@atlaskit/adf-utils 17.1.4 → 17.1.5

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 (190) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/codemods/17.0.0-update-imports-to-new-entry-points.ts +2 -3
  3. package/dist/cjs/transforms/helpers.js +14 -0
  4. package/dist/cjs/transforms/invalid-media-content-transform.js +103 -0
  5. package/dist/cjs/transforms/nodes-missing-content-transform.js +26 -20
  6. package/dist/cjs/transforms.js +9 -1
  7. package/dist/cjs/version.json +1 -1
  8. package/dist/es2019/transforms/helpers.js +5 -0
  9. package/dist/es2019/transforms/invalid-media-content-transform.js +77 -0
  10. package/dist/es2019/transforms/nodes-missing-content-transform.js +20 -17
  11. package/dist/es2019/transforms.js +2 -1
  12. package/dist/es2019/version.json +1 -1
  13. package/dist/esm/transforms/helpers.js +5 -0
  14. package/dist/esm/transforms/invalid-media-content-transform.js +91 -0
  15. package/dist/esm/transforms/nodes-missing-content-transform.js +22 -17
  16. package/dist/esm/transforms.js +2 -1
  17. package/dist/esm/version.json +1 -1
  18. package/dist/types/transforms/helpers.d.ts +2 -0
  19. package/dist/types/transforms/invalid-media-content-transform.d.ts +5 -0
  20. package/dist/types/transforms.d.ts +1 -0
  21. package/package.json +6 -10
  22. package/report.api.md +15 -2
  23. package/dist/types-ts4.0/builders/marks/alignment.d.ts +0 -3
  24. package/dist/types-ts4.0/builders/marks/annotation.d.ts +0 -3
  25. package/dist/types-ts4.0/builders/marks/breakout.d.ts +0 -3
  26. package/dist/types-ts4.0/builders/marks/code.d.ts +0 -2
  27. package/dist/types-ts4.0/builders/marks/data-consumer.d.ts +0 -3
  28. package/dist/types-ts4.0/builders/marks/em.d.ts +0 -2
  29. package/dist/types-ts4.0/builders/marks/fragment.d.ts +0 -3
  30. package/dist/types-ts4.0/builders/marks/indentation.d.ts +0 -3
  31. package/dist/types-ts4.0/builders/marks/link.d.ts +0 -3
  32. package/dist/types-ts4.0/builders/marks/strike.d.ts +0 -2
  33. package/dist/types-ts4.0/builders/marks/strong.d.ts +0 -2
  34. package/dist/types-ts4.0/builders/marks/subsup.d.ts +0 -3
  35. package/dist/types-ts4.0/builders/marks/text-color.d.ts +0 -3
  36. package/dist/types-ts4.0/builders/marks/underline.d.ts +0 -2
  37. package/dist/types-ts4.0/builders/nodes/block-card.d.ts +0 -2
  38. package/dist/types-ts4.0/builders/nodes/blockquote.d.ts +0 -2
  39. package/dist/types-ts4.0/builders/nodes/bodied-extension.d.ts +0 -2
  40. package/dist/types-ts4.0/builders/nodes/bullet-list.d.ts +0 -2
  41. package/dist/types-ts4.0/builders/nodes/caption.d.ts +0 -2
  42. package/dist/types-ts4.0/builders/nodes/code-block.d.ts +0 -3
  43. package/dist/types-ts4.0/builders/nodes/date.d.ts +0 -2
  44. package/dist/types-ts4.0/builders/nodes/decision-item.d.ts +0 -2
  45. package/dist/types-ts4.0/builders/nodes/decision-list.d.ts +0 -2
  46. package/dist/types-ts4.0/builders/nodes/doc.d.ts +0 -2
  47. package/dist/types-ts4.0/builders/nodes/embed-card.d.ts +0 -2
  48. package/dist/types-ts4.0/builders/nodes/emoji.d.ts +0 -2
  49. package/dist/types-ts4.0/builders/nodes/expand.d.ts +0 -2
  50. package/dist/types-ts4.0/builders/nodes/extension.d.ts +0 -2
  51. package/dist/types-ts4.0/builders/nodes/hard-break.d.ts +0 -2
  52. package/dist/types-ts4.0/builders/nodes/heading.d.ts +0 -2
  53. package/dist/types-ts4.0/builders/nodes/inline-card.d.ts +0 -2
  54. package/dist/types-ts4.0/builders/nodes/inline-extension.d.ts +0 -2
  55. package/dist/types-ts4.0/builders/nodes/layout-column.d.ts +0 -4
  56. package/dist/types-ts4.0/builders/nodes/layout-section.d.ts +0 -2
  57. package/dist/types-ts4.0/builders/nodes/list-item.d.ts +0 -2
  58. package/dist/types-ts4.0/builders/nodes/media-group.d.ts +0 -2
  59. package/dist/types-ts4.0/builders/nodes/media-inline.d.ts +0 -2
  60. package/dist/types-ts4.0/builders/nodes/media-single.d.ts +0 -7
  61. package/dist/types-ts4.0/builders/nodes/media.d.ts +0 -2
  62. package/dist/types-ts4.0/builders/nodes/mention.d.ts +0 -2
  63. package/dist/types-ts4.0/builders/nodes/nested-expand.d.ts +0 -2
  64. package/dist/types-ts4.0/builders/nodes/ordered-list.d.ts +0 -2
  65. package/dist/types-ts4.0/builders/nodes/panel.d.ts +0 -2
  66. package/dist/types-ts4.0/builders/nodes/paragraph.d.ts +0 -2
  67. package/dist/types-ts4.0/builders/nodes/placeholder.d.ts +0 -2
  68. package/dist/types-ts4.0/builders/nodes/rule.d.ts +0 -2
  69. package/dist/types-ts4.0/builders/nodes/status.d.ts +0 -2
  70. package/dist/types-ts4.0/builders/nodes/table-cell.d.ts +0 -2
  71. package/dist/types-ts4.0/builders/nodes/table-header.d.ts +0 -2
  72. package/dist/types-ts4.0/builders/nodes/table-row.d.ts +0 -2
  73. package/dist/types-ts4.0/builders/nodes/table.d.ts +0 -2
  74. package/dist/types-ts4.0/builders/nodes/task-item.d.ts +0 -2
  75. package/dist/types-ts4.0/builders/nodes/task-list.d.ts +0 -2
  76. package/dist/types-ts4.0/builders/nodes/text.d.ts +0 -2
  77. package/dist/types-ts4.0/builders/types.d.ts +0 -8
  78. package/dist/types-ts4.0/builders/utils/apply-mark.d.ts +0 -4
  79. package/dist/types-ts4.0/builders/utils/create-text-nodes.d.ts +0 -3
  80. package/dist/types-ts4.0/builders/utils/is-duplicate-mark.d.ts +0 -6
  81. package/dist/types-ts4.0/builders.d.ts +0 -63
  82. package/dist/types-ts4.0/empty-adf.d.ts +0 -2
  83. package/dist/types-ts4.0/index.d.ts +0 -1
  84. package/dist/types-ts4.0/scrub/default-node-replacements.d.ts +0 -10
  85. package/dist/types-ts4.0/scrub/default-value-replacements.d.ts +0 -6
  86. package/dist/types-ts4.0/scrub/hash.d.ts +0 -1
  87. package/dist/types-ts4.0/scrub/scrub-adf.d.ts +0 -9
  88. package/dist/types-ts4.0/scrub/scrub-content.d.ts +0 -11
  89. package/dist/types-ts4.0/scrub.d.ts +0 -1
  90. package/dist/types-ts4.0/transforms/dedupe-marks-transform.d.ts +0 -8
  91. package/dist/types-ts4.0/transforms/indentation-marks-transform.d.ts +0 -7
  92. package/dist/types-ts4.0/transforms/media-link-transform.d.ts +0 -5
  93. package/dist/types-ts4.0/transforms/nodes-missing-content-transform.d.ts +0 -7
  94. package/dist/types-ts4.0/transforms/text-link-code-transform.d.ts +0 -5
  95. package/dist/types-ts4.0/transforms.d.ts +0 -5
  96. package/dist/types-ts4.0/traverse/filter.d.ts +0 -2
  97. package/dist/types-ts4.0/traverse/map.d.ts +0 -2
  98. package/dist/types-ts4.0/traverse/reduce.d.ts +0 -2
  99. package/dist/types-ts4.0/traverse/traverse.d.ts +0 -12
  100. package/dist/types-ts4.0/traverse.d.ts +0 -4
  101. package/dist/types-ts4.0/types/index.d.ts +0 -24
  102. package/dist/types-ts4.0/types/validatorTypes.d.ts +0 -137
  103. package/dist/types-ts4.0/validator/entry.d.ts +0 -1
  104. package/dist/types-ts4.0/validator/rules.d.ts +0 -3
  105. package/dist/types-ts4.0/validator/specs/alignment.d.ts +0 -17
  106. package/dist/types-ts4.0/validator/specs/annotation.d.ts +0 -20
  107. package/dist/types-ts4.0/validator/specs/atomic_inline.d.ts +0 -2
  108. package/dist/types-ts4.0/validator/specs/blockCard.d.ts +0 -26
  109. package/dist/types-ts4.0/validator/specs/block_content.d.ts +0 -2
  110. package/dist/types-ts4.0/validator/specs/blockquote.d.ts +0 -15
  111. package/dist/types-ts4.0/validator/specs/bodiedExtension.d.ts +0 -50
  112. package/dist/types-ts4.0/validator/specs/bodiedExtension_with_marks.d.ts +0 -10
  113. package/dist/types-ts4.0/validator/specs/breakout.d.ts +0 -17
  114. package/dist/types-ts4.0/validator/specs/bulletList.d.ts +0 -14
  115. package/dist/types-ts4.0/validator/specs/caption.d.ts +0 -14
  116. package/dist/types-ts4.0/validator/specs/code.d.ts +0 -9
  117. package/dist/types-ts4.0/validator/specs/codeBlock.d.ts +0 -38
  118. package/dist/types-ts4.0/validator/specs/codeBlock_with_marks.d.ts +0 -10
  119. package/dist/types-ts4.0/validator/specs/codeBlock_with_no_marks.d.ts +0 -11
  120. package/dist/types-ts4.0/validator/specs/code_inline.d.ts +0 -10
  121. package/dist/types-ts4.0/validator/specs/dataConsumer.d.ts +0 -20
  122. package/dist/types-ts4.0/validator/specs/date.d.ts +0 -17
  123. package/dist/types-ts4.0/validator/specs/decisionItem.d.ts +0 -25
  124. package/dist/types-ts4.0/validator/specs/decisionList.d.ts +0 -22
  125. package/dist/types-ts4.0/validator/specs/doc.d.ts +0 -18
  126. package/dist/types-ts4.0/validator/specs/em.d.ts +0 -9
  127. package/dist/types-ts4.0/validator/specs/embedCard.d.ts +0 -35
  128. package/dist/types-ts4.0/validator/specs/emoji.d.ts +0 -24
  129. package/dist/types-ts4.0/validator/specs/expand.d.ts +0 -28
  130. package/dist/types-ts4.0/validator/specs/expand_with_breakout_mark.d.ts +0 -10
  131. package/dist/types-ts4.0/validator/specs/expand_with_no_mark.d.ts +0 -11
  132. package/dist/types-ts4.0/validator/specs/extension.d.ts +0 -44
  133. package/dist/types-ts4.0/validator/specs/extension_with_marks.d.ts +0 -10
  134. package/dist/types-ts4.0/validator/specs/formatted_text_inline.d.ts +0 -10
  135. package/dist/types-ts4.0/validator/specs/fragment.d.ts +0 -21
  136. package/dist/types-ts4.0/validator/specs/hardBreak.d.ts +0 -19
  137. package/dist/types-ts4.0/validator/specs/heading.d.ts +0 -29
  138. package/dist/types-ts4.0/validator/specs/heading_with_alignment.d.ts +0 -10
  139. package/dist/types-ts4.0/validator/specs/heading_with_indentation.d.ts +0 -10
  140. package/dist/types-ts4.0/validator/specs/heading_with_no_marks.d.ts +0 -11
  141. package/dist/types-ts4.0/validator/specs/indentation.d.ts +0 -18
  142. package/dist/types-ts4.0/validator/specs/index.d.ts +0 -82
  143. package/dist/types-ts4.0/validator/specs/inline.d.ts +0 -2
  144. package/dist/types-ts4.0/validator/specs/inlineCard.d.ts +0 -26
  145. package/dist/types-ts4.0/validator/specs/inlineExtension.d.ts +0 -39
  146. package/dist/types-ts4.0/validator/specs/inlineExtension_with_marks.d.ts +0 -10
  147. package/dist/types-ts4.0/validator/specs/inline_comment_marker.d.ts +0 -16
  148. package/dist/types-ts4.0/validator/specs/layoutColumn.d.ts +0 -24
  149. package/dist/types-ts4.0/validator/specs/layoutSection.d.ts +0 -18
  150. package/dist/types-ts4.0/validator/specs/layoutSection_full.d.ts +0 -21
  151. package/dist/types-ts4.0/validator/specs/layoutSection_with_single_column.d.ts +0 -21
  152. package/dist/types-ts4.0/validator/specs/link.d.ts +0 -33
  153. package/dist/types-ts4.0/validator/specs/link_text_inline.d.ts +0 -10
  154. package/dist/types-ts4.0/validator/specs/listItem.d.ts +0 -15
  155. package/dist/types-ts4.0/validator/specs/media.d.ts +0 -73
  156. package/dist/types-ts4.0/validator/specs/mediaGroup.d.ts +0 -15
  157. package/dist/types-ts4.0/validator/specs/mediaInline.d.ts +0 -51
  158. package/dist/types-ts4.0/validator/specs/mediaSingle.d.ts +0 -29
  159. package/dist/types-ts4.0/validator/specs/mediaSingle_caption.d.ts +0 -13
  160. package/dist/types-ts4.0/validator/specs/mediaSingle_full.d.ts +0 -12
  161. package/dist/types-ts4.0/validator/specs/mention.d.ts +0 -29
  162. package/dist/types-ts4.0/validator/specs/nestedExpand.d.ts +0 -19
  163. package/dist/types-ts4.0/validator/specs/nestedExpand_content.d.ts +0 -7
  164. package/dist/types-ts4.0/validator/specs/nestedExpand_with_no_marks.d.ts +0 -11
  165. package/dist/types-ts4.0/validator/specs/non_nestable_block_content.d.ts +0 -2
  166. package/dist/types-ts4.0/validator/specs/orderedList.d.ts +0 -23
  167. package/dist/types-ts4.0/validator/specs/panel.d.ts +0 -39
  168. package/dist/types-ts4.0/validator/specs/paragraph.d.ts +0 -20
  169. package/dist/types-ts4.0/validator/specs/paragraph_with_alignment.d.ts +0 -10
  170. package/dist/types-ts4.0/validator/specs/paragraph_with_indentation.d.ts +0 -10
  171. package/dist/types-ts4.0/validator/specs/paragraph_with_no_marks.d.ts +0 -11
  172. package/dist/types-ts4.0/validator/specs/placeholder.d.ts +0 -16
  173. package/dist/types-ts4.0/validator/specs/rule.d.ts +0 -9
  174. package/dist/types-ts4.0/validator/specs/status.d.ts +0 -29
  175. package/dist/types-ts4.0/validator/specs/strike.d.ts +0 -9
  176. package/dist/types-ts4.0/validator/specs/strong.d.ts +0 -9
  177. package/dist/types-ts4.0/validator/specs/subsup.d.ts +0 -17
  178. package/dist/types-ts4.0/validator/specs/table.d.ts +0 -38
  179. package/dist/types-ts4.0/validator/specs/tableCell.d.ts +0 -35
  180. package/dist/types-ts4.0/validator/specs/tableCell_content.d.ts +0 -7
  181. package/dist/types-ts4.0/validator/specs/tableHeader.d.ts +0 -35
  182. package/dist/types-ts4.0/validator/specs/tableRow.d.ts +0 -13
  183. package/dist/types-ts4.0/validator/specs/taskItem.d.ts +0 -26
  184. package/dist/types-ts4.0/validator/specs/taskList.d.ts +0 -23
  185. package/dist/types-ts4.0/validator/specs/text.d.ts +0 -18
  186. package/dist/types-ts4.0/validator/specs/textColor.d.ts +0 -17
  187. package/dist/types-ts4.0/validator/specs/underline.d.ts +0 -9
  188. package/dist/types-ts4.0/validator/utils.d.ts +0 -8
  189. package/dist/types-ts4.0/validator/validator.d.ts +0 -3
  190. package/dist/types-ts4.0/validator.d.ts +0 -1
