@atlaskit/adf-schema 44.0.0 → 44.2.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 (81) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/index.js +24 -0
  3. package/dist/cjs/next-schema/generated/markTypes.js +3 -0
  4. package/dist/cjs/next-schema/generated/nodeTypes.js +77 -1
  5. package/dist/cjs/next-schema/groups/blockContentGroup.js +4 -2
  6. package/dist/cjs/next-schema/groups/blockGroup.js +4 -2
  7. package/dist/cjs/next-schema/groups/nonNestableBlockContentGroup.js +4 -2
  8. package/dist/cjs/next-schema/groups/tableCellContentPseudoGroup.js +2 -2
  9. package/dist/cjs/next-schema/marks/breakout.js +5 -0
  10. package/dist/cjs/next-schema/nodes/extensionFrame.js +4 -2
  11. package/dist/cjs/next-schema/nodes/tableNodes.js +166 -0
  12. package/dist/cjs/schema/default-schema.js +5 -1
  13. package/dist/cjs/schema/index.js +24 -0
  14. package/dist/cjs/schema/marks/breakout.js +6 -2
  15. package/dist/cjs/schema/nodes/index.js +24 -0
  16. package/dist/cjs/schema/nodes/tableNodes.js +52 -40
  17. package/dist/cjs/validator-schema/generated/validatorSpec.js +4 -0
  18. package/dist/es2019/index.js +1 -1
  19. package/dist/es2019/next-schema/generated/markTypes.js +3 -0
  20. package/dist/es2019/next-schema/generated/nodeTypes.js +76 -0
  21. package/dist/es2019/next-schema/groups/blockContentGroup.js +4 -2
  22. package/dist/es2019/next-schema/groups/blockGroup.js +4 -2
  23. package/dist/es2019/next-schema/groups/nonNestableBlockContentGroup.js +4 -2
  24. package/dist/es2019/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
  25. package/dist/es2019/next-schema/marks/breakout.js +5 -0
  26. package/dist/es2019/next-schema/nodes/extensionFrame.js +4 -2
  27. package/dist/es2019/next-schema/nodes/tableNodes.js +160 -0
  28. package/dist/es2019/schema/default-schema.js +6 -2
  29. package/dist/es2019/schema/index.js +1 -1
  30. package/dist/es2019/schema/marks/breakout.js +6 -2
  31. package/dist/es2019/schema/nodes/index.js +1 -1
  32. package/dist/es2019/schema/nodes/tableNodes.js +23 -14
  33. package/dist/es2019/validator-schema/generated/validatorSpec.js +4 -0
  34. package/dist/esm/index.js +1 -1
  35. package/dist/esm/next-schema/generated/markTypes.js +3 -0
  36. package/dist/esm/next-schema/generated/nodeTypes.js +76 -0
  37. package/dist/esm/next-schema/groups/blockContentGroup.js +4 -2
  38. package/dist/esm/next-schema/groups/blockGroup.js +4 -2
  39. package/dist/esm/next-schema/groups/nonNestableBlockContentGroup.js +4 -2
  40. package/dist/esm/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
  41. package/dist/esm/next-schema/marks/breakout.js +5 -0
  42. package/dist/esm/next-schema/nodes/extensionFrame.js +4 -2
  43. package/dist/esm/next-schema/nodes/tableNodes.js +161 -0
  44. package/dist/esm/schema/default-schema.js +6 -2
  45. package/dist/esm/schema/index.js +1 -1
  46. package/dist/esm/schema/marks/breakout.js +6 -2
  47. package/dist/esm/schema/nodes/index.js +1 -1
  48. package/dist/esm/schema/nodes/tableNodes.js +52 -43
  49. package/dist/esm/validator-schema/generated/validatorSpec.js +4 -0
  50. package/dist/json-schema/v1/full.json +3 -0
  51. package/dist/json-schema/v1/stage-0.json +3 -0
  52. package/dist/types/index.d.ts +1 -1
  53. package/dist/types/next-schema/generated/markTypes.d.ts +1 -0
  54. package/dist/types/next-schema/generated/nodeGroupTypes.d.ts +3 -3
  55. package/dist/types/next-schema/generated/nodeTypes.d.ts +52 -4
  56. package/dist/types/next-schema/groups/nonNestableBlockContentGroup.d.ts +1 -55
  57. package/dist/types/next-schema/groups/tableCellContentPseudoGroup.d.ts +71 -0
  58. package/dist/types/next-schema/nodes/tableNodes.d.ts +2 -0
  59. package/dist/types/schema/index.d.ts +2 -2
  60. package/dist/types/schema/nodes/index.d.ts +2 -2
  61. package/dist/types/schema/nodes/tableNodes.d.ts +27 -0
  62. package/dist/types/validator-schema/generated/validatorSpec.d.ts +4 -0
  63. package/json-schema/v1/full.json +3 -0
  64. package/json-schema/v1/stage-0.json +3 -0
  65. package/package.json +2 -2
  66. package/dist/cjs/next-schema/nodes/table.js +0 -53
  67. package/dist/cjs/next-schema/nodes/tableCell.js +0 -50
  68. package/dist/cjs/next-schema/nodes/tableHeader.js +0 -50
  69. package/dist/cjs/next-schema/nodes/tableRow.js +0 -26
  70. package/dist/es2019/next-schema/nodes/table.js +0 -47
  71. package/dist/es2019/next-schema/nodes/tableCell.js +0 -44
  72. package/dist/es2019/next-schema/nodes/tableHeader.js +0 -44
  73. package/dist/es2019/next-schema/nodes/tableRow.js +0 -20
  74. package/dist/esm/next-schema/nodes/table.js +0 -47
  75. package/dist/esm/next-schema/nodes/tableCell.js +0 -44
  76. package/dist/esm/next-schema/nodes/tableHeader.js +0 -44
  77. package/dist/esm/next-schema/nodes/tableRow.js +0 -20
  78. package/dist/types/next-schema/nodes/table.d.ts +0 -1
  79. package/dist/types/next-schema/nodes/tableCell.d.ts +0 -1
  80. package/dist/types/next-schema/nodes/tableHeader.d.ts +0 -1
  81. package/dist/types/next-schema/nodes/tableRow.d.ts +0 -1
