@atlaskit/adf-utils 19.21.3 → 19.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/afm-adminhub/tsconfig.json +26 -0
  3. package/dist/cjs/builders/nodes/sync-block.js +14 -0
  4. package/dist/cjs/transforms/dedupe-marks-transform.js +1 -0
  5. package/dist/cjs/transforms/indentation-marks-transform.js +2 -0
  6. package/dist/cjs/transforms/invalid-media-content-transform.js +2 -1
  7. package/dist/cjs/transforms/nested-table-transform.js +1 -0
  8. package/dist/cjs/transforms/nodes-missing-content-transform.js +6 -2
  9. package/dist/cjs/transforms/text-link-code-transform.js +1 -0
  10. package/dist/es2019/builders/nodes/sync-block.js +4 -0
  11. package/dist/es2019/transforms/dedupe-marks-transform.js +1 -0
  12. package/dist/es2019/transforms/indentation-marks-transform.js +2 -0
  13. package/dist/es2019/transforms/invalid-media-content-transform.js +2 -1
  14. package/dist/es2019/transforms/nested-table-transform.js +1 -0
  15. package/dist/es2019/transforms/nodes-missing-content-transform.js +6 -2
  16. package/dist/es2019/transforms/text-link-code-transform.js +1 -0
  17. package/dist/esm/builders/nodes/sync-block.js +8 -0
  18. package/dist/esm/transforms/dedupe-marks-transform.js +1 -0
  19. package/dist/esm/transforms/indentation-marks-transform.js +2 -0
  20. package/dist/esm/transforms/invalid-media-content-transform.js +2 -1
  21. package/dist/esm/transforms/nested-table-transform.js +1 -0
  22. package/dist/esm/transforms/nodes-missing-content-transform.js +6 -2
  23. package/dist/esm/transforms/text-link-code-transform.js +1 -0
  24. package/dist/types/builders/nodes/doc.d.ts +2 -2
  25. package/dist/types/builders/nodes/sync-block.d.ts +2 -0
  26. package/dist/types-ts4.5/builders/nodes/doc.d.ts +2 -2
  27. package/dist/types-ts4.5/builders/nodes/sync-block.d.ts +2 -0
  28. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/adf-utils
2
2
 
3
+ ## 19.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`b367661ba720e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b367661ba720e) -
8
+ EDITOR-1562 bump adf-schema for afm
9
+
10
+ ## 19.22.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`64ec65231b4cf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/64ec65231b4cf) -
15
+ EDITOR-1568 bump adf-schema for afm
16
+
3
17
  ## 19.21.3
4
18
 
5
19
  ### Patch Changes
@@ -0,0 +1,26 @@
1
+ {
2
+ "extends": "../../../../tsconfig.entry-points.adminhub.json",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "target": "es5",
6
+ "outDir": "../../../../../adminhub/tsDist/@atlaskit__adf-utils/app",
7
+ "rootDir": "../",
8
+ "composite": true
9
+ },
10
+ "include": [
11
+ "../src/**/*.ts",
12
+ "../src/**/*.tsx"
13
+ ],
14
+ "exclude": [
15
+ "../src/**/__tests__/*",
16
+ "../src/**/*.test.*",
17
+ "../src/**/test.*",
18
+ "../src/**/examples.*",
19
+ "../src/**/examples/*",
20
+ "../src/**/examples/**/*",
21
+ "../src/**/*.stories.*",
22
+ "../src/**/stories/*",
23
+ "../src/**/stories/**/*"
24
+ ],
25
+ "references": []
26
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.syncBlock = void 0;
7
+ var syncBlock = exports.syncBlock = function syncBlock(attrs) {
8
+ return function () {
9
+ return {
10
+ type: 'syncBlock',
11
+ attrs: attrs
12
+ };
13
+ };
14
+ };
@@ -91,6 +91,7 @@ var transformDedupeMarks = exports.transformDedupeMarks = function transformDedu
91
91
  return result.node;
