@f-ewald/components 1.28.0 → 1.29.0

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.
@@ -5,19 +5,34 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { LitElement, css, html } from "lit";
8
- import { customElement } from "lit/decorators.js";
8
+ import { customElement, property } from "lit/decorators.js";
9
9
  import { tokens } from "./tokens.js";
10
10
  /**
11
- * Vertical timeline: a single connecting line runs down the left edge and each
12
- * slotted `timeline-entry` places a dot on it. This is a thin layout and
13
- * semantics wrapper — the entries draw the line segments and dots themselves,
14
- * so the container adds no gap between them (a gap would break the line).
15
- * Exposed to assistive technology as a list of events.
11
+ * Vertical timeline: a connecting line runs down the entries and each slotted
12
+ * `timeline-entry` places a dot on it. This is a thin layout and semantics
13
+ * wrapper — the entries draw the line segments and dots themselves, so the
14
+ * container adds no gap between them (a gap would break the line). Exposed to
15
+ * assistive technology as a list of events.
16
+ *
17
+ * `layout` chooses where the line runs. `left` (the default) puts it down the
18
+ * left edge with each entry's label inline beside its headline. `alternating`
19
+ * centers it and gives each entry three columns — label, line, body — with the
20
+ * two sides swapping on every second entry, for a presentation timeline rather
21
+ * than an event log.
22
+ *
23
+ * The layout is pushed onto each entry rather than read from here, because a
24
+ * shadow-DOM child cannot style itself against an ancestor portably —
25
+ * `:host-context()` is Chromium-only.
16
26
  *
17
27
  * @element timeline-container
18
28
  * @slot - `timeline-entry` elements, in chronological order.
19
29
  */
