@atlaskit/adf-utils 14.3.0 → 14.4.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 (75) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cjs/builders/marks/fragment.js +19 -0
  3. package/dist/cjs/builders.js +8 -0
  4. package/dist/cjs/validator/rules.js +13 -0
  5. package/dist/cjs/validator/specs/atomic_inline.js +1 -1
  6. package/dist/cjs/validator/specs/blockCard.js +2 -1
  7. package/dist/cjs/validator/specs/block_content.js +1 -1
  8. package/dist/cjs/validator/specs/{bodiedExtension_with_no_marks.js → bodiedExtension_with_experimental_marks.js} +1 -2
  9. package/dist/cjs/validator/specs/doc.js +1 -1
  10. package/dist/cjs/validator/specs/embedCard.js +2 -1
  11. package/dist/cjs/validator/specs/{extension_with_no_marks.js → extension_with_experimental_marks.js} +1 -2
  12. package/dist/cjs/validator/specs/fragment.js +27 -0
  13. package/dist/cjs/validator/specs/index.js +26 -18
  14. package/dist/cjs/validator/specs/inline.js +1 -1
  15. package/dist/cjs/validator/specs/inlineCard.js +2 -1
  16. package/dist/cjs/validator/specs/{inlineExtension_with_no_marks.js → inlineExtension_with_experimental_marks.js} +1 -2
  17. package/dist/cjs/validator/specs/link.js +2 -1
  18. package/dist/cjs/validator/specs/non_nestable_block_content.js +1 -1
  19. package/dist/cjs/validator/specs/tableCell_content.js +1 -1
  20. package/dist/cjs/validator/validator.js +7 -1
  21. package/dist/cjs/version.json +1 -1
  22. package/dist/es2019/builders/marks/fragment.js +7 -0
  23. package/dist/es2019/builders.js +2 -1
  24. package/dist/es2019/validator/rules.js +4 -0
  25. package/dist/es2019/validator/specs/atomic_inline.js +1 -1
  26. package/dist/es2019/validator/specs/blockCard.js +2 -1
  27. package/dist/es2019/validator/specs/block_content.js +1 -1
  28. package/dist/{esm/validator/specs/bodiedExtension_with_no_marks.js → es2019/validator/specs/bodiedExtension_with_experimental_marks.js} +1 -2
  29. package/dist/es2019/validator/specs/doc.js +1 -1
  30. package/dist/es2019/validator/specs/embedCard.js +2 -1
  31. package/dist/es2019/validator/specs/{extension_with_no_marks.js → extension_with_experimental_marks.js} +1 -2
  32. package/dist/es2019/validator/specs/fragment.js +20 -0
  33. package/dist/es2019/validator/specs/index.js +4 -3
  34. package/dist/es2019/validator/specs/inline.js +1 -1
  35. package/dist/es2019/validator/specs/inlineCard.js +2 -1
  36. package/dist/es2019/validator/specs/{inlineExtension_with_no_marks.js → inlineExtension_with_experimental_marks.js} +1 -2
  37. package/dist/es2019/validator/specs/link.js +2 -1
  38. package/dist/es2019/validator/specs/non_nestable_block_content.js +1 -1
  39. package/dist/es2019/validator/specs/tableCell_content.js +1 -1
  40. package/dist/es2019/validator/validator.js +4 -1
  41. package/dist/es2019/version.json +1 -1
  42. package/dist/esm/builders/marks/fragment.js +9 -0
  43. package/dist/esm/builders.js +2 -1
  44. package/dist/esm/validator/rules.js +4 -0
  45. package/dist/esm/validator/specs/atomic_inline.js +1 -1
  46. package/dist/esm/validator/specs/blockCard.js +2 -1
  47. package/dist/esm/validator/specs/block_content.js +1 -1
  48. package/dist/{es2019/validator/specs/bodiedExtension_with_no_marks.js → esm/validator/specs/bodiedExtension_with_experimental_marks.js} +1 -2
  49. package/dist/esm/validator/specs/doc.js +1 -1
  50. package/dist/esm/validator/specs/embedCard.js +2 -1
  51. package/dist/esm/validator/specs/{extension_with_no_marks.js → extension_with_experimental_marks.js} +1 -2
  52. package/dist/esm/validator/specs/fragment.js +20 -0
  53. package/dist/esm/validator/specs/index.js +4 -3
  54. package/dist/esm/validator/specs/inline.js +1 -1
  55. package/dist/esm/validator/specs/inlineCard.js +2 -1
  56. package/dist/esm/validator/specs/{inlineExtension_with_no_marks.js → inlineExtension_with_experimental_marks.js} +1 -2
  57. package/dist/esm/validator/specs/link.js +2 -1
  58. package/dist/esm/validator/specs/non_nestable_block_content.js +1 -1
  59. package/dist/esm/validator/specs/tableCell_content.js +1 -1
  60. package/dist/esm/validator/validator.js +6 -1
  61. package/dist/esm/version.json +1 -1
  62. package/dist/types/builders/marks/fragment.d.ts +3 -0
  63. package/dist/types/builders.d.ts +1 -0
  64. package/dist/types/types/validatorTypes.d.ts +1 -0
  65. package/dist/types/validator/rules.d.ts +3 -0
  66. package/dist/types/validator/specs/blockCard.d.ts +1 -0
  67. package/dist/types/validator/specs/{bodiedExtension_with_no_marks.d.ts → bodiedExtension_with_experimental_marks.d.ts} +1 -2
  68. package/dist/types/validator/specs/embedCard.d.ts +1 -0
  69. package/dist/types/validator/specs/{extension_with_no_marks.d.ts → extension_with_experimental_marks.d.ts} +1 -2
  70. package/dist/types/validator/specs/fragment.d.ts +21 -0
  71. package/dist/types/validator/specs/index.d.ts +4 -3
  72. package/dist/types/validator/specs/inlineCard.d.ts +1 -0
  73. package/dist/types/validator/specs/{inlineExtension_with_no_marks.d.ts → inlineExtension_with_experimental_marks.d.ts} +1 -2
  74. package/dist/types/validator/specs/link.d.ts +1 -0
  75. package/package.json +7 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @atlaskit/adf-utils
