@atlaskit/renderer 115.0.5 → 115.1.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.
Files changed (84) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/actions/index.js +14 -8
  3. package/dist/cjs/react/nodes/blockCard.js +2 -1
  4. package/dist/cjs/react/nodes/embedCard.js +4 -1
  5. package/dist/cjs/react/nodes/inlineCard.js +2 -1
  6. package/dist/cjs/react/nodes/media/index.js +5 -1
  7. package/dist/cjs/react/nodes/mediaSingle/index.js +2 -2
  8. package/dist/cjs/react/nodes/tableNew.js +9 -3
  9. package/dist/cjs/ui/Renderer/PortalContext.js +24 -0
  10. package/dist/cjs/ui/Renderer/index.js +31 -10
  11. package/dist/cjs/ui/annotations/context.js +14 -1
  12. package/dist/cjs/ui/annotations/contexts/AnnotationRangeContext.js +199 -35
  13. package/dist/cjs/ui/annotations/draft/component.js +6 -1
  14. package/dist/cjs/ui/annotations/element/useInlineAnnotationProps.js +5 -1
  15. package/dist/cjs/ui/annotations/hooks/user-selection.js +14 -9
  16. package/dist/cjs/ui/annotations/hover/mounter.js +31 -10
  17. package/dist/cjs/ui/annotations/hover/range-validator.js +2 -1
  18. package/dist/cjs/ui/annotations/index.js +2 -1
  19. package/dist/cjs/ui/annotations/selection/mounter.js +41 -12
  20. package/dist/cjs/ui/annotations/selection/range-validator.js +10 -7
  21. package/dist/cjs/ui/annotations/wrapper.js +48 -2
  22. package/dist/es2019/actions/index.js +12 -8
  23. package/dist/es2019/react/nodes/blockCard.js +2 -1
  24. package/dist/es2019/react/nodes/embedCard.js +4 -1
  25. package/dist/es2019/react/nodes/inlineCard.js +2 -1
  26. package/dist/es2019/react/nodes/media/index.js +6 -1
  27. package/dist/es2019/react/nodes/mediaSingle/index.js +2 -2
  28. package/dist/es2019/react/nodes/tableNew.js +9 -3
  29. package/dist/es2019/ui/Renderer/PortalContext.js +15 -0
  30. package/dist/es2019/ui/Renderer/index.js +31 -10
  31. package/dist/es2019/ui/annotations/context.js +14 -1
  32. package/dist/es2019/ui/annotations/contexts/AnnotationRangeContext.js +207 -30
  33. package/dist/es2019/ui/annotations/draft/component.js +7 -1
  34. package/dist/es2019/ui/annotations/element/useInlineAnnotationProps.js +6 -1
  35. package/dist/es2019/ui/annotations/hooks/user-selection.js +14 -9
  36. package/dist/es2019/ui/annotations/hover/mounter.js +33 -10
  37. package/dist/es2019/ui/annotations/hover/range-validator.js +2 -1
  38. package/dist/es2019/ui/annotations/index.js +2 -1
  39. package/dist/es2019/ui/annotations/selection/mounter.js +43 -12
  40. package/dist/es2019/ui/annotations/selection/range-validator.js +6 -4
  41. package/dist/es2019/ui/annotations/wrapper.js +49 -1
  42. package/dist/esm/actions/index.js +14 -8
  43. package/dist/esm/react/nodes/blockCard.js +2 -1
  44. package/dist/esm/react/nodes/embedCard.js +4 -1
  45. package/dist/esm/react/nodes/inlineCard.js +2 -1
  46. package/dist/esm/react/nodes/media/index.js +5 -1
  47. package/dist/esm/react/nodes/mediaSingle/index.js +2 -2
  48. package/dist/esm/react/nodes/tableNew.js +9 -3
  49. package/dist/esm/ui/Renderer/PortalContext.js +15 -0
  50. package/dist/esm/ui/Renderer/index.js +31 -10
  51. package/dist/esm/ui/annotations/context.js +14 -1
  52. package/dist/esm/ui/annotations/contexts/AnnotationRangeContext.js +198 -34
  53. package/dist/esm/ui/annotations/draft/component.js +6 -1
  54. package/dist/esm/ui/annotations/element/useInlineAnnotationProps.js +5 -1
  55. package/dist/esm/ui/annotations/hooks/user-selection.js +14 -9
  56. package/dist/esm/ui/annotations/hover/mounter.js +31 -10
  57. package/dist/esm/ui/annotations/hover/range-validator.js +2 -1
  58. package/dist/esm/ui/annotations/index.js +2 -1
  59. package/dist/esm/ui/annotations/selection/mounter.js +41 -12
  60. package/dist/esm/ui/annotations/selection/range-validator.js +10 -7
  61. package/dist/esm/ui/annotations/wrapper.js +47 -1
  62. package/dist/types/actions/index.d.ts +5 -0
  63. package/dist/types/ui/Renderer/PortalContext.d.ts +6 -0
  64. package/dist/types/ui/Renderer/index.d.ts +0 -3
  65. package/dist/types/ui/annotations/context.d.ts +13 -1
  66. package/dist/types/ui/annotations/contexts/AnnotationRangeContext.d.ts +46 -4
  67. package/dist/types/ui/annotations/hooks/user-selection.d.ts +2 -1
  68. package/dist/types/ui/annotations/hover/mounter.d.ts +10 -2
  69. package/dist/types/ui/annotations/hover/range-validator.d.ts +14 -3
  70. package/dist/types/ui/annotations/selection/mounter.d.ts +10 -2
  71. package/dist/types/ui/annotations/selection/range-validator.d.ts +14 -3
  72. package/dist/types/ui/annotations/wrapper.d.ts +2 -0
  73. package/dist/types-ts4.5/actions/index.d.ts +5 -0
  74. package/dist/types-ts4.5/ui/Renderer/PortalContext.d.ts +6 -0
  75. package/dist/types-ts4.5/ui/Renderer/index.d.ts +0 -3
  76. package/dist/types-ts4.5/ui/annotations/context.d.ts +13 -1
  77. package/dist/types-ts4.5/ui/annotations/contexts/AnnotationRangeContext.d.ts +46 -4
  78. package/dist/types-ts4.5/ui/annotations/hooks/user-selection.d.ts +2 -0
  79. package/dist/types-ts4.5/ui/annotations/hover/mounter.d.ts +10 -2
  80. package/dist/types-ts4.5/ui/annotations/hover/range-validator.d.ts +14 -3
  81. package/dist/types-ts4.5/ui/annotations/selection/mounter.d.ts +10 -2
  82. package/dist/types-ts4.5/ui/annotations/selection/range-validator.d.ts +14 -3
  83. package/dist/types-ts4.5/ui/annotations/wrapper.d.ts +2 -0
  84. package/package.json +8 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 115.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#151824](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/151824)
