@happyvertical/smrt-content 0.43.4 → 0.43.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/AGENTS.md +9 -86
  2. package/agents/content-list.md +869 -0
  3. package/dist/content-query.d.ts +310 -0
  4. package/dist/content-query.d.ts.map +1 -0
  5. package/dist/contents.d.ts +22 -0
  6. package/dist/contents.d.ts.map +1 -1
  7. package/dist/index.d.ts +2 -0
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +672 -4
  10. package/dist/index.js.map +1 -1
  11. package/dist/manifest.json +22 -2
  12. package/dist/smrt-knowledge.json +38 -5
  13. package/dist/svelte/components/ContentList.svelte +941 -30
  14. package/dist/svelte/components/ContentList.svelte.d.ts +44 -1
  15. package/dist/svelte/components/ContentList.svelte.d.ts.map +1 -1
  16. package/dist/svelte/content-list-controller.d.ts +98 -1
  17. package/dist/svelte/content-list-controller.d.ts.map +1 -1
  18. package/dist/svelte/content-list-controller.js +290 -19
  19. package/dist/svelte/content-list-query.d.ts +498 -0
  20. package/dist/svelte/content-list-query.d.ts.map +1 -0
  21. package/dist/svelte/content-list-query.js +1294 -0
  22. package/dist/svelte/content-list-saved-views.d.ts +172 -0
  23. package/dist/svelte/content-list-saved-views.d.ts.map +1 -0
  24. package/dist/svelte/content-list-saved-views.js +298 -0
  25. package/dist/svelte/content-list-url-state.d.ts +211 -0
  26. package/dist/svelte/content-list-url-state.d.ts.map +1 -0
  27. package/dist/svelte/content-list-url-state.js +856 -0
  28. package/dist/svelte/i18n.contribution.d.ts +24 -0
  29. package/dist/svelte/i18n.contribution.d.ts.map +1 -1
  30. package/dist/svelte/i18n.contribution.js +26 -0
  31. package/dist/svelte/index.d.ts +5 -1
  32. package/dist/svelte/index.d.ts.map +1 -1
  33. package/dist/svelte/index.js +8 -1
  34. package/package.json +16 -15
package/AGENTS.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  STI content management with governance workflows, contribution intake, AI reviews, fact-checking, corrections, versioning, transparency reports, and thumbnail generation.
4
4
 
