@atlaskit/editor-common 65.0.0 → 66.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 (78) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/normalize-feature-flags.js +40 -4
  3. package/dist/cjs/styles/shared/link.js +2 -2
  4. package/dist/cjs/styles/shared/lists.js +1 -1
  5. package/dist/cjs/styles/shared/panel.js +7 -4
  6. package/dist/cjs/styles/shared/rule.js +5 -2
  7. package/dist/cjs/styles/shared/table.js +1 -1
  8. package/dist/cjs/ui/Expand/index.js +84 -46
  9. package/dist/cjs/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +9 -9
  10. package/dist/cjs/ui/MediaSingle/index.js +13 -8
  11. package/dist/cjs/ui/MediaSingle/styled.js +23 -20
  12. package/dist/cjs/ui/Popup/index.js +15 -1
  13. package/dist/cjs/ui/UnsupportedBlock/index.js +1 -1
  14. package/dist/cjs/ui/index.js +12 -22
  15. package/dist/cjs/utils/compare-props.js +136 -0
  16. package/dist/cjs/utils/index.js +23 -1
  17. package/dist/cjs/utils/performance/hooks/use-component-render-tracking/index.js +47 -0
  18. package/dist/cjs/utils/validator.js +1 -1
  19. package/dist/cjs/version.json +1 -1
  20. package/dist/es2019/normalize-feature-flags.js +40 -4
  21. package/dist/es2019/styles/shared/link.js +1 -1
  22. package/dist/es2019/styles/shared/lists.js +2 -0
  23. package/dist/es2019/styles/shared/panel.js +15 -15
  24. package/dist/es2019/styles/shared/rule.js +3 -3
  25. package/dist/es2019/styles/shared/table.js +9 -1
  26. package/dist/es2019/ui/Expand/index.js +97 -67
  27. package/dist/es2019/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +1 -1
  28. package/dist/es2019/ui/MediaSingle/index.js +13 -9
  29. package/dist/es2019/ui/MediaSingle/styled.js +13 -12
  30. package/dist/es2019/ui/Popup/index.js +16 -1
  31. package/dist/es2019/ui/UnsupportedBlock/index.js +0 -1
  32. package/dist/es2019/ui/index.js +2 -4
  33. package/dist/es2019/utils/compare-props.js +99 -0
  34. package/dist/es2019/utils/index.js +3 -1
  35. package/dist/es2019/utils/performance/hooks/use-component-render-tracking/index.js +36 -0
  36. package/dist/es2019/utils/validator.js +1 -1
  37. package/dist/es2019/version.json +1 -1
  38. package/dist/esm/normalize-feature-flags.js +39 -4
  39. package/dist/esm/styles/shared/link.js +1 -1
  40. package/dist/esm/styles/shared/lists.js +1 -1
  41. package/dist/esm/styles/shared/panel.js +6 -4
  42. package/dist/esm/styles/shared/rule.js +4 -2
  43. package/dist/esm/styles/shared/table.js +1 -1
  44. package/dist/esm/ui/Expand/index.js +79 -42
  45. package/dist/esm/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +7 -7
  46. package/dist/esm/ui/MediaSingle/index.js +14 -9
  47. package/dist/esm/ui/MediaSingle/styled.js +17 -10
  48. package/dist/esm/ui/Popup/index.js +16 -1
  49. package/dist/esm/ui/UnsupportedBlock/index.js +1 -1
  50. package/dist/esm/ui/index.js +2 -4
  51. package/dist/esm/utils/compare-props.js +115 -0
  52. package/dist/esm/utils/index.js +3 -1
  53. package/dist/esm/utils/performance/hooks/use-component-render-tracking/index.js +37 -0
  54. package/dist/esm/utils/validator.js +1 -1
  55. package/dist/esm/version.json +1 -1
  56. package/dist/types/extensions/types/field-definitions.d.ts +1 -1
  57. package/dist/types/normalize-feature-flags.d.ts +6 -3
  58. package/dist/types/styles/shared/link.d.ts +1 -1
  59. package/dist/types/styles/shared/panel.d.ts +1 -1
  60. package/dist/types/styles/shared/rule.d.ts +2 -1
  61. package/dist/types/ui/Expand/index.d.ts +12 -10
  62. package/dist/types/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.d.ts +1 -1
  63. package/dist/types/ui/MediaSingle/index.d.ts +4 -2
  64. package/dist/types/ui/MediaSingle/styled.d.ts +10 -5
  65. package/dist/types/ui/Popup/index.d.ts +3 -0
  66. package/dist/types/ui/index.d.ts +2 -4
  67. package/dist/types/utils/compare-props.d.ts +32 -0
  68. package/dist/types/utils/index.d.ts +4 -0
  69. package/dist/types/utils/performance/hooks/use-component-render-tracking/index.d.ts +19 -0
  70. package/package.json +13 -14
  71. package/dist/cjs/ui/IntlLegacyFallbackProvider/index.js +0 -60
  72. package/dist/cjs/ui/LegacyToNextIntlProvider/index.js +0 -67
  73. package/dist/es2019/ui/IntlLegacyFallbackProvider/index.js +0 -21
  74. package/dist/es2019/ui/LegacyToNextIntlProvider/index.js +0 -24
  75. package/dist/esm/ui/IntlLegacyFallbackProvider/index.js +0 -45
  76. package/dist/esm/ui/LegacyToNextIntlProvider/index.js +0 -51
  77. package/dist/types/ui/IntlLegacyFallbackProvider/index.d.ts +0 -8
  78. package/dist/types/ui/LegacyToNextIntlProvider/index.d.ts +0 -8
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
 
4
4
  var _templateObject;
5
5
 
6
- import { css } from 'styled-components';
6
+ import { css } from '@emotion/react';
7
7
  import { PanelType } from '@atlaskit/adf-schema';
8
8
  import { akEditorTableCellMinWidth, blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
9
9
  import { akEditorCustomIconSize } from '@atlaskit/editor-shared-styles/consts';
@@ -181,6 +181,8 @@ var mainDynamicStyles = function mainDynamicStyles(panelType) {
181
181
  };
182
182
  };
183
183
 
