@atlaskit/renderer 153.5.0 → 153.6.0

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.
@@ -16,6 +16,8 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
16
16
  /* eslint-disable @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/enforce-style-prop, @repo/internal/react/no-class-components */
17
17
 
18
18
  import React from 'react';
19
+ import { IntlContext } from 'react-intl';
20
+ import { messages } from '@atlaskit/editor-common/messages/table';
19
21
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
20
22
  import overflowShadow from '@atlaskit/editor-common/OverflowShadow';
21
23
  import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
@@ -222,6 +224,9 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
222
224
  _defineProperty(_this, "lastComputedStyle", {});
223
225
  _defineProperty(_this, "resizeObserver", null);
224
226
  _defineProperty(_this, "applyResizerChange", function (entries) {
227
+ if (_this.props.isPerformanceModeActive) {
228
+ return;
229
+ }
225
230
  var wrapperWidth = _this.state.wrapperWidth;
226
231
  var headerRowHeight = _this.state.headerRowHeight;
227
232
  var _iterator = _createForOfIteratorHelper(entries),
@@ -288,6 +293,9 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
288
293
  return (_this.overflowParent ? _this.overflowParent.top : 0) + offsetTop;
289
294
  });
290
295
  _defineProperty(_this, "updateSticky", function () {
296
+ if (_this.props.isPerformanceModeActive) {
297
+ return;
298
+ }
291
299
  var tableElem = _this.tableRef.current;
292
300
  var refElem = _this.stickyHeaderRef.current;
293
301
  if (!tableElem || !refElem) {
@@ -317,6 +325,12 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
317
325
  }
318
326
  });
319
327
  _defineProperty(_this, "onWrapperScrolled", function () {
328
+ if (_this.props.isPerformanceModeActive) {
329
+ if (_this.wrapperRef.current && _this.stickyScrollbarRef.current) {
330
+ _this.stickyScrollbarRef.current.scrollLeft = _this.wrapperRef.current.scrollLeft;
331
+ }
332
+ return;
333
+ }
320
334
  if (!_this.wrapperRef.current || !_this.stickyWrapperRef.current) {
321
335
  return;
322
336
  }
@@ -454,17 +468,12 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
454
468
  * @example
455
469
  */
456
470
  function componentDidMount() {
457
- this.resizeObserver = new ResizeObserver(this.applyResizerChange);
458
- if (this.wrapperRef.current) {
459
- this.resizeObserver.observe(this.wrapperRef.current);
460
- }
461
- if (this.stickyHeaderRef.current) {
462
- this.resizeObserver.observe(this.stickyHeaderRef.current);
471
+ if (!this.props.isPerformanceModeActive) {
472
+ this.observeDimensions();
463
473
  }
464
474
  if (this.props.stickyHeaders) {
465
475
  var _this$props$stickyHea;
466
476
  this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea = this.props.stickyHeaders) === null || _this$props$stickyHea === void 0 ? void 0 : _this$props$stickyHea.defaultScrollRootId_DO_NOT_USE);
467
- // Ignored via go/ees005
468
477
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
469
478
  this.overflowParent.addEventListener('scroll', this.onScroll);
470
479
  }
@@ -473,7 +482,20 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
473
482
  }
474
483
  this.applyNestedRendererTableFix();
475
484
  }
