@atlaskit/editor-plugin-table 23.3.11 → 23.4.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 (44) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/nodeviews/TableCell.js +2 -5
  3. package/dist/cjs/nodeviews/TableComponent.js +18 -1
  4. package/dist/cjs/nodeviews/TableRow.js +4 -0
  5. package/dist/cjs/nodeviews/TableRowNativeStickyWithFallback.js +3 -0
  6. package/dist/cjs/nodeviews/toDOM.js +13 -1
  7. package/dist/cjs/pm-plugins/commands/selection.js +1 -2
  8. package/dist/cjs/pm-plugins/table-resizing/utils/dom.js +31 -1
  9. package/dist/cjs/tablePlugin.js +1 -1
  10. package/dist/cjs/types/index.js +1 -0
  11. package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +10 -2
  12. package/dist/cjs/ui/common-styles.js +8 -22
  13. package/dist/cjs/ui/rounded-table-styles.js +43 -0
  14. package/dist/es2019/nodeviews/TableCell.js +2 -5
  15. package/dist/es2019/nodeviews/TableComponent.js +19 -2
  16. package/dist/es2019/nodeviews/TableRow.js +5 -1
  17. package/dist/es2019/nodeviews/TableRowNativeStickyWithFallback.js +4 -1
  18. package/dist/es2019/nodeviews/toDOM.js +13 -1
  19. package/dist/es2019/pm-plugins/commands/selection.js +1 -2
  20. package/dist/es2019/pm-plugins/table-resizing/utils/dom.js +30 -0
  21. package/dist/es2019/tablePlugin.js +1 -1
  22. package/dist/es2019/types/index.js +1 -0
  23. package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +10 -2
  24. package/dist/es2019/ui/common-styles.js +21 -458
  25. package/dist/es2019/ui/rounded-table-styles.js +581 -0
  26. package/dist/esm/nodeviews/TableCell.js +2 -5
  27. package/dist/esm/nodeviews/TableComponent.js +19 -2
  28. package/dist/esm/nodeviews/TableRow.js +5 -1
  29. package/dist/esm/nodeviews/TableRowNativeStickyWithFallback.js +4 -1
  30. package/dist/esm/nodeviews/toDOM.js +13 -1
  31. package/dist/esm/pm-plugins/commands/selection.js +1 -2
  32. package/dist/esm/pm-plugins/table-resizing/utils/dom.js +30 -0
  33. package/dist/esm/tablePlugin.js +1 -1
  34. package/dist/esm/types/index.js +1 -0
  35. package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +10 -2
  36. package/dist/esm/ui/common-styles.js +8 -22
  37. package/dist/esm/ui/rounded-table-styles.js +37 -0
  38. package/dist/types/pm-plugins/table-resizing/utils/dom.d.ts +1 -0
  39. package/dist/types/types/index.d.ts +1 -0
  40. package/dist/types/ui/rounded-table-styles.d.ts +2 -0
  41. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/dom.d.ts +1 -0
  42. package/dist/types-ts4.5/types/index.d.ts +1 -0
  43. package/dist/types-ts4.5/ui/rounded-table-styles.d.ts +2 -0
  44. package/package.json +6 -9
