SIAX Technology AB focuses on agentic process automation: process analysis, operational improvement, data and system integration.
@siax/ui-kit (0.2.0)
Published 2026-11-06 17:52:04 +00:00 by admin
Installation
@siax:registry=https://git.cloud.siax.io/api/packages/sax3l/npm/npm install @siax/ui-kit@0.2.0"@siax/ui-kit": "0.2.0"About this package
Framework-free collection adapter — one state, URL and query contract for every SIAX listing surface.
@siax/ui-kit
Framework-free adapter for SIAX collections. One state, one URL contract, one
query plan — shared with the React surfaces through @siax/analytical-context.
CollectionDefinition ──► createCollectionStore ──► ListingKit (DOM)
▲ │ │
@siax/analytical-context │ └─ renders cards, facets,
(canonical vocabulary) └─ canonical URL codec chips, paging, modal
Why this package exists
The vanilla listing kit used to own its own state object and its own URL parser.
That made a second truth next to useUrlListingState in @siax/ui. This
package removes that duplication:
- the collection definition decides which fields are filterable, sortable, searchable, exportable and visible;
- the store owns state transitions, page-offset rules and the shareable URL;
- the renderer owns DOM, markup and keyboard/ARIA behaviour — nothing else.
Install
pnpm add @siax/ui-kit
Use
import { defineCollection } from '@siax/analytical-context';
import { ListingKit } from '@siax/ui-kit/listing';
import '@siax/ui/globals.css';
import '@siax/ui-kit/styles.css';
const collection = defineCollection({
id: 'property.listings',
entityType: 'listing',
fields: [
{ id: 'id', kind: 'text', sortable: false, filterable: false },
{ id: 'title', kind: 'text', searchable: true },
{ id: 'municipality', kind: 'enum', facetable: true, searchable: true },
{ id: 'price', kind: 'number', unit: 'SEK', facetable: true },
{ id: 'area', kind: 'number', unit: 'm2', facetable: true },
{ id: 'published_at', kind: 'date' },
],
facets: [{ field: 'municipality' }, { field: 'price', type: 'range' }],
sorts: [{ field: 'published_at', direction: 'desc', default: true }],
pagination: { pageSize: 24, pageSizes: [12, 24, 48] },
});
new ListingKit({
container: '#app',
api: '/api/listings',
collection,
facetFields: [
{ key: 'municipality', label: 'Kommun' },
{ key: 'source', label: 'Källa' },
],
rangeFields: [
{ key: 'price', label: 'Pris', unit: 'kr/mån' },
{ key: 'area', label: 'Yta', unit: 'm²' },
],
});
Store only (no DOM)
import { createCollectionStore } from '@siax/ui-kit/store';
const store = createCollectionStore(collection, {
history,
location,
urlMode: 'replace',
});
store.subscribe((state, reason) => render(state, reason));
store.setQuery('ringön'); // page resets to 1
store.toggleFacet('municipality', 'Göteborg');
store.setRange('price', { min: 2000, max: 5000 });
store.setSort('-price');
store.setPage(2); // page is caller-owned
store.plan({ execution: 'server' }); // QueryPlanInput for @siax/grid/analytical
Guarantees
- No invented vocabulary. Unknown fields, facets, sorts, views and page sizes are dropped by the canonical normalizer, never forwarded.
- Page reset. Changing
q,facets,ranges,filters,sorts,perresets the offset unless the same patch setspageexplicitly. - Bounded page size.
?per=outsidepagination.pageSizesfalls back to the catalogue default instead of widening the result set. - No duplicate URL logic.
q,per,page,sort,view,facets,ranges; defaults omitted; identical to@siax/ui'suseUrlListingState. - No global access. The store receives
history/locationexplicitly; tests and server rendering never touch browser globals. - Renderers stay dumb.
ListingKitreadsstore.getState()and calls store methods; it holds no filter, sort or paging state of its own.
Scripts
pnpm --filter @siax/ui-kit test # vitest
pnpm --filter @siax/ui-kit typecheck # tsc --noEmit
Dependencies
Dependencies
| ID | Version |
|---|---|
| @siax/analytical-context | ^0.6.0 |
Development Dependencies
| ID | Version |
|---|---|
| typescript | ^5.7.2 |
| vitest | ^3.0.0 |
Details
Assets (1)
Versions (2)
View all
ui-kit-0.2.0.tgz
22 KiB