@atlaskit/renderer 114.3.0 → 114.3.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 (51) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/dist/cjs/react/marks/alignment.js +13 -1
  4. package/dist/cjs/react/nodes/codeBlock/components/codeBlockContainer.js +36 -13
  5. package/dist/cjs/react/nodes/codeBlock/components/lightWeightCodeBlock.js +165 -5
  6. package/dist/cjs/react/nodes/layoutColumn.js +18 -1
  7. package/dist/cjs/react/nodes/media/index.js +75 -32
  8. package/dist/cjs/react/nodes/mediaSingle/index.js +9 -2
  9. package/dist/cjs/react/nodes/multiBodiedExtension.js +83 -4
  10. package/dist/cjs/react/nodes/panel.js +162 -2
  11. package/dist/cjs/react/nodes/table/sticky.js +51 -1
  12. package/dist/cjs/ui/Expand.js +124 -8
  13. package/dist/cjs/ui/Renderer/index.js +1 -1
  14. package/dist/cjs/ui/annotations/draft/component.js +27 -7
  15. package/dist/cjs/ui/annotations/element/mark.js +85 -6
  16. package/dist/es2019/react/marks/alignment.js +13 -1
  17. package/dist/es2019/react/nodes/codeBlock/components/codeBlockContainer.js +69 -13
  18. package/dist/es2019/react/nodes/codeBlock/components/lightWeightCodeBlock.js +194 -4
  19. package/dist/es2019/react/nodes/layoutColumn.js +27 -1
  20. package/dist/es2019/react/nodes/media/index.js +49 -15
  21. package/dist/es2019/react/nodes/mediaSingle/index.js +9 -2
  22. package/dist/es2019/react/nodes/multiBodiedExtension.js +83 -4
  23. package/dist/es2019/react/nodes/panel.js +162 -2
  24. package/dist/es2019/react/nodes/table/sticky.js +64 -1
  25. package/dist/es2019/ui/Expand.js +125 -8
  26. package/dist/es2019/ui/Renderer/index.js +1 -1
  27. package/dist/es2019/ui/annotations/draft/component.js +28 -7
  28. package/dist/es2019/ui/annotations/element/mark.js +96 -6
  29. package/dist/esm/react/marks/alignment.js +13 -1
  30. package/dist/esm/react/nodes/codeBlock/components/codeBlockContainer.js +36 -13
  31. package/dist/esm/react/nodes/codeBlock/components/lightWeightCodeBlock.js +164 -4
  32. package/dist/esm/react/nodes/layoutColumn.js +18 -1
  33. package/dist/esm/react/nodes/media/index.js +75 -32
  34. package/dist/esm/react/nodes/mediaSingle/index.js +9 -2
  35. package/dist/esm/react/nodes/multiBodiedExtension.js +83 -4
  36. package/dist/esm/react/nodes/panel.js +163 -3
  37. package/dist/esm/react/nodes/table/sticky.js +51 -1
  38. package/dist/esm/ui/Expand.js +125 -9
  39. package/dist/esm/ui/Renderer/index.js +1 -1
  40. package/dist/esm/ui/annotations/draft/component.js +28 -7
  41. package/dist/esm/ui/annotations/element/mark.js +85 -7
  42. package/dist/types/react/nodes/codeBlock/components/lightWeightCodeBlock.d.ts +5 -1
  43. package/dist/types/ui/annotations/draft/component.d.ts +0 -4
  44. package/dist/types-ts4.5/react/nodes/codeBlock/components/lightWeightCodeBlock.d.ts +5 -1
  45. package/dist/types-ts4.5/ui/annotations/draft/component.d.ts +0 -4
  46. package/package.json +5 -4
  47. package/dist/cjs/react/nodes/mediaSingle/styles.js +0 -24
  48. package/dist/es2019/react/nodes/mediaSingle/styles.js +0 -18
  49. package/dist/esm/react/nodes/mediaSingle/styles.js +0 -18
  50. package/dist/types/react/nodes/mediaSingle/styles.d.ts +0 -2
  51. package/dist/types-ts4.5/react/nodes/mediaSingle/styles.d.ts +0 -2
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.MarkComponent = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
11
  var _react = require("react");
12
12
  var _react2 = require("@emotion/react");
@@ -24,15 +24,64 @@ var _templateObject;
24
24
  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; }
