@atlaskit/adf-schema 36.16.0 → 36.17.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 (76) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/next-schema/full-schema.adf.js +1 -5
  3. package/dist/cjs/next-schema/generated/markTypes.js +19 -19
  4. package/dist/cjs/next-schema/generated/nodeTypes.js +422 -316
  5. package/dist/cjs/next-schema/groups/blockGroup.js +1 -5
  6. package/dist/cjs/next-schema/groups/blockRootOnlyGroup.js +2 -1
  7. package/dist/cjs/next-schema/groups/inlineGroup.js +3 -1
  8. package/dist/cjs/next-schema/nodes/codeBlock.js +5 -0
  9. package/dist/cjs/next-schema/nodes/confluenceJiraIssue.js +38 -0
  10. package/dist/cjs/next-schema/nodes/decisionItem.js +1 -2
  11. package/dist/cjs/next-schema/nodes/extensionFrame.js +3 -1
  12. package/dist/cjs/next-schema/nodes/heading.js +1 -2
  13. package/dist/cjs/next-schema/nodes/image.js +28 -0
  14. package/dist/cjs/next-schema/nodes/mediaGroup.js +2 -0
  15. package/dist/cjs/next-schema/nodes/mediaInline.js +0 -4
  16. package/dist/cjs/next-schema/nodes/mediaSingle.js +1 -1
  17. package/dist/cjs/next-schema/nodes/paragraph.js +1 -2
  18. package/dist/cjs/next-schema/nodes/status.js +1 -0
  19. package/dist/cjs/next-schema/nodes/table.js +1 -1
  20. package/dist/cjs/next-schema/nodes/task.js +1 -2
  21. package/dist/cjs/schema/create-schema.js +21 -0
  22. package/dist/cjs/schema/nodes/multi-bodied-extension.js +0 -2
  23. package/dist/cjs/schema/nodes/paragraph.js +2 -2
  24. package/dist/es2019/next-schema/full-schema.adf.js +1 -5
  25. package/dist/es2019/next-schema/generated/markTypes.js +19 -19
  26. package/dist/es2019/next-schema/generated/nodeTypes.js +421 -315
  27. package/dist/es2019/next-schema/groups/blockGroup.js +1 -5
  28. package/dist/es2019/next-schema/groups/blockRootOnlyGroup.js +2 -1
  29. package/dist/es2019/next-schema/groups/inlineGroup.js +3 -1
  30. package/dist/es2019/next-schema/nodes/codeBlock.js +5 -0
  31. package/dist/es2019/next-schema/nodes/confluenceJiraIssue.js +32 -0
  32. package/dist/es2019/next-schema/nodes/decisionItem.js +1 -2
  33. package/dist/es2019/next-schema/nodes/extensionFrame.js +3 -1
  34. package/dist/es2019/next-schema/nodes/heading.js +1 -2
  35. package/dist/es2019/next-schema/nodes/image.js +22 -0
  36. package/dist/es2019/next-schema/nodes/mediaGroup.js +2 -0
  37. package/dist/es2019/next-schema/nodes/mediaInline.js +0 -4
  38. package/dist/es2019/next-schema/nodes/mediaSingle.js +1 -1
  39. package/dist/es2019/next-schema/nodes/paragraph.js +1 -2
  40. package/dist/es2019/next-schema/nodes/status.js +1 -0
  41. package/dist/es2019/next-schema/nodes/table.js +1 -1
  42. package/dist/es2019/next-schema/nodes/task.js +1 -2
  43. package/dist/es2019/schema/create-schema.js +22 -0
  44. package/dist/es2019/schema/nodes/multi-bodied-extension.js +0 -2
  45. package/dist/es2019/schema/nodes/paragraph.js +2 -2
  46. package/dist/esm/next-schema/full-schema.adf.js +1 -5
  47. package/dist/esm/next-schema/generated/markTypes.js +19 -19
  48. package/dist/esm/next-schema/generated/nodeTypes.js +421 -315
  49. package/dist/esm/next-schema/groups/blockGroup.js +1 -5
  50. package/dist/esm/next-schema/groups/blockRootOnlyGroup.js +2 -1
  51. package/dist/esm/next-schema/groups/inlineGroup.js +3 -1
  52. package/dist/esm/next-schema/nodes/codeBlock.js +5 -0
  53. package/dist/esm/next-schema/nodes/confluenceJiraIssue.js +32 -0
  54. package/dist/esm/next-schema/nodes/decisionItem.js +1 -2
  55. package/dist/esm/next-schema/nodes/extensionFrame.js +3 -1
  56. package/dist/esm/next-schema/nodes/heading.js +1 -2
  57. package/dist/esm/next-schema/nodes/image.js +22 -0
  58. package/dist/esm/next-schema/nodes/mediaGroup.js +2 -0
  59. package/dist/esm/next-schema/nodes/mediaInline.js +0 -4
  60. package/dist/esm/next-schema/nodes/mediaSingle.js +1 -1
  61. package/dist/esm/next-schema/nodes/paragraph.js +1 -2
  62. package/dist/esm/next-schema/nodes/status.js +1 -0
  63. package/dist/esm/next-schema/nodes/table.js +1 -1
  64. package/dist/esm/next-schema/nodes/task.js +1 -2
  65. package/dist/esm/schema/create-schema.js +20 -0
  66. package/dist/esm/schema/nodes/multi-bodied-extension.js +0 -2
  67. package/dist/esm/schema/nodes/paragraph.js +2 -2
  68. package/dist/types/next-schema/generated/markTypes.d.ts +24 -24
  69. package/dist/types/next-schema/generated/nodeGroupTypes.d.ts +6 -4
  70. package/dist/types/next-schema/generated/nodeTypes.d.ts +336 -280
  71. package/dist/types/next-schema/nodes/confluenceJiraIssue.d.ts +22 -0
  72. package/dist/types/next-schema/nodes/image.d.ts +22 -0
  73. package/dist/types/schema/create-schema.d.ts +4 -0
  74. package/package.json +2 -2
  75. package/schema-generators/__tests__/unit/json-full-schema.unit.ts +297 -20
  76. package/schema-generators/__tests__/unit/validate-pm-schema.unit.ts +21 -30