8
+ [`0828a5f0b032e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0828a5f0b032e) -
9
+ Extract portal to a context when custom nodeComponents are not passed in.
10
+
11
+ ### Patch Changes
12
+
13
+ - [#152820](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/152820)
14
+ [`00eda15128c75`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/00eda15128c75) -
15
+ ED-27923:Fix embeded card width during SSR
16
+
17
+ ## 115.0.6
18
+
19
+ ### Patch Changes
20
+
21
+ - [#152081](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/152081)
22
+ [`703ddc882eae5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/703ddc882eae5) -
23
+ The annotation draft position has been moved to a high-order context so it can persist across
24
+ unmounts. The Range context has also been update to support multiple active annotation drafts.
25
+ This is because currently both the media and selection comments can be opened
26
+
3
27
  ## 115.0.5
4
28
 
5
29
  ### Patch Changes
@@ -22,10 +22,6 @@ var _matchesUtils = require("./matches-utils");
22
22
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
23
23
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
24
24
  var RendererActions = exports.default = /*#__PURE__*/function () {
25
- // Any kind of refence is allowed
26
- // Ignored via go/ees005
27
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
-
29
25
  function RendererActions() {
30
26
  var initFromContext = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
31
27
  (0, _classCallCheck2.default)(this, RendererActions);
@@ -33,6 +29,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
33
29
  // This module can only be used when wrapped with
34
30
  // the <RendererContext> component for now.
35
31
  (0, _defineProperty2.default)(this, "initFromContext", false);
32
+ (0, _defineProperty2.default)(this, "debugAnalyticLoggingEnabled", false);
36
33
  // TODO: EDITOR-595 - This method is temporary and should be removed once the following issue
37
34
  // has been identified and fixed: https://atlassian.slack.com/archives/C08JK0WSCH5/p1745902609966999
38
35
  // This is a copy of the original canApplyAnnotationOnRange. If that returns false this is run to figure out exactly why
@@ -115,7 +112,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
115
112
  key: "_privateValidatePositionsForAnnotation",
116
113
  value: function _privateValidatePositionsForAnnotation(from, to) {
117
114
  if (!this.doc || !this.schema) {
118
- if (this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
115
+ if (this.debugAnalyticLoggingEnabled && this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
119
116
  this.onAnalyticsEvent({
120
117
  // @ts-ignore
121
118
  action: 'failed',
@@ -137,7 +134,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
137
134
  }
138
135
  var currentSelection = _state.TextSelection.create(this.doc, from, to);
139
136
  if ((0, _utils.isEmptyTextSelection)(currentSelection, this.schema)) {
140
- if (this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
137
+ if (this.debugAnalyticLoggingEnabled && this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
141
138
  this.onAnalyticsEvent({
142
139
  // @ts-ignore
143
140
  action: 'failed',
@@ -161,7 +158,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
161
158
  from: from,
162
159
  to: to
163
160
  }, this.doc, this.schema);
164
- if (!result && this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
161
+ if (this.debugAnalyticLoggingEnabled && !result && this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
165
162
  this.onAnalyticsEvent({
166
163
  // @ts-ignore
167
164
  action: 'failed',
@@ -341,7 +338,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
341
338
  key: "isValidAnnotationPosition",
342
339
  value: function isValidAnnotationPosition(pos) {
343
340
  if (!pos || !this.doc) {
344
- if (this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
341
+ if (this.debugAnalyticLoggingEnabled && this.onAnalyticsEvent && (0, _platformFeatureFlags.fg)('platform_renderer_annotations_create_debug_logging')) {
345
342
  this.onAnalyticsEvent({
346
343
  // @ts-ignore
347
344
  action: 'failed',
@@ -548,5 +545,14 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
548
545
  schema: this.schema
549
546
  }, annotationId);
550
547
  }
548
+
549
+ /**
550
+ * This is a temporary method used for controlling when extra analytics shoulw be logged.
551
+ */
552
+ }, {
553
+ key: "_setDebugLogging",
554
+ value: function _setDebugLogging(enabled) {
555
+ this.debugAnalyticLoggingEnabled = enabled;
556
+ }
551
557
  }]);
552
558
  }();
@@ -18,6 +18,7 @@ var _ssr = require("@atlaskit/smart-card/ssr");
18
18
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
19
  var _colors = require("@atlaskit/theme/colors");
20
20
  var _utils = require("@atlaskit/editor-common/utils");
21
+ var _PortalContext = require("../../ui/Renderer/PortalContext");
21
22
  /**
22
23
  * @jsxRuntime classic
23
24
  * @jsx jsx
@@ -37,9 +38,9 @@ function BlockCard(props) {
37
38
  var url = props.url,
38
39
  data = props.data,
39
40
  eventHandlers = props.eventHandlers,
40
- portal = props.portal,
41
41
  smartLinks = props.smartLinks,
42
42
  isNodeNested = props.isNodeNested;
43
+ var portal = (0, _PortalContext.usePortal)(props);
43
44
  var _ref = smartLinks || {},
44
45
  actionOptions = _ref.actionOptions;
45
46
  var onClick = (0, _getCardClickHandler.getCardClickHandler)(eventHandlers, url);
@@ -19,6 +19,7 @@ var _fallback = require("./fallback");
19
19
  var _style = require("../../ui/Renderer/style");
20
20
  var _getCardClickHandler = require("../utils/getCardClickHandler");
21
21
  var _analyticsNext = require("@atlaskit/analytics-next");
22
+ var _PortalContext = require("../../ui/Renderer/PortalContext");
22
23
  /**
23
24
  * @jsxRuntime classic
24
25
  * @jsx jsx
@@ -38,6 +39,8 @@ var embedCardWrapperStyles = (0, _react.css)({
38
39
  },
39
40
  margin: '0 auto'
40
41
  });
42
+
43
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
41
44
  var uIMediaSingleLayoutStyles = (0, _react.css)({
42
45
  // eslint-disable-next-line @atlaskit/design-system/use-tokens-space
43
46
  marginLeft: '50%',
@@ -48,13 +51,13 @@ function EmbedCard(props) {
48
51
  var url = props.url,
49
52
  data = props.data,
50
53
  eventHandlers = props.eventHandlers,
51
- portal = props.portal,
52
54
  layout = props.layout,
53
55
  width = props.width,
54
56
  isInsideOfBlockNode = props.isInsideOfBlockNode,
55
57
  rendererAppearance = props.rendererAppearance,
56
58
  smartLinks = props.smartLinks,
57
59
  isInsideOfInlineExtension = props.isInsideOfInlineExtension;
60
+ var portal = (0, _PortalContext.usePortal)(props);
58
61
  var embedIframeRef = (0, _react2.useRef)(null);
59
62
  var onClick = (0, _getCardClickHandler.getCardClickHandler)(eventHandlers, url);
60
63
  var _ref = smartLinks || {},
@@ -16,6 +16,7 @@ var _SmartCardStorage = require("../../ui/SmartCardStorage");
16
16
  var _getCardClickHandler = require("../utils/getCardClickHandler");
17
17
  var _analyticsNext = require("@atlaskit/analytics-next");
18
18
  var _useInlineAnnotationProps = require("../../ui/annotations/element/useInlineAnnotationProps");
19
+ var _PortalContext = require("../../ui/Renderer/PortalContext");
19
20
  /**
20
21
  * @jsxRuntime classic
21
22
  * @jsx jsx
@@ -26,8 +27,8 @@ var InlineCard = function InlineCard(props) {
26
27
  var url = props.url,
27
28
  data = props.data,
28
29
  eventHandlers = props.eventHandlers,
29
- portal = props.portal,
30
30
  smartLinks = props.smartLinks;
31
+ var portal = (0, _PortalContext.usePortal)(props);
31
32
  var onClick = (0, _getCardClickHandler.getCardClickHandler)(eventHandlers, url);
32
33
  var cardProps = {
33
34
  url: url,
@@ -35,6 +35,7 @@ var _reactIntlNext = require("react-intl-next");
35
35
  var _useInlineCommentsFilter = require("../../../ui/annotations/hooks/use-inline-comments-filter");
36
36
  var _useInlineCommentSubscriber = require("../../../ui/annotations/hooks/use-inline-comment-subscriber");
37
37
  var _types = require("@atlaskit/editor-common/types");
38
+ var _AnnotationRangeContext = require("../../../ui/annotations/contexts/AnnotationRangeContext");
38
39
  var _excluded = ["marks", "mediaSingleElement", "isDrafting"],
39
40
  _excluded2 = ["marks", "mediaSingleElement", "isDrafting"];
40
41
  /**
@@ -430,7 +431,10 @@ var Media = /*#__PURE__*/function (_PureComponent) {
430
431
  }]);
431
432
  }(_react.PureComponent);
432
433
  var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
433
- var draftPosition = _react.default.useContext(_context.AnnotationsDraftContext);
434
+ var draftPositionOld = _react.default.useContext(_context.AnnotationsDraftContext);
435
+ var _useAnnotationRangeSt = (0, _AnnotationRangeContext.useAnnotationRangeState)(),
436
+ hoverDraftDocumentPosition = _useAnnotationRangeSt.hoverDraftDocumentPosition;
437
+ var draftPosition = (0, _platformFeatureFlags.fg)('platform_renderer_annotation_draft_position_fix') ? hoverDraftDocumentPosition : draftPositionOld;
434
438
  var dataAttributes = props.dataAttributes;
435
439
  var pos = dataAttributes && dataAttributes['data-renderer-start-pos'];
436
440
  var _useState9 = (0, _react.useState)(),
@@ -141,7 +141,7 @@ var MediaSingleWithChildren = function MediaSingleWithChildren(props) {
141
141
  var padding = isFullPage ? _style.FullPagePadding * 2 : 0;
142
142
  var calcDimensions = (0, _react.useCallback)(function (mediaContainerWidth) {
143
143
  var containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
144
- var maxWidth = (0, _coreUtils.isSSR)() && widthAttr && (0, _platformFeatureFlags.fg)('platform_editor_fix_image_size_diff_during_ssr') ? Math.max(widthAttr, containerWidth) : containerWidth;
144
+ var maxWidth = (0, _coreUtils.isSSR)() && widthAttr && typeof widthAttr === 'number' && widthType === 'pixel' && (0, _platformFeatureFlags.fg)('platform_editor_fix_image_size_diff_during_ssr') ? Math.max(widthAttr, containerWidth) : containerWidth;
145
145
  var maxHeight = height / width * maxWidth;
146
146
  var cardDimensions = {
147
147
  width: "".concat(maxWidth, "px"),
@@ -162,7 +162,7 @@ var MediaSingleWithChildren = function MediaSingleWithChildren(props) {
162
162
  cardDimensions: cardDimensions,
163
163
  lineLength: lineLength
164
164
  };
165
- }, [height, isFullWidth, isInsideOfBlockNode, layout, padding, rendererAppearance, width, widthAttr]);
165
+ }, [height, isFullWidth, isInsideOfBlockNode, layout, padding, rendererAppearance, width, widthAttr, widthType]);
166
166
  var originalDimensions = (0, _react.useMemo)(function () {
167
167
  return {
168
168
  width: width,
@@ -386,11 +386,17 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
386
386
  this.updatedLayout = layout;
387
387
  }
388
388
 
389
+ // defined in colgroup.tsx:
390
+ // appearance == comment && allowTableResizing && means it is a comment
391
+ // appearance == comment && !allowTableResizing && means it is a inline comment
392
+ // for inline comments, the table should inherit the width of the parent component rather than maintain its own size
393
+ var isInsideInlineComment = rendererAppearance === 'comment' && !allowTableResizing;
394
+
389
395
  // These styling removes extra padding for `comment` rendererAppearance.
390
396
  // This is especially relevant for Jira which only uses `comment` appearance and does not need padding.
391
397
  var resizerContainerPadding = rendererAppearance === 'comment' ? 0 : gutterPadding;
392
- var resizerItemMaxWidth = rendererAppearance === 'comment' ? "min(100cqw, var(--ak-editor-table-max-width))" : "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))";
393
- var resizerItemWidth = rendererAppearance === 'comment' ? "min(100cqw, ".concat(tableWidthAttribute, ")") : "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(tableWidthAttribute, ")");
398
+ var resizerItemMaxWidth = rendererAppearance === 'comment' ? isInsideInlineComment ? 'inherit' : "min(100cqw, var(--ak-editor-table-max-width))" : "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))";
399
+ var resizerItemWidth = rendererAppearance === 'comment' ? isInsideInlineComment ? 'inherit' : "min(100cqw, ".concat(tableWidthAttribute, ")") : "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(tableWidthAttribute, ")");
394
400
 
395
401
  // full width tables can have either left-aligned or centered layout despite looking centered in the renderer.
396
402
  // in these cases, keep the alignment unset
@@ -412,7 +418,7 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
412
418
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
413
419
  ,
414
420
  style: {
415
- width: "min(calc(100cqw - ".concat(resizerContainerPadding, "px), ").concat(tableWidthAttribute, ")")
421
+ width: isInsideInlineComment ? '100%' : "min(calc(100cqw - ".concat(resizerContainerPadding, "px), ").concat(tableWidthAttribute, ")")
416
422
  }
417
423
  }, /*#__PURE__*/_react.default.createElement("div", {
418
424
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.usePortal = exports.PortalContext = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
11
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
+ var PortalContext = exports.PortalContext = /*#__PURE__*/_react.default.createContext(undefined);
13
+ var usePortal = exports.usePortal = function usePortal() {
14
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
15
+ portalFromProps = _ref.portal;
16
+ var portalFromContext = (0, _react.useContext)(PortalContext);
17
+ if (portalFromProps) {
18
+ return portalFromProps;
19
+ }
20
+ if ((0, _platformFeatureFlags.fg)('cc_complexit_reduce_portal_rerenders')) {
21
+ return portalFromContext;
22
+ }
23
+ return undefined;
24
+ };
@@ -9,6 +9,7 @@ exports.NORMAL_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = void 0
9
9
  exports.Renderer = Renderer;
10
10
  exports.default = exports.RendererWithAnalytics = exports.RendererFunctionalComponent = void 0;
11
11
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
12
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
14
  var _react = _interopRequireWildcard(require("react"));
14
15
  var _schemaDefault = require("@atlaskit/adf-schema/schema-default");
@@ -49,6 +50,8 @@ var _RendererStyleContainer = require("./RendererStyleContainer");
49
50
  var _getBaseFontSize = require("./get-base-font-size");
50
51
  var _rendererHelper = require("./rendererHelper");
51
52
  var _useMemoFromPropsDerivative = require("./useMemoFromPropsDerivative");
53
+ var _PortalContext = require("./PortalContext");
54
+ var _excluded = ["portal"];
52
55
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
53
56
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
54
57
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -60,11 +63,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
60
63
  var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
61
64
  var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
62
65
  var packageName = "@atlaskit/renderer";
63
- var packageVersion = "115.0.5";
66
+ var packageVersion = "115.1.0";
64
67
  var setAsQueryContainerStyles = (0, _react2.css)({
65
68
  containerName: 'ak-renderer-wrapper',
66
- containerType: 'inline-size',
67
- contain: 'layout style inline-size'
69
+ containerType: 'inline-size'
68
70
  });
69
71
  var handleMouseTripleClickInTables = function handleMouseTripleClickInTables(event) {
70
72
  var _parentElement, _parentElement2;
@@ -172,10 +174,6 @@ var handleWrapperOnClick = function handleWrapperOnClick(event, props, mouseDown
172
174
  props.eventHandlers.onUnhandledClick(event);
173
175
  }
174
176
  };
175
-
176
- /**
177
- * Exported due to enzyme test reliance on this component.
178
- */
179
177
  var RendererFunctionalComponent = exports.RendererFunctionalComponent = function RendererFunctionalComponent(props) {
180
178
  var createAnalyticsEvent = props.createAnalyticsEvent;
181
179
  var mouseDownSelection = (0, _react.useRef)(undefined);
@@ -458,6 +456,29 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
458
456
  }
459
457
  };
460
458
  var RendererFunctionalComponentMemoized = /*#__PURE__*/_react.default.memo(RendererFunctionalComponent);
459
+ var RendererFunctionalComponentWithPortalContext = function RendererFunctionalComponentWithPortalContext(props) {
460
+ var portal = props.portal,
461
+ propsWithoutPortal = (0, _objectWithoutProperties2.default)(props, _excluded);
462
+ return (0, _react2.jsx)(_PortalContext.PortalContext.Provider, {
463
+ value: portal
464
+ }, (0, _react2.jsx)(RendererFunctionalComponent, propsWithoutPortal));
465
+ };
466
+ var RendererFunctionalComponentWithPortalContextMemoized = /*#__PURE__*/_react.default.memo(RendererFunctionalComponentWithPortalContext);
467
+ var getRendererComponent = function getRendererComponent(nodeComponents) {
468
+ // If nodeComponents are provided, for now we don't want to remove portal from props
469
+ // and use context instead because at this time we cannot guarantee that existing
470
+ // consumers of Atlaskit Renderer will update to use the new portal context.
471
+ if (!Boolean(nodeComponents) && (0, _platformFeatureFlags.fg)('cc_complexit_reduce_portal_rerenders')) {
472
+ if ((0, _platformFeatureFlags.fg)('cc_perf_reduce_rerenders')) {
473
+ return RendererFunctionalComponentWithPortalContextMemoized;
474
+ }
475
+ return RendererFunctionalComponentWithPortalContext;
476
+ }
477
+ if ((0, _platformFeatureFlags.fg)('cc_perf_reduce_rerenders')) {
478
+ return RendererFunctionalComponentMemoized;
479
+ }
480
+ return RendererFunctionalComponent;
481
+ };
461
482
  function Renderer(props) {
462
483
  var _React$useContext = _react.default.useContext(_annotations.AnnotationsPositionContext),
463
484
  startPos = _React$useContext.startPos;
@@ -465,7 +486,7 @@ function Renderer(props) {
465
486
  isTopLevelRenderer = _useRendererContext.isTopLevelRenderer;
466
487
  var _ref = (0, _react.useContext)(_ValidationContext.ValidationContext) || {},
467
488
  skipValidation = _ref.skipValidation;
468
- var RendererComponent = (0, _platformFeatureFlags.fg)('cc_perf_reduce_rerenders') ? RendererFunctionalComponentMemoized : RendererFunctionalComponent;
489
+ var RendererComponent = getRendererComponent(props.nodeComponents);
469
490
  return (0, _react2.jsx)(RendererComponent
470
491
  // Ignored via go/ees005
471
492
  // eslint-disable-next-line react/jsx-props-no-spreading
@@ -603,10 +624,10 @@ var RendererWrapper = /*#__PURE__*/_react.default.memo(function (props) {
603
624
  // Only apply container-type = inline-size when having a known width in full-page/full-width/comment mode.
604
625
  // Otherwise when appearance is unspecified the renderer size is decided by the content.
605
626
  // In this case we can't set the container-type = inline-size as it will collapse width to 0.
606
- return (appearance === 'full-page' || appearance === 'full-width' || appearance === 'comment') &&
627
+ return appearance === 'comment' &&
607
628
  // In case of having excerpt-include on page there are multiple renderers nested.
608
629
  // Make sure only the root renderer is set to be query container.
609
- isTopLevelRenderer && (0, _platformFeatureFlags.fg)('platform-fix-table-ssr-resizing') ? (0, _react2.jsx)("div", {
630
+ isTopLevelRenderer && (0, _platformFeatureFlags.fg)('platform-ssr-table-resize') ? (0, _react2.jsx)("div", {
610
631
  css: setAsQueryContainerStyles
611
632
  }, renderer) : renderer;
612
633
  });
@@ -18,10 +18,23 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
18
18
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
19
19
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
20
20
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
21
- var AnnotationsDraftContext = exports.AnnotationsDraftContext = /*#__PURE__*/(0, _react.createContext)(null);
22
21
  var ProvidersContext = exports.ProvidersContext = /*#__PURE__*/(0, _react.createContext)(null);
23
22
  var InlineCommentsStateContext = exports.InlineCommentsStateContext = /*#__PURE__*/(0, _react.createContext)({});
24
23
 
24
+ /**
25
+ * @private
26
+ * @deprecated The FG platform_renderer_annotation_draft_position_fix will make this context redundant as the draft position
27
+ * has been moved to the AnnotationRangeProvider in order to be more consistent with the hover and selection ranges.
28
+ * Once the FG is rolled out this context will be removed. Please ensure any changes are duplicated to the AnnotationRangeProvider.
29
+ */
30
+ var AnnotationsDraftContext = exports.AnnotationsDraftContext = /*#__PURE__*/(0, _react.createContext)(null);
31
+
32
+ /**
33
+ * @private
34
+ * @deprecated The FG platform_renderer_annotation_draft_position_fix will make this context redundant as the draft position
35
+ * has been moved to the AnnotationRangeProvider in order to be more consistent with the hover and selection ranges.
36
+ * Once the FG is rolled out this context will be removed. Please ensure any changes are duplicated to the AnnotationRangeProvider.
37
+ */
25
38
  // Ignored via go/ees005
26
39
  // eslint-disable-next-line @repo/internal/react/no-class-components
27
40
  var AnnotationsDraftContextWrapper = exports.AnnotationsDraftContextWrapper = /*#__PURE__*/function (_React$Component) {