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.

Passwords: final polish pass (drawn glyphs, sidebar, list/detail, editor, generator, lock screens); RTL direction for isolated apps; more brand names in brand-check

Federico Pereiraa07ad6ee0afc
diff --git a/apps/passwords/Detail.jsx b/apps/passwords/Detail.jsx
index 306be3f..45d46db 100644
--- a/apps/passwords/Detail.jsx
+++ b/apps/passwords/Detail.jsx
@@ -1,21 +1,23 @@
-// Detail.jsx — una entrada: verla (campos con mostrar/copiar, código 2FA con cuenta regresiva,
-// QR del Wi-Fi, notas, adjuntos, historial, recordatorio de cambio) y editarla (plantilla de su
-// categoría, campos propios, etiquetas, generador, 2FA desde un QR).
+// Detail.jsx — one item: viewing it (fields with show/copy, the 2FA code with its countdown, the
+// Wi-Fi QR, notes, attachments, history, the change reminder) and editing it (its category's
+// template, own fields, tags, the generator, 2FA from a QR). Layout per docs/DESIGN.md: a
+// largeTitle header, fields in an inset group, one primary action (Edit / Save).
import {
- View, Text, Image, useTheme, useStore, Button, TextInput, Toggle, ScrollView, Markdown, wm, formatDate, formatTime, formatBytes, t,
+ View, Text, Image, useTheme, useStore, Button, TextInput, Toggle, ScrollView, Markdown, EmptyState, textDirection, direction, wm, formatDate, formatTime, formatBytes, t,
} from '@lordos/sdk';
import { useEffect, useRef, useState } from 'react';
import { app, req, copySecret, copyText, revealField, upsertItem, dropItem, toast, errorText, appMode } from './api.js';
import { builtinById, fieldLabel, templateFields, allCategories, catName, FIELD_TYPES } from './templates.js';
import {
- EntryIcon, CatIcon, Sheet, b64ToBytes, fileReq, fileName, Label, Hint, Warning, QrImage, TextArea, FilePicker, Choice, IconButton, Chip, StrengthBar, RED, ORANGE,
+ EntryIcon, Sheet, b64ToBytes, fileReq, fileName, Label, Hint, Warning, QrImage, TextArea, FilePicker, Choice, IconButton, Chip, StrengthBar, Group, RED,
} from './ui.jsx';
+import { Glyph } from './glyphs.jsx';
import { GeneratorSheet } from './Generator.jsx';
const HIDDEN = new Set(['hidden', 'totp', 'pin']);
const DAY = 86400;
-// ---- código 2FA ----
+// ---- 2FA code ----
function TotpBox({ v, id }) {
const th = useTheme();
@@ -50,14 +52,16 @@ function TotpBox({ v, id }) {
const frac = c.period ? left / c.period : 0;
const shown = c.code.length === 6 ? `${c.code.slice(0, 3)} ${c.code.slice(3)}` : c.code;
return (
- <View key={c.k} style={{ gap: 6, padding: 12, borderRadius: 10, backgroundColor: th.control }}>
+ <View key={c.k} style={{ gap: 6, paddingTop: 2, paddingBottom: 4 }}>
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 10 }}>
- <Text style={{ flex: 1, fontSize: 26, fontWeight: 600, fontFamily: 'monospace', color: left <= 5 ? RED : th.text, direction: 'ltr' }}>{shown}</Text>
- <Text style={{ fontSize: 13, color: th.textDim }}>{t('passwords.totp.left', { s: left })}</Text>
- <IconButton glyph="⧉" onClick={() => copySecret(c.code, t('passwords.totp.code'))} />
+ <View style={{ flex: 1, minWidth: 0, alignItems: 'flex-start' }}>
+ <Text style={{ fontSize: 22, fontWeight: 600, fontFamily: 'monospace', color: left <= 5 ? RED : th.text, direction: 'ltr' }}>{shown}</Text>
+ </View>
+ <Text style={{ fontSize: 12, color: left <= 5 ? RED : th.textDim }}>{t('passwords.totp.left', { s: left })}</Text>
+ <IconButton glyph="⧉" tip={t('passwords.copy')} onClick={() => copySecret(c.code, t('passwords.totp.code'))} />
</View>
- <View style={{ height: 4, borderRadius: 2, backgroundColor: th.windowBg, direction: 'ltr' }}>
- <View style={{ width: `${Math.round(frac * 100)}%`, height: 4, borderRadius: 2, backgroundColor: left <= 5 ? RED : th.accent }} />
+ <View style={{ height: 3, borderRadius: 2, backgroundColor: th.control, direction: 'ltr' }}>
+ <View style={{ width: `${Math.round(frac * 100)}%`, height: 3, borderRadius: 2, backgroundColor: left <= 5 ? RED : th.accent }} />
</View>
{(c.issuer || c.account) && <Text style={{ fontSize: 11, color: th.textDim }}>{[c.issuer, c.account].filter(Boolean).join(' · ')}</Text>}
</View>
@@ -65,14 +69,14 @@ function TotpBox({ v, id }) {
});
}
-// ---- un campo (ver) ----
+// ---- one field (view) ----
function FieldRow({ v, entry, f, index }) {
const th = useTheme();
const [shown, setShown] = useState(null);
useEffect(() => { setShown(null); }, [entry.id, f.k]);
if (f.t === 'totp') return (
- <View style={{ gap: 4 }}>
+ <View style={{ gap: 4, paddingVertical: 8 }}>
<Label>{fieldLabel(f)}</Label>
<TotpBox v={v} id={entry.id} />
</View>
@@ -95,20 +99,22 @@ function FieldRow({ v, entry, f, index }) {
if (f.k === 'security' && f.v === 'none') value = t('passwords.wifi.open');
if (!value && !hidden) return null;
const multi = String(value).includes('\n');
+ const mono = hidden || f.t === 'pin';
return (
- <View style={{ gap: 3, paddingVertical: 6, borderBottom: `1px solid ${th.separator}` }}>
- <Label>{label}</Label>
- <View style={{ flexDirection: 'row', alignItems: multi ? 'flex-start' : 'center', gap: 6 }}>
- <Text style={{ flex: 1, fontSize: 14, color: f.t === 'url' ? th.accent : th.text, lineHeight: 19,
- fontFamily: hidden || f.t === 'pin' ? 'monospace' : undefined, direction: hidden ? 'ltr' : undefined }}>{value}</Text>
- {hidden && f.has && <IconButton glyph={shown != null ? '◉' : '👁'} onClick={reveal} />}
- {(f.has || !hidden) && <IconButton glyph="⧉" onClick={copy} />}
+ <View style={{ flexDirection: 'row', alignItems: multi ? 'flex-start' : 'center', gap: 6, paddingVertical: 8 }}>
+ <View style={{ flex: 1, minWidth: 0, gap: 2 }}>
+ <Label>{label}</Label>
+ {/* the value keeps its own direction and sits at the start of the row (the right in RTL) */}
+ <Text style={{ alignSelf: 'flex-start', maxWidth: '100%', fontSize: 13, color: f.t === 'url' ? th.accent : th.text, lineHeight: 18, fontFamily: mono ? 'monospace' : undefined,
+ direction: mono ? 'ltr' : textDirection(value), ...(multi ? {} : { whiteSpace: 'nowrap', textOverflow: 'ellipsis' }) }}>{value}</Text>
</View>
+ {hidden && f.has && <IconButton glyph={{ kind: shown != null ? 'eyeOff' : 'eye' }} tip={shown != null ? t('passwords.hide') : t('passwords.show')} onClick={reveal} />}
+ {(f.has || !hidden) && <IconButton glyph="⧉" tip={t('passwords.copy')} onClick={copy} />}
</View>
);
}
-// ---- adjuntos ----
+// ---- attachments ----
function Attachments({ v, entry, onChanged }) {
const th = useTheme();
@@ -130,24 +136,24 @@ function Attachments({ v, entry, onChanged }) {
};
const mimeOf = (name) => (/\.png$/i.test(name) ? 'image/png' : /\.jpe?g$/i.test(name) ? 'image/jpeg' : /\.(txt|key|lic|md)$/i.test(name) ? 'text/plain' : 'application/octet-stream');
return (
- <View style={{ gap: 6 }}>
- <View style={{ flexDirection: 'row', alignItems: 'center' }}>
- <Text style={{ flex: 1, fontSize: 13, fontWeight: 600, color: th.text }}>{t('passwords.att.title')}</Text>
- <Button label={t('passwords.att.add')} onClick={() => setAdding(true)} />
+ <View style={{ gap: 8 }}>
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
+ <Text style={{ flex: 1, minWidth: 0, fontSize: 13, fontWeight: 600, color: th.text }}>{t('passwords.att.title')}</Text>
+ <Button small label={t('passwords.att.add')} onClick={() => setAdding(true)} />
</View>
{!entry.att?.length && <Hint>{t('passwords.att.none')}</Hint>}
- {(entry.att || []).map((a) => (
- <View key={a.id} style={{ flexDirection: 'row', alignItems: 'center', gap: 8, padding: 8, borderRadius: 8, backgroundColor: th.control }}>
- <Text style={{ fontSize: 16 }}>{isImage(a) ? '🖼️' : '📎'}</Text>
- <View style={{ flex: 1 }}>
- <Text style={{ fontSize: 13, color: th.text, whiteSpace: 'nowrap', overflow: 'hidden' }}>{a.name}</Text>
+ {entry.att?.length ? <Group>{(entry.att || []).map((a) => (
+ <View key={a.id} style={{ flexDirection: 'row', alignItems: 'center', gap: 10, paddingVertical: 8 }}>
+ <Glyph kind={isImage(a) ? 'image' : 'clip'} size={16} color={th.textDim} />
+ <View style={{ flex: 1, minWidth: 0 }}>
+ <Text style={{ fontSize: 13, color: th.text, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{a.name}</Text>
<Text style={{ fontSize: 11, color: th.textDim }}>{formatBytes(a.size)}</Text>
</View>
- {(isImage(a) || isText(a)) && <IconButton glyph="👁" onClick={() => open(a)} />}
- <IconButton glyph="⬇" onClick={() => setSaveAtt(a)} />
- <IconButton glyph="✕" onClick={async () => { try { const r = await req('att-del', { v, id: entry.id, att: a.id }); upsertItem(r.item); onChanged(); } catch (e) { toast(errorText(e.code)); } }} />
+ {(isImage(a) || isText(a)) && <IconButton glyph={{ kind: 'eye' }} tip={t('passwords.att.view')} onClick={() => open(a)} />}
+ <IconButton glyph="↓" tip={t('passwords.att.save')} onClick={() => setSaveAtt(a)} />
+ <IconButton glyph="✕" tip={t('passwords.att.remove')} onClick={async () => { try { const r = await req('att-del', { v, id: entry.id, att: a.id }); upsertItem(r.item); onChanged(); } catch (e) { toast(errorText(e.code)); } }} />
</View>
- ))}
+ ))}</Group> : null}
{view && (
<Sheet title={view.a.name} onClose={() => setView(null)} width={view.img ? Math.max(360, view.img.width + 40) : 520}>
{view.img ? <Image pixels={view.img} style={{ width: view.img.width, height: view.img.height, borderRadius: 6 }} />
@@ -170,7 +176,7 @@ function Attachments({ v, entry, onChanged }) {
);
}
-// ---- historial ----
+// ---- history ----
function History({ v, entry }) {
const th = useTheme();
@@ -180,15 +186,15 @@ function History({ v, entry }) {
if (!hist.length) return null;
return (
<View style={{ gap: 6 }}>
- <View onClick={() => setOpen(!open)} style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>
- <Text style={{ fontSize: 11, color: th.textDim }}>{open ? '▾' : '▸'}</Text>
+ <View onClick={() => setOpen(!open)} style={{ flexDirection: 'row', alignItems: 'center', gap: 6, height: 24 }}>
+ <Text style={{ fontSize: 8, color: th.textDim, transform: open ? 'rotate(90deg)' : direction() === 'rtl' ? 'rotate(180deg)' : undefined }}>▶</Text>
<Text style={{ fontSize: 13, fontWeight: 600, color: th.text }}>{t('passwords.hist.title', { count: hist.length })}</Text>
</View>
{open && (
<View style={{ gap: 6 }}>
- {!full && <Button label={t('passwords.hist.reveal')} onClick={async () => { try { setFull((await req('get', { v, id: entry.id, hist: true, reveal: true })).entry.hist); } catch (e) { toast(errorText(e.code)); } }} style={{ alignSelf: 'flex-start' }} />}
+ {!full && <Button small label={t('passwords.hist.reveal')} onClick={async () => { try { setFull((await req('get', { v, id: entry.id, hist: true, reveal: true })).entry.hist); } catch (e) { toast(errorText(e.code)); } }} style={{ alignSelf: 'flex-start' }} />}
{hist.map((h, i) => (
- <View key={i} style={{ padding: 8, borderRadius: 8, backgroundColor: th.control, gap: 3 }}>
+ <View key={i} style={{ paddingHorizontal: 12, paddingVertical: 8, borderRadius: 8, border: `1px solid ${th.separator}`, gap: 3 }}>
<Text style={{ fontSize: 11, color: th.textDim }}>{`${formatDate(new Date(h.t * 1000))} ${formatTime(new Date(h.t * 1000))}`}</Text>
{h.title !== entry.title && <Text style={{ fontSize: 12, color: th.text }}>{`${t('passwords.edit.title')}: ${h.title}`}</Text>}
{(h.f || []).map((f, k) => (
@@ -202,7 +208,7 @@ function History({ v, entry }) {
);
}
-// ---- ver una entrada ----
+// ---- view an item ----
export function EntryView({ v, id, onEdit, onDeleted }) {
const th = useTheme();
@@ -210,12 +216,14 @@ export function EntryView({ v, id, onEdit, onDeleted }) {
const [e, setE] = useState(null);
const [qr, setQr] = useState(null);
const [err, setErr] = useState('');
+ const boxRef = useRef(null);
+ const paneW = usePaneWidth(boxRef, 480);
const load = async () => {
try { setE((await req('get', { v, id, hist: true })).entry); setErr(''); } catch (x) { setErr(errorText(x.code)); setE(null); }
};
useEffect(() => { setQr(null); load(); }, [id, v]);
- if (err) return <Center text={err} />;
- if (!e) return <Center text="" />;
+ if (err) return <EmptyState icon={<Glyph kind="lock" size={36} color={th.textDim} />} title={err} />;
+ if (!e) return <View ref={boxRef} style={{ flex: 1 }} />;
const cat = allCategories(cats).find((c) => c.id === e.cat) || builtinById(e.cat) || { id: e.cat };
const b = builtinById(cat.template || e.cat) || builtinById(e.cat);
const act = async (op, extra = {}) => {
@@ -233,51 +241,57 @@ export function EntryView({ v, id, onEdit, onDeleted }) {
const ageDays = pwField && since ? Math.floor((now - since) / DAY) : null;
const dueIn = e.rotate && ageDays != null ? e.rotate - ageDays : null;
const seen = {};
+ const compact = paneW < 420;
+ const fields = e.f.map((f) => { const i = seen[f.k] = (seen[f.k] ?? -1) + 1; return <FieldRow key={`${f.k}-${i}`} v={v} entry={e} f={f} index={i} />; });
return (
<ScrollView style={{ flex: 1 }}>
- <View style={{ padding: 22, gap: 14 }}>
- <View style={{ flexDirection: 'row', alignItems: 'center', gap: 14 }}>
- <EntryIcon entry={{ ...e, url: e.f.find((f) => f.k === 'url')?.v }} cat={cat} size={58} />
- <View style={{ flex: 1, gap: 4 }}>
- <Text style={{ fontSize: 22, fontWeight: 700, color: th.text }}>{e.title || t('passwords.untitled')}</Text>
- <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 5, alignItems: 'center' }}>
+ <View ref={boxRef} style={{ paddingHorizontal: 24, paddingTop: 20, paddingBottom: 24, gap: 16 }}>
+ <View style={{ flexDirection: 'row', alignItems: 'flex-start', gap: 14 }}>
+ <EntryIcon entry={{ ...e, url: e.f.find((f) => f.k === 'url')?.v }} cat={cat} size={compact ? 44 : 52} />
+ <View style={{ flex: 1, minWidth: 0, gap: 6, paddingTop: 2 }}>
+ <Text style={{ alignSelf: 'flex-start', maxWidth: '100%', fontSize: compact ? 17 : 22, fontWeight: 600, color: th.text, lineHeight: compact ? 22 : 27,
+ maxHeight: compact ? 44 : 54, overflow: 'hidden', textOverflow: 'ellipsis', numberOfLines: 2, direction: textDirection(e.title || '') }}>{e.title || t('passwords.untitled')}</Text>
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 6, alignItems: 'center' }}>
<Chip label={catName(cat)} color={cat.color || b?.color} />
{(e.tags || []).map((tg) => <Chip key={tg} label={`#${tg}`} color={tagColor(tg)} />)}
</View>
</View>
- {v === 'main' && <IconButton glyph={e.fav ? '★' : '☆'} active={e.fav} onClick={() => act('fav', { on: !e.fav })} />}
- {!e.trash && <Button primary label={t('passwords.edit.button')} onClick={() => onEdit(e)} />}
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: 6, paddingTop: compact ? 8 : 12 }}>
+ {v === 'main' && <IconButton glyph={e.fav ? '★' : '☆'} active={e.fav} color={e.fav ? '#ffb300' : undefined}
+ tip={e.fav ? t('passwords.unfav') : t('passwords.fav')} onClick={() => act('fav', { on: !e.fav })} />}
+ {!e.trash && <Button primary label={t('passwords.edit.button')} onClick={() => onEdit(e)} />}
+ </View>
</View>
{e.trash ? <Warning>{t('passwords.trash.inTrash')}</Warning> : null}
- {b?.warning && <Warning>{t('passwords.crypto.warning')}</Warning>}
+ {b?.warning && <Warning tone="orange">{t('passwords.crypto.warning')}</Warning>}
{dueIn != null && (
- <View style={{ flexDirection: 'row', gap: 8, padding: 10, borderRadius: 9, backgroundColor: dueIn <= 0 ? 'rgba(255,69,58,0.14)' : th.control }}>
- <Text style={{ fontSize: 14 }}>⏰</Text>
- <Text style={{ flex: 1, fontSize: 12, color: dueIn <= 0 ? RED : th.text }}>
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: 10, paddingHorizontal: 12, paddingVertical: 10, borderRadius: 10,
+ backgroundColor: dueIn <= 0 ? 'rgba(255,69,58,0.10)' : th.control }}>
+ <Glyph kind="clock" size={15} color={dueIn <= 0 ? RED : th.textDim} />
+ <Text style={{ flex: 1, fontSize: 12, lineHeight: 17, color: dueIn <= 0 ? RED : th.text }}>
{dueIn <= 0 ? t('passwords.rotate.overdue', { days: e.rotate, ago: -dueIn }) : t('passwords.rotate.due', { days: e.rotate, left: dueIn })}
</Text>
</View>
)}
- <View>
- {e.f.map((f) => { const i = seen[f.k] = (seen[f.k] ?? -1) + 1; return <FieldRow key={`${f.k}-${i}`} v={v} entry={e} f={f} index={i} />; })}
- </View>
+ {fields.length ? <Group>{fields}</Group> : null}
{(e.cat === 'wifi' || b?.id === 'wifi') && (
- <View style={{ gap: 8, alignItems: 'flex-start' }}>
- <Button label={qr ? t('passwords.wifi.hideQr') : t('passwords.wifi.showQr')} onClick={async () => {
+ <View style={{ gap: 10, alignItems: 'flex-start' }}>
+ <Button small label={qr ? t('passwords.wifi.hideQr') : t('passwords.wifi.showQr')} onClick={async () => {
if (qr) { setQr(null); return; }
try { setQr(await req('qr', { v, id: e.id })); } catch (x) { toast(errorText(x.code)); }
}} />
- {qr && <View style={{ padding: 10, borderRadius: 12, backgroundColor: '#fff', gap: 6, alignItems: 'center' }}>
- <QrImage qr={qr} scale={Math.max(3, Math.floor(260 / (qr.size + 8)))} />
+ {qr && <View style={{ padding: 12, borderRadius: 12, backgroundColor: '#fff', gap: 6, alignItems: 'center', border: `1px solid ${th.separator}` }}>
+ <QrImage qr={qr} scale={Math.max(3, Math.floor(Math.min(240, paneW - 80) / (qr.size + 8)))} />
<Text style={{ fontSize: 11, color: '#333' }}>{t('passwords.wifi.scan')}</Text>
</View>}
</View>
)}
- {b?.settingsLink && !appMode && <Button label={t('passwords.vpn.openSettings')} onClick={() => wm.open('settings', { args: { page: 'network' } })} style={{ alignSelf: 'flex-start' }} />}
+ {b?.settingsLink && !appMode && <Button small label={t('passwords.vpn.openSettings')} onClick={() => wm.open('settings', { args: { page: 'network' } })} style={{ alignSelf: 'flex-start' }} />}
{e.notes ? (
- <View style={{ gap: 4 }}>
+ <View style={{ gap: 6 }}>
<Label>{t('passwords.field.notes')}</Label>
- <View style={{ padding: 10, borderRadius: 8, backgroundColor: th.control }}><Markdown source={e.notes} width={460} /></View>
+ <View style={{ paddingHorizontal: 12, paddingVertical: 10, borderRadius: 10, border: `1px solid ${th.separator}`,
+ backgroundColor: th.mode === 'dark' ? 'rgba(255,255,255,0.04)' : 'rgba(0,0,0,0.025)' }}><Markdown source={e.notes} width={Math.max(160, paneW - 74)} /></View>
</View>
) : null}
{v === 'main' && !e.trash && <Attachments v={v} entry={e} onChanged={load} />}
@@ -285,23 +299,35 @@ export function EntryView({ v, id, onEdit, onDeleted }) {
<Text style={{ fontSize: 11, color: th.textDim }}>
{t('passwords.dates', { created: formatDate(new Date(e.created * 1000)), modified: `${formatDate(new Date(e.modified * 1000))} ${formatTime(new Date(e.modified * 1000))}` })}
</Text>
- <View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
- {v === 'main' && !e.trash && <Button label={e.arch ? t('passwords.unarchive') : t('passwords.archive')} onClick={() => act('archive', { on: !e.arch })} />}
- {!e.trash && v === 'main' && <Button label={t('passwords.trash.move')} onClick={() => act('trash')} />}
- {e.trash ? <Button label={t('passwords.trash.restore')} onClick={() => act('restore')} /> : null}
- {(e.trash || v === 'login') ? <Button label={t('passwords.trash.purge')} onClick={() => act('purge')} style={{ backgroundColor: 'rgba(255,69,58,0.2)' }} /> : null}
+ <View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap', paddingTop: 12, borderTopWidth: 1, borderTopColor: th.separator }}>
+ {v === 'main' && !e.trash && <Button small label={e.arch ? t('passwords.unarchive') : t('passwords.archive')} onClick={() => act('archive', { on: !e.arch })} />}
+ {!e.trash && v === 'main' && <Button small destructive label={t('passwords.trash.move')} onClick={() => act('trash')} />}
+ {e.trash ? <Button small label={t('passwords.trash.restore')} onClick={() => act('restore')} /> : null}
+ {(e.trash || v === 'login') ? <Button small destructive label={t('passwords.trash.purge')} onClick={() => act('purge')} /> : null}
</View>
</View>
</ScrollView>
);
}
+// The width of a box after layout (measured again on every render).
+function usePaneWidth(ref, initial) {
+ const [w, setW] = useState(initial);
+ useEffect(() => {
+ const id = setTimeout(() => {
+ try { if (ref.current) { const nw = lord.getLayout(ref.current.id)[2]; if (nw && Math.abs(nw - w) > 0.5) setW(nw); } } catch (x) { /* not laid out */ }
+ }, 20);
+ return () => clearTimeout(id);
+ });
+ return w;
+}
+
export function Center({ text, children }) {
const th = useTheme();
return (
- <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center', gap: 10, padding: 20 }}>
+ <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center', gap: 8, padding: 24 }}>
{children}
- <Text style={{ fontSize: 13, color: th.textDim, textAlign: 'center' }}>{text}</Text>
+ {text ? <Text style={{ fontSize: 13, color: th.textDim, textAlign: 'center', maxWidth: 360, lineHeight: 18 }}>{text}</Text> : null}
</View>
);
}
@@ -315,7 +341,7 @@ export function tagColor(name) {
return ['#0a84ff', '#5e5ce6', '#bf5af2', '#ff375f', '#ff9f0a', '#30d158', '#64d2ff', '#ac8e68'][h % 8];
}
-// ---- editar / crear ----
+// ---- edit / create ----
function FieldEditor({ f, onChange, onRemove, onGenerate, onQr }) {
const th = useTheme();
@@ -328,28 +354,29 @@ function FieldEditor({ f, onChange, onRemove, onGenerate, onQr }) {
const opts = f.choices.map((c) => [c, f.k === 'doc_type' ? t(`passwords.doc.${c}`) : f.k === 'security' && c === 'none' ? t('passwords.wifi.open') : c]);
input = <Choice value={f.v} options={opts} onChange={set} width={240} />;
} else if (f.multiline || f.t === 'multiline') {
- input = <View style={{ flex: 1 }}>{f.keep ? <Button label={t('passwords.edit.replaceSecret')} onClick={() => set('')} /> : <TextArea value={f.v || ''} onChange={set} mono={hidden} secure={hidden && !show} minHeight={70} />}</View>;
+ input = <View style={{ flex: 1, minWidth: 0, alignItems: f.keep ? 'flex-start' : 'stretch' }}>{f.keep ? <Button small label={t('passwords.edit.replaceSecret')} onClick={() => set('')} /> : <TextArea value={f.v || ''} onChange={set} mono={hidden} secure={hidden && !show} minHeight={70} />}</View>;
} else if (f.keep) {
- input = <View style={{ flex: 1, flexDirection: 'row', gap: 6, alignItems: 'center' }}>
- <Text style={{ flex: 1, fontSize: 13, color: th.textDim }}>{t('passwords.edit.keptSecret')}</Text>
- <Button label={t('passwords.edit.replaceSecret')} onClick={() => set('')} />
+ input = <View style={{ flex: 1, minWidth: 0, height: 28, flexDirection: 'row', gap: 8, alignItems: 'center', paddingHorizontal: 10, borderRadius: 7,
+ border: `1px dashed ${th.separator}` }}>
+ <Text style={{ flex: 1, minWidth: 0, fontSize: 13, color: th.textDim, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{t('passwords.edit.keptSecret')}</Text>
+ <Button small plain label={t('passwords.edit.replaceSecret')} onClick={() => set('')} style={{ marginInlineEnd: -6 }} />
</View>;
} else {
- input = <TextInput value={f.v || ''} onChange={set} secure={hidden && !show} placeholder={f.t === 'totp' ? t('passwords.totp.placeholder') : f.t === 'date' ? t('passwords.edit.datePh') : ''} style={{ flex: 1 }} />;
+ input = <TextInput value={f.v || ''} onChange={set} secure={hidden && !show} placeholder={f.t === 'totp' ? t('passwords.totp.placeholder') : f.t === 'date' ? t('passwords.edit.datePh') : ''} style={{ flex: 1, minWidth: 0 }} />;
}
return (
- <View style={{ gap: 4 }}>
- <View style={{ flexDirection: 'row', alignItems: 'center' }}>
- <View style={{ flex: 1 }}>{f.custom
- ? <TextInput value={f.l || ''} onChange={(l) => onChange({ ...f, l })} placeholder={t('passwords.edit.fieldName')} size={11} style={{ height: 24, width: 200 }} />
+ <View style={{ gap: 6 }}>
+ <View style={{ flexDirection: 'row', alignItems: 'center', minHeight: 16, gap: 8 }}>
+ <View style={{ flex: 1, minWidth: 0 }}>{f.custom
+ ? <TextInput value={f.l || ''} onChange={(l) => onChange({ ...f, l })} placeholder={t('passwords.edit.fieldName')} size={12} style={{ height: 24, width: 200 }} />
: <Label>{fieldLabel(f)}</Label>}</View>
- {onRemove && <Text onClick={onRemove} style={{ fontSize: 11, color: th.textDim }}>{t('passwords.edit.removeField')}</Text>}
+ {onRemove && <Button small plain destructive label={t('passwords.edit.removeField')} onClick={onRemove} />}
</View>
- <View style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: 4 }}>
{input}
- {hidden && !f.keep && !f.multiline && <IconButton glyph={show ? '◉' : '👁'} onClick={() => setShow(!show)} />}
- {f.k === 'password' && !f.keep && <IconButton glyph="⚄" title={t('passwords.edit.generate')} onClick={onGenerate} />}
- {f.t === 'totp' && <IconButton glyph="▦" title={t('passwords.totp.fromQr')} onClick={onQr} />}
+ {hidden && !f.keep && !f.multiline && <IconButton glyph={{ kind: show ? 'eyeOff' : 'eye' }} tip={show ? t('passwords.hide') : t('passwords.show')} onClick={() => setShow(!show)} />}
+ {f.k === 'password' && !f.keep && <IconButton glyph="⚄" label={t('passwords.edit.generate')} tip={t('passwords.menu.generator')} onClick={onGenerate} />}
+ {f.t === 'totp' && <IconButton glyph="▦" label={t('passwords.totp.fromQr')} onClick={onQr} />}
</View>
</View>
);
@@ -376,13 +403,15 @@ export function EntryEditor({ v, entry, catId, onDone, onCancel }) {
return { ...f, multiline: tf?.multiline, choices: tf?.choices, keep: HIDDEN.has(f.t) && f.has && f.v == null, v: f.v ?? '', custom: !tf && !!f.l };
});
});
- const [gen, setGen] = useState(null); // índice del campo que recibe la contraseña generada
+ const [gen, setGen] = useState(null); // index of the field that gets the generated password
const [qrFor, setQrFor] = useState(null);
const [adding, setAdding] = useState(false);
const [newType, setNewType] = useState('text');
const [err, setErr] = useState('');
const [busy, setBusy] = useState(false);
const [strength, setStrength] = useState(null);
+ const boxRef = useRef(null);
+ const paneW = usePaneWidth(boxRef, 480);
const pw = fields.find((f) => f.k === 'password' && !f.keep)?.v || '';
useEffect(() => {
if (!pw) { setStrength(null); return; }
@@ -423,23 +452,24 @@ export function EntryEditor({ v, entry, catId, onDone, onCancel }) {
setBusy(false);
};
const b = builtinById(cat) || builtinById(cats.find((c) => c.id === cat)?.template || '');
- const catOpts = cats.map((c) => [c.id, `${c.icon || builtinById(c.id)?.icon || '📁'} ${catName(c)}`]);
+ const catOpts = cats.map((c) => [c.id, catName(c)]);
+ const stack = paneW < 440;
return (
<View style={{ flex: 1 }}>
<ScrollView style={{ flex: 1 }}>
- <View style={{ padding: 22, gap: 12 }}>
- <Text style={{ fontSize: 18, fontWeight: 700, color: th.text }}>{isNew ? t('passwords.edit.new') : t('passwords.edit.editing')}</Text>
- <View style={{ flexDirection: 'row', gap: 10, alignItems: 'flex-end' }}>
- <View style={{ flex: 1, gap: 4 }}>
+ <View ref={boxRef} style={{ paddingHorizontal: 24, paddingTop: 20, paddingBottom: 24, gap: 16 }}>
+ <Text style={{ fontSize: 17, fontWeight: 600, color: th.text }}>{isNew ? t('passwords.edit.new') : t('passwords.edit.editing')}</Text>
+ <View style={{ flexDirection: stack ? 'column' : 'row', gap: stack ? 16 : 12, alignItems: stack ? 'stretch' : 'flex-end' }}>
+ <View style={{ flex: stack ? undefined : 1, minWidth: 0, gap: 6 }}>
<Label>{t('passwords.edit.title')}</Label>
<TextInput value={title} onChange={setTitle} autoFocus={isNew} placeholder={t('passwords.edit.titlePh')} />
</View>
- <View style={{ gap: 4 }}>
+ <View style={{ gap: 6 }}>
<Label>{t('passwords.edit.category')}</Label>
- <Choice value={cat} options={catOpts} onChange={changeCat} width={220} />
+ <Choice value={cat} options={catOpts} onChange={changeCat} width={stack ? Math.max(160, paneW - 48) : 200} />
</View>
</View>
- {b?.warning && <Warning>{t('passwords.crypto.warning')}</Warning>}
+ {b?.warning && <Warning tone="orange">{t('passwords.crypto.warning')}</Warning>}
{fields.map((f, i) => (
<FieldEditor key={`${f.k}-${i}`} f={f} onChange={(nf) => setField(i, nf)}
onRemove={f.custom || !templateFields(cats.find((c) => c.id === cat), cats).some((x) => x.k === f.k) ? () => setFields((l) => l.filter((_, k) => k !== i)) : null}
@@ -448,25 +478,26 @@ export function EntryEditor({ v, entry, catId, onDone, onCancel }) {
{strength && <StrengthBar score={strength.score} bits={strength.bits} />}
{strength?.common && <Text style={{ fontSize: 12, color: RED }}>{t('passwords.report.commonHint')}</Text>}
{adding ? (
- <View style={{ flexDirection: 'row', gap: 8, alignItems: 'center' }}>
- <Choice value={newType} options={FIELD_TYPES.map((x) => [x, t(`passwords.ftype.${x}`)])} onChange={setNewType} width={180} />
- <Button primary label={t('passwords.edit.addField')} onClick={addField} />
- <Button label={t('passwords.cancel')} onClick={() => setAdding(false)} />
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 8, alignItems: 'center' }}>
+ <Choice value={newType} options={FIELD_TYPES.map((x) => [x, t(`passwords.ftype.${x}`)])} onChange={setNewType} width={170} />
+ <Button small label={t('passwords.cancel')} onClick={() => setAdding(false)} />
+ <Button small label={t('passwords.edit.addField')} onClick={addField} />
</View>
- ) : <Button label={t('passwords.edit.addFieldDots')} onClick={() => setAdding(true)} style={{ alignSelf: 'flex-start' }} />}
- <View style={{ gap: 4 }}>
+ ) : <Button small icon="+" label={t('passwords.edit.addFieldDots')} onClick={() => setAdding(true)} style={{ alignSelf: 'flex-start' }} />}
+ <View style={{ height: 1, backgroundColor: th.separator }} />
+ <View style={{ gap: 6 }}>
<Label>{t('passwords.edit.tags')}</Label>
- <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 5, alignItems: 'center' }}>
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 6, alignItems: 'center' }}>
{tags.map((tg) => <Chip key={tg} label={`#${tg}`} color={tagColor(tg)} onRemove={() => setTags(tags.filter((x) => x !== tg))} />)}
- <TextInput value={tagIn} onChange={setTagIn} placeholder={t('passwords.edit.tagPh')} onSubmit={addTag} style={{ width: 160, height: 26 }} size={12} />
+ <TextInput value={tagIn} onChange={setTagIn} placeholder={t('passwords.edit.tagPh')} onSubmit={addTag} style={{ width: 150, height: 24 }} size={12} />
</View>
</View>
- <View style={{ flexDirection: 'row', alignItems: 'center', gap: 10 }}>
- <Text style={{ flex: 1, fontSize: 13, color: th.text }}>{t('passwords.rotate.label')}</Text>
- <Choice value={rotate} width={180} onChange={setRotate} options={[[0, t('passwords.rotate.never')], [30, t('passwords.rotate.days', { n: 30 })],
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', gap: 12 }}>
+ <Text style={{ flex: 1, minWidth: 160, fontSize: 13, color: th.text }}>{t('passwords.rotate.label')}</Text>
+ <Choice value={rotate} width={170} onChange={setRotate} options={[[0, t('passwords.rotate.never')], [30, t('passwords.rotate.days', { n: 30 })],
[60, t('passwords.rotate.days', { n: 60 })], [90, t('passwords.rotate.days', { n: 90 })], [180, t('passwords.rotate.days', { n: 180 })], [365, t('passwords.rotate.year')]]} />
</View>
- <View style={{ gap: 4 }}>
+ <View style={{ gap: 6 }}>
<Label>{t('passwords.field.notes')}</Label>
<TextArea value={notes} onChange={setNotes} placeholder={t('passwords.edit.notesPh')} minHeight={b?.notesFirst ? 180 : 80} />
<Hint>{t('passwords.edit.markdown')}</Hint>
@@ -475,7 +506,7 @@ export function EntryEditor({ v, entry, catId, onDone, onCancel }) {
{err ? <Text style={{ fontSize: 12, color: RED }}>{err}</Text> : null}
</View>
</ScrollView>
- <View style={{ flexDirection: 'row', justifyContent: 'flex-end', gap: 8, padding: 12, borderTop: `1px solid ${th.separator}` }}>
+ <View style={{ height: 53, flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-end', gap: 8, paddingHorizontal: 20, borderTopWidth: 1, borderTopColor: th.separator }}>
<Button label={t('passwords.cancel')} onClick={onCancel} />
<Button primary label={busy ? t('passwords.saving') : t('passwords.save')} onClick={save} />
</View>
diff --git a/apps/passwords/Generator.jsx b/apps/passwords/Generator.jsx
index 6158441..67a31a2 100644
--- a/apps/passwords/Generator.jsx
+++ b/apps/passwords/Generator.jsx
@@ -1,9 +1,11 @@
-// Generator.jsx — generador de contraseñas y frases de contraseña (configurable). Genera en
-// lord-vault (getrandom; frases con la lista de 7776 palabras de la EFF) y muestra la fuerza.
+// Generator.jsx — the password and passphrase generator (configurable). It generates in
+// lord-vault (getrandom; passphrases from the EFF list of 7776 words) and shows the strength.
+// Layout: the result in a monospaced box with its strength under it, Another / Copy (and Use),
+// a neutral Password / Passphrase switch and the options as an inset group (docs/DESIGN.md).
import { View, Text, useTheme, useStore, Button, Toggle, Segmented, Slider, Stepper, TextInput, t } from '@lordos/sdk';
import { useEffect, useState } from 'react';
import { app, req, copySecret, setMeta } from './api.js';
-import { StrengthBar, Sheet, Label } from './ui.jsx';
+import { StrengthBar, Sheet, Hint, Group } from './ui.jsx';
export const GEN_DEFAULTS = { mode: 'password', length: 20, upper: true, lower: true, digits: true, symbols: true, noAmbiguous: false,
words: 5, sep: '-', capitalize: true, addDigit: true };
@@ -11,14 +13,14 @@ export const GEN_DEFAULTS = { mode: 'password', length: 20, upper: true, lower:
function Opt({ label, children }) {
const th = useTheme();
return (
- <View style={{ flexDirection: 'row', alignItems: 'center', minHeight: 30 }}>
- <Text style={{ flex: 1, fontSize: 13, color: th.text }}>{label}</Text>
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: 12, minHeight: 32 }}>
+ <Text style={{ flex: 1, minWidth: 0, fontSize: 13, color: th.text }}>{label}</Text>
{children}
</View>
);
}
-export function GeneratorPanel({ onUse, compact }) {
+export function GeneratorPanel({ onUse }) {
const th = useTheme();
const meta = useStore(app, (s) => s.meta);
const [o, setO] = useState({ ...GEN_DEFAULTS, ...(meta?.gen || {}) });
@@ -32,42 +34,47 @@ export function GeneratorPanel({ onUse, compact }) {
useEffect(() => { gen(); }, [JSON.stringify(o)]);
const save = () => setMeta({ gen: o }).catch(() => {});
return (
- <View style={{ gap: 10 }}>
- <View style={{ padding: 14, borderRadius: 10, backgroundColor: th.control, minHeight: 64, justifyContent: 'center', direction: 'ltr' }}>
- <Text style={{ fontSize: compact ? 15 : 18, fontFamily: 'monospace', color: th.text, lineHeight: 24 }}>{res?.password || ''}</Text>
- </View>
- {res && <StrengthBar score={res.score} bits={res.bits} />}
- <View style={{ flexDirection: 'row', gap: 8 }}>
- <Button label={t('passwords.gen.again')} onClick={gen} />
- <Button label={t('passwords.gen.copy')} onClick={() => res && copySecret(res.password, t('passwords.gen.password'))} />
- {onUse && <Button primary label={t('passwords.gen.use')} onClick={() => { if (res) { save(); onUse(res.password); } }} />}
+ <View style={{ gap: 12 }}>
+ <Segmented appearance="neutral" fill value={o.mode} onChange={(mode) => set({ mode })} options={[['password', t('passwords.gen.modePassword')], ['words', t('passwords.gen.modeWords')]]} />
+ <View style={{ gap: 8 }}>
+ <View style={{ paddingHorizontal: 14, paddingVertical: 10, borderRadius: 10, minHeight: 52, justifyContent: 'center', direction: 'ltr',
+ border: `1px solid ${th.separator}`, backgroundColor: th.mode === 'dark' ? 'rgba(255,255,255,0.05)' : 'rgba(0,0,0,0.03)' }}>
+ <Text style={{ fontSize: 16, fontFamily: 'monospace', color: th.text, lineHeight: 22, textAlign: 'center' }}>{res?.password || ''}</Text>
+ </View>
+ {res ? <StrengthBar score={res.score} bits={res.bits} /> : <View style={{ height: 21 }} />}
</View>
- <Segmented value={o.mode} onChange={(mode) => set({ mode })} options={[['password', t('passwords.gen.modePassword')], ['words', t('passwords.gen.modeWords')]]} />
{o.mode === 'password' ? (
- <View style={{ gap: 4 }}>
- <Opt label={t('passwords.gen.length', { n: o.length })}><Slider value={o.length} min={8} max={64} onChange={(v) => set({ length: Math.round(v) })} /></Opt>
- <Opt label={t('passwords.gen.upper')}><Toggle on={o.upper} onChange={(upper) => set({ upper })} /></Opt>
- <Opt label={t('passwords.gen.lower')}><Toggle on={o.lower} onChange={(lower) => set({ lower })} /></Opt>
- <Opt label={t('passwords.gen.digits')}><Toggle on={o.digits} onChange={(digits) => set({ digits })} /></Opt>
- <Opt label={t('passwords.gen.symbols')}><Toggle on={o.symbols} onChange={(symbols) => set({ symbols })} /></Opt>
- <Opt label={t('passwords.gen.noAmbiguous')}><Toggle on={o.noAmbiguous} onChange={(noAmbiguous) => set({ noAmbiguous })} /></Opt>
- </View>
+ <Group>
+ <Opt label={t('passwords.gen.length', { n: o.length })}><Slider value={o.length} min={8} max={64} width={150} onChange={(v) => set({ length: Math.round(v) })} /></Opt>
+ <Opt label={t('passwords.gen.upper')}><Toggle small on={o.upper} onChange={(upper) => set({ upper })} /></Opt>
+ <Opt label={t('passwords.gen.lower')}><Toggle small on={o.lower} onChange={(lower) => set({ lower })} /></Opt>
+ <Opt label={t('passwords.gen.digits')}><Toggle small on={o.digits} onChange={(digits) => set({ digits })} /></Opt>
+ <Opt label={t('passwords.gen.symbols')}><Toggle small on={o.symbols} onChange={(symbols) => set({ symbols })} /></Opt>
+ <Opt label={t('passwords.gen.noAmbiguous')}><Toggle small on={o.noAmbiguous} onChange={(noAmbiguous) => set({ noAmbiguous })} /></Opt>
+ </Group>
) : (
- <View style={{ gap: 4 }}>
- <Opt label={t('passwords.gen.words')}><Stepper value={o.words} min={3} max={12} onChange={(words) => set({ words })} /></Opt>
- <Opt label={t('passwords.gen.sep')}><TextInput value={o.sep} onChange={(sep) => set({ sep: sep.slice(0, 3) })} style={{ width: 70 }} /></Opt>
- <Opt label={t('passwords.gen.capitalize')}><Toggle on={o.capitalize} onChange={(capitalize) => set({ capitalize })} /></Opt>
- <Opt label={t('passwords.gen.addDigit')}><Toggle on={o.addDigit} onChange={(addDigit) => set({ addDigit })} /></Opt>
- <Label>{t('passwords.gen.wordsHint')}</Label>
+ <View style={{ gap: 6 }}>
+ <Group>
+ <Opt label={t('passwords.gen.words')}><Stepper value={o.words} min={3} max={12} onChange={(words) => set({ words })} /></Opt>
+ <Opt label={t('passwords.gen.sep')}><TextInput value={o.sep} onChange={(sep) => set({ sep: sep.slice(0, 3) })} style={{ width: 64, height: 24 }} /></Opt>
+ <Opt label={t('passwords.gen.capitalize')}><Toggle small on={o.capitalize} onChange={(capitalize) => set({ capitalize })} /></Opt>
+ <Opt label={t('passwords.gen.addDigit')}><Toggle small on={o.addDigit} onChange={(addDigit) => set({ addDigit })} /></Opt>
+ </Group>
+ <View style={{ paddingHorizontal: 8 }}><Hint>{t('passwords.gen.wordsHint')}</Hint></View>
</View>
)}
+ <View style={{ flexDirection: 'row', gap: 8, justifyContent: 'flex-end' }}>
+ <Button icon="↻" label={t('passwords.gen.again')} onClick={gen} />
+ <Button primary={!onUse} label={t('passwords.gen.copy')} onClick={() => res && copySecret(res.password, t('passwords.gen.password'))} />
+ {onUse && <Button primary label={t('passwords.gen.use')} onClick={() => { if (res) { save(); onUse(res.password); } }} />}
+ </View>
</View>
);
}
export function GeneratorSheet({ onClose, onUse }) {
return (
- <Sheet title={t('passwords.gen.title')} onClose={onClose} width={440}>
+ <Sheet title={t('passwords.gen.title')} onClose={onClose} width={420}>
<GeneratorPanel onUse={onUse ? (p) => { onUse(p); onClose(); } : null} />
</Sheet>
);
diff --git a/apps/passwords/Lock.jsx b/apps/passwords/Lock.jsx
index a8e955c..d462338 100644
--- a/apps/passwords/Lock.jsx
+++ b/apps/passwords/Lock.jsx
@@ -1,26 +1,57 @@
-// Lock.jsx — crear la bóveda (elegir cómo se abre), abrirla (contraseña, archivo llave, llave
-// FIDO2, contraseña + archivo llave, clave de recuperación) y mostrar la clave de recuperación
-// para imprimirla o guardarla.
+// Lock.jsx — creating the vault (choosing how it unlocks), unlocking it (password, key file,
+// FIDO2 security key, password + key file, recovery key) and showing the recovery key to print
+// or save. A centered column (360 px; 440 px for the forms with more choices), the padlock, a
+// 22 px title, a neutral method switch and one primary button (docs/DESIGN.md).
import { View, Text, useTheme, useStore, Button, TextInput, Segmented, requestPermission, print, fs, t } from '@lordos/sdk';
import * as React from 'react';
import { useEffect, useState } from 'react';
import { app, req, refreshStatus, errorText, APP_ID, toast, appMode } from './api.js';
-import { StrengthBar, Hint, Warning, FilePicker, Label, RED, fileReq, fileName } from './ui.jsx';
+import { StrengthBar, Hint, Warning, FilePicker, Label, Check, RED, fileReq, fileName } from './ui.jsx';
+import { Glyph } from './glyphs.jsx';
+// The padlock of the lock screens, in the app icon's colors; the shackle is a neutral gray that
+// reads on light and dark backgrounds.
function Padlock({ size = 64, open }) {
+ const th = useTheme();
+ const shackle = th.mode === 'dark' ? 'rgba(235,235,245,0.62)' : '#a8a8b0';
return (
- <View style={{ width: size, height: size * 1.1, alignItems: 'center' }}>
- <View style={{ width: size * 0.56, height: size * 0.56, borderRadius: size * 0.28, border: `${Math.max(3, size * 0.09)}px solid #ffffffcc`,
- marginBottom: -size * 0.28, marginLeft: open ? size * 0.3 : 0 }} />
- <View style={{ width: size * 0.84, height: size * 0.58, borderRadius: size * 0.12, background: 'linear-gradient(160deg, #7d7aff, #3a37c4)',
- alignItems: 'center', justifyContent: 'center', boxShadow: '0 6px 18px rgba(0,0,0,0.35)' }}>
+ <View style={{ width: size, height: size * 1.04, alignItems: 'center', direction: 'ltr' }}>
+ <View style={{ width: size * 0.5, height: size * 0.5, borderRadius: size * 0.25, border: `${Math.max(3, Math.round(size * 0.085))}px solid ${shackle}`,
+ marginBottom: -size * 0.25, marginLeft: open ? size * 0.34 : 0 }} />
+ <View style={{ width: size * 0.8, height: size * 0.56, borderRadius: size * 0.13, background: 'linear-gradient(180deg, #38c6d4, #1f6fd1)',
+ alignItems: 'center', justifyContent: 'center', boxShadow: '0 4px 12px rgba(0,0,0,0.22)' }}>
<View style={{ width: size * 0.12, height: size * 0.12, borderRadius: size * 0.06, backgroundColor: '#fff' }} />
- <View style={{ width: size * 0.05, height: size * 0.14, borderRadius: size * 0.02, backgroundColor: '#fff' }} />
+ <View style={{ width: size * 0.05, height: size * 0.12, marginTop: -1, borderRadius: size * 0.02, backgroundColor: '#fff' }} />
</View>
</View>
);
}
+// The header of a lock screen: picture, title and one line under it.
+function Head({ pic, title, sub }) {
+ const th = useTheme();
+ return (
+ <View style={{ alignItems: 'center', gap: 8, marginBottom: 4 }}>
+ {pic}
+ <Text style={{ marginTop: 6, fontSize: 22, fontWeight: 600, color: th.text, textAlign: 'center' }}>{title}</Text>
+ {sub ? <Text style={{ fontSize: 13, color: th.textDim, textAlign: 'center', lineHeight: 18, maxWidth: 400 }}>{sub}</Text> : null}
+ </View>
+ );
+}
+
+// A picked file: its name (or a dim placeholder) and the button that picks it.
+function FileRow({ file, empty, button, onPick }) {
+ const th = useTheme();
+ return (
+ <View style={{ height: 36, flexDirection: 'row', gap: 8, alignItems: 'center', paddingInlineStart: 10, paddingInlineEnd: 4, borderRadius: 8,
+ border: `1px solid ${th.separator}` }}>
+ <Glyph kind="drive" size={14} color={file ? th.accent : th.textDim} />
+ <Text style={{ flex: 1, minWidth: 0, fontSize: 12, color: file ? th.text : th.textDim, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{fileName(file) || empty}</Text>
+ <Button small label={button} onClick={onPick} />
+ </View>
+ );
+}
+
// picker: a file picker shown in place of the form, under the header (the first child), so the
// lock screen stays recognisable instead of disappearing behind a dialog. In the app process the
// system dialog picks the file and the form stays.
@@ -29,15 +60,15 @@ function Shell({ children, wide, picker }) {
const kids = React.Children.toArray(children);
const inline = picker && !appMode;
return (
- <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center', backgroundColor: th.windowBg }}>
- <View style={{ width: inline ? 520 : wide ? 520 : 380, gap: 12, alignItems: 'stretch' }}>
+ <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center', backgroundColor: th.windowBg, padding: 20 }}>
+ <View style={{ width: inline ? 500 : wide ? 460 : 360, maxWidth: '100%', gap: 14, alignItems: 'stretch' }}>
{inline ? [kids[0], <React.Fragment key="picker">{picker}</React.Fragment>] : [...kids, picker ? <React.Fragment key="picker">{picker}</React.Fragment> : null]}
</View>
</View>
);
}
-// ---- abrir ----
+// ---- unlock ----
export function UnlockView() {
const th = useTheme();
@@ -91,39 +122,35 @@ export function UnlockView() {
if (has('recovery')) opts.push(['recovery', t('passwords.method.recovery')]);
return (
<Shell picker={picking && <FilePicker inline title={t('passwords.unlock.chooseKeyfile')} onClose={() => setPicking(false)} onPick={(p) => { setKeyfile(p); setPicking(false); }} />}>
- <View style={{ alignItems: 'center', gap: 6 }}>
- <Padlock size={72} />
- <Text style={{ fontSize: 20, fontWeight: 700, color: th.text }}>{t('passwords.unlock.title')}</Text>
- <Text style={{ fontSize: 12, color: th.textDim, textAlign: 'center' }}>{t('passwords.unlock.subtitle')}</Text>
- </View>
- {opts.length > 1 && <View style={{ alignItems: 'center' }}><Segmented options={opts} value={method} onChange={(m) => { setMethod(m); setErr(''); }} /></View>}
+ <Head pic={<Padlock size={64} />} title={t('passwords.unlock.title')} sub={t('passwords.unlock.subtitle')} />
+ {opts.length > 1 && <View style={{ alignItems: 'center' }}><Segmented appearance="neutral" options={opts} value={method} onChange={(m) => { setMethod(m); setErr(''); }} /></View>}
{(method === 'password' || method === 'passkey') && (
- <TextInput value={pw} onChange={setPw} secure autoFocus placeholder={t('passwords.unlock.password')} onSubmit={go} size={15} />
+ <TextInput value={pw} onChange={setPw} secure autoFocus placeholder={t('passwords.unlock.password')} onSubmit={go} />
)}
{(method === 'keyfile' || method === 'passkey') && (
- <View style={{ flexDirection: 'row', gap: 8, alignItems: 'center' }}>
- <Text style={{ flex: 1, fontSize: 12, color: keyfile ? th.text : th.textDim, whiteSpace: 'nowrap', overflow: 'hidden' }}>{fileName(keyfile) || t('passwords.unlock.noKeyfile')}</Text>
- <Button label={t('passwords.unlock.chooseKeyfile')} onClick={() => setPicking(true)} />
- </View>
+ <FileRow file={keyfile} empty={t('passwords.unlock.noKeyfile')} button={t('passwords.unlock.chooseKeyfile')} onPick={() => setPicking(true)} />
)}
{method === 'fido' && (
- <View style={{ gap: 8 }}>
- <Hint>{st.touch ? t('passwords.fido.touch') : t('passwords.fido.insert')}</Hint>
+ <View style={{ gap: 10 }}>
+ <View style={{ flexDirection: 'row', gap: 10, alignItems: 'center', paddingHorizontal: 12, paddingVertical: 10, borderRadius: 8, backgroundColor: th.control }}>
+ <Glyph kind="key" size={16} color={th.accent} />
+ <Text style={{ flex: 1, fontSize: 12, color: th.text, lineHeight: 17 }}>{st.touch ? t('passwords.fido.touch') : t('passwords.fido.insert')}</Text>
+ </View>
<TextInput value={pin} onChange={setPin} secure placeholder={t('passwords.fido.pinOptional')} onSubmit={go} />
</View>
)}
{method === 'recovery' && (
- <TextInput value={rec} onChange={setRec} placeholder="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" onSubmit={go} />
+ <TextInput value={rec} onChange={setRec} placeholder="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" onSubmit={go} style={{ direction: 'ltr' }} />
)}
- {err ? <Text style={{ fontSize: 12, color: RED, textAlign: 'center' }}>{err}</Text> : null}
- <Button primary label={busy ? (st.touch ? t('passwords.fido.touchShort') : t('passwords.unlock.working')) : t('passwords.unlock.button')} onClick={go} style={{ height: 34 }} />
- {ms != null && <Hint>{t('passwords.unlock.took', { ms })}</Hint>}
+ {err ? <Text style={{ fontSize: 12, color: RED, textAlign: 'center', lineHeight: 17 }}>{err}</Text> : null}
+ <Button primary label={busy ? (st.touch ? t('passwords.fido.touchShort') : t('passwords.unlock.working')) : t('passwords.unlock.button')} onClick={go} />
+ {ms != null && <Text style={{ fontSize: 11, color: th.textDim, textAlign: 'center' }}>{t('passwords.unlock.took', { ms })}</Text>}
{st.status?.main?.unreadable && <Warning>{t('passwords.unlock.unreadable')}</Warning>}
</Shell>
);
}
-// ---- crear ----
+// ---- create ----
export function CreateView() {
const th = useTheme();
@@ -174,16 +201,14 @@ export function CreateView() {
return (
<Shell wide picker={picking && <FilePicker inline save suggest="contrasenas.key" title={t('passwords.create.chooseKeyPath')} onClose={() => setPicking(false)}
onPick={(p) => { setKeyPath(p); setPicking(false); }} />}>
- <View style={{ alignItems: 'center', gap: 6 }}>
- <Padlock size={64} open />
- <Text style={{ fontSize: 20, fontWeight: 700, color: th.text }}>{t('passwords.create.title')}</Text>
- <Text style={{ fontSize: 12, color: th.textDim, textAlign: 'center', lineHeight: 17 }}>{t('passwords.create.subtitle')}</Text>
+ <Head pic={<Padlock size={60} open />} title={t('passwords.create.title')} sub={t('passwords.create.subtitle')} />
+ <View style={{ gap: 8, marginTop: 4 }}>
+ <Label>{t('passwords.create.how')}</Label>
+ <Segmented appearance="neutral" fill value={method} onChange={(m) => { setMethod(m); setErr(''); }} options={[
+ ['password', t('passwords.method.password')], ['fido', t('passwords.method.fido')],
+ ['keyfile', t('passwords.method.keyfile')], ['passkey', t('passwords.method.passkey')]]} />
+ <Hint>{t(`passwords.create.about.${method}`)}</Hint>
</View>
- <Label>{t('passwords.create.how')}</Label>
- <Segmented value={method} onChange={(m) => { setMethod(m); setErr(''); }} options={[
- ['password', t('passwords.method.password')], ['fido', t('passwords.method.fido')],
- ['keyfile', t('passwords.method.keyfile')], ['passkey', t('passwords.method.passkey')]]} />
- <Hint>{t(`passwords.create.about.${method}`)}</Hint>
{needPw && (
<View style={{ gap: 8 }}>
<TextInput value={pw} onChange={setPw} secure autoFocus placeholder={t('passwords.create.password')} />
@@ -192,10 +217,7 @@ export function CreateView() {
</View>
)}
{needKey && (
- <View style={{ flexDirection: 'row', gap: 8, alignItems: 'center' }}>
- <Text style={{ flex: 1, fontSize: 12, color: keyPath ? th.text : th.textDim, whiteSpace: 'nowrap', overflow: 'hidden' }}>{fileName(keyPath) || t('passwords.create.keyWhere')}</Text>
- <Button label={t('passwords.create.chooseKeyPath')} onClick={() => setPicking(true)} />
- </View>
+ <FileRow file={keyPath} empty={t('passwords.create.keyWhere')} button={t('passwords.create.chooseKeyPath')} onPick={() => setPicking(true)} />
)}
{method === 'fido' && (
<View style={{ gap: 8 }}>
@@ -204,13 +226,13 @@ export function CreateView() {
</View>
)}
{err ? <Text style={{ fontSize: 12, color: RED }}>{err}</Text> : null}
- <Button primary label={busy ? (st.touch ? t('passwords.fido.touchShort') : t('passwords.create.working')) : t('passwords.create.button')} onClick={go} style={{ height: 34 }} />
- <Hint>{t('passwords.create.local')}</Hint>
+ <Button primary label={busy ? (st.touch ? t('passwords.fido.touchShort') : t('passwords.create.working')) : t('passwords.create.button')} onClick={go} />
+ <Text style={{ fontSize: 11, color: th.textDim, textAlign: 'center', lineHeight: 15 }}>{t('passwords.create.local')}</Text>
</Shell>
);
}
-// ---- clave de recuperación ----
+// ---- recovery key ----
export function RecoveryView({ code, onDone }) {
const th = useTheme();
@@ -227,22 +249,18 @@ export function RecoveryView({ code, onDone }) {
} catch (e) { toast(errorText('file')); }
setSaving(false);
}} />}>
- <Text style={{ fontSize: 20, fontWeight: 700, color: th.text, textAlign: 'center' }}>{t('passwords.recovery.title')}</Text>
- <Hint>{t('passwords.recovery.body')}</Hint>
- <View style={{ padding: 16, borderRadius: 10, backgroundColor: th.control, alignItems: 'center', direction: 'ltr' }}>
- <Text style={{ fontSize: 17, fontWeight: 600, color: th.text, fontFamily: 'monospace' }}>{code}</Text>
+ <Head pic={<View style={{ width: 56, height: 56, borderRadius: 14, alignItems: 'center', justifyContent: 'center', background: 'linear-gradient(180deg, #38c6d4, #1f6fd1)' }}>
+ <Glyph kind="key" size={32} color="#fff" /></View>} title={t('passwords.recovery.title')} sub={t('passwords.recovery.body')} />
+ <View style={{ paddingHorizontal: 16, paddingVertical: 14, borderRadius: 10, border: `1px solid ${th.separator}`,
+ backgroundColor: th.mode === 'dark' ? 'rgba(255,255,255,0.05)' : 'rgba(0,0,0,0.03)', alignItems: 'center', direction: 'ltr' }}>
+ <Text style={{ fontSize: 15, fontWeight: 600, color: th.text, fontFamily: 'monospace', textAlign: 'center', lineHeight: 22 }}>{code}</Text>
</View>
<View style={{ flexDirection: 'row', gap: 8, justifyContent: 'center' }}>
- {!appMode && <Button label={t('passwords.recovery.print')} onClick={() => print.open({ title: t('passwords.recovery.printTitle'), text })} />}
- <Button label={t('passwords.recovery.save')} onClick={() => setSaving(true)} />
- </View>
- <View onClick={() => setOk(!ok)} style={{ flexDirection: 'row', gap: 8, alignItems: 'center' }}>
- <View style={{ width: 18, height: 18, borderRadius: 4, border: `1px solid ${th.separator}`, backgroundColor: ok ? th.accent : th.inputBg, alignItems: 'center', justifyContent: 'center' }}>
- {ok && <Text style={{ fontSize: 11, color: '#fff' }}>✓</Text>}
- </View>
- <Text style={{ flex: 1, fontSize: 12, color: th.text }}>{t('passwords.recovery.confirm')}</Text>
+ {!appMode && <Button small label={t('passwords.recovery.print')} onClick={() => print.open({ title: t('passwords.recovery.printTitle'), text })} />}
+ <Button small label={t('passwords.recovery.save')} onClick={() => setSaving(true)} />
</View>
- <Button primary label={t('passwords.recovery.done')} onClick={() => ok && onDone()} style={{ opacity: ok ? 1 : 0.5, height: 34 }} />
+ <Check on={ok} onChange={setOk} label={t('passwords.recovery.confirm')} />
+ <Button primary disabled={!ok} label={t('passwords.recovery.done')} onClick={() => ok && onDone()} />
</Shell>
);
}
diff --git a/apps/passwords/Security.jsx b/apps/passwords/Security.jsx
index d9e44bb..73b68c7 100644
--- a/apps/passwords/Security.jsx
+++ b/apps/passwords/Security.jsx
@@ -1,40 +1,47 @@
-// Security.jsx — el informe de seguridad (contraseñas débiles, repetidas y viejas; filtradas según
-// la lista de comunes y, si el usuario lo elige, un archivo local de Have I Been Pwned: nunca por
-// red) y la vista de todos los códigos 2FA con su cuenta regresiva.
-import { View, Text, useTheme, useStore, Button, ScrollView, t } from '@lordos/sdk';
+// Security.jsx — the security report (weak, reused and old passwords; breached ones from the
+// list of common passwords and, if the user picks one, a local file of known-breached hashes:
+// never over the network) and the view with every 2FA code and its countdown.
+import { View, Text, useTheme, useStore, Button, ScrollView, EmptyState, t } from '@lordos/sdk';
import { useEffect, useRef, useState } from 'react';
import { app, req, errorText, toast, copySecret } from './api.js';
import { allCategories, builtinById } from './templates.js';
import { EntryIcon, Hint, FilePicker, strengthColor, strengthLabel, RED, ORANGE, YELLOW, GREEN, IconButton, fileReq } from './ui.jsx';
+import { Glyph } from './glyphs.jsx';
import { Center } from './Detail.jsx';
+// One finding: a colored dot, the title and the count, a hint line and the items, in an inset box.
function Card({ title, count, color, children, hint }) {
const th = useTheme();
+ const kids = (Array.isArray(children) ? children.flat() : [children]).filter(Boolean);
return (
- <View style={{ gap: 6, padding: 14, borderRadius: 12, backgroundColor: th.control }}>
+ <View style={{ borderRadius: 10, border: `1px solid ${th.separator}`, backgroundColor: th.mode === 'dark' ? 'rgba(255,255,255,0.04)' : 'rgba(0,0,0,0.025)',
+ paddingHorizontal: 14, paddingTop: 12, paddingBottom: kids.length ? 6 : 12, gap: 4 }}>
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
- <View style={{ width: 10, height: 10, borderRadius: 5, backgroundColor: color }} />
- <Text style={{ flex: 1, fontSize: 14, fontWeight: 700, color: th.text }}>{title}</Text>
- <Text style={{ fontSize: 20, fontWeight: 700, color: count ? color : th.textDim }}>{String(count)}</Text>
+ <View style={{ width: 8, height: 8, borderRadius: 4, backgroundColor: color }} />
+ <Text style={{ flex: 1, minWidth: 0, fontSize: 13, fontWeight: 600, color: th.text }}>{title}</Text>
+ <Text style={{ fontSize: 17, fontWeight: 600, color: count ? color : th.textDim }}>{String(count)}</Text>
</View>
{hint && <Hint>{hint}</Hint>}
- {children}
+ {kids.length ? <View style={{ marginTop: 4 }}>{kids}</View> : null}
</View>
);
}
function Item({ e, cats, sub, onOpen }) {
const th = useTheme();
+ const [hover, setHover] = useState(false);
if (!e) return null;
const cat = cats.find((c) => c.id === e.cat) || builtinById(e.cat);
return (
- <View onClick={() => onOpen(e.id)} style={{ flexDirection: 'row', alignItems: 'center', gap: 10, paddingVertical: 5 }}>
- <EntryIcon entry={e} cat={cat} size={26} />
- <View style={{ flex: 1 }}>
- <Text style={{ fontSize: 13, color: th.text, whiteSpace: 'nowrap', overflow: 'hidden' }}>{e.title || t('passwords.untitled')}</Text>
- {sub && <Text style={{ fontSize: 11, color: th.textDim }}>{sub}</Text>}
+ <View onClick={() => onOpen(e.id)} onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
+ style={{ flexDirection: 'row', alignItems: 'center', gap: 10, minHeight: 40, paddingHorizontal: 6, marginHorizontal: -6, borderRadius: 6,
+ borderTopWidth: 1, borderTopColor: th.separator, backgroundColor: hover ? th.hover : 'transparent' }}>
+ <EntryIcon entry={e} cat={cat} size={24} />
+ <View style={{ flex: 1, minWidth: 0 }}>
+ <Text style={{ fontSize: 13, color: th.text, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{e.title || t('passwords.untitled')}</Text>
+ {sub && <Text style={{ fontSize: 11, color: th.textDim, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{sub}</Text>}
</View>
- <Text style={{ fontSize: 12, color: th.textDim }}>›</Text>
+ <Text style={{ fontSize: 14, color: th.textDim }}>›</Text>
</View>
);
}
@@ -59,16 +66,20 @@ export function SecurityView({ onOpen }) {
const total = st.entries.filter((e) => !e.trash).length;
return (
<ScrollView style={{ flex: 1 }}>
- <View style={{ padding: 22, gap: 12 }}>
- <View style={{ flexDirection: 'row', alignItems: 'center', gap: 14 }}>
- <View style={{ width: 56, height: 56, borderRadius: 28, alignItems: 'center', justifyContent: 'center', backgroundColor: issues ? 'rgba(255,159,10,0.2)' : 'rgba(48,209,88,0.2)' }}>
- <Text style={{ fontSize: 28 }}>{issues ? '⚠️' : '✅'}</Text>
+ <View style={{ paddingHorizontal: 24, paddingTop: 20, paddingBottom: 24, gap: 12, width: '100%', maxWidth: 760, alignSelf: 'center' }}>
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: 14, marginBottom: 4 }}>
+ <View style={{ width: 48, height: 48, borderRadius: 12, alignItems: 'center', justifyContent: 'center',
+ background: issues ? 'linear-gradient(180deg, #ffb340, #ff9500)' : 'linear-gradient(180deg, #4cd964, #28b84a)' }}>
+ <Glyph kind="shield" size={28} color="#fff" />
+ <View style={{ position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, alignItems: 'center', justifyContent: 'center', paddingBottom: 3 }}>
+ <Text style={{ fontSize: 13, fontWeight: 700, color: '#fff' }}>{issues ? '!' : '✓'}</Text>
+ </View>
</View>
- <View style={{ flex: 1, gap: 2 }}>
- <Text style={{ fontSize: 22, fontWeight: 700, color: th.text }}>{t('passwords.report.title')}</Text>
+ <View style={{ flex: 1, minWidth: 0, gap: 2 }}>
+ <Text style={{ fontSize: 22, fontWeight: 600, color: th.text, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{t('passwords.report.title')}</Text>
<Text style={{ fontSize: 12, color: th.textDim }}>{issues ? t('passwords.report.issues', { count: issues, total }) : t('passwords.report.allGood', { total })}</Text>
</View>
- <Button label={busy ? t('passwords.report.loading') : t('passwords.report.again')} onClick={() => run(hibp)} />
+ <Button small label={busy ? t('passwords.report.loading') : t('passwords.report.again')} onClick={() => run(hibp)} />
</View>
<Card title={t('passwords.report.weak')} count={rep.weak.length} color={RED} hint={t('passwords.report.weakHint')}>
{rep.weak.map((w) => <Item key={w.id} e={byId.get(w.id)} cats={cats} onOpen={onOpen}
@@ -76,8 +87,8 @@ export function SecurityView({ onOpen }) {
</Card>
<Card title={t('passwords.report.reused')} count={rep.reused.length} color={ORANGE} hint={t('passwords.report.reusedHint')}>
{rep.reused.map((g, i) => (
- <View key={i} style={{ gap: 2, paddingVertical: 4, borderBottom: `1px solid ${th.separator}` }}>
- <Text style={{ fontSize: 11, color: th.textDim }}>{t('passwords.report.sameIn', { count: g.length })}</Text>
+ <View key={i}>
+ <Text style={{ fontSize: 11, fontWeight: 600, color: th.textDim, paddingTop: 8, paddingBottom: 4 }}>{t('passwords.report.sameIn', { count: g.length })}</Text>
{g.map((id) => <Item key={id} e={byId.get(id)} cats={cats} onOpen={onOpen} />)}
</View>
))}
@@ -88,9 +99,9 @@ export function SecurityView({ onOpen }) {
<Card title={t('passwords.report.breached')} count={rep.breached ? rep.breached.length : rep.weak.filter((w) => w.common).length} color={RED}
hint={hibp ? t('passwords.report.hibpUsing') : t('passwords.report.breachedHint')}>
{(rep.breached || []).map((b) => <Item key={b.id} e={byId.get(b.id)} cats={cats} onOpen={onOpen} sub={t('passwords.report.seen', { count: b.count })} />)}
- <Button label={t('passwords.report.hibpChoose')} onClick={() => setPicking(true)} style={{ alignSelf: 'flex-start' }} />
+ <View style={{ paddingTop: 4, paddingBottom: 6, alignItems: 'flex-start' }}><Button small label={t('passwords.report.hibpChoose')} onClick={() => setPicking(true)} /></View>
</Card>
- <Hint>{t('passwords.report.offline')}</Hint>
+ <View style={{ paddingHorizontal: 4 }}><Hint>{t('passwords.report.offline')}</Hint></View>
</View>
{picking && <FilePicker title={t('passwords.report.hibpChoose')} onClose={() => setPicking(false)}
onPick={(p) => { setPicking(false); setHibp(typeof p === 'string' ? p : null); run(p); }} />}
@@ -98,7 +109,7 @@ export function SecurityView({ onOpen }) {
);
}
-// ---- todos los códigos 2FA ----
+// ---- every 2FA code ----
export function CodesView({ onOpen }) {
const th = useTheme();
@@ -119,31 +130,32 @@ export function CodesView({ onOpen }) {
return () => clearInterval(iv);
}, [codes]);
const byId = new Map(st.entries.map((e) => [e.id, e]));
- if (!codes.length) return <Center text={t('passwords.codes.empty')}><Text style={{ fontSize: 40 }}>🔢</Text></Center>;
+ if (!codes.length) return <EmptyState icon={<Glyph kind="clock" size={40} color={th.textDim} />} title={t('passwords.side.codes')} hint={t('passwords.codes.empty')} />;
const el = Date.now() / 1000 - base.current.at;
return (
<ScrollView style={{ flex: 1 }}>
- <View style={{ padding: 22, gap: 10 }}>
- <Text style={{ fontSize: 22, fontWeight: 700, color: th.text }}>{t('passwords.side.codes')}</Text>
+ <View style={{ paddingHorizontal: 24, paddingTop: 20, paddingBottom: 24, gap: 8, width: '100%', maxWidth: 760, alignSelf: 'center' }}>
+ <Text style={{ fontSize: 22, fontWeight: 600, color: th.text, marginBottom: 8 }}>{t('passwords.side.codes')}</Text>
{codes.map((c) => {
const e = byId.get(c.id);
const left = Math.max(0, Math.round(c.remaining - el));
const shown = c.code.length === 6 ? `${c.code.slice(0, 3)} ${c.code.slice(3)}` : c.code;
return (
- <View key={`${c.id}-${c.k}`} onClick={() => onOpen(c.id)} style={{ flexDirection: 'row', alignItems: 'center', gap: 12, padding: 12, borderRadius: 12, backgroundColor: th.control }}>
- {e && <EntryIcon entry={e} cat={cats.find((x) => x.id === e.cat)} size={34} />}
- <View style={{ flex: 1, gap: 2 }}>
- <Text style={{ fontSize: 13, color: th.text }}>{e?.title || c.issuer || ''}</Text>
- <Text style={{ fontSize: 11, color: th.textDim }}>{c.account || e?.sub || ''}</Text>
+ <View key={`${c.id}-${c.k}`} onClick={() => onOpen(c.id)} style={{ flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal: 12, height: 60,
+ borderRadius: 10, border: `1px solid ${th.separator}`, backgroundColor: th.mode === 'dark' ? 'rgba(255,255,255,0.04)' : 'rgba(0,0,0,0.025)' }}>
+ {e && <EntryIcon entry={e} cat={cats.find((x) => x.id === e.cat)} size={32} />}
+ <View style={{ flex: 1, minWidth: 0, gap: 2 }}>
+ <Text style={{ fontSize: 13, fontWeight: 600, color: th.text, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{e?.title || c.issuer || ''}</Text>
+ <Text style={{ fontSize: 11, color: th.textDim, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{c.account || e?.sub || ''}</Text>
</View>
- <Text style={{ fontSize: 22, fontWeight: 600, fontFamily: 'monospace', color: left <= 5 ? RED : th.text, direction: 'ltr' }}>{shown}</Text>
- <View style={{ width: 34, alignItems: 'center' }}>
+ <Text style={{ fontSize: 20, fontWeight: 600, fontFamily: 'monospace', color: left <= 5 ? RED : th.text, direction: 'ltr' }}>{shown}</Text>
+ <View style={{ width: 34, alignItems: 'center', gap: 4 }}>
<Text style={{ fontSize: 12, color: left <= 5 ? RED : th.textDim }}>{`${left}s`}</Text>
<View style={{ width: 30, height: 3, borderRadius: 2, backgroundColor: th.windowBg, direction: 'ltr' }}>
<View style={{ width: Math.round(30 * (c.period ? left / c.period : 0)), height: 3, borderRadius: 2, backgroundColor: left <= 5 ? RED : GREEN }} />
</View>
</View>
- <IconButton glyph="⧉" onClick={() => copySecret(c.code, t('passwords.totp.code'))} />
+ <IconButton glyph="⧉" tip={t('passwords.copy')} onClick={() => copySecret(c.code, t('passwords.totp.code'))} />
</View>
);
})}
diff --git a/apps/passwords/Settings.jsx b/apps/passwords/Settings.jsx
index 7486dd8..ac27b16 100644
--- a/apps/passwords/Settings.jsx
+++ b/apps/passwords/Settings.jsx
@@ -1,15 +1,18 @@
-// Settings.jsx — ajustes de la bóveda (formas de abrir, clave de recuperación, bloqueo automático,
-// portapapeles, Argon2id), importar y exportar, y editar categorías y etiquetas.
+// Settings.jsx — vault settings (ways to unlock, recovery key, auto-lock, clipboard, Argon2id),
+// import and export, and editing categories and tags. Each sheet is built from inset groups
+// (Group) with the one primary action in the footer (docs/DESIGN.md).
import { View, Text, useTheme, useStore, Button, TextInput, Segmented, requestPermission, t, formatDate } from '@lordos/sdk';
import { useState } from 'react';
import { app, req, refreshStatus, reload, errorText, toast, setMeta, setCats, setTags, APP_ID } from './api.js';
import { allCategories, BUILTIN, ICONS, COLORS, FIELD_TYPES, catName, builtinById } from './templates.js';
-import { Sheet, Label, Hint, Warning, FilePicker, Choice, CatIcon, StrengthBar, RED, fileReq, fileName } from './ui.jsx';
+import { Sheet, Label, Hint, Warning, FilePicker, Choice, CatIcon, StrengthBar, Group, Check, RED, GREEN, fileReq, fileName } from './ui.jsx';
+import { Glyph, iconKind } from './glyphs.jsx';
import { RecoveryView } from './Lock.jsx';
-const slotIcon = { password: '🔤', keyfile: '💾', passkey: '🔤💾', fido: '🔑', recovery: '🧾', session: '👤' };
+// The glyph of each way to unlock (drawn: glyphs.jsx).
+const slotIcon = { password: 'lock', keyfile: 'drive', passkey: 'drive', fido: 'key', recovery: 'note', session: 'person' };
-// ---- ajustes ----
+// ---- settings ----
export function SettingsSheet({ onClose }) {
const th = useTheme();
@@ -49,35 +52,35 @@ export function SettingsSheet({ onClose }) {
if (rec) return <Sheet title={t('passwords.recovery.title')} onClose={() => setRec(null)} width={600}><RecoveryView code={rec} onDone={() => setRec(null)} /></Sheet>;
return (
<Sheet title={t('passwords.set.title')} onClose={onClose} width={560}>
- <Segmented value={tab} onChange={setTab} options={[['unlock', t('passwords.set.tabUnlock')], ['prefs', t('passwords.set.tabPrefs')]]} />
+ <Segmented appearance="neutral" fill value={tab} onChange={setTab} options={[['unlock', t('passwords.set.tabUnlock')], ['prefs', t('passwords.set.tabPrefs')]]} />
{tab === 'unlock' ? (
- <View style={{ gap: 8 }}>
+ <View style={{ gap: 10 }}>
<Hint>{t('passwords.set.unlockHint')}</Hint>
- {slots.map((s) => (
- <View key={s.id} style={{ flexDirection: 'row', alignItems: 'center', gap: 10, padding: 10, borderRadius: 9, backgroundColor: th.control }}>
- <Text style={{ fontSize: 16 }}>{slotIcon[s.type] || '•'}</Text>
- <View style={{ flex: 1 }}>
- <Text style={{ fontSize: 13, color: th.text }}>{t(`passwords.method.${s.type}`)}{s.label ? ` · ${s.label}` : ''}</Text>
- <Text style={{ fontSize: 11, color: th.textDim }}>
+ <Group>{slots.map((s) => (
+ <View key={s.id} style={{ flexDirection: 'row', alignItems: 'center', gap: 10, minHeight: 48 }}>
+ <Glyph kind={slotIcon[s.type] || 'key'} size={16} color={th.accent} />
+ <View style={{ flex: 1, minWidth: 0 }}>
+ <Text style={{ fontSize: 13, color: th.text, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{t(`passwords.method.${s.type}`)}{s.label ? ` · ${s.label}` : ''}</Text>
+ <Text style={{ fontSize: 11, color: th.textDim, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>
{s.m ? t('passwords.set.kdf', { m: Math.round(s.m / 1024), t: s.t }) : ''}{s.created ? ` ${formatDate(new Date(s.created * 1000))}` : ''}
</Text>
</View>
{s.type === 'recovery'
- ? <Button label={t('passwords.set.newRecovery')} onClick={() => run(async () => { const r = await req('recovery-new'); await refreshStatus(); setRec(r.recovery); })} />
- : <Button label={t('passwords.set.remove')} onClick={() => run(async () => { await req('slot-del', { slot: s.id }); await done(t('passwords.set.removed')); })} />}
+ ? <Button small label={t('passwords.set.newRecovery')} onClick={() => run(async () => { const r = await req('recovery-new'); await refreshStatus(); setRec(r.recovery); })} />
+ : <Button small destructive label={t('passwords.set.remove')} onClick={() => run(async () => { await req('slot-del', { slot: s.id }); await done(t('passwords.set.removed')); })} />}
</View>
- ))}
+ ))}</Group>
{!add && (
- <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 6 }}>
- {slots.some((s) => s.type === 'password') && <Button label={t('passwords.set.change')} onClick={() => setAdd('change')} />}
- {!slots.some((s) => s.type === 'password') && <Button label={t('passwords.set.addPassword')} onClick={() => setAdd('password')} />}
- <Button label={t('passwords.set.addKeyfile')} onClick={() => setAdd('keyfile')} />
- <Button label={t('passwords.set.addPasskey')} onClick={() => setAdd('passkey')} />
- <Button label={t('passwords.set.addFido')} onClick={() => setAdd('fido')} />
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 8 }}>
+ {slots.some((s) => s.type === 'password') && <Button small label={t('passwords.set.change')} onClick={() => setAdd('change')} />}
+ {!slots.some((s) => s.type === 'password') && <Button small label={t('passwords.set.addPassword')} onClick={() => setAdd('password')} />}
+ <Button small label={t('passwords.set.addKeyfile')} onClick={() => setAdd('keyfile')} />
+ <Button small label={t('passwords.set.addPasskey')} onClick={() => setAdd('passkey')} />
+ <Button small label={t('passwords.set.addFido')} onClick={() => setAdd('fido')} />
</View>
)}
{add && (
- <View style={{ gap: 8, padding: 12, borderRadius: 10, border: `1px solid ${th.separator}` }}>
+ <View style={{ gap: 10, padding: 14, borderRadius: 10, border: `1px solid ${th.separator}` }}>
<Text style={{ fontSize: 13, fontWeight: 600, color: th.text }}>{t(`passwords.set.adding.${add}`)}</Text>
<Hint>{t(`passwords.create.about.${add === 'change' ? 'password' : add}`)}</Hint>
{add === 'change' && <TextInput value={old} onChange={setOld} secure placeholder={t('passwords.set.oldPassword')} />}
@@ -87,8 +90,9 @@ export function SettingsSheet({ onClose }) {
</>}
{(add === 'keyfile' || add === 'passkey') && (
<View style={{ flexDirection: 'row', gap: 8, alignItems: 'center' }}>
- <Text style={{ flex: 1, fontSize: 12, color: path ? th.text : th.textDim, whiteSpace: 'nowrap', overflow: 'hidden' }}>{fileName(path) || t('passwords.create.keyWhere')}</Text>
- <Button label={t('passwords.create.chooseKeyPath')} onClick={() => setPicking(true)} />
+ <Glyph kind="drive" size={14} color={path ? th.accent : th.textDim} />
+ <Text style={{ flex: 1, minWidth: 0, fontSize: 12, color: path ? th.text : th.textDim, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{fileName(path) || t('passwords.create.keyWhere')}</Text>
+ <Button small label={t('passwords.create.chooseKeyPath')} onClick={() => setPicking(true)} />
</View>
)}
{add === 'passkey' && <Warning>{t('passwords.set.passkeyWarn')}</Warning>}
@@ -104,25 +108,24 @@ export function SettingsSheet({ onClose }) {
{!add && err ? <Text style={{ fontSize: 12, color: RED }}>{err}</Text> : null}
</View>
) : (
- <View style={{ gap: 10 }}>
- <Row label={t('passwords.set.autolock')}>
+ <View style={{ gap: 12 }}>
+ <Group>
+ <Row label={t('passwords.set.autolock')} hint={t('passwords.set.autolockHint')}>
<Choice value={meta.autolock ?? 300} width={190} onChange={(autolock) => setMeta({ autolock }).catch((e) => toast(errorText(e.code)))} options={[
[60, t('passwords.set.min', { n: 1 })], [300, t('passwords.set.min', { n: 5 })], [900, t('passwords.set.min', { n: 15 })],
[3600, t('passwords.set.hour')], [0, t('passwords.set.never')]]} />
</Row>
- <Hint>{t('passwords.set.autolockHint')}</Hint>
- <Row label={t('passwords.set.clip')}>
+ <Row label={t('passwords.set.clip')} hint={t('passwords.set.clipHint')}>
<Choice value={meta.clip ?? 30} width={190} onChange={(clip) => setMeta({ clip }).catch(() => {})} options={[
[15, t('passwords.set.sec', { n: 15 })], [30, t('passwords.set.sec', { n: 30 })], [60, t('passwords.set.sec', { n: 60 })], [120, t('passwords.set.sec', { n: 120 })]]} />
</Row>
- <Hint>{t('passwords.set.clipHint')}</Hint>
- <Row label={t('passwords.set.calibrate')}>
- <Button label={busy ? t('passwords.saving') : t('passwords.set.measure')} onClick={() => run(async () => {
+ <Row label={t('passwords.set.calibrate')} hint={t('passwords.set.calibrateHint')}>
+ <Button small label={busy ? t('passwords.saving') : t('passwords.set.measure')} onClick={() => run(async () => {
const r = await req('calibrate', { targetMs: 700 });
toast(t('passwords.set.measured', { m: Math.round(r.m / 1024), t: r.t, ms: r.ms }));
})} />
</Row>
- <Hint>{t('passwords.set.calibrateHint')}</Hint>
+ </Group>
<Hint>{t('passwords.set.memory', { kb: Math.round((st.status?.mem?.inUse || 0) / 1024), locked: Math.round((st.status?.mem?.locked || 0) / 1024) })}</Hint>
</View>
)}
@@ -131,17 +134,21 @@ export function SettingsSheet({ onClose }) {
);
}
-function Row({ label, children }) {
+// A settings row: the label (and a hint under it) at the start, the control at the end.
+function Row({ label, hint, children }) {
const th = useTheme();
return (
- <View style={{ flexDirection: 'row', alignItems: 'center', gap: 10 }}>
- <Text style={{ flex: 1, fontSize: 13, color: th.text }}>{label}</Text>
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: 12, paddingVertical: 8, minHeight: 36 }}>
+ <View style={{ flex: 1, minWidth: 0, gap: 2 }}>
+ <Text style={{ fontSize: 13, color: th.text }}>{label}</Text>
+ {hint ? <Text style={{ fontSize: 11, color: th.textDim, lineHeight: 15 }}>{hint}</Text> : null}
+ </View>
{children}
</View>
);
}
-// ---- importar ----
+// ---- import ----
export function ImportSheet({ onClose }) {
const th = useTheme();
@@ -174,26 +181,31 @@ export function ImportSheet({ onClose }) {
<Button key="c" label={t('passwords.close')} onClick={onClose} />,
<Button key="g" primary label={busy ? t('passwords.imp.working') : t('passwords.imp.button')} onClick={go} />]}>
<Hint>{t('passwords.imp.formats')}</Hint>
- <View style={{ flexDirection: 'row', gap: 8, alignItems: 'center' }}>
- <Text style={{ flex: 1, fontSize: 12, color: file ? th.text : th.textDim, whiteSpace: 'nowrap', overflow: 'hidden' }}>{fileName(file) || t('passwords.imp.noFile')}</Text>
- <Button label={t('passwords.imp.choose')} onClick={() => setPicking('file')} />
+ <View style={{ height: 40, flexDirection: 'row', gap: 8, alignItems: 'center', paddingInlineStart: 12, paddingInlineEnd: 6, borderRadius: 8, border: `1px solid ${th.separator}` }}>
+ <Glyph kind="note" size={15} color={file ? th.accent : th.textDim} />
+ <Text style={{ flex: 1, minWidth: 0, fontSize: 12, color: file ? th.text : th.textDim, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{fileName(file) || t('passwords.imp.noFile')}</Text>
+ <Button small label={t('passwords.imp.choose')} onClick={() => setPicking('file')} />
</View>
{(isKdbx || isVault) && (
<View style={{ gap: 8 }}>
<TextInput value={pw} onChange={setPw} secure placeholder={isVault ? t('passwords.imp.vaultPassword') : t('passwords.imp.kdbxPassword')} onSubmit={go} />
<View style={{ flexDirection: 'row', gap: 8, alignItems: 'center' }}>
- <Text style={{ flex: 1, fontSize: 12, color: key ? th.text : th.textDim, whiteSpace: 'nowrap', overflow: 'hidden' }}>{fileName(key) || t('passwords.imp.noKey')}</Text>
- <Button label={t('passwords.imp.chooseKey')} onClick={() => setPicking('key')} />
+ <Text style={{ flex: 1, minWidth: 0, fontSize: 12, color: key ? th.text : th.textDim, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{fileName(key) || t('passwords.imp.noKey')}</Text>
+ <Button small label={t('passwords.imp.chooseKey')} onClick={() => setPicking('key')} />
</View>
</View>
)}
{isKdbx && <Hint>{t('passwords.imp.kdbxHint')}</Hint>}
{err ? <Text style={{ fontSize: 12, color: RED }}>{err}</Text> : null}
{res && (
- <View style={{ padding: 12, borderRadius: 10, backgroundColor: 'rgba(48,209,88,0.15)', gap: 4 }}>
- <Text style={{ fontSize: 14, fontWeight: 600, color: th.text }}>{t('passwords.imp.done', { count: res.count })}</Text>
+ <View style={{ flexDirection: 'row', gap: 10, paddingHorizontal: 12, paddingVertical: 10, borderRadius: 10, backgroundColor: 'rgba(48,209,88,0.12)',
+ border: '1px solid rgba(48,209,88,0.35)' }}>
+ <Text style={{ fontSize: 13, fontWeight: 700, color: GREEN, lineHeight: 18 }}>✓</Text>
+ <View style={{ flex: 1, gap: 2 }}>
+ <Text style={{ fontSize: 13, fontWeight: 600, color: th.text, lineHeight: 18 }}>{t('passwords.imp.done', { count: res.count })}</Text>
{res.format && <Text style={{ fontSize: 12, color: th.textDim }}>{t('passwords.imp.detected', { format: t(`passwords.fmt.${res.format}`) })}</Text>}
{res.cats ? <Text style={{ fontSize: 12, color: th.textDim }}>{t('passwords.imp.cats', { count: res.cats })}</Text> : null}
+ </View>
</View>
)}
{picking && <FilePicker title={picking === 'file' ? t('passwords.imp.choose') : t('passwords.imp.chooseKey')} onClose={() => setPicking(null)}
@@ -203,7 +215,7 @@ export function ImportSheet({ onClose }) {
);
}
-// ---- exportar ----
+// ---- export ----
export function ExportSheet({ onClose }) {
const th = useTheme();
@@ -222,17 +234,12 @@ export function ExportSheet({ onClose }) {
return (
<Sheet title={t('passwords.exp.title')} onClose={onClose} width={520} footer={[
<Button key="c" label={t('passwords.cancel')} onClick={onClose} />,
- <Button key="g" primary label={t('passwords.exp.button')} onClick={() => (kind === 'vault' || ok) && setPicking(true)} />]}>
- <Segmented value={kind} onChange={(k) => { setKind(k); setOk(false); }} options={[['vault', t('passwords.exp.vault')], ['csv', t('passwords.exp.csv')]]} />
+ <Button key="g" primary disabled={kind === 'csv' && !ok} label={t('passwords.exp.button')} onClick={() => (kind === 'vault' || ok) && setPicking(true)} />]}>
+ <Segmented appearance="neutral" fill value={kind} onChange={(k) => { setKind(k); setOk(false); }} options={[['vault', t('passwords.exp.vault')], ['csv', t('passwords.exp.csv')]]} />
{kind === 'vault' ? <Hint>{t('passwords.exp.vaultHint')}</Hint> : (
<View style={{ gap: 8 }}>
<Warning>{t('passwords.exp.csvWarning')}</Warning>
- <View onClick={() => setOk(!ok)} style={{ flexDirection: 'row', gap: 8, alignItems: 'center' }}>
- <View style={{ width: 18, height: 18, borderRadius: 4, border: `1px solid ${th.separator}`, backgroundColor: ok ? RED : th.inputBg, alignItems: 'center', justifyContent: 'center' }}>
- {ok && <Text style={{ fontSize: 11, color: '#fff' }}>✓</Text>}
- </View>
- <Text style={{ flex: 1, fontSize: 12, color: th.text }}>{t('passwords.exp.csvConfirm')}</Text>
- </View>
+ <Check on={ok} onChange={setOk} color={RED} label={t('passwords.exp.csvConfirm')} />
</View>
)}
{err ? <Text style={{ fontSize: 12, color: RED }}>{err}</Text> : null}
@@ -241,7 +248,7 @@ export function ExportSheet({ onClose }) {
);
}
-// ---- categorías ----
+// ---- categories ----
export function CategorySheet({ cat, onClose }) {
const th = useTheme();
@@ -249,7 +256,7 @@ export function CategorySheet({ cat, onClose }) {
const cats = allCategories(st.cats);
const isNew = !cat;
const [name, setName] = useState(cat?.name || '');
- const [icon, setIcon] = useState(cat?.icon || '📁');
+ const [icon, setIcon] = useState(iconKind(cat?.icon));
const [color, setColor] = useState(cat?.color || COLORS[0]);
const [parent, setParent] = useState(cat?.parent || '');
const [template, setTemplate] = useState(cat?.template || 'general');
@@ -270,45 +277,52 @@ export function CategorySheet({ cat, onClose }) {
const parents = [['', t('passwords.cats.noParent')], ...cats.filter((c) => c.id !== cat?.id).map((c) => [c.id, catName(c)])];
return (
<Sheet title={isNew ? t('passwords.cats.new') : t('passwords.cats.edit')} onClose={onClose} width={540} footer={[
- !isNew && <Button key="d" label={t('passwords.cats.delete')} onClick={remove} />,
+ !isNew && <Button key="d" destructive label={t('passwords.cats.delete')} onClick={remove} />, !isNew && <View key="sp" style={{ flex: 1 }} />,
<Button key="c" label={t('passwords.cancel')} onClick={onClose} />,
<Button key="s" primary label={t('passwords.save')} onClick={save} />].filter(Boolean)}>
- <View style={{ flexDirection: 'row', gap: 10, alignItems: 'center' }}>
- <CatIcon cat={{ icon, color }} size={40} />
- <TextInput value={name} onChange={setName} placeholder={t('passwords.cats.name')} autoFocus style={{ flex: 1 }} />
+ <View style={{ flexDirection: 'row', gap: 12, alignItems: 'center' }}>
+ <CatIcon cat={{ icon, color }} size={36} />
+ <TextInput value={name} onChange={setName} placeholder={t('passwords.cats.name')} autoFocus style={{ flex: 1, minWidth: 0 }} />
</View>
- <Label>{t('passwords.cats.icon')}</Label>
- <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 4 }}>
- {ICONS.map((i) => <View key={i} onClick={() => setIcon(i)} style={{ width: 30, height: 30, borderRadius: 7, alignItems: 'center', justifyContent: 'center', backgroundColor: i === icon ? th.accent : th.control }}>
- <Text style={{ fontSize: 16 }}>{i}</Text></View>)}
+ <View style={{ gap: 6 }}>
+ <Label>{t('passwords.cats.icon')}</Label>
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 4 }}>
+ {ICONS.map((i) => <View key={i} onClick={() => setIcon(i)} style={{ width: 32, height: 32, borderRadius: 7, alignItems: 'center', justifyContent: 'center',
+ backgroundColor: i === icon ? th.accent : th.control }}>
+ <Glyph kind={i} size={16} color={i === icon ? '#fff' : th.text} /></View>)}
+ </View>
</View>
- <Label>{t('passwords.cats.color')}</Label>
- <View style={{ flexDirection: 'row', gap: 6 }}>
- {COLORS.map((c) => <View key={c} onClick={() => setColor(c)} style={{ width: 22, height: 22, borderRadius: 11, backgroundColor: c, border: c === color ? `2px solid ${th.text}` : '2px solid transparent' }} />)}
+ <View style={{ gap: 6 }}>
+ <Label>{t('passwords.cats.color')}</Label>
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 8 }}>
+ {COLORS.map((c) => <View key={c} onClick={() => setColor(c)} style={{ width: 22, height: 22, borderRadius: 11, alignItems: 'center', justifyContent: 'center',
+ border: c === color ? `2px solid ${th.accent}` : '2px solid transparent' }}>
+ <View style={{ width: 16, height: 16, borderRadius: 8, backgroundColor: c }} /></View>)}
+ </View>
</View>
- <View style={{ flexDirection: 'row', gap: 10 }}>
- <View style={{ flex: 1, gap: 4 }}><Label>{t('passwords.cats.parent')}</Label><Choice value={parent} options={parents} onChange={setParent} width={230} /></View>
- <View style={{ flex: 1, gap: 4 }}><Label>{t('passwords.cats.template')}</Label>
- <Choice value={template} options={BUILTIN.map((b) => [b.id, `${b.icon} ${t(`passwords.cat.${b.id}`)}`])} onChange={setTemplate} width={230} /></View>
+ <View style={{ flexDirection: 'row', gap: 12 }}>
+ <View style={{ flex: 1, minWidth: 0, gap: 6 }}><Label>{t('passwords.cats.parent')}</Label><Choice value={parent} options={parents} onChange={setParent} width={220} /></View>
+ <View style={{ flex: 1, minWidth: 0, gap: 6 }}><Label>{t('passwords.cats.template')}</Label>
+ <Choice value={template} options={BUILTIN.map((b) => [b.id, t(`passwords.cat.${b.id}`)])} onChange={setTemplate} width={220} /></View>
</View>
<Label>{t('passwords.cats.fields')}</Label>
<Hint>{t('passwords.cats.fieldsHint')}</Hint>
{fields.map((f, i) => (
<View key={i} style={{ flexDirection: 'row', gap: 6, alignItems: 'center' }}>
- <TextInput value={f.l || ''} onChange={(l) => setFields(fields.map((x, k) => (k === i ? { ...x, l } : x)))} placeholder={t('passwords.edit.fieldName')} style={{ flex: 1 }} />
+ <TextInput value={f.l || ''} onChange={(l) => setFields(fields.map((x, k) => (k === i ? { ...x, l } : x)))} placeholder={t('passwords.edit.fieldName')} style={{ flex: 1, minWidth: 0 }} />
<Choice value={f.multiline ? 'multiline' : f.t} options={FIELD_TYPES.map((x) => [x, t(`passwords.ftype.${x}`)])} width={150}
onChange={(ty) => setFields(fields.map((x, k) => (k === i ? { ...x, t: ty === 'multiline' ? 'text' : ty, multiline: ty === 'multiline' } : x)))} />
- <Button label="✕" onClick={() => setFields(fields.filter((_, k) => k !== i))} />
+ <Button small plain label="✕" onClick={() => setFields(fields.filter((_, k) => k !== i))} />
</View>
))}
- <Button label={t('passwords.edit.addFieldDots')} style={{ alignSelf: 'flex-start' }}
+ <Button small icon="+" label={t('passwords.edit.addFieldDots')} style={{ alignSelf: 'flex-start' }}
onClick={() => setFields([...fields, { k: `c${fields.length + 1}`, t: 'text', l: '' }])} />
{err ? <Text style={{ fontSize: 12, color: RED }}>{err}</Text> : null}
</Sheet>
);
}
-// ---- etiquetas ----
+// ---- tags ----
export function TagSheet({ tag, onClose }) {
const st = useStore(app);
@@ -327,10 +341,13 @@ export function TagSheet({ tag, onClose }) {
const remove = async () => { try { await req('rename-tag', { from: tag, to: '' }); await setTags((st.tags || []).filter((x) => x.name !== tag)); await reload(); onClose(); } catch (e) { toast(errorText(e.code)); } };
return (
<Sheet title={t('passwords.tags.edit')} onClose={onClose} width={420} footer={[
- <Button key="d" label={t('passwords.tags.delete')} onClick={remove} />, <Button key="s" primary label={t('passwords.save')} onClick={save} />]}>
+ <Button key="d" destructive label={t('passwords.tags.delete')} onClick={remove} />, <View key="sp" style={{ flex: 1 }} />,
+ <Button key="c" label={t('passwords.cancel')} onClick={onClose} />, <Button key="s" primary label={t('passwords.save')} onClick={save} />]}>
<TextInput value={name} onChange={setName} autoFocus />
- <View style={{ flexDirection: 'row', gap: 6 }}>
- {COLORS.map((c) => <View key={c} onClick={() => setColor(c)} style={{ width: 22, height: 22, borderRadius: 11, backgroundColor: c, border: c === color ? `2px solid ${th.text}` : '2px solid transparent' }} />)}
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 8 }}>
+ {COLORS.map((c) => <View key={c} onClick={() => setColor(c)} style={{ width: 22, height: 22, borderRadius: 11, alignItems: 'center', justifyContent: 'center',
+ border: c === color ? `2px solid ${th.accent}` : '2px solid transparent' }}>
+ <View style={{ width: 16, height: 16, borderRadius: 8, backgroundColor: c }} /></View>)}
</View>
</Sheet>
);
diff --git a/apps/passwords/glyphs.jsx b/apps/passwords/glyphs.jsx
new file mode 100644
index 0000000..915f6c8
--- /dev/null
+++ b/apps/passwords/glyphs.jsx
@@ -0,0 +1,233 @@
+// glyphs.jsx — the icons of Passwords, drawn with views (no color emoji, see docs/DESIGN.md):
+// source-list glyphs in the accent color, white glyphs on the colored category tiles, and the
+// eye / clip / clock / shield shapes used by the detail pane and the dialogs.
+// A category stores the name of its glyph ("globe", "key"…); categories saved by older versions
+// stored an emoji, which iconKind() maps to the closest glyph.
+import { View, Text, useTheme } from '@lordos/sdk';
+
+// The glyphs a user category can pick (Settings → New category), in picker order.
+export const GLYPH_KINDS = ['folder', 'globe', 'mail', 'bank', 'card', 'network', 'wifi', 'terminal', 'database', 'apps', 'key', 'braces',
+ 'id', 'coin', 'shield', 'note', 'lock', 'star', 'person', 'briefcase', 'clock', 'drive'];
+
+const LEGACY = {
+ '🗂': 'folder', '📁': 'folder', '📂': 'folder', '🏠': 'folder', '🌐': 'globe', '✉': 'mail', '📧': 'mail', '🏦': 'bank', '💰': 'bank', '💳': 'card',
+ '🖧': 'network', '📡': 'network', '📶': 'wifi', '🖥': 'terminal', '💻': 'terminal', '🗄': 'database', '📱': 'apps', '🎮': 'apps', '🔑': 'key',
+ '🗝': 'key', '🧩': 'braces', '🪪': 'id', '🪙': 'coin', '🛡': 'shield', '📝': 'note', '📄': 'note', '🔒': 'lock', '🔐': 'lock', '⭐': 'star',
+ '👤': 'person', '🐧': 'key', '💼': 'briefcase', '🎓': 'briefcase', '🛒': 'briefcase', '✈': 'briefcase', '🏥': 'shield', '⚙': 'apps',
+ '📷': 'apps', '🎵': 'apps', '📦': 'drive', '💾': 'drive',
+};
+
+// The glyph of a stored icon value (a glyph name, or an emoji from an older version).
+export function iconKind(icon, fallback = 'folder') {
+ const s = String(icon || '');
+ if (GLYPH_KINDS.includes(s)) return s;
+ const bare = s.replace(/️/g, '');
+ return LEGACY[bare] || fallback;
+}
+
+export function Glyph({ kind, size = 16, color }) {
+ const th = useTheme();
+ const c = color || th.accent;
+ const s = size;
+ const w = Math.max(1.5, Math.round(s / 11 * 2) / 2); // stroke
+ const box = (children, extra) => (
+ <View style={{ width: s, height: s, alignItems: 'center', justifyContent: 'center', ...extra }}>{children}</View>
+ );
+ const line = (style) => <View style={{ position: 'absolute', backgroundColor: c, ...style }} />;
+ switch (kind) {
+ case 'lock':
+ return box(<>
+ <View style={{ width: s * 0.5, height: s * 0.42, marginBottom: -w, borderTopLeftRadius: s * 0.25, borderTopRightRadius: s * 0.25,
+ borderTopWidth: w, borderLeftWidth: w, borderRightWidth: w, borderColor: c }} />
+ <View style={{ width: s * 0.74, height: s * 0.48, borderRadius: s * 0.1, backgroundColor: c }} />
+ </>);
+ case 'star':
+ return box(<Text style={{ fontSize: s * 0.92, lineHeight: s, color: c }}>★</Text>);
+ case 'archive':
+ return box(<>
+ <View style={{ width: s * 0.9, height: s * 0.2, borderRadius: 1.5, backgroundColor: c, marginBottom: 1 }} />
+ <View style={{ width: s * 0.76, height: s * 0.48, borderBottomLeftRadius: s * 0.1, borderBottomRightRadius: s * 0.1, border: `${w}px solid ${c}`, alignItems: 'center' }}>
+ <View style={{ marginTop: s * 0.1, width: s * 0.28, height: w, backgroundColor: c }} />
+ </View>
+ </>);
+ case 'trash':
+ return box(<>
+ <View style={{ width: s * 0.3, height: s * 0.1, borderTopLeftRadius: 1.5, borderTopRightRadius: 1.5, backgroundColor: c }} />
+ <View style={{ width: s * 0.8, height: w, backgroundColor: c, marginBottom: 1 }} />
+ <View style={{ width: s * 0.6, height: s * 0.54, borderBottomLeftRadius: s * 0.1, borderBottomRightRadius: s * 0.1, border: `${w}px solid ${c}` }} />
+ </>);
+ case 'folder':
+ return box(
+ <View style={{ width: s * 0.86, height: s * 0.66 }}>
+ <View style={{ width: s * 0.36, height: s * 0.16, borderTopLeftRadius: s * 0.08, borderTopRightRadius: s * 0.08, backgroundColor: c }} />
+ <View style={{ flex: 1, borderRadius: s * 0.1, borderTopLeftRadius: 0, border: `${w}px solid ${c}` }} />
+ </View>,
+ );
+ case 'clock':
+ return box(
+ <View style={{ width: s * 0.84, height: s * 0.84, borderRadius: s * 0.42, border: `${w}px solid ${c}` }}>
+ {line({ left: s * 0.42 - w * 1.5, top: s * 0.16, width: w, height: s * 0.28 })}
+ {line({ left: s * 0.42 - w * 1.5, top: s * 0.42 - w * 1.5, width: s * 0.22, height: w })}
+ </View>,
+ );
+ case 'wifi':
+ return box(
+ <View style={{ flexDirection: 'row', alignItems: 'flex-end', gap: s * 0.1, height: s * 0.76, direction: 'ltr' }}>
+ {[0.32, 0.54, 0.76].map((h) => <View key={h} style={{ width: s * 0.2, height: s * h, borderRadius: 1.5, backgroundColor: c }} />)}
+ </View>,
+ );
+ case 'note':
+ return box(
+ <View style={{ width: s * 0.7, height: s * 0.86, borderRadius: s * 0.1, border: `${w}px solid ${c}`, paddingTop: s * 0.14, paddingHorizontal: s * 0.1, gap: s * 0.1 }}>
+ {[1, 0.8, 0.55].map((f) => <View key={f} style={{ width: `${f * 100}%`, height: w, backgroundColor: c }} />)}
+ </View>,
+ );
+ case 'card':
+ return box(
+ <View style={{ width: s * 0.9, height: s * 0.64, borderRadius: s * 0.1, border: `${w}px solid ${c}`, overflow: 'hidden' }}>
+ <View style={{ marginTop: s * 0.1, height: s * 0.14, backgroundColor: c }} />
+ </View>,
+ );
+ case 'shield':
+ return box(
+ <View style={{ width: s * 0.7, height: s * 0.84, borderTopLeftRadius: s * 0.08, borderTopRightRadius: s * 0.08,
+ borderBottomLeftRadius: s * 0.35, borderBottomRightRadius: s * 0.35, border: `${w}px solid ${c}` }} />,
+ );
+ case 'person':
+ return box(<>
+ <View style={{ width: s * 0.4, height: s * 0.4, borderRadius: s * 0.2, backgroundColor: c, marginBottom: s * 0.06 }} />
+ <View style={{ width: s * 0.76, height: s * 0.34, borderTopLeftRadius: s * 0.38, borderTopRightRadius: s * 0.38, backgroundColor: c }} />
+ </>);
+ case 'globe':
+ return box(
+ <View style={{ width: s * 0.86, height: s * 0.86, borderRadius: s * 0.43, border: `${w}px solid ${c}`, alignItems: 'center', justifyContent: 'center' }}>
+ <View style={{ width: s * 0.36, height: s * 0.86 - w * 2, borderRadius: s * 0.18, border: `${w}px solid ${c}` }} />
+ {line({ left: 0, right: 0, top: s * 0.43 - w * 1.5, height: w })}
+ </View>,
+ );
+ case 'mail':
+ return box(
+ <View style={{ width: s * 0.9, height: s * 0.64, borderRadius: s * 0.08, border: `${w}px solid ${c}`, overflow: 'hidden', alignItems: 'center' }}>
+ <View style={{ position: 'absolute', top: -s * 0.34, width: s * 0.6, height: s * 0.6, borderRadius: s * 0.06, border: `${w}px solid ${c}`, transform: 'rotate(45deg)' }} />
+ </View>,
+ );
+ case 'bank':
+ return box(<>
+ <View style={{ width: s * 0.84, height: s * 0.16, borderTopLeftRadius: s * 0.3, borderTopRightRadius: s * 0.3, backgroundColor: c }} />
+ <View style={{ flexDirection: 'row', gap: s * 0.12, height: s * 0.4, marginVertical: s * 0.04 }}>
+ {[0, 1, 2].map((i) => <View key={i} style={{ width: s * 0.12, backgroundColor: c }} />)}
+ </View>
+ <View style={{ width: s * 0.84, height: s * 0.12, backgroundColor: c }} />
+ </>);
+ case 'network':
+ return box(<>
+ <View style={{ width: s * 0.36, height: s * 0.26, borderRadius: s * 0.05, backgroundColor: c }} />
+ <View style={{ width: w, height: s * 0.12, backgroundColor: c }} />
+ <View style={{ width: s * 0.66, height: w, backgroundColor: c }} />
+ <View style={{ flexDirection: 'row', width: s * 0.9, justifyContent: 'space-between' }}>
+ {[0, 1].map((i) => <View key={i} style={{ alignItems: 'center' }}>
+ <View style={{ width: w, height: s * 0.1, backgroundColor: c }} />
+ <View style={{ width: s * 0.32, height: s * 0.22, borderRadius: s * 0.05, backgroundColor: c }} />
+ </View>)}
+ </View>
+ </>);
+ case 'terminal':
+ return box(
+ <View style={{ width: s * 0.9, height: s * 0.72, borderRadius: s * 0.1, border: `${w}px solid ${c}`, justifyContent: 'center', paddingInlineStart: s * 0.08, direction: 'ltr' }}>
+ <Text style={{ fontSize: s * 0.42, lineHeight: s * 0.5, fontWeight: 700, color: c }}>{'>_'}</Text>
+ </View>,
+ );
+ case 'database':
+ return box(
+ <View style={{ gap: s * 0.04 }}>
+ {[0, 1, 2].map((i) => <View key={i} style={{ width: s * 0.72, height: s * 0.24, borderRadius: s * 0.12, border: `${w}px solid ${c}` }} />)}
+ </View>,
+ );
+ case 'apps':
+ return box(
+ <View style={{ width: s * 0.78, flexDirection: 'row', flexWrap: 'wrap', gap: s * 0.1 }}>
+ {[0, 1, 2, 3].map((i) => <View key={i} style={{ width: s * 0.34, height: s * 0.34, borderRadius: s * 0.08, backgroundColor: c }} />)}
+ </View>,
+ );
+ case 'key':
+ return box(
+ <View style={{ flexDirection: 'row', alignItems: 'center', direction: 'ltr' }}>
+ <View style={{ width: s * 0.4, height: s * 0.4, borderRadius: s * 0.2, border: `${w * 1.3}px solid ${c}` }} />
+ <View style={{ width: s * 0.46, height: w * 1.3, backgroundColor: c }}>
+ <View style={{ position: 'absolute', right: 0, top: 0, width: w * 1.3, height: s * 0.2, backgroundColor: c }} />
+ <View style={{ position: 'absolute', right: s * 0.12, top: 0, width: w * 1.3, height: s * 0.14, backgroundColor: c }} />
+ </View>
+ </View>,
+ );
+ case 'braces':
+ return box(<Text style={{ fontSize: s * 0.62, lineHeight: s * 0.8, fontWeight: 700, color: c, direction: 'ltr' }}>{'{ }'}</Text>);
+ case 'id':
+ return box(
+ <View style={{ width: s * 0.9, height: s * 0.64, borderRadius: s * 0.1, border: `${w}px solid ${c}`, flexDirection: 'row', alignItems: 'center',
+ paddingHorizontal: s * 0.08, gap: s * 0.08, direction: 'ltr' }}>
+ <View style={{ width: s * 0.22, height: s * 0.22, borderRadius: s * 0.11, backgroundColor: c }} />
+ <View style={{ flex: 1, gap: s * 0.08 }}>
+ <View style={{ height: w, backgroundColor: c }} />
+ <View style={{ width: '70%', height: w, backgroundColor: c }} />
+ </View>
+ </View>,
+ );
+ case 'coin':
+ return box(
+ <View style={{ width: s * 0.84, height: s * 0.84, borderRadius: s * 0.42, border: `${w}px solid ${c}`, alignItems: 'center', justifyContent: 'center' }}>
+ <View style={{ width: s * 0.44, height: s * 0.44, borderRadius: s * 0.22, border: `${w}px solid ${c}` }} />
+ </View>,
+ );
+ case 'briefcase':
+ return box(<>
+ <View style={{ width: s * 0.34, height: s * 0.16, borderTopLeftRadius: s * 0.06, borderTopRightRadius: s * 0.06, borderTopWidth: w, borderLeftWidth: w, borderRightWidth: w, borderColor: c }} />
+ <View style={{ width: s * 0.86, height: s * 0.56, borderRadius: s * 0.1, backgroundColor: c }} />
+ </>);
+ case 'drive':
+ return box(<>
+ <View style={{ width: s * 0.3, height: s * 0.2, borderTopLeftRadius: s * 0.04, borderTopRightRadius: s * 0.04, border: `${w}px solid ${c}`, marginBottom: -w }} />
+ <View style={{ width: s * 0.5, height: s * 0.62, borderRadius: s * 0.1, backgroundColor: c }} />
+ </>);
+ case 'eye':
+ case 'eyeOff':
+ return box(<>
+ <View style={{ width: s * 0.9, height: s * 0.56, borderRadius: s * 0.28, border: `${w}px solid ${c}`, alignItems: 'center', justifyContent: 'center' }}>
+ <View style={{ width: s * 0.26, height: s * 0.26, borderRadius: s * 0.13, backgroundColor: c }} />
+ </View>
+ {kind === 'eyeOff' ? <View style={{ position: 'absolute', width: s * 1.0, height: w, backgroundColor: c, transform: 'rotate(-40deg)' }} /> : null}
+ </>);
+ case 'clip':
+ return box(
+ <View style={{ width: s * 0.34, height: s * 0.86, borderRadius: s * 0.17, border: `${w}px solid ${c}`, transform: 'rotate(40deg)' }} />,
+ );
+ case 'image':
+ return box(
+ <View style={{ width: s * 0.9, height: s * 0.72, borderRadius: s * 0.1, border: `${w}px solid ${c}`, overflow: 'hidden', direction: 'ltr' }}>
+ <View style={{ position: 'absolute', left: s * 0.14, top: s * 0.12, width: s * 0.18, height: s * 0.18, borderRadius: s * 0.09, backgroundColor: c }} />
+ <View style={{ position: 'absolute', left: s * 0.2, top: s * 0.36, width: s * 0.5, height: s * 0.5, backgroundColor: c, transform: 'rotate(45deg)' }} />
+ </View>,
+ );
+ default:
+ return box(null);
+ }
+}
+
+// A category's tile: its color as a soft vertical gradient and its glyph in white (as the
+// badges of Settings).
+export function Tile({ kind, color = '#8e8e93', size = 20, radius }) {
+ return (
+ <View style={{ width: size, height: size, borderRadius: radius ?? size * 0.26, alignItems: 'center', justifyContent: 'center',
+ background: `linear-gradient(180deg, ${tint(color, 0.18)}, ${tint(color, -0.12)})` }}>
+ <Glyph kind={kind} size={Math.round(size * 0.62)} color="#ffffff" />
+ </View>
+ );
+}
+
+export function tint(hex, amt) {
+ const m = /^#?([0-9a-f]{6})$/i.exec(String(hex || ''));
+ if (!m) return hex;
+ const n = parseInt(m[1], 16);
+ const ch = (v) => Math.max(0, Math.min(255, Math.round(v + (amt < 0 ? v * amt : (255 - v) * amt))));
+ const r = ch(n >> 16), g = ch((n >> 8) & 255), b = ch(n & 255);
+ return `#${((r << 16) | (g << 8) | b).toString(16).padStart(6, '0')}`;
+}
diff --git a/apps/passwords/index.jsx b/apps/passwords/index.jsx
index 5e0e26e..c02eae1 100644
--- a/apps/passwords/index.jsx
+++ b/apps/passwords/index.jsx
@@ -1,30 +1,34 @@
-// Contraseñas — el gestor de contraseñas de LordOS: entradas por categorías (árbol, con plantillas
-// de campos) y etiquetas, favoritas, archivadas, papelera, historial, códigos 2FA, Wi-Fi con QR,
-// notas seguras, tarjetas, informe de seguridad, generador, importar/exportar y el llavero de la
-// sesión. Todo lo descifrado lo maneja lord-vault, encerrado y sin red; esta ventana está
-// protegida (negra en capturas, grabaciones y escritorio remoto). Ver docs/PASSWORDS.md.
+// Passwords — the LordOS password manager: items by category (a tree, with field templates) and
+// tags, favorites, archived, trash, history, 2FA codes, Wi-Fi with QR, secure notes, cards, the
+// security report, the generator, import/export and the session keyring. Everything decrypted is
+// handled by lord-vault, sandboxed and without network; this window is protected (black in
+// screenshots, recordings and the remote desktop). See docs/PASSWORDS.md.
+// Layout (docs/DESIGN.md): a source list (search, sections, categories, tags), the item list and
+// the detail pane; under 960 px the columns get narrower so nothing is clipped.
import {
- View, Text, useTheme, useStore, useAppWindow, useKeyboard, Button, TextInput, ScrollView, wm, t, vaultAvailable,
+ View, Text, useTheme, useStore, useAppWindow, useKeyboard, Button, ScrollView, SearchField, SectionTitle, ToolbarButton, EmptyState,
+ hasTextFocus, direction, wm, t, vaultAvailable,
} from '@lordos/sdk';
import { useEffect, useMemo, useRef, useState } from 'react';
import { app, req, refreshStatus, wireEvents, reloadLogin } from './api.js';
import { allCategories, builtinById, catName } from './templates.js';
-import { CatIcon, EntryIcon, Chip, shade, Overlays } from './ui.jsx';
+import { CatIcon, EntryIcon, Overlays } from './ui.jsx';
+import { Glyph } from './glyphs.jsx';
import { UnlockView, CreateView } from './Lock.jsx';
-import { EntryView, EntryEditor, Center, tagColor } from './Detail.jsx';
+import { EntryView, EntryEditor, tagColor } from './Detail.jsx';
import { SecurityView, CodesView } from './Security.jsx';
import { GeneratorSheet } from './Generator.jsx';
import { SettingsSheet, ImportSheet, ExportSheet, CategorySheet, TagSheet } from './Settings.jsx';
-// ---- ícono de la app: un candado con tres asteriscos, propio ----
+// ---- the app icon: a padlock with three dots, our own ----
export function Icon({ size: s }) {
return (
<View style={{ width: s, height: s, borderRadius: s * 0.225, background: 'linear-gradient(160deg, #3fd2c7, #1f6fd1)', overflow: 'hidden',
boxShadow: `0 ${s * 0.04}px ${s * 0.12}px rgba(0,0,0,0.35)`, alignItems: 'center' }}>
- {/* arco del candado */}
+ {/* shackle */}
<View style={{ position: 'absolute', top: s * 0.14, width: s * 0.4, height: s * 0.4, borderRadius: s * 0.2, border: `${Math.max(2, s * 0.075)}px solid #ffffff` }} />
- {/* cuerpo */}
+ {/* body */}
<View style={{ position: 'absolute', top: s * 0.38, width: s * 0.62, height: s * 0.44, borderRadius: s * 0.1, backgroundColor: '#ffffff',
flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: s * 0.05, boxShadow: `0 ${s * 0.02}px ${s * 0.05}px rgba(0,0,0,0.25)` }}>
{[0, 1, 2].map((i) => <View key={i} style={{ width: s * 0.09, height: s * 0.09, borderRadius: s * 0.045, backgroundColor: '#1f6fd1' }} />)}
@@ -33,30 +37,30 @@ export function Icon({ size: s }) {
);
}
-// ---- barra lateral ----
+// ---- source list ----
+// A source-list row (as the SDK's SidebarItem): 28 px, a glyph or tile, the label and a count;
+// twisty: a disclosure triangle for categories with children.
function SideRow({ icon, label, count, selected, onClick, depth = 0, color, onDoubleClick, twisty, onTwisty }) {
const th = useTheme();
const [hover, setHover] = useState(false);
+ const glyph = typeof icon === 'string' ? <Glyph kind={icon} size={15} color={selected ? '#fff' : th.accent} /> : icon;
return (
<View onClick={onClick} onDoubleClick={onDoubleClick} onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
- style={{ height: 28, paddingLeft: 8 + depth * 14, paddingRight: 8, borderRadius: 6, flexDirection: 'row', alignItems: 'center', gap: 7,
+ style={{ height: 28, paddingInlineStart: 8 + depth * 16, paddingInlineEnd: 10, borderRadius: 6, flexDirection: 'row', alignItems: 'center', gap: 8,
backgroundColor: selected ? th.accent : hover ? th.hover : 'transparent' }}>
- {twisty != null ? <Text onClick={(e) => { e.stopPropagation?.(); onTwisty?.(); }} style={{ width: 10, fontSize: 9, color: selected ? '#fff' : th.textDim }}>{twisty ? '▾' : '▸'}</Text>
- : depth ? <View style={{ width: 10 }} /> : null}
- {typeof icon === 'string' ? <Text style={{ fontSize: 14, width: 18, textAlign: 'center' }}>{icon}</Text> : icon}
- {color && <View style={{ width: 9, height: 9, borderRadius: 5, backgroundColor: color }} />}
- <Text style={{ flex: 1, fontSize: 13, color: selected ? '#fff' : th.text, whiteSpace: 'nowrap', overflow: 'hidden' }}>{label}</Text>
- {count != null && count > 0 && <Text style={{ fontSize: 11, color: selected ? '#fff' : th.textDim }}>{String(count)}</Text>}
+ {twisty != null ? (
+ <View onClick={(e) => { e.stopPropagation?.(); onTwisty?.(); }} style={{ width: 12, height: 20, marginInlineEnd: -4, alignItems: 'center', justifyContent: 'center' }}>
+ <Text style={{ fontSize: 8, color: selected ? '#fff' : th.textDim, transform: twisty ? 'rotate(90deg)' : direction() === 'rtl' ? 'rotate(180deg)' : undefined }}>▶</Text>
+ </View>
+ ) : depth ? <View style={{ width: 12, marginInlineEnd: -4 }} /> : null}
+ {color ? <View style={{ width: 18, alignItems: 'center' }}><View style={{ width: 9, height: 9, borderRadius: 5, backgroundColor: color }} /></View> : glyph}
+ <Text style={{ flex: 1, minWidth: 0, fontSize: 13, fontWeight: 500, color: selected ? '#fff' : th.text, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{label}</Text>
+ {count != null && count > 0 && <Text style={{ fontSize: 11, color: selected ? 'rgba(255,255,255,0.85)' : th.textDim }}>{String(count)}</Text>}
</View>
);
}
-function Section({ children }) {
- const th = useTheme();
- return <Text style={{ fontSize: 11, fontWeight: 600, color: th.textDim, marginLeft: 10, marginTop: 12, marginBottom: 3 }}>{children}</Text>;
-}
-
function inCat(entryCat, catId, cats) {
if (entryCat === catId) return true;
let c = cats.find((x) => x.id === entryCat);
@@ -79,7 +83,7 @@ function Sidebar({ sel, onSel, issues, onNewCat, onEditCat, onEditTag }) {
const tree = (pid, depth) => childrenOf(pid).map((c) => {
const n = count((e) => inCat(e.cat, c.id, cats));
const kids = childrenOf(c.id);
- if (c.builtin && !n && !kids.length && sel !== `cat:${c.id}`) return null; // las incluidas vacías no ocupan lugar
+ if (c.builtin && !n && !kids.length && sel !== `cat:${c.id}`) return null; // empty built-in ones take no room
const isOpen = open[c.id] !== false;
return [
<SideRow key={c.id} icon={<CatIcon cat={c} size={18} />} label={catName(c)} count={n} depth={depth} selected={sel === `cat:${c.id}`}
@@ -90,72 +94,87 @@ function Sidebar({ sel, onSel, issues, onNewCat, onEditCat, onEditTag }) {
});
return (
<ScrollView style={{ flex: 1 }}>
- <View style={{ padding: 8, gap: 1 }}>
- <SideRow icon="🔐" label={t('passwords.side.all')} count={count((e) => !e.arch)} selected={sel === 'all'} onClick={() => onSel('all')} />
- <SideRow icon="⭐" label={t('passwords.side.fav')} count={count((e) => e.fav)} selected={sel === 'fav'} onClick={() => onSel('fav')} />
- <SideRow icon="🗄️" label={t('passwords.side.archived')} count={count((e) => e.arch)} selected={sel === 'archived'} onClick={() => onSel('archived')} />
- <SideRow icon="🔢" label={t('passwords.side.codes')} count={count((e) => e.totp)} selected={sel === 'codes'} onClick={() => onSel('codes')} />
- <SideRow icon="📶" label={t('passwords.side.wifi')} count={count((e) => inCat(e.cat, 'wifi', cats))} selected={sel === 'cat:wifi'} onClick={() => onSel('cat:wifi')} />
- <SideRow icon="📝" label={t('passwords.side.notes')} count={count((e) => inCat(e.cat, 'notes', cats))} selected={sel === 'cat:notes'} onClick={() => onSel('cat:notes')} />
- <SideRow icon="💳" label={t('passwords.side.cards')} count={count((e) => inCat(e.cat, 'cards', cats))} selected={sel === 'cat:cards'} onClick={() => onSel('cat:cards')} />
- <SideRow icon="🛡️" label={t('passwords.side.security')} count={issues} selected={sel === 'security'} onClick={() => onSel('security')} />
- <View style={{ flexDirection: 'row', alignItems: 'center' }}>
- <View style={{ flex: 1 }}><Section>{t('passwords.side.categories')}</Section></View>
- <Text onClick={onNewCat} style={{ fontSize: 15, color: th.accent, marginRight: 10, marginTop: 8 }}>+</Text>
+ <View style={{ paddingHorizontal: 10, paddingBottom: 12, gap: 2 }}>
+ <SideRow icon="lock" label={t('passwords.side.all')} count={count((e) => !e.arch)} selected={sel === 'all'} onClick={() => onSel('all')} />
+ <SideRow icon="star" label={t('passwords.side.fav')} count={count((e) => e.fav)} selected={sel === 'fav'} onClick={() => onSel('fav')} />
+ <SideRow icon="clock" label={t('passwords.side.codes')} count={count((e) => e.totp)} selected={sel === 'codes'} onClick={() => onSel('codes')} />
+ <SideRow icon="shield" label={t('passwords.side.security')} count={issues} selected={sel === 'security'} onClick={() => onSel('security')} />
+ <SideRow icon="wifi" label={t('passwords.side.wifi')} count={count((e) => inCat(e.cat, 'wifi', cats))} selected={sel === 'cat:wifi'} onClick={() => onSel('cat:wifi')} />
+ <SideRow icon="note" label={t('passwords.side.notes')} count={count((e) => inCat(e.cat, 'notes', cats))} selected={sel === 'cat:notes'} onClick={() => onSel('cat:notes')} />
+ <SideRow icon="card" label={t('passwords.side.cards')} count={count((e) => inCat(e.cat, 'cards', cats))} selected={sel === 'cat:cards'} onClick={() => onSel('cat:cards')} />
+ <SideRow icon="archive" label={t('passwords.side.archived')} count={count((e) => e.arch)} selected={sel === 'archived'} onClick={() => onSel('archived')} />
+ <View style={{ flexDirection: 'row', alignItems: 'center', marginTop: 8 }}>
+ <View style={{ flex: 1 }}><SectionTitle>{t('passwords.side.categories')}</SectionTitle></View>
+ <ToolbarButton small icon="+" iconSize={15} color={th.textDim} title={t('passwords.menu.newCat')} onClick={onNewCat} style={{ marginTop: 6 }} />
</View>
{tree('', 0)}
- {tags.length > 0 && <Section>{t('passwords.side.tags')}</Section>}
+ {tags.length > 0 && <View style={{ marginTop: 8 }}><SectionTitle>{t('passwords.side.tags')}</SectionTitle></View>}
{tags.map((tg) => (
- <SideRow key={tg} icon="#" color={tagColor(tg)} label={tg} count={count((e) => (e.tags || []).includes(tg))} selected={sel === `tag:${tg}`}
+ <SideRow key={tg} color={tagColor(tg)} label={tg} count={count((e) => (e.tags || []).includes(tg))} selected={sel === `tag:${tg}`}
onClick={() => onSel(`tag:${tg}`)} onDoubleClick={() => onEditTag(tg)} />
))}
- <Section>{t('passwords.side.system')}</Section>
- <SideRow icon="👤" label={t('passwords.side.login')} count={st.login.entries.length} selected={sel === 'login'} onClick={() => { reloadLogin(); onSel('login'); }} />
- <SideRow icon="🗑️" label={t('passwords.side.trash')} count={st.entries.filter((e) => e.trash).length} selected={sel === 'trash'} onClick={() => onSel('trash')} />
+ <View style={{ marginTop: 8 }}><SectionTitle>{t('passwords.side.system')}</SectionTitle></View>
+ <SideRow icon="person" label={t('passwords.side.login')} count={st.login.entries.length} selected={sel === 'login'} onClick={() => { reloadLogin(); onSel('login'); }} />
+ <SideRow icon="trash" label={t('passwords.side.trash')} count={st.entries.filter((e) => e.trash).length} selected={sel === 'trash'} onClick={() => onSel('trash')} />
</View>
</ScrollView>
);
}
-// ---- lista ----
+// ---- item list ----
function ListRow({ e, cat, selected, onClick }) {
const th = useTheme();
const [hover, setHover] = useState(false);
+ const dim = selected ? 'rgba(255,255,255,0.82)' : th.textDim;
return (
<View onClick={onClick} onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
- style={{ flexDirection: 'row', alignItems: 'center', gap: 10, paddingHorizontal: 10, paddingVertical: 7, borderRadius: 8,
+ style={{ height: 48, flexDirection: 'row', alignItems: 'center', gap: 10, paddingHorizontal: 10, borderRadius: 8,
backgroundColor: selected ? th.accent : hover ? th.hover : 'transparent' }}>
- <EntryIcon entry={e} cat={cat} size={32} />
- <View style={{ flex: 1, gap: 1 }}>
- <Text style={{ fontSize: 13, fontWeight: 600, color: selected ? '#fff' : th.text, whiteSpace: 'nowrap', overflow: 'hidden' }}>{e.title || t('passwords.untitled')}</Text>
- <Text style={{ fontSize: 11, color: selected ? 'rgba(255,255,255,0.85)' : th.textDim, whiteSpace: 'nowrap', overflow: 'hidden' }}>{e.sub || catName(cat)}</Text>
+ <EntryIcon entry={e} cat={cat} size={30} />
+ <View style={{ flex: 1, minWidth: 0, gap: 1 }}>
+ <Text style={{ fontSize: 13, fontWeight: 600, color: selected ? '#fff' : th.text, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{e.title || t('passwords.untitled')}</Text>
+ <Text style={{ fontSize: 12, color: dim, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{e.sub || catName(cat)}</Text>
</View>
- {e.totp && <Text style={{ fontSize: 10, color: selected ? '#fff' : th.textDim }}>2FA</Text>}
- {e.natt ? <Text style={{ fontSize: 11 }}>📎</Text> : null}
- {e.fav && <Text style={{ fontSize: 12, color: selected ? '#fff' : '#ffd60a' }}>★</Text>}
+ {e.natt ? <Glyph kind="clip" size={13} color={dim} /> : null}
+ {e.totp && <Text style={{ fontSize: 10, fontWeight: 600, color: dim }}>2FA</Text>}
+ {e.fav && <Text style={{ fontSize: 12, color: selected ? '#fff' : '#ffb300' }}>★</Text>}
</View>
);
}
-// ---- ventana ----
+// The width of a box after layout (measured again on every render).
+function useWidth(ref, initial) {
+ const [w, setW] = useState(initial);
+ useEffect(() => {
+ const id = setTimeout(() => {
+ try { if (ref.current) { const nw = lord.getLayout(ref.current.id)[2]; if (nw && Math.abs(nw - w) > 0.5) setW(nw); } } catch (e) { /* not laid out */ }
+ }, 20);
+ return () => clearTimeout(id);
+ });
+ return w;
+}
+
+// ---- window ----
export default function Passwords() {
const th = useTheme();
const win = useAppWindow();
const st = useStore(app);
const [sel, setSel] = useState('all');
- const [cur, setCur] = useState(null); // id de la entrada abierta
+ const [cur, setCur] = useState(null); // id of the open item
const [editing, setEditing] = useState(null); // null | { entry } | { new: catId }
const [q, setQ] = useState('');
- const [hits, setHits] = useState(null); // ids de la búsqueda
+ const [hits, setHits] = useState(null); // ids found by the search
const [searchMs, setSearchMs] = useState(null);
const [sort, setSort] = useState('title');
const [sheet, setSheet] = useState(null); // gen | settings | import | export | cat | tag
const [sheetArg, setSheetArg] = useState(null);
const [issues, setIssues] = useState(0);
+ const rootRef = useRef(null);
+ const winW = useWidth(rootRef, 1040);
- // protegida: negra en capturas, grabaciones, escritorio remoto y miniaturas
+ // protected: black in screenshots, recordings, the remote desktop and thumbnails
useEffect(() => { if (win?.id) wm.setProtected(win.id, true); }, [win?.id]);
useEffect(() => { wireEvents(); refreshStatus(); }, []);
useEffect(() => {
@@ -198,8 +217,19 @@ export default function Passwords() {
]);
}, [win?.id, st.phase, sel]);
+ // ↑ / ↓ move the selection in the item list (when no text field has the focus)
+ const listRef = useRef([]);
useKeyboard((e) => {
- if (!e.meta || st.phase !== 'unlocked') return;
+ if (st.phase !== 'unlocked') return;
+ if (!e.meta && !e.ctrl && (e.key === 'ArrowDown' || e.key === 'ArrowUp') && !hasTextFocus() && !editing && !sheet) {
+ const l = listRef.current;
+ if (!l.length) return;
+ const i = l.findIndex((x) => x.id === cur);
+ const n = e.key === 'ArrowDown' ? Math.min(l.length - 1, i + 1) : Math.max(0, i < 0 ? 0 : i - 1);
+ setCur(l[n].id);
+ return;
+ }
+ if (!e.meta) return;
const k = String(e.base || e.key || '').toLowerCase();
if (k === 'n') newEntry();
else if (k === 'g') openSheet('gen');
@@ -208,10 +238,9 @@ export default function Passwords() {
});
const cats = useMemo(() => allCategories(st.cats), [st.cats]);
- const wrap = (el) => <View style={{ flex: 1 }}>{el}<Overlays /></View>;
- if (!vaultAvailable()) return <Center text={t('passwords.unavailable')} />;
- if (st.phase === 'loading') return <Center text="" />;
- if (st.phase === 'unavailable') return <Center text={t('passwords.unavailable')} />;
+ const wrap = (el) => <View ref={rootRef} style={{ flex: 1 }}>{el}<Overlays /></View>;
+ if (!vaultAvailable() || st.phase === 'unavailable') return <EmptyState icon={<Glyph kind="lock" size={40} color={th.textDim} />} title={t('passwords.unavailable')} />;
+ if (st.phase === 'loading') return <View style={{ flex: 1, backgroundColor: th.windowBg }} />;
if (st.phase === 'none') return wrap(<CreateView />);
if (st.phase === 'locked') return wrap(<UnlockView />);
@@ -236,7 +265,10 @@ export default function Passwords() {
const title = sel === 'all' ? t('passwords.side.all') : sel === 'fav' ? t('passwords.side.fav') : sel === 'archived' ? t('passwords.side.archived')
: sel === 'trash' ? t('passwords.side.trash') : sel === 'login' ? t('passwords.side.login') : sel.startsWith('tag:') ? `#${sel.slice(4)}`
: sel.startsWith('cat:') ? catName(cats.find((c) => c.id === sel.slice(4)) || builtinById(sel.slice(4))) : '';
+ listRef.current = list;
const fullPane = sel === 'security' || sel === 'codes';
+ const narrow = winW < 960;
+ const sideW = narrow ? 200 : 220, listW = narrow ? 250 : 290;
const catOf = (e) => cats.find((c) => c.id === e.cat) || builtinById(e.cat) || { id: e.cat };
let detail;
@@ -246,52 +278,60 @@ export default function Passwords() {
} else if (cur) {
detail = <EntryView key={cur} v={v} id={cur} onEdit={(entry) => setEditing({ entry })} onDeleted={() => setCur(null)} />;
} else {
- detail = <Center text={list.length ? t('passwords.pick') : ''}><Icon size={64} /></Center>;
+ detail = <EmptyState icon={<Icon size={56} />} title={list.length ? t('passwords.pick') : t('passwords.list.empty')}
+ hint={list.length ? t('passwords.pickHint') : t('passwords.emptyHint')} />;
}
+ const canAdd = sel !== 'login' && sel !== 'trash';
return (
- <View style={{ flex: 1, flexDirection: 'row', backgroundColor: th.windowBg }}>
- <View style={{ width: 230, backgroundColor: th.sidebarBg, borderRight: `1px solid ${th.separator}` }}>
- <View style={{ padding: 10, paddingBottom: 4 }}>
- <TextInput value={q} onChange={setQ} placeholder={t('passwords.search')} onCancel={() => setQ('')} />
+ <View ref={rootRef} style={{ flex: 1, flexDirection: 'row', backgroundColor: th.windowBg }}>
+ <View style={{ width: sideW, backgroundColor: th.sidebarBg, borderInlineEndWidth: 1, borderInlineEndColor: th.separator }}>
+ <View style={{ paddingHorizontal: 10, paddingTop: 10, paddingBottom: 6 }}>
+ <SearchField value={q} onChange={setQ} placeholder={t('passwords.search')} />
</View>
<Sidebar sel={sel} onSel={(s) => { setSel(s); setCur(null); setEditing(null); }} issues={issues}
onNewCat={() => openSheet('cat')} onEditCat={(c) => openSheet('cat', c)} onEditTag={(tg) => openSheet('tag', tg)} />
- <View style={{ flexDirection: 'row', gap: 6, padding: 8, borderTop: `1px solid ${th.separator}` }}>
- <Button label="⚄" onClick={() => openSheet('gen')} style={{ paddingHorizontal: 10 }} />
- <Button label="⚙" onClick={() => openSheet('settings')} style={{ paddingHorizontal: 10 }} />
+ <View style={{ height: 41, flexDirection: 'row', alignItems: 'center', gap: 4, paddingHorizontal: 10, borderTopWidth: 1, borderTopColor: th.separator }}>
+ <ToolbarButton icon="⚄" iconSize={16} title={t('passwords.menu.generator')} onClick={() => openSheet('gen')} />
+ <ToolbarButton icon="⚙" iconSize={15} title={t('passwords.menu.settings')} onClick={() => openSheet('settings')} />
<View style={{ flex: 1 }} />
- <Button label={`🔒 ${t('passwords.lock')}`} onClick={lock} />
+ <ToolbarButton icon={<Glyph kind="lock" size={14} color={th.text} />} label={t('passwords.lock')} title={t('passwords.menu.lock')} onClick={lock} />
</View>
</View>
{fullPane ? (
- <View style={{ flex: 1 }}>{sel === 'security'
+ <View style={{ flex: 1, minWidth: 0 }}>{sel === 'security'
? <SecurityView onOpen={(id) => { setSel('all'); setCur(id); }} />
: <CodesView onOpen={(id) => { setSel('all'); setCur(id); }} />}</View>
) : (
<>
- <View style={{ width: 300, borderRight: `1px solid ${th.separator}` }}>
- <View style={{ flexDirection: 'row', alignItems: 'center', paddingHorizontal: 12, paddingTop: 12, paddingBottom: 6, gap: 6 }}>
- <View style={{ flex: 1 }}>
- <Text style={{ fontSize: 17, fontWeight: 700, color: th.text, whiteSpace: 'nowrap', overflow: 'hidden' }}>{title}</Text>
- <Text style={{ fontSize: 11, color: th.textDim }}>{q.trim() && searchMs != null && sel !== 'login'
+ <View style={{ width: listW, borderInlineEndWidth: 1, borderInlineEndColor: th.separator }}>
+ <View style={{ height: 56, flexDirection: 'row', alignItems: 'center', paddingInlineStart: 16, paddingInlineEnd: 10, gap: 4 }}>
+ <View style={{ flex: 1, minWidth: 0 }}>
+ <Text style={{ fontSize: 17, fontWeight: 600, color: th.text, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{title}</Text>
+ <Text style={{ fontSize: 11, color: th.textDim, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{q.trim() && searchMs != null && sel !== 'login'
? t('passwords.list.found', { count: list.length, ms: searchMs.toFixed(1) }) : t('passwords.list.count', { count: list.length })}</Text>
</View>
- <Text onClick={() => setSort(sort === 'title' ? 'modified' : 'title')} style={{ fontSize: 11, color: th.textDim }}>{sort === 'title' ? 'A–Z' : '🕒'}</Text>
- {sel !== 'login' && sel !== 'trash' && <Button label="+" onClick={newEntry} style={{ paddingHorizontal: 10 }} />}
+ <ToolbarButton small label={sort === 'title' ? t('passwords.list.sortName') : t('passwords.list.sortDate')} color={th.textDim}
+ title={t('passwords.list.sortHint')} onClick={() => setSort(sort === 'title' ? 'modified' : 'title')} />
+ {canAdd && <ToolbarButton icon="+" iconSize={17} title={t('passwords.menu.new')} onClick={newEntry} />}
</View>
- {sel === 'login' && <Text style={{ fontSize: 11, color: th.textDim, paddingHorizontal: 12, paddingBottom: 6, lineHeight: 15 }}>{t('passwords.login.hint')}</Text>}
- {sel === 'trash' && list.length > 0 && <Button label={t('passwords.trash.empty')} style={{ marginHorizontal: 12, marginBottom: 6 }}
- onClick={() => req('empty-trash').then(refreshStatus).catch(() => {})} />}
- <ScrollView style={{ flex: 1 }}>
- <View style={{ paddingHorizontal: 6, paddingBottom: 10 }}>
- {list.slice(0, 600).map((e) => <ListRow key={e.id} e={e} cat={catOf(e)} selected={cur === e.id} onClick={() => { setCur(e.id); setEditing(null); }} />)}
- {list.length > 600 && <Text style={{ fontSize: 11, color: th.textDim, padding: 10 }}>{t('passwords.list.more', { count: list.length - 600 })}</Text>}
- {!list.length && <Text style={{ fontSize: 12, color: th.textDim, padding: 14, textAlign: 'center' }}>{q ? t('passwords.list.noResults') : t('passwords.list.empty')}</Text>}
- </View>
- </ScrollView>
+ {sel === 'login' && <Text style={{ fontSize: 11, color: th.textDim, paddingHorizontal: 16, paddingBottom: 8, lineHeight: 15 }}>{t('passwords.login.hint')}</Text>}
+ {sel === 'trash' && list.length > 0 && <View style={{ paddingHorizontal: 16, paddingBottom: 8, alignItems: 'flex-start' }}>
+ <Button small destructive label={t('passwords.trash.empty')} onClick={() => req('empty-trash').then(refreshStatus).catch(() => {})} /></View>}
+ {list.length ? (
+ <ScrollView style={{ flex: 1 }}>
+ <View style={{ paddingHorizontal: 8, paddingBottom: 10, gap: 2 }}>
+ {list.slice(0, 600).map((e) => <ListRow key={e.id} e={e} cat={catOf(e)} selected={cur === e.id} onClick={() => { setCur(e.id); setEditing(null); }} />)}
+ {list.length > 600 && <Text style={{ fontSize: 11, color: th.textDim, padding: 10 }}>{t('passwords.list.more', { count: list.length - 600 })}</Text>}
+ </View>
+ </ScrollView>
+ ) : (
+ <EmptyState icon={<Glyph kind={q ? 'note' : sel === 'trash' ? 'trash' : 'lock'} size={30} color={th.textDim} />}
+ title={q ? t('passwords.list.noResults') : t('passwords.list.empty')} hint={q ? null : canAdd ? t('passwords.list.emptyHint') : null}
+ style={{ justifyContent: 'flex-start', paddingTop: 72 }} />
+ )}
</View>
- <View style={{ flex: 1 }}>{detail}</View>
+ <View style={{ flex: 1, minWidth: 0 }}>{detail}</View>
</>
)}
{sheet === 'gen' && <GeneratorSheet onClose={() => setSheet(null)} />}
@@ -302,9 +342,9 @@ export default function Passwords() {
{sheet === 'tag' && <TagSheet tag={sheetArg} onClose={() => setSheet(null)} />}
<Overlays />
{st.toast && (
- <View style={{ position: 'absolute', bottom: 18, left: 0, right: 0, alignItems: 'center', zIndex: 80 }}>
- <View style={{ paddingHorizontal: 14, paddingVertical: 8, borderRadius: 18, backgroundColor: th.mode === 'dark' ? '#3a3a3c' : '#1c1c1e', boxShadow: '0 6px 20px rgba(0,0,0,0.35)' }}>
- <Text style={{ fontSize: 12, color: '#fff' }}>{st.toast.text}</Text>
+ <View style={{ position: 'absolute', bottom: 20, left: 0, right: 0, alignItems: 'center', zIndex: 80, pointerEvents: 'none' }}>
+ <View style={{ paddingHorizontal: 14, height: 32, justifyContent: 'center', borderRadius: 16, backgroundColor: th.mode === 'dark' ? '#3a3a3c' : '#1c1c1e', boxShadow: '0 6px 20px rgba(0,0,0,0.3)' }}>
+ <Text style={{ fontSize: 12, fontWeight: 500, color: '#fff', whiteSpace: 'nowrap' }}>{st.toast.text}</Text>
</View>
</View>
)}
diff --git a/apps/passwords/templates.js b/apps/passwords/templates.js
index 60c708c..bf4356a 100644
--- a/apps/passwords/templates.js
+++ b/apps/passwords/templates.js
@@ -1,75 +1,76 @@
-// templates.js — categorías incluidas, con la plantilla de campos de cada una, y los tipos de
-// campo. Los nombres se traducen al dibujar (t('passwords.cat.<id>'), t('passwords.field.<clave>')):
-// por eso son funciones y no constantes con texto.
+// templates.js — the built-in categories, each with its field template and its glyph (glyphs.jsx),
+// and the field types. Names are translated when drawn (t('passwords.cat.<id>'),
+// t('passwords.field.<key>')): that is why they are functions and not constants with text.
import { t } from '@lordos/sdk';
+import { GLYPH_KINDS } from './glyphs.jsx';
-// Campos de cada plantilla: k = clave (estable, la usa lord-vault: "password" entra en el informe,
-// "totp" da códigos, "expiry" avisa vencimientos), t = tipo.
+// Fields of each template: k = key (stable, lord-vault uses it: "password" goes into the report,
+// "totp" gives codes, "expiry" warns before it expires), t = type.
const F = (k, type = 'text', extra = {}) => ({ k, t: type, ...extra });
export const BUILTIN = [
- { id: 'general', icon: '🗂️', color: '#8e8e93', fields: [F('username'), F('password', 'hidden'), F('url', 'url')] },
- { id: 'internet', icon: '🌐', color: '#0a84ff', fields: [F('url', 'url'), F('username'), F('password', 'hidden'), F('totp', 'totp')] },
- { id: 'email', icon: '✉️', color: '#5e5ce6', fields: [F('email', 'email'), F('password', 'hidden'), F('imap_host'), F('imap_port', 'number'),
+ { id: 'general', icon: 'folder', color: '#8e8e93', fields: [F('username'), F('password', 'hidden'), F('url', 'url')] },
+ { id: 'internet', icon: 'globe', color: '#0a84ff', fields: [F('url', 'url'), F('username'), F('password', 'hidden'), F('totp', 'totp')] },
+ { id: 'email', icon: 'mail', color: '#5e5ce6', fields: [F('email', 'email'), F('password', 'hidden'), F('imap_host'), F('imap_port', 'number'),
F('smtp_host'), F('smtp_port', 'number'), F('app_password', 'hidden')] },
- { id: 'finance', icon: '🏦', color: '#30d158', fields: [F('bank'), F('client'), F('username'), F('password', 'hidden'), F('transfer_key', 'hidden'),
+ { id: 'finance', icon: 'bank', color: '#30d158', fields: [F('bank'), F('client'), F('username'), F('password', 'hidden'), F('transfer_key', 'hidden'),
F('pin', 'pin'), F('coords', 'hidden', { multiline: true })] },
- { id: 'cards', icon: '💳', color: '#ff9f0a', fields: [F('holder'), F('number', 'hidden'), F('expiry'), F('cvv', 'pin'), F('pin', 'pin'), F('phone')] },
- { id: 'network', icon: '📡', color: '#64d2ff', fields: [F('device'), F('host'), F('port', 'number'), F('username'), F('password', 'hidden')] },
- { id: 'wifi', icon: '📶', color: '#32ade6', fields: [F('ssid'), F('security', 'text', { choices: ['WPA3', 'WPA2', 'WPA', 'WEP', 'none'] }), F('password', 'hidden'),
+ { id: 'cards', icon: 'card', color: '#ff9f0a', fields: [F('holder'), F('number', 'hidden'), F('expiry'), F('cvv', 'pin'), F('pin', 'pin'), F('phone')] },
+ { id: 'network', icon: 'network', color: '#64d2ff', fields: [F('device'), F('host'), F('port', 'number'), F('username'), F('password', 'hidden')] },
+ { id: 'wifi', icon: 'wifi', color: '#32ade6', fields: [F('ssid'), F('security', 'text', { choices: ['WPA3', 'WPA2', 'WPA', 'WEP', 'none'] }), F('password', 'hidden'),
F('hidden', 'bool')] },
- { id: 'ssh', icon: '🖥️', color: '#636366', fields: [F('host'), F('port', 'number'), F('username'), F('password', 'hidden'),
+ { id: 'ssh', icon: 'terminal', color: '#636366', fields: [F('host'), F('port', 'number'), F('username'), F('password', 'hidden'),
F('private_key', 'hidden', { multiline: true }), F('fingerprint')] },
- { id: 'database', icon: '🗄️', color: '#bf5af2', fields: [F('engine', 'text', { choices: ['PostgreSQL', 'MySQL', 'MariaDB', 'SQLite', 'MongoDB', 'Redis', 'SQL Server', 'Oracle'] }),
+ { id: 'database', icon: 'database', color: '#bf5af2', fields: [F('engine', 'text', { choices: ['PostgreSQL', 'MySQL', 'MariaDB', 'SQLite', 'MongoDB', 'Redis', 'SQL Server', 'Oracle'] }),
F('host'), F('port', 'number'), F('database'), F('username'), F('password', 'hidden')] },
- { id: 'apps', icon: '📱', color: '#ff375f', fields: [F('app'), F('account'), F('password', 'hidden'), F('totp', 'totp'), F('recovery_codes', 'hidden', { multiline: true })] },
- { id: 'licenses', icon: '🔑', color: '#ffd60a', fields: [F('product'), F('version'), F('license_key', 'hidden', { multiline: true }), F('email', 'email'),
+ { id: 'apps', icon: 'apps', color: '#ff375f', fields: [F('app'), F('account'), F('password', 'hidden'), F('totp', 'totp'), F('recovery_codes', 'hidden', { multiline: true })] },
+ { id: 'licenses', icon: 'key', color: '#ffd60a', fields: [F('product'), F('version'), F('license_key', 'hidden', { multiline: true }), F('email', 'email'),
F('purchase_date', 'date'), F('expiry', 'date')], attachments: true },
- { id: 'api', icon: '🧩', color: '#ac8e68', fields: [F('service'), F('key', 'hidden'), F('secret', 'hidden'), F('expiry', 'date'), F('scopes')] },
- { id: 'identity', icon: '🪪', color: '#ff6961', fields: [F('doc_type', 'text', { choices: ['dni', 'passport', 'license', 'health'] }), F('number'),
+ { id: 'api', icon: 'braces', color: '#ac8e68', fields: [F('service'), F('key', 'hidden'), F('secret', 'hidden'), F('expiry', 'date'), F('scopes')] },
+ { id: 'identity', icon: 'id', color: '#ff6961', fields: [F('doc_type', 'text', { choices: ['dni', 'passport', 'license', 'health'] }), F('number'),
F('holder'), F('issued', 'date'), F('expiry', 'date'), F('issuer')], attachments: true, photos: true },
- { id: 'crypto', icon: '🪙', color: '#f5a623', fields: [F('wallet'), F('address'), F('seed', 'hidden', { multiline: true }), F('password', 'hidden')], warning: true },
- { id: 'vpn', icon: '🛡️', color: '#34c759', fields: [F('server'), F('vpn_type', 'text', { choices: ['WireGuard', 'OpenVPN', 'IPsec/IKEv2', 'AnyConnect'] }),
+ { id: 'crypto', icon: 'coin', color: '#f5a623', fields: [F('wallet'), F('address'), F('seed', 'hidden', { multiline: true }), F('password', 'hidden')], warning: true },
+ { id: 'vpn', icon: 'shield', color: '#34c759', fields: [F('server'), F('vpn_type', 'text', { choices: ['WireGuard', 'OpenVPN', 'IPsec/IKEv2', 'AnyConnect'] }),
F('username'), F('password', 'hidden')], attachments: true, settingsLink: true },
- { id: 'notes', icon: '📝', color: '#ffcc00', fields: [], attachments: true, notesFirst: true },
+ { id: 'notes', icon: 'note', color: '#ffcc00', fields: [], attachments: true, notesFirst: true },
];
-// Las del llavero de la sesión (no se crean a mano)
+// The session keyring's categories (never created by hand)
export const SYSTEM_CATS = [
- { id: 'keyring', icon: '🔐', color: '#8e8e93', fields: [F('service'), F('username'), F('password', 'hidden')] },
- { id: 'secrets', icon: '🐧', color: '#8e8e93', fields: [F('url', 'url'), F('username'), F('password', 'hidden')] },
+ { id: 'keyring', icon: 'lock', color: '#8e8e93', fields: [F('service'), F('username'), F('password', 'hidden')] },
+ { id: 'secrets', icon: 'key', color: '#8e8e93', fields: [F('url', 'url'), F('username'), F('password', 'hidden')] },
];
export const FIELD_TYPES = ['text', 'hidden', 'url', 'date', 'number', 'email', 'totp', 'file', 'pin', 'multiline'];
-export const ICONS = ['🗂️', '🌐', '✉️', '🏦', '💳', '🖧', '📶', '🖥️', '🗄️', '📱', '🔑', '🧩', '🪪', '🪙', '🛡️', '📝', '📁', '🏠', '💼', '🎓',
- '🎮', '🛒', '✈️', '🏥', '⚙️', '📷', '🎵', '📦', '🔒', '⭐'];
+// The glyphs a user category can pick (drawn in glyphs.jsx; no color emoji).
+export const ICONS = GLYPH_KINDS;
export const COLORS = ['#0a84ff', '#5e5ce6', '#bf5af2', '#ff375f', '#ff453a', '#ff9f0a', '#ffd60a', '#30d158', '#64d2ff', '#ac8e68', '#8e8e93'];
export const builtinById = (id) => BUILTIN.find((c) => c.id === id) || SYSTEM_CATS.find((c) => c.id === id);
-// Nombre visible de una categoría (incluida o del usuario)
+// Visible name of a category (built-in or the user's)
export function catName(cat) {
if (!cat) return '';
if (cat.builtin || builtinById(cat.id) && !cat.name) return t(`passwords.cat.${cat.id}`);
return cat.name || cat.id;
}
-// Etiqueta de un campo: la propia (campos agregados) o la de la plantilla
+// A field's label: its own (added fields) or the template's
export function fieldLabel(f) {
if (f.l) return f.l;
const k = String(f.k || '');
return /^c\d+$/.test(k) ? t('passwords.field.custom') : t(`passwords.field.${k}`);
}
-// Todas las categorías: incluidas + del usuario (árbol por "parent")
+// Every category: built-in + the user's (a tree by "parent")
export function allCategories(userCats = []) {
const builtins = BUILTIN.map((c) => ({ ...c, builtin: true }));
const users = (userCats || []).filter((c) => c && c.id && !builtinById(c.id)).map((c) => ({ ...c, builtin: false }));
return [...builtins, ...users];
}
-// Campos para una entrada nueva de la categoría (los del usuario heredan los de su plantilla)
+// Fields for a new item of the category (user categories inherit their template's)
export function templateFields(cat, cats) {
if (!cat) return BUILTIN[0].fields;
if (cat.fields && cat.fields.length) return cat.fields;
diff --git a/apps/passwords/ui.jsx b/apps/passwords/ui.jsx
index 729e05f..53a711c 100644
--- a/apps/passwords/ui.jsx
+++ b/apps/passwords/ui.jsx
@@ -1,9 +1,11 @@
-// ui.jsx — piezas chicas de la app Contraseñas: íconos de categoría, hojas (diálogos), barra de
-// fuerza, imagen de un código QR, un campo de varias líneas, un selector de archivos y menús.
-import { View, Text, Image, useTheme, useStore, createStore, Button, ScrollView, TextInput, takeTextFocus, releaseTextFocus, fs, t } from '@lordos/sdk';
+// ui.jsx — small pieces of Passwords: category and item icons, sheets (dialogs), the strength
+// bar, a QR code image, a multi-line field, a file picker and pop-up menus. Spacing, type and
+// controls follow docs/DESIGN.md; icons are drawn (glyphs.jsx), never color emoji.
+import { View, Text, Image, useTheme, useStore, createStore, Button, ScrollView, TextInput, ToolbarButton, takeTextFocus, releaseTextFocus, fs, t } from '@lordos/sdk';
import { useEffect, useRef, useState } from 'react';
import { builtinById } from './templates.js';
import { appMode } from './api.js';
+import { Glyph, Tile, iconKind, tint } from './glyphs.jsx';
// A picked file is a path (shell: lord-server opens it, validated like lord.fs) or { fd, name }
// (app process: the system dialog opened it). fileReq builds the request options for either.
@@ -19,21 +21,17 @@ export const fileName = (p) => (typeof p === 'string' ? p : p?.name || '');
export const RED = '#ff453a', ORANGE = '#ff9f0a', GREEN = '#30d158', YELLOW = '#ffd60a';
-// ---- íconos ----
+// ---- icons ----
+// A category's tile: its color and its glyph (a user category stores the glyph's name; older
+// versions stored an emoji, mapped by iconKind).
export function CatIcon({ cat, size = 28 }) {
const b = cat ? builtinById(cat.id) : null;
const color = cat?.color || b?.color || '#8e8e93';
- const icon = /^[a-z_-]+$/i.test(cat?.icon || '') ? '📁' : cat?.icon || b?.icon || '🗂️';
- return (
- <View style={{ width: size, height: size, borderRadius: size * 0.26, alignItems: 'center', justifyContent: 'center',
- background: `linear-gradient(160deg, ${color}, ${shade(color, -0.25)})` }}>
- <Text style={{ fontSize: size * 0.56 }}>{icon}</Text>
- </View>
- );
+ return <Tile kind={iconKind(cat?.icon || b?.icon)} color={color} size={size} />;
}
-// Inicial del sitio (o del título) sobre el color de la categoría: como los íconos de sitios sin descargar nada
+// The site's initial (or the title's) on the category color: like site icons, without downloading anything
export function EntryIcon({ entry, cat, size = 32 }) {
const b = cat ? builtinById(cat.id) : null;
const color = cat?.color || b?.color || '#8e8e93';
@@ -43,25 +41,18 @@ export function EntryIcon({ entry, cat, size = 32 }) {
const ch = ([...(host || entry.title || '?')][0] || '?').toUpperCase();
return (
<View style={{ width: size, height: size, borderRadius: size * 0.26, alignItems: 'center', justifyContent: 'center',
- background: `linear-gradient(160deg, ${color}, ${shade(color, -0.3)})` }}>
- <Text style={{ fontSize: size * 0.5, fontWeight: 700, color: '#fff' }}>{ch}</Text>
+ background: `linear-gradient(180deg, ${tint(color, 0.18)}, ${tint(color, -0.12)})` }}>
+ <Text style={{ fontSize: Math.round(size * 0.46), fontWeight: 600, color: '#fff' }}>{ch}</Text>
</View>
);
}
-export function shade(hex, amt) {
- const m = /^#?([0-9a-f]{6})$/i.exec(String(hex || ''));
- if (!m) return hex;
- const n = parseInt(m[1], 16);
- const ch = (v) => Math.max(0, Math.min(255, Math.round(v + (amt < 0 ? v * amt : (255 - v) * amt))));
- const r = ch(n >> 16), g = ch((n >> 8) & 255), b = ch(n & 255);
- return `#${((r << 16) | (g << 8) | b).toString(16).padStart(6, '0')}`;
-}
+export const shade = tint;
-// ---- hoja (diálogo encima de la ventana) ----
+// ---- sheet (a dialog over the window) ----
-// Las hojas se dibujan arriba de toda la ventana (no adentro del panel que las abre): cada
-// <Sheet> se anota en `overlays` y <Overlays /> (al final de la app) las muestra.
+// Sheets are drawn over the whole window (not inside the pane that opens them): each <Sheet>
+// registers itself in `overlays` and <Overlays /> (at the end of the app) shows them.
const overlays = createStore([]); // [{ key, node }]
let overlaySeq = 0;
@@ -100,40 +91,76 @@ function SheetBox(props) {
function SheetPanel({ title, onClose, children, width = 460, footer, inline }) {
const th = useTheme();
return (
- <View style={{ width: inline ? undefined : width, alignSelf: inline ? 'stretch' : undefined, maxHeight: inline ? undefined : '94%', borderRadius: 14,
- backgroundColor: th.windowBg, border: `1px solid ${th.separator}`,
- boxShadow: inline ? '0 6px 18px rgba(0,0,0,0.25)' : '0 18px 50px rgba(0,0,0,0.5)', overflow: 'hidden' }}>
- <View style={{ flexDirection: 'row', alignItems: 'center', paddingHorizontal: 16, paddingVertical: 12, borderBottom: `1px solid ${th.separator}` }}>
- <Text style={{ flex: 1, fontSize: 15, fontWeight: 700, color: th.text }}>{title}</Text>
- {onClose && <View onClick={onClose} style={{ width: 24, height: 24, borderRadius: 12, alignItems: 'center', justifyContent: 'center', backgroundColor: th.control }}>
- <Text style={{ fontSize: 12, color: th.textDim }}>✕</Text></View>}
- </View>
- <View style={{ padding: 16, gap: 10, flexShrink: 1, overflow: 'hidden' }}>{children}</View>
- {footer && <View style={{ flexDirection: 'row', justifyContent: 'flex-end', gap: 8, paddingHorizontal: 16, paddingVertical: 12, borderTop: `1px solid ${th.separator}` }}>{footer}</View>}
+ <View style={{ width: inline ? undefined : width, maxWidth: inline ? undefined : '92%', alignSelf: inline ? 'stretch' : undefined,
+ maxHeight: inline ? undefined : '92%', borderRadius: 12, backgroundColor: th.windowBg, border: `1px solid ${th.separator}`,
+ boxShadow: inline ? '0 4px 14px rgba(0,0,0,0.18)' : '0 18px 50px rgba(0,0,0,0.45)', overflow: 'hidden' }}>
+ <View style={{ height: 48, flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal: 20, borderBottomWidth: 1, borderBottomColor: th.separator }}>
+ <Text style={{ flex: 1, minWidth: 0, fontSize: 15, fontWeight: 600, color: th.text, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{title}</Text>
+ {onClose && <ToolbarButton small icon="✕" iconSize={11} title={t('passwords.close')} onClick={onClose} />}
</View>
+ {inline ? <View style={{ paddingHorizontal: 20, paddingVertical: 16, gap: 12 }}>{children}</View> : (
+ // a body taller than the window scrolls instead of being cut off (small windows)
+ <ScrollView style={{ flex: -1 }}>
+ <View style={{ paddingHorizontal: 20, paddingVertical: 16, gap: 12 }}>{children}</View>
+ </ScrollView>
+ )}
+ {footer && <View style={{ flexDirection: 'row', justifyContent: 'flex-end', gap: 8, paddingHorizontal: 20, paddingVertical: 12, borderTopWidth: 1, borderTopColor: th.separator }}>{footer}</View>}
+ </View>
);
}
+// Caption over a field (11 px, 600, dim).
export function Label({ children }) {
const th = useTheme();
return <Text style={{ fontSize: 11, fontWeight: 600, color: th.textDim }}>{children}</Text>;
}
+// One hint line (12 px, dim).
export function Hint({ children, color }) {
const th = useTheme();
return <Text style={{ fontSize: 12, color: color || th.textDim, lineHeight: 17 }}>{children}</Text>;
}
-export function Warning({ children }) {
+// A calm warning box: a monochrome sign and the text, on a soft tint.
+export function Warning({ children, tone = 'red' }) {
+ const th = useTheme();
+ const c = tone === 'orange' ? ORANGE : RED;
return (
- <View style={{ flexDirection: 'row', gap: 8, padding: 10, borderRadius: 9, backgroundColor: 'rgba(255,69,58,0.14)', border: '1px solid rgba(255,69,58,0.45)' }}>
- <Text style={{ fontSize: 15 }}>⚠️</Text>
- <Text style={{ flex: 1, fontSize: 12, color: RED, lineHeight: 17 }}>{children}</Text>
+ <View style={{ flexDirection: 'row', alignItems: 'flex-start', gap: 10, paddingHorizontal: 12, paddingVertical: 10, borderRadius: 10,
+ backgroundColor: tone === 'orange' ? 'rgba(255,159,10,0.12)' : 'rgba(255,69,58,0.10)', border: `1px solid ${tone === 'orange' ? 'rgba(255,159,10,0.35)' : 'rgba(255,69,58,0.32)'}` }}>
+ <Text style={{ fontSize: 13, lineHeight: 17, fontWeight: 600, color: c }}>⚠</Text>
+ <Text style={{ flex: 1, fontSize: 12, color: th.mode === 'dark' ? '#ffb3ad' : '#c4281c', lineHeight: 17 }}>{children}</Text>
</View>
);
}
-// ---- fuerza ----
+// A grouped ("inset") box as in docs/DESIGN.md: rows separated by hairlines.
+export function Group({ children, style }) {
+ const th = useTheme();
+ const rows = (Array.isArray(children) ? children.flat() : [children]).filter(Boolean);
+ return (
+ <View style={[{ borderRadius: 10, backgroundColor: th.mode === 'dark' ? 'rgba(255,255,255,0.04)' : 'rgba(0,0,0,0.025)',
+ border: `1px solid ${th.separator}`, paddingHorizontal: 12 }, style]}>
+ {rows.map((r, i) => <View key={i} style={i ? { borderTopWidth: 1, borderTopColor: th.separator } : null}>{r}</View>)}
+ </View>
+ );
+}
+
+// A checkbox with its label (16 px box, accent when on).
+export function Check({ on, onChange, label, color }) {
+ const th = useTheme();
+ return (
+ <View onClick={() => onChange(!on)} style={{ flexDirection: 'row', gap: 8, alignItems: 'center', minHeight: 24 }}>
+ <View style={{ width: 16, height: 16, borderRadius: 4, border: `1px solid ${on ? 'transparent' : th.textDim}`,
+ backgroundColor: on ? (color || th.accent) : th.inputBg, alignItems: 'center', justifyContent: 'center' }}>
+ {on && <Text style={{ fontSize: 11, fontWeight: 700, color: '#fff' }}>✓</Text>}
+ </View>
+ <Text style={{ flex: 1, fontSize: 13, color: th.text, lineHeight: 18 }}>{label}</Text>
+ </View>
+ );
+}
+
+// ---- strength ----
export function strengthColor(score) { return [RED, RED, ORANGE, YELLOW, GREEN][Math.max(0, Math.min(4, score | 0))]; }
export function strengthLabel(score) { return [t('passwords.strength.0'), t('passwords.strength.1'), t('passwords.strength.2'), t('passwords.strength.3'), t('passwords.strength.4')][Math.max(0, Math.min(4, score | 0))]; }
@@ -141,18 +168,18 @@ export function strengthLabel(score) { return [t('passwords.strength.0'), t('pas
export function StrengthBar({ score, bits }) {
const th = useTheme();
return (
- <View style={{ gap: 4 }}>
- <View style={{ flexDirection: 'row', gap: 3, direction: 'ltr' }}>
+ <View style={{ gap: 6 }}>
+ <View style={{ flexDirection: 'row', gap: 4, direction: 'ltr' }}>
{[0, 1, 2, 3].map((i) => (
- <View key={i} style={{ flex: 1, height: 5, borderRadius: 3, backgroundColor: i < Math.max(1, score) ? strengthColor(score) : th.control }} />
+ <View key={i} style={{ flex: 1, height: 4, borderRadius: 2, backgroundColor: i < Math.max(1, score) ? strengthColor(score) : th.control }} />
))}
</View>
- <Text style={{ fontSize: 11, color: strengthColor(score) }}>{bits != null ? t('passwords.strength.bits', { label: strengthLabel(score), bits }) : strengthLabel(score)}</Text>
+ <Text style={{ fontSize: 11, fontWeight: 500, color: strengthColor(score) }}>{bits != null ? t('passwords.strength.bits', { label: strengthLabel(score), bits }) : strengthLabel(score)}</Text>
</View>
);
}
-// ---- código QR (filas en hex de lord-vault → píxeles) ----
+// ---- QR code (hex rows from lord-vault → pixels) ----
export function QrImage({ qr, scale = 5 }) {
if (!qr || !qr.size) return null;
@@ -172,7 +199,7 @@ export function QrImage({ qr, scale = 5 }) {
return <Image pixels={{ width: side, height: side, data }} style={{ width: side, height: side, borderRadius: 8 }} />;
}
-// ---- campo de varias líneas (notas, claves privadas, frases semilla) ----
+// ---- multi-line field (notes, private keys, seed phrases) ----
export function TextArea({ value, onChange, placeholder, minHeight = 90, mono, secure }) {
const th = useTheme();
@@ -193,18 +220,18 @@ export function TextArea({ value, onChange, placeholder, minHeight = 90, mono, s
const shown = secure && !focus ? String(value || '').replace(/[^\n]/g, '•') : value;
return (
<View onMouseDown={() => { takeTextFocus(token, onKey, () => setFocus(false)); setFocus(true); }}
- style={{ minHeight, padding: 8, borderRadius: 7, backgroundColor: th.inputBg, border: `1px solid ${focus ? th.accent : th.separator}` }}>
+ style={{ minHeight, paddingHorizontal: 10, paddingVertical: 7, borderRadius: 7, backgroundColor: th.inputBg, border: `1px solid ${focus ? th.accent : th.separator}` }}>
{value ? <Text style={{ fontSize: 13, color: th.text, lineHeight: 18, fontFamily: mono ? 'monospace' : undefined }}>{shown}{focus ? '▏' : ''}</Text>
: <Text style={{ fontSize: 13, color: th.textDim }}>{focus ? '▏' : placeholder || ''}</Text>}
</View>
);
}
-// ---- elegir un archivo (carpeta personal y discos del usuario: pendrives) ----
+// ---- pick a file (home folder and the user's disks: USB sticks) ----
export function FilePicker({ title, save, suggest = '', onPick, onClose, filter, inline }) {
const th = useTheme();
- const [dir, setDir] = useState(null); // null = lugares
+ const [dir, setDir] = useState(null); // null = places
const [name, setName] = useState(suggest);
const [sel, setSel] = useState(null);
// app process: the system's own dialog (powerbox) picks the file and hands over only its fd
@@ -218,8 +245,8 @@ export function FilePicker({ title, save, suggest = '', onPick, onClose, filter,
let entries = [];
let places = [];
if (dir === null) {
- places = [{ name: t('passwords.picker.home'), path: fs.home(), icon: '🏠' }];
- try { for (const v of fs.volumes()) places.push({ name: v.name || v.path, path: v.path, icon: '💾' }); } catch (e) { /* sin discos */ }
+ places = [{ name: t('passwords.picker.home'), path: fs.home(), icon: 'folder' }];
+ try { for (const v of fs.volumes()) places.push({ name: v.name || v.path, path: v.path, icon: 'drive' }); } catch (e) { /* no disks */ }
} else {
try { entries = fs.list(dir).filter((e) => e.dir || !filter || filter(e.name)); } catch (e) { entries = []; }
}
@@ -233,15 +260,15 @@ export function FilePicker({ title, save, suggest = '', onPick, onClose, filter,
<Button key="c" label={t('passwords.cancel')} onClick={onClose} />,
<Button key="o" primary label={save ? t('passwords.picker.save') : t('passwords.picker.open')} onClick={choose} />]}>
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
- <Button label="‹" onClick={up} />
- <Text style={{ flex: 1, fontSize: 12, color: th.textDim, whiteSpace: 'nowrap', overflow: 'hidden' }}>{dir === null ? t('passwords.picker.places') : dir}</Text>
+ <ToolbarButton icon="‹" title={t('passwords.picker.up')} onClick={up} />
+ <Text style={{ flex: 1, minWidth: 0, fontSize: 12, color: th.textDim, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{dir === null ? t('passwords.picker.places') : dir}</Text>
</View>
<View style={{ height: inline ? 190 : 260, borderRadius: 8, border: `1px solid ${th.separator}`, overflow: 'hidden' }}>
<ScrollView style={{ flex: 1 }}>
{dir === null ? places.map((p) => (
<Row key={p.path} icon={p.icon} label={p.name} onClick={() => setDir(p.path)} />
)) : entries.map((e) => (
- <Row key={e.name} icon={e.dir ? '📁' : '📄'} label={e.name} selected={sel === e.name}
+ <Row key={e.name} icon={e.dir ? 'folder' : 'note'} label={e.name} selected={sel === e.name}
onClick={() => (e.dir ? (setDir(fs.join(dir, e.name)), setSel(null)) : (setSel(e.name), save && setName(e.name)))}
onDoubleClick={() => !e.dir && onPick(fs.join(dir, e.name))} />
))}
@@ -256,15 +283,15 @@ export function FilePicker({ title, save, suggest = '', onPick, onClose, filter,
function Row({ icon, label, onClick, onDoubleClick, selected }) {
const th = useTheme();
return (
- <View onClick={onClick} onDoubleClick={onDoubleClick} style={{ flexDirection: 'row', alignItems: 'center', gap: 8, paddingHorizontal: 10, paddingVertical: 6,
- backgroundColor: selected ? th.accent : 'transparent' }}>
- <Text style={{ fontSize: 14 }}>{icon}</Text>
- <Text style={{ flex: 1, fontSize: 13, color: selected ? '#fff' : th.text, whiteSpace: 'nowrap', overflow: 'hidden' }}>{label}</Text>
+ <View onClick={onClick} onDoubleClick={onDoubleClick} style={{ height: 28, flexDirection: 'row', alignItems: 'center', gap: 8, paddingHorizontal: 10,
+ marginHorizontal: 4, borderRadius: 6, backgroundColor: selected ? th.accent : 'transparent' }}>
+ <Glyph kind={icon} size={15} color={selected ? '#fff' : th.accent} />
+ <Text style={{ flex: 1, minWidth: 0, fontSize: 13, color: selected ? '#fff' : th.text, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{label}</Text>
</View>
);
}
-// ---- menú desplegable chico ----
+// ---- small pop-up menu ----
export function Choice({ value, options, onChange, width = 200 }) {
const th = useTheme();
@@ -272,53 +299,54 @@ export function Choice({ value, options, onChange, width = 200 }) {
const cur = options.find((o) => o[0] === value);
return (
<View style={{ width }}>
- <View onClick={() => setOpen(!open)} style={{ height: 30, paddingHorizontal: 10, borderRadius: 7, flexDirection: 'row', alignItems: 'center',
- backgroundColor: th.inputBg, border: `1px solid ${th.separator}` }}>
- <Text style={{ flex: 1, fontSize: 13, color: th.text, whiteSpace: 'nowrap', overflow: 'hidden' }}>{cur ? cur[1] : String(value ?? '')}</Text>
- <Text style={{ fontSize: 10, color: th.textDim }}>▾</Text>
+ <View onClick={() => setOpen(!open)} style={{ height: 28, paddingHorizontal: 10, borderRadius: 7, flexDirection: 'row', alignItems: 'center', gap: 6,
+ backgroundColor: th.control, border: `1px solid ${open ? th.accent : 'transparent'}` }}>
+ <Text style={{ flex: 1, minWidth: 0, fontSize: 13, color: th.text, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{cur ? cur[1] : String(value ?? '')}</Text>
+ <Text style={{ fontSize: 9, color: th.textDim }}>▼</Text>
</View>
{open && (
- <View style={{ position: 'absolute', top: 32, left: 0, width, zIndex: 60, borderRadius: 8, padding: 4, backgroundColor: th.windowBg,
- border: `1px solid ${th.separator}`, boxShadow: '0 10px 28px rgba(0,0,0,0.4)' }}>
- {options.map(([v, label]) => (
- <View key={String(v)} onClick={() => { setOpen(false); onChange(v); }}
- style={{ paddingHorizontal: 8, paddingVertical: 5, borderRadius: 5, backgroundColor: v === value ? th.accent : 'transparent' }}>
- <Text style={{ fontSize: 13, color: v === value ? '#fff' : th.text }}>{label}</Text>
- </View>
- ))}
+ <View style={{ position: 'absolute', top: 32, insetInlineStart: 0, width, zIndex: 60, borderRadius: 8, padding: 5,
+ backgroundColor: th.mode === 'dark' ? '#2c2c31' : '#ffffff', border: `1px solid ${th.separator}`, boxShadow: '0 10px 30px rgba(0,0,0,0.35)' }}>
+ {options.map(([v, label]) => <ChoiceRow key={String(v)} label={label} on={v === value} onClick={() => { setOpen(false); onChange(v); }} />)}
</View>
)}
</View>
);
}
-// Botón chico con un símbolo (copiar, mostrar, generar)
-export function IconButton({ glyph, onClick, title, active, size = 26 }) {
+function ChoiceRow({ label, on, onClick }) {
const th = useTheme();
const [hover, setHover] = useState(false);
return (
<View onClick={onClick} onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
- style={{ minWidth: size, height: size, paddingHorizontal: title ? 8 : 0, borderRadius: 6, flexDirection: 'row', gap: 4, alignItems: 'center',
- justifyContent: 'center', backgroundColor: active ? th.accent : hover ? th.hover : th.control }}>
- <Text style={{ fontSize: 12, color: active ? '#fff' : th.text }}>{glyph}</Text>
- {title ? <Text style={{ fontSize: 12, color: active ? '#fff' : th.text }}>{title}</Text> : null}
+ style={{ height: 24, paddingHorizontal: 8, borderRadius: 5, flexDirection: 'row', alignItems: 'center', gap: 6, backgroundColor: hover ? th.accent : 'transparent' }}>
+ <Text style={{ width: 12, fontSize: 11, color: hover ? '#fff' : th.text }}>{on ? '✓' : ''}</Text>
+ <Text style={{ flex: 1, minWidth: 0, fontSize: 13, color: hover ? '#fff' : th.text, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{label}</Text>
</View>
);
}
+// Small borderless button with a glyph (copy, show, generate): a string glyph or a drawn kind
+// ({ kind: 'eye' }). label: visible text after the glyph; tip: the tooltip (icon-only buttons).
+export function IconButton({ glyph, onClick, label, tip, active, color }) {
+ const th = useTheme();
+ const icon = glyph && typeof glyph === 'object' && glyph.kind ? <Glyph kind={glyph.kind} size={14} color={active ? th.accent : color || th.text} /> : glyph;
+ return <ToolbarButton small icon={icon} iconSize={13} label={label} title={tip} active={active} color={color} onClick={onClick} />;
+}
+
export function Chip({ label, color, onClick, onRemove, selected }) {
const th = useTheme();
return (
- <View onClick={onClick} style={{ flexDirection: 'row', alignItems: 'center', gap: 5, height: 22, paddingHorizontal: 8, borderRadius: 11,
+ <View onClick={onClick} style={{ flexDirection: 'row', alignItems: 'center', gap: 6, height: 22, paddingHorizontal: 9, borderRadius: 11,
backgroundColor: selected ? th.accent : th.control }}>
- <View style={{ width: 8, height: 8, borderRadius: 4, backgroundColor: color || '#8e8e93' }} />
- <Text style={{ fontSize: 11, color: selected ? '#fff' : th.text }}>{label}</Text>
- {onRemove && <Text onClick={(e) => { e.stopPropagation?.(); onRemove(); }} style={{ fontSize: 10, color: th.textDim }}>✕</Text>}
+ <View style={{ width: 7, height: 7, borderRadius: 4, backgroundColor: color || '#8e8e93' }} />
+ <Text style={{ fontSize: 11, fontWeight: 500, color: selected ? '#fff' : th.text, whiteSpace: 'nowrap' }}>{label}</Text>
+ {onRemove && <Text onClick={(e) => { e.stopPropagation?.(); onRemove(); }} style={{ fontSize: 9, color: th.textDim, paddingInlineStart: 2 }}>✕</Text>}
</View>
);
}
-// base64 → bytes (QuickJS no trae atob)
+// base64 → bytes (QuickJS has no atob)
export function b64ToBytes(s) {
const A = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
const map = new Uint8Array(128);
diff --git a/assets/locales/en/passwords.json b/assets/locales/en/passwords.json
index 233d549..5b9ee39 100644
--- a/assets/locales/en/passwords.json
+++ b/assets/locales/en/passwords.json
@@ -276,8 +276,8 @@
"report.oldHint": "Past their change reminder (or unchanged for over a year).",
"report.breached": "Breached",
"report.breachedHint": "Compared offline with the 10,000 most common passwords from public breaches.",
- "report.hibpUsing": "Compared with the local Have I Been Pwned file you chose (offline).",
- "report.hibpChoose": "Use a Have I Been Pwned file…",
+ "report.hibpUsing": "Compared with the local list of breached passwords you chose (offline).",
+ "report.hibpChoose": "Use a breached-passwords file…",
"report.common": "Among the most used",
"report.bits": "~{bits} bits",
"report.sameIn": {
@@ -328,10 +328,10 @@
"set.calibrateHint": "It is tuned automatically when the vault or an unlock method is created; changing the password measures again.",
"set.memory": "Protected memory in lord-vault: {kb} KB in use, {locked} KB pinned (no swap, no dumps).",
"imp.title": "Import passwords",
- "imp.formats": "KeePass/KeePassXC (.kdbx or its CSV), Bitwarden (JSON or CSV), Chrome, Firefox, CSV from other password managers (Title, URL, Username, Password) and Passwords copies (.lvault).",
+ "imp.formats": "Password databases (.kdbx) and exports from other password managers (JSON or CSV), browser CSV exports (Title, URL, Username, Password) and Passwords copies (.lvault).",
"imp.noFile": "No file chosen",
"imp.choose": "Choose file…",
- "imp.kdbxPassword": "KeePass database password",
+ "imp.kdbxPassword": "Database password (.kdbx)",
"imp.vaultPassword": "That vault's password",
"imp.noKey": "No key file",
"imp.chooseKey": "Key file…",
@@ -347,12 +347,12 @@
"one": "{count} new folder as a category",
"other": "{count} new folders as categories"
},
- "fmt.kdbx": "KeePass (KDBX)",
- "fmt.keepassxc-csv": "KeePassXC (CSV)",
- "fmt.bitwarden-json": "Bitwarden (JSON)",
- "fmt.bitwarden-csv": "Bitwarden (CSV)",
- "fmt.chrome-csv": "Chrome (CSV)",
- "fmt.firefox-csv": "Firefox (CSV)",
+ "fmt.kdbx": "Password database (.kdbx)",
+ "fmt.keepassxc-csv": "Password database export (CSV)",
+ "fmt.bitwarden-json": "Password manager export (JSON)",
+ "fmt.bitwarden-csv": "Password manager export (CSV)",
+ "fmt.chrome-csv": "Browser export (CSV)",
+ "fmt.firefox-csv": "Browser export (CSV)",
"fmt.apple-csv": "CSV from other password managers",
"fmt.lordos-csv": "Passwords (CSV)",
"fmt.unknown": "unknown",
@@ -407,8 +407,8 @@
"err.keyfile-short": "That file is too small to be a key file.",
"err.keyfile-write": "The key file couldn't be written.",
"err.unknown-format": "I don't recognize the file format.",
- "err.bad-password": "The KeePass database password or key file is wrong.",
- "err.encrypted-export": "It's an encrypted Bitwarden export: export it unencrypted (JSON).",
+ "err.bad-password": "The database password or key file is wrong.",
+ "err.encrypted-export": "It's an encrypted export: export it again without encryption (JSON).",
"err.unsupported-cipher": "Unsupported cipher (for example, Twofish).",
"err.unsupported-kdf": "Unsupported key derivation.",
"err.too-big": "It's too big.",
@@ -426,8 +426,22 @@
"err.fido-no-hmac": "This key has no hmac-secret (U2F only): it can't be used for encryption.",
"err.fido-denied": "Permission to use the key was denied.",
"err.unavailable": "The vault helper is not available.",
- "err.bad-keyfile": "The KeePass key file is not valid.",
+ "err.bad-keyfile": "The database key file is not valid.",
"err.other": "Error: {code}",
"autofill.title": "Fill from Passwords",
- "autofill.none": "Nothing saved for this (or Passwords is locked)."
+ "autofill.none": "Nothing saved for this (or Passwords is locked).",
+ "copy": "Copy",
+ "show": "Show",
+ "hide": "Hide",
+ "fav": "Add to Favorites",
+ "unfav": "Remove from Favorites",
+ "att.view": "View",
+ "att.remove": "Remove",
+ "pickHint": "Its fields, codes and notes appear here.",
+ "emptyHint": "Add your first item with + or import them from another password manager (File → Import).",
+ "list.sortName": "Name",
+ "list.sortDate": "Recent",
+ "list.sortHint": "Sort by name or by the last change",
+ "list.emptyHint": "Add one with +.",
+ "picker.up": "Back"
}
diff --git a/assets/locales/en/settings.json b/assets/locales/en/settings.json
index 700ad71..32c86f8 100644
--- a/assets/locales/en/settings.json
+++ b/assets/locales/en/settings.json
@@ -22,13 +22,13 @@
},
"clipboard.historyHint": "❖V opens the quick panel and ❖⇧V the full one, with filters and preview.",
"clipboard.ignore": "Don't save from these apps",
- "clipboard.ignoreHint": "By id (the Wayland app_id, e.g. org.keepassxc.KeePassXC). What these apps copy can be pasted but is not kept in the history.",
+ "clipboard.ignoreHint": "By id (the Wayland app_id, e.g. org.example.PasswordManager). What these apps copy can be pasted but is not kept in the history.",
"clipboard.max": "Maximum items",
"clipboard.maxMB": "Space for images",
"clipboard.maxMBHint": "When exceeded, the oldest images are deleted (not pinned ones).",
"clipboard.never": "never",
"clipboard.open": "Open panel",
- "clipboard.privacy": "Never saved: what is copied from a LordOS password field, and what an app marks as secret (password managers like KeePassXC do).",
+ "clipboard.privacy": "Never saved: what is copied from a LordOS password field, and what an app marks as secret (password managers do).",
"clipboard.save": "Save the history",
"clipboard.saveHint": "What you copy (text and images) is saved in your home folder and survives a restart. Off: memory only.",
"dark": "Dark",
diff --git a/assets/locales/es/passwords.json b/assets/locales/es/passwords.json
index ce338d0..195314d 100644
--- a/assets/locales/es/passwords.json
+++ b/assets/locales/es/passwords.json
@@ -276,8 +276,8 @@
"report.oldHint": "Pasaron su recordatorio de cambio (o más de un año sin cambiarse).",
"report.breached": "Filtradas",
"report.breachedHint": "Comparadas, sin red, con las 10 000 contraseñas más comunes de las filtraciones públicas.",
- "report.hibpUsing": "Comparadas con el archivo local de Have I Been Pwned que elegiste (sin red).",
- "report.hibpChoose": "Usar un archivo de Have I Been Pwned…",
+ "report.hibpUsing": "Comparadas con la lista local de contraseñas filtradas que elegiste (sin red).",
+ "report.hibpChoose": "Usar un archivo de contraseñas filtradas…",
"report.common": "Está entre las más usadas",
"report.bits": "~{bits} bits",
"report.sameIn": {
@@ -328,10 +328,10 @@
"set.calibrateHint": "Se ajusta solo al crear la bóveda o una forma de abrir; cambiar la contraseña lo vuelve a medir.",
"set.memory": "Memoria protegida en lord-vault: {kb} KB en uso, {locked} KB fijados (sin swap ni volcados).",
"imp.title": "Importar contraseñas",
- "imp.formats": "KeePass/KeePassXC (.kdbx o su CSV), Bitwarden (JSON o CSV), Chrome, Firefox, CSV de otros gestores de contraseñas (Title, URL, Username, Password) y copias de Contraseñas (.lvault).",
+ "imp.formats": "Bases de contraseñas (.kdbx) y exportaciones de otros gestores de contraseñas (JSON o CSV), exportaciones CSV de navegadores (Title, URL, Username, Password) y copias de Contraseñas (.lvault).",
"imp.noFile": "Ningún archivo elegido",
"imp.choose": "Elegir archivo…",
- "imp.kdbxPassword": "Contraseña de la base de KeePass",
+ "imp.kdbxPassword": "Contraseña de la base (.kdbx)",
"imp.vaultPassword": "Contraseña de esa bóveda",
"imp.noKey": "Sin archivo llave",
"imp.chooseKey": "Archivo llave…",
@@ -347,12 +347,12 @@
"one": "{count} carpeta nueva como categoría",
"other": "{count} carpetas nuevas como categorías"
},
- "fmt.kdbx": "KeePass (KDBX)",
- "fmt.keepassxc-csv": "KeePassXC (CSV)",
- "fmt.bitwarden-json": "Bitwarden (JSON)",
- "fmt.bitwarden-csv": "Bitwarden (CSV)",
- "fmt.chrome-csv": "Chrome (CSV)",
- "fmt.firefox-csv": "Firefox (CSV)",
+ "fmt.kdbx": "Base de contraseñas (.kdbx)",
+ "fmt.keepassxc-csv": "Exportación de una base de contraseñas (CSV)",
+ "fmt.bitwarden-json": "Exportación de un gestor de contraseñas (JSON)",
+ "fmt.bitwarden-csv": "Exportación de un gestor de contraseñas (CSV)",
+ "fmt.chrome-csv": "Exportación de un navegador (CSV)",
+ "fmt.firefox-csv": "Exportación de un navegador (CSV)",
"fmt.apple-csv": "CSV de otros gestores de contraseñas",
"fmt.lordos-csv": "Contraseñas (CSV)",
"fmt.unknown": "desconocido",
@@ -407,8 +407,8 @@
"err.keyfile-short": "Ese archivo es muy chico para ser un archivo llave.",
"err.keyfile-write": "No se pudo escribir el archivo llave.",
"err.unknown-format": "No reconozco el formato del archivo.",
- "err.bad-password": "La contraseña o el archivo llave de la base de KeePass no son correctos.",
- "err.encrypted-export": "Es una exportación cifrada de Bitwarden: exportala sin cifrar (JSON).",
+ "err.bad-password": "La contraseña o el archivo llave de la base no son correctos.",
+ "err.encrypted-export": "Es una exportación cifrada: exportala de nuevo sin cifrar (JSON).",
"err.unsupported-cipher": "Cifrado no compatible (por ejemplo, Twofish).",
"err.unsupported-kdf": "Derivación de clave no compatible.",
"err.too-big": "Es demasiado grande.",
@@ -426,8 +426,22 @@
"err.fido-no-hmac": "Esta llave no tiene hmac-secret (solo U2F): no sirve para cifrar.",
"err.fido-denied": "Permiso para usar la llave denegado.",
"err.unavailable": "El ayudante de la bóveda no está disponible.",
- "err.bad-keyfile": "El archivo llave de KeePass no es válido.",
+ "err.bad-keyfile": "El archivo llave de la base no es válido.",
"err.other": "Error: {code}",
"autofill.title": "Rellenar desde Contraseñas",
- "autofill.none": "No hay nada guardado para esto (o Contraseñas está bloqueada)."
+ "autofill.none": "No hay nada guardado para esto (o Contraseñas está bloqueada).",
+ "copy": "Copiar",
+ "show": "Mostrar",
+ "hide": "Ocultar",
+ "fav": "Agregar a Favoritas",
+ "unfav": "Quitar de Favoritas",
+ "att.view": "Ver",
+ "att.remove": "Quitar",
+ "pickHint": "Sus campos, códigos y notas aparecen acá.",
+ "emptyHint": "Agregá la primera con + o importalas de otro gestor de contraseñas (Archivo → Importar).",
+ "list.sortName": "Nombre",
+ "list.sortDate": "Recientes",
+ "list.sortHint": "Ordenar por nombre o por el último cambio",
+ "list.emptyHint": "Agregá una con +.",
+ "picker.up": "Atrás"
}
diff --git a/assets/locales/es/settings.json b/assets/locales/es/settings.json
index af2b319..c824c50 100644
--- a/assets/locales/es/settings.json
+++ b/assets/locales/es/settings.json
@@ -22,13 +22,13 @@
},
"clipboard.historyHint": "❖V abre el panel rápido y ❖⇧V el completo, con filtros y vista previa.",
"clipboard.ignore": "No guardar lo de estas apps",
- "clipboard.ignoreHint": "Por su id (el app_id de Wayland, por ejemplo org.keepassxc.KeePassXC). Lo que estas apps copian se puede pegar, pero no queda en el historial.",
+ "clipboard.ignoreHint": "Por su id (el app_id de Wayland, por ejemplo org.example.PasswordManager). Lo que estas apps copian se puede pegar, pero no queda en el historial.",
"clipboard.max": "Máximo de elementos",
"clipboard.maxMB": "Espacio para imágenes",
"clipboard.maxMBHint": "Cuando se pasa, se borran las imágenes más viejas (no las fijadas).",
"clipboard.never": "nunca",
"clipboard.open": "Abrir panel",
- "clipboard.privacy": "Nunca se guarda: lo copiado de un campo de contraseña de LordOS ni lo que una app marca como secreto (los gestores de contraseñas como KeePassXC lo hacen).",
+ "clipboard.privacy": "Nunca se guarda: lo copiado de un campo de contraseña de LordOS ni lo que una app marca como secreto (los gestores de contraseñas lo hacen).",
"clipboard.save": "Guardar el historial",
"clipboard.saveHint": "Lo que copiás (textos e imágenes) se guarda en tu carpeta personal y sigue ahí después de reiniciar. Apagado, queda solo en memoria.",
"dark": "Oscuro",
diff --git a/assets/locales/pt/passwords.json b/assets/locales/pt/passwords.json
index 5b6a205..e43df89 100644
--- a/assets/locales/pt/passwords.json
+++ b/assets/locales/pt/passwords.json
@@ -276,8 +276,8 @@
"report.oldHint": "Passaram do lembrete de troca (ou mais de um ano sem trocar).",
"report.breached": "Vazadas",
"report.breachedHint": "Comparadas, sem rede, com as 10.000 senhas mais comuns dos vazamentos públicos.",
- "report.hibpUsing": "Comparadas com o arquivo local do Have I Been Pwned que você escolheu (sem rede).",
- "report.hibpChoose": "Usar um arquivo do Have I Been Pwned…",
+ "report.hibpUsing": "Comparadas com a lista local de senhas vazadas que você escolheu (sem rede).",
+ "report.hibpChoose": "Usar um arquivo de senhas vazadas…",
"report.common": "Está entre as mais usadas",
"report.bits": "~{bits} bits",
"report.sameIn": {
@@ -328,10 +328,10 @@
"set.calibrateHint": "É ajustado sozinho ao criar o cofre ou uma forma de abrir; trocar a senha mede de novo.",
"set.memory": "Memória protegida no lord-vault: {kb} KB em uso, {locked} KB fixados (sem swap nem despejos).",
"imp.title": "Importar senhas",
- "imp.formats": "KeePass/KeePassXC (.kdbx ou seu CSV), Bitwarden (JSON ou CSV), Chrome, Firefox, CSV de outros gerenciadores de senhas (Title, URL, Username, Password) e cópias do Senhas (.lvault).",
+ "imp.formats": "Bancos de senhas (.kdbx) e exportações de outros gerenciadores de senhas (JSON ou CSV), exportações CSV de navegadores (Title, URL, Username, Password) e cópias do Senhas (.lvault).",
"imp.noFile": "Nenhum arquivo escolhido",
"imp.choose": "Escolher arquivo…",
- "imp.kdbxPassword": "Senha do banco do KeePass",
+ "imp.kdbxPassword": "Senha do banco (.kdbx)",
"imp.vaultPassword": "Senha desse cofre",
"imp.noKey": "Sem arquivo chave",
"imp.chooseKey": "Arquivo chave…",
@@ -347,12 +347,12 @@
"one": "{count} pasta nova como categoria",
"other": "{count} pastas novas como categorias"
},
- "fmt.kdbx": "KeePass (KDBX)",
- "fmt.keepassxc-csv": "KeePassXC (CSV)",
- "fmt.bitwarden-json": "Bitwarden (JSON)",
- "fmt.bitwarden-csv": "Bitwarden (CSV)",
- "fmt.chrome-csv": "Chrome (CSV)",
- "fmt.firefox-csv": "Firefox (CSV)",
+ "fmt.kdbx": "Banco de senhas (.kdbx)",
+ "fmt.keepassxc-csv": "Exportação de um banco de senhas (CSV)",
+ "fmt.bitwarden-json": "Exportação de um gerenciador de senhas (JSON)",
+ "fmt.bitwarden-csv": "Exportação de um gerenciador de senhas (CSV)",
+ "fmt.chrome-csv": "Exportação de um navegador (CSV)",
+ "fmt.firefox-csv": "Exportação de um navegador (CSV)",
"fmt.apple-csv": "CSV de outros gerenciadores de senhas",
"fmt.lordos-csv": "Senhas (CSV)",
"fmt.unknown": "desconhecido",
@@ -407,8 +407,8 @@
"err.keyfile-short": "Esse arquivo é pequeno demais para ser um arquivo chave.",
"err.keyfile-write": "Não foi possível gravar o arquivo chave.",
"err.unknown-format": "Não reconheço o formato do arquivo.",
- "err.bad-password": "A senha ou o arquivo chave do banco do KeePass estão incorretos.",
- "err.encrypted-export": "É uma exportação cifrada do Bitwarden: exporte sem cifrar (JSON).",
+ "err.bad-password": "A senha ou o arquivo chave do banco estão incorretos.",
+ "err.encrypted-export": "É uma exportação cifrada: exporte de novo sem cifrar (JSON).",
"err.unsupported-cipher": "Cifra não compatível (por exemplo, Twofish).",
"err.unsupported-kdf": "Derivação de chave não compatível.",
"err.too-big": "É grande demais.",
@@ -426,8 +426,22 @@
"err.fido-no-hmac": "Esta chave não tem hmac-secret (só U2F): não serve para cifrar.",
"err.fido-denied": "A permissão para usar a chave foi negada.",
"err.unavailable": "O ajudante do cofre não está disponível.",
- "err.bad-keyfile": "O arquivo chave do KeePass não é válido.",
+ "err.bad-keyfile": "O arquivo chave do banco não é válido.",
"err.other": "Erro: {code}",
"autofill.title": "Preencher com o Senhas",
- "autofill.none": "Nada salvo para isto (ou o Senhas está bloqueado)."
+ "autofill.none": "Nada salvo para isto (ou o Senhas está bloqueado).",
+ "copy": "Copiar",
+ "show": "Mostrar",
+ "hide": "Ocultar",
+ "fav": "Adicionar aos Favoritos",
+ "unfav": "Remover dos Favoritos",
+ "att.view": "Ver",
+ "att.remove": "Remover",
+ "pickHint": "Seus campos, códigos e notas aparecem aqui.",
+ "emptyHint": "Adicione o primeiro com + ou importe de outro gerenciador de senhas (Arquivo → Importar).",
+ "list.sortName": "Nome",
+ "list.sortDate": "Recentes",
+ "list.sortHint": "Ordenar por nome ou pela última alteração",
+ "list.emptyHint": "Adicione um com +.",
+ "picker.up": "Voltar"
}
diff --git a/assets/locales/pt/settings.json b/assets/locales/pt/settings.json
index b26d880..205b393 100644
--- a/assets/locales/pt/settings.json
+++ b/assets/locales/pt/settings.json
@@ -22,13 +22,13 @@
},
"clipboard.historyHint": "❖V abre o painel rápido e ❖⇧V o completo, com filtros e pré-visualização.",
"clipboard.ignore": "Não salvar destes apps",
- "clipboard.ignoreHint": "Pelo id (o app_id do Wayland, por exemplo org.keepassxc.KeePassXC). O que esses apps copiam pode ser colado, mas não fica no histórico.",
+ "clipboard.ignoreHint": "Pelo id (o app_id do Wayland, por exemplo org.example.PasswordManager). O que esses apps copiam pode ser colado, mas não fica no histórico.",
"clipboard.max": "Máximo de itens",
"clipboard.maxMB": "Espaço para imagens",
"clipboard.maxMBHint": "Quando passar, as imagens mais antigas são apagadas (não as fixadas).",
"clipboard.never": "nunca",
"clipboard.open": "Abrir painel",
- "clipboard.privacy": "Nunca é salvo: o que é copiado de um campo de senha do LordOS, nem o que um app marca como secreto (gerenciadores de senhas como o KeePassXC fazem isso).",
+ "clipboard.privacy": "Nunca é salvo: o que é copiado de um campo de senha do LordOS, nem o que um app marca como secreto (gerenciadores de senhas fazem isso).",
"clipboard.save": "Salvar o histórico",
"clipboard.saveHint": "O que você copia (textos e imagens) fica salvo na sua pasta pessoal e continua lá depois de reiniciar. Desligado: só na memória.",
"dark": "Escuro",
diff --git a/docs/DESIGN.md b/docs/DESIGN.md
index e61037c..a20e323 100644
--- a/docs/DESIGN.md
+++ b/docs/DESIGN.md
@@ -11,7 +11,7 @@ The first pass (Calculator, Text Editor, Notes, Photos, PDF Viewer and Fonts) an
with the system emoji picker, About and the Installer) are documented with before/after
screenshots in [`docs/polish/`](polish/), as is the third (Settings page by page, Files, Terminal
Preferences and the Store's remaining pages), and the fourth (the system apps: Disks, Backups, Logs,
-Clock and Help), as is the fifth (Mail, Calendar, Contacts and Reminders).
+Clock and Help), as is the fifth (Mail, Calendar, Contacts and Reminders) and the last one (Passwords).
## Spacing: an 8 px grid
@@ -134,6 +134,16 @@ the Recorder draw their empty-state icons. `↻ ⤮ ♪ ◫ ▣ ☺ ≡` render
edge), `Actions` (buttons under a group, trailing), `Note`/`Message`. Buttons inside rows are
`small` (22 px); switches are `<Toggle small>` (36 × 20). Pickers between a few pictures (light/dark,
Dock side) are thumbnail tiles with a 2 px accent ring.
+- **Passwords (an isolated app):** a 220 px source list (`SearchField`, then accent glyph rows,
+ `SectionTitle` captions, category rows with 18 px colored tiles and tag rows with a color dot; a 41 px
+ bottom bar with the generator, settings and Lock), a 290 px item list (17/600 title, 48 px rows with a
+ 30 px tile, sort and "+" as toolbar buttons) and the detail pane (22/600 title, chips, the fields in
+ an inset group with icon-only copy/show buttons, small secondary buttons, destructive ones in red).
+ Under 960 px the columns shrink to 200 / 250 px and the detail title to 17 px. Category glyphs are
+ drawn (`apps/passwords/glyphs.jsx`); a category stores the glyph's name, and old emoji values map to
+ the nearest glyph. The lock screens are a 360–460 px centered column with a 22/600 title and a neutral
+ method switch; sheets are 48 px title + 20 px padding and scroll when the window is too small. An
+ isolated app gets the UI direction with the language (`locale.dir`), so it mirrors in RTL too.
- **Preferences panes (Terminal):** sections as sidebar rows (not a long tab bar that cannot fit),
a header with the section and profile names and the `Done` button, and a form with a 170 px
right-aligned label column. Measure the pane: under 480 px the labels go above their controls.
diff --git a/docs/PASSWORDS.md b/docs/PASSWORDS.md
index 9bc0b5b..1bcf518 100644
--- a/docs/PASSWORDS.md
+++ b/docs/PASSWORDS.md
@@ -8,6 +8,10 @@ No gnome-keyring, kwallet, libsecret, libdbus or sd-bus is used by LordOS.
## Screenshots (VM 116, real `lord-sessiond` session, user `pwtest`)
+The current look (polish pass, VM 118) is in [`docs/polish/passwords-comparison.png`](polish/passwords-comparison.png)
+with every `passwords-before-*` / `passwords-after-*` shot (light, dark, RTL, minimum size, locked,
+editor, generator, first run); the shots below are from the first version.
+
| | |
|---|---|
| ![Create the vault](m9-contrasenas-crear.png) | ![Unlock with the master password](m9-contrasenas-desbloquear.png) |
@@ -368,8 +372,10 @@ Built-in categories, each with a field template (`apps/passwords/templates.js`):
Internet, Email, Finance, Cards, Network, Wi-Fi (with QR), Servers/SSH, Databases, Apps,
Licenses (attachments), API and tokens, Identity and documents (photo attachments), Crypto (extra
warning), VPN (link to Settings → Network), Secure notes (markdown + attachments). Users create
-categories with a name, icon, colour, parent (any depth: KeePassX-style tree) and their own field
-definitions; imported KeePass/Bitwarden folders become user categories. Items have one category,
+categories with a name, icon, colour, parent (any depth: a tree) and their own field
+definitions; folders of imported password databases and exports become user categories. Icons are
+drawn glyphs (`apps/passwords/glyphs.jsx`, no color emoji): a category stores the glyph's name, and
+categories saved by older versions (an emoji) are shown with the nearest glyph. Items have one category,
many tags (with colours), favourite, archived, trash, history, attachments and an optional
"change every N days" reminder.
diff --git a/docs/polish/passwords-after-category.png b/docs/polish/passwords-after-category.png
new file mode 100644
index 0000000..881ecc6
Binary files /dev/null and b/docs/polish/passwords-after-category.png differ
diff --git a/docs/polish/passwords-after-codes.png b/docs/polish/passwords-after-codes.png
new file mode 100644
index 0000000..65109eb
Binary files /dev/null and b/docs/polish/passwords-after-codes.png differ
diff --git a/docs/polish/passwords-after-create.png b/docs/polish/passwords-after-create.png
new file mode 100644
index 0000000..3db7f1a
Binary files /dev/null and b/docs/polish/passwords-after-create.png differ
diff --git a/docs/polish/passwords-after-dark.png b/docs/polish/passwords-after-dark.png
new file mode 100644
index 0000000..29420a5
Binary files /dev/null and b/docs/polish/passwords-after-dark.png differ
diff --git a/docs/polish/passwords-after-editor-dark.png b/docs/polish/passwords-after-editor-dark.png
new file mode 100644
index 0000000..5892a56
Binary files /dev/null and b/docs/polish/passwords-after-editor-dark.png differ
diff --git a/docs/polish/passwords-after-editor-rtl.png b/docs/polish/passwords-after-editor-rtl.png
new file mode 100644
index 0000000..aa7b254
Binary files /dev/null and b/docs/polish/passwords-after-editor-rtl.png differ
diff --git a/docs/polish/passwords-after-editor-small.png b/docs/polish/passwords-after-editor-small.png
new file mode 100644
index 0000000..14e0028
Binary files /dev/null and b/docs/polish/passwords-after-editor-small.png differ
diff --git a/docs/polish/passwords-after-editor.png b/docs/polish/passwords-after-editor.png
new file mode 100644
index 0000000..ed8c79c
Binary files /dev/null and b/docs/polish/passwords-after-editor.png differ
diff --git a/docs/polish/passwords-after-generator-dark.png b/docs/polish/passwords-after-generator-dark.png
new file mode 100644
index 0000000..cd8d890
Binary files /dev/null and b/docs/polish/passwords-after-generator-dark.png differ
diff --git a/docs/polish/passwords-after-generator-rtl.png b/docs/polish/passwords-after-generator-rtl.png
new file mode 100644
index 0000000..4d22c1b
Binary files /dev/null and b/docs/polish/passwords-after-generator-rtl.png differ
diff --git a/docs/polish/passwords-after-generator-small.png b/docs/polish/passwords-after-generator-small.png
new file mode 100644
index 0000000..33f74b7
Binary files /dev/null and b/docs/polish/passwords-after-generator-small.png differ
diff --git a/docs/polish/passwords-after-generator.png b/docs/polish/passwords-after-generator.png
new file mode 100644
index 0000000..62af332
Binary files /dev/null and b/docs/polish/passwords-after-generator.png differ
diff --git a/docs/polish/passwords-after-light.png b/docs/polish/passwords-after-light.png
new file mode 100644
index 0000000..de07c52
Binary files /dev/null and b/docs/polish/passwords-after-light.png differ
diff --git a/docs/polish/passwords-after-lock-dark.png b/docs/polish/passwords-after-lock-dark.png
new file mode 100644
index 0000000..c5bae15
Binary files /dev/null and b/docs/polish/passwords-after-lock-dark.png differ
diff --git a/docs/polish/passwords-after-lock-rtl.png b/docs/polish/passwords-after-lock-rtl.png
new file mode 100644
index 0000000..1a816c6
Binary files /dev/null and b/docs/polish/passwords-after-lock-rtl.png differ
diff --git a/docs/polish/passwords-after-lock-small.png b/docs/polish/passwords-after-lock-small.png
new file mode 100644
index 0000000..32aa870
Binary files /dev/null and b/docs/polish/passwords-after-lock-small.png differ
diff --git a/docs/polish/passwords-after-lock.png b/docs/polish/passwords-after-lock.png
new file mode 100644
index 0000000..12fb26c
Binary files /dev/null and b/docs/polish/passwords-after-lock.png differ
diff --git a/docs/polish/passwords-after-rtl.png b/docs/polish/passwords-after-rtl.png
new file mode 100644
index 0000000..2eaaf1b
Binary files /dev/null and b/docs/polish/passwords-after-rtl.png differ
diff --git a/docs/polish/passwords-after-security.png b/docs/polish/passwords-after-security.png
new file mode 100644
index 0000000..737e8fa
Binary files /dev/null and b/docs/polish/passwords-after-security.png differ
diff --git a/docs/polish/passwords-after-settings.png b/docs/polish/passwords-after-settings.png
new file mode 100644
index 0000000..d9da678
Binary files /dev/null and b/docs/polish/passwords-after-settings.png differ
diff --git a/docs/polish/passwords-after-small.png b/docs/polish/passwords-after-small.png
new file mode 100644
index 0000000..d3f5620
Binary files /dev/null and b/docs/polish/passwords-after-small.png differ
diff --git a/docs/polish/passwords-after-wifi.png b/docs/polish/passwords-after-wifi.png
new file mode 100644
index 0000000..f3e218b
Binary files /dev/null and b/docs/polish/passwords-after-wifi.png differ
diff --git a/docs/polish/passwords-before-create.png b/docs/polish/passwords-before-create.png
new file mode 100644
index 0000000..400dcac
Binary files /dev/null and b/docs/polish/passwords-before-create.png differ
diff --git a/docs/polish/passwords-before-dark.png b/docs/polish/passwords-before-dark.png
new file mode 100644
index 0000000..aa35563
Binary files /dev/null and b/docs/polish/passwords-before-dark.png differ
diff --git a/docs/polish/passwords-before-editor-dark.png b/docs/polish/passwords-before-editor-dark.png
new file mode 100644
index 0000000..b233574
Binary files /dev/null and b/docs/polish/passwords-before-editor-dark.png differ
diff --git a/docs/polish/passwords-before-editor.png b/docs/polish/passwords-before-editor.png
new file mode 100644
index 0000000..a690141
Binary files /dev/null and b/docs/polish/passwords-before-editor.png differ
diff --git a/docs/polish/passwords-before-empty.png b/docs/polish/passwords-before-empty.png
new file mode 100644
index 0000000..faa98f7
Binary files /dev/null and b/docs/polish/passwords-before-empty.png differ
diff --git a/docs/polish/passwords-before-generator-dark.png b/docs/polish/passwords-before-generator-dark.png
new file mode 100644
index 0000000..bbe9f11
Binary files /dev/null and b/docs/polish/passwords-before-generator-dark.png differ
diff --git a/docs/polish/passwords-before-generator.png b/docs/polish/passwords-before-generator.png
new file mode 100644
index 0000000..a5c1fdb
Binary files /dev/null and b/docs/polish/passwords-before-generator.png differ
diff --git a/docs/polish/passwords-before-light.png b/docs/polish/passwords-before-light.png
new file mode 100644
index 0000000..1c34b68
Binary files /dev/null and b/docs/polish/passwords-before-light.png differ
diff --git a/docs/polish/passwords-before-lock-dark.png b/docs/polish/passwords-before-lock-dark.png
new file mode 100644
index 0000000..8c38638
Binary files /dev/null and b/docs/polish/passwords-before-lock-dark.png differ
diff --git a/docs/polish/passwords-before-lock-rtl.png b/docs/polish/passwords-before-lock-rtl.png
new file mode 100644
index 0000000..7ba11f4
Binary files /dev/null and b/docs/polish/passwords-before-lock-rtl.png differ
diff --git a/docs/polish/passwords-before-lock.png b/docs/polish/passwords-before-lock.png
new file mode 100644
index 0000000..d347606
Binary files /dev/null and b/docs/polish/passwords-before-lock.png differ
diff --git a/docs/polish/passwords-before-recovery.png b/docs/polish/passwords-before-recovery.png
new file mode 100644
index 0000000..5ccef4f
Binary files /dev/null and b/docs/polish/passwords-before-recovery.png differ
diff --git a/docs/polish/passwords-before-rtl.png b/docs/polish/passwords-before-rtl.png
new file mode 100644
index 0000000..1e29599
Binary files /dev/null and b/docs/polish/passwords-before-rtl.png differ
diff --git a/docs/polish/passwords-before-security-small.png b/docs/polish/passwords-before-security-small.png
new file mode 100644
index 0000000..9790ebe
Binary files /dev/null and b/docs/polish/passwords-before-security-small.png differ
diff --git a/docs/polish/passwords-before-small.png b/docs/polish/passwords-before-small.png
new file mode 100644
index 0000000..af3c6a8
Binary files /dev/null and b/docs/polish/passwords-before-small.png differ
diff --git a/docs/polish/passwords-comparison.png b/docs/polish/passwords-comparison.png
new file mode 100644
index 0000000..5e650fa
Binary files /dev/null and b/docs/polish/passwords-comparison.png differ
diff --git a/runtime/app-host.js b/runtime/app-host.js
index 5da2c0f..3e1a2e4 100644
--- a/runtime/app-host.js
+++ b/runtime/app-host.js
@@ -33,7 +33,8 @@ const tokens = createStore(DEFAULT_TOKENS);
function applyLocale(l) {
if (!l || !l.lang) return;
const cur = locale.get();
- if (cur.lang !== l.lang || (cur.region || '') !== (l.region || '')) locale.set({ lang: l.lang, region: l.region || '' });
+ const dir = l.dir === 'rtl' || l.dir === 'ltr' ? l.dir : undefined;
+ if (cur.lang !== l.lang || (cur.region || '') !== (l.region || '') || cur.dir !== dir) locale.set({ lang: l.lang, region: l.region || '', dir });
}
function applyState(st) {
@@ -120,16 +121,17 @@ globalThis.__lordOnRevoke = (fn) => { revokeListeners.add(fn); return () => revo
function Root() {
const tk = useStore(tokens);
- const { lang, region } = useStore(locale);
+ const { lang, region, dir } = useStore(locale);
const list = useStore(windows);
const focused = sdk.wm.focused();
// a language change remounts the app, as in the theme (texts are built while rendering)
return h(ThemeProvider, { tokens: tk },
- h(Fragment, { key: `${lang}|${region}` },
+ h(Fragment, { key: `${lang}|${region}|${dir || ''}` },
list.map((w, i) => h(runtime.View, {
key: w.id,
ref: (inst) => attach(w.id, inst),
- style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', backgroundColor: tk.windowBg },
+ // each window is laid out as its own root (appclient.c), so it states the UI direction itself
+ style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', backgroundColor: tk.windowBg, direction: sdk.direction() },
}, h(AppHost, { id: w.id, focused: w.id === focused }), i === 0 ? h(PermissionPrompt) : null))));
}
diff --git a/sdk/i18n.js b/sdk/i18n.js
index ddf04a5..e1c16c2 100644
--- a/sdk/i18n.js
+++ b/sdk/i18n.js
@@ -99,10 +99,10 @@ export const locale = createStore({ lang: initial(), region: settings.get().regi
// The server picks the CJK font according to the language (the same ideograph is drawn differently in
// Chinese, Japanese and Korean) and, if the language is right-to-left (meta.json "direction": "rtl"),
// mirrors the interface: rows, start alignment, menus.
-function applyNative({ lang }) {
+function applyNative(l) {
try {
- lord.text.setLanguage(lang);
- lord.text.setDirection(meta(lang).direction === 'rtl');
+ lord.text.setLanguage(l.lang);
+ lord.text.setDirection(dirOf(l) === 'rtl');
} catch (e) { /* server without lord.text */ }
}
applyNative(locale.get());
@@ -110,7 +110,10 @@ locale.subscribe(() => applyNative(locale.get()));
// Direction of the interface ('rtl' in Arabic, Hebrew, Persian…) and of a standalone text (that of its
// first strong character: an Arabic file name inside an English interface).
-export const direction = () => (meta(locale.get().lang).direction === 'rtl' ? 'rtl' : 'ltr');
+// An isolated app (runtime/app-host.js) also gets the direction from lord-server with the language
+// (`dir`), so it mirrors like the desktop even if it cannot read that language's meta.json.
+function dirOf(l) { return l.dir === 'rtl' || l.dir === 'ltr' ? l.dir : meta(l.lang).direction === 'rtl' ? 'rtl' : 'ltr'; }
+export const direction = () => dirOf(locale.get());
export const textDirection = (s) => { try { return lord.text.direction(String(s ?? '')); } catch (e) { return 'ltr'; } };
settings.subscribe(() => {
diff --git a/tools/brand-check.mjs b/tools/brand-check.mjs
index 65f8bdc..055509e 100644
--- a/tools/brand-check.mjs
+++ b/tools/brand-check.mjs
@@ -18,7 +18,7 @@ const BRANDS = [
'Apple', 'macOS', 'Mac OS', 'OS X', 'Mac', 'MacBook', 'iMac', 'iPhone', 'iPad', 'iOS', 'iCloud', 'Safari',
'Xcode', 'Finder', 'Spotlight', 'Launchpad', 'Night Shift', 'Quick Look', 'Time Machine', 'AirPrint',
'AirDrop', 'Mission Control', 'Disk Utility', 'TCC', 'Windows', 'Microsoft', 'Outlook', 'Hotmail',
- 'Little Snitch', 'iTerm', 'iTerm2', 'Parallels',
+ 'Little Snitch', 'iTerm', 'iTerm2', 'Parallels', 'KeePass', 'KeePassXC', '1Password', 'Bitwarden', 'LastPass', 'Have I Been Pwned',
];
const BRAND_RE = new RegExp(`(?<![\\w.-])(?:${BRANDS.map((b) => b.replace(/ /g, '\\s+')).join('|')})(?![\\w])`, 'g');