@se-studio/core-ui 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/README.md +218 -20
  2. package/dist/CmsRendererConfig.d.ts +38 -0
  3. package/dist/CmsRendererConfig.d.ts.map +1 -0
  4. package/dist/CmsRendererConfig.js +2 -0
  5. package/dist/CmsRendererConfig.js.map +1 -0
  6. package/dist/__tests__/setup.d.ts +2 -0
  7. package/dist/__tests__/setup.d.ts.map +1 -0
  8. package/dist/__tests__/setup.js +2 -0
  9. package/dist/__tests__/setup.js.map +1 -0
  10. package/dist/components/AnimationComponent.d.ts +13 -0
  11. package/dist/components/AnimationComponent.d.ts.map +1 -0
  12. package/dist/components/AnimationComponent.js +6 -0
  13. package/dist/components/AnimationComponent.js.map +1 -0
  14. package/dist/components/ClientMonitor.d.ts +2 -3
  15. package/dist/components/ClientMonitor.d.ts.map +1 -0
  16. package/dist/components/ClientMonitor.js +104 -102
  17. package/dist/components/ClientMonitor.js.map +1 -1
  18. package/dist/components/CmsCollection.d.ts +14 -0
  19. package/dist/components/CmsCollection.d.ts.map +1 -0
  20. package/dist/components/CmsCollection.js +26 -0
  21. package/dist/components/CmsCollection.js.map +1 -0
  22. package/dist/components/CmsComponent.d.ts +14 -0
  23. package/dist/components/CmsComponent.d.ts.map +1 -0
  24. package/dist/components/CmsComponent.js +26 -0
  25. package/dist/components/CmsComponent.js.map +1 -0
  26. package/dist/components/CmsContent.d.ts +22 -0
  27. package/dist/components/CmsContent.d.ts.map +1 -0
  28. package/dist/components/CmsContent.js +117 -0
  29. package/dist/components/CmsContent.js.map +1 -0
  30. package/dist/components/CmsDataError.d.ts +14 -0
  31. package/dist/components/CmsDataError.d.ts.map +1 -0
  32. package/dist/components/CmsDataError.js +7 -0
  33. package/dist/components/CmsDataError.js.map +1 -0
  34. package/dist/components/ImageComponent.d.ts +7 -0
  35. package/dist/components/ImageComponent.d.ts.map +1 -0
  36. package/dist/components/ImageComponent.js +14 -0
  37. package/dist/components/ImageComponent.js.map +1 -0
  38. package/dist/components/ImageKitClientVideo.d.ts +10 -0
  39. package/dist/components/ImageKitClientVideo.d.ts.map +1 -0
  40. package/dist/components/ImageKitClientVideo.js +30 -0
  41. package/dist/components/ImageKitClientVideo.js.map +1 -0
  42. package/dist/components/LocalVideo.d.ts +9 -0
  43. package/dist/components/LocalVideo.d.ts.map +1 -0
  44. package/dist/components/LocalVideo.js +31 -0
  45. package/dist/components/LocalVideo.js.map +1 -0
  46. package/dist/components/PictureComponent.d.ts +7 -0
  47. package/dist/components/PictureComponent.d.ts.map +1 -0
  48. package/dist/components/PictureComponent.js +28 -0
  49. package/dist/components/PictureComponent.js.map +1 -0
  50. package/dist/components/Preview.d.ts +2 -3
  51. package/dist/components/Preview.d.ts.map +1 -0
  52. package/dist/components/Preview.js +33 -31
  53. package/dist/components/Preview.js.map +1 -1
  54. package/dist/components/SvgComponent.d.ts +7 -0
  55. package/dist/components/SvgComponent.d.ts.map +1 -0
  56. package/dist/components/SvgComponent.js +8 -0
  57. package/dist/components/SvgComponent.js.map +1 -0
  58. package/dist/components/SvgImageComponent.d.ts +7 -0
  59. package/dist/components/SvgImageComponent.d.ts.map +1 -0
  60. package/dist/components/SvgImageComponent.js +10 -0
  61. package/dist/components/SvgImageComponent.js.map +1 -0
  62. package/dist/components/Video.d.ts +6 -0
  63. package/dist/components/Video.d.ts.map +1 -0
  64. package/dist/components/Video.js +2 -0
  65. package/dist/components/Video.js.map +1 -0
  66. package/dist/components/VideoComponent.d.ts +9 -0
  67. package/dist/components/VideoComponent.d.ts.map +1 -0
  68. package/dist/components/VideoComponent.js +11 -0
  69. package/dist/components/VideoComponent.js.map +1 -0
  70. package/dist/components/Visual.d.ts +30 -0
  71. package/dist/components/Visual.d.ts.map +1 -0
  72. package/dist/components/Visual.js +57 -0
  73. package/dist/components/Visual.js.map +1 -0
  74. package/dist/components/VisualComponent.d.ts +7 -0
  75. package/dist/components/VisualComponent.d.ts.map +1 -0
  76. package/dist/components/VisualComponent.js +19 -0
  77. package/dist/components/VisualComponent.js.map +1 -0
  78. package/dist/elements/RtfOrString.d.ts +13 -0
  79. package/dist/elements/RtfOrString.d.ts.map +1 -0
  80. package/dist/elements/RtfOrString.js +13 -0
  81. package/dist/elements/RtfOrString.js.map +1 -0
  82. package/dist/elements/UtmLink.d.ts +7 -0
  83. package/dist/elements/UtmLink.d.ts.map +1 -0
  84. package/dist/elements/UtmLink.js +24 -0
  85. package/dist/elements/UtmLink.js.map +1 -0
  86. package/dist/elements/UtmLinkOrDiv.d.ts +5 -0
  87. package/dist/elements/UtmLinkOrDiv.d.ts.map +1 -0
  88. package/dist/elements/UtmLinkOrDiv.js +9 -0
  89. package/dist/elements/UtmLinkOrDiv.js.map +1 -0
  90. package/dist/embeddable/BuildEmbed.d.ts +6 -0
  91. package/dist/embeddable/BuildEmbed.d.ts.map +1 -0
  92. package/dist/embeddable/BuildEmbed.js +15 -0
  93. package/dist/embeddable/BuildEmbed.js.map +1 -0
  94. package/dist/embeddable/EmbeddableContext.d.ts +14 -0
  95. package/dist/embeddable/EmbeddableContext.d.ts.map +1 -0
  96. package/dist/embeddable/EmbeddableContext.js +2 -0
  97. package/dist/embeddable/EmbeddableContext.js.map +1 -0
  98. package/dist/embeddable/EmbeddableMaps.d.ts +7 -0
  99. package/dist/embeddable/EmbeddableMaps.d.ts.map +1 -0
  100. package/dist/embeddable/EmbeddableMaps.js +7 -0
  101. package/dist/embeddable/EmbeddableMaps.js.map +1 -0
  102. package/dist/framework/BackgroundMedia.d.ts +11 -0
  103. package/dist/framework/BackgroundMedia.d.ts.map +1 -0
  104. package/dist/framework/BackgroundMedia.js +19 -0
  105. package/dist/framework/BackgroundMedia.js.map +1 -0
  106. package/dist/framework/ColourChange.d.ts +8 -0
  107. package/dist/framework/ColourChange.d.ts.map +1 -0
  108. package/dist/framework/ColourChange.js +13 -0
  109. package/dist/framework/ColourChange.js.map +1 -0
  110. package/dist/framework/ComponentErrorIndicator.d.ts +12 -0
  111. package/dist/framework/ComponentErrorIndicator.d.ts.map +1 -0
  112. package/dist/framework/ComponentErrorIndicator.js +26 -0
  113. package/dist/framework/ComponentErrorIndicator.js.map +1 -0
  114. package/dist/framework/componentErrors.d.ts +11 -0
  115. package/dist/framework/componentErrors.d.ts.map +1 -0
  116. package/dist/framework/componentErrors.js +21 -0
  117. package/dist/framework/componentErrors.js.map +1 -0
  118. package/dist/hooks/useClickTracking.d.ts +19 -0
  119. package/dist/hooks/useClickTracking.d.ts.map +1 -0
  120. package/dist/hooks/useClickTracking.js +19 -0
  121. package/dist/hooks/useClickTracking.js.map +1 -0
  122. package/dist/hooks/useDocumentVisible.d.ts +2 -3
  123. package/dist/hooks/useDocumentVisible.d.ts.map +1 -0
  124. package/dist/hooks/useDocumentVisible.js +15 -18
  125. package/dist/hooks/useDocumentVisible.js.map +1 -1
  126. package/dist/hooks/visibility.d.ts +14 -0
  127. package/dist/hooks/visibility.d.ts.map +1 -0
  128. package/dist/hooks/visibility.js +122 -0
  129. package/dist/hooks/visibility.js.map +1 -0
  130. package/dist/index.d.ts +40 -172
  131. package/dist/index.d.ts.map +1 -0
  132. package/dist/index.js +28 -1077
  133. package/dist/index.js.map +1 -1
  134. package/dist/rtf/rtf.d.ts +11 -0
  135. package/dist/rtf/rtf.d.ts.map +1 -0
  136. package/dist/rtf/rtf.js +60 -0
  137. package/dist/rtf/rtf.js.map +1 -0
  138. package/dist/utils/UnsupportedWarning.d.ts +7 -0
  139. package/dist/utils/UnsupportedWarning.d.ts.map +1 -0
  140. package/dist/utils/UnsupportedWarning.js +20 -0
  141. package/dist/utils/UnsupportedWarning.js.map +1 -0
  142. package/dist/utils/UnusedChecker.d.ts +12 -0
  143. package/dist/utils/UnusedChecker.d.ts.map +1 -0
  144. package/dist/utils/UnusedChecker.js +53 -0
  145. package/dist/utils/UnusedChecker.js.map +1 -0
  146. package/dist/utils/buildPageMetadata.d.ts +11 -0
  147. package/dist/utils/buildPageMetadata.d.ts.map +1 -0
  148. package/dist/utils/buildPageMetadata.js +45 -0
  149. package/dist/utils/buildPageMetadata.js.map +1 -0
  150. package/dist/utils/cn.d.ts +3 -0
  151. package/dist/utils/cn.d.ts.map +1 -0
  152. package/dist/utils/cn.js +6 -0
  153. package/dist/utils/cn.js.map +1 -0
  154. package/dist/utils/componentUtils.d.ts +26 -0
  155. package/dist/utils/componentUtils.d.ts.map +1 -0
  156. package/dist/utils/componentUtils.js +46 -0
  157. package/dist/utils/componentUtils.js.map +1 -0
  158. package/dist/utils/convertText.d.ts +2 -0
  159. package/dist/utils/convertText.d.ts.map +1 -0
  160. package/dist/utils/convertText.js +33 -0
  161. package/dist/utils/convertText.js.map +1 -0
  162. package/dist/utils/errorHandling.d.ts +10 -0
  163. package/dist/utils/errorHandling.d.ts.map +1 -0
  164. package/dist/utils/errorHandling.js +27 -0
  165. package/dist/utils/errorHandling.js.map +1 -0
  166. package/dist/utils/previewUtils.d.ts +29 -0
  167. package/dist/utils/previewUtils.d.ts.map +1 -0
  168. package/dist/utils/previewUtils.js +24 -0
  169. package/dist/utils/previewUtils.js.map +1 -0
  170. package/dist/utils/visualPositions.d.ts +3 -0
  171. package/dist/utils/visualPositions.d.ts.map +1 -0
  172. package/dist/utils/visualPositions.js +14 -0
  173. package/dist/utils/visualPositions.js.map +1 -0
  174. package/dist/utils/visualSizes.d.ts +5 -0
  175. package/dist/utils/visualSizes.d.ts.map +1 -0
  176. package/dist/utils/visualSizes.js +21 -0
  177. package/dist/utils/visualSizes.js.map +1 -0
  178. package/package.json +13 -14
  179. package/dist/client.d.ts +0 -2
  180. package/dist/client.js +0 -8
  181. package/dist/client.js.map +0 -1