@@ -9,6 +9,7 @@ import { generateColgroupFromNode, getResizerMinWidth } from '../pm-plugins/tabl
9
9
  import { TABLE_MAX_WIDTH, TABLE_FULL_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
10
10
  import { getTableResizerContainerMaxWidthInCSS, getTableResizerContainerForFullPageWidthInCSS, getTableResizerItemWidthInCSS } from '../pm-plugins/table-resizing/utils/misc';
11
11
  import { isContentModeSupported } from '../pm-plugins/utils/tableMode/is-content-mode-supported';
12
+ import { TableCssClassName as ClassName } from '../types';
12
13
  import { getAlignmentStyle } from './table-container-styles';
13
14
  export const tableNodeSpecWithFixedToDOM = config => {
14
15
  const tableNode = config.isNestingSupported ? tableWithNestedTable : table;
@@ -50,6 +51,17 @@ export const tableNodeSpecWithFixedToDOM = config => {
50
51
  if (config.allowColumnResizing) {
51
52
  colgroup = ['colgroup', {}, ...generateColgroupFromNode(node, config.isCommentEditor, config.isChromelessEditor, config.isNested, config.isTableScalingEnabled, config.shouldUseIncreasedScalingPercent)];
52
53
  }
54
+ const roundedTableCornerMasks = expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? [['div', {
55
+ contenteditable: 'false',
56
+ 'aria-hidden': 'true',
57
+ class: ClassName.TABLE_CORNER_MASK,
58
+ 'data-corner': 'left'
59
+ }], ['div', {
60
+ contenteditable: 'false',
61
+ 'aria-hidden': 'true',
62
+ class: ClassName.TABLE_CORNER_MASK,
63
+ 'data-corner': 'right'
64
+ }]] : [];
53
65
  const tableContainerDiv = ['div', {
54
66
  class: 'pm-table-container',
55
67
  'data-number-column': node.attrs.isNumberColumnEnabled,
@@ -62,7 +74,7 @@ export const tableNodeSpecWithFixedToDOM = config => {
62
74
  class: 'pm-table-row-controls-wrapper'
63
75
  }, ['div']], ['div', {
64
76
  class: 'pm-table-wrapper'
65
- }, ['table', attrs, colgroup, ['tbody', 0]]], ['div', {
77
+ }, ...roundedTableCornerMasks, ['table', attrs, colgroup, ['tbody', 0]]], ['div', {
66
78
  class: 'pm-table-sticky-sentinel-bottom',
67
79
  'data-testid': 'sticky-sentinel-bottom'
68
80
  }], ...(isSSRStreaming() ? [['div', {
@@ -4,7 +4,6 @@ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
5
5
  import { TableMap } from '@atlaskit/editor-tables/table-map';
6
6
  import { cellAround, findTable, isColumnSelected, isRowSelected, isTableSelected, selectedRect } from '@atlaskit/editor-tables/utils';
7
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
8
7
  import { getClosestSelectionRect } from '../../ui/toolbar';
9
8
  import { getPluginState } from '../plugin-factory';
10
9
  import { selectColumn, selectRow } from './misc';
@@ -429,7 +428,7 @@ export const modASelectTable = editorSelectionAPI => () => (state, dispatch) =>
429
428
  const isCellSelection = selection instanceof CellSelection;
430
429
 
431
430
  // if no cells are selected
432
- if (!isCellSelection && expValEquals('platform_editor_lovability_select_all_shortcut', 'isEnabled', true)) {
431
+ if (!isCellSelection) {
433
432
  return selectTableCell(state, dispatch);
434
433
  }
435
434
  // else if any number of cells are selected but not the full table
@@ -1,5 +1,6 @@
1
1
  import { tableCellBorderWidth, tableMarginTop } from '@atlaskit/editor-common/styles';
2
2
  import { closestElement, containsClassName, parsePx } from '@atlaskit/editor-common/utils';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
4
  import { TableCssClassName as ClassName } from '../../../types';
4
5
  import { getPluginState as getMainPluginState } from '../../plugin-factory';
5
6
  import { colWidthsForRow } from '../../utils/column-controls';
@@ -96,5 +97,34 @@ const applyTableWidthToStickyRow = (tableRef, headerRow) => {
96
97
  const newWidth = Math.min(tbody.offsetWidth + 1, wrapper.offsetWidth);
97
98
  headerRow.style.width = `${newWidth}px`;
98
99
  headerRow.scrollLeft = wrapper.scrollLeft;
100
+ if (expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true)) {
101
+ syncCornerMasksToStickyRow(tableRef, headerRow, wrapper);
102
+ }
103
+ }
104
+ };
105
+ export const clearStickyCornerMaskPositions = tableRef => {
106
+ const wrapper = tableRef === null || tableRef === void 0 ? void 0 : tableRef.parentElement;
107
+ if (!wrapper) {
108
+ return;
109
+ }
110
+ wrapper.querySelectorAll(`.${ClassName.TABLE_CORNER_MASK}`).forEach(mask => {
111
+ mask.style.removeProperty('left');
112
+ });
113
+ };
114
+ const syncCornerMasksToStickyRow = (tableRef, headerRow, wrapper) => {
115
+ const cornerMasks = wrapper.querySelectorAll(`.${ClassName.TABLE_CORNER_MASK}`);
116
+ if (!cornerMasks.length) {
117
+ return;
118
+ }
119
+ const isLegacySticky = tableRef.classList.contains(ClassName.TABLE_STICKY) && headerRow.classList.contains('sticky');
120
+ if (!isLegacySticky) {
121
+ clearStickyCornerMaskPositions(tableRef);
122
+ return;
99
123
  }
124
+ const stickyRowRect = headerRow.getBoundingClientRect();
125
+ cornerMasks.forEach(mask => {
126
+ const corner = mask.dataset.corner;
127
+ const left = corner === 'right' ? stickyRowRect.right - 11 : stickyRowRect.left - 1;
128
+ mask.style.left = `${left}px`;
129
+ });
100
130
  };
@@ -486,7 +486,7 @@ const tablePlugin = ({
486
486
  name: 'editorContentAreaHeightPlugin',
487
487
  plugin: () => expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') && fg('platform_editor_table_sticky_header_patch_1') ? createContentAreaHeightPlugin() : undefined
488
488
  }];
489
- if (!expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') && fg('platform_editor_table_sticky_header_patch_2')) {
489
+ if (!expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
490
490
  plugins.push({
491
491
  name: 'tableAnchorNames',
492
492
  plugin: () => createTableAnchorNamesPlugin()
@@ -142,6 +142,7 @@ export const TableCssClassName = {
142
142
  NODEVIEW_WRAPPER: 'tableView-content-wrap',
143
143
  TABLE_SELECTED: `${tablePrefixSelector}-table__selected`,
144
144
  TABLE_CELL: tableCellSelector,
145
+ TABLE_CORNER_MASK: `${tablePrefixSelector}-corner-mask`,
145
146
  TABLE_HEADER_CELL: tableHeaderSelector,
146
147
  TABLE_STICKY: `${tablePrefixSelector}-sticky`,
147
148
  TABLE_CHROMELESS: `${tablePrefixSelector}-chromeless`,
@@ -53,13 +53,21 @@ export default class NumberColumn extends Component {
53
53
  updateCellHoverLocation
54
54
  } = this.props;
55
55
  const rowHeights = getRowHeights(tableRef);
56
+ const getMarginTop = () => {
57
+ if (!hasHeaderRow || this.props.stickyTop === undefined) {
58
+ return undefined;
59
+ }
60
+
61
+ // with platform_editor_table_q4_loveability enabled, table controls have margin-top of 1px applied. Offset this here.
62
+ return rowHeights[0] + 1;
63
+ };
56
64
  if (isSSR()) {
57
65
  return /*#__PURE__*/React.createElement("div", {
58
66
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
59
67
  className: ClassName.NUMBERED_COLUMN,
60
68
  style: {
61
69
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
62
- marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
70
+ marginTop: expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? getMarginTop() : hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
63
71
  borderLeft: isDragAndDropEnabled && tableActive && !expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ?
64
72
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
65
73
  `1px solid ${tableBorderColor}` : undefined,
@@ -74,7 +82,7 @@ export default class NumberColumn extends Component {
74
82
  className: ClassName.NUMBERED_COLUMN,
75
83
  style: {
76
84
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
77
- marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
85
+ marginTop: expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? getMarginTop() : hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
78
86
  borderLeft: isDragAndDropEnabled && tableActive && !expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ?
79
87
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
80
88
  `1px solid ${tableBorderColor}` : undefined,
@@ -18,6 +18,7 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
18
18
  import { SORTING_ICON_CLASS_NAME } from '../pm-plugins/view-mode-sort/consts';
19
19
  import { TableCssClassName as ClassName } from '../types';
20
20
  import { aboveNativeStickyHeaderZIndex, belowNativeStickyHeaderZIndex, columnControlsDecorationHeight, dragRowControlsWidth, nativeStickyHeaderZIndex, resizeHandlerAreaWidth, resizeHandlerZIndex, resizeLineWidth, rowControlsZIndex, stickyHeaderBorderBottomWidth, stickyRowOffsetTop, stickyRowZIndex, tableBorderColor, tableBorderDeleteColor, tableBorderRadiusSize, tableBorderSelectedColor, tableCellBackgroundColor, tableCellDeleteColor, tableCellSelectedColor, tableColumnControlsHeight, tableControlsSpacing, tableHeaderCellBackgroundColor, tableHeaderCellSelectedColor, tableInsertColumnButtonSize, tableOverflowShadowWidth, tablePadding, tableScrollbarOffset, tableTextColor, tableToolbarDeleteColor, tableToolbarSelectedColor, tableToolbarSize } from './consts';
21
+ import { roundedTableOverrides } from './rounded-table-styles';
21
22
  import { columnControlsDecoration, columnControlsLineMarker, DeleteButton, dragCornerControlButton, dragInsertButtonWrapper, floatingColumnControls, HeaderButton, HeaderButtonDanger, HeaderButtonHover, hoveredCell, hoveredDeleteButton, hoveredWarningCell, insertColumnButtonWrapper, insertLine, InsertMarker, insertRowButtonWrapper, OverflowShadow, resizeHandle, rowControlsWrapperDotStyle } from './ui-styles';
22
23
  const cornerControlHeight = tableToolbarSize + 1;
23
24
 
@@ -219,443 +220,6 @@ const tableStickyHeaderFirefoxFixStyle = () => {
219
220
  `;
220
221
  }
221
222
  };
222
- const roundedTableCellCornerStyles = () => css`
223
- .${ClassName.TABLE_NODE_WRAPPER} > table {
224
- /* Round table corner cells (including merged cells that span to the edge)
225
- and their interaction overlays. The data-reaches-* attributes are set by the
226
- TableCell node view based on each cell's position + rowspan/colspan. */
227
- > tbody > tr > td[data-reaches-top][data-reaches-left],
228
- > tbody > tr > th[data-reaches-top][data-reaches-left] {
229
- border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
230
-
231
- &::after,
232
- &.${ClassName.HOVERED_CELL_IN_DANGER}::after,
233
- &.${ClassName.HOVERED_NO_HIGHLIGHT}.${ClassName.HOVERED_CELL_IN_DANGER}::after {
234
- border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
235
- }
236
- }
237
-
238
- > tbody > tr > td[data-reaches-top][data-reaches-right],
239
- > tbody > tr > th[data-reaches-top][data-reaches-right] {
240
- border-top-right-radius: ${"var(--ds-radius-medium, 6px)"};
241
-
242
- &::after,
243
- &.${ClassName.HOVERED_CELL_IN_DANGER}::after,
244
- &.${ClassName.HOVERED_NO_HIGHLIGHT}.${ClassName.HOVERED_CELL_IN_DANGER}::after {
245
- border-top-right-radius: ${"var(--ds-radius-medium, 6px)"};
246
- }
247
- }
248
-
249
- > tbody > tr > td[data-reaches-bottom][data-reaches-left],
250
- > tbody > tr > th[data-reaches-bottom][data-reaches-left] {
251
- border-bottom-left-radius: ${"var(--ds-radius-medium, 6px)"};
252
-
253
- &::after,
254
- &.${ClassName.HOVERED_CELL_IN_DANGER}::after,
255
- &.${ClassName.HOVERED_NO_HIGHLIGHT}.${ClassName.HOVERED_CELL_IN_DANGER}::after {
256
- border-bottom-left-radius: ${"var(--ds-radius-medium, 6px)"};
257
- }
258
- }
259
-
260
- > tbody > tr > td[data-reaches-bottom][data-reaches-right],
261
- > tbody > tr > th[data-reaches-bottom][data-reaches-right] {
262
- border-bottom-right-radius: ${"var(--ds-radius-medium, 6px)"};
263
-
264
- &::after,
265
- &.${ClassName.HOVERED_CELL_IN_DANGER}::after,
266
- &.${ClassName.HOVERED_NO_HIGHLIGHT}.${ClassName.HOVERED_CELL_IN_DANGER}::after {
267
- border-bottom-right-radius: ${"var(--ds-radius-medium, 6px)"};
268
- }
269
- }
270
- }
271
- `;
272
- const roundedTableInteractionOverlayStyles = () => css`
273
- .${ClassName.TABLE_NODE_WRAPPER} > table {
274
- /* Active-cell highlight base properties (replaces activeCellHighlightStyles).
275
- width/height: auto overrides the base cell ::after which uses width: 100%; height: 100%,
276
- so that left/right/top/bottom determine the size instead. */
277
- td.${ClassName.TABLE_CELL}.${ClassName.ACTIVE_CURSOR_CELL}::after,
278
- th.${ClassName.TABLE_HEADER_CELL}.${ClassName.ACTIVE_CURSOR_CELL}::after {
279
- border: 1px solid ${"var(--ds-border-selected, #1868DB)"};
280
- box-shadow: ${"var(--ds-shadow-raised, 0px 1px 1px #1E1F2140, 0px 0px 1px #1E1F214f)"};
281
- content: '';
282
- position: absolute;
283
- top: -1px;
284
- left: -1px;
285
- right: -1px;
286
- bottom: -1px;
287
- width: auto;
288
- height: auto;
289
- z-index: ${akEditorSmallZIndex};
290
- pointer-events: none;
291
- }
292
-
293
- /* Normalize selected/hover/danger overlays to the same box model as active-cell.
294
- width/height: auto overrides the base cell ::after which uses width: 100%; height: 100%. */
295
- td.${ClassName.HOVERED_CELL}::after,
296
- td.${ClassName.SELECTED_CELL}::after,
297
- th.${ClassName.TABLE_HEADER_CELL}.${ClassName.SELECTED_CELL}::after,
298
- th.${ClassName.TABLE_HEADER_CELL}.${ClassName.HOVERED_CELL}::after,
299
- th.${ClassName.TABLE_HEADER_CELL}.${ClassName.HOVERED_CELL_IN_DANGER}::after,
300
- td.${ClassName.TABLE_CELL}.${ClassName.HOVERED_CELL_IN_DANGER}::after {
301
- left: -1px;
302
- right: -1px;
303
- top: -1px;
304
- bottom: -1px;
305
- width: auto;
306
- height: auto;
307
- }
308
-
309
- /* Active-cell overlays: clamp outer sides using data-reaches-* attributes.
310
- Internal sides keep -1px overlap; true outer edges are clamped to 0. */
311
- > tbody
312
- > tr
313
- > td[data-reaches-top].${ClassName.ACTIVE_CURSOR_CELL}::after,
314
- > tbody
315
- > tr
316
- > th[data-reaches-top].${ClassName.ACTIVE_CURSOR_CELL}::after {
317
- top: 0;
318
- }
319
-
320
- > tbody
321
- > tr
322
- > td[data-reaches-left].${ClassName.ACTIVE_CURSOR_CELL}::after,
323
- > tbody
324
- > tr
325
- > th[data-reaches-left].${ClassName.ACTIVE_CURSOR_CELL}::after {
326
- left: 0;
327
- }
328
-
329
- > tbody
330
- > tr
331
- > td[data-reaches-right].${ClassName.ACTIVE_CURSOR_CELL}::after,
332
- > tbody
333
- > tr
334
- > th[data-reaches-right].${ClassName.ACTIVE_CURSOR_CELL}::after {
335
- right: 0;
336
- }
337
-
338
- > tbody
339
- > tr
340
- > td[data-reaches-bottom].${ClassName.ACTIVE_CURSOR_CELL}::after,
341
- > tbody
342
- > tr
343
- > th[data-reaches-bottom].${ClassName.ACTIVE_CURSOR_CELL}::after {
344
- bottom: 0;
345
- }
346
-
347
- /* Selected/hover/active overlays: clamp outer left side and draw overlay border. */
348
- > tbody
349
- > tr
350
- > td[data-reaches-left].${ClassName.SELECTED_CELL},
351
- > tbody
352
- > tr
353
- > th[data-reaches-left].${ClassName.SELECTED_CELL},
354
- > tbody
355
- > tr
356
- > td[data-reaches-left].${ClassName.HOVERED_CELL},
357
- > tbody
358
- > tr
359
- > th[data-reaches-left].${ClassName.HOVERED_CELL},
360
- > tbody
361
- > tr
362
- > td[data-reaches-left].${ClassName.ACTIVE_CURSOR_CELL},
363
- > tbody
364
- > tr
365
- > th[data-reaches-left].${ClassName.ACTIVE_CURSOR_CELL} {
366
- border-left-color: transparent;
367
-
368
- &::after {
369
- left: 0;
370
- border-left-color: ${tableBorderSelectedColor};
371
- }
372
- }
373
-
374
- /* Danger/delete overlays: clamp outer left side. */
375
- > tbody
376
- > tr
377
- > td[data-reaches-left].${ClassName.HOVERED_CELL_IN_DANGER},
378
- > tbody
379
- > tr
380
- > th[data-reaches-left].${ClassName.HOVERED_CELL_IN_DANGER} {
381
- border-left-color: transparent;
382
-
383
- &::after {
384
- left: 0;
385
- border-left-color: ${tableBorderDeleteColor};
386
- }
387
- }
388
-
389
- /* Selected/hover/active overlays: clamp outer right side. */
390
- > tbody
391
- > tr
392
- > td[data-reaches-right].${ClassName.SELECTED_CELL},
393
- > tbody
394
- > tr
395
- > th[data-reaches-right].${ClassName.SELECTED_CELL},
396
- > tbody
397
- > tr
398
- > td[data-reaches-right].${ClassName.HOVERED_CELL},
399
- > tbody
400
- > tr
401
- > th[data-reaches-right].${ClassName.HOVERED_CELL},
402
- > tbody
403
- > tr
404
- > td[data-reaches-right].${ClassName.ACTIVE_CURSOR_CELL},
405
- > tbody
406
- > tr
407
- > th[data-reaches-right].${ClassName.ACTIVE_CURSOR_CELL} {
408
- border-right-color: transparent;
409
-
410
- &::after {
411
- right: 0;
412
- border-right-color: ${tableBorderSelectedColor};
413
- }
414
- }
415
-
416
- /* Danger/delete overlays: clamp outer right side. */
417
- > tbody
418
- > tr
419
- > td[data-reaches-right].${ClassName.HOVERED_CELL_IN_DANGER},
420
- > tbody
421
- > tr
422
- > th[data-reaches-right].${ClassName.HOVERED_CELL_IN_DANGER} {
423
- border-right-color: transparent;
424
-
425
- &::after {
426
- right: 0;
427
- border-right-color: ${tableBorderDeleteColor};
428
- }
429
- }
430
-
431
- /* Selected/hover/active overlays: clamp outer bottom side. */
432
- > tbody
433
- > tr
434
- > td[data-reaches-bottom].${ClassName.SELECTED_CELL},
435
- > tbody
436
- > tr
437
- > th[data-reaches-bottom].${ClassName.SELECTED_CELL},
438
- > tbody
439
- > tr
440
- > td[data-reaches-bottom].${ClassName.HOVERED_CELL},
441
- > tbody
442
- > tr
443
- > th[data-reaches-bottom].${ClassName.HOVERED_CELL},
444
- > tbody
445
- > tr
446
- > td[data-reaches-bottom].${ClassName.ACTIVE_CURSOR_CELL},
447
- > tbody
448
- > tr
449
- > th[data-reaches-bottom].${ClassName.ACTIVE_CURSOR_CELL} {
450
- border-bottom-color: transparent;
451
-
452
- &::after {
453
- border-bottom-color: ${tableBorderSelectedColor};
454
- }
455
- }
456
-
457
- /* Danger/delete overlays: clamp outer bottom side. */
458
- > tbody
459
- > tr
460
- > td[data-reaches-bottom].${ClassName.HOVERED_CELL_IN_DANGER},
461
- > tbody
462
- > tr
463
- > th[data-reaches-bottom].${ClassName.HOVERED_CELL_IN_DANGER} {
464
- border-bottom-color: transparent;
465
-
466
- &::after {
467
- border-bottom-color: ${tableBorderDeleteColor};
468
- }
469
- }
470
- }
471
- `;
472
- const roundedTableNumberedColumnStyles = () => css`
473
- /* Numbered columns are separate, so they need their own rounded edge owner. */
474
- .${ClassName.TABLE_CONTAINER}[data-number-column='true'] {
475
- /* Override the inline/container left border and replace it with one rounded pseudo-border. */
476
- > .${ClassName.ROW_CONTROLS_WRAPPER}
477
- .${ClassName.NUMBERED_COLUMN},
478
- > .${ClassName.DRAG_ROW_CONTROLS_WRAPPER}
479
- .${ClassName.NUMBERED_COLUMN} {
480
- position: relative;
481
- border-left: 0;
482
-
483
- &::before {
484
- content: '';
485
- position: absolute;
486
- top: 0;
487
- left: 0;
488
- bottom: 0;
489
- width: 100%;
490
- border-left: 1px solid ${tableBorderColor};
491
- border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
492
- border-bottom-left-radius: ${"var(--ds-radius-medium, 6px)"};
493
- pointer-events: none;
494
- z-index: ${akEditorUnitZIndex};
495
- }
496
- }
497
-
498
- /* Prevent individual number buttons from drawing a straight left border. */
499
- > .${ClassName.ROW_CONTROLS_WRAPPER}
500
- .${ClassName.NUMBERED_COLUMN_BUTTON},
501
- > .${ClassName.DRAG_ROW_CONTROLS_WRAPPER}
502
- .${ClassName.NUMBERED_COLUMN_BUTTON} {
503
- border-left-color: transparent;
504
- }
505
-
506
- > .${ClassName.ROW_CONTROLS_WRAPPER}
507
- .${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_IN_DANGER},
508
- > .${ClassName.DRAG_ROW_CONTROLS_WRAPPER}
509
- .${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_IN_DANGER},
510
- > .${ClassName.ROW_CONTROLS_WRAPPER}
511
- .${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_ACTIVE},
512
- > .${ClassName.DRAG_ROW_CONTROLS_WRAPPER}
513
- .${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_ACTIVE},
514
- > .${ClassName.ROW_CONTROLS_WRAPPER}
515
- .${ClassName.NUMBERED_COLUMN_BUTTON}.active,
516
- > .${ClassName.DRAG_ROW_CONTROLS_WRAPPER}
517
- .${ClassName.NUMBERED_COLUMN_BUTTON}.active {
518
- border-left-color: transparent;
519
- }
520
-
521
- /* When numbered column is present, the visual left edge belongs to the number column widget.
522
- Zero out any left-side border-radius on the cell and its overlays/pseudo-borders —
523
- but leave right-side radii untouched so right-edge cells still round correctly. */
524
- .${ClassName.TABLE_NODE_WRAPPER} > table > tbody > tr > th[data-reaches-top][data-reaches-left],
525
- .${ClassName.TABLE_NODE_WRAPPER}
526
- > table
527
- > tbody
528
- > tr
529
- > td[data-reaches-top][data-reaches-left] {
530
- border-top-left-radius: 0;
531
-
532
- &::after,
533
- &::before {
534
- border-top-left-radius: 0;
535
- }
536
- }
537
-
538
- .${ClassName.TABLE_NODE_WRAPPER}
539
- > table
540
- > tbody
541
- > tr
542
- > th[data-reaches-bottom][data-reaches-left],
543
- .${ClassName.TABLE_NODE_WRAPPER}
544
- > table
545
- > tbody
546
- > tr
547
- > td[data-reaches-bottom][data-reaches-left] {
548
- border-bottom-left-radius: 0;
549
-
550
- &::after,
551
- &::before {
552
- border-bottom-left-radius: 0;
553
- }
554
- }
555
-
556
- /* Preserve rounded numbered-column corners across normal, active, and danger states. */
557
- .${ClassName.NUMBERED_COLUMN_BUTTON}:first-of-type {
558
- border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
559
- }
560
-
561
- .${ClassName.NUMBERED_COLUMN_BUTTON}:last-of-type {
562
- border-bottom-left-radius: ${"var(--ds-radius-medium, 6px)"};
563
- }
564
-
565
- .${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_IN_DANGER}:first-of-type,
566
- .${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_ACTIVE}:first-of-type,
567
- .${ClassName.NUMBERED_COLUMN_BUTTON}.active:first-of-type {
568
- border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
569
- }
570
-
571
- .${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_IN_DANGER}:last-of-type,
572
- .${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_ACTIVE}:last-of-type,
573
- .${ClassName.NUMBERED_COLUMN_BUTTON}.active:last-of-type {
574
- border-bottom-left-radius: ${"var(--ds-radius-medium, 6px)"};
575
- }
576
-
577
- .${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_IN_DANGER}:first-of-type::after {
578
- border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
579
- }
580
-
581
- .${ClassName.NUMBERED_COLUMN_BUTTON}.${ClassName.HOVERED_CELL_IN_DANGER}:last-of-type::after {
582
- border-bottom-left-radius: ${"var(--ds-radius-medium, 6px)"};
583
- }
584
-
585
- /* Sticky numbered-column mask also needs the same top-left radius. */
586
- .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW}
587
- tr
588
- th[data-reaches-top][data-reaches-left]::before {
589
- border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
590
- }
591
- }
592
- `;
593
- const roundedTableStickyHeaderStyles = () => css`
594
- /* Sticky header rows have independent border/shadow/mask painting, so patch the sticky-only painters too. */
595
- .${ClassName.TABLE_NODE_WRAPPER}
596
- > table
597
- > tbody
598
- > tr.${ClassName.NATIVE_STICKY},
599
- .${ClassName.TABLE_NODE_WRAPPER}
600
- > table.${ClassName.TABLE_STICKY}
601
- > tbody
602
- > tr.sticky {
603
- > th[data-reaches-left],
604
- > td[data-reaches-left] {
605
- border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
606
-
607
- &::after,
608
- &::before {
609
- border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
610
- }
611
- }
612
-
613
- > td[data-reaches-right],
614
- > th[data-reaches-right] {
615
- border-top-right-radius: ${"var(--ds-radius-medium, 6px)"};
616
-
617
- &::after,
618
- &::before {
619
- border-top-right-radius: ${"var(--ds-radius-medium, 6px)"};
620
- }
621
- }
622
- }
623
-
624
- .${ClassName.TABLE_STICKY} .${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
625
- border-left-color: transparent;
626
- }
627
-
628
- .${ClassName.TABLE_CONTAINER}[data-number-column='true'] .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} tr th[data-reaches-top][data-reaches-left]::before,
629
- .${ClassName.TABLE_CONTAINER}[data-number-column='true'] .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} tr.${ClassName.NATIVE_STICKY} th[data-reaches-left]::before,
630
- .${ClassName.TABLE_CONTAINER}[data-number-column='true'] .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} .${ClassName.NATIVE_STICKY_ACTIVE} th[data-reaches-left]::before {
631
- border-top-left-radius: ${"var(--ds-radius-medium, 6px)"};
632
- clip-path: inset(0 0 0 0 round ${"var(--ds-radius-medium, 6px)"} 0 0 0);
633
- box-shadow: none !important;
634
- }
635
-
636
- .${ClassName.TABLE_NODE_WRAPPER}
637
- > table
638
- > tbody
639
- > tr.${ClassName.NATIVE_STICKY},
640
- .${ClassName.TABLE_NODE_WRAPPER}
641
- > table.${ClassName.TABLE_STICKY}
642
- > tbody
643
- > tr.sticky {
644
- box-shadow: none !important;
645
- }
646
-
647
- .${ClassName.TABLE_CONTAINER}.${ClassName.WITH_CONTROLS}:has(tr.sticky)
648
- .${ClassName.NUMBERED_COLUMN}
649
- .${ClassName.NUMBERED_COLUMN_BUTTON}:first-of-type {
650
- box-shadow: none !important;
651
- }
652
- `;
653
- const roundedTableOverrides = () => css`
654
- ${roundedTableCellCornerStyles()}
655
- ${roundedTableInteractionOverlayStyles()}
656
- ${roundedTableNumberedColumnStyles()}
657
- ${roundedTableStickyHeaderStyles()}
658
- `;
659
223
  const baseTableStylesWithoutSharedStyle = props => css`
660
224
  ${columnControlsLineMarker()};
661
225
  ${hoveredDeleteButton()};
@@ -916,23 +480,14 @@ const baseTableStylesWithoutSharedStyle = props => css`
916
480
  height: 0;
917
481
  margin-bottom: -${tableMarginTop}px;
918
482
  position: sticky;
919
- border-top: ${tableMarginTop}px solid
920
- ${expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? `var(${akEditorTableContainerBg}, ${"var(--ds-surface, #FFFFFF)"})` : "var(--ds-surface, #FFFFFF)"};
483
+ border-top: ${tableMarginTop}px solid transparent;
921
484
  z-index: ${stickyRowZIndex};
922
485
  }
923
486
 
924
- /** When cleaning up, merge this with the mask style above */
925
- ${fg('platform_editor_table_sticky_header_patch_2') ? `
926
- .${ClassName.TABLE_NODE_WRAPPER}:has(tr.${ClassName.NATIVE_STICKY})::before {
927
- border-top: ${tableMarginTop}px solid transparent;
928
- }
929
-
930
- .${ClassName.TABLE_NODE_WRAPPER}:has(tr.${ClassName.NATIVE_STICKY_ACTIVE})::before {
931
- border-top: ${tableMarginTop}px solid ${expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? `var(${akEditorTableContainerBg}, ${"var(--ds-surface, #FFFFFF)"})` : "var(--ds-surface, #FFFFFF)"};
932
- }` : fg('platform_editor_table_sticky_header_patch_1') ? `
933
- .${ClassName.TABLE_NODE_WRAPPER}:has(tr.${ClassName.NATIVE_STICKY})::before {
934
- margin-top: 1px;
935
- }` : ``}
487
+ .${ClassName.TABLE_NODE_WRAPPER}:has(tr.${ClassName.NATIVE_STICKY_ACTIVE})::before {
488
+ border-top: ${tableMarginTop}px solid
489
+ ${expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? `var(${akEditorTableContainerBg}, ${"var(--ds-surface, #FFFFFF)"})` : "var(--ds-surface, #FFFFFF)"};
490
+ }
936
491
 
937
492
  /** Corrects position of drag row controls when sticky header top mask is present */
938
493
  .${ClassName.TABLE_CONTAINER}:has(.${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW})
@@ -1631,6 +1186,9 @@ const baseTableStylesWithoutSharedStyle = props => css`
1631
1186
  position-area: top center;
1632
1187
  position-visibility: anchors-visible;
1633
1188
  z-index: ${nativeStickyHeaderZIndex + 1};
1189
+ ${expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? `
1190
+ /* Leave a 1px gap so the sticky header row's top border stays visible. */
1191
+ translate: 0 -1px;` : ``}
1634
1192
  }` : `.${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} > .${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER} {
1635
1193
  /* +2px is to overlap the table border on the sides */
1636
1194
  width: calc(anchor-size(width) + 2px);
@@ -1640,6 +1198,9 @@ const baseTableStylesWithoutSharedStyle = props => css`
1640
1198
  position-area: top center;
1641
1199
  position-visibility: anchors-visible;
1642
1200
  z-index: ${nativeStickyHeaderZIndex + 1};
1201
+ ${expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? `
1202
+ /* Leave a 1px gap so the sticky header row's top border stays visible. */
1203
+ margin-bottom: 1px;` : ``}
1643
1204
  }`}
1644
1205
 
1645
1206
  /** Mask for content to the left of the column controls */
@@ -1662,16 +1223,17 @@ const baseTableStylesWithoutSharedStyle = props => css`
1662
1223
  display: inline-block;
1663
1224
  box-sizing: border-box;
1664
1225
  left: 0;
1665
- width: ${akEditorTableNumberColumnWidth - 1}px;
1666
- height: 100%;
1667
- margin-left: -${akEditorTableNumberColumnWidth}px;
1668
- margin-top: -${stickyRowOffsetTop}px;
1669
- outline: ${expValEquals('platform_editor_table_sticky_header_patch_9', 'isEnabled', true) ? `0.5px solid ${tableBorderColor}` : `1px solid ${tableBorderColor}`};
1670
- border-left: ${expValEquals('platform_editor_table_sticky_header_patch_9', 'isEnabled', true) ? 'none' : `1px solid ${tableBorderColor}`};
1226
+ width: ${expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? `${akEditorTableNumberColumnWidth}px` : `${akEditorTableNumberColumnWidth - 1}px`};
1227
+ height: ${expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? 'calc(100% + 2px)' : '100%'};
1228
+ margin-left: ${expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? `-${akEditorTableNumberColumnWidth + 1}px` : `-${akEditorTableNumberColumnWidth}px`};
1229
+ margin-top: ${expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? `-${stickyRowOffsetTop + 1}px` : `-${stickyRowOffsetTop}px`};
1230
+ outline: ${expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? 'none' : expValEquals('platform_editor_table_sticky_header_patch_9', 'isEnabled', true) ? `0.5px solid ${tableBorderColor}` : `1px solid ${tableBorderColor}`};
1231
+ border-left: ${expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? `1px solid ${tableBorderColor}` : expValEquals('platform_editor_table_sticky_header_patch_9', 'isEnabled', true) ? 'none' : `1px solid ${tableBorderColor}`};
1232
+ ${expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? `border-bottom: 1px solid ${tableBorderColor};` : ``}
1671
1233
  background: ${"var(--ds-background-accent-gray-subtlest, #F0F1F2)"};
1672
1234
  ${fg('platform_editor_table_sticky_header_patch_1') ? `border-top: 1px solid ${tableBorderColor};` : ``}
1673
1235
 
1674
- ${getBrowserInfo().gecko && expValEquals('platform_editor_table_sticky_header_patch_9', 'isEnabled', true) ? `border-top: 1px solid ${tableBorderColor};` : `border-top: none;`}
1236
+ ${expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) || getBrowserInfo().gecko && expValEquals('platform_editor_table_sticky_header_patch_9', 'isEnabled', true) ? `border-top: 1px solid ${tableBorderColor};` : `border-top: none;`}
1675
1237
  }
1676
1238
 
1677
1239
  ${fg('platform_editor_table_sticky_header_patch_7') ? `.ak-editor-selected-node .${ClassName.TABLE_CONTAINER}[data-number-column="true"]:not(.${ClassName.TABLE_SELECTED}) .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} tr:first-of-type th:first-of-type {
@@ -1688,6 +1250,7 @@ const baseTableStylesWithoutSharedStyle = props => css`
1688
1250
  .${ClassName.TABLE_CONTAINER}[data-number-column="true"].${ClassName.TABLE_SELECTED} .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} tr:first-of-type th.${ClassName.SELECTED_CELL}:not(.${ClassName.HOVERED_CELL_IN_DANGER}):first-of-type::before, .${ClassName.TABLE_CONTAINER}[data-number-column="true"] .${ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW} tr:first-of-type th.${ClassName.SELECTED_CELL}:not(.${ClassName.HOVERED_CELL_IN_DANGER}, .${ClassName.COLUMN_SELECTED}):first-of-type::before {
1689
1251
  outline: none;
1690
1252
  border-left-color: ${tableBorderSelectedColor};
1253
+ ${expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? `border-bottom-color: ${tableBorderSelectedColor}` : ''};
1691
1254
  ${fg('platform_editor_table_sticky_header_patch_1') ? `border-top-color: ${tableBorderSelectedColor};` : ``}
1692
1255
  background: ${tableHeaderCellSelectedColor};
1693
1256
  }