@cntrl-site/components 1.0.106-alpha.0 → 1.0.107-alpha.1

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 (92) hide show
  1. package/dist/ArchivePopup-DMpGP8r2.js +176 -0
  2. package/dist/ArchivePopup-X4EtTAyA.mjs +694 -0
  3. package/dist/ArchivePopupComponent-BTniPIfi.js +1 -0
  4. package/dist/{PretextComponent-j-OsRZTx.mjs → ArchivePopupComponent-GgAT2Avz.mjs} +954 -479
  5. package/dist/ClickGallerie-CYQMgrIr.js +36 -0
  6. package/dist/ClickGallerie-o2U6oyOF.mjs +272 -0
  7. package/dist/Components/ArchivePopup/ArchivePopup.d.ts +154 -0
  8. package/dist/Components/ArchivePopup/ArchivePopupComponent.d.ts +288 -0
  9. package/dist/Components/ClickGallerie/ClickGallerie.d.ts +2 -1
  10. package/dist/Components/Helix/Helix.d.ts +4 -1
  11. package/dist/Components/Hive/Hive.d.ts +4 -1
  12. package/dist/Components/ImageRevealSlider/ImageRevealSlider.d.ts +2 -1
  13. package/dist/Components/List/List.d.ts +6 -2
  14. package/dist/Components/Marquee/Marquee.d.ts +6 -2
  15. package/dist/Components/MarqueeText/MarqueeText.d.ts +2 -1
  16. package/dist/Components/Mercury/Mercury.d.ts +4 -1
  17. package/dist/Components/Waterfall/WaterfallLightbox.d.ts +4 -1
  18. package/dist/Components/utils/EmbedMediaFrame.d.ts +27 -0
  19. package/dist/Components/utils/LinkWrapper.d.ts +16 -0
  20. package/dist/Components/utils/embedMedia.d.ts +40 -0
  21. package/dist/Components/utils/index.d.ts +6 -0
  22. package/dist/{ControlSlider-SiOt22l_.js → ControlSlider-Kkec-i14.js} +1 -1
  23. package/dist/{ControlSlider-pZv7H6BU.mjs → ControlSlider-LcZmviGX.mjs} +1 -1
  24. package/dist/EmbedMediaFrame-DsOTKE4i.js +1 -0
  25. package/dist/EmbedMediaFrame-DwHeOAy5.mjs +164 -0
  26. package/dist/{FAQ-C7823fyi.js → FAQ-BxhMo7T8.js} +1 -1
  27. package/dist/{FAQ-CZ39u4m8.mjs → FAQ-CdwSft5p.mjs} +1 -1
  28. package/dist/Grid-CFHTP3mb.js +378 -0
  29. package/dist/Grid-e-gLfsji.mjs +1590 -0
  30. package/dist/Helix-BpLo9FD3.js +43 -0
  31. package/dist/Helix-CidI3ucE.mjs +324 -0
  32. package/dist/{Hive-D6-R6TwM.mjs → Hive-BsmFHk2i.mjs} +505 -475
  33. package/dist/Hive-D1j6wZpV.js +321 -0
  34. package/dist/ImageRevealSlider-BuukTGAK.js +1 -0
  35. package/dist/{ImageRevealSlider-BdFGyVEP.mjs → ImageRevealSlider-Df9sygk9.mjs} +63 -70
  36. package/dist/{Lightbox-eP9qAZzL.mjs → Lightbox-C_fXsfdz.mjs} +1 -1
  37. package/dist/{Lightbox-CIss_nOG.js → Lightbox-DaunVrkp.js} +1 -1
  38. package/dist/LinkWrapper-Ca84iPtg.js +1 -0
  39. package/dist/LinkWrapper-DZs9hlOn.mjs +13 -0
  40. package/dist/{List-DW7fyJbf.mjs → List-Bh_-l9vD.mjs} +532 -520
  41. package/dist/List-DVvpQ24J.js +377 -0
  42. package/dist/Marquee-DByooiWP.mjs +578 -0
  43. package/dist/Marquee-DfIP-tIN.js +133 -0
  44. package/dist/{MarqueeText-Rzt2fJYt.mjs → MarqueeText-D6FNCe6P.mjs} +115 -114
  45. package/dist/MarqueeText-DsUiV6Zv.js +132 -0
  46. package/dist/Mercury-B-s2Kvuq.js +267 -0
  47. package/dist/Mercury-CCW0Es-s.mjs +1700 -0
  48. package/dist/{RichTextRenderer-B6WtTYlR.mjs → RichTextRenderer-BptwNpbJ.mjs} +10 -9
  49. package/dist/RichTextRenderer-K90Dd7pt.js +1 -0
  50. package/dist/{Slider20-Dm8BeCli.mjs → Slider20-CCzixTiN.mjs} +1 -1
  51. package/dist/{Slider20-C9o2REDl.js → Slider20-fMVeRfgx.js} +1 -1
  52. package/dist/{TestimonialGrid-CPu4qQ6B.mjs → TestimonialGrid-CbsVxSn9.mjs} +1 -1
  53. package/dist/{TestimonialGrid-D4ieiz9e.js → TestimonialGrid-CiCagfBU.js} +1 -1
  54. package/dist/{TestimonialSingle-DLdnAVF7.mjs → TestimonialSingle-BVm3Amrl.mjs} +1 -1
  55. package/dist/{TestimonialSingle-CVu15ZtV.js → TestimonialSingle-BWXynGjv.js} +1 -1
  56. package/dist/Waterfall-3kKioKh2.mjs +1432 -0
  57. package/dist/Waterfall-DII4-WV5.js +288 -0
  58. package/dist/{components-D2LyuDm-.mjs → components-DKuQ8PUa.mjs} +19 -18
  59. package/dist/components-SEwSqFrQ.js +1 -0
  60. package/dist/content/postFieldBindings.d.ts +29 -0
  61. package/dist/elements.js +1 -1
  62. package/dist/elements.mjs +22 -21
  63. package/dist/elements.node.js +1 -1
  64. package/dist/elements.node.mjs +1 -1
  65. package/dist/index.d.ts +3 -1
  66. package/dist/index.js +1 -1
  67. package/dist/index.mjs +52 -15
  68. package/dist/sources.js +1331 -233
  69. package/dist/sources.mjs +1355 -256
  70. package/dist/types/SchemaV1.d.ts +53 -1
  71. package/dist/utils.js +1 -1
  72. package/dist/utils.mjs +30 -20
  73. package/package.json +1 -1
  74. package/dist/ClickGallerie-D7g093HX.js +0 -36
  75. package/dist/ClickGallerie-QSOQjSdv.mjs +0 -271
  76. package/dist/Grid-BBpdl60K.js +0 -374
  77. package/dist/Grid-DS53S_gA.mjs +0 -1576
  78. package/dist/Helix-BPn9V1sg.mjs +0 -315
  79. package/dist/Helix-DcgsCc4D.js +0 -43
  80. package/dist/Hive-n8Fz-j3o.js +0 -321
  81. package/dist/ImageRevealSlider-BBWtFjUF.js +0 -1
  82. package/dist/List-C32WImI3.js +0 -377
  83. package/dist/Marquee-DOIRRCu4.js +0 -133
  84. package/dist/Marquee-O_PDwlIb.mjs +0 -564
  85. package/dist/MarqueeText-DkaO2lQ5.js +0 -132
  86. package/dist/Mercury-C9D10TTT.mjs +0 -1702
  87. package/dist/Mercury-DynO-NxY.js +0 -267
  88. package/dist/PretextComponent-BnsS2zJ6.js +0 -1
  89. package/dist/RichTextRenderer-CIy6yI8U.js +0 -1
  90. package/dist/Waterfall-DC2WQ3GT.js +0 -287
  91. package/dist/Waterfall-Yud2VR62.mjs +0 -1404
  92. package/dist/components-B9Vdjf0w.js +0 -1
