@atlaskit/adf-schema 37.1.22 → 37.1.23

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 (33) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/next-schema/groups/tableCellContentPseudoGroup.js +32 -0
  3. package/dist/cjs/next-schema/nodes/bodiedExtension.js +1 -2
  4. package/dist/cjs/next-schema/nodes/codeBlock.js +2 -2
  5. package/dist/cjs/next-schema/nodes/expand.js +2 -2
  6. package/dist/cjs/next-schema/nodes/layoutSection.js +2 -3
  7. package/dist/cjs/next-schema/nodes/tableCell.js +2 -17
  8. package/dist/cjs/next-schema/nodes/tableCellContent.js +14 -0
  9. package/dist/cjs/next-schema/nodes/tableHeader.js +2 -16
  10. package/dist/cjs/next-schema/nodes/tableRow.js +2 -1
  11. package/dist/es2019/next-schema/groups/tableCellContentPseudoGroup.js +26 -0
  12. package/dist/es2019/next-schema/nodes/bodiedExtension.js +1 -2
  13. package/dist/es2019/next-schema/nodes/codeBlock.js +2 -2
  14. package/dist/es2019/next-schema/nodes/expand.js +2 -2
  15. package/dist/es2019/next-schema/nodes/layoutSection.js +2 -3
  16. package/dist/es2019/next-schema/nodes/tableCell.js +3 -18
  17. package/dist/es2019/next-schema/nodes/tableCellContent.js +9 -0
  18. package/dist/es2019/next-schema/nodes/tableHeader.js +3 -17
  19. package/dist/es2019/next-schema/nodes/tableRow.js +2 -1
  20. package/dist/esm/next-schema/groups/tableCellContentPseudoGroup.js +26 -0
  21. package/dist/esm/next-schema/nodes/bodiedExtension.js +1 -2
  22. package/dist/esm/next-schema/nodes/codeBlock.js +2 -2
  23. package/dist/esm/next-schema/nodes/expand.js +2 -2
  24. package/dist/esm/next-schema/nodes/layoutSection.js +2 -3
  25. package/dist/esm/next-schema/nodes/tableCell.js +3 -18
  26. package/dist/esm/next-schema/nodes/tableCellContent.js +9 -0
  27. package/dist/esm/next-schema/nodes/tableHeader.js +3 -17
  28. package/dist/esm/next-schema/nodes/tableRow.js +2 -1
  29. package/dist/types/next-schema/groups/tableCellContentPseudoGroup.d.ts +2 -0
  30. package/dist/types/next-schema/nodes/tableCellContent.d.ts +40 -0
  31. package/package.json +2 -2
  32. package/schema-generators/__tests__/unit/json-full-schema-backwards-compat.unit.ts +0 -14
  33. package/schema-generators/__tests__/unit/__fixtures__/index.fixture.ts +0 -140
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 37.1.23
4
+
5
+ ### Patch Changes
6
+
7
+ - e0280dc: Add backwards compatability for bodied extension, code block, expand, layout section, non-nestable block content
8
+
3
9
  ## 37.1.22
4
10
 
5
11
  ### Patch Changes
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.tableHeaderContentPseudoGroup = exports.tableCellContentPseudoGroup = void 0;
7
+ var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
8
+ var _blockCard = require("../nodes/blockCard");
9
+ var _blockquote = require("../nodes/blockquote");
10
+ var _codeBlock = require("../nodes/codeBlock");
11
+ var _decisionList = require("../nodes/decisionList");
12
+ var _embedCard = require("../nodes/embedCard");
13
+ var _extension = require("../nodes/extension");
14
+ var _heading = require("../nodes/heading");
15
+ var _list = require("../nodes/list");
16
+ var _mediaGroup = require("../nodes/mediaGroup");
17
+ var _mediaSingle = require("../nodes/mediaSingle");
18
+ var _nestedExpand = require("../nodes/nestedExpand");
19
+ var _panel = require("../nodes/panel");
20
+ var _paragraph = require("../nodes/paragraph");
21
+ var _rule = require("../nodes/rule");
22
+ var _task = require("../nodes/task");
23
+ var _unsupportedBlock = require("../nodes/unsupportedBlock");
24
+ var tableCellContentNodes = [_codeBlock.codeBlock.use('with_no_marks'), _blockCard.blockCard, _paragraph.paragraph.use('with_no_marks'), _paragraph.paragraph.use('with_alignment'), _mediaSingle.mediaSingle.use('caption'), _mediaSingle.mediaSingle.use('full'), _task.taskList, _list.bulletList, _list.orderedList, _heading.heading.use('with_no_marks'), _heading.heading.use('with_alignment'), _heading.heading.use('with_indentation'), _mediaGroup.mediaGroup, _decisionList.decisionList, _rule.rule, _panel.panel, _blockquote.blockquote, _extension.extension.use('with_marks'), _embedCard.embedCard, _nestedExpand.nestedExpand.use('with_no_marks')];
25
+
26
+ // This is not an actual group, but a collection of nodes
27
+ // @DSLCompatibilityException JSON Schema and PM Spec are not in sync. We need to fix it
28
+ // In PM Spec, they contain different items. (tableHeader using tableHeaderContentPseudoGroup, tableCell using tableCellContentPseudoGroup)
29
+ // In JSON Schema, both tableHeader and tableCell points to tableCellContentPseudoGroup
30
+ // The differences are highighted below.
31
+ var tableCellContentPseudoGroup = exports.tableCellContentPseudoGroup = (0, _adfSchemaGenerator.$onePlus)(_adfSchemaGenerator.$or.apply(void 0, tableCellContentNodes.concat([_unsupportedBlock.unsupportedBlock])));
32
+ var tableHeaderContentPseudoGroup = exports.tableHeaderContentPseudoGroup = (0, _adfSchemaGenerator.$onePlus)(_adfSchemaGenerator.$or.apply(void 0, tableCellContentNodes.concat([_nestedExpand.nestedExpand])));
@@ -50,8 +50,7 @@ var bodiedExtension = exports.bodiedExtension = (0, _adfSchemaGenerator.adfNode)
50
50
  default: null
