@atlaskit/adf-utils 19.0.10 → 19.0.12

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 (185) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/builders/marks/alignment.js +2 -3
  3. package/dist/cjs/builders/marks/annotation.js +2 -3
  4. package/dist/cjs/builders/marks/border.js +2 -3
  5. package/dist/cjs/builders/marks/breakout.js +2 -3
  6. package/dist/cjs/builders/marks/code.js +2 -3
  7. package/dist/cjs/builders/marks/data-consumer.js +2 -3
  8. package/dist/cjs/builders/marks/em.js +2 -3
  9. package/dist/cjs/builders/marks/fragment.js +2 -3
  10. package/dist/cjs/builders/marks/indentation.js +2 -3
  11. package/dist/cjs/builders/marks/link.js +2 -3
  12. package/dist/cjs/builders/marks/strike.js +2 -3
  13. package/dist/cjs/builders/marks/strong.js +2 -3
  14. package/dist/cjs/builders/marks/subsup.js +2 -3
  15. package/dist/cjs/builders/marks/text-color.js +2 -3
  16. package/dist/cjs/builders/marks/underline.js +2 -3
  17. package/dist/cjs/builders/nodes/block-card.js +2 -3
  18. package/dist/cjs/builders/nodes/blockquote.js +2 -3
  19. package/dist/cjs/builders/nodes/bodied-extension.js +2 -3
  20. package/dist/cjs/builders/nodes/bullet-list.js +2 -3
  21. package/dist/cjs/builders/nodes/caption.js +2 -3
  22. package/dist/cjs/builders/nodes/code-block.js +2 -3
  23. package/dist/cjs/builders/nodes/date.js +2 -3
  24. package/dist/cjs/builders/nodes/decision-item.js +2 -3
  25. package/dist/cjs/builders/nodes/decision-list.js +2 -3
  26. package/dist/cjs/builders/nodes/doc.js +2 -3
  27. package/dist/cjs/builders/nodes/embed-card.js +2 -3
  28. package/dist/cjs/builders/nodes/emoji.js +2 -3
  29. package/dist/cjs/builders/nodes/expand.js +2 -3
  30. package/dist/cjs/builders/nodes/extension.js +2 -3
  31. package/dist/cjs/builders/nodes/hard-break.js +2 -3
  32. package/dist/cjs/builders/nodes/heading.js +2 -3
  33. package/dist/cjs/builders/nodes/inline-card.js +2 -3
  34. package/dist/cjs/builders/nodes/inline-extension.js +2 -3
  35. package/dist/cjs/builders/nodes/layout-column.js +2 -3
  36. package/dist/cjs/builders/nodes/layout-section.js +2 -3
  37. package/dist/cjs/builders/nodes/list-item.js +2 -3
  38. package/dist/cjs/builders/nodes/media-group.js +2 -3
  39. package/dist/cjs/builders/nodes/media-inline.js +2 -3
  40. package/dist/cjs/builders/nodes/media-single.js +2 -3
  41. package/dist/cjs/builders/nodes/media.js +2 -3
  42. package/dist/cjs/builders/nodes/mention.js +2 -3
  43. package/dist/cjs/builders/nodes/multi-bodied-extension.js +18 -0
  44. package/dist/cjs/builders/nodes/nested-expand.js +2 -3
  45. package/dist/cjs/builders/nodes/ordered-list.js +2 -3
  46. package/dist/cjs/builders/nodes/panel.js +2 -3
  47. package/dist/cjs/builders/nodes/paragraph.js +2 -3
  48. package/dist/cjs/builders/nodes/placeholder.js +2 -3
  49. package/dist/cjs/builders/nodes/rule.js +2 -3
  50. package/dist/cjs/builders/nodes/status.js +2 -3
  51. package/dist/cjs/builders/nodes/table-cell.js +2 -3
  52. package/dist/cjs/builders/nodes/table-header.js +2 -3
  53. package/dist/cjs/builders/nodes/table-row.js +2 -3
  54. package/dist/cjs/builders/nodes/table.js +2 -3
  55. package/dist/cjs/builders/nodes/task-item.js +2 -3
  56. package/dist/cjs/builders/nodes/task-list.js +2 -3
  57. package/dist/cjs/builders/nodes/text.js +2 -3
  58. package/dist/cjs/empty-adf.js +2 -3
  59. package/dist/cjs/scrub/default-node-replacements.js +2 -3
  60. package/dist/cjs/scrub/default-value-replacements.js +2 -3
  61. package/dist/cjs/scrub/hash.js +2 -3
  62. package/dist/cjs/scrub/scrub-adf.js +2 -3
  63. package/dist/cjs/scrub/scrub-content.js +4 -7
  64. package/dist/cjs/transforms/dedupe-marks-transform.js +5 -6
  65. package/dist/cjs/transforms/helpers.js +2 -3
  66. package/dist/cjs/transforms/indentation-marks-transform.js +3 -4
  67. package/dist/cjs/transforms/invalid-media-content-transform.js +2 -3
  68. package/dist/cjs/transforms/media-link-transform.js +3 -4
  69. package/dist/cjs/transforms/nodes-missing-content-transform.js +5 -6
  70. package/dist/cjs/transforms/text-link-code-transform.js +2 -3
  71. package/dist/cjs/validator/rules.js +2 -3
  72. package/dist/cjs/validator/specs/alignment.js +2 -3
  73. package/dist/cjs/validator/specs/annotation.js +2 -3
  74. package/dist/cjs/validator/specs/atomic_inline.js +1 -2
  75. package/dist/cjs/validator/specs/blockCard.js +2 -3
  76. package/dist/cjs/validator/specs/block_content.js +1 -2
  77. package/dist/cjs/validator/specs/blockquote.js +2 -3
  78. package/dist/cjs/validator/specs/bodiedExtension.js +2 -3
  79. package/dist/cjs/validator/specs/bodiedExtension_with_marks.js +2 -3
  80. package/dist/cjs/validator/specs/border.js +2 -3
  81. package/dist/cjs/validator/specs/breakout.js +2 -3
  82. package/dist/cjs/validator/specs/bulletList.js +2 -3
  83. package/dist/cjs/validator/specs/caption.js +2 -3
  84. package/dist/cjs/validator/specs/code.js +2 -3
  85. package/dist/cjs/validator/specs/codeBlock.js +2 -3
  86. package/dist/cjs/validator/specs/codeBlock_with_marks.js +2 -3
  87. package/dist/cjs/validator/specs/codeBlock_with_no_marks.js +2 -3
  88. package/dist/cjs/validator/specs/code_inline.js +2 -3
  89. package/dist/cjs/validator/specs/dataConsumer.js +2 -3
  90. package/dist/cjs/validator/specs/date.js +2 -3
  91. package/dist/cjs/validator/specs/decisionItem.js +2 -3
  92. package/dist/cjs/validator/specs/decisionList.js +2 -3
  93. package/dist/cjs/validator/specs/doc.js +3 -4
  94. package/dist/cjs/validator/specs/em.js +2 -3
  95. package/dist/cjs/validator/specs/embedCard.js +2 -3
  96. package/dist/cjs/validator/specs/emoji.js +2 -3
  97. package/dist/cjs/validator/specs/expand.js +2 -3
  98. package/dist/cjs/validator/specs/expand_with_breakout_mark.js +2 -3
  99. package/dist/cjs/validator/specs/expand_with_no_mark.js +2 -3
  100. package/dist/cjs/validator/specs/extension.js +2 -3
  101. package/dist/cjs/validator/specs/extensionFrame.js +19 -0
  102. package/dist/cjs/validator/specs/extension_with_marks.js +2 -3
  103. package/dist/cjs/validator/specs/formatted_text_inline.js +2 -3
  104. package/dist/cjs/validator/specs/fragment.js +2 -3
  105. package/dist/cjs/validator/specs/hardBreak.js +2 -3
  106. package/dist/cjs/validator/specs/heading.js +2 -3
  107. package/dist/cjs/validator/specs/heading_with_alignment.js +2 -3
  108. package/dist/cjs/validator/specs/heading_with_indentation.js +2 -3
  109. package/dist/cjs/validator/specs/heading_with_no_marks.js +2 -3
  110. package/dist/cjs/validator/specs/indentation.js +2 -3
  111. package/dist/cjs/validator/specs/index.js +14 -0
  112. package/dist/cjs/validator/specs/inline.js +1 -2
  113. package/dist/cjs/validator/specs/inlineCard.js +2 -3
  114. package/dist/cjs/validator/specs/inlineExtension.js +2 -3
  115. package/dist/cjs/validator/specs/inlineExtension_with_marks.js +2 -3
  116. package/dist/cjs/validator/specs/inline_comment_marker.js +2 -3
  117. package/dist/cjs/validator/specs/layoutColumn.js +2 -3
  118. package/dist/cjs/validator/specs/layoutSection.js +2 -3
  119. package/dist/cjs/validator/specs/layoutSection_full.js +2 -3
  120. package/dist/cjs/validator/specs/layoutSection_with_single_column.js +2 -3
  121. package/dist/cjs/validator/specs/link.js +2 -3
  122. package/dist/cjs/validator/specs/link_text_inline.js +2 -3
  123. package/dist/cjs/validator/specs/listItem.js +2 -3
  124. package/dist/cjs/validator/specs/media.js +2 -3
  125. package/dist/cjs/validator/specs/mediaGroup.js +2 -3
  126. package/dist/cjs/validator/specs/mediaInline.js +2 -3
  127. package/dist/cjs/validator/specs/mediaSingle.js +2 -3
  128. package/dist/cjs/validator/specs/mediaSingle_caption.js +2 -3
  129. package/dist/cjs/validator/specs/mediaSingle_full.js +2 -3
  130. package/dist/cjs/validator/specs/mention.js +2 -3
  131. package/dist/cjs/validator/specs/multiBodiedExtension.js +58 -0
  132. package/dist/cjs/validator/specs/nestedExpand.js +2 -3
  133. package/dist/cjs/validator/specs/nestedExpand_content.js +2 -3
  134. package/dist/cjs/validator/specs/nestedExpand_with_no_marks.js +2 -3
  135. package/dist/cjs/validator/specs/non_nestable_block_content.js +1 -2
  136. package/dist/cjs/validator/specs/orderedList.js +2 -3
  137. package/dist/cjs/validator/specs/panel.js +2 -3
  138. package/dist/cjs/validator/specs/paragraph.js +2 -3
  139. package/dist/cjs/validator/specs/paragraph_with_alignment.js +2 -3
  140. package/dist/cjs/validator/specs/paragraph_with_indentation.js +2 -3
  141. package/dist/cjs/validator/specs/paragraph_with_no_marks.js +2 -3
  142. package/dist/cjs/validator/specs/placeholder.js +2 -3
  143. package/dist/cjs/validator/specs/rule.js +2 -3
  144. package/dist/cjs/validator/specs/status.js +2 -3
  145. package/dist/cjs/validator/specs/strike.js +2 -3
  146. package/dist/cjs/validator/specs/strong.js +2 -3
  147. package/dist/cjs/validator/specs/subsup.js +2 -3
  148. package/dist/cjs/validator/specs/table.js +2 -3
  149. package/dist/cjs/validator/specs/tableCell.js +2 -3
  150. package/dist/cjs/validator/specs/tableCell_content.js +2 -3
  151. package/dist/cjs/validator/specs/tableHeader.js +2 -3
  152. package/dist/cjs/validator/specs/tableRow.js +2 -3
  153. package/dist/cjs/validator/specs/taskItem.js +2 -3
  154. package/dist/cjs/validator/specs/taskList.js +2 -3
  155. package/dist/cjs/validator/specs/text.js +2 -3
  156. package/dist/cjs/validator/specs/textColor.js +2 -3
  157. package/dist/cjs/validator/specs/underline.js +2 -3
  158. package/dist/cjs/validator/utils.js +9 -17
  159. package/dist/cjs/validator/validator.js +2 -2
  160. package/dist/es2019/builders/nodes/multi-bodied-extension.js +5 -0
  161. package/dist/es2019/validator/specs/doc.js +1 -1
  162. package/dist/es2019/validator/specs/extensionFrame.js +13 -0
  163. package/dist/es2019/validator/specs/index.js +2 -0
  164. package/dist/es2019/validator/specs/multiBodiedExtension.js +52 -0
  165. package/dist/esm/builders/nodes/multi-bodied-extension.js +12 -0
  166. package/dist/esm/transforms/dedupe-marks-transform.js +3 -3
  167. package/dist/esm/transforms/indentation-marks-transform.js +1 -1
  168. package/dist/esm/transforms/media-link-transform.js +1 -1
  169. package/dist/esm/transforms/nodes-missing-content-transform.js +3 -3
  170. package/dist/esm/validator/specs/doc.js +1 -1
  171. package/dist/esm/validator/specs/extensionFrame.js +13 -0
  172. package/dist/esm/validator/specs/index.js +2 -0
  173. package/dist/esm/validator/specs/multiBodiedExtension.js +52 -0
  174. package/dist/esm/validator/validator.js +2 -2
  175. package/dist/types/builders/nodes/doc.d.ts +2 -2
  176. package/dist/types/builders/nodes/multi-bodied-extension.d.ts +2 -0
  177. package/dist/types/validator/specs/extensionFrame.d.ts +14 -0
  178. package/dist/types/validator/specs/index.d.ts +2 -0
  179. package/dist/types/validator/specs/multiBodiedExtension.d.ts +53 -0
  180. package/dist/types-ts4.5/builders/nodes/doc.d.ts +2 -2
  181. package/dist/types-ts4.5/builders/nodes/multi-bodied-extension.d.ts +2 -0
  182. package/dist/types-ts4.5/validator/specs/extensionFrame.d.ts +14 -0
  183. package/dist/types-ts4.5/validator/specs/index.d.ts +2 -0
  184. package/dist/types-ts4.5/validator/specs/multiBodiedExtension.d.ts +53 -0
  185. package/package.json +2 -2
