@atlaskit/renderer 148.0.4 → 149.0.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 (62) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/cjs/actions/index.js +35 -3
  3. package/dist/cjs/entry-points/expand-body.js +12 -0
  4. package/dist/cjs/react/index.js +8 -0
  5. package/dist/cjs/react/marks/annotation.js +3 -1
  6. package/dist/cjs/react/nodes/extension-comments.compiled.css +4 -0
  7. package/dist/cjs/react/nodes/extension-comments.js +144 -0
  8. package/dist/cjs/react/nodes/extension.js +86 -11
  9. package/dist/cjs/steps/index.js +23 -0
  10. package/dist/cjs/ui/Expand.js +10 -0
  11. package/dist/cjs/ui/Renderer/index.js +1 -1
  12. package/dist/cjs/ui/annotations/contexts/AnnotationRangeContext.js +29 -11
  13. package/dist/cjs/ui/annotations/element/extension.compiled.css +6 -0
  14. package/dist/cjs/ui/annotations/element/extension.js +34 -0
  15. package/dist/cjs/ui/annotations/element/index.js +4 -2
  16. package/dist/cjs/ui/annotations/element/mark.js +11 -1
  17. package/dist/cjs/ui/annotations/index.js +2 -1
  18. package/dist/es2019/actions/index.js +33 -3
  19. package/dist/es2019/entry-points/expand-body.js +3 -0
  20. package/dist/es2019/react/index.js +8 -0
  21. package/dist/es2019/react/marks/annotation.js +3 -1
  22. package/dist/es2019/react/nodes/extension-comments.compiled.css +4 -0
  23. package/dist/es2019/react/nodes/extension-comments.js +115 -0
  24. package/dist/es2019/react/nodes/extension.js +83 -7
  25. package/dist/es2019/steps/index.js +25 -0
  26. package/dist/es2019/ui/Expand.js +10 -0
  27. package/dist/es2019/ui/Renderer/index.js +1 -1
  28. package/dist/es2019/ui/annotations/contexts/AnnotationRangeContext.js +28 -12
  29. package/dist/es2019/ui/annotations/element/extension.compiled.css +6 -0
  30. package/dist/es2019/ui/annotations/element/extension.js +26 -0
  31. package/dist/es2019/ui/annotations/element/index.js +4 -2
  32. package/dist/es2019/ui/annotations/element/mark.js +11 -1
  33. package/dist/es2019/ui/annotations/index.js +2 -1
  34. package/dist/esm/actions/index.js +35 -3
  35. package/dist/esm/entry-points/expand-body.js +3 -0
  36. package/dist/esm/react/index.js +8 -0
  37. package/dist/esm/react/marks/annotation.js +3 -1
  38. package/dist/esm/react/nodes/extension-comments.compiled.css +4 -0
  39. package/dist/esm/react/nodes/extension-comments.js +135 -0
  40. package/dist/esm/react/nodes/extension.js +86 -7
  41. package/dist/esm/steps/index.js +23 -0
  42. package/dist/esm/ui/Expand.js +10 -0
  43. package/dist/esm/ui/Renderer/index.js +1 -1
  44. package/dist/esm/ui/annotations/contexts/AnnotationRangeContext.js +30 -12
  45. package/dist/esm/ui/annotations/element/extension.compiled.css +6 -0
  46. package/dist/esm/ui/annotations/element/extension.js +27 -0
  47. package/dist/esm/ui/annotations/element/index.js +4 -2
  48. package/dist/esm/ui/annotations/element/mark.js +11 -1
  49. package/dist/esm/ui/annotations/index.js +2 -1
  50. package/dist/types/actions/index.d.ts +13 -0
  51. package/dist/types/entry-points/expand-body.d.ts +2 -0
  52. package/dist/types/react/marks/annotation.d.ts +1 -1
  53. package/dist/types/react/nodes/extension-comments.d.ts +17 -0
  54. package/dist/types/react/nodes/extension.d.ts +12 -0
  55. package/dist/types/react/types.d.ts +1 -0
  56. package/dist/types/ui/annotations/contexts/AnnotationRangeContext.d.ts +4 -2
  57. package/dist/types/ui/annotations/element/extension.d.ts +17 -0
  58. package/dist/types/ui/annotations/element/index.d.ts +2 -1
  59. package/dist/types/ui/annotations/element/mark.d.ts +3 -107
  60. package/dist/types/ui/utils/expand-body.d.ts +5 -3
  61. package/expand-body/package.json +10 -0
  62. package/package.json +5 -5
@@ -216,11 +216,34 @@ export function resolvePos(node, offset) {
216
216
  }
217
217
  return resolvedPos + offset;
218
218
  }