51
51
  }
52
52
  },
53
- content: [(0, _adfSchemaGenerator.$onePlus)((0, _adfSchemaGenerator.$or)(_nonNestableBlockContentGroup.nonNestableBlockContentGroup))],
54
- ignore: ['json-schema']
53
+ content: [(0, _adfSchemaGenerator.$onePlus)((0, _adfSchemaGenerator.$or)(_nonNestableBlockContentGroup.nonNestableBlockContentGroup))]
55
54
  }).variant('with_marks', {
56
55
  marks: [_dataConsumer.dataConsumer, _fragment.fragment, _unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark],
57
56
  content: [],
@@ -14,6 +14,7 @@ var codeBlock = exports.codeBlock = (0, _adfSchemaGenerator.adfNode)('codeBlock'
14
14
  code: true,
15
15
  defining: true,
16
16
  marks: [_unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark],
17
+ hasEmptyMarks: true,
17
18
  attrs: {
18
19
  language: {
19
20
  type: 'string',
@@ -26,8 +27,7 @@ var codeBlock = exports.codeBlock = (0, _adfSchemaGenerator.adfNode)('codeBlock'
26
27
  optional: true
27
28
  }
28
29
  },
29
- content: [(0, _adfSchemaGenerator.$zeroPlus)((0, _adfSchemaGenerator.$or)(_text.text, _unsupportedInline.unsupportedInline))],
30
- ignore: ['json-schema']
30
+ content: [(0, _adfSchemaGenerator.$zeroPlus)((0, _adfSchemaGenerator.$or)(_text.text, _unsupportedInline.unsupportedInline))]
31
31
  }).variant('with_marks', {
32
32
  marks: [_breakout.breakout, _unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark],
33
33
  ignore: ['pm-spec']
@@ -13,6 +13,7 @@ var expand = exports.expand = (0, _adfSchemaGenerator.adfNode)('expand').define(
13
13
  isolating: true,
14
14
  selectable: true,
15
15
  marks: [_unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark],
16
+ hasEmptyMarks: true,
16
17
  attrs: {
17
18
  title: {
18
19
  type: 'string',
@@ -25,8 +26,7 @@ var expand = exports.expand = (0, _adfSchemaGenerator.adfNode)('expand').define(
25
26
  optional: true
26
27
  }
27
28
  },
28
- content: [(0, _adfSchemaGenerator.$onePlus)((0, _adfSchemaGenerator.$or)(_nonNestableBlockContentGroup.nonNestableBlockContentGroup))],
29
- ignore: ['json-schema']
29
+ content: [(0, _adfSchemaGenerator.$onePlus)((0, _adfSchemaGenerator.$or)(_nonNestableBlockContentGroup.nonNestableBlockContentGroup))]
30
30
  }).variant('with_breakout_mark', {
31
31
  marks: [_breakout.breakout, _unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark],
32
32
  content: [],
@@ -13,13 +13,12 @@ var _unsupportedBlock = require("./unsupportedBlock");
13
13
  var layoutSection = exports.layoutSection = (0, _adfSchemaGenerator.adfNode)('layoutSection').define({
14
14
  isolating: true,
15
15
  marks: [_breakout.breakout, _unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark],
16
- content: [(0, _adfSchemaGenerator.$range)(1, 3, (0, _adfSchemaGenerator.$or)(_layoutColumn.layoutColumn, _unsupportedBlock.unsupportedBlock))],
17
- ignore: ['json-schema'],
16
+ content: [(0, _adfSchemaGenerator.$or)(_layoutColumn.layoutColumn, _unsupportedBlock.unsupportedBlock)],
18
17
  DANGEROUS_MANUAL_OVERRIDE: {
19
18
  'pm-spec': {
20
19
  content: {
21
20
  value: '(layoutColumn | unsupportedBlock){1,3} unsupportedBlock* | unsupportedBlock+',
22
- reason: "The content expression is not correct or redundant around 'unsupportedBlock* | unsupportedBlock+'. This case is not supported by the DSL."
21
+ reason: "The content expression is not correct or redundant around 'unsupportedBlock* | unsupportedBlock+'. This case is not supported by the DSL. Also in JSON schema there is no range for the items, so theres a mismatch between JSON and PM."
23
22
  }
24
23
  }
25
24
  }
@@ -7,22 +7,7 @@ exports.tableCell = void 0;
7
7
  var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
8
8
  var _unsupportedMark = require("../marks/unsupportedMark");
9
9
  var _unsupportedNodeAttribute = require("../marks/unsupportedNodeAttribute");
10
- var _blockCard = require("./blockCard");
11
- var _blockquote = require("./blockquote");
12
- var _codeBlock = require("./codeBlock");
13
- var _decisionList = require("./decisionList");
14
- var _embedCard = require("./embedCard");
15
- var _extension = require("./extension");
16
- var _heading = require("./heading");
17
- var _list = require("./list");
18
- var _mediaGroup = require("./mediaGroup");
19
- var _mediaSingle = require("./mediaSingle");
20
- var _nestedExpand = require("./nestedExpand");
21
- var _panel = require("./panel");
22
- var _paragraph = require("./paragraph");
23
- var _rule = require("./rule");
24
- var _task = require("./task");
25
- var _unsupportedBlock = require("./unsupportedBlock");
10
+ var _tableCellContentPseudoGroup = require("../groups/tableCellContentPseudoGroup");
26
11
  var tableCell = exports.tableCell = (0, _adfSchemaGenerator.adfNode)('tableCell').define({
27
12
  isolating: true,
28
13
  selectable: false,
@@ -53,5 +38,5 @@ var tableCell = exports.tableCell = (0, _adfSchemaGenerator.adfNode)('tableCell'
53
38
  optional: true
54
39
  }
55
40
  },
56
- content: [(0, _adfSchemaGenerator.$onePlus)((0, _adfSchemaGenerator.$or)(_codeBlock.codeBlock.use('with_no_marks'), _blockCard.blockCard, _paragraph.paragraph.use('with_no_marks'), _paragraph.paragraph.use('with_alignment'), _mediaSingle.mediaSingle.use('caption'), _mediaSingle.mediaSingle.use('full'), _task.taskList, _list.bulletList, _list.orderedList, _heading.heading.use('with_no_marks'), _heading.heading.use('with_alignment'), _heading.heading.use('with_indentation'), _mediaGroup.mediaGroup, _decisionList.decisionList, _rule.rule, _panel.panel, _blockquote.blockquote, _extension.extension.use('with_marks'), _embedCard.embedCard, _nestedExpand.nestedExpand.use('with_no_marks'), _unsupportedBlock.unsupportedBlock))]
41
+ content: [_tableCellContentPseudoGroup.tableCellContentPseudoGroup]
57
42
  });
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.tableCellContent = void 0;
7
+ var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
8
+ var _tableCellContentPseudoGroup = require("../groups/tableCellContentPseudoGroup");
9
+ // @DSLCompatibilityException This is only used by JSON schema to group the table cell content into a definition.
10
+ // This node should be deleted and the content should be replicated in the JSON schema for table header and table cell node
11
+ var tableCellContent = exports.tableCellContent = (0, _adfSchemaGenerator.adfNode)('tableCellContent').define({
12
+ ignore: ['pm-spec', 'validator-spec'],
13
+ content: [_tableCellContentPseudoGroup.tableCellContentPseudoGroup]
14
+ });
@@ -5,23 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.tableHeader = void 0;
7
7
  var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
8
+ var _tableCellContentPseudoGroup = require("../groups/tableCellContentPseudoGroup");
8
9
  var _unsupportedMark = require("../marks/unsupportedMark");
9
10
  var _unsupportedNodeAttribute = require("../marks/unsupportedNodeAttribute");
10
- var _blockCard = require("./blockCard");
11
- var _blockquote = require("./blockquote");
12
- var _codeBlock = require("./codeBlock");
13
- var _decisionList = require("./decisionList");
14
- var _embedCard = require("./embedCard");
15
- var _extension = require("./extension");
16
- var _heading = require("./heading");
17
- var _list = require("./list");
18
- var _mediaGroup = require("./mediaGroup");
19
- var _mediaSingle = require("./mediaSingle");
20
- var _nestedExpand = require("./nestedExpand");
21
- var _panel = require("./panel");
22
- var _paragraph = require("./paragraph");
23
- var _rule = require("./rule");
24
- var _task = require("./task");
25
11
  var tableHeader = exports.tableHeader = (0, _adfSchemaGenerator.adfNode)('tableHeader').define({
26
12
  isolating: true,
27
13
  selectable: false,
@@ -52,5 +38,5 @@ var tableHeader = exports.tableHeader = (0, _adfSchemaGenerator.adfNode)('tableH
52
38
  optional: true
53
39
  }
54
40
  },
55
- content: [(0, _adfSchemaGenerator.$onePlus)((0, _adfSchemaGenerator.$or)(_codeBlock.codeBlock.use('with_no_marks'), _blockCard.blockCard, _paragraph.paragraph.use('with_no_marks'), _paragraph.paragraph.use('with_alignment'), _mediaSingle.mediaSingle.use('caption'), _mediaSingle.mediaSingle.use('full'), _task.taskList, _list.bulletList, _list.orderedList, _heading.heading.use('with_no_marks'), _heading.heading.use('with_alignment'), _heading.heading.use('with_indentation'), _mediaGroup.mediaGroup, _decisionList.decisionList, _rule.rule, _panel.panel, _blockquote.blockquote, _extension.extension.use('with_marks'), _embedCard.embedCard, _nestedExpand.nestedExpand, _nestedExpand.nestedExpand.use('with_no_marks')))]
41
+ content: [_tableCellContentPseudoGroup.tableHeaderContentPseudoGroup]
56
42
  });
@@ -9,9 +9,10 @@ var _unsupportedMark = require("../marks/unsupportedMark");
9
9
  var _unsupportedNodeAttribute = require("../marks/unsupportedNodeAttribute");
10
10
  var _tableCell = require("./tableCell");
11
11
  var _tableHeader = require("./tableHeader");
12
+ var _tableCellContent = require("./tableCellContent");
12
13
  var tableRow = exports.tableRow = (0, _adfSchemaGenerator.adfNode)('tableRow').define({
13
14
  selectable: false,
14
15
  marks: [_unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark],
15
- content: [(0, _adfSchemaGenerator.$onePlus)((0, _adfSchemaGenerator.$or)(_tableCell.tableCell, _tableHeader.tableHeader))],
16
+ content: [(0, _adfSchemaGenerator.$onePlus)((0, _adfSchemaGenerator.$or)(_tableCell.tableCell, _tableHeader.tableHeader, _tableCellContent.tableCellContent))],
16
17
  tableRole: 'row'
17
18
  });
@@ -0,0 +1,26 @@
1
+ import { $onePlus, $or } from '@atlaskit/adf-schema-generator';
2
+ import { blockCard } from '../nodes/blockCard';
3
+ import { blockquote } from '../nodes/blockquote';
4
+ import { codeBlock } from '../nodes/codeBlock';
5
+ import { decisionList } from '../nodes/decisionList';
6
+ import { embedCard } from '../nodes/embedCard';
7
+ import { extension } from '../nodes/extension';
8
+ import { heading } from '../nodes/heading';
9
+ import { bulletList, orderedList } from '../nodes/list';
10
+ import { mediaGroup } from '../nodes/mediaGroup';
11
+ import { mediaSingle } from '../nodes/mediaSingle';
12
+ import { nestedExpand } from '../nodes/nestedExpand';
13
+ import { panel } from '../nodes/panel';
14
+ import { paragraph } from '../nodes/paragraph';
15
+ import { rule } from '../nodes/rule';
16
+ import { taskList } from '../nodes/task';
17
+ import { unsupportedBlock } from '../nodes/unsupportedBlock';
18
+ const tableCellContentNodes = [codeBlock.use('with_no_marks'), blockCard, paragraph.use('with_no_marks'), paragraph.use('with_alignment'), mediaSingle.use('caption'), mediaSingle.use('full'), taskList, bulletList, orderedList, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), mediaGroup, decisionList, rule, panel, blockquote, extension.use('with_marks'), embedCard, nestedExpand.use('with_no_marks')];
19
+
20
+ // This is not an actual group, but a collection of nodes
21
+ // @DSLCompatibilityException JSON Schema and PM Spec are not in sync. We need to fix it
22
+ // In PM Spec, they contain different items. (tableHeader using tableHeaderContentPseudoGroup, tableCell using tableCellContentPseudoGroup)
23
+ // In JSON Schema, both tableHeader and tableCell points to tableCellContentPseudoGroup
24
+ // The differences are highighted below.
25
+ export const tableCellContentPseudoGroup = $onePlus($or(...tableCellContentNodes, unsupportedBlock));
26
+ export const tableHeaderContentPseudoGroup = $onePlus($or(...tableCellContentNodes, nestedExpand));
@@ -44,8 +44,7 @@ export const bodiedExtension = adfNode('bodiedExtension').define({
44
44
  default: null
45
45
  }
46
46
  },
47
- content: [$onePlus($or(nonNestableBlockContentGroup))],
48
- ignore: ['json-schema']
47
+ content: [$onePlus($or(nonNestableBlockContentGroup))]
49
48
  }).variant('with_marks', {
50
49
  marks: [dataConsumer, fragment, unsupportedNodeAttribute, unsupportedMark],
51
50
  content: [],
@@ -8,6 +8,7 @@ export const codeBlock = adfNode('codeBlock').define({
8
8
  code: true,
9
9
  defining: true,
10
10
  marks: [unsupportedNodeAttribute, unsupportedMark],
11
+ hasEmptyMarks: true,
11
12
  attrs: {
12
13
  language: {
13
14
  type: 'string',
@@ -20,8 +21,7 @@ export const codeBlock = adfNode('codeBlock').define({
20
21
  optional: true
21
22
  }
22
23
  },
23
- content: [$zeroPlus($or(text, unsupportedInline))],
24
- ignore: ['json-schema']
24
+ content: [$zeroPlus($or(text, unsupportedInline))]
25
25
  }).variant('with_marks', {
26
26
  marks: [breakout, unsupportedNodeAttribute, unsupportedMark],
27
27
  ignore: ['pm-spec']
@@ -7,6 +7,7 @@ export const expand = adfNode('expand').define({
7
7
  isolating: true,
8
8
  selectable: true,
9
9
  marks: [unsupportedNodeAttribute, unsupportedMark],
10
+ hasEmptyMarks: true,
10
11
  attrs: {
11
12
  title: {
12
13
  type: 'string',
@@ -19,8 +20,7 @@ export const expand = adfNode('expand').define({
19
20
  optional: true
20
21
  }
21
22
  },
22
- content: [$onePlus($or(nonNestableBlockContentGroup))],
23
- ignore: ['json-schema']
23
+ content: [$onePlus($or(nonNestableBlockContentGroup))]
24
24
  }).variant('with_breakout_mark', {
25
25
  marks: [breakout, unsupportedNodeAttribute, unsupportedMark],
26
26
  content: [],
@@ -7,13 +7,12 @@ import { unsupportedBlock } from './unsupportedBlock';
7
7
  export const layoutSection = adfNode('layoutSection').define({
8
8
  isolating: true,
9
9
  marks: [breakout, unsupportedNodeAttribute, unsupportedMark],
10
- content: [$range(1, 3, $or(layoutColumn, unsupportedBlock))],
11
- ignore: ['json-schema'],
10
+ content: [$or(layoutColumn, unsupportedBlock)],
12
11
  DANGEROUS_MANUAL_OVERRIDE: {
13
12
  'pm-spec': {
14
13
  content: {
15
14
  value: '(layoutColumn | unsupportedBlock){1,3} unsupportedBlock* | unsupportedBlock+',
16
- reason: `The content expression is not correct or redundant around 'unsupportedBlock* | unsupportedBlock+'. This case is not supported by the DSL.`
15
+ reason: `The content expression is not correct or redundant around 'unsupportedBlock* | unsupportedBlock+'. This case is not supported by the DSL. Also in JSON schema there is no range for the items, so theres a mismatch between JSON and PM.`
17
16
  }
18
17
  }
19
18
  }
@@ -1,22 +1,7 @@
1
- import { $onePlus, $or, adfNode } from '@atlaskit/adf-schema-generator';
1
+ import { adfNode } from '@atlaskit/adf-schema-generator';
2
2
  import { unsupportedMark } from '../marks/unsupportedMark';
3
3
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
4
- import { blockCard } from './blockCard';
5
- import { blockquote } from './blockquote';
6
- import { codeBlock } from './codeBlock';
7
- import { decisionList } from './decisionList';
8
- import { embedCard } from './embedCard';
9
- import { extension } from './extension';
10
- import { heading } from './heading';
11
- import { bulletList, orderedList } from './list';
12
- import { mediaGroup } from './mediaGroup';
13
- import { mediaSingle } from './mediaSingle';
14
- import { nestedExpand } from './nestedExpand';
15
- import { panel } from './panel';
16
- import { paragraph } from './paragraph';
17
- import { rule } from './rule';
18
- import { taskList } from './task';
19
- import { unsupportedBlock } from './unsupportedBlock';
4
+ import { tableCellContentPseudoGroup } from '../groups/tableCellContentPseudoGroup';
20
5
  export const tableCell = adfNode('tableCell').define({
21
6
  isolating: true,
22
7
  selectable: false,
@@ -47,5 +32,5 @@ export const tableCell = adfNode('tableCell').define({
47
32
  optional: true
48
33
  }
49
34
  },
50
- content: [$onePlus($or(codeBlock.use('with_no_marks'), blockCard, paragraph.use('with_no_marks'), paragraph.use('with_alignment'), mediaSingle.use('caption'), mediaSingle.use('full'), taskList, bulletList, orderedList, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), mediaGroup, decisionList, rule, panel, blockquote, extension.use('with_marks'), embedCard, nestedExpand.use('with_no_marks'), unsupportedBlock))]
35
+ content: [tableCellContentPseudoGroup]
51
36
  });
@@ -0,0 +1,9 @@
1
+ import { adfNode } from '@atlaskit/adf-schema-generator';
2
+ import { tableCellContentPseudoGroup } from '../groups/tableCellContentPseudoGroup';
3
+
4
+ // @DSLCompatibilityException This is only used by JSON schema to group the table cell content into a definition.
5
+ // This node should be deleted and the content should be replicated in the JSON schema for table header and table cell node
6
+ export const tableCellContent = adfNode('tableCellContent').define({
7
+ ignore: ['pm-spec', 'validator-spec'],
8
+ content: [tableCellContentPseudoGroup]
9
+ });
@@ -1,21 +1,7 @@
1
- import { $onePlus, $or, adfNode } from '@atlaskit/adf-schema-generator';
1
+ import { adfNode } from '@atlaskit/adf-schema-generator';
2
+ import { tableHeaderContentPseudoGroup } from '../groups/tableCellContentPseudoGroup';
2
3
  import { unsupportedMark } from '../marks/unsupportedMark';
3
4
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
4
- import { blockCard } from './blockCard';
5
- import { blockquote } from './blockquote';
6
- import { codeBlock } from './codeBlock';
7
- import { decisionList } from './decisionList';
8
- import { embedCard } from './embedCard';
9
- import { extension } from './extension';
10
- import { heading } from './heading';
11
- import { bulletList, orderedList } from './list';
12
- import { mediaGroup } from './mediaGroup';
13
- import { mediaSingle } from './mediaSingle';
14
- import { nestedExpand } from './nestedExpand';
15
- import { panel } from './panel';
16
- import { paragraph } from './paragraph';
17
- import { rule } from './rule';
18
- import { taskList } from './task';
19
5
  export const tableHeader = adfNode('tableHeader').define({
20
6
  isolating: true,
21
7
  selectable: false,
@@ -46,5 +32,5 @@ export const tableHeader = adfNode('tableHeader').define({
46
32
  optional: true
47
33
  }
48
34
  },
49
- content: [$onePlus($or(codeBlock.use('with_no_marks'), blockCard, paragraph.use('with_no_marks'), paragraph.use('with_alignment'), mediaSingle.use('caption'), mediaSingle.use('full'), taskList, bulletList, orderedList, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), mediaGroup, decisionList, rule, panel, blockquote, extension.use('with_marks'), embedCard, nestedExpand, nestedExpand.use('with_no_marks')))]
35
+ content: [tableHeaderContentPseudoGroup]
50
36
  });
@@ -3,9 +3,10 @@ import { unsupportedMark } from '../marks/unsupportedMark';
3
3
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
4
4
  import { tableCell } from './tableCell';
5
5
  import { tableHeader } from './tableHeader';
6
+ import { tableCellContent } from './tableCellContent';
6
7
  export const tableRow = adfNode('tableRow').define({
7
8
  selectable: false,
8
9
  marks: [unsupportedNodeAttribute, unsupportedMark],
9
- content: [$onePlus($or(tableCell, tableHeader))],
10
+ content: [$onePlus($or(tableCell, tableHeader, tableCellContent))],
10
11
  tableRole: 'row'
11
12
  });
@@ -0,0 +1,26 @@
1
+ import { $onePlus, $or } from '@atlaskit/adf-schema-generator';
2
+ import { blockCard } from '../nodes/blockCard';
3
+ import { blockquote } from '../nodes/blockquote';
4
+ import { codeBlock } from '../nodes/codeBlock';
5
+ import { decisionList } from '../nodes/decisionList';
6
+ import { embedCard } from '../nodes/embedCard';
7
+ import { extension } from '../nodes/extension';
8
+ import { heading } from '../nodes/heading';
9
+ import { bulletList, orderedList } from '../nodes/list';
10
+ import { mediaGroup } from '../nodes/mediaGroup';
11
+ import { mediaSingle } from '../nodes/mediaSingle';
12
+ import { nestedExpand } from '../nodes/nestedExpand';
13
+ import { panel } from '../nodes/panel';
14
+ import { paragraph } from '../nodes/paragraph';
15
+ import { rule } from '../nodes/rule';
16
+ import { taskList } from '../nodes/task';
17
+ import { unsupportedBlock } from '../nodes/unsupportedBlock';
18
+ var tableCellContentNodes = [codeBlock.use('with_no_marks'), blockCard, paragraph.use('with_no_marks'), paragraph.use('with_alignment'), mediaSingle.use('caption'), mediaSingle.use('full'), taskList, bulletList, orderedList, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), mediaGroup, decisionList, rule, panel, blockquote, extension.use('with_marks'), embedCard, nestedExpand.use('with_no_marks')];
19
+
20
+ // This is not an actual group, but a collection of nodes
21
+ // @DSLCompatibilityException JSON Schema and PM Spec are not in sync. We need to fix it
22
+ // In PM Spec, they contain different items. (tableHeader using tableHeaderContentPseudoGroup, tableCell using tableCellContentPseudoGroup)
23
+ // In JSON Schema, both tableHeader and tableCell points to tableCellContentPseudoGroup
24
+ // The differences are highighted below.
25
+ export var tableCellContentPseudoGroup = $onePlus($or.apply(void 0, tableCellContentNodes.concat([unsupportedBlock])));
26
+ export var tableHeaderContentPseudoGroup = $onePlus($or.apply(void 0, tableCellContentNodes.concat([nestedExpand])));
@@ -44,8 +44,7 @@ export var bodiedExtension = adfNode('bodiedExtension').define({
44
44
  default: null
45
45
  }
46
46
  },
47
- content: [$onePlus($or(nonNestableBlockContentGroup))],
48
- ignore: ['json-schema']
47
+ content: [$onePlus($or(nonNestableBlockContentGroup))]
49
48
  }).variant('with_marks', {
50
49
  marks: [dataConsumer, fragment, unsupportedNodeAttribute, unsupportedMark],
51
50
  content: [],
@@ -8,6 +8,7 @@ export var codeBlock = adfNode('codeBlock').define({
8
8
  code: true,
9
9
  defining: true,
10
10
  marks: [unsupportedNodeAttribute, unsupportedMark],
11
+ hasEmptyMarks: true,
11
12
  attrs: {
12
13
  language: {
13
14
  type: 'string',
@@ -20,8 +21,7 @@ export var codeBlock = adfNode('codeBlock').define({
20
21
  optional: true
21
22
  }
22
23
  },
23
- content: [$zeroPlus($or(text, unsupportedInline))],
24
- ignore: ['json-schema']
24
+ content: [$zeroPlus($or(text, unsupportedInline))]
25
25
  }).variant('with_marks', {
26
26
  marks: [breakout, unsupportedNodeAttribute, unsupportedMark],
27
27
  ignore: ['pm-spec']
@@ -7,6 +7,7 @@ export var expand = adfNode('expand').define({
7
7
  isolating: true,
8
8
  selectable: true,
9
9
  marks: [unsupportedNodeAttribute, unsupportedMark],
10
+ hasEmptyMarks: true,
10
11
  attrs: {
11
12
  title: {
12
13
  type: 'string',
@@ -19,8 +20,7 @@ export var expand = adfNode('expand').define({
19
20
  optional: true
20
21
  }
21
22
  },
22
- content: [$onePlus($or(nonNestableBlockContentGroup))],
23
- ignore: ['json-schema']
23
+ content: [$onePlus($or(nonNestableBlockContentGroup))]
24
24
  }).variant('with_breakout_mark', {
25
25
  marks: [breakout, unsupportedNodeAttribute, unsupportedMark],
26
26
  content: [],
@@ -7,13 +7,12 @@ import { unsupportedBlock } from './unsupportedBlock';
7
7
  export var layoutSection = adfNode('layoutSection').define({
8
8
  isolating: true,
9
9
  marks: [breakout, unsupportedNodeAttribute, unsupportedMark],
10
- content: [$range(1, 3, $or(layoutColumn, unsupportedBlock))],
11
- ignore: ['json-schema'],
10
+ content: [$or(layoutColumn, unsupportedBlock)],
12
11
  DANGEROUS_MANUAL_OVERRIDE: {
13
12
  'pm-spec': {
14
13
  content: {
15
14
  value: '(layoutColumn | unsupportedBlock){1,3} unsupportedBlock* | unsupportedBlock+',
16
- reason: "The content expression is not correct or redundant around 'unsupportedBlock* | unsupportedBlock+'. This case is not supported by the DSL."
15
+ reason: "The content expression is not correct or redundant around 'unsupportedBlock* | unsupportedBlock+'. This case is not supported by the DSL. Also in JSON schema there is no range for the items, so theres a mismatch between JSON and PM."
17
16
  }
18
17
  }
19
18
  }
@@ -1,22 +1,7 @@
1
- import { $onePlus, $or, adfNode } from '@atlaskit/adf-schema-generator';
1
+ import { adfNode } from '@atlaskit/adf-schema-generator';
2
2
  import { unsupportedMark } from '../marks/unsupportedMark';
3
3
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
4
- import { blockCard } from './blockCard';
5
- import { blockquote } from './blockquote';
6
- import { codeBlock } from './codeBlock';
7
- import { decisionList } from './decisionList';
8
- import { embedCard } from './embedCard';
9
- import { extension } from './extension';
10
- import { heading } from './heading';
11
- import { bulletList, orderedList } from './list';
12
- import { mediaGroup } from './mediaGroup';
13
- import { mediaSingle } from './mediaSingle';
14
- import { nestedExpand } from './nestedExpand';
15
- import { panel } from './panel';
16
- import { paragraph } from './paragraph';
17
- import { rule } from './rule';
18
- import { taskList } from './task';
19
- import { unsupportedBlock } from './unsupportedBlock';
4
+ import { tableCellContentPseudoGroup } from '../groups/tableCellContentPseudoGroup';
20
5
  export var tableCell = adfNode('tableCell').define({
21
6
  isolating: true,
22
7
  selectable: false,
@@ -47,5 +32,5 @@ export var tableCell = adfNode('tableCell').define({
47
32
  optional: true
48
33
  }
49
34
  },
50
- content: [$onePlus($or(codeBlock.use('with_no_marks'), blockCard, paragraph.use('with_no_marks'), paragraph.use('with_alignment'), mediaSingle.use('caption'), mediaSingle.use('full'), taskList, bulletList, orderedList, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), mediaGroup, decisionList, rule, panel, blockquote, extension.use('with_marks'), embedCard, nestedExpand.use('with_no_marks'), unsupportedBlock))]
35
+ content: [tableCellContentPseudoGroup]
51
36
  });
@@ -0,0 +1,9 @@
1
+ import { adfNode } from '@atlaskit/adf-schema-generator';
2
+ import { tableCellContentPseudoGroup } from '../groups/tableCellContentPseudoGroup';
3
+
4
+ // @DSLCompatibilityException This is only used by JSON schema to group the table cell content into a definition.
5
+ // This node should be deleted and the content should be replicated in the JSON schema for table header and table cell node
6
+ export var tableCellContent = adfNode('tableCellContent').define({
7
+ ignore: ['pm-spec', 'validator-spec'],
8
+ content: [tableCellContentPseudoGroup]
9
+ });
@@ -1,21 +1,7 @@
1
- import { $onePlus, $or, adfNode } from '@atlaskit/adf-schema-generator';
1
+ import { adfNode } from '@atlaskit/adf-schema-generator';
2
+ import { tableHeaderContentPseudoGroup } from '../groups/tableCellContentPseudoGroup';
2
3
  import { unsupportedMark } from '../marks/unsupportedMark';
3
4
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
4
- import { blockCard } from './blockCard';
5
- import { blockquote } from './blockquote';
6
- import { codeBlock } from './codeBlock';
7
- import { decisionList } from './decisionList';
8
- import { embedCard } from './embedCard';
9
- import { extension } from './extension';
10
- import { heading } from './heading';
11
- import { bulletList, orderedList } from './list';
12
- import { mediaGroup } from './mediaGroup';
13
- import { mediaSingle } from './mediaSingle';
14
- import { nestedExpand } from './nestedExpand';
15
- import { panel } from './panel';
16
- import { paragraph } from './paragraph';
17
- import { rule } from './rule';
18
- import { taskList } from './task';
19
5
  export var tableHeader = adfNode('tableHeader').define({
20
6
  isolating: true,
21
7
  selectable: false,
@@ -46,5 +32,5 @@ export var tableHeader = adfNode('tableHeader').define({
46
32
  optional: true
47
33
  }
48
34
  },
49
- content: [$onePlus($or(codeBlock.use('with_no_marks'), blockCard, paragraph.use('with_no_marks'), paragraph.use('with_alignment'), mediaSingle.use('caption'), mediaSingle.use('full'), taskList, bulletList, orderedList, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), mediaGroup, decisionList, rule, panel, blockquote, extension.use('with_marks'), embedCard, nestedExpand, nestedExpand.use('with_no_marks')))]
35
+ content: [tableHeaderContentPseudoGroup]
50
36
  });
@@ -3,9 +3,10 @@ import { unsupportedMark } from '../marks/unsupportedMark';
3
3
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
4
4
  import { tableCell } from './tableCell';
5
5
  import { tableHeader } from './tableHeader';
6
+ import { tableCellContent } from './tableCellContent';
6
7
  export var tableRow = adfNode('tableRow').define({
7
8
  selectable: false,
8
9
  marks: [unsupportedNodeAttribute, unsupportedMark],
9
- content: [$onePlus($or(tableCell, tableHeader))],
10
+ content: [$onePlus($or(tableCell, tableHeader, tableCellContent))],
10
11
  tableRole: 'row'
11
12
  });
@@ -0,0 +1,2 @@
1
+ export declare const tableCellContentPseudoGroup: import("@atlaskit/adf-schema-generator/dist/types/types/ADFNodeSpec").ADFNodeContentOneOrMoreSpec;
2
+ export declare const tableHeaderContentPseudoGroup: import("@atlaskit/adf-schema-generator/dist/types/types/ADFNodeSpec").ADFNodeContentOneOrMoreSpec;
@@ -0,0 +1,40 @@
1
+ export declare const tableCellContent: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
2
+ ignore?: import("@atlaskit/adf-schema-generator/dist/types/transforms/transformerNames").TransformerNames[];
3
+ root?: boolean;
4
+ atom?: boolean;
5
+ version?: 1;
6
+ attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
7
+ inline?: true;
8
+ code?: boolean;
9
+ content?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFNodeSpec").ADFNodeContentSpec[];
10
+ contentMinItems?: number;
11
+ contentMaxItems?: number;
12
+ defining?: boolean;
13
+ definingAsContext?: boolean;
14
+ definingForContent?: boolean;
15
+ draggable?: boolean;
16
+ group?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFNodeGroup").ADFNodeGroup;
17
+ isolating?: boolean;
18
+ marks?: import("@atlaskit/adf-schema-generator/dist/types/adfMark").ADFMark<unknown>[];
19
+ allowAnyChildMark?: boolean;
20
+ allowNoChildMark?: boolean;
21
+ noMarks?: boolean;
22
+ hasEmptyMarks?: boolean;
23
+ selectable?: boolean;
24
+ whitespace?: "pre" | "normal";
25
+ tableRole?: "table" | "row" | "cell" | "header_cell";
26
+ DANGEROUS_MANUAL_OVERRIDE?: {
27
+ 'pm-spec'?: {
28
+ [x: string]: {
29
+ value: any;
30
+ reason: string;
31
+ };
32
+ };
33
+ 'validator-spec'?: {
34
+ [x: string]: {
35
+ value: any;
36
+ reason: string;
37
+ };
38
+ };
39
+ };
40
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "37.1.22",
3
+ "version": "37.1.23",
4
4
  "description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "devDependencies": {
49
49
  "@atlassian/adf-schema-json": "^1.16.0",
50
- "@atlaskit/adf-schema-generator": "^1.25.1",
50
+ "@atlaskit/adf-schema-generator": "^1.25.2",
51
51
  "@atlaskit/adf-utils": "^19.2.2",
52
52
  "@atlaskit/codemod-utils": "^4.2.4",
53
53
  "@atlaskit/json-schema-generator": "^3.3.9",
@@ -1,10 +1,6 @@
1
1
  import { validateSchemaCompatibility } from 'json-schema-diff-validator';
2
2
  import { adfToJSON } from '@atlaskit/adf-schema-generator';
3
3
  import adfNode from '@atlaskit/adf-schema/src/next-schema/full-schema.adf';
4
- import {
5
- tableCellNodeContent,
6
- tableHeaderNodeContent,
7
- } from './__fixtures__/index.fixture';
8
4
 
9
5
  declare let expect: any;
10
6
  expect.extend({
@@ -45,19 +41,9 @@ expect.extend({
45
41
  function transformFullFixtureForKnownFailures(json) {
46
42
  const definitions = json.definitions;
47
43
 
48
- delete definitions.bodiedExtension_node;
49
- delete definitions.codeBlock_node;
50
- delete definitions.expand_node;
51
- delete definitions.layoutSection_node;
52
44
  delete definitions.nestedExpand_content;
53
45
  delete definitions.nestedExpand_node;
54
46
  delete definitions.nestedExpand_with_no_marks_node;
55
- delete definitions.non_nestable_block_content;
56
- delete definitions.table_cell_content;
57
-
58
- // New JSON, different to the old JSON schema
59
- definitions.table_cell_node.properties.content = tableCellNodeContent;
60
- definitions.table_header_node.properties.content = tableHeaderNodeContent;
61
47
 
62
48
  return json;
63
49
  }
@@ -1,140 +0,0 @@
1
- import { JSONSchema4 } from 'json-schema';
2
-
3
- export const tableCellNodeContent: JSONSchema4 = {
4
- type: 'array',
5
- items: {
6
- anyOf: [
7
- {
8
- $ref: '#/definitions/codeBlock_with_no_marks_node',
9
- },
10
- {
11
- $ref: '#/definitions/blockCard_node',
12
- },
13
- {
14
- $ref: '#/definitions/paragraph_with_no_marks_node',
15
- },
16
- {
17
- $ref: '#/definitions/paragraph_with_alignment_node',
18
- },
19
- {
20
- $ref: '#/definitions/mediaSingle_caption_node',
21
- },
22
- {
23
- $ref: '#/definitions/mediaSingle_full_node',
24
- },
25
- {
26
- $ref: '#/definitions/taskList_node',
27
- },
28
- {
29
- $ref: '#/definitions/bulletList_node',
30
- },
31
- {
32
- $ref: '#/definitions/orderedList_node',
33
- },
34
- {
35
- $ref: '#/definitions/heading_with_no_marks_node',
36
- },
37
- {
38
- $ref: '#/definitions/heading_with_alignment_node',
39
- },
40
- {
41
- $ref: '#/definitions/heading_with_indentation_node',
42
- },
43
- {
44
- $ref: '#/definitions/mediaGroup_node',
45
- },
46
- {
47
- $ref: '#/definitions/decisionList_node',
48
- },
49
- {
50
- $ref: '#/definitions/rule_node',
51
- },
52
- {
53
- $ref: '#/definitions/panel_node',
54
- },
55
- {
56
- $ref: '#/definitions/blockquote_node',
57
- },
58
- {
59
- $ref: '#/definitions/extension_with_marks_node',
60
- },
61
- {
62
- $ref: '#/definitions/embedCard_node',
63
- },
64
- {
65
- $ref: '#/definitions/nestedExpand_with_no_marks_node',
66
- },
67
- ],
68
- },
69
- minItems: 1,
70
- };
71
-
72
- export const tableHeaderNodeContent: JSONSchema4 = {
73
- type: 'array',
74
- items: {
75
- anyOf: [
76
- {
77
- $ref: '#/definitions/codeBlock_with_no_marks_node',
78
- },
79
- {
80
- $ref: '#/definitions/blockCard_node',
81
- },
82
- {
83
- $ref: '#/definitions/paragraph_with_no_marks_node',
84
- },
85
- {
86
- $ref: '#/definitions/paragraph_with_alignment_node',
87
- },
88
- {
89
- $ref: '#/definitions/mediaSingle_caption_node',
90
- },
91
- {
92
- $ref: '#/definitions/mediaSingle_full_node',
93
- },
94
- {
95
- $ref: '#/definitions/taskList_node',
96
- },
97
- {
98
- $ref: '#/definitions/bulletList_node',
99
- },
100
- {
101
- $ref: '#/definitions/orderedList_node',
102
- },
103
- {
104
- $ref: '#/definitions/heading_with_no_marks_node',
105
- },
106
- {
107
- $ref: '#/definitions/heading_with_alignment_node',
108
- },
109
- {
110
- $ref: '#/definitions/heading_with_indentation_node',
111
- },
112
- {
113
- $ref: '#/definitions/mediaGroup_node',
114
- },
115
- {
116
- $ref: '#/definitions/decisionList_node',
117
- },
118
- {
119
- $ref: '#/definitions/rule_node',
120
- },
121
- {
122
- $ref: '#/definitions/panel_node',
123
- },
124
- {
125
- $ref: '#/definitions/blockquote_node',
126
- },
127
- { $ref: '#/definitions/nestedExpand_node' },
128
- {
129
- $ref: '#/definitions/extension_with_marks_node',
130
- },
131
- {
132
- $ref: '#/definitions/embedCard_node',
133
- },
134
- {
135
- $ref: '#/definitions/nestedExpand_with_no_marks_node',
136
- },
137
- ],
138
- },
139
- minItems: 1,
140
- };