package/README.md CHANGED
@@ -1,12 +1,15 @@
1
1
  # @se-studio/core-ui
2
2
 
3
- Shared React UI component library with Tailwind CSS v4 for SE Studio applications.
3
+ Shared React UI component library with Tailwind CSS v4 and CMS infrastructure for SE Studio applications.
4
4
 
5
5
  ## Features
6
6
 
7
7
  - **React 19** - Built with the latest React
8
8
  - **TypeScript** - Full type safety
9
- - **Tailwind CSS v4** - Modern utility-first CSS framework
9
+ - **CMS Infrastructure** - Complete system for mapping Contentful content to React components
10
+ - **Tailwind CSS v4** - Modern utility-first CSS framework with custom breakpoints
11
+ - **Visual Components** - Optimized image, video, and animation components
12
+ - **Rich Text Rendering** - RTF (Rich Text Field) support with embedded content
10
13
  - **Tree-shakeable** - Import only what you need
11
14
  - **Dual exports** - ESM and CJS support
12
15
  - **Fully tested** - Comprehensive test coverage with Vitest
@@ -17,23 +20,45 @@ Shared React UI component library with Tailwind CSS v4 for SE Studio application
17
20
  pnpm add @se-studio/core-ui
18
21
  ```
19
22
 
20
- ## Usage
23
+ ## Quick Start
21
24
 
22
- ### Importing Components
25
+ ### Basic Component Usage
23
26
 
24
27
  ```tsx