5
+ ## Modules
6
+
7
+ Per-module semantics live in sibling module docs — read the one for the module
8
+ you are editing. This file keeps what holds across the package.
9
+
10
+ | Module | Scope | Module doc |
11
+ |---|---|---|
12
+ | `src/svelte/content-list-*.ts` + `components/ContentList.svelte` | the shared list adapter (#2451), server-backed queries over `POST /api/v1/contents/query` (#2452), shareable URL state, and saved views | [agents/content-list.md](agents/content-list.md) |
13
+
5
14
  ## Models
6
15
 
7
16
  - **Content** (STI base): `type`, `variant` (generator:domain:specific format), `status` (published/draft/review/archived/deleted), `state`, `category` (hierarchical path with `/` separator), `metadata` JSON, `tags` array, `thumbnailAssetId`
@@ -86,92 +95,6 @@ Three strategies via ThumbnailGenerator:
86
95
  ### Contributions
87
96
  `ContentContributionForm`, `ContentContributionInbox`, `ContentContributionPortal`, `ContentContributionTypeManager`, `ContentContributorManager`
88
97
 
89
- ## ContentList migration (#2451)
90
-
91
- `ContentList` no longer holds bespoke local state. `src/svelte/content-list-controller.ts`
92
- is the single adapter every presentation reads from, and one shared
93
- `DataTableController` (from `@happyvertical/smrt-ui/data`) owns search, filters,
94
- sorting, page, and selection.
95
-
96
- | Before | After |
97
- |--------|-------|
98
- | local `searchTerm`/`selectedType`/`selectedStatus` runes | controller commands `setSearch` / `setFilters` (stable filter ids `type`, `status`) |
99
- | `filteredContents` `$derived` per view | `toContentListRows` → `selectContentListRows` → `paginateContentListRows`, computed once for all three modes |
100
- | bespoke `<table>` markup in compact mode | smrt-ui `DataTable` with the shared columns plus per-column cell snippets |
101
- | no selection | checkbox selection in every mode via `toggleRowSelection` / `setSelectedRows` |
102
- | `getViewHref` called inline three times | `resolveContentHref` / `contentListRowActions` (one eligibility source) |
103
-
104
- Props are unchanged and still exported as `ContentListProps`: `apiBaseUrl`,
105
- `contents`, `type` (still locks and hides the type filter), `defaultViewMode`
106
- (still seeds once), `onEdit`, `onDelete`, `onAdd`, `controls`, `getViewHref`.
107
- New optional props: `loading`, `error`, `onRetry`, and `dataSurface`
108
- (`{ registry, descriptor? }`).
109
-
110
- Adapter exports (also re-exported from `./svelte`): `createContentListController`,
111
- `buildContentListColumns`, `buildContentListSurfaceDescriptor`,
112
- `toContentListRows`, `selectContentListRows`, `paginateContentListRows`,
113
- `contentListFilters`, `readContentListFilter`, `applyContentListFilter`,
114
- `contentListRowActions`, `resolveContentHref`, `selectableContentListRowIds`,
115
- `resolveSelectedContentListRows`, `resolveSelectedContents`, plus the
116
- `CONTENT_LIST_*` identity constants.
117
-
118
- Notes:
119
-
120
- - Controller modes are all `manual`: the adapter owns search, filters, sorting,
121
- and paging in **every** presentation, and the compact table receives
122
- `data={pageRows}` plus `totalRows={queryRows.length}`. Letting DataTable
123
- filter locally over already-filtered rows re-ran the transform with subtly
124
- different semantics (untrimmed search, its own equality rules), so the two
125
- presentations could disagree. The component clamps the page with
126
- `controller.clampPage(queryRows.length)`. #2452 replaces the local
127
- implementation of that transform with a server query behind the same contract.
128
- - A `type` prop lock is enforced against live state, not just against the prop:
129
- a data-surface `set-filters` or `reset` command that drops the type filter is
130
- re-applied by the lock effect (equality-guarded, so it settles).
131
- - Selection may only address durable rows. All three presentations render a
132
- disabled, explained checkbox for `identified: false` rows, page select-all
133
- skips them, and a normalization effect re-dispatches `setSelectedRows` without
134
- any non-durable id, which covers data-surface commands too.
135
- - Compact mode renders a content-owned `select` column (header + cell snippets)
136
- instead of passing `selectable` to DataTable. DataTable has no per-row
137
- selection predicate, so its header select-all addresses the synthetic id of an
138
- unidentified row; the normalization effect then strips it and the header stays
139
- indeterminate forever. Because column order is reconciled from the
140
- controller's known column ids, the structural `select` and `actions` ids are
141
- part of `CONTENT_LIST_TABLE_COLUMN_IDS` — omit them and selection renders
142
- behind every data column.
143
- - Only rendered columns are published to a data surface. `description` is a
144
- hidden, search-only column so search still reaches the deck; the descriptor
145
- additionally declares the `id` row-key column, which the surface contract
146
- requires but the table never renders.
147
- - Rows without a durable `id` (or repeating one) still render, keyed by
148
- position, but are marked `identified: false`;
149
- `resolveSelectedContentListRows` drops them so a bulk action can never act on
150
- an unaddressable row. `ContentData` has no expiry or site field, so the
151
- `site` column is derived from `url`/`source`.
152
- - Column ids are public identifiers and do not always match the model field, so
153
- the descriptor's `fieldName` comes from an explicit map
154
- (`publish` → `publish_date`, `updated` → `updatedAt`); the derived `site`
155
- column advertises no field at all rather than a nonexistent one.
156
- - Filter values are normalized per column (`type` via `normalizeContentType`,
157
- everything else via `normalizeContentToken`) through
158
- `normalizeContentListFilterValue`, and a blank value clears the filter — an
159
- `equals ''` filter would silently exclude every row.
160
- - The card presentations render their own page controls (smrt-ui `Pagination`
161
- dispatching `setPage`) and their own polite refresh status, because DataTable
162
- — which owns both in compact mode — is not mounted there. A page size arriving
163
- from a saved view or a surface command would otherwise strand the operator on
164
- page one, and a refresh over retained rows would be silent.
165
- - `dataSurface` registers the compact table only. Agent addressability for the
166
- grid and detailed presentations lands with #2456.
167
- - Compact mode stays mounted for empty and loading results — DataTable renders
168
- its own `empty` snippet and loading row — because it owns the mounted surface:
169
- swapping it for the shared empty panel unregisters the surface, and an agent
170
- whose own search returned nothing then gets `not_found` on the command that
171
- would undo it. The shared loading/empty panels are the card presentations'
172
- only; the `error` branch still replaces the list in every mode, since a load
173
- failure is host-driven rather than surface-driven.
174
-
175
98
  ## Dev Server
176
99
 
177
100
  `npm run dev` starts SvelteKit at `localhost:5173` with 4 pages: