@f-ewald/components 1.40.2 → 1.41.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.
Files changed (106) hide show
  1. package/README.md +11 -3
  2. package/custom-elements.json +788 -97
  3. package/dist/app-shell.js +1 -1
  4. package/dist/app-shell.js.map +1 -1
  5. package/dist/blink-cursor.d.ts +27 -0
  6. package/dist/blink-cursor.d.ts.map +1 -0
  7. package/dist/blink-cursor.js +78 -0
  8. package/dist/blink-cursor.js.map +1 -0
  9. package/dist/button-group.d.ts.map +1 -1
  10. package/dist/button-group.js +3 -0
  11. package/dist/button-group.js.map +1 -1
  12. package/dist/calendar-day.d.ts.map +1 -1
  13. package/dist/calendar-day.js +5 -0
  14. package/dist/calendar-day.js.map +1 -1
  15. package/dist/calendar-week.d.ts.map +1 -1
  16. package/dist/calendar-week.js +5 -0
  17. package/dist/calendar-week.js.map +1 -1
  18. package/dist/code-diff.d.ts +41 -0
  19. package/dist/code-diff.d.ts.map +1 -0
  20. package/dist/code-diff.js +161 -0
  21. package/dist/code-diff.js.map +1 -0
  22. package/dist/comment-label.d.ts +26 -0
  23. package/dist/comment-label.d.ts.map +1 -0
  24. package/dist/comment-label.js +81 -0
  25. package/dist/comment-label.js.map +1 -0
  26. package/dist/confirm-dialog.d.ts +12 -6
  27. package/dist/confirm-dialog.d.ts.map +1 -1
  28. package/dist/confirm-dialog.js +50 -88
  29. package/dist/confirm-dialog.js.map +1 -1
  30. package/dist/frame-box.d.ts.map +1 -1
  31. package/dist/frame-box.js +4 -0
  32. package/dist/frame-box.js.map +1 -1
  33. package/dist/index.d.ts +8 -1
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +8 -1
  36. package/dist/index.js.map +1 -1
  37. package/dist/mcp-server.js +1 -1
  38. package/dist/mcp-server.js.map +1 -1
  39. package/dist/modal-dialog.d.ts +16 -13
  40. package/dist/modal-dialog.d.ts.map +1 -1
  41. package/dist/modal-dialog.js +69 -104
  42. package/dist/modal-dialog.js.map +1 -1
  43. package/dist/photo-gallery.js +1 -1
  44. package/dist/photo-gallery.js.map +1 -1
  45. package/dist/price-history-chart.js +1 -1
  46. package/dist/price-history-chart.js.map +1 -1
  47. package/dist/progress-bar.d.ts.map +1 -1
  48. package/dist/progress-bar.js +23 -17
  49. package/dist/progress-bar.js.map +1 -1
  50. package/dist/radio-pills.d.ts.map +1 -1
  51. package/dist/radio-pills.js +3 -0
  52. package/dist/radio-pills.js.map +1 -1
  53. package/dist/slide-panel.d.ts +3 -3
  54. package/dist/slide-panel.d.ts.map +1 -1
  55. package/dist/slide-panel.js +38 -22
  56. package/dist/slide-panel.js.map +1 -1
  57. package/dist/stat-strip.d.ts +30 -0
  58. package/dist/stat-strip.d.ts.map +1 -0
  59. package/dist/stat-strip.js +111 -0
  60. package/dist/stat-strip.js.map +1 -0
  61. package/dist/step-ladder.d.ts +46 -0
  62. package/dist/step-ladder.d.ts.map +1 -0
  63. package/dist/step-ladder.js +175 -0
  64. package/dist/step-ladder.js.map +1 -0
  65. package/dist/terminal-block.d.ts +45 -0
  66. package/dist/terminal-block.d.ts.map +1 -0
  67. package/dist/terminal-block.js +113 -0
  68. package/dist/terminal-block.js.map +1 -0
  69. package/dist/tile-grid.d.ts.map +1 -1
  70. package/dist/tile-grid.js +3 -0
  71. package/dist/tile-grid.js.map +1 -1
  72. package/dist/toast-notification.d.ts +7 -0
  73. package/dist/toast-notification.d.ts.map +1 -1
  74. package/dist/toast-notification.js +34 -0
  75. package/dist/toast-notification.js.map +1 -1
  76. package/dist/tokens.css +60 -1
  77. package/dist/tokens.d.ts +58 -0
  78. package/dist/tokens.d.ts.map +1 -1
  79. package/dist/tokens.js +135 -0
  80. package/dist/tokens.js.map +1 -1
  81. package/dist/ui-button.js +2 -2
  82. package/dist/ui-button.js.map +1 -1
  83. package/dist/window-chrome.d.ts +34 -0
  84. package/dist/window-chrome.d.ts.map +1 -0
  85. package/dist/window-chrome.js +141 -0
  86. package/dist/window-chrome.js.map +1 -0
  87. package/docs/app-shell.md +1 -1
  88. package/docs/blink-cursor.md +45 -0
  89. package/docs/code-diff.md +64 -0
  90. package/docs/comment-label.md +49 -0
  91. package/docs/confirm-dialog.md +4 -3
  92. package/docs/design-language.md +80 -28
  93. package/docs/layouts/marketing-landing.md +102 -0
  94. package/docs/modal-dialog.md +9 -9
  95. package/docs/photo-gallery.md +1 -1
  96. package/docs/price-history-chart.md +1 -0
  97. package/docs/radio-pills.md +1 -0
  98. package/docs/slide-panel.md +2 -2
  99. package/docs/stat-strip.md +57 -0
  100. package/docs/step-ladder.md +63 -0
  101. package/docs/terminal-block.md +69 -0
  102. package/docs/tile-grid.md +1 -0
  103. package/docs/ui-button.md +2 -0
  104. package/docs/window-chrome.md +64 -0
  105. package/llms.txt +227 -20
  106. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"modal-dialog.d.ts","sourceRoot":"","sources":["../src/modal-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAM1E,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,IAAI,GAAG,YAAY,CAAC;AAE9D;;;;;;;;;;;;;;;GAeG;AACH,qBACa,WAAY,SAAQ,UAAU;IACzC,OAAgB,MAAM,4BAoHpB;IAEF,qCAAqC;IACR,IAAI,UAAS;IAC1C,4EAA4E;IAChE,OAAO,SAAM;IACzB;;;;OAIG;IACS,IAAI,EAAE,eAAe,CAAa;IAC9C,oHAAoH;IACvF,WAAW,UAAS;IAEjD,OAAO,CAAC,cAAc,CAA4B;IAElD,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,kBAAkB,CAGxB;IAEF,OAAO,CAAC,gBAAgB,CAuBtB;IAEF,OAAO,CAAC,eAAe,CAErB;IAEF,UAAmB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAexD;IAEQ,oBAAoB,IAAI,IAAI,CAQpC;IAEQ,MAAM,yCA6Bd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
1
+ {"version":3,"file":"modal-dialog.d.ts","sourceRoot":"","sources":["../src/modal-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAM1E,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,IAAI,GAAG,YAAY,CAAC;AAE9D;;;;;;;;;;;;;;;GAeG;AACH,qBACa,WAAY,SAAQ,UAAU;IACzC,OAAgB,MAAM,4BAgHpB;IAEF,qCAAqC;IACR,IAAI,UAAS;IAC1C,4EAA4E;IAChE,OAAO,SAAM;IACzB;;;;OAIG;IACS,IAAI,EAAE,eAAe,CAAa;IAC9C,oHAAoH;IACvF,WAAW,UAAS;IAEhC,OAAO,CAAC,OAAO,CAAqB;IAErD,OAAO,CAAC,MAAM;IAId,qGAAqG;IACrG,OAAO,CAAC,aAAa;IAMrB,mGAAmG;IACnG,OAAO,CAAC,gBAAgB,CAEtB;IAEF,8GAA8G;IAC9G,OAAO,CAAC,SAAS,CAGf;IAEF,yFAAyF;IACzF,OAAO,CAAC,cAAc,CAMpB;IAEF,UAAmB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAYxD;IAEQ,oBAAoB,IAAI,IAAI,CAKpC;IAEQ,MAAM,yCAuBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
@@ -5,20 +5,20 @@ 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, nothing } from "lit";
8
- import { customElement, property } from "lit/decorators.js";
8
+ import { customElement, property, query } from "lit/decorators.js";
9
9
  import { iconX } from "./icons.js";
10
10
  import { tokens } from "./tokens.js";
11
11
  import { activateLayer, claimEscape, deactivateLayer, isTopLayer } from "./utils/layer-stack.js";
12
12
  /**
13
- * Generic centered modal-dialog shell: overlay + card with header chrome, a
14
- * close button, and an arbitrary slotted body — the modal sibling to
15
- * `slide-panel` (fixed-edge) and `popover-panel` (anchored). Unlike
16
- * `confirm-dialog`, it has no baked-in actions; the consumer supplies the
17
- * body content (a form, a read-only viewer, a table) and any footer buttons
18
- * itself. Instant `display:none` → `display:flex` toggle, no transition.
19
- * Traps focus, closes on Escape, and restores focus to the trigger on
20
- * close, stacking correctly against other open `confirm-dialog`/
21
- * `slide-panel`/`popover-panel`/`modal-dialog` layers.
13
+ * Generic centered modal-dialog shell: a native modal `<dialog>` card with
14
+ * header chrome, a close button, and an arbitrary slotted body — the modal
15
+ * sibling to `slide-panel` (fixed-edge) and `popover-panel` (anchored).
16
+ * Unlike `confirm-dialog`, it has no baked-in actions; the consumer supplies
17
+ * the body content (a form, a read-only viewer, a table) and any footer
18
+ * buttons itself. Instant open/close, no transition. Because it uses
19
+ * `showModal()`, it renders in the browser's top layer, makes the rest of the
20
+ * page inert, contains focus, and restores focus to the trigger on close;
21
+ * Escape is routed to the topmost layer only (see `utils/layer-stack`).
22
22
  *
23
23
  * @element modal-dialog
24
24
  * @fires panel-close - User clicked the close (✕) button, pressed Escape, or (when `dismissible`) clicked the backdrop.
@@ -40,65 +40,38 @@ let ModalDialog = class ModalDialog extends LitElement {
40
40
  this.size = "default";
41
41
  /** When true, clicking the backdrop also closes the dialog (off by default — safe for forms with unsaved input). */
42
42
  this.dismissible = false;
43
- this._previousFocus = null;
44
- this._onDocumentFocusIn = (event) => {
45
- if (!this.open || !isTopLayer(this) || event.composedPath().includes(this))
46
- return;
47
- this._focusInitial();
48
- };
43
+ /** Escape goes to the topmost layer only (a popover opened inside this dialog claims it first). */
49
44
  this._onWindowKeydown = (event) => {
50
- if (!this.open || !isTopLayer(this))
51
- return;
52
- if (claimEscape(this, event)) {
45
+ if (this.open && claimEscape(this, event))
46
+ this._close();
47
+ };
48
+ /** Native close requests (e.g. a back gesture) are routed through `panel-close`; the consumer owns `open`. */
49
+ this._onCancel = (event) => {
50
+ event.preventDefault();
51
+ if (this.open && isTopLayer(this))
53
52
  this._close();
54
- return;
55
- }
56
- if (event.key !== "Tab")
57
- return;
58
- const focusable = this._getFocusableElements();
59
- if (focusable.length === 0) {
60
- event.preventDefault();
61
- this._focusInitial();
62
- return;
63
- }
64
- const active = (this.shadowRoot?.activeElement ?? document.activeElement);
65
- const index = focusable.indexOf(active);
66
- if (event.shiftKey && index <= 0) {
67
- event.preventDefault();
68
- focusable.at(-1)?.focus();
69
- }
70
- else if (!event.shiftKey && index === focusable.length - 1) {
71
- event.preventDefault();
72
- focusable[0]?.focus();
73
- }
74
53
  };
75
- this._onOverlayClick = (event) => {
76
- if (this.dismissible && event.target === event.currentTarget)
54
+ /** A click that lands on the `<dialog>` itself, outside its box, is a backdrop click. */
55
+ this._onDialogClick = (event) => {
56
+ if (!this.dismissible || event.target !== event.currentTarget)
57
+ return;
58
+ const box = this._dialog.getBoundingClientRect();
59
+ const outside = event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;
60
+ if (outside)
77
61
  this._close();
78
62
  };
79
63
  }
80
64
  static { this.styles = [
81
65
  tokens,
82
66
  css `
83
- .overlay {
67
+ .dialog {
68
+ /* Native modal <dialog>: top layer, inert page behind it, built-in focus containment. */
84
69
  position: fixed;
85
- inset: 0;
86
- background: var(--ui-overlay, rgb(15 23 42 / 0.45));
87
- z-index: var(--component-layer-z, 50);
88
- display: none;
89
- align-items: flex-start;
90
- justify-content: center;
91
- padding: 10vh 1.25rem 1.25rem;
92
- box-sizing: border-box;
93
- }
94
- .overlay.open {
95
- display: flex;
96
- }
97
- .overlay.fullscreen {
70
+ inset: 0 0 auto 0;
71
+ margin: 10vh auto 0;
98
72
  padding: 0;
99
- align-items: stretch;
100
- }
101
- .dialog {
73
+ border: 0;
74
+ color: inherit;
102
75
  background: var(--ui-surface, #ffffff);
103
76
  border-radius: var(--ui-radius, 0.5rem);
104
77
  box-shadow: var(
@@ -109,16 +82,24 @@ let ModalDialog = class ModalDialog extends LitElement {
109
82
  width: 100%;
110
83
  max-width: min(25rem, calc(100vw - 2rem));
111
84
  max-height: calc(100vh - 10vh - 1.25rem);
112
- display: flex;
113
- flex-direction: column;
114
85
  overflow: hidden;
115
86
  box-sizing: border-box;
116
87
  outline: none;
117
88
  }
89
+ /* Scoped to [open]: an author display value would otherwise defeat the UA's display:none. */
90
+ .dialog[open] {
91
+ display: flex;
92
+ flex-direction: column;
93
+ }
94
+ .dialog::backdrop {
95
+ background: var(--ui-overlay, rgb(15 23 42 / 0.45));
96
+ }
118
97
  .dialog.lg {
119
98
  max-width: min(60rem, calc(100vw - 2rem));
120
99
  }
121
100
  .dialog.fullscreen {
101
+ inset: 0;
102
+ margin: 0;
122
103
  width: 100vw;
123
104
  height: 100vh;
124
105
  max-width: 100vw;
@@ -187,9 +168,8 @@ let ModalDialog = class ModalDialog extends LitElement {
187
168
  }
188
169
  }
189
170
  @media (max-width: 48rem) {
190
- .overlay {
191
- padding: 0.75rem;
192
- overflow-y: auto;
171
+ .dialog {
172
+ margin-top: 0.75rem;
193
173
  }
194
174
  }
195
175
  `,
@@ -197,74 +177,56 @@ let ModalDialog = class ModalDialog extends LitElement {
197
177
  _close() {
198
178
  this.dispatchEvent(new CustomEvent("panel-close", { bubbles: true, composed: true }));
199
179
  }
200
- _getFocusableElements() {
201
- const selector = "a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex='-1'])";
202
- const slotted = Array.from(this.querySelectorAll(selector));
203
- const internal = Array.from(this.shadowRoot?.querySelectorAll(selector) ?? []).filter((element) => element.closest(".dialog") !== null);
204
- return [...slotted, ...internal].filter((element) => !element.hasAttribute("hidden"));
205
- }
180
+ /** Native focus delegation doesn't reliably reach slotted light-DOM content, so focus explicitly. */
206
181
  _focusInitial() {
207
182
  const autofocus = this.querySelector("[autofocus]");
208
183
  const close = this.shadowRoot?.querySelector(".close-btn");
209
- const dialog = this.shadowRoot?.querySelector(".dialog");
210
- (autofocus ?? close ?? this._getFocusableElements()[0] ?? dialog)?.focus();
184
+ (autofocus ?? close)?.focus();
211
185
  }
212
186
  updated(changed) {
213
187
  if (!changed.has("open"))
214
188
  return;
215
189
  if (this.open) {
216
190
  activateLayer(this);
217
- this._previousFocus = document.activeElement;
218
- document.addEventListener("focusin", this._onDocumentFocusIn, true);
219
191
  window.addEventListener("keydown", this._onWindowKeydown, true);
192
+ if (!this._dialog.open)
193
+ this._dialog.showModal();
220
194
  this._focusInitial();
221
195
  return;
222
196
  }
223
197
  deactivateLayer(this);
224
- document.removeEventListener("focusin", this._onDocumentFocusIn, true);
225
198
  window.removeEventListener("keydown", this._onWindowKeydown, true);
226
- if (this._previousFocus?.isConnected)
227
- this._previousFocus.focus();
228
- this._previousFocus = null;
199
+ if (this._dialog.open)
200
+ this._dialog.close();
229
201
  }
230
202
  disconnectedCallback() {
231
203
  super.disconnectedCallback();
232
- document.removeEventListener("focusin", this._onDocumentFocusIn, true);
233
204
  window.removeEventListener("keydown", this._onWindowKeydown, true);
234
205
  deactivateLayer(this);
235
- if (this._previousFocus?.isConnected)
236
- this._previousFocus.focus();
237
- this._previousFocus = null;
238
206
  this.open = false;
239
207
  }
240
208
  render() {
241
209
  const explicitLabel = this.getAttribute("aria-label");
242
210
  return html `
243
- <div
244
- class="overlay ${this.open ? "open" : ""} ${this.size === "fullscreen" ? "fullscreen" : ""}"
245
- @click=${this._onOverlayClick}
211
+ <dialog
212
+ class="dialog ${this.size === "lg" ? "lg" : this.size === "fullscreen" ? "fullscreen" : ""}"
213
+ aria-label=${explicitLabel ?? nothing}
214
+ aria-labelledby=${explicitLabel ? nothing : "dialog-title"}
215
+ @click=${this._onDialogClick}
216
+ @cancel=${this._onCancel}
246
217
  >
247
- <div
248
- class="dialog ${this.size === "lg" ? "lg" : this.size === "fullscreen" ? "fullscreen" : ""}"
249
- role="dialog"
250
- aria-modal="true"
251
- aria-label=${explicitLabel ?? nothing}
252
- aria-labelledby=${explicitLabel ? nothing : "dialog-title"}
253
- tabindex="-1"
254
- >
255
- <div class="dialog-header">
256
- <span id="dialog-title" class="dialog-title">
257
- <slot name="title">${this.heading}</slot>
258
- </span>
259
- <button class="close-btn" aria-label="Close" @click=${this._close}>
260
- <span aria-hidden="true">${iconX(18)}</span>
261
- </button>
262
- </div>
263
- <div class="body">
264
- <slot></slot>
265
- </div>
218
+ <div class="dialog-header">
219
+ <span id="dialog-title" class="dialog-title">
220
+ <slot name="title">${this.heading}</slot>
221
+ </span>
222
+ <button class="close-btn" aria-label="Close" @click=${this._close}>
223
+ <span aria-hidden="true">${iconX(18)}</span>
224
+ </button>
225
+ </div>
226
+ <div class="body">
227
+ <slot></slot>
266
228
  </div>
267
- </div>
229
+ </dialog>
268
230
  `;
269
231
  }
270
232
  };
@@ -280,6 +242,9 @@ __decorate([
280
242
  __decorate([
281
243
  property({ type: Boolean })
282
244
  ], ModalDialog.prototype, "dismissible", void 0);
245
+ __decorate([
246
+ query("dialog")
247
+ ], ModalDialog.prototype, "_dialog", void 0);
283
248
  ModalDialog = __decorate([
284
249
  customElement("modal-dialog")
285
250
  ], ModalDialog);
@@ -1 +1 @@
1
- {"version":3,"file":"modal-dialog.js","sourceRoot":"","sources":["../src/modal-dialog.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,WAAW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;;;uBAG7E,aAAa,IAAI,OAAO;4BACnB,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc;;;;;mCAKjC,IAAI,CAAC,OAAO;;kEAEmB,IAAI,CAAC,MAAM;yCACpC,KAAK,CAAC,EAAE,CAAC;;;;;;;;KAQ7C,CAAC;IACJ,CAAC;CACF,CAAA;AA9H8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCAAc;AAE9B;IAAX,QAAQ,EAAE;4CAAc;AAMb;IAAX,QAAQ,EAAE;yCAAmC;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAqB;AAlItC,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAsPvB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconX } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport { activateLayer, claimEscape, deactivateLayer, isTopLayer } from \"./utils/layer-stack.js\";\n\nexport type ModalDialogSize = \"default\" | \"lg\" | \"fullscreen\";\n\n/**\n * Generic centered modal-dialog shell: overlay + card with header chrome, a\n * close button, and an arbitrary slotted body — the modal sibling to\n * `slide-panel` (fixed-edge) and `popover-panel` (anchored). Unlike\n * `confirm-dialog`, it has no baked-in actions; the consumer supplies the\n * body content (a form, a read-only viewer, a table) and any footer buttons\n * itself. Instant `display:none` → `display:flex` toggle, no transition.\n * Traps focus, closes on Escape, and restores focus to the trigger on\n * close, stacking correctly against other open `confirm-dialog`/\n * `slide-panel`/`popover-panel`/`modal-dialog` layers.\n *\n * @element modal-dialog\n * @fires panel-close - User clicked the close (✕) button, pressed Escape, or (when `dismissible`) clicked the backdrop.\n * @slot - Dialog body content.\n * @slot title - Overrides the header title text (falls back to the `heading` property).\n */\n@customElement(\"modal-dialog\")\nexport class ModalDialog extends LitElement {\n static override styles = [\n tokens,\n css`\n .overlay {\n position: fixed;\n inset: 0;\n background: var(--ui-overlay, rgb(15 23 42 / 0.45));\n z-index: var(--component-layer-z, 50);\n display: none;\n align-items: flex-start;\n justify-content: center;\n padding: 10vh 1.25rem 1.25rem;\n box-sizing: border-box;\n }\n .overlay.open {\n display: flex;\n }\n .overlay.fullscreen {\n padding: 0;\n align-items: stretch;\n }\n .dialog {\n background: var(--ui-surface, #ffffff);\n border-radius: var(--ui-radius, 0.5rem);\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n width: 100%;\n max-width: min(25rem, calc(100vw - 2rem));\n max-height: calc(100vh - 10vh - 1.25rem);\n display: flex;\n flex-direction: column;\n overflow: hidden;\n box-sizing: border-box;\n outline: none;\n }\n .dialog.lg {\n max-width: min(60rem, calc(100vw - 2rem));\n }\n .dialog.fullscreen {\n width: 100vw;\n height: 100vh;\n max-width: 100vw;\n max-height: 100vh;\n border-radius: 0;\n }\n .dialog-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.75rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n flex: 0 0 auto;\n }\n .dialog-title {\n font-weight: var(--ui-font-weight-semibold, 600);\n font-size: var(--ui-font-size-lg, 1rem);\n line-height: var(--ui-line-height-tight, 1.25);\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 color: var(--ui-text, #0f172a);\n flex: 1 1 auto;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n padding-right: 0.5rem;\n }\n .close-btn {\n background: none;\n border: none;\n cursor: pointer;\n width: 2rem;\n height: 2rem;\n padding: 0;\n color: var(--ui-text-muted, #64748b);\n border-radius: var(--ui-radius-sm, 0.25rem);\n flex: 0 0 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n }\n .close-btn:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .close-btn:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .body {\n overflow-y: auto;\n flex: 1 1 auto;\n }\n @media (forced-colors: active) {\n .close-btn:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n @media (max-width: 48rem) {\n .overlay {\n padding: 0.75rem;\n overflow-y: auto;\n }\n }\n `,\n ];\n\n /** Whether the dialog is visible. */\n @property({ type: Boolean }) open = false;\n /** Title text shown in the dialog header (overridable via slot=\"title\"). */\n @property() heading = \"\";\n /**\n * `\"lg\"` widens the dialog to 60rem for content like tables; `\"default\"`\n * is 25rem; `\"fullscreen\"` covers the entire viewport edge-to-edge with\n * no border-radius or overlay padding.\n */\n @property() size: ModalDialogSize = \"default\";\n /** When true, clicking the backdrop also closes the dialog (off by default — safe for forms with unsaved input). */\n @property({ type: Boolean }) dismissible = false;\n\n private _previousFocus: HTMLElement | null = null;\n\n private _close() {\n this.dispatchEvent(new CustomEvent(\"panel-close\", { bubbles: true, composed: true }));\n }\n\n private _getFocusableElements(): HTMLElement[] {\n const selector =\n \"a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex='-1'])\";\n const slotted = Array.from(this.querySelectorAll<HTMLElement>(selector));\n const internal = Array.from(\n this.shadowRoot?.querySelectorAll<HTMLElement>(selector) ?? [],\n ).filter((element) => element.closest(\".dialog\") !== null);\n return [...slotted, ...internal].filter((element) => !element.hasAttribute(\"hidden\"));\n }\n\n private _focusInitial(): void {\n const autofocus = this.querySelector<HTMLElement>(\"[autofocus]\");\n const close = this.shadowRoot?.querySelector<HTMLElement>(\".close-btn\");\n const dialog = this.shadowRoot?.querySelector<HTMLElement>(\".dialog\");\n (autofocus ?? close ?? this._getFocusableElements()[0] ?? dialog)?.focus();\n }\n\n private _onDocumentFocusIn = (event: FocusEvent): void => {\n if (!this.open || !isTopLayer(this) || event.composedPath().includes(this)) return;\n this._focusInitial();\n };\n\n private _onWindowKeydown = (event: KeyboardEvent): void => {\n if (!this.open || !isTopLayer(this)) return;\n if (claimEscape(this, event)) {\n this._close();\n return;\n }\n if (event.key !== \"Tab\") return;\n\n const focusable = this._getFocusableElements();\n if (focusable.length === 0) {\n event.preventDefault();\n this._focusInitial();\n return;\n }\n const active = (this.shadowRoot?.activeElement ?? document.activeElement) as HTMLElement | null;\n const index = focusable.indexOf(active as HTMLElement);\n if (event.shiftKey && index <= 0) {\n event.preventDefault();\n focusable.at(-1)?.focus();\n } else if (!event.shiftKey && index === focusable.length - 1) {\n event.preventDefault();\n focusable[0]?.focus();\n }\n };\n\n private _onOverlayClick = (event: MouseEvent): void => {\n if (this.dismissible && event.target === event.currentTarget) this._close();\n };\n\n protected override updated(changed: PropertyValues): void {\n if (!changed.has(\"open\")) return;\n if (this.open) {\n activateLayer(this);\n this._previousFocus = document.activeElement as HTMLElement | null;\n document.addEventListener(\"focusin\", this._onDocumentFocusIn, true);\n window.addEventListener(\"keydown\", this._onWindowKeydown, true);\n this._focusInitial();\n return;\n }\n deactivateLayer(this);\n document.removeEventListener(\"focusin\", this._onDocumentFocusIn, true);\n window.removeEventListener(\"keydown\", this._onWindowKeydown, true);\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener(\"focusin\", this._onDocumentFocusIn, true);\n window.removeEventListener(\"keydown\", this._onWindowKeydown, true);\n deactivateLayer(this);\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n this.open = false;\n }\n\n override render() {\n const explicitLabel = this.getAttribute(\"aria-label\");\n return html`\n <div\n class=\"overlay ${this.open ? \"open\" : \"\"} ${this.size === \"fullscreen\" ? \"fullscreen\" : \"\"}\"\n @click=${this._onOverlayClick}\n >\n <div\n class=\"dialog ${this.size === \"lg\" ? \"lg\" : this.size === \"fullscreen\" ? \"fullscreen\" : \"\"}\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=${explicitLabel ?? nothing}\n aria-labelledby=${explicitLabel ? nothing : \"dialog-title\"}\n tabindex=\"-1\"\n >\n <div class=\"dialog-header\">\n <span id=\"dialog-title\" class=\"dialog-title\">\n <slot name=\"title\">${this.heading}</slot>\n </span>\n <button class=\"close-btn\" aria-label=\"Close\" @click=${this._close}>\n <span aria-hidden=\"true\">${iconX(18)}</span>\n </button>\n </div>\n <div class=\"body\">\n <slot></slot>\n </div>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"modal-dialog\": ModalDialog;\n }\n}\n"]}
1
+ {"version":3,"file":"modal-dialog.js","sourceRoot":"","sources":["../src/modal-dialog.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIjG;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QAmHL,qCAAqC;QACR,SAAI,GAAG,KAAK,CAAC;QAC1C,4EAA4E;QAChE,YAAO,GAAG,EAAE,CAAC;QACzB;;;;WAIG;QACS,SAAI,GAAoB,SAAS,CAAC;QAC9C,oHAAoH;QACvF,gBAAW,GAAG,KAAK,CAAC;QAejD,mGAAmG;QAC3F,qBAAgB,GAAG,CAA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,OAAO,IAAI,CAAA;;wBAES,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE;qBAC7E,aAAa,IAAI,OAAO;0BACnB,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc;iBACjD,IAAI,CAAC,cAAc;kBAClB,IAAI,CAAC,SAAS;;;;iCAIC,IAAI,CAAC,OAAO;;gEAEmB,IAAI,CAAC,MAAM;uCACpC,KAAK,CAAC,EAAE,CAAC;;;;;;;KAO3C,CAAC;IACJ,CAAC;CACF,CAAA;AA1F8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCAAc;AAE9B;IAAX,QAAQ,EAAE;4CAAc;AAMb;IAAX,QAAQ,EAAE;yCAAmC;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAqB;AAExB;IAAxB,KAAK,CAAC,QAAQ,CAAC;4CAAqC;AAhI1C,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA8MvB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property, query } from \"lit/decorators.js\";\nimport { iconX } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport { activateLayer, claimEscape, deactivateLayer, isTopLayer } from \"./utils/layer-stack.js\";\n\nexport type ModalDialogSize = \"default\" | \"lg\" | \"fullscreen\";\n\n/**\n * Generic centered modal-dialog shell: a native modal `<dialog>` card with\n * header chrome, a close button, and an arbitrary slotted body — the modal\n * sibling to `slide-panel` (fixed-edge) and `popover-panel` (anchored).\n * Unlike `confirm-dialog`, it has no baked-in actions; the consumer supplies\n * the body content (a form, a read-only viewer, a table) and any footer\n * buttons itself. Instant open/close, no transition. Because it uses\n * `showModal()`, it renders in the browser's top layer, makes the rest of the\n * page inert, contains focus, and restores focus to the trigger on close;\n * Escape is routed to the topmost layer only (see `utils/layer-stack`).\n *\n * @element modal-dialog\n * @fires panel-close - User clicked the close (✕) button, pressed Escape, or (when `dismissible`) clicked the backdrop.\n * @slot - Dialog body content.\n * @slot title - Overrides the header title text (falls back to the `heading` property).\n */\n@customElement(\"modal-dialog\")\nexport class ModalDialog extends LitElement {\n static override styles = [\n tokens,\n css`\n .dialog {\n /* Native modal <dialog>: top layer, inert page behind it, built-in focus containment. */\n position: fixed;\n inset: 0 0 auto 0;\n margin: 10vh auto 0;\n padding: 0;\n border: 0;\n color: inherit;\n background: var(--ui-surface, #ffffff);\n border-radius: var(--ui-radius, 0.5rem);\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n width: 100%;\n max-width: min(25rem, calc(100vw - 2rem));\n max-height: calc(100vh - 10vh - 1.25rem);\n overflow: hidden;\n box-sizing: border-box;\n outline: none;\n }\n /* Scoped to [open]: an author display value would otherwise defeat the UA's display:none. */\n .dialog[open] {\n display: flex;\n flex-direction: column;\n }\n .dialog::backdrop {\n background: var(--ui-overlay, rgb(15 23 42 / 0.45));\n }\n .dialog.lg {\n max-width: min(60rem, calc(100vw - 2rem));\n }\n .dialog.fullscreen {\n inset: 0;\n margin: 0;\n width: 100vw;\n height: 100vh;\n max-width: 100vw;\n max-height: 100vh;\n border-radius: 0;\n }\n .dialog-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.75rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n flex: 0 0 auto;\n }\n .dialog-title {\n font-weight: var(--ui-font-weight-semibold, 600);\n font-size: var(--ui-font-size-lg, 1rem);\n line-height: var(--ui-line-height-tight, 1.25);\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 color: var(--ui-text, #0f172a);\n flex: 1 1 auto;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n padding-right: 0.5rem;\n }\n .close-btn {\n background: none;\n border: none;\n cursor: pointer;\n width: 2rem;\n height: 2rem;\n padding: 0;\n color: var(--ui-text-muted, #64748b);\n border-radius: var(--ui-radius-sm, 0.25rem);\n flex: 0 0 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n }\n .close-btn:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .close-btn:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .body {\n overflow-y: auto;\n flex: 1 1 auto;\n }\n @media (forced-colors: active) {\n .close-btn:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n @media (max-width: 48rem) {\n .dialog {\n margin-top: 0.75rem;\n }\n }\n `,\n ];\n\n /** Whether the dialog is visible. */\n @property({ type: Boolean }) open = false;\n /** Title text shown in the dialog header (overridable via slot=\"title\"). */\n @property() heading = \"\";\n /**\n * `\"lg\"` widens the dialog to 60rem for content like tables; `\"default\"`\n * is 25rem; `\"fullscreen\"` covers the entire viewport edge-to-edge with\n * no border-radius or overlay padding.\n */\n @property() size: ModalDialogSize = \"default\";\n /** When true, clicking the backdrop also closes the dialog (off by default — safe for forms with unsaved input). */\n @property({ type: Boolean }) dismissible = false;\n\n @query(\"dialog\") private _dialog!: HTMLDialogElement;\n\n private _close() {\n this.dispatchEvent(new CustomEvent(\"panel-close\", { bubbles: true, composed: true }));\n }\n\n /** Native focus delegation doesn't reliably reach slotted light-DOM content, so focus explicitly. */\n private _focusInitial(): void {\n const autofocus = this.querySelector<HTMLElement>(\"[autofocus]\");\n const close = this.shadowRoot?.querySelector<HTMLElement>(\".close-btn\");\n (autofocus ?? close)?.focus();\n }\n\n /** Escape goes to the topmost layer only (a popover opened inside this dialog claims it first). */\n private _onWindowKeydown = (event: KeyboardEvent): void => {\n if (this.open && claimEscape(this, event)) this._close();\n };\n\n /** Native close requests (e.g. a back gesture) are routed through `panel-close`; the consumer owns `open`. */\n private _onCancel = (event: Event): void => {\n event.preventDefault();\n if (this.open && isTopLayer(this)) this._close();\n };\n\n /** A click that lands on the `<dialog>` itself, outside its box, is a backdrop click. */\n private _onDialogClick = (event: MouseEvent): void => {\n if (!this.dismissible || event.target !== event.currentTarget) return;\n const box = this._dialog.getBoundingClientRect();\n const outside =\n event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;\n if (outside) this._close();\n };\n\n protected override updated(changed: PropertyValues): void {\n if (!changed.has(\"open\")) return;\n if (this.open) {\n activateLayer(this);\n window.addEventListener(\"keydown\", this._onWindowKeydown, true);\n if (!this._dialog.open) this._dialog.showModal();\n this._focusInitial();\n return;\n }\n deactivateLayer(this);\n window.removeEventListener(\"keydown\", this._onWindowKeydown, true);\n if (this._dialog.open) this._dialog.close();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener(\"keydown\", this._onWindowKeydown, true);\n deactivateLayer(this);\n this.open = false;\n }\n\n override render() {\n const explicitLabel = this.getAttribute(\"aria-label\");\n return html`\n <dialog\n class=\"dialog ${this.size === \"lg\" ? \"lg\" : this.size === \"fullscreen\" ? \"fullscreen\" : \"\"}\"\n aria-label=${explicitLabel ?? nothing}\n aria-labelledby=${explicitLabel ? nothing : \"dialog-title\"}\n @click=${this._onDialogClick}\n @cancel=${this._onCancel}\n >\n <div class=\"dialog-header\">\n <span id=\"dialog-title\" class=\"dialog-title\">\n <slot name=\"title\">${this.heading}</slot>\n </span>\n <button class=\"close-btn\" aria-label=\"Close\" @click=${this._close}>\n <span aria-hidden=\"true\">${iconX(18)}</span>\n </button>\n </div>\n <div class=\"body\">\n <slot></slot>\n </div>\n </dialog>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"modal-dialog\": ModalDialog;\n }\n}\n"]}
@@ -159,7 +159,7 @@ let PhotoGallery = class PhotoGallery extends LitElement {
159
159
  width: 2rem;
160
160
  height: 2rem;
161
161
  padding: 0;
162
- color: var(--ui-on-accent, #ffffff);
162
+ color: var(--ui-overlay-text, #ffffff);
163
163
  background: var(--ui-overlay, rgb(15 23 42 / 0.45));
164
164
  border-radius: var(--ui-radius-pill, 9999px);
165
165
  pointer-events: auto;
@@ -1 +1 @@
1
- {"version":3,"file":"photo-gallery.js","sourceRoot":"","sources":["../src/photo-gallery.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAGvD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAoBrC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,gBAAgB,GAAG;IACvB,aAAa,CAAC,KAAoB;QAChC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,OAAO,CAAC;IAC7C,CAAC;CACF,CAAC;AAEF;;;;;;;;;;;GAWG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QACL,qCAAqC;QAErC,iBAAY,GAAG,CAAC,CAAC;QAEjB,0EAA0E;QAC9C,UAAK,GAAG,CAAC,CAAC;QAEtC,mDAAmD;QAEnD,iBAAY,GAAG,IAAI,CAAC;QAEpB,gDAAgD;Q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cAAc,EAAE,CAAC;iDACnC;AAIpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;oDACnC;AAIvB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,uBAAuB,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;yDACnD;AAI3B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAC5B;AAIf;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;iDACjB;AAIvB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;+CACK;AAG1B;IADhB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;mDACL;AAGvC;IADP,KAAK,EAAE;oDACqC;AAGrC;IADP,KAAK,EAAE;mDACkB;AA3Cf,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAupBxB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property, queryAssignedElements, state } from \"lit/decorators.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport type { GalleryItemVariant } from \"./gallery-item-variant.js\";\nimport { GalleryItem } from \"./gallery-item.js\";\nimport { iconChevronLeft, iconChevronRight } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport type PhotoGalleryObjectFit = \"cover\" | \"contain\";\nexport type PhotoGalleryChangeReason =\n | \"autoplay\"\n | \"indicator\"\n | \"items\"\n | \"keyboard\"\n | \"next\"\n | \"previous\"\n | \"programmatic\"\n | \"swipe\";\n\nexport interface PhotoGallerySlideChangeDetail {\n previousIndex: number;\n currentIndex: number;\n item: GalleryItem;\n reason: PhotoGalleryChangeReason;\n}\n\nconst transitionDurationMs = 250;\nconst swipeThresholdPx = 40;\nconst booleanAttribute = {\n fromAttribute(value: string | null): boolean {\n return value !== null && value !== \"false\";\n },\n};\n\n/**\n * Responsive, accessible image carousel composed from declarative\n * `gallery-item` children.\n *\n * The image viewport keeps a fixed `aspect-ratio`, and the caption row is\n * reserved for every slide whenever any slide has a caption, so the carousel's\n * total height stays constant as it cycles — it never shifts the page below it.\n *\n * @element photo-gallery\n * @slot - `gallery-item` elements rendered as slides.\n * @fires slide-change - The active image changed.\n */\n@customElement(\"photo-gallery\")\nexport class PhotoGallery extends LitElement {\n /** Zero-based active image index. */\n @property({ type: Number, attribute: \"current-index\", reflect: true })\n currentIndex = 0;\n\n /** Autoplay interval in milliseconds. Set to zero to disable autoplay. */\n @property({ type: Number }) delay = 0;\n\n /** Whether previous and next buttons are shown. */\n @property({ attribute: \"show-controls\", converter: booleanAttribute })\n showControls = true;\n\n /** Whether a current/total counter is shown. */\n @property({ type: Boolean, attribute: \"show-counter\" })\n showCounter = false;\n\n /** Whether clickable slide indicators are shown. */\n @property({ type: Boolean, attribute: \"show-indicators\" })\n showIndicators = false;\n\n /** Whether autoplay includes a built-in pause/play control. */\n @property({ attribute: \"show-autoplay-control\", converter: booleanAttribute })\n showAutoplayControl = true;\n\n /** Whether autoplay is explicitly paused. */\n @property({ type: Boolean, reflect: true })\n paused = false;\n\n /** CSS aspect ratio used by the image viewport. */\n @property({ attribute: \"aspect-ratio\" })\n aspectRatio = \"16 / 9\";\n\n /** How images fit within the stable viewport. */\n @property({ attribute: \"object-fit\" })\n objectFit: PhotoGalleryObjectFit = \"cover\";\n\n @queryAssignedElements({ selector: \"gallery-item\" })\n private readonly _galleryItems!: GalleryItem[];\n\n @state()\n private _previousIndex: number | null = null;\n\n @state()\n private _itemsVersion = 0;\n\n private _autoplayTimer?: number;\n private _transitionTimer?: number;\n private _metadataObserver?: MutationObserver;\n private _hovered = false;\n private _focusWithin = false;\n private _nextChangeReason: PhotoGalleryChangeReason | null = null;\n private _pendingChange?: PhotoGallerySlideChangeDetail;\n private _pointerStart?: { id: number; x: number; y: number };\n private _itemsChanged = false;\n private _activeItem?: GalleryItem;\n private _renderedIndex = 0;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n color: var(--ui-text, #0f172a);\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 font-size: var(--ui-font-size, 0.875rem);\n }\n .gallery {\n outline: none;\n }\n figure {\n margin: 0;\n }\n .viewport {\n position: relative;\n overflow: hidden;\n aspect-ratio: var(--photo-gallery-aspect-ratio, 16 / 9);\n border-radius: var(--ui-radius, 0.5rem);\n background: var(--ui-surface-muted, #f8fafc);\n touch-action: pan-y;\n user-select: none;\n }\n .gallery:focus-visible .viewport {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .slides {\n display: grid;\n width: 100%;\n height: 100%;\n }\n picture {\n grid-area: 1 / 1;\n display: block;\n width: 100%;\n height: 100%;\n }\n picture img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--photo-gallery-object-fit, cover);\n }\n .entering {\n z-index: 2;\n animation: gallery-fade-in 250ms ease both;\n }\n .leaving {\n z-index: 1;\n pointer-events: none;\n animation: gallery-fade-out 250ms ease both;\n }\n .arrow-controls {\n position: absolute;\n z-index: 3;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.5rem;\n pointer-events: none;\n }\n button {\n border: 0;\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 cursor: pointer;\n }\n button:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .arrow-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n padding: 0;\n color: var(--ui-on-accent, #ffffff);\n background: var(--ui-overlay, rgb(15 23 42 / 0.45));\n border-radius: var(--ui-radius-pill, 9999px);\n pointer-events: auto;\n }\n .arrow-button:hover {\n background: color-mix(in srgb, var(--ui-text, #0f172a) 70%, transparent);\n }\n figcaption {\n padding: 0.5rem 0.25rem 0;\n min-height: 1lh;\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text-muted, #64748b);\n }\n .footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.75rem;\n min-height: 2rem;\n padding-top: 0.5rem;\n }\n .counter {\n color: var(--ui-text-muted, #64748b);\n font-size: var(--ui-font-size-sm, 0.75rem);\n white-space: nowrap;\n }\n .indicators {\n display: flex;\n flex: 1 1 auto;\n align-items: center;\n justify-content: center;\n gap: 0.25rem;\n }\n .indicator {\n position: relative;\n width: 2rem;\n height: 2rem;\n padding: 0;\n background: transparent;\n border-radius: var(--ui-radius-pill, 9999px);\n }\n .indicator::before {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 0.625rem;\n height: 0.625rem;\n background: var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-pill, 9999px);\n content: \"\";\n transform: translate(-50%, -50%);\n }\n .indicator[aria-current=\"true\"]::before {\n background: var(--ui-primary, #4f46e5);\n }\n .autoplay-button {\n height: 2rem;\n box-sizing: border-box;\n padding: 0.25rem 0.5rem;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface-muted, #f8fafc);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-tight, 1.25);\n white-space: nowrap;\n }\n .autoplay-button:hover {\n background: var(--ui-surface, #ffffff);\n }\n slot {\n display: none;\n }\n @keyframes gallery-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n @keyframes gallery-fade-out {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .entering,\n .leaving {\n animation: none;\n }\n }\n `,\n ];\n\n /** Starts observers and autoplay integration when the element connects. */\n override connectedCallback(): void {\n super.connectedCallback();\n this._metadataObserver ??= new MutationObserver(() => this._handleMetadataChange());\n this._metadataObserver.observe(this, {\n attributes: true,\n attributeFilter: [\"alt\", \"caption\", \"media\", \"src\", \"srcset\"],\n childList: true,\n subtree: true,\n });\n document.addEventListener(\"visibilitychange\", this._handleVisibilityChange);\n }\n\n /** Releases timers and observers when the element disconnects. */\n override disconnectedCallback(): void {\n this._clearAutoplay();\n this._clearTransition();\n this._metadataObserver?.disconnect();\n document.removeEventListener(\"visibilitychange\", this._handleVisibilityChange);\n super.disconnectedCallback();\n }\n\n /** Normalizes external index changes before rendering. */\n protected override willUpdate(changed: PropertyValues<this>): void {\n if (!changed.has(\"currentIndex\")) return;\n\n const normalized = this._normalizeIndex(this.currentIndex);\n if (normalized !== this.currentIndex) {\n this.currentIndex = normalized;\n }\n\n const previousValue = changed.get(\"currentIndex\");\n if (previousValue === undefined || this._galleryItems.length === 0) {\n this._nextChangeReason = null;\n return;\n }\n\n const previousIndex = this._normalizeIndex(Number(previousValue));\n if (previousIndex === normalized) {\n this._nextChangeReason = null;\n return;\n }\n\n const reason = this._nextChangeReason ?? \"programmatic\";\n this._previousIndex = reason === \"items\" ? null : previousIndex;\n this._pendingChange = {\n previousIndex,\n currentIndex: normalized,\n item: this._galleryItems[normalized],\n reason,\n };\n this._nextChangeReason = null;\n }\n\n /** Emits completed changes and keeps autoplay synchronized with properties. */\n protected override updated(changed: PropertyValues<this>): void {\n if (this._pendingChange) {\n this.dispatchEvent(\n new CustomEvent<PhotoGallerySlideChangeDetail>(\"slide-change\", {\n bubbles: true,\n composed: true,\n detail: this._pendingChange,\n }),\n );\n this._pendingChange = undefined;\n this._scheduleTransitionCleanup();\n }\n\n if (changed.has(\"currentIndex\") || changed.has(\"delay\") || changed.has(\"paused\") || this._itemsChanged) {\n this._itemsChanged = false;\n this._restartAutoplay();\n }\n this._activeItem = this._galleryItems[this.currentIndex];\n this._renderedIndex = this.currentIndex;\n }\n\n /** Wraps any requested index into the current item range. */\n private _normalizeIndex(index: number): number {\n const count = this._galleryItems.length;\n if (count === 0 || !Number.isFinite(index)) return 0;\n return ((Math.trunc(index) % count) + count) % count;\n }\n\n /** Returns responsive variants declared directly under an item. */\n private _variantsFor(item: GalleryItem): GalleryItemVariant[] {\n return Array.from(item.children).filter(\n (child): child is GalleryItemVariant => child.tagName.toLowerCase() === \"gallery-item-variant\",\n );\n }\n\n /** Changes slides through the shared state and event path. */\n private _goTo(index: number, reason: PhotoGalleryChangeReason): void {\n const normalized = this._normalizeIndex(index);\n if (this._galleryItems.length < 2 || normalized === this.currentIndex) {\n this._restartAutoplay();\n return;\n }\n\n this._nextChangeReason = reason;\n this.currentIndex = normalized;\n }\n\n /** Moves to the previous image. */\n private _showPrevious(reason: PhotoGalleryChangeReason = \"previous\"): void {\n this._goTo(this.currentIndex - 1, reason);\n }\n\n /** Moves to the next image. */\n private _showNext(reason: PhotoGalleryChangeReason = \"next\"): void {\n this._goTo(this.currentIndex + 1, reason);\n }\n\n /** Toggles explicit autoplay pause state. */\n private _togglePaused(): void {\n this.paused = !this.paused;\n }\n\n /** Clears and conditionally schedules the next autoplay advance. */\n private _restartAutoplay(): void {\n this._clearAutoplay();\n if (!this._canAutoplay()) return;\n\n this._autoplayTimer = window.setTimeout(() => {\n this._showNext(\"autoplay\");\n }, this.delay);\n }\n\n /** Reports whether autoplay may currently schedule a transition. */\n private _canAutoplay(): boolean {\n return (\n this.delay > 0 &&\n this._galleryItems.length > 1 &&\n !this.paused &&\n !this._hovered &&\n !this._focusWithin &&\n !document.hidden\n );\n }\n\n /** Clears the pending autoplay timeout. */\n private _clearAutoplay(): void {\n if (this._autoplayTimer === undefined) return;\n window.clearTimeout(this._autoplayTimer);\n this._autoplayTimer = undefined;\n }\n\n /** Removes the outgoing crossfade layer after the animation completes. */\n private _scheduleTransitionCleanup(): void {\n this._clearTransition();\n this._transitionTimer = window.setTimeout(() => {\n this._previousIndex = null;\n this._transitionTimer = undefined;\n }, transitionDurationMs);\n }\n\n /** Clears pending transition cleanup. */\n private _clearTransition(): void {\n if (this._transitionTimer === undefined) return;\n window.clearTimeout(this._transitionTimer);\n this._transitionTimer = undefined;\n }\n\n /** Refreshes item metadata and clamps the active index after light-DOM changes. */\n private _handleMetadataChange(): void {\n this._itemsChanged = true;\n this._itemsVersion += 1;\n const preserveActiveItem = this.currentIndex === this._renderedIndex;\n const preservedIndex =\n preserveActiveItem && this._activeItem ? this._galleryItems.indexOf(this._activeItem) : -1;\n const normalized = preservedIndex >= 0 ? preservedIndex : this._normalizeIndex(this.currentIndex);\n if (normalized === this.currentIndex) {\n const item = this._galleryItems[normalized];\n const activeItemRemoved = Boolean(this._activeItem && !this._galleryItems.includes(this._activeItem));\n if (item && activeItemRemoved) {\n this._previousIndex = null;\n this._pendingChange = {\n previousIndex: this._renderedIndex,\n currentIndex: normalized,\n item,\n reason: \"items\",\n };\n }\n return;\n }\n this._nextChangeReason = \"items\";\n this.currentIndex = normalized;\n }\n\n /** Refreshes item state after the default slot changes. */\n private _handleSlotChange(): void {\n this._handleMetadataChange();\n }\n\n /** Temporarily pauses autoplay while the pointer is over the gallery. */\n private _handleMouseEnter(): void {\n this._hovered = true;\n this._restartAutoplay();\n }\n\n /** Resumes autoplay with a fresh delay after hover ends. */\n private _handleMouseLeave(): void {\n this._hovered = false;\n this._restartAutoplay();\n }\n\n /** Temporarily pauses autoplay while focus is inside the gallery. */\n private _handleFocusIn(): void {\n this._focusWithin = true;\n this._restartAutoplay();\n }\n\n /** Resumes autoplay with a fresh delay after focus leaves the gallery. */\n private _handleFocusOut(): void {\n queueMicrotask(() => {\n this._focusWithin = this.matches(\":focus-within\");\n this._restartAutoplay();\n });\n }\n\n /** Pauses or resumes scheduling when page visibility changes. */\n private readonly _handleVisibilityChange = (): void => {\n this._restartAutoplay();\n };\n\n /** Handles Left and Right arrow keyboard navigation. */\n private _handleKeyDown(event: KeyboardEvent): void {\n if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n this._showPrevious(\"keyboard\");\n return;\n }\n if (event.key === \"ArrowRight\") {\n event.preventDefault();\n this._showNext(\"keyboard\");\n }\n }\n\n /** Records the starting point of a primary pointer gesture. */\n private _handlePointerDown(event: PointerEvent): void {\n if (!event.isPrimary || event.button !== 0) return;\n if (event.composedPath().some((target) => target instanceof HTMLButtonElement)) return;\n this._pointerStart = { id: event.pointerId, x: event.clientX, y: event.clientY };\n (event.currentTarget as HTMLElement).setPointerCapture(event.pointerId);\n }\n\n /** Converts a sufficiently horizontal pointer gesture into navigation. */\n private _handlePointerUp(event: PointerEvent): void {\n const start = this._pointerStart;\n this._pointerStart = undefined;\n if (!start || start.id !== event.pointerId) return;\n\n const deltaX = event.clientX - start.x;\n const deltaY = event.clientY - start.y;\n if (Math.abs(deltaX) < swipeThresholdPx || Math.abs(deltaX) <= Math.abs(deltaY)) return;\n\n event.preventDefault();\n if (deltaX < 0) {\n this._showNext(\"swipe\");\n return;\n }\n this._showPrevious(\"swipe\");\n }\n\n /** Cancels an incomplete pointer gesture. */\n private _handlePointerCancel(): void {\n this._pointerStart = undefined;\n }\n\n /** Renders one responsive image layer for the crossfade stack. */\n private _renderPicture(index: number, state: \"current\" | \"previous\") {\n const item = this._galleryItems[index];\n if (!item) return nothing;\n\n const isPrevious = state === \"previous\";\n const transitionClass = this._previousIndex === null ? \"\" : isPrevious ? \"leaving\" : \"entering\";\n return html`\n <picture class=${transitionClass} aria-hidden=${isPrevious ? \"true\" : nothing}>\n ${this._variantsFor(item)\n .filter((variant) => variant.srcset)\n .map(\n (variant) =>\n html`<source media=${ifDefined(variant.media || undefined)} srcset=${variant.srcset} />`,\n )}\n <img src=${item.src} alt=${isPrevious ? \"\" : item.alt} draggable=\"false\" />\n </picture>\n `;\n }\n\n /** Renders enabled counter, indicator, and autoplay controls. */\n private _renderFooter(itemCount: number) {\n const showIndicators = this.showIndicators && itemCount > 1;\n const showAutoplay = this.showAutoplayControl && this.delay > 0 && itemCount > 1;\n if (!this.showCounter && !showIndicators && !showAutoplay) return nothing;\n\n return html`\n <div class=\"footer\">\n ${this.showCounter\n ? html`<span class=\"counter\">${this.currentIndex + 1} / ${itemCount}</span>`\n : nothing}\n ${showIndicators\n ? html`\n <div class=\"indicators\" role=\"group\" aria-label=\"Choose image\">\n ${this._galleryItems.map(\n (_item, index) => html`\n <button\n class=\"indicator\"\n type=\"button\"\n aria-label=\"Show image ${index + 1} of ${itemCount}\"\n aria-current=${String(index === this.currentIndex)}\n @click=${() => this._goTo(index, \"indicator\")}\n ></button>\n `,\n )}\n </div>\n `\n : nothing}\n ${showAutoplay\n ? html`\n <button\n class=\"autoplay-button\"\n type=\"button\"\n aria-label=${this.paused ? \"Resume slideshow\" : \"Pause slideshow\"}\n @click=${this._togglePaused}\n >\n ${this.paused ? \"Play\" : \"Pause\"}\n </button>\n `\n : nothing}\n </div>\n `;\n }\n\n /** Renders the active image, navigation, caption, and hidden metadata slot. */\n protected override render() {\n const itemCount = this._galleryItems.length;\n const currentItem = this._galleryItems[this.currentIndex];\n // Reserve the caption row for every slide as soon as any slide has a\n // caption, so the gallery's total height stays constant while it cycles\n // (a slide without a caption no longer collapses the box and shifts the\n // page below it).\n const hasCaptions = this._galleryItems.some((item) => item.caption);\n const objectFit: PhotoGalleryObjectFit = this.objectFit === \"contain\" ? \"contain\" : \"cover\";\n const viewportStyles = {\n \"--photo-gallery-aspect-ratio\": this.aspectRatio.trim() || \"16 / 9\",\n \"--photo-gallery-object-fit\": objectFit,\n };\n\n return html`\n <div\n class=\"gallery\"\n role=\"region\"\n aria-roledescription=\"carousel\"\n aria-label=\"Photo gallery\"\n tabindex=\"0\"\n @keydown=${this._handleKeyDown}\n @mouseenter=${this._handleMouseEnter}\n @mouseleave=${this._handleMouseLeave}\n @focusin=${this._handleFocusIn}\n @focusout=${this._handleFocusOut}\n >\n ${currentItem\n ? html`\n <figure>\n <div\n class=\"viewport\"\n style=${styleMap(viewportStyles)}\n @pointerdown=${this._handlePointerDown}\n @pointerup=${this._handlePointerUp}\n @pointercancel=${this._handlePointerCancel}\n >\n <div class=\"slides\">\n ${this._previousIndex === null\n ? nothing\n : this._renderPicture(this._previousIndex, \"previous\")}\n ${this._renderPicture(this.currentIndex, \"current\")}\n </div>\n ${this.showControls && itemCount > 1\n ? html`\n <div class=\"arrow-controls\">\n <button\n class=\"arrow-button previous\"\n type=\"button\"\n aria-label=\"Previous image\"\n @click=${() => this._showPrevious()}\n >\n ${iconChevronLeft(18)}\n </button>\n <button\n class=\"arrow-button next\"\n type=\"button\"\n aria-label=\"Next image\"\n @click=${() => this._showNext()}\n >\n ${iconChevronRight(18)}\n </button>\n </div>\n `\n : nothing}\n </div>\n ${hasCaptions\n ? html`<figcaption>${currentItem.caption}</figcaption>`\n : nothing}\n </figure>\n ${this._renderFooter(itemCount)}\n `\n : nothing}\n <slot @slotchange=${this._handleSlotChange}></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"photo-gallery\": PhotoGallery;\n }\n}\n"]}
1
+ {"version":3,"file":"photo-gallery.js","sourceRoot":"","sources":["../src/photo-gallery.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAGvD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAoBrC,MAAM,oBAAoB,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H,CAAC,CAAC,OAAO;4BACS,IAAI,CAAC,iBAAiB;;KAE7C,CAAC;IACJ,CAAC;CACF,CAAA;AAppBC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDACrD;AAGW;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAW;AAItC;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;kDAClD;AAIpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;iDACnC;AAIpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;oDACnC;AAIvB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,uBAAuB,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;yDACnD;AAI3B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAC5B;AAIf;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;iDACjB;AAIvB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;+CACK;AAG1B;IADhB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;mDACL;AAGvC;IADP,KAAK,EAAE;oDACqC;AAGrC;IADP,KAAK,EAAE;mDACkB;AA3Cf,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAupBxB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property, queryAssignedElements, state } from \"lit/decorators.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport type { GalleryItemVariant } from \"./gallery-item-variant.js\";\nimport { GalleryItem } from \"./gallery-item.js\";\nimport { iconChevronLeft, iconChevronRight } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport type PhotoGalleryObjectFit = \"cover\" | \"contain\";\nexport type PhotoGalleryChangeReason =\n | \"autoplay\"\n | \"indicator\"\n | \"items\"\n | \"keyboard\"\n | \"next\"\n | \"previous\"\n | \"programmatic\"\n | \"swipe\";\n\nexport interface PhotoGallerySlideChangeDetail {\n previousIndex: number;\n currentIndex: number;\n item: GalleryItem;\n reason: PhotoGalleryChangeReason;\n}\n\nconst transitionDurationMs = 250;\nconst swipeThresholdPx = 40;\nconst booleanAttribute = {\n fromAttribute(value: string | null): boolean {\n return value !== null && value !== \"false\";\n },\n};\n\n/**\n * Responsive, accessible image carousel composed from declarative\n * `gallery-item` children.\n *\n * The image viewport keeps a fixed `aspect-ratio`, and the caption row is\n * reserved for every slide whenever any slide has a caption, so the carousel's\n * total height stays constant as it cycles — it never shifts the page below it.\n *\n * @element photo-gallery\n * @slot - `gallery-item` elements rendered as slides.\n * @fires slide-change - The active image changed.\n */\n@customElement(\"photo-gallery\")\nexport class PhotoGallery extends LitElement {\n /** Zero-based active image index. */\n @property({ type: Number, attribute: \"current-index\", reflect: true })\n currentIndex = 0;\n\n /** Autoplay interval in milliseconds. Set to zero to disable autoplay. */\n @property({ type: Number }) delay = 0;\n\n /** Whether previous and next buttons are shown. */\n @property({ attribute: \"show-controls\", converter: booleanAttribute })\n showControls = true;\n\n /** Whether a current/total counter is shown. */\n @property({ type: Boolean, attribute: \"show-counter\" })\n showCounter = false;\n\n /** Whether clickable slide indicators are shown. */\n @property({ type: Boolean, attribute: \"show-indicators\" })\n showIndicators = false;\n\n /** Whether autoplay includes a built-in pause/play control. */\n @property({ attribute: \"show-autoplay-control\", converter: booleanAttribute })\n showAutoplayControl = true;\n\n /** Whether autoplay is explicitly paused. */\n @property({ type: Boolean, reflect: true })\n paused = false;\n\n /** CSS aspect ratio used by the image viewport. */\n @property({ attribute: \"aspect-ratio\" })\n aspectRatio = \"16 / 9\";\n\n /** How images fit within the stable viewport. */\n @property({ attribute: \"object-fit\" })\n objectFit: PhotoGalleryObjectFit = \"cover\";\n\n @queryAssignedElements({ selector: \"gallery-item\" })\n private readonly _galleryItems!: GalleryItem[];\n\n @state()\n private _previousIndex: number | null = null;\n\n @state()\n private _itemsVersion = 0;\n\n private _autoplayTimer?: number;\n private _transitionTimer?: number;\n private _metadataObserver?: MutationObserver;\n private _hovered = false;\n private _focusWithin = false;\n private _nextChangeReason: PhotoGalleryChangeReason | null = null;\n private _pendingChange?: PhotoGallerySlideChangeDetail;\n private _pointerStart?: { id: number; x: number; y: number };\n private _itemsChanged = false;\n private _activeItem?: GalleryItem;\n private _renderedIndex = 0;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n color: var(--ui-text, #0f172a);\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 font-size: var(--ui-font-size, 0.875rem);\n }\n .gallery {\n outline: none;\n }\n figure {\n margin: 0;\n }\n .viewport {\n position: relative;\n overflow: hidden;\n aspect-ratio: var(--photo-gallery-aspect-ratio, 16 / 9);\n border-radius: var(--ui-radius, 0.5rem);\n background: var(--ui-surface-muted, #f8fafc);\n touch-action: pan-y;\n user-select: none;\n }\n .gallery:focus-visible .viewport {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .slides {\n display: grid;\n width: 100%;\n height: 100%;\n }\n picture {\n grid-area: 1 / 1;\n display: block;\n width: 100%;\n height: 100%;\n }\n picture img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--photo-gallery-object-fit, cover);\n }\n .entering {\n z-index: 2;\n animation: gallery-fade-in 250ms ease both;\n }\n .leaving {\n z-index: 1;\n pointer-events: none;\n animation: gallery-fade-out 250ms ease both;\n }\n .arrow-controls {\n position: absolute;\n z-index: 3;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.5rem;\n pointer-events: none;\n }\n button {\n border: 0;\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 cursor: pointer;\n }\n button:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .arrow-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n padding: 0;\n color: var(--ui-overlay-text, #ffffff);\n background: var(--ui-overlay, rgb(15 23 42 / 0.45));\n border-radius: var(--ui-radius-pill, 9999px);\n pointer-events: auto;\n }\n .arrow-button:hover {\n background: color-mix(in srgb, var(--ui-text, #0f172a) 70%, transparent);\n }\n figcaption {\n padding: 0.5rem 0.25rem 0;\n min-height: 1lh;\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text-muted, #64748b);\n }\n .footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.75rem;\n min-height: 2rem;\n padding-top: 0.5rem;\n }\n .counter {\n color: var(--ui-text-muted, #64748b);\n font-size: var(--ui-font-size-sm, 0.75rem);\n white-space: nowrap;\n }\n .indicators {\n display: flex;\n flex: 1 1 auto;\n align-items: center;\n justify-content: center;\n gap: 0.25rem;\n }\n .indicator {\n position: relative;\n width: 2rem;\n height: 2rem;\n padding: 0;\n background: transparent;\n border-radius: var(--ui-radius-pill, 9999px);\n }\n .indicator::before {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 0.625rem;\n height: 0.625rem;\n background: var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-pill, 9999px);\n content: \"\";\n transform: translate(-50%, -50%);\n }\n .indicator[aria-current=\"true\"]::before {\n background: var(--ui-primary, #4f46e5);\n }\n .autoplay-button {\n height: 2rem;\n box-sizing: border-box;\n padding: 0.25rem 0.5rem;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface-muted, #f8fafc);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-tight, 1.25);\n white-space: nowrap;\n }\n .autoplay-button:hover {\n background: var(--ui-surface, #ffffff);\n }\n slot {\n display: none;\n }\n @keyframes gallery-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n @keyframes gallery-fade-out {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .entering,\n .leaving {\n animation: none;\n }\n }\n `,\n ];\n\n /** Starts observers and autoplay integration when the element connects. */\n override connectedCallback(): void {\n super.connectedCallback();\n this._metadataObserver ??= new MutationObserver(() => this._handleMetadataChange());\n this._metadataObserver.observe(this, {\n attributes: true,\n attributeFilter: [\"alt\", \"caption\", \"media\", \"src\", \"srcset\"],\n childList: true,\n subtree: true,\n });\n document.addEventListener(\"visibilitychange\", this._handleVisibilityChange);\n }\n\n /** Releases timers and observers when the element disconnects. */\n override disconnectedCallback(): void {\n this._clearAutoplay();\n this._clearTransition();\n this._metadataObserver?.disconnect();\n document.removeEventListener(\"visibilitychange\", this._handleVisibilityChange);\n super.disconnectedCallback();\n }\n\n /** Normalizes external index changes before rendering. */\n protected override willUpdate(changed: PropertyValues<this>): void {\n if (!changed.has(\"currentIndex\")) return;\n\n const normalized = this._normalizeIndex(this.currentIndex);\n if (normalized !== this.currentIndex) {\n this.currentIndex = normalized;\n }\n\n const previousValue = changed.get(\"currentIndex\");\n if (previousValue === undefined || this._galleryItems.length === 0) {\n this._nextChangeReason = null;\n return;\n }\n\n const previousIndex = this._normalizeIndex(Number(previousValue));\n if (previousIndex === normalized) {\n this._nextChangeReason = null;\n return;\n }\n\n const reason = this._nextChangeReason ?? \"programmatic\";\n this._previousIndex = reason === \"items\" ? null : previousIndex;\n this._pendingChange = {\n previousIndex,\n currentIndex: normalized,\n item: this._galleryItems[normalized],\n reason,\n };\n this._nextChangeReason = null;\n }\n\n /** Emits completed changes and keeps autoplay synchronized with properties. */\n protected override updated(changed: PropertyValues<this>): void {\n if (this._pendingChange) {\n this.dispatchEvent(\n new CustomEvent<PhotoGallerySlideChangeDetail>(\"slide-change\", {\n bubbles: true,\n composed: true,\n detail: this._pendingChange,\n }),\n );\n this._pendingChange = undefined;\n this._scheduleTransitionCleanup();\n }\n\n if (changed.has(\"currentIndex\") || changed.has(\"delay\") || changed.has(\"paused\") || this._itemsChanged) {\n this._itemsChanged = false;\n this._restartAutoplay();\n }\n this._activeItem = this._galleryItems[this.currentIndex];\n this._renderedIndex = this.currentIndex;\n }\n\n /** Wraps any requested index into the current item range. */\n private _normalizeIndex(index: number): number {\n const count = this._galleryItems.length;\n if (count === 0 || !Number.isFinite(index)) return 0;\n return ((Math.trunc(index) % count) + count) % count;\n }\n\n /** Returns responsive variants declared directly under an item. */\n private _variantsFor(item: GalleryItem): GalleryItemVariant[] {\n return Array.from(item.children).filter(\n (child): child is GalleryItemVariant => child.tagName.toLowerCase() === \"gallery-item-variant\",\n );\n }\n\n /** Changes slides through the shared state and event path. */\n private _goTo(index: number, reason: PhotoGalleryChangeReason): void {\n const normalized = this._normalizeIndex(index);\n if (this._galleryItems.length < 2 || normalized === this.currentIndex) {\n this._restartAutoplay();\n return;\n }\n\n this._nextChangeReason = reason;\n this.currentIndex = normalized;\n }\n\n /** Moves to the previous image. */\n private _showPrevious(reason: PhotoGalleryChangeReason = \"previous\"): void {\n this._goTo(this.currentIndex - 1, reason);\n }\n\n /** Moves to the next image. */\n private _showNext(reason: PhotoGalleryChangeReason = \"next\"): void {\n this._goTo(this.currentIndex + 1, reason);\n }\n\n /** Toggles explicit autoplay pause state. */\n private _togglePaused(): void {\n this.paused = !this.paused;\n }\n\n /** Clears and conditionally schedules the next autoplay advance. */\n private _restartAutoplay(): void {\n this._clearAutoplay();\n if (!this._canAutoplay()) return;\n\n this._autoplayTimer = window.setTimeout(() => {\n this._showNext(\"autoplay\");\n }, this.delay);\n }\n\n /** Reports whether autoplay may currently schedule a transition. */\n private _canAutoplay(): boolean {\n return (\n this.delay > 0 &&\n this._galleryItems.length > 1 &&\n !this.paused &&\n !this._hovered &&\n !this._focusWithin &&\n !document.hidden\n );\n }\n\n /** Clears the pending autoplay timeout. */\n private _clearAutoplay(): void {\n if (this._autoplayTimer === undefined) return;\n window.clearTimeout(this._autoplayTimer);\n this._autoplayTimer = undefined;\n }\n\n /** Removes the outgoing crossfade layer after the animation completes. */\n private _scheduleTransitionCleanup(): void {\n this._clearTransition();\n this._transitionTimer = window.setTimeout(() => {\n this._previousIndex = null;\n this._transitionTimer = undefined;\n }, transitionDurationMs);\n }\n\n /** Clears pending transition cleanup. */\n private _clearTransition(): void {\n if (this._transitionTimer === undefined) return;\n window.clearTimeout(this._transitionTimer);\n this._transitionTimer = undefined;\n }\n\n /** Refreshes item metadata and clamps the active index after light-DOM changes. */\n private _handleMetadataChange(): void {\n this._itemsChanged = true;\n this._itemsVersion += 1;\n const preserveActiveItem = this.currentIndex === this._renderedIndex;\n const preservedIndex =\n preserveActiveItem && this._activeItem ? this._galleryItems.indexOf(this._activeItem) : -1;\n const normalized = preservedIndex >= 0 ? preservedIndex : this._normalizeIndex(this.currentIndex);\n if (normalized === this.currentIndex) {\n const item = this._galleryItems[normalized];\n const activeItemRemoved = Boolean(this._activeItem && !this._galleryItems.includes(this._activeItem));\n if (item && activeItemRemoved) {\n this._previousIndex = null;\n this._pendingChange = {\n previousIndex: this._renderedIndex,\n currentIndex: normalized,\n item,\n reason: \"items\",\n };\n }\n return;\n }\n this._nextChangeReason = \"items\";\n this.currentIndex = normalized;\n }\n\n /** Refreshes item state after the default slot changes. */\n private _handleSlotChange(): void {\n this._handleMetadataChange();\n }\n\n /** Temporarily pauses autoplay while the pointer is over the gallery. */\n private _handleMouseEnter(): void {\n this._hovered = true;\n this._restartAutoplay();\n }\n\n /** Resumes autoplay with a fresh delay after hover ends. */\n private _handleMouseLeave(): void {\n this._hovered = false;\n this._restartAutoplay();\n }\n\n /** Temporarily pauses autoplay while focus is inside the gallery. */\n private _handleFocusIn(): void {\n this._focusWithin = true;\n this._restartAutoplay();\n }\n\n /** Resumes autoplay with a fresh delay after focus leaves the gallery. */\n private _handleFocusOut(): void {\n queueMicrotask(() => {\n this._focusWithin = this.matches(\":focus-within\");\n this._restartAutoplay();\n });\n }\n\n /** Pauses or resumes scheduling when page visibility changes. */\n private readonly _handleVisibilityChange = (): void => {\n this._restartAutoplay();\n };\n\n /** Handles Left and Right arrow keyboard navigation. */\n private _handleKeyDown(event: KeyboardEvent): void {\n if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n this._showPrevious(\"keyboard\");\n return;\n }\n if (event.key === \"ArrowRight\") {\n event.preventDefault();\n this._showNext(\"keyboard\");\n }\n }\n\n /** Records the starting point of a primary pointer gesture. */\n private _handlePointerDown(event: PointerEvent): void {\n if (!event.isPrimary || event.button !== 0) return;\n if (event.composedPath().some((target) => target instanceof HTMLButtonElement)) return;\n this._pointerStart = { id: event.pointerId, x: event.clientX, y: event.clientY };\n (event.currentTarget as HTMLElement).setPointerCapture(event.pointerId);\n }\n\n /** Converts a sufficiently horizontal pointer gesture into navigation. */\n private _handlePointerUp(event: PointerEvent): void {\n const start = this._pointerStart;\n this._pointerStart = undefined;\n if (!start || start.id !== event.pointerId) return;\n\n const deltaX = event.clientX - start.x;\n const deltaY = event.clientY - start.y;\n if (Math.abs(deltaX) < swipeThresholdPx || Math.abs(deltaX) <= Math.abs(deltaY)) return;\n\n event.preventDefault();\n if (deltaX < 0) {\n this._showNext(\"swipe\");\n return;\n }\n this._showPrevious(\"swipe\");\n }\n\n /** Cancels an incomplete pointer gesture. */\n private _handlePointerCancel(): void {\n this._pointerStart = undefined;\n }\n\n /** Renders one responsive image layer for the crossfade stack. */\n private _renderPicture(index: number, state: \"current\" | \"previous\") {\n const item = this._galleryItems[index];\n if (!item) return nothing;\n\n const isPrevious = state === \"previous\";\n const transitionClass = this._previousIndex === null ? \"\" : isPrevious ? \"leaving\" : \"entering\";\n return html`\n <picture class=${transitionClass} aria-hidden=${isPrevious ? \"true\" : nothing}>\n ${this._variantsFor(item)\n .filter((variant) => variant.srcset)\n .map(\n (variant) =>\n html`<source media=${ifDefined(variant.media || undefined)} srcset=${variant.srcset} />`,\n )}\n <img src=${item.src} alt=${isPrevious ? \"\" : item.alt} draggable=\"false\" />\n </picture>\n `;\n }\n\n /** Renders enabled counter, indicator, and autoplay controls. */\n private _renderFooter(itemCount: number) {\n const showIndicators = this.showIndicators && itemCount > 1;\n const showAutoplay = this.showAutoplayControl && this.delay > 0 && itemCount > 1;\n if (!this.showCounter && !showIndicators && !showAutoplay) return nothing;\n\n return html`\n <div class=\"footer\">\n ${this.showCounter\n ? html`<span class=\"counter\">${this.currentIndex + 1} / ${itemCount}</span>`\n : nothing}\n ${showIndicators\n ? html`\n <div class=\"indicators\" role=\"group\" aria-label=\"Choose image\">\n ${this._galleryItems.map(\n (_item, index) => html`\n <button\n class=\"indicator\"\n type=\"button\"\n aria-label=\"Show image ${index + 1} of ${itemCount}\"\n aria-current=${String(index === this.currentIndex)}\n @click=${() => this._goTo(index, \"indicator\")}\n ></button>\n `,\n )}\n </div>\n `\n : nothing}\n ${showAutoplay\n ? html`\n <button\n class=\"autoplay-button\"\n type=\"button\"\n aria-label=${this.paused ? \"Resume slideshow\" : \"Pause slideshow\"}\n @click=${this._togglePaused}\n >\n ${this.paused ? \"Play\" : \"Pause\"}\n </button>\n `\n : nothing}\n </div>\n `;\n }\n\n /** Renders the active image, navigation, caption, and hidden metadata slot. */\n protected override render() {\n const itemCount = this._galleryItems.length;\n const currentItem = this._galleryItems[this.currentIndex];\n // Reserve the caption row for every slide as soon as any slide has a\n // caption, so the gallery's total height stays constant while it cycles\n // (a slide without a caption no longer collapses the box and shifts the\n // page below it).\n const hasCaptions = this._galleryItems.some((item) => item.caption);\n const objectFit: PhotoGalleryObjectFit = this.objectFit === \"contain\" ? \"contain\" : \"cover\";\n const viewportStyles = {\n \"--photo-gallery-aspect-ratio\": this.aspectRatio.trim() || \"16 / 9\",\n \"--photo-gallery-object-fit\": objectFit,\n };\n\n return html`\n <div\n class=\"gallery\"\n role=\"region\"\n aria-roledescription=\"carousel\"\n aria-label=\"Photo gallery\"\n tabindex=\"0\"\n @keydown=${this._handleKeyDown}\n @mouseenter=${this._handleMouseEnter}\n @mouseleave=${this._handleMouseLeave}\n @focusin=${this._handleFocusIn}\n @focusout=${this._handleFocusOut}\n >\n ${currentItem\n ? html`\n <figure>\n <div\n class=\"viewport\"\n style=${styleMap(viewportStyles)}\n @pointerdown=${this._handlePointerDown}\n @pointerup=${this._handlePointerUp}\n @pointercancel=${this._handlePointerCancel}\n >\n <div class=\"slides\">\n ${this._previousIndex === null\n ? nothing\n : this._renderPicture(this._previousIndex, \"previous\")}\n ${this._renderPicture(this.currentIndex, \"current\")}\n </div>\n ${this.showControls && itemCount > 1\n ? html`\n <div class=\"arrow-controls\">\n <button\n class=\"arrow-button previous\"\n type=\"button\"\n aria-label=\"Previous image\"\n @click=${() => this._showPrevious()}\n >\n ${iconChevronLeft(18)}\n </button>\n <button\n class=\"arrow-button next\"\n type=\"button\"\n aria-label=\"Next image\"\n @click=${() => this._showNext()}\n >\n ${iconChevronRight(18)}\n </button>\n </div>\n `\n : nothing}\n </div>\n ${hasCaptions\n ? html`<figcaption>${currentItem.caption}</figcaption>`\n : nothing}\n </figure>\n ${this._renderFooter(itemCount)}\n `\n : nothing}\n <slot @slotchange=${this._handleSlotChange}></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"photo-gallery\": PhotoGallery;\n }\n}\n"]}
@@ -109,7 +109,7 @@ let PriceHistoryChart = class PriceHistoryChart extends LitElement {
109
109
  fill: var(--ui-tooltip, #0f172a);
110
110
  }
111
111
  .tooltip-label {
112
- fill: var(--ui-on-accent, #ffffff);
112
+ fill: var(--ui-tooltip-text, #ffffff);
113
113
  }
114
114
  `,
115
115
  ]; }