@atlaskit/renderer 91.0.0 → 93.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/cjs/analytics/enums.js +2 -0
  3. package/dist/cjs/react/marks/alignment.js +11 -12
  4. package/dist/cjs/react/marks/breakout.js +7 -9
  5. package/dist/cjs/react/marks/link.js +13 -6
  6. package/dist/cjs/react/nodes/codeBlock.js +17 -16
  7. package/dist/cjs/react/nodes/codeBlockCopyButton.js +13 -11
  8. package/dist/cjs/react/nodes/embedCard.js +25 -33
  9. package/dist/cjs/react/nodes/heading-anchor.js +7 -6
  10. package/dist/cjs/react/nodes/heading.js +4 -2
  11. package/dist/cjs/react/nodes/layoutColumn.js +7 -2
  12. package/dist/cjs/react/nodes/media.js +7 -6
  13. package/dist/cjs/react/nodes/mediaSingle/index.js +15 -4
  14. package/dist/cjs/react/nodes/mediaSingle/styles.js +7 -10
  15. package/dist/cjs/react/nodes/panel.js +26 -16
  16. package/dist/cjs/react/nodes/table/sticky.js +63 -55
  17. package/dist/cjs/react/nodes/table.js +2 -10
  18. package/dist/cjs/react/utils/inject-props.js +33 -0
  19. package/dist/cjs/react/utils/performance/RenderTracking.js +52 -0
  20. package/dist/cjs/ui/Expand.js +52 -28
  21. package/dist/cjs/ui/MediaCard.js +4 -14
  22. package/dist/cjs/ui/Renderer/index.js +72 -64
  23. package/dist/cjs/ui/Renderer/style.js +62 -55
  24. package/dist/cjs/ui/Renderer/truncated-wrapper.js +19 -21
  25. package/dist/cjs/ui/SortingIcon.js +8 -9
  26. package/dist/cjs/ui/annotations/draft/component.js +22 -12
  27. package/dist/cjs/ui/annotations/element/mark.js +9 -5
  28. package/dist/cjs/ui/renderer-props.js +1 -3
  29. package/dist/cjs/version.json +1 -1
  30. package/dist/es2019/analytics/enums.js +2 -0
  31. package/dist/es2019/react/marks/alignment.js +15 -7
  32. package/dist/es2019/react/marks/breakout.js +6 -5
  33. package/dist/es2019/react/marks/link.js +8 -5
  34. package/dist/es2019/react/nodes/codeBlock.js +25 -23
  35. package/dist/es2019/react/nodes/codeBlockCopyButton.js +12 -9
  36. package/dist/es2019/react/nodes/embedCard.js +16 -16
  37. package/dist/es2019/react/nodes/heading-anchor.js +9 -6
  38. package/dist/es2019/react/nodes/heading.js +4 -2
  39. package/dist/es2019/react/nodes/layoutColumn.js +7 -3
  40. package/dist/es2019/react/nodes/media.js +9 -5
  41. package/dist/es2019/react/nodes/mediaSingle/index.js +10 -6
  42. package/dist/es2019/react/nodes/mediaSingle/styles.js +6 -7
  43. package/dist/es2019/react/nodes/panel.js +23 -16
  44. package/dist/es2019/react/nodes/table/sticky.js +55 -37
  45. package/dist/es2019/react/nodes/table.js +2 -5
  46. package/dist/es2019/react/utils/inject-props.js +24 -0
  47. package/dist/es2019/react/utils/performance/RenderTracking.js +37 -0
  48. package/dist/es2019/ui/Expand.js +65 -36
  49. package/dist/es2019/ui/MediaCard.js +3 -6
  50. package/dist/es2019/ui/Renderer/index.js +72 -57
  51. package/dist/es2019/ui/Renderer/style.js +370 -327
  52. package/dist/es2019/ui/Renderer/truncated-wrapper.js +26 -15
  53. package/dist/es2019/ui/SortingIcon.js +9 -7
  54. package/dist/es2019/ui/annotations/draft/component.js +18 -12
  55. package/dist/es2019/ui/annotations/element/mark.js +12 -6
  56. package/dist/es2019/ui/renderer-props.js +1 -1
  57. package/dist/es2019/version.json +1 -1
  58. package/dist/esm/analytics/enums.js +2 -0
  59. package/dist/esm/react/marks/alignment.js +13 -6
  60. package/dist/esm/react/marks/breakout.js +6 -5
  61. package/dist/esm/react/marks/link.js +7 -5
  62. package/dist/esm/react/nodes/codeBlock.js +18 -14
  63. package/dist/esm/react/nodes/codeBlockCopyButton.js +10 -7
  64. package/dist/esm/react/nodes/embedCard.js +19 -19
  65. package/dist/esm/react/nodes/heading-anchor.js +8 -6
  66. package/dist/esm/react/nodes/heading.js +4 -2
  67. package/dist/esm/react/nodes/layoutColumn.js +7 -3
  68. package/dist/esm/react/nodes/media.js +8 -5
  69. package/dist/esm/react/nodes/mediaSingle/index.js +11 -6
  70. package/dist/esm/react/nodes/mediaSingle/styles.js +5 -7
  71. package/dist/esm/react/nodes/panel.js +27 -15
  72. package/dist/esm/react/nodes/table/sticky.js +64 -53
  73. package/dist/esm/react/nodes/table.js +2 -8
  74. package/dist/esm/react/utils/inject-props.js +24 -0
  75. package/dist/esm/react/utils/performance/RenderTracking.js +39 -0
  76. package/dist/esm/ui/Expand.js +57 -29
  77. package/dist/esm/ui/MediaCard.js +3 -9
  78. package/dist/esm/ui/Renderer/index.js +74 -61
  79. package/dist/esm/ui/Renderer/style.js +58 -51
  80. package/dist/esm/ui/Renderer/truncated-wrapper.js +20 -14
  81. package/dist/esm/ui/SortingIcon.js +9 -7
  82. package/dist/esm/ui/annotations/draft/component.js +18 -11
  83. package/dist/esm/ui/annotations/element/mark.js +11 -4
  84. package/dist/esm/ui/renderer-props.js +1 -1
  85. package/dist/esm/version.json +1 -1
  86. package/dist/types/analytics/enums.d.ts +2 -0
  87. package/dist/types/analytics/events.d.ts +12 -2
  88. package/dist/types/react/marks/alignment.d.ts +2 -2
  89. package/dist/types/react/marks/breakout.d.ts +4 -3
  90. package/dist/types/react/marks/link.d.ts +2 -2
  91. package/dist/types/react/nodes/codeBlock.d.ts +4 -14
  92. package/dist/types/react/nodes/embedCard.d.ts +3 -2
  93. package/dist/types/react/nodes/heading-anchor.d.ts +1 -0
  94. package/dist/types/react/nodes/heading.d.ts +1 -0
  95. package/dist/types/react/nodes/index.d.ts +1 -13
  96. package/dist/types/react/nodes/layoutColumn.d.ts +3 -1
  97. package/dist/types/react/nodes/media.d.ts +3 -1
  98. package/dist/types/react/nodes/mediaSingle/index.d.ts +1 -0
  99. package/dist/types/react/nodes/mediaSingle/styles.d.ts +2 -3
  100. package/dist/types/react/nodes/panel.d.ts +3 -1
  101. package/dist/types/react/nodes/table/sticky.d.ts +4 -2
  102. package/dist/types/react/utils/inject-props.d.ts +6 -0
  103. package/dist/types/react/utils/performance/RenderTracking.d.ts +15 -0
  104. package/dist/types/ui/Expand.d.ts +3 -2
  105. package/dist/types/ui/MediaCard.d.ts +1 -3
  106. package/dist/types/ui/Renderer/index.d.ts +3 -26
  107. package/dist/types/ui/Renderer/style.d.ts +2 -3
  108. package/dist/types/ui/Renderer/truncated-wrapper.d.ts +3 -1
  109. package/dist/types/ui/SortingIcon.d.ts +3 -3
  110. package/dist/types/ui/annotations/draft/component.d.ts +1 -0
  111. package/dist/types/ui/annotations/element/mark.d.ts +1 -0
  112. package/dist/types/ui/renderer-props.d.ts +14 -2
  113. package/package.json +22 -23