25
- import { ResponsiveVisual } from '@se-studio/core-ui';
26
- import type { IResponsiveVisual } from '@se-studio/core-data-types';
27
-
28
- const visual: IResponsiveVisual = {
29
- // ... your visual data
28
+ import { Visual } from '@se-studio/core-ui';
29
+ import type { IAsset } from '@se-studio/core-data-types';
30
+
31
+ const image: IAsset = {
32
+ src: 'https://images.ctfassets.net/...',
33
+ alt: 'Hero image',
34
+ width: 1920,
35
+ height: 1080
30
36
  };
31
37
 
32
38
  export default function MyPage() {
33
- return <ResponsiveVisual visual={visual} />;
39
+ return <Visual image={image} className="w-full h-auto" />;
34
40
  }
35
41
  ```
36
42
 
43
+ ### CMS Infrastructure Usage
44
+
45
+ For content-driven applications, use the CMS infrastructure:
46
+
47
+ ```tsx
48
+ import { CmsContent } from '@se-studio/core-ui';
49
+ import { contentfulPageRest } from '@se-studio/contentful-rest-api';
50
+
51
+ // Fetch page from Contentful
52
+ const page = await contentfulPageRest(config, 'home');
53
+
54
+ // Automatically render the correct components
55
+ export default function Page() {
56
+ return <CmsContent content={page} config={rendererConfig} />;
57
+ }
58
+ ```
59
+
60
+ See the [CMS Infrastructure Guide](./CMS_INFRASTRUCTURE.md) for detailed documentation.
61
+
37
62
  ### Using Tailwind Configuration
38
63
 
39
64
  Import the Tailwind configuration in your `tailwind.config.ts`:
@@ -64,28 +89,109 @@ import '@se-studio/core-ui/styles';
64
89
 
65
90
  ## Components
66
91
 
67
- ### ResponsiveVisual
92
+ ### CMS Infrastructure Components
68
93
 
69
- Renders responsive visual content (images, videos, animations) from Contentful.
94
+ #### CmsContent
70
95
 
71
- **Props:**
96
+ Main component for rendering CMS content with automatic component mapping.
72
97
 
73
- - `visual` - `IResponsiveVisual` - The visual data from Contentful
74
- - `className?` - `string` - Additional CSS classes
75
- - `priority?` - `boolean` - Enable priority loading for above-the-fold images
98
+ **Props:**
99
+ - `content` - Page or entry content from Contentful
100
+ - `config` - `CmsRendererConfig` - Component and collection mapping configuration
101
+ - `context?` - Optional context data to pass to components
76
102
 
77
103
  **Example:**
104
+ ```tsx
105
+ import { CmsContent } from '@se-studio/core-ui';
106
+
107
+ <CmsContent content={page} config={rendererConfig} />
108
+ ```
109
+
110
+ #### CmsComponent
111
+
112
+ Renders individual CMS components with type-based routing.
113
+
114
+ **Props:**
115
+ - `component` - Component data from Contentful
116
+ - `config` - Component mapping configuration
117
+ - `context?` - Optional context
118
+
119
+ #### CmsCollection
120
+
121
+ Renders CMS collections (arrays of components) with type-based routing.
78
122
 
123
+ **Props:**
124
+ - `collection` - Array of components from Contentful
125
+ - `config` - Collection mapping configuration
126
+ - `context?` - Optional context
127
+
128
+ ### Visual Components
129
+
130
+ #### Visual
131
+
132
+ Optimized image/video component with Next.js Image integration.
133
+
134
+ **Props:**
135
+ - `image` - `IAsset` - Image data with src, alt, width, height
136
+ - `video?` - `IAsset` - Optional video data
137
+ - `animation?` - `IAsset` - Optional animation/Lottie data
138
+ - `className?` - Additional CSS classes
139
+ - `priority?` - Enable priority loading for above-the-fold content
140
+ - `fill?` - Use Next.js Image fill mode
141
+
142
+ **Example:**
79
143
  ```tsx
80
- import { ResponsiveVisual } from '@se-studio/core-ui';
144
+ import { Visual } from '@se-studio/core-ui';
81
145
 
82
- <ResponsiveVisual
83
- visual={responsiveVisualData}
146
+ <Visual
147
+ image={imageData}
84
148
  className="w-full h-auto"
85
149
  priority
86
150
  />
87
151
  ```
88
152
 
153
+ ### Rich Text Components
154
+
155
+ #### RTF (Rich Text Field)
156
+
157
+ Renders Contentful rich text with support for embedded entries and assets.
158
+
159
+ **Props:**
160
+ - `document` - Contentful rich text document
161
+ - `embeddedComponents?` - Configuration for embedded components
162
+ - `embeddedCollections?` - Configuration for embedded collections
163
+
164
+ **Example:**
165
+ ```tsx
166
+ import { RTF } from '@se-studio/core-ui';
167
+
168
+ <RTF
169
+ document={richTextField}
170
+ embeddedComponents={componentConfig}
171
+ />
172
+ ```
173
+
174
+ ### Utility Components
175
+
176
+ #### UnusedChecker
177
+
178
+ Development utility to detect unused CMS content types in your configuration.
179
+
180
+ **Props:**
181
+ - `config` - Your CMS renderer configuration
182
+ - `pages` - Array of pages to check against
183
+ - `allowedUnused?` - Array of content types allowed to be unused
184
+
185
+ **Example:**
186
+ ```tsx
187
+ import { UnusedChecker } from '@se-studio/core-ui';
188
+
189
+ <UnusedChecker
190
+ config={rendererConfig}
191
+ pages={allPages}
192
+ />
193
+ ```
194
+
89
195
  ## Development
90
196
 
91
197
  ```bash
@@ -108,7 +214,9 @@ pnpm type-check
108
214
  pnpm lint
109
215
  ```
110
216
 
111
- ## Custom Breakpoints
217
+ ## Tailwind Configuration
218
+
219
+ ### Custom Breakpoints
112
220
 
113
221
  The library includes custom breakpoints optimized for modern responsive design:
114
222
 
@@ -116,6 +224,96 @@ The library includes custom breakpoints optimized for modern responsive design:
116
224
  - `laptop`: 1024px
117
225
  - `desktop`: 1440px
118
226
 
227
+ Use them in your Tailwind classes:
228
+
229
+ ```tsx
230
+ <div className="hidden tablet:block laptop:grid laptop:grid-cols-2 desktop:grid-cols-3">
231
+ {/* Content */}
232
+ </div>
233
+ ```
234
+
235
+ ### Typography Utilities
236
+
237
+ Custom typography styles are available:
238
+
239
+ - `text-h1` - Heading 1 style
240
+ - `text-h2` - Heading 2 style
241
+ - `text-h3` - Heading 3 style
242
+ - `text-h4` - Heading 4 style
243
+ - `text-body` - Body text style
244
+ - `text-body-sm` - Small body text
245
+
246
+ ## Configuration System
247
+
248
+ The package exports several configuration utilities:
249
+
250
+ ### createCmsRendererConfig
251
+
252
+ Creates a type-safe CMS renderer configuration:
253
+
254
+ ```tsx
255
+ import { createCmsRendererConfig } from '@se-studio/core-ui';
256
+
257
+ const config = createCmsRendererConfig({
258
+ components: {
259
+ heroSection: HeroComponent,
260
+ featureSection: FeatureComponent
261
+ },
262
+ collections: {
263
+ cardGrid: CardGridCollection
264
+ }
265
+ });
266
+ ```
267
+
268
+ ### mergeCmsRendererConfig
269
+
270
+ Merges multiple configurations (useful for environment-specific or preview mode configs):
271
+
272
+ ```tsx
273
+ import { mergeCmsRendererConfig } from '@se-studio/core-ui';
274
+
275
+ const previewConfig = mergeCmsRendererConfig(
276
+ baseConfig,
277
+ previewOverrides
278
+ );
279
+ ```
280
+
281
+ ## API Exports
282
+
283
+ ### Component Configuration Types
284
+
285
+ - `ComponentConfig<TComponent, TContext>` - Type-safe component configuration
286
+ - `CollectionConfig<TCollection, TContext>` - Type-safe collection configuration
287
+ - `CmsRendererConfig` - Complete renderer configuration type
288
+
289
+ ### Utility Functions
290
+
291
+ - `buildPageMetadata(page)` - Generate Next.js metadata from page data
292
+ - `handleCmsError(error)` - Error handling utility for CMS operations
293
+ - `extractComponentInfo(component, config)` - Extract component rendering info
294
+ - `extractCollectionInfo(collection, config)` - Extract collection rendering info
295
+
296
+ ## Advanced Usage
297
+
298
+ For advanced CMS infrastructure usage, including:
299
+ - Configuration composition patterns
300
+ - Embeddable components
301
+ - Context passing
302
+ - Type-safe prop extraction
303
+ - Preview mode setup
304
+
305
+ See the [CMS Infrastructure Guide](./CMS_INFRASTRUCTURE.md).
306
+
307
+ ## Examples
308
+
309
+ Check out the [example-pointme app](../../apps/example-pointme) for a complete implementation using all core-ui features.
310
+
311
+ ## Learn More
312
+
313
+ - [CMS Infrastructure Guide](./CMS_INFRASTRUCTURE.md) - Comprehensive guide to the CMS system
314
+ - [Core Data Types](../core-data-types/README.md) - Shared TypeScript types
315
+ - [Contentful REST API](../contentful-rest-api/README.md) - API client for Contentful
316
+
119
317
  ## License
120
318
 
121
319
  MIT
@@ -0,0 +1,38 @@
1
+ import type { IContentContext } from '@se-studio/core-data-types';
2
+ import type { React } from 'next/dist/server/route-modules/app-page/vendored/rsc/entrypoints';
3
+ import type { PropsWithChildren } from 'react';
4
+ import type { CollectionMap } from './components/CmsCollection';
5
+ import type { ComponentMap } from './components/CmsComponent';
6
+ import type { ExternalComponentMap, InternalLinkRenderer, VisualComponentRenderer } from './components/CmsContent';
7
+ export interface CmsRendererConfig {
8
+ componentMap: ComponentMap;
9
+ collectionMap: CollectionMap;
10
+ externalComponentMap: ExternalComponentMap;
11
+ visualComponentRenderer: VisualComponentRenderer;
12
+ internalLinkRenderer: InternalLinkRenderer;
13
+ customContentMap?: Partial<Record<string, React.FC<{
14
+ information: any;
15
+ contentContext: IContentContext;
16
+ }>>>;
17
+ showUnknownTypeErrors: boolean;
18
+ showRenderErrors: boolean;
19
+ defaultComponentRenderer: React.FC<{
20
+ information: any;
21
+ contentContext: IContentContext;
22
+ rendererConfig: CmsRendererConfig;
23
+ }>;
24
+ defaultCollectionRenderer: React.FC<{
25
+ information: any;
26
+ contentContext: IContentContext;
27
+ rendererConfig: CmsRendererConfig;
28
+ }>;
29
+ basicLinkRenderer: React.FC<PropsWithChildren<{
30
+ href?: string;
31
+ }>>;
32
+ embeddedContentRenderer: React.FC<{
33
+ information: any;
34
+ contentContext: IContentContext;
35
+ rendererConfig: CmsRendererConfig;
36
+ }>;
37
+ }
38
+ //# sourceMappingURL=CmsRendererConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CmsRendererConfig.d.ts","sourceRoot":"","sources":["../src/CmsRendererConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kEAAkE,CAAC;AAC9F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAyCjC,MAAM,WAAW,iBAAiB;IAahC,YAAY,EAAE,YAAY,CAAC;IAc3B,aAAa,EAAE,aAAa,CAAC;IAc7B,oBAAoB,EAAE,oBAAoB,CAAC;IAa3C,uBAAuB,EAAE,uBAAuB,CAAC;IAajD,oBAAoB,EAAE,oBAAoB,CAAC;IAc3C,gBAAgB,CAAC,EAAE,OAAO,CACxB,MAAM,CACJ,MAAM,EACN,KAAK,CAAC,EAAE,CAAC;QACP,WAAW,EAAE,GAAG,CAAC;QACjB,cAAc,EAAE,eAAe,CAAC;KACjC,CAAC,CACH,CACF,CAAC;IAQF,qBAAqB,EAAE,OAAO,CAAC;IAQ/B,gBAAgB,EAAE,OAAO,CAAC;IAE1B,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC;QACjC,WAAW,EAAE,GAAG,CAAC;QACjB,cAAc,EAAE,eAAe,CAAC;QAChC,cAAc,EAAE,iBAAiB,CAAC;KACnC,CAAC,CAAC;IACH,yBAAyB,EAAE,KAAK,CAAC,EAAE,CAAC;QAClC,WAAW,EAAE,GAAG,CAAC;QACjB,cAAc,EAAE,eAAe,CAAC;QAChC,cAAc,EAAE,iBAAiB,CAAC;KACnC,CAAC,CAAC;IACH,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IAClE,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC;QAChC,WAAW,EAAE,GAAG,CAAC;QACjB,cAAc,EAAE,eAAe,CAAC;QAChC,cAAc,EAAE,iBAAiB,CAAC;KACnC,CAAC,CAAC;CACJ"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=CmsRendererConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CmsRendererConfig.js","sourceRoot":"","sources":["../src/CmsRendererConfig.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import '@testing-library/jest-dom';
2
+ //# sourceMappingURL=setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/__tests__/setup.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC"}
@@ -0,0 +1,2 @@
1
+ import '@testing-library/jest-dom';
2
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/__tests__/setup.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { IAnimation } from '@se-studio/core-data-types';
2
+ import type { IVisualProps } from './Visual';
3
+ interface IAnimationProps extends IVisualProps {
4
+ direction?: number;
5
+ controls?: boolean;
6
+ count?: number;
7
+ hover?: boolean;
8
+ }
9
+ declare function Animation({ className, style, }: {
10
+ animation: IAnimation;
11
+ } & Omit<IAnimationProps, 'analyticsContext' | 'componentLabel'>): import("react/jsx-runtime").JSX.Element;
12
+ export default Animation;
13
+ //# sourceMappingURL=AnimationComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimationComponent.d.ts","sourceRoot":"","sources":["../../src/components/AnimationComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,UAAU,eAAgB,SAAQ,YAAY;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,iBAAS,SAAS,CAAC,EACjB,SAAS,EACT,KAAK,GACN,EAAE;IACD,SAAS,EAAE,UAAU,CAAC;CACvB,GAAG,IAAI,CAAC,eAAe,EAAE,kBAAkB,GAAG,gBAAgB,CAAC,2CAM/D;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ function Animation({ className, style, }) {
3
+ return (_jsx("div", { className: className, style: style, children: "Animation Component" }));
4
+ }
5
+ export default Animation;
6
+ //# sourceMappingURL=AnimationComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimationComponent.js","sourceRoot":"","sources":["../../src/components/AnimationComponent.tsx"],"names":[],"mappings":";AAUA,SAAS,SAAS,CAAC,EACjB,SAAS,EACT,KAAK,GAGyD;IAC9D,OAAO,CACL,cAAK,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,oCAEjC,CACP,CAAC;AACJ,CAAC;AAED,eAAe,SAAS,CAAC"}
@@ -1,3 +1,2 @@
1
- declare const ClientMonitor: React.FC;
2
-
3
- export { ClientMonitor };
1
+ export declare const ClientMonitor: React.FC;
2
+ //# sourceMappingURL=ClientMonitor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClientMonitor.d.ts","sourceRoot":"","sources":["../../src/components/ClientMonitor.tsx"],"names":[],"mappings":"AA4JA,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAYjC,CAAC"}
@@ -1,135 +1,137 @@
1
- "use client";
2
- import { usePathname } from "next/navigation";
3
- import { useEffect } from "react";
4
- import { useDocumentVisible } from "../hooks/useDocumentVisible";
1
+ 'use client';
2
+ import { usePathname } from 'next/navigation';
3
+ import { useEffect } from 'react';
4
+ import { useDocumentVisible } from '../hooks/useDocumentVisible';
5
5
  let _observer;
6
6
  function handleVideo(video, isIntersecting) {
7
- if (!isIntersecting) {
8
- if (!video.paused) {
9
- video.pause();
7
+ if (!isIntersecting) {
8
+ if (!video.paused) {
9
+ video.pause();
10
+ }
11
+ }
12
+ else if (video.paused) {
13
+ video
14
+ .play()
15
+ .then(() => {
16
+ video.controls = false;
17
+ })
18
+ .catch(() => {
19
+ });
10
20
  }
11
- } else if (video.paused) {
12
- video.play().then(() => {
13
- video.controls = false;
14
- }).catch(() => {
15
- });
16
- }
17
21
  }
18
22
  function handleAnimation(animation, isIntersecting) {
19
- const currentState = animation.currentState;
20
- if (!isIntersecting) {
21
- if (currentState === "playing") {
22
- animation.pause();
23
- }
24
- } else {
25
- if (currentState === "paused") {
26
- animation.play();
23
+ const currentState = animation.currentState;
24
+ if (!isIntersecting) {
25
+ if (currentState === 'playing') {
26
+ animation.pause();
27
+ }
27
28
  }
28
- if (!currentState || currentState === "loading") {
29
- if (animation.play) {
30
- animation.play();
31
- }
32
- animation.autoplay = true;
29
+ else {
30
+ if (currentState === 'paused') {
31
+ animation.play();
32
+ }
33
+ if (!currentState || currentState === 'loading') {
34
+ if (animation.play) {
35
+ animation.play();
36
+ }
37
+ animation.autoplay = true;
38
+ }
33
39
  }
34
- }
35
40
  }
36
41
  function handleAnimatedSection(section, isIntersecting) {
37
- section.dataset.visible = isIntersecting ? "true" : "false";
38
- if (isIntersecting) {
39
- if (!section.dataset.seen) {
40
- section.dataset.seen = "true";
42
+ section.dataset.visible = isIntersecting ? 'true' : 'false';
43
+ if (isIntersecting) {
44
+ if (!section.dataset.seen) {
45
+ section.dataset.seen = 'true';
46
+ }
41
47
  }
42
- }
43
48
  }
44
49
  function intersectionHandler(entries) {
45
- for (const entry of entries) {
46
- const target = entry.target;
47
- switch (target.localName) {
48
- case "video":
49
- handleVideo(target, entry.isIntersecting);
50
- break;
51
- case "lottie-player":
52
- handleAnimation(target, entry.isIntersecting);
53
- break;
54
- default:
55
- {
56
- const element = target;
57
- handleAnimatedSection(element, entry.isIntersecting);
50
+ for (const entry of entries) {
51
+ const target = entry.target;
52
+ switch (target.localName) {
53
+ case 'video':
54
+ handleVideo(target, entry.isIntersecting);
55
+ break;
56
+ case 'lottie-player':
57
+ handleAnimation(target, entry.isIntersecting);
58
+ break;
59
+ default:
60
+ {
61
+ const element = target;
62
+ handleAnimatedSection(element, entry.isIntersecting);
63
+ }
64
+ break;
58
65
  }
59
- break;
60
66
  }
61
- }
62
67
  }
63
68
  function getObserver() {
64
- if (!_observer) {
65
- const observer = new IntersectionObserver(intersectionHandler, {
66
- threshold: 0.2
67
- });
68
- _observer = observer;
69
- }
70
- return _observer;
69
+ if (!_observer) {
70
+ const observer = new IntersectionObserver(intersectionHandler, {
71
+ threshold: 0.2,
72
+ });
73
+ _observer = observer;
74
+ }
75
+ return _observer;
71
76
  }
72
77
  function findAllVideos() {
73
- const videos = document.getElementsByTagName("video");
74
- const observer = getObserver();
75
- for (const video of videos) {
76
- video.controls = false;
77
- video.muted = true;
78
- observer.observe(video);
79
- }
80
- return () => {
78
+ const videos = document.getElementsByTagName('video');
79
+ const observer = getObserver();
81
80
  for (const video of videos) {
82
- observer.unobserve(video);
81
+ video.controls = false;
82
+ video.muted = true;
83
+ observer.observe(video);
83
84
  }
84
- };
85
+ return () => {
86
+ for (const video of videos) {
87
+ observer.unobserve(video);
88
+ }
89
+ };
85
90
  }
86
91
  function findAllAnimations() {
87
- const animations = document.getElementsByTagName("lottie-player");
88
- const observer = getObserver();
89
- for (const animation of animations) {
90
- observer.observe(animation);
91
- }
92
- return () => {
92
+ const animations = document.getElementsByTagName('lottie-player');
93
+ const observer = getObserver();
93
94
  for (const animation of animations) {
94
- observer.unobserve(animation);
95
+ observer.observe(animation);
95
96
  }
96
- };
97
+ return () => {
98
+ for (const animation of animations) {
99
+ observer.unobserve(animation);
100
+ }
101
+ };
97
102
  }
98
103
  function findAllAnimatedSections() {
99
- const sections = document.querySelectorAll("[data-component]");
100
- const observer = getObserver();
101
- for (const section of sections) {
102
- observer.observe(section);
103
- }
104
- return () => {
104
+ const sections = document.querySelectorAll('[data-component]');
105
+ const observer = getObserver();
105
106
  for (const section of sections) {
106
- observer.unobserve(section);
107
+ observer.observe(section);
107
108
  }
108
- };
109
+ return () => {
110
+ for (const section of sections) {
111
+ observer.unobserve(section);
112
+ }
113
+ };
109
114
  }
110
115
  function findAll() {
111
- const videoCleanup = findAllVideos();
112
- const animationCleanup = findAllAnimations();
113
- const animatedSectionCleanup = findAllAnimatedSections();
114
- return () => {
115
- videoCleanup();
116
- animationCleanup();
117
- animatedSectionCleanup();
118
- };
116
+ const videoCleanup = findAllVideos();
117
+ const animationCleanup = findAllAnimations();
118
+ const animatedSectionCleanup = findAllAnimatedSections();
119
+ return () => {
120
+ videoCleanup();
121
+ animationCleanup();
122
+ animatedSectionCleanup();
123
+ };
119
124
  }
120
- const ClientMonitor = () => {
121
- const isDocumentVisible = useDocumentVisible();
122
- const pathname = usePathname();
123
- useEffect(() => {
124
- pathname;
125
- if (isDocumentVisible) {
126
- return findAll();
127
- }
128
- return void 0;
129
- }, [pathname, isDocumentVisible]);
130
- return null;
131
- };
132
- export {
133
- ClientMonitor
125
+ export const ClientMonitor = () => {
126
+ const isDocumentVisible = useDocumentVisible();
127
+ const pathname = usePathname();
128
+ useEffect(() => {
129
+ pathname;
130
+ if (isDocumentVisible) {
131
+ return findAll();
132
+ }
133
+ return undefined;
134
+ }, [pathname, isDocumentVisible]);
135
+ return null;
134
136
  };
135
137
  //# sourceMappingURL=ClientMonitor.js.map