92
92
  }
93
93
  }
94
+ return;
94
95
  }
95
96
  });
96
97
  return {
@@ -42,12 +42,14 @@ var transformIndentationMarks = exports.transformIndentationMarks = function tra
42
42
  isTransformed = true;
43
43
  return removeIndentationFromHeadings(node);
44
44
  }
45
+ return;
45
46
  },
46
47
  tableHeader: function tableHeader(node) {
47
48
  if (hasChildHeadingWithIndentation(node)) {
48
49
  isTransformed = true;
49
50
  return removeIndentationFromHeadings(node);
50
51
  }
52
+ return;
51
53
  }
52
54
  });
53
55
  return {
@@ -13,7 +13,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
13
13
  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) { (0, _defineProperty2.default)(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; }
14
14
  var getChildrenTypeCounts = function getChildrenTypeCounts(nodeContent, allowedTypes) {
15
15
  var childrenTypes = {};
16
- nodeContent.forEach(function (childNode, index) {
16
+ nodeContent.forEach(function (childNode) {
17
17
  if (!(childNode !== null && childNode !== void 0 && childNode.type) || !allowedTypes.includes(childNode.type)) {
18
18
  return;
19
19
  }
@@ -74,6 +74,7 @@ var transformInvalidMediaContent = exports.transformInvalidMediaContent = functi
74
74
  isTransformed = true;
75
75
  return deduplicateMediaSingleChildren(node, childrenTypes);
76
76
  }
77
+ return;
77
78
  }
78
79
  });
79
80
  return {
@@ -66,6 +66,7 @@ var transformNestedTablesIncomingDocument = exports.transformNestedTablesIncomin
66
66
  isTransformed = true;
67
67
  return transformNestedTableExtension(node);
68
68
  }
69
+ return;
69
70
  }
70
71
  });
71
72
  return {
@@ -39,6 +39,7 @@ var fixIfTableCellInvalidEmpty = function fixIfTableCellInvalidEmpty(reportTrans
39
39
  content: createValidEmptyContent(node)
40
40
  });
41
41
  }
42
+ return;
42
43
  };
43
44
  };
44
45
  var hasNonListItemChildren = function hasNonListItemChildren(node) {
@@ -86,6 +87,7 @@ var fixIfListParentWithInvalidListItemChildren = function fixIfListParentWithInv
86
87
  content: tryCreateValidListItemWrappedChildren(node)
87
88
  });
88
89
  }
90
+ return;
89
91
  };
90
92
  };
91
93
  var hasNonTableRowChildren = function hasNonTableRowChildren(node) {
@@ -124,10 +126,10 @@ var tryCreateValidTableRowWrappedChildren = function tryCreateValidTableRowWrapp
124
126
  };
125
127
  var hasEmptyTableRowChildren = function hasEmptyTableRowChildren(node) {
126
128
  var _node$content4;
127
- return node === null || node === void 0 || (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(function (node) {
129
+ return (node === null || node === void 0 || (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(function (node) {
128
130
  var _node$content5;
129
131
  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;
130
- });
132
+ })) || undefined;
131
133
  };
132
134
  var fixIfTableParentWithInvalidTableRowChildren = function fixIfTableParentWithInvalidTableRowChildren(reportTransform) {
133
135
  return function (node) {
@@ -137,6 +139,7 @@ var fixIfTableParentWithInvalidTableRowChildren = function fixIfTableParentWithI
137
139
  content: tryCreateValidTableRowWrappedChildren(node)
138
140
  });
139
141
  }
142
+ return;
140
143
  };
141
144
  };
142
145
  var removeMediaSingleWithNoContent = function removeMediaSingleWithNoContent(reportTransform) {
@@ -145,6 +148,7 @@ var removeMediaSingleWithNoContent = function removeMediaSingleWithNoContent(rep
145
148
  reportTransform();
146
149
  return false;
147
150
  }
151
+ return;
148
152
  };
