Focused advanced chapter · experimental API

Giving Atmosphere a Body

One native live object records the composition. Direct subscribers and replaceable adapters keep the DOM, URL, controls, and host application in step.

Interact first

One object, every subscriber in step

Use the model controls in the left rail. The summary receives the live object directly. The token probe reads resolved facts from the cascade. The activity log at right receives only a bridged document event.

StateNamed composition coordinates.
EventsRevision plus changed fields.
RenderingThe existing CSS cascade.
Change Look, Lattice, density, or Life.
State plus event source

The experimental wrapper is deliberately small

class AtmosphereLiveModel extends EventTarget {
  #current;
  #revision = 0;

  get current() { return this.#current; }
  get revision() { return this.#revision; }

  set(axis, value, options) {
    return this.setComposition({ [axis]: value }, options);
  }

  subscribe(listener) {
    const handler = event => listener(event.detail);
    this.addEventListener('atmosphere:change', handler);
    return () => this.removeEventListener('atmosphere:change', handler);
  }
}
No virtual DOM and no style object.

The model records decisions, invokes the current composition controller, observes the compatibility DOM surface, and emits immutable snapshots. CSS continues to resolve the result.

Tight relationship

Give a related component the object directly

set model(nextModel) {
  this.#unsubscribe?.();
  this.#model = nextModel;
  this.#unsubscribe = nextModel.subscribe(change => {
    this.#render(change.coordinate, change.changed);
  });
  this.#render(nextModel.current, []);
}
Explicit dependency

The summary clearly declares that it needs the model.

Targeted update

The event says which coordinate fields changed.

Clean lifetime

The setter unsubscribes before binding another instance.

The coordinate summary and token probe on the first view use this pattern.

Loose relationship

Bridge global effects without coupling every component

// Adapter: model event → document event
model.subscribe(detail => {
  document.dispatchEvent(new CustomEvent(
    'atmosphere:model-change', { detail }
  ));
});

// Distant subscriber: no model reference
connectedCallback() {
  document.addEventListener(
    'atmosphere:model-change', this.#onChange
  );
}
Use the bridge for global effects, not routine component state.

URL synchronization, analytics, activity feeds, and host-level coordination benefit from decoupling. A closely related view is clearer with a direct dependency.

The activity component in the right rail demonstrates this path. It is never assigned AtmosphereModel.

What this proves—and what it does not

The pattern works; the core migration is not yet complete

CapabilityStatus
DOM-backed composition controllerShipped
Composite route plus ?at=Shipped
Reactive wrapper used on this pageExperimental
One canonical atomic persistence recordProposed
Drawer and every host write only through the modelProposed
AtmosphereModel

Target source of truth.

DOM adapter

Current compatibility surface.

URL adapter

Composition plus host route.

Storage adapter

Future atomic record.

Control adapter

Drawer and tray migration.