@atlaskit/renderer 133.16.1 → 133.16.2

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,13 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 133.16.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8e4275326153d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8e4275326153d) -
8
+ [ux] Fixes an issue where heading couldn't collapse when sync blocks is partially visible.
9
+ - Updated dependencies
10
+
3
11
  ## 133.16.1
4
12
 
5
13
  ### Patch Changes
@@ -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.0";
76
+ var packageVersion = "133.16.1";
77
77
  var setAsQueryContainerStyles = (0, _react2.css)({
78
78
  containerName: 'ak-renderer-wrapper',
79
79
  containerType: 'inline-size'
@@ -16,6 +16,10 @@ var _collapsibleHeadingsSectionModel = require("./collapsible-headings-section-m
16
16
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
17
17
  var CollapsibleHeadingsContext = /*#__PURE__*/_react.default.createContext(null);
18
18
  var emptyCollapsedHeadings = new Set();
19
+ function isSameDocument(currentDocument, nextDocument) {
20
+ // Renderer reparses equivalent ADF on parent rerenders, so object identity is not stable.
21
+ return currentDocument === nextDocument || Boolean(currentDocument && nextDocument && currentDocument.eq(nextDocument));
22
+ }
19
23
  function supportsHiddenUntilFound(rendererRef) {
20
24
  var _rendererRef$current;
21
25
  var body = (_rendererRef$current = rendererRef.current) === null || _rendererRef$current === void 0 ? void 0 : _rendererRef$current.ownerDocument.body;
@@ -50,16 +54,18 @@ function CollapsibleHeadingsProvider(_ref) {
50
54
  return section.headingPos;
51
55
  }));
52
56
  }, [sections]);
53
- var collapsedHeadings = state.pmDocument === pmDocument ? state.positions : emptyCollapsedHeadings;
57
+ var isCurrentDocument = isSameDocument(state.pmDocument, pmDocument);
58
+ var collapsedHeadings = isCurrentDocument ? state.positions : emptyCollapsedHeadings;
54
59
  var isActive = isEnabled && isBrowserFindSupported && Boolean(pmDocument);
55
60
  (0, _react.useEffect)(function () {
56
61
  setIsBrowserFindSupported(isEnabled && supportsHiddenUntilFound(rendererRef));
57
62
  }, [isEnabled, rendererRef]);
