@cntrl-site/components 1.0.107-alpha.6 → 1.0.108-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Burger-EMSn7TPB.mjs → Burger-BkVgNMGU.mjs} +464 -436
- package/dist/Burger-C3yVbQcq.js +669 -0
- package/dist/{ChroniclesComponent-CccM-H_s.mjs → ChroniclesComponent-9Fi2A06B.mjs} +484 -333
- package/dist/ChroniclesComponent-DILYPR6b.js +1 -0
- package/dist/Components/Burger/Burger.d.ts +3 -0
- package/dist/Components/Burger/BurgerComponent.d.ts +32 -0
- package/dist/Components/Hive/Hive.d.ts +16 -0
- package/dist/Components/Hive/HiveComponent.d.ts +3 -1
- package/dist/Hive-CzabuuCc.js +328 -0
- package/dist/Hive-DyxYd5eg.mjs +1504 -0
- package/dist/{components-C_iy6uBo.js → components-BJdVsqb6.js} +1 -1
- package/dist/{components-DNKhvmUV.mjs → components-Qpn7IZ0W.mjs} +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +2 -2
- 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 +128 -21
- package/dist/sources.mjs +128 -21
- package/dist/types/Component.d.ts +5 -0
- package/package.json +1 -1
- package/dist/Burger-C6jI6C1c.js +0 -661
- package/dist/ChroniclesComponent-BazDuget.js +0 -1
- package/dist/Hive-BsmFHk2i.mjs +0 -1458
- package/dist/Hive-D1j6wZpV.js +0 -321
package/dist/sources.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-9Fi2A06B.mjs";
|
|
2
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';
|
|
@@ -58,6 +58,7 @@ type BurgerPosition =
|
|
|
58
58
|
type BurgerSettings = {
|
|
59
59
|
link?: BurgerLink[];
|
|
60
60
|
logo?: BurgerLogo | null;
|
|
61
|
+
logoLink?: string;
|
|
61
62
|
logoMaxWidth?: number;
|
|
62
63
|
logoMaxHeight?: number;
|
|
63
64
|
logoPosition?: BurgerLogoPosition;
|
|
@@ -151,7 +152,7 @@ function resolveCurrentState(value?: string | null): BurgerVisualState | undefin
|
|
|
151
152
|
return undefined;
|
|
152
153
|
}
|
|
153
154
|
|
|
154
|
-
type BurgerShowIn = 'always' | 'open only' | 'open and compact' | 'default and open' | 'default and compact';
|
|
155
|
+
type BurgerShowIn = 'always' | 'open only' | 'default only' | 'open and compact' | 'default and open' | 'default and compact';
|
|
155
156
|
|
|
156
157
|
function resolveLogoPosition(value?: string): BurgerLogoPosition {
|
|
157
158
|
if (value === 'center' || value === 'right') return value;
|
|
@@ -189,6 +190,7 @@ function pickShowIn(value?: BurgerShowInValue, layoutId?: string): string | unde
|
|
|
189
190
|
function resolveShowIn(value?: BurgerShowInValue, layoutId?: string): BurgerShowIn {
|
|
190
191
|
const showIn = (pickShowIn(value, layoutId) ?? 'always').trim().toLowerCase().replace(/[_-]+/g, ' ');
|
|
191
192
|
if (showIn === 'open only' || showIn === 'openonly') return 'open only';
|
|
193
|
+
if (showIn === 'default only' || showIn === 'defaultonly') return 'default only';
|
|
192
194
|
if (showIn === 'open and compact' || showIn === 'openandcompact') return 'open and compact';
|
|
193
195
|
if (showIn === 'default and open' || showIn === 'defaultandopen') return 'default and open';
|
|
194
196
|
if (showIn === 'default and compact' || showIn === 'defaultandcompact') return 'default and compact';
|
|
@@ -199,6 +201,8 @@ function isVisibleInClosedNav(item: BurgerLink, navigationState: BurgerNavigatio
|
|
|
199
201
|
switch (resolveShowIn(item.showIn, layoutId)) {
|
|
200
202
|
case 'open only':
|
|
201
203
|
return false;
|
|
204
|
+
case 'default only':
|
|
205
|
+
return navigationState === 'default';
|
|
202
206
|
case 'open and compact':
|
|
203
207
|
return navigationState === 'compact';
|
|
204
208
|
case 'default and compact':
|
|
@@ -212,6 +216,7 @@ function isVisibleInClosedNav(item: BurgerLink, navigationState: BurgerNavigatio
|
|
|
212
216
|
|
|
213
217
|
function isVisibleInOpenNav(item: BurgerLink, layoutId?: string): boolean {
|
|
214
218
|
switch (resolveShowIn(item.showIn, layoutId)) {
|
|
219
|
+
case 'default only':
|
|
215
220
|
case 'default and compact':
|
|
216
221
|
return false;
|
|
217
222
|
default:
|
|
@@ -219,6 +224,12 @@ function isVisibleInOpenNav(item: BurgerLink, layoutId?: string): boolean {
|
|
|
219
224
|
}
|
|
220
225
|
}
|
|
221
226
|
|
|
227
|
+
/** The open menu is unavailable when every link is shown in the default state only. */
|
|
228
|
+
export function isBurgerOpenMenuAvailable(links: unknown, layoutId?: string): boolean {
|
|
229
|
+
if (!Array.isArray(links) || links.length === 0) return true;
|
|
230
|
+
return (links as BurgerLink[]).some((item) => resolveShowIn(item?.showIn, layoutId) !== 'default only');
|
|
231
|
+
}
|
|
232
|
+
|
|
222
233
|
type BurgerPageRef = {
|
|
223
234
|
id: string;
|
|
224
235
|
slug: string;
|
|
@@ -274,6 +285,13 @@ function getBurgerDest(item: BurgerLink): {
|
|
|
274
285
|
return { type: 'page', value: item.page ?? '', target, anchor: item.anchor };
|
|
275
286
|
}
|
|
276
287
|
|
|
288
|
+
function normalizeLogoHref(value: string): string {
|
|
289
|
+
if (/^[a-z][a-z\\d+\\-.]*:/i.test(value) || value.startsWith('/') || value.startsWith('#')) {
|
|
290
|
+
return value;
|
|
291
|
+
}
|
|
292
|
+
return \`https://\${value}\`;
|
|
293
|
+
}
|
|
294
|
+
|
|
277
295
|
function resolveBurgerLink(item: BurgerLink, pages?: BurgerPageRef[]): {
|
|
278
296
|
label: string;
|
|
279
297
|
href: string;
|
|
@@ -1302,6 +1320,14 @@ function getCSS(P: string): string {
|
|
|
1302
1320
|
right: 0;
|
|
1303
1321
|
transform: none;
|
|
1304
1322
|
}
|
|
1323
|
+
.\${P}-nav-logo-link {
|
|
1324
|
+
display: flex;
|
|
1325
|
+
align-items: center;
|
|
1326
|
+
height: 100%;
|
|
1327
|
+
color: inherit;
|
|
1328
|
+
text-decoration: none;
|
|
1329
|
+
cursor: pointer;
|
|
1330
|
+
}
|
|
1305
1331
|
.\${P}-nav-logo-inner {
|
|
1306
1332
|
position: relative;
|
|
1307
1333
|
flex-shrink: 0;
|
|
@@ -1898,8 +1924,9 @@ export function Burger({
|
|
|
1898
1924
|
const pinnedState = resolveCurrentState(currentStateProp);
|
|
1899
1925
|
const unavailableStateSet = useMemo(() => new Set(unavailableStates), [unavailableStates]);
|
|
1900
1926
|
const isStateUnavailable = (state?: string | null) => Boolean(state && unavailableStateSet.has(state));
|
|
1927
|
+
const isOpenMenuAvailable = isBurgerOpenMenuAvailable(settingsProp.link, layoutId);
|
|
1901
1928
|
const isOpenPinned = Boolean(isEditor && !isPreviewMode && pinnedState === 'open' && !isStateUnavailable('open'));
|
|
1902
|
-
const isOpen = isOpenPinned || (!(isEditor && !isPreviewMode) && isOpenUser);
|
|
1929
|
+
const isOpen = isOpenMenuAvailable && (isOpenPinned || (!(isEditor && !isPreviewMode) && isOpenUser));
|
|
1903
1930
|
const isEditorCanvas = Boolean(isEditor && !isPreviewMode);
|
|
1904
1931
|
const shouldLockScroll = isOpen && !isEditorCanvas;
|
|
1905
1932
|
useLightboxScrollLock(shouldLockScroll);
|
|
@@ -1932,6 +1959,7 @@ export function Burger({
|
|
|
1932
1959
|
|
|
1933
1960
|
const {
|
|
1934
1961
|
logo,
|
|
1962
|
+
logoLink = '',
|
|
1935
1963
|
logoMaxHeight = 120 / 1440,
|
|
1936
1964
|
logoPosition = 'left',
|
|
1937
1965
|
panelHeight = 60 / 1440,
|
|
@@ -2025,7 +2053,7 @@ export function Burger({
|
|
|
2025
2053
|
const closedNavPaddingRight = isCompactNav ? compactNavPaddingRight : navPaddingRight;
|
|
2026
2054
|
|
|
2027
2055
|
const resolvedNavTextWidth = closedNavTextWidth ?? textWidth;
|
|
2028
|
-
const showBurgerButton = isOpen || (isCompactNav ? compactShowIcon : showIcon) !== 'off';
|
|
2056
|
+
const showBurgerButton = isOpen || (isOpenMenuAvailable && (isCompactNav ? compactShowIcon : showIcon) !== 'off');
|
|
2029
2057
|
|
|
2030
2058
|
const colorVars = buildColorVars(P, {
|
|
2031
2059
|
iconColor,
|
|
@@ -2212,6 +2240,9 @@ export function Burger({
|
|
|
2212
2240
|
const tintLogo = Boolean(logoMaskUrl);
|
|
2213
2241
|
const logoHeight = scaled(Math.min(closedLogoMaxHeight, closedPanelHeight));
|
|
2214
2242
|
const isLogoOnRight = Boolean(showLogo && logoSrc && closedLogoPosition === 'right');
|
|
2243
|
+
const logoLinkItem: BurgerLink | null = logoLink.trim()
|
|
2244
|
+
? { link: { type: 'url', value: normalizeLogoHref(logoLink.trim()), target: 'self' } }
|
|
2245
|
+
: null;
|
|
2215
2246
|
const toggleSide = isLogoOnRight ? 'left' : 'right';
|
|
2216
2247
|
|
|
2217
2248
|
const items = Array.isArray(linkItems) ? linkItems : [];
|
|
@@ -2562,6 +2593,23 @@ export function Burger({
|
|
|
2562
2593
|
);
|
|
2563
2594
|
};
|
|
2564
2595
|
|
|
2596
|
+
const logoNode = (
|
|
2597
|
+
<div
|
|
2598
|
+
className={\`\${P}-nav-logo-inner\${tintLogo ? \` \${P}-nav-logo-tinted\` : ''}\`}
|
|
2599
|
+
style={{
|
|
2600
|
+
height: logoHeight,
|
|
2601
|
+
...(tintLogo && logoMaskUrl ? { [\`--\${P}-logo-image\`]: cssMaskImageUrl(logoMaskUrl) } : {}),
|
|
2602
|
+
} as CSSProperties}
|
|
2603
|
+
>
|
|
2604
|
+
<img
|
|
2605
|
+
src={tintLogo && logoMaskUrl ? logoMaskUrl : logoSrc}
|
|
2606
|
+
alt=""
|
|
2607
|
+
className={\`\${P}-nav-logo-img\`}
|
|
2608
|
+
/>
|
|
2609
|
+
{tintLogo ? <span className={\`\${P}-nav-logo-tint\`} aria-hidden="true" /> : null}
|
|
2610
|
+
</div>
|
|
2611
|
+
);
|
|
2612
|
+
|
|
2565
2613
|
const navBarStyle: CSSProperties = {
|
|
2566
2614
|
...colorVars,
|
|
2567
2615
|
height: scalingValue(closedPanelHeight, isEditor),
|
|
@@ -2596,20 +2644,16 @@ export function Burger({
|
|
|
2596
2644
|
{showLogo && logoSrc ? (
|
|
2597
2645
|
<div className={\`\${P}-nav-logo \${P}-nav-logo-\${closedLogoPosition}\`}>
|
|
2598
2646
|
{closedLogoPosition === 'left' ? renderNavEdgePadding('left') : null}
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
className={\`\${P}-nav-logo-img\`}
|
|
2610
|
-
/>
|
|
2611
|
-
{tintLogo ? <span className={\`\${P}-nav-logo-tint\`} aria-hidden="true" /> : null}
|
|
2612
|
-
</div>
|
|
2647
|
+
{logoLinkItem ? (
|
|
2648
|
+
<a
|
|
2649
|
+
href={logoLinkItem.link?.value}
|
|
2650
|
+
className={\`\${P}-nav-logo-link\`}
|
|
2651
|
+
aria-label="Home"
|
|
2652
|
+
onClick={(event) => onNavLinkClick(event, logoLinkItem)}
|
|
2653
|
+
>
|
|
2654
|
+
{logoNode}
|
|
2655
|
+
</a>
|
|
2656
|
+
) : logoNode}
|
|
2613
2657
|
{closedLogoPosition === 'right' ? renderNavEdgePadding('right') : null}
|
|
2614
2658
|
</div>
|
|
2615
2659
|
) : null}
|
|
@@ -8444,6 +8488,7 @@ import {
|
|
|
8444
8488
|
type HiveLightboxTitleSettings,
|
|
8445
8489
|
} from './HiveLightboxTitles';
|
|
8446
8490
|
import { getDisplayedImageRect } from '../utils/getImageRect';
|
|
8491
|
+
import { textStylesToCss, type TextStyles } from '../utils/textStylesToCss';
|
|
8447
8492
|
|
|
8448
8493
|
function sv(px: number): string {
|
|
8449
8494
|
return \`calc(var(--cntrl-article-width, 100vw) * \${px / 1440})\`;
|
|
@@ -8770,6 +8815,13 @@ function getCSS(P: string): string {
|
|
|
8770
8815
|
pointer-events: auto;
|
|
8771
8816
|
flex-shrink: 0;
|
|
8772
8817
|
}
|
|
8818
|
+
.\${P}-item-text {
|
|
8819
|
+
flex-shrink: 0;
|
|
8820
|
+
margin: 0;
|
|
8821
|
+
white-space: normal;
|
|
8822
|
+
overflow-wrap: anywhere;
|
|
8823
|
+
word-break: break-word;
|
|
8824
|
+
}
|
|
8773
8825
|
\`;
|
|
8774
8826
|
}
|
|
8775
8827
|
|
|
@@ -8782,8 +8834,20 @@ type GridLayoutConfig = {
|
|
|
8782
8834
|
};
|
|
8783
8835
|
|
|
8784
8836
|
type HiveSettings = {
|
|
8837
|
+
type?: 'a' | 'b';
|
|
8785
8838
|
gridLayout: GridLayoutConfig;
|
|
8786
8839
|
verticalGap: number;
|
|
8840
|
+
textBoxWidth?: number;
|
|
8841
|
+
textMarginTop?: number;
|
|
8842
|
+
entryTitleColor?: string;
|
|
8843
|
+
entryTitleFontFamily?: string;
|
|
8844
|
+
entryTitleFontSettings?: { fontWeight: number; fontStyle: string };
|
|
8845
|
+
entryTitleFontSize?: number;
|
|
8846
|
+
entryTitleLineHeight?: number;
|
|
8847
|
+
entryTitleLetterSpacing?: number;
|
|
8848
|
+
entryTitleWordSpacing?: number;
|
|
8849
|
+
entryTitleTextAlign?: TextStyles['textAlign'];
|
|
8850
|
+
entryTitleTextAppearance?: TextStyles['textAppearance'];
|
|
8787
8851
|
align?: 'top' | 'center' | 'bottom';
|
|
8788
8852
|
imageDisplay: {
|
|
8789
8853
|
display: 'fit' | 'cover';
|
|
@@ -10574,7 +10638,16 @@ export function Hive({
|
|
|
10574
10638
|
portalId,
|
|
10575
10639
|
}: HiveProps) {
|
|
10576
10640
|
const { prefix: P } = useScopedStyles();
|
|
10577
|
-
const {
|
|
10641
|
+
const {
|
|
10642
|
+
type = 'a',
|
|
10643
|
+
gridLayout,
|
|
10644
|
+
verticalGap,
|
|
10645
|
+
textBoxWidth = 100,
|
|
10646
|
+
textMarginTop = 0,
|
|
10647
|
+
align = 'top',
|
|
10648
|
+
imageDisplay,
|
|
10649
|
+
} = settings;
|
|
10650
|
+
const showEntryText = type === 'b';
|
|
10578
10651
|
|
|
10579
10652
|
const isCover = imageDisplay?.display === 'cover';
|
|
10580
10653
|
const ratioValue = imageDisplay?.ratioValue ?? '1:1';
|
|
@@ -10590,6 +10663,27 @@ export function Hive({
|
|
|
10590
10663
|
const horizontalGapScaled = scalingValue(gridLayout.horizontalGap ?? 0, isEditor);
|
|
10591
10664
|
const imageWrapperWidth = entryWidthScaled;
|
|
10592
10665
|
const controlWidthStyle = entryWidthScaled;
|
|
10666
|
+
const textBoxWidthStyle = \`calc(\${entryWidthScaled} * (\${textBoxWidth} / 100))\`;
|
|
10667
|
+
const textControlWidthStyle = scalingValue(size * textBoxWidth / 100, isEditor);
|
|
10668
|
+
// like Neptune, a text box wider than the entry widens the whole cell so the image stays centered
|
|
10669
|
+
const itemInnerWidth = showEntryText && textBoxWidth > 100 ? textBoxWidthStyle : entryWidthScaled;
|
|
10670
|
+
const entryTextStyle = useMemo(
|
|
10671
|
+
() => textStylesToCss({
|
|
10672
|
+
fontSettings: {
|
|
10673
|
+
fontFamily: settings.entryTitleFontFamily ?? 'Arial',
|
|
10674
|
+
fontWeight: settings.entryTitleFontSettings?.fontWeight ?? 400,
|
|
10675
|
+
fontStyle: settings.entryTitleFontSettings?.fontStyle ?? 'normal',
|
|
10676
|
+
},
|
|
10677
|
+
fontSize: settings.entryTitleFontSize ?? 0.0098,
|
|
10678
|
+
lineHeight: settings.entryTitleLineHeight,
|
|
10679
|
+
letterSpacing: settings.entryTitleLetterSpacing ?? 0,
|
|
10680
|
+
wordSpacing: settings.entryTitleWordSpacing ?? 0,
|
|
10681
|
+
textAlign: settings.entryTitleTextAlign ?? 'left',
|
|
10682
|
+
textAppearance: settings.entryTitleTextAppearance,
|
|
10683
|
+
color: settings.entryTitleColor ?? '#000000',
|
|
10684
|
+
}, isEditor),
|
|
10685
|
+
[settings, isEditor],
|
|
10686
|
+
);
|
|
10593
10687
|
|
|
10594
10688
|
const imageWrapperStyle: React.CSSProperties = {
|
|
10595
10689
|
width: imageWrapperWidth,
|
|
@@ -10774,7 +10868,7 @@ export function Hive({
|
|
|
10774
10868
|
isLastRow ? \`\${P}-item-inner-last-row\` : '',
|
|
10775
10869
|
].filter(Boolean).join(' ')}
|
|
10776
10870
|
style={{
|
|
10777
|
-
width:
|
|
10871
|
+
width: itemInnerWidth,
|
|
10778
10872
|
...(gridColumn ? { gridColumn } : {}),
|
|
10779
10873
|
}}
|
|
10780
10874
|
>
|
|
@@ -10785,7 +10879,20 @@ export function Hive({
|
|
|
10785
10879
|
{imageContent}
|
|
10786
10880
|
</a>
|
|
10787
10881
|
<div className={\`\${P}-item-subtitle-row\`}>
|
|
10788
|
-
|
|
10882
|
+
{showEntryText && item.title1?.trim() ? (
|
|
10883
|
+
<>
|
|
10884
|
+
<div
|
|
10885
|
+
data-controls={isEditMode ? 'textMarginTop' : undefined}
|
|
10886
|
+
className={isEditMode ? \`\${P}-control\` : undefined}
|
|
10887
|
+
style={{ height: scalingValue(textMarginTop, isEditor), width: textControlWidthStyle }}
|
|
10888
|
+
/>
|
|
10889
|
+
<p className={\`\${P}-item-text\`} style={{ ...entryTextStyle, width: textBoxWidthStyle }}>
|
|
10890
|
+
{item.title1}
|
|
10891
|
+
</p>
|
|
10892
|
+
</>
|
|
10893
|
+
) : (
|
|
10894
|
+
<div style={{ height: 0, width: controlWidthStyle }} />
|
|
10895
|
+
)}
|
|
10789
10896
|
</div>
|
|
10790
10897
|
</div>
|
|
10791
10898
|
</div>
|
|
@@ -32,6 +32,11 @@ export type Component = {
|
|
|
32
32
|
parameters: Path[];
|
|
33
33
|
};
|
|
34
34
|
normalizeLayoutSettingsUpdate?: (nextSettings: Record<string, any>, prevSettings: Record<string, any>, options?: any) => Record<string, any>;
|
|
35
|
+
/**
|
|
36
|
+
* Extra panel availability context derived from the component settings,
|
|
37
|
+
* matched against schema panels' `availableWhen`.
|
|
38
|
+
*/
|
|
39
|
+
getPanelAvailabilityContext?: (settings: Record<string, any>, layoutId?: string) => Record<string, string | undefined>;
|
|
35
40
|
};
|
|
36
41
|
type Path = {
|
|
37
42
|
path: string;
|