149
153
  };
150
154
  var transformNodesMissingContent = exports.transformNodesMissingContent = function transformNodesMissingContent(adf) {
@@ -38,6 +38,7 @@ var transformTextLinkCodeMarks = exports.transformTextLinkCodeMarks = function t
38
38
  isTransformed = true;
39
39
  return removeCodeMarks(node);
40
40
  }
41
+ return;
41
42
  }
42
43
  });
43
44
  return {
@@ -0,0 +1,4 @@
1
+ export const syncBlock = attrs => () => ({
2
+ type: 'syncBlock',
3
+ attrs
4
+ });
@@ -76,6 +76,7 @@ export const transformDedupeMarks = adf => {
76
76
  return result.node;
77
77
  }
78
78
  }
79
+ return;
79
80
  }
80
81
  });
81
82
  return {
@@ -30,12 +30,14 @@ export const transformIndentationMarks = adf => {
30
30
  isTransformed = true;
31
31
  return removeIndentationFromHeadings(node);
32
32
  }
33
+ return;
33
34
  },
34
35
  tableHeader: node => {
35
36
  if (hasChildHeadingWithIndentation(node)) {
36
37
  isTransformed = true;
37
38
  return removeIndentationFromHeadings(node);
38
39
  }
40
+ return;
39
41
  }
40
42
  });
41
43
  return {
@@ -2,7 +2,7 @@ import { traverse } from '../traverse/traverse';
2
2
  import { isEmpty } from './helpers';
3
3
  const getChildrenTypeCounts = (nodeContent, allowedTypes) => {
4
4
  const childrenTypes = {};
5
- nodeContent.forEach((childNode, index) => {
5
+ nodeContent.forEach(childNode => {
6
6
  if (!(childNode !== null && childNode !== void 0 && childNode.type) || !allowedTypes.includes(childNode.type)) {
7
7
  return;
8
8
  }
@@ -58,6 +58,7 @@ export const transformInvalidMediaContent = adf => {
58
58
  isTransformed = true;
59
59
  return deduplicateMediaSingleChildren(node, childrenTypes);
60
60
  }
61
+ return;
61
62
  }
62
63
  });
63
64
  return {
@@ -57,6 +57,7 @@ options = {}) => {
57
57
  isTransformed = true;
58
58
  return transformNestedTableExtension(node);
59
59
  }
60
+ return;
60
61
  }
61
62
  });
62
63
  return {
@@ -28,6 +28,7 @@ const fixIfTableCellInvalidEmpty = reportTransform => node => {
28
28
  content: createValidEmptyContent(node)
29
29
  };
30
30
  }
31
+ return;
31
32
  };
32
33
  const hasNonListItemChildren = node => {
33
34
  var _node$content;
@@ -72,6 +73,7 @@ const fixIfListParentWithInvalidListItemChildren = reportTransform => node => {
72
73
  content: tryCreateValidListItemWrappedChildren(node)
73
74
  };
74
75
  }
76
+ return;
75
77
  };
