@atlaskit/renderer 133.16.5 → 133.16.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 133.16.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9291603af8830`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9291603af8830) -
8
+ Upgrade types to be compatible with React 19.
9
+
10
+ This was done with the official React codemod: https://github.com/eps1lon/types-react-codemod/
11
+
12
+ - Updated dependencies
13
+
14
+ ## 133.16.6
15
+
16
+ ### Patch Changes
17
+
18
+ - [`b91c14d4dbad7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b91c14d4dbad7) -
19
+ Editor; Ensure only the first table row can become a sticky header when the rounded table patch is
20
+ enabled
21
+
22
+ Renderer; Patch table body elements to have rounded corners when overridden by consumers
23
+
24
+ - Updated dependencies
25
+
3
26
  ## 133.16.5
4
27
 
5
28
  ### Patch Changes
@@ -849,6 +849,53 @@ var getCellEdgePropsByCellOffset = function getCellEdgePropsByCellOffset(tableNo
849
849
  });
850
850
  return cellEdgePropsByCellOffset;
851
851
  };
852
+ var isRenderedTableCell = function isRenderedTableCell(element) {
853
+ var _ref4 = element.props,
854
+ nodeType = _ref4.nodeType;
855
+ return nodeType === 'tableCell' || nodeType === 'tableHeader' || element.type === _tableCell.TableCell || element.type === _tableCell.TableHeader;
856
+ };
857
+ var addTableCellEdgePropsThroughWrappers = function addTableCellEdgePropsThroughWrappers(rows, tableNode, isNumberColumnEnabled) {
858
+ try {
859
+ if (!tableNode) {
860
+ return rows;
861
+ }
862
+ var cellEdgePropsByCellOffset = getCellEdgePropsByCellOffset(tableNode, isNumberColumnEnabled);
863
+ var cellOffset = 0;
864
+ return _react.default.Children.map(rows, function (row, rowIndex) {
865
+ var rowNode = tableNode.child(rowIndex);
866
+ cellOffset += 1;
867
+ var cellIndex = 0;
868
+ var _addEdgePropsToRenderedCells = function addEdgePropsToRenderedCells(element) {
869
+ if (isRenderedTableCell(element)) {
870
+ var cellNode = rowNode.child(cellIndex);
871
+ var edgeProps = cellEdgePropsByCellOffset.get(cellOffset);
872
+ cellIndex += 1;
873
+ cellOffset += cellNode.nodeSize;
874
+ return edgeProps ? /*#__PURE__*/_react.default.cloneElement(element, edgeProps) : element;
875
+ }
876
+ var _ref5 = element.props,
877
+ children = _ref5.children;
878
+ if (children === undefined) {
879
+ return element;
880
+ }
881
+ var childrenWithEdgeProps = _react.default.Children.map(children, function (child) {
882
+ return /*#__PURE__*/_react.default.isValidElement(child) ? _addEdgePropsToRenderedCells(child) : child;
883
+ });
884
+ return /*#__PURE__*/_react.default.cloneElement(element, undefined, childrenWithEdgeProps);
885
+ };
886
+ var rowWithEdgeProps = _addEdgePropsToRenderedCells(row);
887
+ if (cellIndex !== rowNode.childCount) {
888
+ throw new Error('Rendered table row does not match its document node');
889
+ }
890
+ cellOffset += 1;
891
+ return rowWithEdgeProps;
892
+ });
893
+ } catch (_unused) {
894
+ // Renderer can receive malformed historical ADF. If the table shape cannot
895
+ // be described safely, keep rendering without rounded edge metadata.
896
+ return rows;
897
+ }
898
+ };
852
899
  var addTableCellEdgeProps = function addTableCellEdgeProps(rows, tableNode, isNumberColumnEnabled) {
853
900
  try {
854
901
  if (!tableNode) {
@@ -873,7 +920,7 @@ var addTableCellEdgeProps = function addTableCellEdgeProps(rows, tableNode, isNu
873
920
  cellOffset += 1;
874
921
  return /*#__PURE__*/_react.default.cloneElement(row, undefined, rowChildren);
875
922
  });
876
- } catch (_unused) {
923
+ } catch (_unused2) {
877
924
  // Renderer can receive malformed historical ADF. If the table shape cannot
878
925
  // be described safely, keep rendering without rounded edge metadata.
879
926
  return rows;
@@ -969,7 +1016,7 @@ var TableProcessorWithContainerStyles = exports.TableProcessorWithContainerStyle
969
1016
  return null;
970
1017
  }
971
1018
  var childrenArray = _react.default.Children.toArray(children);
972
- var childrenWithTableEdgeProps = (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? addTableCellEdgeProps(childrenArray, tableNode, isNumberColumnEnabled) : childrenArray;
1019
+ var childrenWithTableEdgeProps = (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? (0, _expValEquals.expValEquals)('platform_editor_table_q4_patch_5', 'isEnabled', true) ? addTableCellEdgePropsThroughWrappers(childrenArray, tableNode, isNumberColumnEnabled) : addTableCellEdgeProps(childrenArray, tableNode, isNumberColumnEnabled) : childrenArray;
973
1020
  var orderedChildren = (0, _utils.compose)(this.addNumberColumnIndexes, this.addSortableColumn
974
1021
  // @ts-expect-error TS2345: Argument of type '(ReactChild | ReactFragment | ReactPortal)[]' is not assignable to parameter of type 'ReactElement<any, string | JSXElementConstructor<any>>[]'
975
1022
  )(childrenWithTableEdgeProps);
@@ -73,7 +73,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
73
73
  var TABLE_INFO_TIMEOUT = 10000;
74
74
  var RENDER_EVENT_SAMPLE_RATE = 0.1;
75
75
  var packageName = "@atlaskit/renderer";
76
- var packageVersion = "133.16.4";
76
+ var packageVersion = "133.16.6";
77
77
  var setAsQueryContainerStyles = (0, _react2.css)({
78
78
  containerName: 'ak-renderer-wrapper',
79
79
  containerType: 'inline-size'
@@ -10,7 +10,7 @@ import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMerged
10
10
  import { SortOrder } from '@atlaskit/editor-common/types';
11
11
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorMaxWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
12
12
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
13
- import { TableHeader } from './tableCell';
13
+ import { TableCell, TableHeader } from './tableCell';
14
14
  import { StickyTable, tableStickyPadding, OverflowParent } from './table/sticky';
15
15
  import { Table } from './table/table';
16
16
  import { isCommentAppearance, isFullWidthOrFullPageAppearance, isFullWidthAppearance, isMaxWidthAppearance, isFullPageAppearance } from '../utils/appearance';
@@ -790,6 +790,53 @@ const getCellEdgePropsByCellOffset = (tableNode, isNumberColumnEnabled) => {
790
790
  });
791
791
  return cellEdgePropsByCellOffset;
792
792
  };
793
+ const isRenderedTableCell = element => {
794
+ const {
795
+ nodeType
796
+ } = element.props;
797
+ return nodeType === 'tableCell' || nodeType === 'tableHeader' || element.type === TableCell || element.type === TableHeader;
798
+ };
799
+ const addTableCellEdgePropsThroughWrappers = (rows, tableNode, isNumberColumnEnabled) => {
800
+ try {
801
+ if (!tableNode) {
802
+ return rows;
803
+ }
804
+ const cellEdgePropsByCellOffset = getCellEdgePropsByCellOffset(tableNode, isNumberColumnEnabled);
805
+ let cellOffset = 0;
806
+ return React.Children.map(rows, (row, rowIndex) => {
807
+ const rowNode = tableNode.child(rowIndex);
808
+ cellOffset += 1;
809
+ let cellIndex = 0;
810
+ const addEdgePropsToRenderedCells = element => {
811
+ if (isRenderedTableCell(element)) {
812
+ const cellNode = rowNode.child(cellIndex);
813
+ const edgeProps = cellEdgePropsByCellOffset.get(cellOffset);
814
+ cellIndex += 1;
815
+ cellOffset += cellNode.nodeSize;
816
+ return edgeProps ? /*#__PURE__*/React.cloneElement(element, edgeProps) : element;
817
+ }
818
+ const {
819
+ children
820
+ } = element.props;
821
+ if (children === undefined) {
822
+ return element;
823
+ }
824
+ const childrenWithEdgeProps = React.Children.map(children, child => /*#__PURE__*/React.isValidElement(child) ? addEdgePropsToRenderedCells(child) : child);
825
+ return /*#__PURE__*/React.cloneElement(element, undefined, childrenWithEdgeProps);
826
+ };
827
+ const rowWithEdgeProps = addEdgePropsToRenderedCells(row);
828
+ if (cellIndex !== rowNode.childCount) {
829
+ throw new Error('Rendered table row does not match its document node');
830
+ }
831
+ cellOffset += 1;
832
+ return rowWithEdgeProps;
833
+ });
834
+ } catch {
835
+ // Renderer can receive malformed historical ADF. If the table shape cannot
836
+ // be described safely, keep rendering without rounded edge metadata.
837
+ return rows;
838
+ }
839
+ };
793
840
  const addTableCellEdgeProps = (rows, tableNode, isNumberColumnEnabled) => {
794
841
  try {
795
842
  if (!tableNode) {
@@ -906,7 +953,7 @@ export class TableProcessorWithContainerStyles extends React.Component {
906
953
  return null;
907
954
  }
908
955
  const childrenArray = React.Children.toArray(children);
909
- const childrenWithTableEdgeProps = expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? addTableCellEdgeProps(childrenArray, tableNode, isNumberColumnEnabled) : childrenArray;
956
+ const childrenWithTableEdgeProps = expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? expValEquals('platform_editor_table_q4_patch_5', 'isEnabled', true) ? addTableCellEdgePropsThroughWrappers(childrenArray, tableNode, isNumberColumnEnabled) : addTableCellEdgeProps(childrenArray, tableNode, isNumberColumnEnabled) : childrenArray;
910
957
  const orderedChildren = compose(this.addNumberColumnIndexes, this.addSortableColumn
911
958
  // @ts-expect-error TS2345: Argument of type '(ReactChild | ReactFragment | ReactPortal)[]' is not assignable to parameter of type 'ReactElement<any, string | JSXElementConstructor<any>>[]'
912
959
  )(childrenWithTableEdgeProps);
@@ -59,7 +59,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
59
59
  const TABLE_INFO_TIMEOUT = 10000;
60
60
  const RENDER_EVENT_SAMPLE_RATE = 0.1;
61
61
  const packageName = "@atlaskit/renderer";
62
- const packageVersion = "133.16.4";
62
+ const packageVersion = "133.16.6";
63
63
  const setAsQueryContainerStyles = css({
64
64
  containerName: 'ak-renderer-wrapper',
65
65
  containerType: 'inline-size'
@@ -23,7 +23,7 @@ import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMerged
23
23
  import { SortOrder } from '@atlaskit/editor-common/types';
24
24
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorMaxWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
25
25
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
26
- import { TableHeader } from './tableCell';
26
+ import { TableCell, TableHeader } from './tableCell';
27
27
  import { StickyTable, tableStickyPadding, OverflowParent } from './table/sticky';
28
28
  import { Table } from './table/table';
29
29
  import { isCommentAppearance, isFullWidthOrFullPageAppearance, isFullWidthAppearance, isMaxWidthAppearance, isFullPageAppearance } from '../utils/appearance';
@@ -843,6 +843,53 @@ var getCellEdgePropsByCellOffset = function getCellEdgePropsByCellOffset(tableNo
843
843
  });
844
844
  return cellEdgePropsByCellOffset;
845
845
  };
846
+ var isRenderedTableCell = function isRenderedTableCell(element) {
847
+ var _ref4 = element.props,
848
+ nodeType = _ref4.nodeType;
849
+ return nodeType === 'tableCell' || nodeType === 'tableHeader' || element.type === TableCell || element.type === TableHeader;
850
+ };
851
+ var addTableCellEdgePropsThroughWrappers = function addTableCellEdgePropsThroughWrappers(rows, tableNode, isNumberColumnEnabled) {
852
+ try {
853
+ if (!tableNode) {
854
+ return rows;
855
+ }
856
+ var cellEdgePropsByCellOffset = getCellEdgePropsByCellOffset(tableNode, isNumberColumnEnabled);
857
+ var cellOffset = 0;
858
+ return React.Children.map(rows, function (row, rowIndex) {
859
+ var rowNode = tableNode.child(rowIndex);
860
+ cellOffset += 1;
861
+ var cellIndex = 0;
862
+ var _addEdgePropsToRenderedCells = function addEdgePropsToRenderedCells(element) {
863
+ if (isRenderedTableCell(element)) {
864
+ var cellNode = rowNode.child(cellIndex);
865
+ var edgeProps = cellEdgePropsByCellOffset.get(cellOffset);
866
+ cellIndex += 1;
867
+ cellOffset += cellNode.nodeSize;
868
+ return edgeProps ? /*#__PURE__*/React.cloneElement(element, edgeProps) : element;
869
+ }
870
+ var _ref5 = element.props,
871
+ children = _ref5.children;
872
+ if (children === undefined) {
873
+ return element;
874
+ }
875
+ var childrenWithEdgeProps = React.Children.map(children, function (child) {
876
+ return /*#__PURE__*/React.isValidElement(child) ? _addEdgePropsToRenderedCells(child) : child;
877
+ });
878
+ return /*#__PURE__*/React.cloneElement(element, undefined, childrenWithEdgeProps);
879
+ };
880
+ var rowWithEdgeProps = _addEdgePropsToRenderedCells(row);
881
+ if (cellIndex !== rowNode.childCount) {
882
+ throw new Error('Rendered table row does not match its document node');
883
+ }
884
+ cellOffset += 1;
885
+ return rowWithEdgeProps;
886
+ });
887
+ } catch (_unused) {
888
+ // Renderer can receive malformed historical ADF. If the table shape cannot
889
+ // be described safely, keep rendering without rounded edge metadata.
890
+ return rows;
891
+ }
892
+ };
846
893
  var addTableCellEdgeProps = function addTableCellEdgeProps(rows, tableNode, isNumberColumnEnabled) {
847
894
  try {
848
895
  if (!tableNode) {
@@ -867,7 +914,7 @@ var addTableCellEdgeProps = function addTableCellEdgeProps(rows, tableNode, isNu
867
914
  cellOffset += 1;
868
915
  return /*#__PURE__*/React.cloneElement(row, undefined, rowChildren);
869
916
  });
870
- } catch (_unused) {
917
+ } catch (_unused2) {
871
918
  // Renderer can receive malformed historical ADF. If the table shape cannot
872
919
  // be described safely, keep rendering without rounded edge metadata.
873
920
  return rows;
@@ -963,7 +1010,7 @@ export var TableProcessorWithContainerStyles = /*#__PURE__*/function (_React$Com
963
1010
  return null;
964
1011
  }
965
1012
  var childrenArray = React.Children.toArray(children);
966
- var childrenWithTableEdgeProps = expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? addTableCellEdgeProps(childrenArray, tableNode, isNumberColumnEnabled) : childrenArray;
1013
+ var childrenWithTableEdgeProps = expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? expValEquals('platform_editor_table_q4_patch_5', 'isEnabled', true) ? addTableCellEdgePropsThroughWrappers(childrenArray, tableNode, isNumberColumnEnabled) : addTableCellEdgeProps(childrenArray, tableNode, isNumberColumnEnabled) : childrenArray;
967
1014
  var orderedChildren = compose(this.addNumberColumnIndexes, this.addSortableColumn
968
1015
  // @ts-expect-error TS2345: Argument of type '(ReactChild | ReactFragment | ReactPortal)[]' is not assignable to parameter of type 'ReactElement<any, string | JSXElementConstructor<any>>[]'
969
1016
  )(childrenWithTableEdgeProps);
@@ -64,7 +64,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
64
64
  var TABLE_INFO_TIMEOUT = 10000;
65
65
  var RENDER_EVENT_SAMPLE_RATE = 0.1;
66
66
  var packageName = "@atlaskit/renderer";
67
- var packageVersion = "133.16.4";
67
+ var packageVersion = "133.16.6";
68
68
  var setAsQueryContainerStyles = css({
69
69
  containerName: 'ak-renderer-wrapper',
70
70
  containerType: 'inline-size'
@@ -32,8 +32,8 @@ export type TableProps = SharedTableProps & {
32
32
  stickyHeaders?: StickyHeaderConfig;
33
33
  tableNode?: PMNode;
34
34
  };
35
- export declare const isHeaderRowEnabled: (rows: (React.ReactChild | React.ReactFragment | React.ReactPortal)[]) => any;
36
- export declare const tableCanBeSticky: (node: PMNode | undefined, children: (React.ReactChild | React.ReactFragment | React.ReactPortal)[]) => any;
35
+ export declare const isHeaderRowEnabled: (rows: (React.ReactElement | number | string | React.ReactFragment | React.ReactPortal)[]) => any;
36
+ export declare const tableCanBeSticky: (node: PMNode | undefined, children: (React.ReactElement | number | string | React.ReactFragment | React.ReactPortal)[]) => any;
37
37
  export interface TableOrderStatus {
38
38
  columnIndex: number;
39
39
  order: SortOrder;
@@ -31,8 +31,8 @@ export type TableProps = SharedTableProps & {
31
31
  stickyHeaders?: StickyHeaderConfig;
32
32
  tableNode?: PMNode;
33
33
  };
34
- export declare const isHeaderRowEnabled: (rows: (React.ReactChild | React.ReactFragment | React.ReactPortal)[]) => any;
35
- export declare const tableCanBeSticky: (node: PMNode | undefined, children: (React.ReactChild | React.ReactFragment | React.ReactPortal)[]) => any;
34
+ export declare const isHeaderRowEnabled: (rows: (React.ReactElement | number | string | React.ReactFragment | React.ReactPortal)[]) => any;
35
+ export declare const tableCanBeSticky: (node: PMNode | undefined, children: (React.ReactElement | number | string | React.ReactFragment | React.ReactPortal)[]) => any;
36
36
  export interface TableOrderStatus {
37
37
  columnIndex: number;
38
38
  order: SortOrder;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "133.16.5",
3
+ "version": "133.16.7",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -68,7 +68,7 @@
68
68
  "@atlaskit/status": "^5.7.0",
69
69
  "@atlaskit/task-decision": "^21.7.0",
70
70
  "@atlaskit/theme": "^26.1.0",
71
- "@atlaskit/tmp-editor-statsig": "^135.1.0",
71
+ "@atlaskit/tmp-editor-statsig": "^135.2.0",
72
72
  "@atlaskit/tokens": "^16.3.0",
73
73
  "@atlaskit/tooltip": "^23.2.0",
74
74
  "@atlaskit/visually-hidden": "^4.2.0",