package/dist/sources.js CHANGED
@@ -1,4 +1,1002 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./PretextComponent-BnsS2zJ6.js"),e=`import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./ArchivePopupComponent-BTniPIfi.js"),e=`import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
2
+ import { createPortal } from 'react-dom';
3
+ import cn from 'classnames';
4
+ import { CommonComponentProps } from '../props';
5
+ import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
6
+ import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
7
+ import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
8
+ import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
9
+
10
+ type ArchivePopupMedia = {
11
+ assetId: string;
12
+ name?: string;
13
+ type?: 'image' | 'video';
14
+ objectFit?: 'cover' | 'contain';
15
+ };
16
+
17
+ /** Columns count the group column too, so the least is the group and its title. */
18
+ export const ARCHIVE_POPUP_MIN_COLUMNS = 2;
19
+ export const ARCHIVE_POPUP_MAX_COLUMNS = 5;
20
+ /** The fields of the columns after the title, in order; \`columns\` decides how many of them a row shows. */
21
+ export const ARCHIVE_POPUP_EXTRA_TITLE_KEYS = ['title2', 'title3', 'title4'] as const;
22
+ /** Every column but the last has a width of its own, like Programme's; the last takes what is left of the row. */
23
+ export const ARCHIVE_POPUP_COLUMN_WIDTH_KEYS = ['column1Width', 'column2Width', 'column3Width', 'column4Width'] as const;
24
+
25
+ type ArchivePopupColumnWidthKey = typeof ARCHIVE_POPUP_COLUMN_WIDTH_KEYS[number];
26
+
27
+ /**
28
+ * Where A's panel sits on the screen, as \`left\`/\`top\` of the screen and of the panel alike, so 0% is flush with
29
+ * one edge and 100% with the other. Named like Mercury's title position; center comes first because the editor
30
+ * puts the first value into a popup saved before there was a position, and those were centred.
31
+ */
32
+ const PANEL_POSITION_OFFSETS = {
33
+ center: { x: '50%', y: '50%' },
34
+ 'left-top': { x: '0%', y: '0%' },
35
+ 'top-center': { x: '50%', y: '0%' },
36
+ 'top-right': { x: '100%', y: '0%' },
37
+ 'left-center': { x: '0%', y: '50%' },
38
+ 'right-center': { x: '100%', y: '50%' },
39
+ 'left-bottom': { x: '0%', y: '100%' },
40
+ 'bottom-center': { x: '50%', y: '100%' },
41
+ 'right-bottom': { x: '100%', y: '100%' },
42
+ } as const;
43
+
44
+ export type ArchivePopupPanelPosition = keyof typeof PANEL_POSITION_OFFSETS;
45
+
46
+ export const ARCHIVE_POPUP_PANEL_POSITIONS = Object.keys(PANEL_POSITION_OFFSETS) as ArchivePopupPanelPosition[];
47
+
48
+ /** Each column of a row has a text style of its own, the group column's being \`column1\`. */
49
+ export const ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES = ['column1', 'column2', 'column3', 'column4', 'column5'] as const;
50
+
51
+ type ArchivePopupColumnStylePrefix = typeof ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES[number];
52
+
53
+ type ArchivePopupTitle = any[] | string;
54
+
55
+ export type ArchivePopupContentItem = {
56
+ group?: string;
57
+ /** Rich text, so parts of a title can be linked; a plain string is still shown as is. */
58
+ title?: ArchivePopupTitle;
59
+ title2?: ArchivePopupTitle;
60
+ title3?: ArchivePopupTitle;
61
+ title4?: ArchivePopupTitle;
62
+ image?: ArchivePopupMedia;
63
+ };
64
+
65
+ type FontSettings = { fontWeight: number; fontStyle: string };
66
+
67
+ type Padding = { top: number; right: number; bottom: number; left: number };
68
+
69
+ /** A text style as settings hold it, each field under the name of what it styles, e.g. \`triggerFontSize\`. */
70
+ type TextStyleFields = {
71
+ FontFamily?: string;
72
+ FontSettings?: FontSettings;
73
+ FontSize?: number;
74
+ LineHeight?: number;
75
+ LetterSpacing?: number;
76
+ WordSpacing?: number;
77
+ TextAlign?: TextStyles['textAlign'];
78
+ TextAppearance?: TextStyles['textAppearance'];
79
+ };
80
+
81
+ type PrefixedTextStyle<Prefix extends string> = {
82
+ [Key in keyof TextStyleFields as \`\${Prefix}\${Key}\`]?: TextStyleFields[Key];
83
+ };
84
+
85
+ type ArchivePopupSettings = PrefixedTextStyle<'trigger'>
86
+ & PrefixedTextStyle<ArchivePopupColumnStylePrefix>
87
+ // One style every column shared before each had its own; a column with no style of its own still shows it.
88
+ & PrefixedTextStyle<'list'>
89
+ & {
90
+ /** \`a\` opens from a label; \`b\` is always open, in place on the page. */
91
+ type?: 'a' | 'b';
92
+ triggerLabel?: string;
93
+ closeLabel?: string;
94
+ /** Every column of a row, the group column included. */
95
+ columns?: number;
96
+ columnGap?: number;
97
+ column1Width?: number;
98
+ column2Width?: number;
99
+ column3Width?: number;
100
+ column4Width?: number;
101
+ /** A only: B's panel stays where it is placed on the page. */
102
+ panelPosition?: string;
103
+ panelWidth?: number;
104
+ panelPadding?: Padding;
105
+ panelRadius?: number;
106
+ groupGap?: number;
107
+ triggerColor?: string;
108
+ triggerHoverColor?: string;
109
+ closeColor?: string;
110
+ closeHoverColor?: string;
111
+ panelColor?: string;
112
+ textColor?: string;
113
+ textHoverColor?: string;
114
+ overlayColor?: string;
115
+ };
116
+
117
+ type ArchivePopupProps = {
118
+ settings: ArchivePopupSettings;
119
+ content?: ArchivePopupContentItem[];
120
+ isEditor?: boolean;
121
+ isEditMode?: boolean;
122
+ isPreviewMode?: boolean;
123
+ activeEvent?: string;
124
+ portalId?: string;
125
+ } & CommonComponentProps;
126
+
127
+ export type ArchivePopupRow = {
128
+ item: ArchivePopupContentItem;
129
+ index: number;
130
+ };
131
+
132
+ export type ArchivePopupGroup = {
133
+ label: string;
134
+ rows: ArchivePopupRow[];
135
+ };
136
+
137
+ type ColorKeys =
138
+ | 'triggerColor'
139
+ | 'triggerHoverColor'
140
+ | 'closeColor'
141
+ | 'closeHoverColor'
142
+ | 'panelColor'
143
+ | 'textColor'
144
+ | 'textHoverColor'
145
+ | 'overlayColor';
146
+
147
+ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
148
+ triggerColor: 'trigger-color',
149
+ triggerHoverColor: 'trigger-hover-color',
150
+ closeColor: 'close-color',
151
+ closeHoverColor: 'close-hover-color',
152
+ panelColor: 'panel-color',
153
+ textColor: 'text-color',
154
+ textHoverColor: 'text-hover-color',
155
+ overlayColor: 'overlay-color',
156
+ };
157
+
158
+ const STATE_KEYS = ['hover', 'open'] as const;
159
+
160
+ const OVERLAY_ANIM_MS = 300;
161
+ // The least a padding handle is drawn at, so a zero padding can still be grabbed.
162
+ const PADDING_HANDLE_SIZE = 0.004;
163
+ const COLUMN_RESIZE_HANDLE_WIDTH = 0.004;
164
+ // The least a column is dragged down to, in pixels of the layout.
165
+ const MIN_COLUMN_WIDTH_PX = 20;
166
+ const DEFAULT_COLUMN_GAP = 0.0139;
167
+ const DEFAULT_PANEL_WIDTH = 0.3194;
168
+ const DEFAULT_PANEL_PADDING: Padding = { top: 0.00972, right: 0.00972, bottom: 0.00972, left: 0.00972 };
169
+ const IMAGE_FADE_MS = 800;
170
+
171
+ const LIGHTBOX_CSS_VARS = [
172
+ '--cntrl-article-width',
173
+ '--cntrl-article-top',
174
+ '--cntrl-article-left',
175
+ '--cntrl-viewport-height',
176
+ ] as const;
177
+
178
+ // A row with an empty group continues the group above it, so the label only has to be typed once.
179
+ type ColumnLayoutSettings = Pick<ArchivePopupSettings, 'columns' | 'columnGap' | 'panelWidth' | 'panelPadding'>
180
+ & Partial<Record<ArchivePopupColumnWidthKey, number>>;
181
+
182
+ function getColumnCount(columns: number | undefined): number {
183
+ return Math.min(Math.max(Math.round(columns ?? ARCHIVE_POPUP_MIN_COLUMNS), ARCHIVE_POPUP_MIN_COLUMNS), ARCHIVE_POPUP_MAX_COLUMNS);
184
+ }
185
+
186
+ /** The width a row's columns share: the panel's, less its padding and the gaps between them. */
187
+ function getColumnsSpace(settings: ColumnLayoutSettings): number {
188
+ const { panelWidth = DEFAULT_PANEL_WIDTH, panelPadding = DEFAULT_PANEL_PADDING, columnGap = DEFAULT_COLUMN_GAP } = settings;
189
+ const gaps = (getColumnCount(settings.columns) - 1) * columnGap;
190
+ return Math.max(0, panelWidth - panelPadding.left - panelPadding.right - gaps);
191
+ }
192
+
193
+ export function getArchivePopupEqualColumnWidths(settings: ColumnLayoutSettings): Partial<Record<ArchivePopupColumnWidthKey, number>> {
194
+ const count = getColumnCount(settings.columns);
195
+ const width = getColumnsSpace(settings) / count;
196
+ return Object.fromEntries(ARCHIVE_POPUP_COLUMN_WIDTH_KEYS.slice(0, count - 1).map((key) => [key, width]));
197
+ }
198
+
199
+ /**
200
+ * Every column's width, the last taking what the others leave. A column with no width of its own gets an equal share,
201
+ * and widths that no longer fit, after the panel narrows or a column is added, shrink together until they do.
202
+ */
203
+ export function resolveArchivePopupColumnWidths(settings: ColumnLayoutSettings): number[] {
204
+ const count = getColumnCount(settings.columns);
205
+ const space = getColumnsSpace(settings);
206
+ const sized = ARCHIVE_POPUP_COLUMN_WIDTH_KEYS.slice(0, count - 1).map((key) => {
207
+ const width = settings[key];
208
+ return typeof width === 'number' ? Math.max(0, width) : space / count;
209
+ });
210
+ const sizedTotal = sized.reduce((sum, width) => sum + width, 0);
211
+ const scale = sizedTotal > space ? space / sizedTotal : 1;
212
+ const fitted = sized.map((width) => width * scale);
213
+ return [...fitted, Math.max(0, space - sizedTotal * scale)];
214
+ }
215
+
216
+ /** Like Programme, a new column count starts the columns over at equal widths. */
217
+ export function applyArchivePopupColumnCountChange(
218
+ nextSettings: Record<string, any>,
219
+ prevSettings: Record<string, any>,
220
+ ): Record<string, any> {
221
+ if (typeof nextSettings.columns !== 'number' || nextSettings.columns === prevSettings.columns) {
222
+ return nextSettings;
223
+ }
224
+ return { ...nextSettings, ...getArchivePopupEqualColumnWidths({ ...prevSettings, ...nextSettings }) };
225
+ }
226
+
227
+ // The columns stay in proportion when the panel is drawn narrower than its width, on a small screen.
228
+ function getGridTemplateColumns(widths: number[]): string {
229
+ const total = widths.reduce((sum, width) => sum + width, 0);
230
+ return widths.map((width) => \`minmax(0, \${total > 0 ? (width / total) * 100 : 1}fr)\`).join(' ');
231
+ }
232
+
233
+ export function groupArchiveRows(items: ArchivePopupContentItem[]): ArchivePopupGroup[] {
234
+ const groups: ArchivePopupGroup[] = [];
235
+ items.forEach((item, index) => {
236
+ const label = item.group?.trim() ?? '';
237
+ const current = groups[groups.length - 1];
238
+ if (!current || (label !== '' && label !== current.label)) {
239
+ groups.push({ label, rows: [{ item, index }] });
240
+ return;
241
+ }
242
+ current.rows.push({ item, index });
243
+ });
244
+ return groups;
245
+ }
246
+
247
+ function isVideoMedia(media: ArchivePopupMedia): boolean {
248
+ if (media.type === 'video') return true;
249
+ if (media.type === 'image') return false;
250
+ return /\\.(mp4|webm|ogg|mov)(\\?|$)/i.test(media.name ?? '') || /\\.(mp4|webm|ogg|mov)(\\?|$)/i.test(media.assetId);
251
+ }
252
+
253
+ function findLayoutContainer(element: HTMLElement | null): HTMLElement | null {
254
+ let el = element;
255
+ while (el) {
256
+ if (getComputedStyle(el).getPropertyValue('--cntrl-article-width').trim()) {
257
+ return el;
258
+ }
259
+ el = el.parentElement;
260
+ }
261
+ return element;
262
+ }
263
+
264
+ function getLightboxLayoutStyle(container: HTMLElement | null): CSSProperties {
265
+ const style: Record<string, string> = {};
266
+ const layoutContainer = findLayoutContainer(container);
267
+ if (!layoutContainer) return style;
268
+ const computed = getComputedStyle(layoutContainer);
269
+ for (const varName of LIGHTBOX_CSS_VARS) {
270
+ const value = computed.getPropertyValue(varName).trim();
271
+ if (value) {
272
+ style[varName] = value;
273
+ }
274
+ }
275
+ return style;
276
+ }
277
+
278
+ function resolveTextStyle(settings: ArchivePopupSettings, prefix: string, fallbackPrefix?: string): TextStyles {
279
+ const values = settings as Record<string, unknown>;
280
+ const read = <Key extends keyof TextStyleFields>(key: Key) => (
281
+ values[\`\${prefix}\${key}\`] ?? (fallbackPrefix ? values[\`\${fallbackPrefix}\${key}\`] : undefined)
282
+ ) as TextStyleFields[Key];
283
+ const fontSettings = read('FontSettings');
284
+ return {
285
+ fontSettings: {
286
+ fontFamily: read('FontFamily'),
287
+ fontWeight: fontSettings?.fontWeight ?? 400,
288
+ fontStyle: fontSettings?.fontStyle ?? 'normal',
289
+ },
290
+ fontSize: read('FontSize') ?? 0.01,
291
+ lineHeight: read('LineHeight'),
292
+ letterSpacing: read('LetterSpacing') ?? 0,
293
+ wordSpacing: read('WordSpacing') ?? 0,
294
+ textAlign: read('TextAlign'),
295
+ textAppearance: read('TextAppearance'),
296
+ color: '#000000',
297
+ };
298
+ }
299
+
300
+ function getCSS(P: string): string {
301
+ return \`
302
+ .\${P}-trigger,
303
+ .\${P}-close {
304
+ display: inline-block;
305
+ margin: 0;
306
+ padding: 0;
307
+ border: 0;
308
+ background: none;
309
+ cursor: pointer;
310
+ white-space: nowrap;
311
+ transition: color 150ms ease;
312
+ -webkit-appearance: none;
313
+ appearance: none;
314
+ -webkit-tap-highlight-color: transparent;
315
+ }
316
+ .\${P}-trigger {
317
+ color: var(--\${P}-trigger-color);
318
+ }
319
+ .\${P}-close {
320
+ color: var(--\${P}-close-color);
321
+ }
322
+ .\${P}-trigger:focus,
323
+ .\${P}-close:focus {
324
+ outline: none;
325
+ }
326
+ .\${P}-trigger:focus-visible,
327
+ .\${P}-close:focus-visible {
328
+ outline: 1px solid currentColor;
329
+ outline-offset: 2px;
330
+ }
331
+ .\${P}-interactive .\${P}-trigger:hover,
332
+ .\${P}-state-hover .\${P}-trigger {
333
+ color: var(--\${P}-trigger-hover-color, var(--\${P}-trigger-color));
334
+ }
335
+ .\${P}-close:hover {
336
+ color: var(--\${P}-close-hover-color, var(--\${P}-close-color));
337
+ }
338
+ .\${P}-editor .\${P}-trigger {
339
+ cursor: default;
340
+ }
341
+ .\${P}-overlay {
342
+ position: fixed;
343
+ inset: 0;
344
+ z-index: 9997;
345
+ overflow: hidden;
346
+ overscroll-behavior: none;
347
+ opacity: 0;
348
+ pointer-events: none;
349
+ transition: opacity \${OVERLAY_ANIM_MS}ms ease;
350
+ }
351
+ .\${P}-inline-layer {
352
+ position: fixed;
353
+ inset: 0;
354
+ z-index: 9997;
355
+ overflow: hidden;
356
+ pointer-events: none;
357
+ }
358
+ .\${P}-overlay-editor {
359
+ inset: auto;
360
+ top: var(--cntrl-article-top, 0);
361
+ left: var(--cntrl-article-left, 0);
362
+ width: var(--cntrl-article-width, 100vw) !important;
363
+ height: var(--cntrl-viewport-height, 100vh) !important;
364
+ }
365
+ .\${P}-overlay-edit-mode {
366
+ z-index: 1;
367
+ }
368
+ .\${P}-overlay-active {
369
+ opacity: 1;
370
+ pointer-events: auto;
371
+ }
372
+ .\${P}-backdrop {
373
+ position: absolute;
374
+ inset: 0;
375
+ background-color: var(--\${P}-overlay-color);
376
+ }
377
+ .\${P}-media-layer {
378
+ position: absolute;
379
+ inset: 0;
380
+ pointer-events: none;
381
+ }
382
+ .\${P}-media {
383
+ position: absolute;
384
+ inset: 0;
385
+ width: 100%;
386
+ height: 100%;
387
+ object-fit: cover;
388
+ opacity: 0;
389
+ transition: opacity \${IMAGE_FADE_MS}ms cubic-bezier(0, 0, 0.58, 1);
390
+ }
391
+ .\${P}-media-contain {
392
+ object-fit: contain;
393
+ }
394
+ .\${P}-media-visible {
395
+ opacity: 1;
396
+ }
397
+ .\${P}-close {
398
+ position: absolute;
399
+ z-index: 2;
400
+ }
401
+ .\${P}-panel {
402
+ position: absolute;
403
+ top: var(--\${P}-panel-y);
404
+ left: var(--\${P}-panel-x);
405
+ z-index: 1;
406
+ box-sizing: border-box;
407
+ max-width: 100%;
408
+ max-height: 100%;
409
+ overflow-y: auto;
410
+ transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y) + 12px));
411
+ background-color: var(--\${P}-panel-color);
412
+ color: var(--\${P}-text-color);
413
+ overscroll-behavior: contain;
414
+ transition: transform \${OVERLAY_ANIM_MS}ms cubic-bezier(0, 0, 0.58, 1);
415
+ }
416
+ .\${P}-overlay-active .\${P}-panel {
417
+ transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y)));
418
+ }
419
+ .\${P}-panel-settled {
420
+ transition: none;
421
+ }
422
+ .\${P}-panel-inline {
423
+ position: relative;
424
+ top: auto;
425
+ left: auto;
426
+ max-height: none;
427
+ transform: none;
428
+ transition: none;
429
+ }
430
+ .\${P}-media-layer-instant .\${P}-media {
431
+ transition: none;
432
+ }
433
+ .\${P}-panel-copy {
434
+ position: absolute;
435
+ pointer-events: none;
436
+ }
437
+ .\${P}-panel-copy .\${P}-row-active .\${P}-title {
438
+ color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
439
+ }
440
+ @media (prefers-reduced-motion: reduce) {
441
+ .\${P}-panel {
442
+ transition: none;
443
+ }
444
+ }
445
+ .\${P}-group ~ .\${P}-group {
446
+ margin-top: var(--\${P}-group-gap);
447
+ }
448
+ .\${P}-row {
449
+ display: grid;
450
+ grid-template-columns: var(--\${P}-grid-columns);
451
+ column-gap: var(--\${P}-column-gap);
452
+ align-items: baseline;
453
+ }
454
+ .\${P}-group-label {
455
+ min-width: 0;
456
+ overflow-wrap: anywhere;
457
+ }
458
+ .\${P}-title {
459
+ min-width: 0;
460
+ overflow-wrap: anywhere;
461
+ transition: color 150ms cubic-bezier(0, 0, 0.58, 1);
462
+ }
463
+ .\${P}-control-anchor {
464
+ position: absolute;
465
+ pointer-events: none;
466
+ z-index: 2;
467
+ }
468
+ .\${P}-title a {
469
+ text-decoration: inherit;
470
+ }
471
+ .\${P}-interactive .\${P}-row:hover .\${P}-title,
472
+ .\${P}-row:focus-within .\${P}-title,
473
+ .\${P}-state-hover .\${P}-row:first-child .\${P}-title {
474
+ color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
475
+ }
476
+ \`;
477
+ }
478
+
479
+ function ArchivePopupMediaItem({
480
+ P,
481
+ media,
482
+ isVisible,
483
+ }: {
484
+ P: string;
485
+ media: ArchivePopupMedia;
486
+ isVisible: boolean;
487
+ }) {
488
+ const videoRef = useRef<HTMLVideoElement>(null);
489
+ const [isLoaded, setIsLoaded] = useState(false);
490
+ const isVideo = isVideoMedia(media);
491
+ const className = cn(
492
+ \`\${P}-media\`,
493
+ media.objectFit === 'contain' && \`\${P}-media-contain\`,
494
+ isVisible && isLoaded && \`\${P}-media-visible\`,
495
+ );
496
+
497
+ useEffect(() => {
498
+ const video = videoRef.current;
499
+ if (!isVideo || !video) return;
500
+ if (isVisible) {
501
+ video.play()?.catch(() => {});
502
+ } else {
503
+ video.pause();
504
+ }
505
+ }, [isVideo, isVisible]);
506
+
507
+ if (isVideo) {
508
+ return (
509
+ <video
510
+ ref={videoRef}
511
+ className={className}
512
+ src={media.assetId}
513
+ muted
514
+ loop
515
+ playsInline
516
+ preload="auto"
517
+ onLoadedData={() => setIsLoaded(true)}
518
+ />
519
+ );
520
+ }
521
+
522
+ return (
523
+ <img
524
+ className={className}
525
+ src={media.assetId}
526
+ alt=""
527
+ decoding="async"
528
+ onLoad={() => setIsLoaded(true)}
529
+ />
530
+ );
531
+ }
532
+
533
+ // A line in each gap, at the right edge of the column it sizes, as Programme's are.
534
+ function renderColumnWidthControls(
535
+ P: string,
536
+ widths: number[],
537
+ paddingLeft: number,
538
+ columnGap: number,
539
+ scaled: (value: number) => string,
540
+ ) {
541
+ const lastWidth = widths[widths.length - 1];
542
+ let columnLeft = paddingLeft;
543
+ return widths.slice(0, -1).map((width, index) => {
544
+ const gapCenter = columnLeft + width + columnGap / 2;
545
+ columnLeft += width + columnGap;
546
+ return (
547
+ <div
548
+ key={ARCHIVE_POPUP_COLUMN_WIDTH_KEYS[index]}
549
+ data-controls={ARCHIVE_POPUP_COLUMN_WIDTH_KEYS[index]}
550
+ data-controls-axis="x"
551
+ data-controls-variant="column-width"
552
+ data-controls-min={String(MIN_COLUMN_WIDTH_PX)}
553
+ // a column grows into the last one, which the editor keeps from going under its own least
554
+ data-controls-max-fraction={String(width + lastWidth)}
555
+ className={\`\${P}-control-anchor\`}
556
+ style={{ top: 0, left: scaled(gapCenter - COLUMN_RESIZE_HANDLE_WIDTH / 2), width: scaled(COLUMN_RESIZE_HANDLE_WIDTH), height: '100%' }}
557
+ />
558
+ );
559
+ });
560
+ }
561
+
562
+ function renderPanelPaddingControls(
563
+ P: string,
564
+ panelWidth: number,
565
+ padding: Padding,
566
+ scaled: (value: number) => string,
567
+ ) {
568
+ const handleSize = (value: number) => scaled(Math.max(value, PADDING_HANDLE_SIZE));
569
+ return (
570
+ <>
571
+ <div
572
+ data-controls="panelPadding.top"
573
+ data-controls-axis="y"
574
+ data-controls-variant="row-padding"
575
+ data-controls-min="0"
576
+ className={\`\${P}-control-anchor\`}
577
+ style={{ top: 0, left: 0, width: '100%', height: handleSize(padding.top) }}
578
+ />
579
+ <div
580
+ data-controls="panelPadding.bottom"
581
+ data-controls-axis="y"
582
+ data-controls-variant="row-padding"
583
+ data-controls-reverse=""
584
+ data-controls-min="0"
585
+ className={\`\${P}-control-anchor\`}
586
+ style={{ bottom: 0, left: 0, width: '100%', height: handleSize(padding.bottom) }}
587
+ />
588
+ <div
589
+ data-controls="panelPadding.left"
590
+ data-controls-axis="x"
591
+ data-controls-variant="column-padding"
592
+ data-controls-min="0"
593
+ data-controls-max-fraction={String(Math.max(0, panelWidth - padding.right))}
594
+ className={\`\${P}-control-anchor\`}
595
+ style={{ top: 0, left: 0, width: handleSize(padding.left), height: '100%' }}
596
+ />
597
+ <div
598
+ data-controls="panelPadding.right"
599
+ data-controls-axis="x"
600
+ data-controls-variant="column-padding"
601
+ data-controls-reverse=""
602
+ data-controls-min="0"
603
+ data-controls-max-fraction={String(Math.max(0, panelWidth - padding.left))}
604
+ className={\`\${P}-control-anchor\`}
605
+ style={{ top: 0, right: 0, width: handleSize(padding.right), height: '100%' }}
606
+ />
607
+ </>
608
+ );
609
+ }
610
+
611
+ export function ArchivePopup({
612
+ settings,
613
+ content,
614
+ isEditor,
615
+ isEditMode,
616
+ isPreviewMode,
617
+ activeEvent,
618
+ portalId,
619
+ currentState,
620
+ unavailableStates,
621
+ }: ArchivePopupProps) {
622
+ const { prefix: P } = useScopedStyles();
623
+ const {
624
+ type = 'a',
625
+ triggerLabel = 'Archive',
626
+ closeLabel = 'Close',
627
+ columns = ARCHIVE_POPUP_MIN_COLUMNS,
628
+ columnGap = DEFAULT_COLUMN_GAP,
629
+ panelPosition,
630
+ panelWidth = DEFAULT_PANEL_WIDTH,
631
+ panelPadding = DEFAULT_PANEL_PADDING,
632
+ panelRadius = 0,
633
+ groupGap = 0.0139,
634
+ triggerColor = '#000000',
635
+ triggerHoverColor = '#666666',
636
+ closeColor = '#000000',
637
+ closeHoverColor = '#666666',
638
+ panelColor = '#FFFFFF',
639
+ textColor = '#333132',
640
+ textHoverColor = '#BBBBBB',
641
+ overlayColor = '#FFFFFFE6',
642
+ } = settings;
643
+ const items = content ?? [];
644
+ const wrapperRef = useRef<HTMLDivElement>(null);
645
+ const triggerRef = useRef<HTMLButtonElement>(null);
646
+ const overlayRef = useRef<HTMLDivElement>(null);
647
+ const closeRef = useRef<HTMLButtonElement>(null);
648
+ const panelRef = useRef<HTMLDivElement>(null);
649
+ const inlineLayerRef = useRef<HTMLDivElement>(null);
650
+ const [isOpenUser, setIsOpen] = useState(false);
651
+ const [isOverlayMounted, setIsOverlayMounted] = useState(false);
652
+ const [isOverlayActive, setIsOverlayActive] = useState(false);
653
+ const [isOverlaySettled, setIsOverlaySettled] = useState(false);
654
+ const [activeIndex, setActiveIndex] = useState<number | null>(null);
655
+ const [mountedMedia, setMountedMedia] = useState<Set<number>>(() => new Set());
656
+ const [closePosition, setClosePosition] = useState<{ top: number; left: number } | null>(null);
657
+ const [layoutStyle, setLayoutStyle] = useState<CSSProperties>({});
658
+ const [copyRect, setCopyRect] = useState<{ top: number; left: number; width: number } | null>(null);
659
+ const [isMediaCut, setIsMediaCut] = useState(false);
660
+
661
+ const isEditorCanvas = Boolean(isEditor && !isPreviewMode);
662
+ const isInteractive = !isEditor || Boolean(isPreviewMode);
663
+ // B has no popup to open: its panel is always shown in place of the label.
664
+ const isInline = type === 'b';
665
+ const isOpenPinned = isEditorCanvas && currentState === 'open' && !unavailableStates?.includes('open');
666
+ // Escape from preview lands in edit mode: a popup opened there stays open, with its controls.
667
+ const isOpen = !isInline && (isOpenPinned || ((isInteractive || Boolean(isEditMode)) && isOpenUser));
668
+ const scaled = (value: number) => scalingValue(value, isEditor ?? false);
669
+ const scopedCss = useMemo(() => getCSS(P), [P]);
670
+ const groups = useMemo(() => groupArchiveRows(content ?? []), [content]);
671
+ const panelOffset = PANEL_POSITION_OFFSETS[panelPosition as ArchivePopupPanelPosition] ?? PANEL_POSITION_OFFSETS.center;
672
+ const columnCount = getColumnCount(columns);
673
+ const columnWidths = resolveArchivePopupColumnWidths(settings);
674
+ // the group takes the first column, the titles the rest
675
+ const titleKeys = ['title', ...ARCHIVE_POPUP_EXTRA_TITLE_KEYS].slice(0, columnCount - 1) as Array<'title' | typeof ARCHIVE_POPUP_EXTRA_TITLE_KEYS[number]>;
676
+
677
+ useLightboxScrollLock(isOpen && !isEditorCanvas);
678
+
679
+ useEffect(() => {
680
+ if (isEditorCanvas && !isEditMode) setIsOpen(false);
681
+ }, [isEditorCanvas, isEditMode]);
682
+
683
+ useEffect(() => {
684
+ if (isOpen) {
685
+ setLayoutStyle(getLightboxLayoutStyle(wrapperRef.current));
686
+ setIsOverlayMounted(true);
687
+ return;
688
+ }
689
+ setIsOverlayActive(false);
690
+ setActiveIndex(null);
691
+ const timer = window.setTimeout(() => setIsOverlayMounted(false), OVERLAY_ANIM_MS);
692
+ return () => window.clearTimeout(timer);
693
+ }, [isOpen]);
694
+
695
+ // Activate only after the mounted overlay's hidden styles are applied, or the appear has nothing to transition from.
696
+ useEffect(() => {
697
+ if (!isOpen || !isOverlayMounted) return;
698
+ overlayRef.current?.getBoundingClientRect();
699
+ const frame = requestAnimationFrame(() => setIsOverlayActive(true));
700
+ return () => cancelAnimationFrame(frame);
701
+ }, [isOpen, isOverlayMounted]);
702
+
703
+ // Canvas controls measure their anchors once, so they wait for the panel to finish sliding in.
704
+ useEffect(() => {
705
+ if (!isOverlayActive) {
706
+ setIsOverlaySettled(false);
707
+ return;
708
+ }
709
+ const timer = window.setTimeout(() => setIsOverlaySettled(true), OVERLAY_ANIM_MS);
710
+ return () => window.clearTimeout(timer);
711
+ }, [isOverlayActive]);
712
+
713
+ // The close button sits exactly where the trigger is, so the label swaps in place.
714
+ const updateClosePosition = useCallback(() => {
715
+ const trigger = triggerRef.current;
716
+ const overlay = overlayRef.current;
717
+ if (!trigger || !overlay) return;
718
+ const triggerRect = trigger.getBoundingClientRect();
719
+ const overlayRect = overlay.getBoundingClientRect();
720
+ setClosePosition({ top: triggerRect.top - overlayRect.top, left: triggerRect.left - overlayRect.left });
721
+ }, []);
722
+
723
+ useLayoutEffect(() => {
724
+ if (!isOverlayMounted) return;
725
+ updateClosePosition();
726
+ window.addEventListener('resize', updateClosePosition);
727
+ return () => window.removeEventListener('resize', updateClosePosition);
728
+ }, [isOverlayMounted, updateClosePosition]);
729
+
730
+ useEffect(() => {
731
+ if (!isOpen || !isInteractive) return;
732
+ closeRef.current?.focus({ preventScroll: true });
733
+ const onKeyDown = (event: KeyboardEvent) => {
734
+ if (event.key === 'Escape') setIsOpen(false);
735
+ };
736
+ document.addEventListener('keydown', onKeyDown);
737
+ return () => document.removeEventListener('keydown', onKeyDown);
738
+ }, [isOpen, isInteractive]);
739
+
740
+ // B's media fills the screen above the page, so a copy of the panel is laid exactly over the real one to stay readable.
741
+ useLayoutEffect(() => {
742
+ if (!isInline || activeIndex === null) return;
743
+ const panelEl = panelRef.current;
744
+ const layer = inlineLayerRef.current;
745
+ if (!panelEl || !layer) return;
746
+ const panelRect = panelEl.getBoundingClientRect();
747
+ const layerRect = layer.getBoundingClientRect();
748
+ setCopyRect({ top: panelRect.top - layerRect.top, left: panelRect.left - layerRect.left, width: panelRect.width });
749
+ }, [isInline, activeIndex]);
750
+
751
+ // The copy stays over the list while the media fades out, so the list never shows through a fading image.
752
+ useEffect(() => {
753
+ if (activeIndex !== null) return;
754
+ const timer = window.setTimeout(() => setCopyRect(null), IMAGE_FADE_MS);
755
+ return () => window.clearTimeout(timer);
756
+ }, [activeIndex]);
757
+
758
+ // The copy is only true to the panel until the page moves, so scrolling cuts the media at once rather than locking it,
759
+ // fading out included: a copy left over the list would stay put while the list scrolls away under it.
760
+ const isCopyShown = copyRect !== null;
761
+ useEffect(() => {
762
+ if (!isInline || !isCopyShown) return;
763
+ const cut = () => {
764
+ setIsMediaCut(true);
765
+ setActiveIndex(null);
766
+ setCopyRect(null);
767
+ };
768
+ document.addEventListener('scroll', cut, { capture: true, passive: true });
769
+ window.addEventListener('resize', cut);
770
+ return () => {
771
+ document.removeEventListener('scroll', cut, { capture: true });
772
+ window.removeEventListener('resize', cut);
773
+ };
774
+ }, [isInline, isCopyShown]);
775
+
776
+ const close = () => {
777
+ if (!isInteractive) return;
778
+ setIsOpen(false);
779
+ triggerRef.current?.focus({ preventScroll: true });
780
+ };
781
+
782
+ const showRowMedia = (index: number) => {
783
+ if (!isInteractive || !items[index]?.image?.assetId) {
784
+ setActiveIndex(null);
785
+ return;
786
+ }
787
+ setMountedMedia((prev) => (prev.has(index) ? prev : new Set(prev).add(index)));
788
+ if (isInline && activeIndex === null) setLayoutStyle(getLightboxLayoutStyle(wrapperRef.current));
789
+ setIsMediaCut(false);
790
+ setActiveIndex(index);
791
+ };
792
+
793
+ const hideRowMedia = (index: number) => {
794
+ setActiveIndex((current) => (current === index ? null : current));
795
+ };
796
+
797
+ // Title links only navigate on a live page or in preview, not on the editor canvas.
798
+ const onPanelClickCapture = (event: MouseEvent<HTMLDivElement>) => {
799
+ if (!isInteractive && (event.target as HTMLElement).closest('a')) {
800
+ event.preventDefault();
801
+ }
802
+ };
803
+
804
+ const triggerTypographyCss = omitTextColors(textStylesToCss(resolveTextStyle(settings, 'trigger'), isEditor));
805
+ const columnTypographyCss = ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES.slice(0, columnCount).map((prefix) => (
806
+ omitTextColors(textStylesToCss(resolveTextStyle(settings, prefix, 'list'), isEditor))
807
+ ));
808
+
809
+ const colorVars = buildColorVars(P, {
810
+ triggerColor,
811
+ triggerHoverColor,
812
+ closeColor,
813
+ closeHoverColor,
814
+ panelColor,
815
+ textColor,
816
+ textHoverColor,
817
+ overlayColor,
818
+ }, COLOR_VAR_MAP, STATE_KEYS);
819
+ const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
820
+ const interactiveClass = isInteractive ? \`\${P}-interactive\` : '';
821
+
822
+ const mediaLayer = (
823
+ <div className={cn(\`\${P}-media-layer\`, isMediaCut && \`\${P}-media-layer-instant\`)} aria-hidden="true">
824
+ {[...mountedMedia].map((index) => {
825
+ const media = items[index]?.image;
826
+ if (!media?.assetId) return null;
827
+ return (
828
+ <ArchivePopupMediaItem
829
+ key={\`\${index}-\${media.assetId}\`}
830
+ P={P}
831
+ media={media}
832
+ isVisible={activeIndex === index}
833
+ />
834
+ );
835
+ })}
836
+ </div>
837
+ );
838
+ // Inline there is no slide-in to wait for, so the canvas controls can measure straight away.
839
+ const showPanelControls = Boolean(isEditMode) && (isInline || isOverlaySettled);
840
+
841
+ const renderPanel = (isCopy: boolean) => (
842
+ <div
843
+ ref={isCopy ? undefined : panelRef}
844
+ className={cn(
845
+ \`\${P}-panel\`,
846
+ // Only the open and close slide; once open, a new position or size moves the panel straight there.
847
+ isOverlayActive && isOverlaySettled && \`\${P}-panel-settled\`,
848
+ isInline && \`\${P}-panel-inline\`,
849
+ isCopy && \`\${P}-panel-copy\`,
850
+ )}
851
+ style={{
852
+ width: scaled(panelWidth),
853
+ paddingTop: scaled(panelPadding.top),
854
+ paddingRight: scaled(panelPadding.right),
855
+ paddingBottom: scaled(panelPadding.bottom),
856
+ paddingLeft: scaled(panelPadding.left),
857
+ borderRadius: scaled(panelRadius),
858
+ [\`--\${P}-group-gap\`]: scaled(groupGap),
859
+ [\`--\${P}-panel-x\`]: panelOffset.x,
860
+ [\`--\${P}-panel-y\`]: panelOffset.y,
861
+ [\`--\${P}-grid-columns\`]: getGridTemplateColumns(columnWidths),
862
+ [\`--\${P}-column-gap\`]: scaled(columnGap),
863
+ ...(isCopy && copyRect ? { top: copyRect.top, left: copyRect.left, width: copyRect.width } : {}),
864
+ } as CSSProperties}
865
+ data-lightbox-scrollable={isInline ? undefined : ''}
866
+ aria-hidden={isCopy || undefined}
867
+ onMouseLeave={isCopy ? undefined : () => setActiveIndex(null)}
868
+ onClickCapture={isCopy ? undefined : onPanelClickCapture}
869
+ >
870
+ {!isCopy && showPanelControls && renderPanelPaddingControls(P, panelWidth, panelPadding, scaled)}
871
+ {!isCopy && showPanelControls && renderColumnWidthControls(P, columnWidths, panelPadding.left, columnGap, scaled)}
872
+ {groups.map((group, groupIndex) => (
873
+ <Fragment key={groupIndex}>
874
+ {!isCopy && showPanelControls && groupIndex > 0 && (
875
+ // Left at its static top, the anchor sits right where the gap above this group starts.
876
+ <div
877
+ data-controls="groupGap"
878
+ data-controls-paired=""
879
+ data-controls-axis="y"
880
+ data-controls-reverse=""
881
+ data-controls-min="0"
882
+ className={\`\${P}-control-anchor\`}
883
+ style={{ left: 0, width: '100%', height: scaled(Math.max(groupGap, PADDING_HANDLE_SIZE)) }}
884
+ />
885
+ )}
886
+ <div className={\`\${P}-group\`}>
887
+ {group.rows.map(({ item, index }, rowIndex) => (
888
+ <div
889
+ key={index}
890
+ className={cn(\`\${P}-row\`, isCopy && index === activeIndex && \`\${P}-row-active\`)}
891
+ {...(isCopy ? {} : {
892
+ onMouseEnter: () => showRowMedia(index),
893
+ onMouseLeave: () => hideRowMedia(index),
894
+ onFocus: () => showRowMedia(index),
895
+ onBlur: () => hideRowMedia(index),
896
+ })}
897
+ >
898
+ <span className={\`\${P}-group-label\`} style={columnTypographyCss[0]}>
899
+ {rowIndex === 0 ? group.label : ''}
900
+ </span>
901
+ {titleKeys.map((key, titleIndex) => {
902
+ const title = item[key];
903
+ return (
904
+ <div key={key} className={\`\${P}-title\`} style={columnTypographyCss[titleIndex + 1]}>
905
+ {Array.isArray(title) ? <RichTextRenderer content={title} /> : title}
906
+ </div>
907
+ );
908
+ })}
909
+ </div>
910
+ ))}
911
+ </div>
912
+ </Fragment>
913
+ ))}
914
+ </div>
915
+ );
916
+
917
+ const overlay = isOverlayMounted ? (
918
+ <div
919
+ ref={overlayRef}
920
+ className={cn(
921
+ \`\${P}-overlay\`,
922
+ isEditor && \`\${P}-overlay-editor\`,
923
+ isEditMode && \`\${P}-overlay-edit-mode\`,
924
+ isOverlayActive && \`\${P}-overlay-active\`,
925
+ interactiveClass,
926
+ stateClass,
927
+ )}
928
+ style={{ ...colorVars, ...layoutStyle }}
929
+ role="dialog"
930
+ aria-modal="true"
931
+ aria-label={triggerLabel}
932
+ data-selection="none"
933
+ >
934
+ <div className={\`\${P}-backdrop\`} aria-hidden="true" onClick={close} />
935
+ {mediaLayer}
936
+ <button
937
+ ref={closeRef}
938
+ type="button"
939
+ className={\`\${P}-close\`}
940
+ style={{
941
+ ...triggerTypographyCss,
942
+ top: closePosition?.top ?? 0,
943
+ left: closePosition?.left ?? 0,
944
+ visibility: closePosition ? 'visible' : 'hidden',
945
+ }}
946
+ onClick={close}
947
+ >
948
+ {closeLabel}
949
+ </button>
950
+ {renderPanel(false)}
951
+ </div>
952
+ ) : null;
953
+
954
+ const inlineLayer = isInline && mountedMedia.size > 0 ? (
955
+ <div
956
+ ref={inlineLayerRef}
957
+ className={cn(\`\${P}-inline-layer\`, isEditor && \`\${P}-overlay-editor\`, interactiveClass, stateClass)}
958
+ style={{ ...colorVars, ...layoutStyle }}
959
+ aria-hidden="true"
960
+ data-selection="none"
961
+ >
962
+ {mediaLayer}
963
+ {copyRect && renderPanel(true)}
964
+ </div>
965
+ ) : null;
966
+ const portalContent = overlay ?? inlineLayer;
967
+
968
+ return (
969
+ <>
970
+ <style dangerouslySetInnerHTML={{ __html: scopedCss }} />
971
+ <div
972
+ ref={wrapperRef}
973
+ className={cn(isEditorCanvas && \`\${P}-editor\`, interactiveClass, stateClass)}
974
+ style={colorVars}
975
+ >
976
+ {isInline ? renderPanel(false) : (
977
+ <button
978
+ ref={triggerRef}
979
+ type="button"
980
+ className={\`\${P}-trigger\`}
981
+ style={triggerTypographyCss}
982
+ aria-haspopup="dialog"
983
+ aria-expanded={isOpen}
984
+ onClick={() => {
985
+ if (isInteractive) setIsOpen(true);
986
+ }}
987
+ >
988
+ {triggerLabel}
989
+ </button>
990
+ )}
991
+ </div>
992
+ {portalContent && typeof document !== 'undefined' && createPortal(
993
+ portalContent,
994
+ (portalId ? document.getElementById(portalId) : null) ?? document.body,
995
+ )}
996
+ </>
997
+ );
998
+ }
999
+ `,t=`import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
2
1000
  import { CommonComponentProps } from '../props';
3
1001
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
4
1002
  import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
@@ -2639,16 +3637,16 @@ export function Burger({
2639
3637
  </div>
2640
3638
  );
2641
3639
  }
2642
- `,t=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3640
+ `,i=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2643
3641
  import { CommonComponentProps } from '../props';
2644
- import { useScopedStyles } from '../utils/index';
3642
+ import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
2645
3643
 
2646
3644
  type ClickGallerieItem = {
2647
3645
  image: {
2648
3646
  assetId: string;
2649
3647
  name: string;
2650
3648
  };
2651
- link: string;
3649
+ link?: ContentLink;
2652
3650
  };
2653
3651
 
2654
3652
  type ImageSizeSettings = {
@@ -2683,7 +3681,7 @@ type ImageMeta = {
2683
3681
  interface PlacedImage {
2684
3682
  id: number;
2685
3683
  assetId: string;
2686
- link: string;
3684
+ link?: ContentLink;
2687
3685
  name: string;
2688
3686
  x: number;
2689
3687
  y: number;
@@ -3146,13 +4144,9 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
3146
4144
  cursor: useCustomCursor ? 'none' : 'default',
3147
4145
  }}
3148
4146
  >
3149
- {target === 'area' && img.link ? (
3150
- <a href={img.link} target="_blank" rel="noreferrer" className={\`\${P}-link\`}>
3151
- <img src={img.assetId} alt={img.name} className={\`\${P}-image\`} />
3152
- </a>
3153
- ) : (
4147
+ <LinkWrapper link={target === 'area' ? img.link : undefined} className={\`\${P}-link\`}>
3154
4148
  <img src={img.assetId} alt={img.name} className={\`\${P}-image\`} />
3155
- )}
4149
+ </LinkWrapper>
3156
4150
  </div>
3157
4151
  ))}
3158
4152
  {isInside && useCustomCursor && (
@@ -3172,7 +4166,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
3172
4166
  </>
3173
4167
  );
3174
4168
  }
3175
- `,i=`import { useCallback, useEffect, useMemo, useState } from 'react';
4169
+ `,o=`import { useCallback, useEffect, useMemo, useState } from 'react';
3176
4170
  import cn from 'classnames';
3177
4171
  import { CommonComponentProps } from '../props';
3178
4172
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
@@ -3920,7 +4914,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
3920
4914
  </>
3921
4915
  );
3922
4916
  }
3923
- `,o=`import React, { useMemo, useState } from 'react';
4917
+ `,r=`import React, { useMemo, useState } from 'react';
3924
4918
  import { CommonComponentProps } from '../props';
3925
4919
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
3926
4920
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -4558,12 +5552,14 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
4558
5552
  };
4559
5553
 
4560
5554
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
4561
- `,r=`import { Splide, SplideSlide } from '@splidejs/react-splide';
5555
+ `,a=`import { Splide, SplideSlide } from '@splidejs/react-splide';
4562
5556
  import '@splidejs/react-splide/css/core';
4563
5557
  import { CommonComponentProps } from '../props';
5558
+ import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
4564
5559
  import {
4565
5560
  buildColorVars,
4566
5561
  getFormFieldValidationError,
5562
+ LinkWrapper,
4567
5563
  scalingValue,
4568
5564
  useLazyVideos,
4569
5565
  useScopedStyles,
@@ -4670,6 +5666,10 @@ function getCSS(P: string): string {
4670
5666
  max-width: 100%;
4671
5667
  object-fit: contain;
4672
5668
  }
5669
+ .\${P}-item-image-wrapper-fit-slider > .\${P}-item-image-wrapper-sizer div {
5670
+ grid-area: 1 / 1;
5671
+ width: 100%;
5672
+ }
4673
5673
  .\${P}-item-image-wrapper-fit-slider > .\${P}-item-slider {
4674
5674
  position: absolute;
4675
5675
  inset: 0;
@@ -5063,7 +6063,10 @@ type SwipeAxis = 'none' | 'horizontal' | 'vertical';
5063
6063
  type GridMedia = {
5064
6064
  assetId: string;
5065
6065
  name?: string;
5066
- type: 'image' | 'video';
6066
+ type: 'image' | 'video' | 'vimeo' | 'youtube';
6067
+ thumbnail?: string;
6068
+ width?: number;
6069
+ height?: number;
5067
6070
  };
5068
6071
 
5069
6072
  type GridMediaPair = {
@@ -5119,8 +6122,7 @@ function getGridDisplayItems(image: GridMedia[] | GridMediaPair[] | undefined):
5119
6122
  }
5120
6123
 
5121
6124
  function isVideoMedia(media: GridMedia): boolean {
5122
- if (media.type === 'video') return true;
5123
- return false;
6125
+ return !isEmbedMedia(media) && media.type === 'video';
5124
6126
  }
5125
6127
 
5126
6128
  function collectGridLightboxMedia(content: any[]): GridMedia[] {
@@ -5144,7 +6146,9 @@ function collectGridLightboxMedia(content: any[]): GridMedia[] {
5144
6146
  function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
5145
6147
  const [pool, setPool] = useState<HTMLDivElement | null>(null);
5146
6148
  useLazyVideos(pool, { preload: 'metadata' });
5147
- if (mediaList.length === 0) return null;
6149
+ // an embed's player is only ever framed where it shows
6150
+ const files = mediaList.filter(media => !isEmbedMedia(media));
6151
+ if (files.length === 0) return null;
5148
6152
 
5149
6153
  return (
5150
6154
  <div
@@ -5159,7 +6163,7 @@ function LightboxMediaPreloadPool({ mediaList }: { mediaList: GridMedia[] }) {
5159
6163
  pointerEvents: 'none',
5160
6164
  }}
5161
6165
  >
5162
- {mediaList.map((media) => (
6166
+ {files.map((media) => (
5163
6167
  isVideoMedia(media) ? (
5164
6168
  <video
5165
6169
  key={media.assetId}
@@ -5201,15 +6205,34 @@ function GridMediaItem({
5201
6205
  media,
5202
6206
  className,
5203
6207
  style,
6208
+ hasLightbox,
5204
6209
  isSplideSlide = false,
5205
6210
  onMediaClick,
5206
6211
  }: {
5207
6212
  media: GridMedia;
5208
6213
  className: string;
5209
6214
  style: React.CSSProperties;
6215
+ /** An embed then plays here as a silent loop, and as it was set to in the lightbox. */
6216
+ hasLightbox: boolean;
5210
6217
  isSplideSlide?: boolean;
5211
6218
  onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
5212
6219
  }) {
6220
+ if (isEmbedMedia(media)) {
6221
+ return (
6222
+ <EmbedMediaFrame
6223
+ media={media}
6224
+ fit={style.objectFit === 'contain' ? 'contain' : 'cover'}
6225
+ silentLoop={hasLightbox}
6226
+ className={className}
6227
+ style={{
6228
+ ...style,
6229
+ cursor: onMediaClick ? 'pointer' : 'default',
6230
+ }}
6231
+ onClick={onMediaClick}
6232
+ />
6233
+ );
6234
+ }
6235
+
5213
6236
  if (isVideoMedia(media)) {
5214
6237
  const videoProps = {
5215
6238
  src: media.assetId,
@@ -5280,20 +6303,14 @@ function getContainRect(box: AnimRect, natural: { width: number; height: number
5280
6303
 
5281
6304
  function LightboxVideo({
5282
6305
  src,
5283
- phase,
5284
6306
  mediaRef,
5285
6307
  mediaStyle,
5286
6308
  onLoadedMetadata,
5287
- onClick,
5288
- onMouseMove,
5289
6309
  }: {
5290
6310
  src: string;
5291
- phase: 'opening' | 'open' | 'closing';
5292
6311
  mediaRef: React.RefObject<HTMLVideoElement>;
5293
6312
  mediaStyle: React.CSSProperties;
5294
6313
  onLoadedMetadata: (e: React.SyntheticEvent<HTMLVideoElement>) => void;
5295
- onClick: (e: React.MouseEvent<HTMLVideoElement>) => void;
5296
- onMouseMove: (e: React.MouseEvent<HTMLVideoElement>) => void;
5297
6314
  }) {
5298
6315
  useEffect(() => {
5299
6316
  const video = mediaRef.current;
@@ -5308,12 +6325,12 @@ function LightboxVideo({
5308
6325
  <video
5309
6326
  ref={mediaRef}
5310
6327
  src={src}
5311
- controls={phase === 'open'}
6328
+ muted
6329
+ autoPlay
6330
+ loop
5312
6331
  playsInline
5313
6332
  preload='auto'
5314
6333
  onLoadedMetadata={onLoadedMetadata}
5315
- onClick={onClick}
5316
- onMouseMove={onMouseMove}
5317
6334
  style={mediaStyle}
5318
6335
  />
5319
6336
  );
@@ -5498,7 +6515,7 @@ function Lightbox({
5498
6515
  const prevItemUrlRef = useRef<string | undefined>(undefined);
5499
6516
  const currentItem = items[index];
5500
6517
  const isCurrentVideo = currentItem ? isVideoMedia(currentItem) : false;
5501
- const isHorizontalNavActive = slideOffset !== 0 || slideAnimating;
6518
+ const isCurrentEmbed = currentItem ? isEmbedMedia(currentItem) : false;
5502
6519
  const isSliding = slideDir !== null;
5503
6520
 
5504
6521
  const handleMediaLoad = useCallback((e: React.SyntheticEvent<HTMLImageElement | HTMLVideoElement>) => {
@@ -5852,50 +6869,14 @@ function Lightbox({
5852
6869
  const swipeBackdropOpacity = swipeOffset > 0 ? Math.max(0, 1 - swipeOffset / 500) : 1;
5853
6870
  const swipeMediaOpacity = swipeOffset > 0 ? Math.max(0.35, 1 - swipeOffset / 500) : 1;
5854
6871
 
6872
+ // an embed's player reports no size of its own, so its stored aspect stands in
6873
+ const naturalSize = isCurrentEmbed && currentItem
6874
+ ? { width: getEmbedAspect(currentItem), height: 1 }
6875
+ : mediaNaturalSize;
5855
6876
  const contentRect = finalRect
5856
- ? (isCover ? finalRect : getContainRect(finalRect, mediaNaturalSize))
6877
+ ? (isCover ? finalRect : getContainRect(finalRect, naturalSize))
5857
6878
  : null;
5858
6879
 
5859
- const handleVideoClick = (e: React.MouseEvent<HTMLVideoElement>) => {
5860
- e.stopPropagation();
5861
- if (touchInteractionRef.current) {
5862
- touchInteractionRef.current = false;
5863
- return;
5864
- }
5865
- if (items.length <= 1) return;
5866
-
5867
- const rect = contentRect ?? e.currentTarget.getBoundingClientRect();
5868
- const y = e.clientY - rect.top;
5869
- const controlsZoneHeight = Math.min(52, rect.height * 0.2);
5870
-
5871
- if (y > rect.height - controlsZoneHeight) {
5872
- return;
5873
- }
5874
-
5875
- if (e.clientX - rect.left < rect.width / 2) {
5876
- startProgrammaticSlide(-1);
5877
- return;
5878
- }
5879
-
5880
- startProgrammaticSlide(1);
5881
- };
5882
-
5883
- const handleVideoMouseMove = (e: React.MouseEvent<HTMLVideoElement>) => {
5884
- if (items.length <= 1) return;
5885
-
5886
- const rect = contentRect ?? e.currentTarget.getBoundingClientRect();
5887
- const x = e.clientX - rect.left;
5888
- const y = e.clientY - rect.top;
5889
- const controlsZoneHeight = Math.min(52, rect.height * 0.2);
5890
-
5891
- if (y > rect.height - controlsZoneHeight) {
5892
- e.currentTarget.style.cursor = 'default';
5893
- return;
5894
- }
5895
-
5896
- e.currentTarget.style.cursor = x < rect.width / 2 ? 'w-resize' : 'e-resize';
5897
- };
5898
-
5899
6880
  const backingBaseStyle: React.CSSProperties = {
5900
6881
  position: 'fixed',
5901
6882
  top: viewportRect?.top,
@@ -5940,8 +6921,7 @@ function Lightbox({
5940
6921
  width: contentRect?.width,
5941
6922
  height: contentRect?.height,
5942
6923
  objectFit: objectFitStyle,
5943
- pointerEvents: isCurrentVideo && isOpen && !isHorizontalNavActive ? 'auto' : 'none',
5944
- touchAction: isCurrentVideo && isOpen ? 'none' : undefined,
6924
+ pointerEvents: 'none',
5945
6925
  };
5946
6926
 
5947
6927
  const slideWidth = viewportRect?.width ?? 0;
@@ -5964,10 +6944,14 @@ function Lightbox({
5964
6944
  pointerEvents: 'none',
5965
6945
  };
5966
6946
 
6947
+ // over an embed with controls the overlays stop short of the player's own control bar
6948
+ const navOverlayInset = isCurrentEmbed && currentItem && getEmbedPlayback(currentItem).controls && contentRect
6949
+ ? Math.min(52, contentRect.height * 0.2)
6950
+ : 0;
5967
6951
  const navOverlayBaseStyle = contentRect ? {
5968
6952
  position: 'fixed' as const,
5969
6953
  top: contentRect.top,
5970
- height: contentRect.height,
6954
+ height: contentRect.height - navOverlayInset,
5971
6955
  width: contentRect.width / 2,
5972
6956
  zIndex: 9999,
5973
6957
  } : null;
@@ -6068,11 +7052,20 @@ function Lightbox({
6068
7052
 
6069
7053
  {finalRect && viewportRect && neighborItem && (
6070
7054
  <div style={neighborBackingStyle} onTransitionEnd={handleSlideTransitionEnd}>
6071
- {isVideoMedia(neighborItem) ? (
7055
+ {isEmbedMedia(neighborItem) ? (
7056
+ <img
7057
+ key={\`neighbor-\${neighborIndex}-\${neighborItem.assetId}\`}
7058
+ src={neighborItem.thumbnail}
7059
+ alt={neighborItem.name}
7060
+ style={neighborMediaStyle}
7061
+ />
7062
+ ) : isVideoMedia(neighborItem) ? (
6072
7063
  <video
6073
7064
  key={\`neighbor-\${neighborIndex}-\${neighborItem.assetId}\`}
6074
7065
  src={neighborItem.assetId}
6075
7066
  muted
7067
+ autoPlay
7068
+ loop
6076
7069
  playsInline
6077
7070
  preload='auto'
6078
7071
  style={neighborMediaStyle}
@@ -6090,16 +7083,22 @@ function Lightbox({
6090
7083
 
6091
7084
  {finalRect && viewportRect && currentItem && (
6092
7085
  <div style={currentBackingStyle} onTransitionEnd={handleSlideTransitionEnd}>
6093
- {isCurrentVideo ? (
7086
+ {isCurrentEmbed ? (
7087
+ <EmbedMediaFrame
7088
+ key={\`\${index}-\${currentItem.assetId}\`}
7089
+ media={currentItem}
7090
+ fit={isCover ? 'cover' : 'contain'}
7091
+ lazy={false}
7092
+ startsAtOnce
7093
+ style={currentMediaStyle}
7094
+ />
7095
+ ) : isCurrentVideo ? (
6094
7096
  <LightboxVideo
6095
7097
  key={\`\${index}-\${currentItem.assetId}\`}
6096
7098
  src={currentItem.assetId}
6097
- phase={phase}
6098
7099
  mediaRef={mediaRef as React.RefObject<HTMLVideoElement>}
6099
7100
  mediaStyle={currentMediaStyle}
6100
7101
  onLoadedMetadata={handleMediaLoad}
6101
- onClick={handleVideoClick}
6102
- onMouseMove={handleVideoMouseMove}
6103
7102
  />
6104
7103
  ) : (
6105
7104
  <img
@@ -6114,7 +7113,7 @@ function Lightbox({
6114
7113
  </div>
6115
7114
  )}
6116
7115
 
6117
- {isOpen && navOverlayBaseStyle && items.length > 1 && !isCurrentVideo && (
7116
+ {isOpen && navOverlayBaseStyle && items.length > 1 && (
6118
7117
  <>
6119
7118
  <div
6120
7119
  style={{
@@ -6462,7 +7461,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
6462
7461
  {cropContent.map((item: any, index: number) => {
6463
7462
  const hasTitle = hasText(item.title);
6464
7463
  const hasSubtitle = hasText(item.subtitle);
6465
- const itemLink = (item.link?.length ?? 0) > 0 && lightbox === 'off' ? item.link : undefined;
7464
+ const itemLink = lightbox === 'off' && item.link?.value ? item.link : undefined;
6466
7465
  const isLastRow = Math.floor(index / columnsCount)
6467
7466
  === Math.ceil(cropContent.length / columnsCount) - 1;
6468
7467
  const gridColumn = isPartialLastRow && index >= lastRowStartIndex
@@ -6564,16 +7563,11 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
6564
7563
  </div>
6565
7564
  ) : null;
6566
7565
 
6567
- const alignedTextRows = itemLink ? (
6568
- <a href={itemLink} target="_blank" className={\`\${P}-item-text-link\`}>
6569
- {titleRow}
6570
- {subtitleRow}
6571
- </a>
6572
- ) : (
6573
- <>
7566
+ const alignedTextRows = (
7567
+ <LinkWrapper link={itemLink} className={\`\${P}-item-text-link\`}>
6574
7568
  {titleRow}
6575
7569
  {subtitleRow}
6576
- </>
7570
+ </LinkWrapper>
6577
7571
  );
6578
7572
 
6579
7573
  const displayItems = getGridDisplayItems(item.gallery);
@@ -6597,6 +7591,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
6597
7591
  media={displayMedia}
6598
7592
  className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
6599
7593
  style={imageStyle}
7594
+ hasLightbox={lightbox === 'on'}
6600
7595
  onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
6601
7596
  ? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
6602
7597
  : undefined}
@@ -6608,7 +7603,9 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
6608
7603
  {isFitSlider && (
6609
7604
  <div className={\`\${P}-item-image-wrapper-sizer\`} aria-hidden="true">
6610
7605
  {displayItems.map(({ displayMedia }) => (
6611
- isVideoMedia(displayMedia) ? (
7606
+ isEmbedMedia(displayMedia) ? (
7607
+ <div key={\`sizer-\${displayMedia.assetId}\`} style={{ aspectRatio: \`\${getEmbedAspect(displayMedia)}\` }} />
7608
+ ) : isVideoMedia(displayMedia) ? (
6612
7609
  <LazyVideo key={\`sizer-\${displayMedia.assetId}\`} src={displayMedia.assetId} nearPreload='metadata' muted playsInline />
6613
7610
  ) : (
6614
7611
  <img key={\`sizer-\${displayMedia.assetId}\`} src={displayMedia.assetId} alt="" />
@@ -6650,6 +7647,7 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
6650
7647
  media={displayMedia}
6651
7648
  className={\`\${P}-item-\${isVideoMedia(displayMedia) ? 'video' : 'image'}\`.trim()}
6652
7649
  style={imageStyle}
7650
+ hasLightbox={lightbox === 'on'}
6653
7651
  isSplideSlide
6654
7652
  onMediaClick={canOpenLightboxMedia && lightboxIndex >= 0
6655
7653
  ? () => openLightbox(lightboxItemsForEntry, lightboxIndex)
@@ -6697,6 +7695,15 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
6697
7695
  </>
6698
7696
  ) : null;
6699
7697
 
7698
+ // the aligned layout sizes this box whether or not it links anywhere
7699
+ const alignedImage = itemLink ? (
7700
+ <LinkWrapper link={itemLink} className={\`\${P}-item-image-link\`}>
7701
+ {imageContent}
7702
+ </LinkWrapper>
7703
+ ) : (
7704
+ <a className={\`\${P}-item-image-link\`}>{imageContent}</a>
7705
+ );
7706
+
6700
7707
  return (
6701
7708
  <div
6702
7709
  key={index}
@@ -6719,29 +7726,25 @@ export function Grid({ settings, content, isEditor, isPreviewMode, isEditMode, m
6719
7726
  {isTextBeforeImage ? (
6720
7727
  <>
6721
7728
  {alignedTextRows}
6722
- <a href={itemLink} target="_blank" className={\`\${P}-item-image-link\`}>
6723
- {imageContent}
6724
- </a>
7729
+ {alignedImage}
6725
7730
  </>
6726
7731
  ) : (
6727
7732
  <>
6728
- <a href={itemLink} target="_blank" className={\`\${P}-item-image-link\`}>
6729
- {imageContent}
6730
- </a>
7733
+ {alignedImage}
6731
7734
  {alignedTextRows}
6732
7735
  </>
6733
7736
  )}
6734
7737
  </>
6735
7738
  ) : itemLink ? (
6736
7739
  <>
6737
- <a href={itemLink} target="_blank" className={\`\${P}-item-image-link\`}>
7740
+ <LinkWrapper link={itemLink} className={\`\${P}-item-image-link\`}>
6738
7741
  {typeCTextBlock}
6739
7742
  {imageContent}
6740
- </a>
7743
+ </LinkWrapper>
6741
7744
  {!isTextBeforeImage && (
6742
- <a href={itemLink} target="_blank" className={\`\${P}-item-text-link\`}>
7745
+ <LinkWrapper link={itemLink} className={\`\${P}-item-text-link\`}>
6743
7746
  {typeABText}
6744
- </a>
7747
+ </LinkWrapper>
6745
7748
  )}
6746
7749
  </>
6747
7750
  ) : (
@@ -6864,10 +7867,11 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
6864
7867
  };
6865
7868
 
6866
7869
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
6867
- `,a=`import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
7870
+ `,s=`import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
6868
7871
  import { CommonComponentProps } from '../props';
6869
7872
  import { scalingValue } from '../utils/scalingValue';
6870
7873
  import { useScopedStyles } from '../utils/useScopedStyles';
7874
+ import { EmbedMediaFrame, isEmbedMedia } from '../utils/index';
6871
7875
  import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
6872
7876
 
6873
7877
  const DEG_PER_SEC_PER_SPEED_UNIT = 10;
@@ -6938,7 +7942,10 @@ function getCSS(P: string): string {
6938
7942
  type HelixMedia = {
6939
7943
  assetId?: string;
6940
7944
  name?: string;
6941
- type?: 'image' | 'video';
7945
+ type?: 'image' | 'video' | 'vimeo' | 'youtube';
7946
+ thumbnail?: string;
7947
+ width?: number;
7948
+ height?: number;
6942
7949
  };
6943
7950
 
6944
7951
  export type HelixContentItem = {
@@ -7033,6 +8040,7 @@ function getAspectHeightFactor(imageDisplay: ImageDisplay): number {
7033
8040
  }
7034
8041
 
7035
8042
  function isVideoMedia(media: HelixMedia): boolean {
8043
+ if (isEmbedMedia(media)) return false;
7036
8044
  if (media.type === 'video') return true;
7037
8045
  if (media.type === 'image') return false;
7038
8046
  return /\\.(mp4|webm|ogg|mov)(\\?|$)/i.test(media.name ?? '') || /\\.(mp4|webm|ogg|mov)(\\?|$)/i.test(media.assetId ?? '');
@@ -7380,7 +8388,15 @@ export function Helix({
7380
8388
  objectPosition: 'center',
7381
8389
  }
7382
8390
  : mediaStyle;
7383
- const mediaNode = isVideoMedia(media) ? (
8391
+ const mediaNode = isEmbedMedia(media) ? (
8392
+ <EmbedMediaFrame
8393
+ className={\`\${P}-media\`}
8394
+ // the frame positions itself inline, so the cover's absolute placement is given the same way
8395
+ style={isCover ? { ...coverMediaStyle, position: 'absolute', inset: 0 } : coverMediaStyle}
8396
+ media={media}
8397
+ fit={isCover ? 'cover' : 'contain'}
8398
+ />
8399
+ ) : isVideoMedia(media) ? (
7384
8400
  <LazyVideo
7385
8401
  className={\`\${P}-media\`}
7386
8402
  style={coverMediaStyle}
@@ -7424,8 +8440,8 @@ export function Helix({
7424
8440
  </>
7425
8441
  );
7426
8442
  }
7427
- `,s=`import { CommonComponentProps } from '../props';
7428
- import { scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
8443
+ `,l=`import { CommonComponentProps } from '../props';
8444
+ import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
7429
8445
  import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
7430
8446
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
7431
8447
  import { createPortal } from 'react-dom';
@@ -7787,7 +8803,10 @@ type HiveMedia = {
7787
8803
  assetId: string;
7788
8804
  name?: string;
7789
8805
  objectFit?: 'cover' | 'contain';
7790
- type?: 'image' | 'video';
8806
+ type?: 'image' | 'video' | 'vimeo' | 'youtube';
8807
+ thumbnail?: string;
8808
+ width?: number;
8809
+ height?: number;
7791
8810
  };
7792
8811
 
7793
8812
  type HiveMediaPair = {
@@ -7985,6 +9004,11 @@ function preloadMediaDimensions(
7985
9004
  media: HiveMedia,
7986
9005
  onDimensions: (url: string, width: number, height: number) => void,
7987
9006
  ) {
9007
+ if (isEmbedMedia(media)) {
9008
+ onDimensions(media.assetId, getEmbedAspect(media), 1);
9009
+ return;
9010
+ }
9011
+
7988
9012
  if (isVideoMedia(media)) {
7989
9013
  const video = document.createElement('video');
7990
9014
  const handleMetadata = () => {
@@ -8032,7 +9056,9 @@ function collectAllHiveMedia(content: HiveContentItem[]): HiveMedia[] {
8032
9056
  function PreloadedMediaPool({ mediaList }: { mediaList: HiveMedia[] }) {
8033
9057
  const [pool, setPool] = useState<HTMLDivElement | null>(null);
8034
9058
  useLazyVideos(pool, { preload: 'metadata' });
8035
- if (mediaList.length === 0) return null;
9059
+ // an embed's player is only ever framed where it shows
9060
+ const files = mediaList.filter(media => !isEmbedMedia(media));
9061
+ if (files.length === 0) return null;
8036
9062
 
8037
9063
  return (
8038
9064
  <div
@@ -8047,7 +9073,7 @@ function PreloadedMediaPool({ mediaList }: { mediaList: HiveMedia[] }) {
8047
9073
  pointerEvents: 'none',
8048
9074
  }}
8049
9075
  >
8050
- {mediaList.map((media) => (
9076
+ {files.map((media) => (
8051
9077
  isVideoMedia(media) ? (
8052
9078
  <video
8053
9079
  key={media.assetId}
@@ -8252,6 +9278,7 @@ function getDisplayItems(gallery: HiveMedia[] | HiveMediaPair[] | undefined): Di
8252
9278
  }
8253
9279
 
8254
9280
  function isVideoMedia(media: HiveMedia): boolean {
9281
+ if (isEmbedMedia(media)) return false;
8255
9282
  if (media.type === 'video') return true;
8256
9283
  return /\\.(mp4|webm|ogg|mov)(\\?|#|$)/i.test(media.assetId);
8257
9284
  }
@@ -8269,6 +9296,24 @@ function MediaItem({
8269
9296
  gridIndex?: number;
8270
9297
  onMediaClick?: (e: React.MouseEvent<HTMLElement>) => void;
8271
9298
  }) {
9299
+ if (isEmbedMedia(media)) {
9300
+ return (
9301
+ <EmbedMediaFrame
9302
+ media={media}
9303
+ fit={style.objectFit === 'contain' ? 'contain' : 'cover'}
9304
+ // a cell opens the lightbox, where the video plays as it was set to
9305
+ silentLoop
9306
+ className={className}
9307
+ data-hive-grid-index={gridIndex}
9308
+ style={{
9309
+ ...style,
9310
+ cursor: onMediaClick ? 'pointer' : 'default',
9311
+ }}
9312
+ onClick={onMediaClick}
9313
+ />
9314
+ );
9315
+ }
9316
+
8272
9317
  if (isVideoMedia(media)) {
8273
9318
  return (
8274
9319
  <LazyVideo
@@ -8305,7 +9350,6 @@ function MediaItem({
8305
9350
 
8306
9351
  function LightboxVideo({
8307
9352
  src,
8308
- phase,
8309
9353
  onMediaElement,
8310
9354
  wrapperStyle,
8311
9355
  videoStyle,
@@ -8313,7 +9357,6 @@ function LightboxVideo({
8313
9357
  onTransitionEnd,
8314
9358
  }: {
8315
9359
  src: string;
8316
- phase: 'opening' | 'open' | 'closing';
8317
9360
  onMediaElement?: (element: HTMLVideoElement | null) => void;
8318
9361
  wrapperStyle: React.CSSProperties;
8319
9362
  videoStyle: React.CSSProperties;
@@ -8338,11 +9381,12 @@ function LightboxVideo({
8338
9381
  key={src}
8339
9382
  ref={videoRef}
8340
9383
  src={src}
8341
- controls={phase === 'open'}
9384
+ muted
9385
+ autoPlay
9386
+ loop
8342
9387
  playsInline
8343
9388
  preload='auto'
8344
9389
  onLoadedMetadata={onLoadedMetadata}
8345
- onClick={(e) => e.stopPropagation()}
8346
9390
  style={videoStyle}
8347
9391
  />
8348
9392
  </div>
@@ -8360,11 +9404,17 @@ function LightboxSideMedia({
8360
9404
  onTransitionEnd?: (e: React.TransitionEvent<HTMLElement>) => void;
8361
9405
  onMeasure?: (url: string, width: number, height: number) => void;
8362
9406
  }) {
9407
+ if (isEmbedMedia(media)) {
9408
+ return <img src={media.thumbnail} alt={media.name} style={style} onTransitionEnd={onTransitionEnd} />;
9409
+ }
9410
+
8363
9411
  if (isVideoMedia(media)) {
8364
9412
  return (
8365
9413
  <video
8366
9414
  src={media.assetId}
8367
9415
  muted
9416
+ autoPlay
9417
+ loop
8368
9418
  playsInline
8369
9419
  preload='auto'
8370
9420
  style={style}
@@ -8472,6 +9522,7 @@ function Lightbox({
8472
9522
  const prevItemUrlRef = useRef<string | undefined>(undefined);
8473
9523
  const currentItem = items[index];
8474
9524
  const isCurrentVideo = currentItem ? isVideoMedia(currentItem) : false;
9525
+ const isCurrentEmbed = currentItem ? isEmbedMedia(currentItem) : false;
8475
9526
  const isHorizontalNavActive = navSwipeOffset !== 0 || navSwipeAnimating;
8476
9527
  const allowSwipeDismiss = !isEditMode && (!isEditor || Boolean(isPreviewMode));
8477
9528
  const allowNavigation = canNavigate && !isEditMode;
@@ -9236,10 +10287,9 @@ function Lightbox({
9236
10287
  : phase === 'opening' || isClosing
9237
10288
  ? \`opacity \${LIGHTBOX_ANIM_MS}ms \${LIGHTBOX_EASING}\`
9238
10289
  : 'none',
9239
- pointerEvents: isCurrentVideo && isOpen && !isHorizontalNavActive ? 'auto' : 'none',
9240
- touchAction: isCurrentVideo && isOpen ? 'none' : undefined,
10290
+ pointerEvents: 'none',
9241
10291
  zIndex: 1,
9242
- overflow: isCurrentVideo ? 'hidden' : undefined,
10292
+ overflow: isCurrentVideo || isCurrentEmbed ? 'hidden' : undefined,
9243
10293
  };
9244
10294
 
9245
10295
  const lightboxVideoStyle: React.CSSProperties = {
@@ -9247,7 +10297,7 @@ function Lightbox({
9247
10297
  height: '100%',
9248
10298
  display: 'block',
9249
10299
  objectFit: 'contain',
9250
- pointerEvents: isOpen && !isHorizontalNavActive ? 'auto' : 'none',
10300
+ pointerEvents: 'none',
9251
10301
  };
9252
10302
 
9253
10303
  const getSideMediaStyle = (
@@ -9485,11 +10535,20 @@ function Lightbox({
9485
10535
  )}
9486
10536
 
9487
10537
  {finalRect && currentItem && (
9488
- isCurrentVideo ? (
10538
+ isCurrentEmbed ? (
10539
+ <div key={\`\${index}-\${currentItem.assetId}\`} style={mediaStyle} onTransitionEnd={handleNavSwipeTransitionEnd}>
10540
+ <EmbedMediaFrame
10541
+ media={currentItem}
10542
+ fit="contain"
10543
+ lazy={false}
10544
+ startsAtOnce
10545
+ style={lightboxVideoStyle}
10546
+ />
10547
+ </div>
10548
+ ) : isCurrentVideo ? (
9489
10549
  <LightboxVideo
9490
10550
  key={\`\${index}-\${currentItem.assetId}\`}
9491
10551
  src={currentItem.assetId}
9492
- phase={phase}
9493
10552
  onMediaElement={setCenterMediaElement}
9494
10553
  wrapperStyle={mediaStyle}
9495
10554
  videoStyle={lightboxVideoStyle}
@@ -9770,7 +10829,7 @@ export function Hive({
9770
10829
  </>
9771
10830
  );
9772
10831
  }
9773
- `,l=`import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
10832
+ `,c=`import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
9774
10833
  import { createPortal } from 'react-dom';
9775
10834
  import { CommonComponentProps } from '../props';
9776
10835
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -10535,7 +11594,7 @@ export type LightboxJournalSettings = {
10535
11594
  closeIconColor: string;
10536
11595
  closeIconHoverColor: string;
10537
11596
  };
10538
- `,c=`import { useEffect, useRef, useState, type MouseEvent } from 'react';
11597
+ `,d=`import { useEffect, useRef, useState, type MouseEvent } from 'react';
10539
11598
  import { createPortal } from 'react-dom';
10540
11599
  import { CommonComponentProps } from '../props';
10541
11600
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -11081,10 +12140,10 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
11081
12140
  </>
11082
12141
  );
11083
12142
  };
11084
- `,d=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
12143
+ `,u=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
11085
12144
  import { createPortal } from 'react-dom';
11086
12145
  import { CommonComponentProps } from '../props';
11087
- import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
12146
+ import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
11088
12147
  import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
11089
12148
  import type { LayoutItem, LayoutTab } from '../../types/SchemaV1';
11090
12149
 
@@ -11214,7 +12273,10 @@ type ListMedia = {
11214
12273
  objectFit?: 'cover' | 'contain';
11215
12274
  assetId: string;
11216
12275
  name: string;
11217
- type?: 'image' | 'video';
12276
+ type?: 'image' | 'video' | 'vimeo' | 'youtube';
12277
+ thumbnail?: string;
12278
+ width?: number;
12279
+ height?: number;
11218
12280
  };
11219
12281
 
11220
12282
  type ListContentItem = {
@@ -11224,14 +12286,14 @@ type ListContentItem = {
11224
12286
  DColumnWidth?: string;
11225
12287
  EColumnWidth?: string;
11226
12288
  image?: ListMedia;
11227
- link?: string;
12289
+ link?: ContentLink;
11228
12290
  };
11229
12291
 
11230
12292
  type ListItemRow = {
11231
12293
  id: string | number;
11232
12294
  cells: Record<string, React.ReactNode>;
11233
12295
  image?: ListContentItem['image'];
11234
- link?: string;
12296
+ link?: ContentLink;
11235
12297
  };
11236
12298
 
11237
12299
  type HoverImageState = {
@@ -11239,10 +12301,13 @@ type HoverImageState = {
11239
12301
  assetId: string;
11240
12302
  objectFit: 'cover' | 'contain';
11241
12303
  isVideo: boolean;
12304
+ /** The media itself when it is a Vimeo or YouTube video, framed rather than drawn. */
12305
+ embed?: ListMedia;
11242
12306
  widthPx: number;
11243
12307
  };
11244
12308
 
11245
12309
  function isVideoMedia(media: Pick<ListMedia, 'assetId' | 'type' | 'name'>): boolean {
12310
+ if (isEmbedMedia(media)) return false;
11246
12311
  if (media.type === 'video') return true;
11247
12312
  if (media.type === 'image') return false;
11248
12313
  const name = media.name ?? '';
@@ -11255,7 +12320,7 @@ function ListHoverMedia({
11255
12320
  className,
11256
12321
  style,
11257
12322
  }: {
11258
- media: Pick<HoverImageState, 'assetId' | 'objectFit' | 'isVideo'>;
12323
+ media: Pick<HoverImageState, 'assetId' | 'objectFit' | 'isVideo' | 'embed'>;
11259
12324
  className: string;
11260
12325
  style: React.CSSProperties;
11261
12326
  }) {
@@ -11272,6 +12337,18 @@ function ListHoverMedia({
11272
12337
  }
11273
12338
  }, [media.isVideo, media.assetId]);
11274
12339
 
12340
+ if (media.embed) {
12341
+ return (
12342
+ <EmbedMediaFrame
12343
+ media={media.embed}
12344
+ startsAtOnce
12345
+ fit="contain"
12346
+ className={className}
12347
+ style={style}
12348
+ />
12349
+ );
12350
+ }
12351
+
11275
12352
  if (media.isVideo) {
11276
12353
  return (
11277
12354
  <video
@@ -13434,6 +14511,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
13434
14511
  assetId: image.assetId,
13435
14512
  objectFit: 'contain',
13436
14513
  isVideo: isVideoMedia(image),
14514
+ embed: isEmbedMedia(image) ? image : undefined,
13437
14515
  widthPx,
13438
14516
  });
13439
14517
  hoverShowPositionRef.current = { x, y };
@@ -13719,7 +14797,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
13719
14797
  >
13720
14798
  <div style={{ width: '100%', position: 'relative' }}>
13721
14799
  {visibleRows.map((row, rowIdx) => {
13722
- const hasLink = (row.link?.length ?? 0) > 0;
14800
+ const hasLink = (row.link?.value.length ?? 0) > 0;
13723
14801
  const RowElement = hasLink && (!isEditor || isPreviewMode) ? 'a' : 'div';
13724
14802
  const rowStyle = getEntryDividerWidths(
13725
14803
  rowIdx,
@@ -13736,7 +14814,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
13736
14814
  key={row.id}
13737
14815
  ref={rowIdx === 0 ? (el: HTMLElement | null) => { firstRowRef.current = el; } : undefined}
13738
14816
  className={\`\${P}-list-item\${hasLink || entryHoverShowOption === 'always' ? \` \${P}-list-item-has-link\` : ''}\${showCutLabel && rowIdx === visibleRows.length - 1 ? \` \${P}-list-item-before-cut\` : ''}\`}
13739
- {...(hasLink ? { href: row.link, target: '_blank' } : {})}
14817
+ {...(hasLink ? { href: row.link?.value, target: row.link?.target === 'blank' ? '_blank' : '_self' } : {})}
13740
14818
  style={rowStyle}
13741
14819
  onMouseEnter={(event) => {
13742
14820
  if (revealHoverActive && (hasLink || entryHoverShowOption === 'always')) {
@@ -14167,11 +15245,10 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
14167
15245
  </>
14168
15246
  );
14169
15247
  }
14170
- `,u=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
15248
+ `,g=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
14171
15249
  import cn from 'classnames';
14172
15250
  import { CommonComponentProps } from '../props';
14173
- import { scalingValue } from '../utils/scalingValue';
14174
- import { useScopedStyles } from '../utils/useScopedStyles';
15251
+ import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
14175
15252
  import { NEAR_VIEWPORT_MARGIN, observeIntersection } from '../utils/observeIntersection';
14176
15253
  import { pauseVideo, playVideo, raisePreload } from '../utils/useLazyVideos';
14177
15254
 
@@ -14400,6 +15477,7 @@ const isAnyCopyOfSlotInView = (wrapper: Element, itemIndex: number): boolean =>
14400
15477
  };
14401
15478
 
14402
15479
  const isVideoMedia = (media: Pick<NonNullable<MarqueeItem['image']>, 'assetId' | 'type' | 'name'>): boolean => {
15480
+ if (isEmbedMedia(media)) return false;
14403
15481
  if (media.type === 'video') return true;
14404
15482
  if (media.type === 'image') return false;
14405
15483
  const name = media.name ?? '';
@@ -14441,11 +15519,13 @@ const MarqueeItemCard = ({
14441
15519
  }: MarqueeItemCardProps) => {
14442
15520
  const mediaRef = useRef<HTMLImageElement | HTMLVideoElement | null>(null);
14443
15521
  const isVideo = Boolean(item.image?.assetId && isVideoMedia(item.image));
15522
+ // an embed's box is sized from what is stored, so there is nothing to wait for
15523
+ const isEmbed = Boolean(item.image?.assetId && isEmbedMedia(item.image));
14444
15524
 
14445
15525
  useLayoutEffect(() => {
14446
15526
  if (!isFirstSet) return;
14447
- if (isMediaReady(mediaRef.current)) onFirstSetImageDone?.();
14448
- }, [isFirstSet, item.image?.assetId, onFirstSetImageDone]);
15527
+ if (isEmbed || isMediaReady(mediaRef.current)) onFirstSetImageDone?.();
15528
+ }, [isFirstSet, isEmbed, item.image?.assetId, onFirstSetImageDone]);
14449
15529
 
14450
15530
  const isCover = imageFit.display === 'cover';
14451
15531
  const ratioValue = imageFit.ratioValue ?? '1:1';
@@ -14484,9 +15564,27 @@ const MarqueeItemCard = ({
14484
15564
  ...radiusStyle,
14485
15565
  };
14486
15566
 
15567
+ // a frame has no size of its own: fitted, it takes the box a video of its aspect would
15568
+ const embedAspect = isEmbed && item.image ? getEmbedAspect(item.image) : null;
15569
+ const embedStyle: CSSProperties | undefined = embedAspect === null
15570
+ ? undefined
15571
+ : isCover
15572
+ ? mediaStyle
15573
+ : {
15574
+ ...mediaStyle,
15575
+ width: scaled(imageMaxWidth / embedAspect > imageMaxHeight ? imageMaxHeight * embedAspect : imageMaxWidth),
15576
+ height: scaled(imageMaxWidth / embedAspect > imageMaxHeight ? imageMaxHeight : imageMaxWidth / embedAspect),
15577
+ };
15578
+
14487
15579
  const imageNode =
14488
15580
  item.image?.assetId &&
14489
- (isVideo ? (
15581
+ (isEmbed ? (
15582
+ <EmbedMediaFrame
15583
+ media={item.image}
15584
+ fit={isCover ? 'cover' : 'contain'}
15585
+ style={embedStyle}
15586
+ />
15587
+ ) : isVideo ? (
14490
15588
  <video
14491
15589
  ref={(el) => { mediaRef.current = el; }}
14492
15590
  src={item.image.assetId}
@@ -14541,14 +15639,11 @@ const MarqueeItemCard = ({
14541
15639
  }),
14542
15640
  }}
14543
15641
  >
14544
- {imageNode && item.link
14545
- ? (
14546
- <a href={item.link} target='_self' rel='noopener noreferrer' className={cn(\`\${P}-marquee-link\`, !isCover && \`\${P}-marquee-link-contain\`)}>
14547
- {imageNode}
14548
- </a>
14549
- )
14550
- : imageNode
14551
- }
15642
+ {imageNode && (
15643
+ <LinkWrapper link={item.link} className={cn(\`\${P}-marquee-link\`, !isCover && \`\${P}-marquee-link-contain\`)}>
15644
+ {imageNode}
15645
+ </LinkWrapper>
15646
+ )}
14552
15647
  </div>
14553
15648
  </div>
14554
15649
  );
@@ -14977,9 +16072,12 @@ export type MarqueeItem = {
14977
16072
  image?: {
14978
16073
  assetId?: string;
14979
16074
  name?: string;
14980
- type?: 'image' | 'video';
16075
+ type?: 'image' | 'video' | 'vimeo' | 'youtube';
16076
+ thumbnail?: string;
16077
+ width?: number;
16078
+ height?: number;
14981
16079
  };
14982
- link?: string;
16080
+ link?: ContentLink;
14983
16081
  };
14984
16082
 
14985
16083
  export type MarqueeSettings = {
@@ -15005,11 +16103,10 @@ type MarqueeProps = {
15005
16103
  isPreviewMode?: boolean;
15006
16104
  isEditMode?: boolean;
15007
16105
  } & CommonComponentProps;
15008
- `,g=`import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
16106
+ `,m=`import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
15009
16107
  import cn from 'classnames';
15010
16108
  import { CommonComponentProps } from '../props';
15011
- import { scalingValue } from '../utils/scalingValue';
15012
- import { useScopedStyles } from '../utils/useScopedStyles';
16109
+ import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
15013
16110
  import { textStylesToCss } from '../utils/textStylesToCss';
15014
16111
  import { observeIntersection } from '../utils/observeIntersection';
15015
16112
 
@@ -15349,9 +16446,7 @@ const MarqueeTextItemView = ({ item, prefix: P, textCss, capHeightPx, opticalOff
15349
16446
  );
15350
16447
  return (
15351
16448
  <div className={\`\${P}-item\`} data-marquee-text-item style={{ gap: imageGapPx }}>
15352
- {item.link
15353
- ? <a href={item.link} className={\`\${P}-item-link\`} style={{ gap: imageGapPx }}>{content}</a>
15354
- : content}
16449
+ <LinkWrapper link={item.link} className={\`\${P}-item-link\`} style={{ gap: imageGapPx }}>{content}</LinkWrapper>
15355
16450
  </div>
15356
16451
  );
15357
16452
  };
@@ -15434,7 +16529,7 @@ export const MarqueeText = ({ settings, content, isEditor, isPreviewMode }: Marq
15434
16529
  const [ribbonHeightPx, setRibbonHeightPx] = useState(0);
15435
16530
 
15436
16531
  const contentKey = useMemo(
15437
- () => (content ?? []).map((i) => \`\${i.text}\\0\${i.image?.assetId ?? ''}\\0\${i.link ?? ''}\`).join('\\0'),
16532
+ () => (content ?? []).map((i) => \`\${i.text}\\0\${i.image?.assetId ?? ''}\\0\${i.link?.value ?? ''}\`).join('\\0'),
15438
16533
  [content],
15439
16534
  );
15440
16535
  const [contentSequenceRepeat, setContentSequenceRepeat] = useState(MIN_CONTENT_SEQUENCE_REPEAT);
@@ -15915,7 +17010,7 @@ export type MarqueeTextItem = {
15915
17010
  assetId?: string;
15916
17011
  name?: string;
15917
17012
  };
15918
- link?: string;
17013
+ link?: ContentLink;
15919
17014
  };
15920
17015
 
15921
17016
  export type MarqueeTextSettings = {
@@ -15951,10 +17046,11 @@ type MarqueeTextProps = {
15951
17046
  isPreviewMode?: boolean;
15952
17047
  isEditMode?: boolean;
15953
17048
  } & CommonComponentProps;
15954
- `,m=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
17049
+ `,p=`import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
15955
17050
  import { createPortal } from 'react-dom';