76
78
  const hasNonTableRowChildren = node => {
77
79
  var _node$content3;
@@ -107,10 +109,10 @@ const tryCreateValidTableRowWrappedChildren = parentTableNode => {
107
109
  };
108
110
  const hasEmptyTableRowChildren = node => {
109
111
  var _node$content4;
110
- return node === null || node === void 0 ? void 0 : (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(node => {
112
+ return (node === null || node === void 0 ? void 0 : (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(node => {
111
113
  var _node$content5;
112
114
  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;
113
- });
115
+ })) || undefined;
114
116
  };
115
117
  const fixIfTableParentWithInvalidTableRowChildren = reportTransform => node => {
116
118
  if (hasEmptyTableRowChildren(node) || hasNonTableRowChildren(node)) {
@@ -120,12 +122,14 @@ const fixIfTableParentWithInvalidTableRowChildren = reportTransform => node => {
120
122
  content: tryCreateValidTableRowWrappedChildren(node)
121
123
  };
122
124
  }
125
+ return;
123
126
  };
124
127
  const removeMediaSingleWithNoContent = reportTransform => node => {
125
128
  if (isEmpty(node)) {
126
129
  reportTransform();
127
130
  return false;
128
131
  }
132
+ return;
129
133
  };
130
134
  export const transformNodesMissingContent = adf => {
131
135
  let isTransformed = false;
@@ -25,6 +25,7 @@ export const transformTextLinkCodeMarks = adf => {
25
25
  isTransformed = true;
26
26
  return removeCodeMarks(node);
27
27
  }
28
+ return;
28
29
  }
29
30
  });
30
31
  return {
@@ -0,0 +1,8 @@
1
+ export var syncBlock = function syncBlock(attrs) {
2
+ return function () {
3
+ return {
4
+ type: 'syncBlock',
5
+ attrs: attrs
6
+ };
7
+ };
8
+ };
@@ -84,6 +84,7 @@ export var transformDedupeMarks = function transformDedupeMarks(adf) {
84
84
  return result.node;
85
85
  }
86
86
  }
87
+ return;
87
88
  }
88
89
  });
89
90
  return {
@@ -35,12 +35,14 @@ export var transformIndentationMarks = function transformIndentationMarks(adf) {
35
35
  isTransformed = true;
36
36
  return removeIndentationFromHeadings(node);
37
37
  }
38
+ return;
38
39
  },
39
40
  tableHeader: function tableHeader(node) {
40
41
  if (hasChildHeadingWithIndentation(node)) {
41
42
  isTransformed = true;
42
43
  return removeIndentationFromHeadings(node);
43
44
  }
45
+ return;
44
46
  }
45
47
  });
46
48
  return {
@@ -6,7 +6,7 @@ import { traverse } from '../traverse/traverse';
6
6
  import { isEmpty } from './helpers';
7
7
  var getChildrenTypeCounts = function getChildrenTypeCounts(nodeContent, allowedTypes) {
8
8
  var childrenTypes = {};
9
- nodeContent.forEach(function (childNode, index) {
9
+ nodeContent.forEach(function (childNode) {
10
10
  if (!(childNode !== null && childNode !== void 0 && childNode.type) || !allowedTypes.includes(childNode.type)) {
11
11
  return;
12
12
  }
@@ -67,6 +67,7 @@ export var transformInvalidMediaContent = function transformInvalidMediaContent(
67
67
  isTransformed = true;
68
68
  return deduplicateMediaSingleChildren(node, childrenTypes);
69
69
  }
70
+ return;
70
71
  }
71
72
  });
72
73
  return {
@@ -59,6 +59,7 @@ export var transformNestedTablesIncomingDocument = function transformNestedTable
59
59
  isTransformed = true;
60
60
  return transformNestedTableExtension(node);
61
61
  }
62
+ return;
62
63
  }
63
64
  });
64
65
  return {
@@ -32,6 +32,7 @@ var fixIfTableCellInvalidEmpty = function fixIfTableCellInvalidEmpty(reportTrans
32
32
  content: createValidEmptyContent(node)
33
33
  });
34
34
  }
35
+ return;
35
36
  };
36
37
  };
37
38
  var hasNonListItemChildren = function hasNonListItemChildren(node) {
@@ -79,6 +80,7 @@ var fixIfListParentWithInvalidListItemChildren = function fixIfListParentWithInv
79
80
  content: tryCreateValidListItemWrappedChildren(node)
80
81
  });
81
82
  }
83
+ return;
82
84
  };
83
85
  };
84
86
  var hasNonTableRowChildren = function hasNonTableRowChildren(node) {
@@ -117,10 +119,10 @@ var tryCreateValidTableRowWrappedChildren = function tryCreateValidTableRowWrapp
117
119
  };