@@ -18,8 +18,4 @@ import { rule } from '../nodes/rule';
18
18
  import { table } from '../nodes/table';
19
19
  import { taskList } from '../nodes/task';
20
20
  import { unsupportedBlock } from '../nodes/unsupportedBlock';
21
- export const blockGroup = adfNodeGroup('block', [blockCard, codeBlock.use('with_no_marks'), mediaSingle, mediaSingle.use('caption'), mediaSingle.use('full'), paragraph, paragraph.use('with_alignment'), paragraph.use('with_indentation'), taskList, orderedList, bulletList, blockquote.use('with_list'), decisionList, embedCard,
22
- // extension,
23
- extension.use('with_marks'), heading, heading.use('with_no_marks'), mediaGroup, rule, panel, table,
24
- // bodiedExtension,
25
- bodiedExtension.use('with_marks'), expand.use('with_no_mark'), confluenceUnsupportedBlock, unsupportedBlock]);
21
+ export const blockGroup = adfNodeGroup('block', [panel, paragraph, paragraph.use('with_marks'), blockquote.use('with_list'), orderedList, bulletList, rule, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), codeBlock.use('with_no_marks'), mediaGroup, mediaSingle.use('caption'), mediaSingle.use('full'), decisionList, taskList, table, expand.use('with_no_mark'), extension.use('with_marks'), bodiedExtension.use('with_marks'), blockCard, embedCard, confluenceUnsupportedBlock, unsupportedBlock]);
@@ -1,2 +1,3 @@
1
1
  import { adfNodeGroup } from '@atlaskit/adf-schema-generator';
