@atlaskit/adf-schema 37.0.3 → 37.1.20

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 (155) hide show
  1. package/CHANGELOG.md +153 -0
  2. package/dist/cjs/next-schema/full-schema.adf.js +1 -1
  3. package/dist/cjs/next-schema/generated/nodeTypes.js +101 -31
  4. package/dist/cjs/next-schema/groups/blockGroup.js +1 -1
  5. package/dist/cjs/next-schema/groups/inlineGroup.js +1 -1
  6. package/dist/cjs/next-schema/index.js +20 -8
  7. package/dist/cjs/next-schema/marks/link.js +2 -1
  8. package/dist/cjs/next-schema/nodes/blockquote.js +3 -2
  9. package/dist/cjs/next-schema/nodes/bodiedExtension.js +6 -2
  10. package/dist/cjs/next-schema/nodes/codeBlock.js +10 -3
  11. package/dist/cjs/next-schema/nodes/date.js +2 -1
  12. package/dist/cjs/next-schema/nodes/embedCard.js +2 -1
  13. package/dist/cjs/next-schema/nodes/emoji.js +2 -1
  14. package/dist/cjs/next-schema/nodes/expand.js +11 -3
  15. package/dist/cjs/next-schema/nodes/extension.js +5 -2
  16. package/dist/cjs/next-schema/nodes/heading.js +28 -5
  17. package/dist/cjs/next-schema/nodes/inlineExtension.js +1 -0
  18. package/dist/cjs/next-schema/nodes/layoutSection.js +15 -2
  19. package/dist/cjs/next-schema/nodes/list.js +12 -9
  20. package/dist/cjs/next-schema/nodes/mediaInline.js +2 -1
  21. package/dist/cjs/next-schema/nodes/mediaSingle.js +75 -4
  22. package/dist/cjs/next-schema/nodes/mention.js +2 -1
  23. package/dist/cjs/next-schema/nodes/multiBodiedExtension.js +8 -4
  24. package/dist/cjs/next-schema/nodes/nestedExpand.js +5 -1
  25. package/dist/cjs/next-schema/nodes/panel.js +3 -0
  26. package/dist/cjs/next-schema/nodes/paragraph.js +29 -5
  27. package/dist/cjs/next-schema/nodes/status.js +2 -1
  28. package/dist/cjs/next-schema/nodes/tableCell.js +4 -1
  29. package/dist/cjs/next-schema/nodes/tableHeader.js +5 -2
  30. package/dist/cjs/next-schema/nodes/task.js +1 -0
  31. package/dist/cjs/next-schema/nodes/text.js +7 -1
  32. package/dist/cjs/schema/nodes/media.js +10 -4
  33. package/dist/cjs/schema/nodes/text.js +1 -0
  34. package/dist/es2019/next-schema/full-schema.adf.js +1 -1
  35. package/dist/es2019/next-schema/generated/nodeTypes.js +100 -30
  36. package/dist/es2019/next-schema/groups/blockGroup.js +1 -1
  37. package/dist/es2019/next-schema/groups/inlineGroup.js +1 -1
  38. package/dist/es2019/next-schema/index.js +1 -1
  39. package/dist/es2019/next-schema/marks/link.js +2 -1
  40. package/dist/es2019/next-schema/nodes/blockquote.js +3 -2
  41. package/dist/es2019/next-schema/nodes/bodiedExtension.js +6 -2
  42. package/dist/es2019/next-schema/nodes/codeBlock.js +10 -3
  43. package/dist/es2019/next-schema/nodes/date.js +2 -1
  44. package/dist/es2019/next-schema/nodes/embedCard.js +2 -1
  45. package/dist/es2019/next-schema/nodes/emoji.js +2 -1
  46. package/dist/es2019/next-schema/nodes/expand.js +11 -3
  47. package/dist/es2019/next-schema/nodes/extension.js +5 -2
  48. package/dist/es2019/next-schema/nodes/heading.js +27 -4
  49. package/dist/es2019/next-schema/nodes/inlineExtension.js +1 -0
  50. package/dist/es2019/next-schema/nodes/layoutSection.js +15 -2
  51. package/dist/es2019/next-schema/nodes/list.js +12 -9
  52. package/dist/es2019/next-schema/nodes/mediaInline.js +2 -1
  53. package/dist/es2019/next-schema/nodes/mediaSingle.js +76 -5
  54. package/dist/es2019/next-schema/nodes/mention.js +2 -1
  55. package/dist/es2019/next-schema/nodes/multiBodiedExtension.js +8 -4
  56. package/dist/es2019/next-schema/nodes/nestedExpand.js +5 -1
  57. package/dist/es2019/next-schema/nodes/panel.js +3 -0
  58. package/dist/es2019/next-schema/nodes/paragraph.js +29 -5
  59. package/dist/es2019/next-schema/nodes/status.js +2 -1
  60. package/dist/es2019/next-schema/nodes/tableCell.js +4 -1
  61. package/dist/es2019/next-schema/nodes/tableHeader.js +5 -2
  62. package/dist/es2019/next-schema/nodes/task.js +1 -0
  63. package/dist/es2019/next-schema/nodes/text.js +7 -1
  64. package/dist/es2019/schema/nodes/media.js +3 -1
  65. package/dist/es2019/schema/nodes/text.js +1 -0
  66. package/dist/esm/next-schema/full-schema.adf.js +1 -1
  67. package/dist/esm/next-schema/generated/nodeTypes.js +100 -30
  68. package/dist/esm/next-schema/groups/blockGroup.js +1 -1
  69. package/dist/esm/next-schema/groups/inlineGroup.js +1 -1
  70. package/dist/esm/next-schema/index.js +1 -1
  71. package/dist/esm/next-schema/marks/link.js +2 -1
  72. package/dist/esm/next-schema/nodes/blockquote.js +3 -2
  73. package/dist/esm/next-schema/nodes/bodiedExtension.js +6 -2
  74. package/dist/esm/next-schema/nodes/codeBlock.js +10 -3
  75. package/dist/esm/next-schema/nodes/date.js +2 -1
  76. package/dist/esm/next-schema/nodes/embedCard.js +2 -1
  77. package/dist/esm/next-schema/nodes/emoji.js +2 -1
  78. package/dist/esm/next-schema/nodes/expand.js +11 -3
  79. package/dist/esm/next-schema/nodes/extension.js +5 -2
  80. package/dist/esm/next-schema/nodes/heading.js +27 -4
  81. package/dist/esm/next-schema/nodes/inlineExtension.js +1 -0
  82. package/dist/esm/next-schema/nodes/layoutSection.js +15 -2
  83. package/dist/esm/next-schema/nodes/list.js +12 -9
  84. package/dist/esm/next-schema/nodes/mediaInline.js +2 -1
  85. package/dist/esm/next-schema/nodes/mediaSingle.js +76 -5
  86. package/dist/esm/next-schema/nodes/mention.js +2 -1
  87. package/dist/esm/next-schema/nodes/multiBodiedExtension.js +8 -4
  88. package/dist/esm/next-schema/nodes/nestedExpand.js +5 -1
  89. package/dist/esm/next-schema/nodes/panel.js +3 -0
  90. package/dist/esm/next-schema/nodes/paragraph.js +29 -5
  91. package/dist/esm/next-schema/nodes/status.js +2 -1
  92. package/dist/esm/next-schema/nodes/tableCell.js +4 -1
  93. package/dist/esm/next-schema/nodes/tableHeader.js +5 -2
  94. package/dist/esm/next-schema/nodes/task.js +1 -0
  95. package/dist/esm/next-schema/nodes/text.js +7 -1
  96. package/dist/esm/schema/nodes/media.js +9 -4
  97. package/dist/esm/schema/nodes/text.js +1 -0
  98. package/dist/types/next-schema/full-schema.adf.d.ts +18 -0
  99. package/dist/types/next-schema/generated/markTypes.d.ts +20 -20
  100. package/dist/types/next-schema/generated/nodeGroupTypes.d.ts +2 -2
  101. package/dist/types/next-schema/generated/nodeTypes.d.ts +145 -96
  102. package/dist/types/next-schema/groups/nonNestableBlockContentGroup.d.ts +128 -6
  103. package/dist/types/next-schema/index.d.ts +2 -2
  104. package/dist/types/next-schema/nodes/blockCard.d.ts +18 -0
  105. package/dist/types/next-schema/nodes/blockquote.d.ts +20 -1
  106. package/dist/types/next-schema/nodes/bodiedExtension.d.ts +20 -0
  107. package/dist/types/next-schema/nodes/caption.d.ts +18 -0
  108. package/dist/types/next-schema/nodes/codeBlock.d.ts +48 -0
  109. package/dist/types/next-schema/nodes/confluenceJiraIssue.d.ts +18 -0
  110. package/dist/types/next-schema/nodes/confluenceUnsupportedBlock.d.ts +18 -0
  111. package/dist/types/next-schema/nodes/confluenceUnsupportedInline.d.ts +18 -0
  112. package/dist/types/next-schema/nodes/date.d.ts +18 -0
  113. package/dist/types/next-schema/nodes/decisionItem.d.ts +18 -0
  114. package/dist/types/next-schema/nodes/decisionList.d.ts +18 -0
  115. package/dist/types/next-schema/nodes/embedCard.d.ts +18 -0
  116. package/dist/types/next-schema/nodes/emoji.d.ts +18 -0
  117. package/dist/types/next-schema/nodes/expand.d.ts +25 -0
  118. package/dist/types/next-schema/nodes/extension.d.ts +19 -0
  119. package/dist/types/next-schema/nodes/extensionFrame.d.ts +18 -0
  120. package/dist/types/next-schema/nodes/hardBreak.d.ts +18 -0
  121. package/dist/types/next-schema/nodes/heading.d.ts +80 -0
  122. package/dist/types/next-schema/nodes/image.d.ts +18 -0
  123. package/dist/types/next-schema/nodes/inlineCard.d.ts +18 -0
  124. package/dist/types/next-schema/nodes/inlineExtension.d.ts +18 -0
  125. package/dist/types/next-schema/nodes/layoutColumn.d.ts +18 -0
  126. package/dist/types/next-schema/nodes/layoutSection.d.ts +22 -0
  127. package/dist/types/next-schema/nodes/list.d.ts +36 -0
  128. package/dist/types/next-schema/nodes/media.d.ts +18 -0
  129. package/dist/types/next-schema/nodes/mediaGroup.d.ts +18 -0
  130. package/dist/types/next-schema/nodes/mediaInline.d.ts +18 -0
  131. package/dist/types/next-schema/nodes/mediaSingle.d.ts +67 -1
  132. package/dist/types/next-schema/nodes/mention.d.ts +18 -0
  133. package/dist/types/next-schema/nodes/multiBodiedExtension.d.ts +18 -0
  134. package/dist/types/next-schema/nodes/nestedExpand.d.ts +22 -0
  135. package/dist/types/next-schema/nodes/panel.d.ts +22 -1
  136. package/dist/types/next-schema/nodes/paragraph.d.ts +29 -0
  137. package/dist/types/next-schema/nodes/placeholder.d.ts +18 -0
  138. package/dist/types/next-schema/nodes/rule.d.ts +18 -0
  139. package/dist/types/next-schema/nodes/status.d.ts +18 -0
  140. package/dist/types/next-schema/nodes/table.d.ts +18 -0
  141. package/dist/types/next-schema/nodes/tableCell.d.ts +18 -0
  142. package/dist/types/next-schema/nodes/tableHeader.d.ts +18 -0
  143. package/dist/types/next-schema/nodes/tableRow.d.ts +18 -0
  144. package/dist/types/next-schema/nodes/task.d.ts +36 -0
  145. package/dist/types/next-schema/nodes/text.d.ts +22 -1
  146. package/dist/types/next-schema/nodes/unsupportedBlock.d.ts +18 -0
  147. package/dist/types/next-schema/nodes/unsupportedInline.d.ts +18 -0
  148. package/package.json +8 -3
  149. package/schema-generators/__tests__/unit/__fixtures__/index.fixture.ts +140 -0
  150. package/schema-generators/__tests__/unit/adfToValidatorSpec.unit.ts +1 -45
  151. package/schema-generators/__tests__/unit/adfToValidatorSpecValidation.unit.ts +85 -0
  152. package/schema-generators/__tests__/unit/json-full-schema-backwards-compat.unit.ts +70 -61
  153. package/schema-generators/__tests__/unit/validate-pm-schema.unit.ts +152 -46
  154. package/schema-generators/__tests__/unit/jqueries.md +0 -194
  155. package/schema-generators/__tests__/unit/json-full-schema.unit.ts +0 -2320
