@softwarity/livewire 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -165,8 +165,20 @@ class LivewireClient {
165
165
  return socket;
166
166
  }
167
167
  send(event, data) {
168
- // Anything sent before the socket is up is not queued here: `onopen` sends
169
- // every open subscription, which is the same set and a shorter path.
168
+ // Nothing is sent before the socket is up, and this is not an optimisation.
169
+ // A `WebSocket` still connecting *throws* on `send` rather than ignoring
170
+ // it, and that exception comes straight back out of `watch`'s subscribe
171
+ // function - killing the very subscription being opened. On a cold load
172
+ // that is every list a screen asks for before the handshake completes, and
173
+ // they never come back, because the error tears the observable down.
174
+ //
175
+ // Nothing is lost by waiting: `onopen` sends every open subscription, which
176
+ // is the same set and a shorter path. An `unsubscribe` that does not go out
177
+ // is not lost either - the id is already gone from `open`, so it is not
178
+ // among what gets re-sent.
179
+ if (!this.live()) {
180
+ return;
181
+ }
170
182
  this.socket?.send(JSON.stringify({ event, data }));
171
183
  }
172
184
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LivewireClient, deps: [{ token: LIVEWIRE_CONFIG }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -702,7 +714,7 @@ class LiveIndicatorComponent {
702
714
  <button type="button" class="lw-indicator" [class.lw-down]="!live()" [attr.aria-label]="label()" [title]="label()" (click)="retry()">
703
715
  <span class="lw-dot" [class.lw-beat]="live() && !asked()" [class.lw-turn]="asked()"></span>
704
716
  </button>
705
- `, isInline: true, styles: [":host{display:inline-flex;// Centred on its own line and beside whatever it sits next to. A dot is // small enough that a row aligning its children to the top leaves it // stranded above the text it belongs to. align-items: center;align-self:center;vertical-align:middle}.lw-indicator{display:inline-flex;align-items:center;padding:0;border:none;background:none;cursor:pointer;color:var(--lw-live, currentColor)}.lw-indicator.lw-down{color:var(--lw-down, #b26a00)}.lw-indicator:focus-visible{outline:2px solid currentColor;outline-offset:2px;border-radius:50%}.lw-dot{display:block;width:.6rem;height:.6rem;border-radius:50%;background:currentColor}.lw-dot.lw-beat{animation:lw-beat 2.4s ease-in-out infinite}.lw-dot.lw-turn{animation:lw-turn .5s ease-out}// A breath,not a pulse. The dot says the socket is up,which is the // quiet state of a working screen: something that jumps every second // reads as a warning and pulls the eye away from the list. @keyframes lw-beat{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.45;transform:scale(.88)}}@keyframes lw-turn{0%{transform:scale(1.6);opacity:.4}}@media(prefers-reduced-motion:reduce){.lw-dot.lw-beat,.lw-dot.lw-turn{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
717
+ `, isInline: true, styles: [":host{display:inline-flex;align-items:center;align-self:center;vertical-align:middle}.lw-indicator{display:inline-flex;align-items:center;padding:0;border:none;background:none;cursor:pointer;color:var(--lw-live, currentColor)}.lw-indicator.lw-down{color:var(--lw-down, #b26a00)}.lw-indicator:focus-visible{outline:2px solid currentColor;outline-offset:2px;border-radius:50%}.lw-dot{position:relative;display:block;width:.55rem;height:.55rem;border-radius:50%;background:currentColor;box-shadow:0 0 0 .18rem color-mix(in srgb,currentColor 20%,transparent)}.lw-dot:after{content:\"\";position:absolute;inset:0;border-radius:50%;background:currentColor;opacity:0}.lw-dot.lw-beat:after{animation:lw-flare 2.4s cubic-bezier(0,0,.2,1) infinite}.lw-dot.lw-turn{animation:lw-turn .5s ease-out}@keyframes lw-flare{0%{opacity:.5;transform:scale(1)}70%,to{opacity:0;transform:scale(2.8)}}@keyframes lw-turn{0%{transform:scale(1.7);opacity:.4}}@media(prefers-reduced-motion:reduce){.lw-dot.lw-beat:after,.lw-dot.lw-turn{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
706
718
  }
707
719
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LiveIndicatorComponent, decorators: [{
708
720
  type: Component,
@@ -710,10 +722,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
710
722
  <button type="button" class="lw-indicator" [class.lw-down]="!live()" [attr.aria-label]="label()" [title]="label()" (click)="retry()">
711
723
  <span class="lw-dot" [class.lw-beat]="live() && !asked()" [class.lw-turn]="asked()"></span>
712
724
  </button>
713
- `, styles: [":host{display:inline-flex;// Centred on its own line and beside whatever it sits next to. A dot is // small enough that a row aligning its children to the top leaves it // stranded above the text it belongs to. align-items: center;align-self:center;vertical-align:middle}.lw-indicator{display:inline-flex;align-items:center;padding:0;border:none;background:none;cursor:pointer;color:var(--lw-live, currentColor)}.lw-indicator.lw-down{color:var(--lw-down, #b26a00)}.lw-indicator:focus-visible{outline:2px solid currentColor;outline-offset:2px;border-radius:50%}.lw-dot{display:block;width:.6rem;height:.6rem;border-radius:50%;background:currentColor}.lw-dot.lw-beat{animation:lw-beat 2.4s ease-in-out infinite}.lw-dot.lw-turn{animation:lw-turn .5s ease-out}// A breath,not a pulse. The dot says the socket is up,which is the // quiet state of a working screen: something that jumps every second // reads as a warning and pulls the eye away from the list. @keyframes lw-beat{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.45;transform:scale(.88)}}@keyframes lw-turn{0%{transform:scale(1.6);opacity:.4}}@media(prefers-reduced-motion:reduce){.lw-dot.lw-beat,.lw-dot.lw-turn{animation:none}}\n"] }]
725
+ `, styles: [":host{display:inline-flex;align-items:center;align-self:center;vertical-align:middle}.lw-indicator{display:inline-flex;align-items:center;padding:0;border:none;background:none;cursor:pointer;color:var(--lw-live, currentColor)}.lw-indicator.lw-down{color:var(--lw-down, #b26a00)}.lw-indicator:focus-visible{outline:2px solid currentColor;outline-offset:2px;border-radius:50%}.lw-dot{position:relative;display:block;width:.55rem;height:.55rem;border-radius:50%;background:currentColor;box-shadow:0 0 0 .18rem color-mix(in srgb,currentColor 20%,transparent)}.lw-dot:after{content:\"\";position:absolute;inset:0;border-radius:50%;background:currentColor;opacity:0}.lw-dot.lw-beat:after{animation:lw-flare 2.4s cubic-bezier(0,0,.2,1) infinite}.lw-dot.lw-turn{animation:lw-turn .5s ease-out}@keyframes lw-flare{0%{opacity:.5;transform:scale(1)}70%,to{opacity:0;transform:scale(2.8)}}@keyframes lw-turn{0%{transform:scale(1.7);opacity:.4}}@media(prefers-reduced-motion:reduce){.lw-dot.lw-beat:after,.lw-dot.lw-turn{animation:none}}\n"] }]
714
726
  }] });
715
- const LIVE = 'Live - click to ask for the data again';
716
- const DOWN = 'Disconnected - reconnecting. Click to try now';
727
+ const LIVE = 'Live data - click to ask for it again';
728
+ const DOWN = 'No live data - reconnecting. Click to try now';
717
729
 