2
- export const blockRootOnlyGroup = adfNodeGroup('blockRootOnly');
2
+ import { multiBodiedExtension } from '../nodes/multiBodiedExtension';
3
+ export const blockRootOnlyGroup = adfNodeGroup('blockRootOnly', [multiBodiedExtension]);
@@ -11,4 +11,6 @@ import { inlineExtension } from '../nodes/inlineExtension';
11
11
  import { mediaInline } from '../nodes/mediaInline';
12
12
  import { unsupportedInline } from '../nodes/unsupportedInline';
13
13
  import { confluenceUnsupportedInline } from '../nodes/confluenceUnsupportedInline';
14
- export const inlineGroup = adfNodeGroup('inline', [text, text.use('formatted'), text.use('code_inline'), date, emoji, hardBreak, inlineCard, mention, placeholder, status, inlineExtension.use('with_marks'), mediaInline, confluenceUnsupportedInline, unsupportedInline]);
14
+ import { image } from '../nodes/image';
15
+ import { confluenceJiraIssue } from '../nodes/confluenceJiraIssue';
16
+ export const inlineGroup = adfNodeGroup('inline', [text, text.use('formatted'), text.use('code_inline'), date, emoji, hardBreak, inlineCard, mention, placeholder, status, inlineExtension.use('with_marks'), mediaInline, image, confluenceJiraIssue, confluenceUnsupportedInline, unsupportedInline]);
@@ -13,6 +13,11 @@ export const codeBlock = adfNode('codeBlock').define({
13
13
  type: 'string',
14
14
  default: null,
15
15
  optional: true
16
+ },
17
+ uniqueId: {
18
+ type: 'string',
19
+ default: null,
20
+ optional: true
16
21
  }
17
22
  },
18
23
  content: [$zeroPlus($or(text, unsupportedInline))]
@@ -0,0 +1,32 @@
1
+ import { adfNode, JSONSchemaTransformerName, ValidatorSpecTransformerName } from '@atlaskit/adf-schema-generator';
2
+ export const confluenceJiraIssue = adfNode('confluenceJiraIssue').define({
3
+ ignore: [JSONSchemaTransformerName, ValidatorSpecTransformerName],
4
+ atom: true,
5
+ inline: true,
6
+ attrs: {
7
+ issueKey: {
8
+ type: 'string',
9
+ default: ''
10
+ },
11
+ macroId: {
12
+ type: 'string',
13
+ default: null,
14
+ optional: true
15
+ },
16
+ schemaVersion: {
17
+ type: 'string',
18
+ default: null,
19
+ optional: true
20
+ },
21
+ server: {
22
+ type: 'string',
23
+ default: null,
24
+ optional: true
25
+ },
26
+ serverId: {
27
+ type: 'string',
28
+ default: null,
29
+ optional: true
30
+ }
31
+ }
32
+ });
@@ -2,7 +2,6 @@ import { $or, $zeroPlus, adfNode } from '@atlaskit/adf-schema-generator';
2
2
  import { inlineGroup } from '../groups/inlineGroup';
3
3
  import { unsupportedMark } from '../marks/unsupportedMark';
4
4
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
5
- import { unsupportedBlock } from './unsupportedBlock';
6
5
  export const decisionItem = adfNode('decisionItem').define({
7
6
  defining: true,
8
7
  marks: [unsupportedNodeAttribute, unsupportedMark],
@@ -17,5 +16,5 @@ export const decisionItem = adfNode('decisionItem').define({
17
16
  default: 'DECIDED'
18
17
  }
19
18
  },
20
- content: [$zeroPlus($or(inlineGroup, unsupportedBlock))]
19
+ content: [$zeroPlus($or(inlineGroup))]
21
20
  });
@@ -19,11 +19,13 @@ import { paragraph } from './paragraph';
19
19
  import { rule } from './rule';
20
20
  import { table } from './table';
21
21
  import { taskList } from './task';