@@ -7,6 +7,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
7
7
 
8
8
  import { traverse } from '../traverse/traverse';
9
9
  import { tableRow, tableCell, paragraph, listItem } from '../builders';
10
+ import { isEmpty } from './helpers';
10
11
 
11
12
  var getMaxColumnsCountForTable = function getMaxColumnsCountForTable(tableNode) {
12
13
  var _tableNode$content;
@@ -32,12 +33,6 @@ var createValidEmptyContent = function createValidEmptyContent(node) {
32
33
  }
33
34
  };
34
35
 
35
- var isEmpty = function isEmpty(node) {
36
- var _node$content;
37
-
38
- return ((_node$content = node.content) === null || _node$content === void 0 ? void 0 : _node$content.length) === 0;
39
- };
40
-
41
36
  var fixIfTableCellInvalidEmpty = function fixIfTableCellInvalidEmpty(reportTransform) {
42
37
  return function (node) {
43
38
  if (isEmpty(node)) {
@@ -50,17 +45,17 @@ var fixIfTableCellInvalidEmpty = function fixIfTableCellInvalidEmpty(reportTrans
50
45
  };
51
46
 
52
47
  var hasNonListItemChildren = function hasNonListItemChildren(node) {
53
- var _node$content2;
48
+ var _node$content;
54
49
 
55
- return (_node$content2 = node.content) === null || _node$content2 === void 0 ? void 0 : _node$content2.some(function (node) {
50
+ return (_node$content = node.content) === null || _node$content === void 0 ? void 0 : _node$content.some(function (node) {
56
51
  return (node === null || node === void 0 ? void 0 : node.type) !== 'listItem';
57
52
  });
58
53
  };
59
54
 
60
55
  var hasEmptyListItemChildren = function hasEmptyListItemChildren(node) {
61
- var _node$content3;
56
+ var _node$content2;
62
57
 
63
- return (_node$content3 = node.content) === null || _node$content3 === void 0 ? void 0 : _node$content3.some(function (childNode) {
58
+ return (_node$content2 = node.content) === null || _node$content2 === void 0 ? void 0 : _node$content2.some(function (childNode) {
64
59
  var _childNode$content2;
65
60
 
66
61
  return (childNode === null || childNode === void 0 ? void 0 : childNode.type) === 'listItem' && !((_childNode$content2 = childNode.content) !== null && _childNode$content2 !== void 0 && _childNode$content2.length);
@@ -107,9 +102,9 @@ var fixIfListParentWithInvalidListItemChildren = function fixIfListParentWithInv
107
102
  };
108
103
 
109
104
  var hasNonTableRowChildren = function hasNonTableRowChildren(node) {
110
- var _node$content4;
105
+ var _node$content3;
111
106
 
112
- return (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(function (node) {
107
+ return (_node$content3 = node.content) === null || _node$content3 === void 0 ? void 0 : _node$content3.some(function (node) {
113
108
  return (node === null || node === void 0 ? void 0 : node.type) !== 'tableRow';
114
109
  });
115
110
  };
@@ -150,12 +145,12 @@ var tryCreateValidTableRowWrappedChildren = function tryCreateValidTableRowWrapp
150
145
  };
151
146
 
152
147
  var hasEmptyTableRowChildren = function hasEmptyTableRowChildren(node) {
153
- var _node$content5;
148
+ var _node$content4;
154
149
 
155
- return node === null || node === void 0 ? void 0 : (_node$content5 = node.content) === null || _node$content5 === void 0 ? void 0 : _node$content5.some(function (node) {
156
- var _node$content6;
150
+ return node === null || node === void 0 ? void 0 : (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(function (node) {
151
+ var _node$content5;
157
152
 
158
- return (node === null || node === void 0 ? void 0 : node.type) === 'tableRow' && (node === null || node === void 0 ? void 0 : (_node$content6 = node.content) === null || _node$content6 === void 0 ? void 0 : _node$content6.length) === 0;
153
+ 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;
159
154
  });
160
155
  };
161
156
 
@@ -170,6 +165,15 @@ var fixIfTableParentWithInvalidTableRowChildren = function fixIfTableParentWithI
170
165
  };
171
166
  };
172
167
 
168
+ var removeMediaSingleWithNoContent = function removeMediaSingleWithNoContent(reportTransform) {
169
+ return function (node) {
170
+ if (isEmpty(node)) {
171
+ reportTransform();
172
+ return false;
173
+ }
174
+ };
175
+ };
176
+
173
177
  export var transformNodesMissingContent = function transformNodesMissingContent(adf) {
174
178
  var isTransformed = false;
175
179
 
@@ -183,7 +187,8 @@ export var transformNodesMissingContent = function transformNodesMissingContent(
183
187
  transformedAdf = traverse(transformedAdf || adf, {
184
188
  bulletList: fixIfListParentWithInvalidListItemChildren(reportTransform),
185
189
  orderedList: fixIfListParentWithInvalidListItemChildren(reportTransform),
186
- table: fixIfTableParentWithInvalidTableRowChildren(reportTransform)
190
+ table: fixIfTableParentWithInvalidTableRowChildren(reportTransform),
191
+ mediaSingle: removeMediaSingleWithNoContent(reportTransform)
187
192
  });
188
193
  return {
189
194
  transformedAdf: transformedAdf,
@@ -2,4 +2,5 @@ export { transformMediaLinkMarks } from './transforms/media-link-transform';
2
2
  export { transformTextLinkCodeMarks } from './transforms/text-link-code-transform';
3
3
  export { transformDedupeMarks } from './transforms/dedupe-marks-transform';
4
4
  export { transformNodesMissingContent } from './transforms/nodes-missing-content-transform';
5
- export { transformIndentationMarks } from './transforms/indentation-marks-transform';
5
+ export { transformIndentationMarks } from './transforms/indentation-marks-transform';
6
+ export { transformInvalidMediaContent } from './transforms/invalid-media-content-transform';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-utils",
3
- "version": "17.1.4",
3
+ "version": "17.1.5",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,2 @@
1
+ import { ADFEntity } from '../types';
2
+ export declare const isEmpty: (node: ADFEntity) => boolean;
@@ -0,0 +1,5 @@
1
+ import { ADFEntity } from '../types';
2
+ export declare const transformInvalidMediaContent: (adf: ADFEntity) => {
3
+ transformedAdf: ADFEntity;
4
+ isTransformed: boolean;
5
+ };
@@ -3,3 +3,4 @@ export { transformTextLinkCodeMarks } from './transforms/text-link-code-transfor
3
3
  export { transformDedupeMarks } from './transforms/dedupe-marks-transform';
4
4
  export { transformNodesMissingContent } from './transforms/nodes-missing-content-transform';
5
5
  export { transformIndentationMarks } from './transforms/indentation-marks-transform';
6
+ export { transformInvalidMediaContent } from './transforms/invalid-media-content-transform';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-utils",
3
- "version": "17.1.4",
3
+ "version": "17.1.5",
4
4
  "description": "Set of utilities to traverse, modify and create ADF documents.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -12,13 +12,6 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
- "typesVersions": {
16
- ">=4.0 <4.5": {
17
- "*": [
18
- "dist/types-ts4.0/*"
19
- ]
20
- }
21
- },
22
15
  "sideEffects": false,
23
16
  "atlaskit:src": "src/index.ts",
24
17
  "atlassian": {
@@ -46,7 +39,7 @@
46
39
  },
47
40
  "devDependencies": {
48
41
  "@atlaskit/docs": "*",
49
- "@atlaskit/json-schema-generator": "^3.2.0",
42
+ "@atlaskit/json-schema-generator": "^3.3.0",
50
43
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
51
44
  "jscodeshift": "^0.13.0",
52
45
  "react": "^16.8.0",
@@ -60,7 +53,10 @@
60
53
  ]
61
54
  },
62
55
  "@repo/internal": {
63
- "deprecation": "no-deprecated-imports"
56
+ "deprecation": "no-deprecated-imports",
57
+ "styling": [
58
+ "emotion"
59
+ ]
64
60
  }
65
61
  },
66
62
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
package/report.api.md CHANGED
@@ -1,7 +1,20 @@
1
+ <!-- API Report Version: 2.2 -->
2
+
1
3
  ## API Report File for "@atlaskit/adf-utils"
2
4
 
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
5
+ > Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
6
+ > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
7
+
8
+ ### Table of contents
9
+
10
+ - [Main Entry Types](#main-entry-types)
11
+
12
+ ### Main Entry Types
13
+
14
+ <!--SECTION START: Main Entry Types-->
4
15
 
5
16
  ```ts
6
- export {};
17
+ // (No @packageDocumentation comment for this package)
7
18
  ```
19
+
20
+ <!--SECTION END: Main Entry Types-->
@@ -1,3 +0,0 @@
1
- import { AlignmentMarkDefinition, AlignmentAttributes, ParagraphDefinition, HeadingDefinition } from '@atlaskit/adf-schema';
2
- import { WithMark, WithAppliedMark } from '../types';
3
- export declare const alignment: (attrs: AlignmentAttributes) => (maybeNode: WithMark | string) => WithAppliedMark<ParagraphDefinition | HeadingDefinition, AlignmentMarkDefinition>;
@@ -1,3 +0,0 @@
1
- import { AnnotationMarkAttributes } from '@atlaskit/adf-schema';
2
- import { WithMark } from '../types';
3
- export declare const annotation: (attrs: AnnotationMarkAttributes) => (maybeNode: WithMark | string) => WithMark;
@@ -1,3 +0,0 @@
1
- import { BreakoutMarkAttrs, BreakoutMarkDefinition, CodeBlockDefinition, LayoutSectionDefinition } from '@atlaskit/adf-schema';
2
- import { WithAppliedMark } from '../types';
3
- export declare const breakout: (attrs: BreakoutMarkAttrs) => (maybeNode: CodeBlockDefinition | LayoutSectionDefinition) => WithAppliedMark<CodeBlockDefinition | LayoutSectionDefinition, BreakoutMarkDefinition>;
@@ -1,2 +0,0 @@
1
- import { WithMark } from '../types';
2
- export declare const code: (maybeNode: WithMark | string) => WithMark;
@@ -1,3 +0,0 @@
1
- import { ExtensionDefinition, BodiedExtensionDefinition, InlineExtensionDefinition, DataConsumerAttributes, DataConsumerDefinition } from '@atlaskit/adf-schema';
2
- import { WithAppliedMark } from '../types';
3
- export declare const dataConsumer: (attrs: DataConsumerAttributes) => (maybeNode: ExtensionDefinition | BodiedExtensionDefinition | InlineExtensionDefinition) => WithAppliedMark<ExtensionDefinition | BodiedExtensionDefinition | InlineExtensionDefinition, DataConsumerDefinition>;
@@ -1,2 +0,0 @@
1
- import { WithMark } from '../types';
2
- export declare const em: (maybeNode: WithMark | string) => WithMark;
@@ -1,3 +0,0 @@
1
- import { ExtensionDefinition, BodiedExtensionDefinition, InlineExtensionDefinition, TableDefinition, FragmentAttributes, FragmentDefinition } from '@atlaskit/adf-schema';
2
- import { WithAppliedMark } from '../types';
3
- export declare const fragment: (attrs: FragmentAttributes) => (maybeNode: TableDefinition | ExtensionDefinition | BodiedExtensionDefinition | InlineExtensionDefinition) => WithAppliedMark<ExtensionDefinition | BodiedExtensionDefinition | InlineExtensionDefinition | TableDefinition, FragmentDefinition>;
@@ -1,3 +0,0 @@
1
- import { IndentationMarkDefinition, IndentationMarkAttributes, ParagraphDefinition } from '@atlaskit/adf-schema';
2
- import { WithMark, WithAppliedMark } from '../types';
3
- export declare const indentation: (attrs: IndentationMarkAttributes) => (maybeNode: WithMark | string) => WithAppliedMark<ParagraphDefinition, IndentationMarkDefinition>;
@@ -1,3 +0,0 @@
1
- import { LinkAttributes } from '@atlaskit/adf-schema';
2
- import { WithMark } from '../types';
3
- export declare const link: (attrs: LinkAttributes) => (maybeNode: WithMark | string) => WithMark;
@@ -1,2 +0,0 @@
1
- import { WithMark } from '../types';
2
- export declare const strike: (maybeNode: WithMark | string) => WithMark;
@@ -1,2 +0,0 @@
1
- import { WithMark } from '../types';
2
- export declare const strong: (maybeNode: WithMark | string) => WithMark;
@@ -1,3 +0,0 @@
1
- import { SubSupAttributes } from '@atlaskit/adf-schema';
2
- import { WithMark } from '../types';
3
- export declare const subsup: (attrs: SubSupAttributes) => (maybeNode: WithMark | string) => WithMark;
@@ -1,3 +0,0 @@
1
- import { TextColorAttributes } from '@atlaskit/adf-schema';
2
- import { WithMark } from '../types';
3
- export declare const textColor: (attrs: TextColorAttributes) => (maybeNode: WithMark | string) => WithMark;
@@ -1,2 +0,0 @@
1
- import { WithMark } from '../types';
2
- export declare const underline: (maybeNode: WithMark | string) => WithMark;
@@ -1,2 +0,0 @@
1
- import { BlockCardDefinition, CardAttributes } from '@atlaskit/adf-schema';
2
- export declare const blockCard: (attrs: CardAttributes) => BlockCardDefinition;
@@ -1,2 +0,0 @@
1
- import { ParagraphDefinition, BlockQuoteDefinition } from '@atlaskit/adf-schema';
2
- export declare const blockQuote: (...content: Array<ParagraphDefinition>) => BlockQuoteDefinition;
@@ -1,2 +0,0 @@
1
- import { BodiedExtensionDefinition, NonNestableBlockContent } from '@atlaskit/adf-schema';
2
- export declare const bodiedExtension: (attrs: BodiedExtensionDefinition['attrs']) => (...content: Array<NonNestableBlockContent>) => BodiedExtensionDefinition;
@@ -1,2 +0,0 @@
1
- import { BulletListDefinition, ListItemDefinition } from '@atlaskit/adf-schema';
2
- export declare const bulletList: (...content: Array<ListItemDefinition>) => BulletListDefinition;
@@ -1,2 +0,0 @@
1
- import { CaptionDefinition } from '@atlaskit/adf-schema';
2
- export declare const caption: (...content: CaptionDefinition['content']) => CaptionDefinition;
@@ -1,3 +0,0 @@
1
- import { CodeBlockDefinition, TextDefinition, NoMark } from '@atlaskit/adf-schema';
2
- export declare type CodeBlockContent = TextDefinition & NoMark;
3
- export declare const codeBlock: (attrs: CodeBlockDefinition['attrs'] | undefined) => (...content: Array<CodeBlockContent>) => CodeBlockDefinition;
@@ -1,2 +0,0 @@
1
- import { DateDefinition } from '@atlaskit/adf-schema';
2
- export declare const date: (attrs?: DateDefinition['attrs']) => DateDefinition;
@@ -1,2 +0,0 @@
1
- import { DecisionItemDefinition, Inline } from '@atlaskit/adf-schema';
2
- export declare const decisionItem: (attrs: DecisionItemDefinition['attrs']) => (...content: Array<Inline>) => DecisionItemDefinition;
@@ -1,2 +0,0 @@
1
- import { DecisionListDefinition, DecisionItemDefinition } from '@atlaskit/adf-schema';
2
- export declare const decisionList: (attrs: DecisionListDefinition['attrs']) => (...content: Array<DecisionItemDefinition>) => DecisionListDefinition;
@@ -1,2 +0,0 @@
1
- import { DocNode, BlockContent, LayoutSectionDefinition } from '@atlaskit/adf-schema';
2
- export declare const doc: (...content: Array<BlockContent | LayoutSectionDefinition>) => DocNode;
@@ -1,2 +0,0 @@
1
- import { EmbedCardDefinition, EmbedCardAttributes } from '@atlaskit/adf-schema';
2
- export declare const embedCard: (attrs: EmbedCardAttributes) => EmbedCardDefinition;
@@ -1,2 +0,0 @@
1
- import { EmojiDefinition, EmojiAttributes } from '@atlaskit/adf-schema';
2
- export declare const emoji: (attrs: EmojiAttributes) => EmojiDefinition;
@@ -1,2 +0,0 @@
1
- import { ExpandDefinition, NonNestableBlockContent } from '@atlaskit/adf-schema';
2
- export declare const expand: (attrs: ExpandDefinition['attrs']) => (...content: Array<NonNestableBlockContent>) => ExpandDefinition;
@@ -1,2 +0,0 @@
1
- import { ExtensionDefinition } from '@atlaskit/adf-schema';
2
- export declare const extension: (attrs: ExtensionDefinition['attrs']) => ExtensionDefinition;
@@ -1,2 +0,0 @@
1
- import { HardBreakDefinition } from '@atlaskit/adf-schema';
2
- export declare const hardBreak: (attrs?: HardBreakDefinition['attrs']) => HardBreakDefinition;
@@ -1,2 +0,0 @@
1
- import { Inline, HeadingDefinition } from '@atlaskit/adf-schema';
2
- export declare const heading: (attrs: HeadingDefinition['attrs']) => (...content: Array<Inline>) => HeadingDefinition;
@@ -1,2 +0,0 @@
1
- import { InlineCardDefinition, CardAttributes } from '@atlaskit/adf-schema';
2
- export declare const inlineCard: (attrs: CardAttributes) => InlineCardDefinition;
@@ -1,2 +0,0 @@
1
- import { InlineExtensionDefinition } from '@atlaskit/adf-schema';
2
- export declare const inlineExtension: (attrs: InlineExtensionDefinition['attrs']) => () => InlineExtensionDefinition;
@@ -1,4 +0,0 @@
1
- import { BlockContent, LayoutColumnDefinition } from '@atlaskit/adf-schema';
2
- export declare const layoutColumn: (attrs: {
3
- width: number;
4
- }) => (content: BlockContent[]) => LayoutColumnDefinition;
@@ -1,2 +0,0 @@
1
- import { LayoutColumnDefinition, LayoutSectionDefinition } from '@atlaskit/adf-schema';
2
- export declare const layoutSection: () => (content: Array<LayoutColumnDefinition>) => LayoutSectionDefinition;
@@ -1,2 +0,0 @@
1
- import { ListItemDefinition, ListItemArray } from '@atlaskit/adf-schema';
2
- export declare const listItem: (content: ListItemArray) => ListItemDefinition;
@@ -1,2 +0,0 @@
1
- import { MediaGroupDefinition, MediaDefinition } from '@atlaskit/adf-schema';
2
- export declare const mediaGroup: (...content: Array<MediaDefinition>) => MediaGroupDefinition;
@@ -1,2 +0,0 @@
1
- import { MediaInlineDefinition, MediaInlineAttributes } from '@atlaskit/adf-schema';
2
- export declare const mediaInline: (attrs: MediaInlineAttributes) => MediaInlineDefinition;
@@ -1,7 +0,0 @@
1
- import { MediaSingleDefinition, MediaDefinition, RichMediaAttributes as MediaSingleAttributes, CaptionDefinition } from '@atlaskit/adf-schema';
2
- export declare const mediaSingle: (attrs: MediaSingleAttributes | undefined) => (content: MediaDefinition | [
3
- MediaDefinition
4
- ] | [
5
- MediaDefinition,
6
- CaptionDefinition
7
- ]) => MediaSingleDefinition;
@@ -1,2 +0,0 @@
1
- import { MediaDefinition, MediaAttributes } from '@atlaskit/adf-schema';
2
- export declare const media: (attrs: MediaAttributes) => MediaDefinition;
@@ -1,2 +0,0 @@
1
- import { MentionDefinition, MentionAttributes } from '@atlaskit/adf-schema';
2
- export declare const mention: (attrs: MentionAttributes) => MentionDefinition;
@@ -1,2 +0,0 @@
1
- import { NestedExpandDefinition, NestedExpandContent } from '@atlaskit/adf-schema';
2
- export declare const nestedExpand: (attrs: NestedExpandDefinition['attrs']) => (...content: NestedExpandContent) => NestedExpandDefinition;
@@ -1,2 +0,0 @@
1
- import { ListItemDefinition, OrderedListDefinition } from '@atlaskit/adf-schema';
2
- export declare const orderedList: (attrs?: OrderedListDefinition['attrs']) => (...content: Array<ListItemDefinition>) => OrderedListDefinition;
@@ -1,2 +0,0 @@
1
- import { PanelDefinition, PanelAttributes } from '@atlaskit/adf-schema';
2
- export declare const panel: (attrs: PanelAttributes) => (...content: PanelDefinition['content']) => PanelDefinition;
@@ -1,2 +0,0 @@
1
- import { ParagraphDefinition, Inline } from '@atlaskit/adf-schema';
2
- export declare const paragraph: (...content: Array<Inline | string>) => ParagraphDefinition;
@@ -1,2 +0,0 @@
1
- import { PlaceholderDefinition } from '@atlaskit/adf-schema';
2
- export declare const placeholder: (attrs: PlaceholderDefinition['attrs']) => PlaceholderDefinition;
@@ -1,2 +0,0 @@
1
- import { RuleDefinition } from '@atlaskit/adf-schema';
2
- export declare const rule: () => RuleDefinition;
@@ -1,2 +0,0 @@
1
- import { StatusDefinition } from '@atlaskit/adf-schema';
2
- export declare const status: (attrs?: StatusDefinition['attrs']) => StatusDefinition;
@@ -1,2 +0,0 @@
1
- import { TableCellDefinition, CellAttributes } from '@atlaskit/adf-schema';
2
- export declare const tableCell: (attrs?: CellAttributes | undefined) => (...content: TableCellDefinition['content']) => TableCellDefinition;
@@ -1,2 +0,0 @@
1
- import { TableHeaderDefinition, CellAttributes } from '@atlaskit/adf-schema';
2
- export declare const tableHeader: (attrs?: CellAttributes | undefined) => (...content: TableHeaderDefinition['content']) => TableHeaderDefinition;
@@ -1,2 +0,0 @@
1
- import { TableRowDefinition, TableHeaderDefinition, TableCellDefinition } from '@atlaskit/adf-schema';
2
- export declare const tableRow: (content: Array<TableHeaderDefinition> | Array<TableCellDefinition>) => TableRowDefinition;
@@ -1,2 +0,0 @@
1
- import { TableDefinition, TableRowDefinition } from '@atlaskit/adf-schema';
2
- export declare const table: (...content: Array<TableRowDefinition>) => TableDefinition;
@@ -1,2 +0,0 @@
1
- import { Inline, TaskItemDefinition } from '@atlaskit/adf-schema';
2
- export declare const taskItem: (attrs: TaskItemDefinition['attrs']) => (...content: Array<Inline>) => TaskItemDefinition;
@@ -1,2 +0,0 @@
1
- import { TaskListDefinition, TaskListContent } from '@atlaskit/adf-schema';
2
- export declare const taskList: (attrs: TaskListDefinition['attrs']) => (...content: TaskListContent) => TaskListDefinition;
@@ -1,2 +0,0 @@
1
- import { TextDefinition } from '@atlaskit/adf-schema';
2
- export declare const text: (text: string) => TextDefinition;
@@ -1,8 +0,0 @@
1
- export declare type WithMark = {
2
- type: any;
3
- marks?: Array<any>;
4
- [prop: string]: any;
5
- };
6
- export declare type WithAppliedMark<T, M> = T & {
7
- marks?: Array<M>;
8
- };
@@ -1,4 +0,0 @@
1
- import { WithMark } from '../types';
2
- export declare function applyMark<T>(mark: T & {
3
- type: string;
4
- }, maybeNode: WithMark | string): WithMark;
@@ -1,3 +0,0 @@
1
- import { TextDefinition } from '@atlaskit/adf-schema';
2
- export declare function createTextNodes<T = any>(nodes: Array<T | string>): Array<T | TextDefinition>;
3
- export declare function createTextFromString<T = any>(str: T | string): T | TextDefinition;
@@ -1,6 +0,0 @@
1
- export declare function isDuplicateMark(node: {
2
- marks?: Array<any>;
3
- }, type: string): boolean;
4
- export declare function duplicateMarkError(node: {
5
- marks?: Array<any>;
6
- }, type: string): string;
@@ -1,63 +0,0 @@
1
- export { breakout } from './builders/marks/breakout';
2
- export { code } from './builders/marks/code';
3
- export { em } from './builders/marks/em';
4
- export { link } from './builders/marks/link';
5
- export { link as a } from './builders/marks/link';
6
- export { strike } from './builders/marks/strike';
7
- export { strong } from './builders/marks/strong';
8
- export { strong as b } from './builders/marks/strong';
9
- export { subsup } from './builders/marks/subsup';
10
- export { textColor } from './builders/marks/text-color';
11
- export { underline } from './builders/marks/underline';
12
- export { underline as u } from './builders/marks/underline';
13
- export { alignment } from './builders/marks/alignment';
14
- export { indentation } from './builders/marks/indentation';
15
- export { dataConsumer } from './builders/marks/data-consumer';
16
- export { fragment } from './builders/marks/fragment';
17
- export { blockQuote } from './builders/nodes/blockquote';
18
- export { bodiedExtension } from './builders/nodes/bodied-extension';
19
- export { blockCard } from './builders/nodes/block-card';
20
- export { bulletList } from './builders/nodes/bullet-list';
21
- export { bulletList as ul } from './builders/nodes/bullet-list';
22
- export { codeBlock } from './builders/nodes/code-block';
23
- export { date } from './builders/nodes/date';
24
- export { decisionItem } from './builders/nodes/decision-item';
25
- export { decisionList } from './builders/nodes/decision-list';
26
- export { doc } from './builders/nodes/doc';
27
- export { emoji } from './builders/nodes/emoji';
28
- export { extension } from './builders/nodes/extension';
29
- export { expand } from './builders/nodes/expand';
30
- export { nestedExpand } from './builders/nodes/nested-expand';
31
- export { hardBreak } from './builders/nodes/hard-break';
32
- export { hardBreak as br } from './builders/nodes/hard-break';
33
- export { heading } from './builders/nodes/heading';
34
- export { inlineExtension } from './builders/nodes/inline-extension';
35
- export { inlineCard } from './builders/nodes/inline-card';
36
- export { layoutColumn } from './builders/nodes/layout-column';
37
- export { layoutSection } from './builders/nodes/layout-section';
38
- export { listItem } from './builders/nodes/list-item';
39
- export { listItem as li } from './builders/nodes/list-item';
40
- export { mediaGroup } from './builders/nodes/media-group';
41
- export { mediaSingle } from './builders/nodes/media-single';
42
- export { media } from './builders/nodes/media';
43
- export { mention } from './builders/nodes/mention';
44
- export { orderedList } from './builders/nodes/ordered-list';
45
- export { orderedList as ol } from './builders/nodes/ordered-list';
46
- export { panel } from './builders/nodes/panel';
47
- export { paragraph } from './builders/nodes/paragraph';
48
- export { paragraph as p } from './builders/nodes/paragraph';
49
- export { placeholder } from './builders/nodes/placeholder';
50
- export { rule } from './builders/nodes/rule';
51
- export { rule as hr } from './builders/nodes/rule';
52
- export { status } from './builders/nodes/status';
53
- export { tableCell } from './builders/nodes/table-cell';
54
- export { tableCell as td } from './builders/nodes/table-cell';
55
- export { tableHeader } from './builders/nodes/table-header';
56
- export { tableHeader as th } from './builders/nodes/table-header';
57
- export { tableRow } from './builders/nodes/table-row';
58
- export { tableRow as tr } from './builders/nodes/table-row';
59
- export { table } from './builders/nodes/table';
60
- export { taskItem } from './builders/nodes/task-item';
61
- export { taskList } from './builders/nodes/task-list';
62
- export { text } from './builders/nodes/text';
63
- export { embedCard } from './builders/nodes/embed-card';
@@ -1,2 +0,0 @@
1
- import { DocNode } from './validator/entry';
2
- export declare const getEmptyADF: () => DocNode;
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- import { ADFEntity, EntityParent } from '../types';
2
- import { ValueReplacements } from './default-value-replacements';
3
- export declare type NodeReplacer = (node: ADFEntity, context: {
4
- parent: EntityParent;
5
- valueReplacements: ValueReplacements;
6
- }) => ADFEntity | null | false;
7
- export declare type NodeReplacements = {
8
- [key: string]: NodeReplacer;
9
- };
10
- export declare const defaultNodeReplacements: NodeReplacements;
@@ -1,6 +0,0 @@
1
- export declare type Value = string | number | boolean | undefined | null;
2
- export declare type ValueReplacer<V extends Value> = (value: V) => V;
3
- export declare type ValueReplacements = {
4
- href: ValueReplacer<string>;
5
- };
6
- export declare const defaultValueReplacements: ValueReplacements;
@@ -1 +0,0 @@
1
- export declare const hash: (input: string) => string;
@@ -1,9 +0,0 @@
1
- import { ADFEntity } from '../types';
2
- import { NodeReplacements } from './default-node-replacements';
3
- import { ValueReplacements } from './default-value-replacements';
4
- export interface ScrubAdfOptions {
5
- nodeReplacements?: NodeReplacements;
6
- valueReplacements?: ValueReplacements;
7
- }
8
- declare const _default: (adf: ADFEntity, options?: ScrubAdfOptions) => false | ADFEntity;
9
- export default _default;
@@ -1,11 +0,0 @@
1
- import { ValueReplacements } from './default-value-replacements';
2
- export declare const scrubStr: (val: string, offset?: number) => string;
3
- export declare type ScrubLinkOptions = {
4
- valueReplacements: ValueReplacements;
5
- };
6
- export declare const scrubLink: (marks: {
7
- [key: string]: any;
8
- }[], { valueReplacements }: ScrubLinkOptions) => {
9
- [key: string]: any;
10
- }[];
11
- export declare const scrubAttrs: (nodeType: string, attrs: unknown, offset?: number) => any;
@@ -1 +0,0 @@
1
- export { default as scrubAdf } from './scrub/scrub-adf';