@atlaskit/editor-common 134.7.1 → 134.8.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 (77) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/cjs/extensibility/Extension/Extension/index.js +3 -1
  3. package/dist/cjs/extensibility/MultiBodiedExtension/index.js +3 -1
  4. package/dist/cjs/extensibility/utils/get-breakout-width.js +27 -0
  5. package/dist/cjs/extensibility/utils/has-breakout-width.js +11 -0
  6. package/dist/cjs/extensibility/utils/should-extension-breakout.js +10 -1
  7. package/dist/cjs/extensions/messages.js +5 -0
  8. package/dist/cjs/monitoring/error.js +1 -1
  9. package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.compiled.css +2 -9
  10. package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.js +6 -6
  11. package/dist/cjs/quick-insert/ElementBrowserQuickInsertMenuItem.js +76 -103
  12. package/dist/cjs/quick-insert/QuickInsertHoverPreview.compiled.css +1 -38
  13. package/dist/cjs/quick-insert/QuickInsertHoverPreview.js +9 -93
  14. package/dist/cjs/quick-insert/QuickInsertMenuItem.js +2 -1
  15. package/dist/cjs/quick-insert/QuickInsertPreviewContent.compiled.css +38 -0
  16. package/dist/cjs/quick-insert/QuickInsertPreviewContent.js +142 -0
  17. package/dist/cjs/quick-insert/QuickInsertShortcut.compiled.css +10 -0
  18. package/dist/cjs/quick-insert/QuickInsertShortcut.js +28 -0
  19. package/dist/cjs/ui/DropList/index.js +1 -1
  20. package/dist/cjs/ui/HoverLinkOverlay/index.js +45 -10
  21. package/dist/cjs/ui/Layer/index.js +14 -208
  22. package/dist/cjs/vanilla-tooltip/index.js +5 -14
  23. package/dist/es2019/extensibility/Extension/Extension/index.js +3 -1
  24. package/dist/es2019/extensibility/MultiBodiedExtension/index.js +3 -1
  25. package/dist/es2019/extensibility/utils/get-breakout-width.js +9 -0
  26. package/dist/es2019/extensibility/utils/has-breakout-width.js +4 -0
  27. package/dist/es2019/extensibility/utils/should-extension-breakout.js +9 -1
  28. package/dist/es2019/extensions/messages.js +5 -0
  29. package/dist/es2019/monitoring/error.js +1 -1
  30. package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.compiled.css +2 -9
  31. package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.js +6 -6
  32. package/dist/es2019/quick-insert/ElementBrowserQuickInsertMenuItem.js +74 -101
  33. package/dist/es2019/quick-insert/QuickInsertHoverPreview.compiled.css +1 -38
  34. package/dist/es2019/quick-insert/QuickInsertHoverPreview.js +10 -86
  35. package/dist/es2019/quick-insert/QuickInsertMenuItem.js +2 -1
  36. package/dist/es2019/quick-insert/QuickInsertPreviewContent.compiled.css +38 -0
  37. package/dist/es2019/quick-insert/QuickInsertPreviewContent.js +126 -0
  38. package/dist/es2019/quick-insert/QuickInsertShortcut.compiled.css +10 -0
  39. package/dist/es2019/quick-insert/QuickInsertShortcut.js +19 -0
  40. package/dist/es2019/ui/DropList/index.js +1 -1
  41. package/dist/es2019/ui/HoverLinkOverlay/index.js +36 -3
  42. package/dist/es2019/ui/Layer/index.js +15 -192
  43. package/dist/es2019/vanilla-tooltip/index.js +7 -15
  44. package/dist/esm/extensibility/Extension/Extension/index.js +3 -1
  45. package/dist/esm/extensibility/MultiBodiedExtension/index.js +3 -1
  46. package/dist/esm/extensibility/utils/get-breakout-width.js +21 -0
  47. package/dist/esm/extensibility/utils/has-breakout-width.js +6 -0
  48. package/dist/esm/extensibility/utils/should-extension-breakout.js +10 -1
  49. package/dist/esm/extensions/messages.js +5 -0
  50. package/dist/esm/monitoring/error.js +1 -1
  51. package/dist/esm/quick-insert/CompactQuickInsertMenuItem.compiled.css +2 -9
  52. package/dist/esm/quick-insert/CompactQuickInsertMenuItem.js +6 -6
  53. package/dist/esm/quick-insert/ElementBrowserQuickInsertMenuItem.js +77 -104
  54. package/dist/esm/quick-insert/QuickInsertHoverPreview.compiled.css +1 -38
  55. package/dist/esm/quick-insert/QuickInsertHoverPreview.js +10 -93
  56. package/dist/esm/quick-insert/QuickInsertMenuItem.js +2 -1
  57. package/dist/esm/quick-insert/QuickInsertPreviewContent.compiled.css +38 -0
  58. package/dist/esm/quick-insert/QuickInsertPreviewContent.js +135 -0
  59. package/dist/esm/quick-insert/QuickInsertShortcut.compiled.css +10 -0
  60. package/dist/esm/quick-insert/QuickInsertShortcut.js +21 -0
  61. package/dist/esm/ui/DropList/index.js +1 -1
  62. package/dist/esm/ui/HoverLinkOverlay/index.js +45 -10
  63. package/dist/esm/ui/Layer/index.js +15 -211
  64. package/dist/esm/vanilla-tooltip/index.js +7 -15
  65. package/dist/types/extensibility/utils/get-breakout-width.d.ts +3 -0
  66. package/dist/types/extensibility/utils/has-breakout-width.d.ts +3 -0
  67. package/dist/types/extensibility/utils/should-extension-breakout.d.ts +2 -1
  68. package/dist/types/extensions/messages.d.ts +24 -19
  69. package/dist/types/quick-insert/ElementBrowserQuickInsertMenuItem.d.ts +7 -1
  70. package/dist/types/quick-insert/QuickInsertHoverPreview.d.ts +0 -1
  71. package/dist/types/quick-insert/QuickInsertPreviewContent.d.ts +24 -0
  72. package/dist/types/quick-insert/QuickInsertShortcut.d.ts +13 -0
  73. package/dist/types/ui/Layer/index.d.ts +1 -15
  74. package/dist/types/vanilla-tooltip/index.d.ts +1 -1
  75. package/extensibility/get-breakout-width/package.json +10 -0
  76. package/extensibility/has-breakout-width/package.json +10 -0
  77. package/package.json +3 -8