@@ -1,4 +1,4 @@
1
- import styled, { css } from 'styled-components';
1
+ import { css } from '@emotion/react';
2
2
  import { themed } from '@atlaskit/theme/components';
3
3
  import { gridSize, fontFamily, fontSize, borderRadius } from '@atlaskit/theme/constants';
4
4
  import * as colors from '@atlaskit/theme/colors';
@@ -84,9 +84,14 @@ const alignedHeadingAnchorStyle = ({
84
84
  return '';
85
85
  }
86
86
 
87
- return `
87
+ return css`
88
88
  .fabric-editor-block-mark[data-align] > {
89
- h1, h2, h3, h4, h5, h6 {
89
+ h1,
90
+ h2,
91
+ h3,
92
+ h4,
93
+ h5,
94
+ h6 {
90
95
  position: relative;
91
96
  }
92
97
  }
@@ -97,41 +102,45 @@ const alignedHeadingAnchorStyle = ({
97
102
  * container edge.
98
103
  */
99
104
  .fabric-editor-block-mark:not([data-align='center'])[data-align] {
100
- > {
101
- h1, h2, h3, h4, h5, h6 {
102
- // Using right to left text to achieve the inverse effect
103
- // of where the copy link button icon sits for left/center
104
- // alignment.
105
- // Although this is unorthodox it's the only approach which
106
- // allows the button to sit flush against the left edge of
107
- // bottom line of text.
108
- direction: rtl;
109
-
110
- // By default RTL will negatively impact the layout of special
111
- // characters within the heading text, and potentially other
112
- // nested inline nodes. To prevent this we insert pseudo elements
113
- // containing HTML entities to retain LTR for all heading content
114
- // except for the copy link button.
115
- > *:not(.${HeadingAnchorWrapperClassName}):not(br) {
116
- ::before {
117
- // Open LTR: https://www.fileformat.info/info/unicode/char/202a/index.htm
118
- content: '\u202A';
119
- }
120
- ::after {
121
- // Close LTR: https://www.fileformat.info/info/unicode/char/202c/index.htm
122
- content: '\u202C';
123
- }
105
+ > {
106
+ h1,
107
+ h2,
108
+ h3,
109
+ h4,
110
+ h5,
111
+ h6 {
112
+ // Using right to left text to achieve the inverse effect
113
+ // of where the copy link button icon sits for left/center
114
+ // alignment.
115
+ // Although this is unorthodox it's the only approach which
116
+ // allows the button to sit flush against the left edge of
117
+ // bottom line of text.
118
+ direction: rtl;
119
+
120
+ // By default RTL will negatively impact the layout of special
121
+ // characters within the heading text, and potentially other
122
+ // nested inline nodes. To prevent this we insert pseudo elements
123
+ // containing HTML entities to retain LTR for all heading content
124
+ // except for the copy link button.
125
+ > *:not(.${HeadingAnchorWrapperClassName}):not(br) {
126
+ ::before {
127
+ // Open LTR: https://www.fileformat.info/info/unicode/char/202a/index.htm
128
+ content: '\u202A';
129
+ }
130
+ ::after {
131
+ // Close LTR: https://www.fileformat.info/info/unicode/char/202c/index.htm
132
+ content: '\u202C';
124
133
  }
125
134
  }
126
135
  }
127
- .${HeadingAnchorWrapperClassName} {
128
- margin: 0 6px 0 0;
129
- }
136
+ }
137
+ .${HeadingAnchorWrapperClassName} {
138
+ margin: 0 6px 0 0;
139
+ }
130
140
 
131
- @media (hover: hover) and (pointer: fine) {
132
- .${HeadingAnchorWrapperClassName} > button {
133
- transform: translate(8px, 0px);
134
- }
141
+ @media (hover: hover) and (pointer: fine) {
142
+ .${HeadingAnchorWrapperClassName} > button {
143
+ transform: translate(8px, 0px);
135
144
  }
136
145
  }
137
146
  }
@@ -174,7 +183,7 @@ const tableSortableColumnStyle = ({
174
183
  `;
175
184
  }
176
185
 
177
- return `
186
+ return css`
178
187
  .${RendererCssClassName.SORTABLE_COLUMN} {
179
188
  padding: 0;
180
189
 
@@ -211,7 +220,8 @@ const tableSortableColumnStyle = ({
211
220
  ${headingsCss}
212
221
  }
213
222
 
214
- &.${RendererCssClassName.SORTABLE_COLUMN_NOT_ALLOWED} .${RendererCssClassName.SORTABLE_COLUMN_BUTTON} {
223
+ &.${RendererCssClassName.SORTABLE_COLUMN_NOT_ALLOWED}
224
+ .${RendererCssClassName.SORTABLE_COLUMN_BUTTON} {
215
225
  cursor: default;
216
226
  }
217
227
 
@@ -235,14 +245,15 @@ const tableSortableColumnStyle = ({
235
245
  };
236
246
 
237
247
  const fullPageStyles = ({
238
- theme,
239
248
  appearance
249
+ }, {
250
+ theme
240
251
  }) => {
241
252
  if (appearance !== 'full-page' && appearance !== 'mobile') {
242
253
  return '';
243
254
  }
244
255
 
245
- return `
256
+ return css`
246
257
  max-width: ${theme && theme.layoutMaxWidth ? `${theme.layoutMaxWidth}px` : 'none'};
247
258
  margin: 0 auto;
248
259
  padding: 0 ${appearance === 'full-page' ? FullPagePadding : 0}px;
@@ -256,363 +267,395 @@ const fullWidthStyles = ({
256
267
  return '';
257
268
  }
258
269
 
259
- return `
260
- max-width: ${akEditorFullWidthLayoutWidth}px;
261
- margin: 0 auto;
270
+ return css`
271
+ max-width: ${akEditorFullWidthLayoutWidth}px;
272
+ margin: 0 auto;
262
273
 
263
- .fabric-editor-breakout-mark,
264
- .pm-table-container,
265
- .ak-renderer-extension {
266
- width: 100% !important;
267
- }
274
+ .fabric-editor-breakout-mark,
275
+ .pm-table-container,
276
+ .ak-renderer-extension {
277
+ width: 100% !important;
278
+ }
268
279
  `;
269
- }; // prettier-ignore
270
-
271
-
272
- export const Wrapper = styled.div`
273
- font-size: ${editorFontSize}px;
274
- line-height: 1.5rem;
275
- color: ${themed({
276
- light: colors.N800,
277
- dark: '#B8C7E0'
278
- })};
279
-
280
- ${fullPageStyles}
281
- ${fullWidthStyles}
282
-
283
- & h1 {
284
- ${headingAnchorStyle('h1')}
285
- }
286
-
287
- & h2 {
288
- ${headingAnchorStyle('h2')}
289
- }
280
+ };
290
281
 
291
- & h3 {
292
- ${headingAnchorStyle('h3')}
293
- }
282
+ export const rendererStyles = wrapperProps => theme => {
283
+ // This is required to be compatible with styled-components prop structure.
284
+ const themeProps = {
285
+ theme
286
+ };
287
+ return css`
288
+ font-size: ${editorFontSize(themeProps)}px;
289
+ line-height: 1.5rem;
290
+ color: ${themed({
291
+ light: colors.N800,
292
+ dark: '#B8C7E0'
293
+ })(themeProps)};
294
+
295
+ .${RendererCssClassName.DOCUMENT}::after {
296
+ // we add a clearfix after ak-renderer-document in order to
297
+ // contain internal floats (such as media images that are "wrap-left")
298
+ // to just the renderer (and not spill outside of it)
299
+ content: '';
300
+ visibility: hidden;
301
+ display: block;
302
+ height: 0;
303
+ clear: both;
304
+ }
294
305
 
295
- & h4 {
296
- ${headingAnchorStyle('h4')}
297
- }
306
+ ${fullPageStyles(wrapperProps, themeProps)}
307
+ ${fullWidthStyles(wrapperProps)}
298
308
 
299
- & h5 {
300
- ${headingAnchorStyle('h5')}
301
- }
309
+ & h1 {
310
+ ${headingAnchorStyle('h1')}
311
+ }
302
312
 
303
- & h6 {
304
- ${headingAnchorStyle('h6')}
305
- }
313
+ & h2 {
314
+ ${headingAnchorStyle('h2')}
315
+ }
306
316
 
307
- & span.akActionMark {
308
- color: ${colors.B400};
309
- text-decoration: none;
317
+ & h3 {
318
+ ${headingAnchorStyle('h3')}
319
+ }
310
320
 
311
- &:hover {
312
- color: ${colors.B300};
313
- text-decoration: underline;
321
+ & h4 {
322
+ ${headingAnchorStyle('h4')}
314
323
  }
315
- }
316
324
 
317
- & span.akActionMark {
318
- cursor: pointer;
319
- }
325
+ & h5 {
326
+ ${headingAnchorStyle('h5')}
327
+ }
320
328
 
321
- & span[data-placeholder] {
322
- color: ${colors.placeholderText};
323
- }
329
+ & h6 {
330
+ ${headingAnchorStyle('h6')}
331
+ }
324
332
 
325
- ${whitespaceSharedStyles};
326
- ${blockquoteSharedStyles};
327
- ${headingsSharedStyles};
328
- ${panelSharedStyles};
329
- ${ruleSharedStyles};
330
- ${paragraphSharedStyles};
331
- ${listsSharedStyles};
332
- ${indentationSharedStyles};
333
- ${blockMarksSharedStyles};
334
- ${codeMarkSharedStyles};
335
- ${shadowSharedStyle};
336
- ${dateSharedStyle};
337
- ${textColorStyles};
338
- ${tasksAndDecisionsStyles};
339
- ${smartCardSharedStyles}
340
-
341
- & .UnknownBlock {
342
- font-family: ${fontFamily()};
343
- font-size: ${relativeFontSizeToBase16(fontSize())};
344
- font-weight: 400;
345
- white-space: pre-wrap;
346
- word-wrap: break-word;
347
- }
333
+ & span.akActionMark {
334
+ color: ${colors.B400};
335
+ text-decoration: none;
348
336
 
349
- & span.date-node {
350
- background: ${themed({
351
- light: colors.N30A,
352
- dark: colors.DN70
353
- })};
354
- border-radius: ${borderRadius()}px;
355
- color: ${themed({
356
- light: colors.N800,
357
- dark: colors.DN600
358
- })};
359
- padding: 2px 4px;
360
- margin: 0 1px;
361
- transition: background 0.3s;
362
- }
337
+ &:hover {
338
+ color: ${colors.B300};
339
+ text-decoration: underline;
340
+ }
341
+ }
363
342
 
364
- & span.date-node-highlighted {
365
- background: ${colors.R50};
366
- color: ${colors.R500};
367
- }
343
+ & span.akActionMark {
344
+ cursor: pointer;
345
+ }
368
346
 
369
- & .renderer-image {
370
- max-width: 100%;
371
- display: block;
372
- margin: ${gridSize() * 3}px 0;
373
- }
347
+ & span[data-placeholder] {
348
+ color: ${colors.placeholderText(themeProps)};
349
+ }
374
350
 
375
- .${richMediaClassName}.rich-media-wrapped + .${richMediaClassName}:not(.rich-media-wrapped) {
376
- clear: both;
377
- }
351
+ ${whitespaceSharedStyles};
352
+ ${blockquoteSharedStyles};
353
+ ${headingsSharedStyles(themeProps)};
354
+ ${panelSharedStyles(themeProps)};
355
+ ${ruleSharedStyles(themeProps)};
356
+ ${paragraphSharedStyles};
357
+ ${listsSharedStyles};
358
+ ${indentationSharedStyles};
359
+ ${blockMarksSharedStyles};
360
+ ${codeMarkSharedStyles(themeProps)};
361
+ ${shadowSharedStyle};
362
+ ${dateSharedStyle};
363
+ ${textColorStyles};
364
+ ${tasksAndDecisionsStyles};
365
+ ${smartCardSharedStyles}
366
+
367
+ & .UnknownBlock {
368
+ font-family: ${fontFamily()};
369
+ font-size: ${relativeFontSizeToBase16(fontSize())};
370
+ font-weight: 400;
371
+ white-space: pre-wrap;
372
+ word-wrap: break-word;
373
+ }
378
374
 
379
- & .code-block,
380
- & blockquote,
381
- & hr,
382
- & > div > div:not(.rich-media-wrapped),
383
- .${richMediaClassName}.rich-media-wrapped + .rich-media-wrapped + *:not(.rich-media-wrapped),
384
- .${richMediaClassName}.rich-media-wrapped + div:not(.rich-media-wrapped),
385
- .${richMediaClassName}.image-align-start,
386
- .${richMediaClassName}.image-center,
387
- .${richMediaClassName}.image-align-end {
388
- clear: both;
389
- }
375
+ & span.date-node {
376
+ background: ${themed({
377
+ light: colors.N30A,
378
+ dark: colors.DN70
379
+ })(themeProps)};
380
+ border-radius: ${borderRadius()}px;
381
+ color: ${themed({
382
+ light: colors.N800,
383
+ dark: colors.DN600
384
+ })(themeProps)};
385
+ padding: 2px 4px;
386
+ margin: 0 1px;
387
+ transition: background 0.3s;
388
+ }
390
389
 
391
- & .rich-media-wrapped {
392
- & + h1,
393
- & + h2,
394
- & + h3,
395
- & + h4,
396
- & + h5,
397
- & + h6 {
398
- margin-top: 8px;
390
+ & span.date-node-highlighted {
391
+ background: ${colors.R50};
392
+ color: ${colors.R500};
399
393
  }
400
- }
401
394
 
402
- ${alignedHeadingAnchorStyle}
395
+ & .renderer-image {
396
+ max-width: 100%;
397
+ display: block;
398
+ margin: ${gridSize() * 3}px 0;
399
+ }
403
400
 
404
- ${mediaSingleSharedStyle} &
405
- div[class^='image-wrap-'] + div[class^='image-wrap-'] {
406
- margin-left: 0;
407
- margin-right: 0;
408
- }
401
+ .${richMediaClassName}.rich-media-wrapped
402
+ + .${richMediaClassName}:not(.rich-media-wrapped) {
403
+ clear: both;
404
+ }
409
405
 
410
- /* Breakout for tables and extensions */
411
- .${RendererCssClassName.DOCUMENT} > {
412
- * .${TableSharedCssClassName.TABLE_CONTAINER} {
413
- width: 100% !important;
414
- left: 0 !important;
406
+ & .code-block,
407
+ & blockquote,
408
+ & hr,
409
+ & > div > div:not(.rich-media-wrapped),
410
+ .${richMediaClassName}.rich-media-wrapped
411
+ + .rich-media-wrapped
412
+ + *:not(.rich-media-wrapped),
413
+ .${richMediaClassName}.rich-media-wrapped + div:not(.rich-media-wrapped),
414
+ .${richMediaClassName}.image-align-start,
415
+ .${richMediaClassName}.image-center,
416
+ .${richMediaClassName}.image-align-end {
417
+ clear: both;
415
418
  }
416
419
 
417
- * .${RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER} {
418
- overflow-x: auto;
420
+ & .rich-media-wrapped {
421
+ & + h1,
422
+ & + h2,
423
+ & + h3,
424
+ & + h4,
425
+ & + h5,
426
+ & + h6 {
427
+ margin-top: 8px;
428
+ }
419
429
  }
420
430
 
421
- & .${RendererCssClassName.EXTENSION}:first-child {
422
- margin-top: 0;
431
+ ${alignedHeadingAnchorStyle(wrapperProps)}
432
+ /* plugin styles */
433
+ ${mediaSingleSharedStyle} &
434
+ div[class^='image-wrap-'] + div[class^='image-wrap-'] {
435
+ margin-left: 0;
436
+ margin-right: 0;
423
437
  }
424
- }
425
438
 
426
- .${RendererCssClassName.EXTENSION} {
427
- margin-top: ${blockNodesVerticalMargin};
428
- }
439
+ /* Breakout for tables and extensions */
440
+ .${RendererCssClassName.DOCUMENT} > {
441
+ * .${TableSharedCssClassName.TABLE_CONTAINER} {
442
+ width: 100% !important;
443
+ left: 0 !important;
444
+ }
429
445
 
430
- .${RendererCssClassName.EXTENSION_CENTER_ALIGN} {
431
- margin-left: 50%;
432
- transform: translateX(-50%);
433
- }
446
+ * .${RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER} {
447
+ overflow-x: auto;
448
+ }
434
449
 
435
- .${TableSharedCssClassName.TABLE_NODE_WRAPPER} {
436
- overflow-x: auto;
437
- }
450
+ & .${RendererCssClassName.EXTENSION}:first-child {
451
+ margin-top: 0;
452
+ }
453
+ }
438
454
 
439
- ${tableSharedStyle}
455
+ .${RendererCssClassName.DOCUMENT} {
456
+ .${RendererCssClassName.EXTENSION} {
457
+ margin-top: ${blockNodesVerticalMargin};
458
+ }
440
459
 
441
- .${TableSharedCssClassName.TABLE_CONTAINER} {
442
- z-index: 0;
443
- transition: all 0.1s linear;
444
- display: flex; /* needed to avoid position: fixed jumpiness in Chrome */
460
+ .${RendererCssClassName.EXTENSION_CENTER_ALIGN} {
461
+ margin-left: 50%;
462
+ transform: translateX(-50%);
463
+ }
445
464
 
446
- /** Shadow overrides */
447
- &.${shadowClassNames.RIGHT_SHADOW}::after, &.${shadowClassNames.LEFT_SHADOW}::before {
448
- top: ${tableMarginTop - 1}px;
449
- height: calc(100% - ${tableMarginTop}px);
450
- z-index: ${akEditorStickyHeaderZIndex};
465
+ .${TableSharedCssClassName.TABLE_NODE_WRAPPER} {
466
+ overflow-x: auto;
467
+ }
451
468
  }
452
469
 
453
- /**
470
+ ${tableSharedStyle(themeProps)}
471
+
472
+ .${RendererCssClassName.DOCUMENT} .${TableSharedCssClassName.TABLE_CONTAINER} {
473
+ z-index: 0;
474
+ transition: all 0.1s linear;
475
+ display: flex; /* needed to avoid position: fixed jumpiness in Chrome */
476
+
477
+ /** Shadow overrides */
478
+ &.${shadowClassNames.RIGHT_SHADOW}::after,
479
+ &.${shadowClassNames.LEFT_SHADOW}::before {
480
+ top: ${tableMarginTop - 1}px;
481
+ height: calc(100% - ${tableMarginTop}px);
482
+ z-index: ${akEditorStickyHeaderZIndex};
483
+ }
484
+
485
+ /**
454
486
  * A hack for making all the <th /> heights equal in case some have shorter
455
487
  * content than others.
456
488
  *
457
489
  * This is done to make sort buttons fill entire <th />.
458
490
  */
459
- table {
460
- height: 1px; /* will be ignored */
461
- ${tableSortableColumnStyle};
462
- margin-left: 0;
463
- margin-right: 0;
464
- }
491
+ table {
492
+ height: 1px; /* will be ignored */
493
+ ${tableSortableColumnStyle(wrapperProps)};
494
+ margin-left: 0;
495
+ margin-right: 0;
496
+ }
465
497
 
466
- table tr:first-child {
467
- height: 100%;
498
+ table tr:first-child {
499
+ height: 100%;
468
500
 
469
- td, th {
470
- position: relative;
501
+ td,
502
+ th {
503
+ position: relative;
504
+ }
471
505
  }
472
- }
473
506
 
474
- table[data-number-column='true'] {
475
- .${RendererCssClassName.NUMBER_COLUMN} {
476
- background-color: ${themed({
477
- light: akEditorTableToolbar,
478
- dark: akEditorTableToolbarDark
479
- })};
480
- border-right: 1px solid ${themed({
481
- light: akEditorTableBorder,
482
- dark: akEditorTableBorderDark
483
- })};
484
- width: ${akEditorTableNumberColumnWidth}px;
485
- text-align: center;
486
- color: ${themed({
487
- light: colors.N200,
488
- dark: colors.DN400
489
- })};
490
- font-size: ${relativeFontSizeToBase16(fontSize())};
491
- }
507
+ table[data-number-column='true'] {
508
+ .${RendererCssClassName.NUMBER_COLUMN} {
509
+ background-color: ${themed({
510
+ light: akEditorTableToolbar,
511
+ dark: akEditorTableToolbarDark
512
+ })(themeProps)};
513
+ border-right: 1px solid
514
+ ${themed({
515
+ light: akEditorTableBorder,
516
+ dark: akEditorTableBorderDark
517
+ })(themeProps)};
518
+ width: ${akEditorTableNumberColumnWidth}px;
519
+ text-align: center;
520
+ color: ${themed({
521
+ light: colors.N200,
522
+ dark: colors.DN400
523
+ })(themeProps)};
524
+ font-size: ${relativeFontSizeToBase16(fontSize())};
525
+ }
492
526
 
493
- .fixed .${RendererCssClassName.NUMBER_COLUMN} {
494
- border-right: 0px none;
527
+ .fixed .${RendererCssClassName.NUMBER_COLUMN} {
528
+ border-right: 0px none;
529
+ }
495
530
  }
496
531
  }
497
- }
498
532
 
499
- tr[data-header-row].fixed {
500
- position: fixed !important;
501
- display: flex;
502
- overflow: hidden;
503
- z-index: ${akEditorStickyHeaderZIndex};
504
-
505
- border-right: 1px solid ${themed({
506
- light: akEditorTableBorder,
507
- dark: akEditorTableBorderDark
508
- })};
509
- border-bottom: 1px solid ${themed({
510
- light: akEditorTableBorder,
511
- dark: akEditorTableBorderDark
512
- })};
513
-
514
- /* this is to compensate for the table border */
515
- transform: translateX(-1px);
516
- }
533
+ tr[data-header-row].fixed {
534
+ position: fixed !important;
535
+ display: flex;
536
+ overflow: hidden;
537
+ z-index: ${akEditorStickyHeaderZIndex};
517
538
 
518
- .sticky > th {
519
- z-index: ${akEditorStickyHeaderZIndex};
520
- position: sticky !important;
521
- top: 0;
522
- }
539
+ border-right: 1px solid
540
+ ${themed({
541
+ light: akEditorTableBorder,
542
+ dark: akEditorTableBorderDark
543
+ })(themeProps)};
544
+ border-bottom: 1px solid
545
+ ${themed({
546
+ light: akEditorTableBorder,
547
+ dark: akEditorTableBorderDark
548
+ })(themeProps)};
549
+
550
+ /* this is to compensate for the table border */
551
+ transform: translateX(-1px);
552
+ }
523
553
 
524
- /* Make the number column header sticky */
525
- .sticky > td {
526
- position: sticky !important;
527
- top: 0;
528
- }
554
+ .sticky > th {
555
+ z-index: ${akEditorStickyHeaderZIndex};
556
+ position: sticky !important;
557
+ top: 0;
558
+ }
559
+
560
+ /* Make the number column header sticky */
561
+ .sticky > td {
562
+ position: sticky !important;
563
+ top: 0;
564
+ }
529
565
 
530
- /* add border for position: sticky
566
+ /* add border for position: sticky
531
567
  and work around background-clip: padding-box
532
568
  bug for FF causing box-shadow bug in Chrome */
533
- .sticky th, .sticky td {
534
- box-shadow: 0px 1px ${themed({
535
- light: akEditorTableBorder,
536
- dark: akEditorTableBorderDark
537
- })}, 0px -0.5px ${themed({
538
- light: akEditorTableBorder,
539
- dark: akEditorTableBorderDark
540
- })}, inset -1px 0px ${themed({
541
- light: akEditorTableToolbar,
542
- dark: akEditorTableToolbarDark
543
- })}, 0px -1px ${themed({
544
- light: akEditorTableToolbar,
545
- dark: akEditorTableToolbarDark
546
- })};
547
- }
569
+ .sticky th,
570
+ .sticky td {
571
+ box-shadow: 0px 1px
572
+ ${themed({
573
+ light: akEditorTableBorder,
574
+ dark: akEditorTableBorderDark
575
+ })(themeProps)},
576
+ 0px -0.5px ${themed({
577
+ light: akEditorTableBorder,
578
+ dark: akEditorTableBorderDark
579
+ })(themeProps)},
580
+ inset -1px 0px ${themed({
581
+ light: akEditorTableToolbar,
582
+ dark: akEditorTableToolbarDark
583
+ })(themeProps)},
584
+ 0px -1px ${themed({
585
+ light: akEditorTableToolbar,
586
+ dark: akEditorTableToolbarDark
587
+ })(themeProps)};
588
+ }
548
589
 
549
- /* this will remove jumpiness caused in Chrome for sticky headers */
550
- .fixed + tr {
551
- min-height: 0px;
552
- }
590
+ /* this will remove jumpiness caused in Chrome for sticky headers */
591
+ .fixed + tr {
592
+ min-height: 0px;
593
+ }
553
594
 
554
- /*
595
+ /*
555
596
  * We wrap CodeBlock in a grid to prevent it from overflowing the container of the renderer.
556
597
  * See ED-4159.
557
598
  */
558
- & .code-block {
559
- max-width: 100%;
560
- /* -ms- properties are necessary until MS supports the latest version of the grid spec */
561
- /* stylelint-disable value-no-vendor-prefix, declaration-block-no-duplicate-properties */
562
- display: -ms-grid;
563
- display: grid;
564
- -ms-grid-columns: auto 1fr;
565
- /* stylelint-enable */
566
-
567
- grid-template-columns: minmax(0, 1fr);
568
- position: relative;
569
- border-radius: ${borderRadius()}px;
599
+ & .code-block {
600
+ max-width: 100%;
601
+ /* -ms- properties are necessary until MS supports the latest version of the grid spec */
602
+ /* stylelint-disable value-no-vendor-prefix, declaration-block-no-duplicate-properties */
603
+ display: -ms-grid;
604
+ display: grid;
605
+ -ms-grid-columns: auto 1fr;
606
+ /* stylelint-enable */
570
607
 
571
- /*
608
+ grid-template-columns: minmax(0, 1fr);
609
+ position: relative;
610
+ border-radius: ${borderRadius()}px;
611
+
612
+ /*
572
613
  * The overall renderer has word-wrap: break; which causes issues with
573
614
  * code block line numbers in Safari / iOS.
574
615
  */
575
- word-wrap: normal;
576
-
577
- & > span {
578
- /* stylelint-disable value-no-vendor-prefix */
579
- -ms-grid-row: 1;
580
- -ms-grid-column: 2;
581
- /* stylelint-enable */
582
- grid-column: 1;
616
+ word-wrap: normal;
617
+
618
+ & > span {
619
+ /* stylelint-disable value-no-vendor-prefix */
620
+ -ms-grid-row: 1;
621
+ -ms-grid-column: 2;
622
+ /* stylelint-enable */
623
+ grid-column: 1;
624
+ }
583
625
  }
584
- }
585
-
586
- & .MediaGroup,
587
- & .code-block {
588
- margin-top: ${blockNodesVerticalMargin};
589
626
 
590
- &:first-child {
591
- margin-top: 0;
592
- }
627
+ & .MediaGroup,
628
+ & .code-block {
629
+ margin-top: ${blockNodesVerticalMargin};
593
630
 
594
- &:hover button.copy-to-clipboard, .copy-to-clipboard:focus{
595
- opacity: 1;
596
- position: absolute;
597
- height: 32px;
598
- width: 32px;
599
- right: 6px;
600
- top: 4px;
601
- padding: 2px;
602
- }
603
- }
631
+ &:first-child {
632
+ margin-top: 0;
633
+ }
604
634
 
605
- ${columnLayoutSharedStyle};
606
- & [data-layout-section] {
607
- margin-top: ${gridSize() * 2.5}px;
608
- & > div + div {
609
- margin-left: ${gridSize() * 4}px;
635
+ &:hover button.copy-to-clipboard,
636
+ .copy-to-clipboard:focus {
637
+ opacity: 1;
638
+ position: absolute;
639
+ height: 32px;
640
+ width: 32px;
641
+ right: 6px;
642
+ top: 4px;
643
+ padding: 2px;
644
+ }
610
645
  }
611
646
 
612
- @media screen and (max-width: ${gridMediumMaxWidth}px) {
647
+ ${columnLayoutSharedStyle};
648
+ & [data-layout-section] {
649
+ margin-top: ${gridSize() * 2.5}px;
613
650
  & > div + div {
614
- margin-left: 0;
651
+ margin-left: ${gridSize() * 4}px;
652
+ }
653
+
654
+ @media screen and (max-width: ${gridMediumMaxWidth}px) {
655
+ & > div + div {
656
+ margin-left: 0;
657
+ }
615
658
  }
616
659
  }
617
- }
618
- `;
660
+ `;
661
+ };