chore: more cleanup in the specs

This commit is contained in:
2026-04-09 17:37:46 +02:00
parent 92f0687549
commit b7807161f0
10 changed files with 334 additions and 0 deletions

View File

@@ -58,6 +58,16 @@ value RelativeDateFormat {
else: timestamp.toLocaleDateString(locale, month: short, day: numeric)
}
surface RelativeDateFormatSurface {
context format: RelativeDateFormat
exposes:
format.timestamp
format.locale
format.diff_days
format.display
}
value PostDateFormat {
timestamp: Timestamp
locale: String
@@ -67,6 +77,15 @@ value PostDateFormat {
-- Example: "Feb 10, 2026"
}
surface PostDateFormatSurface {
context format: PostDateFormat
exposes:
format.timestamp
format.locale
format.display
}
value PostTypeIcon {
categories: List<String>
@@ -80,6 +99,14 @@ value PostTypeIcon {
else: "document"
}
surface PostTypeIconSurface {
context icon: PostTypeIcon
exposes:
icon.categories
icon.icon
}
invariant SidebarEntityListPattern {
-- Views following this pattern (scripts, templates, chat, import) must provide:
-- 1. Header with localised title and create button.
@@ -103,6 +130,22 @@ value PostsView {
has_more: Boolean -- pagination, 500 per batch
}
surface PostsViewSurface {
context view: PostsView
exposes:
view.mode
view.search_query
view.filter_panel_visible
view.calendar_filter when view.calendar_filter != null
view.tag_filter
view.category_filter
view.draft_section.count
view.published_section.count
view.archived_section.count
view.has_more
}
-- Drafts section always shows all drafts regardless of filters.
-- Published and archived sections respect active filters.
-- "Clear All Filters" button resets search, date, tags, categories.
@@ -175,6 +218,17 @@ value MediaView {
grid: List<MediaGridItem> -- grid layout (not list)
}
surface MediaViewSurface {
context view: MediaView
exposes:
view.search_query
view.filter_panel_visible
view.calendar_filter when view.calendar_filter != null
view.tag_filter
view.grid.count
}
value MediaGridItem {
media_id: String
thumbnail_path: String? -- small (150px) thumbnail on disk when image; null for non-image
@@ -240,6 +294,13 @@ value ScriptsView {
items: List<ScriptListItem>
}
surface ScriptsViewSurface {
context view: ScriptsView
exposes:
view.items.count
}
value ScriptListItem {
script_id: String
title: String -- truncated with ellipsis on overflow
@@ -299,6 +360,13 @@ value TemplatesView {
items: List<TemplateListItem>
}
surface TemplatesViewSurface {
context view: TemplatesView
exposes:
view.items.count
}
value TemplateListItem {
template_id: String
title: String -- truncated with ellipsis on overflow
@@ -398,6 +466,13 @@ value SettingsNav {
active_section: String? -- persisted across sidebar switches
}
surface SettingsNavSurface {
context nav: SettingsNav
exposes:
nav.active_section when nav.active_section != null
}
rule SettingsNavClick {
when: SettingsNavEntryClicked(section)
if section = style:
@@ -452,6 +527,13 @@ value TagsNav {
active_section: String? -- persisted
}
surface TagsNavSurface {
context nav: TagsNav
exposes:
nav.active_section when nav.active_section != null
}
rule TagsNavClick {
when: TagsNavEntryClicked(section)
ensures: OpenTabRequested(type: tags, id: tags, intent: pin)
@@ -469,6 +551,14 @@ value ChatView {
items: List<ChatListItem>
}
surface ChatViewSurface {
context view: ChatView
exposes:
view.api_ready
view.items.count
}
value ChatListItem {
conversation_id: String
title: String -- live-updated via onTitleUpdated
@@ -514,6 +604,13 @@ value ImportView {
items: List<ImportListItem>
}
surface ImportViewSurface {
context view: ImportView
exposes:
view.items.count
}
value ImportListItem {
definition_id: String
name: String -- live-updated via onNameUpdated
@@ -571,6 +668,22 @@ value GitActiveView {
has_more_history: Boolean -- paginated, 20 per page
}
surface GitActiveViewSurface {
context view: GitActiveView
exposes:
view.branch
view.upstream when view.upstream != null
view.ahead
view.behind
view.status_files.count
view.history_entries.count
view.has_more_history
provides:
GitCommitRequested(message)
}
value GitStatusFile {
path: String
status: String -- modified, added, deleted, renamed, etc.
@@ -672,6 +785,14 @@ value CalendarYear {
months: List<CalendarMonth>
}
surface CalendarYearSurface {
context calendar_year: CalendarYear
exposes:
calendar_year.year
calendar_year.months.count
}
value CalendarMonth {
month: Integer -- 1-12
count: Integer -- number of items in this month