118
120
  var hasEmptyTableRowChildren = function hasEmptyTableRowChildren(node) {
119
121
  var _node$content4;
120
- return node === null || node === void 0 || (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(function (node) {
122
+ return (node === null || node === void 0 || (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(function (node) {
121
123
  var _node$content5;
122
124
  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;
123
- });
125
+ })) || undefined;
124
126
  };
125
127
  var fixIfTableParentWithInvalidTableRowChildren = function fixIfTableParentWithInvalidTableRowChildren(reportTransform) {
126
128
  return function (node) {
@@ -130,6 +132,7 @@ var fixIfTableParentWithInvalidTableRowChildren = function fixIfTableParentWithI
130
132
  content: tryCreateValidTableRowWrappedChildren(node)
131
133
  });
132
134
  }
135
+ return;
133
136
  };
134
137
  };
135
138
  var removeMediaSingleWithNoContent = function removeMediaSingleWithNoContent(reportTransform) {
@@ -138,6 +141,7 @@ var removeMediaSingleWithNoContent = function removeMediaSingleWithNoContent(rep
138
141
  reportTransform();
139
142
  return false;
140
143
  }
144
+ return;
141
145
  };
142
146
  };
143
147
  export var transformNodesMissingContent = function transformNodesMissingContent(adf) {
@@ -31,6 +31,7 @@ export var transformTextLinkCodeMarks = function transformTextLinkCodeMarks(adf)
31
31
  isTransformed = true;
32
32
  return removeCodeMarks(node);
33
33
  }
34
+ return;
34
35
  }
35
36
  });
36
37
  return {
@@ -1,2 +1,2 @@
1
- import type { DocNode, BlockContent, LayoutSectionDefinition, MultiBodiedExtensionDefinition } from '@atlaskit/adf-schema';
2
- export declare const doc: (...content: Array<BlockContent | LayoutSectionDefinition | MultiBodiedExtensionDefinition>) => DocNode;
1
+ import type { DocNode, BlockContent, LayoutSectionDefinition, MultiBodiedExtensionDefinition, SyncBlockDefinition } from '@atlaskit/adf-schema';
2
+ export declare const doc: (...content: Array<BlockContent | LayoutSectionDefinition | MultiBodiedExtensionDefinition | SyncBlockDefinition>) => DocNode;
@@ -0,0 +1,2 @@
1
+ import { type SyncBlockDefinition } from '@atlaskit/adf-schema';
2
+ export declare const syncBlock: (attrs: SyncBlockDefinition["attrs"]) => () => SyncBlockDefinition;
@@ -1,2 +1,2 @@
1
- import type { DocNode, BlockContent, LayoutSectionDefinition, MultiBodiedExtensionDefinition } from '@atlaskit/adf-schema';
2
- export declare const doc: (...content: Array<BlockContent | LayoutSectionDefinition | MultiBodiedExtensionDefinition>) => DocNode;
1
+ import type { DocNode, BlockContent, LayoutSectionDefinition, MultiBodiedExtensionDefinition, SyncBlockDefinition } from '@atlaskit/adf-schema';
2
+ export declare const doc: (...content: Array<BlockContent | LayoutSectionDefinition | MultiBodiedExtensionDefinition | SyncBlockDefinition>) => DocNode;
@@ -0,0 +1,2 @@
1
+ import { type SyncBlockDefinition } from '@atlaskit/adf-schema';
2
+ export declare const syncBlock: (attrs: SyncBlockDefinition["attrs"]) => () => SyncBlockDefinition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-utils",
3
- "version": "19.21.3",
3
+ "version": "19.23.0",
4
4
  "description": "Set of utilities to traverse, modify and create ADF documents.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -26,7 +26,7 @@
26
26
  "team": "Editor: Collaboration"
27
27
  },
28
28
  "dependencies": {
29
- "@atlaskit/adf-schema": "^50.2.3",
29
+ "@atlaskit/adf-schema": "^51.1.2",
30
30
  "@babel/runtime": "^7.0.0"
31
31
  },
32
32
  "devDependencies": {