476
-
485
+ }, {
486
+ key: "observeDimensions",
487
+ value: function observeDimensions() {
488
+ this.resizeObserver = new ResizeObserver(this.applyResizerChange);
489
+ if (this.wrapperRef.current) {
490
+ this.resizeObserver.observe(this.wrapperRef.current);
491
+ }
492
+ if (this.stickyHeaderRef.current) {
493
+ this.resizeObserver.observe(this.stickyHeaderRef.current);
494
+ }
495
+ }
496
+ }, {
497
+ key: "componentDidUpdate",
498
+ value:
477
499
  /**
478
500
  * Updates sticky header wiring and scroll synchronization after prop or state changes.
479
501
  *
@@ -481,13 +503,28 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
481
503
  * @param prevState
482
504
  * @example
483
505
  */
484
- }, {
485
- key: "componentDidUpdate",
486
- value: function componentDidUpdate(prevProps, prevState) {
506
+ function componentDidUpdate(prevProps, prevState) {
507
+ if (this.props.isPerformanceModeActive !== prevProps.isPerformanceModeActive) {
508
+ if (this.props.isPerformanceModeActive) {
509
+ var _this$resizeObserver;
510
+ (_this$resizeObserver = this.resizeObserver) === null || _this$resizeObserver === void 0 || _this$resizeObserver.disconnect();
511
+ this.resizeObserver = null;
512
+ if (this.nextFrame) {
513
+ cancelAnimationFrame(this.nextFrame);
514
+ this.nextFrame = undefined;
515
+ }
516
+ } else if (prevProps.isPerformanceModeActive) {
517
+ this.observeDimensions();
518
+ }
519
+ }
487
520
  // toggling sticky headers visiblity
488
521
  if (this.props.stickyHeaders && !this.overflowParent) {
489
522
  var _this$props$stickyHea2;
490
523
  this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea2 = this.props.stickyHeaders) === null || _this$props$stickyHea2 === void 0 ? void 0 : _this$props$stickyHea2.defaultScrollRootId_DO_NOT_USE);
524
+ if (prevProps.isPerformanceModeActive) {
525
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
526
+ this.overflowParent.addEventListener('scroll', this.onScroll);
527
+ }
491
528
  } else if (!this.props.stickyHeaders && this.overflowParent) {
492
529
  // Ignored via go/ees005
493
530
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
@@ -720,7 +757,10 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
720
757
  "data-table-local-id": tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.localId,
721
758
  "data-table-width": tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width,
722
759
  "data-vc": "table-node-wrapper",
723
- onScroll: this.props.stickyHeaders && this.onWrapperScrolled
760
+ tabIndex: this.props.isPerformanceModeActive ? 0 : undefined,
761
+ role: this.props.isPerformanceModeActive ? 'region' : undefined,
762
+ "aria-label": this.props.isPerformanceModeActive ? this.props.scrollRegionLabel : undefined,
763
+ onScroll: (this.props.isPerformanceModeActive || this.props.stickyHeaders) && this.onWrapperScrolled
724
764
  }, /*#__PURE__*/React.createElement(Table, {
725
765
  innerRef: this.tableRef,
726
766
  columnWidths: columnWidths,
@@ -756,6 +796,16 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
756
796
  isNumberColumnEnabled: isNumberColumnEnabled
757
797
  })));
758
798
  }
799
+ }], [{
800
+ key: "getDerivedStateFromProps",
801
+ value: function getDerivedStateFromProps(props, state) {
802
+ if (props.isPerformanceModeActive && state.stickyMode !== 'none') {
803
+ return {
804
+ stickyMode: 'none'
805
+ };
806
+ }
807
+ return null;
808
+ }
759
809
  }]);
760
810
  }(React.Component);