58
63
  var updateCollapsedHeadings = (0, _react.useCallback)(function (update) {
59
64
  setState(function (currentState) {
60
- var positions = new Set(currentState.pmDocument === pmDocument ? currentState.positions : emptyCollapsedHeadings);
65
+ var isStillCurrentDocument = isSameDocument(currentState.pmDocument, pmDocument);
66
+ var positions = new Set(isStillCurrentDocument ? currentState.positions : emptyCollapsedHeadings);
61
67
  if (!update(positions)) {
62
- return currentState.pmDocument === pmDocument ? currentState : {
68
+ return isStillCurrentDocument ? currentState : {
63
69
  pmDocument: pmDocument,
64
70
  positions: positions
65
71
  };
@@ -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.0";
62
+ const packageVersion = "133.16.1";
63
63
  const setAsQueryContainerStyles = css({
64
64
  containerName: 'ak-renderer-wrapper',
65
65
  containerType: 'inline-size'
@@ -4,6 +4,10 @@ import { COLLAPSED_CONTENT_OWNERS_ATTRIBUTE, getCollapsedContentOwners, getOwned
4
4
  import { buildTopLevelHeadingSections } from './collapsible-headings-section-model';
5
5
  const CollapsibleHeadingsContext = /*#__PURE__*/React.createContext(null);
6
6
  const emptyCollapsedHeadings = new Set();
7
+ function isSameDocument(currentDocument, nextDocument) {
8
+ // Renderer reparses equivalent ADF on parent rerenders, so object identity is not stable.
9
+ return currentDocument === nextDocument || Boolean(currentDocument && nextDocument && currentDocument.eq(nextDocument));
10
+ }
7
11
  function supportsHiddenUntilFound(rendererRef) {
8
12
  var _rendererRef$current;
9
13
  const body = (_rendererRef$current = rendererRef.current) === null || _rendererRef$current === void 0 ? void 0 : _rendererRef$current.ownerDocument.body;
@@ -25,16 +29,18 @@ export function CollapsibleHeadingsProvider({
25
29
  const originalHiddenAttributes = React.useRef(new WeakMap()).current;
26
30
  const sections = useMemo(() => buildTopLevelHeadingSections(pmDocument), [pmDocument]);
27
31
  const collapsibleSectionPositions = useMemo(() => new Set(sections.filter(section => section.contentFrom < section.to).map(section => section.headingPos)), [sections]);
28
- const collapsedHeadings = state.pmDocument === pmDocument ? state.positions : emptyCollapsedHeadings;
32
+ const isCurrentDocument = isSameDocument(state.pmDocument, pmDocument);
33
+ const collapsedHeadings = isCurrentDocument ? state.positions : emptyCollapsedHeadings;
29
34
  const isActive = isEnabled && isBrowserFindSupported && Boolean(pmDocument);
30
35
  useEffect(() => {
31
36
  setIsBrowserFindSupported(isEnabled && supportsHiddenUntilFound(rendererRef));
32
37
  }, [isEnabled, rendererRef]);
33
38
  const updateCollapsedHeadings = useCallback(update => {
34
39
  setState(currentState => {
35
- const positions = new Set(currentState.pmDocument === pmDocument ? currentState.positions : emptyCollapsedHeadings);
40
+ const isStillCurrentDocument = isSameDocument(currentState.pmDocument, pmDocument);
41
+ const positions = new Set(isStillCurrentDocument ? currentState.positions : emptyCollapsedHeadings);
36
42
  if (!update(positions)) {
37
- return currentState.pmDocument === pmDocument ? currentState : {
43
+ return isStillCurrentDocument ? currentState : {
38
44
  pmDocument,
39
45
  positions
40
46
  };
@@ -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.0";
67
+ var packageVersion = "133.16.1";
68
68
  var setAsQueryContainerStyles = css({
69
69
  containerName: 'ak-renderer-wrapper',
70
70
  containerType: 'inline-size'
@@ -5,6 +5,10 @@ import { COLLAPSED_CONTENT_OWNERS_ATTRIBUTE, getCollapsedContentOwners, getOwned
5
5
  import { buildTopLevelHeadingSections } from './collapsible-headings-section-model';
6
6
  var CollapsibleHeadingsContext = /*#__PURE__*/React.createContext(null);
7
7
  var emptyCollapsedHeadings = new Set();
8
+ function isSameDocument(currentDocument, nextDocument) {
9
+ // Renderer reparses equivalent ADF on parent rerenders, so object identity is not stable.
10
+ return currentDocument === nextDocument || Boolean(currentDocument && nextDocument && currentDocument.eq(nextDocument));
11
+ }
8
12
  function supportsHiddenUntilFound(rendererRef) {
9
13
  var _rendererRef$current;
10
14
  var body = (_rendererRef$current = rendererRef.current) === null || _rendererRef$current === void 0 ? void 0 : _rendererRef$current.ownerDocument.body;
@@ -39,16 +43,18 @@ export function CollapsibleHeadingsProvider(_ref) {
39
43
  return section.headingPos;
40
44
  }));
41
45
  }, [sections]);
42
- var collapsedHeadings = state.pmDocument === pmDocument ? state.positions : emptyCollapsedHeadings;
46
+ var isCurrentDocument = isSameDocument(state.pmDocument, pmDocument);
47
+ var collapsedHeadings = isCurrentDocument ? state.positions : emptyCollapsedHeadings;
43
48
  var isActive = isEnabled && isBrowserFindSupported && Boolean(pmDocument);
44
49
  useEffect(function () {
45
50
  setIsBrowserFindSupported(isEnabled && supportsHiddenUntilFound(rendererRef));
46
51
  }, [isEnabled, rendererRef]);
47
52
  var updateCollapsedHeadings = useCallback(function (update) {
48
53
  setState(function (currentState) {
49
- var positions = new Set(currentState.pmDocument === pmDocument ? currentState.positions : emptyCollapsedHeadings);
54
+ var isStillCurrentDocument = isSameDocument(currentState.pmDocument, pmDocument);
55
+ var positions = new Set(isStillCurrentDocument ? currentState.positions : emptyCollapsedHeadings);
50
56
  if (!update(positions)) {
51
- return currentState.pmDocument === pmDocument ? currentState : {
57
+ return isStillCurrentDocument ? currentState : {
52
58
  pmDocument: pmDocument,
53
59
  positions: positions
54
60
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "133.16.1",
3
+ "version": "133.16.2",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -49,7 +49,7 @@
49
49
  "@atlaskit/feature-gate-js-client": "^6.0.0",
50
50
  "@atlaskit/icon": "^37.1.0",
51
51
  "@atlaskit/link": "^4.3.0",
52
- "@atlaskit/link-datasource": "^6.2.0",
52
+ "@atlaskit/link-datasource": "^6.3.0",
53
53
  "@atlaskit/link-extractors": "^3.2.0",
54
54
  "@atlaskit/linking-common": "^11.0.0",
55
55
  "@atlaskit/media-card": "^81.4.0",
@@ -64,11 +64,11 @@
64
64
  "@atlaskit/pragmatic-drag-and-drop": "^2.0.0",
65
65
  "@atlaskit/react-compiler-gating": "^0.2.0",
66
66
  "@atlaskit/react-ufo": "^7.3.0",
67
- "@atlaskit/smart-card": "^45.12.0",
67
+ "@atlaskit/smart-card": "^45.13.0",
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": "^133.0.0",
71
+ "@atlaskit/tmp-editor-statsig": "^133.1.0",
72
72
  "@atlaskit/tokens": "^16.3.0",
73
73
  "@atlaskit/tooltip": "^23.1.0",
74
74
  "@atlaskit/visually-hidden": "^4.2.0",