formaui-net.Framework.Catalog
1.0.0-preview.27
Prefix Reserved
dotnet add package formaui-net.Framework.Catalog --version 1.0.0-preview.27
NuGet\Install-Package formaui-net.Framework.Catalog -Version 1.0.0-preview.27
<PackageReference Include="formaui-net.Framework.Catalog" Version="1.0.0-preview.27" />
<PackageVersion Include="formaui-net.Framework.Catalog" Version="1.0.0-preview.27" />
<PackageReference Include="formaui-net.Framework.Catalog" />
paket add formaui-net.Framework.Catalog --version 1.0.0-preview.27
#r "nuget: formaui-net.Framework.Catalog, 1.0.0-preview.27"
#:package formaui-net.Framework.Catalog@1.0.0-preview.27
#addin nuget:?package=formaui-net.Framework.Catalog&version=1.0.0-preview.27&prerelease
#tool nuget:?package=formaui-net.Framework.Catalog&version=1.0.0-preview.27&prerelease
Forma.Framework.Catalog
The model of a browsable collection of items and folders: the item and folder contracts, the provider that answers one slice of them at a time, the requests a surface hands back when the reader renames, deletes or moves something, and the ceilings a collection keeps. A host writes its items and its provider against these contracts once, and every surface that browses a catalog lists them.
Install
dotnet add package formaui-net.Framework.Catalog --prerelease
The package builds on Forma.Framework.Resources alone, so items and providers can live in a plain
class library. Its types are used directly, without registration.
Items
ICatalogItem is one item, and ICatalogFolderItem is a folder, adding ParentKey and Count.
| Member | What it is |
|---|---|
Key |
The stable identifier, unique among the items and the same each time the item is rebuilt. |
Name |
The displayed name. |
Capabilities |
The operations the item supports, as CatalogItemCapabilities flags: Open, View, Drag, Drop, Move, Rename, Delete, Create and more. |
Visibility |
Visible, Hidden (left out of the listing and its counts), or Invisible (keeps its place, undrawn). |
IsDisabled |
Whether the item is listed with its operations unavailable. |
DisabledReason |
Why the item is disabled, which the explorer shows as its tooltip while it is; null unless an implementation gives one. |
CreatedAt, ModifiedAt |
When the item was created and last changed. |
ThumbnailSource |
The address of the item's thumbnail. |
Resource |
The ResourceInfo the item wraps, which a thumbnail, a preview and the kind and size read. |
ParentKey |
On a folder, the key of the folder it sits inside; null is the top level. |
Count |
On a folder, how many items it holds. |
GetKind reads what an item is as a CatalogItemKind, Folder, Image, Video, Audio, Archive,
Document, File or Unknown, the same in every culture.
CatalogItem and CatalogFolderItem implement both with init-only members. CatalogItem.For,
ForAll and ForFolder build them from resources, with the capabilities each kind supports:
using Forma.Framework.Catalog;
IReadOnlyList<ICatalogItem> folders = CatalogItem.ForAll(await store.GetFoldersAsync());
IReadOnlyList<ICatalogItem> files = CatalogItem.ForAll(await store.GetFilesAsync(folderKey));
A host's own entity can implement ICatalogItem itself, deciding what each entry supports:
using Forma.Framework.Catalog;
using Forma.Framework.Resources;
public sealed class PhotoItem(Photo photo) : ICatalogItem
{
public string Key => photo.Id;
public string Name => photo.FileName;
public CatalogItemCapabilities Capabilities => photo.IsLocked
? CatalogItemCapabilities.View
: CatalogItemCapabilities.View | CatalogItemCapabilities.Drag | CatalogItemCapabilities.Move
| CatalogItemCapabilities.Rename | CatalogItemCapabilities.Delete;
public CatalogItemVisibility Visibility => CatalogItemVisibility.Visible;
public bool IsDisabled => photo.IsProcessing;
public string? DisabledReason => photo.IsProcessing ? "Still processing" : null;
public DateTimeOffset? CreatedAt => photo.UploadedAt;
public DateTimeOffset? ModifiedAt => photo.EditedAt;
public string? ThumbnailSource => photo.ThumbnailUrl;
public ResourceInfo? Resource { get; } = new ImageResourceInfo(photo.Url)
{
ContentType = photo.ContentType,
Size = photo.Bytes,
Width = photo.Width,
Height = photo.Height,
};
}
Providers
A collection too large to hold in memory is answered one slice at a time by an ICatalogProvider.
GetItemsAsync receives a CatalogQuery of FolderKey, Skip, Take, Search, SortBy and
Direction, and returns a CatalogPage of the slice's Items and a TotalCount. FolderKey names
the folder the slice was asked for when it was asked, null for every folder's items, so a provider
answers from the query alone. Items the sort ties stand in the ascending ordinal order of their keys,
in either direction, so neighboring slices neither repeat nor skip one.
Skip and Take count the store's positions, and TotalCount how many positions the query
matched, so a slice holding a hidden item, or one the surface's filter rejects, still moves the next
slice on by every position it read. A page whose items stand for more positions than it returns,
because the provider left some out itself, says how many it read in ReadCount. The query's
Filter names the kinds the surface lists, for a store that applies it before paging; one that does,
and leaves hidden items out too, gives the count of what the whole query lists in ListedCount,
which is the only count a surface shows as how many items there are. A null TotalCount suits a
store that cannot count cheaply: HasMore then says whether another slice follows, and without it a
slice that read fewer positions than Take ends the collection.
A provider that lists folders lists them as ICatalogFolderItems whose ParentKey places them, the
folder key of every item in them; a flat catalog lists none. The query's Kinds names the kinds of
item it asks for, null asking for every kind and an empty set for none, and AsksFor answers for one.
A provider applies them before it pages, so the slice, ReadCount, TotalCount, ListedCount and
HasMore all describe the items of those kinds alone: a surface asks a provider for its folders
alone, or for its files alone, and pages through either. A caller can leave an item of another kind
out of an answer, but its counts and positions stay wrong for a provider that ignored the kinds.
using Forma.Framework.Catalog;
using Forma.Framework.Catalog.Queries;
public sealed class PhotoItemsProvider(IPhotoStore store) : ICatalogProvider
{
public async ValueTask<CatalogPage> GetItemsAsync(CatalogQuery query, CancellationToken cancellationToken)
{
var photos = await store.ListAsync(
query.FolderKey,
query.AsksFor(CatalogItemKind.Folder),
query.AsksFor(CatalogItemKind.Image),
query.Search, query.SortBy, query.Direction, query.Skip, query.Take, cancellationToken);
return new CatalogPage([.. photos.Select(photo => new PhotoItem(photo))], TotalCount: null);
}
}
ReadAllAsync reads every item a query asks for, a slice of Take positions at a time from Skip
on, moving past a slice that holds no item by the positions it read and stopping where a slice says
none follow, which suits a surface that needs a whole list, such as every folder, at the cost of
reading all of it:
var everyFolder = new CatalogQuery(null, 0, 200, null, CatalogSortField.Name, CatalogSortDirection.Ascending)
{
Kinds = new HashSet<CatalogItemKind> { CatalogItemKind.Folder },
};
var folders = await provider.ReadAllAsync(everyFolder, cancellationToken);
A query's Grouping gathers the items into groups that order them before the sort does, so a group
whose items span two slices is one group in both. It names the field, CatalogGroupField, and the
groups in the order they stand, each a key the same in every culture and on every day and a rule a
store can apply without the reader's culture or clock: CatalogNameGroup for the names beginning
with a range of characters, CatalogSizeGroup and CatalogDateGroup for a range of sizes or of
instants, CatalogKindGroup for one kind, CatalogMissingGroup for the items holding no size or no
date, and CatalogRemainderGroup for whatever the others leave. An item falls in the first group that
admits it, and items stand in their groups' order, then the sort's, then their keys'. A query with
IncludesGroupSizes asks the page for how many items each group lists across the whole query,
leaving hidden items out, in GroupSizes; CatalogGrouping.CountGroups counts them for a provider
that holds its items.
CatalogResourceFilter.Parse reads an accepted-kinds pattern, globs:*.jpg;*.pdf or
contentType:image;video, and its Accepts answers for one resource. A glob names files; a content
type of folder names folders, and AcceptsFolders says whether a filter takes them. A store applying
the filter itself reads what it was parsed from in Globs and ContentTypes, and AcceptsAll says
whether it takes every item of a CatalogItemKind, so the store asks its database for that kind whole
and matches the rest against the globs or the content types.
Requests and constraints
Each change the reader asks a surface for comes back to the host as a request in
Forma.Framework.Catalog.Requests, carrying the host's own items for the host to carry out. A rename,
a deletion and a drop take files and folders alike, and a host that could not carry one out calls its
Fail(), which the surface reads once the host has answered:
| Request | Carries |
|---|---|
CatalogRenameRequest |
Item, NewName |
CatalogDeleteRequest |
Items |
CatalogDropRequest |
Items, TargetFolder (null is the top level) |
CatalogFolderCreateRequest |
ParentFolder, Name |
CatalogConstraints holds the kinds a collection lists and accepts, AcceptedResourceKinds, the
kinds an upload may add where they differ, AcceptedUploadKinds, and the ceilings it keeps, each
unlimited at zero: MaxFolderDepth, MaxFolderRootCount, MaxSubfolderCount,
MaxFolderItemCount, MaxItemCount, MaxTotalBytes and MaxFileBytes, the bytes of one file.
A surface reports a refusal as a CatalogRejection of its Reason, the Limit it reached and a
localized Message.
var constraints = new CatalogConstraints
{
AcceptedResourceKinds = "contentType:image;video",
MaxFolderDepth = 3,
MaxTotalBytes = 500L * 1024 * 1024,
MaxFileBytes = 20L * 1024 * 1024,
};
Building a surface
A component that browses a catalog keeps its state in the types this package provides:
| Type | What it is |
|---|---|
CatalogCollectionView |
A held collection filtered by kind, searched by name, sorted and cut to the visible page. |
CatalogListProvider |
An ICatalogProvider answering from a list it holds, shaped as a CatalogCollectionView shapes it, so a held collection and a store answer alike. |
CatalogFolderTree |
The folder items indexed by key and by parent. |
License
Apache License 2.0, under the repository's LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- formaui-net.Framework.Resources (= 1.0.0-preview.27)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on formaui-net.Framework.Catalog:
| Package | Downloads |
|---|---|
|
formaui-net.Framework.Explorer
The options and state behind FormaExplorer: the records a host configures an explorer with, and the view and interaction contracts through which the explorer's parts, its toolbar, sidebar, address bar and content views, read its state and ask it for changes. |
|
|
formaui-net.Blazor.Explorer
FormaExplorer, a file manager for the Forma component library over items and folders the host already holds: a folder tree, an address bar with history and breadcrumbs, thumbnail, details and list views, search, sorting and grouping, selection, drag and drop between folders, upload, and a preview of any item. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-preview.27 | 45 | 12/3/2026 |
| 1.0.0-preview.26 | 54 | 12/3/2026 |
| 1.0.0-preview.25 | 53 | 12/2/2026 |
| 1.0.0-preview.24 | 65 | 12/1/2026 |
| 1.0.0-preview.23 | 85 | 11/30/2026 |
| 1.0.0-preview.22 | 80 | 11/30/2026 |
| 1.0.0-preview.21 | 83 | 11/29/2026 |
| 1.0.0-preview.20 | 88 | 11/26/2026 |
| 1.0.0-preview.19 | 83 | 11/26/2026 |
| 1.0.0-preview.18 | 81 | 11/26/2026 |
| 1.0.0-preview.17 | 77 | 11/26/2026 |
| 1.0.0-preview.16 | 73 | 11/24/2026 |
| 1.0.0-preview.15 | 73 | 11/23/2026 |
| 1.0.0-preview.14 | 71 | 11/23/2026 |
| 1.0.0-preview.13 | 73 | 11/21/2026 |
| 1.0.0-preview.12 | 75 | 11/20/2026 |
| 1.0.0-preview.11 | 73 | 11/18/2026 |
| 1.0.0-preview.10 | 81 | 11/17/2026 |
| 1.0.0-preview.9 | 110 | 11/17/2026 |
| 1.0.0-preview.8 | 82 | 11/17/2026 |
What this release changed is in Forma's changelog: https://github.com/FormaUI/Forma/blob/v1.0.0-preview.27/CHANGELOG.md