@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
@@ -3,6 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  * @jsxRuntime classic
4
4
  * @jsx jsx
5
5
  */
6
+
6
7
  import React, { Fragment } from 'react';
7
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
9
  import { css, jsx } from '@emotion/react';
@@ -14,6 +15,7 @@ import { dataAttributes } from './dom';
14
15
  import { AnnotationSharedCSSByState } from '@atlaskit/editor-common/styles';
15
16
  import { segmentText } from '../../../react/utils/segment-text';
16
17
  import { renderTextSegments } from '../../../react/utils/render-text-segments';
18
+ import { fg } from '@atlaskit/platform-feature-flags';
17
19
 
18
20
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
19
21
  const markStyles = () => css({
@@ -25,19 +27,38 @@ const markStyles = () => css({
25
27
  AnnotationSharedCSSByState().common,
26
28
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
27
29
  AnnotationSharedCSSByState().focus);
30
+
31
+ // Localized AnnotationSharedCSSByState().common and AnnotationSharedCSSByState().focus
32
+ const markStylesNew = css({
33
+ color: 'inherit',
34
+ backgroundColor: 'unset',
35
+ WebkitTapHighlightColor: 'transparent',
36
+ borderBottom: '2px solid transparent',
37
+ cursor: 'pointer',
38
+ padding: '1px 0 2px',
39
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors
40
+ '&:has(.card), &:has([data-inline-card])': {
41
+ padding: '5px 0 3px 0'
42
+ },
43
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors
44
+ '&:has(.date-lozenger-container)': {
45
+ paddingTop: "var(--ds-space-025, 2px)"
46
+ },
47
+ background: "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)",
48
+ borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
49
+ boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)"
50
+ });
28
51
  export const AnnotationDraft = ({
29
52
  draftPosition,
30
53
  children
31
54
  }) => {
32
- return (
55
+ return jsx("mark", _extends({
56
+ "data-renderer-mark": true
33
57
  // Ignored via go/ees005
34
58
  // eslint-disable-next-line react/jsx-props-no-spreading
35
- jsx("mark", _extends({
36
- "data-renderer-mark": true
37
- }, dataAttributes(draftPosition), {
38
- css: markStyles
39
- }), children)
40
- );
59
+ }, dataAttributes(draftPosition), {
60
+ css: fg('platform_editor_emotion_refactor_renderer') ? markStylesNew : markStyles
61
+ }), children);
41
62
  };
42
63
  export const getAnnotationIndex = (annotationPosition, fragmentCount) => {
43
64
  if (annotationPosition === InsertDraftPosition.START) {
@@ -11,9 +11,8 @@ import { AnnotationMarkStates } from '@atlaskit/adf-schema';
11
11
  import { fg } from '@atlaskit/platform-feature-flags';
12
12
  import { useIntl } from 'react-intl-next';
13
13
  import { inlineCommentMessages } from '../../../messages';
14
-
15
14
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- `AnnotationSharedCSSByState` is not object-safe
16
- const markStyles = () => css`
15
+ const markStylesOld = () => css`
17
16
  color: inherit;
18
17
  background-color: unset;
19
18
  -webkit-tap-highlight-color: transparent;
@@ -31,12 +30,69 @@ const markStyles = () => css`
31
30
  }
32
31
  }
33
32
  `;
33
+ const markStylesNew = css({
34
+ color: 'inherit',
35
+ backgroundColor: 'unset',
36
+ WebkitTapHighlightColor: 'transparent',
37
+ // 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
38
+ [`&[data-mark-annotation-state='${AnnotationMarkStates.ACTIVE}']`]: {
39
+ // was from blur in AnnotationSharedCSSByState().blur
40
+ background: "var(--ds-background-accent-yellow-subtlest, #FFF7D6)",
41
+ borderBottom: `2px solid ${"var(--ds-border-accent-yellow, #B38600)"}`,
42
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
43
+ '&:focus, &[data-has-focus="true"]': {
44
+ background: "var(--ds-background-accent-yellow-subtler, #F8E6A0)",
45
+ borderBottom: `2px solid ${"var(--ds-border-accent-yellow, #B38600)"}`,
46
+ // TODO: DSP-4147 - Annotation shadow
47
+ boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)",
48
+ cursor: 'pointer'
49
+ }
50
+ }
51
+ });
52
+ const markStylesNewWithInlineComments = css({
53
+ // 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
54
+ [`&[data-mark-annotation-state='${AnnotationMarkStates.ACTIVE}']`]: {
55
+ // was from common in AnnotationSharedCSSByState().common
56
+ borderBottom: '2px solid transparent',
57
+ cursor: 'pointer',
58
+ padding: '1px 0 2px',
59
+ // it was under fg(annotations_align_editor_and_renderer_styles) from AnnotationSharedCSSByState().common, assume it's on as already rolled out
60
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors
61
+ '&:has(.card), &:has([data-inline-card])': {
62
+ padding: '5px 0 3px 0'
63
+ },
64
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors
65
+ '&:has(.date-lozenger-container)': {
66
+ paddingTop: "var(--ds-space-025, 2px)"
67
+ },
68
+ // was from blur in AnnotationSharedCSSByState().blur
69
+ background: "var(--ds-background-accent-yellow-subtlest, #FFF7D6)",
70
+ borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
71
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
72
+ '&:focus, &[data-has-focus="true"]': {
73
+ background: "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)",
74
+ borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
75
+ boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)"
76
+ }
77
+ }
78
+ });
79
+ const markStylesNewWithCommentsPanel = css({
80
+ // 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
81
+ [`&[data-mark-annotation-state='${AnnotationMarkStates.ACTIVE}']`]: {
82
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
83
+ '&[data-is-hovered="true"]:not([data-has-focus="true"])': {
84
+ background: "var(--ds-background-accent-yellow-subtlest-hovered, #F8E6A0)",
85
+ borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
86
+ boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)"
87
+ }
88
+ }
89
+ });
34
90
  const isMobile = () => {
35
91
  // Ignored via go/ees005
36
92
  // eslint-disable-next-line require-unicode-regexp
37
93
  return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
38
94
  };
39
- const accessibilityStyles = (startMarker, endMarker) => css({
95
+ const accessibilityStylesOld = (startMarker, endMarker) => css({
40
96
  '&::before, &::after': {
41
97
  clipPath: 'inset(100%)',
42
98
  clip: 'rect(1px, 1px, 1px, 1px)',
@@ -55,6 +111,25 @@ const accessibilityStyles = (startMarker, endMarker) => css({
55
111
  content: `' [${endMarker}] '`
56
112
  }
57
113
  });
114
+ const accessibilityStylesNew = css({
115
+ '&::before, &::after': {
116
+ clipPath: 'inset(100%)',
117
+ clip: 'rect(1px, 1px, 1px, 1px)',
118
+ height: '1px',
119
+ overflow: 'hidden',
120
+ position: 'absolute',
121
+ whiteSpace: 'nowrap',
122
+ width: '1px'
123
+ },
124
+ '&::before': {
125
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
126
+ content: `' [var(--ak-renderer-annotation-startmarker)] '`
127
+ },
128
+ '&::after': {
129
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
130
+ content: `' [var(--ak-renderer-annotation-endmarker)] '`
131
+ }
132
+ });
58
133
  export const MarkComponent = ({
59
134
  annotationParentIds,
60
135
  children,
@@ -127,25 +202,40 @@ export const MarkComponent = ({
127
202
  'aria-details': annotationIds.join(', '),
128
203
  ...desktopAccessibilityAttributes
129
204
  };
130
- const getAccessibilityStyles = () => {
205
+ const getAccessibilityStylesOld = () => {
131
206
  if (isMobile()) {
132
207
  return {};
133
208
  }
134
209
  if (state !== AnnotationMarkStates.RESOLVED) {
135
210
  const startMarker = intl.formatMessage(inlineCommentMessages.contentRendererInlineCommentMarkerStart);
136
211
  const endMarker = intl.formatMessage(inlineCommentMessages.contentRendererInlineCommentMarkerEnd);
137
- return accessibilityStyles(startMarker, endMarker);
212
+ return accessibilityStylesOld(startMarker, endMarker);
138
213
  } else {
139
214
  return {};
140
215
  }
141
216
  };
217
+ if (fg('platform_editor_emotion_refactor_renderer')) {
218
+ return jsx(useBlockLevel ? 'div' : 'mark', {
219
+ id,
220
+ [fg('editor_inline_comments_on_inline_nodes') ? 'onClickCapture' : 'onClick']: onMarkClick,
221
+ ...accessibility,
222
+ ...overriddenData,
223
+ ...(!useBlockLevel && {
224
+ css: [markStylesNew, fg('editor_inline_comments_on_inline_nodes') && markStylesNewWithInlineComments, fg('confluence-frontend-comments-panel') && markStylesNewWithCommentsPanel, !isMobile() && accessibilityStylesNew],
225
+ style: {
226
+ '--ak-renderer-annotation-startmarker': intl.formatMessage(inlineCommentMessages.contentRendererInlineCommentMarkerStart),
227
+ '--ak-renderer-annotation-endmarker': intl.formatMessage(inlineCommentMessages.contentRendererInlineCommentMarkerEnd)
228
+ }
229
+ })
230
+ }, children);
231
+ }
142
232
  return jsx(useBlockLevel ? 'div' : 'mark', {
143
233
  id,
144
234
  [fg('editor_inline_comments_on_inline_nodes') ? 'onClickCapture' : 'onClick']: onMarkClick,
145
235
  ...accessibility,
146
236
  ...overriddenData,
147
237
  ...(!useBlockLevel && {
148
- css: [markStyles, getAccessibilityStyles()]
238
+ css: [markStylesOld, getAccessibilityStylesOld()]
149
239
  })
150
240
  }, children);
151
241
  };
@@ -9,7 +9,8 @@ import React from 'react';
9
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
10
  import { css, jsx } from '@emotion/react';
11
11
  import { alignmentPositionMap } from '@atlaskit/adf-schema';
12
- var MarkWrapper = function MarkWrapper(props) {
12
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
13
+ var MarkWrapperOld = function MarkWrapperOld(props) {
13
14
  var styles = props['data-align'] ? // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
14
15
  css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t\t\t\ttext-align: ", ";\n\t\t\t"])), alignmentPositionMap[props['data-align']]) : '';
15
16
  return jsx("div", _extends({
@@ -19,6 +20,17 @@ var MarkWrapper = function MarkWrapper(props) {
19
20
  // eslint-disable-next-line react/jsx-props-no-spreading
20
21
  }, props), props.children);
21
22
  };
23
+ var MarkWrapperNew = function MarkWrapperNew(props) {
24
+ var dataAlign = props['data-align'] ? alignmentPositionMap[props['data-align']] : undefined;
25
+ return jsx("div", _extends({
26
+ style: {
27
+ textAlign: dataAlign
28
+ }
29
+ // Ignored via go/ees005
30
+ // eslint-disable-next-line react/jsx-props-no-spreading
31
+ }, props), props.children);
32
+ };
33
+ var MarkWrapper = componentWithFG('platform_editor_emotion_refactor_renderer', MarkWrapperNew, MarkWrapperOld);
22
34
  export default function Alignment(props) {
23
35
  return jsx(MarkWrapper
24
36
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -1,3 +1,4 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
3
  var _templateObject;
3
4
  /**
@@ -10,11 +11,35 @@ import { overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-share
10
11
  import { N20 } from '@atlaskit/theme/colors';
11
12
  import { CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
12
13
  import CodeBlockButtonContainer from './codeBlockButtonContainer';
14
+ import { fg } from '@atlaskit/platform-feature-flags';
13
15
 
14
16
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
15
- var codeBlockStyleOverrides = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\ttab-size: 4;\n\tbackground-color: ", ";\n\n\t&:hover {\n\t\tbutton {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\n\tbutton {\n\t\topacity: 0;\n\t\ttransition: opacity 0.2s ease 0s;\n\t}\n\n\t", " {\n\t\tfont-size: ", ";\n\t\tline-height: 1.5rem;\n\t\tbackground-image: ", ";\n\t\tbackground-attachment: local, local, local, local, scroll, scroll, scroll, scroll;\n\t\tbackground-position:\n\t\t\t0 0,\n\t\t\t0 0,\n\t\t\t100% 0,\n\t\t\t100% 0,\n\t\t\t100% 0,\n\t\t\t100% 0,\n\t\t\t0 0,\n\t\t\t0 0;\n\t}\n"])), "var(--ds-surface-raised, ".concat(N20, ")"), CodeBlockSharedCssClassName.DS_CODEBLOCK, relativeFontSizeToBase16(14), overflowShadow({
17
+ var codeBlockStyleOverridesOld = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\ttab-size: 4;\n\tbackground-color: ", ";\n\n\t&:hover {\n\t\tbutton {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\n\tbutton {\n\t\topacity: 0;\n\t\ttransition: opacity 0.2s ease 0s;\n\t}\n\n\t", " {\n\t\tfont-size: ", ";\n\t\tline-height: 1.5rem;\n\t\tbackground-image: ", ";\n\t\tbackground-attachment: local, local, local, local, scroll, scroll, scroll, scroll;\n\t\tbackground-position:\n\t\t\t0 0,\n\t\t\t0 0,\n\t\t\t100% 0,\n\t\t\t100% 0,\n\t\t\t100% 0,\n\t\t\t100% 0,\n\t\t\t0 0,\n\t\t\t0 0;\n\t}\n"])), "var(--ds-surface-raised, ".concat(N20, ")"), CodeBlockSharedCssClassName.DS_CODEBLOCK, relativeFontSizeToBase16(14), overflowShadow({
16
18
  leftCoverWidth: "var(--ds-space-300, 24px)"
17
19
  }));
20
+ var codeBlockStyleOverridesNew = css(_defineProperty({
21
+ tabSize: 4,
22
+ backgroundColor: "var(--ds-surface-raised, ".concat(N20, ")"),
23
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
24
+ button: {
25
+ opacity: 0,
26
+ transition: 'opacity 0.2s ease 0s'
27
+ },
28
+ '&:hover': {
29
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
30
+ button: {
31
+ opacity: 1
32
+ }
33
+ }
34
+ }, "".concat(CodeBlockSharedCssClassName.DS_CODEBLOCK), {
35
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
36
+ fontSize: "".concat(14 / 16, "rem"),
37
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
38
+ lineHeight: '1.5rem',
39
+ backgroundImage: "linear-gradient(\n\t\t\tto right,\n\t\t\t".concat("var(--ds-background-neutral, #091E420F)", " ", "var(--ds-space-300, 24px)", ",\n\t\t\ttransparent ", "var(--ds-space-300, 24px)", "\n\t\t\t),linear-gradient(\n\t\t\tto right,\n\t\t\t", "var(--ds-surface-raised, #FFFFFF)", " ", "var(--ds-space-300, 24px)", ",\n\t\t\ttransparent ", "var(--ds-space-300, 24px)", "\n\t\t\t),linear-gradient(\n\t\t\tto left,\n\t\t\t", "var(--ds-background-neutral, #091E420F)", " ", "var(--ds-space-100, 8px)", ",\n\t\t\ttransparent ", "var(--ds-space-100, 8px)", "\n\t\t\t),linear-gradient(\n\t\t\tto left,\n\t\t\t", "var(--ds-surface-raised, #FFFFFF)", " ", "var(--ds-space-100, 8px)", ",\n\t\t\ttransparent ", "var(--ds-space-100, 8px)", "\n\t\t\t),linear-gradient(\n\t\t\tto left,\n\t\t\t", "var(--ds-shadow-overflow-spread, #091e4229)", " 0,\n\t\t\t", "var(--ds-UNSAFE-transparent, transparent)", " ", "var(--ds-space-100, 8px)", "\n\t\t\t),linear-gradient(\n\t\t\tto left,\n\t\t\t", "var(--ds-shadow-overflow-perimeter, #091e421f)", " 0,\n\t\t\t", "var(--ds-UNSAFE-transparent, transparent)", " ", "var(--ds-space-100, 8px)", "\n\t\t\t),linear-gradient(\n\t\t\tto right,\n\t\t\t", "var(--ds-shadow-overflow-spread, #091e4229)", " 0,\n\t\t\t", "var(--ds-UNSAFE-transparent, transparent)", " ", "var(--ds-space-100, 8px)", "\n\t\t\t),linear-gradient(\n\t\t\tto right,\n\t\t\t", "var(--ds-shadow-overflow-perimeter, #091e421f)", " 0,\n\t\t\t", "var(--ds-UNSAFE-transparent, transparent)", " ", "var(--ds-space-100, 8px)", "\n\t\t\t)"),
40
+ backgroundAttachment: 'local, local, local, local, scroll, scroll, scroll, scroll',
41
+ backgroundPosition: '0 0, 0 0, 100% 0, 100% 0, 100% 0, 100% 0, 0 0, 0 0'
42
+ }));
18
43
  var CodeBlockContainer = function CodeBlockContainer(_ref) {
19
44
  var allowCopyToClipboard = _ref.allowCopyToClipboard,
20
45
  allowWrapCodeBlock = _ref.allowWrapCodeBlock,
@@ -23,18 +48,16 @@ var CodeBlockContainer = function CodeBlockContainer(_ref) {
23
48
  setWrapLongLines = _ref.setWrapLongLines,
24
49
  text = _ref.text,
25
50
  wrapLongLines = _ref.wrapLongLines;
26
- return (
51
+ return jsx("div", {
27
52
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
28
- jsx("div", {
29
- className: className,
30
- css: codeBlockStyleOverrides
31
- }, jsx(CodeBlockButtonContainer, {
32
- allowCopyToClipboard: allowCopyToClipboard,
33
- allowWrapCodeBlock: allowWrapCodeBlock,
34
- setWrapLongLines: setWrapLongLines,
35
- text: text,
36
- wrapLongLines: wrapLongLines
37
- }), children)
38
- );
53
+ className: className,
54
+ css: fg('platform_editor_emotion_refactor_renderer') ? codeBlockStyleOverridesNew : codeBlockStyleOverridesOld
55
+ }, jsx(CodeBlockButtonContainer, {
56
+ allowCopyToClipboard: allowCopyToClipboard,
57
+ allowWrapCodeBlock: allowWrapCodeBlock,
58
+ setWrapLongLines: setWrapLongLines,
59
+ text: text,
60
+ wrapLongLines: wrapLongLines
61
+ }), children);
39
62
  };
40
63
  export default CodeBlockContainer;
@@ -1,5 +1,9 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  var _templateObject, _templateObject2;
4
+ /* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */
5
+ /* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */
6
+ /* eslint-disable @atlaskit/ui-styling-standard/no-nested-selectors */
3
7
  /**
4
8
  * @jsxRuntime classic
5
9
  * @jsx jsx
@@ -7,15 +11,124 @@ var _templateObject, _templateObject2;
7
11
  import React, { forwardRef, useMemo } from 'react';
8
12
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
13
  import { css, jsx } from '@emotion/react';
10
- import { blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
14
+ import { akEditorTableCellMinWidth, blockNodesVerticalMargin, overflowShadow } from '@atlaskit/editor-shared-styles';
11
15
  import { codeBlockSharedStyles, CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
12
16
  import { useBidiWarnings } from '../../../hooks/use-bidi-warnings';
13
17
  import { RendererCssClassName } from '../../../../consts';
18
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
19
+ var codeBlockSharedStylesNew = css(_defineProperty(_defineProperty(_defineProperty({}, ".".concat(CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPED, "\n\t\t> .").concat(CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER, "\n\t\t> .").concat(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
+ }), ".".concat(CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER, "\n\t\t> .").concat(CodeBlockSharedCssClassName.CODEBLOCK_CONTENT), {
27
+ display: 'flex',
28
+ flex: 1,
29
+ code: {
30
+ flexGrow: 1,
31
+ whiteSpace: 'pre'
32
+ }
33
+ }), ".".concat(CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
34
+ position: 'relative',
35
+ backgroundColor: "var(--ds-surface-raised, #FFFFFF)",
36
+ borderRadius: "var(--ds-border-radius, 3px)",
37
+ margin: "".concat(blockNodesVerticalMargin, " 0 0 0"),
38
+ fontFamily: "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
39
+ minWidth: "".concat(akEditorTableCellMinWidth, "px"),
40
+ cursor: 'pointer',
41
+ clear: 'both',
42
+ '--ds--code--bg-color': 'transparent',
43
+ '.code-block-gutter-pseudo-element::before': {
44
+ content: '"attr(data-label)"'
45
+ },
46
+ /* This is necessary to allow for arrow key navigation in/out of code blocks in Firefox. */
47
+ whiteSpace: 'normal'
48
+ }, ".".concat(CodeBlockSharedCssClassName.CODEBLOCK_START), {
49
+ position: 'absolute',
50
+ visibility: 'hidden',
51
+ height: '1.5rem',
52
+ top: '0px',
53
+ left: '0px'
54
+ }), "".concat(CodeBlockSharedCssClassName.CODEBLOCK_END), {
55
+ position: 'absolute',
56
+ visibility: 'hidden',
57
+ height: '1.5rem',
58
+ bottom: '0px',
59
+ right: '0px'
60
+ }), ".".concat(CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER), {
61
+ position: 'relative',
62
+ backgroundColor: "var(--ds-background-neutral, #091E420F)",
63
+ display: 'flex',
64
+ borderRadius: "var(--ds-border-radius, 3px)",
65
+ width: '100%',
66
+ counterReset: 'line',
67
+ overflowX: 'auto',
68
+ backgroundImage: 'var(--ak-renderer-codeblock-content-wrapper-bg-img)',
69
+ backgroundRepeat: 'no-repeat',
70
+ backgroundAttachment: 'local, local, local, local, scroll, scroll, scroll, scroll',
71
+ backgroundSize: "var(--ds-space-300, 24px)".concat(" 100%,\n\t\t\t\t", "var(--ds-space-300, 24px)", " 100%,\n\t\t\t\t", "var(--ds-space-100, 8px)", " 100%,\n\t\t\t\t", "var(--ds-space-100, 8px)", " 100%,\n\t\t\t\t", "var(--ds-space-100, 8px)", " 100%,\n\t\t\t\t1px 100%,\n\t\t\t\t", "var(--ds-space-100, 8px)", " 100%,\n\t\t\t\t1px 100%"),
72
+ backgroundPosition: "0 0,\n\t\t\t\t0 0,\n\t\t\t\t100% 0,\n\t\t\t\t100% 0,\n\t\t\t\t100% 0,\n\t\t\t\t100% 0,\n\t\t\t\t0 0,\n\t\t\t\t0 0",
73
+ /* Be careful if refactoring this; it is needed to keep arrow key navigation in Firefox consistent with other browsers. */
74
+ overflowY: 'hidden'
75
+ }), ".".concat(CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER), {
76
+ backgroundColor: "var(--ds-background-neutral, #091E420F)",
77
+ position: 'relative',
78
+ width: 'var(--lineNumberGutterWidth, 2rem)',
79
+ padding: "var(--ds-space-100, 8px)",
80
+ flexShrink: 0,
81
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
82
+ fontSize: "".concat(14 / 16, "rem"),
83
+ boxSizing: 'content-box'
84
+ }), ".".concat(CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER, "::before"), {
85
+ content: '"1"',
86
+ visibility: 'hidden',
87
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
88
+ fontSize: "".concat(14 / 16, "rem"),
89
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
90
+ lineHeight: '1.5rem'
91
+ }), ".".concat(CodeBlockSharedCssClassName.CODEBLOCK_CONTENT), {
92
+ code: {
93
+ tabSize: 4,
94
+ cursor: 'text',
95
+ color: "var(--ds-text, #172B4D)",
96
+ borderRadius: "var(--ds-border-radius, 3px)",
97
+ margin: "var(--ds-space-100, 8px)",
98
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
99
+ fontSize: "".concat(14 / 16, "rem"),
100
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
101
+ lineHeight: '1.5rem'
102
+ }
103
+ }), ".".concat(CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER_LINE_NUMBER_WIDGET), {
104
+ pointerEvents: 'none',
105
+ userSelect: 'none',
106
+ width: 'var(--lineNumberGutterWidth, 2rem)',
107
+ left: 0,
108
+ position: 'absolute',
109
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
110
+ fontSize: "".concat(14 / 16, "rem"),
111
+ padding: "0px ".concat("var(--ds-space-100, 8px)"),
112
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
113
+ lineHeight: '1.5rem',
114
+ textAlign: 'right',
115
+ color: "var(--ds-text-subtlest, #505F79)",
116
+ boxSizing: 'content-box'
117
+ })));
118
+
14
119
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
15
- var lightWeightCodeBlockStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.", " {\n\t\tcursor: text;\n\t}\n"])), CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER);
120
+ var lightWeightCodeBlockStylesOld = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.", " {\n\t\tcursor: text;\n\t}\n"])), CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER);
121
+ var lightWeightCodeBlockStylesNew = css(_defineProperty({}, ".".concat(CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER), {
122
+ cursor: 'text'
123
+ }));
16
124
  export var LightWeightCodeBlockCssClassName = {
17
125
  CONTAINER: 'light-weight-code-block'
18
126
  };
127
+
128
+ /**
129
+ * @private
130
+ * @deprecated styles are moved to RendererStyleContainer
131
+ */
19
132
  export var getLightWeightCodeBlockStylesForRootRendererStyleSheet = function getLightWeightCodeBlockStylesForRootRendererStyleSheet() {
20
133
  // We overwrite the rule that clears margin-top for first nested codeblocks, as
21
134
  // our lightweight codeblock dom structure will always nest the codeblock inside
@@ -26,7 +139,7 @@ export var getLightWeightCodeBlockStylesForRootRendererStyleSheet = function get
26
139
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
27
140
  return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n\t\t.", "\n\t\t\t> .", "\n\t\t\t.", " {\n\t\t\tmargin-top: ", ";\n\t\t}\n\t"])), RendererCssClassName.DOCUMENT, LightWeightCodeBlockCssClassName.CONTAINER, CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER, blockNodesVerticalMargin);
28
141
  };
29
- var LightWeightCodeBlock = /*#__PURE__*/forwardRef(function (_ref, ref) {
142
+ var LightWeightCodeBlockOld = /*#__PURE__*/forwardRef(function (_ref, ref) {
30
143
  var text = _ref.text,
31
144
  _ref$codeBidiWarningT = _ref.codeBidiWarningTooltipEnabled,
32
145
  codeBidiWarningTooltipEnabled = _ref$codeBidiWarningT === void 0 ? true : _ref$codeBidiWarningT,
@@ -45,7 +158,53 @@ var LightWeightCodeBlock = /*#__PURE__*/forwardRef(function (_ref, ref) {
45
158
  ref: ref
46
159
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
47
160
  ,
48
- css: [codeBlockSharedStyles(), lightWeightCodeBlockStyles]
161
+ css: [codeBlockSharedStyles(), lightWeightCodeBlockStylesOld]
162
+ }, jsx("div", {
163
+ className: CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER
164
+ }, jsx("div", {
165
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
166
+ className: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER
167
+ }, jsx("div", {
168
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
169
+ className: CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER
170
+ }, textRows.map(function (_, index) {
171
+ return (
172
+ // Ignored via go/ees005
173
+ // eslint-disable-next-line react/no-array-index-key
174
+ jsx("span", {
175
+ key: index
176
+ })
177
+ );
178
+ })), jsx("div", {
179
+ className: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT
180
+ }, jsx("code", null, renderBidiWarnings(text))))));
181
+ });
182
+ var LightWeightCodeBlockNew = /*#__PURE__*/forwardRef(function (_ref2, ref) {
183
+ var text = _ref2.text,
184
+ _ref2$codeBidiWarning = _ref2.codeBidiWarningTooltipEnabled,
185
+ codeBidiWarningTooltipEnabled = _ref2$codeBidiWarning === void 0 ? true : _ref2$codeBidiWarning,
186
+ className = _ref2.className;
187
+ var textRows = useMemo(function () {
188
+ return (text !== null && text !== void 0 ? text : '').split('\n');
189
+ }, [text]);
190
+ var _useBidiWarnings2 = useBidiWarnings({
191
+ enableWarningTooltip: codeBidiWarningTooltipEnabled
192
+ }),
193
+ renderBidiWarnings = _useBidiWarnings2.renderBidiWarnings;
194
+ var classNames = [LightWeightCodeBlockCssClassName.CONTAINER, className].join(' ');
195
+ var codeBlockBackgroundImage = overflowShadow({
196
+ leftCoverWidth: "var(--ds-space-300, 24px)"
197
+ });
198
+ return jsx("div", {
199
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
200
+ className: classNames,
201
+ ref: ref
202
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
203
+ ,
204
+ css: [codeBlockSharedStylesNew, lightWeightCodeBlockStylesNew],
205
+ style: {
206
+ '--ak-renderer-codeblock-content-wrapper-bg-img': codeBlockBackgroundImage
207
+ }
49
208
  }, jsx("div", {
50
209
  className: CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER
51
210
  }, jsx("div", {
@@ -66,4 +225,5 @@ var LightWeightCodeBlock = /*#__PURE__*/forwardRef(function (_ref, ref) {
66
225
  className: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT
67
226
  }, jsx("code", null, renderBidiWarnings(text))))));
68
227
  });
228
+ var LightWeightCodeBlock = componentWithFG('platform_editor_emotion_refactor_renderer', LightWeightCodeBlockNew, LightWeightCodeBlockOld);
69
229
  export default LightWeightCodeBlock;
@@ -1,3 +1,4 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  /**
2
3
  * @jsxRuntime classic
3
4
  * @jsx jsx
@@ -6,6 +7,22 @@ import React from 'react';
6
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
8
  import { jsx, css } from '@emotion/react';
8
9
  import { WidthProvider, clearNextSiblingMarginTopStyle, clearNextSiblingBlockMarkMarginTopStyle } from '@atlaskit/editor-common/ui';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
11
+
12
+ // localized styles, was from clearNextSiblingMarginTopStyle in @atlaskit/editor-common/ui
13
+ var clearNextSiblingMarginTopStyleNew = css({
14
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
15
+ '& + *': {
16
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
17
+ marginTop: '0 !important'
18
+ }
19
+ });
20
+
21
+ // localized styles, was from clearNextSiblingBlockMarkMarginTopStyle in @atlaskit/editor-common/ui
22
+ var clearNextSiblingBlockMarkMarginTopStyleNew = css(_defineProperty({}, "+ .fabric-editor-block-mark > p,\n\t + .fabric-editor-block-mark > h1,\n\t + .fabric-editor-block-mark > h2,\n\t + .fabric-editor-block-mark > h3,\n\t + .fabric-editor-block-mark > h4,\n\t + .fabric-editor-block-mark > h5,\n\t + .fabric-editor-block-mark > h6\n\t", {
23
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
24
+ marginTop: '0 !important'
25
+ }));
9
26
 
10
27
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
11
28
  var layoutColumnClearMarginTopStyles = css(
@@ -21,6 +38,6 @@ export default function LayoutSection(props) {
21
38
  flexBasis: "".concat(props.width, "%")
22
39
  }
23
40
  }, jsx(WidthProvider, null, jsx("div", {
24
- css: layoutColumnClearMarginTopStyles
41
+ css: fg('platform_editor_emotion_refactor_renderer') ? [clearNextSiblingMarginTopStyleNew, clearNextSiblingBlockMarkMarginTopStyleNew] : layoutColumnClearMarginTopStyles
25
42
  }), props.children));
26
43
  }