@atlaskit/editor-common 65.0.0 → 66.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/build/tsconfig.json +1 -2
  3. package/dist/cjs/i18n/en.js +27 -0
  4. package/dist/cjs/i18n/en_GB.js +27 -0
  5. package/dist/cjs/normalize-feature-flags.js +40 -4
  6. package/dist/cjs/panel.js +55 -0
  7. package/dist/cjs/styles/index.js +0 -44
  8. package/dist/cjs/styles/shared/link.js +2 -2
  9. package/dist/cjs/styles/shared/lists.js +1 -1
  10. package/dist/cjs/styles/shared/panel.js +15 -6
  11. package/dist/cjs/styles/shared/rule.js +5 -2
  12. package/dist/cjs/styles/shared/table.js +1 -1
  13. package/dist/cjs/ui/BaseTheme/index.js +1 -5
  14. package/dist/cjs/ui/Expand/index.js +84 -46
  15. package/dist/cjs/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +9 -9
  16. package/dist/cjs/ui/MediaSingle/index.js +13 -8
  17. package/dist/cjs/ui/MediaSingle/styled.js +23 -20
  18. package/dist/cjs/ui/Popup/index.js +15 -1
  19. package/dist/cjs/ui/UnsupportedBlock/index.js +1 -1
  20. package/dist/cjs/ui/index.js +12 -22
  21. package/dist/cjs/utils/compare-props.js +136 -0
  22. package/dist/cjs/utils/index.js +23 -1
  23. package/dist/cjs/utils/performance/hooks/use-component-render-tracking/index.js +47 -0
  24. package/dist/cjs/utils/validator.js +7 -5
  25. package/dist/cjs/version.json +1 -1
  26. package/dist/es2019/i18n/en.js +19 -0
  27. package/dist/es2019/i18n/en_GB.js +19 -0
  28. package/dist/es2019/normalize-feature-flags.js +40 -4
  29. package/dist/es2019/panel.js +1 -0
  30. package/dist/es2019/styles/index.js +0 -1
  31. package/dist/es2019/styles/shared/link.js +1 -1
  32. package/dist/es2019/styles/shared/lists.js +2 -0
  33. package/dist/es2019/styles/shared/panel.js +79 -76
  34. package/dist/es2019/styles/shared/rule.js +3 -3
  35. package/dist/es2019/styles/shared/table.js +9 -1
  36. package/dist/es2019/ui/BaseTheme/index.js +1 -4
  37. package/dist/es2019/ui/Expand/index.js +97 -67
  38. package/dist/es2019/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +1 -1
  39. package/dist/es2019/ui/MediaSingle/index.js +13 -9
  40. package/dist/es2019/ui/MediaSingle/styled.js +13 -12
  41. package/dist/es2019/ui/Popup/index.js +16 -1
  42. package/dist/es2019/ui/UnsupportedBlock/index.js +0 -1
  43. package/dist/es2019/ui/index.js +2 -4
  44. package/dist/es2019/utils/compare-props.js +99 -0
  45. package/dist/es2019/utils/index.js +3 -1
  46. package/dist/es2019/utils/performance/hooks/use-component-render-tracking/index.js +36 -0
  47. package/dist/es2019/utils/validator.js +3 -2
  48. package/dist/es2019/version.json +1 -1
  49. package/dist/esm/i18n/en.js +19 -0
  50. package/dist/esm/i18n/en_GB.js +19 -0
  51. package/dist/esm/normalize-feature-flags.js +39 -4
  52. package/dist/esm/panel.js +1 -0
  53. package/dist/esm/styles/index.js +0 -1
  54. package/dist/esm/styles/shared/link.js +1 -1
  55. package/dist/esm/styles/shared/lists.js +1 -1
  56. package/dist/esm/styles/shared/panel.js +10 -5
  57. package/dist/esm/styles/shared/rule.js +4 -2
  58. package/dist/esm/styles/shared/table.js +1 -1
  59. package/dist/esm/ui/BaseTheme/index.js +1 -4
  60. package/dist/esm/ui/Expand/index.js +79 -42
  61. package/dist/esm/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +7 -7
  62. package/dist/esm/ui/MediaSingle/index.js +14 -9
  63. package/dist/esm/ui/MediaSingle/styled.js +17 -10
  64. package/dist/esm/ui/Popup/index.js +16 -1
  65. package/dist/esm/ui/UnsupportedBlock/index.js +1 -1
  66. package/dist/esm/ui/index.js +2 -4
  67. package/dist/esm/utils/compare-props.js +115 -0
  68. package/dist/esm/utils/index.js +3 -1
  69. package/dist/esm/utils/performance/hooks/use-component-render-tracking/index.js +37 -0
  70. package/dist/esm/utils/validator.js +3 -2
  71. package/dist/esm/version.json +1 -1
  72. package/dist/types/extensions/types/field-definitions.d.ts +1 -1
  73. package/dist/types/i18n/en.d.ts +19 -0
  74. package/dist/types/i18n/en_GB.d.ts +19 -0
  75. package/dist/types/normalize-feature-flags.d.ts +6 -3
  76. package/dist/types/panel.d.ts +1 -0
  77. package/dist/types/provider-factory/media-provider.d.ts +2 -2
  78. package/dist/types/provider-factory/types.d.ts +1 -1
  79. package/dist/types/styles/index.d.ts +0 -1
  80. package/dist/types/styles/shared/link.d.ts +1 -1
  81. package/dist/types/styles/shared/panel.d.ts +2 -1
  82. package/dist/types/styles/shared/rule.d.ts +2 -1
  83. package/dist/types/ui/EventHandlers/index.d.ts +2 -2
  84. package/dist/types/ui/Expand/index.d.ts +12 -10
  85. package/dist/types/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.d.ts +1 -1
  86. package/dist/types/ui/MediaSingle/index.d.ts +4 -2
  87. package/dist/types/ui/MediaSingle/styled.d.ts +10 -5
  88. package/dist/types/ui/Popup/index.d.ts +3 -0
  89. package/dist/types/ui/index.d.ts +2 -4
  90. package/dist/types/utils/compare-props.d.ts +32 -0
  91. package/dist/types/utils/index.d.ts +4 -0
  92. package/dist/types/utils/performance/hooks/use-component-render-tracking/index.d.ts +19 -0
  93. package/package.json +18 -19
  94. package/panel/package.json +7 -0
  95. package/dist/cjs/ui/IntlLegacyFallbackProvider/index.js +0 -60
  96. package/dist/cjs/ui/LegacyToNextIntlProvider/index.js +0 -67
  97. package/dist/es2019/ui/IntlLegacyFallbackProvider/index.js +0 -21
  98. package/dist/es2019/ui/LegacyToNextIntlProvider/index.js +0 -24
  99. package/dist/esm/ui/IntlLegacyFallbackProvider/index.js +0 -45
  100. package/dist/esm/ui/LegacyToNextIntlProvider/index.js +0 -51
  101. package/dist/types/ui/IntlLegacyFallbackProvider/index.d.ts +0 -8
  102. package/dist/types/ui/LegacyToNextIntlProvider/index.d.ts +0 -8
