Search selfstore
v1.8.21

selfstore-storage

The whole storage journey, in one element. Most apps need nothing else.

<selfstore-storage></selfstore-storage>
const store = await selfstore('app', { drive: { clientId } });
document.querySelector('selfstore-storage').store = store;

That is the integration. Everything else is derived from the store: which destinations to offer, which backup to propose reopening, who holds it.

What it decides for you

It composes two elements you can still mount separately:

  • before there is a durable home, the gate - the first-run question, which only appears when the engine says a destination is missing;
  • once there is one, the destination panel - where it saves, when it last wrote, and how to change it.

The choice between them follows the engine’s own status, the same signal the gate uses to decide whether to be on screen. That is the part worth having: the assembly is where the mistakes were - showing the gate while the store was still loading, building destination lists by hand from a session the store already had, deriving a “reopen my backup” card from data the library was already holding. An app that mounts this element cannot make any of them.

Properties

Property Type Notes
store StoreLike | null The only one that is required.
targets ConnectTargets | null Override the destinations. Derived from the store when left alone.
manager BackupsManager | null Adds the named-backups panel (backups).
icons Partial<Record<ConnectKind, string>> An image per destination.
confirmAction (a: DestinationAction) => boolean | Promise<boolean> Veto before detaching.
deferrable boolean Whether the first-run screen offers a way out.
recommended ConnectKind | null Badge one destination. Also an attribute.

When to mount the pieces instead

Reach for the individual elements when your app puts them in different places - the gate on a first-run route, the panel inside a settings page - or when you need ::part() on the connect journey, which the composed version cannot expose (see styling).

Everything the pieces accept, they still accept. This element adds a decision, not a restriction.