25
25
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
26
26
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- `AnnotationSharedCSSByState` is not object-safe
27
- var markStyles = function markStyles() {
27
+ var markStylesOld = function markStylesOld() {
28
28
  return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\tcolor: inherit;\n\tbackground-color: unset;\n\t-webkit-tap-highlight-color: transparent;\n\n\t&[data-mark-annotation-state='", "'] {\n\t\t", "\n\t\t", "\n\n\t\t&:focus,\n\t\t\t&[data-has-focus='true'] {\n\t\t\t", "\n\t\t}\n\t\t&[data-is-hovered='true']:not([data-has-focus='true']) {\n\t\t\t", "\n\t\t}\n\t}\n"])), _adfSchema.AnnotationMarkStates.ACTIVE, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? (0, _styles.AnnotationSharedCSSByState)().common : '', (0, _styles.AnnotationSharedCSSByState)().blur, (0, _styles.AnnotationSharedCSSByState)().focus, (0, _platformFeatureFlags.fg)('confluence-frontend-comments-panel') ? (0, _styles.AnnotationSharedCSSByState)().hover : '');
29
29
  };
30
+ var markStylesNew = (0, _react2.css)((0, _defineProperty2.default)({
31
+ color: 'inherit',
32
+ backgroundColor: 'unset',
33
+ WebkitTapHighlightColor: 'transparent'
34
+ }, "&[data-mark-annotation-state='".concat(_adfSchema.AnnotationMarkStates.ACTIVE, "']"), {
35
+ // was from blur in AnnotationSharedCSSByState().blur
36
+ background: "var(--ds-background-accent-yellow-subtlest, #FFF7D6)",
37
+ borderBottom: "2px solid ".concat("var(--ds-border-accent-yellow, #B38600)"),
38
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
39
+ '&:focus, &[data-has-focus="true"]': {
40
+ background: "var(--ds-background-accent-yellow-subtler, #F8E6A0)",
41
+ borderBottom: "2px solid ".concat("var(--ds-border-accent-yellow, #B38600)"),
42
+ // TODO: DSP-4147 - Annotation shadow
43
+ boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)",
44
+ cursor: 'pointer'
45
+ }
46
+ }));
47
+ var markStylesNewWithInlineComments = (0, _react2.css)((0, _defineProperty2.default)({}, "&[data-mark-annotation-state='".concat(_adfSchema.AnnotationMarkStates.ACTIVE, "']"), {
48
+ // was from common in AnnotationSharedCSSByState().common
49
+ borderBottom: '2px solid transparent',
50
+ cursor: 'pointer',
51
+ padding: '1px 0 2px',
52
+ // it was under fg(annotations_align_editor_and_renderer_styles) from AnnotationSharedCSSByState().common, assume it's on as already rolled out
53
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors
54
+ '&:has(.card), &:has([data-inline-card])': {
55
+ padding: '5px 0 3px 0'
56
+ },
57
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors
58
+ '&:has(.date-lozenger-container)': {
59
+ paddingTop: "var(--ds-space-025, 2px)"
60
+ },
61
+ // was from blur in AnnotationSharedCSSByState().blur
62
+ background: "var(--ds-background-accent-yellow-subtlest, #FFF7D6)",
63
+ borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
64
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
65
+ '&:focus, &[data-has-focus="true"]': {
66
+ background: "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)",
67
+ borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
68
+ boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)"
69
+ }
70
+ }));
71
+ var markStylesNewWithCommentsPanel = (0, _react2.css)((0, _defineProperty2.default)({}, "&[data-mark-annotation-state='".concat(_adfSchema.AnnotationMarkStates.ACTIVE, "']"), {
72
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
73
+ '&[data-is-hovered="true"]:not([data-has-focus="true"])': {
74
+ background: "var(--ds-background-accent-yellow-subtlest-hovered, #F8E6A0)",
75
+ borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
76
+ boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)"
77
+ }
78
+ }));
30
79
  var isMobile = function isMobile() {
31
80
  // Ignored via go/ees005
32
81
  // eslint-disable-next-line require-unicode-regexp
33
82
  return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
34
83
  };