@@ -179,12 +179,24 @@ Object.defineProperty(exports, "getModeFromTheme", {
179
179
  return _getModeFromTheme.getModeFromTheme;
180
180
  }
181
181
  });
182
+ Object.defineProperty(exports, "getPropsDifference", {
183
+ enumerable: true,
184
+ get: function get() {
185
+ return _compareProps.getPropsDifference;
186
+ }
187
+ });
182
188
  Object.defineProperty(exports, "getResponseEndTime", {
183
189
  enumerable: true,
184
190
  get: function get() {
185
191
  return _navigation.getResponseEndTime;
186
192
  }
187
193
  });
194
+ Object.defineProperty(exports, "getShallowPropsDifference", {
195
+ enumerable: true,
196
+ get: function get() {
197
+ return _compareProps.getShallowPropsDifference;
198
+ }
199
+ });
188
200
  Object.defineProperty(exports, "getTTISeverity", {
189
201
  enumerable: true,
190
202
  get: function get() {
@@ -335,6 +347,12 @@ Object.defineProperty(exports, "todayTimestampInUTC", {
335
347
  return _date.todayTimestampInUTC;
336
348
  }
337
349
  });
350
+ Object.defineProperty(exports, "useComponentRenderTracking", {
351
+ enumerable: true,
352
+ get: function get() {
353
+ return _useComponentRenderTracking.useComponentRenderTracking;
354
+ }
355
+ });
338
356
  Object.defineProperty(exports, "validateADFEntity", {
339
357
  enumerable: true,
340
358
  get: function get() {
@@ -404,4 +422,8 @@ var _browserExtensions = require("./browser-extensions");
404
422
 
405
423
  var _renderCount = require("./profiler/render-count");
406
424
 
407
- var _validateUsingSpec = require("./validate-using-spec");
425
+ var _validateUsingSpec = require("./validate-using-spec");
426
+
427
+ var _compareProps = require("./compare-props");
428
+
429
+ var _useComponentRenderTracking = require("./performance/hooks/use-component-render-tracking");
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useComponentRenderTracking = useComponentRenderTracking;
7
+
8
+ var _react = require("react");
9
+
10
+ var _adfSchema = require("@atlaskit/adf-schema");
11
+
12
+ var _compareProps = require("../../../compare-props");
13
+
14
+ function useComponentRenderTracking(_ref) {
15
+ var onRender = _ref.onRender,
16
+ propsDiffingOptions = _ref.propsDiffingOptions,
17
+ _ref$zeroBasedCount = _ref.zeroBasedCount,
18
+ zeroBasedCount = _ref$zeroBasedCount === void 0 ? true : _ref$zeroBasedCount;
19
+ var propsRef = (0, _react.useRef)();
20
+ var renderCountRef = (0, _react.useRef)(zeroBasedCount ? 0 : 1);
21
+
22
+ var _useRef = (0, _react.useRef)(_adfSchema.uuid.generate()),
23
+ componentId = _useRef.current;
24
+
25
+ (0, _react.useEffect)(function () {
26
+ var lastProps = propsRef.current;
27
+ var renderCount = renderCountRef.current;
28
+ var propsDifference;
29
+
30
+ if (propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.enabled && lastProps) {
31
+ propsDifference = propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.useShallow ? (0, _compareProps.getShallowPropsDifference)(lastProps, propsDiffingOptions.props) : (0, _compareProps.getPropsDifference)(lastProps, propsDiffingOptions.props, 0, 2, propsDiffingOptions === null || propsDiffingOptions === void 0 ? void 0 : propsDiffingOptions.propsToIgnore);
32
+ }
33
+
34
+ var result = {
35
+ renderCount: renderCount,
36
+ propsDifference: propsDifference,
37
+ componentId: componentId
38
+ };
39
+ onRender(result);
40
+
41
+ if (propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.enabled) {
42
+ propsRef.current = propsDiffingOptions.props;
43
+ }
44
+
45
+ renderCountRef.current = renderCountRef.current + 1;
46
+ }); // No dependencies run on each render
47
+ }
@@ -13,6 +13,8 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
13
13
 
14
14
  var _adfSchema = require("@atlaskit/adf-schema");
15
15
 
16
+ var _schemaDefault = require("@atlaskit/adf-schema/schema-default");
17
+
16
18
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
19
 
18
20
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -63,7 +65,7 @@ var isSameMark = function isSameMark(mark, otherMark) {
63
65
  exports.isSameMark = isSameMark;
64
66
 
65
67
  var getValidDocument = function getValidDocument(doc) {
66
- var schema = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _adfSchema.defaultSchema;
68
+ var schema = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _schemaDefault.defaultSchema;
67
69
  var adfStage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'final';
68
70
  var node = getValidNode(doc, schema, adfStage);
69
71
 
@@ -88,7 +90,7 @@ var wrapInlineNodes = function wrapInlineNodes() {
88
90
  };
89
91
 
90
92
  var getValidContent = function getValidContent(content) {
91
- var schema = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _adfSchema.defaultSchema;
93
+ var schema = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _schemaDefault.defaultSchema;
92
94
  var adfStage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'final';
93
95
  return content.map(function (node) {
94
96
  return getValidNode(node, schema, adfStage);
@@ -101,7 +103,7 @@ var RELATIVE_LINK = /^\//;
101
103
  var ANCHOR_LINK = /^#/;
102
104
 
103
105
  var flattenUnknownBlockTree = function flattenUnknownBlockTree(node) {
104
- var schema = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _adfSchema.defaultSchema;
106
+ var schema = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _schemaDefault.defaultSchema;
105
107
  var adfStage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'final';
106
108
  var output = [];
107
109
  var isPrevLeafNode = false;
@@ -210,7 +212,7 @@ var getValidMarks = function getValidMarks(marks) {
210
212
 
211
213
 
212
214
  var getValidNode = function getValidNode(originalNode) {
213
- var schema = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _adfSchema.defaultSchema;
215
+ var schema = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _schemaDefault.defaultSchema;
214
216
  var adfStage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'final';
215
217
  var attrs = originalNode.attrs,
216
218
  marks = originalNode.marks,
@@ -399,7 +401,7 @@ var getValidNode = function getValidNode(originalNode) {
399
401
  mediaCollection = collection;
400
402
  }
401
403
 
402
- if (mediaId && mediaCollection && adfStage === 'stage0') {
404
+ if (mediaId && mediaCollection) {
403
405
  return {
404
406
  type: type,
405
407
  attrs: attrs,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "65.0.0",
3
+ "version": "66.0.2",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * NOTE:
3
+ *
4
+ * This file is automatically generated by Traduki 2.0.
5
+ * DO NOT CHANGE IT BY HAND or your changes will be lost.
6
+ */
7
+ //
8
+ export default {
9
+ 'fabric.editor.captionPlaceholder': 'Add a caption',
10
+ 'fabric.editor.codeBidiWarningLabel': 'Bidirectional characters change the order that text is rendered. This could be used to obscure malicious code.',
11
+ 'fabric.editor.collapseNode': 'Collapse content',
12
+ 'fabric.editor.expandDefaultTitle': 'Click here to expand...',
13
+ 'fabric.editor.expandNode': 'Expand content',
14
+ 'fabric.editor.expandPlaceholder': 'Give this expand a title...',
15
+ 'fabric.editor.openLink': 'Open link in a new tab',
16
+ 'fabric.editor.unsupportedBlockContent': 'This editor does not support displaying this content',
17
+ 'fabric.editor.unsupportedContentTooltip': 'Content is not available in this editor, this will be preserved when you edit and save',
18
+ 'fabric.editor.unsupportedInlineContent': 'Unsupported content'
19
+ };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * NOTE:
3
+ *
4
+ * This file is automatically generated by Traduki 2.0.
5
+ * DO NOT CHANGE IT BY HAND or your changes will be lost.
6
+ */
7
+ //English (United Kingdom)
8
+ export default {
9
+ 'fabric.editor.captionPlaceholder': 'Add a caption',
10
+ 'fabric.editor.codeBidiWarningLabel': 'Bidirectional characters change the order that text is rendered. This could be used to obscure malicious code.',
11
+ 'fabric.editor.collapseNode': 'Collapse content',
12
+ 'fabric.editor.expandDefaultTitle': 'Click here to expand...',
13
+ 'fabric.editor.expandNode': 'Expand content',
14
+ 'fabric.editor.expandPlaceholder': 'Give this expand a title...',
15
+ 'fabric.editor.openLink': 'Open link in a new tab',
16
+ 'fabric.editor.unsupportedBlockContent': 'This editor does not support displaying this content',
17
+ 'fabric.editor.unsupportedContentTooltip': 'Content is not available in this editor, this will be preserved when you edit and save',
18
+ 'fabric.editor.unsupportedInlineContent': 'Unsupported content'
19
+ };
@@ -1,6 +1,24 @@
1
1
  import camelCase from 'lodash/camelCase';
2
2
  import kebabCase from 'lodash/kebabCase';
3
3
  const EMPTY = {};
4
+
5
+ function isObjectFlagKey(key, value, objectFlagKeys) {
6
+ return Boolean(typeof value === 'string' && (objectFlagKeys === null || objectFlagKeys === void 0 ? void 0 : objectFlagKeys.includes(key)));
7
+ }
8
+
9
+ function isValidJSONObject(value) {
10
+ try {
11
+ let result = JSON.parse(value);
12
+
13
+ if (typeof result === 'object' && result !== null) {
14
+ return true;
15
+ }
16
+
17
+ return false;
18
+ } catch (err) {
19
+ return false;
20
+ }
21
+ }
4
22
  /**
5
23
  * Normalise and filter a free Record<string, unknown> to match
6
24
  * the rules for feature flags in editor and renderer
@@ -11,18 +29,36 @@ const EMPTY = {};
11
29
  *
12
30
  * Output matches
13
31
  * 1. cased in camelCase (match [a-zA-Z])
14
- * 2. has boolean value
32
+ * 2. has boolean value or object {} value
15
33
  *
16
34
  * @param rawFeatureFlags
17
35
  */
18
36
 
19
- export function normalizeFeatureFlags(rawFeatureFlags) {
37
+
38
+ export function normalizeFeatureFlags(rawFeatureFlags, options) {
20
39
  if (!rawFeatureFlags) {
21
40
  return EMPTY;
22
41
  }
23
42
 
24
- return Object.entries(rawFeatureFlags).filter(e => typeof e[1] === 'boolean').filter(([key]) => kebabCase(key) === key).map(([key, value]) => [camelCase(key), value]).reduce((flags, [key, value]) => {
25
- flags[key] = value;
43
+ return Object.entries(rawFeatureFlags).filter(e => {
44
+ if (typeof e[1] === 'boolean') {
45
+ return true;
46
+ }
47
+
48
+ if (isObjectFlagKey(camelCase(e[0]), e[1], options === null || options === void 0 ? void 0 : options.objectFlagKeys) && isValidJSONObject(e[1])) {
49
+ return true;
50
+ }
51
+
52
+ return false;
53
+ }).filter(([key]) => kebabCase(key) === key).map(([key, value]) => [camelCase(key), value]).reduce((flags, [key, value]) => {
54
+ if (isObjectFlagKey(key, value, options === null || options === void 0 ? void 0 : options.objectFlagKeys)) {
55
+ flags[key] = JSON.parse(value);
56
+ }
57
+
58
+ if (typeof value === 'boolean') {
59
+ flags[key] = value;
60
+ }
61
+
26
62
  return flags;
27
63
  }, {});
28
64
  }
@@ -0,0 +1 @@
1
+ export { getPanelTypeBackground, darkPanelColors, getPanelDarkColor, panelSharedStyles, panelSharedStylesWithoutPrefix, PanelSharedCssClassName, PanelSharedSelectors, getPanelBackgroundDarkModeColors } from './styles/shared/panel';
@@ -5,7 +5,6 @@ export { columnLayoutSharedStyle } from './shared/column-layout';
5
5
  export { mediaSingleSharedStyle, richMediaClassName } from './shared/media-single';
6
6
  export { blockquoteSharedStyles } from './shared/blockquote';
7
7
  export { headingsSharedStyles } from './shared/headings';
8
- export { getPanelTypeBackground, darkPanelColors, getPanelDarkColor, panelSharedStyles, PanelSharedCssClassName, PanelSharedSelectors, getPanelBackgroundDarkModeColors } from './shared/panel';
9
8
  export { ruleSharedStyles } from './shared/rule';
10
9
  export { whitespaceSharedStyles } from './shared/whitespace';
11
10
  export { paragraphSharedStyles } from './shared/paragraph';
@@ -1,4 +1,4 @@
1
- import { css } from 'styled-components';
1
+ import { css } from '@emotion/react';
2
2
  const linkSharedStyle = css`
3
3
  a.blockLink {
4
4
  display: block;
@@ -42,8 +42,10 @@ export const listsSharedStyles = css`
42
42
  @see https://css-tricks.com/display-flow-root/
43
43
  */
44
44
  // For older browsers the do not support flow-root.
45
+ /* stylelint-disable declaration-block-no-duplicate-properties */
45
46
  display: table;
46
47
  display: flow-root;
48
+ /* stylelint-enable declaration-block-no-duplicate-properties */
47
49
  }
48
50
 
49
51
  /* =============== INDENTATION AESTHETICS ========= */
@@ -1,4 +1,4 @@
1
- import { css } from 'styled-components';
1
+ import { css } from '@emotion/react';
2
2
  import { PanelType } from '@atlaskit/adf-schema';
3
3
  import { akEditorTableCellMinWidth, blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
4
4
  import { akEditorCustomIconSize } from '@atlaskit/editor-shared-styles/consts';
@@ -173,107 +173,110 @@ const mainDynamicStyles = panelType => props => {
173
173
  `;
174
174
  };
175
175
 
176
- export const panelSharedStyles = css`
177
- .${PanelSharedCssClassName.prefix} {
178
- border-radius: ${borderRadius()}px;
179
- margin: ${blockNodesVerticalMargin} 0 0;
180
- padding: ${gridSize()}px;
181
- min-width: ${akEditorTableCellMinWidth}px;
182
- display: flex;
183
- position: relative;
184
- align-items: baseline;
185
- word-break: break-word;
176
+ export const panelSharedStylesWithoutPrefix = props => css`
177
+ border-radius: ${borderRadius()}px;
178
+ margin: ${blockNodesVerticalMargin} 0 0;
179
+ padding: ${gridSize()}px;
180
+ min-width: ${akEditorTableCellMinWidth}px;
181
+ display: flex;
182
+ position: relative;
183
+ align-items: baseline;
184
+ word-break: break-word;
186
185
 
187
- ${mainDynamicStyles(PanelType.INFO)}
186
+ ${mainDynamicStyles(PanelType.INFO)(props)}
188
187
 
189
- .${PanelSharedCssClassName.icon} {
190
- flex-shrink: 0;
191
- height: ${gridSize() * 3}px;
192
- width: ${gridSize() * 3}px;
193
- box-sizing: content-box;
194
- padding-right: ${gridSize()}px;
195
- text-align: center;
196
- user-select: none;
197
- -moz-user-select: none;
198
- -webkit-user-select: none;
199
- -ms-user-select: none;
200
- ${iconDynamicStyles(PanelType.INFO)}
188
+ .${PanelSharedCssClassName.icon} {
189
+ flex-shrink: 0;
190
+ height: ${gridSize() * 3}px;
191
+ width: ${gridSize() * 3}px;
192
+ box-sizing: content-box;
193
+ padding-right: ${gridSize()}px;
194
+ text-align: center;
195
+ user-select: none;
196
+ -moz-user-select: none;
197
+ -webkit-user-select: none;
198
+ -ms-user-select: none;
199
+ ${iconDynamicStyles(PanelType.INFO)(props)}
201
200
 
202
- > span {
203
- vertical-align: middle;
204
- display: inline-flex;
205
- }
201
+ > span {
202
+ vertical-align: middle;
203
+ display: inline-flex;
204
+ }
206
205
 
207
- .${emojiSprite} {
208
- vertical-align: ${panelEmojiSpriteVerticalAlignment}px;
209
- }
206
+ .${emojiSprite} {
207
+ vertical-align: ${panelEmojiSpriteVerticalAlignment}px;
208
+ }
210
209
 
211
- .${emojiImage} {
212
- vertical-align: ${panelEmojiImageVerticalAlignment}px;
210
+ .${emojiImage} {
211
+ vertical-align: ${panelEmojiImageVerticalAlignment}px;
213
212
 
214
- // Vertical align only works for inline-block elements in Firefox
215
- @-moz-document url-prefix() {
216
- img {
217
- display: inline-block;
218
- }
213
+ // Vertical align only works for inline-block elements in Firefox
214
+ @-moz-document url-prefix() {
215
+ img {
216
+ display: inline-block;
219
217
  }
220
218
  }
221
219
  }
220
+ }
222
221
 
223
- .ak-editor-panel__content {
224
- margin: 1px 0 1px;
225
- flex: 1 0 0;
226
- /*
227
- https://ishadeed.com/article/min-max-css/#setting-min-width-to-zero-with-flexbox
228
- 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’t compute to zero. The minimum size of a flex item is equal to the size of its contents.
229
- */
230
- min-width: 0;
231
- }
222
+ .ak-editor-panel__content {
223
+ margin: 1px 0 1px;
224
+ flex: 1 0 0;
225
+ /*
226
+ https://ishadeed.com/article/min-max-css/#setting-min-width-to-zero-with-flexbox
227
+ 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’t compute to zero. The minimum size of a flex item is equal to the size of its contents.
228
+ */
229
+ min-width: 0;
230
+ }
232
231
 
233
- &[data-panel-type='${PanelType.NOTE}'] {
234
- ${mainDynamicStyles(PanelType.NOTE)}
232
+ &[data-panel-type='${PanelType.NOTE}'] {
233
+ ${mainDynamicStyles(PanelType.NOTE)(props)}
235
234
 
236
- .${PanelSharedCssClassName.icon} {
237
- ${iconDynamicStyles(PanelType.NOTE)}
238
- }
235
+ .${PanelSharedCssClassName.icon} {
236
+ ${iconDynamicStyles(PanelType.NOTE)(props)}
239
237
  }
238
+ }
240
239
 
241
- &[data-panel-type='${PanelType.TIP}'] {
242
- ${mainDynamicStyles(PanelType.TIP)}
240
+ &[data-panel-type='${PanelType.TIP}'] {
241
+ ${mainDynamicStyles(PanelType.TIP)(props)}
243
242
 
244
- .${PanelSharedCssClassName.icon} {
245
- ${iconDynamicStyles(PanelType.TIP)}
246
- }
243
+ .${PanelSharedCssClassName.icon} {
244
+ ${iconDynamicStyles(PanelType.TIP)(props)}
247
245
  }
246
+ }
248
247
 
249
- &[data-panel-type='${PanelType.WARNING}'] {
250
- ${mainDynamicStyles(PanelType.WARNING)}
248
+ &[data-panel-type='${PanelType.WARNING}'] {
249
+ ${mainDynamicStyles(PanelType.WARNING)(props)}
251
250
 
252
- .${PanelSharedCssClassName.icon} {
253
- ${iconDynamicStyles(PanelType.WARNING)}
254
- }
251
+ .${PanelSharedCssClassName.icon} {
252
+ ${iconDynamicStyles(PanelType.WARNING)(props)}
255
253
  }
254
+ }
256
255
 
257
- &[data-panel-type='${PanelType.ERROR}'] {
258
- ${mainDynamicStyles(PanelType.ERROR)}
256
+ &[data-panel-type='${PanelType.ERROR}'] {
257
+ ${mainDynamicStyles(PanelType.ERROR)(props)}
259
258
 
260
- .${PanelSharedCssClassName.icon} {
261
- ${iconDynamicStyles(PanelType.ERROR)}
262
- }
259
+ .${PanelSharedCssClassName.icon} {
260
+ ${iconDynamicStyles(PanelType.ERROR)(props)}
263
261
  }
262
+ }
264
263
 
265
- &[data-panel-type='${PanelType.SUCCESS}'] {
266
- ${mainDynamicStyles(PanelType.SUCCESS)}
264
+ &[data-panel-type='${PanelType.SUCCESS}'] {
265
+ ${mainDynamicStyles(PanelType.SUCCESS)(props)}
267
266
 
268
- .${PanelSharedCssClassName.icon} {
269
- ${iconDynamicStyles(PanelType.SUCCESS)}
270
- }
267
+ .${PanelSharedCssClassName.icon} {
268
+ ${iconDynamicStyles(PanelType.SUCCESS)(props)}
271
269
  }
270
+ }
272
271
 
273
- &[data-panel-type='${PanelType.CUSTOM}'] {
274
- ${themed({
272
+ &[data-panel-type='${PanelType.CUSTOM}'] {
273
+ ${themed({
275
274
  dark: getPanelBackgroundDarkModeColors
276
- })};
277
- }
275
+ })(props)};
276
+ }
277
+ `;
278
+ export const panelSharedStyles = props => css`
279
+ .${PanelSharedCssClassName.prefix} {
280
+ ${panelSharedStylesWithoutPrefix(props)}
278
281
  }
279
282
  `;
@@ -1,4 +1,4 @@
1
- import { css } from 'styled-components';
1
+ import { css } from '@emotion/react';
2
2
  import { akEditorLineHeight } from '@atlaskit/editor-shared-styles';
3
3
  import { DN50, N30A } from '@atlaskit/theme/colors';
4
4
  import { themed } from '@atlaskit/theme/components';
@@ -7,10 +7,10 @@ const divider = themed({
7
7
  dark: DN50
8
8
  }); // @see typography spreadsheet: https://docs.google.com/spreadsheets/d/1iYusRGCT4PoPfvxbJ8NrgjtfFgXLm5lpDWXzjua1W2E/edit#gid=93913128
9
9
 
10
- export const ruleSharedStyles = css`
10
+ export const ruleSharedStyles = props => css`
11
11
  & hr {
12
12
  border: none;
13
- background-color: ${divider};
13
+ background-color: ${divider(props)};
14
14
  margin: ${akEditorLineHeight}em 0;
15
15
  height: 2px;
16
16
  border-radius: 1px;
@@ -44,12 +44,20 @@ const tableSharedStyle = props => css`
44
44
  padding-left: ${akEditorTableNumberColumnWidth - 1}px;
45
45
  clear: both;
46
46
  }
47
+ .${TableSharedCssClassName.TABLE_NODE_WRAPPER} > table {
48
+ margin: ${tableMarginTop}px 0 0 0;
49
+ }
50
+
51
+ .${TableSharedCssClassName.TABLE_CONTAINER} > table,
52
+ .${TableSharedCssClassName.TABLE_STICKY_WRAPPER} > table {
53
+ margin: ${tableMarginTop}px ${tableMarginSides}px 0 0;
54
+ }
55
+
47
56
  /* avoid applying styles to nested tables (possible via extensions) */
48
57
  .${TableSharedCssClassName.TABLE_CONTAINER} > table,
49
58
  .${TableSharedCssClassName.TABLE_NODE_WRAPPER} > table,
50
59
  .${TableSharedCssClassName.TABLE_STICKY_WRAPPER} > table {
51
60
  border-collapse: collapse;
52
- margin: ${tableMarginTop}px ${tableMarginSides}px 0 0;
53
61
  border: ${tableCellBorderWidth}px solid
54
62
  ${themed({
55
63
  light: akEditorTableBorder,
@@ -1,6 +1,5 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import { ThemeProvider } from '@emotion/react';
3
- import { ThemeProvider as DeprecatedThemeProvider } from 'styled-components';
4
3
  import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
5
4
  import { useGlobalTheme } from '@atlaskit/theme/components';
6
5
  import { CHANNEL, fontSize } from '@atlaskit/theme/constants';
@@ -50,9 +49,7 @@ export function BaseThemeWrapper({
50
49
  }), [breakpoint, dynamicTextSizing, baseFontSize, mode]);
51
50
  return /*#__PURE__*/React.createElement(ThemeProvider, {
52
51
  theme: memoizedTheme
53
- }, /*#__PURE__*/React.createElement(DeprecatedThemeProvider, {
54
- theme: memoizedTheme
55
- }, children));
52
+ }, children);
56
53
  }
57
54
  export function BaseTheme({
58
55
  children,