@dotcms/uve 1.2.3-next.2 → 1.2.3

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 (2) hide show
  1. package/README.md +33 -51
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -44,7 +44,6 @@ With `@dotcms/uve`, framework SDKs are able to:
44
44
  - [Accessing Style Values](#accessing-style-values)
45
45
  - [Best Practices](#best-practices)
46
46
  - [Complete Example](#complete-example)
47
- - [Current Capabilities and Limitations](#current-capabilities-and-limitations)
48
47
  - [Troubleshooting](#troubleshooting)
49
48
  - [Common Issues & Solutions](#common-issues--solutions)
50
49
  - [Debugging Tips](#debugging-tips)
@@ -497,7 +496,7 @@ The Style Editor is a powerful feature that enables content authors and develope
497
496
  **Key Benefits:**
498
497
 
499
498
  - **Real-Time Visual Editing**: Modify component styles and see changes instantly in the editor
500
- - **Content-Specific Customization**: Different content types can have unique style schemas, and the same contentlet could have different styles depending on if it is located in a different container or page
499
+ - **Content-Specific Customization**: Different content types can have unique style schemas
501
500
  - **Developer-Controlled**: Developers define which properties are editable and how they're presented
502
501
  - **Flexible Configuration**: Support for text inputs, dropdowns, radio buttons, and checkbox groups
503
502
  - **Type-Safe**: Full TypeScript support with type inference for option values
@@ -1075,27 +1074,27 @@ function BlogPostEditor() {
1075
1074
 
1076
1075
  ### Accessing Style Values
1077
1076
 
1078
- Style Editor values are managed internally by UVE and passed to your components through the `dotStyleProperties` attribute. This attribute is available in your contentlet component props.
1077
+ Style Editor values are managed internally by UVE and passed to your components through the `styleProperties` attribute. This attribute is available in your contentlet component props.
1079
1078
 
1080
1079
  #### In React Components
1081
1080
 
1082
- When rendering contentlets, style properties are accessed through the `dotStyleProperties` prop:
1081
+ When rendering contentlets, style properties are accessed through the `styleProperties` prop:
1083
1082
 
1084
1083
  ```typescript
1085
1084
  import { DotCMSContentlet } from '@dotcms/types';
1086
1085
 
1087
1086
  interface ActivityProps {
1088
1087
  contentlet: DotCMSContentlet;
1089
- dotStyleProperties?: Record<string, any>;
1088
+ styleProperties?: Record<string, any>;
1090
1089
  }
1091
1090
 
1092
1091
  function Activity(props: ActivityProps) {
1093
- const { title, description, dotStyleProperties } = props; // Contentlet information
1092
+ const { title, description, styleProperties } = props; // Contentlet information
1094
1093
 
1095
1094
  // Access style values using dot notation or bracket notation
1096
- const fontSize = dotStyleProperties?.['font-size'];
1097
- const textAlign = dotStyleProperties?.text;
1098
- const layout = dotStyleProperties?.layout;
1095
+ const fontSize = styleProperties?.['font-size'];
1096
+ const textAlign = styleProperties?.text;
1097
+ const layout = styleProperties?.layout;
1099
1098
 
1100
1099
  return (
1101
1100
  <div style={{ fontSize, textAlign }}>
@@ -1155,17 +1154,17 @@ Use the style values to conditionally render styles, classes, or component varia
1155
1154
 
1156
1155
  ```typescript
1157
1156
  function BlogPost(props) {
1158
- const { title, body, dotStyleProperties } = props;
1157
+ const { title, body, styleProperties } = props;
1159
1158
 
1160
1159
  // Example: Apply dynamic font size
1161
- const fontSize = dotStyleProperties?.['font-size'] || '16px';
1160
+ const fontSize = styleProperties?.['font-size'] || '16px';
1162
1161
 
1163
1162
  // Example: Apply layout classes
1164
- const layout = dotStyleProperties?.layout || 'default';
1163
+ const layout = styleProperties?.layout || 'default';
1165
1164
  const layoutClass = `layout-${layout}`;
1166
1165
 
1167
1166
  // Example: Apply checkbox group values
1168
- const textStyles = dotStyleProperties?.['text-style'] || {};
1167
+ const textStyles = styleProperties?.['text-style'] || {};
1169
1168
  const textStyleClasses = [
1170
1169
  textStyles.bold ? 'font-bold' : '',
1171
1170
  textStyles.italic ? 'font-italic' : '',
@@ -1183,7 +1182,7 @@ function BlogPost(props) {
1183
1182
  }
1184
1183
  ```
1185
1184
 
1186
- **💡 Note:** The `dotStyleProperties` prop is automatically passed to your contentlet components by the framework SDK when UVE is active and style schemas are registered.
1185
+ **💡 Note:** The `styleProperties` prop is automatically passed to your contentlet components by the framework SDK when UVE is active and style schemas are registered.
1187
1186
 
1188
1187
  ### Best Practices
1189
1188
 
@@ -1332,13 +1331,13 @@ When using style properties, always provide fallback defaults:
1332
1331
 
1333
1332
  ```typescript
1334
1333
  // ✅ Good: Fallback values prevent errors
1335
- const fontSize = dotStyleProperties?.['font-size'] || '16px';
1336
- const layout = dotStyleProperties?.layout || 'default';
1337
- const textStyles = dotStyleProperties?.['text-style'] || {};
1334
+ const fontSize = styleProperties?.['font-size'] || '16px';
1335
+ const layout = styleProperties?.layout || 'default';
1336
+ const textStyles = styleProperties?.['text-style'] || {};
1338
1337
 
1339
1338
  // ❌ Bad: No fallbacks (could cause errors)
1340
- const fontSize = dotStyleProperties?.['font-size'];
1341
- const layout = dotStyleProperties?.layout;
1339
+ const fontSize = styleProperties?.['font-size'];
1340
+ const layout = styleProperties?.layout;
1342
1341
  ```
1343
1342
 
1344
1343
  ### Complete Example
@@ -1539,24 +1538,24 @@ export function BlogPostStyleEditor() {
1539
1538
 
1540
1539
  // Example: Using style properties in a component
1541
1540
  export function BlogPostRenderer(props) {
1542
- const { title, body, dotStyleProperties } = props;
1541
+ const { title, body, styleProperties } = props;
1543
1542
 
1544
1543
  // Extract style values with defaults
1545
- const headingSize = dotStyleProperties?.['heading-font-size'] || '24px';
1546
- const bodySize = dotStyleProperties?.['body-font-size'] || '16px';
1547
- const fontFamily = dotStyleProperties?.['font-family'] || 'arial';
1548
- const lineHeight = dotStyleProperties?.['line-height'] || '1.5';
1549
- const layout = dotStyleProperties?.['page-layout'] || 'full-width';
1550
- const contentWidth = dotStyleProperties?.['content-width'] || '1000px';
1551
- const sectionSpacing = dotStyleProperties?.['section-spacing'] || 40;
1552
- const theme = dotStyleProperties?.['color-theme'] || 'light';
1553
- const primaryColor = dotStyleProperties?.['primary-color'] || '#007bff';
1554
- const backgroundColor = dotStyleProperties?.['background-color'] || '#ffffff';
1544
+ const headingSize = styleProperties?.['heading-font-size'] || '24px';
1545
+ const bodySize = styleProperties?.['body-font-size'] || '16px';
1546
+ const fontFamily = styleProperties?.['font-family'] || 'arial';
1547
+ const lineHeight = styleProperties?.['line-height'] || '1.5';
1548
+ const layout = styleProperties?.['page-layout'] || 'full-width';
1549
+ const contentWidth = styleProperties?.['content-width'] || '1000px';
1550
+ const sectionSpacing = styleProperties?.['section-spacing'] || 40;
1551
+ const theme = styleProperties?.['color-theme'] || 'light';
1552
+ const primaryColor = styleProperties?.['primary-color'] || '#007bff';
1553
+ const backgroundColor = styleProperties?.['background-color'] || '#ffffff';
1555
1554
 
1556
1555
  // Extract checkbox group values
1557
- const textStyle = dotStyleProperties?.['text-style'] || {};
1558
- const features = dotStyleProperties?.features || {};
1559
- const responsive = dotStyleProperties?.responsive || {};
1556
+ const textStyle = styleProperties?.['text-style'] || {};
1557
+ const features = styleProperties?.features || {};
1558
+ const responsive = styleProperties?.responsive || {};
1560
1559
 
1561
1560
  // Build CSS classes based on values
1562
1561
  const containerClasses = [
@@ -1614,26 +1613,9 @@ export function BlogPostRenderer(props) {
1614
1613
  - ✅ Visual layout selection with images
1615
1614
  - ✅ Checkbox groups for boolean flags
1616
1615
  - ✅ Clear, descriptive labels
1617
- - ✅ Safe value extraction with defaults using `dotStyleProperties`
1616
+ - ✅ Safe value extraction with defaults using `styleProperties`
1618
1617
  - ✅ Dynamic styling based on style values
1619
1618
 
1620
- ### Current Capabilities and Limitations:
1621
-
1622
- When **defining styles** for a contentlet within a page using **Style Editor**, the following behaviors might occur:
1623
-
1624
- | Scenario | Behavior | Result |
1625
- |---------------------------------------------------|-----------------------------------------------------------------------------------|---------------------------------------------|
1626
- | Same Contentlet, Different Containers, Same Page | Page A: { Container_1: contentlet_1, Container_2: contentlet_1 } | 🎨 Styles are different |
1627
- | Same Contentlet, Same Container, Different Pages | Page A: { Container_1: contentlet_1 }, Page B: { Container_1: contentlet_1 } | 🎨 Styles are different |
1628
- | Copying a Page with Styled Content | Creating Page B as a copy of Page A, where Page A includes styled content | ✅ Styles preserved, 🎨 Styles are different |
1629
- | Moving Styled Content to Same Container Type | system-container → system-container | ✅ Styles preserved |
1630
- | Moving Styled Content to Different Container Type | system-container → custom-container | ⚠️ Styles lost |
1631
- | Adding, Deleting, or Moving Unstyled Content | Performing any structural change on the page that does not involve styled content | if any: ✅ Styles preserved |
1632
-
1633
- > **NOTE:** (🎨 Styles are different) means the capability to define distinct styles, even when utilizing the identical Contentlet.
1634
-
1635
- The only known limitation is that moving a contentlet with defined styles between different container types (5th scenario), results in the loss of those styles. See the [technical details document](https://docs.google.com/document/d/1UiuJlIn8ZjybIB-0oHeoTLXZo1k-YExITEqEMfyvVlU/edit?tab=t.0) for our planned solution.
1636
-
1637
1619
  ## Troubleshooting
1638
1620
 
1639
1621
  ### Common Issues & Solutions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotcms/uve",
3
- "version": "1.2.3-next.2",
3
+ "version": "1.2.3",
4
4
  "description": "Official JavaScript library for interacting with Universal Visual Editor (UVE)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -50,4 +50,4 @@
50
50
  "module": "./index.esm.js",
51
51
  "main": "./index.cjs.js",
52
52
  "types": "./index.d.ts"
53
- }
53
+ }