184
- export var panelSharedStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n border-radius: ", "px;\n margin: ", " 0 0;\n padding: ", "px;\n min-width: ", "px;\n display: flex;\n position: relative;\n align-items: baseline;\n word-break: break-word;\n\n ", "\n\n .", " {\n flex-shrink: 0;\n height: ", "px;\n width: ", "px;\n box-sizing: content-box;\n padding-right: ", "px;\n text-align: center;\n user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n ", "\n\n > span {\n vertical-align: middle;\n display: inline-flex;\n }\n\n .", " {\n vertical-align: ", "px;\n }\n\n .", " {\n vertical-align: ", "px;\n\n // Vertical align only works for inline-block elements in Firefox\n @-moz-document url-prefix() {\n img {\n display: inline-block;\n }\n }\n }\n }\n\n .ak-editor-panel__content {\n margin: 1px 0 1px;\n flex: 1 0 0;\n /*\n https://ishadeed.com/article/min-max-css/#setting-min-width-to-zero-with-flexbox\n The default value for min-width is auto, which is computed to zero. When an element is a flex item, the value of min-width doesn\u2019t compute to zero. The minimum size of a flex item is equal to the size of its contents.\n */\n min-width: 0;\n }\n\n &[data-panel-type='", "'] {\n ", "\n\n .", " {\n ", "\n }\n }\n\n &[data-panel-type='", "'] {\n ", "\n\n .", " {\n ", "\n }\n }\n\n &[data-panel-type='", "'] {\n ", "\n\n .", " {\n ", "\n }\n }\n\n &[data-panel-type='", "'] {\n ", "\n\n .", " {\n ", "\n }\n }\n\n &[data-panel-type='", "'] {\n ", "\n\n .", " {\n ", "\n }\n }\n\n &[data-panel-type='", "'] {\n ", ";\n }\n }\n"])), PanelSharedCssClassName.prefix, borderRadius(), blockNodesVerticalMargin, gridSize(), akEditorTableCellMinWidth, mainDynamicStyles(PanelType.INFO), PanelSharedCssClassName.icon, gridSize() * 3, gridSize() * 3, gridSize(), iconDynamicStyles(PanelType.INFO), emojiSprite, panelEmojiSpriteVerticalAlignment, emojiImage, panelEmojiImageVerticalAlignment, PanelType.NOTE, mainDynamicStyles(PanelType.NOTE), PanelSharedCssClassName.icon, iconDynamicStyles(PanelType.NOTE), PanelType.TIP, mainDynamicStyles(PanelType.TIP), PanelSharedCssClassName.icon, iconDynamicStyles(PanelType.TIP), PanelType.WARNING, mainDynamicStyles(PanelType.WARNING), PanelSharedCssClassName.icon, iconDynamicStyles(PanelType.WARNING), PanelType.ERROR, mainDynamicStyles(PanelType.ERROR), PanelSharedCssClassName.icon, iconDynamicStyles(PanelType.ERROR), PanelType.SUCCESS, mainDynamicStyles(PanelType.SUCCESS), PanelSharedCssClassName.icon, iconDynamicStyles(PanelType.SUCCESS), PanelType.CUSTOM, themed({
185
- dark: getPanelBackgroundDarkModeColors
186
- }));
184
+ export var panelSharedStyles = function panelSharedStyles(props) {
185
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n border-radius: ", "px;\n margin: ", " 0 0;\n padding: ", "px;\n min-width: ", "px;\n display: flex;\n position: relative;\n align-items: baseline;\n word-break: break-word;\n\n ", "\n\n .", " {\n flex-shrink: 0;\n height: ", "px;\n width: ", "px;\n box-sizing: content-box;\n padding-right: ", "px;\n text-align: center;\n user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n ", "\n\n > span {\n vertical-align: middle;\n display: inline-flex;\n }\n\n .", " {\n vertical-align: ", "px;\n }\n\n .", " {\n vertical-align: ", "px;\n\n // Vertical align only works for inline-block elements in Firefox\n @-moz-document url-prefix() {\n img {\n display: inline-block;\n }\n }\n }\n }\n\n .ak-editor-panel__content {\n margin: 1px 0 1px;\n flex: 1 0 0;\n /*\n https://ishadeed.com/article/min-max-css/#setting-min-width-to-zero-with-flexbox\n The default value for min-width is auto, which is computed to zero. When an element is a flex item, the value of min-width doesn\u2019t compute to zero. The minimum size of a flex item is equal to the size of its contents.\n */\n min-width: 0;\n }\n\n &[data-panel-type='", "'] {\n ", "\n\n .", " {\n ", "\n }\n }\n\n &[data-panel-type='", "'] {\n ", "\n\n .", " {\n ", "\n }\n }\n\n &[data-panel-type='", "'] {\n ", "\n\n .", " {\n ", "\n }\n }\n\n &[data-panel-type='", "'] {\n ", "\n\n .", " {\n ", "\n }\n }\n\n &[data-panel-type='", "'] {\n ", "\n\n .", " {\n ", "\n }\n }\n\n &[data-panel-type='", "'] {\n ", ";\n }\n }\n"])), PanelSharedCssClassName.prefix, borderRadius(), blockNodesVerticalMargin, gridSize(), akEditorTableCellMinWidth, mainDynamicStyles(PanelType.INFO)(props), PanelSharedCssClassName.icon, gridSize() * 3, gridSize() * 3, gridSize(), iconDynamicStyles(PanelType.INFO)(props), emojiSprite, panelEmojiSpriteVerticalAlignment, emojiImage, panelEmojiImageVerticalAlignment, PanelType.NOTE, mainDynamicStyles(PanelType.NOTE)(props), PanelSharedCssClassName.icon, iconDynamicStyles(PanelType.NOTE)(props), PanelType.TIP, mainDynamicStyles(PanelType.TIP)(props), PanelSharedCssClassName.icon, iconDynamicStyles(PanelType.TIP)(props), PanelType.WARNING, mainDynamicStyles(PanelType.WARNING)(props), PanelSharedCssClassName.icon, iconDynamicStyles(PanelType.WARNING)(props), PanelType.ERROR, mainDynamicStyles(PanelType.ERROR)(props), PanelSharedCssClassName.icon, iconDynamicStyles(PanelType.ERROR)(props), PanelType.SUCCESS, mainDynamicStyles(PanelType.SUCCESS)(props), PanelSharedCssClassName.icon, iconDynamicStyles(PanelType.SUCCESS)(props), PanelType.CUSTOM, themed({
186
+ dark: getPanelBackgroundDarkModeColors
187
+ })(props));
188
+ };
@@ -2,7 +2,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
2
2
 
3
3
  var _templateObject;
4
4
 
5
- import { css } from 'styled-components';
5
+ import { css } from '@emotion/react';
6
6
  import { akEditorLineHeight } from '@atlaskit/editor-shared-styles';
7
7
  import { DN50, N30A } from '@atlaskit/theme/colors';
8
8
  import { themed } from '@atlaskit/theme/components';