22
+ import { unsupportedBlock } from './unsupportedBlock';
22
23
  export const extensionFrame = adfNode('extensionFrame').define({
23
24
  isolating: true,
24
25
  definingAsContext: false,
25
26
  definingForContent: true,
26
27
  selectable: false,
27
28
  marks: [dataConsumer, fragment, unsupportedNodeAttribute, unsupportedMark],
28
- content: [$onePlus($or(bodiedExtension, panel, paragraph, blockquote, orderedList, bulletList, rule, heading, codeBlock, mediaGroup, mediaSingle, decisionList, taskList, table, extension, blockCard, embedCard))]
29
+ attrs: {},
30
+ content: [$onePlus($or(bodiedExtension, panel, paragraph, blockquote, orderedList, bulletList, rule, heading, codeBlock, mediaGroup, mediaSingle, decisionList, taskList, table, extension, blockCard, embedCard, unsupportedBlock))]
29
31
  });
@@ -3,7 +3,6 @@ import { inlineGroup } from '../groups/inlineGroup';
3
3
  import { alignment, indentation } from '../marks/alignmentAndIndentation';
4
4
  import { unsupportedMark } from '../marks/unsupportedMark';
5
5
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
6
- import { unsupportedInline } from './unsupportedInline';
7
6
  export const heading = adfNode('heading').define({
8
7
  defining: true,
9
8
  selectable: false,
@@ -16,7 +15,7 @@ export const heading = adfNode('heading').define({
16
15
  maximum: 6
17
16
  }
18
17
  },
19
- content: [$zeroPlus($or(inlineGroup, unsupportedInline))]
18
+ content: [$zeroPlus($or(inlineGroup))]
20
19
  }).variant('with_alignment', {
21
20
  marks: [alignment, unsupportedNodeAttribute, unsupportedMark]
22
21
  }).variant('with_indentation', {
@@ -0,0 +1,22 @@
1
+ import { adfNode, JSONSchemaTransformerName, ValidatorSpecTransformerName } from '@atlaskit/adf-schema-generator';
2
+ export const image = adfNode('image').define({
3
+ ignore: [JSONSchemaTransformerName, ValidatorSpecTransformerName],
4
+ inline: true,
5
+ draggable: true,
6
+ attrs: {
7
+ src: {
8
+ type: 'string',
9
+ default: ''
10
+ },
11
+ alt: {
12
+ type: 'string',
13
+ default: '',
14
+ optional: true
15
+ },
16
+ title: {
17
+ type: 'string',
18
+ default: null,
19
+ optional: true
20
+ }
21
+ }
22
+ });
@@ -6,5 +6,7 @@ import { unsupportedBlock } from './unsupportedBlock';
6
6
  export const mediaGroup = adfNode('mediaGroup').define({
7
7
  selectable: false,
8
8
  marks: [unsupportedNodeAttribute, unsupportedMark],
9
+ // Need to be empty object to match old PM Spec
10
+ attrs: {},
9
11
  content: [$onePlus($or(media, unsupportedBlock))]
10
12
  });
@@ -10,10 +10,6 @@ export const mediaInline = adfNode('mediaInline').define({
10
10
  inline: true,
11
11
  marks: [link, annotation, border, unsupportedNodeAttribute, unsupportedMark],
12
12
  attrs: {
13
- data: {
14
- type: 'object',
15
- optional: true
16
- },
17
13
  type: {
18
14
  type: 'enum',
19
15
  values: ['link', 'file', 'image'],
@@ -38,7 +38,7 @@ export const mediaSingle = adfNode('mediaSingle').define({
38
38
  widthType: {
39
39
  type: 'enum',
40
40
  values: ['pixel'],
41
- default: 'pixel'
41
+ default: null
42
42
  },
43
43
  layout: {
44
44
  type: 'enum',
@@ -3,11 +3,10 @@ import { inlineGroup } from '../groups/inlineGroup';
3
3
  import { alignment, indentation } from '../marks/alignmentAndIndentation';
4
4
  import { unsupportedMark } from '../marks/unsupportedMark';
5
5
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
6
- import { unsupportedInline } from './unsupportedInline';
7
6
  export const paragraph = adfNode('paragraph').define({
8
7
  selectable: false,
9
8
  marks: [unsupportedNodeAttribute, unsupportedMark],
10
- content: [$zeroPlus($or(inlineGroup, unsupportedInline))]
9
+ content: [$zeroPlus($or(inlineGroup))]
11
10
  }).variant('with_alignment', {
12
11
  marks: [alignment, unsupportedNodeAttribute, unsupportedMark]
13
12
  }).variant('with_indentation', {
@@ -2,6 +2,7 @@ import { adfNode } from '@atlaskit/adf-schema-generator';
2
2
  import { unsupportedMark } from '../marks/unsupportedMark';
3
3
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
4
4
  export const status = adfNode('status').define({
5
+ inline: true,
5
6
  selectable: true,
6
7
  marks: [unsupportedNodeAttribute, unsupportedMark],
7
8
  attrs: {
@@ -12,7 +12,7 @@ export const table = adfNode('table').define({
12
12
  displayMode: {
13
13
  type: 'enum',
14
14
  values: ['default', 'fixed'],
15
- default: 'default',
15
+ default: null,
16
16
  optional: true
17
17
  },
18
18
  isNumberColumnEnabled: {
@@ -2,7 +2,6 @@ import { $onePlus, $or, $zeroPlus, adfNode } from '@atlaskit/adf-schema-generato
2
2
  import { inlineGroup } from '../groups/inlineGroup';
3
3
  import { unsupportedMark } from '../marks/unsupportedMark';
4
4
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
5
- import { unsupportedInline } from './unsupportedInline';
6
5
  import { unsupportedBlock } from './unsupportedBlock';
7
6
  export const taskItem = adfNode('taskItem');
8
7
  export const taskList = adfNode('taskList');
@@ -22,7 +21,7 @@ taskItem.define({
22
21
  default: 'TODO'
23
22
  }
24
23
  },
25
- content: [$zeroPlus($or(inlineGroup, unsupportedInline))]
24
+ content: [$zeroPlus($or(inlineGroup))]
26
25
  });
27
26
  taskList.define({
28
27
  defining: true,
@@ -258,6 +258,28 @@ const marksInOrder = [{
258
258
  name: 'unsupportedNodeAttribute',
259
259
  spec: unsupportedNodeAttribute
260
260
  }];
261
+ export function getNodesAndMarksMap() {
262
+ const nodes = nodesInOrder.reduce((acc, {
263
+ name,
264
+ spec
265
+ }) => {
266
+ // @ts-expect-error - Type for SchemaBuiltInItem is not correct
267
+ acc[name] = spec;
268
+ return acc;
269
+ }, {});
270
+ const marks = marksInOrder.reduce((acc, {
271
+ name,
272
+ spec
273
+ }) => {
274
+ // @ts-expect-error - Type for SchemaBuiltInItem is not correct
275
+ acc[name] = spec;
276
+ return acc;
277
+ }, {});
278
+ return {
279
+ nodes,
280
+ marks
281
+ };
282
+ }
261
283
 
262
284
  /**
263
285
  * Creates a schema preserving order of marks and nodes.
@@ -10,7 +10,6 @@ import { getExtensionAttrs } from '../../utils/extensions';
10
10
  * @returns NodeSpec for ExtensionFrameDefinition
11
11
  */
12
12
  export const extensionFrame = {
13
- type: 'extensionFrame',
14
13
  content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaGroup | mediaSingle | decisionList | taskList | table | extension | bodiedExtension | unsupportedBlock | blockCard | embedCard)+',
15
14
  isolating: true,
16
15
  marks: 'dataConsumer fragment',
@@ -47,7 +46,6 @@ const createMultiBodiedExtensionNodeSpec = () => {
47
46
  inline: false,
48
47
  group: 'blockRootOnly',
49
48
  content: 'extensionFrame+',
50
- block: true,
51
49
  definingAsContext: true,
52
50
  selectable: true,
53
51
  attrs: {
@@ -32,7 +32,7 @@ export const paragraphStage0 = {
32
32
  default: null
33
33
  }
34
34
  },
35
- marks: 'strong code em link border strike subsup textColor backgroundColor typeAheadQuery underline confluenceInlineComment action annotation unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
35
+ marks: 'strong code em link border strike subsup textColor backgroundColor typeAheadQuery underline confluenceInlineComment annotation unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
36
36
  parseDOM: [{
37
37
  tag: 'p',
38
38
  getAttrs: domNode => {
@@ -59,7 +59,7 @@ export const paragraph = {
59
59
  selectable: false,
60
60
  content: 'inline*',
61
61
  group: 'block',
62
- marks: 'strong code em link border strike subsup textColor backgroundColor typeAheadQuery underline confluenceInlineComment action annotation unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
62
+ marks: 'strong code em link border strike subsup textColor backgroundColor typeAheadQuery underline confluenceInlineComment annotation unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
63
63
  parseDOM: [{
64
64
  tag: 'p'
65
65
  }],
@@ -2,13 +2,9 @@ import { $or, $onePlus, adfNode } from '@atlaskit/adf-schema-generator';
2
2
  import { blockGroup } from './groups/blockGroup';
3
3
  import { layoutSection } from './nodes/layoutSection';
4
4
  import { blockRootOnlyGroup } from './groups/blockRootOnlyGroup';
5
- import { paragraph } from './nodes/paragraph';
6
- import { expand } from './nodes/expand';
7
- import { codeBlock } from './nodes/codeBlock';
8
- import { unsupportedBlock } from './nodes/unsupportedBlock';
9
5
  var doc = adfNode('doc').define({
10
6
  root: true,
11
7
  version: 1,
12
- content: [$onePlus($or(blockGroup, layoutSection, layoutSection.use('full'), blockRootOnlyGroup, expand.use('with_breakout_mark'), codeBlock.use('with_no_marks'), codeBlock.use('with_marks'), paragraph.use('with_indentation'), unsupportedBlock))]
8
+ content: [$onePlus($or(blockGroup, layoutSection, blockRootOnlyGroup))]
13
9
  });
14
10
  export default doc;
@@ -31,25 +31,6 @@ export var link = createPMMarkSpecFactory({
31
31
  excludes: 'link',
32
32
  group: 'link'
33
33
  });
34
- export var annotation = createPMMarkSpecFactory({
35
- attrs: {
36
- id: {
37
- default: ''
38
- },
39
- annotationType: {
40
- default: 'inlineComment'
41
- }
42
- },
43
- inclusive: true,
44
- group: 'annotation'
45
- });
46
- export var border = createPMMarkSpecFactory({
47
- attrs: {
48
- size: {},
49
- color: {}
50
- },
51
- inclusive: false
52
- });
53
34
  export var em = createPMMarkSpecFactory({
54
35
  inclusive: true,
55
36
  group: 'fontStyle'
@@ -82,6 +63,18 @@ export var textColor = createPMMarkSpecFactory({
82
63
  inclusive: true,
83
64
  group: 'color'
84
65
  });
66
+ export var annotation = createPMMarkSpecFactory({
67
+ attrs: {
68
+ id: {
69
+ default: ''
70
+ },
71
+ annotationType: {
72
+ default: 'inlineComment'
73
+ }
74
+ },
75
+ inclusive: true,
76
+ group: 'annotation'
77
+ });
85
78
  export var backgroundColor = createPMMarkSpecFactory({
86
79
  attrs: {
87
80
  color: {}
@@ -112,6 +105,13 @@ export var fragment = createPMMarkSpecFactory({
112
105
  },
113
106
  inclusive: false
114
107
  });
108
+ export var border = createPMMarkSpecFactory({
109
+ attrs: {
110
+ size: {},
111
+ color: {}
112
+ },
113
+ inclusive: false
114
+ });
115
115
  export var alignment = createPMMarkSpecFactory({
116
116
  attrs: {
117
117
  align: {}