@@ -2,10 +2,7 @@ import { hexToEditorBackgroundPaletteRawValue } from '../../utils/editor-palette
2
2
  import { B100, B50, B75, G200, G50, G75, hexToRgba, isHex, isRgb, N0, N20, N60, N800, P100, P50, P75, R100, R50, R75, rgbToHex, T100, T50, T75, Y200, Y50, Y75 } from '../../utils/colors';
3
3
  import { uuid } from '../../utils/uuid';
4
4
  import { getDarkModeLCHColor } from '../../utils/lch-color-inversion';
5
- import { table as tableFactory } from '../../next-schema/generated/nodeTypes';
6
- import { tableCell as tableCellFactory } from '../../next-schema/generated/nodeTypes';
7
- import { tableHeader as tableHeaderFactory } from '../../next-schema/generated/nodeTypes';
8
- import { tableRow as tableRowFactory } from '../../next-schema/generated/nodeTypes';
5
+ import { table as tableFactory, tableWithNestedTable as tableWithNestedTableFactory, tableRow as tableRowFactory, tableRowWithNestedTable as tableRowWithNestedTableFactory, tableHeader as tableHeaderFactory, tableHeaderWithNestedTable as tableHeaderWithNestedTableFactory, tableCell as tableCellFactory, tableCellWithNestedTable as tableCellWithNestedTableFactory } from '../../next-schema/generated/nodeTypes';
9
6
  export const tablePrefixSelector = 'pm-table';
10
7
  export const tableCellSelector = `${tablePrefixSelector}-cell-content-wrap`;
11
8
  export const tableHeaderSelector = `${tablePrefixSelector}-header-content-wrap`;
@@ -201,8 +198,9 @@ export const tableBackgroundColorNames = new Map();
201
198
  * @name table_header_node
202
199
  */
203
200
 
204
- // TODO: Fix any, potential issue. ED-5048
205
- const createTableSpec = () => tableFactory({
201
+ // table nodes with nested tables support
202
+
203
+ const tableNodeSpecOptions = {
206
204
  parseDOM: [{
207
205
  tag: 'table',
208
206
  getAttrs: node => {
@@ -233,7 +231,9 @@ const createTableSpec = () => tableFactory({
233
231
  };
234
232
  return ['table', attrs, ['tbody', 0]];
235
233
  }
236
- });
234
+ };
235
+ // TODO: Fix any, potential issue. ED-5048
236
+ const createTableSpec = () => tableFactory(tableNodeSpecOptions);
237
237
 
238
238
  // TODO: assuming breaking changes aren't allowed, so retaining both exports
239
239
  /** Includes table width attribute */
@@ -250,14 +250,15 @@ export const tableToJSON = node => ({
250
250
  };
251
251
  }, {})
252
252
  });