35
- var accessibilityStyles = function accessibilityStyles(startMarker, endMarker) {
84
+ var accessibilityStylesOld = function accessibilityStylesOld(startMarker, endMarker) {
36
85
  return (0, _react2.css)({
37
86
  '&::before, &::after': {
38
87
  clipPath: 'inset(100%)',
@@ -53,6 +102,25 @@ var accessibilityStyles = function accessibilityStyles(startMarker, endMarker) {
53
102
  }
54
103
  });
55
104
  };
105
+ var accessibilityStylesNew = (0, _react2.css)({
106
+ '&::before, &::after': {
107
+ clipPath: 'inset(100%)',
108
+ clip: 'rect(1px, 1px, 1px, 1px)',
109
+ height: '1px',
110
+ overflow: 'hidden',
111
+ position: 'absolute',
112
+ whiteSpace: 'nowrap',
113
+ width: '1px'
114
+ },
115
+ '&::before': {
116
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
117
+ content: "' [var(--ak-renderer-annotation-startmarker)] '"
118
+ },
119
+ '&::after': {
120
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
121
+ content: "' [var(--ak-renderer-annotation-endmarker)] '"
122
+ }
123
+ });
56
124
  var MarkComponent = exports.MarkComponent = function MarkComponent(_ref) {
57
125
  var annotationParentIds = _ref.annotationParentIds,
58
126
  children = _ref.children,
@@ -124,21 +192,32 @@ var MarkComponent = exports.MarkComponent = function MarkComponent(_ref) {
124
192
  } : _objectSpread({
125
193
  'aria-details': annotationIds.join(', ')
126
194
  }, desktopAccessibilityAttributes);
127
- var getAccessibilityStyles = function getAccessibilityStyles() {
195
+ var getAccessibilityStylesOld = function getAccessibilityStylesOld() {
128
196
  if (isMobile()) {
129
197
  return {};
130
198
  }
131
199
  if (state !== _adfSchema.AnnotationMarkStates.RESOLVED) {
132
200
  var startMarker = intl.formatMessage(_messages.inlineCommentMessages.contentRendererInlineCommentMarkerStart);
133
201
  var endMarker = intl.formatMessage(_messages.inlineCommentMessages.contentRendererInlineCommentMarkerEnd);
134
- return accessibilityStyles(startMarker, endMarker);
202
+ return accessibilityStylesOld(startMarker, endMarker);
135
203
  } else {
136
204
  return {};
137
205
  }
138
206
  };
207
+ if ((0, _platformFeatureFlags.fg)('platform_editor_emotion_refactor_renderer')) {
208
+ return (0, _react2.jsx)(useBlockLevel ? 'div' : 'mark', _objectSpread(_objectSpread(_objectSpread((0, _defineProperty2.default)({
209
+ id: id
210
+ }, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? 'onClickCapture' : 'onClick', onMarkClick), accessibility), overriddenData), !useBlockLevel && {
211
+ css: [markStylesNew, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') && markStylesNewWithInlineComments, (0, _platformFeatureFlags.fg)('confluence-frontend-comments-panel') && markStylesNewWithCommentsPanel, !isMobile() && accessibilityStylesNew],
212
+ style: {
213
+ '--ak-renderer-annotation-startmarker': intl.formatMessage(_messages.inlineCommentMessages.contentRendererInlineCommentMarkerStart),
214
+ '--ak-renderer-annotation-endmarker': intl.formatMessage(_messages.inlineCommentMessages.contentRendererInlineCommentMarkerEnd)
215
+ }
216
+ }), children);
217
+ }
139
218
  return (0, _react2.jsx)(useBlockLevel ? 'div' : 'mark', _objectSpread(_objectSpread(_objectSpread((0, _defineProperty2.default)({
140
219
  id: id
141
220
  }, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? 'onClickCapture' : 'onClick', onMarkClick), accessibility), overriddenData), !useBlockLevel && {
142
- css: [markStyles, getAccessibilityStyles()]
221
+ css: [markStylesOld, getAccessibilityStylesOld()]
143
222
  }), children);
144
223
  };
@@ -7,7 +7,8 @@ import React from 'react';
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { alignmentPositionMap } from '@atlaskit/adf-schema';
10
- const MarkWrapper = props => {
10
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
11
+ const MarkWrapperOld = props => {
11
12
  const styles = props['data-align'] ?
12
13
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
13
14
  css`
@@ -20,6 +21,17 @@ const MarkWrapper = props => {
20
21
  // eslint-disable-next-line react/jsx-props-no-spreading
21
22
  }, props), props.children);
22
23
  };
24
+ const MarkWrapperNew = props => {
25
+ const dataAlign = props['data-align'] ? alignmentPositionMap[props['data-align']] : undefined;
26
+ return jsx("div", _extends({
27
+ style: {
28
+ textAlign: dataAlign
29
+ }
30
+ // Ignored via go/ees005
31
+ // eslint-disable-next-line react/jsx-props-no-spreading
32
+ }, props), props.children);
33
+ };
34
+ const MarkWrapper = componentWithFG('platform_editor_emotion_refactor_renderer', MarkWrapperNew, MarkWrapperOld);
23
35
  export default function Alignment(props) {
24
36
  return jsx(MarkWrapper
25
37
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -8,9 +8,10 @@ import { overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-share
8
8
  import { N20 } from '@atlaskit/theme/colors';
9
9
  import { CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
10
10
  import CodeBlockButtonContainer from './codeBlockButtonContainer';
11
+ import { fg } from '@atlaskit/platform-feature-flags';
11
12
 
12
13
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
13
- const codeBlockStyleOverrides = css`
14
+ const codeBlockStyleOverridesOld = css`
14
15
  tab-size: 4;
15
16
  background-color: ${`var(--ds-surface-raised, ${N20})`};
16
17
 
@@ -43,6 +44,63 @@ const codeBlockStyleOverrides = css`
43
44
  0 0;
44
45
  }
45
46
  `;
47
+ const codeBlockStyleOverridesNew = css({
48
+ tabSize: 4,
49
+ backgroundColor: `var(--ds-surface-raised, ${N20})`,
50
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
51
+ button: {
52
+ opacity: 0,
53
+ transition: 'opacity 0.2s ease 0s'
54
+ },
55
+ '&:hover': {
56
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
57
+ button: {
58
+ opacity: 1
59
+ }
60
+ },
61
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
62
+ [`${CodeBlockSharedCssClassName.DS_CODEBLOCK}`]: {
63
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
64
+ fontSize: `${14 / 16}rem`,
65
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
66
+ lineHeight: '1.5rem',
67
+ backgroundImage: `linear-gradient(
68
+ to right,
69
+ ${"var(--ds-background-neutral, #091E420F)"} ${"var(--ds-space-300, 24px)"},
70
+ transparent ${"var(--ds-space-300, 24px)"}
71
+ ),linear-gradient(
72
+ to right,
73
+ ${"var(--ds-surface-raised, #FFFFFF)"} ${"var(--ds-space-300, 24px)"},
74
+ transparent ${"var(--ds-space-300, 24px)"}
75
+ ),linear-gradient(
76
+ to left,
77
+ ${"var(--ds-background-neutral, #091E420F)"} ${"var(--ds-space-100, 8px)"},
78
+ transparent ${"var(--ds-space-100, 8px)"}
79
+ ),linear-gradient(
80
+ to left,
81
+ ${"var(--ds-surface-raised, #FFFFFF)"} ${"var(--ds-space-100, 8px)"},
82
+ transparent ${"var(--ds-space-100, 8px)"}
83
+ ),linear-gradient(
84
+ to left,
85
+ ${"var(--ds-shadow-overflow-spread, #091e4229)"} 0,
86
+ ${"var(--ds-UNSAFE-transparent, transparent)"} ${"var(--ds-space-100, 8px)"}
87
+ ),linear-gradient(
88
+ to left,
89
+ ${"var(--ds-shadow-overflow-perimeter, #091e421f)"} 0,
90
+ ${"var(--ds-UNSAFE-transparent, transparent)"} ${"var(--ds-space-100, 8px)"}
91
+ ),linear-gradient(
92
+ to right,
93
+ ${"var(--ds-shadow-overflow-spread, #091e4229)"} 0,
94
+ ${"var(--ds-UNSAFE-transparent, transparent)"} ${"var(--ds-space-100, 8px)"}
95
+ ),linear-gradient(
96
+ to right,
97
+ ${"var(--ds-shadow-overflow-perimeter, #091e421f)"} 0,
98
+ ${"var(--ds-UNSAFE-transparent, transparent)"} ${"var(--ds-space-100, 8px)"}
99
+ )`,
100
+ backgroundAttachment: 'local, local, local, local, scroll, scroll, scroll, scroll',
101
+ backgroundPosition: '0 0, 0 0, 100% 0, 100% 0, 100% 0, 100% 0, 0 0, 0 0'
102
+ }
103
+ });
46
104
  const CodeBlockContainer = ({
47
105
  allowCopyToClipboard,
48
106
  allowWrapCodeBlock,
@@ -52,18 +110,16 @@ const CodeBlockContainer = ({
52
110
  text,
53
111
  wrapLongLines
54
112
  }) => {
55
- return (
113
+ return jsx("div", {
56
114
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
57
- jsx("div", {
58
- className: className,
59
- css: codeBlockStyleOverrides
60
- }, jsx(CodeBlockButtonContainer, {
61
- allowCopyToClipboard: allowCopyToClipboard,
62
- allowWrapCodeBlock: allowWrapCodeBlock,
63
- setWrapLongLines: setWrapLongLines,
64
- text: text,
65
- wrapLongLines: wrapLongLines
66
- }), children)
67
- );
115
+ className: className,
116
+ css: fg('platform_editor_emotion_refactor_renderer') ? codeBlockStyleOverridesNew : codeBlockStyleOverridesOld
117
+ }, jsx(CodeBlockButtonContainer, {
118
+ allowCopyToClipboard: allowCopyToClipboard,
119
+ allowWrapCodeBlock: allowWrapCodeBlock,
120
+ setWrapLongLines: setWrapLongLines,
121
+ text: text,
122
+ wrapLongLines: wrapLongLines
123
+ }), children);
68
124
  };
69
125
  export default CodeBlockContainer;
@@ -1,3 +1,6 @@
1
+ /* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */
2
+ /* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */
3
+ /* eslint-disable @atlaskit/ui-styling-standard/no-nested-selectors */
1
4
  /**
2
5
  * @jsxRuntime classic
3
6
  * @jsx jsx
@@ -5,19 +8,163 @@
5
8
  import React, { forwardRef, useMemo } from 'react';
6
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
10
  import { css, jsx } from '@emotion/react';
8
- import { blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
11
+ import { akEditorTableCellMinWidth, blockNodesVerticalMargin, overflowShadow } from '@atlaskit/editor-shared-styles';
9
12
  import { codeBlockSharedStyles, CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
10
13
  import { useBidiWarnings } from '../../../hooks/use-bidi-warnings';
11
14
  import { RendererCssClassName } from '../../../../consts';
15
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
16
+ const codeBlockSharedStylesNew = css({
17
+ [`.${CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPED}
18
+ > .${CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER}
19
+ > .${CodeBlockSharedCssClassName.CODEBLOCK_CONTENT}`]: {
20
+ marginRight: "var(--ds-space-100, 8px)",
21
+ code: {
22
+ display: 'block',
23
+ wordBreak: 'break-word',
24
+ whiteSpace: 'pre-wrap'
25
+ }
26
+ },
27
+ [`.${CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER}
28
+ > .${CodeBlockSharedCssClassName.CODEBLOCK_CONTENT}`]: {
29
+ display: 'flex',
30
+ flex: 1,
31
+ code: {
32
+ flexGrow: 1,
33
+ whiteSpace: 'pre'
34
+ }
35
+ },
36
+ [`.${CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER}`]: {
37
+ position: 'relative',
38
+ backgroundColor: "var(--ds-surface-raised, #FFFFFF)",
39
+ borderRadius: "var(--ds-border-radius, 3px)",
40
+ margin: `${blockNodesVerticalMargin} 0 0 0`,
41
+ fontFamily: "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
42
+ minWidth: `${akEditorTableCellMinWidth}px`,
43
+ cursor: 'pointer',
44
+ clear: 'both',
45
+ '--ds--code--bg-color': 'transparent',
46
+ '.code-block-gutter-pseudo-element::before': {
47
+ content: '"attr(data-label)"'
48
+ },
49
+ /* This is necessary to allow for arrow key navigation in/out of code blocks in Firefox. */
50
+ whiteSpace: 'normal',
51
+ [`.${CodeBlockSharedCssClassName.CODEBLOCK_START}`]: {
52
+ position: 'absolute',
53
+ visibility: 'hidden',
54
+ height: '1.5rem',
55
+ top: '0px',
56
+ left: '0px'
57
+ },
58
+ [`${CodeBlockSharedCssClassName.CODEBLOCK_END}`]: {
59
+ position: 'absolute',
60
+ visibility: 'hidden',
61
+ height: '1.5rem',
62
+ bottom: '0px',
63
+ right: '0px'
64
+ },
65
+ [`.${CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER}`]: {
66
+ position: 'relative',
67
+ backgroundColor: "var(--ds-background-neutral, #091E420F)",
68
+ display: 'flex',
69
+ borderRadius: "var(--ds-border-radius, 3px)",
70
+ width: '100%',
71
+ counterReset: 'line',
72
+ overflowX: 'auto',
73
+ backgroundImage: 'var(--ak-renderer-codeblock-content-wrapper-bg-img)',
74
+ backgroundRepeat: 'no-repeat',
75
+ backgroundAttachment: 'local, local, local, local, scroll, scroll, scroll, scroll',
76
+ backgroundSize: `${"var(--ds-space-300, 24px)"} 100%,
77
+ ${"var(--ds-space-300, 24px)"} 100%,
78
+ ${"var(--ds-space-100, 8px)"} 100%,
79
+ ${"var(--ds-space-100, 8px)"} 100%,
80
+ ${"var(--ds-space-100, 8px)"} 100%,
81
+ 1px 100%,
82
+ ${"var(--ds-space-100, 8px)"} 100%,
83
+ 1px 100%`,
84
+ backgroundPosition: `0 0,
85
+ 0 0,
86
+ 100% 0,
87
+ 100% 0,
88
+ 100% 0,
89
+ 100% 0,
90
+ 0 0,
91
+ 0 0`,
92
+ /* Be careful if refactoring this; it is needed to keep arrow key navigation in Firefox consistent with other browsers. */
93
+ overflowY: 'hidden'
94
+ },
95
+ [`.${CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER}`]: {
96
+ backgroundColor: "var(--ds-background-neutral, #091E420F)",
97
+ position: 'relative',
98
+ width: 'var(--lineNumberGutterWidth, 2rem)',
99
+ padding: "var(--ds-space-100, 8px)",
100
+ flexShrink: 0,
101
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
102
+ fontSize: `${14 / 16}rem`,
103
+ boxSizing: 'content-box'
104
+ },
105
+ // This is a fix of marker of list item with code block.
106
+ // The list item marker in Chrome is aligned by the baseline of the text,
107
+ // that's why we need to add a text (content: "1") to the line number gutter to align
108
+ // the list item marker with the text.
109
+ // Without it, the list item marker will be aligned by the bottom of the code block.
110
+ [`.${CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER}::before`]: {
111
+ content: '"1"',
112
+ visibility: 'hidden',
113
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
114
+ fontSize: `${14 / 16}rem`,
115
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
116
+ lineHeight: '1.5rem'
117
+ },
118
+ [`.${CodeBlockSharedCssClassName.CODEBLOCK_CONTENT}`]: {
119
+ code: {
120
+ tabSize: 4,
121
+ cursor: 'text',
122
+ color: "var(--ds-text, #172B4D)",
123
+ borderRadius: "var(--ds-border-radius, 3px)",
124
+ margin: "var(--ds-space-100, 8px)",
125
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
126
+ fontSize: `${14 / 16}rem`,
127
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
128
+ lineHeight: '1.5rem'
129
+ }
130
+ },
131
+ [`.${CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER_LINE_NUMBER_WIDGET}`]: {
132
+ pointerEvents: 'none',
133
+ userSelect: 'none',
134
+ width: 'var(--lineNumberGutterWidth, 2rem)',
135
+ left: 0,
136
+ position: 'absolute',
137
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
138
+ fontSize: `${14 / 16}rem`,
139
+ padding: `0px ${"var(--ds-space-100, 8px)"}`,
140
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
141
+ lineHeight: '1.5rem',
142
+ textAlign: 'right',
143
+ color: "var(--ds-text-subtlest, #505F79)",
144
+ boxSizing: 'content-box'
145
+ }
146
+ }
147
+ });
148
+
12
149
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
13
- const lightWeightCodeBlockStyles = css`
150
+ const lightWeightCodeBlockStylesOld = css`
14
151
  .${CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER} {
15
152
  cursor: text;
16
153
  }
17
154
  `;
155
+ const lightWeightCodeBlockStylesNew = css({
156
+ [`.${CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER}`]: {
157
+ cursor: 'text'
158
+ }
159
+ });
18
160
  export const LightWeightCodeBlockCssClassName = {
19
161
  CONTAINER: 'light-weight-code-block'
20
162
  };
163
+
164
+ /**
165
+ * @private
166
+ * @deprecated styles are moved to RendererStyleContainer
167
+ */
21
168
  export const getLightWeightCodeBlockStylesForRootRendererStyleSheet = () => {
22
169
  // We overwrite the rule that clears margin-top for first nested codeblocks, as
23
170
  // our lightweight codeblock dom structure will always nest the codeblock inside
@@ -34,7 +181,7 @@ export const getLightWeightCodeBlockStylesForRootRendererStyleSheet = () => {
34
181
  }
35
182
  `;
36
183
  };
37
- const LightWeightCodeBlock = /*#__PURE__*/forwardRef(({
184
+ const LightWeightCodeBlockOld = /*#__PURE__*/forwardRef(({
38
185
  text,
39
186
  codeBidiWarningTooltipEnabled = true,
40
187
  className
@@ -52,7 +199,49 @@ const LightWeightCodeBlock = /*#__PURE__*/forwardRef(({
52
199
  ref: ref
53
200
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
54
201
  ,
55
- css: [codeBlockSharedStyles(), lightWeightCodeBlockStyles]
202
+ css: [codeBlockSharedStyles(), lightWeightCodeBlockStylesOld]
203
+ }, jsx("div", {
204
+ className: CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER
205
+ }, jsx("div", {
206
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
207
+ className: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER
208
+ }, jsx("div", {
209
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
210
+ className: CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER
211
+ }, textRows.map((_, index) =>
212
+ // Ignored via go/ees005
213
+ // eslint-disable-next-line react/no-array-index-key
214
+ jsx("span", {
215
+ key: index
216
+ }))), jsx("div", {
217
+ className: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT
218
+ }, jsx("code", null, renderBidiWarnings(text))))));
219
+ });
220
+ const LightWeightCodeBlockNew = /*#__PURE__*/forwardRef(({
221
+ text,
222
+ codeBidiWarningTooltipEnabled = true,
223
+ className
224
+ }, ref) => {
225
+ const textRows = useMemo(() => (text !== null && text !== void 0 ? text : '').split('\n'), [text]);
226
+ const {
227
+ renderBidiWarnings
228
+ } = useBidiWarnings({
229
+ enableWarningTooltip: codeBidiWarningTooltipEnabled
230
+ });
231
+ const classNames = [LightWeightCodeBlockCssClassName.CONTAINER, className].join(' ');
232
+ const codeBlockBackgroundImage = overflowShadow({
233
+ leftCoverWidth: "var(--ds-space-300, 24px)"
234
+ });
235
+ return jsx("div", {
236
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
237
+ className: classNames,
238
+ ref: ref
239
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
240
+ ,
241
+ css: [codeBlockSharedStylesNew, lightWeightCodeBlockStylesNew],
242
+ style: {
243
+ '--ak-renderer-codeblock-content-wrapper-bg-img': codeBlockBackgroundImage
244
+ }
56
245
  }, jsx("div", {
57
246
  className: CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER
58
247
  }, jsx("div", {
@@ -70,4 +259,5 @@ const LightWeightCodeBlock = /*#__PURE__*/forwardRef(({
70
259
  className: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT
71
260
  }, jsx("code", null, renderBidiWarnings(text))))));
72
261
  });
262
+ const LightWeightCodeBlock = componentWithFG('platform_editor_emotion_refactor_renderer', LightWeightCodeBlockNew, LightWeightCodeBlockOld);
73
263
  export default LightWeightCodeBlock;
@@ -6,6 +6,32 @@ import React from 'react';
6
6
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
7
  import { jsx, css } from '@emotion/react';
8
8
  import { WidthProvider, clearNextSiblingMarginTopStyle, clearNextSiblingBlockMarkMarginTopStyle } from '@atlaskit/editor-common/ui';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
10
+
11
+ // localized styles, was from clearNextSiblingMarginTopStyle in @atlaskit/editor-common/ui
12
+ const clearNextSiblingMarginTopStyleNew = css({
13
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
14
+ '& + *': {
15
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
16
+ marginTop: '0 !important'
17
+ }
18
+ });
19
+
20
+ // localized styles, was from clearNextSiblingBlockMarkMarginTopStyle in @atlaskit/editor-common/ui
21
+ const clearNextSiblingBlockMarkMarginTopStyleNew = css({
22
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
23
+ [`+ .fabric-editor-block-mark > p,
24
+ + .fabric-editor-block-mark > h1,
25
+ + .fabric-editor-block-mark > h2,
26
+ + .fabric-editor-block-mark > h3,
27
+ + .fabric-editor-block-mark > h4,
28
+ + .fabric-editor-block-mark > h5,
29
+ + .fabric-editor-block-mark > h6
30
+ `]: {
31
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
32
+ marginTop: '0 !important'
33
+ }
34
+ });
9
35
 
10
36
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
11
37
  const layoutColumnClearMarginTopStyles = css(
@@ -21,6 +47,6 @@ export default function LayoutSection(props) {
21
47
  flexBasis: `${props.width}%`
22
48
  }
23
49
  }, jsx(WidthProvider, null, jsx("div", {
24
- css: layoutColumnClearMarginTopStyles
50
+ css: fg('platform_editor_emotion_refactor_renderer') ? [clearNextSiblingMarginTopStyleNew, clearNextSiblingBlockMarkMarginTopStyleNew] : layoutColumnClearMarginTopStyles
25
51
  }), props.children));
26
52
  }
@@ -28,28 +28,37 @@ import { useInlineCommentsFilter } from '../../../ui/annotations/hooks/use-inlin
28
28
  import { useInlineCommentSubscriberContext } from '../../../ui/annotations/hooks/use-inline-comment-subscriber';
29
29
  import { AnnotationUpdateEvent } from '@atlaskit/editor-common/types';
30
30
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
31
- // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
32
- const linkStyle = css`
33
- position: absolute;
34
- background: transparent;
35
- top: 0;
36
- right: 0;
37
- bottom: 0;
38
- left: 0;
39
- cursor: pointer;
40
- width: 100% !important;
41
- height: 100% !important;
42
- `;
31
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
32
+ const linkStyle = css({
33
+ position: 'absolute',
34
+ background: 'transparent',
35
+ top: 0,
36
+ right: 0,
37
+ bottom: 0,
38
+ left: 0,
39
+ cursor: 'pointer',
40
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
41
+ width: '100% !important',
42
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
43
+ height: '100% !important'
44
+ });
43
45
 
44
46
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Ignored via go/DSP-18766
45
- const borderStyle = (color, width) => css`
47
+ const borderStyleOld = (color, width) => css`
46
48
  position: absolute;
47
49
  width: 100% !important;
48
50
  height: 100% !important;
49
51
  border-radius: ${width}px;
50
52
  box-shadow: 0 0 0 ${width}px ${color};
51
53
  `;
52
- const MediaBorder = ({
54
+ const borderStyleNew = css({
55
+ position: 'absolute',
56
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
57
+ width: '100% !important',
58
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
59
+ height: '100% !important'
60
+ });
61
+ const MediaBorderOld = ({
53
62
  mark,
54
63
  children
55
64
  }) => {
@@ -66,11 +75,36 @@ const MediaBorder = ({
66
75
  "data-size": borderWidth
67
76
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
68
77
  ,
69
- css: borderStyle(paletteColorValue, borderWidth)
78
+ css: borderStyleOld(paletteColorValue, borderWidth)
79
+ }, jsx(MediaBorderGapFiller, {
80
+ borderColor: borderColor
81
+ }), children);
82
+ };
83
+ const MediaBorderNew = ({
84
+ mark,
85
+ children
86
+ }) => {
87
+ var _mark$attrs$color2, _mark$attrs$size2;
88
+ if (!mark) {
89
+ return jsx(Fragment, null, children);
90
+ }
91
+ const borderColor = (_mark$attrs$color2 = mark === null || mark === void 0 ? void 0 : mark.attrs.color) !== null && _mark$attrs$color2 !== void 0 ? _mark$attrs$color2 : '';
92
+ const borderWidth = (_mark$attrs$size2 = mark === null || mark === void 0 ? void 0 : mark.attrs.size) !== null && _mark$attrs$size2 !== void 0 ? _mark$attrs$size2 : 0;
93
+ const paletteColorValue = hexToEditorBorderPaletteColor(borderColor) || borderColor;
94
+ return jsx("div", {
95
+ "data-mark-type": "border",
96
+ "data-color": borderColor,
97
+ "data-size": borderWidth,
98
+ css: borderStyleNew,
99
+ style: {
100
+ borderRadius: `${borderWidth}px`,
101
+ boxShadow: `0 0 0 ${borderWidth}px ${paletteColorValue}`
102
+ }
70
103
  }, jsx(MediaBorderGapFiller, {
71
104
  borderColor: borderColor
72
105
  }), children);
73
106
  };
107
+ const MediaBorder = componentWithFG('platform_editor_emotion_refactor_renderer', MediaBorderNew, MediaBorderOld);
74
108
  const MediaLink = ({
75
109
  mark,
76
110
  children,