@atlaskit/adf-utils 19.27.46 → 19.28.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @atlaskit/adf-utils
2
2
 
3
+ ## 19.28.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`9ea3b02135766`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9ea3b02135766) -
8
+ EDITOR-5613: Remove flexible list variants and consolidate into base list types.
9
+
10
+ The `listItem` and `taskList` node specs now natively support the flexible content model (allowing
11
+ lists as first child of listItem, and nested taskLists without requiring taskItem first). The
12
+ separate `listItemWithFlexibleFirstChildStage0` and `taskListWithFlexibleFirstChildStage0`
13
+ variants have been removed from public exports — the flexible behavior is now the default for all
14
+ schema stages. Consumers importing these removed exports should switch to `listItem` / `taskList`.
15
+
16
+ This is a schema simplification: the flexible content spec is a strict superset of the old
17
+ restrictive spec, so all previously valid content remains valid.
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+
23
+ ## 19.27.47
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies
28
+
3
29
  ## 19.27.46
4
30
 
5
31
  ### Patch Changes
@@ -303,12 +303,6 @@ Object.defineProperty(exports, "listItem", {
303
303
  return _schemaValidator.listItem;
304
304
  }
305
305
  });
306
- Object.defineProperty(exports, "listItem_with_flexible_first_child", {
307
- enumerable: true,
308
- get: function get() {
309
- return _schemaValidator.listItem_with_flexible_first_child;
310
- }
311
- });
312
306
  Object.defineProperty(exports, "media", {
313
307
  enumerable: true,
314
308
  get: function get() {
@@ -513,12 +507,6 @@ Object.defineProperty(exports, "taskList", {
513
507
  return _schemaValidator.taskList;
514
508
  }
515
509
  });
516
- Object.defineProperty(exports, "taskList_with_flexible_first_child", {
517
- enumerable: true,
518
- get: function get() {
519
- return _schemaValidator.taskList_with_flexible_first_child;
520
- }
521
- });
522
510
  Object.defineProperty(exports, "text", {
523
511
  enumerable: true,
524
512
  get: function get() {
@@ -12,7 +12,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
12
12
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
14
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
- var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
16
15
  var specs = _interopRequireWildcard(require("./specs"));
17
16
  var _utils = require("./utils");
18
17
  var _extractAllowedContent = require("./extractAllowedContent");
@@ -67,9 +66,6 @@ var partitionObject = function partitionObject(obj, predicate) {
67
66
  * Checks if a spec is a variant spec.
68
67
  * A variant spec is an array where the first element is a string (base spec name)
69
68
  * and the second element is a ValidatorSpec object { props: { ... } }
70
- *
71
- * @param spec - The spec to check
72
- * @returns true if the spec is a variant spec, false otherwise
73
69
  */
74
70
  var isVariant = function isVariant(spec) {
75
71
  return (0, _typeof2.default)(spec) === 'object' && !!spec && 0 in spec && 1 in spec && typeof spec[0] === 'string' && (0, _typeof2.default)(spec[1]) === 'object';
@@ -80,19 +76,16 @@ var isVariant = function isVariant(spec) {
80
76
  * We denormalised the spec to save bundle size.
81
77
  */
82
78
  function createSpec(nodes, marks) {
79
+ var variantOverrides = getVariantSpecOverrides();
83
80
  // Ignored via go/ees005
84
81
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
85
82
  return Object.keys(specs).reduce(function (newSpecs, k) {
86
83
  // Ignored via go/ees005
87
84
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
88
85
  var spec = _objectSpread({}, specs[k]);
89
- if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_flexible_list_schema', 'isEnabled', true) && isVariant(spec) &&
90
- // Only apply to variants which are explicitly marked for override in `variantSpecOverrides`
91
- Object.values(variantSpecOverrides).includes(k)) {
92
- // This allows the variant spec to also have the content normalization applied to it
86
+ if (isVariant(spec) && Object.values(variantOverrides).includes(k)) {
93
87
  // When the spec is a variant it will be in the form of ['base_spec_name', { props: { ... } }]
94
- // So the actual validator spec of the variant will be the second item in the array
95
- // We also need to shallow clone this to ensure we don't mutate the original spec
88
+ // The actual validator spec of the variant will be the second item in the array
96
89
  spec = _objectSpread({}, spec[1]);
97
90
  }
98
91
  if (spec.props) {
@@ -212,6 +205,10 @@ function getOptionsForType(type, list) {
212
205
  var isValidatorSpecAttrs = function isValidatorSpecAttrs(spec) {
213
206
  return !!spec.props;
214
207
  };
208
+
209
+ /**
210
+ * Validates attributes against the provided attribute specification.
211
+ */
215
212
  function validateAttrs(spec, value) {
216
213
  if (!(0, _utils.isDefined)(value)) {
217
214
  return !!spec.optional;
@@ -350,21 +347,22 @@ var unsupportedNodeAttributesContent = function unsupportedNodeAttributesContent
350
347
  };
351
348
 
352
349
  /**
353
- * Map of base spec names to a preferred variant spec that should be used in their place during validation.
350
+ * Returns a map of base spec names to a preferred variant spec that should be used
351
+ * in their place during validation. Implemented as a getter function so that entries
352
+ * can be conditionally included behind feature gates.
354
353
  *
355
354
  * WARNING: The variant spec must be a strict superset of the base spec, i.e. any content valid
356
- * under the base spec must also be valid under the variant
355
+ * under the base spec must also be valid under the variant.
357
356
  */
358
- var variantSpecOverrides = {
359
- listItem: 'listItem_with_flexible_first_child',
360
- taskList: 'taskList_with_flexible_first_child'
357
+ var getVariantSpecOverrides = function getVariantSpecOverrides() {
358
+ return {};
361
359
  };
362
360
 
363
361
  /**
364
- * Replaces base validator specs with their designated variant overrides
362
+ * Replaces base validator specs with their designated variant overrides.
365
363
  */
366
364
  var applyVariantSpecOverrides = function applyVariantSpecOverrides(validatorSpecs) {
367
- Object.entries(variantSpecOverrides).forEach(function (_ref2) {
365
+ Object.entries(getVariantSpecOverrides()).forEach(function (_ref2) {
368
366
  var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
369
367
  base = _ref3[0],
370
368
  variant = _ref3[1];
@@ -376,11 +374,14 @@ var applyVariantSpecOverrides = function applyVariantSpecOverrides(validatorSpec
376
374
  }
377
375
  });
378
376
  };
377
+
378
+ /**
379
+ * Creates a validator function for ADF documents.
380
+ * Validates document structure against the ADF specification.
381
+ */
379
382
  function validator(nodes, marks, options) {
380
383
  var validatorSpecs = createSpec(nodes, marks);
381
- if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_flexible_list_schema', 'isEnabled', true)) {
382
- applyVariantSpecOverrides(validatorSpecs);
383
- }
384
+ applyVariantSpecOverrides(validatorSpecs);
384
385
  var _ref4 = options || {},
385
386
  _ref4$mode = _ref4.mode,
386
387
  mode = _ref4$mode === void 0 ? 'strict' : _ref4$mode,
@@ -1,2 +1,2 @@
1
1
  /* eslint-disable @atlaskit/editor/no-re-export */
2
- export { alignment, annotation, backgroundColor, blockCard, block_content, blockRootOnly, blockquote, blockTaskItem, bodiedExtension, bodiedExtension_with_marks, border, breakout, bulletList, caption, code, codeBlock, codeBlock_root_only, text_with_no_marks, confluenceInlineComment, dataConsumer, date, decisionItem, decisionList, doc, em, embedCard, emoji, expand, expand_root_only, extension, extensionFrame, extension_with_marks, fontSize, fragment, hardBreak, heading, heading_with_alignment, heading_with_indentation, heading_with_no_marks, indentation, inlineCard, inlineExtension, inlineExtension_with_marks, inline_content, layoutColumn, layoutSection, layoutSection_full, layoutSection_with_single_column, link, listItem, listItem_with_flexible_first_child, media, mediaGroup, mediaInline, mediaSingle, mediaSingle_caption, mediaSingle_full, mention, multiBodiedExtension, nestedExpand, nestedExpand_content, nestedExpand_with_no_marks, non_nestable_block_content, orderedList, panel, paragraph, paragraph_with_alignment, paragraph_with_font_size, paragraph_with_font_size_and_alignment, paragraph_with_font_size_and_indentation, paragraph_with_indentation, paragraph_with_no_marks, placeholder, rule, status, strike, strong, subsup, table, tableCell, tableHeader, tableRow, taskItem, taskList, taskList_with_flexible_first_child, text, textColor, text_code_inline, text_formatted, text_link_inline, underline, syncBlock, bodiedSyncBlock } from '@atlaskit/adf-schema/schema-validator';
2
+ export { alignment, annotation, backgroundColor, blockCard, block_content, blockRootOnly, blockquote, blockTaskItem, bodiedExtension, bodiedExtension_with_marks, border, breakout, bulletList, caption, code, codeBlock, codeBlock_root_only, text_with_no_marks, confluenceInlineComment, dataConsumer, date, decisionItem, decisionList, doc, em, embedCard, emoji, expand, expand_root_only, extension, extensionFrame, extension_with_marks, fontSize, fragment, hardBreak, heading, heading_with_alignment, heading_with_indentation, heading_with_no_marks, indentation, inlineCard, inlineExtension, inlineExtension_with_marks, inline_content, layoutColumn, layoutSection, layoutSection_full, layoutSection_with_single_column, link, listItem, media, mediaGroup, mediaInline, mediaSingle, mediaSingle_caption, mediaSingle_full, mention, multiBodiedExtension, nestedExpand, nestedExpand_content, nestedExpand_with_no_marks, non_nestable_block_content, orderedList, panel, paragraph, paragraph_with_alignment, paragraph_with_font_size, paragraph_with_font_size_and_alignment, paragraph_with_font_size_and_indentation, paragraph_with_indentation, paragraph_with_no_marks, placeholder, rule, status, strike, strong, subsup, table, tableCell, tableHeader, tableRow, taskItem, taskList, text, textColor, text_code_inline, text_formatted, text_link_inline, underline, syncBlock, bodiedSyncBlock } from '@atlaskit/adf-schema/schema-validator';
@@ -1,4 +1,3 @@
1
- import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
2
1
  // Ignored via go/ees005
3
2
  // eslint-disable-next-line import/no-namespace
4
3
  import * as specs from './specs';
@@ -47,9 +46,6 @@ const partitionObject = (obj, predicate) => Object.keys(obj).reduce((acc, key) =
47
46
  * Checks if a spec is a variant spec.
48
47
  * A variant spec is an array where the first element is a string (base spec name)
49
48
  * and the second element is a ValidatorSpec object { props: { ... } }
50
- *
51
- * @param spec - The spec to check
52
- * @returns true if the spec is a variant spec, false otherwise
53
49
  */
54
50
  const isVariant = spec => typeof spec === 'object' && !!spec && 0 in spec && 1 in spec && typeof spec[0] === 'string' && typeof spec[1] === 'object';
55
51
 
@@ -58,6 +54,7 @@ const isVariant = spec => typeof spec === 'object' && !!spec && 0 in spec && 1 i
58
54
  * We denormalised the spec to save bundle size.
59
55
  */
60
56
  export function createSpec(nodes, marks) {
57
+ const variantOverrides = getVariantSpecOverrides();
61
58
  // Ignored via go/ees005
62
59
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
60
  return Object.keys(specs).reduce((newSpecs, k) => {
@@ -66,13 +63,9 @@ export function createSpec(nodes, marks) {
66
63
  let spec = {
67
64
  ...specs[k]
68
65
  };
69
- if (expValEqualsNoExposure('platform_editor_flexible_list_schema', 'isEnabled', true) && isVariant(spec) &&
70
- // Only apply to variants which are explicitly marked for override in `variantSpecOverrides`
71
- Object.values(variantSpecOverrides).includes(k)) {
72
- // This allows the variant spec to also have the content normalization applied to it
66
+ if (isVariant(spec) && Object.values(variantOverrides).includes(k)) {
73
67
  // When the spec is a variant it will be in the form of ['base_spec_name', { props: { ... } }]
74
- // So the actual validator spec of the variant will be the second item in the array
75
- // We also need to shallow clone this to ensure we don't mutate the original spec
68
+ // The actual validator spec of the variant will be the second item in the array
76
69
  spec = {
77
70
  ...spec[1]
78
71
  };
@@ -183,6 +176,10 @@ function getOptionsForType(type, list) {
183
176
  const isValidatorSpecAttrs = spec => {
184
177
  return !!spec.props;
185
178
  };
179
+
180
+ /**
181
+ * Validates attributes against the provided attribute specification.
182
+ */
186
183
  export function validateAttrs(spec, value) {
187
184
  if (!isDefined(value)) {
188
185
  return !!spec.optional;
@@ -311,21 +308,22 @@ const unsupportedNodeAttributesContent = (entity, errorCode, invalidAttributes,
311
308
  };
312
309
 
313
310
  /**
314
- * Map of base spec names to a preferred variant spec that should be used in their place during validation.
311
+ * Returns a map of base spec names to a preferred variant spec that should be used
312
+ * in their place during validation. Implemented as a getter function so that entries
313
+ * can be conditionally included behind feature gates.
315
314
  *
316
315
  * WARNING: The variant spec must be a strict superset of the base spec, i.e. any content valid
317
- * under the base spec must also be valid under the variant
316
+ * under the base spec must also be valid under the variant.
318
317
  */
319
- const variantSpecOverrides = {
320
- listItem: 'listItem_with_flexible_first_child',
321
- taskList: 'taskList_with_flexible_first_child'
318
+ const getVariantSpecOverrides = () => {
319
+ return {};
322
320
  };
323
321
 
324
322
  /**
325
- * Replaces base validator specs with their designated variant overrides
323
+ * Replaces base validator specs with their designated variant overrides.
326
324
  */
327
325
  const applyVariantSpecOverrides = validatorSpecs => {
328
- Object.entries(variantSpecOverrides).forEach(([base, variant]) => {
326
+ Object.entries(getVariantSpecOverrides()).forEach(([base, variant]) => {
329
327
  const baseSpec = validatorSpecs[base];
330
328
  const variantOverride = validatorSpecs[variant];
331
329
  if (baseSpec !== null && baseSpec !== void 0 && baseSpec.props && variantOverride !== null && variantOverride !== void 0 && variantOverride.props && typeof baseSpec.props === 'object' && typeof variantOverride.props === 'object') {
@@ -338,11 +336,14 @@ const applyVariantSpecOverrides = validatorSpecs => {
338
336
  }
339
337
  });
340
338
  };
339
+
340
+ /**
341
+ * Creates a validator function for ADF documents.
342
+ * Validates document structure against the ADF specification.
343
+ */
341
344
  export function validator(nodes, marks, options) {
342
345
  const validatorSpecs = createSpec(nodes, marks);
343
- if (expValEqualsNoExposure('platform_editor_flexible_list_schema', 'isEnabled', true)) {
344
- applyVariantSpecOverrides(validatorSpecs);
345
- }
346
+ applyVariantSpecOverrides(validatorSpecs);
346
347
  const {
347
348
  mode = 'strict',
348
349
  allowPrivateAttributes = false
@@ -1,2 +1,2 @@
1
1
  /* eslint-disable @atlaskit/editor/no-re-export */
2
- export { alignment, annotation, backgroundColor, blockCard, block_content, blockRootOnly, blockquote, blockTaskItem, bodiedExtension, bodiedExtension_with_marks, border, breakout, bulletList, caption, code, codeBlock, codeBlock_root_only, text_with_no_marks, confluenceInlineComment, dataConsumer, date, decisionItem, decisionList, doc, em, embedCard, emoji, expand, expand_root_only, extension, extensionFrame, extension_with_marks, fontSize, fragment, hardBreak, heading, heading_with_alignment, heading_with_indentation, heading_with_no_marks, indentation, inlineCard, inlineExtension, inlineExtension_with_marks, inline_content, layoutColumn, layoutSection, layoutSection_full, layoutSection_with_single_column, link, listItem, listItem_with_flexible_first_child, media, mediaGroup, mediaInline, mediaSingle, mediaSingle_caption, mediaSingle_full, mention, multiBodiedExtension, nestedExpand, nestedExpand_content, nestedExpand_with_no_marks, non_nestable_block_content, orderedList, panel, paragraph, paragraph_with_alignment, paragraph_with_font_size, paragraph_with_font_size_and_alignment, paragraph_with_font_size_and_indentation, paragraph_with_indentation, paragraph_with_no_marks, placeholder, rule, status, strike, strong, subsup, table, tableCell, tableHeader, tableRow, taskItem, taskList, taskList_with_flexible_first_child, text, textColor, text_code_inline, text_formatted, text_link_inline, underline, syncBlock, bodiedSyncBlock } from '@atlaskit/adf-schema/schema-validator';
2
+ export { alignment, annotation, backgroundColor, blockCard, block_content, blockRootOnly, blockquote, blockTaskItem, bodiedExtension, bodiedExtension_with_marks, border, breakout, bulletList, caption, code, codeBlock, codeBlock_root_only, text_with_no_marks, confluenceInlineComment, dataConsumer, date, decisionItem, decisionList, doc, em, embedCard, emoji, expand, expand_root_only, extension, extensionFrame, extension_with_marks, fontSize, fragment, hardBreak, heading, heading_with_alignment, heading_with_indentation, heading_with_no_marks, indentation, inlineCard, inlineExtension, inlineExtension_with_marks, inline_content, layoutColumn, layoutSection, layoutSection_full, layoutSection_with_single_column, link, listItem, media, mediaGroup, mediaInline, mediaSingle, mediaSingle_caption, mediaSingle_full, mention, multiBodiedExtension, nestedExpand, nestedExpand_content, nestedExpand_with_no_marks, non_nestable_block_content, orderedList, panel, paragraph, paragraph_with_alignment, paragraph_with_font_size, paragraph_with_font_size_and_alignment, paragraph_with_font_size_and_indentation, paragraph_with_indentation, paragraph_with_no_marks, placeholder, rule, status, strike, strong, subsup, table, tableCell, tableHeader, tableRow, taskItem, taskList, text, textColor, text_code_inline, text_formatted, text_link_inline, underline, syncBlock, bodiedSyncBlock } from '@atlaskit/adf-schema/schema-validator';
@@ -8,7 +8,6 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
8
8
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
9
9
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
10
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
- import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
12
11
  // Ignored via go/ees005
13
12
  // eslint-disable-next-line import/no-namespace
14
13
  import * as specs from './specs';
@@ -58,9 +57,6 @@ var partitionObject = function partitionObject(obj, predicate) {
58
57
  * Checks if a spec is a variant spec.
59
58
  * A variant spec is an array where the first element is a string (base spec name)
60
59
  * and the second element is a ValidatorSpec object { props: { ... } }
61
- *
62
- * @param spec - The spec to check
63
- * @returns true if the spec is a variant spec, false otherwise
64
60
  */
65
61
  var isVariant = function isVariant(spec) {
66
62
  return _typeof(spec) === 'object' && !!spec && 0 in spec && 1 in spec && typeof spec[0] === 'string' && _typeof(spec[1]) === 'object';
@@ -71,19 +67,16 @@ var isVariant = function isVariant(spec) {
71
67
  * We denormalised the spec to save bundle size.
72
68
  */
73
69
  export function createSpec(nodes, marks) {
70
+ var variantOverrides = getVariantSpecOverrides();
74
71
  // Ignored via go/ees005
75
72
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
73
  return Object.keys(specs).reduce(function (newSpecs, k) {
77
74
  // Ignored via go/ees005
78
75
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
79
76
  var spec = _objectSpread({}, specs[k]);
80
- if (expValEqualsNoExposure('platform_editor_flexible_list_schema', 'isEnabled', true) && isVariant(spec) &&
81
- // Only apply to variants which are explicitly marked for override in `variantSpecOverrides`
82
- Object.values(variantSpecOverrides).includes(k)) {
83
- // This allows the variant spec to also have the content normalization applied to it
77
+ if (isVariant(spec) && Object.values(variantOverrides).includes(k)) {
84
78
  // When the spec is a variant it will be in the form of ['base_spec_name', { props: { ... } }]
85
- // So the actual validator spec of the variant will be the second item in the array
86
- // We also need to shallow clone this to ensure we don't mutate the original spec
79
+ // The actual validator spec of the variant will be the second item in the array
87
80
  spec = _objectSpread({}, spec[1]);
88
81
  }
89
82
  if (spec.props) {
@@ -203,6 +196,10 @@ function getOptionsForType(type, list) {
203
196
  var isValidatorSpecAttrs = function isValidatorSpecAttrs(spec) {
204
197
  return !!spec.props;
205
198
  };
199
+
200
+ /**
201
+ * Validates attributes against the provided attribute specification.
202
+ */
206
203
  export function validateAttrs(spec, value) {
207
204
  if (!isDefined(value)) {
208
205
  return !!spec.optional;
@@ -341,21 +338,22 @@ var unsupportedNodeAttributesContent = function unsupportedNodeAttributesContent
341
338
  };
342
339
 
343
340
  /**
344
- * Map of base spec names to a preferred variant spec that should be used in their place during validation.
341
+ * Returns a map of base spec names to a preferred variant spec that should be used
342
+ * in their place during validation. Implemented as a getter function so that entries
343
+ * can be conditionally included behind feature gates.
345
344
  *
346
345
  * WARNING: The variant spec must be a strict superset of the base spec, i.e. any content valid
347
- * under the base spec must also be valid under the variant
346
+ * under the base spec must also be valid under the variant.
348
347
  */
349
- var variantSpecOverrides = {
350
- listItem: 'listItem_with_flexible_first_child',
351
- taskList: 'taskList_with_flexible_first_child'
348
+ var getVariantSpecOverrides = function getVariantSpecOverrides() {
349
+ return {};
352
350
  };
353
351
 
354
352
  /**
355
- * Replaces base validator specs with their designated variant overrides
353
+ * Replaces base validator specs with their designated variant overrides.
356
354
  */
357
355
  var applyVariantSpecOverrides = function applyVariantSpecOverrides(validatorSpecs) {
358
- Object.entries(variantSpecOverrides).forEach(function (_ref2) {
356
+ Object.entries(getVariantSpecOverrides()).forEach(function (_ref2) {
359
357
  var _ref3 = _slicedToArray(_ref2, 2),
360
358
  base = _ref3[0],
361
359
  variant = _ref3[1];
@@ -367,11 +365,14 @@ var applyVariantSpecOverrides = function applyVariantSpecOverrides(validatorSpec
367
365
  }
368
366
  });
369
367
  };
368
+
369
+ /**
370
+ * Creates a validator function for ADF documents.
371
+ * Validates document structure against the ADF specification.
372
+ */
370
373
  export function validator(nodes, marks, options) {
371
374
  var validatorSpecs = createSpec(nodes, marks);
372
- if (expValEqualsNoExposure('platform_editor_flexible_list_schema', 'isEnabled', true)) {
373
- applyVariantSpecOverrides(validatorSpecs);
374
- }
375
+ applyVariantSpecOverrides(validatorSpecs);
375
376
  var _ref4 = options || {},
376
377
  _ref4$mode = _ref4.mode,
377
378
  mode = _ref4$mode === void 0 ? 'strict' : _ref4$mode,
@@ -1 +1 @@
1
- export { alignment, annotation, backgroundColor, blockCard, block_content, blockRootOnly, blockquote, blockTaskItem, bodiedExtension, bodiedExtension_with_marks, border, breakout, bulletList, caption, code, codeBlock, codeBlock_root_only, text_with_no_marks, confluenceInlineComment, dataConsumer, date, decisionItem, decisionList, doc, em, embedCard, emoji, expand, expand_root_only, extension, extensionFrame, extension_with_marks, fontSize, fragment, hardBreak, heading, heading_with_alignment, heading_with_indentation, heading_with_no_marks, indentation, inlineCard, inlineExtension, inlineExtension_with_marks, inline_content, layoutColumn, layoutSection, layoutSection_full, layoutSection_with_single_column, link, listItem, listItem_with_flexible_first_child, media, mediaGroup, mediaInline, mediaSingle, mediaSingle_caption, mediaSingle_full, mention, multiBodiedExtension, nestedExpand, nestedExpand_content, nestedExpand_with_no_marks, non_nestable_block_content, orderedList, panel, paragraph, paragraph_with_alignment, paragraph_with_font_size, paragraph_with_font_size_and_alignment, paragraph_with_font_size_and_indentation, paragraph_with_indentation, paragraph_with_no_marks, placeholder, rule, status, strike, strong, subsup, table, tableCell, tableHeader, tableRow, taskItem, taskList, taskList_with_flexible_first_child, text, textColor, text_code_inline, text_formatted, text_link_inline, underline, syncBlock, bodiedSyncBlock, } from '@atlaskit/adf-schema/schema-validator';
1
+ export { alignment, annotation, backgroundColor, blockCard, block_content, blockRootOnly, blockquote, blockTaskItem, bodiedExtension, bodiedExtension_with_marks, border, breakout, bulletList, caption, code, codeBlock, codeBlock_root_only, text_with_no_marks, confluenceInlineComment, dataConsumer, date, decisionItem, decisionList, doc, em, embedCard, emoji, expand, expand_root_only, extension, extensionFrame, extension_with_marks, fontSize, fragment, hardBreak, heading, heading_with_alignment, heading_with_indentation, heading_with_no_marks, indentation, inlineCard, inlineExtension, inlineExtension_with_marks, inline_content, layoutColumn, layoutSection, layoutSection_full, layoutSection_with_single_column, link, listItem, media, mediaGroup, mediaInline, mediaSingle, mediaSingle_caption, mediaSingle_full, mention, multiBodiedExtension, nestedExpand, nestedExpand_content, nestedExpand_with_no_marks, non_nestable_block_content, orderedList, panel, paragraph, paragraph_with_alignment, paragraph_with_font_size, paragraph_with_font_size_and_alignment, paragraph_with_font_size_and_indentation, paragraph_with_indentation, paragraph_with_no_marks, placeholder, rule, status, strike, strong, subsup, table, tableCell, tableHeader, tableRow, taskItem, taskList, text, textColor, text_code_inline, text_formatted, text_link_inline, underline, syncBlock, bodiedSyncBlock, } from '@atlaskit/adf-schema/schema-validator';
@@ -4,5 +4,12 @@ import type { AttributesSpec, CreateSpecReturn, Validate, ValidationOptions } fr
4
4
  * We denormalised the spec to save bundle size.
5
5
  */
6
6
  export declare function createSpec(nodes?: Array<string>, marks?: Array<string>): CreateSpecReturn;
7
+ /**
8
+ * Validates attributes against the provided attribute specification.
9
+ */
7
10
  export declare function validateAttrs<T>(spec: AttributesSpec, value: T): boolean;
11
+ /**
12
+ * Creates a validator function for ADF documents.
13
+ * Validates document structure against the ADF specification.
14
+ */
8
15
  export declare function validator(nodes?: Array<string>, marks?: Array<string>, options?: ValidationOptions): Validate;
@@ -1 +1 @@
1
- export { alignment, annotation, backgroundColor, blockCard, block_content, blockRootOnly, blockquote, blockTaskItem, bodiedExtension, bodiedExtension_with_marks, border, breakout, bulletList, caption, code, codeBlock, codeBlock_root_only, text_with_no_marks, confluenceInlineComment, dataConsumer, date, decisionItem, decisionList, doc, em, embedCard, emoji, expand, expand_root_only, extension, extensionFrame, extension_with_marks, fontSize, fragment, hardBreak, heading, heading_with_alignment, heading_with_indentation, heading_with_no_marks, indentation, inlineCard, inlineExtension, inlineExtension_with_marks, inline_content, layoutColumn, layoutSection, layoutSection_full, layoutSection_with_single_column, link, listItem, listItem_with_flexible_first_child, media, mediaGroup, mediaInline, mediaSingle, mediaSingle_caption, mediaSingle_full, mention, multiBodiedExtension, nestedExpand, nestedExpand_content, nestedExpand_with_no_marks, non_nestable_block_content, orderedList, panel, paragraph, paragraph_with_alignment, paragraph_with_font_size, paragraph_with_font_size_and_alignment, paragraph_with_font_size_and_indentation, paragraph_with_indentation, paragraph_with_no_marks, placeholder, rule, status, strike, strong, subsup, table, tableCell, tableHeader, tableRow, taskItem, taskList, taskList_with_flexible_first_child, text, textColor, text_code_inline, text_formatted, text_link_inline, underline, syncBlock, bodiedSyncBlock, } from '@atlaskit/adf-schema/schema-validator';
1
+ export { alignment, annotation, backgroundColor, blockCard, block_content, blockRootOnly, blockquote, blockTaskItem, bodiedExtension, bodiedExtension_with_marks, border, breakout, bulletList, caption, code, codeBlock, codeBlock_root_only, text_with_no_marks, confluenceInlineComment, dataConsumer, date, decisionItem, decisionList, doc, em, embedCard, emoji, expand, expand_root_only, extension, extensionFrame, extension_with_marks, fontSize, fragment, hardBreak, heading, heading_with_alignment, heading_with_indentation, heading_with_no_marks, indentation, inlineCard, inlineExtension, inlineExtension_with_marks, inline_content, layoutColumn, layoutSection, layoutSection_full, layoutSection_with_single_column, link, listItem, media, mediaGroup, mediaInline, mediaSingle, mediaSingle_caption, mediaSingle_full, mention, multiBodiedExtension, nestedExpand, nestedExpand_content, nestedExpand_with_no_marks, non_nestable_block_content, orderedList, panel, paragraph, paragraph_with_alignment, paragraph_with_font_size, paragraph_with_font_size_and_alignment, paragraph_with_font_size_and_indentation, paragraph_with_indentation, paragraph_with_no_marks, placeholder, rule, status, strike, strong, subsup, table, tableCell, tableHeader, tableRow, taskItem, taskList, text, textColor, text_code_inline, text_formatted, text_link_inline, underline, syncBlock, bodiedSyncBlock, } from '@atlaskit/adf-schema/schema-validator';
@@ -4,5 +4,12 @@ import type { AttributesSpec, CreateSpecReturn, Validate, ValidationOptions } fr
4
4
  * We denormalised the spec to save bundle size.
5
5
  */
6
6
  export declare function createSpec(nodes?: Array<string>, marks?: Array<string>): CreateSpecReturn;
7
+ /**
8
+ * Validates attributes against the provided attribute specification.
9
+ */
7
10
  export declare function validateAttrs<T>(spec: AttributesSpec, value: T): boolean;
11
+ /**
12
+ * Creates a validator function for ADF documents.
13
+ * Validates document structure against the ADF specification.
14
+ */
8
15
  export declare function validator(nodes?: Array<string>, marks?: Array<string>, options?: ValidationOptions): Validate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-utils",
3
- "version": "19.27.46",
3
+ "version": "19.28.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,9 +26,8 @@
26
26
  "team": "Editor: Collaboration"
27
27
  },
28
28
  "dependencies": {
29
- "@atlaskit/adf-schema": "^52.6.0",
29
+ "@atlaskit/adf-schema": "^52.7.0",
30
30
  "@atlaskit/platform-feature-flags": "^1.1.0",
31
- "@atlaskit/tmp-editor-statsig": "^72.0.0",
32
31
  "@babel/runtime": "^7.0.0"
33
32
  },
34
33
  "devDependencies": {