253
- export const tableRow = tableRowFactory({
253
+ const tableRowNodeSpecOptions = {
254
254
  parseDOM: [{
255
255
  tag: 'tr'
256
256
  }],
257
257
  toDOM() {
258
258
  return ['tr', 0];
259
259
  }
260
- });
260
+ };
261
+ export const tableRow = tableRowFactory(tableRowNodeSpecOptions);
261
262
  const cellAttrs = {
262
263
  colspan: {
263
264
  default: 1
@@ -272,7 +273,7 @@ const cellAttrs = {
272
273
  default: null
273
274
  }
274
275
  };
275
- export const tableCell = tableCellFactory({
276
+ const tableCellNodeSpecOptions = {
276
277
  parseDOM: [
277
278
  // Ignore number cell copied from renderer
278
279
  {
@@ -283,7 +284,8 @@ export const tableCell = tableCellFactory({
283
284
  getAttrs: dom => getCellAttrs(dom)
284
285
  }],
285
286
  toDOM: node => ['td', getCellDomAttrs(node), 0]
286
- });
287
+ };
288
+ export const tableCell = tableCellFactory(tableCellNodeSpecOptions);
287
289
  export const toJSONTableCell = node => ({
288
290
  attrs: Object.keys(node.attrs).reduce((obj, key) => {
289
291
  if (cellAttrs[key].default !== node.attrs[key]) {
@@ -292,7 +294,7 @@ export const toJSONTableCell = node => ({
292
294
  return obj;
293
295
  }, {})
294
296
  });
295
- export const tableHeader = tableHeaderFactory({
297
+ const tableHeaderNodeSpecOptions = {
296
298
  parseDOM: [{
297
299
  tag: 'th',
298
300
  getAttrs: dom => getCellAttrs(dom, {
@@ -300,5 +302,12 @@ export const tableHeader = tableHeaderFactory({
300
302
  })
301
303
  }],
302
304
  toDOM: node => ['th', getCellDomAttrs(node), 0]
303
- });
304
- export const toJSONTableHeader = toJSONTableCell;
305
+ };
306
+ export const tableHeader = tableHeaderFactory(tableHeaderNodeSpecOptions);
307
+ export const toJSONTableHeader = toJSONTableCell;
308
+
309
+ // table nodes with nested table support
310
+ export const tableWithNestedTable = tableWithNestedTableFactory(tableNodeSpecOptions);
311
+ export const tableRowWithNestedTable = tableRowWithNestedTableFactory(tableRowNodeSpecOptions);
312
+ export const tableCellWithNestedTable = tableCellWithNestedTableFactory(tableCellNodeSpecOptions);
313
+ export const tableHeaderWithNestedTable = tableHeaderWithNestedTableFactory(tableHeaderNodeSpecOptions);
@@ -1733,6 +1733,10 @@ export const breakout = {
1733
1733
  mode: {
1734
1734
  type: 'enum',
1735
1735
  values: ['wide', 'full-width']
1736
+ },
1737
+ width: {
1738
+ type: 'number',
1739
+ optional: true
1736
1740
  }
1737
1741
  }
1738
1742
  }
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockquote, blockquoteWithList, blockquoteWithNestedCodeblockOrMedia, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
2
- colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, emoji, expand, expandWithNestedExpand, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, layoutColumn, layoutSection, link, linkToJSON, listItem, listItemWithTask, listItemWithDecisionStage0, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleSpec, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, extendedPanel, panelWithBlockquoteStage0, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableStage0, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, extensionFrame, multiBodiedExtension, backgroundColor, backgroundColorPalette } from './schema';
2
+ colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, emoji, expand, expandWithNestedExpand, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, layoutColumn, layoutSection, link, linkToJSON, listItem, listItemWithTask, listItemWithDecisionStage0, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleSpec, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, extendedPanel, panelWithBlockquoteStage0, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableStage0, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, extensionFrame, multiBodiedExtension, backgroundColor, backgroundColorPalette, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable } from './schema';
3
3
  export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, linkify, linkifyMatch, normalizeHexColor, normalizeUrl, rgbToHex, uuid, getDarkModeLCHColor } from './utils';
4
4
 
5
5
  // ADF createPMSpecFactory
@@ -44,6 +44,9 @@ export var breakout = createPMMarkSpecFactory({
44
44
  attrs: {
45
45
  mode: {
46
46
  default: 'wide'
47
+ },
48
+ width: {
49
+ default: null
47
50
  }
48
51
  },
49
52
  inclusive: false,
@@ -1030,6 +1030,34 @@ export var table = createPMNodeSpecFactory({
1030
1030
  isolating: true,
1031
1031
  tableRole: 'table'
1032
1032
  });
1033
+ export var tableWithNestedTable = createPMNodeSpecFactory({
1034
+ content: 'tableRow+',
1035
+ marks: 'unsupportedMark unsupportedNodeAttribute',
1036
+ group: 'block',
1037
+ attrs: {
1038
+ displayMode: {
1039
+ default: null
1040
+ },
1041
+ isNumberColumnEnabled: {
1042
+ default: false
1043
+ },
1044
+ layout: {
1045
+ default: 'default'
1046
+ },
1047
+ localId: {
1048
+ default: ''
1049
+ },
1050
+ width: {
1051
+ default: null
1052
+ },
1053
+ __autoSize: {
1054
+ default: false
1055
+ }
1056
+ },
1057
+ selectable: true,
1058
+ isolating: true,
1059
+ tableRole: 'table'
1060
+ });
1033
1061
  export var tableCell = createPMNodeSpecFactory({
1034
1062
  content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand | unsupportedBlock)+',
1035
1063
  marks: 'alignment unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
@@ -1051,6 +1079,27 @@ export var tableCell = createPMNodeSpecFactory({
1051
1079
  isolating: true,
1052
1080
  tableRole: 'cell'
1053
1081
  });
1082
+ export var tableCellWithNestedTable = createPMNodeSpecFactory({
1083
+ content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand | unsupportedBlock | table)+',
1084
+ marks: 'alignment unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
1085
+ attrs: {
1086
+ colspan: {
1087
+ default: 1
1088
+ },
1089
+ rowspan: {
1090
+ default: 1
1091
+ },
1092
+ colwidth: {
1093
+ default: null
1094
+ },
1095
+ background: {
1096
+ default: null
1097
+ }
1098
+ },
1099
+ selectable: false,
1100
+ isolating: true,
1101
+ tableRole: 'cell'
1102
+ });
1054
1103
  export var tableHeader = createPMNodeSpecFactory({
1055
1104
  content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand)+',
1056
1105
  marks: 'alignment unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
@@ -1072,12 +1121,39 @@ export var tableHeader = createPMNodeSpecFactory({
1072
1121
  isolating: true,
1073
1122
  tableRole: 'header_cell'
1074
1123
  });
1124
+ export var tableHeaderWithNestedTable = createPMNodeSpecFactory({
1125
+ content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand | table)+',
1126
+ marks: 'alignment unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
1127
+ attrs: {
1128
+ colspan: {
1129
+ default: 1
1130
+ },
1131
+ rowspan: {
1132
+ default: 1
1133
+ },
1134
+ colwidth: {
1135
+ default: null
1136
+ },
1137
+ background: {
1138
+ default: null
1139
+ }
1140
+ },
1141
+ selectable: false,
1142
+ isolating: true,
1143
+ tableRole: 'header_cell'
1144
+ });
1075
1145
  export var tableRow = createPMNodeSpecFactory({
1076
1146
  content: '(tableCell | tableHeader)+',
1077
1147
  marks: 'unsupportedMark unsupportedNodeAttribute',
1078
1148
  selectable: false,
1079
1149
  tableRole: 'row'
1080
1150
  });
1151
+ export var tableRowWithNestedTable = createPMNodeSpecFactory({
1152
+ content: '(tableCell | tableHeader)+',
1153
+ marks: 'unsupportedMark unsupportedNodeAttribute',
1154
+ selectable: false,
1155
+ tableRole: 'row'
1156
+ });
1081
1157
  export var taskItem = createPMNodeSpecFactory({
1082
1158
  content: 'inline*',
1083
1159
  marks: '_',
@@ -15,7 +15,7 @@ import { mediaSingle } from '../nodes/mediaSingle';
15
15
  import { panel } from '../nodes/panel';
16
16
  import { paragraph } from '../nodes/paragraph';
17
17
  import { rule } from '../nodes/rule';
18
- import { table } from '../nodes/table';
18
+ import { table } from '../nodes/tableNodes';
19
19
  import { taskList } from '../nodes/task';
20
20
  import { unsupportedBlock } from '../nodes/unsupportedBlock';
21
21
 
@@ -32,6 +32,8 @@ import { unsupportedBlock } from '../nodes/unsupportedBlock';
32
32
  * - no base heading
33
33
  * - no base expand
34
34
  */
35
- export var blockContentGroup = adfNodeGroup('block_content', [blockCard, paragraph.use('with_no_marks'), paragraph.use('with_alignment'), paragraph.use('with_indentation'), mediaSingle.use('caption'), mediaSingle.use('full'), codeBlock.use('with_no_marks'), taskList, bulletList, orderedList, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), mediaGroup, decisionList, rule, panel, panel.use('with_nested_blockquote'), blockquote, blockquote.use('without_nested_codeblock_or_media'), extension.use('with_marks'), embedCard, table, expand.use('without_nested_expand'), expand.use('with_no_mark'), bodiedExtension.use('with_marks'), confluenceUnsupportedBlock, unsupportedBlock], {
35
+ export var blockContentGroup = adfNodeGroup('block_content', [blockCard, paragraph.use('with_no_marks'), paragraph.use('with_alignment'), paragraph.use('with_indentation'), mediaSingle.use('caption'), mediaSingle.use('full'), codeBlock.use('with_no_marks'), taskList, bulletList, orderedList, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), mediaGroup, decisionList, rule, panel, panel.use('with_nested_blockquote'), blockquote, blockquote.use('without_nested_codeblock_or_media'), extension.use('with_marks'), embedCard, table,
36
+ // @ts-expect-error - types don't deal well with circular references for the variant
37
+ table.use('with_nested_table'), expand.use('without_nested_expand'), expand.use('with_no_mark'), bodiedExtension.use('with_marks'), confluenceUnsupportedBlock, unsupportedBlock], {
36
38
  ignore: ['pm-spec', 'json-schema']
37
39
  });
@@ -15,10 +15,12 @@ import { mediaSingle } from '../nodes/mediaSingle';
15
15
  import { panel } from '../nodes/panel';
16
16
  import { paragraph } from '../nodes/paragraph';
17
17
  import { rule } from '../nodes/rule';
18
- import { table } from '../nodes/table';
18
+ import { table } from '../nodes/tableNodes';
19
19
  import { taskList } from '../nodes/task';
20
20
  import { unsupportedBlock } from '../nodes/unsupportedBlock';
21
- export var blockGroup = adfNodeGroup('block', [blockCard, codeBlock, codeBlock.use('with_marks'), codeBlock.use('with_no_marks'), mediaSingle, mediaSingle.use('caption'), mediaSingle.use('full'), mediaSingle.use('width_type'), paragraph, paragraph.use('with_alignment'), paragraph.use('with_indentation'), paragraph.use('with_no_marks'), taskList, orderedList, bulletList, blockquote, blockquote.use('legacy'), blockquote.use('without_nested_codeblock_or_media'), decisionList, embedCard, extension, extension.use('with_marks'), heading, heading.use('with_indentation'), heading.use('with_no_marks'), heading.use('with_alignment'), mediaGroup, rule, panel, panel.use('with_nested_blockquote'), table, bodiedExtension, bodiedExtension.use('with_marks'), expand, expand.use('with_no_mark'), expand.use('with_breakout_mark'), expand.use('without_nested_expand'), confluenceUnsupportedBlock, unsupportedBlock], {
21
+ export var blockGroup = adfNodeGroup('block', [blockCard, codeBlock, codeBlock.use('with_marks'), codeBlock.use('with_no_marks'), mediaSingle, mediaSingle.use('caption'), mediaSingle.use('full'), mediaSingle.use('width_type'), paragraph, paragraph.use('with_alignment'), paragraph.use('with_indentation'), paragraph.use('with_no_marks'), taskList, orderedList, bulletList, blockquote, blockquote.use('legacy'), blockquote.use('without_nested_codeblock_or_media'), decisionList, embedCard, extension, extension.use('with_marks'), heading, heading.use('with_indentation'), heading.use('with_no_marks'), heading.use('with_alignment'), mediaGroup, rule, panel, panel.use('with_nested_blockquote'), table,
22
+ // @ts-expect-error - types don't deal well with circular references for the variant
23
+ table.use('with_nested_table'), bodiedExtension, bodiedExtension.use('with_marks'), expand, expand.use('with_no_mark'), expand.use('with_breakout_mark'), expand.use('without_nested_expand'), confluenceUnsupportedBlock, unsupportedBlock], {
22
24
  // @DSLCompatibilityException
23
25
  // Block group in PM doesn't match ADF
24
26
  ignore: ['validator-spec']
@@ -12,13 +12,15 @@ import { mediaSingle } from '../nodes/mediaSingle';
12
12
  import { panel } from '../nodes/panel';
13
13
  import { paragraph } from '../nodes/paragraph';
14
14
  import { rule } from '../nodes/rule';
15
- import { table } from '../nodes/table';
15
+ import { table } from '../nodes/tableNodes';
16
16
  import { taskList } from '../nodes/task';
17
17
  import { unsupportedBlock } from '../nodes/unsupportedBlock';
18
18
 
19
19
  // Not an actual group, but a collection of nodes that can't be nested inside each other
20
20
  // TODO: make it an actual group
21
- export var nonNestableBlockContent = [paragraph.use('with_no_marks'), panel, blockquote, orderedList, bulletList, rule, heading.use('with_no_marks'), codeBlock.use('with_no_marks'), mediaGroup, mediaSingle.use('caption'), mediaSingle.use('full'), decisionList, taskList, table, blockCard, embedCard, extension.use('with_marks'), unsupportedBlock];
21
+ export var nonNestableBlockContent = [paragraph.use('with_no_marks'), panel, blockquote, orderedList, bulletList, rule, heading.use('with_no_marks'), codeBlock.use('with_no_marks'), mediaGroup, mediaSingle.use('caption'), mediaSingle.use('full'), decisionList, taskList, table,
22
+ // @ts-expect-error - types don't deal well with circular references for the variant
23
+ table.use('with_nested_table'), blockCard, embedCard, extension.use('with_marks'), unsupportedBlock];
22
24
 
23
25
  /**
24
26
  * @DSLCompatibilityException
@@ -15,7 +15,7 @@ import { paragraph } from '../nodes/paragraph';
15
15
  import { rule } from '../nodes/rule';
16
16
  import { taskList } from '../nodes/task';
17
17
  import { unsupportedBlock } from '../nodes/unsupportedBlock';
18
- var tableCellContentNodes = [paragraph.use('with_no_marks'), paragraph.use('with_alignment'), panel, blockquote, orderedList, bulletList, rule, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), codeBlock.use('with_no_marks'), mediaSingle.use('caption'), mediaSingle.use('full'), mediaGroup, decisionList, taskList, blockCard, embedCard, extension.use('with_marks'), nestedExpand.use('content'), nestedExpand.use('with_no_marks')];
18
+ export var tableCellContentNodes = [paragraph.use('with_no_marks'), paragraph.use('with_alignment'), panel, blockquote, orderedList, bulletList, rule, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), codeBlock.use('with_no_marks'), mediaSingle.use('caption'), mediaSingle.use('full'), mediaGroup, decisionList, taskList, blockCard, embedCard, extension.use('with_marks'), nestedExpand.use('content'), nestedExpand.use('with_no_marks')];
19
19
 
20
20
  // This is not an actual group, but a collection of nodes
21
21
  // @DSLCompatibilityException JSON Schema and PM Spec are not in sync. We need to fix it
@@ -7,6 +7,11 @@ export var breakout = adfMark('breakout').define({
7
7
  type: 'enum',
8
8
  values: ['wide', 'full-width'],
9
9
  default: 'wide'
10
+ },
11
+ width: {
12
+ type: 'number',
13
+ default: null,
14
+ optional: true
10
15
  }
11
16
  }
12
17
  });
@@ -17,7 +17,7 @@ import { mediaSingle } from './mediaSingle';
17
17
  import { panel } from './panel';
18
18
  import { paragraph } from './paragraph';
19
19
  import { rule } from './rule';
20
- import { table } from './table';
20
+ import { table } from './tableNodes';
21
21
  import { taskList } from './task';
22
22
  import { unsupportedBlock } from './unsupportedBlock';
23
23
  export var extensionFrame = adfNode('extensionFrame').define({
@@ -30,7 +30,9 @@ export var extensionFrame = adfNode('extensionFrame').define({
30
30
  // packages/adf-schema-generator/src/transforms/adfToPm/buildPmSpec.ts
31
31
  marks: [dataConsumer, fragment, unsupportedMark, unsupportedNodeAttribute],
32
32
  attrs: {},
33
- content: [$onePlus($or(paragraph.use('with_no_marks'), panel, blockquote, orderedList, bulletList, rule, heading.use('with_no_marks'), codeBlock.use('with_no_marks'), mediaGroup, mediaSingle.use('full'), mediaSingle.use('caption'), decisionList, taskList, table, extension.use('with_marks'), bodiedExtension.use('with_marks'), unsupportedBlock, blockCard, embedCard))],
33
+ content: [$onePlus($or(paragraph.use('with_no_marks'), panel, blockquote, orderedList, bulletList, rule, heading.use('with_no_marks'), codeBlock.use('with_no_marks'), mediaGroup, mediaSingle.use('full'), mediaSingle.use('caption'), decisionList, taskList, table,
34
+ // @ts-expect-error - types don't deal well with circular references for the variant
35
+ table.use('with_nested_table'), extension.use('with_marks'), bodiedExtension.use('with_marks'), unsupportedBlock, blockCard, embedCard))],
34
36
  DANGEROUS_MANUAL_OVERRIDE: {
35
37
  'validator-spec': {
36
38
  'props.content.allowUnsupportedBlock': {
@@ -0,0 +1,161 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import { $onePlus, $or, adfNode } from '@atlaskit/adf-schema-generator';
3
+ import { fragment } from '../marks/fragment';
4
+ import { unsupportedMark } from '../marks/unsupportedMark';
5
+ import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
6
+ import { tableCellContentPseudoGroup, tableCellContentNodes, tableHeaderContentPseudoGroup } from '../groups/tableCellContentPseudoGroup';
7
+ import { tableCellContent } from './tableCellContent';
8
+ import { nestedExpand } from './nestedExpand';
9
+ import { unsupportedBlock } from './unsupportedBlock';
10
+
11
+ // Declare early to allow for circular references within the file
12
+ var table = adfNode('table');
13
+ var tableCell = adfNode('tableCell').define({
14
+ isolating: true,
15
+ selectable: false,
16
+ tableRole: 'cell',
17
+ marks: [unsupportedMark, unsupportedNodeAttribute],
18
+ attrs: {
19
+ colspan: {
20
+ type: 'number',
21
+ default: 1,
22
+ optional: true
23
+ },
24
+ rowspan: {
25
+ type: 'number',
26
+ default: 1,
27
+ optional: true
28
+ },
29
+ colwidth: {
30
+ type: 'array',
31
+ items: {
32
+ type: 'number'
33
+ },
34
+ default: null,
35
+ optional: true
36
+ },
37
+ background: {
38
+ type: 'string',
39
+ default: null,
40
+ optional: true
41
+ }
42
+ },
43
+ content: [tableCellContentPseudoGroup],
44
+ DANGEROUS_MANUAL_OVERRIDE: {
45
+ 'validator-spec': {
46
+ required: {
47
+ reason: '@DSLCompatibilityException - required for tableCell validator spec',
48
+ value: ['content']
49
+ }
50
+ }
51
+ }
52
+ }).variant('with_nested_table', {
53
+ content: [$onePlus($or.apply(void 0, _toConsumableArray(tableCellContentNodes).concat([unsupportedBlock, table])))],
54
+ ignore: ['json-schema', 'validator-spec']
55
+ });
56
+ var tableHeader = adfNode('tableHeader').define({
57
+ isolating: true,
58
+ selectable: false,
59
+ tableRole: 'header_cell',
60
+ marks: [unsupportedMark, unsupportedNodeAttribute],
61
+ attrs: {
62
+ colspan: {
63
+ type: 'number',
64
+ default: 1,
65
+ optional: true
66
+ },
67
+ rowspan: {
68
+ type: 'number',
69
+ default: 1,
70
+ optional: true
71
+ },
72
+ colwidth: {
73
+ type: 'array',
74
+ items: {
75
+ type: 'number'
76
+ },
77
+ default: null,
78
+ optional: true
79
+ },
80
+ background: {
81
+ type: 'string',
82
+ default: null,
83
+ optional: true
84
+ }
85
+ },
86
+ content: [tableHeaderContentPseudoGroup],
87
+ DANGEROUS_MANUAL_OVERRIDE: {
88
+ 'validator-spec': {
89
+ required: {
90
+ reason: '@DSLCompatibilityException - required for tableHeader validator spec',
91
+ value: ['content']
92
+ }
93
+ }
94
+ }
95
+ }).variant('with_nested_table', {
96
+ content: [$onePlus($or.apply(void 0, _toConsumableArray(tableCellContentNodes).concat([nestedExpand, table])))],
97
+ ignore: ['json-schema', 'validator-spec']
98
+ });
99
+ var tableRow = adfNode('tableRow').define({
100
+ selectable: false,
101
+ marks: [unsupportedMark, unsupportedNodeAttribute],
102
+ content: [$onePlus($or(tableCell, tableHeader, tableCellContent))],
103
+ tableRole: 'row',
104
+ DANGEROUS_MANUAL_OVERRIDE: {
105
+ 'validator-spec': {
106
+ 'props.content.minItems': {
107
+ reason: '@DSLCompatibilityException - required for tableRow validator spec',
108
+ remove: true
109
+ }
110
+ }
111
+ }
112
+ }).variant('with_nested_table', {
113
+ content: [$onePlus($or(tableCell.use('with_nested_table'), tableHeader.use('with_nested_table')))],
114
+ ignore: ['json-schema', 'validator-spec']
115
+ });
116
+ table.define({
117
+ isolating: true,
118
+ selectable: true,
119
+ tableRole: 'table',
120
+ marks: [fragment, unsupportedMark, unsupportedNodeAttribute],
121
+ attrs: {
122
+ displayMode: {
123
+ type: 'enum',
124
+ values: ['default', 'fixed'],
125
+ default: null,
126
+ optional: true
127
+ },
128
+ isNumberColumnEnabled: {
129
+ type: 'boolean',
130
+ default: false,
131
+ optional: true
132
+ },
133
+ layout: {
134
+ type: 'enum',
135
+ values: ['wide', 'full-width', 'center', 'align-end', 'align-start', 'default'],
136
+ default: 'default',
137
+ optional: true
138
+ },
139
+ localId: {
140
+ type: 'string',
141
+ minLength: 1,
142
+ default: '',
143
+ optional: true
144
+ },
145
+ width: {
146
+ type: 'number',
147
+ default: null,
148
+ optional: true
149
+ },
150
+ __autoSize: {
151
+ type: 'boolean',
152
+ default: false,
153
+ optional: true
154
+ }
155
+ },
156
+ content: [$onePlus($or(tableRow))]
157
+ }).variant('with_nested_table', {
158
+ content: [$onePlus($or(tableRow.use('with_nested_table')))],
159
+ ignore: ['json-schema', 'validator-spec']
160
+ });
161
+ export { table };
@@ -1,5 +1,5 @@
1
1
  import memoizeOne from 'memoize-one';
2
- import { extensionFrame, layoutSectionWithSingleColumn, multiBodiedExtension, expandWithNestedExpand, blockquoteWithNestedCodeblockOrMedia, listItemWithDecisionStage0, panelWithBlockquoteStage0 } from './nodes';
2
+ import { extensionFrame, layoutSectionWithSingleColumn, multiBodiedExtension, expandWithNestedExpand, blockquoteWithNestedCodeblockOrMedia, listItemWithDecisionStage0, panelWithBlockquoteStage0, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable } from './nodes';
3
3
  import { createSchema } from './create-schema';
4
4
  var getDefaultSchemaConfig = function getDefaultSchemaConfig() {
5
5
  var defaultSchemaConfig = {
@@ -22,7 +22,11 @@ export var getSchemaBasedOnStage = memoizeOne(function () {
22
22
  expand: expandWithNestedExpand,
23
23
  blockquote: blockquoteWithNestedCodeblockOrMedia,
24
24
  listItem: listItemWithDecisionStage0,
25
- panel: panelWithBlockquoteStage0(true)
25
+ panel: panelWithBlockquoteStage0(true),
26
+ table: tableWithNestedTable,
27
+ tableRow: tableRowWithNestedTable,
28
+ tableCell: tableCellWithNestedTable,
29
+ tableHeader: tableHeaderWithNestedTable
26
30
  };
27
31
  }
28
32
  return createSchema(defaultSchemaConfig);
@@ -1,4 +1,4 @@
1
- export { PanelType, blockCard, blockquote, blockquoteWithList, blockquoteWithNestedCodeblockOrMedia, bodiedExtension, bulletList, bulletListSelector, caption, codeBlock, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, decisionItem, decisionList, decisionListSelector, doc, embedCard, emoji, expand, expandWithNestedExpand, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineExtension, layoutColumn, layoutSection, layoutSectionWithSingleColumn, listItem, listItemWithTask, listItemWithDecisionStage0, media, mediaGroup, mediaSingle, mediaSingleSpec, mediaInline, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, extendedPanel, panelWithBlockquoteStage0, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableStage0, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline, extensionFrame, multiBodiedExtension } from './nodes';
1
+ export { PanelType, blockCard, blockquote, blockquoteWithList, blockquoteWithNestedCodeblockOrMedia, bodiedExtension, bulletList, bulletListSelector, caption, codeBlock, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, decisionItem, decisionList, decisionListSelector, doc, embedCard, emoji, expand, expandWithNestedExpand, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineExtension, layoutColumn, layoutSection, layoutSectionWithSingleColumn, listItem, listItemWithTask, listItemWithDecisionStage0, media, mediaGroup, mediaSingle, mediaSingleSpec, mediaInline, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, extendedPanel, panelWithBlockquoteStage0, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableStage0, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline, extensionFrame, multiBodiedExtension, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable } from './nodes';
2
2
  export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
3
3
  colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, backgroundColor, backgroundColorPalette } from './marks';
4
4
  export { unsupportedNodeTypesForMediaCards } from './unsupported';
@@ -10,15 +10,19 @@ export var breakout = breakoutFactory({
10
10
  tag: 'div.fabric-editor-breakout-mark',
11
11
  getAttrs: function getAttrs(dom) {
12
12
  var mode = dom.getAttribute('data-mode');
13
+ var width = dom.getAttribute('data-width');
13
14
  return {
14
- mode: allowedTypes.indexOf(mode || '') === -1 ? 'wide' : mode
15
+ mode: allowedTypes.indexOf(mode || '') === -1 ? 'wide' : mode,
16
+ width: width ? parseInt(width) : null
15
17
  };
16
18
  }
17
19
  }],
18
20
  toDOM: function toDOM(mark) {
21
+ var _mark$attrs;
19
22
  return ['div', {
20
23
  class: 'fabric-editor-breakout-mark',
21
- 'data-mode': mark.attrs.mode
24
+ 'data-mode': mark.attrs.mode,
25
+ 'data-width': (_mark$attrs = mark.attrs) === null || _mark$attrs === void 0 ? void 0 : _mark$attrs.width
22
26
  }, 0];
23
27
  }
24
28
  });
@@ -23,7 +23,7 @@ export { media, copyPrivateAttributes as copyPrivateMediaAttributes, toJSON as m
23
23
  export { mediaGroup } from './media-group';
24
24
  export { mediaInline } from './media-inline';
25
25
  export { mediaSingle, mediaSingleSpec, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, toJSON as mediaSingleToJSON } from './media-single';
26
- export { table, tableStage0, tableWithCustomWidth, tableToJSON, tableCell, toJSONTableCell, tableHeader, toJSONTableHeader, tableRow, tableBackgroundColorPalette, tableBackgroundBorderColor, tableBackgroundColorNames, getCellAttrs, getCellDomAttrs, tablePrefixSelector, tableCellSelector, tableHeaderSelector, tableCellContentWrapperSelector, tableCellContentDomSelector } from './tableNodes';
26
+ export { table, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, tableStage0, tableWithCustomWidth, tableToJSON, tableCell, toJSONTableCell, tableHeader, toJSONTableHeader, tableRow, tableBackgroundColorPalette, tableBackgroundBorderColor, tableBackgroundColorNames, getCellAttrs, getCellDomAttrs, tablePrefixSelector, tableCellSelector, tableHeaderSelector, tableCellContentWrapperSelector, tableCellContentDomSelector } from './tableNodes';
27
27
  export { decisionList, decisionListSelector } from './decision-list';
28
28
  export { decisionItem } from './decision-item';
29
29
  export { taskList, taskListSelector } from './task-list';