e5x — every value on this page is a subscription to a DOM tree

Current view

One view for the page's lifetime; it recomputes when the data or its deps change.

const view = sales.item
  .$where(matchesFilters, [filters.$.dept, filters.$.organic, filters.$.search])
  .$sort(bySortField, [filters.$.sort, filters.$.direction])
itemsview.$length
unitsview.quantity.$sum
avg priceview.price.$avg
price rangeview.price.$min / $max
stock valueview.price × view.quantity
notes (all)sales.$deep('note').$length

Inventory

Rows come from view.subscribe; each row repaints from item.subscribe. Controls write filters.dept = ….

type dept note item.note price qty organic

Units by dept

sales.item.$where({ dept }).quantity.$sum — asking the same path anywhere returns the same view. Click a bar to filter.

Outside writes

Plain DOM APIs, no e5x. Everything above still updates — the DOM is the source of truth.

The model, live

filters.subscribe + sales.subscribe — both trees, serialized.