@@ -10,6 +10,7 @@ export var bodiedExtension = adfNode('bodiedExtension').define({
10
10
  selectable: true,
11
11
  isolating: true,
12
12
  marks: [unsupportedNodeAttribute, unsupportedMark],
13
+ hasEmptyMarks: true,
13
14
  attrs: {
14
15
  extensionKey: {
15
16
  minLength: 1,
@@ -44,7 +45,10 @@ export var bodiedExtension = adfNode('bodiedExtension').define({
44
45
  default: null
45
46
  }
46
47
  },
47
- content: [$onePlus($or.apply(void 0, _toConsumableArray(nonNestableBlockContent)))]
48
+ content: [$onePlus($or.apply(void 0, _toConsumableArray(nonNestableBlockContent)))],
49
+ ignore: ['json-schema']
48
50
  }).variant('with_marks', {
49
- marks: [dataConsumer, fragment, unsupportedNodeAttribute, unsupportedMark]
51
+ marks: [dataConsumer, fragment, unsupportedNodeAttribute, unsupportedMark],
52
+ content: [],
53
+ ignore: []
50
54
  });
@@ -20,8 +20,15 @@ export var codeBlock = adfNode('codeBlock').define({
20
20
  optional: true
21
21
  }
22
22
  },
23
- content: [$zeroPlus($or(text, unsupportedInline))]
23
+ content: [$zeroPlus($or(text, unsupportedInline))],
24
+ ignore: ['json-schema']
24
25
  }).variant('with_marks', {
25
- marks: [breakout, unsupportedNodeAttribute, unsupportedMark]
26
- }).variant('with_no_marks', {});
26
+ marks: [breakout, unsupportedNodeAttribute, unsupportedMark],
27
+ ignore: ['pm-spec']
28
+ }).variant('with_no_marks', {
29
+ content: [],
30
+ marks: [],
31
+ noMarks: true,
32
+ ignore: []
33
+ });
27
34
  export var codeBlockWithNoMarks = codeBlock;
