@dotcms/react 0.0.1-alpha.37 → 0.0.1-alpha.38

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/index.esm.js CHANGED
@@ -1623,6 +1623,16 @@ for (var COLLECTION_NAME in DOMIterables) {
1623
1623
 
1624
1624
  handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
1625
1625
 
1626
+ /**
1627
+ * Custom Hook to handle the DotCMS editor interaction with the page.
1628
+ *
1629
+ * @category Hooks
1630
+ * @param {DotcmsPageProps} props {
1631
+ * pageContext,
1632
+ * config,
1633
+ * }
1634
+ * @returns {DotCMSPageContext} The context for a DotCMS page provided by the editor.
1635
+ */
1626
1636
  const useDotcmsEditor = ({
1627
1637
  pageContext,
1628
1638
  config
@@ -1637,7 +1647,6 @@ const useDotcmsEditor = ({
1637
1647
  }));
1638
1648
  /**
1639
1649
  * Initializes the DotCMS editor.
1640
- *
1641
1650
  */
1642
1651
  useEffect(() => {
1643
1652
  if (!isInsideEditor()) {
@@ -1654,7 +1663,6 @@ const useDotcmsEditor = ({
1654
1663
  }, [pathname]);
1655
1664
  /**
1656
1665
  * Reloads the page when changes are made in the editor.
1657
- *
1658
1666
  */
1659
1667
  useEffect(() => {
1660
1668
  const insideEditor = isInsideEditor();
@@ -1676,7 +1684,7 @@ const useDotcmsEditor = ({
1676
1684
  action: CUSTOMER_ACTIONS.CLIENT_READY,
1677
1685
  payload: editor
1678
1686
  });
1679
- }, [pathname]);
1687
+ }, [pathname, editor]);
1680
1688
  /**
1681
1689
  * Updates the page asset when changes are made in the editor.
1682
1690
  */
@@ -1696,6 +1704,11 @@ const useDotcmsEditor = ({
1696
1704
  return state;
1697
1705
  };
1698
1706
 
1707
+ /**
1708
+ * The `PageContext` is a React context that provides access to the DotCMS page context.
1709
+ *
1710
+ * @category Contexts
1711
+ */
1699
1712
  const PageContext = /*#__PURE__*/createContext(null);
1700
1713
 
1701
1714
  /**
@@ -1748,6 +1761,10 @@ var css_248z$1 = ".row-module_row__8V7Eh {\n display: grid;\n grid-templat
1748
1761
  var styles$1 = {"row":"row-module_row__8V7Eh"};
1749
1762
  styleInject(css_248z$1);
1750
1763
 
1764
+ var css_248z = ".column-module_col-start-1__GK-q- {\n grid-column-start: 1;\n}\n\n.column-module_col-start-2__1DmkY {\n grid-column-start: 2;\n}\n\n.column-module_col-start-3__HNEPh {\n grid-column-start: 3;\n}\n\n.column-module_col-start-4__oCAwh {\n grid-column-start: 4;\n}\n\n.column-module_col-start-5__re1rB {\n grid-column-start: 5;\n}\n\n.column-module_col-start-6__dkB4w {\n grid-column-start: 6;\n}\n\n.column-module_col-start-7__kEfJb {\n grid-column-start: 7;\n}\n\n.column-module_col-start-8__Yx31z {\n grid-column-start: 8;\n}\n\n.column-module_col-start-9__9YiVY {\n grid-column-start: 9;\n}\n\n.column-module_col-start-10__6AFbk {\n grid-column-start: 10;\n}\n\n.column-module_col-start-11__LP24D {\n grid-column-start: 11;\n}\n\n.column-module_col-start-12__8p0QS {\n grid-column-start: 12;\n}\n\n.column-module_col-end-1__G9axv {\n grid-column-end: 1;\n}\n\n.column-module_col-end-2__pYjHG {\n grid-column-end: 2;\n}\n\n.column-module_col-end-3__4woe6 {\n grid-column-end: 3;\n}\n\n.column-module_col-end-4__zlBaT {\n grid-column-end: 4;\n}\n\n.column-module_col-end-5__aC-y8 {\n grid-column-end: 5;\n}\n\n.column-module_col-end-6__YljAP {\n grid-column-end: 6;\n}\n\n.column-module_col-end-7__lpQrW {\n grid-column-end: 7;\n}\n\n.column-module_col-end-8__F6UVd {\n grid-column-end: 8;\n}\n\n.column-module_col-end-9__kvQ3T {\n grid-column-end: 9;\n}\n\n.column-module_col-end-10__XJhrd {\n grid-column-end: 10;\n}\n\n.column-module_col-end-11__nx-lF {\n grid-column-end: 11;\n}\n\n.column-module_col-end-12__LIRnk {\n grid-column-end: 12;\n}\n\n.column-module_col-end-13__0p7YI {\n grid-column-end: 13;\n}\n";
1765
+ var styles = {"col-start-1":"column-module_col-start-1__GK-q-","col-start-2":"column-module_col-start-2__1DmkY","col-start-3":"column-module_col-start-3__HNEPh","col-start-4":"column-module_col-start-4__oCAwh","col-start-5":"column-module_col-start-5__re1rB","col-start-6":"column-module_col-start-6__dkB4w","col-start-7":"column-module_col-start-7__kEfJb","col-start-8":"column-module_col-start-8__Yx31z","col-start-9":"column-module_col-start-9__9YiVY","col-start-10":"column-module_col-start-10__6AFbk","col-start-11":"column-module_col-start-11__LP24D","col-start-12":"column-module_col-start-12__8p0QS","col-end-1":"column-module_col-end-1__G9axv","col-end-2":"column-module_col-end-2__pYjHG","col-end-3":"column-module_col-end-3__4woe6","col-end-4":"column-module_col-end-4__zlBaT","col-end-5":"column-module_col-end-5__aC-y8","col-end-6":"column-module_col-end-6__YljAP","col-end-7":"column-module_col-end-7__lpQrW","col-end-8":"column-module_col-end-8__F6UVd","col-end-9":"column-module_col-end-9__kvQ3T","col-end-10":"column-module_col-end-10__XJhrd","col-end-11":"column-module_col-end-11__nx-lF","col-end-12":"column-module_col-end-12__LIRnk","col-end-13":"column-module_col-end-13__0p7YI"};
1766
+ styleInject(css_248z);
1767
+
1751
1768
  const endClassMap = {
1752
1769
  1: 'col-end-1',
1753
1770
  2: 'col-end-2',
@@ -1777,6 +1794,13 @@ const startClassMap = {
1777
1794
  11: 'col-start-11',
1778
1795
  12: 'col-start-12'
1779
1796
  };
1797
+ /**
1798
+ * Get the container data from the containers object using the current container reference obtained from the layout.
1799
+ *
1800
+ * @param {ContainerData} containers
1801
+ * @param {DotCMSPageContext['pageAsset']['layout']['body']['rows'][0]['columns'][0]['containers'][0]} containerRef
1802
+ * @returns {Object} Container with all the data it has.
1803
+ */
1780
1804
  const getContainersData = (containers, containerRef) => {
1781
1805
  const {
1782
1806
  identifier,
@@ -1800,7 +1824,20 @@ const getContainersData = (containers, containerRef) => {
1800
1824
  variantId
1801
1825
  });
1802
1826
  };
1827
+ /**
1828
+ * Combine classes into a single string.
1829
+ *
1830
+ * @param {string[]} classes
1831
+ * @returns {string} Combined classes
1832
+ */
1803
1833
  const combineClasses = classes => classes.filter(Boolean).join(' ');
1834
+ /**
1835
+ * Get the start and end classes for the column based on the left offset and width.
1836
+ *
1837
+ * @param {number} start
1838
+ * @param {number} end
1839
+ * @returns {Object} Start and end classes
1840
+ */
1804
1841
  const getPositionStyleClasses = (start, end) => {
1805
1842
  const startClass = startClassMap[start];
1806
1843
  const endClass = endClassMap[end];
@@ -1810,10 +1847,6 @@ const getPositionStyleClasses = (start, end) => {
1810
1847
  };
1811
1848
  };
1812
1849
 
1813
- var css_248z = ".column-module_col-start-1__GK-q- {\n grid-column-start: 1;\n}\n\n.column-module_col-start-2__1DmkY {\n grid-column-start: 2;\n}\n\n.column-module_col-start-3__HNEPh {\n grid-column-start: 3;\n}\n\n.column-module_col-start-4__oCAwh {\n grid-column-start: 4;\n}\n\n.column-module_col-start-5__re1rB {\n grid-column-start: 5;\n}\n\n.column-module_col-start-6__dkB4w {\n grid-column-start: 6;\n}\n\n.column-module_col-start-7__kEfJb {\n grid-column-start: 7;\n}\n\n.column-module_col-start-8__Yx31z {\n grid-column-start: 8;\n}\n\n.column-module_col-start-9__9YiVY {\n grid-column-start: 9;\n}\n\n.column-module_col-start-10__6AFbk {\n grid-column-start: 10;\n}\n\n.column-module_col-start-11__LP24D {\n grid-column-start: 11;\n}\n\n.column-module_col-start-12__8p0QS {\n grid-column-start: 12;\n}\n\n.column-module_col-end-1__G9axv {\n grid-column-end: 1;\n}\n\n.column-module_col-end-2__pYjHG {\n grid-column-end: 2;\n}\n\n.column-module_col-end-3__4woe6 {\n grid-column-end: 3;\n}\n\n.column-module_col-end-4__zlBaT {\n grid-column-end: 4;\n}\n\n.column-module_col-end-5__aC-y8 {\n grid-column-end: 5;\n}\n\n.column-module_col-end-6__YljAP {\n grid-column-end: 6;\n}\n\n.column-module_col-end-7__lpQrW {\n grid-column-end: 7;\n}\n\n.column-module_col-end-8__F6UVd {\n grid-column-end: 8;\n}\n\n.column-module_col-end-9__kvQ3T {\n grid-column-end: 9;\n}\n\n.column-module_col-end-10__XJhrd {\n grid-column-end: 10;\n}\n\n.column-module_col-end-11__nx-lF {\n grid-column-end: 11;\n}\n\n.column-module_col-end-12__LIRnk {\n grid-column-end: 12;\n}\n\n.column-module_col-end-13__0p7YI {\n grid-column-end: 13;\n}\n";
1814
- var styles = {"col-start-1":"column-module_col-start-1__GK-q-","col-start-2":"column-module_col-start-2__1DmkY","col-start-3":"column-module_col-start-3__HNEPh","col-start-4":"column-module_col-start-4__oCAwh","col-start-5":"column-module_col-start-5__re1rB","col-start-6":"column-module_col-start-6__dkB4w","col-start-7":"column-module_col-start-7__kEfJb","col-start-8":"column-module_col-start-8__Yx31z","col-start-9":"column-module_col-start-9__9YiVY","col-start-10":"column-module_col-start-10__6AFbk","col-start-11":"column-module_col-start-11__LP24D","col-start-12":"column-module_col-start-12__8p0QS","col-end-1":"column-module_col-end-1__G9axv","col-end-2":"column-module_col-end-2__pYjHG","col-end-3":"column-module_col-end-3__4woe6","col-end-4":"column-module_col-end-4__zlBaT","col-end-5":"column-module_col-end-5__aC-y8","col-end-6":"column-module_col-end-6__YljAP","col-end-7":"column-module_col-end-7__lpQrW","col-end-8":"column-module_col-end-8__F6UVd","col-end-9":"column-module_col-end-9__kvQ3T","col-end-10":"column-module_col-end-10__XJhrd","col-end-11":"column-module_col-end-11__nx-lF","col-end-12":"column-module_col-end-12__LIRnk","col-end-13":"column-module_col-end-13__0p7YI"};
1815
- styleInject(css_248z);
1816
-
1817
1850
  var NATIVE_BIND$1 = functionBindNative;
1818
1851
 
1819
1852
  var FunctionPrototype = Function.prototype;
@@ -1989,6 +2022,12 @@ if ($stringify) {
1989
2022
  });
1990
2023
  }
1991
2024
 
2025
+ /**
2026
+ * Component to render when there is no component for the content type.
2027
+ *
2028
+ * @param {{ readonly contentType: string }} { contentType }
2029
+ * @return {*}
2030
+ */
1992
2031
  function NoComponent({
1993
2032
  contentType
1994
2033
  }) {
@@ -1997,9 +2036,22 @@ function NoComponent({
1997
2036
  children: ["No Component for ", contentType]
1998
2037
  });
1999
2038
  }
2039
+ /**
2040
+ * Component to render when there is no content in the container.
2041
+ *
2042
+ * @return {*}
2043
+ */
2000
2044
  function EmptyContent() {
2001
2045
  return null;
2002
2046
  }
2047
+ /**
2048
+ * Renders a Container with its content using information provided by dotCMS Page API.
2049
+ *
2050
+ * @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
2051
+ * @export
2052
+ * @param {ContainerProps} { containerRef }
2053
+ * @return {JSX.Element} Rendered container with content
2054
+ */
2003
2055
  function Container({
2004
2056
  containerRef
2005
2057
  }) {
@@ -2075,6 +2127,14 @@ function Container({
2075
2127
  });
2076
2128
  }
2077
2129
 
2130
+ /**
2131
+ * Renders a Column with its containers using information provided by dotCMS Page API.
2132
+ *
2133
+ * @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
2134
+ * @export
2135
+ * @param {ColumnProps} { column }
2136
+ * @return {JSX.Element} Rendered column with containers
2137
+ */
2078
2138
  function Column({
2079
2139
  column
2080
2140
  }) {
@@ -2085,25 +2145,29 @@ function Column({
2085
2145
  startClass,
2086
2146
  endClass
2087
2147
  } = getPositionStyleClasses(column.leftOffset, column.width + column.leftOffset);
2088
- const combinedClasses = combineClasses([styles[endClass], styles[startClass], column.styleClass]);
2148
+ const combinedClasses = combineClasses([styles[endClass], styles[startClass]]);
2089
2149
  const columnProps = isInsideEditor ? {
2090
2150
  'data-dot': 'column',
2091
2151
  'data-testid': 'column'
2092
2152
  } : {};
2093
2153
  return jsx("div", Object.assign({}, columnProps, {
2094
2154
  className: combinedClasses,
2095
- children: column.containers.map(container => jsx(Container, {
2096
- containerRef: container
2097
- }, `${container.identifier}-${container.uuid}`))
2155
+ children: jsx("div", {
2156
+ className: column.styleClass,
2157
+ children: column.containers.map(container => jsx(Container, {
2158
+ containerRef: container
2159
+ }, `${container.identifier}-${container.uuid}`))
2160
+ })
2098
2161
  }));
2099
2162
  }
2100
2163
 
2101
2164
  /**
2102
- * Renders a row
2165
+ * This component renders a row with all it's content using the layout provided by dotCMS Page API.
2103
2166
  *
2167
+ * @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
2104
2168
  * @category Components
2105
2169
  * @param {React.ForwardedRef<HTMLDivElement, RowProps>} ref
2106
- * @return {*}
2170
+ * @return {JSX.Element} Rendered rows with columns
2107
2171
  */
2108
2172
  const Row = /*#__PURE__*/forwardRef((props, ref) => {
2109
2173
  const {
@@ -2112,18 +2176,23 @@ const Row = /*#__PURE__*/forwardRef((props, ref) => {
2112
2176
  const {
2113
2177
  row
2114
2178
  } = props;
2115
- const combinedClasses = combineClasses([styles$1.row, row.styleClass]);
2116
2179
  const rowProps = isInsideEditor ? {
2117
2180
  'data-dot': 'row',
2118
2181
  'data-testid': 'row',
2119
2182
  ref
2120
2183
  } : {};
2121
- return jsx("div", Object.assign({}, rowProps, {
2122
- className: combinedClasses,
2123
- children: row.columns.map((column, index) => jsx(Column, {
2124
- column: column
2125
- }, index))
2126
- }));
2184
+ return jsx("div", {
2185
+ className: row.styleClass,
2186
+ children: jsx("div", {
2187
+ className: "container",
2188
+ children: jsx("div", Object.assign({}, rowProps, {
2189
+ className: styles$1.row,
2190
+ children: row.columns.map((column, index) => jsx(Column, {
2191
+ column: column
2192
+ }, index))
2193
+ }))
2194
+ })
2195
+ });
2127
2196
  });
2128
2197
 
2129
2198
  /**
@@ -4414,6 +4483,33 @@ const TINYMCE_CONFIG = {
4414
4483
  };
4415
4484
 
4416
4485
  const MCE_URL = '/ext/tinymcev7/tinymce.min.js';
4486
+ /**
4487
+ * Allows inline edit content pulled from dotCMS API using TinyMCE editor
4488
+ *
4489
+ * @export
4490
+ * @component
4491
+ * @param {Readonly<DotEditableTextProps>} props {
4492
+ * mode = 'plain',
4493
+ * format = 'text',
4494
+ * contentlet,
4495
+ * fieldName = ''
4496
+ * }
4497
+ * @example
4498
+ * ```javascript
4499
+ * import { DotEditableText } from '@dotcms/react';
4500
+ *
4501
+ * const MyContentletWithTitle = ({ contentlet }) => (
4502
+ * <h2>
4503
+ * <DotEditableText
4504
+ * contentlet={contentlet}
4505
+ * fieldName="title"
4506
+ * mode='full'
4507
+ * format='text'/>
4508
+ * </h2>
4509
+ * );
4510
+ * ```
4511
+ * @returns {JSX.Element} A component to edit content inline
4512
+ */
4417
4513
  function DotEditableText({
4418
4514
  mode = 'plain',
4419
4515
  format = 'text',
@@ -4442,7 +4538,7 @@ function DotEditableText({
4442
4538
  format
4443
4539
  });
4444
4540
  setContent(content);
4445
- }, [format, fieldName, contentlet == null ? void 0 : contentlet[fieldName]]);
4541
+ }, [format, fieldName, contentlet]);
4446
4542
  useEffect(() => {
4447
4543
  if (!isInsideEditor()) {
4448
4544
  return;
@@ -4555,6 +4651,12 @@ function useDotcmsPageContext() {
4555
4651
  return useContext(PageContext);
4556
4652
  }
4557
4653
 
4654
+ /**
4655
+ * Represents the different types of Blocks that can be used in the Block Editor
4656
+ *
4657
+ * @export
4658
+ * @enum {number}
4659
+ */
4558
4660
  var Blocks;
4559
4661
  (function (Blocks) {
4560
4662
  Blocks["PARAGRAPH"] = "paragraph";
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@dotcms/react",
3
- "version": "0.0.1-alpha.37",
3
+ "version": "0.0.1-alpha.38",
4
4
  "peerDependencies": {
5
5
  "react": ">=18",
6
6
  "react-dom": ">=18",
7
- "@dotcms/client": "0.0.1-alpha.37",
7
+ "@dotcms/client": "0.0.1-alpha.38",
8
8
  "@tinymce/tinymce-react": "^5.1.1"
9
9
  },
10
10
  "description": "Official React Components library to render a dotCMS page.",
@@ -1,5 +1,19 @@
1
1
  import { DotCMSPageContext } from '../../models';
2
+ /**
3
+ * Props for Column component to render a column with its containers.
4
+ *
5
+ * @export
6
+ * @interface ColumnProps
7
+ */
2
8
  export interface ColumnProps {
3
9
  readonly column: DotCMSPageContext['pageAsset']['layout']['body']['rows'][0]['columns'][0];
4
10
  }
11
+ /**
12
+ * Renders a Column with its containers using information provided by dotCMS Page API.
13
+ *
14
+ * @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
15
+ * @export
16
+ * @param {ColumnProps} { column }
17
+ * @return {JSX.Element} Rendered column with containers
18
+ */
5
19
  export declare function Column({ column }: ColumnProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,19 @@
1
1
  import { DotCMSPageContext } from '../../models';
2
+ /**
3
+ * Props for the Container component.
4
+ *
5
+ * @export
6
+ * @interface ContainerProps
7
+ */
2
8
  export interface ContainerProps {
3
9
  readonly containerRef: DotCMSPageContext['pageAsset']['layout']['body']['rows'][0]['columns'][0]['containers'][0];
4
10
  }
11
+ /**
12
+ * Renders a Container with its content using information provided by dotCMS Page API.
13
+ *
14
+ * @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
15
+ * @export
16
+ * @param {ContainerProps} { containerRef }
17
+ * @return {JSX.Element} Rendered container with content
18
+ */
5
19
  export declare function Container({ containerRef }: ContainerProps): import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,31 @@
1
+ /// <reference types="react" />
1
2
  import { DotEditableTextProps } from './utils';
2
- export declare function DotEditableText({ mode, format, contentlet, fieldName }: Readonly<DotEditableTextProps>): import("react/jsx-runtime").JSX.Element;
3
+ /**
4
+ * Allows inline edit content pulled from dotCMS API using TinyMCE editor
5
+ *
6
+ * @export
7
+ * @component
8
+ * @param {Readonly<DotEditableTextProps>} props {
9
+ * mode = 'plain',
10
+ * format = 'text',
11
+ * contentlet,
12
+ * fieldName = ''
13
+ * }
14
+ * @example
15
+ * ```javascript
16
+ * import { DotEditableText } from '@dotcms/react';
17
+ *
18
+ * const MyContentletWithTitle = ({ contentlet }) => (
19
+ * <h2>
20
+ * <DotEditableText
21
+ * contentlet={contentlet}
22
+ * fieldName="title"
23
+ * mode='full'
24
+ * format='text'/>
25
+ * </h2>
26
+ * );
27
+ * ```
28
+ * @returns {JSX.Element} A component to edit content inline
29
+ */
30
+ export declare function DotEditableText({ mode, format, contentlet, fieldName }: Readonly<DotEditableTextProps>): JSX.Element;
3
31
  export default DotEditableText;
@@ -16,10 +16,11 @@ export interface RowProps {
16
16
  row: DotCMSPageContext['pageAsset']['layout']['body']['rows'][0];
17
17
  }
18
18
  /**
19
- * Renders a row
19
+ * This component renders a row with all it's content using the layout provided by dotCMS Page API.
20
20
  *
21
+ * @see {@link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas}
21
22
  * @category Components
22
23
  * @param {React.ForwardedRef<HTMLDivElement, RowProps>} ref
23
- * @return {*}
24
+ * @return {JSX.Element} Rendered rows with columns
24
25
  */
25
26
  export declare const Row: import("react").ForwardRefExoticComponent<RowProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,3 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { DotCMSPageContext } from '../models';
3
+ /**
4
+ * The `PageContext` is a React context that provides access to the DotCMS page context.
5
+ *
6
+ * @category Contexts
7
+ */
3
8
  export declare const PageContext: import("react").Context<DotCMSPageContext | null>;
@@ -1,3 +1,13 @@
1
1
  import { DotcmsPageProps } from '../components/DotcmsLayout/DotcmsLayout';
2
2
  import { DotCMSPageContext } from '../models';
3
+ /**
4
+ * Custom Hook to handle the DotCMS editor interaction with the page.
5
+ *
6
+ * @category Hooks
7
+ * @param {DotcmsPageProps} props {
8
+ * pageContext,
9
+ * config,
10
+ * }
11
+ * @returns {DotCMSPageContext} The context for a DotCMS page provided by the editor.
12
+ */
3
13
  export declare const useDotcmsEditor: ({ pageContext, config }: DotcmsPageProps) => DotCMSPageContext;
@@ -1,8 +1,20 @@
1
1
  /// <reference types="react" />
2
2
  import { ContentNode } from './content-node.interface';
3
+ /**
4
+ * Represents a Block of content provided by the Block Editor
5
+ *
6
+ * @export
7
+ * @interface Block
8
+ */
3
9
  export interface Block {
4
10
  content: ContentNode[];
5
11
  }
12
+ /**
13
+ * Props for a contentlet inside the Block Editor
14
+ *
15
+ * @export
16
+ * @interface DotContentletProps
17
+ */
6
18
  export interface DotContentletProps {
7
19
  title: string;
8
20
  baseType: string;
@@ -33,9 +45,21 @@ export interface DotContentletProps {
33
45
  mimeType: string;
34
46
  thumbnail?: string;
35
47
  }
48
+ /**
49
+ * Props for a block inside the Block Editor Component
50
+ *
51
+ * @export
52
+ * @interface BlockProps
53
+ */
36
54
  export interface BlockProps {
37
55
  children: React.ReactNode;
38
56
  }
57
+ /**
58
+ * Represents the different types of Blocks that can be used in the Block Editor
59
+ *
60
+ * @export
61
+ * @enum {number}
62
+ */
39
63
  export declare enum Blocks {
40
64
  PARAGRAPH = "paragraph",
41
65
  HEADING = "heading",
@@ -1,9 +1,21 @@
1
1
  /// <reference types="react" />
2
2
  import { BlockProps } from './blocks.interface';
3
+ /**
4
+ * Represents a Mark used by text content in the Block Editor
5
+ *
6
+ * @export
7
+ * @interface Mark
8
+ */
3
9
  export interface Mark {
4
10
  type: string;
5
11
  attrs: Record<string, string>;
6
12
  }
13
+ /**
14
+ * Represents a Content Node used by the Block Editor
15
+ *
16
+ * @export
17
+ * @interface ContentNode
18
+ */
7
19
  export interface ContentNode {
8
20
  type: string;
9
21
  content: ContentNode[];
@@ -11,19 +23,60 @@ export interface ContentNode {
11
23
  marks?: Mark[];
12
24
  text?: string;
13
25
  }
26
+ /**
27
+ * Represents a Custom Renderer used by the Block Editor Component
28
+ *
29
+ * @export
30
+ * @interface CustomRenderer
31
+ */
14
32
  export type CustomRenderer<T = any> = Record<string, React.FC<T>>;
33
+ /**
34
+ * Represents a CodeBlock used by the Block Editor Component
35
+ * @export
36
+ * @interface CodeBlockProps
37
+ */
15
38
  export type CodeBlockProps = BlockProps & ContentNode;
39
+ /**
40
+ * Represents a Heading used by the Block Editor Component
41
+ * @export
42
+ * @interface HeadingProps
43
+ */
16
44
  export type HeadingProps = BlockProps & ContentNode;
45
+ /**
46
+ * Represents a Link used by the Block Editor Component
47
+ * @export
48
+ * @interface LinkProps
49
+ */
17
50
  export type LinkProps = BlockProps & {
18
51
  attrs?: Mark['attrs'];
19
52
  };
53
+ /**
54
+ * Represents a Paragraph used by the Block Editor Component
55
+ * @export
56
+ * @interface ParagraphProps
57
+ */
20
58
  export type ParagraphProps = BlockProps & ContentNode;
59
+ /**
60
+ * Represents a DotCMSVideo used by the Block Editor Component
61
+ * @export
62
+ * @interface DotCMSVideoProps
63
+ */
21
64
  export type DotCMSVideoProps = ContentNode['attrs'] & {
22
65
  data?: Record<string, string>;
23
66
  };
67
+ /**
68
+ * Represents a DotCMSImage used by the Block Editor Component
69
+ * @export
70
+ * @interface DotCMSImageProps
71
+ */
24
72
  export type DotCMSImageProps = ContentNode['attrs'] & {
25
73
  data?: Record<string, unknown>;
26
74
  };
75
+ /**
76
+ * Represents a DotContent used by the Block Editor Component
77
+ * @export
78
+ * @interface DotContentProps
79
+ */
27
80
  export type DotContentProps = ContentNode & {
28
81
  customRenderers?: CustomRenderer;
29
82
  };
@@ -1,4 +1,11 @@
1
1
  import { ContainerData, DotCMSPageContext } from '../models';
2
+ /**
3
+ * Get the container data from the containers object using the current container reference obtained from the layout.
4
+ *
5
+ * @param {ContainerData} containers
6
+ * @param {DotCMSPageContext['pageAsset']['layout']['body']['rows'][0]['columns'][0]['containers'][0]} containerRef
7
+ * @returns {Object} Container with all the data it has.
8
+ */
2
9
  export declare const getContainersData: (containers: ContainerData, containerRef: DotCMSPageContext['pageAsset']['layout']['body']['rows'][0]['columns'][0]['containers'][0]) => {
3
10
  acceptTypes: string;
4
11
  contentlets: {
@@ -16,7 +23,20 @@ export declare const getContainersData: (containers: ContainerData, containerRef
16
23
  maxContentlets: number;
17
24
  parentPermissionable: Record<string, string>;
18
25
  };
26
+ /**
27
+ * Combine classes into a single string.
28
+ *
29
+ * @param {string[]} classes
30
+ * @returns {string} Combined classes
31
+ */
19
32
  export declare const combineClasses: (classes: string[]) => string;
33
+ /**
34
+ * Get the start and end classes for the column based on the left offset and width.
35
+ *
36
+ * @param {number} start
37
+ * @param {number} end
38
+ * @returns {Object} Start and end classes
39
+ */
20
40
  export declare const getPositionStyleClasses: (start: number, end: number) => {
21
41
  startClass: string;
22
42
  endClass: string;