2
2
 
3
+ ## 14.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`83154234335`](https://bitbucket.org/atlassian/atlassian-frontend/commits/83154234335) - ED-13522 Add safe URL check to ADF validator (smart cards now show as unsupported content if the check fails)
8
+ - [`8bbb96540ea`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8bbb96540ea) - Add "fragment" mark to stage0 ADF schema
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
3
14
  ## 14.3.0
4
15
 
5
16
  ### Minor Changes
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.fragment = void 0;
7
+
8
+ var _applyMark = require("../utils/apply-mark");
9
+
10
+ var fragment = function fragment(attrs) {
11
+ return function (maybeNode) {
12
+ return (0, _applyMark.applyMark)({
13
+ type: 'fragment',
14
+ attrs: attrs
15
+ }, maybeNode);
16
+ };
17
+ };
18
+
19
+ exports.fragment = fragment;
@@ -93,6 +93,12 @@ Object.defineProperty(exports, "dataConsumer", {
93
93
  return _dataConsumer.dataConsumer;
94
94
  }
95
95
  });
96
+ Object.defineProperty(exports, "fragment", {
97
+ enumerable: true,
98
+ get: function get() {
99
+ return _fragment.fragment;
100
+ }
101
+ });
96
102
  Object.defineProperty(exports, "blockQuote", {
97
103
  enumerable: true,
98
104
  get: function get() {
@@ -400,6 +406,8 @@ var _indentation = require("./builders/marks/indentation");
400
406
 
401
407
  var _dataConsumer = require("./builders/marks/data-consumer");
402
408
 
409
+ var _fragment = require("./builders/marks/fragment");
410
+
403
411
  var _blockquote = require("./builders/nodes/blockquote");
404
412
 
405
413
  var _bodiedExtension = require("./builders/nodes/bodied-extension");
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.validatorFnMap = void 0;
7
+
8
+ var _adfSchema = require("@atlaskit/adf-schema");
9
+
10
+ var validatorFnMap = {
11
+ safeUrl: _adfSchema.isSafeUrl
12
+ };
13
+ exports.validatorFnMap = validatorFnMap;
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_no_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline'];
7
+ var _default = ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline'];
8
8
  exports.default = _default;
@@ -13,7 +13,8 @@ var _default = {
13
13
  attrs: [{
14
14
  props: {
15
15
  url: {
16
- type: 'string'
16
+ type: 'string',
17
+ validatorFn: 'safeUrl'
17
18
  }
18
19
  }
19
20
  }, {
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = ['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_no_marks', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'bodiedExtension_with_no_marks', 'bodiedExtension_with_marks'];
7
+ var _default = ['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'extension_with_experimental_marks', 'embedCard', 'table', 'expand_with_no_mark', 'bodiedExtension_with_marks', 'bodiedExtension_with_experimental_marks'];
8
8
  exports.default = _default;
@@ -8,8 +8,7 @@ var _default = ['bodiedExtension', {
8
8
  props: {
9
9
  marks: {
10
10
  type: 'array',
11
- items: [],
12
- maxItems: 0,
11
+ items: ['fragment'],
13
12
  optional: true
14
13
  }
15
14
  }
@@ -16,7 +16,7 @@ var _default = {
16
16
  },
17
17
  content: {
18
18
  type: 'array',
19
- items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_no_marks', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'expand_with_breakout_mark', 'bodiedExtension_with_no_marks', 'bodiedExtension_with_marks', 'layoutSection_full', 'layoutSection_with_single_column']],
19
+ items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'extension_with_experimental_marks', 'embedCard', 'table', 'expand_with_no_mark', 'expand_with_breakout_mark', 'bodiedExtension_with_marks', 'bodiedExtension_with_experimental_marks', 'layoutSection_full', 'layoutSection_with_single_column']],
20
20
  allowUnsupportedBlock: true
21
21
  }
22
22
  }
@@ -21,7 +21,8 @@ var _default = {
21
21
  optional: true
22
22
  },
23
23
  url: {
24
- type: 'string'
24
+ type: 'string',
25
+ validatorFn: 'safeUrl'
25
26
  },
26
27
  width: {
27
28
  type: 'number',
@@ -8,8 +8,7 @@ var _default = ['extension', {
8
8
  props: {
9
9
  marks: {
10
10
  type: 'array',
11
- items: [],
12
- maxItems: 0,
11
+ items: ['fragment'],
13
12
  optional: true
14
13
  }
15
14
  }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = {
8
+ props: {
9
+ type: {
10
+ type: 'enum',
11
+ values: ['fragment']
12
+ },
13
+ attrs: {
14
+ props: {
15
+ localId: {
16
+ type: 'string',
17
+ minLength: 1
18
+ },
19
+ name: {
20
+ type: 'string',
21
+ optional: true
22
+ }
23
+ }
24
+ }
25
+ }
26
+ };
27
+ exports.default = _default;
@@ -89,6 +89,12 @@ Object.defineProperty(exports, "dataConsumer", {
89
89
  return _dataConsumer.default;
90
90
  }
91
91
  });
92
+ Object.defineProperty(exports, "fragment", {
93
+ enumerable: true,
94
+ get: function get() {
95
+ return _fragment.default;
96
+ }
97
+ });
92
98
  Object.defineProperty(exports, "hardBreak", {
93
99
  enumerable: true,
94
100
  get: function get() {
@@ -113,16 +119,16 @@ Object.defineProperty(exports, "inlineExtension", {
113
119
  return _inlineExtension.default;
114
120
  }
115
121
  });
116
- Object.defineProperty(exports, "inlineExtension_with_no_marks", {
122
+ Object.defineProperty(exports, "inlineExtension_with_marks", {
117
123
  enumerable: true,
118
124
  get: function get() {
119
- return _inlineExtension_with_no_marks.default;
125
+ return _inlineExtension_with_marks.default;
120
126
  }
121
127
  });
122
- Object.defineProperty(exports, "inlineExtension_with_marks", {
128
+ Object.defineProperty(exports, "inlineExtension_with_experimental_marks", {
123
129
  enumerable: true,
124
130
  get: function get() {
125
- return _inlineExtension_with_marks.default;
131
+ return _inlineExtension_with_experimental_marks.default;
126
132
  }
127
133
  });
128
134
  Object.defineProperty(exports, "date", {
@@ -365,16 +371,16 @@ Object.defineProperty(exports, "extension", {
365
371
  return _extension.default;
366
372
  }
367
373
  });
368
- Object.defineProperty(exports, "extension_with_no_marks", {
374
+ Object.defineProperty(exports, "extension_with_marks", {
369
375
  enumerable: true,
370
376
  get: function get() {
371
- return _extension_with_no_marks.default;
377
+ return _extension_with_marks.default;
372
378
  }
373
379
  });
374
- Object.defineProperty(exports, "extension_with_marks", {
380
+ Object.defineProperty(exports, "extension_with_experimental_marks", {
375
381
  enumerable: true,
376
382
  get: function get() {
377
- return _extension_with_marks.default;
383
+ return _extension_with_experimental_marks.default;
378
384
  }
379
385
  });
380
386
  Object.defineProperty(exports, "embedCard", {
@@ -461,16 +467,16 @@ Object.defineProperty(exports, "bodiedExtension", {
461
467
  return _bodiedExtension.default;
462
468
  }
463
469
  });
464
- Object.defineProperty(exports, "bodiedExtension_with_no_marks", {
470
+ Object.defineProperty(exports, "bodiedExtension_with_marks", {
465
471
  enumerable: true,
466
472
  get: function get() {
467
- return _bodiedExtension_with_no_marks.default;
473
+ return _bodiedExtension_with_marks.default;
468
474
  }
469
475
  });
470
- Object.defineProperty(exports, "bodiedExtension_with_marks", {
476
+ Object.defineProperty(exports, "bodiedExtension_with_experimental_marks", {
471
477
  enumerable: true,
472
478
  get: function get() {
473
- return _bodiedExtension_with_marks.default;
479
+ return _bodiedExtension_with_experimental_marks.default;
474
480
  }
475
481
  });
476
482
  Object.defineProperty(exports, "block_content", {
@@ -538,6 +544,8 @@ var _annotation = _interopRequireDefault(require("./annotation"));
538
544
 
539
545
  var _dataConsumer = _interopRequireDefault(require("./dataConsumer"));
540
546
 
547
+ var _fragment = _interopRequireDefault(require("./fragment"));
548
+
541
549
  var _hardBreak = _interopRequireDefault(require("./hardBreak"));
542
550
 
543
551
  var _mention = _interopRequireDefault(require("./mention"));
@@ -546,10 +554,10 @@ var _emoji = _interopRequireDefault(require("./emoji"));
546
554
 
547
555
  var _inlineExtension = _interopRequireDefault(require("./inlineExtension"));
548
556
 
549
- var _inlineExtension_with_no_marks = _interopRequireDefault(require("./inlineExtension_with_no_marks"));
550
-
551
557
  var _inlineExtension_with_marks = _interopRequireDefault(require("./inlineExtension_with_marks"));
552
558
 
559
+ var _inlineExtension_with_experimental_marks = _interopRequireDefault(require("./inlineExtension_with_experimental_marks"));
560
+
553
561
  var _date = _interopRequireDefault(require("./date"));
554
562
 
555
563
  var _placeholder = _interopRequireDefault(require("./placeholder"));
@@ -630,10 +638,10 @@ var _taskList = _interopRequireDefault(require("./taskList"));
630
638
 
631
639
  var _extension = _interopRequireDefault(require("./extension"));
632
640
 
633
- var _extension_with_no_marks = _interopRequireDefault(require("./extension_with_no_marks"));
634
-
635
641
  var _extension_with_marks = _interopRequireDefault(require("./extension_with_marks"));
636
642
 
643
+ var _extension_with_experimental_marks = _interopRequireDefault(require("./extension_with_experimental_marks"));
644
+
637
645
  var _embedCard = _interopRequireDefault(require("./embedCard"));
638
646
 
639
647
  var _nestedExpand_content = _interopRequireDefault(require("./nestedExpand_content"));
@@ -662,10 +670,10 @@ var _expand_with_breakout_mark = _interopRequireDefault(require("./expand_with_b
662
670
 
663
671
  var _bodiedExtension = _interopRequireDefault(require("./bodiedExtension"));
664
672
 
665
- var _bodiedExtension_with_no_marks = _interopRequireDefault(require("./bodiedExtension_with_no_marks"));
666
-
667
673
  var _bodiedExtension_with_marks = _interopRequireDefault(require("./bodiedExtension_with_marks"));
668
674
 
675
+ var _bodiedExtension_with_experimental_marks = _interopRequireDefault(require("./bodiedExtension_with_experimental_marks"));
676
+
669
677
  var _block_content = _interopRequireDefault(require("./block_content"));
670
678
 
671
679
  var _layoutColumn = _interopRequireDefault(require("./layoutColumn"));
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_no_marks', 'inlineExtension_with_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline', 'formatted_text_inline', 'code_inline'];
7
+ var _default = ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_marks', 'inlineExtension_with_experimental_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline', 'formatted_text_inline', 'code_inline'];
8
8
  exports.default = _default;
@@ -13,7 +13,8 @@ var _default = {
13
13
  attrs: [{
14
14
  props: {
15
15
  url: {
16
- type: 'string'
16
+ type: 'string',
17
+ validatorFn: 'safeUrl'
17
18
  }
18
19
  }
19
20
  }, {
@@ -8,8 +8,7 @@ var _default = ['inlineExtension', {
8
8
  props: {
9
9
  marks: {
10
10
  type: 'array',
11
- items: [],
12
- maxItems: 0,
11
+ items: ['fragment'],
13
12
  optional: true
14
13
  }
15
14
  }
@@ -13,7 +13,8 @@ var _default = {
13
13
  attrs: {
14
14
  props: {
15
15
  href: {
16
- type: 'string'
16
+ type: 'string',
17
+ validatorFn: 'safeUrl'
17
18
  },
18
19
  title: {
19
20
  type: 'string',
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = ['blockCard', 'paragraph_with_no_marks', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_no_marks', 'extension_with_marks', 'embedCard', 'table'];
7
+ var _default = ['blockCard', 'paragraph_with_no_marks', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'extension_with_experimental_marks', 'embedCard', 'table'];
8
8
  exports.default = _default;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _default = {
8
8
  type: 'array',
9
- items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_no_marks', 'extension_with_marks', 'embedCard', 'nestedExpand_with_no_marks']],
9
+ items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'extension_with_experimental_marks', 'embedCard', 'nestedExpand_with_no_marks']],
10
10
  minItems: 1,
11
11
  allowUnsupportedBlock: true
12
12
  };
@@ -20,6 +20,8 @@ var specs = _interopRequireWildcard(require("./specs"));
20
20
 
21
21
  var _utils = require("./utils");
22
22
 
23
+ var _rules = require("./rules");
24
+
23
25
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
24
26
 
25
27
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -194,7 +196,11 @@ function validateAttrs(spec, value) {
194
196
  return (0, _utils.isInteger)(value) && ((0, _utils.isDefined)(spec.minimum) ? spec.minimum <= value : true) && ((0, _utils.isDefined)(spec.maximum) ? spec.maximum >= value : true);
195
197
 
196
198
  case 'string':
197
- return (0, _utils.isString)(value) && ((0, _utils.isDefined)(spec.minLength) ? spec.minLength <= value.length : true) && (spec.pattern ? new RegExp(spec.pattern).test(value) : true);
199
+ var validatorFnPassed = function validatorFnPassed(rule) {
200
+ return typeof value === 'string' && (0, _utils.isDefined)(_rules.validatorFnMap[rule]) && _rules.validatorFnMap[rule](value);
201
+ };
202
+
203
+ return (0, _utils.isString)(value) && ((0, _utils.isDefined)(spec.minLength) ? spec.minLength <= value.length : true) && ((0, _utils.isDefined)(spec.validatorFn) ? validatorFnPassed(spec.validatorFn) : true) && (spec.pattern ? new RegExp(spec.pattern).test(value) : true);
198
204
 
199
205
  case 'object':
200
206
  return (0, _utils.isPlainObject)(value);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-utils",
3
- "version": "14.3.0",
3
+ "version": "14.4.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,7 @@
1
+ import { applyMark } from '../utils/apply-mark';
2
+ export const fragment = attrs => maybeNode => {
3
+ return applyMark({
4
+ type: 'fragment',
5
+ attrs
6
+ }, maybeNode);
7
+ };
@@ -13,7 +13,8 @@ export { underline } from './builders/marks/underline';
13
13
  export { underline as u } from './builders/marks/underline';
14
14
  export { alignment } from './builders/marks/alignment';
15
15
  export { indentation } from './builders/marks/indentation';
16
- export { dataConsumer } from './builders/marks/data-consumer'; // Nodes Builders
16
+ export { dataConsumer } from './builders/marks/data-consumer';
17
+ export { fragment } from './builders/marks/fragment'; // Nodes Builders
17
18
 
18
19
  export { blockQuote } from './builders/nodes/blockquote';
19
20
  export { bodiedExtension } from './builders/nodes/bodied-extension';
@@ -0,0 +1,4 @@
1
+ import { isSafeUrl } from '@atlaskit/adf-schema';
2
+ export const validatorFnMap = {
3
+ safeUrl: isSafeUrl
4
+ };
@@ -1 +1 @@
1
- export default ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_no_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline'];
1
+ export default ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline'];
@@ -7,7 +7,8 @@ export default {
7
7
  attrs: [{
8
8
  props: {
9
9
  url: {
10
- type: 'string'
10
+ type: 'string',
11
+ validatorFn: 'safeUrl'
11
12
  }
12
13
  }
13
14
  }, {
@@ -1 +1 @@
1
- export default ['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_no_marks', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'bodiedExtension_with_no_marks', 'bodiedExtension_with_marks'];
1
+ export default ['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'extension_with_experimental_marks', 'embedCard', 'table', 'expand_with_no_mark', 'bodiedExtension_with_marks', 'bodiedExtension_with_experimental_marks'];
@@ -2,8 +2,7 @@ export default ['bodiedExtension', {
2
2
  props: {
3
3
  marks: {
4
4
  type: 'array',
5
- items: [],
6
- maxItems: 0,
5
+ items: ['fragment'],
7
6
  optional: true
8
7
  }
9
8
  }
@@ -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', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_no_marks', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'expand_with_breakout_mark', 'bodiedExtension_with_no_marks', 'bodiedExtension_with_marks', 'layoutSection_full', 'layoutSection_with_single_column']],
13
+ items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'extension_with_experimental_marks', 'embedCard', 'table', 'expand_with_no_mark', 'expand_with_breakout_mark', 'bodiedExtension_with_marks', 'bodiedExtension_with_experimental_marks', 'layoutSection_full', 'layoutSection_with_single_column']],
14
14
  allowUnsupportedBlock: true
15
15
  }
16
16
  }
@@ -15,7 +15,8 @@ export default {
15
15
  optional: true
16
16
  },
17
17
  url: {
18
- type: 'string'
18
+ type: 'string',
19
+ validatorFn: 'safeUrl'
19
20
  },
20
21
  width: {
21
22
  type: 'number',
@@ -2,8 +2,7 @@ export default ['extension', {
2
2
  props: {
3
3
  marks: {
4
4
  type: 'array',
5
- items: [],
6
- maxItems: 0,
5
+ items: ['fragment'],
7
6
  optional: true
8
7
  }
9
8
  }
@@ -0,0 +1,20 @@
1
+ export default {
2
+ props: {
3
+ type: {
4
+ type: 'enum',
5
+ values: ['fragment']
6
+ },
7
+ attrs: {
8
+ props: {
9
+ localId: {
10
+ type: 'string',
11
+ minLength: 1
12
+ },
13
+ name: {
14
+ type: 'string',
15
+ optional: true
16
+ }
17
+ }
18
+ }
19
+ }
20
+ };
@@ -13,12 +13,13 @@ export { default as alignment } from './alignment';
13
13
  export { default as indentation } from './indentation';
14
14
  export { default as annotation } from './annotation';
15
15
  export { default as dataConsumer } from './dataConsumer';
16
+ export { default as fragment } from './fragment';
16
17
  export { default as hardBreak } from './hardBreak';
17
18
  export { default as mention } from './mention';
18
19
  export { default as emoji } from './emoji';
19
20
  export { default as inlineExtension } from './inlineExtension';
20
- export { default as inlineExtension_with_no_marks } from './inlineExtension_with_no_marks';
21
21
  export { default as inlineExtension_with_marks } from './inlineExtension_with_marks';
22
+ export { default as inlineExtension_with_experimental_marks } from './inlineExtension_with_experimental_marks';
22
23
  export { default as date } from './date';
23
24
  export { default as placeholder } from './placeholder';
24
25
  export { default as blockCard } from './blockCard';
@@ -59,8 +60,8 @@ export { default as decisionList } from './decisionList';
59
60
  export { default as taskItem } from './taskItem';
60
61
  export { default as taskList } from './taskList';
61
62
  export { default as extension } from './extension';
62
- export { default as extension_with_no_marks } from './extension_with_no_marks';
63
63
  export { default as extension_with_marks } from './extension_with_marks';
64
+ export { default as extension_with_experimental_marks } from './extension_with_experimental_marks';
64
65
  export { default as embedCard } from './embedCard';
65
66
  export { default as nestedExpand_content } from './nestedExpand_content';
66
67
  export { default as nestedExpand } from './nestedExpand';
@@ -75,8 +76,8 @@ export { default as expand } from './expand';
75
76
  export { default as expand_with_no_mark } from './expand_with_no_mark';
76
77
  export { default as expand_with_breakout_mark } from './expand_with_breakout_mark';
77
78
  export { default as bodiedExtension } from './bodiedExtension';
78
- export { default as bodiedExtension_with_no_marks } from './bodiedExtension_with_no_marks';
79
79
  export { default as bodiedExtension_with_marks } from './bodiedExtension_with_marks';
80
+ export { default as bodiedExtension_with_experimental_marks } from './bodiedExtension_with_experimental_marks';
80
81
  export { default as block_content } from './block_content';
81
82
  export { default as layoutColumn } from './layoutColumn';
82
83
  export { default as layoutSection } from './layoutSection';
@@ -1 +1 @@
1
- export default ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_no_marks', 'inlineExtension_with_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline', 'formatted_text_inline', 'code_inline'];
1
+ export default ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_marks', 'inlineExtension_with_experimental_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline', 'formatted_text_inline', 'code_inline'];
@@ -7,7 +7,8 @@ export default {
7
7
  attrs: [{
8
8
  props: {
9
9
  url: {
10
- type: 'string'
10
+ type: 'string',
11
+ validatorFn: 'safeUrl'
11
12
  }
12
13
  }
13
14
  }, {
@@ -2,8 +2,7 @@ export default ['inlineExtension', {
2
2
  props: {
3
3
  marks: {
4
4
  type: 'array',
5
- items: [],
6
- maxItems: 0,
5
+ items: ['fragment'],
7
6
  optional: true
8
7
  }
9
8
  }
@@ -7,7 +7,8 @@ export default {
7
7
  attrs: {
8
8
  props: {
9
9
  href: {
10
- type: 'string'
10
+ type: 'string',
11
+ validatorFn: 'safeUrl'
11
12
  },
12
13
  title: {
13
14
  type: 'string',
@@ -1 +1 @@
1
- export default ['blockCard', 'paragraph_with_no_marks', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_no_marks', 'extension_with_marks', 'embedCard', 'table'];
1
+ export default ['blockCard', 'paragraph_with_no_marks', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'extension_with_experimental_marks', 'embedCard', 'table'];
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  type: 'array',
3
- items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_no_marks', 'extension_with_marks', 'embedCard', 'nestedExpand_with_no_marks']],
3
+ items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'extension_with_experimental_marks', 'embedCard', 'nestedExpand_with_no_marks']],
4
4
  minItems: 1,
5
5
  allowUnsupportedBlock: true
6
6
  };
@@ -1,5 +1,6 @@
1
1
  import * as specs from './specs';
2
2
  import { copy, isBoolean, isDefined, isInteger, isNumber, isPlainObject, isString, makeArray } from './utils';
3
+ import { validatorFnMap } from './rules';
3
4
 
4
5
  function mapMarksItems(spec, fn = x => x) {
5
6
  if (spec.props && spec.props.marks) {
@@ -151,7 +152,9 @@ export function validateAttrs(spec, value) {
151
152
  return isInteger(value) && (isDefined(spec.minimum) ? spec.minimum <= value : true) && (isDefined(spec.maximum) ? spec.maximum >= value : true);
152
153
 
153
154
  case 'string':
154
- return isString(value) && (isDefined(spec.minLength) ? spec.minLength <= value.length : true) && (spec.pattern ? new RegExp(spec.pattern).test(value) : true);
155
+ const validatorFnPassed = rule => typeof value === 'string' && isDefined(validatorFnMap[rule]) && validatorFnMap[rule](value);
156
+
157
+ return isString(value) && (isDefined(spec.minLength) ? spec.minLength <= value.length : true) && (isDefined(spec.validatorFn) ? validatorFnPassed(spec.validatorFn) : true) && (spec.pattern ? new RegExp(spec.pattern).test(value) : true);
155
158
 
156
159
  case 'object':
157
160
  return isPlainObject(value);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-utils",
3
- "version": "14.3.0",
3
+ "version": "14.4.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,9 @@
1
+ import { applyMark } from '../utils/apply-mark';
2
+ export var fragment = function fragment(attrs) {
3
+ return function (maybeNode) {
4
+ return applyMark({
5
+ type: 'fragment',
6
+ attrs: attrs
7
+ }, maybeNode);
8
+ };
9
+ };
@@ -13,7 +13,8 @@ export { underline } from './builders/marks/underline';
13
13
  export { underline as u } from './builders/marks/underline';
14
14
  export { alignment } from './builders/marks/alignment';
15
15
  export { indentation } from './builders/marks/indentation';
16
- export { dataConsumer } from './builders/marks/data-consumer'; // Nodes Builders
16
+ export { dataConsumer } from './builders/marks/data-consumer';
17
+ export { fragment } from './builders/marks/fragment'; // Nodes Builders
17
18
 
18
19
  export { blockQuote } from './builders/nodes/blockquote';
19
20
  export { bodiedExtension } from './builders/nodes/bodied-extension';
@@ -0,0 +1,4 @@
1
+ import { isSafeUrl } from '@atlaskit/adf-schema';
2
+ export var validatorFnMap = {
3
+ safeUrl: isSafeUrl
4
+ };
@@ -1 +1 @@
1
- export default ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_no_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline'];
1
+ export default ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline'];
@@ -7,7 +7,8 @@ export default {
7
7
  attrs: [{
8
8
  props: {
9
9
  url: {
10
- type: 'string'
10
+ type: 'string',
11
+ validatorFn: 'safeUrl'
11
12
  }
12
13
  }
13
14
  }, {
@@ -1 +1 @@
1
- export default ['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_no_marks', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'bodiedExtension_with_no_marks', 'bodiedExtension_with_marks'];
1
+ export default ['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'extension_with_experimental_marks', 'embedCard', 'table', 'expand_with_no_mark', 'bodiedExtension_with_marks', 'bodiedExtension_with_experimental_marks'];
@@ -2,8 +2,7 @@ export default ['bodiedExtension', {
2
2
  props: {
3
3
  marks: {
4
4
  type: 'array',
5
- items: [],
6
- maxItems: 0,
5
+ items: ['fragment'],
7
6
  optional: true
8
7
  }
9
8
  }
@@ -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', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_no_marks', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'expand_with_breakout_mark', 'bodiedExtension_with_no_marks', 'bodiedExtension_with_marks', 'layoutSection_full', 'layoutSection_with_single_column']],
13
+ items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'extension_with_experimental_marks', 'embedCard', 'table', 'expand_with_no_mark', 'expand_with_breakout_mark', 'bodiedExtension_with_marks', 'bodiedExtension_with_experimental_marks', 'layoutSection_full', 'layoutSection_with_single_column']],
14
14
  allowUnsupportedBlock: true
15
15
  }
16
16
  }
@@ -15,7 +15,8 @@ export default {
15
15
  optional: true
16
16
  },
17
17
  url: {
18
- type: 'string'
18
+ type: 'string',
19
+ validatorFn: 'safeUrl'
19
20
  },
20
21
  width: {
21
22
  type: 'number',
@@ -2,8 +2,7 @@ export default ['extension', {
2
2
  props: {
3
3
  marks: {
4
4
  type: 'array',
5
- items: [],
6
- maxItems: 0,
5
+ items: ['fragment'],
7
6
  optional: true
8
7
  }
9
8
  }
@@ -0,0 +1,20 @@
1
+ export default {
2
+ props: {
3
+ type: {
4
+ type: 'enum',
5
+ values: ['fragment']
6
+ },
7
+ attrs: {
8
+ props: {
9
+ localId: {
10
+ type: 'string',
11
+ minLength: 1
12
+ },
13
+ name: {
14
+ type: 'string',
15
+ optional: true
16
+ }
17
+ }
18
+ }
19
+ }
20
+ };
@@ -13,12 +13,13 @@ export { default as alignment } from './alignment';
13
13
  export { default as indentation } from './indentation';
14
14
  export { default as annotation } from './annotation';
15
15
  export { default as dataConsumer } from './dataConsumer';
16
+ export { default as fragment } from './fragment';
16
17
  export { default as hardBreak } from './hardBreak';
17
18
  export { default as mention } from './mention';
18
19
  export { default as emoji } from './emoji';
19
20
  export { default as inlineExtension } from './inlineExtension';
20
- export { default as inlineExtension_with_no_marks } from './inlineExtension_with_no_marks';
21
21
  export { default as inlineExtension_with_marks } from './inlineExtension_with_marks';
22
+ export { default as inlineExtension_with_experimental_marks } from './inlineExtension_with_experimental_marks';
22
23
  export { default as date } from './date';
23
24
  export { default as placeholder } from './placeholder';
24
25
  export { default as blockCard } from './blockCard';
@@ -59,8 +60,8 @@ export { default as decisionList } from './decisionList';
59
60
  export { default as taskItem } from './taskItem';
60
61
  export { default as taskList } from './taskList';
61
62
  export { default as extension } from './extension';
62
- export { default as extension_with_no_marks } from './extension_with_no_marks';
63
63
  export { default as extension_with_marks } from './extension_with_marks';
64
+ export { default as extension_with_experimental_marks } from './extension_with_experimental_marks';
64
65
  export { default as embedCard } from './embedCard';
65
66
  export { default as nestedExpand_content } from './nestedExpand_content';
66
67
  export { default as nestedExpand } from './nestedExpand';
@@ -75,8 +76,8 @@ export { default as expand } from './expand';
75
76
  export { default as expand_with_no_mark } from './expand_with_no_mark';
76
77
  export { default as expand_with_breakout_mark } from './expand_with_breakout_mark';
77
78
  export { default as bodiedExtension } from './bodiedExtension';
78
- export { default as bodiedExtension_with_no_marks } from './bodiedExtension_with_no_marks';
79
79
  export { default as bodiedExtension_with_marks } from './bodiedExtension_with_marks';
80
+ export { default as bodiedExtension_with_experimental_marks } from './bodiedExtension_with_experimental_marks';
80
81
  export { default as block_content } from './block_content';
81
82
  export { default as layoutColumn } from './layoutColumn';
82
83
  export { default as layoutSection } from './layoutSection';
@@ -1 +1 @@
1
- export default ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_no_marks', 'inlineExtension_with_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline', 'formatted_text_inline', 'code_inline'];
1
+ export default ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_marks', 'inlineExtension_with_experimental_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline', 'formatted_text_inline', 'code_inline'];
@@ -7,7 +7,8 @@ export default {
7
7
  attrs: [{
8
8
  props: {
9
9
  url: {
10
- type: 'string'
10
+ type: 'string',
11
+ validatorFn: 'safeUrl'
11
12
  }
12
13
  }
13
14
  }, {
@@ -2,8 +2,7 @@ export default ['inlineExtension', {
2
2
  props: {
3
3
  marks: {
4
4
  type: 'array',
5
- items: [],
6
- maxItems: 0,
5
+ items: ['fragment'],
7
6
  optional: true
8
7
  }
9
8
  }
@@ -7,7 +7,8 @@ export default {
7
7
  attrs: {
8
8
  props: {
9
9
  href: {
10
- type: 'string'
10
+ type: 'string',
11
+ validatorFn: 'safeUrl'
11
12
  },
12
13
  title: {
13
14
  type: 'string',
@@ -1 +1 @@
1
- export default ['blockCard', 'paragraph_with_no_marks', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_no_marks', 'extension_with_marks', 'embedCard', 'table'];
1
+ export default ['blockCard', 'paragraph_with_no_marks', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'extension_with_experimental_marks', 'embedCard', 'table'];
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  type: 'array',
3
- items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_no_marks', 'extension_with_marks', 'embedCard', 'nestedExpand_with_no_marks']],
3
+ items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'extension_with_experimental_marks', 'embedCard', 'nestedExpand_with_no_marks']],
4
4
  minItems: 1,
5
5
  allowUnsupportedBlock: true
6
6
  };
@@ -8,6 +8,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
8
8
 
9
9
  import * as specs from './specs';
10
10
  import { copy, isBoolean, isDefined, isInteger, isNumber, isPlainObject, isString, makeArray } from './utils';
11
+ import { validatorFnMap } from './rules';
11
12
 
12
13
  function mapMarksItems(spec) {
13
14
  var fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (x) {
@@ -176,7 +177,11 @@ export function validateAttrs(spec, value) {
176
177
  return isInteger(value) && (isDefined(spec.minimum) ? spec.minimum <= value : true) && (isDefined(spec.maximum) ? spec.maximum >= value : true);
177
178
 
178
179
  case 'string':
179
- return isString(value) && (isDefined(spec.minLength) ? spec.minLength <= value.length : true) && (spec.pattern ? new RegExp(spec.pattern).test(value) : true);
180
+ var validatorFnPassed = function validatorFnPassed(rule) {
181
+ return typeof value === 'string' && isDefined(validatorFnMap[rule]) && validatorFnMap[rule](value);
182
+ };
183
+
184
+ return isString(value) && (isDefined(spec.minLength) ? spec.minLength <= value.length : true) && (isDefined(spec.validatorFn) ? validatorFnPassed(spec.validatorFn) : true) && (spec.pattern ? new RegExp(spec.pattern).test(value) : true);
180
185
 
181
186
  case 'object':
182
187
  return isPlainObject(value);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-utils",
3
- "version": "14.3.0",
3
+ "version": "14.4.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,3 @@
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>;
@@ -13,6 +13,7 @@ export { underline as u } from './builders/marks/underline';
13
13
  export { alignment } from './builders/marks/alignment';
14
14
  export { indentation } from './builders/marks/indentation';
15
15
  export { dataConsumer } from './builders/marks/data-consumer';
16
+ export { fragment } from './builders/marks/fragment';
16
17
  export { blockQuote } from './builders/nodes/blockquote';
17
18
  export { bodiedExtension } from './builders/nodes/bodied-extension';
18
19
  export { blockCard } from './builders/nodes/block-card';
@@ -43,6 +43,7 @@ export declare type AttributesSpec = {
43
43
  optional?: boolean;
44
44
  minLength?: number;
45
45
  pattern?: RegExp;
46
+ validatorFn?: string;
46
47
  } | {
47
48
  type: 'enum';
48
49
  values: Array<string>;
@@ -0,0 +1,3 @@
1
+ export declare const validatorFnMap: {
2
+ [key: string]: (value: string) => boolean;
3
+ };
@@ -8,6 +8,7 @@ declare const _default: {
8
8
  props: {
9
9
  url: {
10
10
  type: string;
11
+ validatorFn: string;
11
12
  };
12
13
  data?: undefined;
13
14
  };
@@ -2,8 +2,7 @@ declare const _default: (string | {
2
2
  props: {
3
3
  marks: {
4
4
  type: string;
5
- items: never[];
6
- maxItems: number;
5
+ items: string[];
7
6
  optional: boolean;
8
7
  };
9
8
  };
@@ -16,6 +16,7 @@ declare const _default: {
16
16
  };
17
17
  url: {
18
18
  type: string;
19
+ validatorFn: string;
19
20
  };
20
21
  width: {
21
22
  type: string;
@@ -2,8 +2,7 @@ declare const _default: (string | {
2
2
  props: {
3
3
  marks: {
4
4
  type: string;
5
- items: never[];
6
- maxItems: number;
5
+ items: string[];
7
6
  optional: boolean;
8
7
  };
9
8
  };
@@ -0,0 +1,21 @@
1
+ declare const _default: {
2
+ props: {
3
+ type: {
4
+ type: string;
5
+ values: string[];
6
+ };
7
+ attrs: {
8
+ props: {
9
+ localId: {
10
+ type: string;
11
+ minLength: number;
12
+ };
13
+ name: {
14
+ type: string;
15
+ optional: boolean;
16
+ };
17
+ };
18
+ };
19
+ };
20
+ };
21
+ export default _default;
@@ -12,12 +12,13 @@ export { default as alignment } from './alignment';
12
12
  export { default as indentation } from './indentation';
13
13
  export { default as annotation } from './annotation';
14
14
  export { default as dataConsumer } from './dataConsumer';
15
+ export { default as fragment } from './fragment';
15
16
  export { default as hardBreak } from './hardBreak';
16
17
  export { default as mention } from './mention';
17
18
  export { default as emoji } from './emoji';
18
19
  export { default as inlineExtension } from './inlineExtension';
19
- export { default as inlineExtension_with_no_marks } from './inlineExtension_with_no_marks';
20
20
  export { default as inlineExtension_with_marks } from './inlineExtension_with_marks';
21
+ export { default as inlineExtension_with_experimental_marks } from './inlineExtension_with_experimental_marks';
21
22
  export { default as date } from './date';
22
23
  export { default as placeholder } from './placeholder';
23
24
  export { default as blockCard } from './blockCard';
@@ -58,8 +59,8 @@ export { default as decisionList } from './decisionList';
58
59
  export { default as taskItem } from './taskItem';
59
60
  export { default as taskList } from './taskList';
60
61
  export { default as extension } from './extension';
61
- export { default as extension_with_no_marks } from './extension_with_no_marks';
62
62
  export { default as extension_with_marks } from './extension_with_marks';
63
+ export { default as extension_with_experimental_marks } from './extension_with_experimental_marks';
63
64
  export { default as embedCard } from './embedCard';
64
65
  export { default as nestedExpand_content } from './nestedExpand_content';
65
66
  export { default as nestedExpand } from './nestedExpand';
@@ -74,8 +75,8 @@ export { default as expand } from './expand';
74
75
  export { default as expand_with_no_mark } from './expand_with_no_mark';
75
76
  export { default as expand_with_breakout_mark } from './expand_with_breakout_mark';
76
77
  export { default as bodiedExtension } from './bodiedExtension';
77
- export { default as bodiedExtension_with_no_marks } from './bodiedExtension_with_no_marks';
78
78
  export { default as bodiedExtension_with_marks } from './bodiedExtension_with_marks';
79
+ export { default as bodiedExtension_with_experimental_marks } from './bodiedExtension_with_experimental_marks';
79
80
  export { default as block_content } from './block_content';
80
81
  export { default as layoutColumn } from './layoutColumn';
81
82
  export { default as layoutSection } from './layoutSection';
@@ -8,6 +8,7 @@ declare const _default: {
8
8
  props: {
9
9
  url: {
10
10
  type: string;
11
+ validatorFn: string;
11
12
  };
12
13
  data?: undefined;
13
14
  };
@@ -2,8 +2,7 @@ declare const _default: (string | {
2
2
  props: {
3
3
  marks: {
4
4
  type: string;
5
- items: never[];
6
- maxItems: number;
5
+ items: string[];
7
6
  optional: boolean;
8
7
  };
9
8
  };
@@ -8,6 +8,7 @@ declare const _default: {
8
8
  props: {
9
9
  href: {
10
10
  type: string;
11
+ validatorFn: string;
11
12
  };
12
13
  title: {
13
14
  type: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-utils",
3
- "version": "14.3.0",
3
+ "version": "14.4.0",
4
4
  "description": "Set of utilities to traverse, modify and create ADF documents.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -24,12 +24,12 @@
24
24
  "generate:spec": "rm -rf ./src/validator/specs/ && ../json-schema-generator/bin.js --outDir=./src/validator/specs/ --mode=Spec --stage=0 ./src/validator/entry.ts"
25
25
  },
26
26
  "dependencies": {
27
- "@atlaskit/adf-schema": "^19.2.0",
27
+ "@atlaskit/adf-schema": "^20.0.0",
28
28
  "@babel/runtime": "^7.0.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@atlaskit/docs": "*",
32
- "@atlaskit/json-schema-generator": "^3.1.0",
32
+ "@atlaskit/json-schema-generator": "^3.2.0",
33
33
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
34
34
  "react": "^16.8.0",
35
35
  "typescript": "3.9.6",
@@ -40,7 +40,10 @@
40
40
  "circular-dependencies": [
41
41
  "file-level"
42
42
  ]
43
+ },
44
+ "@repo/internal": {
45
+ "deprecation": "no-deprecated-imports"
43
46
  }
44
47
  },
45
48
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
46
- }
49
+ }