@atlaskit/adf-schema 55.0.1 → 55.1.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,22 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 55.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`100d833307949`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/100d833307949) -
8
+ Allow panel_c1 inside bodied sync blocks
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
14
+ ## 55.0.2
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 55.0.1
4
21
 
5
22
  ### Patch Changes
@@ -130,7 +130,7 @@ var bodiedExtensionWithMarks = exports.bodiedExtensionWithMarks = (0, _createPMS
130
130
  isolating: true
131
131
  });
132
132
  var bodiedSyncBlock = exports.bodiedSyncBlock = (0, _createPMSpecFactory.createPMNodeSpecFactory)({
133
- content: '(paragraph | blockCard | blockquote | bulletList | codeBlock | confluenceUnsupportedBlock | decisionList | embedCard | expand | heading | layoutSection | mediaGroup | mediaSingle | orderedList | panel | rule | table | taskList | unsupportedBlock)+',
133
+ content: '(paragraph | blockCard | blockquote | bulletList | codeBlock | confluenceUnsupportedBlock | decisionList | embedCard | expand | heading | layoutSection | mediaGroup | mediaSingle | orderedList | panel | panel_c1 | rule | table | taskList | unsupportedBlock)+',
134
134
  marks: 'unsupportedMark unsupportedNodeAttribute fontSize alignment indentation breakout link fragment',
135
135
  attrs: {
136
136
  resourceId: {
@@ -40,7 +40,7 @@ var bodiedSyncBlock = exports.bodiedSyncBlock = (0, _adfSchemaGenerator.adfNode)
40
40
  default: ''
41
41
  }
42
42
  },
43
- content: [(0, _adfSchemaGenerator.$onePlus)((0, _adfSchemaGenerator.$or)(_paragraph.paragraph, _paragraph.paragraph.use('with_alignment'), _paragraph.paragraph.use('with_indentation'), _paragraph.paragraph.use('with_no_marks'), _blockCard.blockCard, _blockquote.blockquote, _blockquote.blockquote.use('legacy'), _list.bulletList, _codeBlock.codeBlock, _confluenceUnsupportedBlock.confluenceUnsupportedBlock, _decisionList.decisionList, _embedCard.embedCard, _expand.expand, _heading.heading, _heading.heading.use('with_alignment'), _heading.heading.use('with_indentation'), _heading.heading.use('with_no_marks'), _layoutSection.layoutSection, _layoutSection.layoutSection.use('with_single_column'), _layoutSection.layoutSection.use('full'), _mediaGroup.mediaGroup, _mediaSingle.mediaSingle, _mediaSingle.mediaSingle.use('caption'), _mediaSingle.mediaSingle.use('full'), _mediaSingle.mediaSingle.use('width_type'), _list.orderedList, _panel.panel, _rule.rule, _tableNodes.table,
43
+ content: [(0, _adfSchemaGenerator.$onePlus)((0, _adfSchemaGenerator.$or)(_paragraph.paragraph, _paragraph.paragraph.use('with_alignment'), _paragraph.paragraph.use('with_indentation'), _paragraph.paragraph.use('with_no_marks'), _blockCard.blockCard, _blockquote.blockquote, _blockquote.blockquote.use('legacy'), _list.bulletList, _codeBlock.codeBlock, _confluenceUnsupportedBlock.confluenceUnsupportedBlock, _decisionList.decisionList, _embedCard.embedCard, _expand.expand, _heading.heading, _heading.heading.use('with_alignment'), _heading.heading.use('with_indentation'), _heading.heading.use('with_no_marks'), _layoutSection.layoutSection, _layoutSection.layoutSection.use('with_single_column'), _layoutSection.layoutSection.use('full'), _mediaGroup.mediaGroup, _mediaSingle.mediaSingle, _mediaSingle.mediaSingle.use('caption'), _mediaSingle.mediaSingle.use('full'), _mediaSingle.mediaSingle.use('width_type'), _list.orderedList, _panel.panel, _panel.panel.use('c1'), _rule.rule, _tableNodes.table,
44
44
  // @ts-expect-error - types don't deal well with circular references for the variant
45
45
  _tableNodes.table.use('with_nested_table'), _task.taskList, _unsupportedBlock.unsupportedBlock))]
46
46
  });
@@ -60,5 +60,6 @@ var panel = exports.panel = (0, _adfSchemaGenerator.adfNode)('panel').define({
60
60
  // panel_c1 allows all standard panel content plus table (wired via addContent
61
61
  // in full-schema.adf.ts to avoid a circular module import).
62
62
  content: [(0, _adfSchemaGenerator.$onePlus)(_adfSchemaGenerator.$or.apply(void 0, panelContent.concat([_extension.extension.use('with_marks')])))],
63
- ignore: ['json-schema', 'validator-spec']
63
+ ignore: ['json-schema', 'validator-spec'],
64
+ preserveVariantNameInPm: true
64
65
  });
@@ -23,6 +23,9 @@ var PanelType = exports.PanelType = /*#__PURE__*/function (PanelType) {
23
23
  /**
24
24
  * @name panel_node
25
25
  */
26
+ /**
27
+ * @name panel_c1_node
28
+ */
26
29
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
30
  var getDomAttrs = function getDomAttrs(nodeAttrs) {
28
31
  var attrs = {
@@ -29,8 +29,12 @@ function sanitizeNodeSpecContent(nodes, rawContent) {
29
29
  // @ts-ignore TS1501: This regular expression flag is only available when targeting 'es6' or later.
30
30
  var content = rawContent.replace(/(?:[\0-\/:-@\[-\^`\{-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g, ' ');
31
31
  var contentKeys = content.split(' ');
32
- var unsupportedContentKeys = contentKeys.filter(function (contentKey) {
32
+ var unsupportedContentKeys = Array.from(new Set(contentKeys.filter(function (contentKey) {
33
33
  return !isContentSupported(nodes, contentKey);
34
+ }))
35
+ // Remove longer variant names first so base names like `panel` don't partially strip `panel_c1`.
36
+ ).sort(function (a, b) {
37
+ return b.length - a.length;
34
38
  });
35
39
  return unsupportedContentKeys.reduce(function (newContent, nodeName) {
36
40
  return sanitizedContent(newContent, nodeName);
@@ -124,7 +124,7 @@ export const bodiedExtensionWithMarks = createPMNodeSpecFactory({
124
124
  isolating: true
125
125
  });
126
126
  export const bodiedSyncBlock = createPMNodeSpecFactory({
127
- content: '(paragraph | blockCard | blockquote | bulletList | codeBlock | confluenceUnsupportedBlock | decisionList | embedCard | expand | heading | layoutSection | mediaGroup | mediaSingle | orderedList | panel | rule | table | taskList | unsupportedBlock)+',
127
+ content: '(paragraph | blockCard | blockquote | bulletList | codeBlock | confluenceUnsupportedBlock | decisionList | embedCard | expand | heading | layoutSection | mediaGroup | mediaSingle | orderedList | panel | panel_c1 | rule | table | taskList | unsupportedBlock)+',
128
128
  marks: 'unsupportedMark unsupportedNodeAttribute fontSize alignment indentation breakout link fragment',
129
129
  attrs: {
130
130
  resourceId: {
@@ -34,7 +34,7 @@ export const bodiedSyncBlock = adfNode('bodiedSyncBlock').define({
34
34
  default: ''
35
35
  }
36
36
  },
37
- content: [$onePlus($or(paragraph, paragraph.use('with_alignment'), paragraph.use('with_indentation'), paragraph.use('with_no_marks'), blockCard, blockquote, blockquote.use('legacy'), bulletList, codeBlock, confluenceUnsupportedBlock, decisionList, embedCard, expand, heading, heading.use('with_alignment'), heading.use('with_indentation'), heading.use('with_no_marks'), layoutSection, layoutSection.use('with_single_column'), layoutSection.use('full'), mediaGroup, mediaSingle, mediaSingle.use('caption'), mediaSingle.use('full'), mediaSingle.use('width_type'), orderedList, panel, rule, table,
37
+ content: [$onePlus($or(paragraph, paragraph.use('with_alignment'), paragraph.use('with_indentation'), paragraph.use('with_no_marks'), blockCard, blockquote, blockquote.use('legacy'), bulletList, codeBlock, confluenceUnsupportedBlock, decisionList, embedCard, expand, heading, heading.use('with_alignment'), heading.use('with_indentation'), heading.use('with_no_marks'), layoutSection, layoutSection.use('with_single_column'), layoutSection.use('full'), mediaGroup, mediaSingle, mediaSingle.use('caption'), mediaSingle.use('full'), mediaSingle.use('width_type'), orderedList, panel, panel.use('c1'), rule, table,
38
38
  // @ts-expect-error - types don't deal well with circular references for the variant
39
39
  table.use('with_nested_table'), taskList, unsupportedBlock))]
40
40
  });
@@ -54,5 +54,6 @@ export const panel = adfNode('panel').define({
54
54
  // panel_c1 allows all standard panel content plus table (wired via addContent
55
55
  // in full-schema.adf.ts to avoid a circular module import).
56
56
  content: [$onePlus($or(...panelContent, extension.use('with_marks')))],
57
- ignore: ['json-schema', 'validator-spec']
57
+ ignore: ['json-schema', 'validator-spec'],
58
+ preserveVariantNameInPm: true
58
59
  });
@@ -15,6 +15,10 @@ export let PanelType = /*#__PURE__*/function (PanelType) {
15
15
  * @name panel_node
16
16
  */
17
17
 
18
+ /**
19
+ * @name panel_c1_node
20
+ */
21
+
18
22
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
23
  const getDomAttrs = nodeAttrs => {
20
24
  const attrs = {
@@ -19,7 +19,9 @@ function sanitizeNodeSpecContent(nodes, rawContent) {
19
19
  // @ts-ignore TS1501: This regular expression flag is only available when targeting 'es6' or later.
20
20
  const content = rawContent.replace(/\W/gu, ' ');
21
21
  const contentKeys = content.split(' ');
22
- const unsupportedContentKeys = contentKeys.filter(contentKey => !isContentSupported(nodes, contentKey));
22
+ const unsupportedContentKeys = Array.from(new Set(contentKeys.filter(contentKey => !isContentSupported(nodes, contentKey)))
23
+ // Remove longer variant names first so base names like `panel` don't partially strip `panel_c1`.
24
+ ).sort((a, b) => b.length - a.length);
23
25
  return unsupportedContentKeys.reduce((newContent, nodeName) => sanitizedContent(newContent, nodeName), rawContent);
24
26
  }
25
27
 
@@ -124,7 +124,7 @@ export var bodiedExtensionWithMarks = createPMNodeSpecFactory({
124
124
  isolating: true
125
125
  });
126
126
  export var bodiedSyncBlock = createPMNodeSpecFactory({
127
- content: '(paragraph | blockCard | blockquote | bulletList | codeBlock | confluenceUnsupportedBlock | decisionList | embedCard | expand | heading | layoutSection | mediaGroup | mediaSingle | orderedList | panel | rule | table | taskList | unsupportedBlock)+',
127
+ content: '(paragraph | blockCard | blockquote | bulletList | codeBlock | confluenceUnsupportedBlock | decisionList | embedCard | expand | heading | layoutSection | mediaGroup | mediaSingle | orderedList | panel | panel_c1 | rule | table | taskList | unsupportedBlock)+',
128
128
  marks: 'unsupportedMark unsupportedNodeAttribute fontSize alignment indentation breakout link fragment',
129
129
  attrs: {
130
130
  resourceId: {
@@ -34,7 +34,7 @@ export var bodiedSyncBlock = adfNode('bodiedSyncBlock').define({
34
34
  default: ''
35
35
  }
36
36
  },
37
- content: [$onePlus($or(paragraph, paragraph.use('with_alignment'), paragraph.use('with_indentation'), paragraph.use('with_no_marks'), blockCard, blockquote, blockquote.use('legacy'), bulletList, codeBlock, confluenceUnsupportedBlock, decisionList, embedCard, expand, heading, heading.use('with_alignment'), heading.use('with_indentation'), heading.use('with_no_marks'), layoutSection, layoutSection.use('with_single_column'), layoutSection.use('full'), mediaGroup, mediaSingle, mediaSingle.use('caption'), mediaSingle.use('full'), mediaSingle.use('width_type'), orderedList, panel, rule, table,
37
+ content: [$onePlus($or(paragraph, paragraph.use('with_alignment'), paragraph.use('with_indentation'), paragraph.use('with_no_marks'), blockCard, blockquote, blockquote.use('legacy'), bulletList, codeBlock, confluenceUnsupportedBlock, decisionList, embedCard, expand, heading, heading.use('with_alignment'), heading.use('with_indentation'), heading.use('with_no_marks'), layoutSection, layoutSection.use('with_single_column'), layoutSection.use('full'), mediaGroup, mediaSingle, mediaSingle.use('caption'), mediaSingle.use('full'), mediaSingle.use('width_type'), orderedList, panel, panel.use('c1'), rule, table,
38
38
  // @ts-expect-error - types don't deal well with circular references for the variant
39
39
  table.use('with_nested_table'), taskList, unsupportedBlock))]
40
40
  });
@@ -54,5 +54,6 @@ export var panel = adfNode('panel').define({
54
54
  // panel_c1 allows all standard panel content plus table (wired via addContent
55
55
  // in full-schema.adf.ts to avoid a circular module import).
56
56
  content: [$onePlus($or.apply(void 0, panelContent.concat([extension.use('with_marks')])))],
57
- ignore: ['json-schema', 'validator-spec']
57
+ ignore: ['json-schema', 'validator-spec'],
58
+ preserveVariantNameInPm: true
58
59
  });
@@ -18,6 +18,10 @@ export var PanelType = /*#__PURE__*/function (PanelType) {
18
18
  * @name panel_node
19
19
  */
20
20
 
21
+ /**
22
+ * @name panel_c1_node
23
+ */
24
+
21
25
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
26
  var getDomAttrs = function getDomAttrs(nodeAttrs) {
23
27
  var attrs = {
@@ -22,8 +22,12 @@ function sanitizeNodeSpecContent(nodes, rawContent) {
22
22
  // @ts-ignore TS1501: This regular expression flag is only available when targeting 'es6' or later.
23
23
  var content = rawContent.replace(/(?:[\0-\/:-@\[-\^`\{-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g, ' ');
24
24
  var contentKeys = content.split(' ');
25
- var unsupportedContentKeys = contentKeys.filter(function (contentKey) {
25
+ var unsupportedContentKeys = Array.from(new Set(contentKeys.filter(function (contentKey) {
26
26
  return !isContentSupported(nodes, contentKey);
27
+ }))
28
+ // Remove longer variant names first so base names like `panel` don't partially strip `panel_c1`.
29
+ ).sort(function (a, b) {
30
+ return b.length - a.length;
27
31
  });
28
32
  return unsupportedContentKeys.reduce(function (newContent, nodeName) {
29
33
  return sanitizedContent(newContent, nodeName);
@@ -91,7 +91,7 @@ export type BodiedExtensionWithMarksNode = PMNode & BodiedExtensionWithMarksDefi
91
91
  export declare const bodiedExtensionWithMarks: PMNodeSpecFactoryInstance<BodiedExtensionWithMarksNode>;
92
92
  export interface BodiedSyncBlockDefinition {
93
93
  type: 'bodiedSyncBlock';
94
- content: Array<BlockCardDefinition | BlockquoteDefinition | BlockquoteLegacyDefinition | BulletListDefinition | CodeBlockDefinition | ConfluenceUnsupportedBlockDefinition | DecisionListDefinition | EmbedCardDefinition | ExpandDefinition | HeadingDefinition | HeadingWithAlignmentDefinition | HeadingWithIndentationDefinition | HeadingWithNoMarksDefinition | LayoutSectionDefinition | LayoutSectionFullDefinition | LayoutSectionWithSingleColumnStage0Definition | MediaGroupDefinition | MediaSingleCaptionDefinition | MediaSingleDefinition | MediaSingleFullDefinition | MediaSingleWidthTypeDefinition | OrderedListDefinition | PanelDefinition | ParagraphDefinition | ParagraphWithAlignmentDefinition | ParagraphWithIndentationDefinition | ParagraphWithNoMarksDefinition | RuleDefinition | TableDefinition | TableWithNestedTableDefinition | TaskListDefinition | UnsupportedBlockDefinition>;
94
+ content: Array<BlockCardDefinition | BlockquoteDefinition | BlockquoteLegacyDefinition | BulletListDefinition | CodeBlockDefinition | ConfluenceUnsupportedBlockDefinition | DecisionListDefinition | EmbedCardDefinition | ExpandDefinition | HeadingDefinition | HeadingWithAlignmentDefinition | HeadingWithIndentationDefinition | HeadingWithNoMarksDefinition | LayoutSectionDefinition | LayoutSectionFullDefinition | LayoutSectionWithSingleColumnStage0Definition | MediaGroupDefinition | MediaSingleCaptionDefinition | MediaSingleDefinition | MediaSingleFullDefinition | MediaSingleWidthTypeDefinition | OrderedListDefinition | PanelC1Definition | PanelDefinition | ParagraphDefinition | ParagraphWithAlignmentDefinition | ParagraphWithIndentationDefinition | ParagraphWithNoMarksDefinition | RuleDefinition | TableDefinition | TableWithNestedTableDefinition | TaskListDefinition | UnsupportedBlockDefinition>;
95
95
  marks: Array<BreakoutMark | UnsupportedMarkMark | UnsupportedNodeAttributeMark>;
96
96
  attrs: {
97
97
  resourceId: string;
@@ -1,6 +1,6 @@
1
1
  import type { BreakoutMarkDefinition } from '../marks';
2
2
  import type { ExpandDefinition as Expand } from './expand';
3
- import type { PanelDefinition as Panel } from './panel';
3
+ import type { PanelC1Definition as PanelC1, PanelDefinition as Panel } from './panel';
4
4
  import type { ParagraphDefinition as Paragraph, ParagraphWithMarksDefinition as ParagraphWithMarks } from './paragraph';
5
5
  import type { BlockQuoteDefinition as Blockquote } from './blockquote';
6
6
  import type { OrderedListDefinition as OrderedList, BulletListDefinition as BulletList } from './types/list';
@@ -39,7 +39,7 @@ export interface BodiedSyncBlockDefinition {
39
39
  // eslint-disable-next-line eslint-plugin-jsdoc/check-tag-names
40
40
  * @allowUnsupportedBlock true
41
41
  */
42
- content: Array<Paragraph | ParagraphWithMarks | BlockCard | Blockquote | BulletList | CodeBlock | DecisionList | EmbedCard | Expand | Heading | HeadingWithMarks | LayoutSection | MediaGroup | MediaSingle | OrderedList | Panel | Rule | Table | TaskList>;
42
+ content: Array<Paragraph | ParagraphWithMarks | BlockCard | Blockquote | BulletList | CodeBlock | DecisionList | EmbedCard | Expand | Heading | HeadingWithMarks | LayoutSection | MediaGroup | MediaSingle | OrderedList | Panel | PanelC1 | Rule | Table | TaskList>;
43
43
  marks?: Array<BreakoutMarkDefinition>;
44
44
  type: 'bodiedSyncBlock';
45
45
  }
@@ -8,6 +8,7 @@ import type { MediaSingleDefinition as MediaSingle } from './media-single';
8
8
  import type { DecisionListDefinition as DecisionList } from './decision-list';
9
9
  import type { TaskListDefinition as TaskList } from './task-list';
10
10
  import type { RuleDefinition as Rule } from './rule';
11
+ import type { TableDefinition as Table } from './tableNodes';
11
12
  import type { NodeSpec } from '@atlaskit/editor-prosemirror/model';
12
13
  export declare enum PanelType {
13
14
  INFO = "info",
@@ -40,6 +41,20 @@ export interface PanelDefinition {
40
41
  content: Array<Paragraph | Heading | OrderedList | BulletList | BlockCard | CodeBlock | MediaGroup | MediaSingle | DecisionList | TaskList | Rule>;
41
42
  type: 'panel';
42
43
  }
44
+ /**
45
+ * @name panel_c1_node
46
+ */
47
+ export interface PanelC1Definition {
48
+ attrs: PanelAttributes;
49
+ /**
50
+ // eslint-disable-next-line eslint-plugin-jsdoc/check-tag-names
51
+ * @minItems 1
52
+ // eslint-disable-next-line eslint-plugin-jsdoc/check-tag-names
53
+ * @allowUnsupportedBlock true
54
+ */
55
+ content: Array<Paragraph | Heading | OrderedList | BulletList | BlockCard | CodeBlock | MediaGroup | MediaSingle | DecisionList | TaskList | Rule | Table>;
56
+ type: 'panel';
57
+ }
43
58
  export interface DOMAttributes {
44
59
  [propName: string]: string;
45
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "55.0.1",
3
+ "version": "55.1.0",
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/"
@@ -37,9 +37,9 @@
37
37
  "build:schema:all": "yarn build:schema:pm && yarn build:schema:json && yarn build:schema:validator"
38
38
  },
39
39
  "dependencies": {
40
- "@atlaskit/adf-schema-generator": "^3.0.0",
40
+ "@atlaskit/adf-schema-generator": "^3.1.0",
41
41
  "@atlaskit/editor-prosemirror": "^8.0.0",
42
- "@atlaskit/tmp-editor-statsig": "^105.0.0",
42
+ "@atlaskit/tmp-editor-statsig": "^106.0.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "css-color-names": "0.0.4",
45
45
  "linkify-it": "^3.0.3",