@atlaskit/renderer 153.4.7 → 153.5.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.
- package/CHANGELOG.md +29 -0
- package/dist/cjs/react/nodes/table/colgroup.js +36 -16
- package/dist/cjs/react/nodes/table/table.js +16 -1
- package/dist/cjs/react/nodes/table.js +83 -18
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/annotations/contexts/AnnotationRangeContext.js +69 -7
- package/dist/cjs/ui/annotations/selection/mounter.js +31 -1
- package/dist/es2019/react/nodes/table/colgroup.js +34 -17
- package/dist/es2019/react/nodes/table/table.js +17 -2
- package/dist/es2019/react/nodes/table.js +70 -10
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/annotations/contexts/AnnotationRangeContext.js +73 -8
- package/dist/es2019/ui/annotations/selection/mounter.js +31 -1
- package/dist/esm/react/nodes/table/colgroup.js +36 -16
- package/dist/esm/react/nodes/table/table.js +17 -2
- package/dist/esm/react/nodes/table.js +79 -14
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/annotations/contexts/AnnotationRangeContext.js +69 -7
- package/dist/esm/ui/annotations/selection/mounter.js +31 -1
- package/dist/types/react/nodes/table/types.d.ts +3 -0
- package/dist/types/react/nodes/table.d.ts +2 -0
- package/dist/types/ui/annotations/contexts/AnnotationRangeContext.d.ts +22 -0
- package/package.json +10 -9
|
@@ -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
|
-
|
|
458
|
-
|
|
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
|
-
|
|
486
|
-
|
|
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
|
-
|
|
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.
|
|
72
|
+
var packageVersion = "153.5.0";
|
|
73
73
|
var setAsQueryContainerStyles = css({
|
|
74
74
|
containerName: 'ak-renderer-wrapper',
|
|
75
75
|
containerType: 'inline-size'
|
|
@@ -5,6 +5,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import React, { createContext, useCallback, useContext, useMemo, useReducer, useRef } from 'react';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* The range a draft should act on, published by the selection/hover mounters so the manager can
|
|
10
|
+
* resolve its target without reading the ambient `range`, which flips between selection and hover.
|
|
11
|
+
*/
|
|
12
|
+
|
|
8
13
|
// oxlint-disable-next-line eslint/no-redeclare
|
|
9
14
|
|
|
10
15
|
// oxlint-disable-next-line eslint/no-redeclare
|
|
@@ -16,7 +21,10 @@ var initialState = {
|
|
|
16
21
|
selectionDraftRange: null,
|
|
17
22
|
hoverDraftRange: null,
|
|
18
23
|
selectionDraftDocumentPosition: null,
|
|
19
|
-
hoverDraftDocumentPosition: null
|
|
24
|
+
hoverDraftDocumentPosition: null,
|
|
25
|
+
draftIntentSource: null,
|
|
26
|
+
selectionDraftTarget: null,
|
|
27
|
+
hoverDraftTarget: null
|
|
20
28
|
};
|
|
21
29
|
function reducer(state, action) {
|
|
22
30
|
switch (action.type) {
|
|
@@ -93,6 +101,27 @@ function reducer(state, action) {
|
|
|
93
101
|
});
|
|
94
102
|
}
|
|
95
103
|
return state;
|
|
104
|
+
case 'setDraftIntentSource':
|
|
105
|
+
if (state.draftIntentSource !== action.source) {
|
|
106
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
107
|
+
draftIntentSource: action.source
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return state;
|
|
111
|
+
case 'setSelectionDraftTarget':
|
|
112
|
+
if (state.selectionDraftTarget !== action.target) {
|
|
113
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
114
|
+
selectionDraftTarget: action.target
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
return state;
|
|
118
|
+
case 'setHoverDraftTarget':
|
|
119
|
+
if (state.hoverDraftTarget !== action.target) {
|
|
120
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
121
|
+
hoverDraftTarget: action.target
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return state;
|
|
96
125
|
}
|
|
97
126
|
}
|
|
98
127
|
export var AnnotationRangeStateContext = /*#__PURE__*/createContext({
|
|
@@ -101,7 +130,10 @@ export var AnnotationRangeStateContext = /*#__PURE__*/createContext({
|
|
|
101
130
|
selectionDraftRange: null,
|
|
102
131
|
hoverDraftRange: null,
|
|
103
132
|
selectionDraftDocumentPosition: null,
|
|
104
|
-
hoverDraftDocumentPosition: null
|
|
133
|
+
hoverDraftDocumentPosition: null,
|
|
134
|
+
draftIntentSource: null,
|
|
135
|
+
selectionDraftTarget: null,
|
|
136
|
+
hoverDraftTarget: null
|
|
105
137
|
});
|
|
106
138
|
export var AnnotationRangeDispatchContext = /*#__PURE__*/createContext({
|
|
107
139
|
clearSelectionRange: function clearSelectionRange() {},
|
|
@@ -110,7 +142,10 @@ export var AnnotationRangeDispatchContext = /*#__PURE__*/createContext({
|
|
|
110
142
|
promoteSelectionToDraft: function promoteSelectionToDraft() {},
|
|
111
143
|
promoteHoverToDraft: function promoteHoverToDraft() {},
|
|
112
144
|
clearSelectionDraft: function clearSelectionDraft() {},
|
|
113
|
-
clearHoverDraft: function clearHoverDraft() {}
|
|
145
|
+
clearHoverDraft: function clearHoverDraft() {},
|
|
146
|
+
setDraftIntentSource: function setDraftIntentSource() {},
|
|
147
|
+
setSelectionDraftTarget: function setSelectionDraftTarget() {},
|
|
148
|
+
setHoverDraftTarget: function setHoverDraftTarget() {}
|
|
114
149
|
});
|
|
115
150
|
export var AnnotationRangeProviderInner = function AnnotationRangeProviderInner(_ref) {
|
|
116
151
|
var children = _ref.children,
|
|
@@ -127,6 +162,9 @@ export var AnnotationRangeProviderInner = function AnnotationRangeProviderInner(
|
|
|
127
162
|
selectionDraftDocumentPosition = _useReducer2$.selectionDraftDocumentPosition,
|
|
128
163
|
hoverDraftRange = _useReducer2$.hoverDraftRange,
|
|
129
164
|
hoverDraftDocumentPosition = _useReducer2$.hoverDraftDocumentPosition,
|
|
165
|
+
draftIntentSource = _useReducer2$.draftIntentSource,
|
|
166
|
+
selectionDraftTarget = _useReducer2$.selectionDraftTarget,
|
|
167
|
+
hoverDraftTarget = _useReducer2$.hoverDraftTarget,
|
|
130
168
|
dispatch = _useReducer2[1];
|
|
131
169
|
var clearSelectionRange = useCallback(function () {
|
|
132
170
|
return dispatch({
|
|
@@ -194,6 +232,24 @@ export var AnnotationRangeProviderInner = function AnnotationRangeProviderInner(
|
|
|
194
232
|
type: 'clearHoverDraft'
|
|
195
233
|
});
|
|
196
234
|
}, []);
|
|
235
|
+
var setDraftIntentSource = useCallback(function (source) {
|
|
236
|
+
dispatch({
|
|
237
|
+
type: 'setDraftIntentSource',
|
|
238
|
+
source: source
|
|
239
|
+
});
|
|
240
|
+
}, []);
|
|
241
|
+
var setSelectionDraftTarget = useCallback(function (target) {
|
|
242
|
+
dispatch({
|
|
243
|
+
type: 'setSelectionDraftTarget',
|
|
244
|
+
target: target
|
|
245
|
+
});
|
|
246
|
+
}, []);
|
|
247
|
+
var setHoverDraftTarget = useCallback(function (target) {
|
|
248
|
+
dispatch({
|
|
249
|
+
type: 'setHoverDraftTarget',
|
|
250
|
+
target: target
|
|
251
|
+
});
|
|
252
|
+
}, []);
|
|
197
253
|
var stateData = useMemo(function () {
|
|
198
254
|
return {
|
|
199
255
|
// We techinically have two ranges, however we only want to expose one of them at a time, because only one draft
|
|
@@ -203,9 +259,12 @@ export var AnnotationRangeProviderInner = function AnnotationRangeProviderInner(
|
|
|
203
259
|
selectionDraftRange: selectionDraftRange,
|
|
204
260
|
hoverDraftRange: hoverDraftRange,
|
|
205
261
|
selectionDraftDocumentPosition: selectionDraftDocumentPosition,
|
|
206
|
-
hoverDraftDocumentPosition: hoverDraftDocumentPosition
|
|
262
|
+
hoverDraftDocumentPosition: hoverDraftDocumentPosition,
|
|
263
|
+
draftIntentSource: draftIntentSource,
|
|
264
|
+
selectionDraftTarget: selectionDraftTarget,
|
|
265
|
+
hoverDraftTarget: hoverDraftTarget
|
|
207
266
|
};
|
|
208
|
-
}, [selectionRange, hoverRange, type, selectionDraftRange, selectionDraftDocumentPosition, hoverDraftRange, hoverDraftDocumentPosition]);
|
|
267
|
+
}, [selectionRange, hoverRange, type, selectionDraftRange, selectionDraftDocumentPosition, hoverDraftRange, hoverDraftDocumentPosition, draftIntentSource, selectionDraftTarget, hoverDraftTarget]);
|
|
209
268
|
var dispatchData = useMemo(function () {
|
|
210
269
|
return {
|
|
211
270
|
clearSelectionRange: clearSelectionRange,
|
|
@@ -215,9 +274,12 @@ export var AnnotationRangeProviderInner = function AnnotationRangeProviderInner(
|
|
|
215
274
|
promoteSelectionToDraft: promoteSelectionToDraft,
|
|
216
275
|
promoteHoverToDraft: promoteHoverToDraft,
|
|
217
276
|
clearSelectionDraft: clearSelectionDraft,
|
|
218
|
-
clearHoverDraft: clearHoverDraft
|
|
277
|
+
clearHoverDraft: clearHoverDraft,
|
|
278
|
+
setDraftIntentSource: setDraftIntentSource,
|
|
279
|
+
setSelectionDraftTarget: setSelectionDraftTarget,
|
|
280
|
+
setHoverDraftTarget: setHoverDraftTarget
|
|
219
281
|
};
|
|
220
|
-
}, [allowCommentsOnMedia, extensionCommentsEnabled, clearSelectionRange, clearHoverRange, setSelectionRange, setHoverTarget, promoteSelectionToDraft, promoteHoverToDraft, clearSelectionDraft, clearHoverDraft]);
|
|
282
|
+
}, [allowCommentsOnMedia, extensionCommentsEnabled, clearSelectionRange, clearHoverRange, setSelectionRange, setHoverTarget, promoteSelectionToDraft, promoteHoverToDraft, clearSelectionDraft, clearHoverDraft, setDraftIntentSource, setSelectionDraftTarget, setHoverDraftTarget]);
|
|
221
283
|
return /*#__PURE__*/React.createElement(AnnotationRangeStateContext.Provider, {
|
|
222
284
|
value: stateData
|
|
223
285
|
}, /*#__PURE__*/React.createElement(AnnotationRangeDispatchContext.Provider, {
|
|
@@ -25,7 +25,9 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
25
25
|
generateIndexMatch = props.generateIndexMatch;
|
|
26
26
|
var _useAnnotationRangeDi = useAnnotationRangeDispatch(),
|
|
27
27
|
promoteSelectionToDraft = _useAnnotationRangeDi.promoteSelectionToDraft,
|
|
28
|
-
clearSelectionDraft = _useAnnotationRangeDi.clearSelectionDraft
|
|
28
|
+
clearSelectionDraft = _useAnnotationRangeDi.clearSelectionDraft,
|
|
29
|
+
setSelectionDraftTarget = _useAnnotationRangeDi.setSelectionDraftTarget,
|
|
30
|
+
setDraftIntentSource = _useAnnotationRangeDi.setDraftIntentSource;
|
|
29
31
|
var _useAnnotationRangeSt = useAnnotationRangeState(),
|
|
30
32
|
selectionDraftDocumentPosition = _useAnnotationRangeSt.selectionDraftDocumentPosition;
|
|
31
33
|
var actions = useContext(ActionsContext);
|
|
@@ -180,6 +182,34 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
180
182
|
removeDraftModeCallback();
|
|
181
183
|
onCloseProps();
|
|
182
184
|
}, [onCloseProps, removeDraftModeCallback, createAnalyticsEvent, inlineNodeTypes]);
|
|
185
|
+
|
|
186
|
+
// Publish the range this mounter owns, so a draft can be resolved against the surface the user
|
|
187
|
+
// engaged rather than the ambient range, which flips between selection and hover. During a draft
|
|
188
|
+
// the selection range has been promoted away, and skipping the publish then keeps the target a
|
|
189
|
+
// draft captured.
|
|
190
|
+
useEffect(function () {
|
|
191
|
+
if (!annotationManager || !range) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
setSelectionDraftTarget({
|
|
195
|
+
range: range,
|
|
196
|
+
documentPosition: documentPosition,
|
|
197
|
+
isAnnotationAllowed: isAnnotationAllowed,
|
|
198
|
+
source: 'selection'
|
|
199
|
+
});
|
|
200
|
+
setDraftIntentSource('selection');
|
|
201
|
+
}, [annotationManager, range, documentPosition, isAnnotationAllowed, setSelectionDraftTarget, setDraftIntentSource]);
|
|
202
|
+
|
|
203
|
+
// Unmounting means the selection was cleared, so drop the published target.
|
|
204
|
+
useEffect(function () {
|
|
205
|
+
return function () {
|
|
206
|
+
if (annotationManager) {
|
|
207
|
+
setSelectionDraftTarget(null);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
// Cleanup on unmount only; both dependencies are stable for this component's lifetime.
|
|
211
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
212
|
+
}, []);
|
|
183
213
|
useEffect(function () {
|
|
184
214
|
if (annotationManager) {
|
|
185
215
|
var allowAnnotation = function allowAnnotation() {
|
|
@@ -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
|
*
|
|
@@ -2,9 +2,26 @@ import type { ReactNode } from 'react';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { Position } from '../types';
|
|
4
4
|
export type RangeType = 'selection' | 'hover' | null;
|
|
5
|
+
/**
|
|
6
|
+
* The range a draft should act on, published by the selection/hover mounters so the manager can
|
|
7
|
+
* resolve its target without reading the ambient `range`, which flips between selection and hover.
|
|
8
|
+
*/
|
|
9
|
+
export type DraftTarget = {
|
|
10
|
+
documentPosition: Position | false;
|
|
11
|
+
isAnnotationAllowed: boolean;
|
|
12
|
+
/** A block node carrying a node mark, so its position is collapsed, not a text range. */
|
|
13
|
+
isBlockNode?: boolean;
|
|
14
|
+
range: Range | null;
|
|
15
|
+
/** The range the target came from: a draft promotes and clears the draft state of its source. */
|
|
16
|
+
source?: Exclude<RangeType, null>;
|
|
17
|
+
};
|
|
5
18
|
interface AnnotationRangeStateContext {
|
|
19
|
+
/** Which surface the user engaged, tracked explicitly so a transient hover cannot win. */
|
|
20
|
+
draftIntentSource: RangeType;
|
|
6
21
|
hoverDraftDocumentPosition: Position | null;
|
|
7
22
|
hoverDraftRange: Range | null;
|
|
23
|
+
/** The live hover draft target (media). */
|
|
24
|
+
hoverDraftTarget: DraftTarget | null;
|
|
8
25
|
/**
|
|
9
26
|
* This range represents the selection that the user has made before they intend to save an annotation
|
|
10
27
|
*/
|
|
@@ -19,6 +36,8 @@ interface AnnotationRangeStateContext {
|
|
|
19
36
|
* If the user does not set allowDraftMode, this will be ignored as it only is set when we call applyAnnotationDraftAt()
|
|
20
37
|
*/
|
|
21
38
|
selectionDraftRange: Range | null;
|
|
39
|
+
/** The live selection draft target, read by `startDraft`. */
|
|
40
|
+
selectionDraftTarget: DraftTarget | null;
|
|
22
41
|
/**
|
|
23
42
|
* This represents the type of range that is currently set on the range property, ie, whether the range is a hover or selection.
|
|
24
43
|
*/
|
|
@@ -31,7 +50,10 @@ interface AnnotationRangeDispatchContext {
|
|
|
31
50
|
clearSelectionRange: () => void;
|
|
32
51
|
promoteHoverToDraft: (position: Position | null) => void;
|
|
33
52
|
promoteSelectionToDraft: (position: Position | null) => void;
|
|
53
|
+
setDraftIntentSource: (source: RangeType) => void;
|
|
54
|
+
setHoverDraftTarget: (target: DraftTarget | null) => void;
|
|
34
55
|
setHoverTarget?: (target: HTMLElement) => void;
|
|
56
|
+
setSelectionDraftTarget: (target: DraftTarget | null) => void;
|
|
35
57
|
setSelectionRange: (range: Range) => void;
|
|
36
58
|
}
|
|
37
59
|
export declare const AnnotationRangeStateContext: React.Context<AnnotationRangeStateContext>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "153.
|
|
3
|
+
"version": "153.5.1",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@atlaskit/editor-smart-link-draggable": "^1.2.0",
|
|
52
52
|
"@atlaskit/emoji": "^73.6.0",
|
|
53
53
|
"@atlaskit/feature-gate-js-client": "^8.0.0",
|
|
54
|
-
"@atlaskit/icon": "^38.
|
|
54
|
+
"@atlaskit/icon": "^38.1.0",
|
|
55
55
|
"@atlaskit/link": "^5.1.0",
|
|
56
56
|
"@atlaskit/link-datasource": "^7.13.0",
|
|
57
57
|
"@atlaskit/link-extractors": "^5.0.0",
|
|
@@ -67,12 +67,12 @@
|
|
|
67
67
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
68
68
|
"@atlaskit/platform-feature-flags-react": "^1.2.0",
|
|
69
69
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
70
|
-
"@atlaskit/react-ufo": "^8.
|
|
70
|
+
"@atlaskit/react-ufo": "^8.5.0",
|
|
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": "^
|
|
75
|
-
"@atlaskit/tokens": "^20.
|
|
74
|
+
"@atlaskit/tmp-editor-statsig": "^263.0.0",
|
|
75
|
+
"@atlaskit/tokens": "^20.12.0",
|
|
76
76
|
"@atlaskit/tooltip": "^24.4.0",
|
|
77
77
|
"@atlaskit/visually-hidden": "^4.4.0",
|
|
78
78
|
"@babel/runtime": "^7.0.0",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"uuid": "^11.1.1"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
|
-
"@atlaskit/editor-common": "^134.
|
|
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.
|
|
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,11 +110,11 @@
|
|
|
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.
|
|
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",
|
|
117
|
-
"@atlaskit/profilecard": "^27.
|
|
117
|
+
"@atlaskit/profilecard": "^27.10.0",
|
|
118
118
|
"@atlaskit/radio": "^10.2.0",
|
|
119
119
|
"@atlaskit/range": "^12.2.0",
|
|
120
120
|
"@atlaskit/section-message": "^10.3.0",
|
|
@@ -127,6 +127,7 @@
|
|
|
127
127
|
"@atlassian/a11y-playwright-testing": "^0.13.0",
|
|
128
128
|
"@atlassian/experiment-test-utils": "^0.2.0",
|
|
129
129
|
"@atlassian/feature-flags-test-utils": "^1.3.0",
|
|
130
|
+
"@atlassian/relay-test-utils": "workspace:^",
|
|
130
131
|
"@atlassian/structured-docs-types": "workspace:^",
|
|
131
132
|
"@atlassian/testing-library": "^0.12.0",
|
|
132
133
|
"@atlassian/workbench": "workspace:*",
|