@@ -1,10 +1,11 @@
1
1
  import { adfNode } from '@atlaskit/adf-schema-generator';
2
+ import { annotation } from '../marks/annotation';
2
3
  import { unsupportedMark } from '../marks/unsupportedMark';
3
4
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
4
5
  export var date = adfNode('date').define({
5
6
  inline: true,
6
7
  selectable: true,
7
- marks: [unsupportedNodeAttribute, unsupportedMark],
8
+ marks: [unsupportedNodeAttribute, unsupportedMark, annotation],
8
9
  attrs: {
9
10
  timestamp: {
10
11
  minLength: 1,
@@ -7,7 +7,8 @@ export var embedCard = adfNode('embedCard').define({
7
7
  attrs: {
8
8
  url: {
9
9
  type: 'string',
10
- default: ''
10
+ default: '',
11
+ validatorFn: 'safeUrl'
11
12
  },
12
13
  layout: {
13
14
  type: 'enum',
@@ -1,10 +1,11 @@
1
1
  import { adfNode } from '@atlaskit/adf-schema-generator';
2
+ import { annotation } from '../marks/annotation';
2
3
  import { unsupportedMark } from '../marks/unsupportedMark';
3
4
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
4
5
  export var emoji = adfNode('emoji').define({
5
6
  inline: true,
6
7
  selectable: true,
7
- marks: [unsupportedNodeAttribute, unsupportedMark],
8
+ marks: [unsupportedNodeAttribute, unsupportedMark, annotation],
8
9
  attrs: {
9
10
  shortName: {
10
11
  type: 'string',
@@ -20,7 +20,15 @@ export var expand = adfNode('expand').define({
20
20
  optional: true
21
21
  }
22
22
  },
23
- content: [$onePlus($or.apply(void 0, _toConsumableArray(nonNestableBlockContent)))]
23
+ content: [$onePlus($or.apply(void 0, _toConsumableArray(nonNestableBlockContent)))],
24
+ ignore: ['json-schema']
24
25
  }).variant('with_breakout_mark', {
25
- marks: [breakout, unsupportedNodeAttribute, unsupportedMark]
26
- }).variant('with_no_mark', {});
26
+ marks: [breakout, unsupportedNodeAttribute, unsupportedMark],
27
+ content: [],
28
+ ignore: ['pm-spec']
29
+ }).variant('with_no_mark', {
30
+ content: [],
31
+ marks: [],
32
+ noMarks: true,
33
+ ignore: []
34
+ });
@@ -7,6 +7,7 @@ export var extension = adfNode('extension').define({
7
7
  atom: true,
8
8
  selectable: true,
9
9
  marks: [unsupportedNodeAttribute, unsupportedMark],
10
+ hasEmptyMarks: true,
10
11
  attrs: {
11
12
  extensionKey: {
12
13
  minLength: 1,
@@ -40,7 +41,9 @@ export var extension = adfNode('extension').define({
40
41
  optional: true,
41
42
  default: null
42
43
  }
43
- }
44
+ },
45
+ ignore: ['json-schema']
44
46
  }).variant('with_marks', {
45
- marks: [dataConsumer, fragment, unsupportedNodeAttribute, unsupportedMark]
47
+ marks: [dataConsumer, fragment, unsupportedNodeAttribute, unsupportedMark],
48
+ ignore: []
46
49
  });
@@ -7,6 +7,7 @@ export var heading = adfNode('heading').define({
7
7
  defining: true,
8
8
  selectable: false,
9
9
  marks: [unsupportedNodeAttribute, unsupportedMark],
10
+ hasEmptyMarks: true,
10
11
  attrs: {
11
12
  level: {
12
13
  type: 'number',
@@ -20,9 +21,31 @@ export var heading = adfNode('heading').define({
20
21
  default: null
21
22
  }
22
23
  },
23
- content: [$zeroPlus($or(inlineGroup))]
24
+ content: [$zeroPlus($or(inlineGroup))],
25
+ DANGEROUS_MANUAL_OVERRIDE: {
26
+ 'validator-spec': {
27
+ marks: {
28
+ value: {
29
+ type: 'array',
30
+ items: [],
31
+ optional: true
32
+ },
33
+ reason: 'In old types, some nodes have marks: Array<any>, which is not possible to represent in new DSL'
34
+ }
35
+ }
36
+ }
24
37
  }).variant('with_alignment', {
25
- marks: [alignment, unsupportedNodeAttribute, unsupportedMark]
38
+ marks: [alignment, unsupportedNodeAttribute, unsupportedMark],
39
+ content: [],
40
+ ignore: []
26
41
  }).variant('with_indentation', {
27
- marks: [indentation, unsupportedNodeAttribute, unsupportedMark]
28
- }).variant('with_no_marks', {});
42
+ marks: [indentation, unsupportedNodeAttribute, unsupportedMark],
43
+ content: [],
44
+ ignore: []
45
+ }).variant('with_no_marks', {
46
+ content: [],
47
+ marks: [],
48
+ noMarks: true,
49
+ ignore: []
50
+ });
51
+ export var headingWithMarks = heading;
@@ -7,6 +7,7 @@ export var inlineExtension = adfNode('inlineExtension').define({
7
7
  inline: true,
8
8
  selectable: true,
9
9
  marks: [unsupportedNodeAttribute, unsupportedMark],
10
+ hasEmptyMarks: true,
10
11
  attrs: {
11
12
  extensionKey: {
12
13
  minLength: 1,
@@ -7,5 +7,18 @@ 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
- }).variant('full', {});
10
+ content: [$range(1, 3, $or(layoutColumn, unsupportedBlock))],
11
+ ignore: ['json-schema'],
12
+ DANGEROUS_MANUAL_OVERRIDE: {
13
+ 'pm-spec': {
14
+ content: {
15
+ 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."
17
+ }
18
+ }
19
+ }
20
+ }).variant('full', {
21
+ marks: [breakout, unsupportedNodeAttribute, unsupportedMark],
22
+ content: [$range(2, 3, $or(layoutColumn, unsupportedBlock))],
23
+ ignore: []
24
+ });
@@ -8,7 +8,16 @@ import { taskList } from './task';
8
8
  import { unsupportedBlock } from './unsupportedBlock';
9
9
  export var orderedList = adfNode('orderedList');
10
10
  export var bulletList = adfNode('bulletList');
11
- var listItem = adfNode('listItem');
11
+ var listItem = adfNode('listItem').define({
12
+ defining: true,
13
+ selectable: false,
14
+ marks: [unsupportedNodeAttribute, unsupportedMark],
15
+ contentMinItems: 1,
16
+ content: [$or(codeBlock.use('with_no_marks'), paragraph.use('with_no_marks'), mediaSingle.use('caption'), mediaSingle.use('full'), unsupportedBlock), $zeroPlus($or(codeBlock.use('with_no_marks'), paragraph.use('with_no_marks'), mediaSingle.use('caption'), mediaSingle.use('full'), taskList, bulletList, orderedList, unsupportedBlock))]
17
+ }).variant('legacy', {
18
+ content: [$or(codeBlock.use('with_no_marks'), paragraph.use('with_no_marks'), mediaSingle.use('caption'), mediaSingle.use('full'), unsupportedBlock), $zeroPlus($or(codeBlock.use('with_no_marks'), paragraph.use('with_no_marks'), mediaSingle.use('caption'), mediaSingle.use('full'), bulletList, orderedList, unsupportedBlock))],
19
+ ignore: ['json-schema', 'validator-spec']
20
+ });
12
21
  orderedList.define({
13
22
  selectable: false,
14
23
  marks: [unsupportedNodeAttribute, unsupportedMark],
@@ -20,16 +29,10 @@ orderedList.define({
20
29
  optional: true
21
30
  }
22
31
  },
23
- content: [$onePlus($or(listItem))]
32
+ content: [$onePlus($or(listItem, listItem.use('legacy')))]
24
33
  });
25
34
  bulletList.define({
26
35
  selectable: false,
27
36
  marks: [unsupportedNodeAttribute, unsupportedMark],
28
- content: [$onePlus($or(listItem))]
29
- });
30
- listItem.define({
31
- defining: true,
32
- selectable: false,
33
- marks: [unsupportedNodeAttribute, unsupportedMark],
34
- content: [$or(codeBlock.use('with_no_marks'), paragraph.use('with_no_marks'), mediaSingle.use('caption'), mediaSingle.use('full'), unsupportedBlock), $zeroPlus($or(codeBlock.use('with_no_marks'), paragraph.use('with_no_marks'), mediaSingle.use('caption'), mediaSingle.use('full'), taskList, bulletList, orderedList, unsupportedBlock))]
37
+ content: [$onePlus($or(listItem, listItem.use('legacy')))]
35
38
  });
@@ -18,7 +18,8 @@ export var mediaInline = adfNode('mediaInline').define({
18
18
  },
19
19
  url: {
20
20
  type: 'string',
21
- default: null
21
+ default: null,
22
+ optional: true
22
23
  },
23
24
  id: {
24
25
  minLength: 1,
@@ -1,4 +1,4 @@
1
- import { $or, adfNode } from '@atlaskit/adf-schema-generator';
1
+ import { $or, $range, adfNode } from '@atlaskit/adf-schema-generator';
2
2
  import { link } from '../marks/link';
3
3
  import { unsupportedMark } from '../marks/unsupportedMark';
4
4
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
@@ -6,8 +6,9 @@ import { caption } from './caption';
6
6
  import { media } from './media';
7
7
  import { unsupportedBlock } from './unsupportedBlock';
8
8
  export var mediaSingle = adfNode('mediaSingle').define({
9
- atom: false,
9
+ atom: true,
10
10
  selectable: true,
11
+ ignore: ['json-schema'],
11
12
  marks: [link, unsupportedNodeAttribute, unsupportedMark],
12
13
  attrs: {
13
14
  anyOf: [{
@@ -47,8 +48,78 @@ export var mediaSingle = adfNode('mediaSingle').define({
47
48
  }
48
49
  }]
49
50
  },
50
- content: [$or(media)]
51
+ DANGEROUS_MANUAL_OVERRIDE: {
52
+ 'pm-spec': {
53
+ content: {
54
+ value: 'media|media|unsupportedBlock+ unsupportedBlock+',
55
+ reason: 'The content expression is not correct or redundant around `media|media|unsupportedBlock+`. This case is not supported by the DSL.'
56
+ },
57
+ attrs: {
58
+ value: {
59
+ layout: {
60
+ default: 'center'
61
+ },
62
+ width: {
63
+ default: null
64
+ }
65
+ },
66
+ reason: 'the widthType was not in attrs of original spec'
67
+ },
68
+ marks: {
69
+ value: 'annotation border link unsupportedMark unsupportedNodeAttribute',
70
+ reason: "Types and PM Spec don't match, in types base mediaSingle doesn't have children, and in ADF DSL marks are derived from children"
71
+ }
72
+ }
73
+ }
51
74
  }).variant('caption', {
52
75
  atom: false,
53
- content: [$or(media, unsupportedBlock), $or(caption, unsupportedBlock)]
54
- }).variant('full', {});
76
+ ignore: [],
77
+ marks: [],
78
+ contentMinItems: 1,
79
+ contentMaxItems: 2,
80
+ content: [$or(media, unsupportedBlock), $or(caption, unsupportedBlock)],
81
+ DANGEROUS_MANUAL_OVERRIDE: {
82
+ 'pm-spec': {
83
+ content: {
84
+ value: 'media|media|unsupportedBlock+ (caption|unsupportedBlock) unsupportedBlock*',
85
+ reason: 'The content expression is not correct or redundant around `media|media|unsupportedBlock+`. This case is not supported by the DSL.'
86
+ },
87
+ attrs: {
88
+ value: {
89
+ layout: {
90
+ default: 'center'
91
+ },
92
+ width: {
93
+ default: null
94
+ }
95
+ },
96
+ reason: 'the widthType was not in attrs of original spec of mediaSingleWithCaption'
97
+ }
98
+ }
99
+ }
100
+ }).variant('full', {
101
+ atom: false,
102
+ content: [$range(1, 1, $or(media, unsupportedBlock))],
103
+ ignore: [],
104
+ marks: [],
105
+ DANGEROUS_MANUAL_OVERRIDE: {
106
+ 'pm-spec': {
107
+ content: {
108
+ value: 'media|media|unsupportedBlock+ (caption|unsupportedBlock) unsupportedBlock*',
109
+ reason: 'The content expression is not correct or redundant around `media|media|unsupportedBlock+`. This case is not supported by the DSL.'
110
+ }
111
+ }
112
+ }
113
+ }).variant('width_type', {
114
+ content: [$range(1, 1, $or(media, unsupportedBlock))],
115
+ ignore: [],
116
+ marks: [],
117
+ DANGEROUS_MANUAL_OVERRIDE: {
118
+ 'pm-spec': {
119
+ content: {
120
+ value: 'media|media|unsupportedBlock+ unsupportedBlock+',
121
+ reason: 'The content expression is not correct or redundant around `media|media|unsupportedBlock+`. This case is not supported by the DSL.'
122
+ }
123
+ }
124
+ }
125
+ });
@@ -1,10 +1,11 @@
1
1
  import { adfNode } from '@atlaskit/adf-schema-generator';
2
+ import { annotation } from '../marks/annotation';
2
3
  import { unsupportedMark } from '../marks/unsupportedMark';
3
4
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
4
5
  export var mention = adfNode('mention').define({
5
6
  inline: true,
6
7
  selectable: true,
7
- marks: [unsupportedNodeAttribute, unsupportedMark],
8
+ marks: [unsupportedNodeAttribute, unsupportedMark, annotation],
8
9
  attrs: {
9
10
  id: {
10
11
  type: 'string',
@@ -11,11 +11,13 @@ export var multiBodiedExtension = adfNode('multiBodiedExtension').define({
11
11
  attrs: {
12
12
  extensionKey: {
13
13
  type: 'string',
14
- default: ''
14
+ default: '',
15
+ minLength: 1
15
16
  },
16
17
  extensionType: {
17
18
  type: 'string',
18
- default: ''
19
+ default: '',
20
+ minLength: 1
19
21
  },
20
22
  parameters: {
21
23
  type: 'object',
@@ -36,8 +38,10 @@ export var multiBodiedExtension = adfNode('multiBodiedExtension').define({
36
38
  localId: {
37
39
  type: 'string',
38
40
  optional: true,
39
- default: null
41
+ default: null,
42
+ minLength: 1
40
43
  }
41
44
  },
42
- content: [$onePlus($or(extensionFrame))]
45
+ content: [$onePlus($or(extensionFrame))],
46
+ ignore: ['json-schema']
43
47
  });
@@ -30,4 +30,8 @@ export var nestedExpand = adfNode('nestedExpand').define({
30
30
  }
31
31
  },
32
32
  content: [$onePlus($or(codeBlock.use('with_no_marks'), paragraph.use('with_no_marks'), mediaSingle.use('caption'), mediaSingle.use('full'), taskList, bulletList, orderedList, heading.use('with_no_marks'), mediaGroup, decisionList, rule, panel, blockquote, unsupportedBlock))]
33
- }).variant('with_no_marks', {});
33
+ }).variant('with_no_marks', {
34
+ marks: [],
35
+ content: [],
36
+ noMarks: true
37
+ });
@@ -43,4 +43,7 @@ export var panel = adfNode('panel').define({
43
43
  }
44
44
  },
45
45
  content: [$onePlus($or(codeBlock.use('with_no_marks'), blockCard, paragraph.use('with_no_marks'), mediaSingle.use('caption'), mediaSingle.use('full'), taskList, bulletList, orderedList, heading.use('with_no_marks'), mediaGroup, decisionList, rule, unsupportedBlock))]
46
+ }).variant('legacy', {
47
+ content: [$onePlus($or(blockCard, paragraph.use('with_no_marks'), bulletList, orderedList, heading.use('with_no_marks'), unsupportedBlock))],
48
+ ignore: ['json-schema', 'validator-spec']
46
49
  });
@@ -13,11 +13,35 @@ export var paragraph = adfNode('paragraph').define({
13
13
  },
14
14
  selectable: false,
15
15
  marks: [unsupportedNodeAttribute, unsupportedMark],
16
- content: [$zeroPlus($or(inlineGroup))]
16
+ hasEmptyMarks: true,
17
+ content: [$zeroPlus($or(inlineGroup))],
18
+ DANGEROUS_MANUAL_OVERRIDE: {
19
+ 'validator-spec': {
20
+ marks: {
21
+ value: {
22
+ type: 'array',
23
+ items: [],
24
+ optional: true
25
+ },
26
+ reason: 'NoMark type used in old schema had a hack maxItems: 0 to mark nodes that should not have any marks. This is not possible to represent in new DSL.'
27
+ }
28
+ }
29
+ }
17
30
  }).variant('with_alignment', {
18
- marks: [alignment, unsupportedNodeAttribute, unsupportedMark]
31
+ marks: [alignment, unsupportedNodeAttribute, unsupportedMark],
32
+ content: [],
33
+ ignore: []
19
34
  }).variant('with_indentation', {
20
- marks: [indentation, unsupportedNodeAttribute, unsupportedMark]
35
+ marks: [indentation, unsupportedNodeAttribute, unsupportedMark],
36
+ content: [],
37
+ ignore: []
21
38
  }).variant('with_marks', {
22
- marks: [alignment, indentation, unsupportedNodeAttribute, unsupportedMark]
23
- }).variant('with_no_marks', {});
39
+ marks: [alignment, unsupportedNodeAttribute, unsupportedMark],
40
+ content: [],
41
+ ignore: []
42
+ }).variant('with_no_marks', {
43
+ content: [],
44
+ marks: [],
45
+ noMarks: true,
46
+ ignore: []
47
+ });
@@ -1,10 +1,11 @@
1
1
  import { adfNode } from '@atlaskit/adf-schema-generator';
2
+ import { annotation } from '../marks/annotation';
2
3
  import { unsupportedMark } from '../marks/unsupportedMark';
3
4
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
4
5
  export var status = adfNode('status').define({
5
6
  inline: true,
6
7
  selectable: true,
7
- marks: [unsupportedNodeAttribute, unsupportedMark],
8
+ marks: [unsupportedNodeAttribute, unsupportedMark, annotation],
8
9
  attrs: {
9
10
  text: {
10
11
  minLength: 1,
@@ -34,7 +34,10 @@ export var tableCell = adfNode('tableCell').define({
34
34
  optional: true
35
35
  },
36
36
  colwidth: {
37
- type: 'numberList',
37
+ type: 'array',
38
+ items: {
39
+ type: 'number'
40
+ },
38
41
  default: null,
39
42
  optional: true
40
43
  },
@@ -33,7 +33,10 @@ export var tableHeader = adfNode('tableHeader').define({
33
33
  optional: true
34
34
  },
35
35
  colwidth: {
36
- type: 'numberList',
36
+ type: 'array',
37
+ items: {
38
+ type: 'number'
39
+ },
37
40
  default: null,
38
41
  optional: true
39
42
  },
@@ -43,5 +46,5 @@ export var tableHeader = adfNode('tableHeader').define({
43
46
  optional: true
44
47
  }
45
48
  },
46
- 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')))]
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')))]
47
50
  });
@@ -33,5 +33,6 @@ taskList.define({
33
33
  default: ''
34
34
  }
35
35
  },
36
+ contentMinItems: 1,
36
37
  content: [$onePlus($or(taskItem, unsupportedBlock)), $zeroPlus($or(taskItem, taskList, unsupportedBlock))]
37
38
  });
@@ -12,7 +12,13 @@ import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
12
12
  import { unsupportedMark } from '../marks/unsupportedMark';
13
13
  import { typeAheadQuery } from '../marks/typeAheadQuery';
14
14
  import { confluenceInlineComment } from '../marks/confluenceInlineComment';
15
- export var text = adfNode('text').define({}).variant('formatted', {
15
+ export var text = adfNode('text').define({
16
+ marks: [],
17
+ hasEmptyMarks: true
18
+ }).variant('link_inline', {
19
+ marks: [link],
20
+ ignore: ['pm-spec', 'json-schema']
21
+ }).variant('formatted', {
16
22
  marks: [link, em, strong, strike, subsup, underline, textColor, annotation, backgroundColor, typeAheadQuery, confluenceInlineComment, unsupportedNodeAttribute, unsupportedMark]
17
23
  }).variant('code_inline', {
18
24
  marks: [code, link, annotation, unsupportedNodeAttribute, unsupportedMark]
@@ -1,3 +1,6 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1
4
  import { N30 } from '../../utils/colors';
2
5
 
3
6
  /**
@@ -105,10 +108,12 @@ export var createMediaSpec = function createMediaSpec(attributes) {
105
108
  }
106
109
  });
107
110
  }
108
- return {
111
+ return _objectSpread(_objectSpread({
109
112
  selectable: true,
110
- inline: inline,
111
- group: inline ? 'inline' : undefined,
113
+ inline: inline
114
+ }, inline && {
115
+ group: 'inline'
116
+ }), {}, {
112
117
  attrs: attributes,
113
118
  parseDOM: parseDOM,
114
119
  toDOM: function toDOM(node) {
@@ -135,7 +140,7 @@ export var createMediaSpec = function createMediaSpec(attributes) {
135
140
  });
136
141
  return ["".concat(domNodeType), attrs];
137
142
  }
138
- };
143
+ });
139
144
  };
140
145
  export var media = createMediaSpec(defaultAttrs);
141
146
  export var camelCaseToKebabCase = function camelCaseToKebabCase(str) {
@@ -4,6 +4,7 @@
4
4
 
5
5
  export var text = {
6
6
  group: 'inline',
7
+ // TODO: toDebugString needs to be passed with createToPmFactory when migrate in https://product-fabric.atlassian.net/browse/ED-23606
7
8
  toDebugString: process.env.NODE_ENV !== 'production' ? undefined : function () {
8
9
  return 'text_node';
9
10
  }
@@ -7,6 +7,8 @@ declare const doc: import("@atlaskit/adf-schema-generator/dist/types/adfNode").A
7
7
  inline?: true;
8
8
  code?: boolean;
9
9
  content?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFNodeSpec").ADFNodeContentSpec[];
10
+ contentMinItems?: number;
11
+ contentMaxItems?: number;
10
12
  defining?: boolean;
11
13
  definingAsContext?: boolean;
12
14
  definingForContent?: boolean;
@@ -16,8 +18,24 @@ declare const doc: import("@atlaskit/adf-schema-generator/dist/types/adfNode").A
16
18
  marks?: import("@atlaskit/adf-schema-generator/dist/types/adfMark").ADFMark<unknown>[];
17
19
  allowAnyChildMark?: boolean;
18
20
  allowNoChildMark?: boolean;
21
+ noMarks?: boolean;
22
+ hasEmptyMarks?: boolean;
19
23
  selectable?: boolean;
20
24
  whitespace?: "pre" | "normal";
21
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
+ };
22
40
  }>;
23
41
  export default doc;