@@ -11,4 +11,6 @@ var divider = themed({
11
11
  dark: DN50
12
12
  }); // @see typography spreadsheet: https://docs.google.com/spreadsheets/d/1iYusRGCT4PoPfvxbJ8NrgjtfFgXLm5lpDWXzjua1W2E/edit#gid=93913128
13
13
 
14
- export var ruleSharedStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & hr {\n border: none;\n background-color: ", ";\n margin: ", "em 0;\n height: 2px;\n border-radius: 1px;\n }\n"])), divider, akEditorLineHeight);
14
+ export var ruleSharedStyles = function ruleSharedStyles(props) {
15
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & hr {\n border: none;\n background-color: ", ";\n margin: ", "em 0;\n height: 2px;\n border-radius: 1px;\n }\n"])), divider(props), akEditorLineHeight);
16
+ };
@@ -32,7 +32,7 @@ export var TableSharedCssClassName = {
32
32
  };
33
33
 
34
34
  var tableSharedStyle = function tableSharedStyle(props) {
35
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n position: relative;\n margin: 0 auto ", "px;\n box-sizing: border-box;\n\n /**\n * Fix block top alignment inside table cells.\n */\n .decisionItemView-content-wrap:first-child > div {\n margin-top: 0;\n }\n }\n .", "[data-number-column='true'] {\n padding-left: ", "px;\n clear: both;\n }\n /* avoid applying styles to nested tables (possible via extensions) */\n .", " > table,\n .", " > table,\n .", " > table {\n border-collapse: collapse;\n margin: ", "px ", "px 0 0;\n border: ", "px solid\n ", ";\n table-layout: fixed;\n font-size: 1em;\n width: 100%;\n\n &[data-autosize='true'] {\n table-layout: auto;\n }\n\n & {\n * {\n box-sizing: border-box;\n }\n hr {\n box-sizing: content-box;\n }\n\n tbody {\n border-bottom: none;\n }\n th td {\n background-color: white;\n }\n th,\n td {\n min-width: ", "px;\n font-weight: normal;\n vertical-align: top;\n border: 1px solid\n ", ";\n border-right-width: 0;\n border-bottom-width: 0;\n padding: ", "px;\n /* https://stackoverflow.com/questions/7517127/borders-not-shown-in-firefox-with-border-collapse-on-table-position-relative-o */\n ", "\n\n ", ";\n\n > *:first-child {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor.-right:first-child + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child + span + * {\n margin-top: 0;\n }\n\n th p:not(:first-of-type),\n td p:not(:first-of-type) {\n margin-top: 12px;\n }\n }\n th {\n background-color: ", ";\n text-align: left;\n\n /* only apply this styling to codeblocks in default background headercells */\n /* TODO this needs to be overhauled as it relies on unsafe selectors */\n &:not([style]) {\n .code-block {\n background-image: ", ";\n background-attachment: local, scroll, scroll;\n background-position: 100% 0, 100% 0, 0 0;\n background-color: ", ";\n\n .line-number-gutter {\n background-color: ", ";\n }\n\n /* this is only relevant to the element taken care of by renderer */\n > [data-ds--code--code-block] {\n background-image: ", "!important;\n\n background-color: ", "!important;\n\n // selector lives inside @atlaskit/code\n --ds--code--line-number-bg-color: ", ";\n }\n }\n }\n }\n }\n }\n"])), TableSharedCssClassName.TABLE_CONTAINER, tableMarginBottom, TableSharedCssClassName.TABLE_CONTAINER, akEditorTableNumberColumnWidth - 1, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_NODE_WRAPPER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableMarginTop, tableMarginSides, tableCellBorderWidth, themed({
35
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n position: relative;\n margin: 0 auto ", "px;\n box-sizing: border-box;\n\n /**\n * Fix block top alignment inside table cells.\n */\n .decisionItemView-content-wrap:first-child > div {\n margin-top: 0;\n }\n }\n .", "[data-number-column='true'] {\n padding-left: ", "px;\n clear: both;\n }\n .", " > table {\n margin: ", "px 0 0 0;\n }\n\n .", " > table,\n .", " > table {\n margin: ", "px ", "px 0 0;\n }\n\n /* avoid applying styles to nested tables (possible via extensions) */\n .", " > table,\n .", " > table,\n .", " > table {\n border-collapse: collapse;\n border: ", "px solid\n ", ";\n table-layout: fixed;\n font-size: 1em;\n width: 100%;\n\n &[data-autosize='true'] {\n table-layout: auto;\n }\n\n & {\n * {\n box-sizing: border-box;\n }\n hr {\n box-sizing: content-box;\n }\n\n tbody {\n border-bottom: none;\n }\n th td {\n background-color: white;\n }\n th,\n td {\n min-width: ", "px;\n font-weight: normal;\n vertical-align: top;\n border: 1px solid\n ", ";\n border-right-width: 0;\n border-bottom-width: 0;\n padding: ", "px;\n /* https://stackoverflow.com/questions/7517127/borders-not-shown-in-firefox-with-border-collapse-on-table-position-relative-o */\n ", "\n\n ", ";\n\n > *:first-child {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor.-right:first-child + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child + span + * {\n margin-top: 0;\n }\n\n th p:not(:first-of-type),\n td p:not(:first-of-type) {\n margin-top: 12px;\n }\n }\n th {\n background-color: ", ";\n text-align: left;\n\n /* only apply this styling to codeblocks in default background headercells */\n /* TODO this needs to be overhauled as it relies on unsafe selectors */\n &:not([style]) {\n .code-block {\n background-image: ", ";\n background-attachment: local, scroll, scroll;\n background-position: 100% 0, 100% 0, 0 0;\n background-color: ", ";\n\n .line-number-gutter {\n background-color: ", ";\n }\n\n /* this is only relevant to the element taken care of by renderer */\n > [data-ds--code--code-block] {\n background-image: ", "!important;\n\n background-color: ", "!important;\n\n // selector lives inside @atlaskit/code\n --ds--code--line-number-bg-color: ", ";\n }\n }\n }\n }\n }\n }\n"])), TableSharedCssClassName.TABLE_CONTAINER, tableMarginBottom, TableSharedCssClassName.TABLE_CONTAINER, akEditorTableNumberColumnWidth - 1, TableSharedCssClassName.TABLE_NODE_WRAPPER, tableMarginTop, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableMarginTop, tableMarginSides, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_NODE_WRAPPER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableCellBorderWidth, themed({
36
36
  light: akEditorTableBorder,
37
37
  dark: akEditorTableBorderDark
38
38
  })(props), tableCellMinWidth, themed({
@@ -1,9 +1,14 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
1
3
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
4
+ var _excluded = ["children"];
2
5
 
3
6
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
4
7
 
8
+ /** @jsx jsx */
9
+ import React, { forwardRef } from 'react';
10
+ import { css, jsx } from '@emotion/react';
5
11
  import { defineMessages } from 'react-intl-next';
6
- import styled, { css } from 'styled-components';
7
12
  import { akEditorLineHeight, akEditorSwoopCubicBezier, akLayoutGutterOffset, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
8
13
  import * as colors from '@atlaskit/theme/colors';
9
14
  import { themed } from '@atlaskit/theme/components';
@@ -42,47 +47,79 @@ var EXPAND_EXPANDED_BORDER_COLOR = themed({
42
47
  light: colors.N40A,
43
48
  dark: colors.DN50
44
49
  });
45
- export var ExpandIconWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n display: flex;\n color: ", ";\n border-radius: ", "px;\n width: 24px;\n height: 24px;\n\n &:hover {\n background: ", ";\n }\n\n svg {\n ", "\n transition: transform 0.2s ", ";\n }\n"])), themed({
46
- light: colors.N90,
47
- dark: '#d9dde3'
48
- }), gridSize() / 2, colors.N30A, function (props) {
49
- return props.expanded ? 'transform: rotate(90deg);' : '';
50
- }, akEditorSwoopCubicBezier);
51
- export var ExpandLayoutWrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: ", "px;\n height: ", "px;\n"])), gridSize() * 3, gridSize() * 3);
52
- var ContainerStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n border-radius: ", "px;\n min-height: 25px;\n background: ", ";\n margin: ", ";\n\n transition: background 0.3s ", ",\n border-color 0.3s ", ";\n padding: ", "px;\n\n &:hover {\n border: 1px solid ", ";\n background: ", ";\n }\n\n td > &:first-child {\n margin-top: 0;\n }\n"])), function (_ref) {
53
- var expanded = _ref.expanded,
54
- focused = _ref.focused;
55
- var expandedBorderColor = expanded ? EXPAND_EXPANDED_BORDER_COLOR : EXPAND_COLLAPSED_BORDER_COLOR;
56
- return focused ? EXPAND_FOCUSED_BORDER_COLOR : expandedBorderColor;
57
- }, BORDER_RADIUS, function (_ref2) {
58
- var expanded = _ref2.expanded;
59
- return !expanded ? EXPAND_COLLAPSED_BACKGROUND : EXPAND_SELECTED_BACKGROUND;
60
- }, function (props) {
61
- return "".concat(gridSize() / 2 / fontSize(), "rem ").concat( // Only only these margins if the expand isn't editable
62
- // and is the root level expand.
63
- props['data-node-type'] === 'expand' ? "-".concat(akLayoutGutterOffset, "px") : "0", " 0");
64
- }, akEditorSwoopCubicBezier, akEditorSwoopCubicBezier, gridSize, themed({
65
- light: colors.N50A,
66
- dark: colors.DN50
67
- }), EXPAND_SELECTED_BACKGROUND);
68
- var ContentStyles = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", ";\n"])), function (_ref3) {
69
- var expanded = _ref3.expanded;
70
- return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding-top: ", "px;\n padding-right: ", "px;\n padding-left: ", "px;\n display: table;\n display: flow-root;\n\n // The follow rules inside @supports block are added as a part of ED-8893\n // The fix is targeting mobile bridge on iOS 12 or below,\n // We should consider remove this fix when we no longer support iOS 12\n @supports not (display: flow-root) {\n width: 100%;\n box-sizing: border-box;\n }\n\n ", "\n "])), expanded ? gridSize() : 0, gridSize(), gridSize() * 4 - gridSize() / 2, !expanded ? "\n .expand-content-wrapper, .nestedExpand-content-wrapper {\n /* We visually hide the content here to preserve the content during copy+paste */\n width: 100%;\n display: block;\n height: 0;\n overflow: hidden;\n clip: rect(1px, 1px, 1px, 1px);\n white-space: nowrap;\n user-select: none;\n }\n " : '');
50
+ export var ExpandIconWrapper = function ExpandIconWrapper(_ref) {
51
+ var children = _ref.children,
52
+ expanded = _ref.expanded;
53
+ return jsx("div", {
54
+ css: function css(props) {
55
+ return expanded ? [expandIconWrapperStyle(props), expandIconWrapperExpandedStyle] : expandIconWrapperStyle(props);
56
+ }
57
+ }, children);
58
+ };
59
+
60
+ var expandIconWrapperStyle = function expandIconWrapperStyle(props) {
61
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n display: flex;\n color: ", ";\n border-radius: ", "px;\n width: 24px;\n height: 24px;\n\n &:hover {\n background: ", ";\n }\n\n svg {\n transition: transform 0.2s ", ";\n }\n"])), themed({
62
+ light: colors.N90,
63
+ dark: '#d9dde3'
64
+ })(props), gridSize() / 2, colors.N30A, akEditorSwoopCubicBezier);
65
+ };
66
+
67
+ var expandIconWrapperExpandedStyle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n svg {\n transform: rotate(90deg);\n }\n"])));
68
+ export var expandLayoutWrapperStyle = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: ", "px;\n height: ", "px;\n"])), gridSize() * 3, gridSize() * 3);
69
+ export var ExpandLayoutWrapperWithRef = /*#__PURE__*/forwardRef(function (props, ref) {
70
+ var children = props.children,
71
+ rest = _objectWithoutProperties(props, _excluded);
72
+
73
+ return jsx("div", _extends({
74
+ css: expandLayoutWrapperStyle
75
+ }, rest, {
76
+ ref: ref
77
+ }), children);
71
78
  });
72
- var TitleInputStyles = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n outline: none;\n border: none;\n font-size: ", ";\n line-height: ", ";\n font-weight: normal;\n color: ", ";\n background: transparent;\n display: flex;\n flex: 1;\n padding: 0 0 0 ", "px;\n width: 100%;\n\n &::placeholder {\n opacity: 0.6;\n color: ", ";\n }\n"])), relativeFontSizeToBase16(fontSize()), akEditorLineHeight, themed({
73
- light: colors.N200A,
74
- dark: colors.DN600
75
- }), gridSize() / 2, themed({
76
- light: colors.N200A,
77
- dark: colors.DN600
78
- }));
79
- var TitleContainerStyles = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n padding: 0;\n display: flex;\n align-items: flex-start;\n background: none;\n border: none;\n font-size: ", ";\n width: 100%;\n color: ", ";\n overflow: hidden;\n cursor: pointer;\n // Prevent browser selection being inside the title container\n user-select: none;\n\n &:focus {\n outline: 0;\n }\n"])), relativeFontSizeToBase16(fontSize()), themed({
80
- light: colors.N300A,
81
- dark: colors.DN600
82
- }));
79
+
80
+ var containerStyles = function containerStyles(styleProps) {
81
+ var expanded = styleProps.expanded,
82
+ focused = styleProps.focused;
83
+ var marginTop = "".concat(gridSize() / 2 / fontSize(), "rem");
84
+ var marginBottom = 0; // Only only these margins if the expand isn't editable
85
+ // and is the root level expand.
86
+
87
+ var marginHorizontal = styleProps['data-node-type'] === 'expand' ? "-".concat(akLayoutGutterOffset, "px") : 0;
88
+ var margin = "".concat(marginTop, " ").concat(marginHorizontal, " ").concat(marginBottom);
89
+ return function (themeProps) {
90
+ return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n border-radius: ", "px;\n min-height: 25px;\n background: ", ";\n margin: ", ";\n\n transition: background 0.3s ", ",\n border-color 0.3s ", ";\n padding: ", "px;\n\n &:hover {\n border: 1px solid\n ", ";\n background: ", ";\n }\n\n td > &:first-child {\n margin-top: 0;\n }\n "])), focused ? EXPAND_FOCUSED_BORDER_COLOR : expanded ? EXPAND_EXPANDED_BORDER_COLOR(themeProps) : EXPAND_COLLAPSED_BORDER_COLOR, BORDER_RADIUS, !expanded ? EXPAND_COLLAPSED_BACKGROUND : EXPAND_SELECTED_BACKGROUND(themeProps), margin, akEditorSwoopCubicBezier, akEditorSwoopCubicBezier, gridSize(), themed({
91
+ light: colors.N50A,
92
+ dark: colors.DN50
93
+ })(themeProps), EXPAND_SELECTED_BACKGROUND(themeProps));
94
+ };
95
+ };
96
+
97
+ var contentStyles = function contentStyles(styleProps) {
98
+ return function (themeProps) {
99
+ return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding-top: ", "px;\n padding-right: ", "px;\n padding-left: ", "px;\n display: flow-root;\n\n // The follow rules inside @supports block are added as a part of ED-8893\n // The fix is targeting mobile bridge on iOS 12 or below,\n // We should consider remove this fix when we no longer support iOS 12\n @supports not (display: flow-root) {\n width: 100%;\n box-sizing: border-box;\n }\n\n ", "\n"])), styleProps.expanded ? gridSize() : 0, gridSize(), gridSize() * 4 - gridSize() / 2, !styleProps.expanded ? "\n .expand-content-wrapper, .nestedExpand-content-wrapper {\n /* We visually hide the content here to preserve the content during copy+paste */\n width: 100%;\n display: block;\n height: 0;\n overflow: hidden;\n clip: rect(1px, 1px, 1px, 1px);\n white-space: nowrap;\n user-select: none;\n }\n " : '');
100
+ };
101
+ };
102
+
103
+ var titleInputStyles = function titleInputStyles(props) {
104
+ return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n outline: none;\n border: none;\n font-size: ", ";\n line-height: ", ";\n font-weight: normal;\n color: ", ";\n background: transparent;\n display: flex;\n flex: 1;\n padding: 0 0 0 ", "px;\n width: 100%;\n\n &::placeholder {\n opacity: 0.6;\n color: ", ";\n }\n"])), relativeFontSizeToBase16(fontSize()), akEditorLineHeight, themed({
105
+ light: colors.N200A,
106
+ dark: colors.DN600
107
+ })(props), gridSize() / 2, themed({
108
+ light: colors.N200A,
109
+ dark: colors.DN600
110
+ })(props));
111
+ };
112
+
113
+ var titleContainerStyles = function titleContainerStyles(props) {
114
+ return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n padding: 0;\n display: flex;\n align-items: flex-start;\n background: none;\n border: none;\n font-size: ", ";\n width: 100%;\n color: ", ";\n overflow: hidden;\n cursor: pointer;\n // Prevent browser selection being inside the title container\n user-select: none;\n\n &:focus {\n outline: 0;\n }\n"])), relativeFontSizeToBase16(fontSize()), themed({
115
+ light: colors.N300A,
116
+ dark: colors.DN600
117
+ })(props));
118
+ };
119
+
83
120
  export var sharedExpandStyles = {
84
- TitleInputStyles: TitleInputStyles,
85
- TitleContainerStyles: TitleContainerStyles,
86
- ContainerStyles: ContainerStyles,
87
- ContentStyles: ContentStyles
121
+ titleInputStyles: titleInputStyles,
122
+ titleContainerStyles: titleContainerStyles,
123
+ containerStyles: containerStyles,
124
+ contentStyles: contentStyles
88
125
  };