@@ -0,0 +1,10 @@
1
+ ._11c8wadc{font:var(--ds-font-body-small,normal 400 9pt/1pc "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
2
+ ._2rko12b0{border-radius:var(--ds-radius-small,4px)}
3
+ ._18zr1b66{padding-inline:var(--ds-space-050,4px)}
4
+ ._1rjcv77o{padding-block:var(--ds-space-025,2px)}
5
+ ._1o9zidpf{flex-shrink:0}
6
+ ._bfhk187o{background-color:var(--ds-background-disabled,#0515240f)}
7
+ ._bfhki8nm{background-color:var(--ds-background-neutral,#0515240f)}
8
+ ._o5721q9c{white-space:nowrap}
9
+ ._syaz1gmx{color:var(--ds-text-disabled,#080f214a)}
10
+ ._syazazsu{color:var(--ds-text-subtle,#505258)}
@@ -0,0 +1,21 @@
1
+ /* QuickInsertShortcut.tsx generated by @compiled/babel-plugin v3.0.2 */
2
+ import "./QuickInsertShortcut.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React from 'react';
5
+ var styles = {
6
+ shortcut: "_2rko12b0 _11c8wadc _1rjcv77o _18zr1b66 _bfhki8nm _syazazsu _1o9zidpf _o5721q9c",
7
+ disabled: "_bfhk187o _syaz1gmx"
8
+ };
9
+
10
+ /**
11
+ * The keyboard or markdown shortcut chip shown beside a Quick Insert item's title, in both the
12
+ * slash-menu row and the Element Browser tile.
13
+ */
14
+ export var QuickInsertShortcut = function QuickInsertShortcut(_ref) {
15
+ var _ref$isDisabled = _ref.isDisabled,
16
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
17
+ shortcut = _ref.shortcut;
18
+ return /*#__PURE__*/React.createElement("span", {
19
+ className: ax([styles.shortcut, isDisabled && styles.disabled])
20
+ }, shortcut);
21
+ };
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
20
20
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import Layer from '../Layer';
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "134.7.0";
23
+ var packageVersion = "134.7.2";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005
@@ -121,6 +121,7 @@ var HoverLinkOverlay = function HoverLinkOverlay(_ref) {
121
121
  isHovered = _useState4[0],
122
122
  setHovered = _useState4[1];
123
123
  var openTextWidthRef = useRef(null);
124
+ var shouldDeferMeasurement = isExperimentEnabled('platform_editor_improve_inp_batch_2');
124
125
  var regularPadding = DYNAMIC_PADDING_BLOCK;
125
126
  var memoizedHoverLinkStyles = useMemo(function () {
126
127
  return {
@@ -135,21 +136,55 @@ var HoverLinkOverlay = function HoverLinkOverlay(_ref) {
135
136
  if (!isVisible || !isHovered) {
136
137
  return;
137
138
  }
139
+ if (shouldDeferMeasurement) {
140
+ var container = containerRef.current;
141
+ var button = hoverLinkButtonRef.current;
142
+ var hiddenText = hiddenTextRef.current;
143
+ if (!container || !button || !hiddenText) {
144
+ return;
145
+ }
146
+ var observer = new ResizeObserver(function () {
147
+ // One measurement per hover; hiding the label must not trigger another one.
148
+ observer.disconnect();
149
+ var cardWidth = container.offsetWidth;
150
+ var openButtonWidth = button.offsetWidth;
151
+ // Get the hidden text width
152
+ var openTextWidth = hiddenText.offsetWidth || DEFAULT_OPEN_TEXT_WIDTH;
153
+ if (!cardWidth || !openButtonWidth) {
154
+ return;
155
+ }
156
+ var canShowLabel = cardWidth - openTextWidth > MIN_AVAILABLE_SPACE_WITH_LABEL_OVERLAY + ICON_WIDTH;
157
+
158
+ // When a smart link wraps to multiple lines in a constrained container (e.g. table cell),
159
+ // the hover button can overflow beyond the container bounds. We detect this by comparing
160
+ // the button's right edge to the container's right edge, and hide the label if it overflows.
161
+ var containerRight = container.getBoundingClientRect().right;
162
+ var buttonRight = button.getBoundingClientRect().right;
163
+ if (buttonRight > containerRight) {
164
+ canShowLabel = false;
165
+ }
166
+ setShowLabel(canShowLabel);
167
+ });
168
+ observer.observe(button);
169
+ return function () {
170
+ return observer.disconnect();
171
+ };
172
+ }
138
173
  var cardWidth = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetWidth;
139
174
  var openButtonWidth = (_hoverLinkButtonRef$c = hoverLinkButtonRef.current) === null || _hoverLinkButtonRef$c === void 0 ? void 0 : _hoverLinkButtonRef$c.offsetWidth;
140
175
  // Get the hidden text width
141
176
  if (!openTextWidthRef.current) {
142
- var hiddenText = hiddenTextRef.current;
143
- if (hiddenText) {
177
+ var _hiddenText = hiddenTextRef.current;
178
+ if (_hiddenText) {
144
179
  // Measure the width of the hidden text
145
180
  // Temporarily make the element visible to measure its width
146
- hiddenText.style.visibility = 'hidden';
147
- hiddenText.style.display = 'inline';
148
- openTextWidthRef.current = hiddenText.offsetWidth;
181
+ _hiddenText.style.visibility = 'hidden';
182
+ _hiddenText.style.display = 'inline';
183
+ openTextWidthRef.current = _hiddenText.offsetWidth;
149
184
 
150
185
  // Reset the hiddenText's display property
151
- hiddenText.style.display = 'none';
152
- hiddenText.style.visibility = 'inherit';
186
+ _hiddenText.style.display = 'none';
187
+ _hiddenText.style.visibility = 'inherit';
153
188
  } else {
154
189
  openTextWidthRef.current = DEFAULT_OPEN_TEXT_WIDTH;
155
190
  }
@@ -171,7 +206,7 @@ var HoverLinkOverlay = function HoverLinkOverlay(_ref) {
171
206
  }
172
207
  }
173
208
  setShowLabel(canShowLabel);
174
- }, [isVisible, isHovered]);
209
+ }, [isVisible, isHovered, shouldDeferMeasurement]);
175
210
  var handleOverlayChange = function handleOverlayChange(isHovered) {
176
211
  setHovered(isHovered);
177
212
 
@@ -232,13 +267,13 @@ var HoverLinkOverlay = function HoverLinkOverlay(_ref) {
232
267
  ,
233
268
  onFocus: expValEquals('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? function () {} : undefined,
234
269
  onBlur: expValEquals('editor_a11y__enghealth-46814_fy26', 'isEnabled', true) ? function () {} : undefined
235
- }, children, jsx("span", {
270
+ }, children, (!shouldDeferMeasurement || isHovered) && jsx("span", {
236
271
  css: hiddenTextStyle,
237
272
  "aria-hidden": "true"
238
273
  }, jsx(Text, {
239
274
  ref: hiddenTextRef,
240
275
  size: "small",
241
- maxLines: 1
276
+ maxLines: shouldDeferMeasurement ? undefined : 1
242
277
  }, label)), isHovered && jsx(Anchor, {
243
278
  ref: hoverLinkButtonRef,
244
279
  xcss: linkStylesCommon,
@@ -1,39 +1,9 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
- import _inherits from "@babel/runtime/helpers/inherits";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- 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; }
9
- 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; }
10
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
- import React, { Component, useLayoutEffect, useMemo, useRef, useState } from 'react';
13
- // eslint-disable-next-line @atlaskit/design-system/no-third-party-layering -- existing usage from before this rule was added
14
- import Popper from 'popper.js';
15
- // eslint-disable-next-line @atlaskit/design-system/no-third-party-layering -- existing usage from before this rule was added
16
-
17
- // eslint-disable-line import/extensions
18
- import rafSchedule from 'raf-schd';
2
+ import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
19
3
  import { fg } from '@atlaskit/platform-feature-flags/fg';
20
4
  import { Popper as WrappedPopper } from '@atlaskit/popper/main';
5
+ import { Manager } from '@atlaskit/popper/manager';
21
6
  import { positionPropToPopperPosition } from './internal/helpers';
22
- var defaultState = {
23
- hasExtractedStyles: false,
24
- // We set these default offsets to prevent a flash of popper content in the wrong position
25
- // which can cause incorrect height calculations. Popper will calculate these values
26
- offsets: {
27
- popper: {
28
- left: -9999,
29
- top: -9999,
30
- position: null
31
- }
32
- },
33
- cssPosition: 'absolute',
34
- originalHeight: null,
35
- maxHeight: null
36
- };
37
7
  function defaultOnPositioned() {}
38
8
  var defaultProps = {
39
9
  boundariesElement: 'viewport',
@@ -46,170 +16,6 @@ var defaultProps = {
46
16
  isAlwaysFixed: false,
47
17
  onPositioned: defaultOnPositioned
48
18
  };
49
-
50
- // Ignored via go/ees005
51
- // eslint-disable-next-line @repo/internal/react/no-class-components
52
- var LegacyLayer = /*#__PURE__*/function (_Component) {
53
- function LegacyLayer(props) {
54
- var _this;
55
- _classCallCheck(this, LegacyLayer);
56
- _this = _callSuper(this, LegacyLayer, [props]);
57
- _defineProperty(_this, "targetRef", /*#__PURE__*/React.createRef());
58
- _defineProperty(_this, "contentRef", /*#__PURE__*/React.createRef());
59
- _defineProperty(_this, "extractStyles", function (state) {
60
- if (state) {
61
- var popperHeight = state.offsets.popper.height;
62
- var left = Math.round(state.offsets.popper.left);
63
- var top = Math.round(state.offsets.popper.top);
64
- var cssPosition = 'absolute';
65
- var originalHeight = _this.state.originalHeight || popperHeight;
66
- var maxHeight = _this.calculateMaxHeight(originalHeight, popperHeight, top, cssPosition);
67
- _this.setState({
68
- // position: fixed or absolute
69
- cssPosition: cssPosition,
70
- hasExtractedStyles: true,
71
- transform: "translate3d(".concat(left, "px, ").concat(top, "px, 0px)"),
72
- originalHeight: originalHeight,
73
- maxHeight: maxHeight
74
- });
75
- }
76
- });
77
- _this.state = defaultState;
78
- _this.extractStyles = rafSchedule(_this.extractStyles.bind(_this));
79
- return _this;
80
- }
81
- _inherits(LegacyLayer, _Component);
82
- return _createClass(LegacyLayer, [{
83
- key: "componentDidMount",
84
- value: function componentDidMount() {
85
- this.applyPopper(this.props);
86
- }
87
- }, {
88
- key: "componentDidUpdate",
89
- value: function componentDidUpdate(prevProps, prevState) {
90
- var onPositioned = this.props.onPositioned;
91
- var hasExtractedStyles = this.state.hasExtractedStyles;
92
- if (this.props !== prevProps) {
93
- this.applyPopper(this.props);
94
- }
95
-
96
- // This flag is set the first time the position is calculated from Popper and applied to the content
97
- if (!prevState.hasExtractedStyles && hasExtractedStyles && onPositioned) {
98
- onPositioned();
99
- }
100
- }
101
- }, {
102
- key: "componentWillUnmount",
103
- value: function componentWillUnmount() {
104
- // this.extractStyles.cancel();
105
- if (this.popper) {
106
- this.popper.destroy();
107
- }
108
- }
109
-
110
- /* Calculate the max height of the popper if it's height is greater than the viewport to prevent
111
- * the bottom of the popper not being viewable.
112
- * Only works if the popper uses viewport as the boundary and has a fixed position ancestor.
113
- */
114
- }, {
115
- key: "calculateMaxHeight",
116
- value: function calculateMaxHeight(originalHeight, currentHeight, positionTop, cssPosition) {
117
- var DocumentElementClientHeight = 0;
118
- if (document.documentElement) {
119
- DocumentElementClientHeight = document.documentElement.clientHeight;
120
- }
121
- if (cssPosition !== 'fixed') {
122
- return null;
123
- }
124
- var viewportHeight = Math.max(DocumentElementClientHeight, window.innerHeight || 0);
125
- return viewportHeight < originalHeight && currentHeight + positionTop >= viewportHeight - 50 ?
126
- // allow some spacing either side of viewport height
127
- viewportHeight - 12 : null;
128
- }
129
- }, {
130
- key: "applyPopper",
131
- value: function applyPopper(props) {
132
- if (!this.targetRef.current || !this.contentRef.current) {
133
- return;
134
- }
135
- if (this.popper) {
136
- this.popper.destroy();
137
- }
138
-
139
- // "new Popper(...)" operation is very expensive when called on virtual DOM.
140
- // This condition reduces the number of calls so we can run our tests faster
141
- // (time was reduced from 100s to 13s).
142
- if (!props.content) {
143
- return;
144
- }
145
-
146
- // we wrap our target in a div so that we can safely get a reference to it, but we pass the
147
- // actual target to popper
148
- var isAlwaysFixed = false;
149
- var actualTarget = this.targetRef.current.children[0];
150
- var popperOpts = {
151
- placement: positionPropToPopperPosition(props.position),
152
- onCreate: this.extractStyles,
153
- onUpdate: this.extractStyles,
154
- modifiers: {
155
- applyStyle: {
156
- enabled: false
157
- },
158
- hide: {
159
- enabled: false
160
- },
161
- offset: {
162
- enabled: true,
163
- offset: this.props.offset
164
- },
165
- flip: {
166
- enabled: false,
167
- flipVariations: true,
168
- boundariesElement: 'viewport',
169
- padding: 0 // leave 0 pixels between popper and the boundariesElement
170
- },
171
- preventOverflow: {
172
- enabled: false,
173
- escapeWithReference: true
174
- }
175
- },
176
- positionFixed: isAlwaysFixed
177
- };
178
- if (actualTarget) {
179
- this.popper = new Popper(actualTarget, this.contentRef.current, popperOpts);
180
- }
181
- }
182
- }, {
183
- key: "render",
184
- value: function render() {
185
- var _this$state = this.state,
186
- transform = _this$state.transform,
187
- hasExtractedStyles = _this$state.hasExtractedStyles,
188
- maxHeight = _this$state.maxHeight;
189
- var opacity = hasExtractedStyles ? {} : {
190
- opacity: 0
191
- };
192
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
193
- ref: this.targetRef
194
- }, this.props.children), /*#__PURE__*/React.createElement("div", {
195
- ref: this.contentRef,
196
- style: _objectSpread({
197
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
198
- top: 0,
199
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
200
- left: 0,
201
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
202
- position: 'absolute',
203
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
204
- transform: transform,
205
- maxHeight: maxHeight ? maxHeight : 'auto'
206
- }, opacity)
207
- }, this.props.content));
208
- }
209
- }]);
210
- }(Component);
211
- // working with extract-react-types
212
- _defineProperty(LegacyLayer, "defaultProps", defaultProps);
213
19
  function parseOffset(_ref) {
214
20
  var offset = _ref.offset;
215
21
  var _offset$split = offset.split(','),
@@ -294,11 +100,17 @@ function PopperInterop(_ref3) {
294
100
  }, [children]);
295
101
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
296
102
  ref: targetRef
297
- }, children), content && referenceElement ? /*#__PURE__*/React.createElement(WrappedPopper, {
103
+ }, children), content ?
104
+ /*#__PURE__*/
105
+ // Mount `content` in the same commit as the Layer, before `referenceElement` resolves.
106
+ // Callers act on the content DOM in that commit: DropList focuses it, and menus
107
+ // dispatch `ArrowDown` to focus their first item. The `Manager` stops Popper from
108
+ // using an ancestor `Manager`'s reference until `referenceElement` is set.
109
+ React.createElement(Manager, null, /*#__PURE__*/React.createElement(WrappedPopper, {
298
110
  modifiers: modifiers,
299
111
  offset: parsedOffset,
300
112
  placement: positionPropToPopperPosition(position),
301
- referenceElement: referenceElement,
113
+ referenceElement: referenceElement !== null && referenceElement !== void 0 ? referenceElement : undefined,
302
114
  strategy: strategy
303
115
  }, function (_ref4) {
304
116
  var ref = _ref4.ref,
@@ -307,10 +119,10 @@ function PopperInterop(_ref3) {
307
119
  ref: ref,
308
120
  style: style
309
121
  }, content);
310
- }) : /*#__PURE__*/React.createElement("div", null));
122
+ })) : /*#__PURE__*/React.createElement("div", null));
311
123
  }
312
124
 
313
- /** Selects the reversible Popper v1 or ADS wrapper implementation. */
125
+ /** Positions `content` next to `children` with the ADS Popper wrapper. */
314
126
  export default function Layer(_ref5) {
315
127
  var _ref5$children = _ref5.children,
316
128
  children = _ref5$children === void 0 ? defaultProps.children : _ref5$children,
@@ -322,19 +134,11 @@ export default function Layer(_ref5) {
322
134
  onPositioned = _ref5$onPositioned === void 0 ? defaultProps.onPositioned : _ref5$onPositioned,
323
135
  _ref5$position = _ref5.position,
324
136
  position = _ref5$position === void 0 ? defaultProps.position : _ref5$position;
325
- if (fg('platform-dst-popper-consolidation')) {
326
- return /*#__PURE__*/React.createElement(PopperInterop, {
327
- content: content,
328
- offset: offset,
329
- onPositioned: onPositioned,
330
- position: position,
331
- strategy: "absolute"
332
- }, children);
333
- }
334
- return /*#__PURE__*/React.createElement(LegacyLayer, {
137
+ return /*#__PURE__*/React.createElement(PopperInterop, {
335
138
  content: content,
336
139
  offset: offset,
337
140
  onPositioned: onPositioned,
338
- position: position
141
+ position: position,
142
+ strategy: "absolute"
339
143
  }, children);
340
144
  }
@@ -4,11 +4,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  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; }
5
5
  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; }
6
6
  // eslint-disable-next-line @atlaskit/design-system/no-third-party-layering -- existing usage from before this rule was added
7
- import { createPopper as createLegacyPopper } from '@popperjs/core';
7
+
8
8
  import { bind } from 'bind-event-listener';
9
9
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
10
- import { fg } from '@atlaskit/platform-feature-flags/fg';
11
- import { createPopper as createWrappedPopper } from '@atlaskit/popper/unsafe-imperative';
10
+ import { createPopper } from '@atlaskit/popper/unsafe-imperative';
12
11
  import { logException } from '../monitoring/error';
13
12
  var startingOffset = {
14
13
  name: 'offset',
@@ -48,12 +47,6 @@ var generateTooltipId = function () {
48
47
  return typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function' ? "".concat(TOOLTIP_ID_PREFIX, "-").concat(crypto.randomUUID()) : "".concat(TOOLTIP_ID_PREFIX, "-").concat(count += 1);
49
48
  };
50
49
  }();
51
- function getCreatePopper() {
52
- if (fg('platform-dst-popper-consolidation')) {
53
- return createWrappedPopper;
54
- }
55
- return createLegacyPopper;
56
- }
57
50
 
58
51
  /**
59
52
  * A tooltip component similar to "@atlaskit/tooltip" but built for vanilla scenarios
@@ -281,7 +274,7 @@ export var VanillaTooltip = /*#__PURE__*/function () {
281
274
  }, {
282
275
  key: "createPopperInstance",
283
276
  value: function createPopperInstance() {
284
- this.popperInstance = getCreatePopper()(this.trigger, this.tooltip, {
277
+ this.popperInstance = createPopper(this.trigger, this.tooltip, {
285
278
  placement: this.placement,
286
279
  modifiers: [startingOffset]
287
280
  });
@@ -370,13 +363,12 @@ export var VanillaTooltip = /*#__PURE__*/function () {
370
363
  var _this3$popperInstance;
371
364
  // Released rather than reconfigured. The instance was previously kept for the
372
365
  // trigger's whole lifetime, so every element the pointer passed over retained
373
- // one — and under `platform-dst-popper-consolidation` an instance owns a
374
- // detached React root, so that was a retained root per hovered trigger.
366
+ // one — and an instance owns a detached React root, so that was a retained
367
+ // root per hovered trigger.
375
368
  //
376
369
  // Destroying is also the only way to release that root's capture-phase
377
- // `scroll`/`resize` listeners on the consolidated path, where the
378
- // `eventListeners: false` reconfiguration in the control arm is accepted but
379
- // does nothing.
370
+ // `scroll`/`resize` listeners, where the `eventListeners: false`
371
+ // reconfiguration in the control arm is accepted but does nothing.
380
372
  (_this3$popperInstance = _this3.popperInstance) === null || _this3$popperInstance === void 0 || _this3$popperInstance.destroy();
381
373
  _this3.popperInstance = undefined;
382
374
  _this3.tooltip.style.opacity = '0';
@@ -0,0 +1,3 @@
1
+ import type { Mark } from '@atlaskit/editor-prosemirror/model';
2
+ /** returns the breakout width if the node has a breakout mark with a positive breakout width. */
3
+ export declare const getBreakoutWidth: (marks?: readonly Mark[]) => number | undefined;
@@ -0,0 +1,3 @@
1
+ import type { Mark } from '@atlaskit/editor-prosemirror/model';
2
+ /** returns true if the node has a breakout mark with a positive breakout width. */
3
+ export declare const hasBreakoutWidth: (marks?: readonly Mark[]) => boolean;
@@ -2,8 +2,9 @@ import type { EditorAppearance } from '../../types';
2
2
  interface ShouldExtensionBreakoutArgs {
3
3
  editorAppearance?: EditorAppearance;
4
4
  hasBreakoutMark?: boolean;
5
+ hasBreakoutWidth?: boolean;
5
6
  isTopLevelNode?: boolean;
6
7
  layout?: string;
7
8
  }
8
- export declare const shouldExtensionBreakout: ({ layout, isTopLevelNode, editorAppearance, hasBreakoutMark, }: ShouldExtensionBreakoutArgs) => boolean;
9
+ export declare const shouldExtensionBreakout: ({ layout, isTopLevelNode, editorAppearance, hasBreakoutMark, hasBreakoutWidth, }: ShouldExtensionBreakoutArgs) => boolean;
9
10
  export {};
@@ -1,58 +1,63 @@
1
1
  export declare const messages: {
2
- edit: {
3
- id: string;
2
+ confirmDeleteLinkedModalMessage: {
4
3
  defaultMessage: string;
5
4
  description: string;
6
- };
7
- deleteElementTitle: {
8
5
  id: string;
6
+ };
7
+ confirmDeleteLinkedModalOKButton: {
9
8
  defaultMessage: string;
10
9
  description: string;
11
- };
12
- unnamedSource: {
13
10
  id: string;
11
+ };
12
+ confirmModalCheckboxLabel: {
14
13
  defaultMessage: string;
15
14
  description: string;
16
- };
17
- confirmDeleteLinkedModalOKButton: {
18
15
  id: string;
16
+ };
17
+ customWidth: {
19
18
  defaultMessage: string;
20
19
  description: string;
21
- };
22
- confirmDeleteLinkedModalMessage: {
23
20
  id: string;
21
+ };
22
+ deleteElementTitle: {
24
23
  defaultMessage: string;
25
24
  description: string;
26
- };
27
- confirmModalCheckboxLabel: {
28
25
  id: string;
26
+ };
27
+ edit: {
29
28
  defaultMessage: string;
30
29
  description: string;
31
- };
32
- saveIndicator: {
33
30
  id: string;
31
+ };
32
+ extensionLoadingError: {
34
33
  defaultMessage: string;
35
34
  description: string;
35
+ id: string;
36
36
  };
37
37
  panelLoadingError: {
38
- id: string;
39
38
  defaultMessage: string;
40
39
  description: string;
40
+ id: string;
41
41
  };
42
- extensionLoadingError: {
42
+ saveIndicator: {
43
+ defaultMessage: string;
44
+ description: string;
43
45
  id: string;
46
+ };
47
+ unknownMacroHeader: {
44
48
  defaultMessage: string;
45
49
  description: string;
50
+ id: string;
46
51
  };
47
52
  unknownMacroPlaceholderAriaLabel: {
48
- id: string;
49
53
  defaultMessage: string;
50
54
  description: string;
51
- };
52
- unknownMacroHeader: {
53
55
  id: string;
56
+ };
57
+ unnamedSource: {
54
58
  defaultMessage: string;
55
59
  description: string;
60
+ id: string;
56
61
  };
57
62
  };
58
63
  export { configPanelMessages } from './configPanelMessages';
@@ -4,4 +4,10 @@
4
4
  */
5
5
  import React from 'react';
6
6
  import type { QuickInsertMenuItemProps } from './QuickInsertMenuItem';
7
- export declare const ElementBrowserQuickInsertMenuItem: ({ ariaLabel, description, iconBefore, isDisabled, lozenge, onSelect, shortcut, titleContent, shouldWrapIcon, title, }: QuickInsertMenuItemProps) => React.JSX.Element;
7
+ /**
8
+ * An Element Browser tile: the item's hover preview card (image, title, full description, and
9
+ * attribution), with its shortcut beside the title. Items without a preview image show their icon,
10
+ * always in a bordered box, above the title instead. The hover card's small title icon
11
+ * (`previewIcon`) is not shown, so a tile never repeats its icon.
12
+ */
13
+ export declare const ElementBrowserQuickInsertMenuItem: ({ ariaLabel, description, iconBefore, isDisabled, lozenge, onSelect, preview, previewImageUrls, shortcut, titleContent, title, }: QuickInsertMenuItemProps) => React.JSX.Element;
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
- * @jsxFrag React.Fragment
5
4
  */
6
5
  import React, { type ReactNode } from 'react';
7
6
  import type { QuickInsertPreview } from './preview';
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import React, { type ReactNode } from 'react';
6
+ import type { QuickInsertPreview } from './preview';
7
+ /**
8
+ * The image, title, description, and attribution shared by the Quick Insert hover preview and
9
+ * Element Browser tiles. It fills its container; callers own its width and accessible name.
10
+ */
11
+ export declare const QuickInsertPreviewContent: ({ description, icon, id, isDisabled, lozenge, preview, shortcut, shouldClampText, title, }: {
12
+ description?: string;
13
+ icon?: ReactNode;
14
+ /** Lets the slash-menu row or Element Browser tile point aria-describedby at this content. */
15
+ id?: string;
16
+ isDisabled?: boolean;
17
+ lozenge?: ReactNode;
18
+ preview: QuickInsertPreview;
19
+ /** Shown at the end of the title row, inside this content so it is announced with the description. */
20
+ shortcut?: string;
21
+ shouldClampText?: boolean;
22
+ /** Visual title only: the slash-menu row or Element Browser tile already has it as its accessible name. */
23
+ title: ReactNode;
24
+ }) => React.JSX.Element;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import React from 'react';
6
+ /**
7
+ * The keyboard or markdown shortcut chip shown beside a Quick Insert item's title, in both the
8
+ * slash-menu row and the Element Browser tile.
9
+ */
10
+ export declare const QuickInsertShortcut: ({ isDisabled, shortcut, }: {
11
+ isDisabled?: boolean;
12
+ shortcut: string;
13
+ }) => React.JSX.Element;
@@ -7,19 +7,5 @@ export type Props = {
7
7
  onPositioned: () => void;
8
8
  position: string;
9
9
  };
10
- export type State = {
11
- cssPosition: string;
12
- hasExtractedStyles: boolean;
13
- maxHeight: number | null;
14
- offsets: {
15
- popper: {
16
- left: number;
17
- top: number;
18
- };
19
- };
20
- originalHeight: number | null;
21
- position?: string;
22
- transform?: string;
23
- };
24
- /** Selects the reversible Popper v1 or ADS wrapper implementation. */
10
+ /** Positions `content` next to `children` with the ADS Popper wrapper. */
25
11
  export default function Layer({ children, content, offset, onPositioned, position, }: Partial<Props>): ReactNode;
@@ -1,4 +1,4 @@
1
- import { type Placement } from '@popperjs/core';
1
+ import type { Placement } from '@popperjs/core';
2
2
  /**
3
3
  * Opt-in class for the default tooltip look, defined as `vanillaTooltipDefaultStyles` in
4
4
  * EditorContentContainer. Pass it alongside your own class name.