@se-studio/core-ui 1.19.10 → 1.21.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/CHANGELOG.md +18 -0
- package/dist/cmsRegistration.d.ts +16 -0
- package/dist/cmsRegistration.d.ts.map +1 -1
- package/dist/cmsRegistration.js +10 -0
- package/dist/cmsRegistration.js.map +1 -1
- package/dist/components/ClientMonitor.d.ts.map +1 -1
- package/dist/components/ClientMonitor.js +2 -0
- package/dist/components/ClientMonitor.js.map +1 -1
- package/dist/components/DotLottieAnimationComponent.d.ts +16 -0
- package/dist/components/DotLottieAnimationComponent.d.ts.map +1 -0
- package/dist/components/DotLottieAnimationComponent.js +88 -0
- package/dist/components/DotLottieAnimationComponent.js.map +1 -0
- package/dist/components/LazyAnimation.d.ts +11 -1
- package/dist/components/LazyAnimation.d.ts.map +1 -1
- package/dist/components/LazyAnimation.js +62 -18
- package/dist/components/LazyAnimation.js.map +1 -1
- package/dist/components/dotlottieWasm.d.ts +19 -0
- package/dist/components/dotlottieWasm.d.ts.map +1 -0
- package/dist/components/dotlottieWasm.js +62 -0
- package/dist/components/dotlottieWasm.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/route-handlers/createCmsTxtHandler.d.ts.map +1 -1
- package/dist/route-handlers/createCmsTxtHandler.js +4 -0
- package/dist/route-handlers/createCmsTxtHandler.js.map +1 -1
- package/dist/showcase/components/AllViewPanel.d.ts.map +1 -1
- package/dist/showcase/components/AllViewPanel.js +5 -2
- package/dist/showcase/components/AllViewPanel.js.map +1 -1
- package/dist/showcase/components/Controls.d.ts.map +1 -1
- package/dist/showcase/components/Controls.js +2 -5
- package/dist/showcase/components/Controls.js.map +1 -1
- package/dist/showcase/components/ControlsWrapper.d.ts +3 -1
- package/dist/showcase/components/ControlsWrapper.d.ts.map +1 -1
- package/dist/showcase/components/ControlsWrapper.js +2 -2
- package/dist/showcase/components/ControlsWrapper.js.map +1 -1
- package/dist/showcase/components/IframeHeightReporter.d.ts +6 -3
- package/dist/showcase/components/IframeHeightReporter.d.ts.map +1 -1
- package/dist/showcase/components/IframeHeightReporter.js +32 -5
- package/dist/showcase/components/IframeHeightReporter.js.map +1 -1
- package/dist/showcase/components/PreviewPanel.d.ts +6 -1
- package/dist/showcase/components/PreviewPanel.d.ts.map +1 -1
- package/dist/showcase/components/PreviewPanel.js +5 -3
- package/dist/showcase/components/PreviewPanel.js.map +1 -1
- package/dist/showcase/components/ScaledIframe.d.ts +12 -1
- package/dist/showcase/components/ScaledIframe.d.ts.map +1 -1
- package/dist/showcase/components/ScaledIframe.js +18 -11
- package/dist/showcase/components/ScaledIframe.js.map +1 -1
- package/dist/showcase/components/ShowcaseAllRenderPage.d.ts.map +1 -1
- package/dist/showcase/components/ShowcaseAllRenderPage.js +3 -2
- package/dist/showcase/components/ShowcaseAllRenderPage.js.map +1 -1
- package/dist/showcase/components/ShowcasePage.d.ts +6 -1
- package/dist/showcase/components/ShowcasePage.d.ts.map +1 -1
- package/dist/showcase/components/ShowcasePage.js +8 -2
- package/dist/showcase/components/ShowcasePage.js.map +1 -1
- package/dist/showcase/components/ShowcaseRenderPage.d.ts.map +1 -1
- package/dist/showcase/components/ShowcaseRenderPage.js +9 -8
- package/dist/showcase/components/ShowcaseRenderPage.js.map +1 -1
- package/dist/showcase/components/ShowcaseViewportGuard.d.ts +14 -0
- package/dist/showcase/components/ShowcaseViewportGuard.d.ts.map +1 -0
- package/dist/showcase/components/ShowcaseViewportGuard.js +77 -0
- package/dist/showcase/components/ShowcaseViewportGuard.js.map +1 -0
- package/dist/showcase/controlFieldSupport.d.ts +12 -0
- package/dist/showcase/controlFieldSupport.d.ts.map +1 -0
- package/dist/showcase/controlFieldSupport.js +35 -0
- package/dist/showcase/controlFieldSupport.js.map +1 -0
- package/dist/showcase/index.d.ts +7 -1
- package/dist/showcase/index.d.ts.map +1 -1
- package/dist/showcase/index.js +7 -1
- package/dist/showcase/index.js.map +1 -1
- package/dist/showcase/isCmsShowcase.d.ts +10 -0
- package/dist/showcase/isCmsShowcase.d.ts.map +1 -0
- package/dist/showcase/isCmsShowcase.js +12 -0
- package/dist/showcase/isCmsShowcase.js.map +1 -0
- package/dist/showcase/mockFactory.d.ts +3 -0
- package/dist/showcase/mockFactory.d.ts.map +1 -1
- package/dist/showcase/mockFactory.js +144 -27
- package/dist/showcase/mockFactory.js.map +1 -1
- package/dist/showcase/showcaseLayout.d.ts +17 -0
- package/dist/showcase/showcaseLayout.d.ts.map +1 -0
- package/dist/showcase/showcaseLayout.js +11 -0
- package/dist/showcase/showcaseLayout.js.map +1 -0
- package/dist/showcase/showcaseRelatedContent.d.ts +30 -0
- package/dist/showcase/showcaseRelatedContent.d.ts.map +1 -0
- package/dist/showcase/showcaseRelatedContent.js +106 -0
- package/dist/showcase/showcaseRelatedContent.js.map +1 -0
- package/package.json +7 -3
- package/src/showcase/README.md +130 -0
|
@@ -4,7 +4,7 @@ import { AllViewPanel } from './AllViewPanel';
|
|
|
4
4
|
import { ControlsWrapper } from './ControlsWrapper';
|
|
5
5
|
import { PreviewPanel } from './PreviewPanel';
|
|
6
6
|
import { TopBar } from './TopBar';
|
|
7
|
-
export const ShowcasePage = ({ searchParams, rendererConfig, componentFieldsMap, collectionFieldsMap, colorOptions, foregroundColors, basePath, defaultState, excludedComponents = [], excludedCollections = [], componentMockMap = {}, collectionMockMap = {}, }) => {
|
|
7
|
+
export const ShowcasePage = ({ searchParams, rendererConfig, componentFieldsMap, collectionFieldsMap, colorOptions, foregroundColors, basePath, defaultState, excludedComponents = [], excludedCollections = [], componentMockMap = {}, collectionMockMap = {}, componentShowcaseLayoutMap = {}, collectionShowcaseLayoutMap = {}, }) => {
|
|
8
8
|
const componentTypes = Object.keys(rendererConfig.componentMap)
|
|
9
9
|
.filter((type) => !excludedComponents.includes(type))
|
|
10
10
|
.sort();
|
|
@@ -16,10 +16,16 @@ export const ShowcasePage = ({ searchParams, rendererConfig, componentFieldsMap,
|
|
|
16
16
|
const view = (searchParams.view || 'single');
|
|
17
17
|
const isClean = searchParams.clean === 'true' ||
|
|
18
18
|
(Array.isArray(searchParams.clean) && searchParams.clean[0] === 'true');
|
|
19
|
+
const controlsOpen = searchParams.controls === 'true' ||
|
|
20
|
+
(Array.isArray(searchParams.controls) && searchParams.controls[0] === 'true');
|
|
21
|
+
const debug = searchParams.debug === 'true' ||
|
|
22
|
+
searchParams.debug === '1' ||
|
|
23
|
+
(Array.isArray(searchParams.debug) &&
|
|
24
|
+
(searchParams.debug[0] === 'true' || searchParams.debug[0] === '1'));
|
|
19
25
|
const mockDefaults = isClean
|
|
20
26
|
? defaultState
|
|
21
27
|
: getMergedShowcaseDefaultState(defaultState, type, mode, componentMockMap, collectionMockMap);
|
|
22
28
|
const controls = parseShowcaseControls(searchParams, mockDefaults);
|
|
23
|
-
return (_jsxs("div", { className: "flex flex-col h-screen bg-[#ffffff] overflow-hidden", children: [_jsx(TopBar, { componentTypes: componentTypes, collectionTypes: collectionTypes, selectedType: type, mode: mode, view: view }), _jsx("div", { className: "flex-1 flex overflow-hidden relative", children: view === 'all' ? (_jsx(AllViewPanel, { mode: mode, basePath: basePath })) : (_jsxs(_Fragment, { children: [_jsx(PreviewPanel, { type: type, mode: mode, controls: controls, mockDefaults: mockDefaults, basePath: basePath, clean: isClean }), _jsx(ControlsWrapper, { initialState: controls, type: type, mode: mode, colorOptions: colorOptions, foregroundColors: foregroundColors, componentFieldsMap: componentFieldsMap, collectionFieldsMap: collectionFieldsMap })] })) })] }));
|
|
29
|
+
return (_jsxs("div", { className: "flex flex-col h-screen bg-[#ffffff] overflow-hidden", children: [_jsx(TopBar, { componentTypes: componentTypes, collectionTypes: collectionTypes, selectedType: type, mode: mode, view: view }), _jsx("div", { className: "flex-1 flex overflow-hidden relative", children: view === 'all' ? (_jsx(AllViewPanel, { mode: mode, basePath: basePath })) : (_jsxs(_Fragment, { children: [_jsx(PreviewPanel, { type: type, mode: mode, controls: controls, mockDefaults: mockDefaults, basePath: basePath, clean: isClean, componentShowcaseLayoutMap: componentShowcaseLayoutMap, collectionShowcaseLayoutMap: collectionShowcaseLayoutMap, debug: debug }), _jsx(ControlsWrapper, { initialState: controls, type: type, mode: mode, colorOptions: colorOptions, foregroundColors: foregroundColors, componentFieldsMap: componentFieldsMap, collectionFieldsMap: collectionFieldsMap, initialOpen: controlsOpen })] })) })] }));
|
|
24
30
|
};
|
|
25
31
|
//# sourceMappingURL=ShowcasePage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShowcasePage.js","sourceRoot":"","sources":["../../../src/showcase/components/ShowcasePage.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ShowcasePage.js","sourceRoot":"","sources":["../../../src/showcase/components/ShowcasePage.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGtF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAqB,MAAM,EAAE,MAAM,UAAU,CAAC;AAqBrD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,kBAAkB,GAAG,EAAE,EACvB,mBAAmB,GAAG,EAAE,EACxB,gBAAgB,GAAG,EAAE,EACrB,iBAAiB,GAAG,EAAE,EACtB,0BAA0B,GAAG,EAAE,EAC/B,2BAA2B,GAAG,EAAE,GACd,EAAE,EAAE;IACtB,MAAM,cAA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../src/showcase/components/ShowcaseRenderPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAQtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"ShowcaseRenderPage.d.ts","sourceRoot":"","sources":["../../../src/showcase/components/ShowcaseRenderPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAQtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAMrD,UAAU,uBAAuB;IAC/B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IAC5D,cAAc,EAAE,iBAAiB,CAAC;IAClC,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAChD,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACjD,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACrD,YAAY,EAAE,oBAAoB,CAAC;IACnC,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC5C,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC7C,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,EAAE,CAAC,CAAC;IAC9D,kGAAkG;IAClG,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAQD,eAAO,MAAM,kBAAkB,GAAI,yMAYhC,uBAAuB,gCA6EzB,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CmsCollection } from '../../components/CmsCollection';
|
|
3
3
|
import { CmsComponent } from '../../components/CmsComponent';
|
|
4
4
|
import { createMockShowcaseData, getMergedShowcaseDefaultState, parseShowcaseControls, } from '../mockFactory';
|
|
5
5
|
import { SHOWCASE_CONTROL_KEYS } from '../types';
|
|
6
6
|
import { IframeHeightReporter } from './IframeHeightReporter';
|
|
7
7
|
import { ShowcaseAnimationRoot } from './ShowcaseAnimationRoot';
|
|
8
|
+
import { ShowcaseViewportGuard } from './ShowcaseViewportGuard';
|
|
8
9
|
const DEFAULT_MOCK_CONTEXT = {
|
|
9
10
|
current: { type: 'Page', id: 'mock-page' },
|
|
10
11
|
pageContext: {},
|
|
@@ -31,14 +32,14 @@ export const ShowcaseRenderPage = ({ searchParams, rendererConfig, componentFiel
|
|
|
31
32
|
if (!mockData) {
|
|
32
33
|
return _jsx("div", { className: "p-4 text-red-500 text-sm", children: "No component selected" });
|
|
33
34
|
}
|
|
34
|
-
return (_jsxs(ShowcaseAnimationRoot, { children: [mode === 'component' ? (_jsx(CmsComponent
|
|
35
|
-
// biome-ignore lint/suspicious/noExplicitAny: Any is allowed
|
|
36
|
-
, {
|
|
35
|
+
return (_jsxs(ShowcaseAnimationRoot, { children: [_jsx("div", { id: "showcase-measure-root", className: "showcase-render", children: mode === 'component' ? (_jsx(CmsComponent
|
|
37
36
|
// biome-ignore lint/suspicious/noExplicitAny: Any is allowed
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
, {
|
|
38
|
+
// biome-ignore lint/suspicious/noExplicitAny: Any is allowed
|
|
39
|
+
information: mockData, rendererConfig: rendererConfig, contentContext: contentContext })) : (_jsx(CmsCollection
|
|
41
40
|
// biome-ignore lint/suspicious/noExplicitAny: Any is allowed
|
|
42
|
-
|
|
41
|
+
, {
|
|
42
|
+
// biome-ignore lint/suspicious/noExplicitAny: Any is allowed
|
|
43
|
+
information: mockData, rendererConfig: rendererConfig, contentContext: contentContext })) }), !isEmbedded && (_jsxs(_Fragment, { children: [_jsx(ShowcaseViewportGuard, {}), _jsx(IframeHeightReporter, {})] }))] }));
|
|
43
44
|
};
|
|
44
45
|
//# sourceMappingURL=ShowcaseRenderPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShowcaseRenderPage.js","sourceRoot":"","sources":["../../../src/showcase/components/ShowcaseRenderPage.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAiBhE,MAAM,oBAAoB,GAAoB;IAC5C,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE;IAC1C,WAAW,EAAE,EAAE;IACf,gBAAgB,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;CAC3C,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,m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AC,sBAAsB,CACpB,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,QAAQ,CAAC,gBAAgB,EACzB,QAAQ,CAAC,iBAAiB,EAC1B,QAAQ,CAAC,qBAAqB,EAC9B,mBAAmB,CACpB;QACH,CAAC,CAAC,IAAI,CAAC;IAET,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,cAAK,SAAS,EAAC,0BAA0B,sCAA4B,CAAC;IAC/E,CAAC;IAED,OAAO,CACL,MAAC,qBAAqB,eACpB,cAAK,EAAE,EAAC,uBAAuB,EAAC,SAAS,EAAC,iBAAiB,YACxD,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,CACtB,KAAC,YAAY;gBACX,6DAA6D;;oBAA7D,6DAA6D;oBAC7D,WAAW,EAAE,QAAe,EAC5B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC,CAAC,CAAC,CACF,KAAC,aAAa;gBACZ,6DAA6D;;oBAA7D,6DAA6D;oBAC7D,WAAW,EAAE,QAAe,EAC5B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,GAC9B,CACH,GACG,EACL,CAAC,UAAU,IAAI,CACd,8BACE,KAAC,qBAAqB,KAAG,EACzB,KAAC,oBAAoB,KAAG,IACvB,CACJ,IACqB,CACzB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Max height for viewport-unit heroes inside the showcase iframe (px). */
|
|
2
|
+
export declare const SHOWCASE_VIEWPORT_MAX_PX = 720;
|
|
3
|
+
/**
|
|
4
|
+
* Caps elements that use viewport height units so showcase iframes cannot
|
|
5
|
+
* grow unboundedly (svh feedback loop with height reporter).
|
|
6
|
+
* Production pages are unaffected — this only mounts inside showcase render routes.
|
|
7
|
+
*
|
|
8
|
+
* Prefer registration `showcaseLayout` + in-component `isCmsShowcase()` compact
|
|
9
|
+
* layouts; this is a safety net for residual *svh CSS.
|
|
10
|
+
*/
|
|
11
|
+
export declare function ShowcaseViewportGuard({ maxPx }: {
|
|
12
|
+
maxPx?: number;
|
|
13
|
+
}): null;
|
|
14
|
+
//# sourceMappingURL=ShowcaseViewportGuard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShowcaseViewportGuard.d.ts","sourceRoot":"","sources":["../../../src/showcase/components/ShowcaseViewportGuard.tsx"],"names":[],"mappings":"AAIA,2EAA2E;AAC3E,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAM5C;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,KAAgC,EAAE,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,QAsE7F"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
/** Max height for viewport-unit heroes inside the showcase iframe (px). */
|
|
4
|
+
export const SHOWCASE_VIEWPORT_MAX_PX = 720;
|
|
5
|
+
const VIEWPORT_CLASS_RE = /(?:min-h|h)-(?:screen|svh|dvh|lvh|\[(?:\d+(?:\.\d+)?(?:vh|svh|dvh|lvh)|[^[\]]*(?:vh|svh|dvh|lvh)[^[\]]*)\])/;
|
|
6
|
+
const VIEWPORT_STYLE_RE = /(?:\d+(?:\.\d+)?)?(?:vh|svh|dvh|lvh)|100vh|100svh|200svh/;
|
|
7
|
+
/**
|
|
8
|
+
* Caps elements that use viewport height units so showcase iframes cannot
|
|
9
|
+
* grow unboundedly (svh feedback loop with height reporter).
|
|
10
|
+
* Production pages are unaffected — this only mounts inside showcase render routes.
|
|
11
|
+
*
|
|
12
|
+
* Prefer registration `showcaseLayout` + in-component `isCmsShowcase()` compact
|
|
13
|
+
* layouts; this is a safety net for residual *svh CSS.
|
|
14
|
+
*/
|
|
15
|
+
export function ShowcaseViewportGuard({ maxPx = SHOWCASE_VIEWPORT_MAX_PX }) {
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
document.documentElement.classList.add('showcase-iframe');
|
|
18
|
+
let raf = 0;
|
|
19
|
+
let scheduled = false;
|
|
20
|
+
const capElement = (el) => {
|
|
21
|
+
const style = el.getAttribute('style') || '';
|
|
22
|
+
const className = el.className?.toString?.() || '';
|
|
23
|
+
const styleMatch = VIEWPORT_STYLE_RE.test(style);
|
|
24
|
+
const classMatch = VIEWPORT_CLASS_RE.test(className);
|
|
25
|
+
if (!(styleMatch || classMatch)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
// Prefer max-height so flex/sticky layouts still paint content.
|
|
29
|
+
el.style.maxHeight = `${maxPx}px`;
|
|
30
|
+
if (styleMatch && /height\s*:/.test(style)) {
|
|
31
|
+
// Collapse scroll-sentinel budgets (e.g. calc(100svh + 60svh)).
|
|
32
|
+
el.style.height = `${maxPx}px`;
|
|
33
|
+
}
|
|
34
|
+
if (classMatch && !styleMatch) {
|
|
35
|
+
el.style.minHeight = '0';
|
|
36
|
+
if (/(?:^|\s)(?:min-h|h)-(?:screen|svh|dvh)/.test(className) ||
|
|
37
|
+
className.includes('70vh') ||
|
|
38
|
+
className.includes('70svh') ||
|
|
39
|
+
className.includes('100svh')) {
|
|
40
|
+
el.style.height = `${maxPx}px`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const scan = () => {
|
|
45
|
+
scheduled = false;
|
|
46
|
+
const all = document.body?.querySelectorAll('*') ?? [];
|
|
47
|
+
for (const node of all) {
|
|
48
|
+
if (node instanceof HTMLElement) {
|
|
49
|
+
capElement(node);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const scheduleScan = () => {
|
|
54
|
+
if (scheduled)
|
|
55
|
+
return;
|
|
56
|
+
scheduled = true;
|
|
57
|
+
raf = window.requestAnimationFrame(scan);
|
|
58
|
+
};
|
|
59
|
+
scan();
|
|
60
|
+
const observer = new MutationObserver(scheduleScan);
|
|
61
|
+
if (document.body) {
|
|
62
|
+
observer.observe(document.body, {
|
|
63
|
+
childList: true,
|
|
64
|
+
subtree: true,
|
|
65
|
+
attributes: true,
|
|
66
|
+
attributeFilter: ['class', 'style'],
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return () => {
|
|
70
|
+
window.cancelAnimationFrame(raf);
|
|
71
|
+
observer.disconnect();
|
|
72
|
+
document.documentElement.classList.remove('showcase-iframe');
|
|
73
|
+
};
|
|
74
|
+
}, [maxPx]);
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=ShowcaseViewportGuard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShowcaseViewportGuard.js","sourceRoot":"","sources":["../../../src/showcase/components/ShowcaseViewportGuard.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,2EAA2E;AAC3E,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAE5C,MAAM,iBAAiB,GACrB,6GAA6G,CAAC;AAChH,MAAM,iBAAiB,GAAG,0DAA0D,CAAC;AAErF;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,EAAE,KAAK,GAAG,wBAAwB,EAAsB;IAC5F,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,CAAC,eAAe,CAAC,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAE1D,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,IAAI,SAAS,GAAG,KAAK,CAAC;QAEtB,MAAM,UAAU,GAAG,CAAC,EAAe,EAAE,EAAE;YACrC,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAC7C,MAAM,SAAS,GAAG,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC;YACnD,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G,EAAE;YACxB,IAAI,SAAS;gBAAE,OAAO;YACtB,SAAS,GAAG,IAAI,CAAC;YACjB,GAAG,GAAG,MAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC,CAAC;QAEF,IAAI,EAAE,CAAC;QAEP,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,YAAY,CAAC,CAAC;QACpD,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;YAClB,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE;gBAC9B,SAAS,EAAE,IAAI;gBACf,OAAO,EAAE,IAAI;gBACb,UAAU,EAAE,IAAI;gBAChB,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;aACpC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC;YACjC,QAAQ,CAAC,UAAU,EAAE,CAAC;YACtB,QAAQ,CAAC,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAC/D,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ShowcaseControlState } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Maps showcase control keys to CMS usedFields names.
|
|
4
|
+
* Controls use synthetic keys like `showVisual`; registrations list `visual`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const CONTROL_TO_CMS_FIELDS: Record<keyof ShowcaseControlState, readonly string[]>;
|
|
7
|
+
/**
|
|
8
|
+
* Whether a showcase control is supported for the given CMS type's usedFields.
|
|
9
|
+
* Falls back to supported when the type has no fields map entry.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isControlFieldSupported(field: keyof ShowcaseControlState, usedFields: Set<string> | undefined): boolean;
|
|
12
|
+
//# sourceMappingURL=controlFieldSupport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controlFieldSupport.d.ts","sourceRoot":"","sources":["../../src/showcase/controlFieldSupport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAAE,CAevF,CAAC;AAEF;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,oBAAoB,EACjC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,GAClC,OAAO,CAST"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps showcase control keys to CMS usedFields names.
|
|
3
|
+
* Controls use synthetic keys like `showVisual`; registrations list `visual`.
|
|
4
|
+
*/
|
|
5
|
+
export const CONTROL_TO_CMS_FIELDS = {
|
|
6
|
+
showHeading: ['heading'],
|
|
7
|
+
heading: ['heading'],
|
|
8
|
+
preHeading: ['preHeading'],
|
|
9
|
+
postHeading: ['postHeading'],
|
|
10
|
+
body: ['body'],
|
|
11
|
+
additionalCopy: ['additionalCopy'],
|
|
12
|
+
showVisual: ['visual', 'backgroundVisual'],
|
|
13
|
+
showMobileVisual: ['visual', 'backgroundVisual', 'mobileVisual'],
|
|
14
|
+
backgroundColour: ['backgroundColour'],
|
|
15
|
+
textColour: ['textColour'],
|
|
16
|
+
textSize: ['textSize'],
|
|
17
|
+
showLinks: ['links'],
|
|
18
|
+
numberOfLinks: ['links'],
|
|
19
|
+
cmsLabel: ['cmsLabel'],
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Whether a showcase control is supported for the given CMS type's usedFields.
|
|
23
|
+
* Falls back to supported when the type has no fields map entry.
|
|
24
|
+
*/
|
|
25
|
+
export function isControlFieldSupported(field, usedFields) {
|
|
26
|
+
if (!usedFields) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
const cmsFields = CONTROL_TO_CMS_FIELDS[field];
|
|
30
|
+
if (!cmsFields || cmsFields.length === 0) {
|
|
31
|
+
return usedFields.has(field);
|
|
32
|
+
}
|
|
33
|
+
return cmsFields.some((name) => usedFields.has(name));
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=controlFieldSupport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controlFieldSupport.js","sourceRoot":"","sources":["../../src/showcase/controlFieldSupport.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA0D;IAC1F,WAAW,EAAE,CAAC,SAAS,CAAC;IACxB,OAAO,EAAE,CAAC,SAAS,CAAC;IACpB,UAAU,EAAE,CAAC,YAAY,CAAC;IAC1B,WAAW,EAAE,CAAC,aAAa,CAAC;IAC5B,IAAI,EAAE,CAAC,MAAM,CAAC;IACd,cAAc,EAAE,CAAC,gBAAgB,CAAC;IAClC,UAAU,EAAE,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IAC1C,gBAAgB,EAAE,CAAC,QAAQ,EAAE,kBAAkB,EAAE,cAAc,CAAC;IAChE,gBAAgB,EAAE,CAAC,kBAAkB,CAAC;IACtC,UAAU,EAAE,CAAC,YAAY,CAAC;IAC1B,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,SAAS,EAAE,CAAC,OAAO,CAAC;IACpB,aAAa,EAAE,CAAC,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,UAAU,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAAiC,EACjC,UAAmC;IAEnC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,SAAS,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAC/C,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzC,OAAO,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AACxD,CAAC"}
|
package/dist/showcase/index.d.ts
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
export { AllViewPanel } from './components/AllViewPanel';
|
|
2
2
|
export { Controls } from './components/Controls';
|
|
3
3
|
export { ControlsWrapper } from './components/ControlsWrapper';
|
|
4
|
+
export { IframeHeightReporter } from './components/IframeHeightReporter';
|
|
4
5
|
export { PreviewPanel } from './components/PreviewPanel';
|
|
5
|
-
export { ScaledIframe } from './components/ScaledIframe';
|
|
6
|
+
export { ScaledIframe, SHOWCASE_SINGLE_IFRAME_MAX_HEIGHT, } from './components/ScaledIframe';
|
|
6
7
|
export { ShowcaseAllRenderPage } from './components/ShowcaseAllRenderPage';
|
|
7
8
|
export { ShowcaseAnimationRoot } from './components/ShowcaseAnimationRoot';
|
|
8
9
|
export { ShowcasePage } from './components/ShowcasePage';
|
|
9
10
|
export { ShowcaseRenderPage } from './components/ShowcaseRenderPage';
|
|
11
|
+
export { SHOWCASE_VIEWPORT_MAX_PX, ShowcaseViewportGuard, } from './components/ShowcaseViewportGuard';
|
|
10
12
|
export { type ShowcaseView, TopBar } from './components/TopBar';
|
|
13
|
+
export * from './controlFieldSupport';
|
|
14
|
+
export { isCmsShowcase, SHOWCASE_ANALYTICS_SLUG_PREFIX, } from './isCmsShowcase';
|
|
11
15
|
export * from './mergeShowcaseMocks';
|
|
12
16
|
export * from './mockFactory';
|
|
17
|
+
export { resolveShowcaseLayout, SHOWCASE_LAYOUT_FIXED_HEIGHT, type ShowcaseLayoutMode, } from './showcaseLayout';
|
|
18
|
+
export { articlesFromShowcaseContents, peopleFromShowcaseContents, visualFromShowcaseMockDims, } from './showcaseRelatedContent';
|
|
13
19
|
export * from './types';
|
|
14
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/showcase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/showcase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,YAAY,EACZ,iCAAiC,GAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EACL,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAChE,cAAc,uBAAuB,CAAC;AACtC,OAAO,EACL,aAAa,EACb,8BAA8B,GAC/B,MAAM,iBAAiB,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,KAAK,kBAAkB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAClC,cAAc,SAAS,CAAC"}
|
package/dist/showcase/index.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
export { AllViewPanel } from './components/AllViewPanel';
|
|
2
2
|
export { Controls } from './components/Controls';
|
|
3
3
|
export { ControlsWrapper } from './components/ControlsWrapper';
|
|
4
|
+
export { IframeHeightReporter } from './components/IframeHeightReporter';
|
|
4
5
|
export { PreviewPanel } from './components/PreviewPanel';
|
|
5
|
-
export { ScaledIframe } from './components/ScaledIframe';
|
|
6
|
+
export { ScaledIframe, SHOWCASE_SINGLE_IFRAME_MAX_HEIGHT, } from './components/ScaledIframe';
|
|
6
7
|
export { ShowcaseAllRenderPage } from './components/ShowcaseAllRenderPage';
|
|
7
8
|
export { ShowcaseAnimationRoot } from './components/ShowcaseAnimationRoot';
|
|
8
9
|
export { ShowcasePage } from './components/ShowcasePage';
|
|
9
10
|
export { ShowcaseRenderPage } from './components/ShowcaseRenderPage';
|
|
11
|
+
export { SHOWCASE_VIEWPORT_MAX_PX, ShowcaseViewportGuard, } from './components/ShowcaseViewportGuard';
|
|
10
12
|
export { TopBar } from './components/TopBar';
|
|
13
|
+
export * from './controlFieldSupport';
|
|
14
|
+
export { isCmsShowcase, SHOWCASE_ANALYTICS_SLUG_PREFIX, } from './isCmsShowcase';
|
|
11
15
|
export * from './mergeShowcaseMocks';
|
|
12
16
|
export * from './mockFactory';
|
|
17
|
+
export { resolveShowcaseLayout, SHOWCASE_LAYOUT_FIXED_HEIGHT, } from './showcaseLayout';
|
|
18
|
+
export { articlesFromShowcaseContents, peopleFromShowcaseContents, visualFromShowcaseMockDims, } from './showcaseRelatedContent';
|
|
13
19
|
export * from './types';
|
|
14
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/showcase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/showcase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,YAAY,EACZ,iCAAiC,GAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EACL,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAqB,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAChE,cAAc,uBAAuB,CAAC;AACtC,OAAO,EACL,aAAa,EACb,8BAA8B,GAC/B,MAAM,iBAAiB,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,OAAO,EACL,qBAAqB,EACrB,4BAA4B,GAE7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAClC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IContentContext } from '@se-studio/core-data-types';
|
|
2
|
+
/** Analytics slug prefix set by ShowcaseRenderPage / ShowcaseAllRenderPage. */
|
|
3
|
+
export declare const SHOWCASE_ANALYTICS_SLUG_PREFIX = "cms-showcase";
|
|
4
|
+
/**
|
|
5
|
+
* True when rendering inside CMS showcase iframes (`/cms/showcase/render` etc.).
|
|
6
|
+
* Use this to swap viewport/scroll-theatre layouts for compact static previews
|
|
7
|
+
* without affecting production marketing pages.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isCmsShowcase(contentContext?: IContentContext | null): boolean;
|
|
10
|
+
//# sourceMappingURL=isCmsShowcase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isCmsShowcase.d.ts","sourceRoot":"","sources":["../../src/showcase/isCmsShowcase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,+EAA+E;AAC/E,eAAO,MAAM,8BAA8B,iBAAiB,CAAC;AAE7D;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,cAAc,CAAC,EAAE,eAAe,GAAG,IAAI,GAAG,OAAO,CAG9E"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Analytics slug prefix set by ShowcaseRenderPage / ShowcaseAllRenderPage. */
|
|
2
|
+
export const SHOWCASE_ANALYTICS_SLUG_PREFIX = 'cms-showcase';
|
|
3
|
+
/**
|
|
4
|
+
* True when rendering inside CMS showcase iframes (`/cms/showcase/render` etc.).
|
|
5
|
+
* Use this to swap viewport/scroll-theatre layouts for compact static previews
|
|
6
|
+
* without affecting production marketing pages.
|
|
7
|
+
*/
|
|
8
|
+
export function isCmsShowcase(contentContext) {
|
|
9
|
+
const slug = contentContext?.analyticsContext?.slug;
|
|
10
|
+
return typeof slug === 'string' && slug.startsWith(SHOWCASE_ANALYTICS_SLUG_PREFIX);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=isCmsShowcase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isCmsShowcase.js","sourceRoot":"","sources":["../../src/showcase/isCmsShowcase.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,MAAM,CAAC,MAAM,8BAA8B,GAAG,cAAc,CAAC;AAE7D;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,cAAuC;IACnE,MAAM,IAAI,GAAG,cAAc,EAAE,gBAAgB,EAAE,IAAI,CAAC;IACpD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC;AACrF,CAAC"}
|
|
@@ -10,9 +10,12 @@ import type { ShowcaseControlState } from './types';
|
|
|
10
10
|
* - Bullet lists (- item or * item)
|
|
11
11
|
*/
|
|
12
12
|
export declare function createRichTextFromMarkdown(text: string): IContentfulRichText;
|
|
13
|
+
/** True when a mock URL is a video page (must not become next/image Picture src). */
|
|
14
|
+
export declare function isExternalVideoPageUrl(url: string | undefined | null): boolean;
|
|
13
15
|
/**
|
|
14
16
|
* Creates a valid Visual object.
|
|
15
17
|
* - When `lottieUrl` is provided the visual wraps an IAnimation.
|
|
18
|
+
* - When `url` is a Vimeo/YouTube page, wraps an External video (not Picture).
|
|
16
19
|
* - When `url` is provided it is used as the image src.
|
|
17
20
|
* - Otherwise a placehold.co placeholder is generated from the dimensions.
|
|
18
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockFactory.d.ts","sourceRoot":"","sources":["../../src/showcase/mockFactory.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AACx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,CAAC,CAAC,EAChD,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,EACpD,gBAAgB,GAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAM,EAC/C,iBAAiB,GAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAM,EAChD,qBAAqB,GAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,EAAE,CAAM,EACjE,mBAAmB,GAAE,WAAW,CAAC,MAAM,CAAa,GACnD,oBAAoB,GAAG,qBAAqB,CAiM9C"}
|
|
@@ -109,25 +109,121 @@ export function createRichTextFromMarkdown(text) {
|
|
|
109
109
|
json: document,
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
+
/** True when a mock URL is a video page (must not become next/image Picture src). */
|
|
113
|
+
export function isExternalVideoPageUrl(url) {
|
|
114
|
+
if (!url)
|
|
115
|
+
return false;
|
|
116
|
+
try {
|
|
117
|
+
const host = new URL(url).hostname.replace(/^www\./, '');
|
|
118
|
+
return (host === 'vimeo.com' ||
|
|
119
|
+
host === 'player.vimeo.com' ||
|
|
120
|
+
host === 'youtu.be' ||
|
|
121
|
+
host === 'youtube.com' ||
|
|
122
|
+
host === 'youtube-nocookie.com' ||
|
|
123
|
+
host.endsWith('.youtube.com') ||
|
|
124
|
+
host.endsWith('.youtube-nocookie.com'));
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function buildExternalVideoEmbedHtml(url) {
|
|
131
|
+
const width = 1280;
|
|
132
|
+
const height = 720;
|
|
133
|
+
try {
|
|
134
|
+
const u = new URL(url);
|
|
135
|
+
const host = u.hostname.replace(/^www\./, '');
|
|
136
|
+
if (host === 'vimeo.com' || host === 'player.vimeo.com') {
|
|
137
|
+
const id = u.pathname.split('/').filter(Boolean).pop() ?? '';
|
|
138
|
+
const src = `https://player.vimeo.com/video/${id}`;
|
|
139
|
+
return {
|
|
140
|
+
width,
|
|
141
|
+
height,
|
|
142
|
+
html: `<iframe src="${src}" width="${width}" height="${height}" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen title="Showcase video"></iframe>`,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
if (host === 'youtu.be') {
|
|
146
|
+
const id = u.pathname.replace(/^\//, '');
|
|
147
|
+
const src = `https://www.youtube.com/embed/${id}`;
|
|
148
|
+
return {
|
|
149
|
+
width,
|
|
150
|
+
height,
|
|
151
|
+
html: `<iframe src="${src}" width="${width}" height="${height}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen title="Showcase video"></iframe>`,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
if (host === 'youtube.com' ||
|
|
155
|
+
host.endsWith('.youtube.com') ||
|
|
156
|
+
host.endsWith('.youtube-nocookie.com')) {
|
|
157
|
+
const id = u.searchParams.get('v') ?? u.pathname.split('/').filter(Boolean).pop() ?? '';
|
|
158
|
+
const src = `https://www.youtube.com/embed/${id}`;
|
|
159
|
+
return {
|
|
160
|
+
width,
|
|
161
|
+
height,
|
|
162
|
+
html: `<iframe src="${src}" width="${width}" height="${height}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen title="Showcase video"></iframe>`,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
// fall through
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
width,
|
|
171
|
+
height,
|
|
172
|
+
html: `<iframe src="${url}" width="${width}" height="${height}" frameborder="0" allowfullscreen title="Showcase video"></iframe>`,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
112
175
|
/**
|
|
113
176
|
* Creates a valid Visual object.
|
|
114
177
|
* - When `lottieUrl` is provided the visual wraps an IAnimation.
|
|
178
|
+
* - When `url` is a Vimeo/YouTube page, wraps an External video (not Picture).
|
|
115
179
|
* - When `url` is provided it is used as the image src.
|
|
116
180
|
* - Otherwise a placehold.co placeholder is generated from the dimensions.
|
|
117
181
|
*/
|
|
118
182
|
export function createVisual(id, width, height, url, lottieUrl, widthPercent) {
|
|
119
183
|
if (lottieUrl) {
|
|
184
|
+
const format = lottieUrl.toLowerCase().endsWith('.lottie') ? 'dotlottie' : 'lottie-json';
|
|
120
185
|
const animation = {
|
|
121
186
|
type: 'Animation',
|
|
122
187
|
id: `animation-${id}`,
|
|
123
188
|
name: 'Sample Animation',
|
|
189
|
+
format,
|
|
124
190
|
animationSrc: lottieUrl,
|
|
125
191
|
loop: true,
|
|
126
192
|
autoPlay: true,
|
|
127
193
|
...(widthPercent != null && { widthPercent }),
|
|
194
|
+
...(width > 0 && height > 0
|
|
195
|
+
? {
|
|
196
|
+
optimised: {
|
|
197
|
+
width,
|
|
198
|
+
height,
|
|
199
|
+
data: `<svg width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" xmlns="http://www.w3.org/2000/svg"></svg>`,
|
|
200
|
+
},
|
|
201
|
+
}
|
|
202
|
+
: {}),
|
|
128
203
|
};
|
|
129
204
|
return { type: 'Visual', id: `visual-${id}`, animation };
|
|
130
205
|
}
|
|
206
|
+
if (url && isExternalVideoPageUrl(url)) {
|
|
207
|
+
const embed = buildExternalVideoEmbedHtml(url);
|
|
208
|
+
return {
|
|
209
|
+
type: 'Visual',
|
|
210
|
+
id: `visual-${id}`,
|
|
211
|
+
video: {
|
|
212
|
+
type: 'External video',
|
|
213
|
+
id: `video-${id}`,
|
|
214
|
+
name: 'Sample external video',
|
|
215
|
+
external: url,
|
|
216
|
+
width: embed.width,
|
|
217
|
+
height: embed.height,
|
|
218
|
+
embed: {
|
|
219
|
+
html: embed.html,
|
|
220
|
+
width: embed.width,
|
|
221
|
+
height: embed.height,
|
|
222
|
+
},
|
|
223
|
+
...(widthPercent != null && { widthPercent }),
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
}
|
|
131
227
|
return {
|
|
132
228
|
type: 'Visual',
|
|
133
229
|
id: `visual-${id}`,
|
|
@@ -165,6 +261,14 @@ export function createResponsiveVisual(showVisual, showMobile, width = 800, heig
|
|
|
165
261
|
hideMobileVisual: !showMobile,
|
|
166
262
|
};
|
|
167
263
|
}
|
|
264
|
+
// External video pages: single video visual (no mobile duplicate needed for showcase).
|
|
265
|
+
if (url && isExternalVideoPageUrl(url)) {
|
|
266
|
+
return {
|
|
267
|
+
visual: createVisual('desktop', width, height, url, undefined, widthPercent),
|
|
268
|
+
hideVisual: false,
|
|
269
|
+
hideMobileVisual: true,
|
|
270
|
+
};
|
|
271
|
+
}
|
|
168
272
|
// Calculate mobile dimensions maintaining roughly the same aspect ratio, but max width 400
|
|
169
273
|
const aspectRatio = height > 0 ? width / height : 4 / 3;
|
|
170
274
|
const mobileWidth = 400;
|
|
@@ -408,16 +512,18 @@ export function createMockCardContent(collectionType, index, controls, collectio
|
|
|
408
512
|
// We can't automatically know if custom fields are rich text or not without schema.
|
|
409
513
|
return [key, val];
|
|
410
514
|
})),
|
|
411
|
-
//
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
515
|
+
// Prefer curated visual dims; otherwise placeholder when showVisual (default).
|
|
516
|
+
visual: (() => {
|
|
517
|
+
if (visualDims) {
|
|
518
|
+
return createResponsiveVisual(true, true, visualDims.width, visualDims.height, visualDims.url, visualDims.lottieUrl, visualDims.widthPercent);
|
|
519
|
+
}
|
|
520
|
+
if (!controls.showVisual && isCurated) {
|
|
521
|
+
return undefined;
|
|
522
|
+
}
|
|
523
|
+
return createResponsiveVisual(isCurated ? true : controls.showVisual, controls.showMobileVisual);
|
|
524
|
+
})(),
|
|
525
|
+
// Placeholder icon when no real visual dims (filtered out if unused).
|
|
526
|
+
icon: visualDims ? undefined : createVisual(`icon-${index}`, 64, 64),
|
|
421
527
|
// Curated: use the mock's colors (null = component picks its own default).
|
|
422
528
|
// Generic: use the showcase control colors.
|
|
423
529
|
backgroundColour: isCurated
|
|
@@ -502,18 +608,22 @@ export function createMockShowcaseData(type, mode, controls, componentFieldsMap,
|
|
|
502
608
|
: controls.postHeading || null,
|
|
503
609
|
body: providedControlKeys.has('body')
|
|
504
610
|
? toRichText(controls.body)
|
|
505
|
-
:
|
|
506
|
-
?
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
611
|
+
: isMockRichText(mockFields['body'])
|
|
612
|
+
? mockFields['body']
|
|
613
|
+
: typeof mockFields['body'] === 'string'
|
|
614
|
+
? toRichText(mockFields['body'])
|
|
615
|
+
: isCurated
|
|
616
|
+
? null
|
|
617
|
+
: toRichText(controls.body),
|
|
510
618
|
additionalCopy: providedControlKeys.has('additionalCopy')
|
|
511
619
|
? toRichText(controls.additionalCopy)
|
|
512
|
-
:
|
|
513
|
-
?
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
620
|
+
: isMockRichText(mockFields['additionalCopy'])
|
|
621
|
+
? mockFields['additionalCopy']
|
|
622
|
+
: typeof mockFields['additionalCopy'] === 'string'
|
|
623
|
+
? toRichText(mockFields['additionalCopy'])
|
|
624
|
+
: isCurated
|
|
625
|
+
? null
|
|
626
|
+
: toRichText(controls.additionalCopy),
|
|
517
627
|
// Spread other mock fields that are NOT standard controls
|
|
518
628
|
// (Standard controls like heading/body are passed via `controls` object,
|
|
519
629
|
// so we don't need to spread them again, but we do need custom fields)
|
|
@@ -533,13 +643,20 @@ export function createMockShowcaseData(type, mode, controls, componentFieldsMap,
|
|
|
533
643
|
otherMedia: isMockOtherMediaArray(mockFields['otherMedia'])
|
|
534
644
|
? mockOtherMediaToVisuals(mockFields['otherMedia'])
|
|
535
645
|
: undefined,
|
|
536
|
-
visual
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
:
|
|
646
|
+
// Prefer curated visual dimensions/URL when present. Otherwise generate a
|
|
647
|
+
// placehold.co placeholder when showVisual is true (default). usedFields
|
|
648
|
+
// filter drops `visual` when the type does not use it.
|
|
649
|
+
visual: (() => {
|
|
650
|
+
const show = providedControlKeys.has('showVisual')
|
|
651
|
+
? controls.showVisual
|
|
652
|
+
: visualDims
|
|
653
|
+
? true
|
|
654
|
+
: controls.showVisual;
|
|
655
|
+
if (!show) {
|
|
656
|
+
return undefined;
|
|
657
|
+
}
|
|
658
|
+
return createResponsiveVisual(true, controls.showMobileVisual || Boolean(visualDims?.url), visualDims?.width, visualDims?.height, visualDims?.url, visualDims?.lottieUrl, visualDims?.widthPercent);
|
|
659
|
+
})(),
|
|
543
660
|
backgroundColour: providedControlKeys.has('backgroundColour')
|
|
544
661
|
? controls.backgroundColour
|
|
545
662
|
: isCurated
|