20
30
  let TimelineContainer = class TimelineContainer extends LitElement {
31
+ constructor() {
32
+ super(...arguments);
33
+ /** Arrangement of the entries: a left-edge line, or a centered alternating one. */
34
+ this.layout = "left";
35
+ }
21
36
  static { this.styles = [
22
37
  tokens,
23
38
  css `
@@ -31,10 +46,23 @@ let TimelineContainer = class TimelineContainer extends LitElement {
31
46
  if (!this.hasAttribute("role"))
32
47
  this.setAttribute("role", "list");
33
48
  }
49
+ updated() {
50
+ this.#applyLayout();
51
+ }
52
+ /** Mirrors `layout` onto every slotted entry so each can style itself. */
53
+ #applyLayout() {
54
+ const alternating = this.layout === "alternating";
55
+ for (const entry of this.querySelectorAll("timeline-entry")) {
56
+ entry.alternating = alternating;
57
+ }
58
+ }
34
59
  render() {
35
- return html `<slot></slot>`;
60
+ return html `<slot @slotchange=${this.#applyLayout}></slot>`;
36
61
  }
37
62
  };
63
+ __decorate([
64
+ property({ reflect: true })
65
+ ], TimelineContainer.prototype, "layout", void 0);
38
66
  TimelineContainer = __decorate([
39
67
  customElement("timeline-container")
40
68
  ], TimelineContainer);
@@ -1 +1 @@
1
- {"version":3,"file":"timeline-container.js","sourceRoot":"","sources":["../src/timeline-container.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;GASG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;aAC/B,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;KAIF;KACF,AAPqB,CAOpB;IAEO,iBAAiB;QACxB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;YAAE,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;CACF,CAAA;AAlBY,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CAkB7B","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * Vertical timeline: a single connecting line runs down the left edge and each\n * slotted `timeline-entry` places a dot on it. This is a thin layout and\n * semantics wrapper — the entries draw the line segments and dots themselves,\n * so the container adds no gap between them (a gap would break the line).\n * Exposed to assistive technology as a list of events.\n *\n * @element timeline-container\n * @slot - `timeline-entry` elements, in chronological order.\n */\n@customElement(\"timeline-container\")\nexport class TimelineContainer extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n `,\n ];\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.hasAttribute(\"role\")) this.setAttribute(\"role\", \"list\");\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"timeline-container\": TimelineContainer;\n }\n}\n"]}
1
+ {"version":3,"file":"timeline-container.js","sourceRoot":"","sources":["../src/timeline-container.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAMrC;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;QACL,mFAAmF;QACtD,WAAM,GAAmB,MAAM,CAAC;IA+B/D,CAAC;aA7BiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;KAIF;KACF,AAPqB,CAOpB;IAEO,iBAAiB;QACxB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;YAAE,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC;IAEkB,OAAO;QACxB,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;IAED,0EAA0E;IAC1E,YAAY;QACV,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,KAAK,aAAa,CAAC;QAClD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,gBAAgB,CAAgB,gBAAgB,CAAC,EAAE,CAAC;YAC3E,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC;QAClC,CAAC;IACH,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA,qBAAqB,IAAI,CAAC,YAAY,UAAU,CAAC;IAC9D,CAAC;CACF,CAAA;AA/B8B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDAAiC;AAFlD,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CAiC7B","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\nimport type { TimelineEntry } from \"./timeline-entry.js\";\n\n/** How a `timeline-container` arranges its entries. */\nexport type TimelineLayout = \"left\" | \"alternating\";\n\n/**\n * Vertical timeline: a connecting line runs down the entries and each slotted\n * `timeline-entry` places a dot on it. This is a thin layout and semantics\n * wrapper — the entries draw the line segments and dots themselves, so the\n * container adds no gap between them (a gap would break the line). Exposed to\n * assistive technology as a list of events.\n *\n * `layout` chooses where the line runs. `left` (the default) puts it down the\n * left edge with each entry's label inline beside its headline. `alternating`\n * centers it and gives each entry three columns — label, line, body — with the\n * two sides swapping on every second entry, for a presentation timeline rather\n * than an event log.\n *\n * The layout is pushed onto each entry rather than read from here, because a\n * shadow-DOM child cannot style itself against an ancestor portably —\n * `:host-context()` is Chromium-only.\n *\n * @element timeline-container\n * @slot - `timeline-entry` elements, in chronological order.\n */\n@customElement(\"timeline-container\")\nexport class TimelineContainer extends LitElement {\n /** Arrangement of the entries: a left-edge line, or a centered alternating one. */\n @property({ reflect: true }) layout: TimelineLayout = \"left\";\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n `,\n ];\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.hasAttribute(\"role\")) this.setAttribute(\"role\", \"list\");\n }\n\n protected override updated(): void {\n this.#applyLayout();\n }\n\n /** Mirrors `layout` onto every slotted entry so each can style itself. */\n #applyLayout(): void {\n const alternating = this.layout === \"alternating\";\n for (const entry of this.querySelectorAll<TimelineEntry>(\"timeline-entry\")) {\n entry.alternating = alternating;\n }\n }\n\n override render() {\n return html`<slot @slotchange=${this.#applyLayout}></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"timeline-container\": TimelineContainer;\n }\n}\n"]}
@@ -13,6 +13,19 @@ import type { StatusPillColor } from "./status-pill.js";
13
13
  * timestamp prop (e.g. `chat-message`'s `timestamp`) should leave it unset —
14
14
  * setting both renders the same time twice.
15
15
  *
16
+ * `label` is a free-text alternative for a timeline whose axis is not a wall
17
+ * clock — a year, an era, a phase. It wins over `datetime` when both are set.
18
+ * Slot `label` instead when it needs its own styling, since a property is
19
+ * rendered inside this component's shadow DOM and cannot be reached from
20
+ * outside.
21
+ *
22
+ * `alternating` is set by `timeline-container` and should not be set by hand:
23
+ * it switches the entry to three columns — label, line, body — with the sides
24
+ * swapping on every second entry. The entry fills whatever height it is given,
25
+ * so the line spans it rather than only its content — do not override the
26
+ * host's `display` from outside, since a light-DOM rule beats the `:host`
27
+ * declaration this relies on.
28
+ *
16
29
  * The dot's `color` types the entry using the shared status-pill palette —
17
30
  * `primary` by default, plus `neutral`, `info`, `success`, `warning`, and
18
31
  * `danger`.
@@ -26,11 +39,20 @@ import type { StatusPillColor } from "./status-pill.js";
26
39
  *
27
40
  * @element timeline-entry
28
41
  * @slot headline - Optional headline/title for the event.
42
+ * @slot label - Optional replacement for the `label` property, for a label that
43
+ * needs its own styling.
29
44
  * @slot - The event content; nest any elements here.
30
45
  */
31
46
  export declare class TimelineEntry extends LitElement {
32
47
  /** ISO 8601 or SQLite datetime string, rendered as a relative time. */
33
48
  datetime: string | null;
49
+ /** Free-text label shown in place of the relative time; wins over `datetime`. */
50
+ label: string | null;
51
+ /**
52
+ * Three-column alternating presentation. Set by `timeline-container` from its
53
+ * own `layout`; setting it directly is not supported.
54
+ */
55
+ alternating: boolean;
34
56
  /**
35
57
  * Visual type of the entry's dot, from the shared status-pill palette:
36
58
  * `primary` (default), `neutral`, `info`, `success`, `warning`, or `danger`.
@@ -49,8 +71,18 @@ export declare class TimelineEntry extends LitElement {
49
71
  running: boolean;
50
72
  /** Whether the headline slot currently has assigned content. */
51
73
  private _hasHeadline;
74
+ /** Whether the label slot currently has assigned content. */
75
+ private _hasLabel;
52
76
  static styles: import("lit").CSSResult[];
53
77
  connectedCallback(): void;
78
+ /**
79
+ * The entry's one time/label element: a slotted label, else the `label`
80
+ * property, else a relative time. Placed inline beside the headline in the
81
+ * default layout and in its own column when alternating.
82
+ */
83
+ private _renderMeta;
84
+ /** Tracks whether the label slot has content, so an empty one can collapse. */
85
+ private _onLabelSlotChange;
54
86
  /** Collapses the headline when nothing is slotted so the time sits alone. */
55
87
  private _onHeadlineSlotChange;
56
88
  render(): import("lit-html").TemplateResult<1>;
@@ -1 +1 @@
1
- {"version":3,"file":"timeline-entry.d.ts","sourceRoot":"","sources":["../src/timeline-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAErD,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBACa,aAAc,SAAQ,UAAU;IAC3C,uEAAuE;IAC3D,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE3C;;;OAGG;IACS,KAAK,EAAE,eAAe,CAAa;IAE/C;;;OAGG;IACyC,OAAO,UAAS;IAE5D;;;;OAIG;IACyC,OAAO,UAAS;IAE5D,gEAAgE;IACvD,OAAO,CAAC,YAAY,CAAS;IAEtC,OAAgB,MAAM,4BAyLpB;IAEO,iBAAiB,IAAI,IAAI,CAGjC;IAED,6EAA6E;IAC7E,OAAO,CAAC,qBAAqB;IAIpB,MAAM,yCA8Bd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,aAAa,CAAC;KACjC;CACF"}
1
+ {"version":3,"file":"timeline-entry.d.ts","sourceRoot":"","sources":["../src/timeline-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAErD,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,qBACa,aAAc,SAAQ,UAAU;IAC3C,uEAAuE;IAC3D,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE3C,iFAAiF;IACrE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAQ;IAExC;;;OAGG;IACyC,WAAW,UAAS;IAEhE;;;OAGG;IACS,KAAK,EAAE,eAAe,CAAa;IAE/C;;;OAGG;IACyC,OAAO,UAAS;IAE5D;;;;OAIG;IACyC,OAAO,UAAS;IAE5D,gEAAgE;IACvD,OAAO,CAAC,YAAY,CAAS;IAEtC,6DAA6D;IACpD,OAAO,CAAC,SAAS,CAAS;IAEnC,OAAgB,MAAM,4BAiQpB;IAEO,iBAAiB,IAAI,IAAI,CAGjC;IAED;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAgBnB,+EAA+E;IAC/E,OAAO,CAAC,kBAAkB;IAI1B,6EAA6E;IAC7E,OAAO,CAAC,qBAAqB;IAIpB,MAAM,yCA6Bd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,aAAa,CAAC;KACjC;CACF"}
@@ -20,6 +20,19 @@ import { tokens } from "./tokens.js";
20
20
  * timestamp prop (e.g. `chat-message`'s `timestamp`) should leave it unset —
21
21
  * setting both renders the same time twice.
22
22
  *
23
+ * `label` is a free-text alternative for a timeline whose axis is not a wall
24
+ * clock — a year, an era, a phase. It wins over `datetime` when both are set.
25
+ * Slot `label` instead when it needs its own styling, since a property is
26
+ * rendered inside this component's shadow DOM and cannot be reached from
27
+ * outside.
28
+ *
29
+ * `alternating` is set by `timeline-container` and should not be set by hand:
30
+ * it switches the entry to three columns — label, line, body — with the sides
31
+ * swapping on every second entry. The entry fills whatever height it is given,
32
+ * so the line spans it rather than only its content — do not override the
33
+ * host's `display` from outside, since a light-DOM rule beats the `:host`
34
+ * declaration this relies on.
35
+ *
23
36
  * The dot's `color` types the entry using the shared status-pill palette —
24
37
  * `primary` by default, plus `neutral`, `info`, `success`, `warning`, and
25
38
  * `danger`.
@@ -33,6 +46,8 @@ import { tokens } from "./tokens.js";
33
46
  *
34
47
  * @element timeline-entry
35
48
  * @slot headline - Optional headline/title for the event.
49
+ * @slot label - Optional replacement for the `label` property, for a label that
50
+ * needs its own styling.
36
51
  * @slot - The event content; nest any elements here.
37
52
  */
38
53
  let TimelineEntry = class TimelineEntry extends LitElement {
@@ -40,6 +55,13 @@ let TimelineEntry = class TimelineEntry extends LitElement {
40
55
  super(...arguments);
41
56
  /** ISO 8601 or SQLite datetime string, rendered as a relative time. */
42
57
  this.datetime = null;
58
+ /** Free-text label shown in place of the relative time; wins over `datetime`. */
59
+ this.label = null;
60
+ /**
61
+ * Three-column alternating presentation. Set by `timeline-container` from its
62
+ * own `layout`; setting it directly is not supported.
63
+ */
64
+ this.alternating = false;
43
65
  /**
44
66
  * Visual type of the entry's dot, from the shared status-pill palette:
45
67
  * `primary` (default), `neutral`, `info`, `success`, `warning`, or `danger`.
@@ -58,6 +80,8 @@ let TimelineEntry = class TimelineEntry extends LitElement {
58
80
  this.running = false;
59
81
  /** Whether the headline slot currently has assigned content. */
60
82
  this._hasHeadline = false;
83
+ /** Whether the label slot currently has assigned content. */
84
+ this._hasLabel = false;
61
85
  }
62
86
  static { this.styles = [
63
87
  tokens,
@@ -243,6 +267,78 @@ let TimelineEntry = class TimelineEntry extends LitElement {
243
267
  font-size: var(--ui-font-size-sm, 0.75rem);
244
268
  color: var(--ui-text-muted, #64748b);
245
269
  }
270
+ .time.empty {
271
+ display: none;
272
+ }
273
+
274
+ /*
275
+ * Alternating layout. minmax(0, 1fr) rather than a bare 1fr: an
276
+ * auto-sized track grows to its content's minimum width, which would
277
+ * push the middle column - and with it the line and dot - off center.
278
+ */
279
+ /* A grid host so its single auto row stretches to whatever height the
280
+ consumer gives the entry. The line is drawn inside that row, so
281
+ without this it spans only the content and leaves gaps between
282
+ consecutive entries. Flex does not do this: with a content-sized
283
+ height there is no free space for flex-grow to distribute. */
284
+ :host([alternating]) {
285
+ display: grid;
286
+ }
287
+ :host([alternating]) .entry {
288
+ display: grid;
289
+ grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
290
+ align-items: center;
291
+ column-gap: 1.5rem;
292
+ }
293
+ :host([alternating]) .meta,
294
+ :host([alternating]) .rail,
295
+ :host([alternating]) .body {
296
+ grid-row: 1;
297
+ }
298
+ :host([alternating]) .meta {
299
+ grid-column: 1;
300
+ justify-self: end;
301
+ text-align: right;
302
+ }
303
+ :host([alternating]) .rail {
304
+ grid-column: 2;
305
+ align-self: stretch;
306
+ }
307
+ :host([alternating]) .body {
308
+ grid-column: 3;
309
+ padding: 1.5rem 0;
310
+ }
311
+ :host([alternating]:nth-child(even)) .meta {
312
+ grid-column: 3;
313
+ justify-self: start;
314
+ text-align: left;
315
+ }
316
+ :host([alternating]:nth-child(even)) .body {
317
+ grid-column: 1;
318
+ }
319
+ /* The dot marks the middle of the entry rather than its headline, and
320
+ the line runs the entry's full height so consecutive entries join. */
321
+ :host([alternating]) .dot {
322
+ top: 50%;
323
+ transform: translate(-50%, -50%);
324
+ }
325
+ :host([alternating]) .spinner {
326
+ top: 50%;
327
+ transform: translateY(-50%);
328
+ }
329
+ :host([alternating]) .line-top {
330
+ top: 0;
331
+ height: 50%;
332
+ }
333
+ :host([alternating]) .line-bottom {
334
+ top: 50%;
335
+ bottom: 0;
336
+ }
337
+ :host([alternating]) .time {
338
+ font-size: var(--ui-font-size-lg, 1rem);
339
+ font-weight: var(--ui-font-weight-medium, 500);
340
+ letter-spacing: var(--ui-tracking-wide, 0.04em);
341
+ }
246
342
  `,
247
343
  ]; }
248
344
  connectedCallback() {
@@ -250,6 +346,29 @@ let TimelineEntry = class TimelineEntry extends LitElement {
250
346
  if (!this.hasAttribute("role"))
251
347
  this.setAttribute("role", "listitem");
252
348
  }
349
+ /**
350
+ * The entry's one time/label element: a slotted label, else the `label`
351
+ * property, else a relative time. Placed inline beside the headline in the
352
+ * default layout and in its own column when alternating.
353
+ */
354
+ _renderMeta() {
355
+ const fallback = this.label !== null && this.label !== ""
356
+ ? html `${this.label}`
357
+ : this.datetime
358
+ ? html `<relative-time datetime=${this.datetime}></relative-time>`
359
+ : nothing;
360
+ // Collapsed rather than omitted when there is nothing to show: the slot has
361
+ // to stay in the tree for its slotchange to report late-assigned content,
362
+ // but an empty span would otherwise still claim the head row's gap.
363
+ const empty = fallback === nothing && !this._hasLabel;
364
+ return html `<span class="time ${empty ? "empty" : ""}">
365
+ <slot name="label" @slotchange=${this._onLabelSlotChange}>${fallback}</slot>
366
+ </span>`;
367
+ }
368
+ /** Tracks whether the label slot has content, so an empty one can collapse. */
369
+ _onLabelSlotChange(event) {
370
+ this._hasLabel = event.target.assignedNodes({ flatten: true }).length > 0;
371
+ }
253
372
  /** Collapses the headline when nothing is slotted so the time sits alone. */
254
373
  _onHeadlineSlotChange(event) {
255
374
  this._hasHeadline = event.target.assignedNodes({ flatten: true }).length > 0;
@@ -257,6 +376,7 @@ let TimelineEntry = class TimelineEntry extends LitElement {
257
376
  render() {
258
377
  return html `
259
378
  <div class="entry">
379
+ ${this.alternating ? html `<div class="meta">${this._renderMeta()}</div>` : nothing}
260
380
  <div class="rail" aria-hidden="true">
261
381
  <span class="line line-top"></span>
262
382
  <span class="line line-bottom"></span>
@@ -276,9 +396,7 @@ let TimelineEntry = class TimelineEntry extends LitElement {
276
396
  <span class="headline ${this._hasHeadline ? "" : "empty"}">
277
397
  <slot name="headline" @slotchange=${this._onHeadlineSlotChange}></slot>
278
398
  </span>
279
- ${this.datetime
280
- ? html `<relative-time class="time" datetime=${this.datetime}></relative-time>`
281
- : nothing}
399
+ ${this.alternating ? nothing : this._renderMeta()}
282
400
  </div>
283
401
  <div class="content"><slot></slot></div>
284
402
  </div>
@@ -289,6 +407,12 @@ let TimelineEntry = class TimelineEntry extends LitElement {
289
407
  __decorate([
290
408
  property()
291
409
  ], TimelineEntry.prototype, "datetime", void 0);
410
+ __decorate([
411
+ property()
412
+ ], TimelineEntry.prototype, "label", void 0);
413
+ __decorate([
414
+ property({ type: Boolean, reflect: true })
415
+ ], TimelineEntry.prototype, "alternating", void 0);
292
416
  __decorate([
293
417
  property()
294
418
  ], TimelineEntry.prototype, "color", void 0);
@@ -301,6 +425,9 @@ __decorate([
301
425
  __decorate([
302
426
  state()
303
427
  ], TimelineEntry.prototype, "_hasHeadline", void 0);
428
+ __decorate([
429
+ state()
430
+ ], TimelineEntry.prototype, "_hasLabel", void 0);
304
431
  TimelineEntry = __decorate([
305
432
  customElement("timeline-entry")
306
433
  ], TimelineEntry);
@@ -1 +1 @@
1
- {"version":3,"file":"timeline-entry.js","sourceRoot":"","sources":["../src/timeline-entry.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,S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YACb,CAAC,CAAC,IAAI,CAAA,wCAAwC,IAAI,CAAC,QAAQ,mBAAmB;YAC9E,CAAC,CAAC,OAAO;;;;;KAKlB,CAAC;IACJ,CAAC;CACF,CAAA;AA5Pa;IAAX,QAAQ,EAAE;+CAAgC;AAM/B;IAAX,QAAQ,EAAE;4CAAoC;AAMH;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAiB;AAOhB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAiB;AAG3C;IAAhB,KAAK,EAAE;mDAA8B;AAxB3B,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CA8PzB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport \"./relative-time.js\";\nimport { tokens } from \"./tokens.js\";\nimport type { StatusPillColor } from \"./status-pill.js\";\n\n/**\n * One event on a `timeline-container`: a dot on the vertical line, an optional\n * headline, a relative timestamp (\"3 hours ago\"), and freely nested content.\n * The connecting line is drawn here — its segment above the dot is hidden on\n * the first entry and the segment below is hidden on the last, so the line caps\n * exactly at the first and last dots. Only meaningful inside a\n * `timeline-container`; demonstrated through it.\n *\n * `datetime` is the entry's one timestamp. A nested element that has its own\n * timestamp prop (e.g. `chat-message`'s `timestamp`) should leave it unset —\n * setting both renders the same time twice.\n *\n * The dot's `color` types the entry using the shared status-pill palette —\n * `primary` by default, plus `neutral`, `info`, `success`, `warning`, and\n * `danger`.\n *\n * Set `compact` for dense, one-line system-status entries: it tightens the\n * vertical spacing and renders the content smaller and muted.\n *\n * Set `running` to replace the dot with an animated gray ring spinner,\n * indicating the entry represents in-progress work; `color` has no visible\n * effect while `running` is set.\n *\n * @element timeline-entry\n * @slot headline - Optional headline/title for the event.\n * @slot - The event content; nest any elements here.\n */\n@customElement(\"timeline-entry\")\nexport class TimelineEntry extends LitElement {\n /** ISO 8601 or SQLite datetime string, rendered as a relative time. */\n @property() datetime: string | null = null;\n\n /**\n * Visual type of the entry's dot, from the shared status-pill palette:\n * `primary` (default), `neutral`, `info`, `success`, `warning`, or `danger`.\n */\n @property() color: StatusPillColor = \"primary\";\n\n /**\n * Dense, one-line presentation for system-status entries: tighter vertical\n * spacing and smaller, muted content.\n */\n @property({ type: Boolean, reflect: true }) compact = false;\n\n /**\n * Shows an animated ring spinner in place of the dot, indicating the entry\n * represents in-progress work. Overrides `color` while set — the spinner\n * always uses the muted/gray palette.\n */\n @property({ type: Boolean, reflect: true }) running = false;\n\n /** Whether the headline slot currently has assigned content. */\n @state() private _hasHeadline = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .entry {\n display: flex;\n gap: 0.75rem;\n }\n .rail {\n position: relative;\n flex: 0 0 auto;\n width: 0.75rem;\n }\n .line {\n position: absolute;\n left: 50%;\n width: 2px;\n transform: translateX(-50%);\n background: var(--ui-border, #e2e8f0);\n }\n .line-top {\n top: 0;\n height: 0.5rem;\n }\n .line-bottom {\n top: 0.5rem;\n bottom: 0;\n }\n .dot {\n position: absolute;\n top: 0.125rem;\n left: 50%;\n width: 0.75rem;\n height: 0.75rem;\n transform: translateX(-50%);\n border-radius: 9999px;\n /* Same lighter-on-top token gradient as map-circle/user-avatar; the\n base color is swapped per the color property via the private\n --_dot var. */\n background: linear-gradient(\n to bottom,\n color-mix(in srgb, var(--_dot, var(--ui-primary, #4f46e5)) 70%, #ffffff) 0%,\n color-mix(in srgb, var(--_dot, var(--ui-primary, #4f46e5)) 70%, #000000) 100%\n );\n }\n .dot.neutral {\n --_dot: var(--ui-text-muted, #64748b);\n }\n .dot.info {\n --_dot: var(--ui-info, #0ea5e9);\n }\n .dot.primary {\n --_dot: var(--ui-primary, #4f46e5);\n }\n .dot.success {\n --_dot: var(--ui-success, #16a34a);\n }\n .dot.warning {\n --_dot: var(--ui-warning, #d97706);\n }\n .dot.danger {\n --_dot: var(--ui-danger, #dc2626);\n }\n .spinner {\n position: absolute;\n top: 0.125rem;\n left: 0;\n display: block;\n width: 0.75rem;\n height: 0.75rem;\n border-radius: 9999px;\n /* Opaque backing so the connecting line is masked exactly like it is\n behind the solid .dot, instead of showing through the ring's\n hollow center and corners. */\n background: var(--ui-surface, #ffffff);\n }\n .spinner svg {\n display: block;\n width: 100%;\n height: 100%;\n }\n .spinner-track {\n fill: none;\n stroke: color-mix(in srgb, var(--ui-text-muted, #64748b) 25%, transparent);\n stroke-width: 3;\n }\n .spinner-arc {\n fill: none;\n stroke: var(--ui-text-muted, #64748b);\n stroke-width: 3;\n stroke-linecap: round;\n /* r=9 gives a 56.55-unit circumference. Keeping the dash and gap\n total equal to that circumference makes the fixed-length arc loop\n seamlessly while its dash offset advances around the static ring. */\n stroke-dasharray: 42.41 14.14;\n animation: spinner-orbit 0.8s linear infinite;\n }\n @keyframes spinner-orbit {\n from {\n stroke-dashoffset: 0;\n }\n to {\n stroke-dashoffset: -56.55;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .spinner-arc {\n animation: none;\n }\n }\n @media (forced-colors: active) {\n .spinner {\n background: Canvas;\n }\n .spinner-track {\n stroke: GrayText;\n }\n .spinner-arc {\n stroke: CanvasText;\n }\n }\n :host(:first-child) .line-top {\n display: none;\n }\n :host(:last-child) .line-bottom {\n display: none;\n }\n .body {\n flex: 1 1 auto;\n min-width: 0;\n padding-bottom: 1.5rem;\n }\n :host(:last-child) .body {\n padding-bottom: 0;\n }\n .head {\n display: flex;\n align-items: baseline;\n gap: 0.5rem;\n flex-wrap: wrap;\n }\n .headline {\n font-weight: var(--ui-font-weight-semibold, 600);\n font-size: var(--ui-font-size, 0.875rem);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n }\n .headline.empty {\n display: none;\n }\n .time {\n font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text-muted, #64748b);\n }\n .content {\n margin-top: 0.25rem;\n font-size: var(--ui-font-size, 0.875rem);\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text, #0f172a);\n }\n :host([compact]) .body {\n padding-bottom: 0.5rem;\n }\n :host([compact]:last-child) .body {\n padding-bottom: 0;\n }\n :host([compact]) .content {\n margin-top: 0.125rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n color: var(--ui-text-muted, #64748b);\n }\n `,\n ];\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.hasAttribute(\"role\")) this.setAttribute(\"role\", \"listitem\");\n }\n\n /** Collapses the headline when nothing is slotted so the time sits alone. */\n private _onHeadlineSlotChange(event: Event): void {\n this._hasHeadline = (event.target as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;\n }\n\n override render() {\n return html`\n <div class=\"entry\">\n <div class=\"rail\" aria-hidden=\"true\">\n <span class=\"line line-top\"></span>\n <span class=\"line line-bottom\"></span>\n ${this.running\n ? html`\n <span class=\"spinner\">\n <svg viewBox=\"0 0 24 24\">\n <circle class=\"spinner-track\" cx=\"12\" cy=\"12\" r=\"9\"></circle>\n <circle class=\"spinner-arc\" cx=\"12\" cy=\"12\" r=\"9\"></circle>\n </svg>\n </span>\n `\n : html`<span class=\"dot ${this.color}\"></span>`}\n </div>\n <div class=\"body\">\n <div class=\"head\">\n <span class=\"headline ${this._hasHeadline ? \"\" : \"empty\"}\">\n <slot name=\"headline\" @slotchange=${this._onHeadlineSlotChange}></slot>\n </span>\n ${this.datetime\n ? html`<relative-time class=\"time\" datetime=${this.datetime}></relative-time>`\n : nothing}\n </div>\n <div class=\"content\"><slot></slot></div>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"timeline-entry\": Timeline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IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO;;;;YAI9E,IAAI,CAAC,OAAO;YACZ,CAAC,CAAC,IAAI,CAAA;;;;;;;eAOH;YACH,CAAC,CAAC,IAAI,CAAA,oBAAoB,IAAI,CAAC,KAAK,WAAW;;;;oCAIvB,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO;kDAClB,IAAI,CAAC,qBAAqB;;cAE9D,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE;;;;;KAKxD,CAAC;IACJ,CAAC;CACF,CAAA;AAzWa;IAAX,QAAQ,EAAE;+CAAgC;AAG/B;IAAX,QAAQ,EAAE;4CAA6B;AAMI;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDAAqB;AAMpD;IAAX,QAAQ,EAAE;4CAAoC;AAMH;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAiB;AAOhB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAiB;AAG3C;IAAhB,KAAK,EAAE;mDAA8B;AAGrB;IAAhB,KAAK,EAAE;gDAA2B;AApCxB,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CA2WzB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport \"./relative-time.js\";\nimport { tokens } from \"./tokens.js\";\nimport type { StatusPillColor } from \"./status-pill.js\";\n\n/**\n * One event on a `timeline-container`: a dot on the vertical line, an optional\n * headline, a relative timestamp (\"3 hours ago\"), and freely nested content.\n * The connecting line is drawn here — its segment above the dot is hidden on\n * the first entry and the segment below is hidden on the last, so the line caps\n * exactly at the first and last dots. Only meaningful inside a\n * `timeline-container`; demonstrated through it.\n *\n * `datetime` is the entry's one timestamp. A nested element that has its own\n * timestamp prop (e.g. `chat-message`'s `timestamp`) should leave it unset —\n * setting both renders the same time twice.\n *\n * `label` is a free-text alternative for a timeline whose axis is not a wall\n * clock — a year, an era, a phase. It wins over `datetime` when both are set.\n * Slot `label` instead when it needs its own styling, since a property is\n * rendered inside this component's shadow DOM and cannot be reached from\n * outside.\n *\n * `alternating` is set by `timeline-container` and should not be set by hand:\n * it switches the entry to three columns — label, line, body — with the sides\n * swapping on every second entry. The entry fills whatever height it is given,\n * so the line spans it rather than only its content — do not override the\n * host's `display` from outside, since a light-DOM rule beats the `:host`\n * declaration this relies on.\n *\n * The dot's `color` types the entry using the shared status-pill palette —\n * `primary` by default, plus `neutral`, `info`, `success`, `warning`, and\n * `danger`.\n *\n * Set `compact` for dense, one-line system-status entries: it tightens the\n * vertical spacing and renders the content smaller and muted.\n *\n * Set `running` to replace the dot with an animated gray ring spinner,\n * indicating the entry represents in-progress work; `color` has no visible\n * effect while `running` is set.\n *\n * @element timeline-entry\n * @slot headline - Optional headline/title for the event.\n * @slot label - Optional replacement for the `label` property, for a label that\n * needs its own styling.\n * @slot - The event content; nest any elements here.\n */\n@customElement(\"timeline-entry\")\nexport class TimelineEntry extends LitElement {\n /** ISO 8601 or SQLite datetime string, rendered as a relative time. */\n @property() datetime: string | null = null;\n\n /** Free-text label shown in place of the relative time; wins over `datetime`. */\n @property() label: string | null = null;\n\n /**\n * Three-column alternating presentation. Set by `timeline-container` from its\n * own `layout`; setting it directly is not supported.\n */\n @property({ type: Boolean, reflect: true }) alternating = false;\n\n /**\n * Visual type of the entry's dot, from the shared status-pill palette:\n * `primary` (default), `neutral`, `info`, `success`, `warning`, or `danger`.\n */\n @property() color: StatusPillColor = \"primary\";\n\n /**\n * Dense, one-line presentation for system-status entries: tighter vertical\n * spacing and smaller, muted content.\n */\n @property({ type: Boolean, reflect: true }) compact = false;\n\n /**\n * Shows an animated ring spinner in place of the dot, indicating the entry\n * represents in-progress work. Overrides `color` while set — the spinner\n * always uses the muted/gray palette.\n */\n @property({ type: Boolean, reflect: true }) running = false;\n\n /** Whether the headline slot currently has assigned content. */\n @state() private _hasHeadline = false;\n\n /** Whether the label slot currently has assigned content. */\n @state() private _hasLabel = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .entry {\n display: flex;\n gap: 0.75rem;\n }\n .rail {\n position: relative;\n flex: 0 0 auto;\n width: 0.75rem;\n }\n .line {\n position: absolute;\n left: 50%;\n width: 2px;\n transform: translateX(-50%);\n background: var(--ui-border, #e2e8f0);\n }\n .line-top {\n top: 0;\n height: 0.5rem;\n }\n .line-bottom {\n top: 0.5rem;\n bottom: 0;\n }\n .dot {\n position: absolute;\n top: 0.125rem;\n left: 50%;\n width: 0.75rem;\n height: 0.75rem;\n transform: translateX(-50%);\n border-radius: 9999px;\n /* Same lighter-on-top token gradient as map-circle/user-avatar; the\n base color is swapped per the color property via the private\n --_dot var. */\n background: linear-gradient(\n to bottom,\n color-mix(in srgb, var(--_dot, var(--ui-primary, #4f46e5)) 70%, #ffffff) 0%,\n color-mix(in srgb, var(--_dot, var(--ui-primary, #4f46e5)) 70%, #000000) 100%\n );\n }\n .dot.neutral {\n --_dot: var(--ui-text-muted, #64748b);\n }\n .dot.info {\n --_dot: var(--ui-info, #0ea5e9);\n }\n .dot.primary {\n --_dot: var(--ui-primary, #4f46e5);\n }\n .dot.success {\n --_dot: var(--ui-success, #16a34a);\n }\n .dot.warning {\n --_dot: var(--ui-warning, #d97706);\n }\n .dot.danger {\n --_dot: var(--ui-danger, #dc2626);\n }\n .spinner {\n position: absolute;\n top: 0.125rem;\n left: 0;\n display: block;\n width: 0.75rem;\n height: 0.75rem;\n border-radius: 9999px;\n /* Opaque backing so the connecting line is masked exactly like it is\n behind the solid .dot, instead of showing through the ring's\n hollow center and corners. */\n background: var(--ui-surface, #ffffff);\n }\n .spinner svg {\n display: block;\n width: 100%;\n height: 100%;\n }\n .spinner-track {\n fill: none;\n stroke: color-mix(in srgb, var(--ui-text-muted, #64748b) 25%, transparent);\n stroke-width: 3;\n }\n .spinner-arc {\n fill: none;\n stroke: var(--ui-text-muted, #64748b);\n stroke-width: 3;\n stroke-linecap: round;\n /* r=9 gives a 56.55-unit circumference. Keeping the dash and gap\n total equal to that circumference makes the fixed-length arc loop\n seamlessly while its dash offset advances around the static ring. */\n stroke-dasharray: 42.41 14.14;\n animation: spinner-orbit 0.8s linear infinite;\n }\n @keyframes spinner-orbit {\n from {\n stroke-dashoffset: 0;\n }\n to {\n stroke-dashoffset: -56.55;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .spinner-arc {\n animation: none;\n }\n }\n @media (forced-colors: active) {\n .spinner {\n background: Canvas;\n }\n .spinner-track {\n stroke: GrayText;\n }\n .spinner-arc {\n stroke: CanvasText;\n }\n }\n :host(:first-child) .line-top {\n display: none;\n }\n :host(:last-child) .line-bottom {\n display: none;\n }\n .body {\n flex: 1 1 auto;\n min-width: 0;\n padding-bottom: 1.5rem;\n }\n :host(:last-child) .body {\n padding-bottom: 0;\n }\n .head {\n display: flex;\n align-items: baseline;\n gap: 0.5rem;\n flex-wrap: wrap;\n }\n .headline {\n font-weight: var(--ui-font-weight-semibold, 600);\n font-size: var(--ui-font-size, 0.875rem);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n }\n .headline.empty {\n display: none;\n }\n .time {\n font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text-muted, #64748b);\n }\n .content {\n margin-top: 0.25rem;\n font-size: var(--ui-font-size, 0.875rem);\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text, #0f172a);\n }\n :host([compact]) .body {\n padding-bottom: 0.5rem;\n }\n :host([compact]:last-child) .body {\n padding-bottom: 0;\n }\n :host([compact]) .content {\n margin-top: 0.125rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n color: var(--ui-text-muted, #64748b);\n }\n .time.empty {\n display: none;\n }\n\n /*\n * Alternating layout. minmax(0, 1fr) rather than a bare 1fr: an\n * auto-sized track grows to its content's minimum width, which would\n * push the middle column - and with it the line and dot - off center.\n */\n /* A grid host so its single auto row stretches to whatever height the\n consumer gives the entry. The line is drawn inside that row, so\n without this it spans only the content and leaves gaps between\n consecutive entries. Flex does not do this: with a content-sized\n height there is no free space for flex-grow to distribute. */\n :host([alternating]) {\n display: grid;\n }\n :host([alternating]) .entry {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);\n align-items: center;\n column-gap: 1.5rem;\n }\n :host([alternating]) .meta,\n :host([alternating]) .rail,\n :host([alternating]) .body {\n grid-row: 1;\n }\n :host([alternating]) .meta {\n grid-column: 1;\n justify-self: end;\n text-align: right;\n }\n :host([alternating]) .rail {\n grid-column: 2;\n align-self: stretch;\n }\n :host([alternating]) .body {\n grid-column: 3;\n padding: 1.5rem 0;\n }\n :host([alternating]:nth-child(even)) .meta {\n grid-column: 3;\n justify-self: start;\n text-align: left;\n }\n :host([alternating]:nth-child(even)) .body {\n grid-column: 1;\n }\n /* The dot marks the middle of the entry rather than its headline, and\n the line runs the entry's full height so consecutive entries join. */\n :host([alternating]) .dot {\n top: 50%;\n transform: translate(-50%, -50%);\n }\n :host([alternating]) .spinner {\n top: 50%;\n transform: translateY(-50%);\n }\n :host([alternating]) .line-top {\n top: 0;\n height: 50%;\n }\n :host([alternating]) .line-bottom {\n top: 50%;\n bottom: 0;\n }\n :host([alternating]) .time {\n font-size: var(--ui-font-size-lg, 1rem);\n font-weight: var(--ui-font-weight-medium, 500);\n letter-spacing: var(--ui-tracking-wide, 0.04em);\n }\n `,\n ];\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.hasAttribute(\"role\")) this.setAttribute(\"role\", \"listitem\");\n }\n\n /**\n * The entry's one time/label element: a slotted label, else the `label`\n * property, else a relative time. Placed inline beside the headline in the\n * default layout and in its own column when alternating.\n */\n private _renderMeta() {\n const fallback =\n this.label !== null && this.label !== \"\"\n ? html`${this.label}`\n : this.datetime\n ? html`<relative-time datetime=${this.datetime}></relative-time>`\n : nothing;\n // Collapsed rather than omitted when there is nothing to show: the slot has\n // to stay in the tree for its slotchange to report late-assigned content,\n // but an empty span would otherwise still claim the head row's gap.\n const empty = fallback === nothing && !this._hasLabel;\n return html`<span class=\"time ${empty ? \"empty\" : \"\"}\">\n <slot name=\"label\" @slotchange=${this._onLabelSlotChange}>${fallback}</slot>\n </span>`;\n }\n\n /** Tracks whether the label slot has content, so an empty one can collapse. */\n private _onLabelSlotChange(event: Event): void {\n this._hasLabel = (event.target as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;\n }\n\n /** Collapses the headline when nothing is slotted so the time sits alone. */\n private _onHeadlineSlotChange(event: Event): void {\n this._hasHeadline = (event.target as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;\n }\n\n override render() {\n return html`\n <div class=\"entry\">\n ${this.alternating ? html`<div class=\"meta\">${this._renderMeta()}</div>` : nothing}\n <div class=\"rail\" aria-hidden=\"true\">\n <span class=\"line line-top\"></span>\n <span class=\"line line-bottom\"></span>\n ${this.running\n ? html`\n <span class=\"spinner\">\n <svg viewBox=\"0 0 24 24\">\n <circle class=\"spinner-track\" cx=\"12\" cy=\"12\" r=\"9\"></circle>\n <circle class=\"spinner-arc\" cx=\"12\" cy=\"12\" r=\"9\"></circle>\n </svg>\n </span>\n `\n : html`<span class=\"dot ${this.color}\"></span>`}\n </div>\n <div class=\"body\">\n <div class=\"head\">\n <span class=\"headline ${this._hasHeadline ? \"\" : \"empty\"}\">\n <slot name=\"headline\" @slotchange=${this._onHeadlineSlotChange}></slot>\n </span>\n ${this.alternating ? nothing : this._renderMeta()}\n </div>\n <div class=\"content\"><slot></slot></div>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"timeline-entry\": TimelineEntry;\n }\n}\n"]}
@@ -0,0 +1,70 @@
1
+ # `<fullscreen-button>`
2
+
3
+ Toggles fullscreen presentation of the page, or of a given `target` element.
4
+
5
+ The icon and accessible name track the *actual* fullscreen state rather than
6
+ this button's own clicks, because fullscreen can be left without touching it
7
+ — Escape, or the browser's own chrome — which would otherwise leave the
8
+ button showing the wrong affordance.
9
+
10
+ The control is styled as a square icon-sized `ui-button` `secondary` variant
11
+ (2rem, `--ui-radius-sm` corners, the `--ui-button-secondary-*` background and
12
+ border tokens, so a gradient theme carries over) layered over an opaque
13
+ `--ui-surface` base and an elevation shadow, since it normally floats above
14
+ the content it expands.
15
+
16
+ ## Install
17
+
18
+ ```js
19
+ import "@f-ewald/components/fullscreen-button.js";
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ```html
25
+ <fullscreen-button></fullscreen-button>
26
+ <script type="module">
27
+ const button = document.querySelector('fullscreen-button');
28
+ button.target = document.querySelector('#deck'); // omit for the whole page
29
+ button.addEventListener('fullscreen-change', (e) => console.log(e.detail.active));
30
+ </script>
31
+ ```
32
+
33
+ ## Attributes / properties
34
+
35
+ | Property | Attribute | Type | Default | Description |
36
+ | --- | --- | --- | --- | --- |
37
+ | `target` | _(JS property only)_ | `HTMLElement | null` | `null` | Element to present fullscreen; `null` (default) presents the whole page. |
38
+ | `enterLabel` | `enter-label` | `string` | `"Enter full screen"` | Accessible name while not fullscreen. |
39
+ | `exitLabel` | `exit-label` | `string` | `"Exit full screen"` | Accessible name while fullscreen. |
40
+
41
+ ## Events
42
+
43
+ | Event | Description |
44
+ | --- | --- |
45
+ | `fullscreen-change` | The fullscreen state changed, from this button or otherwise (`detail: { active }`). |
46
+
47
+ ## Slots
48
+
49
+ _None._
50
+
51
+ ## CSS custom properties
52
+
53
+ | Custom property |
54
+ | --- |
55
+ | `--ui-border` |
56
+ | `--ui-button-highlight` |
57
+ | `--ui-button-secondary-` |
58
+ | `--ui-button-secondary-background` |
59
+ | `--ui-button-secondary-background-active` |
60
+ | `--ui-button-secondary-background-hover` |
61
+ | `--ui-button-secondary-border` |
62
+ | `--ui-button-secondary-border-hover` |
63
+ | `--ui-focus-ring` |
64
+ | `--ui-line-height-glyph` |
65
+ | `--ui-radius-sm` |
66
+ | `--ui-shadow` |
67
+ | `--ui-surface` |
68
+ | `--ui-surface-muted` |
69
+ | `--ui-text` |
70
+ | `--ui-text-muted` |
@@ -0,0 +1,65 @@
1
+ # `<scroll-dots>`
2
+
3
+ Vertical section navigator for a long scrolled page or a slide deck: one dot
4
+ per section, the active one drawn as an elongated rounded bar rather than a
5
+ dot, which is the only cue needed to read position at a glance.
6
+
7
+ Controlled, like `pagination-nav`: it owns no scroll behavior and never
8
+ reads the scroll position. The consumer sets `active` and moves the page in
9
+ response to `dot-select` — what counts as the active section differs too much
10
+ between a snapped deck and an ordinary long page to bake in.
11
+
12
+ Positioning is also the consumer's, since a rail is normally fixed into a
13
+ reserved gutter that only the page knows the width of.
14
+
15
+ The dots use the same lighter-on-top gradient as `map-circle`/`map-pin`,
16
+ derived from a single base `color` — a rail beside a map reads as the same
17
+ family of marks as the pins on it.
18
+
19
+ ## Install
20
+
21
+ ```js
22
+ import "@f-ewald/components/scroll-dots.js";
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```html
28
+ <scroll-dots label="Journey stops"></scroll-dots>
29
+ <script type="module">
30
+ const rail = document.querySelector('scroll-dots');
31
+ rail.items = ['Intro', 'Freiburg', 'Berkeley', { label: 'Credits', muted: true }];
32
+ rail.active = 0;
33
+ rail.addEventListener('dot-select', (e) => {
34
+ rail.active = e.detail.index;
35
+ sections[e.detail.index].scrollIntoView({ behavior: 'smooth', block: 'start' });
36
+ });
37
+ </script>
38
+ ```
39
+
40
+ ## Attributes / properties
41
+
42
+ | Property | Attribute | Type | Default | Description |
43
+ | --- | --- | --- | --- | --- |
44
+ | `items` | _(JS property only)_ | `ScrollDotsItem[]` | `[]` | Dots to render, in document order. A bare string is shorthand for `{ label }`. |
45
+ | `active` | `active` | `number` | `0` | 0-based index of the active dot. Out-of-range values simply match no dot. |
46
+ | `color` | `color` | `string` | `""` | Base color the dot gradient is derived from. Empty uses `--ui-primary`. |
47
+ | `label` | `label` | `string` | `""` | Accessible name for the rail, e.g. "Journey stops". |
48
+
49
+ ## Events
50
+
51
+ | Event | Description |
52
+ | --- | --- |
53
+ | `dot-select` | The user picked a dot (`detail: { index }`). |
54
+
55
+ ## Slots
56
+
57
+ _None._
58
+
59
+ ## CSS custom properties
60
+
61
+ | Custom property |
62
+ | --- |
63
+ | `--ui-focus-ring` |
64
+ | `--ui-primary` |
65
+ | `--ui-text-muted` |
@@ -1,10 +1,20 @@
1
1
  # `<timeline-container>`
2
2
 
3
- Vertical timeline: a single connecting line runs down the left edge and each
4
- slotted `timeline-entry` places a dot on it. This is a thin layout and
5
- semantics wrapper — the entries draw the line segments and dots themselves,
6
- so the container adds no gap between them (a gap would break the line).
7
- Exposed to assistive technology as a list of events.
3
+ Vertical timeline: a connecting line runs down the entries and each slotted
4
+ `timeline-entry` places a dot on it. This is a thin layout and semantics
5
+ wrapper — the entries draw the line segments and dots themselves, so the
6
+ container adds no gap between them (a gap would break the line). Exposed to
7
+ assistive technology as a list of events.
8
+
9
+ `layout` chooses where the line runs. `left` (the default) puts it down the
10
+ left edge with each entry's label inline beside its headline. `alternating`
11
+ centers it and gives each entry three columns — label, line, body — with the
12
+ two sides swapping on every second entry, for a presentation timeline rather
13
+ than an event log.
14
+
15
+ The layout is pushed onto each entry rather than read from here, because a
16
+ shadow-DOM child cannot style itself against an ancestor portably —
17
+ `:host-context()` is Chromium-only.
8
18
 
9
19
  ## Install
10
20
 
@@ -29,11 +39,25 @@ import "@f-ewald/components/timeline-container.js";
29
39
  <chat-message role="user" author="Freddy">Ship it.</chat-message>
30
40
  </timeline-entry>
31
41
  </timeline-container>
42
+
43
+ <!-- A presentation timeline: centered line, label and body swapping sides. -->
44
+ <timeline-container layout="alternating">
45
+ <timeline-entry label="1987">
46
+ <span slot="headline">Where it started</span>
47
+ A first stop, with the label on the left.
48
+ </timeline-entry>
49
+ <timeline-entry label="2004">
50
+ <span slot="headline">The question</span>
51
+ The second entry mirrors the first.
52
+ </timeline-entry>
53
+ </timeline-container>
32
54
  ```
33
55
 
34
56
  ## Attributes / properties
35
57
 
36
- _None._
58
+ | Property | Attribute | Type | Default | Description |
59
+ | --- | --- | --- | --- | --- |
60
+ | `layout` | `layout` | `TimelineLayout` | `"left"` | Arrangement of the entries: a left-edge line, or a centered alternating one. |
37
61
 
38
62
  ## Events
39
63
 
@@ -11,6 +11,19 @@ exactly at the first and last dots. Only meaningful inside a
11
11
  timestamp prop (e.g. `chat-message`'s `timestamp`) should leave it unset —
12
12
  setting both renders the same time twice.
13
13
 
14
+ `label` is a free-text alternative for a timeline whose axis is not a wall
15
+ clock — a year, an era, a phase. It wins over `datetime` when both are set.
16
+ Slot `label` instead when it needs its own styling, since a property is
17
+ rendered inside this component's shadow DOM and cannot be reached from
18
+ outside.
19
+
20
+ `alternating` is set by `timeline-container` and should not be set by hand:
21
+ it switches the entry to three columns — label, line, body — with the sides
22
+ swapping on every second entry. The entry fills whatever height it is given,
23
+ so the line spans it rather than only its content — do not override the
24
+ host's `display` from outside, since a light-DOM rule beats the `:host`
25
+ declaration this relies on.
26
+
14
27
  The dot's `color` types the entry using the shared status-pill palette —
15
28
  `primary` by default, plus `neutral`, `info`, `success`, `warning`, and
16
29
  `danger`.
@@ -42,6 +55,8 @@ import "@f-ewald/components/timeline-entry.js";
42
55
  | Property | Attribute | Type | Default | Description |
43
56
  | --- | --- | --- | --- | --- |
44
57
  | `datetime` | `datetime` | `string | null` | `null` | ISO 8601 or SQLite datetime string, rendered as a relative time. |
58
+ | `label` | `label` | `string | null` | `null` | Free-text label shown in place of the relative time; wins over `datetime`. |
59
+ | `alternating` | `alternating` | `boolean` | `false` | Three-column alternating presentation. Set by `timeline-container` from its own `layout`; setting it directly is not supported. |
45
60
  | `color` | `color` | `StatusPillColor` | `"primary"` | Visual type of the entry's dot, from the shared status-pill palette: `primary` (default), `neutral`, `info`, `success`, `warning`, or `danger`. |
46
61
  | `compact` | `compact` | `boolean` | `false` | Dense, one-line presentation for system-status entries: tighter vertical spacing and smaller, muted content. |
47
62
  | `running` | `running` | `boolean` | `false` | Shows an animated ring spinner in place of the dot, indicating the entry represents in-progress work. Overrides `color` while set — the spinner always uses the muted/gray palette. |
@@ -62,7 +77,9 @@ _None._
62
77
  | `--ui-danger` |
63
78
  | `--ui-font` |
64
79
  | `--ui-font-size` |
80
+ | `--ui-font-size-lg` |
65
81
  | `--ui-font-size-sm` |
82
+ | `--ui-font-weight-medium` |
66
83
  | `--ui-font-weight-semibold` |
67
84
  | `--ui-info` |
68
85
  | `--ui-line-height-normal` |
@@ -72,4 +89,5 @@ _None._
72
89
  | `--ui-surface` |
73
90
  | `--ui-text` |
74
91
  | `--ui-text-muted` |
92
+ | `--ui-tracking-wide` |
75
93
  | `--ui-warning` |