@cntrl-site/components 1.0.108 → 1.0.110
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.
- package/dist/Chronicles-Cy2h3jlZ.mjs +724 -0
- package/dist/Chronicles-D0ojQzOP.js +196 -0
- package/dist/ChroniclesComponent-FFenN7yL.js +1 -0
- package/dist/{PretextComponent-BiS9XbZr.mjs → ChroniclesComponent-cZLqN307.mjs} +853 -425
- package/dist/{ClickGallerie-o2U6oyOF.mjs → ClickGallerie-Cjc_1Gxy.mjs} +1 -1
- package/dist/{ClickGallerie-CYQMgrIr.js → ClickGallerie-DYbc-rDp.js} +1 -1
- package/dist/Components/Chronicles/Chronicles.d.ts +120 -0
- package/dist/Components/Chronicles/ChroniclesComponent.d.ts +307 -0
- package/dist/Components/utils/buildValidUrl.d.ts +1 -0
- package/dist/Components/utils/index.d.ts +1 -0
- package/dist/{ControlSlider-Kkec-i14.js → ControlSlider-C8ckUIDm.js} +1 -1
- package/dist/{ControlSlider-LcZmviGX.mjs → ControlSlider-DqKfaKMG.mjs} +1 -1
- package/dist/{FAQ-CdwSft5p.mjs → FAQ-BS-vO0l-.mjs} +1 -1
- package/dist/{FAQ-BxhMo7T8.js → FAQ-Ct0YfqX1.js} +1 -1
- package/dist/{Grid-CFHTP3mb.js → Grid-CU1dsdoO.js} +1 -1
- package/dist/{Grid-e-gLfsji.mjs → Grid-qbqchSLi.mjs} +1 -1
- package/dist/{ImageRevealSlider-Df9sygk9.mjs → ImageRevealSlider-DifEXySR.mjs} +1 -1
- package/dist/{ImageRevealSlider-BuukTGAK.js → ImageRevealSlider-DlxudBUy.js} +1 -1
- package/dist/{Lightbox-C_fXsfdz.mjs → Lightbox-BY99NS14.mjs} +1 -1
- package/dist/{Lightbox-DaunVrkp.js → Lightbox-DZckgBzK.js} +1 -1
- package/dist/LinkWrapper-5kQHiGJQ.mjs +10 -0
- package/dist/LinkWrapper-CTqM1ucO.js +1 -0
- package/dist/{Marquee-DfIP-tIN.js → Marquee-DDKigLBo.js} +1 -1
- package/dist/{Marquee-DByooiWP.mjs → Marquee-_xVuf-zp.mjs} +1 -1
- package/dist/{MarqueeText-DsUiV6Zv.js → MarqueeText-B5hqB0HA.js} +1 -1
- package/dist/{MarqueeText-D6FNCe6P.mjs → MarqueeText-C2E6UDsb.mjs} +1 -1
- package/dist/{RichTextRenderer-BptwNpbJ.mjs → RichTextRenderer-D52Xto59.mjs} +1 -1
- package/dist/{RichTextRenderer-K90Dd7pt.js → RichTextRenderer-DEFXh5o6.js} +1 -1
- package/dist/{Slider20-fMVeRfgx.js → Slider20-BOmjDRf2.js} +1 -1
- package/dist/{Slider20-CCzixTiN.mjs → Slider20-DUi6qwnd.mjs} +1 -1
- package/dist/{TestimonialGrid-CiCagfBU.js → TestimonialGrid-BHZazEVX.js} +1 -1
- package/dist/{TestimonialGrid-CbsVxSn9.mjs → TestimonialGrid-C-8IDzWu.mjs} +1 -1
- package/dist/{TestimonialSingle-BWXynGjv.js → TestimonialSingle-BORQom3u.js} +1 -1
- package/dist/{TestimonialSingle-BVm3Amrl.mjs → TestimonialSingle-DrnyReim.mjs} +1 -1
- package/dist/buildValidUrl-BbtqqeHr.mjs +7 -0
- package/dist/buildValidUrl-CtJWFCPi.js +1 -0
- package/dist/{components-ljYgHKal.mjs → components-DtO0Ti47.mjs} +18 -17
- package/dist/components-f82884Bk.js +1 -0
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +16 -15
- package/dist/elements.node.js +1 -1
- package/dist/elements.node.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -2
- package/dist/sources.js +1036 -22
- package/dist/sources.mjs +1060 -45
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +19 -17
- package/package.json +1 -1
- package/dist/LinkWrapper-Ca84iPtg.js +0 -1
- package/dist/LinkWrapper-DZs9hlOn.mjs +0 -13
- package/dist/PretextComponent-DWOy-dqD.js +0 -1
- package/dist/components-CJlisugq.js +0 -1
package/dist/sources.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as n, b as e, T as t, g as i, f as o, S as r, P as a, O as s, h as l, a as c, M as d, L as u, d as g, e as m, H as p, i as h, G as f, F as v, c as P, C as x,
|
|
2
|
-
const
|
|
1
|
+
import { W as n, b as e, T as t, g as i, f as o, S as r, P as a, O as s, h as l, a as c, M as d, L as u, d as g, e as m, H as p, i as h, G as f, F as v, c as P, C as x, j as b, B as y } from "./ChroniclesComponent-cZLqN307.mjs";
|
|
2
|
+
const S = `import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
|
|
3
3
|
import { CommonComponentProps } from '../props';
|
|
4
4
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
5
5
|
import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
|
|
@@ -2684,7 +2684,1021 @@ export function Burger({
|
|
|
2684
2684
|
</div>
|
|
2685
2685
|
);
|
|
2686
2686
|
}
|
|
2687
|
-
`,
|
|
2687
|
+
`, C = `import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from 'react';
|
|
2688
|
+
import { createPortal } from 'react-dom';
|
|
2689
|
+
import cn from 'classnames';
|
|
2690
|
+
import { CommonComponentProps } from '../props';
|
|
2691
|
+
import { buildColorVars, buildValidUrl, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
2692
|
+
import { omitTextColors, TextStyles, textStylesToCss } from '../utils/textStylesToCss';
|
|
2693
|
+
import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
|
|
2694
|
+
|
|
2695
|
+
export const CHRONICLES_EXTRA_TITLE_KEYS = ['title2', 'title3', 'title4'] as const;
|
|
2696
|
+
export const CHRONICLES_COLUMN_WIDTH_KEYS = ['column1Width', 'column2Width', 'column3Width', 'column4Width'] as const;
|
|
2697
|
+
export const CHRONICLES_COLUMN_STYLE_PREFIXES = ['column1', 'column2', 'column3', 'column4', 'column5'] as const;
|
|
2698
|
+
|
|
2699
|
+
const TITLE_KEYS = ['title', ...CHRONICLES_EXTRA_TITLE_KEYS] as const;
|
|
2700
|
+
|
|
2701
|
+
const PANEL_POSITION_OFFSETS = {
|
|
2702
|
+
center: { x: '50%', y: '50%' },
|
|
2703
|
+
'left-top': { x: '0%', y: '0%' },
|
|
2704
|
+
'top-center': { x: '50%', y: '0%' },
|
|
2705
|
+
'top-right': { x: '100%', y: '0%' },
|
|
2706
|
+
'left-center': { x: '0%', y: '50%' },
|
|
2707
|
+
'right-center': { x: '100%', y: '50%' },
|
|
2708
|
+
'left-bottom': { x: '0%', y: '100%' },
|
|
2709
|
+
'bottom-center': { x: '50%', y: '100%' },
|
|
2710
|
+
'right-bottom': { x: '100%', y: '100%' },
|
|
2711
|
+
} as const;
|
|
2712
|
+
|
|
2713
|
+
type ChroniclesPanelPosition = keyof typeof PANEL_POSITION_OFFSETS;
|
|
2714
|
+
|
|
2715
|
+
export const CHRONICLES_PANEL_POSITIONS = Object.keys(PANEL_POSITION_OFFSETS) as ChroniclesPanelPosition[];
|
|
2716
|
+
|
|
2717
|
+
const OVERLAY_ANIM_MS = 300;
|
|
2718
|
+
const IMAGE_FADE_MS = 300;
|
|
2719
|
+
const MIN_HANDLE_SIZE = 0.004;
|
|
2720
|
+
const MIN_COLUMN_WIDTH_PX = 20;
|
|
2721
|
+
const VIDEO_EXTENSION_RE = /\\.(mp4|webm|ogg|mov)(\\?|$)/i;
|
|
2722
|
+
|
|
2723
|
+
const LIGHTBOX_CSS_VARS = [
|
|
2724
|
+
'--cntrl-article-width',
|
|
2725
|
+
'--cntrl-article-top',
|
|
2726
|
+
'--cntrl-article-left',
|
|
2727
|
+
'--cntrl-viewport-height',
|
|
2728
|
+
] as const;
|
|
2729
|
+
|
|
2730
|
+
const COLOR_VAR_MAP = {
|
|
2731
|
+
triggerColor: 'trigger-color',
|
|
2732
|
+
triggerHoverColor: 'trigger-hover-color',
|
|
2733
|
+
closeColor: 'close-color',
|
|
2734
|
+
closeHoverColor: 'close-hover-color',
|
|
2735
|
+
panelColor: 'panel-color',
|
|
2736
|
+
textColor: 'text-color',
|
|
2737
|
+
textHoverColor: 'text-hover-color',
|
|
2738
|
+
overlayColor: 'overlay-color',
|
|
2739
|
+
} as const;
|
|
2740
|
+
|
|
2741
|
+
const PADDING_CONTROLS = [
|
|
2742
|
+
{ side: 'top', axis: 'y', variant: 'row-padding' },
|
|
2743
|
+
{ side: 'bottom', axis: 'y', variant: 'row-padding', reverse: true },
|
|
2744
|
+
{ side: 'left', axis: 'x', variant: 'column-padding', opposite: 'right' },
|
|
2745
|
+
{ side: 'right', axis: 'x', variant: 'column-padding', opposite: 'left', reverse: true },
|
|
2746
|
+
] as const;
|
|
2747
|
+
|
|
2748
|
+
type Padding = { top: number; right: number; bottom: number; left: number };
|
|
2749
|
+
|
|
2750
|
+
type ColumnWidthKey = typeof CHRONICLES_COLUMN_WIDTH_KEYS[number];
|
|
2751
|
+
|
|
2752
|
+
type TextStylePrefix = 'trigger' | typeof CHRONICLES_COLUMN_STYLE_PREFIXES[number];
|
|
2753
|
+
|
|
2754
|
+
type ChroniclesMedia = {
|
|
2755
|
+
assetId: string;
|
|
2756
|
+
name?: string;
|
|
2757
|
+
type?: 'image' | 'video';
|
|
2758
|
+
objectFit?: 'cover' | 'contain';
|
|
2759
|
+
};
|
|
2760
|
+
|
|
2761
|
+
type ChroniclesItem = {
|
|
2762
|
+
group?: string;
|
|
2763
|
+
title?: string;
|
|
2764
|
+
title2?: string;
|
|
2765
|
+
title3?: string;
|
|
2766
|
+
title4?: string;
|
|
2767
|
+
image?: ChroniclesMedia[];
|
|
2768
|
+
link?: ContentLink;
|
|
2769
|
+
};
|
|
2770
|
+
|
|
2771
|
+
type ChroniclesGroup = {
|
|
2772
|
+
label: string;
|
|
2773
|
+
rows: { item: ChroniclesItem; index: number }[];
|
|
2774
|
+
};
|
|
2775
|
+
|
|
2776
|
+
type TextStyleFields = {
|
|
2777
|
+
FontFamily: string;
|
|
2778
|
+
FontSettings: { fontWeight: number; fontStyle: string };
|
|
2779
|
+
FontSize: number;
|
|
2780
|
+
LineHeight: number;
|
|
2781
|
+
LetterSpacing: number;
|
|
2782
|
+
WordSpacing: number;
|
|
2783
|
+
TextAlign?: TextStyles['textAlign'];
|
|
2784
|
+
TextAppearance: TextStyles['textAppearance'];
|
|
2785
|
+
};
|
|
2786
|
+
|
|
2787
|
+
type PrefixedTextStyle<Prefix extends string> = {
|
|
2788
|
+
[Key in keyof TextStyleFields as \`\${Prefix}\${Key}\`]: TextStyleFields[Key];
|
|
2789
|
+
};
|
|
2790
|
+
|
|
2791
|
+
type ColumnLayoutSettings = Partial<Record<ColumnWidthKey, number>> & {
|
|
2792
|
+
columns: number;
|
|
2793
|
+
columnGap: number;
|
|
2794
|
+
panelWidth: number;
|
|
2795
|
+
panelPadding: Padding;
|
|
2796
|
+
};
|
|
2797
|
+
|
|
2798
|
+
type ChroniclesSettings = PrefixedTextStyle<TextStylePrefix> & ColumnLayoutSettings & {
|
|
2799
|
+
type: 'a' | 'b';
|
|
2800
|
+
triggerLabel: string;
|
|
2801
|
+
closeLabel: string;
|
|
2802
|
+
hoverInterval: number;
|
|
2803
|
+
panelPosition: ChroniclesPanelPosition;
|
|
2804
|
+
panelRadius: number;
|
|
2805
|
+
groupGap: number;
|
|
2806
|
+
triggerColor: string;
|
|
2807
|
+
triggerHoverColor: string;
|
|
2808
|
+
closeColor: string;
|
|
2809
|
+
closeHoverColor: string;
|
|
2810
|
+
panelColor: string;
|
|
2811
|
+
textColor: string;
|
|
2812
|
+
textHoverColor: string;
|
|
2813
|
+
overlayColor: string;
|
|
2814
|
+
};
|
|
2815
|
+
|
|
2816
|
+
type ChroniclesProps = {
|
|
2817
|
+
settings: ChroniclesSettings;
|
|
2818
|
+
content?: ChroniclesItem[];
|
|
2819
|
+
isEditor?: boolean;
|
|
2820
|
+
isEditMode?: boolean;
|
|
2821
|
+
isPreviewMode?: boolean;
|
|
2822
|
+
portalId?: string;
|
|
2823
|
+
} & CommonComponentProps;
|
|
2824
|
+
|
|
2825
|
+
function getColumnsSpace({ columns, columnGap, panelWidth, panelPadding }: ColumnLayoutSettings): number {
|
|
2826
|
+
return Math.max(0, panelWidth - panelPadding.left - panelPadding.right - (columns - 1) * columnGap);
|
|
2827
|
+
}
|
|
2828
|
+
|
|
2829
|
+
export function getChroniclesEqualColumnWidths(settings: ColumnLayoutSettings): Partial<Record<ColumnWidthKey, number>> {
|
|
2830
|
+
const width = getColumnsSpace(settings) / settings.columns;
|
|
2831
|
+
return Object.fromEntries(CHRONICLES_COLUMN_WIDTH_KEYS.slice(0, settings.columns - 1).map((key) => [key, width]));
|
|
2832
|
+
}
|
|
2833
|
+
|
|
2834
|
+
export function applyChroniclesColumnCountChange(
|
|
2835
|
+
nextSettings: Record<string, any>,
|
|
2836
|
+
prevSettings: Record<string, any>,
|
|
2837
|
+
): Record<string, any> {
|
|
2838
|
+
if (typeof nextSettings.columns !== 'number' || nextSettings.columns === prevSettings.columns) {
|
|
2839
|
+
return nextSettings;
|
|
2840
|
+
}
|
|
2841
|
+
return { ...nextSettings, ...getChroniclesEqualColumnWidths({ ...prevSettings, ...nextSettings } as ColumnLayoutSettings) };
|
|
2842
|
+
}
|
|
2843
|
+
|
|
2844
|
+
function resolveColumnWidths(settings: ColumnLayoutSettings): number[] {
|
|
2845
|
+
const space = getColumnsSpace(settings);
|
|
2846
|
+
const sized = CHRONICLES_COLUMN_WIDTH_KEYS.slice(0, settings.columns - 1).map((key) => {
|
|
2847
|
+
const width = settings[key];
|
|
2848
|
+
return typeof width === 'number' ? Math.max(0, width) : space / settings.columns;
|
|
2849
|
+
});
|
|
2850
|
+
const sizedTotal = sized.reduce((sum, width) => sum + width, 0);
|
|
2851
|
+
const scale = sizedTotal > space ? space / sizedTotal : 1;
|
|
2852
|
+
return [...sized.map((width) => width * scale), Math.max(0, space - sizedTotal * scale)];
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2855
|
+
function getGridTemplateColumns(widths: number[]): string {
|
|
2856
|
+
const total = widths.reduce((sum, width) => sum + width, 0);
|
|
2857
|
+
return widths.map((width) => \`minmax(0, \${total > 0 ? (width / total) * 100 : 1}fr)\`).join(' ');
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2860
|
+
// A row with an empty group continues the group above it.
|
|
2861
|
+
function groupRows(items: ChroniclesItem[]): ChroniclesGroup[] {
|
|
2862
|
+
const groups: ChroniclesGroup[] = [];
|
|
2863
|
+
items.forEach((item, index) => {
|
|
2864
|
+
const label = item.group?.trim() ?? '';
|
|
2865
|
+
const current = groups[groups.length - 1];
|
|
2866
|
+
if (!current || (label !== '' && label !== current.label)) {
|
|
2867
|
+
groups.push({ label, rows: [{ item, index }] });
|
|
2868
|
+
return;
|
|
2869
|
+
}
|
|
2870
|
+
current.rows.push({ item, index });
|
|
2871
|
+
});
|
|
2872
|
+
return groups;
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2875
|
+
function getRowMedia(item: ChroniclesItem | undefined): ChroniclesMedia[] {
|
|
2876
|
+
return (item?.image ?? []).filter((media) => Boolean(media?.assetId));
|
|
2877
|
+
}
|
|
2878
|
+
|
|
2879
|
+
function getMediaKey(rowIndex: number, mediaIndex: number, assetId: string): string {
|
|
2880
|
+
return \`\${rowIndex}-\${mediaIndex}-\${assetId}\`;
|
|
2881
|
+
}
|
|
2882
|
+
|
|
2883
|
+
function isVideoMedia({ type, name, assetId }: ChroniclesMedia): boolean {
|
|
2884
|
+
if (type) return type === 'video';
|
|
2885
|
+
return VIDEO_EXTENSION_RE.test(name ?? '') || VIDEO_EXTENSION_RE.test(assetId);
|
|
2886
|
+
}
|
|
2887
|
+
|
|
2888
|
+
// The element that sets the article variables rather than one that inherits them, so it can be watched for
|
|
2889
|
+
// their changes: the editor sets them on its page container when the layout changes.
|
|
2890
|
+
function findLayoutContainer(element: HTMLElement | null): HTMLElement | null {
|
|
2891
|
+
const width = element ? getComputedStyle(element).getPropertyValue('--cntrl-article-width').trim() : '';
|
|
2892
|
+
if (!width) return element;
|
|
2893
|
+
let container = element!;
|
|
2894
|
+
for (let el = container.parentElement; el; el = el.parentElement) {
|
|
2895
|
+
if (getComputedStyle(el).getPropertyValue('--cntrl-article-width').trim() !== width) break;
|
|
2896
|
+
container = el;
|
|
2897
|
+
}
|
|
2898
|
+
return container;
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
function getLayoutStyle(container: HTMLElement | null): CSSProperties {
|
|
2902
|
+
const layoutContainer = findLayoutContainer(container);
|
|
2903
|
+
if (!layoutContainer) return {};
|
|
2904
|
+
const computed = getComputedStyle(layoutContainer);
|
|
2905
|
+
return Object.fromEntries(
|
|
2906
|
+
LIGHTBOX_CSS_VARS
|
|
2907
|
+
.map((name) => [name, computed.getPropertyValue(name).trim()])
|
|
2908
|
+
.filter(([, value]) => value),
|
|
2909
|
+
);
|
|
2910
|
+
}
|
|
2911
|
+
|
|
2912
|
+
function resolveTextStyle(settings: ChroniclesSettings, prefix: TextStylePrefix): TextStyles {
|
|
2913
|
+
const read = <Key extends keyof TextStyleFields>(key: Key) => (
|
|
2914
|
+
(settings as Record<string, unknown>)[\`\${prefix}\${key}\`] as TextStyleFields[Key]
|
|
2915
|
+
);
|
|
2916
|
+
return {
|
|
2917
|
+
fontSettings: { fontFamily: read('FontFamily'), ...read('FontSettings') },
|
|
2918
|
+
fontSize: read('FontSize'),
|
|
2919
|
+
lineHeight: read('LineHeight'),
|
|
2920
|
+
letterSpacing: read('LetterSpacing'),
|
|
2921
|
+
wordSpacing: read('WordSpacing'),
|
|
2922
|
+
textAlign: read('TextAlign'),
|
|
2923
|
+
textAppearance: read('TextAppearance'),
|
|
2924
|
+
color: '#000000',
|
|
2925
|
+
};
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
function getCSS(P: string): string {
|
|
2929
|
+
return \`
|
|
2930
|
+
.\${P}-trigger,
|
|
2931
|
+
.\${P}-close {
|
|
2932
|
+
display: inline-block;
|
|
2933
|
+
margin: 0;
|
|
2934
|
+
padding: 0;
|
|
2935
|
+
border: 0;
|
|
2936
|
+
background: none;
|
|
2937
|
+
cursor: pointer;
|
|
2938
|
+
white-space: nowrap;
|
|
2939
|
+
transition: color 150ms ease;
|
|
2940
|
+
-webkit-appearance: none;
|
|
2941
|
+
appearance: none;
|
|
2942
|
+
-webkit-tap-highlight-color: transparent;
|
|
2943
|
+
}
|
|
2944
|
+
.\${P}-trigger {
|
|
2945
|
+
color: var(--\${P}-trigger-color);
|
|
2946
|
+
transition: color 150ms ease, opacity \${OVERLAY_ANIM_MS}ms ease;
|
|
2947
|
+
}
|
|
2948
|
+
.\${P}-trigger-hidden {
|
|
2949
|
+
opacity: 0;
|
|
2950
|
+
}
|
|
2951
|
+
.\${P}-close {
|
|
2952
|
+
position: absolute;
|
|
2953
|
+
z-index: 2;
|
|
2954
|
+
color: var(--\${P}-close-color);
|
|
2955
|
+
}
|
|
2956
|
+
.\${P}-trigger:focus,
|
|
2957
|
+
.\${P}-close:focus {
|
|
2958
|
+
outline: none;
|
|
2959
|
+
}
|
|
2960
|
+
.\${P}-trigger:focus-visible,
|
|
2961
|
+
.\${P}-close:focus-visible {
|
|
2962
|
+
outline: 1px solid currentColor;
|
|
2963
|
+
outline-offset: 2px;
|
|
2964
|
+
}
|
|
2965
|
+
.\${P}-interactive .\${P}-trigger:hover {
|
|
2966
|
+
color: var(--\${P}-trigger-hover-color, var(--\${P}-trigger-color));
|
|
2967
|
+
}
|
|
2968
|
+
.\${P}-close:hover {
|
|
2969
|
+
color: var(--\${P}-close-hover-color, var(--\${P}-close-color));
|
|
2970
|
+
}
|
|
2971
|
+
.\${P}-editor .\${P}-trigger {
|
|
2972
|
+
cursor: default;
|
|
2973
|
+
}
|
|
2974
|
+
.\${P}-overlay {
|
|
2975
|
+
position: fixed;
|
|
2976
|
+
inset: 0;
|
|
2977
|
+
z-index: 9997;
|
|
2978
|
+
overflow: hidden;
|
|
2979
|
+
overscroll-behavior: none;
|
|
2980
|
+
opacity: 0;
|
|
2981
|
+
pointer-events: none;
|
|
2982
|
+
transition: opacity \${OVERLAY_ANIM_MS}ms ease;
|
|
2983
|
+
}
|
|
2984
|
+
.\${P}-inline-layer {
|
|
2985
|
+
position: fixed;
|
|
2986
|
+
inset: 0;
|
|
2987
|
+
z-index: 9997;
|
|
2988
|
+
overflow: hidden;
|
|
2989
|
+
pointer-events: none;
|
|
2990
|
+
}
|
|
2991
|
+
.\${P}-overlay-editor {
|
|
2992
|
+
inset: auto;
|
|
2993
|
+
top: var(--cntrl-article-top, 0);
|
|
2994
|
+
left: var(--cntrl-article-left, 0);
|
|
2995
|
+
width: var(--cntrl-article-width, 100vw) !important;
|
|
2996
|
+
height: var(--cntrl-viewport-height, 100vh) !important;
|
|
2997
|
+
}
|
|
2998
|
+
.\${P}-overlay-edit-mode {
|
|
2999
|
+
z-index: 1;
|
|
3000
|
+
}
|
|
3001
|
+
.\${P}-overlay-active {
|
|
3002
|
+
opacity: 1;
|
|
3003
|
+
pointer-events: auto;
|
|
3004
|
+
}
|
|
3005
|
+
.\${P}-backdrop {
|
|
3006
|
+
position: absolute;
|
|
3007
|
+
inset: 0;
|
|
3008
|
+
background-color: var(--\${P}-overlay-color);
|
|
3009
|
+
}
|
|
3010
|
+
.\${P}-media-layer {
|
|
3011
|
+
position: absolute;
|
|
3012
|
+
inset: 0;
|
|
3013
|
+
pointer-events: none;
|
|
3014
|
+
}
|
|
3015
|
+
.\${P}-media {
|
|
3016
|
+
position: absolute;
|
|
3017
|
+
inset: 0;
|
|
3018
|
+
width: 100%;
|
|
3019
|
+
height: 100%;
|
|
3020
|
+
object-fit: cover;
|
|
3021
|
+
opacity: 0;
|
|
3022
|
+
}
|
|
3023
|
+
.\${P}-media-contain {
|
|
3024
|
+
object-fit: contain;
|
|
3025
|
+
}
|
|
3026
|
+
.\${P}-media-visible,
|
|
3027
|
+
.\${P}-media-fading {
|
|
3028
|
+
transition: opacity \${IMAGE_FADE_MS}ms cubic-bezier(0, 0, 0.58, 1);
|
|
3029
|
+
}
|
|
3030
|
+
.\${P}-media-visible {
|
|
3031
|
+
z-index: 1;
|
|
3032
|
+
opacity: 1;
|
|
3033
|
+
}
|
|
3034
|
+
.\${P}-media-covered {
|
|
3035
|
+
opacity: 1;
|
|
3036
|
+
}
|
|
3037
|
+
.\${P}-media-fading {
|
|
3038
|
+
opacity: 0;
|
|
3039
|
+
}
|
|
3040
|
+
.\${P}-media-layer-instant .\${P}-media {
|
|
3041
|
+
transition: none;
|
|
3042
|
+
}
|
|
3043
|
+
.\${P}-panel {
|
|
3044
|
+
position: absolute;
|
|
3045
|
+
top: var(--\${P}-panel-y);
|
|
3046
|
+
left: var(--\${P}-panel-x);
|
|
3047
|
+
z-index: 1;
|
|
3048
|
+
box-sizing: border-box;
|
|
3049
|
+
max-width: 100%;
|
|
3050
|
+
max-height: 100%;
|
|
3051
|
+
overflow-y: auto;
|
|
3052
|
+
transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y) + 12px));
|
|
3053
|
+
background-color: var(--\${P}-panel-color);
|
|
3054
|
+
color: var(--\${P}-text-color);
|
|
3055
|
+
overscroll-behavior: contain;
|
|
3056
|
+
transition: transform \${OVERLAY_ANIM_MS}ms cubic-bezier(0, 0, 0.58, 1);
|
|
3057
|
+
}
|
|
3058
|
+
.\${P}-overlay-active .\${P}-panel {
|
|
3059
|
+
transform: translate(calc(-1 * var(--\${P}-panel-x)), calc(-1 * var(--\${P}-panel-y)));
|
|
3060
|
+
}
|
|
3061
|
+
.\${P}-panel-settled {
|
|
3062
|
+
transition: none;
|
|
3063
|
+
}
|
|
3064
|
+
.\${P}-panel-inline {
|
|
3065
|
+
position: relative;
|
|
3066
|
+
top: auto;
|
|
3067
|
+
left: auto;
|
|
3068
|
+
max-height: none;
|
|
3069
|
+
transform: none;
|
|
3070
|
+
transition: none;
|
|
3071
|
+
}
|
|
3072
|
+
.\${P}-panel-copy {
|
|
3073
|
+
position: absolute;
|
|
3074
|
+
pointer-events: none;
|
|
3075
|
+
}
|
|
3076
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3077
|
+
.\${P}-panel {
|
|
3078
|
+
transition: none;
|
|
3079
|
+
}
|
|
3080
|
+
}
|
|
3081
|
+
.\${P}-group {
|
|
3082
|
+
display: grid;
|
|
3083
|
+
grid-template-columns: var(--\${P}-grid-columns);
|
|
3084
|
+
column-gap: var(--\${P}-column-gap);
|
|
3085
|
+
}
|
|
3086
|
+
.\${P}-group ~ .\${P}-group {
|
|
3087
|
+
margin-top: var(--\${P}-group-gap);
|
|
3088
|
+
}
|
|
3089
|
+
.\${P}-group-label {
|
|
3090
|
+
grid-column: 1;
|
|
3091
|
+
align-self: start;
|
|
3092
|
+
min-width: 0;
|
|
3093
|
+
overflow-wrap: anywhere;
|
|
3094
|
+
}
|
|
3095
|
+
.\${P}-row {
|
|
3096
|
+
grid-column: 2 / -1;
|
|
3097
|
+
display: grid;
|
|
3098
|
+
grid-template-columns: subgrid;
|
|
3099
|
+
align-items: baseline;
|
|
3100
|
+
}
|
|
3101
|
+
a.\${P}-row {
|
|
3102
|
+
color: inherit;
|
|
3103
|
+
text-decoration: none;
|
|
3104
|
+
}
|
|
3105
|
+
.\${P}-group-unlabeled .\${P}-row {
|
|
3106
|
+
grid-column: 1 / -1;
|
|
3107
|
+
}
|
|
3108
|
+
.\${P}-title {
|
|
3109
|
+
min-width: 0;
|
|
3110
|
+
overflow-wrap: anywhere;
|
|
3111
|
+
white-space: pre-line;
|
|
3112
|
+
transition: color 150ms cubic-bezier(0, 0, 0.58, 1);
|
|
3113
|
+
}
|
|
3114
|
+
.\${P}-interactive .\${P}-row:hover .\${P}-title,
|
|
3115
|
+
.\${P}-row:focus-visible .\${P}-title,
|
|
3116
|
+
.\${P}-panel-copy .\${P}-row-active .\${P}-title {
|
|
3117
|
+
color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
|
|
3118
|
+
}
|
|
3119
|
+
.\${P}-control-anchor {
|
|
3120
|
+
position: absolute;
|
|
3121
|
+
pointer-events: none;
|
|
3122
|
+
z-index: 2;
|
|
3123
|
+
}
|
|
3124
|
+
\`;
|
|
3125
|
+
}
|
|
3126
|
+
|
|
3127
|
+
type ChroniclesMediaItemProps = {
|
|
3128
|
+
P: string;
|
|
3129
|
+
media: ChroniclesMedia;
|
|
3130
|
+
isVisible: boolean;
|
|
3131
|
+
isLoaded: boolean;
|
|
3132
|
+
isCovered: boolean;
|
|
3133
|
+
isFading: boolean;
|
|
3134
|
+
onLoad: () => void;
|
|
3135
|
+
};
|
|
3136
|
+
|
|
3137
|
+
function ChroniclesMediaItem({ P, media, isVisible, isLoaded, isCovered, isFading, onLoad }: ChroniclesMediaItemProps) {
|
|
3138
|
+
const videoRef = useRef<HTMLVideoElement>(null);
|
|
3139
|
+
const isVideo = isVideoMedia(media);
|
|
3140
|
+
const className = cn(
|
|
3141
|
+
\`\${P}-media\`,
|
|
3142
|
+
media.objectFit === 'contain' && \`\${P}-media-contain\`,
|
|
3143
|
+
isVisible && isLoaded && \`\${P}-media-visible\`,
|
|
3144
|
+
isCovered && \`\${P}-media-covered\`,
|
|
3145
|
+
isFading && \`\${P}-media-fading\`,
|
|
3146
|
+
);
|
|
3147
|
+
|
|
3148
|
+
useEffect(() => {
|
|
3149
|
+
const video = videoRef.current;
|
|
3150
|
+
if (!video) return;
|
|
3151
|
+
if (isVisible) {
|
|
3152
|
+
video.play()?.catch(() => {});
|
|
3153
|
+
} else {
|
|
3154
|
+
video.pause();
|
|
3155
|
+
}
|
|
3156
|
+
}, [isVisible]);
|
|
3157
|
+
|
|
3158
|
+
if (isVideo) {
|
|
3159
|
+
return (
|
|
3160
|
+
<video
|
|
3161
|
+
ref={videoRef}
|
|
3162
|
+
className={className}
|
|
3163
|
+
src={media.assetId}
|
|
3164
|
+
muted
|
|
3165
|
+
loop
|
|
3166
|
+
playsInline
|
|
3167
|
+
preload="auto"
|
|
3168
|
+
onLoadedData={onLoad}
|
|
3169
|
+
/>
|
|
3170
|
+
);
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
return <img className={className} src={media.assetId} alt="" decoding="async" onLoad={onLoad} />;
|
|
3174
|
+
}
|
|
3175
|
+
|
|
3176
|
+
function renderColumnWidthControls(
|
|
3177
|
+
P: string,
|
|
3178
|
+
widths: number[],
|
|
3179
|
+
paddingLeft: number,
|
|
3180
|
+
columnGap: number,
|
|
3181
|
+
scaled: (value: number) => string,
|
|
3182
|
+
) {
|
|
3183
|
+
const lastWidth = widths[widths.length - 1];
|
|
3184
|
+
let columnLeft = paddingLeft;
|
|
3185
|
+
return widths.slice(0, -1).map((width, index) => {
|
|
3186
|
+
const gapCenter = columnLeft + width + columnGap / 2;
|
|
3187
|
+
columnLeft += width + columnGap;
|
|
3188
|
+
return (
|
|
3189
|
+
<div
|
|
3190
|
+
key={CHRONICLES_COLUMN_WIDTH_KEYS[index]}
|
|
3191
|
+
data-controls={CHRONICLES_COLUMN_WIDTH_KEYS[index]}
|
|
3192
|
+
data-controls-axis="x"
|
|
3193
|
+
data-controls-variant="column-width"
|
|
3194
|
+
data-controls-min={String(MIN_COLUMN_WIDTH_PX)}
|
|
3195
|
+
data-controls-max-fraction={String(width + lastWidth)}
|
|
3196
|
+
className={\`\${P}-control-anchor\`}
|
|
3197
|
+
style={{ top: 0, left: scaled(gapCenter - MIN_HANDLE_SIZE / 2), width: scaled(MIN_HANDLE_SIZE), height: '100%' }}
|
|
3198
|
+
/>
|
|
3199
|
+
);
|
|
3200
|
+
});
|
|
3201
|
+
}
|
|
3202
|
+
|
|
3203
|
+
function renderPanelPaddingControls(
|
|
3204
|
+
P: string,
|
|
3205
|
+
panelWidth: number,
|
|
3206
|
+
padding: Padding,
|
|
3207
|
+
scaled: (value: number) => string,
|
|
3208
|
+
) {
|
|
3209
|
+
return PADDING_CONTROLS.map((control) => {
|
|
3210
|
+
const size = scaled(Math.max(padding[control.side], MIN_HANDLE_SIZE));
|
|
3211
|
+
const isHorizontal = control.axis === 'x';
|
|
3212
|
+
return (
|
|
3213
|
+
<div
|
|
3214
|
+
key={control.side}
|
|
3215
|
+
data-controls={\`panelPadding.\${control.side}\`}
|
|
3216
|
+
data-controls-axis={control.axis}
|
|
3217
|
+
data-controls-variant={control.variant}
|
|
3218
|
+
data-controls-reverse={'reverse' in control ? '' : undefined}
|
|
3219
|
+
data-controls-min="0"
|
|
3220
|
+
data-controls-max-fraction={'opposite' in control ? String(Math.max(0, panelWidth - padding[control.opposite])) : undefined}
|
|
3221
|
+
className={\`\${P}-control-anchor\`}
|
|
3222
|
+
style={{
|
|
3223
|
+
[control.side]: 0,
|
|
3224
|
+
...(isHorizontal ? { top: 0, width: size, height: '100%' } : { left: 0, width: '100%', height: size }),
|
|
3225
|
+
}}
|
|
3226
|
+
/>
|
|
3227
|
+
);
|
|
3228
|
+
});
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3231
|
+
export function Chronicles({
|
|
3232
|
+
settings,
|
|
3233
|
+
content,
|
|
3234
|
+
isEditor,
|
|
3235
|
+
isEditMode,
|
|
3236
|
+
isPreviewMode,
|
|
3237
|
+
portalId,
|
|
3238
|
+
currentState,
|
|
3239
|
+
unavailableStates,
|
|
3240
|
+
}: ChroniclesProps) {
|
|
3241
|
+
const { prefix: P } = useScopedStyles();
|
|
3242
|
+
const {
|
|
3243
|
+
type,
|
|
3244
|
+
triggerLabel,
|
|
3245
|
+
closeLabel,
|
|
3246
|
+
columns,
|
|
3247
|
+
columnGap,
|
|
3248
|
+
hoverInterval,
|
|
3249
|
+
panelPosition,
|
|
3250
|
+
panelWidth,
|
|
3251
|
+
panelPadding,
|
|
3252
|
+
panelRadius,
|
|
3253
|
+
groupGap,
|
|
3254
|
+
triggerColor,
|
|
3255
|
+
triggerHoverColor,
|
|
3256
|
+
closeColor,
|
|
3257
|
+
closeHoverColor,
|
|
3258
|
+
panelColor,
|
|
3259
|
+
textColor,
|
|
3260
|
+
textHoverColor,
|
|
3261
|
+
overlayColor,
|
|
3262
|
+
} = settings;
|
|
3263
|
+
const items = useMemo(() => content ?? [], [content]);
|
|
3264
|
+
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
3265
|
+
const triggerRef = useRef<HTMLButtonElement>(null);
|
|
3266
|
+
const overlayRef = useRef<HTMLDivElement>(null);
|
|
3267
|
+
const closeRef = useRef<HTMLButtonElement>(null);
|
|
3268
|
+
const panelRef = useRef<HTMLDivElement>(null);
|
|
3269
|
+
const inlineLayerRef = useRef<HTMLDivElement>(null);
|
|
3270
|
+
const shownMediaRef = useRef<string | null>(null);
|
|
3271
|
+
const [isUserOpen, setIsUserOpen] = useState(false);
|
|
3272
|
+
const [isOverlayMounted, setIsOverlayMounted] = useState(false);
|
|
3273
|
+
const [isOverlayActive, setIsOverlayActive] = useState(false);
|
|
3274
|
+
const [isOverlaySettled, setIsOverlaySettled] = useState(false);
|
|
3275
|
+
const [activeIndex, setActiveIndex] = useState<number | null>(null);
|
|
3276
|
+
const [activeMediaIndex, setActiveMediaIndex] = useState(0);
|
|
3277
|
+
const [mountedRows, setMountedRows] = useState<Set<number>>(() => new Set());
|
|
3278
|
+
const [loadedMedia, setLoadedMedia] = useState<Set<string>>(() => new Set());
|
|
3279
|
+
const [coveredMedia, setCoveredMedia] = useState<string | null>(null);
|
|
3280
|
+
const [lastShownMedia, setLastShownMedia] = useState<string | null>(null);
|
|
3281
|
+
const [closePosition, setClosePosition] = useState<{ top: number; left: number } | null>(null);
|
|
3282
|
+
const [layoutStyle, setLayoutStyle] = useState<CSSProperties>({});
|
|
3283
|
+
const [copyRect, setCopyRect] = useState<{ top: number; left: number; width: number } | null>(null);
|
|
3284
|
+
const [isMediaCut, setIsMediaCut] = useState(false);
|
|
3285
|
+
|
|
3286
|
+
const isEditorCanvas = isEditor && !isPreviewMode;
|
|
3287
|
+
const isInteractive = !isEditorCanvas;
|
|
3288
|
+
const isInline = type === 'a';
|
|
3289
|
+
const isOpenPinned = isEditorCanvas && currentState === 'open' && !unavailableStates?.includes('open');
|
|
3290
|
+
const isOpen = !isInline && (isOpenPinned || ((isInteractive || isEditMode) && isUserOpen));
|
|
3291
|
+
const isListShown = isInteractive && (isInline || isOpen);
|
|
3292
|
+
const scaled = (value: number) => scalingValue(value, isEditor ?? false);
|
|
3293
|
+
const scopedCss = useMemo(() => getCSS(P), [P]);
|
|
3294
|
+
const panelOffset = PANEL_POSITION_OFFSETS[panelPosition];
|
|
3295
|
+
const columnWidths = resolveColumnWidths(settings);
|
|
3296
|
+
const titleKeys = TITLE_KEYS.slice(0, columns - 1);
|
|
3297
|
+
const hasGroupColumn = columns > 1;
|
|
3298
|
+
const groups = useMemo<ChroniclesGroup[]>(() => (
|
|
3299
|
+
hasGroupColumn ? groupRows(items) : [{ label: '', rows: items.map((item, index) => ({ item, index })) }]
|
|
3300
|
+
), [items, hasGroupColumn]);
|
|
3301
|
+
|
|
3302
|
+
const activeMedia = activeIndex === null ? [] : getRowMedia(items[activeIndex]);
|
|
3303
|
+
const shownAsset = activeMedia[activeMediaIndex];
|
|
3304
|
+
const shownMedia = activeIndex !== null && shownAsset ? getMediaKey(activeIndex, activeMediaIndex, shownAsset.assetId) : null;
|
|
3305
|
+
const isShownMediaLoaded = shownMedia !== null && loadedMedia.has(shownMedia);
|
|
3306
|
+
|
|
3307
|
+
useLightboxScrollLock(isOpen && !isEditorCanvas);
|
|
3308
|
+
|
|
3309
|
+
useEffect(() => {
|
|
3310
|
+
if (isEditorCanvas && !isEditMode) setIsUserOpen(false);
|
|
3311
|
+
}, [isEditorCanvas, isEditMode]);
|
|
3312
|
+
|
|
3313
|
+
useEffect(() => {
|
|
3314
|
+
if (isOpen) {
|
|
3315
|
+
setLayoutStyle(getLayoutStyle(wrapperRef.current));
|
|
3316
|
+
setIsOverlayMounted(true);
|
|
3317
|
+
return;
|
|
3318
|
+
}
|
|
3319
|
+
setIsOverlayActive(false);
|
|
3320
|
+
setActiveIndex(null);
|
|
3321
|
+
const timer = window.setTimeout(() => setIsOverlayMounted(false), OVERLAY_ANIM_MS);
|
|
3322
|
+
return () => window.clearTimeout(timer);
|
|
3323
|
+
}, [isOpen]);
|
|
3324
|
+
|
|
3325
|
+
useEffect(() => {
|
|
3326
|
+
if (!isOpen || !isOverlayMounted) return;
|
|
3327
|
+
overlayRef.current?.getBoundingClientRect();
|
|
3328
|
+
const frame = requestAnimationFrame(() => setIsOverlayActive(true));
|
|
3329
|
+
return () => cancelAnimationFrame(frame);
|
|
3330
|
+
}, [isOpen, isOverlayMounted]);
|
|
3331
|
+
|
|
3332
|
+
useEffect(() => {
|
|
3333
|
+
if (!isOverlayActive) {
|
|
3334
|
+
setIsOverlaySettled(false);
|
|
3335
|
+
return;
|
|
3336
|
+
}
|
|
3337
|
+
const timer = window.setTimeout(() => setIsOverlaySettled(true), OVERLAY_ANIM_MS);
|
|
3338
|
+
return () => window.clearTimeout(timer);
|
|
3339
|
+
}, [isOverlayActive]);
|
|
3340
|
+
|
|
3341
|
+
const updateClosePosition = useCallback(() => {
|
|
3342
|
+
const trigger = triggerRef.current;
|
|
3343
|
+
const overlay = overlayRef.current;
|
|
3344
|
+
if (!trigger || !overlay) return;
|
|
3345
|
+
const triggerRect = trigger.getBoundingClientRect();
|
|
3346
|
+
const overlayRect = overlay.getBoundingClientRect();
|
|
3347
|
+
setClosePosition({ top: triggerRect.top - overlayRect.top, left: triggerRect.left - overlayRect.left });
|
|
3348
|
+
}, []);
|
|
3349
|
+
|
|
3350
|
+
const isLayerMounted = isOverlayMounted || (isInline && mountedRows.size > 0);
|
|
3351
|
+
useEffect(() => {
|
|
3352
|
+
const wrapper = wrapperRef.current;
|
|
3353
|
+
if (!isLayerMounted || !wrapper || typeof ResizeObserver === 'undefined') return;
|
|
3354
|
+
const update = () => setLayoutStyle((prev) => {
|
|
3355
|
+
const next = getLayoutStyle(wrapper);
|
|
3356
|
+
const isSame = LIGHTBOX_CSS_VARS.every((name) => (prev as Record<string, unknown>)[name] === (next as Record<string, unknown>)[name]);
|
|
3357
|
+
return isSame ? prev : next;
|
|
3358
|
+
});
|
|
3359
|
+
const observer = new ResizeObserver(update);
|
|
3360
|
+
observer.observe(wrapper);
|
|
3361
|
+
// the editor changes the variables a frame after a layout switch, without resizing either element then
|
|
3362
|
+
const styleObserver = new MutationObserver(update);
|
|
3363
|
+
const layoutContainer = findLayoutContainer(wrapper);
|
|
3364
|
+
if (layoutContainer && layoutContainer !== wrapper) {
|
|
3365
|
+
observer.observe(layoutContainer);
|
|
3366
|
+
styleObserver.observe(layoutContainer, { attributes: true, attributeFilter: ['style'] });
|
|
3367
|
+
}
|
|
3368
|
+
return () => {
|
|
3369
|
+
observer.disconnect();
|
|
3370
|
+
styleObserver.disconnect();
|
|
3371
|
+
};
|
|
3372
|
+
}, [isLayerMounted]);
|
|
3373
|
+
|
|
3374
|
+
useLayoutEffect(() => {
|
|
3375
|
+
if (!isOverlayMounted) return;
|
|
3376
|
+
updateClosePosition();
|
|
3377
|
+
window.addEventListener('resize', updateClosePosition);
|
|
3378
|
+
return () => window.removeEventListener('resize', updateClosePosition);
|
|
3379
|
+
}, [isOverlayMounted, layoutStyle, updateClosePosition]);
|
|
3380
|
+
|
|
3381
|
+
useEffect(() => {
|
|
3382
|
+
if (!isOpen || !isInteractive) return;
|
|
3383
|
+
closeRef.current?.focus({ preventScroll: true });
|
|
3384
|
+
const onKeyDown = (event: KeyboardEvent) => {
|
|
3385
|
+
if (event.key !== 'Escape') return;
|
|
3386
|
+
setIsUserOpen(false);
|
|
3387
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
3388
|
+
};
|
|
3389
|
+
document.addEventListener('keydown', onKeyDown);
|
|
3390
|
+
return () => document.removeEventListener('keydown', onKeyDown);
|
|
3391
|
+
}, [isOpen, isInteractive]);
|
|
3392
|
+
|
|
3393
|
+
useLayoutEffect(() => {
|
|
3394
|
+
if (!isInline || activeIndex === null) return;
|
|
3395
|
+
const panelEl = panelRef.current;
|
|
3396
|
+
const layer = inlineLayerRef.current;
|
|
3397
|
+
if (!panelEl || !layer) return;
|
|
3398
|
+
const panelRect = panelEl.getBoundingClientRect();
|
|
3399
|
+
const layerRect = layer.getBoundingClientRect();
|
|
3400
|
+
setCopyRect({ top: panelRect.top - layerRect.top, left: panelRect.left - layerRect.left, width: panelRect.width });
|
|
3401
|
+
}, [isInline, activeIndex]);
|
|
3402
|
+
|
|
3403
|
+
useEffect(() => {
|
|
3404
|
+
if (activeIndex !== null) return;
|
|
3405
|
+
const timer = window.setTimeout(() => setCopyRect(null), IMAGE_FADE_MS);
|
|
3406
|
+
return () => window.clearTimeout(timer);
|
|
3407
|
+
}, [activeIndex]);
|
|
3408
|
+
|
|
3409
|
+
const isCopyShown = copyRect !== null;
|
|
3410
|
+
useEffect(() => {
|
|
3411
|
+
if (!isInline || !isCopyShown) return;
|
|
3412
|
+
const cut = () => {
|
|
3413
|
+
setIsMediaCut(true);
|
|
3414
|
+
setActiveIndex(null);
|
|
3415
|
+
setCopyRect(null);
|
|
3416
|
+
};
|
|
3417
|
+
document.addEventListener('scroll', cut, { capture: true, passive: true });
|
|
3418
|
+
window.addEventListener('resize', cut);
|
|
3419
|
+
return () => {
|
|
3420
|
+
document.removeEventListener('scroll', cut, { capture: true });
|
|
3421
|
+
window.removeEventListener('resize', cut);
|
|
3422
|
+
};
|
|
3423
|
+
}, [isInline, isCopyShown]);
|
|
3424
|
+
|
|
3425
|
+
useEffect(() => {
|
|
3426
|
+
if (!isListShown) return;
|
|
3427
|
+
items.forEach((item) => getRowMedia(item).forEach((media) => {
|
|
3428
|
+
if (!isVideoMedia(media)) new Image().src = media.assetId;
|
|
3429
|
+
}));
|
|
3430
|
+
}, [isListShown, items]);
|
|
3431
|
+
|
|
3432
|
+
useEffect(() => {
|
|
3433
|
+
if (activeMedia.length < 2) return;
|
|
3434
|
+
const timer = window.setInterval(() => {
|
|
3435
|
+
setActiveMediaIndex((current) => (current + 1) % activeMedia.length);
|
|
3436
|
+
}, hoverInterval);
|
|
3437
|
+
return () => window.clearInterval(timer);
|
|
3438
|
+
}, [activeIndex, activeMedia.length, hoverInterval]);
|
|
3439
|
+
|
|
3440
|
+
useLayoutEffect(() => {
|
|
3441
|
+
const previous = shownMediaRef.current;
|
|
3442
|
+
shownMediaRef.current = shownMedia;
|
|
3443
|
+
if (shownMedia === null) return;
|
|
3444
|
+
setLastShownMedia(shownMedia);
|
|
3445
|
+
setCoveredMedia(previous);
|
|
3446
|
+
}, [shownMedia]);
|
|
3447
|
+
|
|
3448
|
+
useEffect(() => {
|
|
3449
|
+
if (!isShownMediaLoaded || coveredMedia === null) return;
|
|
3450
|
+
const timer = window.setTimeout(() => setCoveredMedia(null), IMAGE_FADE_MS);
|
|
3451
|
+
return () => window.clearTimeout(timer);
|
|
3452
|
+
}, [isShownMediaLoaded, coveredMedia]);
|
|
3453
|
+
|
|
3454
|
+
const close = () => {
|
|
3455
|
+
if (!isInteractive) return;
|
|
3456
|
+
setIsUserOpen(false);
|
|
3457
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
3458
|
+
};
|
|
3459
|
+
|
|
3460
|
+
const showRowMedia = (index: number) => {
|
|
3461
|
+
if (!isInteractive || getRowMedia(items[index]).length === 0) {
|
|
3462
|
+
setActiveIndex(null);
|
|
3463
|
+
return;
|
|
3464
|
+
}
|
|
3465
|
+
setMountedRows((prev) => (prev.has(index) ? prev : new Set(prev).add(index)));
|
|
3466
|
+
if (isInline && activeIndex === null) setLayoutStyle(getLayoutStyle(wrapperRef.current));
|
|
3467
|
+
if (activeIndex !== index) setActiveMediaIndex(0);
|
|
3468
|
+
setIsMediaCut(false);
|
|
3469
|
+
setActiveIndex(index);
|
|
3470
|
+
};
|
|
3471
|
+
|
|
3472
|
+
const hideRowMedia = (index: number) => {
|
|
3473
|
+
setActiveIndex((current) => (current === index ? null : current));
|
|
3474
|
+
};
|
|
3475
|
+
|
|
3476
|
+
const onPanelClickCapture = (event: MouseEvent<HTMLDivElement>) => {
|
|
3477
|
+
if (!isInteractive && (event.target as HTMLElement).closest('a')) {
|
|
3478
|
+
event.preventDefault();
|
|
3479
|
+
}
|
|
3480
|
+
};
|
|
3481
|
+
|
|
3482
|
+
const triggerTypographyCss = omitTextColors(textStylesToCss(resolveTextStyle(settings, 'trigger'), isEditor));
|
|
3483
|
+
const columnTypographyCss = CHRONICLES_COLUMN_STYLE_PREFIXES.slice(0, columns).map((prefix) => (
|
|
3484
|
+
omitTextColors(textStylesToCss(resolveTextStyle(settings, prefix), isEditor))
|
|
3485
|
+
));
|
|
3486
|
+
const labelLineHeight = columnTypographyCss[0].lineHeight;
|
|
3487
|
+
const titleLineHeight = columnTypographyCss[1]?.lineHeight;
|
|
3488
|
+
const groupLabelOffset = labelLineHeight !== undefined && titleLineHeight !== undefined
|
|
3489
|
+
? \`calc((\${titleLineHeight} - \${labelLineHeight}) / 2)\`
|
|
3490
|
+
: undefined;
|
|
3491
|
+
|
|
3492
|
+
const colorVars = buildColorVars(P, {
|
|
3493
|
+
triggerColor,
|
|
3494
|
+
triggerHoverColor,
|
|
3495
|
+
closeColor,
|
|
3496
|
+
closeHoverColor,
|
|
3497
|
+
panelColor,
|
|
3498
|
+
textColor,
|
|
3499
|
+
textHoverColor,
|
|
3500
|
+
overlayColor,
|
|
3501
|
+
}, COLOR_VAR_MAP, []);
|
|
3502
|
+
const interactiveClass = isInteractive ? \`\${P}-interactive\` : '';
|
|
3503
|
+
const showPanelControls = Boolean(isEditMode) && (isInline || isOverlaySettled);
|
|
3504
|
+
|
|
3505
|
+
const mediaLayer = (
|
|
3506
|
+
<div className={cn(\`\${P}-media-layer\`, isMediaCut && \`\${P}-media-layer-instant\`)} aria-hidden="true">
|
|
3507
|
+
{[...mountedRows].flatMap((index) => getRowMedia(items[index]).map((media, mediaIndex) => {
|
|
3508
|
+
const mediaKey = getMediaKey(index, mediaIndex, media.assetId);
|
|
3509
|
+
return (
|
|
3510
|
+
<ChroniclesMediaItem
|
|
3511
|
+
key={mediaKey}
|
|
3512
|
+
P={P}
|
|
3513
|
+
media={media}
|
|
3514
|
+
isVisible={mediaKey === shownMedia}
|
|
3515
|
+
isLoaded={loadedMedia.has(mediaKey)}
|
|
3516
|
+
isCovered={mediaKey === coveredMedia}
|
|
3517
|
+
isFading={shownMedia === null && (mediaKey === lastShownMedia || mediaKey === coveredMedia)}
|
|
3518
|
+
onLoad={() => setLoadedMedia((prev) => (prev.has(mediaKey) ? prev : new Set(prev).add(mediaKey)))}
|
|
3519
|
+
/>
|
|
3520
|
+
);
|
|
3521
|
+
}))}
|
|
3522
|
+
</div>
|
|
3523
|
+
);
|
|
3524
|
+
|
|
3525
|
+
const renderPanel = (isCopy: boolean) => {
|
|
3526
|
+
const showControls = !isCopy && showPanelControls;
|
|
3527
|
+
return (
|
|
3528
|
+
<div
|
|
3529
|
+
ref={isCopy ? undefined : panelRef}
|
|
3530
|
+
className={cn(
|
|
3531
|
+
\`\${P}-panel\`,
|
|
3532
|
+
isOverlayActive && isOverlaySettled && \`\${P}-panel-settled\`,
|
|
3533
|
+
isInline && \`\${P}-panel-inline\`,
|
|
3534
|
+
isCopy && \`\${P}-panel-copy\`,
|
|
3535
|
+
)}
|
|
3536
|
+
style={{
|
|
3537
|
+
width: scaled(panelWidth),
|
|
3538
|
+
paddingTop: scaled(panelPadding.top),
|
|
3539
|
+
paddingRight: scaled(panelPadding.right),
|
|
3540
|
+
paddingBottom: scaled(panelPadding.bottom),
|
|
3541
|
+
paddingLeft: scaled(panelPadding.left),
|
|
3542
|
+
borderRadius: scaled(panelRadius),
|
|
3543
|
+
[\`--\${P}-group-gap\`]: scaled(groupGap),
|
|
3544
|
+
[\`--\${P}-panel-x\`]: panelOffset.x,
|
|
3545
|
+
[\`--\${P}-panel-y\`]: panelOffset.y,
|
|
3546
|
+
[\`--\${P}-grid-columns\`]: getGridTemplateColumns(columnWidths),
|
|
3547
|
+
[\`--\${P}-column-gap\`]: scaled(columnGap),
|
|
3548
|
+
...(isCopy && copyRect),
|
|
3549
|
+
} as CSSProperties}
|
|
3550
|
+
data-lightbox-scrollable={isInline ? undefined : ''}
|
|
3551
|
+
aria-hidden={isCopy || undefined}
|
|
3552
|
+
onMouseLeave={isCopy ? undefined : () => setActiveIndex(null)}
|
|
3553
|
+
onClickCapture={isCopy ? undefined : onPanelClickCapture}
|
|
3554
|
+
>
|
|
3555
|
+
{showControls && renderPanelPaddingControls(P, panelWidth, panelPadding, scaled)}
|
|
3556
|
+
{showControls && renderColumnWidthControls(P, columnWidths, panelPadding.left, columnGap, scaled)}
|
|
3557
|
+
{groups.map((group, groupIndex) => (
|
|
3558
|
+
<Fragment key={groupIndex}>
|
|
3559
|
+
{showControls && groupIndex > 0 && (
|
|
3560
|
+
<div
|
|
3561
|
+
data-controls="groupGap"
|
|
3562
|
+
data-controls-paired=""
|
|
3563
|
+
data-controls-axis="y"
|
|
3564
|
+
data-controls-reverse=""
|
|
3565
|
+
data-controls-min="0"
|
|
3566
|
+
className={\`\${P}-control-anchor\`}
|
|
3567
|
+
style={{ left: 0, width: '100%', height: scaled(Math.max(groupGap, MIN_HANDLE_SIZE)) }}
|
|
3568
|
+
/>
|
|
3569
|
+
)}
|
|
3570
|
+
<div
|
|
3571
|
+
className={cn(\`\${P}-group\`, !hasGroupColumn && \`\${P}-group-unlabeled\`)}
|
|
3572
|
+
style={{ gridTemplateRows: \`repeat(\${group.rows.length}, auto) 1fr\` }}
|
|
3573
|
+
>
|
|
3574
|
+
{hasGroupColumn && (
|
|
3575
|
+
<span
|
|
3576
|
+
className={\`\${P}-group-label\`}
|
|
3577
|
+
style={{ ...columnTypographyCss[0], gridRow: \`1 / span \${group.rows.length + 1}\`, marginTop: groupLabelOffset }}
|
|
3578
|
+
>
|
|
3579
|
+
{group.label}
|
|
3580
|
+
</span>
|
|
3581
|
+
)}
|
|
3582
|
+
{group.rows.map(({ item, index }) => {
|
|
3583
|
+
const rowLink = !isCopy && item.link?.value ? item.link : undefined;
|
|
3584
|
+
const RowElement = rowLink ? 'a' : 'div';
|
|
3585
|
+
const linkProps = rowLink ? {
|
|
3586
|
+
href: buildValidUrl(rowLink.value),
|
|
3587
|
+
...(rowLink.target === 'blank' && { target: '_blank', rel: 'noreferrer' }),
|
|
3588
|
+
} : {};
|
|
3589
|
+
const isFocusable = !rowLink && isInteractive && getRowMedia(item).length > 0;
|
|
3590
|
+
const hoverProps = isCopy ? {} : {
|
|
3591
|
+
tabIndex: isFocusable ? 0 : undefined,
|
|
3592
|
+
onMouseEnter: () => showRowMedia(index),
|
|
3593
|
+
onMouseLeave: () => hideRowMedia(index),
|
|
3594
|
+
onFocus: () => showRowMedia(index),
|
|
3595
|
+
onBlur: () => hideRowMedia(index),
|
|
3596
|
+
};
|
|
3597
|
+
return (
|
|
3598
|
+
<RowElement
|
|
3599
|
+
key={index}
|
|
3600
|
+
className={cn(\`\${P}-row\`, isCopy && index === activeIndex && \`\${P}-row-active\`)}
|
|
3601
|
+
{...linkProps}
|
|
3602
|
+
{...hoverProps}
|
|
3603
|
+
>
|
|
3604
|
+
{!hasGroupColumn && (
|
|
3605
|
+
<div className={\`\${P}-title\`} style={columnTypographyCss[0]}>{item.group}</div>
|
|
3606
|
+
)}
|
|
3607
|
+
{titleKeys.map((key, titleIndex) => (
|
|
3608
|
+
<div key={key} className={\`\${P}-title\`} style={columnTypographyCss[titleIndex + 1]}>{item[key]}</div>
|
|
3609
|
+
))}
|
|
3610
|
+
</RowElement>
|
|
3611
|
+
);
|
|
3612
|
+
})}
|
|
3613
|
+
</div>
|
|
3614
|
+
</Fragment>
|
|
3615
|
+
))}
|
|
3616
|
+
</div>
|
|
3617
|
+
);
|
|
3618
|
+
};
|
|
3619
|
+
|
|
3620
|
+
const overlay = isOverlayMounted && !isInline ? (
|
|
3621
|
+
<div
|
|
3622
|
+
ref={overlayRef}
|
|
3623
|
+
className={cn(
|
|
3624
|
+
\`\${P}-overlay\`,
|
|
3625
|
+
isEditor && \`\${P}-overlay-editor\`,
|
|
3626
|
+
isEditMode && \`\${P}-overlay-edit-mode\`,
|
|
3627
|
+
isOverlayActive && \`\${P}-overlay-active\`,
|
|
3628
|
+
interactiveClass,
|
|
3629
|
+
)}
|
|
3630
|
+
style={{ ...colorVars, ...layoutStyle }}
|
|
3631
|
+
role="dialog"
|
|
3632
|
+
aria-modal="true"
|
|
3633
|
+
aria-label={triggerLabel}
|
|
3634
|
+
data-selection="none"
|
|
3635
|
+
>
|
|
3636
|
+
<div className={\`\${P}-backdrop\`} aria-hidden="true" onClick={close} />
|
|
3637
|
+
{mediaLayer}
|
|
3638
|
+
<button
|
|
3639
|
+
ref={closeRef}
|
|
3640
|
+
type="button"
|
|
3641
|
+
className={\`\${P}-close\`}
|
|
3642
|
+
style={{
|
|
3643
|
+
...triggerTypographyCss,
|
|
3644
|
+
top: closePosition?.top ?? 0,
|
|
3645
|
+
left: closePosition?.left ?? 0,
|
|
3646
|
+
visibility: closePosition ? 'visible' : 'hidden',
|
|
3647
|
+
}}
|
|
3648
|
+
onClick={close}
|
|
3649
|
+
>
|
|
3650
|
+
{closeLabel}
|
|
3651
|
+
</button>
|
|
3652
|
+
{renderPanel(false)}
|
|
3653
|
+
</div>
|
|
3654
|
+
) : null;
|
|
3655
|
+
|
|
3656
|
+
const inlineLayer = isInline && mountedRows.size > 0 ? (
|
|
3657
|
+
<div
|
|
3658
|
+
ref={inlineLayerRef}
|
|
3659
|
+
className={cn(\`\${P}-inline-layer\`, isEditor && \`\${P}-overlay-editor\`, interactiveClass)}
|
|
3660
|
+
style={{ ...colorVars, ...layoutStyle }}
|
|
3661
|
+
aria-hidden="true"
|
|
3662
|
+
data-selection="none"
|
|
3663
|
+
>
|
|
3664
|
+
{mediaLayer}
|
|
3665
|
+
{copyRect && renderPanel(true)}
|
|
3666
|
+
</div>
|
|
3667
|
+
) : null;
|
|
3668
|
+
const portalContent = overlay ?? inlineLayer;
|
|
3669
|
+
|
|
3670
|
+
return (
|
|
3671
|
+
<>
|
|
3672
|
+
<style dangerouslySetInnerHTML={{ __html: scopedCss }} />
|
|
3673
|
+
<div
|
|
3674
|
+
ref={wrapperRef}
|
|
3675
|
+
className={cn(isEditorCanvas && \`\${P}-editor\`, interactiveClass)}
|
|
3676
|
+
style={colorVars}
|
|
3677
|
+
>
|
|
3678
|
+
{isInline ? renderPanel(false) : (
|
|
3679
|
+
<button
|
|
3680
|
+
ref={triggerRef}
|
|
3681
|
+
type="button"
|
|
3682
|
+
className={cn(\`\${P}-trigger\`, isOverlayActive && \`\${P}-trigger-hidden\`)}
|
|
3683
|
+
style={triggerTypographyCss}
|
|
3684
|
+
aria-haspopup="dialog"
|
|
3685
|
+
aria-expanded={isOpen}
|
|
3686
|
+
onClick={() => {
|
|
3687
|
+
if (isInteractive) setIsUserOpen(true);
|
|
3688
|
+
}}
|
|
3689
|
+
>
|
|
3690
|
+
{triggerLabel}
|
|
3691
|
+
</button>
|
|
3692
|
+
)}
|
|
3693
|
+
</div>
|
|
3694
|
+
{portalContent && typeof document !== 'undefined' && createPortal(
|
|
3695
|
+
portalContent,
|
|
3696
|
+
(portalId ? document.getElementById(portalId) : null) ?? document.body,
|
|
3697
|
+
)}
|
|
3698
|
+
</>
|
|
3699
|
+
);
|
|
3700
|
+
}
|
|
3701
|
+
`, w = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2688
3702
|
import { CommonComponentProps } from '../props';
|
|
2689
3703
|
import { LinkWrapper, useScopedStyles, type ContentLink } from '../utils/index';
|
|
2690
3704
|
|
|
@@ -3213,7 +4227,7 @@ export function ClickGallerie({ settings, content = [], isEditor }: ClickGalleri
|
|
|
3213
4227
|
</>
|
|
3214
4228
|
);
|
|
3215
4229
|
}
|
|
3216
|
-
`,
|
|
4230
|
+
`, $ = `import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3217
4231
|
import cn from 'classnames';
|
|
3218
4232
|
import { CommonComponentProps } from '../props';
|
|
3219
4233
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -3961,7 +4975,7 @@ export function FAQ({ settings, content, isEditor, isPreviewMode, isEditMode, ac
|
|
|
3961
4975
|
</>
|
|
3962
4976
|
);
|
|
3963
4977
|
}
|
|
3964
|
-
`,
|
|
4978
|
+
`, I = `import React, { useMemo, useState } from 'react';
|
|
3965
4979
|
import { CommonComponentProps } from '../props';
|
|
3966
4980
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
3967
4981
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -4599,7 +5613,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
4599
5613
|
};
|
|
4600
5614
|
|
|
4601
5615
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
4602
|
-
`,
|
|
5616
|
+
`, T = `import { Splide, SplideSlide } from '@splidejs/react-splide';
|
|
4603
5617
|
import '@splidejs/react-splide/css/core';
|
|
4604
5618
|
import { CommonComponentProps } from '../props';
|
|
4605
5619
|
import { EmbedMediaFrame, getEmbedAspect, getEmbedPlayback, isEmbedMedia } from '../utils/index';
|
|
@@ -6914,7 +7928,7 @@ const COLOR_VAR_MAP: Record<ColorKeys, string> = {
|
|
|
6914
7928
|
};
|
|
6915
7929
|
|
|
6916
7930
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
6917
|
-
`,
|
|
7931
|
+
`, E = `import { useEffect, useMemo, useRef, type CSSProperties } from 'react';
|
|
6918
7932
|
import { CommonComponentProps } from '../props';
|
|
6919
7933
|
import { scalingValue } from '../utils/scalingValue';
|
|
6920
7934
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -7487,7 +8501,7 @@ export function Helix({
|
|
|
7487
8501
|
</>
|
|
7488
8502
|
);
|
|
7489
8503
|
}
|
|
7490
|
-
`,
|
|
8504
|
+
`, R = `import { CommonComponentProps } from '../props';
|
|
7491
8505
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, scalingValue, useLazyVideos, useScopedStyles } from '../utils/index';
|
|
7492
8506
|
import { LazyVideo } from '../helpers/LazyVideo/LazyVideo';
|
|
7493
8507
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -9939,7 +10953,7 @@ export function Hive({
|
|
|
9939
10953
|
</>
|
|
9940
10954
|
);
|
|
9941
10955
|
}
|
|
9942
|
-
`,
|
|
10956
|
+
`, M = `import { useCallback, useEffect, useMemo, useRef, useState, type MouseEvent } from 'react';
|
|
9943
10957
|
import { createPortal } from 'react-dom';
|
|
9944
10958
|
import { CommonComponentProps } from '../props';
|
|
9945
10959
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -10704,7 +11718,7 @@ export type LightboxJournalSettings = {
|
|
|
10704
11718
|
closeIconColor: string;
|
|
10705
11719
|
closeIconHoverColor: string;
|
|
10706
11720
|
};
|
|
10707
|
-
`,
|
|
11721
|
+
`, L = `import { useEffect, useRef, useState, type MouseEvent } from 'react';
|
|
10708
11722
|
import { createPortal } from 'react-dom';
|
|
10709
11723
|
import { CommonComponentProps } from '../props';
|
|
10710
11724
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -11250,7 +12264,7 @@ export const LightboxStrip = ({ settings, content, isEditor, isEditMode, isPrevi
|
|
|
11250
12264
|
</>
|
|
11251
12265
|
);
|
|
11252
12266
|
};
|
|
11253
|
-
`,
|
|
12267
|
+
`, k = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
11254
12268
|
import { createPortal } from 'react-dom';
|
|
11255
12269
|
import { CommonComponentProps } from '../props';
|
|
11256
12270
|
import { buildColorVars, EmbedMediaFrame, isEmbedMedia, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -14355,7 +15369,7 @@ export function List({ settings, content, isEditor, isPreviewMode, isEditMode, a
|
|
|
14355
15369
|
</>
|
|
14356
15370
|
);
|
|
14357
15371
|
}
|
|
14358
|
-
`,
|
|
15372
|
+
`, A = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react';
|
|
14359
15373
|
import cn from 'classnames';
|
|
14360
15374
|
import { CommonComponentProps } from '../props';
|
|
14361
15375
|
import { EmbedMediaFrame, getEmbedAspect, isEmbedMedia, LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -15213,7 +16227,7 @@ type MarqueeProps = {
|
|
|
15213
16227
|
isPreviewMode?: boolean;
|
|
15214
16228
|
isEditMode?: boolean;
|
|
15215
16229
|
} & CommonComponentProps;
|
|
15216
|
-
`,
|
|
16230
|
+
`, N = `import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react';
|
|
15217
16231
|
import cn from 'classnames';
|
|
15218
16232
|
import { CommonComponentProps } from '../props';
|
|
15219
16233
|
import { LinkWrapper, scalingValue, useScopedStyles, type ContentLink } from '../utils/index';
|
|
@@ -16156,7 +17170,7 @@ type MarqueeTextProps = {
|
|
|
16156
17170
|
isPreviewMode?: boolean;
|
|
16157
17171
|
isEditMode?: boolean;
|
|
16158
17172
|
} & CommonComponentProps;
|
|
16159
|
-
`,
|
|
17173
|
+
`, H = `import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
16160
17174
|
import { createPortal } from 'react-dom';
|
|
16161
17175
|
import type React from 'react';
|
|
16162
17176
|
import { CommonComponentProps } from '../props';
|
|
@@ -18638,7 +19652,7 @@ export function Mercury({
|
|
|
18638
19652
|
</>
|
|
18639
19653
|
);
|
|
18640
19654
|
}
|
|
18641
|
-
`,
|
|
19655
|
+
`, O = `import React, { useMemo, useState } from 'react';
|
|
18642
19656
|
import { CommonComponentProps } from '../props';
|
|
18643
19657
|
import { buildColorVars, getFormFieldValidationError, scalingValue, useScopedStyles } from '../utils/index';
|
|
18644
19658
|
import { omitTextColors, textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
@@ -19217,7 +20231,7 @@ const COLOR_VAR_MAP: Record<OnelinerColorKeys, string> = {
|
|
|
19217
20231
|
};
|
|
19218
20232
|
|
|
19219
20233
|
const STATE_KEYS = ['hover', 'focus', 'filled', 'success', 'error'] as const;
|
|
19220
|
-
`,
|
|
20234
|
+
`, _ = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
19221
20235
|
import type React from 'react';
|
|
19222
20236
|
import { CommonComponentProps } from '../props';
|
|
19223
20237
|
import { scalingValue, useScopedStyles } from '../utils/index';
|
|
@@ -20056,7 +21070,7 @@ export function Pretext({ settings, content, isEditor, isPreviewMode, isEditMode
|
|
|
20056
21070
|
</>
|
|
20057
21071
|
);
|
|
20058
21072
|
}
|
|
20059
|
-
`,
|
|
21073
|
+
`, F = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20060
21074
|
import cn from 'classnames';
|
|
20061
21075
|
import { CommonComponentProps } from '../props';
|
|
20062
21076
|
import { useScopedStyles } from '../utils/useScopedStyles';
|
|
@@ -20684,7 +21698,7 @@ export function Scale({ settings, content, isEditor, isPreviewMode }: ScaleProps
|
|
|
20684
21698
|
</>
|
|
20685
21699
|
);
|
|
20686
21700
|
}
|
|
20687
|
-
`,
|
|
21701
|
+
`, W = `import { useMemo, type CSSProperties, type MouseEvent, type ReactNode } from 'react';
|
|
20688
21702
|
import { SvgImage } from '../helpers/SvgImage/SvgImage';
|
|
20689
21703
|
import { CommonComponentProps } from '../props';
|
|
20690
21704
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
@@ -21316,7 +22330,7 @@ export function SimpleButton({ settings, isEditor, isPreviewMode, activeEvent, h
|
|
|
21316
22330
|
</>
|
|
21317
22331
|
);
|
|
21318
22332
|
}
|
|
21319
|
-
`,
|
|
22333
|
+
`, D = `import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
21320
22334
|
import cn from 'classnames';
|
|
21321
22335
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
21322
22336
|
import { scalingValue } from '../utils/scalingValue';
|
|
@@ -22498,7 +23512,7 @@ function ArrowIcon({ color, className }: { color: string, className: string }) {
|
|
|
22498
23512
|
</svg>
|
|
22499
23513
|
);
|
|
22500
23514
|
}
|
|
22501
|
-
`,
|
|
23515
|
+
`, B = `import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
22502
23516
|
import cn from 'classnames';
|
|
22503
23517
|
import { CommonComponentProps } from '../props';
|
|
22504
23518
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -23129,7 +24143,7 @@ type TestimonialsSettings = {
|
|
|
23129
24143
|
logoHeight: number;
|
|
23130
24144
|
captionMarginTop: number;
|
|
23131
24145
|
};
|
|
23132
|
-
`,
|
|
24146
|
+
`, z = `import cn from 'classnames';
|
|
23133
24147
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
23134
24148
|
import { CommonComponentProps } from '../props';
|
|
23135
24149
|
import { RichTextRenderer } from '../helpers/RichTextRenderer/RichTextRenderer';
|
|
@@ -23625,7 +24639,7 @@ type TestimonialsSettings = {
|
|
|
23625
24639
|
icon?: string | null;
|
|
23626
24640
|
};
|
|
23627
24641
|
};
|
|
23628
|
-
`,
|
|
24642
|
+
`, V = `import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
23629
24643
|
import type React from 'react';
|
|
23630
24644
|
import { createPortal } from 'react-dom';
|
|
23631
24645
|
import { CommonComponentProps } from '../props';
|
|
@@ -24158,29 +25172,30 @@ export function Waterfall({
|
|
|
24158
25172
|
</>
|
|
24159
25173
|
);
|
|
24160
25174
|
}
|
|
24161
|
-
`,
|
|
24162
|
-
[
|
|
24163
|
-
[
|
|
24164
|
-
[
|
|
24165
|
-
[
|
|
24166
|
-
[
|
|
24167
|
-
[
|
|
24168
|
-
[
|
|
24169
|
-
[
|
|
24170
|
-
[
|
|
24171
|
-
[
|
|
24172
|
-
[
|
|
24173
|
-
[
|
|
24174
|
-
[
|
|
24175
|
-
[
|
|
24176
|
-
[
|
|
24177
|
-
[
|
|
24178
|
-
[
|
|
24179
|
-
[
|
|
24180
|
-
[
|
|
24181
|
-
[
|
|
24182
|
-
[
|
|
25175
|
+
`, U = {
|
|
25176
|
+
[y.id]: S,
|
|
25177
|
+
[b.id]: C,
|
|
25178
|
+
[x.id]: w,
|
|
25179
|
+
[P.id]: $,
|
|
25180
|
+
[v.id]: I,
|
|
25181
|
+
[f.id]: T,
|
|
25182
|
+
[h.id]: E,
|
|
25183
|
+
[p.id]: R,
|
|
25184
|
+
[m.id]: M,
|
|
25185
|
+
[g.id]: L,
|
|
25186
|
+
[u.id]: k,
|
|
25187
|
+
[d.id]: A,
|
|
25188
|
+
[c.id]: N,
|
|
25189
|
+
[l.id]: H,
|
|
25190
|
+
[s.id]: O,
|
|
25191
|
+
[a.id]: _,
|
|
25192
|
+
[r.id]: F,
|
|
25193
|
+
[o.id]: W,
|
|
25194
|
+
[i.id]: D,
|
|
25195
|
+
[t.id]: B,
|
|
25196
|
+
[e.id]: z,
|
|
25197
|
+
[n.id]: V
|
|
24183
25198
|
};
|
|
24184
25199
|
export {
|
|
24185
|
-
|
|
25200
|
+
U as componentSources
|
|
24186
25201
|
};
|