@@ -20,15 +20,15 @@ var isMissingIntlProviderInAncestryError = function isMissingIntlProviderInAnces
20
20
  return err === null || err === void 0 ? void 0 : (_err$toString = err.toString()) === null || _err$toString === void 0 ? void 0 : _err$toString.includes('<IntlProvider> needs to exist in the component ancestry');
21
21
  };
22
22
 
23
- export var IntlNextErrorBoundary = /*#__PURE__*/function (_React$Component) {
24
- _inherits(IntlNextErrorBoundary, _React$Component);
23
+ export var IntlErrorBoundary = /*#__PURE__*/function (_React$Component) {
24
+ _inherits(IntlErrorBoundary, _React$Component);
25
25
 
26
- var _super = _createSuper(IntlNextErrorBoundary);
26
+ var _super = _createSuper(IntlErrorBoundary);
27
27
 
28
- function IntlNextErrorBoundary() {
28
+ function IntlErrorBoundary() {
29
29
  var _this;
30
30
 
31
- _classCallCheck(this, IntlNextErrorBoundary);
31
+ _classCallCheck(this, IntlErrorBoundary);
32
32
 
33
33
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
34
34
  args[_key] = arguments[_key];
@@ -43,7 +43,7 @@ export var IntlNextErrorBoundary = /*#__PURE__*/function (_React$Component) {
43
43
  return _this;
44
44
  }
45
45
 
46
- _createClass(IntlNextErrorBoundary, [{
46
+ _createClass(IntlErrorBoundary, [{
47
47
  key: "componentDidCatch",
48
48
  value: function componentDidCatch(error, errorInfo) {
49
49
  // if missing IntlProvider in ancestry, we setup a fallback IntlProvider ourselves
@@ -69,5 +69,5 @@ export var IntlNextErrorBoundary = /*#__PURE__*/function (_React$Component) {
69
69
  }
70
70
  }]);
71
71
 
72
- return IntlNextErrorBoundary;
72
+ return IntlErrorBoundary;
73
73
  }(React.Component);
@@ -1,9 +1,12 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+
3
+ /** @jsx jsx */
2
4
  import React from 'react';
5
+ import { jsx } from '@emotion/react';
3
6
  import classnames from 'classnames';
4
7
  import { akEditorMediaResizeHandlerPaddingWide, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
5
8
  import { calcPxFromPct } from './grid';
6
- import { MediaSingleWrapper, MediaWrapper } from './styled';
9
+ import { MediaSingleDimensionHelper, MediaWrapper } from './styled';
7
10
  export var DEFAULT_IMAGE_WIDTH = 250;
8
11
  export var DEFAULT_IMAGE_HEIGHT = 200;
9
12
  export var wrappedLayouts = ['wrap-left', 'wrap-right', 'align-end', 'align-start'];
@@ -81,13 +84,15 @@ export default function MediaSingle(_ref) {
81
84
  media = _children[0],
82
85
  caption = _children[1];
83
86
 
84
- return /*#__PURE__*/React.createElement(MediaSingleWrapper, {
85
- innerRef: handleMediaSingleRef,
86
- width: width,
87
- layout: layout,
88
- containerWidth: containerWidth,
89
- pctWidth: pctWidth,
90
- fullWidthMode: fullWidthMode,
87
+ return jsx("div", {
88
+ ref: handleMediaSingleRef,
89
+ css: MediaSingleDimensionHelper({
90
+ width: width,
91
+ layout: layout,
92
+ containerWidth: containerWidth,
93
+ pctWidth: pctWidth,
94
+ fullWidthMode: fullWidthMode
95
+ }),
91
96
  "data-layout": layout,
92
97
  "data-width": pctWidth,
93
98
  "data-node-type": nodeType,
@@ -95,7 +100,7 @@ export default function MediaSingle(_ref) {
95
100
  'is-loading': isLoading,
96
101
  'rich-media-wrapped': layout === 'wrap-left' || layout === 'wrap-right'
97
102
  })
98
- }, /*#__PURE__*/React.createElement(MediaWrapper, {
103
+ }, jsx(MediaWrapper, {
99
104
  hasFallbackContainer: hasFallbackContainer,
100
105
  height: mediaWrapperHeight,
101
106
  paddingBottom: paddingBottom
@@ -1,8 +1,12 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
1
2
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
+ var _excluded = ["children"];
2
4
 
3
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
5
+ var _templateObject, _templateObject2, _templateObject3;
4
6
 
5
- import styled, { css } from 'styled-components';
7
+ /** @jsx jsx */
8
+ import React from 'react';
9
+ import { css, jsx } from '@emotion/react';
6
10
  import { akEditorFullPageMaxWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
7
11
  import { calcBreakoutWidth, calcWideWidth } from '../../utils/breakout';
8
12
 
@@ -140,12 +144,15 @@ var RenderFallbackContainer = function RenderFallbackContainer(_ref2) {
140
144
  return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n"])), hasFallbackContainer ? "\n &::after {\n content: '';\n display: block;\n ".concat(height ? "height: ".concat(height, "px;") : paddingBottom ? "padding-bottom: ".concat(paddingBottom, ";") : '', "\n\n /* Fixes extra padding problem in Firefox */\n font-size: 0;\n line-height: 0;\n }\n ") : '');
141
145
  };
142
146
 
143
- export var MediaWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n\n ", "\n\n /* Editor */\n & > figure {\n position: ", ";\n height: 100%;\n width: 100%;\n }\n\n & > div {\n position: ", ";\n height: 100%;\n width: 100%;\n }\n\n &[data-node-type='embedCard'] > div {\n width: 100%;\n }\n\n /* Renderer */\n [data-node-type='media'] {\n position: static !important;\n\n > div {\n position: absolute;\n height: 100%;\n }\n }\n"])), RenderFallbackContainer, function (_ref3) {
144
- var hasFallbackContainer = _ref3.hasFallbackContainer;
145
- return hasFallbackContainer ? 'absolute' : 'relative';
146
- }, function (_ref4) {
147
- var hasFallbackContainer = _ref4.hasFallbackContainer;
148
- return hasFallbackContainer ? 'absolute' : 'relative';
149
- });
150
- export var MediaSingleWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", ";\n"])), MediaSingleDimensionHelper);
147
+ export var mediaWrapperStyle = function mediaWrapperStyle(props) {
148
+ return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n\n ", "\n\n /* Editor */\n & > figure {\n position: ", ";\n height: 100%;\n width: 100%;\n }\n\n & > div {\n position: ", ";\n height: 100%;\n width: 100%;\n }\n\n &[data-node-type='embedCard'] > div {\n width: 100%;\n }\n\n /* Renderer */\n [data-node-type='media'] {\n position: static !important;\n\n > div {\n position: absolute;\n height: 100%;\n }\n }\n"])), RenderFallbackContainer(props), props.hasFallbackContainer ? 'absolute' : 'relative', props.hasFallbackContainer ? 'absolute' : 'relative');
149
+ };
150
+ export var MediaWrapper = function MediaWrapper(_ref3) {
151
+ var children = _ref3.children,
152
+ rest = _objectWithoutProperties(_ref3, _excluded);
153
+
154
+ return jsx("div", {
155
+ css: mediaWrapperStyle(rest)
156
+ }, children);
157
+ };
151
158
  MediaWrapper.displayName = 'WrapperMediaSingle';
@@ -26,6 +26,8 @@ var Popup = /*#__PURE__*/function (_React$Component) {
26
26
  var _super = _createSuper(Popup);
27
27
 
28
28
  function Popup() {
29
+ var _window;
30
+
29
31
  var _this;
30
32
 
31
33
  _classCallCheck(this, Popup);
@@ -58,6 +60,10 @@ var Popup = /*#__PURE__*/function (_React$Component) {
58
60
  return _this.scheduledUpdatePosition(_this.props);
59
61
  });
60
62
 
63
+ _defineProperty(_assertThisInitialized(_this), "resizeObserver", (_window = window) !== null && _window !== void 0 && _window.ResizeObserver ? new ResizeObserver(function () {
64
+ _this.scheduledUpdatePosition(_this.props);
65
+ }) : undefined);
66
+
61
67
  return _this;
62
68
  }
63
69
 
@@ -184,9 +190,14 @@ var Popup = /*#__PURE__*/function (_React$Component) {
184
190
  value: function componentDidMount() {
185
191
  window.addEventListener('resize', this.onResize);
186
192
  var stick = this.props.stick;
193
+ this.scrollParentElement = findOverflowScrollParent(this.props.target);
194
+
195
+ if (this.scrollParentElement && this.resizeObserver) {
196
+ this.resizeObserver.observe(this.scrollParentElement);
197
+ }
187
198
 
188
199
  if (stick) {
189
- this.scrollElement = findOverflowScrollParent(this.props.target);
200
+ this.scrollElement = this.scrollParentElement;
190
201
  } else {
191
202
  this.scrollElement = this.props.scrollableElement;
192
203
  }
@@ -204,6 +215,10 @@ var Popup = /*#__PURE__*/function (_React$Component) {
204
215
  this.scrollElement.removeEventListener('scroll', this.onResize);
205
216
  }
206
217
 
218
+ if (this.scrollParentElement && this.resizeObserver) {
219
+ this.resizeObserver.unobserve(this.scrollParentElement);
220
+ }
221
+
207
222
  this.scheduledUpdatePosition.cancel();
208
223
  }
209
224
  }, {
@@ -15,7 +15,7 @@ import { unsupportedContentMessages } from '../../messages/unsupportedContent';
15
15
  import { ACTION_SUBJECT_ID } from '../../utils/analytics';
16
16
  import { trackUnsupportedContentTooltipDisplayedFor } from '../../utils/track-unsupported-content';
17
17
  import { getUnsupportedContent } from '../unsupported-content-helper';
18
- var blockNodeStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n align-items: center;\n background: ", ";\n border: 1px dashed ", ";\n border-radius: ", "px;\n box-sizing: border-box;\n cursor: default;\n display: flex;\n font-size: ", ";\n margin: 10px 0;\n min-height: 24px;\n padding: 10px;\n text-align: center;\n vertical-align: text-bottom;\n min-width: 120px;\n align-items: center;\n justify-content: center;\n"])), N30, N50, borderRadius(), relativeFontSizeToBase16(fontSize()));
18
+ var blockNodeStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: ", ";\n border: 1px dashed ", ";\n border-radius: ", "px;\n box-sizing: border-box;\n cursor: default;\n display: flex;\n font-size: ", ";\n margin: 10px 0;\n min-height: 24px;\n padding: 10px;\n text-align: center;\n vertical-align: text-bottom;\n min-width: 120px;\n align-items: center;\n justify-content: center;\n"])), N30, N50, borderRadius(), relativeFontSizeToBase16(fontSize()));
19
19
 
20
20
  var UnsupportedBlockNode = function UnsupportedBlockNode(_ref) {
21
21
  var node = _ref.node,
@@ -11,9 +11,7 @@ export { default as withOuterListeners } from './with-outer-listeners';
11
11
  export { WidthConsumer, WidthProvider, getBreakpoint } from './WidthProvider';
12
12
  export { default as overflowShadow, shadowClassNames } from './OverflowShadow';
13
13
  export { WithCreateAnalyticsEvent } from './WithCreateAnalyticsEvent';
14
- export { messages as expandMessages, sharedExpandStyles, ExpandIconWrapper, ExpandLayoutWrapper } from './Expand';
14
+ export { messages as expandMessages, sharedExpandStyles, ExpandIconWrapper, expandLayoutWrapperStyle, ExpandLayoutWrapperWithRef } from './Expand';
15
15
  export { ErrorMessage, HelperMessage, ValidMessage } from './Messages';
16
16
  export { clearNextSiblingMarginTopStyle } from './clear-next-sibling-margin-top';
17
- export { IntlNextErrorBoundary, REACT_INTL_ERROR_MESSAGE } from './IntlNextErrorBoundary';
18
- export { IntlLegacyFallbackProvider } from './IntlLegacyFallbackProvider';
19
- export { LegacyToNextIntlProvider } from './LegacyToNextIntlProvider';
17
+ export { IntlErrorBoundary, REACT_INTL_ERROR_MESSAGE } from './IntlErrorBoundary';
@@ -0,0 +1,115 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
2
+ import React from 'react';
3
+ export var getKeys = Object.keys;
4
+ export var getKeysAddedRemovedCommon = function getKeysAddedRemovedCommon(object1, object2) {
5
+ var oldKeys = object1 !== null ? getKeys(object1) : [];
6
+ var newKeys = object2 !== null ? getKeys(object2) : [];
7
+ var removed = oldKeys.filter(function (key) {
8
+ return !newKeys.includes(key);
9
+ });
10
+ var added = newKeys.filter(function (key) {
11
+ return !oldKeys.includes(key);
12
+ });
13
+ var common = oldKeys.filter(function (key) {
14
+ return newKeys.includes(key);
15
+ });
16
+ return {
17
+ added: added,
18
+ common: common,
19
+ removed: removed
20
+ };
21
+ };
22
+ export var serializeValue = function serializeValue(value) {
23
+ var valueType = _typeof(value);
24
+
25
+ if (value === null) {
26
+ return 'null';
27
+ } else if (value === undefined) {
28
+ return 'undefined';
29
+ } else if (valueType === 'string' || valueType === 'number') {
30
+ return value;
31
+ } else if (valueType === 'symbol') {
32
+ return value.toString();
33
+ } // Calling toString of function returns whole function text with body.
34
+ // So, just return function with name.
35
+ else if (valueType === 'function') {
36
+ return "function:".concat(value.name);
37
+ } else if (valueType === 'object') {
38
+ return {
39
+ type: 'object',
40
+ keys: Object.keys(value)
41
+ };
42
+ }
43
+ };
44
+ export var getPropsDifference = function getPropsDifference(object1, object2) {
45
+ var curDepth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
46
+ var maxDepth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 2;
47
+ var keysToIgnore = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
48
+
49
+ var _getKeysAddedRemovedC = getKeysAddedRemovedCommon(object1, object2),
50
+ added = _getKeysAddedRemovedC.added,
51
+ common = _getKeysAddedRemovedC.common,
52
+ removed = _getKeysAddedRemovedC.removed;
53
+
54
+ var changed = [];
55
+ common.forEach(function (key) {
56
+ var value1 = object1[key];
57
+ var value2 = object2[key];
58
+
59
+ var value1Type = _typeof(value1);
60
+
61
+ var value2Type = _typeof(value2); // Do comparision only if values doesn't match (or reference to same object in memory).
62
+ // Or if key does not exist in keys to ignore.
63
+
64
+
65
+ if (value1 !== value2 && keysToIgnore.indexOf(key) === -1) {
66
+ // if both key value are objects and not referencing same object in memory.
67
+ // then get recursive difference.
68
+ if ( /*#__PURE__*/React.isValidElement(value1) || /*#__PURE__*/React.isValidElement(value2)) {
69
+ changed.push({
70
+ key: key,
71
+ reactElementChanged: true
72
+ });
73
+ } else if (value1Type === 'object' && value2Type === 'object') {
74
+ if (curDepth <= maxDepth) {
75
+ var difference = getPropsDifference(value1, value2, curDepth + 1, maxDepth);
76
+ changed.push({
77
+ key: key,
78
+ difference: difference
79
+ });
80
+ } else {
81
+ changed.push({
82
+ key: key,
83
+ maxDepthReached: true
84
+ });
85
+ }
86
+ } else {
87
+ changed.push({
88
+ key: key,
89
+ oldValue: serializeValue(value1),
90
+ newValue: serializeValue(value2)
91
+ });
92
+ }
93
+ }
94
+ });
95
+ return {
96
+ added: added,
97
+ changed: changed,
98
+ removed: removed
99
+ };
100
+ };
101
+ export var getShallowPropsDifference = function getShallowPropsDifference(object1, object2) {
102
+ var _getKeysAddedRemovedC2 = getKeysAddedRemovedCommon(object1, object2),
103
+ added = _getKeysAddedRemovedC2.added,
104
+ common = _getKeysAddedRemovedC2.common,
105
+ removed = _getKeysAddedRemovedC2.removed;
106
+
107
+ var changed = common.filter(function (key) {
108
+ return object1[key] !== object2[key];
109
+ });
110
+ return {
111
+ added: added,
112
+ changed: changed,
113
+ removed: removed
114
+ };
115
+ };
@@ -23,4 +23,6 @@ export { shouldForceTracking } from './should-force-tracking';
23
23
  export { getModeFromTheme } from './getModeFromTheme';
24
24
  export { sniffUserBrowserExtensions } from './browser-extensions';
25
25
  export { RenderCountProfiler } from './profiler/render-count';
26
- export { validateADFEntity, validationErrorHandler } from './validate-using-spec';
26
+ export { validateADFEntity, validationErrorHandler } from './validate-using-spec';
27
+ export { getShallowPropsDifference, getPropsDifference } from './compare-props';
28
+ export { useComponentRenderTracking } from './performance/hooks/use-component-render-tracking';
@@ -0,0 +1,37 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import { uuid } from '@atlaskit/adf-schema';
3
+ import { getPropsDifference, getShallowPropsDifference } from '../../../compare-props';
4
+ export function useComponentRenderTracking(_ref) {
5
+ var onRender = _ref.onRender,
6
+ propsDiffingOptions = _ref.propsDiffingOptions,
7
+ _ref$zeroBasedCount = _ref.zeroBasedCount,
8
+ zeroBasedCount = _ref$zeroBasedCount === void 0 ? true : _ref$zeroBasedCount;
9
+ var propsRef = useRef();
10
+ var renderCountRef = useRef(zeroBasedCount ? 0 : 1);
11
+
12
+ var _useRef = useRef(uuid.generate()),
13
+ componentId = _useRef.current;
14
+
15
+ useEffect(function () {
16
+ var lastProps = propsRef.current;
17
+ var renderCount = renderCountRef.current;
18
+ var propsDifference;
19
+
20
+ if (propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.enabled && lastProps) {
21
+ propsDifference = propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.useShallow ? getShallowPropsDifference(lastProps, propsDiffingOptions.props) : getPropsDifference(lastProps, propsDiffingOptions.props, 0, 2, propsDiffingOptions === null || propsDiffingOptions === void 0 ? void 0 : propsDiffingOptions.propsToIgnore);
22
+ }
23
+
24
+ var result = {
25
+ renderCount: renderCount,
26
+ propsDifference: propsDifference,
27
+ componentId: componentId
28
+ };
29
+ onRender(result);
30
+
31
+ if (propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.enabled) {
32
+ propsRef.current = propsDiffingOptions.props;
33
+ }
34
+
35
+ renderCountRef.current = renderCountRef.current + 1;
36
+ }); // No dependencies run on each render
37
+ }
@@ -370,7 +370,7 @@ export var getValidNode = function getValidNode(originalNode) {
370
370
  mediaCollection = collection;
371
371
  }
372
372
 
373
- if (mediaId && mediaCollection && adfStage === 'stage0') {
373
+ if (mediaId && mediaCollection) {
374
374
  return {
375
375
  type: type,
376
376
  attrs: attrs,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "65.0.0",
3
+ "version": "66.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -11,7 +11,7 @@ export declare type Option = {
11
11
  */
12
12
  icon?: string | React.ReactNode;
13
13
  };
14
- import { SmartUserPickerProps } from '@atlaskit/user-picker';
14
+ import { Props as SmartUserPickerProps } from '@atlaskit/smart-user-picker';
15
15
  export declare type UserFieldContext = Pick<SmartUserPickerProps, 'siteId' | 'principalId' | 'fieldId' | 'productKey' | 'containerId' | 'objectId' | 'childObjectId' | 'productAttributes' | 'includeUsers'>;
16
16
  interface BaseFieldDefinition {
17
17
  description?: string;
@@ -1,4 +1,5 @@
1
- declare type NormalizedFeatureFlags = Record<string, boolean>;
1
+ declare type BooleanFlags = Record<string, boolean>;
2
+ declare type NormalizedFeatureFlags<ObjectFlags> = Partial<ObjectFlags & BooleanFlags>;
2
3
  /**
3
4
  * Normalise and filter a free Record<string, unknown> to match
4
5
  * the rules for feature flags in editor and renderer
@@ -9,9 +10,11 @@ declare type NormalizedFeatureFlags = Record<string, boolean>;
9
10
  *
10
11
  * Output matches
11
12
  * 1. cased in camelCase (match [a-zA-Z])
12
- * 2. has boolean value
13
+ * 2. has boolean value or object {} value
13
14
  *
14
15
  * @param rawFeatureFlags
15
16
  */
16
- export declare function normalizeFeatureFlags(rawFeatureFlags?: Record<string, unknown>): NormalizedFeatureFlags;
17
+ export declare function normalizeFeatureFlags<ObjectFlags>(rawFeatureFlags?: Record<string, unknown>, options?: {
18
+ objectFlagKeys: string[];
19
+ }): NormalizedFeatureFlags<ObjectFlags>;
17
20
  export {};