@@ -6,40 +6,32 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.makeArray = exports.isString = exports.isPlainObject = exports.isNumber = exports.isInteger = exports.isDefined = exports.isBoolean = exports.copy = void 0;
8
8
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
- var isDefined = function isDefined(x) {
9
+ var isDefined = exports.isDefined = function isDefined(x) {
10
10
  return x != null;
11
11
  };
12
- exports.isDefined = isDefined;
13
- var isNumber = function isNumber(x) {
12
+ var isNumber = exports.isNumber = function isNumber(x) {
14
13
  return typeof x === 'number' && !isNaN(x) && isFinite(x);
15
14
  };
16
- exports.isNumber = isNumber;
17
- var isInteger = function isInteger(x) {
15
+ var isInteger = exports.isInteger = function isInteger(x) {
18
16
  return typeof x === 'number' && isFinite(x) && Math.floor(x) === x;
19
17
  };
20
- exports.isInteger = isInteger;
21
- var isBoolean = function isBoolean(x) {
18
+ var isBoolean = exports.isBoolean = function isBoolean(x) {
22
19
  return x === true || x === false || toString.call(x) === '[object Boolean]';
23
20
  };
24
21
 
25
22
  // This is a kludge, might replace with something like _.isString in future
26
- exports.isBoolean = isBoolean;
27
- var isString = function isString(s) {
23
+ var isString = exports.isString = function isString(s) {
28
24
  return typeof s === 'string' || s instanceof String;
29
25
  };
30
- exports.isString = isString;
31
- var isPlainObject = function isPlainObject(x) {
26
+ var isPlainObject = exports.isPlainObject = function isPlainObject(x) {
32
27
  return (0, _typeof2.default)(x) === 'object' && x !== null && !Array.isArray(x);
33
28
  };
34
- exports.isPlainObject = isPlainObject;
35
- var copy = function copy(source, dest, key) {
29
+ var copy = exports.copy = function copy(source, dest, key) {
36
30
  dest[key] = source[key];
37
31
  return dest;
38
32
  };
39
33
 
40
34
  // Helpers
41
- exports.copy = copy;
42
- var makeArray = function makeArray(maybeArray) {
35
+ var makeArray = exports.makeArray = function makeArray(maybeArray) {
43
36
  return Array.isArray(maybeArray) ? maybeArray : [maybeArray];
44
- };
45
- exports.makeArray = makeArray;
37
+ };
@@ -105,9 +105,9 @@ function createSpec(nodes, marks) {
105
105
  // Node with overrides
106
106
  // ['mediaSingle', { props: { content: { items: [ 'media', 'caption' ] } }}]
107
107
  if (Array.isArray(subItem)) {
108
- var _subItem$, _subItem$$props, _subItem$$props$conte;
108
+ var _subItem$;
109
109
  var isMainNodeSupported = nodes.indexOf(subItem[0]) > -1;
110
- if (isMainNodeSupported && (_subItem$ = subItem[1]) !== null && _subItem$ !== void 0 && (_subItem$$props = _subItem$.props) !== null && _subItem$$props !== void 0 && (_subItem$$props$conte = _subItem$$props.content) !== null && _subItem$$props$conte !== void 0 && _subItem$$props$conte.items) {
110
+ if (isMainNodeSupported && (_subItem$ = subItem[1]) !== null && _subItem$ !== void 0 && (_subItem$ = _subItem$.props) !== null && _subItem$ !== void 0 && (_subItem$ = _subItem$.content) !== null && _subItem$ !== void 0 && _subItem$.items) {
111
111
  return subItem[1].props.content.items.every(function (item) {
112
112
  return nodes.indexOf(item) > -1;
113
113
  });
@@ -0,0 +1,5 @@
1
+ export const bodiedExtension = attrs => (...content) => ({
2
+ type: 'multiBodiedExtension',
3
+ attrs,
4
+ content
5
+ });
@@ -10,7 +10,7 @@ export default {
10
10
  },
11
11
  content: {
12
12
  type: 'array',
13
- items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'mediaSingle_caption', 'mediaSingle_full', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'bulletList', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'expand_with_breakout_mark', 'bodiedExtension_with_marks', 'layoutSection_full', 'layoutSection_with_single_column']],
13
+ items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'mediaSingle_caption', 'mediaSingle_full', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'bulletList', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'expand_with_breakout_mark', 'bodiedExtension_with_marks', 'layoutSection_full', 'layoutSection_with_single_column', 'multiBodiedExtension']],
14
14
  allowUnsupportedBlock: true
15
15
  }
16
16
  }
@@ -0,0 +1,13 @@
1
+ export default {
2
+ props: {
3
+ type: {
4
+ type: 'enum',
5
+ values: ['extensionFrame']
6
+ },
7
+ content: {
8
+ type: 'array',
9
+ items: [['blockCard', 'paragraph_with_no_marks', 'mediaSingle_caption', 'mediaSingle_full', 'codeBlock_with_no_marks', 'bulletList', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table', 'bodiedExtension_with_marks']],
10
+ minItems: 1
11
+ }
12
+ }
13
+ };
@@ -81,4 +81,6 @@ export { default as layoutColumn } from './layoutColumn';
81
81
  export { default as layoutSection } from './layoutSection';
82
82
  export { default as layoutSection_full } from './layoutSection_full';
83
83
  export { default as layoutSection_with_single_column } from './layoutSection_with_single_column';
84
+ export { default as extensionFrame } from './extensionFrame';
85
+ export { default as multiBodiedExtension } from './multiBodiedExtension';
84
86
  export { default as doc } from './doc';
@@ -0,0 +1,52 @@
1
+ export default {
2
+ props: {
3
+ type: {
4
+ type: 'enum',
5
+ values: ['multiBodiedExtension']
6
+ },
7
+ attrs: {
8
+ props: {
9
+ maxFrames: {
10
+ type: 'number',
11
+ default: 5,
12
+ optional: true
13
+ },
14
+ extensionKey: {
15
+ type: 'string',
16
+ minLength: 1
17
+ },
18
+ extensionType: {
19
+ type: 'string',
20
+ minLength: 1
21
+ },
22
+ parameters: {
23
+ type: 'object',
24
+ optional: true
25
+ },
26
+ text: {
27
+ type: 'string',
28
+ optional: true
29
+ },
30
+ layout: {
31
+ type: 'enum',
32
+ values: ['wide', 'full-width', 'default'],
33
+ optional: true
34
+ },
35
+ localId: {
36
+ type: 'string',
37
+ minLength: 1,
38
+ optional: true
39
+ }
40
+ }
41
+ },
42
+ marks: {
43
+ type: 'array',
44
+ items: [],
45
+ optional: true
46
+ },
47
+ content: {
48
+ type: 'array',
49
+ items: ['extensionFrame']
50
+ }
51
+ }
52
+ };
@@ -0,0 +1,12 @@
1
+ export var bodiedExtension = function bodiedExtension(attrs) {
2
+ return function () {
3
+ for (var _len = arguments.length, content = new Array(_len), _key = 0; _key < _len; _key++) {
4
+ content[_key] = arguments[_key];
5
+ }
6
+ return {
7
+ type: 'multiBodiedExtension',
8
+ attrs: attrs,
9
+ content: content
10
+ };
11
+ };
12
+ };
@@ -9,10 +9,10 @@ import { traverse } from '../traverse/traverse';
9
9
  // annotations as long as they have unique id attributes (valid scenario)
10
10
  var markDuplicatesDisallowed = new Set(['strong', 'underline', 'textColor', 'link', 'em', 'subsup', 'strike']);
11
11
  var maybeHasDisallowedDuplicateMarks = function maybeHasDisallowedDuplicateMarks(node) {
12
- var _node$marks, _node$marks$map;
13
- var markTypes = (_node$marks = node.marks) === null || _node$marks === void 0 ? void 0 : (_node$marks$map = _node$marks.map(function (mark) {
12
+ var _node$marks;
13
+ var markTypes = (_node$marks = node.marks) === null || _node$marks === void 0 || (_node$marks = _node$marks.map(function (mark) {
14
14
  return mark.type;
15
- })) === null || _node$marks$map === void 0 ? void 0 : _node$marks$map.filter(function (markType) {
15
+ })) === null || _node$marks === void 0 ? void 0 : _node$marks.filter(function (markType) {
16
16
  return (
17
17
  // For annotations, we are performing the same cheap check
18
18
  // for duplicates by type, without considering IDs, to quickly determine
@@ -6,7 +6,7 @@ var hasChildHeadingWithIndentation = function hasChildHeadingWithIndentation(nod
6
6
  var _node$content$some, _node$content;
7
7
  return (_node$content$some = (_node$content = node.content) === null || _node$content === void 0 ? void 0 : _node$content.some(function (childNode) {
8
8
  var _childNode$marks;
9
- return (childNode === null || childNode === void 0 ? void 0 : childNode.type) === 'heading' && (childNode === null || childNode === void 0 ? void 0 : (_childNode$marks = childNode.marks) === null || _childNode$marks === void 0 ? void 0 : _childNode$marks.some(function (mark) {
9
+ return (childNode === null || childNode === void 0 ? void 0 : childNode.type) === 'heading' && (childNode === null || childNode === void 0 || (_childNode$marks = childNode.marks) === null || _childNode$marks === void 0 ? void 0 : _childNode$marks.some(function (mark) {
10
10
  return mark.type === 'indentation';
11
11
  }));
12
12
  })) !== null && _node$content$some !== void 0 ? _node$content$some : false;
@@ -14,7 +14,7 @@ export var transformMediaLinkMarks = function transformMediaLinkMarks(adf) {
14
14
  if (mark.type === 'link') {
15
15
  var _node$marks;
16
16
  linkMark = mark;
17
- (_node$marks = node.marks) === null || _node$marks === void 0 ? void 0 : _node$marks.splice(i, 1);
17
+ (_node$marks = node.marks) === null || _node$marks === void 0 || _node$marks.splice(i, 1);
18
18
  isTransformed = true;
19
19
  }
20
20
  });
@@ -8,7 +8,7 @@ import { isEmpty } from './helpers';
8
8
  var getMaxColumnsCountForTable = function getMaxColumnsCountForTable(tableNode) {
9
9
  var _tableNode$content;
10
10
  var colsInRow = 1;
11
- (_tableNode$content = tableNode.content) === null || _tableNode$content === void 0 ? void 0 : _tableNode$content.forEach(function (childNode) {
11
+ (_tableNode$content = tableNode.content) === null || _tableNode$content === void 0 || _tableNode$content.forEach(function (childNode) {
12
12
  var _childNode$content;
13
13
  if ((childNode === null || childNode === void 0 ? void 0 : childNode.type) === 'tableRow' && typeof ((_childNode$content = childNode.content) === null || _childNode$content === void 0 ? void 0 : _childNode$content.length) === 'number' && childNode.content.length > colsInRow) {
14
14
  colsInRow = childNode.content.length;
@@ -115,9 +115,9 @@ var tryCreateValidTableRowWrappedChildren = function tryCreateValidTableRowWrapp
115
115
  };
116
116
  var hasEmptyTableRowChildren = function hasEmptyTableRowChildren(node) {
117
117
  var _node$content4;
118
- return node === null || node === void 0 ? void 0 : (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(function (node) {
118
+ return node === null || node === void 0 || (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(function (node) {
119
119
  var _node$content5;
120
- return (node === null || node === void 0 ? void 0 : node.type) === 'tableRow' && (node === null || node === void 0 ? void 0 : (_node$content5 = node.content) === null || _node$content5 === void 0 ? void 0 : _node$content5.length) === 0;
120
+ return (node === null || node === void 0 ? void 0 : node.type) === 'tableRow' && (node === null || node === void 0 || (_node$content5 = node.content) === null || _node$content5 === void 0 ? void 0 : _node$content5.length) === 0;
121
121
  });
122
122
  };
123
123
  var fixIfTableParentWithInvalidTableRowChildren = function fixIfTableParentWithInvalidTableRowChildren(reportTransform) {
@@ -10,7 +10,7 @@ export default {
10
10
  },
11
11
  content: {
12
12
  type: 'array',
13
- items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'mediaSingle_caption', 'mediaSingle_full', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'bulletList', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'expand_with_breakout_mark', 'bodiedExtension_with_marks', 'layoutSection_full', 'layoutSection_with_single_column']],
13
+ items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'mediaSingle_caption', 'mediaSingle_full', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'bulletList', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'expand_with_breakout_mark', 'bodiedExtension_with_marks', 'layoutSection_full', 'layoutSection_with_single_column', 'multiBodiedExtension']],
14
14
  allowUnsupportedBlock: true
15
15
  }
16
16
  }
@@ -0,0 +1,13 @@
1
+ export default {
2
+ props: {
3
+ type: {
4
+ type: 'enum',
5
+ values: ['extensionFrame']
6
+ },
7
+ content: {
8
+ type: 'array',
9
+ items: [['blockCard', 'paragraph_with_no_marks', 'mediaSingle_caption', 'mediaSingle_full', 'codeBlock_with_no_marks', 'bulletList', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table', 'bodiedExtension_with_marks']],
10
+ minItems: 1
11
+ }
12
+ }
13
+ };
@@ -81,4 +81,6 @@ export { default as layoutColumn } from './layoutColumn';
81
81
  export { default as layoutSection } from './layoutSection';
82
82
  export { default as layoutSection_full } from './layoutSection_full';
83
83
  export { default as layoutSection_with_single_column } from './layoutSection_with_single_column';
84
+ export { default as extensionFrame } from './extensionFrame';
85
+ export { default as multiBodiedExtension } from './multiBodiedExtension';
84
86
  export { default as doc } from './doc';
@@ -0,0 +1,52 @@
1
+ export default {
2
+ props: {
3
+ type: {
4
+ type: 'enum',
5
+ values: ['multiBodiedExtension']
6
+ },
7
+ attrs: {
8
+ props: {
9
+ maxFrames: {
10
+ type: 'number',
11
+ default: 5,
12
+ optional: true
13
+ },
14
+ extensionKey: {
15
+ type: 'string',
16
+ minLength: 1
17
+ },
18
+ extensionType: {
19
+ type: 'string',
20
+ minLength: 1
21
+ },
22
+ parameters: {
23
+ type: 'object',
24
+ optional: true
25
+ },
26
+ text: {
27
+ type: 'string',
28
+ optional: true
29
+ },
30
+ layout: {
31
+ type: 'enum',
32
+ values: ['wide', 'full-width', 'default'],
33
+ optional: true
34
+ },
35
+ localId: {
36
+ type: 'string',
37
+ minLength: 1,
38
+ optional: true
39
+ }
40
+ }
41
+ },
42
+ marks: {
43
+ type: 'array',
44
+ items: [],
45
+ optional: true
46
+ },
47
+ content: {
48
+ type: 'array',
49
+ items: ['extensionFrame']
50
+ }
51
+ }
52
+ };
@@ -94,9 +94,9 @@ function createSpec(nodes, marks) {
94
94
  // Node with overrides
95
95
  // ['mediaSingle', { props: { content: { items: [ 'media', 'caption' ] } }}]
96
96
  if (Array.isArray(subItem)) {
97
- var _subItem$, _subItem$$props, _subItem$$props$conte;
97
+ var _subItem$;
98
98
  var isMainNodeSupported = nodes.indexOf(subItem[0]) > -1;
99
- if (isMainNodeSupported && (_subItem$ = subItem[1]) !== null && _subItem$ !== void 0 && (_subItem$$props = _subItem$.props) !== null && _subItem$$props !== void 0 && (_subItem$$props$conte = _subItem$$props.content) !== null && _subItem$$props$conte !== void 0 && _subItem$$props$conte.items) {
99
+ if (isMainNodeSupported && (_subItem$ = subItem[1]) !== null && _subItem$ !== void 0 && (_subItem$ = _subItem$.props) !== null && _subItem$ !== void 0 && (_subItem$ = _subItem$.content) !== null && _subItem$ !== void 0 && _subItem$.items) {
100
100
  return subItem[1].props.content.items.every(function (item) {
101
101
  return nodes.indexOf(item) > -1;
102
102
  });
@@ -1,2 +1,2 @@
1
- import { DocNode, BlockContent, LayoutSectionDefinition } from '@atlaskit/adf-schema';
2
- export declare const doc: (...content: Array<BlockContent | LayoutSectionDefinition>) => DocNode;
1
+ import type { DocNode, BlockContent, LayoutSectionDefinition, MultiBodiedExtensionDefinition } from '@atlaskit/adf-schema';
2
+ export declare const doc: (...content: Array<BlockContent | LayoutSectionDefinition | MultiBodiedExtensionDefinition>) => DocNode;
@@ -0,0 +1,2 @@
1
+ import type { ExtensionFrameDefinition, MultiBodiedExtensionDefinition } from '@atlaskit/adf-schema';
2
+ export declare const bodiedExtension: (attrs: MultiBodiedExtensionDefinition['attrs']) => (...content: Array<ExtensionFrameDefinition>) => MultiBodiedExtensionDefinition;
@@ -0,0 +1,14 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ content: {
8
+ type: string;
9
+ items: string[][];
10
+ minItems: number;
11
+ };
12
+ };
13
+ };
14
+ export default _default;
@@ -80,4 +80,6 @@ export { default as layoutColumn } from './layoutColumn';
80
80
  export { default as layoutSection } from './layoutSection';
81
81
  export { default as layoutSection_full } from './layoutSection_full';
82
82
  export { default as layoutSection_with_single_column } from './layoutSection_with_single_column';
83
+ export { default as extensionFrame } from './extensionFrame';
84
+ export { default as multiBodiedExtension } from './multiBodiedExtension';
83
85
  export { default as doc } from './doc';
@@ -0,0 +1,53 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ attrs: {
8
+ props: {
9
+ maxFrames: {
10
+ type: string;
11
+ default: number;
12
+ optional: boolean;
13
+ };
14
+ extensionKey: {
15
+ type: string;
16
+ minLength: number;
17
+ };
18
+ extensionType: {
19
+ type: string;
20
+ minLength: number;
21
+ };
22
+ parameters: {
23
+ type: string;
24
+ optional: boolean;
25
+ };
26
+ text: {
27
+ type: string;
28
+ optional: boolean;
29
+ };
30
+ layout: {
31
+ type: string;
32
+ values: string[];
33
+ optional: boolean;
34
+ };
35
+ localId: {
36
+ type: string;
37
+ minLength: number;
38
+ optional: boolean;
39
+ };
40
+ };
41
+ };
42
+ marks: {
43
+ type: string;
44
+ items: never[];
45
+ optional: boolean;
46
+ };
47
+ content: {
48
+ type: string;
49
+ items: string[];
50
+ };
51
+ };
52
+ };
53
+ export default _default;
@@ -1,2 +1,2 @@
1
- import { DocNode, BlockContent, LayoutSectionDefinition } from '@atlaskit/adf-schema';
2
- export declare const doc: (...content: Array<BlockContent | LayoutSectionDefinition>) => DocNode;
1
+ import type { DocNode, BlockContent, LayoutSectionDefinition, MultiBodiedExtensionDefinition } from '@atlaskit/adf-schema';
2
+ export declare const doc: (...content: Array<BlockContent | LayoutSectionDefinition | MultiBodiedExtensionDefinition>) => DocNode;
@@ -0,0 +1,2 @@
1
+ import type { ExtensionFrameDefinition, MultiBodiedExtensionDefinition } from '@atlaskit/adf-schema';
2
+ export declare const bodiedExtension: (attrs: MultiBodiedExtensionDefinition['attrs']) => (...content: Array<ExtensionFrameDefinition>) => MultiBodiedExtensionDefinition;
@@ -0,0 +1,14 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ content: {
8
+ type: string;
9
+ items: string[][];
10
+ minItems: number;
11
+ };
12
+ };
13
+ };
14
+ export default _default;
@@ -80,4 +80,6 @@ export { default as layoutColumn } from './layoutColumn';
80
80
  export { default as layoutSection } from './layoutSection';
81
81
  export { default as layoutSection_full } from './layoutSection_full';
82
82
  export { default as layoutSection_with_single_column } from './layoutSection_with_single_column';
83
+ export { default as extensionFrame } from './extensionFrame';
84
+ export { default as multiBodiedExtension } from './multiBodiedExtension';
83
85
  export { default as doc } from './doc';
@@ -0,0 +1,53 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ attrs: {
8
+ props: {
9
+ maxFrames: {
10
+ type: string;
11
+ default: number;
12
+ optional: boolean;
13
+ };
14
+ extensionKey: {
15
+ type: string;
16
+ minLength: number;
17
+ };
18
+ extensionType: {
19
+ type: string;
20
+ minLength: number;
21
+ };
22
+ parameters: {
23
+ type: string;
24
+ optional: boolean;
25
+ };
26
+ text: {
27
+ type: string;
28
+ optional: boolean;
29
+ };
30
+ layout: {
31
+ type: string;
32
+ values: string[];
33
+ optional: boolean;
34
+ };
35
+ localId: {
36
+ type: string;
37
+ minLength: number;
38
+ optional: boolean;
39
+ };
40
+ };
41
+ };
42
+ marks: {
43
+ type: string;
44
+ items: never[];
45
+ optional: boolean;
46
+ };
47
+ content: {
48
+ type: string;
49
+ items: string[];
50
+ };
51
+ };
52
+ };
53
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-utils",
3
- "version": "19.0.10",
3
+ "version": "19.0.12",
4
4
  "description": "Set of utilities to traverse, modify and create ADF documents.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -41,7 +41,7 @@
41
41
  "generate:spec": "rm -rf ./src/validator/specs/ && yarn json-schema-generator --outDir=./src/validator/specs/ --mode=Spec --stage=0 ./src/validator/entry.ts"
42
42
  },
43
43
  "dependencies": {
44
- "@atlaskit/adf-schema": "^32.0.0",
44
+ "@atlaskit/adf-schema": "^34.0.0",
45
45
  "@atlaskit/codemod-utils": "^4.2.0",
46
46
  "@babel/runtime": "^7.0.0"
47
47
  },