219
+ function getSelectedCommentTargetPosition(range) {
220
+ var startContainer = range.startContainer,
221
+ startOffset = range.startOffset,
222
+ endContainer = range.endContainer,
223
+ endOffset = range.endOffset;
224
+ if (startContainer !== endContainer || endOffset !== startOffset + 1) {
225
+ return false;
226
+ }
227
+ var selectedNode = startContainer.childNodes[startOffset];
228
+ if (!selectedNode || !isElementNode(selectedNode) || selectedNode.dataset.inlineCommentsTarget !== 'true' || !isPositionPointer(selectedNode)) {
229
+ return false;
230
+ }
231
+
232
+ // Subtract 1 from the renderer start position to get the position before the extension node.
233
+ return getStartPos(selectedNode) - 1;
234
+ }
219
235
  export function getPosFromRange(range) {
220
236
  var startContainer = range.startContainer,
221
237
  startOffset = range.startOffset,
222
238
  endContainer = range.endContainer,
223
239
  endOffset = range.endOffset;
240
+ var selectedCommentTargetPosition = fg('cc_maui_annotations_on_extensions') && getSelectedCommentTargetPosition(range);
241
+ if (selectedCommentTargetPosition !== false) {
242
+ return {
243
+ from: selectedCommentTargetPosition,
244
+ to: selectedCommentTargetPosition
245
+ };
246
+ }
224
247
  var possibleMediaOrMediaSingleElement = findParent(startContainer);
225
248
 
226
249
  // Video hover targets return media single, not media, thus, the extra check in condition.
@@ -16,6 +16,7 @@ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/anal
16
16
  import { ExpandIconWrapper, ExpandLayoutWrapperWithRef, expandMessages, WidthProvider } from '@atlaskit/editor-common/ui';
17
17
  import { akEditorLineHeight, akEditorSwoopCubicBezier, akLayoutGutterOffset } from '@atlaskit/editor-shared-styles';
18
18
  import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
19
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
19
20
  import Tooltip from '@atlaskit/tooltip/Tooltip';
20
21
  import { MODE, PLATFORM } from '../analytics/events';
21
22
  import { ActiveHeaderIdConsumer } from './active-header-id-provider';
@@ -394,10 +395,19 @@ function Expand(_ref) {
394
395
  e.preventDefault();
395
396
  e.stopPropagation();
396
397
  fireExpandToggleAnalytics(nodeType, expanded, fireAnalyticsEvent);
398
+ // Recorded so a product remounting this expand under its own body gets it back as the
399
+ // reader left it.
400
+ var recordsToggle = node !== undefined && isExperimentEnabled('cc_light_mode_table_virtualization');
397
401
  if (expanded) {
398
402
  setExpanded(false);
403
+ if (recordsToggle) {
404
+ revealedByFind.delete(node);
405
+ }
399
406
  } else {
400
407
  openBody();
408
+ if (recordsToggle) {
409
+ revealedByFind.add(node);
410
+ }
401
411
  }
402
412
  e.persist();
403
413
  // @ts-ignore detail doesn't exist on type
@@ -62,7 +62,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
62
62
  var TABLE_INFO_TIMEOUT = 10000;
63
63
  var RENDER_EVENT_SAMPLE_RATE = 0.1;
64
64
  var packageName = "@atlaskit/renderer";
65
- var packageVersion = "148.0.3";
65
+ var packageVersion = "148.1.0";
66
66
  var setAsQueryContainerStyles = css({
67
67
  containerName: 'ak-renderer-wrapper',
68
68
  containerType: 'inline-size'
@@ -2,7 +2,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  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; }
4
4
  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) { _defineProperty(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; }
5
- import React, { createContext, useCallback, useContext, useMemo, useReducer } from 'react';
5
+ import React, { createContext, useCallback, useContext, useMemo, useReducer, useRef } from 'react';
6
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
6
7
 
7
8
  // oxlint-disable-next-line eslint/no-redeclare
8
9
 
@@ -113,7 +114,9 @@ export var AnnotationRangeDispatchContext = /*#__PURE__*/createContext({
113
114
  });
114
115
  export var AnnotationRangeProviderInner = function AnnotationRangeProviderInner(_ref) {
115
116
  var children = _ref.children,
116
- allowCommentsOnMedia = _ref.allowCommentsOnMedia;
117
+ allowCommentsOnMedia = _ref.allowCommentsOnMedia,
118
+ hasBlockNodeSupport = _ref.hasBlockNodeSupport;
119
+ var extensionCommentsEnabled = !!hasBlockNodeSupport && fg('cc_maui_annotations_on_extensions');
117
120
  var _useReducer = useReducer(reducer, initialState),
118
121
  _useReducer2 = _slicedToArray(_useReducer, 2),
119
122
  _useReducer2$ = _useReducer2[0],
@@ -141,21 +144,34 @@ export var AnnotationRangeProviderInner = function AnnotationRangeProviderInner(
141
144
  range: range
142
145
  });
143
146
  }, []);
147
+ var hoverDraftRangeRef = useRef(hoverDraftRange);
148
+ hoverDraftRangeRef.current = hoverDraftRange;
144
149
  var setHoverTarget = useCallback(function (target) {
145
- // the HoverComponent expects an element deeply nested inside media, these classes work with the current implementation
146
- var mediaNode = target.querySelector('.media-card-inline-player, .media-file-card-view');
147
- if (!mediaNode) {
150
+ var draftRange = hoverDraftRangeRef.current;
151
+ var draftTarget = draftRange === null || draftRange === void 0 ? void 0 : draftRange.startContainer.childNodes[draftRange.startOffset];
152
+ if (extensionCommentsEnabled && draftTarget instanceof HTMLElement && draftTarget.matches('.ak-renderer-extension[data-inline-comments-target="true"]')) {
153
+ // Keep the composer callbacks bound to the chart chosen when its draft opened.
148
154
  return;
149
155
  }
150
- // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- range for media hover highlight
156
+ // The HoverComponent expects an element deeply nested inside media or the eligible
157
+ // block node's wrapper. Each selector is only included when its comment type is
158
+ // supported, so hover targeting never activates on an ineligible block node.
159
+ var selectors = [allowCommentsOnMedia && '.media-card-inline-player, .media-file-card-view', extensionCommentsEnabled && '.ak-renderer-extension[data-inline-comments-target="true"]'].filter(function (selector) {
160
+ return Boolean(selector);
161
+ }).join(', ');
162
+ var hoverableNode = extensionCommentsEnabled && target.matches('.ak-renderer-extension[data-inline-comments-target="true"]') ? target : selectors ? target.querySelector(selectors) : null;
163
+ if (!hoverableNode) {
164
+ return;
165
+ }
166
+ // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- range for media/extension hover highlight
151
167
  var range = document.createRange();
152
- range.setStartBefore(mediaNode);
153
- range.setEndAfter(mediaNode);
168
+ range.setStartBefore(hoverableNode);
169
+ range.setEndAfter(hoverableNode);
154
170
  dispatch({
155
171
  type: 'setHover',
156
172
  range: range
157
173
  });
158
- }, []);
174
+ }, [allowCommentsOnMedia, extensionCommentsEnabled]);
159
175
  var promoteSelectionToDraft = useCallback(function (position) {
160
176
  dispatch({
161
177
  type: 'promoteSelectionToDraft',
@@ -195,13 +211,13 @@ export var AnnotationRangeProviderInner = function AnnotationRangeProviderInner(
195
211
  clearSelectionRange: clearSelectionRange,
196
212
  clearHoverRange: clearHoverRange,
197
213
  setSelectionRange: setSelectionRange,
198
- setHoverTarget: !!allowCommentsOnMedia ? setHoverTarget : undefined,
214
+ setHoverTarget: allowCommentsOnMedia || extensionCommentsEnabled ? setHoverTarget : undefined,
199
215
  promoteSelectionToDraft: promoteSelectionToDraft,
200
216
  promoteHoverToDraft: promoteHoverToDraft,
201
217
  clearSelectionDraft: clearSelectionDraft,
202
218
  clearHoverDraft: clearHoverDraft
203
219
  };
204
- }, [allowCommentsOnMedia, clearSelectionRange, clearHoverRange, setSelectionRange, setHoverTarget, promoteSelectionToDraft, promoteHoverToDraft, clearSelectionDraft, clearHoverDraft]);
220
+ }, [allowCommentsOnMedia, extensionCommentsEnabled, clearSelectionRange, clearHoverRange, setSelectionRange, setHoverTarget, promoteSelectionToDraft, promoteHoverToDraft, clearSelectionDraft, clearHoverDraft]);
205
221
  return /*#__PURE__*/React.createElement(AnnotationRangeStateContext.Provider, {
206
222
  value: stateData
207
223
  }, /*#__PURE__*/React.createElement(AnnotationRangeDispatchContext.Provider, {
@@ -211,6 +227,7 @@ export var AnnotationRangeProviderInner = function AnnotationRangeProviderInner(
211
227
  export var AnnotationRangeProvider = function AnnotationRangeProvider(_ref2) {
212
228
  var children = _ref2.children,
213
229
  allowCommentsOnMedia = _ref2.allowCommentsOnMedia,
230
+ hasBlockNodeSupport = _ref2.hasBlockNodeSupport,
214
231
  isNestedRender = _ref2.isNestedRender;
215
232
  /*
216
233
  * If this is a nested render, we do not provide the context
@@ -218,7 +235,8 @@ export var AnnotationRangeProvider = function AnnotationRangeProvider(_ref2) {
218
235
  * and we need the original context to create annotations on extensions.
219
236
  */
220
237
  return isNestedRender ? /*#__PURE__*/React.createElement(React.Fragment, null, children) : /*#__PURE__*/React.createElement(AnnotationRangeProviderInner, {
221
- allowCommentsOnMedia: allowCommentsOnMedia
238
+ allowCommentsOnMedia: allowCommentsOnMedia,
239
+ hasBlockNodeSupport: hasBlockNodeSupport
222
240
  }, children);
223
241
  };
224
242
  export var useAnnotationRangeState = function useAnnotationRangeState() {
@@ -0,0 +1,6 @@
1
+ ._154iidpf{top:0}
2
+ ._1ltvidpf{left:0}
3
+ ._1xi2idpf{right:0}
4
+ ._94n5idpf{bottom:0}
5
+ ._kqswstnw{position:absolute}
6
+ ._lcxvglyw{pointer-events:none}
@@ -0,0 +1,27 @@
1
+ /* extension.tsx generated by @compiled/babel-plugin v3.0.2 */
2
+ import "./extension.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React from 'react';
5
+ var styles = {
6
+ anchor: "_kqswstnw _154iidpf _1xi2idpf _94n5idpf _1ltvidpf _lcxvglyw"
7
+ };
8
+
9
+ /** Full-chart anchors for comment navigation, without wrapping or intercepting the iframe. */
10
+ export var ExtensionAnnotation = function ExtensionAnnotation(_ref) {
11
+ var id = _ref.id,
12
+ dataAttributes = _ref.dataAttributes,
13
+ markRef = _ref.markRef;
14
+ return /*#__PURE__*/React.createElement("div", {
15
+ id: id,
16
+ ref: markRef,
17
+ "data-id": dataAttributes['data-id'],
18
+ "data-mark-type": dataAttributes['data-mark-type'],
19
+ "data-mark-annotation-type": dataAttributes['data-mark-annotation-type'],
20
+ "data-mark-annotation-state": dataAttributes['data-mark-annotation-state'],
21
+ "data-block-mark": dataAttributes['data-block-mark'],
22
+ "data-renderer-mark": dataAttributes['data-renderer-mark'],
23
+ "data-has-focus": dataAttributes['data-has-focus'],
24
+ "data-is-hovered": dataAttributes['data-is-hovered'],
25
+ className: ax([styles.anchor])
26
+ });
27
+ };
@@ -12,7 +12,8 @@ var MarkElement = function MarkElement(_ref) {
12
12
  children = _ref.children,
13
13
  dataAttributes = _ref.dataAttributes,
14
14
  id = _ref.id,
15
- useBlockLevel = _ref.useBlockLevel;
15
+ useBlockLevel = _ref.useBlockLevel,
16
+ isExtension = _ref.isExtension;
16
17
  var updateSubscriber = useInlineCommentSubscriberContext();
17
18
  var states = useContext(InlineCommentsStateContext);
18
19
  var _useHasFocusEvent = useHasFocusEvent({
@@ -90,7 +91,8 @@ var MarkElement = function MarkElement(_ref) {
90
91
  hasFocus: hasFocus,
91
92
  isHovered: isHovered,
92
93
  state: states[id],
93
- useBlockLevel: useBlockLevel
94
+ useBlockLevel: useBlockLevel,
95
+ isExtension: isExtension
94
96
  }, children);
95
97
  };
96
98
  export { MarkElement };
@@ -16,6 +16,7 @@ import { AnnotationMarkStates } from '@atlaskit/adf-schema/annotation';
16
16
  import { fg } from '@atlaskit/platform-feature-flags/fg';
17
17
  import { inlineCommentMessages } from '../../../messages';
18
18
  import { useAnnotationManagerDispatch, useAnnotationManagerState } from '../contexts/AnnotationManagerContext';
19
+ import { ExtensionAnnotation } from './extension';
19
20
  var markStyles = css(_defineProperty({
20
21
  color: 'inherit',
21
22
  backgroundColor: 'unset',
@@ -120,7 +121,8 @@ export var MarkComponent = function MarkComponent(_ref) {
120
121
  hasFocus = _ref.hasFocus,
121
122
  isHovered = _ref.isHovered,
122
123
  onClick = _ref.onClick,
123
- useBlockLevel = _ref.useBlockLevel;
124
+ useBlockLevel = _ref.useBlockLevel,
125
+ isExtension = _ref.isExtension;
124
126
  var intl = useIntl();
125
127
  var annotationIds = useMemo(function () {
126
128
  return _toConsumableArray(new Set([].concat(_toConsumableArray(annotationParentIds), [id])));
@@ -210,6 +212,14 @@ export var MarkComponent = function MarkComponent(_ref) {
210
212
  } : _objectSpread({
211
213
  'aria-details': annotationIds.join(', ')
212
214
  }, desktopAccessibilityAttributes);
215
+ if (isExtension && fg('cc_maui_annotations_on_extensions')) {
216
+ // The chart's badge owns interaction. Anchors only supply geometry and annotation state.
217
+ return jsx(ExtensionAnnotation, {
218
+ id: id,
219
+ dataAttributes: overriddenData,
220
+ markRef: id === currentSelectedAnnotationId ? markRef : undefined
221
+ });
222
+ }
213
223
  return jsx(useBlockLevel ? 'div' : 'mark', _objectSpread(_objectSpread(_objectSpread(_defineProperty({
214
224
  ref: id === currentSelectedAnnotationId ? markRef : undefined,
215
225
  id: id
@@ -29,7 +29,7 @@ export var AnnotationsPositionContext = /*#__PURE__*/React.createContext({
29
29
  startPos: 1
30
30
  });
31
31
  export var AnnotationsWrapperInner = function AnnotationsWrapperInner(props) {
32
- var _providers$inlineComm, _providers$inlineComm2;
32
+ var _providers$inlineComm, _providers$inlineComm2, _providers$inlineComm3;
33
33
  var children = props.children,
34
34
  rendererRef = props.rendererRef,
35
35
  adfDocument = props.adfDocument,
@@ -47,6 +47,7 @@ export var AnnotationsWrapperInner = function AnnotationsWrapperInner(props) {
47
47
  value: inlineCommentAnnotationsState
48
48
  }, /*#__PURE__*/React.createElement(AnnotationRangeProvider, {
49
49
  allowCommentsOnMedia: (_providers$inlineComm = providers === null || providers === void 0 || (_providers$inlineComm2 = providers.inlineComment) === null || _providers$inlineComm2 === void 0 ? void 0 : _providers$inlineComm2.allowCommentsOnMedia) !== null && _providers$inlineComm !== void 0 ? _providers$inlineComm : false,
50
+ hasBlockNodeSupport: Boolean(providers === null || providers === void 0 || (_providers$inlineComm3 = providers.inlineComment) === null || _providers$inlineComm3 === void 0 ? void 0 : _providers$inlineComm3.isBlockNodeSupported),
50
51
  isNestedRender: isNestedRender
51
52
  }, /*#__PURE__*/React.createElement(AnnotationHoverContext, null, /*#__PURE__*/React.createElement(AnnotationsContextWrapper, {
52
53
  createAnalyticsEvent: createAnalyticsEvent,
@@ -71,6 +71,19 @@ export default class RendererActions implements RendererActionsOptions, Annotati
71
71
  annotate(range: Range, annotationId: string, _annotationType: 'inlineComment'): AnnotationActionResult;
72
72
  isValidAnnotationRange(range: Range | null): boolean;
73
73
  isRangeAnnotatable(range: Range | null): boolean;
74
+ /**
75
+ * A range only threatens a nested renderer's own document (e.g. a bodiedExtension's macro
76
+ * body, which renders its own nested `<Renderer>`) when it sits inside that nested renderer's
77
+ * `.ak-renderer-document`. Landing directly on the extension's own outer wrapper -- with no
78
+ * nested document in between -- must stay annotatable so the whole chart/extension can be
79
+ * targeted (MAUI-1256), rather than being rejected outright the way any range touching
80
+ * `.ak-renderer-extension` previously was.
81
+ *
82
+ * Behind `cc_maui_annotations_on_extensions` -- the same gate MAUI-1255 added for extension
83
+ * node-mark support -- to preserve the previous behaviour (reject anything touching
84
+ * `.ak-renderer-extension`) while the feature is off.
85
+ */
86
+ private isInsideNestedExtensionRenderer;
74
87
  /**
75
88
  * This is replaced by `isRangeAnnotatable`.
76
89
  *
@@ -0,0 +1,2 @@
1
+ export { ExpandBodyProvider } from '../ui/utils/expand-body';
2
+ export type { ExpandBody } from '../ui/utils/expand-body';
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  import type { Mark } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { MarkProps, AnnotationMarkMeta } from '../types';
4
4
  export declare const isAnnotationMark: (mark: Mark) => boolean;
5
- declare const AnnotationComponent: ({ id, annotationType, children, dataAttributes, annotationParentIds, allowAnnotations, useBlockLevel, isMediaInline, }: MarkProps<AnnotationMarkMeta>) => React.JSX.Element;
5
+ declare const AnnotationComponent: ({ id, annotationType, children, dataAttributes, annotationParentIds, allowAnnotations, useBlockLevel, isExtension, isMediaInline, }: MarkProps<AnnotationMarkMeta>) => React.JSX.Element;
6
6
  export default AnnotationComponent;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ * @jsxFrag React.Fragment
5
+ */
6
+ import React from 'react';
7
+ import type { Mark } from '@atlaskit/editor-prosemirror/model';
8
+ type Props = React.PropsWithChildren<{
9
+ allowAnnotations?: boolean;
10
+ allowAnnotationsDraftMode?: boolean;
11
+ enabled?: boolean;
12
+ marks?: readonly Mark[];
13
+ startPos?: number;
14
+ }>;
15
+ /** Only node-aware provider-approved extensions receive comment visuals. */
16
+ export declare const ExtensionComments: (props: Props) => React.JSX.Element;
17
+ export {};
@@ -12,8 +12,14 @@ import type { AnalyticsEventPayload } from '../../analytics/events';
12
12
  import type { RendererAppearance } from '../../ui/Renderer/types';
13
13
  import type { RendererContext, ExtensionViewportSize } from '../types';
14
14
  interface Props {
15
+ allowAnnotations?: boolean;
16
+ allowAnnotationsDraftMode?: boolean;
17
+ dataAttributes?: {
18
+ 'data-renderer-start-pos': number;
19
+ };
15
20
  extensionHandlers?: ExtensionHandlers;
16
21
  extensionKey: string;
22
+ extensionNode?: PMNode;
17
23
  extensionType: string;
18
24
  extensionViewportSizes?: ExtensionViewportSize[];
19
25
  /**
@@ -40,8 +46,14 @@ type AllOrNone<T> = T | {
40
46
  [K in keyof T]?: never;
41
47
  };
42
48
  type RenderExtensionOptions = {
49
+ dataAttributes?: Props['dataAttributes'];
43
50
  fireAnalyticsEvent?: (event: AnalyticsEventPayload) => void;
51
+ isCommentTarget?: boolean;
44
52
  isTopLevel?: boolean;
53
+ onBlur?: React.FocusEventHandler<HTMLDivElement>;
54
+ onFocus?: React.FocusEventHandler<HTMLDivElement>;
55
+ onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
56
+ onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
45
57
  rendererAppearance?: RendererAppearance;
46
58
  } & AllOrNone<OverflowShadowProps>;
47
59
  export declare const renderExtension: (content: any, layout: ExtensionLayout, options?: RenderExtensionOptions, removeOverflow?: boolean, extensionId?: string, extensionViewportSizes?: ExtensionViewportSize[], nodeHeight?: string, localId?: string, shouldDisplayExtensionAsInline?: (extensionParams?: ExtensionParams<Parameters>) => boolean, node?: ExtensionParams<Parameters>, isInsideOfInlineExtension?: boolean) => React.JSX.Element;
@@ -79,6 +79,7 @@ export interface AnnotationMarkMeta extends MarkMeta {
79
79
  annotationParentIds: string[];
80
80
  annotationType: AnnotationTypes;
81
81
  id: AnnotationId;
82
+ isExtension?: boolean;
82
83
  isMediaInline?: boolean;
83
84
  useBlockLevel?: boolean;
84
85
  }
@@ -36,13 +36,15 @@ interface AnnotationRangeDispatchContext {
36
36
  }
37
37
  export declare const AnnotationRangeStateContext: React.Context<AnnotationRangeStateContext>;
38
38
  export declare const AnnotationRangeDispatchContext: React.Context<AnnotationRangeDispatchContext>;
39
- export declare const AnnotationRangeProviderInner: ({ children, allowCommentsOnMedia, }: {
39
+ export declare const AnnotationRangeProviderInner: ({ children, allowCommentsOnMedia, hasBlockNodeSupport, }: {
40
40
  allowCommentsOnMedia?: boolean;
41
41
  children?: ReactNode;
42
+ hasBlockNodeSupport?: boolean;
42
43
  }) => React.JSX.Element;
43
- export declare const AnnotationRangeProvider: ({ children, allowCommentsOnMedia, isNestedRender, }: {
44
+ export declare const AnnotationRangeProvider: ({ children, allowCommentsOnMedia, hasBlockNodeSupport, isNestedRender, }: {
44
45
  allowCommentsOnMedia?: boolean;
45
46
  children?: ReactNode;
47
+ hasBlockNodeSupport?: boolean;
46
48
  isNestedRender?: boolean;
47
49
  }) => React.JSX.Element;
48
50
  export declare const useAnnotationRangeState: () => AnnotationRangeStateContext;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import React from 'react';
6
+ import type { AnnotationDataAttributes } from '@atlaskit/adf-schema/annotation';
7
+ /** Full-chart anchors for comment navigation, without wrapping or intercepting the iframe. */
8
+ export declare const ExtensionAnnotation: ({ id, dataAttributes, markRef, }: {
9
+ dataAttributes: AnnotationDataAttributes & {
10
+ 'data-block-mark'?: boolean;
11
+ 'data-has-focus'?: boolean;
12
+ 'data-is-hovered'?: boolean;
13
+ 'data-renderer-mark'?: boolean;
14
+ };
15
+ id: string;
16
+ markRef?: React.Ref<HTMLDivElement>;
17
+ }) => React.JSX.Element;
@@ -5,7 +5,8 @@ type MarkElementProps = React.PropsWithChildren<{
5
5
  annotationType: AnnotationTypes;
6
6
  dataAttributes: AnnotationDataAttributes;
7
7
  id: AnnotationId;
8
+ isExtension?: boolean;
8
9
  useBlockLevel?: boolean;
9
10
  }>;
10
- declare const MarkElement: ({ annotationParentIds, children, dataAttributes, id, useBlockLevel, }: MarkElementProps) => React.JSX.Element;
11
+ declare const MarkElement: ({ annotationParentIds, children, dataAttributes, id, useBlockLevel, isExtension, }: MarkElementProps) => React.JSX.Element;
11
12
  export { MarkElement };
@@ -3,8 +3,7 @@
3
3
  * @jsx jsx
4
4
  */
5
5
  import type React from 'react';
6
- import { type SerializedStyles } from '@emotion/react';
7
- import type { AnnotationId, AnnotationDataAttributes, AnnotationTypes } from '@atlaskit/adf-schema/annotation';
6
+ import type { AnnotationId, AnnotationDataAttributes } from '@atlaskit/adf-schema/annotation';
8
7
  import { AnnotationMarkStates } from '@atlaskit/adf-schema/annotation';
9
8
  import type { OnAnnotationClickPayload } from '@atlaskit/editor-common/types';
10
9
  type MarkComponentProps = {
@@ -12,114 +11,11 @@ type MarkComponentProps = {
12
11
  dataAttributes: AnnotationDataAttributes;
13
12
  hasFocus: boolean;
14
13
  id: AnnotationId;
14
+ isExtension?: boolean;
15
15
  isHovered: boolean;
16
16
  onClick: (props: OnAnnotationClickPayload) => void;
17
17
  state: AnnotationMarkStates | null;
18
18
  useBlockLevel?: boolean;
19
19
  };
20
- export declare const MarkComponent: ({ annotationParentIds, children, dataAttributes, id, state, hasFocus, isHovered, onClick, useBlockLevel, }: React.PropsWithChildren<MarkComponentProps>) => React.ReactElement<{
21
- 'aria-disabled': boolean;
22
- css?: (false | SerializedStyles)[] | undefined;
23
- 'data-id': AnnotationId;
24
- 'data-mark-annotation-state'?: AnnotationMarkStates;
25
- 'data-mark-annotation-type': AnnotationTypes;
26
- 'data-mark-type': string;
27
- id: string;
28
- ref: ((node: HTMLElement | null) => void) | undefined;
29
- style?: {
30
- '--ak-renderer-annotation-endmarker': string;
31
- '--ak-renderer-annotation-startmarker': string;
32
- } | undefined;
33
- } | {
34
- 'aria-disabled': boolean;
35
- css?: (false | SerializedStyles)[] | undefined;
36
- 'data-has-focus': boolean;
37
- 'data-id': AnnotationId;
38
- 'data-is-hovered': boolean;
39
- 'data-mark-annotation-state': AnnotationMarkStates;
40
- 'data-mark-annotation-type': AnnotationTypes;
41
- 'data-mark-type': string;
42
- id: string;
43
- ref: ((node: HTMLElement | null) => void) | undefined;
44
- style?: {
45
- '--ak-renderer-annotation-endmarker': string;
46
- '--ak-renderer-annotation-startmarker': string;
47
- } | undefined;
48
- } | {
49
- 'aria-details': string;
50
- 'aria-disabled'?: undefined;
51
- 'aria-expanded'?: undefined;
52
- css?: (false | SerializedStyles)[] | undefined;
53
- 'data-id': AnnotationId;
54
- 'data-mark-annotation-state'?: AnnotationMarkStates;
55
- 'data-mark-annotation-type': AnnotationTypes;
56
- 'data-mark-type': string;
57
- id: string;
58
- onKeyDown?: undefined;
59
- ref: ((node: HTMLElement | null) => void) | undefined;
60
- role?: undefined;
61
- style?: {
62
- '--ak-renderer-annotation-endmarker': string;
63
- '--ak-renderer-annotation-startmarker': string;
64
- } | undefined;
65
- tabIndex?: undefined;
66
- } | {
67
- 'aria-details': string;
68
- 'aria-disabled'?: undefined;
69
- 'aria-expanded'?: undefined;
70
- css?: (false | SerializedStyles)[] | undefined;
71
- 'data-has-focus': boolean;
72
- 'data-id': AnnotationId;
73
- 'data-is-hovered': boolean;
74
- 'data-mark-annotation-state': AnnotationMarkStates;
75
- 'data-mark-annotation-type': AnnotationTypes;
76
- 'data-mark-type': string;
77
- id: string;
78
- onKeyDown?: undefined;
79
- ref: ((node: HTMLElement | null) => void) | undefined;
80
- role?: undefined;
81
- style?: {
82
- '--ak-renderer-annotation-endmarker': string;
83
- '--ak-renderer-annotation-startmarker': string;
84
- } | undefined;
85
- tabIndex?: undefined;
86
- } | {
87
- 'aria-details': string;
88
- 'aria-disabled'?: undefined;
89
- 'aria-expanded': boolean;
90
- css?: (false | SerializedStyles)[] | undefined;
91
- 'data-id': AnnotationId;
92
- 'data-mark-annotation-state'?: AnnotationMarkStates;
93
- 'data-mark-annotation-type': AnnotationTypes;
94
- 'data-mark-type': string;
95
- id: string;
96
- onKeyDown: (evt: KeyboardEvent) => void;
97
- ref: ((node: HTMLElement | null) => void) | undefined;
98
- role: string;
99
- style?: {
100
- '--ak-renderer-annotation-endmarker': string;
101
- '--ak-renderer-annotation-startmarker': string;
102
- } | undefined;
103
- tabIndex: number;
104
- } | {
105
- 'aria-details': string;
106
- 'aria-disabled'?: undefined;
107
- 'aria-expanded': boolean;
108
- css?: (false | SerializedStyles)[] | undefined;
109
- 'data-has-focus': boolean;
110
- 'data-id': AnnotationId;
111
- 'data-is-hovered': boolean;
112
- 'data-mark-annotation-state': AnnotationMarkStates;
113
- 'data-mark-annotation-type': AnnotationTypes;
114
- 'data-mark-type': string;
115
- id: string;
116
- onKeyDown: (evt: KeyboardEvent) => void;
117
- ref: ((node: HTMLElement | null) => void) | undefined;
118
- role: string;
119
- style?: {
120
- '--ak-renderer-annotation-endmarker': string;
121
- '--ak-renderer-annotation-startmarker': string;
122
- } | undefined;
123
- tabIndex: number;
124
- }>;
20
+ export declare const MarkComponent: ({ annotationParentIds, children, dataAttributes, id, state, hasFocus, isHovered, onClick, useBlockLevel, isExtension, }: React.PropsWithChildren<MarkComponentProps>) => React.JSX.Element;
125
21
  export {};
@@ -1,6 +1,6 @@
1
1
  import type { Provider, ReactNode } from 'react';
2
2
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
- type ExpandBody = {
3
+ export type ExpandBody = {
4
4
  /**
5
5
  * Opens this expand, then asks the expand above it to do the same.
6
6
  *
@@ -20,11 +20,13 @@ type ExpandBody = {
20
20
  */
21
21
  revealed: boolean;
22
22
  /**
23
- * The expands browser find has opened. One set is shared by a whole chain of expands.
23
+ * The expands browser find or the reader has opened. One set is shared by a whole chain of
24
+ * expands, and by every expand under a body a product provides itself.
24
25
  *
25
26
  * A table standing in for itself does swap out what it renders, and a nested expand in one of its
26
27
  * rows is rebuilt when it does. This is how that expand knows to come back open rather than
27
- * closed over the match the reader was just taken to.
28
+ * closed over the match the reader was just taken to. A product that remounts what is under its
29
+ * own body gets its expands back the same way.
28
30
  */
29
31
  revealedByFind: WeakSet<PMNode>;
30
32
  };
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/renderer/expand-body",
3
+ "main": "../dist/cjs/entry-points/expand-body.js",
4
+ "module": "../dist/esm/entry-points/expand-body.js",
5
+ "module:es2019": "../dist/es2019/entry-points/expand-body.js",
6
+ "sideEffects": [
7
+ "*.compiled.css"
8
+ ],
9
+ "types": "../dist/types/entry-points/expand-body.d.ts"
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "148.0.4",
3
+ "version": "149.0.0",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -73,8 +73,8 @@
73
73
  "@atlaskit/status": "^5.13.0",
74
74
  "@atlaskit/task-decision": "^21.12.0",
75
75
  "@atlaskit/theme": "^28.2.0",
76
- "@atlaskit/tmp-editor-statsig": "^226.0.0",
77
- "@atlaskit/tokens": "^20.3.0",
76
+ "@atlaskit/tmp-editor-statsig": "^227.0.0",
77
+ "@atlaskit/tokens": "^20.4.0",
78
78
  "@atlaskit/tooltip": "^24.4.0",
79
79
  "@atlaskit/visually-hidden": "^4.4.0",
80
80
  "@babel/runtime": "^7.0.0",
@@ -88,7 +88,7 @@
88
88
  "uuid": "^11.1.1"
89
89
  },
90
90
  "peerDependencies": {
91
- "@atlaskit/editor-common": "^129.1.0",
91
+ "@atlaskit/editor-common": "^130.0.0",
92
92
  "@atlaskit/link-provider": "^6.0.0",
93
93
  "@atlaskit/media-core": "^39.0.0",
94
94
  "react": "^18.2.0 || ^19.2.0",
@@ -100,7 +100,7 @@
100
100
  "@af/visual-regression": "workspace:^",
101
101
  "@atlaskit/analytics-gas-types": "^6.2.0",
102
102
  "@atlaskit/checkbox": "^19.3.0",
103
- "@atlaskit/editor-plugin-media": "^27.0.0",
103
+ "@atlaskit/editor-plugin-media": "^28.0.0",
104
104
  "@atlaskit/editor-test-helpers": "workspace:^",
105
105
  "@atlaskit/inline-edit": "^16.4.0",
106
106
  "@atlaskit/json-ld-types": "^2.0.0",