@se-studio/core-ui 1.0.14 → 1.0.15
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/README.md +33 -14
- package/dist/CmsRendererConfig.d.ts +122 -0
- package/dist/CmsRendererConfig.d.ts.map +1 -1
- package/dist/analytics/AnalyticsProvider.d.ts +7 -0
- package/dist/analytics/AnalyticsProvider.d.ts.map +1 -1
- package/dist/analytics/AnalyticsProvider.js +7 -0
- package/dist/analytics/AnalyticsProvider.js.map +1 -1
- package/dist/analytics/adapters/ConsoleAnalyticsAdapter.d.ts +4 -0
- package/dist/analytics/adapters/ConsoleAnalyticsAdapter.d.ts.map +1 -1
- package/dist/analytics/adapters/ConsoleAnalyticsAdapter.js +5 -0
- package/dist/analytics/adapters/ConsoleAnalyticsAdapter.js.map +1 -1
- package/dist/analytics/types.d.ts +23 -0
- package/dist/analytics/types.d.ts.map +1 -1
- package/dist/analytics/useAnalytics.d.ts +35 -0
- package/dist/analytics/useAnalytics.d.ts.map +1 -1
- package/dist/analytics/useAnalytics.js +35 -0
- package/dist/analytics/useAnalytics.js.map +1 -1
- package/dist/components/ClientMonitor.js +36 -0
- package/dist/components/ClientMonitor.js.map +1 -1
- package/dist/components/CmsCollection.d.ts +47 -0
- package/dist/components/CmsCollection.d.ts.map +1 -1
- package/dist/components/CmsCollection.js +7 -0
- package/dist/components/CmsCollection.js.map +1 -1
- package/dist/components/CmsComponent.d.ts +47 -0
- package/dist/components/CmsComponent.d.ts.map +1 -1
- package/dist/components/CmsComponent.js +7 -0
- package/dist/components/CmsComponent.js.map +1 -1
- package/dist/components/CmsContent.d.ts +62 -0
- package/dist/components/CmsContent.d.ts.map +1 -1
- package/dist/components/CmsContent.js +53 -0
- package/dist/components/CmsContent.js.map +1 -1
- package/dist/components/CmsConversionErrors.js +2 -0
- package/dist/components/CmsConversionErrors.js.map +1 -1
- package/dist/components/CmsEmbeddedContent.d.ts +3 -0
- package/dist/components/CmsEmbeddedContent.d.ts.map +1 -1
- package/dist/components/CmsEmbeddedContent.js +3 -0
- package/dist/components/CmsEmbeddedContent.js.map +1 -1
- package/dist/components/CmsExternalComponent.d.ts +44 -0
- package/dist/components/CmsExternalComponent.d.ts.map +1 -1
- package/dist/components/CmsExternalComponent.js +7 -0
- package/dist/components/CmsExternalComponent.js.map +1 -1
- package/dist/components/ImageKitClientVideo.js +1 -0
- package/dist/components/ImageKitClientVideo.js.map +1 -1
- package/dist/components/SvgComponent.js +3 -1
- package/dist/components/SvgComponent.js.map +1 -1
- package/dist/components/VisualComponent.d.ts +47 -0
- package/dist/components/VisualComponent.d.ts.map +1 -1
- package/dist/components/VisualComponent.js +47 -0
- package/dist/components/VisualComponent.js.map +1 -1
- package/dist/elements/TrackedLink.d.ts +8 -0
- package/dist/elements/TrackedLink.d.ts.map +1 -1
- package/dist/elements/TrackedLink.js +13 -0
- package/dist/elements/TrackedLink.js.map +1 -1
- package/dist/framework/BackgroundMedia.js +5 -1
- package/dist/framework/BackgroundMedia.js.map +1 -1
- package/dist/framework/ComponentErrorIndicator.js +7 -4
- package/dist/framework/ComponentErrorIndicator.js.map +1 -1
- package/dist/framework/componentErrors.d.ts +8 -0
- package/dist/framework/componentErrors.d.ts.map +1 -1
- package/dist/framework/componentErrors.js +10 -0
- package/dist/framework/componentErrors.js.map +1 -1
- package/dist/hooks/useClickTracking.d.ts +39 -0
- package/dist/hooks/useClickTracking.d.ts.map +1 -1
- package/dist/hooks/useClickTracking.js +29 -0
- package/dist/hooks/useClickTracking.js.map +1 -1
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -1
- package/dist/rtf/rtf.d.ts +41 -0
- package/dist/rtf/rtf.d.ts.map +1 -1
- package/dist/rtf/rtf.js +36 -0
- package/dist/rtf/rtf.js.map +1 -1
- package/dist/utils/UnsupportedWarning.d.ts +23 -0
- package/dist/utils/UnsupportedWarning.d.ts.map +1 -1
- package/dist/utils/UnsupportedWarning.js +24 -0
- package/dist/utils/UnsupportedWarning.js.map +1 -1
- package/dist/utils/UnusedChecker.d.ts +39 -0
- package/dist/utils/UnusedChecker.d.ts.map +1 -1
- package/dist/utils/UnusedChecker.js +47 -3
- package/dist/utils/UnusedChecker.js.map +1 -1
- package/dist/utils/buildPageMetadata.d.ts +45 -0
- package/dist/utils/buildPageMetadata.d.ts.map +1 -1
- package/dist/utils/buildPageMetadata.js +37 -0
- package/dist/utils/buildPageMetadata.js.map +1 -1
- package/dist/utils/cn.d.ts +26 -0
- package/dist/utils/cn.d.ts.map +1 -1
- package/dist/utils/cn.js +26 -0
- package/dist/utils/cn.js.map +1 -1
- package/dist/utils/componentUtils.d.ts +121 -0
- package/dist/utils/componentUtils.d.ts.map +1 -1
- package/dist/utils/componentUtils.js +80 -0
- package/dist/utils/componentUtils.js.map +1 -1
- package/dist/utils/convertText.js +10 -2
- package/dist/utils/convertText.js.map +1 -1
- package/dist/utils/errorHandling.d.ts +27 -0
- package/dist/utils/errorHandling.d.ts.map +1 -1
- package/dist/utils/errorHandling.js +33 -0
- package/dist/utils/errorHandling.js.map +1 -1
- package/dist/utils/previewUtils.js +2 -0
- package/dist/utils/previewUtils.js.map +1 -1
- package/package.json +17 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @se-studio/core-ui
|
|
3
|
+
*
|
|
4
|
+
* Shared React UI component library with Tailwind CSS v4 and CMS infrastructure
|
|
5
|
+
* for SE Studio applications.
|
|
6
|
+
*
|
|
7
|
+
* This package provides:
|
|
8
|
+
* - CMS content rendering system with type-safe component mapping
|
|
9
|
+
* - React components for images, videos, animations, and rich text
|
|
10
|
+
* - Analytics integration hooks and providers
|
|
11
|
+
* - Utility functions for page metadata, error handling, and content extraction
|
|
12
|
+
* - Type-safe configuration system for CMS renderers
|
|
13
|
+
*
|
|
14
|
+
* @example Basic usage
|
|
15
|
+
* ```tsx
|
|
16
|
+
* import { CmsContent, Visual } from '@se-studio/core-ui';
|
|
17
|
+
* import { contentfulPageRest } from '@se-studio/contentful-rest-api';
|
|
18
|
+
*
|
|
19
|
+
* const page = await contentfulPageRest(config, 'home');
|
|
20
|
+
*
|
|
21
|
+
* export default function Page() {
|
|
22
|
+
* return <CmsContent content={page} config={rendererConfig} />;
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example Using Visual component
|
|
27
|
+
* ```tsx
|
|
28
|
+
* import { Visual } from '@se-studio/core-ui';
|
|
29
|
+
* import type { IVisual } from '@se-studio/core-data-types';
|
|
30
|
+
*
|
|
31
|
+
* <Visual visual={visualData} className="w-full" priority />
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @packageDocumentation
|
|
35
|
+
*/
|
|
36
|
+
// Component and Collection Mapping Infrastructure
|
|
37
|
+
// Analytics
|
|
1
38
|
export { AnalyticsProvider, useAnalyticsContext } from './analytics/AnalyticsProvider';
|
|
39
|
+
// Analytics Adapters
|
|
2
40
|
export { ConsoleAnalyticsAdapter } from './analytics/adapters';
|
|
3
41
|
export { useAnalytics } from './analytics/useAnalytics';
|
|
4
42
|
export { ClientMonitor } from './components/ClientMonitor.js';
|
|
@@ -8,24 +46,30 @@ export { CmsContent } from './components/CmsContent';
|
|
|
8
46
|
export { CmsConversionErrors } from './components/CmsConversionErrors';
|
|
9
47
|
export { CmsEmbeddedContent } from './components/CmsEmbeddedContent';
|
|
10
48
|
export { Preview } from './components/Preview.js';
|
|
49
|
+
// Visual Components
|
|
11
50
|
export { calculateCropDetails, calculateImagePriority, calculateImageWidthStyleVariable, } from './components/Visual';
|
|
12
51
|
export { Visual } from './components/VisualComponent';
|
|
13
52
|
export { RtfOrString } from './elements/RtfOrString';
|
|
14
53
|
export { TrackedLink } from './elements/TrackedLink';
|
|
54
|
+
// Elements
|
|
15
55
|
export { UtmLink } from './elements/UtmLink';
|
|
16
56
|
export { BackgroundMedia } from './framework/BackgroundMedia';
|
|
57
|
+
// Framework Components
|
|
17
58
|
export { ComponentErrorIndicator } from './framework/ComponentErrorIndicator';
|
|
18
59
|
export { showComponentError, showInlineError } from './framework/componentErrors';
|
|
19
60
|
export { default as ResponsiveVisual } from './framework/ResponsiveVisual';
|
|
61
|
+
// Shared Hooks
|
|
20
62
|
export { useClickTracking } from './hooks/useClickTracking';
|
|
21
63
|
export { RTF } from './rtf/rtf';
|
|
22
64
|
export { buildPageMetadata } from './utils/buildPageMetadata';
|
|
65
|
+
// Shared Utilities
|
|
23
66
|
export { cn } from './utils/cn';
|
|
24
67
|
export { createCollectionProps, createComponentProps, extractCollectionInfo, extractComponentInfo, extractPageContext, } from './utils/componentUtils';
|
|
25
68
|
export { convertText } from './utils/convertText';
|
|
26
69
|
export { handleCmsError } from './utils/errorHandling';
|
|
27
70
|
export { getPreviewAssetIdProps, getPreviewFieldIdProps, getPreviewParentProps, getPreviewProps, } from './utils/previewUtils';
|
|
28
71
|
export { UnsupportedWarning } from './utils/UnsupportedWarning';
|
|
72
|
+
// Development Utilities
|
|
29
73
|
export { DEFAULT_ALLOWED_UNUSED, UnusedChecker } from './utils/UnusedChecker';
|
|
30
74
|
export { isAbsoluteUrl } from './utils/urlUtils';
|
|
31
75
|
export { calculateHorizontalPositionClassName } from './utils/visualPositions';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,kDAAkD;AAElD,YAAY;AACZ,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACvF,qBAAqB;AACrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAM/D,OAAO,EAAE,YAAY,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BAAqB,EACrB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,wBAAwB;AACxB,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,oCAAoC,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/rtf/rtf.d.ts
CHANGED
|
@@ -2,11 +2,52 @@ import { type Document } from '@contentful/rich-text-types';
|
|
|
2
2
|
import type { IContentContext } from '@se-studio/core-data-types';
|
|
3
3
|
import type { HTMLAttributes } from 'react';
|
|
4
4
|
import type { CmsRendererConfig } from '../CmsRendererConfig';
|
|
5
|
+
/**
|
|
6
|
+
* Props for the RTF (Rich Text Field) component.
|
|
7
|
+
*/
|
|
5
8
|
export type RTFProps = {
|
|
9
|
+
/** Contentful rich text document to render */
|
|
6
10
|
content: Document;
|
|
11
|
+
/** Optional CMS renderer configuration for embedded content */
|
|
7
12
|
rendererConfig?: CmsRendererConfig;
|
|
13
|
+
/** Optional content context for embedded components */
|
|
8
14
|
contentContext?: IContentContext;
|
|
15
|
+
/** Optional CSS class for positioning embedded content */
|
|
9
16
|
embeddedPositionClassName?: string;
|
|
10
17
|
} & Omit<HTMLAttributes<HTMLElement>, 'content'>;
|
|
18
|
+
/**
|
|
19
|
+
* Renders Contentful rich text fields with support for embedded entries and assets.
|
|
20
|
+
*
|
|
21
|
+
* This component handles:
|
|
22
|
+
* - Standard rich text formatting (headings, paragraphs, lists, etc.)
|
|
23
|
+
* - Embedded entries (components, collections) via renderer config
|
|
24
|
+
* - Embedded assets (images, videos) via visual component renderer
|
|
25
|
+
* - Hyperlinks (internal and external)
|
|
26
|
+
* - Entry hyperlinks (links to CMS entries)
|
|
27
|
+
*
|
|
28
|
+
* @param content - Contentful rich text document
|
|
29
|
+
* @param rendererConfig - Optional CMS renderer configuration for embedded content
|
|
30
|
+
* @param contentContext - Optional content context for embedded components
|
|
31
|
+
* @param embeddedPositionClassName - Optional CSS class for positioning embedded content
|
|
32
|
+
* @param className - Additional CSS classes
|
|
33
|
+
* @param style - Additional inline styles
|
|
34
|
+
*
|
|
35
|
+
* @example Basic usage
|
|
36
|
+
* ```tsx
|
|
37
|
+
* import { RTF } from '@se-studio/core-ui';
|
|
38
|
+
*
|
|
39
|
+
* <RTF content={richTextField} />
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example With embedded content
|
|
43
|
+
* ```tsx
|
|
44
|
+
* <RTF
|
|
45
|
+
* content={richTextField}
|
|
46
|
+
* rendererConfig={rendererConfig}
|
|
47
|
+
* contentContext={contentContext}
|
|
48
|
+
* embeddedPositionClassName="w-full col-span-full"
|
|
49
|
+
* />
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
11
52
|
export declare function RTF({ content, className, style, rendererConfig, contentContext, embeddedPositionClassName, ...other }: RTFProps): import("react/jsx-runtime").JSX.Element;
|
|
12
53
|
//# sourceMappingURL=rtf.d.ts.map
|
package/dist/rtf/rtf.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rtf.d.ts","sourceRoot":"","sources":["../../src/rtf/rtf.tsx"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,QAAQ,EAGd,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,eAAe,EAAW,MAAM,4BAA4B,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EA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c,EACd,cAAc,EACd,yBAAyB,EACzB,GAAG,KAAK,EACT,EAAE,QAAQ,2CAOV"}
|
package/dist/rtf/rtf.js
CHANGED
|
@@ -8,6 +8,7 @@ function createComplexLinksRenderer(rendererConfig, contentContext, embeddedPosi
|
|
|
8
8
|
if (!rendererConfig || !contentContext) {
|
|
9
9
|
return {};
|
|
10
10
|
}
|
|
11
|
+
// Track the position of embedded entries within this RTF document
|
|
11
12
|
let embeddedEntryCounter = 0;
|
|
12
13
|
return {
|
|
13
14
|
[INLINES.EMBEDDED_ENTRY]: (node) => {
|
|
@@ -36,6 +37,7 @@ function createComplexLinksRenderer(rendererConfig, contentContext, embeddedPosi
|
|
|
36
37
|
[BLOCKS.EMBEDDED_ENTRY]: (node) => {
|
|
37
38
|
const target = node.data.target;
|
|
38
39
|
if (target) {
|
|
40
|
+
// Capture the current index before incrementing for the next embedded entry
|
|
39
41
|
const currentIndex = embeddedEntryCounter++;
|
|
40
42
|
return (_jsx(CmsEmbeddedContent, { information: target, contentContext: contentContext, rendererConfig: rendererConfig, positionClassName: embeddedPositionClassName ?? 'w-full col-span-full', parentIndex: 0, embeddedIndex: currentIndex }));
|
|
41
43
|
}
|
|
@@ -59,6 +61,40 @@ function buildOptions(rendererConfig, contentContext, embeddedPositionClassName)
|
|
|
59
61
|
},
|
|
60
62
|
};
|
|
61
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Renders Contentful rich text fields with support for embedded entries and assets.
|
|
66
|
+
*
|
|
67
|
+
* This component handles:
|
|
68
|
+
* - Standard rich text formatting (headings, paragraphs, lists, etc.)
|
|
69
|
+
* - Embedded entries (components, collections) via renderer config
|
|
70
|
+
* - Embedded assets (images, videos) via visual component renderer
|
|
71
|
+
* - Hyperlinks (internal and external)
|
|
72
|
+
* - Entry hyperlinks (links to CMS entries)
|
|
73
|
+
*
|
|
74
|
+
* @param content - Contentful rich text document
|
|
75
|
+
* @param rendererConfig - Optional CMS renderer configuration for embedded content
|
|
76
|
+
* @param contentContext - Optional content context for embedded components
|
|
77
|
+
* @param embeddedPositionClassName - Optional CSS class for positioning embedded content
|
|
78
|
+
* @param className - Additional CSS classes
|
|
79
|
+
* @param style - Additional inline styles
|
|
80
|
+
*
|
|
81
|
+
* @example Basic usage
|
|
82
|
+
* ```tsx
|
|
83
|
+
* import { RTF } from '@se-studio/core-ui';
|
|
84
|
+
*
|
|
85
|
+
* <RTF content={richTextField} />
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @example With embedded content
|
|
89
|
+
* ```tsx
|
|
90
|
+
* <RTF
|
|
91
|
+
* content={richTextField}
|
|
92
|
+
* rendererConfig={rendererConfig}
|
|
93
|
+
* contentContext={contentContext}
|
|
94
|
+
* embeddedPositionClassName="w-full col-span-full"
|
|
95
|
+
* />
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
62
98
|
export function RTF({ content, className, style, rendererConfig, contentContext, embeddedPositionClassName, ...other }) {
|
|
63
99
|
const options = buildOptions(rendererConfig, contentContext, embeddedPositionClassName);
|
|
64
100
|
return (_jsx("div", { className: className, style: style, ...other, children: documentToReactComponents(content, options) }));
|
package/dist/rtf/rtf.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rtf.js","sourceRoot":"","sources":["../../src/rtf/rtf.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,yBAAyB,GAG1B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,MAAM,EAGN,OAAO,GAER,MAAM,6BAA6B,CAAC;AAErC,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,SAAS,0BAA0B,CACjC,cAAkC,EAClC,cAAgC,EAChC,yBAAkC;IAElC,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,EAAE,CAAC;QACvC,OAAO,EAAE,CAAC;IACZ,CAAC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c,GAAI,CAAC;YAC3E,CAAC;YACD,OAAO,wBAAM,qCAAqC,GAAO,CAAC;QAC5D,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CACnB,cAAkC,EAClC,cAAgC,EAChC,yBAAkC;IAElC,MAAM,oBAAoB,GAAG,0BAA0B,CACrD,cAAc,EACd,cAAc,EACd,yBAAyB,CAC1B,CAAC;IAEF,OAAO;QACL,UAAU,EAAE;YACV,GAAG,oBAAoB;SACxB;KACF,CAAC;AACJ,CAAC;AAgBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,GAAG,CAAC,EAClB,OAAO,EACP,SAAS,EACT,KAAK,EACL,cAAc,EACd,cAAc,EACd,yBAAyB,EACzB,GAAG,KAAK,EACC;IACT,MAAM,OAAO,GAAG,YAAY,CAAC,cAAc,EAAE,cAAc,EAAE,yBAAyB,CAAC,CAAC;IACxF,OAAO,CACL,cAAK,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,KAAM,KAAK,YAC/C,yBAAyB,CAAC,OAAO,EAAE,OAAO,CAAC,GACxC,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
import type { CSSProperties, PropsWithChildren } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Development utility component that displays a warning message for unsupported features or configurations.
|
|
4
|
+
*
|
|
5
|
+
* This helps identify areas where content or features are not yet supported,
|
|
6
|
+
* making it easier to spot missing functionality during development.
|
|
7
|
+
*
|
|
8
|
+
* Only shows warnings in development mode (NODE_ENV !== 'production').
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const MyComponent = ({ data }) => {
|
|
13
|
+
* if (data.type === 'unsupported') {
|
|
14
|
+
* return (
|
|
15
|
+
* <UnsupportedWarning className="my-warning">
|
|
16
|
+
* This content type is not yet supported
|
|
17
|
+
* </UnsupportedWarning>
|
|
18
|
+
* );
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* return <div>{data.content}</div>;
|
|
22
|
+
* };
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
2
25
|
export declare const UnsupportedWarning: React.FC<PropsWithChildren<{
|
|
3
26
|
className?: string;
|
|
4
27
|
style?: CSSProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnsupportedWarning.d.ts","sourceRoot":"","sources":["../../src/utils/UnsupportedWarning.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"UnsupportedWarning.d.ts","sourceRoot":"","sources":["../../src/utils/UnsupportedWarning.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CACvC,iBAAiB,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC,CA0BH,CAAC"}
|
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Development utility component that displays a warning message for unsupported features or configurations.
|
|
4
|
+
*
|
|
5
|
+
* This helps identify areas where content or features are not yet supported,
|
|
6
|
+
* making it easier to spot missing functionality during development.
|
|
7
|
+
*
|
|
8
|
+
* Only shows warnings in development mode (NODE_ENV !== 'production').
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const MyComponent = ({ data }) => {
|
|
13
|
+
* if (data.type === 'unsupported') {
|
|
14
|
+
* return (
|
|
15
|
+
* <UnsupportedWarning className="my-warning">
|
|
16
|
+
* This content type is not yet supported
|
|
17
|
+
* </UnsupportedWarning>
|
|
18
|
+
* );
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* return <div>{data.content}</div>;
|
|
22
|
+
* };
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
2
25
|
export const UnsupportedWarning = ({ children, className, style, showWarnings = true }) => {
|
|
26
|
+
// Only show in development mode
|
|
3
27
|
if ((typeof process !== 'undefined' && process.env?.NODE_ENV === 'production') || !showWarnings) {
|
|
4
28
|
return null;
|
|
5
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnsupportedWarning.js","sourceRoot":"","sources":["../../src/utils/UnsupportedWarning.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"UnsupportedWarning.js","sourceRoot":"","sources":["../../src/utils/UnsupportedWarning.tsx"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAM3B,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI,EAAE,EAAE,EAAE;IAC1D,gCAAgC;IAChC,IAAI,CAAC,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,QAAQ,KAAK,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QAChG,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,YAAY,GAAkB;QAClC,eAAe,EAAE,SAAS;QAC1B,MAAM,EAAE,mBAAmB;QAC3B,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,cAAc;QACvB,MAAM,EAAE,UAAU;QAClB,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE,MAAM;QAClB,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE,cAAc;KACxB,CAAC;IAEF,MAAM,WAAW,GAAG,EAAE,GAAG,YAAY,EAAE,GAAG,KAAK,EAAE,CAAC;IAElD,OAAO,CACL,cAAK,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,YAC1C,QAAQ,GACL,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
import type { PropsWithChildren } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Set of property names that are commonly unused and should not trigger warnings.
|
|
4
|
+
* Projects can extend this list by wrapping UnusedChecker or using their own implementation.
|
|
5
|
+
*/
|
|
2
6
|
declare const DEFAULT_ALLOWED_UNUSED: Set<string>;
|
|
3
7
|
type FieldsType = Record<string, unknown>;
|
|
8
|
+
/**
|
|
9
|
+
* Development utility component that warns about unused component/collection properties.
|
|
10
|
+
*
|
|
11
|
+
* This helps catch cases where CMS content includes fields that aren't being rendered,
|
|
12
|
+
* which could indicate missing functionality or unnecessary data fetching.
|
|
13
|
+
*
|
|
14
|
+
* Only shows warnings in development mode (NODE_ENV !== 'production').
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const USED_FIELDS = new Set(['heading', 'body', 'visual']);
|
|
19
|
+
*
|
|
20
|
+
* const MyComponent = ({ information }) => {
|
|
21
|
+
* const { componentType, ...allFields } = information;
|
|
22
|
+
*
|
|
23
|
+
* return (
|
|
24
|
+
* <UnusedChecker
|
|
25
|
+
* componentName="MyComponent"
|
|
26
|
+
* allFields={allFields}
|
|
27
|
+
* usedFields={USED_FIELDS}
|
|
28
|
+
* additionalAllowedUnused={new Set(['customField'])}
|
|
29
|
+
* showWarnings={true}
|
|
30
|
+
* >
|
|
31
|
+
* <div>
|
|
32
|
+
* <h2>{information.heading}</h2>
|
|
33
|
+
* <p>{information.body}</p>
|
|
34
|
+
* </div>
|
|
35
|
+
* </UnusedChecker>
|
|
36
|
+
* );
|
|
37
|
+
* };
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
4
40
|
export declare const UnusedChecker: React.FC<PropsWithChildren<{
|
|
5
41
|
componentName: string;
|
|
6
42
|
allFields: FieldsType;
|
|
@@ -8,5 +44,8 @@ export declare const UnusedChecker: React.FC<PropsWithChildren<{
|
|
|
8
44
|
additionalAllowedUnused?: Set<string>;
|
|
9
45
|
showWarnings?: boolean;
|
|
10
46
|
}>>;
|
|
47
|
+
/**
|
|
48
|
+
* Export the default allowed unused set so projects can extend it
|
|
49
|
+
*/
|
|
11
50
|
export { DEFAULT_ALLOWED_UNUSED };
|
|
12
51
|
//# sourceMappingURL=UnusedChecker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnusedChecker.d.ts","sourceRoot":"","sources":["../../src/utils/UnusedChecker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"UnusedChecker.d.ts","sourceRoot":"","sources":["../../src/utils/UnusedChecker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C;;;GAGG;AACH,QAAA,MAAM,sBAAsB,aAmB1B,CAAC;AAEH,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAuB1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAClC,iBAAiB,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC;IACtB,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,uBAAuB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC,CA6CH,CAAC;AAEF;;GAEG;AACH,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Set of property names that are commonly unused and should not trigger warnings.
|
|
4
|
+
* Projects can extend this list by wrapping UnusedChecker or using their own implementation.
|
|
5
|
+
*/
|
|
2
6
|
const DEFAULT_ALLOWED_UNUSED = new Set([
|
|
3
7
|
'componentType',
|
|
4
8
|
'CollectionType',
|
|
@@ -19,18 +23,55 @@ const DEFAULT_ALLOWED_UNUSED = new Set([
|
|
|
19
23
|
'backgroundVisual',
|
|
20
24
|
'backgroundOverlayOpacity',
|
|
21
25
|
]);
|
|
26
|
+
/**
|
|
27
|
+
* Get fields that have values but are not in the allowed sets or used fields
|
|
28
|
+
*/
|
|
22
29
|
function getUnusedFields(allFields, usedFields, additionalAllowedUnused) {
|
|
30
|
+
// Combine default allowed unused with any additional project-specific ones
|
|
23
31
|
const allowedUnused = new Set([...DEFAULT_ALLOWED_UNUSED, ...(additionalAllowedUnused || [])]);
|
|
24
32
|
const fieldsWithValues = Object.entries(allFields)
|
|
25
|
-
.filter(([name]) => !allowedUnused.has(name))
|
|
26
|
-
.filter(([name]) => !usedFields?.has(name))
|
|
27
|
-
.filter(([, value]) => typeof value !== 'undefined' && value !== null)
|
|
33
|
+
.filter(([name]) => !allowedUnused.has(name)) // Not in allowed unused sets
|
|
34
|
+
.filter(([name]) => !usedFields?.has(name)) // Not in used fields
|
|
35
|
+
.filter(([, value]) => typeof value !== 'undefined' && value !== null) // Has actual value
|
|
28
36
|
.map(([name]) => name);
|
|
29
37
|
if (fieldsWithValues.length > 0)
|
|
30
38
|
return fieldsWithValues;
|
|
31
39
|
return undefined;
|
|
32
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Development utility component that warns about unused component/collection properties.
|
|
43
|
+
*
|
|
44
|
+
* This helps catch cases where CMS content includes fields that aren't being rendered,
|
|
45
|
+
* which could indicate missing functionality or unnecessary data fetching.
|
|
46
|
+
*
|
|
47
|
+
* Only shows warnings in development mode (NODE_ENV !== 'production').
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* const USED_FIELDS = new Set(['heading', 'body', 'visual']);
|
|
52
|
+
*
|
|
53
|
+
* const MyComponent = ({ information }) => {
|
|
54
|
+
* const { componentType, ...allFields } = information;
|
|
55
|
+
*
|
|
56
|
+
* return (
|
|
57
|
+
* <UnusedChecker
|
|
58
|
+
* componentName="MyComponent"
|
|
59
|
+
* allFields={allFields}
|
|
60
|
+
* usedFields={USED_FIELDS}
|
|
61
|
+
* additionalAllowedUnused={new Set(['customField'])}
|
|
62
|
+
* showWarnings={true}
|
|
63
|
+
* >
|
|
64
|
+
* <div>
|
|
65
|
+
* <h2>{information.heading}</h2>
|
|
66
|
+
* <p>{information.body}</p>
|
|
67
|
+
* </div>
|
|
68
|
+
* </UnusedChecker>
|
|
69
|
+
* );
|
|
70
|
+
* };
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
33
73
|
export const UnusedChecker = ({ children, componentName, allFields, usedFields, additionalAllowedUnused, showWarnings = true, }) => {
|
|
74
|
+
// Only check in development mode
|
|
34
75
|
if ((typeof process !== 'undefined' && process.env?.NODE_ENV === 'production') || !showWarnings) {
|
|
35
76
|
return _jsx(_Fragment, { children: children });
|
|
36
77
|
}
|
|
@@ -48,5 +89,8 @@ export const UnusedChecker = ({ children, componentName, allFields, usedFields,
|
|
|
48
89
|
}
|
|
49
90
|
return _jsx(_Fragment, { children: children });
|
|
50
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* Export the default allowed unused set so projects can extend it
|
|
94
|
+
*/
|
|
51
95
|
export { DEFAULT_ALLOWED_UNUSED };
|
|
52
96
|
//# sourceMappingURL=UnusedChecker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnusedChecker.js","sourceRoot":"","sources":["../../src/utils/UnusedChecker.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"UnusedChecker.js","sourceRoot":"","sources":["../../src/utils/Unus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,aAAa,GAQtB,CAAC,EACH,QAAQ,EACR,aAAa,EACb,SAAS,EACT,UAAU,EACV,uBAAuB,EACvB,YAAY,GAAG,IAAI,GACpB,EAAE,EAAE;IACH,iCAAiC;IACjC,IAAI,CAAC,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,QAAQ,KAAK,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QAChG,OAAO,4BAAG,QAAQ,GAAI,CAAC;IACzB,CAAC;IAED,MAAM,YAAY,GAAG,eAAe,CAAC,SAAS,EAAE,UAAU,EAAE,uBAAuB,CAAC,CAAC;IAErF,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,CACL,8BACE,eACE,KAAK,EAAE;wBACL,eAAe,EAAE,QAAQ;wBACzB,OAAO,EAAE,MAAM;wBACf,MAAM,EAAE,QAAQ;qBACjB,aAED,aACE,KAAK,EAAE;gCACL,QAAQ,EAAE,MAAM;gCAChB,KAAK,EAAE,OAAO;gCACd,MAAM,EAAE,YAAY;6BACrB,mCAEkB,aAAa,IAC9B,EACJ,aAAG,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,gCACzC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IACrC,IACA,EACL,QAAQ,IACR,CACJ,CAAC;IACJ,CAAC;IAED,OAAO,4BAAG,QAAQ,GAAI,CAAC;AACzB,CAAC,CAAC;AAEF;;GAEG;AACH,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -1,11 +1,56 @@
|
|
|
1
1
|
import type { IBaseModel } from '@se-studio/core-data-types';
|
|
2
2
|
import type { Metadata, ResolvingMetadata } from 'next';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for building page metadata.
|
|
5
|
+
*/
|
|
3
6
|
export interface IBuildInformation {
|
|
7
|
+
/** Base URL for the site (e.g., 'https://example.com') */
|
|
4
8
|
baseUrl: string;
|
|
9
|
+
/** Whether the site is in production mode */
|
|
5
10
|
isProduction: boolean;
|
|
11
|
+
/** Whether the site is in development mode */
|
|
6
12
|
isDevelopment: boolean;
|
|
13
|
+
/** Customer/client name for metadata */
|
|
7
14
|
customerName: string;
|
|
15
|
+
/** Optional application name (defaults to customerName) */
|
|
8
16
|
applicationName?: string;
|
|
9
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Builds Next.js metadata object from CMS page model.
|
|
20
|
+
*
|
|
21
|
+
* Generates comprehensive SEO metadata including:
|
|
22
|
+
* - Title and description
|
|
23
|
+
* - Open Graph tags for social sharing
|
|
24
|
+
* - Twitter Card metadata
|
|
25
|
+
* - Canonical URL
|
|
26
|
+
* - Robots directives (index/follow based on production mode)
|
|
27
|
+
* - Featured image for OG/Twitter
|
|
28
|
+
*
|
|
29
|
+
* @param model - Page model from CMS (must include title, description, featuredImage, indexed)
|
|
30
|
+
* @param path - URL path for the page (e.g., '/about-us')
|
|
31
|
+
* @param buildInfo - Build configuration (baseUrl, environment flags, customer info)
|
|
32
|
+
* @param _parent - Next.js parent metadata resolver (unused, for API compatibility)
|
|
33
|
+
* @returns Next.js Metadata object ready for use in page metadata exports
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* import { buildPageMetadata } from '@se-studio/core-ui';
|
|
38
|
+
*
|
|
39
|
+
* export async function generateMetadata({ params }): Promise<Metadata> {
|
|
40
|
+
* const page = await contentfulPageRest(config, params.slug);
|
|
41
|
+
* return buildPageMetadata(
|
|
42
|
+
* page,
|
|
43
|
+
* `/${params.slug}`,
|
|
44
|
+
* {
|
|
45
|
+
* baseUrl: process.env.NEXT_PUBLIC_BASE_URL!,
|
|
46
|
+
* isProduction: process.env.NODE_ENV === 'production',
|
|
47
|
+
* isDevelopment: process.env.NODE_ENV === 'development',
|
|
48
|
+
* customerName: 'My Company',
|
|
49
|
+
* },
|
|
50
|
+
* undefined
|
|
51
|
+
* );
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
10
55
|
export declare function buildPageMetadata(model: Omit<IBaseModel, 'textColour' | 'backgroundColour'>, path: string, { baseUrl, isProduction, customerName, applicationName }: IBuildInformation, _parent: ResolvingMetadata): Metadata;
|
|
11
56
|
//# sourceMappingURL=buildPageMetadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildPageMetadata.d.ts","sourceRoot":"","sources":["../../src/utils/buildPageMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAExD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,YAAY,GAAG,kBAAkB,CAAC,EAC1D,IAAI,EAAE,MAAM,EACZ,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,EAAE,iBAAiB,EAC3E,OAAO,EAAE,iBAAiB,GACzB,QAAQ,CA8CV"}
|
|
1
|
+
{"version":3,"file":"buildPageMetadata.d.ts","sourceRoot":"","sources":["../../src/utils/buildPageMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,YAAY,EAAE,OAAO,CAAC;IACtB,8CAA8C;IAC9C,aAAa,EAAE,OAAO,CAAC;IACvB,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,YAAY,GAAG,kBAAkB,CAAC,EAC1D,IAAI,EAAE,MAAM,EACZ,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,EAAE,iBAAiB,EAC3E,OAAO,EAAE,iBAAiB,GACzB,QAAQ,CA8CV"}
|
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds Next.js metadata object from CMS page model.
|
|
3
|
+
*
|
|
4
|
+
* Generates comprehensive SEO metadata including:
|
|
5
|
+
* - Title and description
|
|
6
|
+
* - Open Graph tags for social sharing
|
|
7
|
+
* - Twitter Card metadata
|
|
8
|
+
* - Canonical URL
|
|
9
|
+
* - Robots directives (index/follow based on production mode)
|
|
10
|
+
* - Featured image for OG/Twitter
|
|
11
|
+
*
|
|
12
|
+
* @param model - Page model from CMS (must include title, description, featuredImage, indexed)
|
|
13
|
+
* @param path - URL path for the page (e.g., '/about-us')
|
|
14
|
+
* @param buildInfo - Build configuration (baseUrl, environment flags, customer info)
|
|
15
|
+
* @param _parent - Next.js parent metadata resolver (unused, for API compatibility)
|
|
16
|
+
* @returns Next.js Metadata object ready for use in page metadata exports
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* import { buildPageMetadata } from '@se-studio/core-ui';
|
|
21
|
+
*
|
|
22
|
+
* export async function generateMetadata({ params }): Promise<Metadata> {
|
|
23
|
+
* const page = await contentfulPageRest(config, params.slug);
|
|
24
|
+
* return buildPageMetadata(
|
|
25
|
+
* page,
|
|
26
|
+
* `/${params.slug}`,
|
|
27
|
+
* {
|
|
28
|
+
* baseUrl: process.env.NEXT_PUBLIC_BASE_URL!,
|
|
29
|
+
* isProduction: process.env.NODE_ENV === 'production',
|
|
30
|
+
* isDevelopment: process.env.NODE_ENV === 'development',
|
|
31
|
+
* customerName: 'My Company',
|
|
32
|
+
* },
|
|
33
|
+
* undefined
|
|
34
|
+
* );
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
1
38
|
export function buildPageMetadata(model, path, { baseUrl, isProduction, customerName, applicationName }, _parent) {
|
|
2
39
|
const { title, description, featuredImage } = model;
|
|
3
40
|
const indexed = isProduction ? model.indexed : false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildPageMetadata.js","sourceRoot":"","sources":["../../src/utils/buildPageMetadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildPageMetadata.js","sourceRoot":"","sources":["../../src/utils/buildPageMetadata.ts"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAA0D,EAC1D,IAAY,EACZ,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAqB,EAC3E,OAA0B;IAE1B,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IACpD,MAAM,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAErD,MAAM,eAAe,GAAG,aAAa,EAAE,EAAE,CAAC;IAC1C,MAAM,iBAAiB,GAAG,eAAe,CAAC,CAAC,CAAC,OAAO,eAAe,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAErF,MAAM,MAAM,GAAa;QACvB,YAAY,EAAE,IAAI,GAAG,CAAC,OAAO,CAAC;QAC9B,eAAe,EAAE,eAAe,IAAI,YAAY;QAChD,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,EAAE,OAAO,EAAE;YACpC,EAAE,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,uBAAuB,EAAE;SACzD;QACD,WAAW,EAAE;YACX,KAAK,EAAE,eAAe,IAAI,YAAY;SACvC;QACD,UAAU,EAAE;YACV,SAAS,EAAE,IAAI;SAChB;QACD,MAAM,EAAE;YACN,KAAK,EAAE,OAAO,IAAI,KAAK;YACvB,MAAM,EAAE,OAAO,IAAI,KAAK;SACzB;QACD,KAAK;QACL,WAAW;QACX,OAAO,EAAE;YACP,IAAI,EAAE,qBAAqB;YAC3B,KAAK;YACL,WAAW,EAAE,WAAW,IAAI,SAAS;YACrC,MAAM,EAAE,iBAAiB;SAC1B;QACD,SAAS,EAAE;YACT,IAAI,EAAE,SAAS;YACf,GAAG,EAAE,IAAI;YACT,KAAK;YACL,WAAW,EAAE,WAAW,IAAI,SAAS;YACrC,MAAM,EAAE,iBAAiB;SAC1B;QACD,KAAK,EAAE;YACL,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,YAAY;SAC7C;KACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/utils/cn.d.ts
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
1
|
import { type ClassValue } from 'clsx';
|
|
2
|
+
/**
|
|
3
|
+
* Utility function for merging Tailwind CSS classes.
|
|
4
|
+
*
|
|
5
|
+
* Combines clsx for conditional class names with tailwind-merge to intelligently
|
|
6
|
+
* merge Tailwind classes, resolving conflicts by keeping the last conflicting class.
|
|
7
|
+
*
|
|
8
|
+
* @param inputs - Variable number of class name inputs (strings, objects, arrays)
|
|
9
|
+
* @returns Merged class name string
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* import { cn } from '@se-studio/core-ui';
|
|
14
|
+
*
|
|
15
|
+
* // Basic usage
|
|
16
|
+
* cn('text-lg', 'font-bold') // 'text-lg font-bold'
|
|
17
|
+
*
|
|
18
|
+
* // Conditional classes
|
|
19
|
+
* cn('text-lg', isActive && 'text-blue-500') // 'text-lg text-blue-500' or 'text-lg'
|
|
20
|
+
*
|
|
21
|
+
* // Resolving conflicts
|
|
22
|
+
* cn('text-lg', 'text-sm') // 'text-sm' (last one wins)
|
|
23
|
+
*
|
|
24
|
+
* // With Tailwind classes
|
|
25
|
+
* cn('p-4', 'p-2') // 'p-2' (conflict resolved)
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
2
28
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
3
29
|
//# sourceMappingURL=cn.d.ts.map
|
package/dist/utils/cn.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
|
|
1
|
+
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAC;AAG7C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
|
package/dist/utils/cn.js
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
/**
|
|
4
|
+
* Utility function for merging Tailwind CSS classes.
|
|
5
|
+
*
|
|
6
|
+
* Combines clsx for conditional class names with tailwind-merge to intelligently
|
|
7
|
+
* merge Tailwind classes, resolving conflicts by keeping the last conflicting class.
|
|
8
|
+
*
|
|
9
|
+
* @param inputs - Variable number of class name inputs (strings, objects, arrays)
|
|
10
|
+
* @returns Merged class name string
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* import { cn } from '@se-studio/core-ui';
|
|
15
|
+
*
|
|
16
|
+
* // Basic usage
|
|
17
|
+
* cn('text-lg', 'font-bold') // 'text-lg font-bold'
|
|
18
|
+
*
|
|
19
|
+
* // Conditional classes
|
|
20
|
+
* cn('text-lg', isActive && 'text-blue-500') // 'text-lg text-blue-500' or 'text-lg'
|
|
21
|
+
*
|
|
22
|
+
* // Resolving conflicts
|
|
23
|
+
* cn('text-lg', 'text-sm') // 'text-sm' (last one wins)
|
|
24
|
+
*
|
|
25
|
+
* // With Tailwind classes
|
|
26
|
+
* cn('p-4', 'p-2') // 'p-2' (conflict resolved)
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
3
29
|
export function cn(...inputs) {
|
|
4
30
|
return twMerge(clsx(inputs));
|
|
5
31
|
}
|
package/dist/utils/cn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cn.js","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,IAAI,EAAE,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,UAAU,EAAE,CAAC,GAAG,MAAoB;IACxC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/B,CAAC"}
|
|
1
|
+
{"version":3,"file":"cn.js","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,IAAI,EAAE,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,EAAE,CAAC,GAAG,MAAoB;IACxC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/B,CAAC"}
|