feat: tag bookmarks and sites, and browse the library by tag

This commit is contained in:
randogoth 2026-10-11 13:32:00 +03:00
parent 5cd053c8a9
commit b0b86ef5b1
13 changed files with 445 additions and 21 deletions

View file

@ -68,6 +68,7 @@ MewsListItem itemRow({
String? date,
String? note,
bool strong = false,
List<Choice> chips = const [],
List<Choice> actions = const [],
}) {
final text = date == null ? label : '$date $label';
@ -83,6 +84,11 @@ MewsListItem itemRow({
const MewsLineBreak(),
MewsEmphasis(EmphasisStyle.emphasis, [MewsText(note)]),
],
if (chips.isNotEmpty) ...[
const MewsLineBreak(),
..._separated(
[for (final chip in chips) MewsLink(chip.href, [MewsText(chip.label)])]),
],
if (actions.isNotEmpty) ...[
const MewsLineBreak(),
..._separated(
@ -139,18 +145,20 @@ ListBlock choiceRow(List<Choice> options) {
);
}
/// A one-field search box that submits back to its own page, turning what the
/// reader typed into a query string. [keep] carries the parameters the submit
/// must not drop as hidden fields, the way an HTML form does.
/// A one-field form that submits back into the mews scheme, turning what the
/// reader typed into one query parameter named [field]. [keep] carries the
/// parameters the submit must not drop as hidden fields, the way an HTML form
/// does.
///
/// Keep this at a fixed position in a page's blocks: the renderer matches form
/// state by position, so a block appearing above it would reset what the
/// reader typed.
FormBlock searchForm({
FormBlock textForm({
required String action,
required String field,
required String label,
required String submitLabel,
required String query,
String value = '',
Map<String, String> keep = const {},
}) {
return FormBlock(
@ -158,7 +166,7 @@ FormBlock searchForm({
method: 'get',
submitLabel: submitLabel,
fields: [
MewsTextField(name: 'q', label: label, password: false, value: query),
MewsTextField(name: field, label: label, password: false, value: value),
for (final kept in keep.entries)
MewsHiddenField(name: kept.key, value: kept.value),
MewsSubmitField(reset: false, label: submitLabel),