Skip to content

LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.

SDK: shape tokens for the shared controls (radii, menu highlight, selection, focus, bordered buttons)

Federico Pereirad93ae831d967
diff --git a/apps/settings/ui.jsx b/apps/settings/ui.jsx
index 09b8e78..eab755c 100644
--- a/apps/settings/ui.jsx
+++ b/apps/settings/ui.jsx
@@ -99,7 +99,7 @@ export const GroupBox = Section;
export function PageHeader({ icon, title, subtitle, children }) {
const t = useTheme();
return (
- <View style={{ flexDirection: 'row', alignItems: 'center', gap: spacing.l, padding: spacing.l, borderRadius: 10,
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: spacing.l, padding: spacing.l, borderRadius: t.groupRadius,
backgroundColor: t.mode === 'dark' ? 'rgba(255,255,255,0.04)' : 'rgba(0,0,0,0.025)', border: `1px solid ${t.separator}` }}>
{icon}
<View style={{ flex: 1, minWidth: 0, gap: 3 }}>
@@ -170,14 +170,20 @@ export function PopUp({ value, options, onChange, width = 190, disabled }) {
const toggle = () => { if (disabled) return; popup.set(open ? null : { node: btn.current, options, value, onChange, width }); };
return (
<View ref={btn} onClick={toggle} onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
- style={{ width, height: 24, paddingHorizontal: 9, borderRadius: 6, flexDirection: 'row', alignItems: 'center', gap: 6,
- backgroundColor: t.control, opacity: disabled ? 0.45 : hover || open ? 0.88 : 1, boxShadow: '0 1px 1px rgba(0,0,0,0.12)' }}>
+ style={{ width, height: 24, paddingHorizontal: 9, borderRadius: t.controlRadiusSmall, flexDirection: 'row', alignItems: 'center', gap: 6,
+ backgroundColor: t.control, opacity: disabled ? 0.45 : hover || open ? 0.88 : 1, boxShadow: '0 1px 1px rgba(0,0,0,0.12)',
+ ...(t.buttonBorder ? { border: `1px solid ${t.separator}` } : null) }}>
{cur && cur[2] ? h(cur[2], { size: 16 }) : null}
<Text style={{ flex: 1, fontSize: 12, color: t.text, whiteSpace: 'nowrap', overflow: 'hidden', textAlign: 'start' }}>{cur ? cur[1] : ''}</Text>
- <View style={{ width: 16, height: 18, borderRadius: 4, backgroundColor: t.accent, alignItems: 'center', justifyContent: 'center' }}>
- <Text style={{ fontSize: 8, color: '#fff', lineHeight: 8 }}>▲</Text>
- <Text style={{ fontSize: 8, color: '#fff', lineHeight: 8 }}>▼</Text>
- </View>
+ {t.menuHighlight === 'subtle'
+ // a drawn chevron (the themes with subtle menus, such as Classic)
+ ? <View style={{ width: 16, height: 18, alignItems: 'center', justifyContent: 'center' }}>
+ <View style={{ width: 6, height: 6, marginTop: -3, borderRightWidth: 1.5, borderBottomWidth: 1.5, borderColor: t.textDim, transform: 'rotate(45deg)' }} />
+ </View>
+ : <View style={{ width: 16, height: 18, borderRadius: 4, backgroundColor: t.accent, alignItems: 'center', justifyContent: 'center' }}>
+ <Text style={{ fontSize: 8, color: '#fff', lineHeight: 8 }}>▲</Text>
+ <Text style={{ fontSize: 8, color: '#fff', lineHeight: 8 }}>▼</Text>
+ </View>}
</View>
);
}
@@ -203,8 +209,8 @@ function PopUpLayer() {
// not clipped by the page's scroll view
return (
<Overlay anchor={p.node}>
- <View ref={menu} style={{ position: 'absolute', left: 0, top: below ? bh + 4 : -4 - height, width: Math.max(bw, p.width), height, padding: 5, borderRadius: 8, overflow: 'hidden',
- backgroundColor: t.mode === 'dark' ? '#2c2c31' : '#ffffff', border: `1px solid ${t.separator}`, boxShadow: '0 10px 30px rgba(0,0,0,0.35)' }}>
+ <View ref={menu} style={{ position: 'absolute', left: 0, top: below ? bh + 4 : -4 - height, width: Math.max(bw, p.width), height, padding: 5, borderRadius: t.menuRadius, overflow: 'hidden',
+ backgroundColor: t.popupBg || (t.mode === 'dark' ? '#2c2c31' : '#ffffff'), border: `1px solid ${t.separator}`, boxShadow: '0 10px 30px rgba(0,0,0,0.35)' }}>
<ScrollView style={{ flex: 1 }}>
{p.options.map(([v, label], i) => (v === '-' ? <View key={`s${i}`} style={{ height: 1, marginVertical: 4, marginHorizontal: 6, backgroundColor: t.separator }} />
: <PopRow key={String(v)} label={label} Icon={p.options[i][2]} checked={v === p.value} onClick={() => { popup.set(null); if (v !== p.value) p.onChange(v); }} />))}
@@ -216,11 +222,13 @@ function PopUpLayer() {
function PopRow({ label, checked, onClick, Icon }) {
const t = useTheme();
- const [hover, setHover] = useState(false);
+ const [lit, setHover] = useState(false);
+ const hover = lit && t.menuHighlight !== 'subtle';
return (
<View onClick={onClick} onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
- style={{ height: 24, paddingHorizontal: 6, borderRadius: 5, flexDirection: 'row', alignItems: 'center', gap: 6, backgroundColor: hover ? t.accent : 'transparent' }}>
- <Text style={{ width: 14, fontSize: 11, color: hover ? '#fff' : t.text }}>{checked ? '✓' : ''}</Text>
+ style={{ height: 24, paddingHorizontal: 6, borderRadius: t.menuItemRadius, flexDirection: 'row', alignItems: 'center', gap: 6,
+ backgroundColor: hover ? t.accent : lit ? t.hover : 'transparent' }}>
+ <Text style={{ width: 14, fontSize: 11, color: hover ? '#fff' : checked && !hover && t.menuHighlight === 'subtle' ? t.accent : t.text }}>{checked ? '✓' : ''}</Text>
{Icon ? <Icon size={16} /> : null}
<Text style={{ flex: 1, fontSize: 12, whiteSpace: 'nowrap', color: hover ? '#fff' : t.text, textAlign: 'start' }}>{label}</Text>
</View>
diff --git a/sdk/components.jsx b/sdk/components.jsx
index 9b6233a..1e44be8 100644
--- a/sdk/components.jsx
+++ b/sdk/components.jsx
@@ -15,10 +15,11 @@ export function Button({ label, onClick, primary, style, small, plain, disabled,
const [hover, setHover] = useState(false);
const fg = primary ? '#fff' : destructive ? '#ff453a' : t.text;
const bg = primary ? t.accent : plain ? (hover && !disabled ? t.hover : 'transparent') : t.control;
+ const border = t.buttonBorder && !plain ? { border: `1px solid ${primary ? t.accent : t.separator}` } : null;
return (
<View onClick={disabled ? undefined : onClick} onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
- style={[{ height: small ? 22 : 28, paddingHorizontal: small ? 10 : 14, borderRadius: small ? 6 : 7, flexDirection: 'row', gap: 6,
- justifyContent: 'center', alignItems: 'center', backgroundColor: bg,
+ style={[{ height: small ? 22 : 28, paddingHorizontal: small ? 10 : 14, borderRadius: small ? t.controlRadiusSmall : t.controlRadius, flexDirection: 'row', gap: 6,
+ justifyContent: 'center', alignItems: 'center', backgroundColor: bg, ...border,
opacity: disabled ? 0.4 : hover && !plain ? 0.85 : 1 }, style]}>
{icon ? <Text style={{ fontSize: small ? 12 : 14, color: fg }}>{icon}</Text> : null}
{label != null && label !== '' ? <Text style={{ fontSize: small ? 12 : 13, fontWeight: 500, color: fg, whiteSpace: 'nowrap' }}>{label}</Text> : null}
@@ -48,11 +49,11 @@ export function Segmented({ options, value, onChange, appearance = 'accent', sma
const neutral = appearance === 'neutral';
const raised = t.mode === 'dark' ? 'rgba(255,255,255,0.18)' : '#ffffff';
return (
- <View style={[{ flexDirection: 'row', backgroundColor: t.control, borderRadius: small ? 6 : 8, padding: 2 }, style]}>
+ <View style={[{ flexDirection: 'row', backgroundColor: t.control, borderRadius: small ? t.controlRadiusSmall : t.controlRadius + 1, padding: 2 }, style]}>
{options.map(([v, label]) => {
const on = value === v;
return (
- <View key={v} onClick={() => onChange(v)} style={{ paddingHorizontal: small ? 10 : 14, height: small ? 18 : 24, borderRadius: small ? 5 : 6,
+ <View key={v} onClick={() => onChange(v)} style={{ paddingHorizontal: small ? 10 : 14, height: small ? 18 : 24, borderRadius: Math.max(2, (small ? t.controlRadiusSmall : t.controlRadius) - 1),
justifyContent: 'center', alignItems: 'center', flexGrow: fill ? 1 : 0,
backgroundColor: on ? (neutral ? raised : t.accent) : 'transparent',
boxShadow: on && neutral ? '0 1px 2px rgba(0,0,0,0.18)' : 'none' }}>
@@ -69,13 +70,18 @@ export function Segmented({ options, value, onChange, appearance = 'accent', sma
export function SidebarItem({ label, selected, onClick, icon, detail, indent = 0 }) {
const t = useTheme();
const [hover, setHover] = useState(false);
+ // selection 'indicator' (a theme token): a light fill and a short accent bar at the leading edge
+ const ind = t.selection === 'indicator';
+ const filled = selected && !ind;
+ const sel = t.mode === 'dark' ? 'rgba(255,255,255,0.09)' : 'rgba(0,0,0,0.06)';
return (
<View onClick={onClick} onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
- style={{ height: 28, paddingLeft: 10 + indent * 14, paddingRight: 10, borderRadius: 6, flexDirection: 'row', alignItems: 'center', gap: 8,
- backgroundColor: selected ? t.accent : hover ? t.hover : 'transparent' }}>
- {typeof icon === 'string' ? <Text style={{ width: 18, textAlign: 'center', fontSize: 14, color: selected ? '#fff' : t.accent }}>{icon}</Text> : icon}
- <Text style={{ flex: 1, fontSize: 13, fontWeight: 500, color: selected ? '#fff' : t.text, whiteSpace: 'nowrap', overflow: 'hidden' }}>{label}</Text>
- {detail != null ? <Text style={{ fontSize: 11, color: selected ? 'rgba(255,255,255,0.8)' : t.textDim }}>{detail}</Text> : null}
+ style={{ height: 28, paddingLeft: 10 + indent * 14, paddingRight: 10, borderRadius: t.controlRadiusSmall, flexDirection: 'row', alignItems: 'center', gap: 8,
+ backgroundColor: filled ? t.accent : selected ? sel : hover ? t.hover : 'transparent' }}>
+ {selected && ind ? <View style={{ position: 'absolute', insetInlineStart: 0, top: 8, width: 3, height: 12, borderRadius: 2, backgroundColor: t.accent }} /> : null}
+ {typeof icon === 'string' ? <Text style={{ width: 18, textAlign: 'center', fontSize: 14, color: filled ? '#fff' : t.accent }}>{icon}</Text> : icon}
+ <Text style={{ flex: 1, fontSize: 13, fontWeight: selected && ind ? 600 : 500, color: filled ? '#fff' : t.text, whiteSpace: 'nowrap', overflow: 'hidden' }}>{label}</Text>
+ {detail != null ? <Text style={{ fontSize: 11, color: filled ? 'rgba(255,255,255,0.8)' : t.textDim }}>{detail}</Text> : null}
</View>
);
}
@@ -211,10 +217,12 @@ export function TextInput({ value, onChange, placeholder, onSubmit, onCancel, on
return (
<View onMouseDown={() => { focusedNow = true; setFocus(token); }}
- style={[{ height: Math.max(28, size + 15), paddingHorizontal: 10, borderRadius: 7, flexDirection: 'row', alignItems: 'center',
+ style={[{ height: Math.max(28, size + 15), paddingHorizontal: 10, borderRadius: t.controlRadius, flexDirection: 'row', alignItems: 'center',
// the cursor goes to the logical end: on the left if the text is Arabic or Hebrew
direction: secure ? 'ltr' : value ? textDirection(value) : 'inherit',
- backgroundColor: t.inputBg, border: `1px solid ${isFocused ? t.accent : t.separator}`, overflow: 'hidden' }, style]}>
+ backgroundColor: t.inputBg, border: `1px solid ${isFocused && t.inputFocus !== 'underline' ? t.accent : t.separator}`, overflow: 'hidden' }, style]}>
+ {/* inputFocus 'underline' (a theme token): an accent line along the bottom edge */}
+ {isFocused && t.inputFocus === 'underline' ? <View style={{ position: 'absolute', left: 0, right: 0, bottom: 0, height: 2, backgroundColor: t.accent, pointerEvents: 'none' }} /> : null}
{value ? <Text style={{ fontSize: size, color: allSel && isFocused ? '#fff' : t.text, whiteSpace: 'nowrap',
backgroundColor: allSel && isFocused ? t.accent : 'transparent' }}>{secure ? '•'.repeat([...value].length) : value}</Text> : null}
{preedit && !secure ? <Preedit st={imeSt} size={size} color={t.text} accent={t.accent} /> : null}
@@ -234,7 +242,7 @@ export function Stepper({ value, onChange, min = -Infinity, max = Infinity, step
</View>
);
return (
- <View style={{ flexDirection: 'row', alignItems: 'center', backgroundColor: t.control, borderRadius: 7, height: 26 }}>
+ <View style={{ flexDirection: 'row', alignItems: 'center', backgroundColor: t.control, borderRadius: t.controlRadius, height: 26 }}>
<Btn label="−" d={-step} />
<Text style={{ width, textAlign: 'center', fontSize: 12, fontWeight: 600, color: t.text }}>{format(value)}</Text>
<Btn label="+" d={step} />
diff --git a/sdk/controls.jsx b/sdk/controls.jsx
index 9469bf4..e576dc5 100644
--- a/sdk/controls.jsx
+++ b/sdk/controls.jsx
@@ -3,7 +3,7 @@
// ("inset") forms. The spacing and type scale they follow is in docs/DESIGN.md.
import { View, Text, addListener } from '@lordos/runtime';
import { useEffect, useRef, useState } from 'react';
-import { useTheme } from './theme.js';
+import { useTheme, popupBg } from './theme.js';
import { TextInput, useAppWindow } from './components.jsx';
import { wm } from './windows.js';
import { direction } from './i18n.js';
@@ -40,8 +40,8 @@ function TooltipBubble({ text, end, top }) {
const t = useTheme();
return (
<View style={{ position: 'absolute', top, [end ? 'right' : 'left']: 0, zIndex: 1000, pointerEvents: 'none',
- paddingHorizontal: 8, height: 22, borderRadius: 6, justifyContent: 'center',
- backgroundColor: t.mode === 'dark' ? '#3a3a40' : '#fbfbfd', border: `1px solid ${t.separator}`, boxShadow: '0 4px 12px rgba(0,0,0,0.25)' }}>
+ paddingHorizontal: 8, height: 22, borderRadius: Math.max(2, t.menuRadius - 2), justifyContent: 'center',
+ backgroundColor: t.popupBg || (t.mode === 'dark' ? '#3a3a40' : '#fbfbfd'), border: `1px solid ${t.separator}`, boxShadow: '0 4px 12px rgba(0,0,0,0.25)' }}>
<Text style={{ fontSize: 11, color: t.text, whiteSpace: 'nowrap' }}>{text}</Text>
</View>
);
@@ -61,7 +61,7 @@ export function ToolbarButton({ icon, label, title, onClick, active, disabled, s
return (
<View ref={ref} onClick={() => { tipLeave(); if (!disabled) onClick?.(); }}
onMouseEnter={() => { setHover(true); tipEnter(); }} onMouseLeave={() => { setHover(false); tipLeave(); }}
- style={[{ height: h, minWidth: h, paddingHorizontal: label ? 8 : 0, borderRadius: controlSize.radiusSmall, flexDirection: 'row', gap: 6,
+ style={[{ height: h, minWidth: h, paddingHorizontal: label ? 8 : 0, borderRadius: t.controlRadiusSmall, flexDirection: 'row', gap: 6,
alignItems: 'center', justifyContent: 'center', opacity: disabled ? 0.45 : 1, zIndex: tip ? 1000 : 0,
backgroundColor: active ? (t.mode === 'dark' ? 'rgba(255,255,255,0.12)' : 'rgba(0,0,0,0.08)') : hover && !disabled ? t.hover : 'transparent' }, style]}>
{icon == null ? null : typeof icon === 'string' || typeof icon === 'number'
@@ -76,7 +76,7 @@ export function ToolbarButton({ icon, label, title, onClick, active, disabled, s
// Buttons that belong together (zoom −/+, markup tools): one rounded track.
export function ToolbarGroup({ children, style }) {
const t = useTheme();
- return <View style={[{ flexDirection: 'row', alignItems: 'center', gap: 2, padding: 2, borderRadius: 8, backgroundColor: t.control }, style]}>{children}</View>;
+ return <View style={[{ flexDirection: 'row', alignItems: 'center', gap: 2, padding: 2, borderRadius: t.controlRadius + 1, backgroundColor: t.control }, style]}>{children}</View>;
}
// The app's toolbar row under the title bar: 44 px, 12 px side insets, 8 px between items and a
@@ -133,7 +133,7 @@ export function MenuButton({ icon = '⋯', title, items, small }) {
{open && (
<Overlay anchor={btn}>
<View ref={menu} style={{ position: 'absolute', top: (small ? controlSize.small : controlSize.regular) + 4, [end ? 'right' : 'left']: 0,
- minWidth: 200, paddingVertical: 5, paddingHorizontal: 5, borderRadius: 8, backgroundColor: t.mode === 'dark' ? '#2c2c31' : '#ffffff',
+ minWidth: 200, paddingVertical: 5, paddingHorizontal: 5, borderRadius: t.menuRadius, backgroundColor: popupBg(t),
border: `1px solid ${t.separator}`, boxShadow: '0 10px 30px rgba(0,0,0,0.35)' }}>
{items.map((it, i) => (it === '-' ? <View key={`s${i}`} style={{ height: 1, marginVertical: 4, marginHorizontal: 6, backgroundColor: t.separator }} />
: <MenuRow key={it.label} it={it} onDone={() => setOpen(false)} />))}
@@ -147,11 +147,12 @@ export function MenuButton({ icon = '⋯', title, items, small }) {
function MenuRow({ it, onDone }) {
const t = useTheme();
const [hover, setHover] = useState(false);
- const on = hover && !it.disabled;
+ const lit = hover && !it.disabled;
+ const on = lit && t.menuHighlight !== 'subtle'; // 'subtle' (a theme token): a light fill, the text keeps its color
return (
<View onClick={() => { if (it.disabled) return; onDone(); it.onClick?.(); }} onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
- style={{ height: 24, paddingHorizontal: 8, borderRadius: 5, flexDirection: 'row', alignItems: 'center', gap: 6, backgroundColor: on ? t.accent : 'transparent',
- opacity: it.disabled ? 0.4 : 1 }}>
+ style={{ height: 24, paddingHorizontal: 8, borderRadius: t.menuItemRadius, flexDirection: 'row', alignItems: 'center', gap: 6,
+ backgroundColor: on ? t.accent : lit ? t.hover : 'transparent', opacity: it.disabled ? 0.4 : 1 }}>
<Text style={{ width: 12, fontSize: 11, color: on ? '#fff' : t.text }}>{it.checked ? '✓' : ''}</Text>
<Text style={{ flex: 1, fontSize: 13, whiteSpace: 'nowrap', color: on ? '#fff' : it.destructive ? '#ff453a' : t.text }}>{it.label}</Text>
</View>
@@ -206,7 +207,7 @@ export function GroupBox({ title, children, footer, style }) {
return (
<View style={[{ gap: 6 }, style]}>
{title ? <Text style={{ fontSize: typeScale.caption, fontWeight: 600, color: t.textDim, marginLeft: spacing.s }}>{title}</Text> : null}
- <View style={{ borderRadius: controlSize.groupRadius, backgroundColor: box, border: `1px solid ${t.separator}`, paddingHorizontal: spacing.m }}>
+ <View style={{ borderRadius: t.groupRadius, backgroundColor: box, border: `1px solid ${t.separator}`, paddingHorizontal: spacing.m }}>
{rows.map((r, i) => (
<View key={i}>
{i > 0 ? <View style={{ height: 1, backgroundColor: t.separator }} /> : null}
@@ -246,7 +247,7 @@ export function ConfirmDialog({ title, detail, okLabel, cancelLabel, onOk, onCan
return (
<View onClick={onCancel} style={{ position: 'absolute', left: a.x, top: a.y, ...(a.w ? { width: a.w, height: a.h } : { right: 0, bottom: 0 }),
backgroundColor: 'rgba(0,0,0,0.3)', alignItems: 'center', justifyContent: 'center' }}>
- <View onClick={(e) => e.stopPropagation()} style={{ width: 360, padding: spacing.xl, gap: spacing.s, borderRadius: 12, backgroundColor: t.windowBg,
+ <View onClick={(e) => e.stopPropagation()} style={{ width: 360, padding: spacing.xl, gap: spacing.s, borderRadius: t.groupRadius + 2, backgroundColor: t.windowBg,
border: `1px solid ${t.separator}`, boxShadow: '0 14px 36px rgba(0,0,0,0.45)' }}>
<Text style={{ fontSize: typeScale.headline, fontWeight: 600, color: t.text, textAlign: 'start' }}>{title}</Text>
{detail ? <Text style={{ fontSize: typeScale.body, color: t.textDim, lineHeight: 1.4, textAlign: 'start' }}>{detail}</Text> : null}
@@ -263,8 +264,8 @@ function DialogButton({ t, label, onClick, primary, destructive }) {
const bg = primary ? (destructive ? '#e5483f' : t.accent) : t.control;
return (
<View onClick={onClick} onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
- style={{ height: controlSize.regular, paddingHorizontal: 14, borderRadius: controlSize.radius, justifyContent: 'center', alignItems: 'center',
- backgroundColor: bg, opacity: hover ? 0.85 : 1 }}>
+ style={{ height: controlSize.regular, paddingHorizontal: 14, borderRadius: t.controlRadius, justifyContent: 'center', alignItems: 'center',
+ backgroundColor: bg, opacity: hover ? 0.85 : 1, ...(t.buttonBorder && !primary ? { border: `1px solid ${t.separator}` } : null) }}>
<Text style={{ fontSize: typeScale.body, fontWeight: 500, color: primary ? '#fff' : t.text, whiteSpace: 'nowrap' }}>{label}</Text>
</View>
);
diff --git a/sdk/power.jsx b/sdk/power.jsx
index 74aed7d..84ef45d 100644
--- a/sdk/power.jsx
+++ b/sdk/power.jsx
@@ -63,7 +63,7 @@ function Button({ th, label, onClick, primary, disabled }) {
const bg = primary ? '#e5483f' : th.control;
return h(View, {
onClick: disabled ? undefined : onClick, onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false),
- style: { height: controlSize.regular, paddingHorizontal: 14, borderRadius: controlSize.radius, justifyContent: 'center', alignItems: 'center',
+ style: { height: controlSize.regular, paddingHorizontal: 14, borderRadius: th.controlRadius ?? controlSize.radius, justifyContent: 'center', alignItems: 'center',
backgroundColor: bg, opacity: disabled ? 0.45 : hover ? 0.85 : 1 },
}, h(Text, { style: { fontSize: typeScale.body, fontWeight: 500, color: primary ? '#fff' : th.text, whiteSpace: 'nowrap' } }, label));
}
@@ -126,7 +126,7 @@ export function PowerDialog() {
style: { position: 'absolute', left: a.x, top: a.y, width: a.w, height: a.h, backgroundColor: 'rgba(0,0,0,0.3)', alignItems: 'center', justifyContent: 'center' },
}, h(View, {
onClick: (e) => e.stopPropagation(),
- style: { width: 400, padding: spacing.xl, gap: spacing.s, borderRadius: 12, backgroundColor: th.windowBg, border: `1px solid ${th.separator}`,
+ style: { width: 400, padding: spacing.xl, gap: spacing.s, borderRadius: (th.groupRadius ?? 10) + 2, backgroundColor: th.windowBg, border: `1px solid ${th.separator}`,
boxShadow: '0 14px 36px rgba(0,0,0,0.45)' },
},
h(Text, { style: { fontSize: typeScale.headline, fontWeight: 600, color: th.text, textAlign: 'start' } },
diff --git a/sdk/theme.js b/sdk/theme.js
index 72351c8..20566d2 100644
--- a/sdk/theme.js
+++ b/sdk/theme.js
@@ -17,8 +17,23 @@ export const DEFAULT_TOKENS = {
inputBg: '#2c2c31',
radius: 8,
wallpapers: [], // [{ id, nameKey (locale key), name (English fallback), src }]
+ // Shape and style of the shared controls (sdk/components.jsx, sdk/controls.jsx). A theme changes
+ // them to give every app its look without touching the apps (docs/DESIGN.md, "Theme tokens").
+ controlRadius: 7, // Button, TextInput, SearchField, Stepper, dialog buttons
+ controlRadiusSmall: 6, // small buttons, toolbar buttons, sidebar rows
+ groupRadius: 10, // GroupBox (inset forms)
+ menuRadius: 8, // MenuButton menus, tooltips use menuRadius - 2
+ menuItemRadius: 5,
+ menuHighlight: 'accent', // 'accent': the hovered item is filled with the accent; 'subtle': a light fill
+ selection: 'fill', // SidebarItem: 'fill' (accent background) or 'indicator' (light fill and an accent bar)
+ inputFocus: 'ring', // TextInput: 'ring' (accent border) or 'underline' (accent line at the bottom)
+ buttonBorder: false, // Button: a 1 px border around neutral buttons
+ popupBg: null, // menus and tooltips; null = a light or dark surface for the mode
};
+// The surface of menus, tooltips and popovers for a theme (popupBg, or one for the mode).
+export const popupBg = (t) => t.popupBg || (t.mode === 'dark' ? '#2c2c31' : '#ffffff');
+
const ThemeContext = createContext(DEFAULT_TOKENS);
// Isolated .lpk apps (another process) receive these same tokens live through the broker