718
730
  /**
719
731
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"softwarity-livewire.mjs","sources":["../../src/lib/livewire.client.ts","../../src/lib/provide-livewire.ts","../../src/lib/live-list.ts","../../src/lib/live-topic.ts","../../src/lib/live-window.datasource.ts","../../src/lib/live-indicator.component.ts","../../src/softwarity-livewire.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { Inject, Injectable, InjectionToken, Optional, signal } from '@angular/core';\nimport { Observable, Subject } from 'rxjs';\nimport { filter } from 'rxjs/operators';\nimport { SUBSCRIBE_EVENT, UNSUBSCRIBE_EVENT, UPDATE_EVENT } from '@softwarity/livewire-protocol';\nimport type { Envelope, JsonValue, LiveRow, UpdateFrame } from '@softwarity/livewire-protocol';\n\nexport interface LivewireConfig {\n /** Where the socket answers. Root-relative, so a gateway can route it. */\n path: string;\n\n /** How long a dropped socket waits before trying again. */\n reconnectMs?: number;\n\n /**\n * How to open the connection.\n *\n * Absent, a real `WebSocket` against `path` on the page's own host. Supplied,\n * anything of that shape - which is how the in-memory server is dropped in\n * for a demo or a test with no backend at all.\n */\n connect?: () => LivewireSocket;\n}\n\n/** The little of a `WebSocket` this client uses. */\nexport interface LivewireSocket {\n send(frame: string): void;\n close(code?: number, reason?: string): void;\n onmessage?: ((frame: string) => void) | null;\n onclose?: ((code: number, reason: string) => void) | null;\n onopen?: (() => void) | null;\n}\n\nexport const LIVEWIRE_CONFIG = new InjectionToken<LivewireConfig>('LIVEWIRE_CONFIG');\n\nconst DEFAULT_RECONNECT_MS = 3000;\n\n/**\n * The one socket, shared by every live list.\n *\n * One connection per tab, not one per screen: one handshake, one place where\n * authorisation happens, one reconnection to get right. Subscriptions are told\n * apart by an id the caller picks, so several lists can be open at once.\n */\n@Injectable({ providedIn: 'root' })\nexport class LivewireClient {\n /** Whether the socket is currently carrying anything. */\n readonly live = signal(false);\n\n private socket: LivewireSocket | null = null;\n\n /** The wait before the next attempt, held so `retry` can cut it short. */\n private retrying: ReturnType<typeof setTimeout> | null = null;\n\n /**\n * Everything the socket delivers, for the watchers to filter.\n *\n * A plain Subject between the socket and the screens, and that indirection is\n * the whole point. `rxjs/webSocket` ties the connection to its subscriber\n * count: it closes when the last one leaves and reopens on the next, so a\n * list scrolling out of view took the connection down with it and the next\n * one opened another - nine sockets for one list, each losing the snapshot\n * sent to the one before.\n */\n private readonly incoming = new Subject<Envelope<unknown>>();\n\n /**\n * What to re-send when a socket comes back.\n *\n * A reconnected socket knows nothing about what the screens were watching a\n * second ago, and the screens have no reason to find out that it dropped.\n */\n private readonly open = new Map<string, unknown>();\n\n constructor(\n @Inject(LIVEWIRE_CONFIG) private readonly config: LivewireConfig,\n @Optional() @Inject(DOCUMENT) private readonly document: Document | null,\n ) {}\n\n /**\n * Watches one topic, and keeps watching it across reconnections.\n *\n * The returned stream starts with a snapshot and continues with patches -\n * applying them is `LiveList`'s job. Unsubscribing closes the subscription\n * server-side; the socket itself stays up for the other lists.\n */\n watch<Row extends LiveRow>(id: string, topic: string, query: JsonValue | null): Observable<UpdateFrame<Row>> {\n return new Observable<UpdateFrame<Row>>((subscriber) => {\n this.connect();\n const asked = { id, topic, query: query ?? undefined };\n this.open.set(id, asked);\n this.send(SUBSCRIBE_EVENT, asked);\n\n const frames = this.incoming\n .pipe(\n filter((envelope): envelope is Envelope<UpdateFrame<Row>> => {\n return envelope.event === UPDATE_EVENT && (envelope.data as UpdateFrame<Row>)?.id === id;\n }),\n )\n .subscribe((envelope) => subscriber.next(envelope.data));\n\n return () => {\n frames.unsubscribe();\n // The socket stays up for the other lists; only this window closes.\n this.open.delete(id);\n this.send(UNSUBSCRIBE_EVENT, { id });\n };\n });\n }\n\n /**\n * Asks for a window again, and gets a snapshot back.\n *\n * A gap in the sequence means the two sides disagree about what was sent.\n * Asking again is cheap; carrying on would show a list nobody can trust.\n */\n resync(id: string): void {\n const asked = this.open.get(id);\n if (asked) {\n this.send(SUBSCRIBE_EVENT, asked);\n }\n }\n\n /**\n * What a reader can do about it when something looks off.\n *\n * Two situations, one gesture, because from their side they are the same\n * complaint - the screen may not be showing what is true. Down: the\n * reconnection delay is skipped and the socket is opened now. Up: every open\n * window is asked for again, and each answers with a snapshot.\n */\n retry(): void {\n if (this.socket) {\n for (const asked of this.open.values()) {\n this.send(SUBSCRIBE_EVENT, asked);\n }\n return;\n }\n if (this.retrying !== null) {\n clearTimeout(this.retrying);\n this.retrying = null;\n }\n this.connect();\n }\n\n /**\n * Opens the one socket, once, and keeps it open.\n *\n * A plain `WebSocket` rather than `rxjs/webSocket`, deliberately - see the\n * note on `incoming`. What this needs is one socket for as long as the tab\n * lives, which is easier to write outright than to talk an operator chain\n * into.\n */\n private connect(): void {\n if (this.socket) {\n return;\n }\n const socket = this.config.connect ? this.config.connect() : this.openWebSocket();\n this.socket = socket;\n\n socket.onopen = (): void => {\n this.live.set(true);\n // Whatever the screens were watching, asked for again. A reconnected\n // socket knows nothing about them, and on the first open this is what\n // sends the subscriptions queued before it came up.\n for (const asked of this.open.values()) {\n this.send(SUBSCRIBE_EVENT, asked);\n }\n };\n\n socket.onmessage = (frame: string): void => {\n try {\n this.incoming.next(JSON.parse(frame) as Envelope<unknown>);\n } catch (error) {\n console.error('[livewire] unreadable frame', error);\n }\n };\n\n // A dropped socket is the normal case, not a fault: a gateway restart, a\n // laptop that slept. Reconnecting is this client's job so no screen has to\n // know it happened.\n socket.onclose = (): void => {\n this.live.set(false);\n this.socket = null;\n this.retrying = setTimeout(() => {\n this.retrying = null;\n this.connect();\n }, this.config.reconnectMs ?? DEFAULT_RECONNECT_MS);\n };\n }\n\n private openWebSocket(): LivewireSocket {\n const location = this.document?.location;\n const scheme = location?.protocol === 'https:' ? 'wss:' : 'ws:';\n const native = new WebSocket(`${scheme}//${location?.host ?? ''}${this.config.path}`);\n // Adapted rather than used directly: a `MessageEvent` is the browser's\n // shape, and everything else here - the in-memory server, the tests -\n // speaks in frames.\n const socket: LivewireSocket = {\n send: (frame) => native.send(frame),\n close: (code, reason) => native.close(code, reason),\n };\n native.onopen = () => socket.onopen?.();\n native.onmessage = (event: MessageEvent) => socket.onmessage?.(String(event.data));\n native.onclose = (event: CloseEvent) => socket.onclose?.(event.code, event.reason);\n native.onerror = () => console.error('[livewire] socket error');\n return socket;\n }\n\n private send(event: string, data: unknown): void {\n // Anything sent before the socket is up is not queued here: `onopen` sends\n // every open subscription, which is the same set and a shorter path.\n this.socket?.send(JSON.stringify({ event, data }));\n }\n}\n","import { LIVEWIRE_CONFIG } from './livewire.client';\nimport type { EnvironmentProviders, Provider } from '@angular/core';\nimport type { LivewireConfig } from './livewire.client';\n\n/**\n * Wires the one socket into an application.\n *\n * ```ts\n * providers: [provideLivewire({ path: '/my-service/ws' })]\n * ```\n *\n * For a demo or a test with no backend, hand it a connection instead:\n *\n * ```ts\n * const server = new MockServer().register('rows', { windowFor: () => window });\n * provideLivewire({ path: '', connect: () => server.connect() });\n * ```\n */\nexport function provideLivewire(config: LivewireConfig): (Provider | EnvironmentProviders)[] {\n return [{ provide: LIVEWIRE_CONFIG, useValue: config }];\n}\n","import { signal } from '@angular/core';\nimport type { Signal } from '@angular/core';\nimport type { LiveRow, PatchFrame, UpdateFrame } from '@softwarity/livewire-protocol';\n\n/**\n * A list kept in step with what the server pushes.\n *\n * Snapshot then patches, applied and nothing more: what belongs in the list and\n * in what order is decided by the source's query, and a client that recomputed\n * either from its own idea of the filters would be a second implementation free\n * to disagree.\n */\nexport class LiveList<Row extends LiveRow> {\n private readonly held = signal<Row[]>([]);\n private readonly length = signal(0);\n private readonly marked = signal<number | null>(null);\n\n /** The list as it stands. Ordered by the server, never re-sorted here. */\n readonly rows: Signal<Row[]> = this.held.asReadonly();\n\n /** What the list is a page of, for a paged topic. Its own length otherwise. */\n readonly total: Signal<number> = this.length.asReadonly();\n\n /**\n * An index in the whole list the server pointed at, if it pointed at one.\n *\n * Meaningless here on purpose: the library carries the number and the screen\n * decides what it means - a boundary, a cursor, the first unread row.\n */\n readonly pivot: Signal<number | null> = this.marked.asReadonly();\n\n private sequence = 0;\n\n /**\n * Applies one frame. Answers false when the two sides have drifted, which is\n * the caller's cue to ask for the window again.\n */\n apply(update: UpdateFrame<Row>): boolean {\n if (update.type === 'error') {\n console.error(`Livewire subscription '${update.id}' refused: ${update.reason}`);\n return true;\n }\n if (update.type === 'snapshot') {\n this.sequence = update.sequence;\n this.held.set(update.rows);\n this.length.set(update.total ?? update.rows.length);\n this.marked.set(update.pivot ?? null);\n return true;\n }\n // On one socket nothing is lost and nothing overtakes, so a gap means the\n // two sides disagree about what was sent. Asking again is cheap; carrying\n // on would show a list nobody can reproduce.\n if (update.sequence !== this.sequence + 1) {\n return false;\n }\n const rebuilt = this.rebuild(update);\n if (!rebuilt) {\n return false;\n }\n this.sequence = update.sequence;\n this.held.set(rebuilt);\n this.length.set(update.total ?? rebuilt.length);\n this.marked.set(update.pivot ?? null);\n return true;\n }\n\n /** Forgets what it holds - a fresh subscription answers with a snapshot. */\n reset(): void {\n this.sequence = 0;\n this.held.set([]);\n this.length.set(0);\n this.marked.set(null);\n }\n\n /** Null when the patch names a row neither side holds - the caller resyncs. */\n private rebuild(update: PatchFrame<Row>): Row[] | null {\n const byId = new Map(this.held().map((row) => [row.id, row]));\n for (const id of update.removed) {\n byId.delete(id);\n }\n for (const row of update.upserted) {\n byId.set(row.id, row);\n }\n const next: Row[] = [];\n for (const id of update.order) {\n const row = byId.get(id);\n if (!row) {\n return null;\n }\n next.push(row);\n }\n return next;\n }\n}\n","import { Observable } from 'rxjs';\nimport { filter, map } from 'rxjs/operators';\nimport { LiveList } from './live-list';\nimport { LivewireClient } from './livewire.client';\nimport type { JsonValue, LiveRow, UpdateFrame } from '@softwarity/livewire-protocol';\n\n/**\n * One screen's live window on one topic.\n *\n * The bookkeeping every feature service would otherwise repeat: the counter,\n * the id it last opened, and the resync that has to name it. Small, and worth\n * having once - the id rule below is the kind of thing that is right in one\n * copy and wrong in the next.\n */\nexport class LiveTopic<Row extends LiveRow> {\n /** Counts subscriptions, so no two ever share an id. */\n private opened = 0;\n\n /** The id of the current window, for `resync`. */\n private watching: string | null = null;\n\n constructor(\n private readonly client: LivewireClient,\n private readonly topic: string,\n ) {}\n\n /**\n * The rows the screen is showing, and again whenever they change.\n *\n * One subscription for the screen, not one per page: the window is part of\n * the question, which is what makes a paged list pushable at all. The server\n * does not send an insertion for the client to place - it sends what rows\n * `[offset, offset+limit)` now hold, so three rows arriving at the top shift\n * no index. The window simply holds something else than it did.\n */\n window(query: object, offset: number, limit: number): Observable<UpdateFrame<Row>> {\n // Unique per subscription. Reusing an id means a patch still in flight from\n // the window before lands on the new one, whose sequence starts over - it\n // reads as a gap, resyncs, and nothing publishes in the meantime.\n this.watching = `${this.topic}:${(this.opened += 1)}`;\n return this.client.watch<Row>(this.watching, this.topic, { ...query, offset, limit } as JsonValue);\n }\n\n /**\n * The same, for a list the server sends whole.\n *\n * A short list is bounded by its filters rather than by a scroll position, so\n * there is no offset to send. Everything around it is unchanged: one live\n * subscription at a time, a fresh id each time, and a resync that names it.\n */\n open(query: JsonValue | null): Observable<UpdateFrame<Row>> {\n this.watching = `${this.topic}:${(this.opened += 1)}`;\n return this.client.watch<Row>(this.watching, this.topic, query);\n }\n\n /** Asks the server for the window again - answered with a snapshot. */\n resync(): void {\n if (this.watching) {\n this.client.resync(this.watching);\n }\n }\n}\n\n/**\n * A short list, kept in step: the values that actually exist.\n *\n * Not a constant in the screen - offering a filter for something an\n * installation has never seen answers nothing. These lists are small and\n * unpaged, so there is one subscription per topic and its id is the topic.\n */\nexport function liveLabels(\n client: LivewireClient,\n topic: string,\n query: JsonValue | null = null,\n): Observable<{ id: string; label: string }[]> {\n const list = new LiveList<LiveRow & { label?: string }>();\n return client.watch<LiveRow & { label?: string }>(topic, topic, query).pipe(\n filter((update) => list.apply(update)),\n // A topic that sends no label is a list of bare values - the value is its\n // own label.\n map(() => list.rows().map((row) => ({ id: row.id, label: row.label ?? row.id }))),\n );\n}\n","import { DataSource } from '@angular/cdk/collections';\nimport { ChangeDetectorRef, inject } from '@angular/core';\nimport { BehaviorSubject, Observable, Subscription } from 'rxjs';\nimport { LiveList } from './live-list';\nimport type { CollectionViewer, ListRange } from '@angular/cdk/collections';\nimport type { LiveRow, UpdateFrame } from '@softwarity/livewire-protocol';\n\n/**\n * How many rows a window holds when the caller does not say.\n *\n * Fixed per screen, never derived from the viewport: a window sized from the\n * rendered range would change with it - 58 rows here, 59 there - and every\n * change is a new question, whose answer republishes, which makes the viewport\n * emit again. That loop freezes the renderer outright. Only the offset moves.\n *\n * The number is a transport budget, not a display choice. Some proxies silently\n * drop a WebSocket frame past ~64 kB and close the connection rather than the\n * frame, leaving the screen empty with no error anywhere. The rule is\n * `rows x bytes-per-row < the ceiling you tested`, and the bytes differ per\n * screen. Measure before raising it: the failure gives no clue at all.\n */\nconst DEFAULT_WINDOW = 100;\n\n/**\n * How far the offset is rounded.\n *\n * Without it every scrolled pixel is a new question. Rounding means the\n * subscription only moves when the view has genuinely left what it was reading.\n */\nconst BLOCK = 50;\n\n/**\n * How close the view may come to an edge before the window is moved.\n *\n * The hysteresis is what keeps this from running away: every publication makes\n * the list longer, the viewport recalculates and emits a range, and recentring\n * on each of those re-subscribes - which republishes, which emits again.\n */\nconst MARGIN = 10;\n\n/**\n * How long a row that just changed stays marked.\n *\n * The `.fresh` styling on the consuming screen should run for exactly this\n * long. Shorter here cuts the animation off mid-way; longer leaves the row\n * plain while it is still marked.\n */\nconst FRESH_MS = 1000;\n\n/**\n * One live window of a long list, as a CDK data source.\n *\n * The screen watches one thing: the rows around what it is showing. Scroll and\n * the window moves; something changes and the server pushes what that window\n * now holds. There is no page cache and no second question in flight - the\n * window *is* the question, which is what lets a paged list be pushed at all.\n *\n * The array handed to the viewport is the full length the server reports, with\n * a hole wherever the window does not reach. That is what makes the scrollbar\n * tell the truth from the first frame: its height is the whole list, not the\n * part being watched.\n */\nexport class LiveWindowDataSource<Row extends LiveRow> extends DataSource<Row | undefined> {\n private readonly published = new BehaviorSubject<(Row | undefined)[]>([]);\n private readonly viewing = new Subscription();\n\n /**\n * The view to repaint, taken from wherever this was built.\n *\n * Zoneless applications schedule nothing when a row arrives from a socket\n * callback: the table is told its data changed but no pass is ever run, and\n * the screen holds stale rows until something unrelated wakes Angular up.\n * `markForCheck()` marks the view dirty *and* notifies the zoneless\n * scheduler, which is exactly the missing half.\n *\n * Injected rather than asked for, because there is nothing to decide: build\n * this in a component field, as one does, and the injection context is right\n * there. Built outside one it throws, and that is the point - a data source\n * with no view to repaint has nobody to answer.\n *\n * (`ApplicationRef.tick()` is the other way and the wrong one: it throws when\n * it lands inside a cycle already in progress.)\n */\n private readonly repaint = inject(ChangeDetectorRef);\n\n private list = new LiveList<Row>();\n private watching: Subscription | null = null;\n\n /** The rows a patch touched a moment ago - see `fresh`. */\n private readonly recent = new Set<string>();\n\n /** Where the current subscription starts. Its length is always `window`. */\n private offset = 0;\n\n private open: ((offset: number, limit: number) => Observable<UpdateFrame<Row>>) | null = null;\n private range = { start: 0, end: 0 };\n\n constructor(\n private readonly onTotal: (total: number) => void = () => undefined,\n /** Told when a patch cannot be applied, so the caller can ask again. */\n private readonly onDrift: () => void = () => undefined,\n /** Rows per window - see `DEFAULT_WINDOW` for how to choose one. */\n private readonly window: number = DEFAULT_WINDOW,\n ) {\n super();\n }\n\n connect(viewer: CollectionViewer): Observable<(Row | undefined)[]> {\n // Kept because a data source is asked for it, but not relied on: inside a\n // `mat-table` the viewer is the table, whose `viewChange` stays silent\n // while the CDK viewport does the scrolling. `track` is what actually\n // reports where the eye is.\n this.viewing.add(viewer.viewChange.subscribe((range) => this.moveTo(range)));\n return this.published;\n }\n\n /**\n * Follows a viewport's rendered range.\n *\n * The screen hands this over explicitly because the `CollectionViewer` a\n * table passes to `connect` does not carry it. Without this the window stays\n * where it started and everything below the first screen is a placeholder\n * that never fills.\n */\n track(ranges: Observable<ListRange>): void {\n this.viewing.add(ranges.subscribe((range) => this.moveTo(range)));\n }\n\n disconnect(): void {\n this.viewing.unsubscribe();\n this.watching?.unsubscribe();\n }\n\n /** How long the list is, as the server last reported it. */\n get length(): number {\n return this.list.total();\n }\n\n /**\n * The index the server pointed at, in the whole list rather than in the page.\n *\n * Whatever it means is the screen's business. It survives the window moving,\n * which is the point: a boundary the reader has scrolled away from is still\n * where it was.\n */\n get pivot(): number | null {\n return this.list.pivot();\n }\n\n /** Every republication, for a caller waiting on one row rather than on the viewport. */\n get changes(): Observable<(Row | undefined)[]> {\n return this.published.asObservable();\n }\n\n /** The row at that index, when the window reaches it. */\n at(index: number): Row | undefined {\n return this.published.value[index];\n }\n\n /**\n * Whether this row arrived, or changed, a moment ago.\n *\n * Only patches mark anything: a snapshot is the answer to \"what does this\n * window hold\", which is what arriving on the screen and what scrolling both\n * ask, and lighting up a whole page every time the window moves says nothing.\n *\n * A patch's `upserted` is exactly the rows whose version changed, so a row\n * that merely shifted because three arrived above it is not marked. The one\n * approximation: for a window part-way down the list, a row pushed into it\n * from just outside is new to this client without being new to the list.\n */\n fresh(id: string | undefined): boolean {\n return id !== undefined && this.recent.has(id);\n }\n\n /**\n * Starts again on a new question.\n *\n * A different question has a different answer, and a row kept from the\n * previous one would be an answer to neither.\n */\n reset(open: (offset: number, limit: number) => Observable<UpdateFrame<Row>>): void {\n this.open = open;\n this.range = { start: 0, end: BLOCK };\n this.offset = -1;\n this.list = new LiveList<Row>();\n this.recent.clear();\n this.published.next([]);\n // What is on the screen has just become the answer to a question nobody is\n // asking any more, and the snapshot lands a moment later. Emptying it\n // without saying so leaves the previous answer on display in between.\n //\n this.repaint.markForCheck();\n this.follow();\n }\n\n /**\n * Makes sure the window covers one row, wherever the viewport currently is.\n *\n * Stepping through a detail panel walks past the edge of what is loaded, and\n * the scroll that follows only reports where it lands - too late for the row\n * the panel is already opening on.\n */\n ensure(index: number): void {\n if (index >= this.offset && index < this.offset + this.window) {\n return;\n }\n // The offset is computed here rather than through `range`: that field is\n // where the viewport is, and writing a made-up position into it means the\n // next real range disagrees, moves the window back, and the two take turns\n // until the renderer gives up.\n //\n // Clamped the way `follow` clamps, and for the same reason: rounding to a\n // block can land beside the very row that was asked for.\n const centred = Math.round((index - this.window / 2) / BLOCK) * BLOCK;\n const wanted = Math.max(0, Math.min(index, Math.max(centred, index - this.window + 1)));\n if (wanted === this.offset) {\n return;\n }\n this.offset = wanted;\n this.subscribe();\n }\n\n private moveTo(range: ListRange): void {\n // An empty range says nothing about where the eye is, and taking it at face\n // value moves the window to the top of the list. A viewport emits one every\n // time it is hidden or resized to nothing - which is what opening a drawer\n // over it does, and why the list behind came back blank.\n if (range.end <= range.start) {\n return;\n }\n this.range = range;\n this.follow();\n }\n\n /** Moves the window if the view has walked out of what it covers. */\n private follow(): void {\n if (!this.open) {\n return;\n }\n const { start, end } = this.range;\n\n // What is left once the rendered rows are covered, and therefore how much\n // of it can be spent as hysteresis on each side. Asking for the full MARGIN\n // regardless leaves a band of rows loaded by nothing: a window barely wider\n // than the viewport cannot both cover it and keep ten rows in hand.\n const spare = Math.max(0, this.window - (end - start));\n const margin = Math.min(MARGIN, Math.floor(spare / 2));\n if (this.offset >= 0 && start >= this.offset + margin && end <= this.offset + this.window - margin) {\n return;\n }\n\n // Centred on the view and rounded to a block - then pulled back until it\n // covers the rendered rows. Covering them is the requirement; the block is\n // only a way of not moving on every scrolled pixel, and rounding to one is\n // exactly how a window settles beside the rows it was meant to hold:\n // rendered [90, 120) rounded to [100, 150), leaving 90 to 99 in no window\n // at all - and, the offset being unchanged, leaving them there.\n const middle = (start + end) / 2;\n const centred = Math.round((middle - this.window / 2) / BLOCK) * BLOCK;\n // Never past the first rendered row, never so far back that the last one\n // falls out. When the viewport renders more rows than the window holds\n // there is no such position: the first row wins, which keeps the hole below\n // the fold rather than above it.\n const wanted = Math.max(0, Math.min(start, Math.max(centred, end - this.window)));\n if (wanted === this.offset) {\n return;\n }\n this.offset = wanted;\n this.subscribe();\n }\n\n private subscribe(): void {\n if (!this.open) {\n return;\n }\n this.watching?.unsubscribe();\n // A fresh list per subscription: the server answers a new window with a\n // snapshot, and rows from the previous one are at different offsets. The\n // marks go with them - they belonged to the window being left.\n this.list = new LiveList<Row>();\n this.recent.clear();\n this.watching = this.open(this.offset, this.window).subscribe({\n next: (update) => {\n if (!this.list.apply(update)) {\n this.onDrift();\n return;\n }\n if (update.type === 'patch') {\n this.mark(update.upserted.map((row) => row.id));\n }\n this.onTotal(this.list.total());\n this.publish();\n },\n error: (error: unknown) => console.error('[livewire] window failed', error),\n });\n }\n\n private mark(ids: string[]): void {\n if (ids.length === 0) {\n return;\n }\n for (const id of ids) {\n this.recent.add(id);\n }\n // One timer per wave, clearing its own ids: a single shared timer would be\n // pushed back by every new arrival, so under a busy feed nothing would ever\n // stop being marked. The repaint is explicit because a zoneless application\n // schedules nothing for a set mutated outside the view.\n setTimeout(() => {\n for (const id of ids) {\n this.recent.delete(id);\n }\n this.repaint.markForCheck();\n }, FRESH_MS);\n }\n\n /**\n * The whole length, holes and all.\n *\n * A new array each time: the viewport compares references to know something\n * changed, and the rows themselves are shared rather than copied.\n */\n private publish(): void {\n const rows = new Array<Row | undefined>(this.list.total());\n const held = this.list.rows();\n for (let index = 0; index < held.length; index += 1) {\n rows[this.offset + index] = held[index];\n }\n this.published.next(rows);\n this.repaint.markForCheck();\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\nimport { LivewireClient } from './livewire.client';\n\n/** How long the indicator acknowledges a click before going back to its state. */\nconst ACKNOWLEDGE_MS = 700;\n\n/**\n * Whether the socket is up, and the one thing to do about it when it is not.\n *\n * That and nothing else - not whether anything is arriving on it, which is a\n * different question and one this would answer badly: a quiet feed at three in\n * the morning is not a fault.\n *\n * Clicking it retries. Down, that opens the socket now instead of waiting out\n * the reconnection delay; up, it asks every open window for a fresh snapshot.\n * It is deliberately not a refresh button on the list: on a live screen a\n * control offering to fetch it again implies that the rest of the time you are\n * looking at something stale.\n *\n * Colours come from CSS custom properties, so a host theme dresses it without\n * this package knowing anything about the theme:\n *\n * ```css\n * lw-live-indicator { --lw-live: #1b7f3b; --lw-down: #b26a00; }\n * ```\n */\n@Component({\n selector: 'lw-live-indicator',\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n template: `\n <button type=\"button\" class=\"lw-indicator\" [class.lw-down]=\"!live()\" [attr.aria-label]=\"label()\" [title]=\"label()\" (click)=\"retry()\">\n <span class=\"lw-dot\" [class.lw-beat]=\"live() && !asked()\" [class.lw-turn]=\"asked()\"></span>\n </button>\n `,\n styles: [\n `\n :host {\n display: inline-flex;\n // Centred on its own line and beside whatever it sits next to. A dot is\n // small enough that a row aligning its children to the top leaves it\n // stranded above the text it belongs to.\n align-items: center;\n align-self: center;\n vertical-align: middle;\n }\n .lw-indicator {\n display: inline-flex;\n align-items: center;\n padding: 0;\n border: none;\n background: none;\n cursor: pointer;\n color: var(--lw-live, currentColor);\n }\n .lw-indicator.lw-down {\n color: var(--lw-down, #b26a00);\n }\n .lw-indicator:focus-visible {\n outline: 2px solid currentColor;\n outline-offset: 2px;\n border-radius: 50%;\n }\n .lw-dot {\n display: block;\n width: 0.6rem;\n height: 0.6rem;\n border-radius: 50%;\n background: currentColor;\n }\n .lw-dot.lw-beat {\n animation: lw-beat 2.4s ease-in-out infinite;\n }\n .lw-dot.lw-turn {\n animation: lw-turn 0.5s ease-out;\n }\n // A breath, not a pulse. The dot says the socket is up, which is the\n // quiet state of a working screen: something that jumps every second\n // reads as a warning and pulls the eye away from the list.\n @keyframes lw-beat {\n 0%,\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n 50% {\n opacity: 0.45;\n transform: scale(0.88);\n }\n }\n @keyframes lw-turn {\n from {\n transform: scale(1.6);\n opacity: 0.4;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .lw-dot.lw-beat,\n .lw-dot.lw-turn {\n animation: none;\n }\n }\n `,\n ],\n})\nexport class LiveIndicatorComponent {\n private readonly client = inject(LivewireClient);\n\n readonly live = this.client.live;\n\n /**\n * Set for a moment after a click, and read for nothing but the animation.\n *\n * A resync on a list that has not moved changes no pixel, so without this the\n * gesture looks like it did nothing at all.\n */\n readonly asked = signal(false);\n\n readonly label = computed(() => (this.live() ? LIVE : DOWN));\n\n retry(): void {\n this.client.retry();\n this.asked.set(true);\n setTimeout(() => this.asked.set(false), ACKNOWLEDGE_MS);\n }\n}\n\nconst LIVE = 'Live - click to ask for the data again';\nconst DOWN = 'Disconnected - reconnecting. Click to try now';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;MAiCa,eAAe,GAAG,IAAI,cAAc,CAAiB,iBAAiB;AAEnF,MAAM,oBAAoB,GAAG,IAAI;AAEjC;;;;;;AAMG;MAEU,cAAc,CAAA;AA8BmB,IAAA,MAAA;AACK,IAAA,QAAA;;AA7BxC,IAAA,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC;IAErB,MAAM,GAA0B,IAAI;;IAGpC,QAAQ,GAAyC,IAAI;AAE7D;;;;;;;;;AASG;AACc,IAAA,QAAQ,GAAG,IAAI,OAAO,EAAqB;AAE5D;;;;;AAKG;AACc,IAAA,IAAI,GAAG,IAAI,GAAG,EAAmB;IAElD,WAAA,CAC4C,MAAsB,EACjB,QAAyB,EAAA;QAD9B,IAAA,CAAA,MAAM,GAAN,MAAM;QACD,IAAA,CAAA,QAAQ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AAA,EAAA,IAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EA3EvB;;;;AAIT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,yqCAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAuEU,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBA/ElC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,mBAAmB,mBACZ,uBAAuB,CAAC,MAAM,EAAA,UAAA,EACnC,IAAI,EAAA,QAAA,EACN;;;;AAIT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,yqCAAA,CAAA,EAAA;;AA6FH,MAAM,IAAI,GAAG,wCAAwC;AACrD,MAAM,IAAI,GAAG,+CAA+C;;AChI5D;;AAEG;;;;"}
1
+ {"version":3,"file":"softwarity-livewire.mjs","sources":["../../src/lib/livewire.client.ts","../../src/lib/provide-livewire.ts","../../src/lib/live-list.ts","../../src/lib/live-topic.ts","../../src/lib/live-window.datasource.ts","../../src/lib/live-indicator.component.ts","../../src/softwarity-livewire.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { Inject, Injectable, InjectionToken, Optional, signal } from '@angular/core';\nimport { Observable, Subject } from 'rxjs';\nimport { filter } from 'rxjs/operators';\nimport { SUBSCRIBE_EVENT, UNSUBSCRIBE_EVENT, UPDATE_EVENT } from '@softwarity/livewire-protocol';\nimport type { Envelope, JsonValue, LiveRow, UpdateFrame } from '@softwarity/livewire-protocol';\n\nexport interface LivewireConfig {\n /** Where the socket answers. Root-relative, so a gateway can route it. */\n path: string;\n\n /** How long a dropped socket waits before trying again. */\n reconnectMs?: number;\n\n /**\n * How to open the connection.\n *\n * Absent, a real `WebSocket` against `path` on the page's own host. Supplied,\n * anything of that shape - which is how the in-memory server is dropped in\n * for a demo or a test with no backend at all.\n */\n connect?: () => LivewireSocket;\n}\n\n/** The little of a `WebSocket` this client uses. */\nexport interface LivewireSocket {\n send(frame: string): void;\n close(code?: number, reason?: string): void;\n onmessage?: ((frame: string) => void) | null;\n onclose?: ((code: number, reason: string) => void) | null;\n onopen?: (() => void) | null;\n}\n\nexport const LIVEWIRE_CONFIG = new InjectionToken<LivewireConfig>('LIVEWIRE_CONFIG');\n\nconst DEFAULT_RECONNECT_MS = 3000;\n\n/**\n * The one socket, shared by every live list.\n *\n * One connection per tab, not one per screen: one handshake, one place where\n * authorisation happens, one reconnection to get right. Subscriptions are told\n * apart by an id the caller picks, so several lists can be open at once.\n */\n@Injectable({ providedIn: 'root' })\nexport class LivewireClient {\n /** Whether the socket is currently carrying anything. */\n readonly live = signal(false);\n\n private socket: LivewireSocket | null = null;\n\n /** The wait before the next attempt, held so `retry` can cut it short. */\n private retrying: ReturnType<typeof setTimeout> | null = null;\n\n /**\n * Everything the socket delivers, for the watchers to filter.\n *\n * A plain Subject between the socket and the screens, and that indirection is\n * the whole point. `rxjs/webSocket` ties the connection to its subscriber\n * count: it closes when the last one leaves and reopens on the next, so a\n * list scrolling out of view took the connection down with it and the next\n * one opened another - nine sockets for one list, each losing the snapshot\n * sent to the one before.\n */\n private readonly incoming = new Subject<Envelope<unknown>>();\n\n /**\n * What to re-send when a socket comes back.\n *\n * A reconnected socket knows nothing about what the screens were watching a\n * second ago, and the screens have no reason to find out that it dropped.\n */\n private readonly open = new Map<string, unknown>();\n\n constructor(\n @Inject(LIVEWIRE_CONFIG) private readonly config: LivewireConfig,\n @Optional() @Inject(DOCUMENT) private readonly document: Document | null,\n ) {}\n\n /**\n * Watches one topic, and keeps watching it across reconnections.\n *\n * The returned stream starts with a snapshot and continues with patches -\n * applying them is `LiveList`'s job. Unsubscribing closes the subscription\n * server-side; the socket itself stays up for the other lists.\n */\n watch<Row extends LiveRow>(id: string, topic: string, query: JsonValue | null): Observable<UpdateFrame<Row>> {\n return new Observable<UpdateFrame<Row>>((subscriber) => {\n this.connect();\n const asked = { id, topic, query: query ?? undefined };\n this.open.set(id, asked);\n this.send(SUBSCRIBE_EVENT, asked);\n\n const frames = this.incoming\n .pipe(\n filter((envelope): envelope is Envelope<UpdateFrame<Row>> => {\n return envelope.event === UPDATE_EVENT && (envelope.data as UpdateFrame<Row>)?.id === id;\n }),\n )\n .subscribe((envelope) => subscriber.next(envelope.data));\n\n return () => {\n frames.unsubscribe();\n // The socket stays up for the other lists; only this window closes.\n this.open.delete(id);\n this.send(UNSUBSCRIBE_EVENT, { id });\n };\n });\n }\n\n /**\n * Asks for a window again, and gets a snapshot back.\n *\n * A gap in the sequence means the two sides disagree about what was sent.\n * Asking again is cheap; carrying on would show a list nobody can trust.\n */\n resync(id: string): void {\n const asked = this.open.get(id);\n if (asked) {\n this.send(SUBSCRIBE_EVENT, asked);\n }\n }\n\n /**\n * What a reader can do about it when something looks off.\n *\n * Two situations, one gesture, because from their side they are the same\n * complaint - the screen may not be showing what is true. Down: the\n * reconnection delay is skipped and the socket is opened now. Up: every open\n * window is asked for again, and each answers with a snapshot.\n */\n retry(): void {\n if (this.socket) {\n for (const asked of this.open.values()) {\n this.send(SUBSCRIBE_EVENT, asked);\n }\n return;\n }\n if (this.retrying !== null) {\n clearTimeout(this.retrying);\n this.retrying = null;\n }\n this.connect();\n }\n\n /**\n * Opens the one socket, once, and keeps it open.\n *\n * A plain `WebSocket` rather than `rxjs/webSocket`, deliberately - see the\n * note on `incoming`. What this needs is one socket for as long as the tab\n * lives, which is easier to write outright than to talk an operator chain\n * into.\n */\n private connect(): void {\n if (this.socket) {\n return;\n }\n const socket = this.config.connect ? this.config.connect() : this.openWebSocket();\n this.socket = socket;\n\n socket.onopen = (): void => {\n this.live.set(true);\n // Whatever the screens were watching, asked for again. A reconnected\n // socket knows nothing about them, and on the first open this is what\n // sends the subscriptions queued before it came up.\n for (const asked of this.open.values()) {\n this.send(SUBSCRIBE_EVENT, asked);\n }\n };\n\n socket.onmessage = (frame: string): void => {\n try {\n this.incoming.next(JSON.parse(frame) as Envelope<unknown>);\n } catch (error) {\n console.error('[livewire] unreadable frame', error);\n }\n };\n\n // A dropped socket is the normal case, not a fault: a gateway restart, a\n // laptop that slept. Reconnecting is this client's job so no screen has to\n // know it happened.\n socket.onclose = (): void => {\n this.live.set(false);\n this.socket = null;\n this.retrying = setTimeout(() => {\n this.retrying = null;\n this.connect();\n }, this.config.reconnectMs ?? DEFAULT_RECONNECT_MS);\n };\n }\n\n private openWebSocket(): LivewireSocket {\n const location = this.document?.location;\n const scheme = location?.protocol === 'https:' ? 'wss:' : 'ws:';\n const native = new WebSocket(`${scheme}//${location?.host ?? ''}${this.config.path}`);\n // Adapted rather than used directly: a `MessageEvent` is the browser's\n // shape, and everything else here - the in-memory server, the tests -\n // speaks in frames.\n const socket: LivewireSocket = {\n send: (frame) => native.send(frame),\n close: (code, reason) => native.close(code, reason),\n };\n native.onopen = () => socket.onopen?.();\n native.onmessage = (event: MessageEvent) => socket.onmessage?.(String(event.data));\n native.onclose = (event: CloseEvent) => socket.onclose?.(event.code, event.reason);\n native.onerror = () => console.error('[livewire] socket error');\n return socket;\n }\n\n private send(event: string, data: unknown): void {\n // Nothing is sent before the socket is up, and this is not an optimisation.\n // A `WebSocket` still connecting *throws* on `send` rather than ignoring\n // it, and that exception comes straight back out of `watch`'s subscribe\n // function - killing the very subscription being opened. On a cold load\n // that is every list a screen asks for before the handshake completes, and\n // they never come back, because the error tears the observable down.\n //\n // Nothing is lost by waiting: `onopen` sends every open subscription, which\n // is the same set and a shorter path. An `unsubscribe` that does not go out\n // is not lost either - the id is already gone from `open`, so it is not\n // among what gets re-sent.\n if (!this.live()) {\n return;\n }\n this.socket?.send(JSON.stringify({ event, data }));\n }\n}\n","import { LIVEWIRE_CONFIG } from './livewire.client';\nimport type { EnvironmentProviders, Provider } from '@angular/core';\nimport type { LivewireConfig } from './livewire.client';\n\n/**\n * Wires the one socket into an application.\n *\n * ```ts\n * providers: [provideLivewire({ path: '/my-service/ws' })]\n * ```\n *\n * For a demo or a test with no backend, hand it a connection instead:\n *\n * ```ts\n * const server = new MockServer().register('rows', { windowFor: () => window });\n * provideLivewire({ path: '', connect: () => server.connect() });\n * ```\n */\nexport function provideLivewire(config: LivewireConfig): (Provider | EnvironmentProviders)[] {\n return [{ provide: LIVEWIRE_CONFIG, useValue: config }];\n}\n","import { signal } from '@angular/core';\nimport type { Signal } from '@angular/core';\nimport type { LiveRow, PatchFrame, UpdateFrame } from '@softwarity/livewire-protocol';\n\n/**\n * A list kept in step with what the server pushes.\n *\n * Snapshot then patches, applied and nothing more: what belongs in the list and\n * in what order is decided by the source's query, and a client that recomputed\n * either from its own idea of the filters would be a second implementation free\n * to disagree.\n */\nexport class LiveList<Row extends LiveRow> {\n private readonly held = signal<Row[]>([]);\n private readonly length = signal(0);\n private readonly marked = signal<number | null>(null);\n\n /** The list as it stands. Ordered by the server, never re-sorted here. */\n readonly rows: Signal<Row[]> = this.held.asReadonly();\n\n /** What the list is a page of, for a paged topic. Its own length otherwise. */\n readonly total: Signal<number> = this.length.asReadonly();\n\n /**\n * An index in the whole list the server pointed at, if it pointed at one.\n *\n * Meaningless here on purpose: the library carries the number and the screen\n * decides what it means - a boundary, a cursor, the first unread row.\n */\n readonly pivot: Signal<number | null> = this.marked.asReadonly();\n\n private sequence = 0;\n\n /**\n * Applies one frame. Answers false when the two sides have drifted, which is\n * the caller's cue to ask for the window again.\n */\n apply(update: UpdateFrame<Row>): boolean {\n if (update.type === 'error') {\n console.error(`Livewire subscription '${update.id}' refused: ${update.reason}`);\n return true;\n }\n if (update.type === 'snapshot') {\n this.sequence = update.sequence;\n this.held.set(update.rows);\n this.length.set(update.total ?? update.rows.length);\n this.marked.set(update.pivot ?? null);\n return true;\n }\n // On one socket nothing is lost and nothing overtakes, so a gap means the\n // two sides disagree about what was sent. Asking again is cheap; carrying\n // on would show a list nobody can reproduce.\n if (update.sequence !== this.sequence + 1) {\n return false;\n }\n const rebuilt = this.rebuild(update);\n if (!rebuilt) {\n return false;\n }\n this.sequence = update.sequence;\n this.held.set(rebuilt);\n this.length.set(update.total ?? rebuilt.length);\n this.marked.set(update.pivot ?? null);\n return true;\n }\n\n /** Forgets what it holds - a fresh subscription answers with a snapshot. */\n reset(): void {\n this.sequence = 0;\n this.held.set([]);\n this.length.set(0);\n this.marked.set(null);\n }\n\n /** Null when the patch names a row neither side holds - the caller resyncs. */\n private rebuild(update: PatchFrame<Row>): Row[] | null {\n const byId = new Map(this.held().map((row) => [row.id, row]));\n for (const id of update.removed) {\n byId.delete(id);\n }\n for (const row of update.upserted) {\n byId.set(row.id, row);\n }\n const next: Row[] = [];\n for (const id of update.order) {\n const row = byId.get(id);\n if (!row) {\n return null;\n }\n next.push(row);\n }\n return next;\n }\n}\n","import { Observable } from 'rxjs';\nimport { filter, map } from 'rxjs/operators';\nimport { LiveList } from './live-list';\nimport { LivewireClient } from './livewire.client';\nimport type { JsonValue, LiveRow, UpdateFrame } from '@softwarity/livewire-protocol';\n\n/**\n * One screen's live window on one topic.\n *\n * The bookkeeping every feature service would otherwise repeat: the counter,\n * the id it last opened, and the resync that has to name it. Small, and worth\n * having once - the id rule below is the kind of thing that is right in one\n * copy and wrong in the next.\n */\nexport class LiveTopic<Row extends LiveRow> {\n /** Counts subscriptions, so no two ever share an id. */\n private opened = 0;\n\n /** The id of the current window, for `resync`. */\n private watching: string | null = null;\n\n constructor(\n private readonly client: LivewireClient,\n private readonly topic: string,\n ) {}\n\n /**\n * The rows the screen is showing, and again whenever they change.\n *\n * One subscription for the screen, not one per page: the window is part of\n * the question, which is what makes a paged list pushable at all. The server\n * does not send an insertion for the client to place - it sends what rows\n * `[offset, offset+limit)` now hold, so three rows arriving at the top shift\n * no index. The window simply holds something else than it did.\n */\n window(query: object, offset: number, limit: number): Observable<UpdateFrame<Row>> {\n // Unique per subscription. Reusing an id means a patch still in flight from\n // the window before lands on the new one, whose sequence starts over - it\n // reads as a gap, resyncs, and nothing publishes in the meantime.\n this.watching = `${this.topic}:${(this.opened += 1)}`;\n return this.client.watch<Row>(this.watching, this.topic, { ...query, offset, limit } as JsonValue);\n }\n\n /**\n * The same, for a list the server sends whole.\n *\n * A short list is bounded by its filters rather than by a scroll position, so\n * there is no offset to send. Everything around it is unchanged: one live\n * subscription at a time, a fresh id each time, and a resync that names it.\n */\n open(query: JsonValue | null): Observable<UpdateFrame<Row>> {\n this.watching = `${this.topic}:${(this.opened += 1)}`;\n return this.client.watch<Row>(this.watching, this.topic, query);\n }\n\n /** Asks the server for the window again - answered with a snapshot. */\n resync(): void {\n if (this.watching) {\n this.client.resync(this.watching);\n }\n }\n}\n\n/**\n * A short list, kept in step: the values that actually exist.\n *\n * Not a constant in the screen - offering a filter for something an\n * installation has never seen answers nothing. These lists are small and\n * unpaged, so there is one subscription per topic and its id is the topic.\n */\nexport function liveLabels(\n client: LivewireClient,\n topic: string,\n query: JsonValue | null = null,\n): Observable<{ id: string; label: string }[]> {\n const list = new LiveList<LiveRow & { label?: string }>();\n return client.watch<LiveRow & { label?: string }>(topic, topic, query).pipe(\n filter((update) => list.apply(update)),\n // A topic that sends no label is a list of bare values - the value is its\n // own label.\n map(() => list.rows().map((row) => ({ id: row.id, label: row.label ?? row.id }))),\n );\n}\n","import { DataSource } from '@angular/cdk/collections';\nimport { ChangeDetectorRef, inject } from '@angular/core';\nimport { BehaviorSubject, Observable, Subscription } from 'rxjs';\nimport { LiveList } from './live-list';\nimport type { CollectionViewer, ListRange } from '@angular/cdk/collections';\nimport type { LiveRow, UpdateFrame } from '@softwarity/livewire-protocol';\n\n/**\n * How many rows a window holds when the caller does not say.\n *\n * Fixed per screen, never derived from the viewport: a window sized from the\n * rendered range would change with it - 58 rows here, 59 there - and every\n * change is a new question, whose answer republishes, which makes the viewport\n * emit again. That loop freezes the renderer outright. Only the offset moves.\n *\n * The number is a transport budget, not a display choice. Some proxies silently\n * drop a WebSocket frame past ~64 kB and close the connection rather than the\n * frame, leaving the screen empty with no error anywhere. The rule is\n * `rows x bytes-per-row < the ceiling you tested`, and the bytes differ per\n * screen. Measure before raising it: the failure gives no clue at all.\n */\nconst DEFAULT_WINDOW = 100;\n\n/**\n * How far the offset is rounded.\n *\n * Without it every scrolled pixel is a new question. Rounding means the\n * subscription only moves when the view has genuinely left what it was reading.\n */\nconst BLOCK = 50;\n\n/**\n * How close the view may come to an edge before the window is moved.\n *\n * The hysteresis is what keeps this from running away: every publication makes\n * the list longer, the viewport recalculates and emits a range, and recentring\n * on each of those re-subscribes - which republishes, which emits again.\n */\nconst MARGIN = 10;\n\n/**\n * How long a row that just changed stays marked.\n *\n * The `.fresh` styling on the consuming screen should run for exactly this\n * long. Shorter here cuts the animation off mid-way; longer leaves the row\n * plain while it is still marked.\n */\nconst FRESH_MS = 1000;\n\n/**\n * One live window of a long list, as a CDK data source.\n *\n * The screen watches one thing: the rows around what it is showing. Scroll and\n * the window moves; something changes and the server pushes what that window\n * now holds. There is no page cache and no second question in flight - the\n * window *is* the question, which is what lets a paged list be pushed at all.\n *\n * The array handed to the viewport is the full length the server reports, with\n * a hole wherever the window does not reach. That is what makes the scrollbar\n * tell the truth from the first frame: its height is the whole list, not the\n * part being watched.\n */\nexport class LiveWindowDataSource<Row extends LiveRow> extends DataSource<Row | undefined> {\n private readonly published = new BehaviorSubject<(Row | undefined)[]>([]);\n private readonly viewing = new Subscription();\n\n /**\n * The view to repaint, taken from wherever this was built.\n *\n * Zoneless applications schedule nothing when a row arrives from a socket\n * callback: the table is told its data changed but no pass is ever run, and\n * the screen holds stale rows until something unrelated wakes Angular up.\n * `markForCheck()` marks the view dirty *and* notifies the zoneless\n * scheduler, which is exactly the missing half.\n *\n * Injected rather than asked for, because there is nothing to decide: build\n * this in a component field, as one does, and the injection context is right\n * there. Built outside one it throws, and that is the point - a data source\n * with no view to repaint has nobody to answer.\n *\n * (`ApplicationRef.tick()` is the other way and the wrong one: it throws when\n * it lands inside a cycle already in progress.)\n */\n private readonly repaint = inject(ChangeDetectorRef);\n\n private list = new LiveList<Row>();\n private watching: Subscription | null = null;\n\n /** The rows a patch touched a moment ago - see `fresh`. */\n private readonly recent = new Set<string>();\n\n /** Where the current subscription starts. Its length is always `window`. */\n private offset = 0;\n\n private open: ((offset: number, limit: number) => Observable<UpdateFrame<Row>>) | null = null;\n private range = { start: 0, end: 0 };\n\n constructor(\n private readonly onTotal: (total: number) => void = () => undefined,\n /** Told when a patch cannot be applied, so the caller can ask again. */\n private readonly onDrift: () => void = () => undefined,\n /** Rows per window - see `DEFAULT_WINDOW` for how to choose one. */\n private readonly window: number = DEFAULT_WINDOW,\n ) {\n super();\n }\n\n connect(viewer: CollectionViewer): Observable<(Row | undefined)[]> {\n // Kept because a data source is asked for it, but not relied on: inside a\n // `mat-table` the viewer is the table, whose `viewChange` stays silent\n // while the CDK viewport does the scrolling. `track` is what actually\n // reports where the eye is.\n this.viewing.add(viewer.viewChange.subscribe((range) => this.moveTo(range)));\n return this.published;\n }\n\n /**\n * Follows a viewport's rendered range.\n *\n * The screen hands this over explicitly because the `CollectionViewer` a\n * table passes to `connect` does not carry it. Without this the window stays\n * where it started and everything below the first screen is a placeholder\n * that never fills.\n */\n track(ranges: Observable<ListRange>): void {\n this.viewing.add(ranges.subscribe((range) => this.moveTo(range)));\n }\n\n disconnect(): void {\n this.viewing.unsubscribe();\n this.watching?.unsubscribe();\n }\n\n /** How long the list is, as the server last reported it. */\n get length(): number {\n return this.list.total();\n }\n\n /**\n * The index the server pointed at, in the whole list rather than in the page.\n *\n * Whatever it means is the screen's business. It survives the window moving,\n * which is the point: a boundary the reader has scrolled away from is still\n * where it was.\n */\n get pivot(): number | null {\n return this.list.pivot();\n }\n\n /** Every republication, for a caller waiting on one row rather than on the viewport. */\n get changes(): Observable<(Row | undefined)[]> {\n return this.published.asObservable();\n }\n\n /** The row at that index, when the window reaches it. */\n at(index: number): Row | undefined {\n return this.published.value[index];\n }\n\n /**\n * Whether this row arrived, or changed, a moment ago.\n *\n * Only patches mark anything: a snapshot is the answer to \"what does this\n * window hold\", which is what arriving on the screen and what scrolling both\n * ask, and lighting up a whole page every time the window moves says nothing.\n *\n * A patch's `upserted` is exactly the rows whose version changed, so a row\n * that merely shifted because three arrived above it is not marked. The one\n * approximation: for a window part-way down the list, a row pushed into it\n * from just outside is new to this client without being new to the list.\n */\n fresh(id: string | undefined): boolean {\n return id !== undefined && this.recent.has(id);\n }\n\n /**\n * Starts again on a new question.\n *\n * A different question has a different answer, and a row kept from the\n * previous one would be an answer to neither.\n */\n reset(open: (offset: number, limit: number) => Observable<UpdateFrame<Row>>): void {\n this.open = open;\n this.range = { start: 0, end: BLOCK };\n this.offset = -1;\n this.list = new LiveList<Row>();\n this.recent.clear();\n this.published.next([]);\n // What is on the screen has just become the answer to a question nobody is\n // asking any more, and the snapshot lands a moment later. Emptying it\n // without saying so leaves the previous answer on display in between.\n //\n this.repaint.markForCheck();\n this.follow();\n }\n\n /**\n * Makes sure the window covers one row, wherever the viewport currently is.\n *\n * Stepping through a detail panel walks past the edge of what is loaded, and\n * the scroll that follows only reports where it lands - too late for the row\n * the panel is already opening on.\n */\n ensure(index: number): void {\n if (index >= this.offset && index < this.offset + this.window) {\n return;\n }\n // The offset is computed here rather than through `range`: that field is\n // where the viewport is, and writing a made-up position into it means the\n // next real range disagrees, moves the window back, and the two take turns\n // until the renderer gives up.\n //\n // Clamped the way `follow` clamps, and for the same reason: rounding to a\n // block can land beside the very row that was asked for.\n const centred = Math.round((index - this.window / 2) / BLOCK) * BLOCK;\n const wanted = Math.max(0, Math.min(index, Math.max(centred, index - this.window + 1)));\n if (wanted === this.offset) {\n return;\n }\n this.offset = wanted;\n this.subscribe();\n }\n\n private moveTo(range: ListRange): void {\n // An empty range says nothing about where the eye is, and taking it at face\n // value moves the window to the top of the list. A viewport emits one every\n // time it is hidden or resized to nothing - which is what opening a drawer\n // over it does, and why the list behind came back blank.\n if (range.end <= range.start) {\n return;\n }\n this.range = range;\n this.follow();\n }\n\n /** Moves the window if the view has walked out of what it covers. */\n private follow(): void {\n if (!this.open) {\n return;\n }\n const { start, end } = this.range;\n\n // What is left once the rendered rows are covered, and therefore how much\n // of it can be spent as hysteresis on each side. Asking for the full MARGIN\n // regardless leaves a band of rows loaded by nothing: a window barely wider\n // than the viewport cannot both cover it and keep ten rows in hand.\n const spare = Math.max(0, this.window - (end - start));\n const margin = Math.min(MARGIN, Math.floor(spare / 2));\n if (this.offset >= 0 && start >= this.offset + margin && end <= this.offset + this.window - margin) {\n return;\n }\n\n // Centred on the view and rounded to a block - then pulled back until it\n // covers the rendered rows. Covering them is the requirement; the block is\n // only a way of not moving on every scrolled pixel, and rounding to one is\n // exactly how a window settles beside the rows it was meant to hold:\n // rendered [90, 120) rounded to [100, 150), leaving 90 to 99 in no window\n // at all - and, the offset being unchanged, leaving them there.\n const middle = (start + end) / 2;\n const centred = Math.round((middle - this.window / 2) / BLOCK) * BLOCK;\n // Never past the first rendered row, never so far back that the last one\n // falls out. When the viewport renders more rows than the window holds\n // there is no such position: the first row wins, which keeps the hole below\n // the fold rather than above it.\n const wanted = Math.max(0, Math.min(start, Math.max(centred, end - this.window)));\n if (wanted === this.offset) {\n return;\n }\n this.offset = wanted;\n this.subscribe();\n }\n\n private subscribe(): void {\n if (!this.open) {\n return;\n }\n this.watching?.unsubscribe();\n // A fresh list per subscription: the server answers a new window with a\n // snapshot, and rows from the previous one are at different offsets. The\n // marks go with them - they belonged to the window being left.\n this.list = new LiveList<Row>();\n this.recent.clear();\n this.watching = this.open(this.offset, this.window).subscribe({\n next: (update) => {\n if (!this.list.apply(update)) {\n this.onDrift();\n return;\n }\n if (update.type === 'patch') {\n this.mark(update.upserted.map((row) => row.id));\n }\n this.onTotal(this.list.total());\n this.publish();\n },\n error: (error: unknown) => console.error('[livewire] window failed', error),\n });\n }\n\n private mark(ids: string[]): void {\n if (ids.length === 0) {\n return;\n }\n for (const id of ids) {\n this.recent.add(id);\n }\n // One timer per wave, clearing its own ids: a single shared timer would be\n // pushed back by every new arrival, so under a busy feed nothing would ever\n // stop being marked. The repaint is explicit because a zoneless application\n // schedules nothing for a set mutated outside the view.\n setTimeout(() => {\n for (const id of ids) {\n this.recent.delete(id);\n }\n this.repaint.markForCheck();\n }, FRESH_MS);\n }\n\n /**\n * The whole length, holes and all.\n *\n * A new array each time: the viewport compares references to know something\n * changed, and the rows themselves are shared rather than copied.\n */\n private publish(): void {\n const rows = new Array<Row | undefined>(this.list.total());\n const held = this.list.rows();\n for (let index = 0; index < held.length; index += 1) {\n rows[this.offset + index] = held[index];\n }\n this.published.next(rows);\n this.repaint.markForCheck();\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\nimport { LivewireClient } from './livewire.client';\n\n/** How long the indicator acknowledges a click before going back to its state. */\nconst ACKNOWLEDGE_MS = 700;\n\n/**\n * Whether the socket is up, and the one thing to do about it when it is not.\n *\n * That and nothing else - not whether anything is arriving on it, which is a\n * different question and one this would answer badly: a quiet feed at three in\n * the morning is not a fault.\n *\n * Clicking it retries. Down, that opens the socket now instead of waiting out\n * the reconnection delay; up, it asks every open window for a fresh snapshot.\n * It is deliberately not a refresh button on the list: on a live screen a\n * control offering to fetch it again implies that the rest of the time you are\n * looking at something stale.\n *\n * Colours come from CSS custom properties, so a host theme dresses it without\n * this package knowing anything about the theme:\n *\n * ```css\n * lw-live-indicator { --lw-live: #1b7f3b; --lw-down: #b26a00; }\n * ```\n */\n@Component({\n selector: 'lw-live-indicator',\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n template: `\n <button type=\"button\" class=\"lw-indicator\" [class.lw-down]=\"!live()\" [attr.aria-label]=\"label()\" [title]=\"label()\" (click)=\"retry()\">\n <span class=\"lw-dot\" [class.lw-beat]=\"live() && !asked()\" [class.lw-turn]=\"asked()\"></span>\n </button>\n `,\n styles: [\n `\n :host {\n display: inline-flex;\n /* Centred on its own line and beside whatever it sits next to. A dot is\n small enough that a row aligning its children to the top leaves it\n stranded above the text it belongs to. */\n align-items: center;\n align-self: center;\n vertical-align: middle;\n }\n .lw-indicator {\n display: inline-flex;\n align-items: center;\n padding: 0;\n border: none;\n background: none;\n cursor: pointer;\n color: var(--lw-live, currentColor);\n }\n .lw-indicator.lw-down {\n color: var(--lw-down, #b26a00);\n }\n .lw-indicator:focus-visible {\n outline: 2px solid currentColor;\n outline-offset: 2px;\n border-radius: 50%;\n }\n /* A lit dot, not a printed one: the disc, and a soft halo of the same\n colour behind it. The halo is what makes it read as a state rather\n than as punctuation. */\n .lw-dot {\n position: relative;\n display: block;\n width: 0.55rem;\n height: 0.55rem;\n border-radius: 50%;\n background: currentColor;\n box-shadow: 0 0 0 0.18rem color-mix(in srgb, currentColor 20%, transparent);\n }\n /* The flare. A ring that leaves the dot and fades, rather than the dot\n itself moving: the state is steady, and what says \"live\" is around it. */\n .lw-dot::after {\n content: '';\n position: absolute;\n inset: 0;\n border-radius: 50%;\n background: currentColor;\n opacity: 0;\n }\n .lw-dot.lw-beat::after {\n animation: lw-flare 2.4s cubic-bezier(0, 0, 0.2, 1) infinite;\n }\n .lw-dot.lw-turn {\n animation: lw-turn 0.5s ease-out;\n }\n @keyframes lw-flare {\n 0% {\n opacity: 0.5;\n transform: scale(1);\n }\n 70%,\n 100% {\n opacity: 0;\n transform: scale(2.8);\n }\n }\n /* One turn on click, so the gesture is acknowledged: a resync on a list\n that has not moved changes no pixel otherwise. */\n @keyframes lw-turn {\n from {\n transform: scale(1.7);\n opacity: 0.4;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n /* The halo stays - it is not motion, and it is what makes the state\n legible at a glance. */\n .lw-dot.lw-beat::after,\n .lw-dot.lw-turn {\n animation: none;\n }\n }\n `,\n ],\n})\nexport class LiveIndicatorComponent {\n private readonly client = inject(LivewireClient);\n\n readonly live = this.client.live;\n\n /**\n * Set for a moment after a click, and read for nothing but the animation.\n *\n * A resync on a list that has not moved changes no pixel, so without this the\n * gesture looks like it did nothing at all.\n */\n readonly asked = signal(false);\n\n readonly label = computed(() => (this.live() ? LIVE : DOWN));\n\n retry(): void {\n this.client.retry();\n this.asked.set(true);\n setTimeout(() => this.asked.set(false), ACKNOWLEDGE_MS);\n }\n}\n\nconst LIVE = 'Live data - click to ask for it again';\nconst DOWN = 'No live data - reconnecting. Click to try now';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;MAiCa,eAAe,GAAG,IAAI,cAAc,CAAiB,iBAAiB;AAEnF,MAAM,oBAAoB,GAAG,IAAI;AAEjC;;;;;;AAMG;MAEU,cAAc,CAAA;AA8BmB,IAAA,MAAA;AACK,IAAA,QAAA;;AA7BxC,IAAA,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC;IAErB,MAAM,GAA0B,IAAI;;IAGpC,QAAQ,GAAyC,IAAI;AAE7D;;;;;;;;;AASG;AACc,IAAA,QAAQ,GAAG,IAAI,OAAO,EAAqB;AAE5D;;;;;AAKG;AACc,IAAA,IAAI,GAAG,IAAI,GAAG,EAAmB;IAElD,WAAA,CAC4C,MAAsB,EACjB,QAAyB,EAAA;QAD9B,IAAA,CAAA,MAAM,GAAN,MAAM;QACD,IAAA,CAAA,QAAQ,GAAR,QAAQ;IACtD;AAEH;;;;;;AAMG;AACH,IAAA,KAAK,CAAsB,EAAU,EAAE,KAAa,EAAE,KAAuB,EAAA;AAC3E,QAAA,OAAO,IAAI,UAAU,CAAmB,CAAC,UAAU,KAAI;YACrD,IAAI,CAAC,OAAO,EAAE;AACd,YAAA,MAAM,KAAK,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE;YACtD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC;AACxB,YAAA,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC;AAEjC,YAAA,MAAM,MAAM,GAAG,IAAI,CAAC;AACjB,iBAAA,IAAI,CACH,MAAM,CAAC,CAAC,QAAQ,KAA4C;AAC1D,gBAAA,OAAO,QAAQ,CAAC,KAAK,KAAK,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AA6GH,MAAM,IAAI,GAAG,uCAAuC;AACpD,MAAM,IAAI,GAAG,+CAA+C;;AChJ5D;;AAEG;;;;"}
@@ -29,7 +29,7 @@ export declare class LiveIndicatorComponent {
29
29
  * gesture looks like it did nothing at all.
30
30
  */
31
31
  readonly asked: import("@angular/core").WritableSignal<boolean>;
32
- readonly label: import("@angular/core").Signal<"Live - click to ask for the data again" | "Disconnected - reconnecting. Click to try now">;
32
+ readonly label: import("@angular/core").Signal<"Live data - click to ask for it again" | "No live data - reconnecting. Click to try now">;
33
33
  retry(): void;
34
34
  static ɵfac: i0.ɵɵFactoryDeclaration<LiveIndicatorComponent, never>;
35
35
  static ɵcmp: i0.ɵɵComponentDeclaration<LiveIndicatorComponent, "lw-live-indicator", never, {}, {}, never, never, true, never>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwarity/livewire",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Live query synchronisation for Angular: subscribe to a query over one WebSocket, get its answer and every answer after it. Virtual-scroll data source included.",
5
5
  "keywords": [
6
6
  "angular",
@@ -33,7 +33,7 @@
33
33
  "rxjs": "^7.5.0"
34
34
  },
35
35
  "dependencies": {
36
- "@softwarity/livewire-protocol": "0.2.2",
36
+ "@softwarity/livewire-protocol": "0.2.4",
37
37
  "tslib": "^2.6.2"
38
38
  },
39
39
  "module": "fesm2022/softwarity-livewire.mjs",