761
811
  var getCellEdgePropsByCellOffset = function getCellEdgePropsByCellOffset(tableNode, isNumberColumnEnabled) {
@@ -948,6 +998,8 @@ export var TableProcessorWithContainerStyles = /*#__PURE__*/function (_React$Com
948
998
  isNumberColumnEnabled = _this$props2.isNumberColumnEnabled,
949
999
  isPresentational = _this$props2.isPresentational,
950
1000
  layout = _this$props2.layout,
1001
+ isPerformanceModeActive = _this$props2.isPerformanceModeActive,
1002
+ scrollRegionLabel = _this$props2.scrollRegionLabel,
951
1003
  rendererAppearance = _this$props2.rendererAppearance,
952
1004
  renderWidth = _this$props2.renderWidth,
953
1005
  shadowClassNames = _this$props2.shadowClassNames,
@@ -977,6 +1029,8 @@ export var TableProcessorWithContainerStyles = /*#__PURE__*/function (_React$Com
977
1029
  isInsideOfTable: isInsideOfTable,
978
1030
  isNumberColumnEnabled: isNumberColumnEnabled,
979
1031
  isPresentational: isPresentational,
1032
+ isPerformanceModeActive: isPerformanceModeActive,
1033
+ scrollRegionLabel: scrollRegionLabel,
980
1034
  layout: layout,
981
1035
  rendererAppearance: rendererAppearance,
982
1036
  renderWidth: renderWidth,
@@ -1001,10 +1055,14 @@ var TableWithShadowsAndContainerStyles = overflowShadow(TableProcessorWithContai
1001
1055
  useShadowObserver: true
1002
1056
  });
1003
1057
  var TableWithWidth = function TableWithWidth(props) {
1004
- var _props$columnWidths;
1058
+ var _intl$formatMessage, _props$columnWidths;
1005
1059
  var _useRendererContext2 = useRendererContext(),
1006
- isTopLevelRenderer = _useRendererContext2.isTopLevelRenderer;
1060
+ isTopLevelRenderer = _useRendererContext2.isTopLevelRenderer,
1061
+ _useRendererContext2$ = _useRendererContext2.isPerformanceModeActive,
1062
+ isPerformanceModeActive = _useRendererContext2$ === void 0 ? false : _useRendererContext2$;
1063
+ var intl = React.useContext(IntlContext);
1007
1064
  var isInsideOfNestedRenderer = isTopLevelRenderer === false;
1065
+ var scrollRegionLabel = isPerformanceModeActive ? (_intl$formatMessage = intl === null || intl === void 0 ? void 0 : intl.formatMessage(messages.tableScrollRegion)) !== null && _intl$formatMessage !== void 0 ? _intl$formatMessage : messages.tableScrollRegion.defaultMessage : undefined;
1008
1066
  var colWidthsSum =
1009
1067
  // eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- Ignored via go/ees017 (to be fixed)
1010
1068
  ((_props$columnWidths = props.columnWidths) === null || _props$columnWidths === void 0 ? void 0 : _props$columnWidths.reduce(function (total, val) {
@@ -1015,6 +1073,10 @@ var TableWithWidth = function TableWithWidth(props) {
1015
1073
  // Ignored via go/ees005
1016
1074
  // eslint-disable-next-line react/jsx-props-no-spreading
1017
1075
  , _extends({}, props, {
1076
+ isPerformanceModeActive: isPerformanceModeActive,
1077
+ scrollRegionLabel: scrollRegionLabel,
1078
+ stickyHeaders: isPerformanceModeActive ? undefined : props.stickyHeaders,
1079
+ disableShadowTracking: isPerformanceModeActive,
1018
1080
  isInsideOfNestedRenderer: isInsideOfNestedRenderer
1019
1081
  }));
1020
1082
  }
@@ -1022,6 +1084,9 @@ var TableWithWidth = function TableWithWidth(props) {
1022
1084
  // Ignored via go/ees005
1023
1085
  // eslint-disable-next-line react/jsx-props-no-spreading
1024
1086
  , _extends({}, props, {
1087
+ isPerformanceModeActive: isPerformanceModeActive,
1088
+ scrollRegionLabel: scrollRegionLabel,
1089
+ stickyHeaders: isPerformanceModeActive ? undefined : props.stickyHeaders,
1025
1090
  isInsideOfNestedRenderer: isInsideOfNestedRenderer
1026
1091
  }));
1027
1092
  };
@@ -69,7 +69,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
69
69
  var TABLE_INFO_TIMEOUT = 10000;
70
70
  var RENDER_EVENT_SAMPLE_RATE = 0.1;
71
71
  var packageName = "@atlaskit/renderer";
72
- var packageVersion = "153.4.7";
72
+ var packageVersion = "153.5.1";
73
73
  var setAsQueryContainerStyles = css({
74
74
  containerName: 'ak-renderer-wrapper',
75
75
  containerType: 'inline-size'
@@ -8,7 +8,8 @@ interface Props {
8
8
  localId: string;
9
9
  preserveContentUntilReady?: boolean;
10
10
  result: ReactNode;
11
+ suppressInitialFallback?: boolean;
11
12
  }
12
13
  /** Keep the native body in layout until Forge finishes its initial rendering. */
13
- export default function ForgeBodiedExtensionHandoff({ fallback, localId, result, preserveContentUntilReady, }: Props): ReactElement;
14
+ export default function ForgeBodiedExtensionHandoff({ fallback, localId, result, preserveContentUntilReady, suppressInitialFallback, }: Props): ReactElement;
14
15
  export {};
@@ -32,6 +32,8 @@ interface Props {
32
32
  serializer: Serializer<any>;
33
33
  shouldDisplayExtensionAsInline?: (extensionParams?: ExtensionParams<Parameters>) => boolean;
34
34
  startPos: number;
35
+ /** Omit the raw SSR body until the initial app handoff. Later fallbacks and app input are unchanged. */
36
+ suppressInitialFallback?: boolean;
35
37
  }
36
38
  declare const BodiedExtension: (props: React.PropsWithChildren<Props>) => React.JSX.Element;
37
39
  export default BodiedExtension;
@@ -10,8 +10,11 @@ export type SharedTableProps = {
10
10
  isInsideOfNestedRenderer?: boolean;
11
11
  isInsideOfTable?: boolean;
12
12
  isNumberColumnEnabled: boolean;
13
+ isPerformanceModeActive?: boolean;
13
14
  layout: TableLayout;
14
15
  rendererAppearance: RendererAppearance;
15
16
  renderWidth: number;
17
+ scrollRegionLabel?: string;
16
18
  tableNode?: PMNode;
19
+ tableWidth?: number;
17
20
  };
@@ -93,6 +93,8 @@ export declare class TableContainer extends React.Component<TableProps & Overflo
93
93
  * @example
94
94
  */
95
95
  componentDidMount(): void;
96
+ private observeDimensions;
97
+ static getDerivedStateFromProps(props: TableProps, state: TableState): Partial<TableState> | null;
96
98
  /**
97
99
  * Updates sticky header wiring and scroll synchronization after prop or state changes.
98
100
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "153.5.0",
3
+ "version": "153.6.0",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -71,7 +71,7 @@
71
71
  "@atlaskit/smart-card": "^46.14.0",
72
72
  "@atlaskit/status": "^5.17.0",
73
73
  "@atlaskit/task-decision": "^21.16.0",
74
- "@atlaskit/tmp-editor-statsig": "^262.0.0",
74
+ "@atlaskit/tmp-editor-statsig": "^263.0.0",
75
75
  "@atlaskit/tokens": "^20.12.0",
76
76
  "@atlaskit/tooltip": "^24.4.0",
77
77
  "@atlaskit/visually-hidden": "^4.4.0",
@@ -86,7 +86,7 @@
86
86
  "uuid": "^11.1.1"
87
87
  },
88
88
  "peerDependencies": {
89
- "@atlaskit/editor-common": "^134.19.0",
89
+ "@atlaskit/editor-common": "^134.20.0",
90
90
  "@atlaskit/link-provider": "^6.1.0",
91
91
  "@atlaskit/media-core": "^39.0.0",
92
92
  "react": "^18.2.0 || ^19.2.0",
@@ -98,7 +98,7 @@
98
98
  "@af/visual-regression": "workspace:^",
99
99
  "@atlaskit/analytics-gas-types": "^6.2.0",
100
100
  "@atlaskit/checkbox": "^19.3.0",
101
- "@atlaskit/editor-common": "^134.19.0",
101
+ "@atlaskit/editor-common": "^134.20.0",
102
102
  "@atlaskit/editor-plugin-media": "^32.4.0",
103
103
  "@atlaskit/editor-test-helpers": "workspace:^",
104
104
  "@atlaskit/inline-edit": "^16.5.0",
@@ -110,7 +110,7 @@
110
110
  "@atlaskit/media-integration-test-helpers": "workspace:^",
111
111
  "@atlaskit/media-state": "^4.0.0",
112
112
  "@atlaskit/media-test-helpers": "^43.0.0",
113
- "@atlaskit/mention": "^30.9.0",
113
+ "@atlaskit/mention": "^30.10.0",
114
114
  "@atlaskit/modal-dialog": "^17.2.0",
115
115
  "@atlaskit/navigation-system": "^11.7.0",
116
116
  "@atlaskit/primitives": "^22.7.0",