@atlaskit/adf-schema 36.10.8 → 36.10.10
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 +12 -0
- package/dist/cjs/next-schema/full-schema.adf.js +1 -1
- package/dist/cjs/next-schema/marks/alignmentAndIndentation.js +5 -6
- package/dist/cjs/next-schema/marks/annotation.js +5 -2
- package/dist/cjs/next-schema/marks/breakout.js +1 -1
- package/dist/cjs/next-schema/marks/code.js +2 -2
- package/dist/cjs/next-schema/marks/color.js +29 -0
- package/dist/cjs/next-schema/marks/dataConsumer.js +3 -1
- package/dist/cjs/next-schema/nodes/blockCard.js +1 -0
- package/dist/cjs/next-schema/nodes/tableRow.js +1 -1
- package/dist/cjs/next-schema/nodes/text.js +2 -3
- package/dist/es2019/next-schema/full-schema.adf.js +2 -2
- package/dist/es2019/next-schema/marks/alignmentAndIndentation.js +5 -6
- package/dist/es2019/next-schema/marks/annotation.js +5 -2
- package/dist/es2019/next-schema/marks/breakout.js +1 -1
- package/dist/es2019/next-schema/marks/code.js +1 -1
- package/dist/es2019/next-schema/marks/color.js +24 -0
- package/dist/es2019/next-schema/marks/dataConsumer.js +3 -1
- package/dist/es2019/next-schema/nodes/blockCard.js +1 -0
- package/dist/es2019/next-schema/nodes/tableRow.js +2 -2
- package/dist/es2019/next-schema/nodes/text.js +1 -2
- package/dist/esm/next-schema/full-schema.adf.js +2 -2
- package/dist/esm/next-schema/marks/alignmentAndIndentation.js +5 -6
- package/dist/esm/next-schema/marks/annotation.js +5 -2
- package/dist/esm/next-schema/marks/breakout.js +1 -1
- package/dist/esm/next-schema/marks/code.js +1 -1
- package/dist/esm/next-schema/marks/color.js +24 -0
- package/dist/esm/next-schema/marks/dataConsumer.js +3 -1
- package/dist/esm/next-schema/nodes/blockCard.js +1 -0
- package/dist/esm/next-schema/nodes/tableRow.js +2 -2
- package/dist/esm/next-schema/nodes/text.js +1 -2
- package/dist/types/next-schema/marks/annotation.d.ts +1 -0
- package/dist/types/next-schema/marks/color.d.ts +3 -0
- package/package.json +3 -3
- package/schema-generators/__tests__/unit/jqueries.md +13 -0
- package/schema-generators/__tests__/unit/json-full-schema.unit.ts +18 -0
- package/schema-generators/__tests__/unit/validate-pm-schema.unit.ts +110 -0
- package/dist/cjs/next-schema/groups/annotationGroup.js +0 -8
- package/dist/cjs/next-schema/groups/colorGroup.js +0 -9
- package/dist/cjs/next-schema/marks/backgroundColor.js +0 -15
- package/dist/cjs/next-schema/marks/textColor.js +0 -16
- package/dist/es2019/next-schema/groups/annotationGroup.js +0 -2
- package/dist/es2019/next-schema/groups/colorGroup.js +0 -3
- package/dist/es2019/next-schema/marks/backgroundColor.js +0 -9
- package/dist/es2019/next-schema/marks/textColor.js +0 -10
- package/dist/esm/next-schema/groups/annotationGroup.js +0 -2
- package/dist/esm/next-schema/groups/colorGroup.js +0 -3
- package/dist/esm/next-schema/marks/backgroundColor.js +0 -9
- package/dist/esm/next-schema/marks/textColor.js +0 -10
- package/dist/types/next-schema/groups/annotationGroup.d.ts +0 -1
- package/dist/types/next-schema/groups/colorGroup.d.ts +0 -1
- package/dist/types/next-schema/marks/backgroundColor.d.ts +0 -1
- package/dist/types/next-schema/marks/textColor.d.ts +0 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# @atlaskit/adf-schema
|
2
2
|
|
3
|
+
## 36.10.10
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- b29eee7: update ADF DSL to match old PM spec, add validation unit test to verify nodeSpec and markSpec generated from ADF DSL
|
8
|
+
|
9
|
+
## 36.10.9
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- 7579d7a: Add minItems field to ADF JSON Schema transformer from ADF DSL
|
14
|
+
|
3
15
|
## 36.10.8
|
4
16
|
|
5
17
|
### Patch Changes
|
@@ -10,6 +10,6 @@ var _layoutSection = require("./nodes/layoutSection");
|
|
10
10
|
var _blockRootOnlyGroup = require("./groups/blockRootOnlyGroup");
|
11
11
|
var doc = (0, _adfSchemaGenerator.adfNode)('doc').define({
|
12
12
|
root: true,
|
13
|
-
content: [(0, _adfSchemaGenerator.$
|
13
|
+
content: [(0, _adfSchemaGenerator.$zeroPlus)((0, _adfSchemaGenerator.$or)(_blockGroup.blockGroup, _layoutSection.layoutSection, _layoutSection.layoutSection.use('full'), _blockRootOnlyGroup.blockRootOnlyGroup))]
|
14
14
|
});
|
15
15
|
var _default = exports.default = doc;
|
@@ -8,20 +8,19 @@ var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
|
|
8
8
|
// These marks defined together because they form a cycle within the excludes.
|
9
9
|
var alignment = exports.alignment = (0, _adfSchemaGenerator.adfMark)('alignment');
|
10
10
|
var indentation = exports.indentation = (0, _adfSchemaGenerator.adfMark)('indentation');
|
11
|
-
var alignementMarkExclusionGroup = (0, _adfSchemaGenerator.adfMarkGroup)('
|
12
|
-
var indentationMarkExclusionGroup = (0, _adfSchemaGenerator.adfMarkGroup)('
|
11
|
+
var alignementMarkExclusionGroup = (0, _adfSchemaGenerator.adfMarkGroup)('alignment', [alignment]);
|
12
|
+
var indentationMarkExclusionGroup = (0, _adfSchemaGenerator.adfMarkGroup)('indentation', [indentation]);
|
13
13
|
alignment.define({
|
14
|
-
excludes: [indentationMarkExclusionGroup],
|
14
|
+
excludes: [alignementMarkExclusionGroup, indentationMarkExclusionGroup],
|
15
15
|
attrs: {
|
16
16
|
align: {
|
17
17
|
type: 'enum',
|
18
|
-
values: ['center', 'end']
|
19
|
-
default: 'center'
|
18
|
+
values: ['center', 'end']
|
20
19
|
}
|
21
20
|
}
|
22
21
|
});
|
23
22
|
indentation.define({
|
24
|
-
excludes: [alignementMarkExclusionGroup],
|
23
|
+
excludes: [indentationMarkExclusionGroup, alignementMarkExclusionGroup],
|
25
24
|
attrs: {
|
26
25
|
level: {
|
27
26
|
type: 'number',
|
@@ -3,10 +3,13 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.annotation = void 0;
|
6
|
+
exports.annotationGroup = exports.annotation = void 0;
|
7
7
|
var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
|
8
|
-
var annotation = exports.annotation = (0, _adfSchemaGenerator.adfMark)('annotation')
|
8
|
+
var annotation = exports.annotation = (0, _adfSchemaGenerator.adfMark)('annotation');
|
9
|
+
var annotationGroup = exports.annotationGroup = (0, _adfSchemaGenerator.adfMarkGroup)('annotation', [annotation]);
|
10
|
+
annotation.define({
|
9
11
|
inclusive: true,
|
12
|
+
group: annotationGroup,
|
10
13
|
attrs: {
|
11
14
|
id: {
|
12
15
|
type: 'string',
|
@@ -7,7 +7,7 @@ exports.breakout = void 0;
|
|
7
7
|
var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
|
8
8
|
var breakout = exports.breakout = (0, _adfSchemaGenerator.adfMark)('breakout').define({
|
9
9
|
spanning: false,
|
10
|
-
inclusive:
|
10
|
+
inclusive: false,
|
11
11
|
attrs: {
|
12
12
|
mode: {
|
13
13
|
type: 'enum',
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.code = void 0;
|
7
7
|
var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
|
8
|
-
var _colorGroup = require("../groups/colorGroup");
|
9
8
|
var _fontStyleGroup = require("../groups/fontStyleGroup");
|
10
9
|
var _linkMarkGroup = require("../groups/linkMarkGroup");
|
11
10
|
var _searchQueryMarkGroup = require("../groups/searchQueryMarkGroup");
|
11
|
+
var _color = require("./color");
|
12
12
|
var code = exports.code = (0, _adfSchemaGenerator.adfMark)('code').define({
|
13
|
-
excludes: [_fontStyleGroup.fontStyleGroup, _linkMarkGroup.linkMarkGroup, _searchQueryMarkGroup.searchQueryMarkGroup,
|
13
|
+
excludes: [_fontStyleGroup.fontStyleGroup, _linkMarkGroup.linkMarkGroup, _searchQueryMarkGroup.searchQueryMarkGroup, _color.colorGroup],
|
14
14
|
inclusive: true
|
15
15
|
});
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.textColor = exports.colorGroup = exports.backgroundColor = void 0;
|
7
|
+
var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
|
8
|
+
var backgroundColor = exports.backgroundColor = (0, _adfSchemaGenerator.adfMark)('backgroundColor');
|
9
|
+
var textColor = exports.textColor = (0, _adfSchemaGenerator.adfMark)('textColor');
|
10
|
+
var colorGroup = exports.colorGroup = (0, _adfSchemaGenerator.adfMarkGroup)('color', [textColor, backgroundColor]);
|
11
|
+
backgroundColor.define({
|
12
|
+
inclusive: true,
|
13
|
+
excludes: [colorGroup],
|
14
|
+
attrs: {
|
15
|
+
color: {
|
16
|
+
pattern: '^#[0-9a-fA-F]{6}$',
|
17
|
+
type: 'string'
|
18
|
+
}
|
19
|
+
}
|
20
|
+
});
|
21
|
+
textColor.define({
|
22
|
+
inclusive: true,
|
23
|
+
attrs: {
|
24
|
+
color: {
|
25
|
+
type: 'string',
|
26
|
+
pattern: '^#[0-9a-fA-F]{6}$'
|
27
|
+
}
|
28
|
+
}
|
29
|
+
});
|
@@ -9,5 +9,5 @@ var _tableCell = require("./tableCell");
|
|
9
9
|
var _tableHeader = require("./tableHeader");
|
10
10
|
var tableRow = exports.tableRow = (0, _adfSchemaGenerator.adfNode)('tableRow').define({
|
11
11
|
selectable: false,
|
12
|
-
content: [(0, _adfSchemaGenerator.$
|
12
|
+
content: [(0, _adfSchemaGenerator.$zeroPlus)((0, _adfSchemaGenerator.$or)(_tableCell.tableCell, _tableHeader.tableHeader))]
|
13
13
|
});
|
@@ -12,11 +12,10 @@ var _link = require("../marks/link");
|
|
12
12
|
var _strike = require("../marks/strike");
|
13
13
|
var _strong = require("../marks/strong");
|
14
14
|
var _subsup = require("../marks/subsup");
|
15
|
-
var _textColor = require("../marks/textColor");
|
16
15
|
var _underline = require("../marks/underline");
|
17
|
-
var
|
16
|
+
var _color = require("../marks/color");
|
18
17
|
var text = exports.text = (0, _adfSchemaGenerator.adfNode)('text').define({}).variant('formatted', {
|
19
|
-
marks: [_link.link, _em.em, _strong.strong, _strike.strike, _subsup.subsup, _underline.underline,
|
18
|
+
marks: [_link.link, _em.em, _strong.strong, _strike.strike, _subsup.subsup, _underline.underline, _color.textColor, _annotation.annotation, _color.backgroundColor]
|
20
19
|
}).variant('code_inline', {
|
21
20
|
marks: [_code.code, _link.link, _annotation.annotation]
|
22
21
|
});
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { $
|
1
|
+
import { $or, $zeroPlus, 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
5
|
const doc = adfNode('doc').define({
|
6
6
|
root: true,
|
7
|
-
content: [$
|
7
|
+
content: [$zeroPlus($or(blockGroup, layoutSection, layoutSection.use('full'), blockRootOnlyGroup))]
|
8
8
|
});
|
9
9
|
export default doc;
|
@@ -4,20 +4,19 @@ import { adfMarkGroup } from '@atlaskit/adf-schema-generator';
|
|
4
4
|
// These marks defined together because they form a cycle within the excludes.
|
5
5
|
export const alignment = adfMark('alignment');
|
6
6
|
export const indentation = adfMark('indentation');
|
7
|
-
const alignementMarkExclusionGroup = adfMarkGroup('
|
8
|
-
const indentationMarkExclusionGroup = adfMarkGroup('
|
7
|
+
const alignementMarkExclusionGroup = adfMarkGroup('alignment', [alignment]);
|
8
|
+
const indentationMarkExclusionGroup = adfMarkGroup('indentation', [indentation]);
|
9
9
|
alignment.define({
|
10
|
-
excludes: [indentationMarkExclusionGroup],
|
10
|
+
excludes: [alignementMarkExclusionGroup, indentationMarkExclusionGroup],
|
11
11
|
attrs: {
|
12
12
|
align: {
|
13
13
|
type: 'enum',
|
14
|
-
values: ['center', 'end']
|
15
|
-
default: 'center'
|
14
|
+
values: ['center', 'end']
|
16
15
|
}
|
17
16
|
}
|
18
17
|
});
|
19
18
|
indentation.define({
|
20
|
-
excludes: [alignementMarkExclusionGroup],
|
19
|
+
excludes: [indentationMarkExclusionGroup, alignementMarkExclusionGroup],
|
21
20
|
attrs: {
|
22
21
|
level: {
|
23
22
|
type: 'number',
|
@@ -1,6 +1,9 @@
|
|
1
|
-
import { adfMark } from '@atlaskit/adf-schema-generator';
|
2
|
-
export const annotation = adfMark('annotation')
|
1
|
+
import { adfMark, adfMarkGroup } from '@atlaskit/adf-schema-generator';
|
2
|
+
export const annotation = adfMark('annotation');
|
3
|
+
export const annotationGroup = adfMarkGroup('annotation', [annotation]);
|
4
|
+
annotation.define({
|
3
5
|
inclusive: true,
|
6
|
+
group: annotationGroup,
|
4
7
|
attrs: {
|
5
8
|
id: {
|
6
9
|
type: 'string',
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { adfMark } from '@atlaskit/adf-schema-generator';
|
2
|
-
import { colorGroup } from '../groups/colorGroup';
|
3
2
|
import { fontStyleGroup } from '../groups/fontStyleGroup';
|
4
3
|
import { linkMarkGroup } from '../groups/linkMarkGroup';
|
5
4
|
import { searchQueryMarkGroup } from '../groups/searchQueryMarkGroup';
|
5
|
+
import { colorGroup } from './color';
|
6
6
|
export const code = adfMark('code').define({
|
7
7
|
excludes: [fontStyleGroup, linkMarkGroup, searchQueryMarkGroup, colorGroup],
|
8
8
|
inclusive: true
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { adfMark } from '@atlaskit/adf-schema-generator';
|
2
|
+
import { adfMarkGroup } from '@atlaskit/adf-schema-generator';
|
3
|
+
export const backgroundColor = adfMark('backgroundColor');
|
4
|
+
export const textColor = adfMark('textColor');
|
5
|
+
export const colorGroup = adfMarkGroup('color', [textColor, backgroundColor]);
|
6
|
+
backgroundColor.define({
|
7
|
+
inclusive: true,
|
8
|
+
excludes: [colorGroup],
|
9
|
+
attrs: {
|
10
|
+
color: {
|
11
|
+
pattern: '^#[0-9a-fA-F]{6}$',
|
12
|
+
type: 'string'
|
13
|
+
}
|
14
|
+
}
|
15
|
+
});
|
16
|
+
textColor.define({
|
17
|
+
inclusive: true,
|
18
|
+
attrs: {
|
19
|
+
color: {
|
20
|
+
type: 'string',
|
21
|
+
pattern: '^#[0-9a-fA-F]{6}$'
|
22
|
+
}
|
23
|
+
}
|
24
|
+
});
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { $
|
1
|
+
import { $or, $zeroPlus, adfNode } from '@atlaskit/adf-schema-generator';
|
2
2
|
import { tableCell } from './tableCell';
|
3
3
|
import { tableHeader } from './tableHeader';
|
4
4
|
export const tableRow = adfNode('tableRow').define({
|
5
5
|
selectable: false,
|
6
|
-
content: [$
|
6
|
+
content: [$zeroPlus($or(tableCell, tableHeader))]
|
7
7
|
});
|
@@ -6,9 +6,8 @@ import { link } from '../marks/link';
|
|
6
6
|
import { strike } from '../marks/strike';
|
7
7
|
import { strong } from '../marks/strong';
|
8
8
|
import { subsup } from '../marks/subsup';
|
9
|
-
import { textColor } from '../marks/textColor';
|
10
9
|
import { underline } from '../marks/underline';
|
11
|
-
import { backgroundColor } from '../marks/
|
10
|
+
import { backgroundColor, textColor } from '../marks/color';
|
12
11
|
export const text = adfNode('text').define({}).variant('formatted', {
|
13
12
|
marks: [link, em, strong, strike, subsup, underline, textColor, annotation, backgroundColor]
|
14
13
|
}).variant('code_inline', {
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { $
|
1
|
+
import { $or, $zeroPlus, 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
5
|
var doc = adfNode('doc').define({
|
6
6
|
root: true,
|
7
|
-
content: [$
|
7
|
+
content: [$zeroPlus($or(blockGroup, layoutSection, layoutSection.use('full'), blockRootOnlyGroup))]
|
8
8
|
});
|
9
9
|
export default doc;
|
@@ -4,20 +4,19 @@ import { adfMarkGroup } from '@atlaskit/adf-schema-generator';
|
|
4
4
|
// These marks defined together because they form a cycle within the excludes.
|
5
5
|
export var alignment = adfMark('alignment');
|
6
6
|
export var indentation = adfMark('indentation');
|
7
|
-
var alignementMarkExclusionGroup = adfMarkGroup('
|
8
|
-
var indentationMarkExclusionGroup = adfMarkGroup('
|
7
|
+
var alignementMarkExclusionGroup = adfMarkGroup('alignment', [alignment]);
|
8
|
+
var indentationMarkExclusionGroup = adfMarkGroup('indentation', [indentation]);
|
9
9
|
alignment.define({
|
10
|
-
excludes: [indentationMarkExclusionGroup],
|
10
|
+
excludes: [alignementMarkExclusionGroup, indentationMarkExclusionGroup],
|
11
11
|
attrs: {
|
12
12
|
align: {
|
13
13
|
type: 'enum',
|
14
|
-
values: ['center', 'end']
|
15
|
-
default: 'center'
|
14
|
+
values: ['center', 'end']
|
16
15
|
}
|
17
16
|
}
|
18
17
|
});
|
19
18
|
indentation.define({
|
20
|
-
excludes: [alignementMarkExclusionGroup],
|
19
|
+
excludes: [indentationMarkExclusionGroup, alignementMarkExclusionGroup],
|
21
20
|
attrs: {
|
22
21
|
level: {
|
23
22
|
type: 'number',
|
@@ -1,6 +1,9 @@
|
|
1
|
-
import { adfMark } from '@atlaskit/adf-schema-generator';
|
2
|
-
export var annotation = adfMark('annotation')
|
1
|
+
import { adfMark, adfMarkGroup } from '@atlaskit/adf-schema-generator';
|
2
|
+
export var annotation = adfMark('annotation');
|
3
|
+
export var annotationGroup = adfMarkGroup('annotation', [annotation]);
|
4
|
+
annotation.define({
|
3
5
|
inclusive: true,
|
6
|
+
group: annotationGroup,
|
4
7
|
attrs: {
|
5
8
|
id: {
|
6
9
|
type: 'string',
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { adfMark } from '@atlaskit/adf-schema-generator';
|
2
|
-
import { colorGroup } from '../groups/colorGroup';
|
3
2
|
import { fontStyleGroup } from '../groups/fontStyleGroup';
|
4
3
|
import { linkMarkGroup } from '../groups/linkMarkGroup';
|
5
4
|
import { searchQueryMarkGroup } from '../groups/searchQueryMarkGroup';
|
5
|
+
import { colorGroup } from './color';
|
6
6
|
export var code = adfMark('code').define({
|
7
7
|
excludes: [fontStyleGroup, linkMarkGroup, searchQueryMarkGroup, colorGroup],
|
8
8
|
inclusive: true
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { adfMark } from '@atlaskit/adf-schema-generator';
|
2
|
+
import { adfMarkGroup } from '@atlaskit/adf-schema-generator';
|
3
|
+
export var backgroundColor = adfMark('backgroundColor');
|
4
|
+
export var textColor = adfMark('textColor');
|
5
|
+
export var colorGroup = adfMarkGroup('color', [textColor, backgroundColor]);
|
6
|
+
backgroundColor.define({
|
7
|
+
inclusive: true,
|
8
|
+
excludes: [colorGroup],
|
9
|
+
attrs: {
|
10
|
+
color: {
|
11
|
+
pattern: '^#[0-9a-fA-F]{6}$',
|
12
|
+
type: 'string'
|
13
|
+
}
|
14
|
+
}
|
15
|
+
});
|
16
|
+
textColor.define({
|
17
|
+
inclusive: true,
|
18
|
+
attrs: {
|
19
|
+
color: {
|
20
|
+
type: 'string',
|
21
|
+
pattern: '^#[0-9a-fA-F]{6}$'
|
22
|
+
}
|
23
|
+
}
|
24
|
+
});
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { $
|
1
|
+
import { $or, $zeroPlus, adfNode } from '@atlaskit/adf-schema-generator';
|
2
2
|
import { tableCell } from './tableCell';
|
3
3
|
import { tableHeader } from './tableHeader';
|
4
4
|
export var tableRow = adfNode('tableRow').define({
|
5
5
|
selectable: false,
|
6
|
-
content: [$
|
6
|
+
content: [$zeroPlus($or(tableCell, tableHeader))]
|
7
7
|
});
|
@@ -6,9 +6,8 @@ import { link } from '../marks/link';
|
|
6
6
|
import { strike } from '../marks/strike';
|
7
7
|
import { strong } from '../marks/strong';
|
8
8
|
import { subsup } from '../marks/subsup';
|
9
|
-
import { textColor } from '../marks/textColor';
|
10
9
|
import { underline } from '../marks/underline';
|
11
|
-
import { backgroundColor } from '../marks/
|
10
|
+
import { backgroundColor, textColor } from '../marks/color';
|
12
11
|
export var text = adfNode('text').define({}).variant('formatted', {
|
13
12
|
marks: [link, em, strong, strike, subsup, underline, textColor, annotation, backgroundColor]
|
14
13
|
}).variant('code_inline', {
|
@@ -1 +1,2 @@
|
|
1
1
|
export declare const annotation: import("@atlaskit/adf-schema-generator/dist/types/adfMark").ADFMark<import("@atlaskit/adf-schema-generator/dist/types/types/ADFMarkSpec").ADFMarkSpec>;
|
2
|
+
export declare const annotationGroup: import("@atlaskit/adf-schema-generator/dist/types/types/ADFMarkGroup").ADFMarkGroup;
|
@@ -0,0 +1,3 @@
|
|
1
|
+
export declare const backgroundColor: import("@atlaskit/adf-schema-generator/dist/types/adfMark").ADFMark<import("@atlaskit/adf-schema-generator/dist/types/types/ADFMarkSpec").ADFMarkSpec>;
|
2
|
+
export declare const textColor: import("@atlaskit/adf-schema-generator/dist/types/adfMark").ADFMark<import("@atlaskit/adf-schema-generator/dist/types/types/ADFMarkSpec").ADFMarkSpec>;
|
3
|
+
export declare const colorGroup: import("@atlaskit/adf-schema-generator/dist/types/types/ADFMarkGroup").ADFMarkGroup;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atlaskit/adf-schema",
|
3
|
-
"version": "36.10.
|
3
|
+
"version": "36.10.10",
|
4
4
|
"description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
|
5
5
|
"publishConfig": {
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"generate:json-schema:full": "json-schema-generator --outDir=./json-schema/v1/ ./src/schema/nodes/doc.ts",
|
22
22
|
"ak-postbuild": "yarn build:json-schema",
|
23
23
|
"test": "yarn test:unit",
|
24
|
-
"test:unit": "yarn workspace @atlaskit/editor-prosemirror build && jest --testPathPattern=adf-schema/
|
24
|
+
"test:unit": "yarn workspace @atlaskit/editor-prosemirror build && jest --testPathPattern=packages/adf-schema/ --config=../../jest.config.js",
|
25
25
|
"build:cjs": "NODE_ENV=production BABEL_ENV=production:node-cjs babel --config-file ../../babel.config.js src --out-dir dist/cjs -x .ts,.tsx",
|
26
26
|
"build:esm": "NODE_ENV=production BABEL_ENV=production:esm babel --config-file ../../babel.config.js src -d dist/esm -x .ts,.tsx",
|
27
27
|
"build:es2019": "NODE_ENV=production BABEL_ENV=production:es2019 babel --config-file ../../babel.config.js src -d dist/es2019 -x .ts,.tsx",
|
@@ -45,7 +45,7 @@
|
|
45
45
|
},
|
46
46
|
"devDependencies": {
|
47
47
|
"@atlassian/adf-schema-json": "^1.15.0",
|
48
|
-
"@atlaskit/adf-schema-generator": "^1.8.
|
48
|
+
"@atlaskit/adf-schema-generator": "^1.8.3",
|
49
49
|
"@babel/cli": "^7.22.9",
|
50
50
|
"@babel/core": "^7.22.9",
|
51
51
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
@@ -114,3 +114,16 @@ A number of nodes have `marks` defined, yet the array is empty. Assuming this is
|
|
114
114
|
.block_content, .nestedExpand_content, .non_nestable_block_content, .table_cell_content, .inline_node,
|
115
115
|
.bodiedExtension_node.properties.marks, .codeBlock_node.properties.marks, .expand_node.properties.marks, .heading_node.properties.marks, .inlineExtension_node.properties.marks, .text_node.properties.marks, .extension_node.properties.marks, .paragraph_node.properties.marks) else . end)' | pbcopy
|
116
116
|
```
|
117
|
+
|
118
|
+
Base level content objects (not nodes) are deleted. `inline` is also deleted, as it is a content object for paragraph.
|
119
|
+
|
120
|
+
All fields of content except for type and items have been deleted as well.
|
121
|
+
|
122
|
+
A number of nodes have `marks` defined, yet the array is empty. Assuming this is redundant, I've removed them.
|
123
|
+
|
124
|
+
```sh
|
125
|
+
cat packages/adf-schema/json-schema/v1/full.json | jq 'walk(if type == "object" then del(
|
126
|
+
.version, .required, .additionalProperties, .allOf, .content.items.anyOf?, .content.items."$ref"?, .content.items[]?, .content."$ref",
|
127
|
+
.block_content, .nestedExpand_content, .non_nestable_block_content, .table_cell_content, .inline_node,
|
128
|
+
.bodiedExtension_node.properties.marks, .codeBlock_node.properties.marks, .expand_node.properties.marks, .heading_node.properties.marks, .inlineExtension_node.properties.marks, .text_node.properties.marks, .extension_node.properties.marks, .paragraph_node.properties.marks) else . end)' | pbcopy
|
129
|
+
```
|
@@ -230,6 +230,7 @@ const jsonWithTypes = {
|
|
230
230
|
items: {
|
231
231
|
type: 'string',
|
232
232
|
},
|
233
|
+
minItems: 1,
|
233
234
|
},
|
234
235
|
},
|
235
236
|
},
|
@@ -455,6 +456,7 @@ const jsonWithTypes = {
|
|
455
456
|
properties: {},
|
456
457
|
},
|
457
458
|
},
|
459
|
+
minItems: 1,
|
458
460
|
},
|
459
461
|
},
|
460
462
|
},
|
@@ -699,6 +701,7 @@ const jsonWithTypes = {
|
|
699
701
|
content: {
|
700
702
|
type: 'array',
|
701
703
|
items: {},
|
704
|
+
minItems: 0,
|
702
705
|
},
|
703
706
|
},
|
704
707
|
},
|
@@ -801,6 +804,7 @@ const jsonWithTypes = {
|
|
801
804
|
content: {
|
802
805
|
type: 'array',
|
803
806
|
items: [],
|
807
|
+
minItems: 1,
|
804
808
|
},
|
805
809
|
attrs: {
|
806
810
|
type: 'object',
|
@@ -821,6 +825,7 @@ const jsonWithTypes = {
|
|
821
825
|
content: {
|
822
826
|
type: 'array',
|
823
827
|
items: [],
|
828
|
+
minItems: 1,
|
824
829
|
},
|
825
830
|
},
|
826
831
|
},
|
@@ -833,6 +838,7 @@ const jsonWithTypes = {
|
|
833
838
|
content: {
|
834
839
|
type: 'array',
|
835
840
|
items: {},
|
841
|
+
minItems: 1,
|
836
842
|
},
|
837
843
|
},
|
838
844
|
},
|
@@ -845,6 +851,7 @@ const jsonWithTypes = {
|
|
845
851
|
content: {
|
846
852
|
type: 'array',
|
847
853
|
items: {},
|
854
|
+
minItems: 1,
|
848
855
|
},
|
849
856
|
attrs: {
|
850
857
|
type: 'object',
|
@@ -891,6 +898,7 @@ const jsonWithTypes = {
|
|
891
898
|
content: {
|
892
899
|
type: 'array',
|
893
900
|
items: {},
|
901
|
+
minItems: 1,
|
894
902
|
},
|
895
903
|
},
|
896
904
|
},
|
@@ -926,6 +934,7 @@ const jsonWithTypes = {
|
|
926
934
|
content: {
|
927
935
|
type: 'array',
|
928
936
|
items: {},
|
937
|
+
minItems: 1,
|
929
938
|
},
|
930
939
|
attrs: {
|
931
940
|
type: 'object',
|
@@ -982,6 +991,7 @@ const jsonWithTypes = {
|
|
982
991
|
content: {
|
983
992
|
type: 'array',
|
984
993
|
items: {},
|
994
|
+
minItems: 1,
|
985
995
|
},
|
986
996
|
},
|
987
997
|
},
|
@@ -994,6 +1004,7 @@ const jsonWithTypes = {
|
|
994
1004
|
content: {
|
995
1005
|
type: 'array',
|
996
1006
|
items: {},
|
1007
|
+
minItems: 1,
|
997
1008
|
},
|
998
1009
|
},
|
999
1010
|
},
|
@@ -1123,6 +1134,7 @@ const jsonWithTypes = {
|
|
1123
1134
|
content: {
|
1124
1135
|
type: 'array',
|
1125
1136
|
items: {},
|
1137
|
+
minItems: 1,
|
1126
1138
|
},
|
1127
1139
|
marks: {
|
1128
1140
|
type: 'array',
|
@@ -1219,6 +1231,7 @@ const jsonWithTypes = {
|
|
1219
1231
|
content: {
|
1220
1232
|
type: 'array',
|
1221
1233
|
items: {},
|
1234
|
+
minItems: 1,
|
1222
1235
|
},
|
1223
1236
|
},
|
1224
1237
|
},
|
@@ -1257,6 +1270,7 @@ const jsonWithTypes = {
|
|
1257
1270
|
content: {
|
1258
1271
|
type: 'array',
|
1259
1272
|
items: {},
|
1273
|
+
minItems: 1,
|
1260
1274
|
},
|
1261
1275
|
},
|
1262
1276
|
},
|
@@ -1280,6 +1294,7 @@ const jsonWithTypes = {
|
|
1280
1294
|
content: {
|
1281
1295
|
type: 'array',
|
1282
1296
|
items: {},
|
1297
|
+
minItems: 1,
|
1283
1298
|
},
|
1284
1299
|
},
|
1285
1300
|
},
|
@@ -1325,12 +1340,15 @@ jsonWithTypes.definitions.heading_node.properties.content = {
|
|
1325
1340
|
jsonWithTypes.definitions.nestedExpand_node.properties.content = {
|
1326
1341
|
type: 'array',
|
1327
1342
|
items: {},
|
1343
|
+
minItems: 1,
|
1328
1344
|
};
|
1329
1345
|
jsonWithTypes.definitions.table_cell_node.properties.content = {
|
1330
1346
|
type: 'array',
|
1331
1347
|
items: {},
|
1348
|
+
minItems: 1,
|
1332
1349
|
};
|
1333
1350
|
jsonWithTypes.definitions.table_header_node.properties.content = {
|
1334
1351
|
type: 'array',
|
1335
1352
|
items: {},
|
1353
|
+
minItems: 1,
|
1336
1354
|
};
|
@@ -0,0 +1,110 @@
|
|
1
|
+
import { MarkSpec, NodeSpec, Schema } from '@atlaskit/editor-prosemirror/model';
|
2
|
+
import * as newMarkSpecs from '@atlaskit/adf-schema-generator/src/generated/markTypes';
|
3
|
+
import * as newNodeSpecs from '@atlaskit/adf-schema-generator/src/generated/nodeTypes';
|
4
|
+
import {
|
5
|
+
MarkSpecFactory,
|
6
|
+
NodeSpecFactory,
|
7
|
+
} from '@atlaskit/adf-schema-generator/src/transforms/adfToPm/createPMSpecFactory';
|
8
|
+
import { defaultSchema } from '../../../src/schema/default-schema';
|
9
|
+
|
10
|
+
function isMarkSpec(value: MarkSpec | NodeSpec): value is MarkSpec {
|
11
|
+
return true;
|
12
|
+
}
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Custom omit function, mainly used to filter out parseDOM and toDOM from old spec
|
16
|
+
* and some special logic to filter out certain field when compare spec
|
17
|
+
* @param data
|
18
|
+
* @param keys
|
19
|
+
* @returns
|
20
|
+
*/
|
21
|
+
function omit<T extends object>(data: T, keys: (keyof T)[]): T {
|
22
|
+
const result = { ...data };
|
23
|
+
for (const k of keys) {
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
25
|
+
delete result[k];
|
26
|
+
}
|
27
|
+
if (isMarkSpec(data)) {
|
28
|
+
// Treat excludes: '' same as no excludes property
|
29
|
+
if (data.excludes !== undefined && data.excludes === '') {
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
31
|
+
delete result['excludes'];
|
32
|
+
}
|
33
|
+
}
|
34
|
+
return result;
|
35
|
+
}
|
36
|
+
|
37
|
+
describe('validate PM schema', () => {
|
38
|
+
describe('marks', () => {
|
39
|
+
const { marks } = defaultSchema as Schema;
|
40
|
+
const skipLists = [
|
41
|
+
'link', // TODO: new link mark is not matching old link mark
|
42
|
+
'confluenceInlineComment', // TODO: not exist in ADF DSL
|
43
|
+
'unsupportedMark', // TODO: not exist in ADF DSL
|
44
|
+
'unsupportedNodeAttribute', // TODO: not exist in ADF DSL
|
45
|
+
'typeAheadQuery', // TODO: not exist in ADF DSL
|
46
|
+
// Following marks not exported in adf-schema
|
47
|
+
'__colorGroupDeclaration',
|
48
|
+
'__fontStyleGroupDeclaration',
|
49
|
+
'__searchQueryGroupDeclaration',
|
50
|
+
'__linkGroupDeclaration',
|
51
|
+
];
|
52
|
+
|
53
|
+
const testCases = Object.entries(marks).map(([key, value]) => {
|
54
|
+
return {
|
55
|
+
name: key,
|
56
|
+
legacyMarkSpec: value.spec,
|
57
|
+
newMarkSpecFn: newMarkSpecs[`${key}`] as MarkSpecFactory,
|
58
|
+
skip: skipLists.includes(key),
|
59
|
+
};
|
60
|
+
});
|
61
|
+
|
62
|
+
const getTestingMethod = (skip: boolean) => {
|
63
|
+
return skip ? it.skip : it;
|
64
|
+
};
|
65
|
+
|
66
|
+
testCases.forEach(({ name, legacyMarkSpec, newMarkSpecFn, skip }) => {
|
67
|
+
const testMethod = getTestingMethod(skip);
|
68
|
+
|
69
|
+
testMethod(`validate markSpec for mark ${name}`, () => {
|
70
|
+
// check if there's any missing markSpec
|
71
|
+
expect(newMarkSpecFn).toBeDefined();
|
72
|
+
const newMarkSpec = newMarkSpecFn({});
|
73
|
+
expect(omit(newMarkSpec, ['parseDOM', 'toDOM'])).toEqual(
|
74
|
+
omit(legacyMarkSpec, ['parseDOM', 'toDOM']),
|
75
|
+
);
|
76
|
+
});
|
77
|
+
});
|
78
|
+
});
|
79
|
+
|
80
|
+
// TODO: content from node is too strict, need a custom comparor
|
81
|
+
// TODO: marks are not matching, especially missing unsupportedBlock, unsupportedNodeAttribute
|
82
|
+
describe.skip('nodes', () => {
|
83
|
+
const { nodes } = defaultSchema as Schema;
|
84
|
+
const skipLists = ['unknownBlock', 'unsupportedBlock', 'unsupportedInline'];
|
85
|
+
const testCases = Object.entries(nodes).map(([key, value]) => {
|
86
|
+
return {
|
87
|
+
name: key,
|
88
|
+
legacyNodeSpec: value.spec,
|
89
|
+
newNodeSpecFn: newNodeSpecs[`${key}`] as NodeSpecFactory,
|
90
|
+
skip: skipLists.includes(key),
|
91
|
+
};
|
92
|
+
});
|
93
|
+
|
94
|
+
const getTestingMethod = (skip: boolean) => {
|
95
|
+
return skip ? it.skip : it;
|
96
|
+
};
|
97
|
+
|
98
|
+
testCases.forEach(({ name, legacyNodeSpec, newNodeSpecFn, skip }) => {
|
99
|
+
const testMethod = getTestingMethod(skip);
|
100
|
+
testMethod(`validate nodeSpec for node ${name}`, () => {
|
101
|
+
// check if there's any missing nodeSpec
|
102
|
+
expect(newNodeSpecFn).toBeDefined();
|
103
|
+
const newNodeSpec = newNodeSpecFn({});
|
104
|
+
expect(omit(newNodeSpec, ['parseDOM', 'toDOM'])).toEqual(
|
105
|
+
omit(legacyNodeSpec, ['parseDOM', 'toDOM']),
|
106
|
+
);
|
107
|
+
});
|
108
|
+
});
|
109
|
+
});
|
110
|
+
});
|
@@ -1,8 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.annotationGroup = void 0;
|
7
|
-
var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
|
8
|
-
var annotationGroup = exports.annotationGroup = (0, _adfSchemaGenerator.adfMarkGroup)('annotation');
|
@@ -1,9 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.colorGroup = void 0;
|
7
|
-
var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
|
8
|
-
var _textColor = require("../marks/textColor");
|
9
|
-
var colorGroup = exports.colorGroup = (0, _adfSchemaGenerator.adfMarkGroup)('color', [_textColor.textColor]);
|
@@ -1,15 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.backgroundColor = void 0;
|
7
|
-
var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
|
8
|
-
var backgroundColor = exports.backgroundColor = (0, _adfSchemaGenerator.adfMark)('backgroundColor').define({
|
9
|
-
attrs: {
|
10
|
-
color: {
|
11
|
-
pattern: '^#[0-9a-fA-F]{6}$',
|
12
|
-
type: 'string'
|
13
|
-
}
|
14
|
-
}
|
15
|
-
});
|
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.textColor = void 0;
|
7
|
-
var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
|
8
|
-
var textColor = exports.textColor = (0, _adfSchemaGenerator.adfMark)('textColor').define({
|
9
|
-
inclusive: true,
|
10
|
-
attrs: {
|
11
|
-
color: {
|
12
|
-
type: 'string',
|
13
|
-
pattern: '^#[0-9a-fA-F]{6}$'
|
14
|
-
}
|
15
|
-
}
|
16
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const annotationGroup: import("@atlaskit/adf-schema-generator/dist/types/types/ADFMarkGroup").ADFMarkGroup;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const colorGroup: import("@atlaskit/adf-schema-generator/dist/types/types/ADFMarkGroup").ADFMarkGroup;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const backgroundColor: import("@atlaskit/adf-schema-generator/dist/types/adfMark").ADFMark<import("@atlaskit/adf-schema-generator/dist/types/types/ADFMarkSpec").ADFMarkSpec>;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const textColor: import("@atlaskit/adf-schema-generator/dist/types/adfMark").ADFMark<import("@atlaskit/adf-schema-generator/dist/types/types/ADFMarkSpec").ADFMarkSpec>;
|