15956
17051
  import type React from 'react';
15957
17052
  import { CommonComponentProps } from '../props';
17053
+ import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
15958
17054
  import {
15959
17055
  buildColorVars,
15960
17056
  scalingValue,
@@ -16346,8 +17442,11 @@ function getTitlePositionAxes(position: TitlePosition): TitlePositionAxes {
16346
17442
  type MercuryMedia = {
16347
17443
  assetId: string;
16348
17444
  name?: string;
16349
- type?: 'image' | 'video';
17445
+ type?: 'image' | 'video' | 'vimeo' | 'youtube';
16350
17446
  objectFit?: 'cover' | 'contain';
17447
+ thumbnail?: string;
17448
+ width?: number;
17449
+ height?: number;
16351
17450
  };
16352
17451
 
16353
17452
  type MercuryMediaPair = {
@@ -16586,21 +17685,15 @@ function resolveLightboxImageDisplay(
16586
17685
 
16587
17686
  function LightboxVideo({
16588
17687
  src,
16589
- phase,
16590
17688
  mediaRef,
16591
17689
  mediaStyle,
16592
17690
  onLoadedMetadata,
16593
- onClick,
16594
- onMouseMove,
16595
17691
  onTransitionEnd,
16596
17692
  }: {
16597
17693
  src: string;
16598
- phase: 'opening' | 'open' | 'closing';
16599
17694
  mediaRef: React.RefObject<HTMLVideoElement>;
16600
17695
  mediaStyle: React.CSSProperties;
16601
17696
  onLoadedMetadata: () => void;
16602
- onClick: (e: React.MouseEvent<HTMLVideoElement>) => void;
16603
- onMouseMove: (e: React.MouseEvent<HTMLVideoElement>) => void;
16604
17697
  onTransitionEnd: (e: React.TransitionEvent<HTMLVideoElement>) => void;
16605
17698
  }) {
16606
17699
  useEffect(() => {
@@ -16616,12 +17709,12 @@ function LightboxVideo({
16616
17709
  <video
16617
17710
  ref={mediaRef}
16618
17711
  src={src}
16619
- controls={phase === 'open'}
17712
+ muted
17713
+ autoPlay
17714
+ loop
16620
17715
  playsInline
16621
17716
  preload="auto"
16622
17717
  onLoadedMetadata={onLoadedMetadata}
16623
- onClick={onClick}
16624
- onMouseMove={onMouseMove}
16625
17718
  onTransitionEnd={onTransitionEnd}
16626
17719
  style={mediaStyle}
16627
17720
  />
@@ -16797,6 +17890,7 @@ function Lightbox({
16797
17890
  const prevIndexRef = useRef(index);
16798
17891
  const currentItem = items[index];
16799
17892
  const isCurrentVideo = currentItem ? isVideoMedia(currentItem) : false;
17893
+ const isCurrentEmbed = currentItem ? isEmbedMedia(currentItem) : false;
16800
17894
  const isHorizontalNavActive = navSwipeOffset !== 0 || navSwipeAnimating;
16801
17895
 
16802
17896
  const setNavSwipeAnimatingState = useCallback((value: boolean) => {
@@ -16833,18 +17927,22 @@ function Lightbox({
16833
17927
  return;
16834
17928
  }
16835
17929
 
16836
- if (!media) {
16837
- setFinalRect(getGhostRect(ghost));
16838
- return;
16839
- }
17930
+ // an embed's player reports no size of its own, so its stored aspect stands in
17931
+ let ir = currentItem && isEmbedMedia(currentItem) ? getEmbedAspect(currentItem) : null;
17932
+ if (ir === null) {
17933
+ if (!media) {
17934
+ setFinalRect(getGhostRect(ghost));
17935
+ return;
17936
+ }
16840
17937
 
16841
- const { width: nw, height: nh } = getLightboxMediaDimensions(media);
16842
- if (!nw || !nh) {
16843
- setFinalRect(getGhostRect(ghost));
16844
- return;
17938
+ const { width: nw, height: nh } = getLightboxMediaDimensions(media);
17939
+ if (!nw || !nh) {
17940
+ setFinalRect(getGhostRect(ghost));
17941
+ return;
17942
+ }
17943
+ ir = nw / nh;
16845
17944
  }
16846
17945
 
16847
- const ir = nw / nh;
16848
17946
  const cr = cw / ch;
16849
17947
  if (ir > cr) {
16850
17948
  const dh = cw / ir;
@@ -16853,7 +17951,7 @@ function Lightbox({
16853
17951
  const dw = ch * ir;
16854
17952
  setFinalRect({ width: dw, height: ch, left: cb.left + (cw - dw) / 2, top: cb.top });
16855
17953
  }
16856
- }, [imageDisplay]);
17954
+ }, [imageDisplay, currentItem]);
16857
17955
 
16858
17956
  useEffect(() => {
16859
17957
  computeFinalRect();
@@ -17073,46 +18171,6 @@ function Lightbox({
17073
18171
  const swipeBackdropOpacity = swipeOffset > 0 ? Math.max(0, 1 - swipeOffset / 500) : 1;
17074
18172
  const swipeMediaOpacity = swipeOffset > 0 ? Math.max(0.35, 1 - swipeOffset / 500) : 1;
17075
18173
 
17076
- const handleVideoClick = (e: React.MouseEvent<HTMLVideoElement>) => {
17077
- e.stopPropagation();
17078
- if (touchInteractionRef.current) {
17079
- touchInteractionRef.current = false;
17080
- return;
17081
- }
17082
- if (items.length <= 1) return;
17083
-
17084
- const rect = e.currentTarget.getBoundingClientRect();
17085
- const y = e.clientY - rect.top;
17086
- const controlsZoneHeight = Math.min(52, rect.height * 0.2);
17087
-
17088
- if (y > rect.height - controlsZoneHeight) {
17089
- return;
17090
- }
17091
-
17092
- if (e.clientX - rect.left < rect.width / 2) {
17093
- onPrev();
17094
- return;
17095
- }
17096
-
17097
- onNext();
17098
- };
17099
-
17100
- const handleVideoMouseMove = (e: React.MouseEvent<HTMLVideoElement>) => {
17101
- if (items.length <= 1) return;
17102
-
17103
- const rect = e.currentTarget.getBoundingClientRect();
17104
- const x = e.clientX - rect.left;
17105
- const y = e.clientY - rect.top;
17106
- const controlsZoneHeight = Math.min(52, rect.height * 0.2);
17107
-
17108
- if (y > rect.height - controlsZoneHeight) {
17109
- e.currentTarget.style.cursor = 'default';
17110
- return;
17111
- }
17112
-
17113
- e.currentTarget.style.cursor = x < rect.width / 2 ? 'w-resize' : 'e-resize';
17114
- };
17115
-
17116
18174
  const handleNavSwipeTransitionEnd = useCallback((e: React.TransitionEvent<HTMLElement>) => {
17117
18175
  if (e.propertyName !== 'transform' || !navSwipeAnimatingRef.current) return;
17118
18176
 
@@ -17148,15 +18206,18 @@ function Lightbox({
17148
18206
  : phase === 'opening' || isClosing
17149
18207
  ? \`opacity \${LIGHTBOX_ANIM_MS}ms \${LIGHTBOX_EASING}\`
17150
18208
  : 'none',
17151
- pointerEvents: isCurrentVideo && isOpen && !isHorizontalNavActive ? 'auto' : 'none',
17152
- touchAction: isCurrentVideo && isOpen ? 'none' : undefined,
18209
+ pointerEvents: 'none',
17153
18210
  zIndex: 9998,
17154
18211
  };
17155
18212
 
18213
+ // over an embed with controls the overlays stop short of the player's own control bar
18214
+ const navOverlayInset = isCurrentEmbed && currentItem && getEmbedPlayback(currentItem).controls && finalRect
18215
+ ? Math.min(52, finalRect.height * 0.2)
18216
+ : 0;
17156
18217
  const navOverlayBaseStyle = finalRect ? {
17157
18218
  position: 'fixed' as const,
17158
18219
  top: finalRect.top,
17159
- height: finalRect.height,
18220
+ height: finalRect.height - navOverlayInset,
17160
18221
  width: finalRect.width / 2,
17161
18222
  zIndex: 9999,
17162
18223
  } : null;
@@ -17256,16 +18317,23 @@ function Lightbox({
17256
18317
  </div>
17257
18318
 
17258
18319
  {finalRect && currentItem && (
17259
- isCurrentVideo ? (
18320
+ isCurrentEmbed ? (
18321
+ <EmbedMediaFrame
18322
+ key={\`\${index}-\${currentItem.assetId}\`}
18323
+ media={currentItem}
18324
+ fit={imageDisplay === 'cover' ? 'cover' : 'contain'}
18325
+ lazy={false}
18326
+ startsAtOnce
18327
+ style={mediaStyle}
18328
+ onTransitionEnd={handleNavSwipeTransitionEnd}
18329
+ />
18330
+ ) : isCurrentVideo ? (
17260
18331
  <LightboxVideo
17261
18332
  key={\`\${index}-\${currentItem.assetId}\`}
17262
18333
  src={currentItem.assetId}
17263
- phase={phase}
17264
18334
  mediaRef={mediaRef as React.RefObject<HTMLVideoElement>}
17265
18335
  mediaStyle={mediaStyle}
17266
18336
  onLoadedMetadata={computeFinalRect}
17267
- onClick={handleVideoClick}
17268
- onMouseMove={handleVideoMouseMove}
17269
18337
  onTransitionEnd={handleNavSwipeTransitionEnd}
17270
18338
  />
17271
18339
  ) : (
@@ -17281,7 +18349,7 @@ function Lightbox({
17281
18349
  )
17282
18350
  )}
17283
18351
 
17284
- {isOpen && navOverlayBaseStyle && items.length > 1 && !isCurrentVideo && (
18352
+ {isOpen && navOverlayBaseStyle && items.length > 1 && (
17285
18353
  <>
17286
18354
  <div
17287
18355
  style={{
@@ -17346,6 +18414,7 @@ function GalleryMediaItem({
17346
18414
  galleryPaddingBetween = 0,
17347
18415
  showPaddingAfter = false,
17348
18416
  showControls = false,
18417
+ hasLightbox,
17349
18418
  onMediaClick,
17350
18419
  }: {
17351
18420
  P: string;
@@ -17358,6 +18427,8 @@ function GalleryMediaItem({
17358
18427
  galleryPaddingBetween?: number;
17359
18428
  showPaddingAfter?: boolean;
17360
18429
  showControls?: boolean;
18430
+ /** An embed then plays here as a silent loop, and as it was set to in the lightbox. */
18431
+ hasLightbox: boolean;
17361
18432
  onMediaClick?: () => void;
17362
18433
  }) {
17363
18434
  const mediaClassName = \`\${P}-gallery-\${isVideoMedia(media) ? 'video' : 'image'}\`;
@@ -17407,7 +18478,14 @@ function GalleryMediaItem({
17407
18478
  };
17408
18479
  const galleryPaddingBetweenHeight = Math.max(galleryPaddingBetween, PADDING_HANDLE_SIZE);
17409
18480
 
17410
- const mediaNode = isVideoMedia(media) ? (
18481
+ const mediaNode = isEmbedMedia(media) ? (
18482
+ <EmbedMediaFrame
18483
+ {...mediaProps}
18484
+ media={media}
18485
+ fit={isCover ? 'cover' : 'contain'}
18486
+ silentLoop={hasLightbox}
18487
+ />
18488
+ ) : isVideoMedia(media) ? (
17411
18489
  <LazyVideo
17412
18490
  {...mediaProps}
17413
18491
  src={media.assetId}
@@ -18350,6 +19428,7 @@ export function Mercury({
18350
19428
  galleryPaddingBetween={galleryPaddingBetween}
18351
19429
  showPaddingAfter={mediaIndex < displayItems.length - 1}
18352
19430
  showControls={showControls}
19431
+ hasLightbox={lightbox === 'on'}
18353
19432
  onMediaClick={canOpenLightbox && lightboxItemIndex >= 0
18354
19433
  ? () => openLightbox(lightboxItemsForEntry, lightboxItemIndex)
18355
19434
  : undefined}
@@ -18401,6 +19480,7 @@ export function Mercury({
18401
19480
  galleryPaddingBetween={galleryPaddingBetween}
18402
19481
  showPaddingAfter={mediaIndex < displayItems.length - 1}
18403
19482
  showControls={showControls}
19483
+ hasLightbox={lightbox === 'on'}
18404
19484
  onMediaClick={canOpenLightbox && lightboxItemIndex >= 0
18405
19485
  ? () => openLightbox(lightboxItemsForEntry, lightboxItemIndex)
18406
19486
  : undefined}
@@ -18448,7 +19528,7 @@ export function Mercury({
18448
19528
  </>
18449
19529
  );
18450
19530
  }
18451
- `,p=`import React, { useMemo, useState } from 'react';
19531
+ `,h=`import React, { useMemo, useState } from 'react';
18452
19532
  import { CommonComponentProps } from '../props';
18453
19533
  import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
18454
19534
  import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
@@ -19027,7 +20107,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
19027
20107
  };
19028
20108
 
19029
20109
  const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
19030
- `,h=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20110
+ `,f=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
19031
20111
  import type React from 'react';
19032
20112
  import { CommonComponentProps } from '../props';
19033
20113
  import { scalingValue, useScopedStyles } from '../utils/index';
@@ -19866,7 +20946,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
19866
20946
  </>
19867
20947
  );
19868
20948
  }
19869
- `,f=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
20949
+ `,v=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
19870
20950
  import cn from 'classnames';
19871
20951
  import { CommonComponentProps } from '../props';
19872
20952
  import { useScopedStyles } from '../utils/useScopedStyles';
@@ -20494,7 +21574,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
20494
21574
  </>
20495
21575
  );
20496
21576
  }
20497
- `,v=`import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
21577
+ `,P=`import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
20498
21578
  import { SvgImage } from '../helpers/SvgImage/SvgImage';
20499
21579
  import { CommonComponentProps } from '../props';
20500
21580
  import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
@@ -21126,7 +22206,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
21126
22206
  </>
21127
22207
  );
21128
22208
  }
21129
- `,P=`import React, { useCallback, useEffect, useRef, useState } from 'react';
22209
+ `,x=`import React, { useCallback, useEffect, useRef, useState } from 'react';
21130
22210
  import cn from 'classnames';
21131
22211
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
21132
22212
  import { scalingValue } from '../utils/scalingValue';
@@ -22308,7 +23388,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
22308
23388
  </svg>
22309
23389
  );
22310
23390
  }
22311
- `,x=`import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
23391
+ `,b=`import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
22312
23392
  import cn from 'classnames';
22313
23393
  import { CommonComponentProps } from '../props';
22314
23394
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -22939,7 +24019,7 @@ type TestimonialsSettings = {
22939
24019
  logoHeight: number;
22940
24020
  captionMarginTop: number;
22941
24021
  };
22942
- `,b=`import cn from 'classnames';
24022
+ `,y=`import cn from 'classnames';
22943
24023
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
22944
24024
  import { CommonComponentProps } from '../props';
22945
24025
  import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
@@ -23435,10 +24515,11 @@ type TestimonialsSettings = {
23435
24515
  icon?: string | null;
23436
24516
  };
23437
24517
  };
23438
- `,y=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
24518
+ `,S=`import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
23439
24519
  import type React from 'react';
23440
24520
  import { createPortal } from 'react-dom';
23441
24521
  import { CommonComponentProps } from '../props';
24522
+ import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia } from '../utils/index';
23442
24523
  import { getContainedMediaTransformOrigin } from '../utils/getImageRect';
23443
24524
  import { scalingValue, useScopedStyles } from '../utils/index';
23444
24525
  import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
@@ -23558,7 +24639,8 @@ function getCSS(P: string): string {
23558
24639
  object-position: bottom;
23559
24640
  }
23560
24641
  .\${P}-item-image-hover-scale img,
23561
- .\${P}-item-image-hover-scale video {
24642
+ .\${P}-item-image-hover-scale video,
24643
+ .\${P}-item-image-hover-scale [data-embed-frame] {
23562
24644
  transition: transform 0.3s ease;
23563
24645
  }
23564
24646
  .\${P}-item-image-hover-scale:hover {
@@ -23764,7 +24846,9 @@ export function Waterfall({
23764
24846
  return style as React.CSSProperties;
23765
24847
  })();
23766
24848
 
23767
- const canOpenLightbox = (settings?.lightbox ?? 'on') === 'on' && (!isEditor || isPreviewMode || isEditMode);
24849
+ const hasLightbox = (settings?.lightbox ?? 'on') === 'on';
24850
+ // an embed in a cell that opens the lightbox plays there as it was set to, and here as a silent loop
24851
+ const canOpenLightbox = hasLightbox && (!isEditor || isPreviewMode || isEditMode);
23768
24852
  const allLightboxEntries = useMemo(() => buildLightboxEntries(items), [items]);
23769
24853
  const allMedia = useMemo(() => collectAllWaterfallMedia(items), [items]);
23770
24854
 
@@ -23868,8 +24952,22 @@ export function Waterfall({
23868
24952
  objectFitMode === 'contain' ? \`\${P}-item-image-fit\` : undefined,
23869
24953
  imageHoverClass,
23870
24954
  ].filter(Boolean).join(' ')}
24955
+ // a frame reports no size of its own, so the stored aspect is set here up front
24956
+ style={isEmbedMedia(item.image)
24957
+ ? { [\`--\${P}-item-media-aspect\`]: String(getEmbedAspect(item.image)) } as React.CSSProperties
24958
+ : undefined}
23871
24959
  >
23872
- {item.image.type === 'video' ? (
24960
+ {isEmbedMedia(item.image) ? (
24961
+ <EmbedMediaFrame
24962
+ media={item.image}
24963
+ fit={objectFitMode}
24964
+ silentLoop={hasLightbox}
24965
+ data-waterfall-index={index}
24966
+ // placed the way the image rule above places a picture, inline since the frame positions itself inline
24967
+ style={{ ...imageStyle, position: 'absolute', left: 0, bottom: 0, width: '100%', height: '1cap' }}
24968
+ onClick={handleOpen}
24969
+ />
24970
+ ) : item.image.type === 'video' ? (
23873
24971
  <LazyVideo
23874
24972
  ref={syncFitMediaLayout}
23875
24973
  src={item.image.assetId}
@@ -23950,4 +25048,4 @@ export function Waterfall({
23950
25048
  </>
23951
25049
  );
23952
25050
  }
23953
- `,S={[n.BurgerComponent.id]:e,[n.ClickGallerieComponent.id]:t,[n.FAQComponent.id]:i,[n.FormComponent.id]:o,[n.GridComponent.id]:r,[n.HelixComponent.id]:a,[n.HiveComponent.id]:s,[n.LightboxJournalComponent.id]:l,[n.LightboxStripComponent.id]:c,[n.ListComponent.id]:d,[n.MarqueeComponent.id]:u,[n.MarqueeTextComponent.id]:g,[n.MercuryComponent.id]:m,[n.OnelinerFormComponent.id]:p,[n.PretextComponent.id]:h,[n.ScaleComponent.id]:f,[n.SimpleButtonComponent.id]:v,[n.Slider20Component.id]:P,[n.TestimonialGridComponent.id]:x,[n.TestimonialSingleComponent.id]:b,[n.WaterfallComponent.id]:y};exports.componentSources=S;
25051
+ `,C={[n.ArchivePopupComponent.id]:e,[n.BurgerComponent.id]:t,[n.ClickGallerieComponent.id]:i,[n.FAQComponent.id]:o,[n.FormComponent.id]:r,[n.GridComponent.id]:a,[n.HelixComponent.id]:s,[n.HiveComponent.id]:l,[n.LightboxJournalComponent.id]:c,[n.LightboxStripComponent.id]:d,[n.ListComponent.id]:u,[n.MarqueeComponent.id]:g,[n.MarqueeTextComponent.id]:m,[n.MercuryComponent.id]:p,[n.OnelinerFormComponent.id]:h,[n.PretextComponent.id]:f,[n.ScaleComponent.id]:v,[n.SimpleButtonComponent.id]:P,[n.Slider20Component.id]:x,[n.TestimonialGridComponent.id]:b,[n.TestimonialSingleComponent.id]:y,[n.WaterfallComponent.id]:S};exports.componentSources=C;