@atlaskit/adf-schema 35.10.0 → 35.12.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 (44) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/index.js +12 -0
  3. package/dist/cjs/schema/create-schema.js +3 -0
  4. package/dist/cjs/schema/index.js +12 -0
  5. package/dist/cjs/schema/marks/background-color.js +117 -0
  6. package/dist/cjs/schema/marks/index.js +14 -1
  7. package/dist/cjs/schema/marks/text-color.js +3 -3
  8. package/dist/cjs/schema/nodes/mention.js +0 -3
  9. package/dist/cjs/schema/nodes/paragraph.js +1 -1
  10. package/dist/cjs/utils/colors.js +7 -1
  11. package/dist/cjs/utils/editor-palette.js +38 -0
  12. package/dist/es2019/index.js +1 -1
  13. package/dist/es2019/schema/create-schema.js +4 -1
  14. package/dist/es2019/schema/index.js +1 -1
  15. package/dist/es2019/schema/marks/background-color.js +105 -0
  16. package/dist/es2019/schema/marks/index.js +2 -1
  17. package/dist/es2019/schema/marks/text-color.js +2 -2
  18. package/dist/es2019/schema/nodes/mention.js +0 -3
  19. package/dist/es2019/schema/nodes/paragraph.js +1 -1
  20. package/dist/es2019/utils/colors.js +6 -0
  21. package/dist/es2019/utils/editor-palette.js +36 -0
  22. package/dist/esm/index.js +1 -1
  23. package/dist/esm/schema/create-schema.js +4 -1
  24. package/dist/esm/schema/index.js +1 -1
  25. package/dist/esm/schema/marks/background-color.js +111 -0
  26. package/dist/esm/schema/marks/index.js +2 -1
  27. package/dist/esm/schema/marks/text-color.js +2 -2
  28. package/dist/esm/schema/nodes/mention.js +0 -3
  29. package/dist/esm/schema/nodes/paragraph.js +1 -1
  30. package/dist/esm/utils/colors.js +6 -0
  31. package/dist/esm/utils/editor-palette.js +36 -0
  32. package/dist/json-schema/v1/full.json +31 -0
  33. package/dist/json-schema/v1/stage-0.json +31 -0
  34. package/dist/types/index.d.ts +2 -2
  35. package/dist/types/schema/index.d.ts +2 -2
  36. package/dist/types/schema/marks/background-color.d.ts +15 -0
  37. package/dist/types/schema/marks/index.d.ts +2 -0
  38. package/dist/types/schema/marks/text-color.d.ts +3 -0
  39. package/dist/types/schema/nodes/types/inline-content.d.ts +2 -2
  40. package/dist/types/utils/colors.d.ts +6 -0
  41. package/dist/types/utils/editor-palette.d.ts +34 -0
  42. package/json-schema/v1/full.json +31 -0
  43. package/json-schema/v1/stage-0.json +31 -0
  44. package/package.json +2 -2
@@ -3,7 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
3
3
  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; }
4
4
  import { Schema } from '@atlaskit/editor-prosemirror/model';
5
5
  import { COLOR, FONT_STYLE, SEARCH_QUERY, LINK } from './groups';
6
- import { link, em, strong, textColor, strike, subsup, underline, code, typeAheadQuery, confluenceInlineComment, breakout, alignment, indentation, annotation, unsupportedMark, unsupportedNodeAttribute, dataConsumer, fragment, border } from './marks';
6
+ import { link, em, strong, textColor, strike, subsup, underline, code, typeAheadQuery, confluenceInlineComment, breakout, alignment, indentation, annotation, unsupportedMark, unsupportedNodeAttribute, dataConsumer, fragment, border, backgroundColor } from './marks';
7
7
  import { confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, doc, paragraph, text, bulletList, orderedListWithOrder, listItemWithTask, heading, blockquoteWithList, codeBlock, extendedPanel, rule, image, mention, media, mediaInline, mediaSingleFull, mediaGroup, hardBreak, emoji, table, tableCell, tableHeader, tableRow, decisionList, decisionItem, taskList, taskItem, unknownBlock, extension, inlineExtension, bodiedExtension, multiBodiedExtension, extensionFrame, date, placeholder, layoutSection, layoutColumn, inlineCard, blockCard, unsupportedBlock, unsupportedInline, status, expand, extendedNestedExpand, embedCard, caption } from './nodes';
8
8
  function addItems(builtInItems, config) {
9
9
  var customSpecs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
@@ -253,6 +253,9 @@ var marksInOrder = [{
253
253
  }, {
254
254
  name: 'border',
255
255
  spec: border
256
+ }, {
257
+ name: 'backgroundColor',
258
+ spec: backgroundColor
256
259
  }, {
257
260
  name: 'unsupportedMark',
258
261
  spec: unsupportedMark
@@ -1,6 +1,6 @@
1
1
  export { PanelType, blockCard, blockquote, blockquoteWithList, bodiedExtension, bulletList, bulletListSelector, caption, codeBlock, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, decisionItem, decisionList, decisionListSelector, doc, embedCard, emoji, expand, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineExtension, layoutColumn, layoutSection, layoutSectionWithSingleColumn, listItem, listItemWithTask, media, mediaGroup, mediaSingle, mediaSingleSpec, mediaInline, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, extendedNestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, extendedPanel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableStage0, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline, extensionFrame, multiBodiedExtension } from './nodes';
2
2
  export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
3
- colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette } from './marks';
3
+ colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, backgroundColor, backgroundColorPalette } from './marks';
4
4
  export { unsupportedNodeTypesForMediaCards } from './unsupported';
5
5
  export { inlineNodes } from './inline-nodes';
6
6
  export { sanitizeNodes, createSchema } from './create-schema';
@@ -0,0 +1,111 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import { hexToEditorTextBackgroundPaletteColor } from '../../utils/editor-palette';
4
+ import { COLOR } from '../groups';
5
+ import { rgbToHex, L200, T200, P200, M200, Neutral300, O200 } from '../../utils/colors';
6
+ import { getGlobalTheme } from './text-color';
7
+ import { getDarkModeLCHColor } from '../../utils/lch-color-inversion';
8
+
9
+ /**
10
+ * @name backgroundColor_mark
11
+ */
12
+
13
+ var colorArrayPalette = [[Neutral300, 'Gray'],
14
+ // token: color.background.accent.gray.subtler
15
+ [T200, 'Teal'],
16
+ // token: color.background.accent.teal.subtler
17
+ [L200, 'Lime'],
18
+ // token: color.background.accent.lime.subtler
19
+ [O200, 'Orange'],
20
+ // token: color.background.accent.orange.subtler
21
+ [M200, 'Magenta'],
22
+ // token: color.background.accent.magenta.subtler
23
+ [P200, 'Purple'] // token: color.background.accent.purple.subtler
24
+ ];
25
+
26
+ // @see https://product-fabric.atlassian.net/wiki/spaces/E/pages/55979455/Colour+picker+decisions#Colourpickerdecisions-Visualdesigndecisions
27
+ export var backgroundColorPalette = new Map();
28
+ colorArrayPalette.forEach(function (_ref) {
29
+ var _ref2 = _slicedToArray(_ref, 2),
30
+ color = _ref2[0],
31
+ label = _ref2[1];
32
+ return backgroundColorPalette.set(color.toLowerCase(), label);
33
+ });
34
+ export var backgroundColor = {
35
+ attrs: {
36
+ color: {}
37
+ },
38
+ inclusive: true,
39
+ group: COLOR,
40
+ parseDOM: [{
41
+ style: 'background-color',
42
+ getAttrs: function getAttrs(maybeValue) {
43
+ var value = maybeValue;
44
+ var hexColor;
45
+ if (value.match(/^rgb/i)) {
46
+ hexColor = rgbToHex(value);
47
+ } else if (value[0] === '#') {
48
+ hexColor = value.toLowerCase();
49
+ }
50
+ // else handle other colour formats
51
+ return hexColor && backgroundColorPalette.has(hexColor) ? {
52
+ color: hexColor
53
+ } : false;
54
+ }
55
+ },
56
+ // This rule ensures when loading from a renderer or editor where the
57
+ // presented text color does not match the stored hex color -- that the
58
+ // text color is preserved.
59
+ //
60
+ // This is used to support the work-around that converts the hex color to
61
+ // a design system token to enable light / dark mode (through a CSS variable --custom-palette-color)
62
+ {
63
+ tag: '.fabric-background-color-mark',
64
+ getAttrs: function getAttrs(maybeElement) {
65
+ if (!(maybeElement instanceof HTMLElement)) {
66
+ return false;
67
+ }
68
+ var hexColor = maybeElement.dataset.backgroundCustomColor;
69
+ return hexColor && backgroundColorPalette.has(hexColor) ? {
70
+ color: hexColor
71
+ } : false;
72
+ }
73
+ }],
74
+ toDOM: function toDOM(mark) {
75
+ var paletteColorValue;
76
+ /**
77
+ * Documents can contain custom colors when content has been migrated from the old editor, or created via APIs.
78
+ *
79
+ * This behaviour predates the introduction of dark mode.
80
+ *
81
+ * Without the inversion logic below, text with custom colors, can be hard to read when the user loads the page in dark mode.
82
+ *
83
+ * This introduces inversion of the presentation of the custom text colors when the user is in dark mode.
84
+ *
85
+ * This can be done without additional changes to account for users copying and pasting content inside the Editor, because of
86
+ * how we detect text colors copied from external editor sources. Where we load the background color from a
87
+ * separate attribute (data-text-custom-color), instead of the inline style.
88
+ *
89
+ * See the following document for more details on this behaviour
90
+ * https://hello.atlassian.net/wiki/spaces/CCECO/pages/2908658046/Unsupported+custom+text+colors+in+dark+theme+Editor+Job+Story
91
+ */
92
+ var tokenColor = hexToEditorTextBackgroundPaletteColor(mark.attrs.color);
93
+ if (tokenColor) {
94
+ paletteColorValue = tokenColor;
95
+ } else {
96
+ if (getGlobalTheme().colorMode === 'dark') {
97
+ // if we have a custom color, we need to check if we are in dark mode
98
+ paletteColorValue = getDarkModeLCHColor(mark.attrs.color);
99
+ } else {
100
+ // if we are in light mode, we can just set the color
101
+ paletteColorValue = mark.attrs.color;
102
+ }
103
+ }
104
+ return ['span', _defineProperty({
105
+ class: 'fabric-background-color-mark',
106
+ // Editor common has a common style which uses this css variable as the value for
107
+ // the color property using the `fabric-text-background-color-mark` selector applied above.
108
+ style: "--custom-palette-color: ".concat(paletteColorValue)
109
+ }, 'data-background-custom-color', mark.attrs.color)];
110
+ }
111
+ };
@@ -16,4 +16,5 @@ export { unsupportedMark } from './unsupported-mark';
16
16
  export { unsupportedNodeAttribute } from './unsupported-node-attributes';
17
17
  export { dataConsumer, toJSON as dataConsumerToJSON } from './data-consumer';
18
18
  export { fragment, toJSON as fragmentToJSON } from './fragment';
19
- export { border, borderColorPalette } from './border';
19
+ export { border, borderColorPalette } from './border';
20
+ export { backgroundColor, backgroundColorPalette } from './background-color';
@@ -73,7 +73,7 @@ export var setGlobalTheme = function setGlobalTheme(theme) {
73
73
  // This is a minimal duplication of the method from @atlaskit/tokens
74
74
  // to minimise the number of dependencies required as these changes are expected
75
75
  // to be patched onto CR8.
76
- var getGlobalTheme = function getGlobalTheme() {
76
+ export var getGlobalTheme = function getGlobalTheme() {
77
77
  // This should only be hit during tests.
78
78
  //
79
79
  // At time of writing Jest mocks are not working in this repository.
@@ -155,7 +155,7 @@ export var textColor = {
155
155
  */
156
156
  var tokenColor = hexToEditorTextPaletteColor(mark.attrs.color);
157
157
  if (tokenColor) {
158
- paletteColorValue = hexToEditorTextPaletteColor(mark.attrs.color) || mark.attrs.color;
158
+ paletteColorValue = tokenColor;
159
159
  } else {
160
160
  if (getGlobalTheme().colorMode === 'dark') {
161
161
  // if we have a custom color, we need to check if we are in dark mode
@@ -29,9 +29,6 @@ export var mention = {
29
29
  userType: {
30
30
  default: null
31
31
  },
32
- /**
33
- * @stage 0
34
- */
35
32
  localId: {
36
33
  default: null
37
34
  }
@@ -28,7 +28,7 @@ export var paragraph = {
28
28
  selectable: false,
29
29
  content: 'inline*',
30
30
  group: 'block',
31
- marks: 'strong code em link border strike subsup textColor typeAheadQuery underline confluenceInlineComment action annotation unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
31
+ marks: 'strong code em link border strike subsup textColor typeAheadQuery underline confluenceInlineComment action annotation unsupportedMark unsupportedNodeAttribute dataConsumer fragment backgroundColor',
32
32
  parseDOM: [{
33
33
  tag: 'p'
34
34
  }],
@@ -30,6 +30,7 @@ export var B75 = '#B3D4FF';
30
30
  export var B100 = '#4C9AFF';
31
31
  export var B400 = '#0052CC';
32
32
  export var B500 = '#0747A6';
33
+ export var L200 = '#D3F1A7';
33
34
  export var N0 = '#FFFFFF';
34
35
  export var N20 = '#F4F5F7';
35
36
  export var N30 = '#EBECF0';
@@ -40,20 +41,25 @@ export var N80 = '#97A0AF';
40
41
  export var N90 = '#8993A4';
41
42
  export var N200 = '#6B778C';
42
43
  export var N300 = '#5E6C84';
44
+ export var Neutral300 = '#DCDFE4';
43
45
  export var N300A = '#091E4224';
44
46
  export var N500 = '#42526E';
45
47
  export var N600 = '#758195';
46
48
  export var N800 = '#172B4D';
47
49
  export var N1000 = '#172B4D';
50
+ export var M200 = '#FDD0EC';
51
+ export var O200 = '#FEDEC8';
48
52
  export var P50 = '#EAE6FF';
49
53
  export var P75 = '#C0B6F2';
50
54
  export var P100 = '#998DD9';
55
+ export var P200 = '#DFD8FD';
51
56
  export var P300 = '#6554C0';
52
57
  export var P400 = '#5243AA';
53
58
  export var P500 = '#403294';
54
59
  export var T50 = '#E6FCFF';
55
60
  export var T75 = '#B3F5FF';
56
61
  export var T100 = '#79E2F2';
62
+ export var T200 = '#C6EDFB';
57
63
  export var T300 = '#00B8D9';
58
64
  export var T500 = '#008DA6';
59
65
 
@@ -96,6 +96,42 @@ export var editorTextPalette = {
96
96
  '#172B4D': 'var(--ds-text, #172B4D)'
97
97
  };
98
98
 
99
+ /**
100
+ * This takes an ADF hex color and returns a matching text background palette color.
101
+ *
102
+ * By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
103
+ *
104
+ * Example usage
105
+ * ```tsx
106
+ * const cssValue = hexToEditorTextBackgroundPaletteColor('#0747A6');
107
+ * // ^? const cssValue: string
108
+ * <span style={{backgroundColor: cssValue}} />
109
+ * ```
110
+ * The names of tokens can change over time, and the values of tokens will differ between themes.
111
+ * The exact output of this function is an implementation detail and should only be used when rendering
112
+ * content to the user, on a client with a matching major version of `@atlaskit/tokens`.
113
+ * - **DO NOT**: store the output of these functions in any user-generated content or back-end.
114
+ * - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
115
+ */
116
+ export function hexToEditorTextBackgroundPaletteColor(hexColor) {
117
+ // Ts ignore was used to allow use of conditional return type
118
+ // (preferring better type on consumption over safety in implementation)
119
+ return textBackgroundColorPalette[hexColor.toUpperCase()];
120
+ }
121
+ export var textBackgroundColorPalette = {
122
+ /** Gray - light */
123
+ '#DCDFE4': 'var(--ds-background-accent-gray-subtler, #DCDFE4)',
124
+ /** Teal - light */
125
+ '#C6EDFB': 'var(--ds-background-accent-teal-subtler, #C6EDFB)',
126
+ /** Lime - light */
127
+ '#D3F1A7': 'var(--ds-background-accent-lime-subtler, #D3F1A7)',
128
+ /** Orange - light */
129
+ '#FEDEC8': 'var(--ds-background-accent-orange-subtler, #FEDEC8)',
130
+ /** Magenta - light */
131
+ '#FDD0EC': 'var(--ds-background-accent-magenta-subtler, #FDD0EC)',
132
+ /** Purple - light */
133
+ '#DFD8FD': 'var(--ds-background-accent-purple-subtler, #DFD8FD)'
134
+ };
99
135
  /**
100
136
  * Takes an ADF hex color and returns the rendered hex code for the associated background palette design token using getTokenValue.
101
137
  * If the provided color does not exist in the Editor color palette, this function returns undefined.
@@ -492,6 +492,34 @@
492
492
  ],
493
493
  "additionalProperties": false
494
494
  },
495
+ "backgroundColor_mark": {
496
+ "type": "object",
497
+ "properties": {
498
+ "type": {
499
+ "enum": [
500
+ "backgroundColor"
501
+ ]
502
+ },
503
+ "attrs": {
504
+ "type": "object",
505
+ "properties": {
506
+ "color": {
507
+ "type": "string",
508
+ "pattern": "^#[0-9a-fA-F]{6}$"
509
+ }
510
+ },
511
+ "required": [
512
+ "color"
513
+ ],
514
+ "additionalProperties": false
515
+ }
516
+ },
517
+ "required": [
518
+ "type",
519
+ "attrs"
520
+ ],
521
+ "additionalProperties": false
522
+ },
495
523
  "hardBreak_node": {
496
524
  "type": "object",
497
525
  "properties": {
@@ -1106,6 +1134,9 @@
1106
1134
  },
1107
1135
  {
1108
1136
  "$ref": "#/definitions/annotation_mark"
1137
+ },
1138
+ {
1139
+ "$ref": "#/definitions/backgroundColor_mark"
1109
1140
  }
1110
1141
  ]
1111
1142
  }
@@ -492,6 +492,34 @@
492
492
  ],
493
493
  "additionalProperties": false
494
494
  },
495
+ "backgroundColor_mark": {
496
+ "type": "object",
497
+ "properties": {
498
+ "type": {
499
+ "enum": [
500
+ "backgroundColor"
501
+ ]
502
+ },
503
+ "attrs": {
504
+ "type": "object",
505
+ "properties": {
506
+ "color": {
507
+ "type": "string",
508
+ "pattern": "^#[0-9a-fA-F]{6}$"
509
+ }
510
+ },
511
+ "required": [
512
+ "color"
513
+ ],
514
+ "additionalProperties": false
515
+ }
516
+ },
517
+ "required": [
518
+ "type",
519
+ "attrs"
520
+ ],
521
+ "additionalProperties": false
522
+ },
495
523
  "hardBreak_node": {
496
524
  "type": "object",
497
525
  "properties": {
@@ -1112,6 +1140,9 @@
1112
1140
  },
1113
1141
  {
1114
1142
  "$ref": "#/definitions/annotation_mark"
1143
+ },
1144
+ {
1145
+ "$ref": "#/definitions/backgroundColor_mark"
1115
1146
  }
1116
1147
  ]
1117
1148
  }
@@ -1,6 +1,6 @@
1
1
  export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockquote, blockquoteWithList, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette,
2
2
  /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
3
- colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, layoutColumn, layoutSection, link, linkToJSON, listItem, listItemWithTask, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleSpec, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, extendedNestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, extendedPanel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableStage0, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, extensionFrame, multiBodiedExtension, } from './schema';
4
- export type { AlignmentAttributes, AlignmentMarkDefinition, AnnotationMarkAttributes, AnnotationMarkDefinition, BlockCardDefinition, BlockContent, BlockQuoteDefinition, BodiedExtensionDefinition, BreakoutMarkAttrs, BreakoutMarkDefinition, BulletListDefinition, CaptionDefinition, CardAttributes, CellAttributes, CodeBlockAttrs, CodeBlockBaseDefinition, CodeBlockDefinition, CodeBlockWithMarksDefinition, CodeDefinition, DatasourceAttributes, DatasourceAttributeProperties, DataConsumerAttributes, DataConsumerDefinition, DataType, DateDefinition, DecisionItemDefinition, DecisionListDefinition, DocNode, EmbedCardDefinition, EmbedCardAttributes, EmDefinition, EmojiAttributes, EmojiDefinition, ExpandDefinition, ExtensionDefinition, ExtensionLayout, ExternalMediaAttributes, FragmentAttributes, FragmentDefinition, HardBreakDefinition, HeadingBaseDefinition, HeadingDefinition, HeadingWithAlignmentDefinition, HeadingWithIndentationDefinition, HeadingWithMarksDefinition, IndentationMarkAttributes, IndentationMarkDefinition, Inline, InlineAtomic, InlineCardDefinition, InlineCode, InlineExtensionDefinition, InlineFormattedText, InlineLinkText, LayoutColumnDefinition, LayoutSectionDefinition, LayoutSectionFullDefinition, LayoutSectionWithSingleColumnDefinition, LinkAttributes, LinkDefinition, ListItemArray, ListItemDefinition, MarksObject, MediaADFAttrs, MediaAttributes, MediaInlineAttributes, MediaInlineDefinition, MediaBaseAttributes, MediaDefinition, MediaDisplayType, MediaGroupDefinition, MediaSingleDefinition, MediaType, MentionAttributes, MentionDefinition, MentionUserType, NestedExpandContent, NestedExpandDefinition, NoMark, NonNestableBlockContent, OrderedListDefinition, PanelAttributes, PanelDefinition, ParagraphBaseDefinition, ParagraphDefinition, ParagraphWithAlignmentDefinition, ParagraphWithIndentationDefinition, ParagraphWithMarksDefinition, PlaceholderDefinition, RuleDefinition, StatusDefinition, StrikeDefinition, StrongDefinition, SubSupAttributes, SubSupDefinition, TableAttributes, TableCellDefinition, TableDefinition, TableDisplayMode, TableHeaderDefinition, TableLayout, TableRowDefinition, TaskItemDefinition, TaskListContent, TaskListDefinition, TextColorAttributes, TextColorDefinition, TextDefinition, UnderlineDefinition, UrlType, AnnotationId, RichMediaAttributes, ExtendedMediaAttributes, RichMediaLayout, AnnotationDataAttributes, CellDomAttrs, BorderMarkAttributes, BorderMarkDefinition, MultiBodiedExtensionDefinition, ExtensionFrameDefinition, } from './schema';
3
+ colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, layoutColumn, layoutSection, link, linkToJSON, listItem, listItemWithTask, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleSpec, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, extendedNestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, extendedPanel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableStage0, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, extensionFrame, multiBodiedExtension, backgroundColor, backgroundColorPalette, } from './schema';
4
+ export type { AlignmentAttributes, AlignmentMarkDefinition, AnnotationMarkAttributes, AnnotationMarkDefinition, BlockCardDefinition, BlockContent, BlockQuoteDefinition, BodiedExtensionDefinition, BreakoutMarkAttrs, BreakoutMarkDefinition, BulletListDefinition, CaptionDefinition, CardAttributes, CellAttributes, CodeBlockAttrs, CodeBlockBaseDefinition, CodeBlockDefinition, CodeBlockWithMarksDefinition, CodeDefinition, DatasourceAttributes, DatasourceAttributeProperties, DataConsumerAttributes, DataConsumerDefinition, DataType, DateDefinition, DecisionItemDefinition, DecisionListDefinition, DocNode, EmbedCardDefinition, EmbedCardAttributes, EmDefinition, EmojiAttributes, EmojiDefinition, ExpandDefinition, ExtensionDefinition, ExtensionLayout, ExternalMediaAttributes, FragmentAttributes, FragmentDefinition, HardBreakDefinition, HeadingBaseDefinition, HeadingDefinition, HeadingWithAlignmentDefinition, HeadingWithIndentationDefinition, HeadingWithMarksDefinition, IndentationMarkAttributes, IndentationMarkDefinition, Inline, InlineAtomic, InlineCardDefinition, InlineCode, InlineExtensionDefinition, InlineFormattedText, InlineLinkText, LayoutColumnDefinition, LayoutSectionDefinition, LayoutSectionFullDefinition, LayoutSectionWithSingleColumnDefinition, LinkAttributes, LinkDefinition, ListItemArray, ListItemDefinition, MarksObject, MediaADFAttrs, MediaAttributes, MediaInlineAttributes, MediaInlineDefinition, MediaBaseAttributes, MediaDefinition, MediaDisplayType, MediaGroupDefinition, MediaSingleDefinition, MediaType, MentionAttributes, MentionDefinition, MentionUserType, NestedExpandContent, NestedExpandDefinition, NoMark, NonNestableBlockContent, OrderedListDefinition, PanelAttributes, PanelDefinition, ParagraphBaseDefinition, ParagraphDefinition, ParagraphWithAlignmentDefinition, ParagraphWithIndentationDefinition, ParagraphWithMarksDefinition, PlaceholderDefinition, RuleDefinition, StatusDefinition, StrikeDefinition, StrongDefinition, SubSupAttributes, SubSupDefinition, TableAttributes, TableCellDefinition, TableDefinition, TableDisplayMode, TableHeaderDefinition, TableLayout, TableRowDefinition, TaskItemDefinition, TaskListContent, TaskListDefinition, TextColorAttributes, TextColorDefinition, TextDefinition, UnderlineDefinition, UrlType, AnnotationId, RichMediaAttributes, ExtendedMediaAttributes, RichMediaLayout, AnnotationDataAttributes, CellDomAttrs, BorderMarkAttributes, BorderMarkDefinition, MultiBodiedExtensionDefinition, ExtensionFrameDefinition, BackgroundColorDefinition, } from './schema';
5
5
  export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, linkify, linkifyMatch, normalizeHexColor, normalizeUrl, rgbToHex, uuid, getDarkModeLCHColor, } from './utils';
6
6
  export type { Match, NameToEmoji } from './utils';
@@ -2,8 +2,8 @@ export { PanelType, blockCard, blockquote, blockquoteWithList, bodiedExtension,
2
2
  export type { BlockCardDefinition, BlockContent, BlockQuoteDefinition, BodiedExtensionDefinition, BulletListDefinition, CaptionDefinition, CardAttributes, CellAttributes, CodeBlockAttrs, CodeBlockBaseDefinition, CodeBlockDefinition, CodeBlockWithMarksDefinition, DatasourceAttributes, DatasourceAttributeProperties, DataType, DateDefinition, DecisionItemDefinition, DecisionListDefinition, DocNode, EmbedCardDefinition, EmbedCardAttributes, EmojiAttributes, EmojiDefinition, ExpandDefinition, ExtensionDefinition, ExtensionLayout, ExternalMediaAttributes, HardBreakDefinition, HeadingBaseDefinition, HeadingDefinition, HeadingWithAlignmentDefinition, HeadingWithIndentationDefinition, HeadingWithMarksDefinition, Inline, InlineAtomic, InlineCardDefinition, InlineCode, InlineExtensionDefinition, InlineFormattedText, InlineLinkText, LayoutColumnDefinition, LayoutSectionDefinition, LayoutSectionBaseDefinition, LayoutSectionFullDefinition, LayoutSectionWithSingleColumnDefinition, ListItemArray, ListItemDefinition, MarksObject, MediaADFAttrs, MediaAttributes, MediaInlineAttributes, MediaInlineDefinition, MediaBaseAttributes, MediaDefinition, MediaDisplayType, MediaGroupDefinition, MediaSingleDefinition, MediaType, MentionAttributes, MentionDefinition, MentionUserType, NestedExpandContent, NestedExpandDefinition, NoMark, NonNestableBlockContent, OrderedListDefinition, PanelAttributes, PanelDefinition, ParagraphBaseDefinition, ParagraphDefinition, ParagraphWithAlignmentDefinition, ParagraphWithIndentationDefinition, ParagraphWithMarksDefinition, PlaceholderDefinition, RuleDefinition, StatusDefinition, TableAttributes, TableCellDefinition, TableDefinition, TableDisplayMode, TableHeaderDefinition, TableLayout, TableRowDefinition, TaskItemDefinition, TaskListContent, TaskListDefinition, TextDefinition, UrlType, RichMediaAttributes, ExtendedMediaAttributes, RichMediaLayout, CellDomAttrs, ExtensionFrameDefinition, MultiBodiedExtensionDefinition, } from './nodes';
3
3
  export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette,
4
4
  /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
5
- colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, } from './marks';
6
- export type { AlignmentAttributes, AlignmentMarkDefinition, AnnotationMarkAttributes, AnnotationMarkDefinition, BreakoutMarkAttrs, BreakoutMarkDefinition, CodeDefinition, EmDefinition, FragmentAttributes, FragmentDefinition, IndentationMarkAttributes, IndentationMarkDefinition, LinkAttributes, LinkDefinition, StrikeDefinition, StrongDefinition, SubSupAttributes, SubSupDefinition, TextColorAttributes, TextColorDefinition, UnderlineDefinition, AnnotationId, AnnotationDataAttributes, DataConsumerAttributes, DataConsumerDefinition, BorderMarkAttributes, BorderMarkDefinition, } from './marks';
5
+ colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, backgroundColor, backgroundColorPalette, } from './marks';
6
+ export type { AlignmentAttributes, AlignmentMarkDefinition, AnnotationMarkAttributes, AnnotationMarkDefinition, BreakoutMarkAttrs, BreakoutMarkDefinition, CodeDefinition, EmDefinition, FragmentAttributes, FragmentDefinition, IndentationMarkAttributes, IndentationMarkDefinition, LinkAttributes, LinkDefinition, StrikeDefinition, StrongDefinition, SubSupAttributes, SubSupDefinition, TextColorAttributes, TextColorDefinition, UnderlineDefinition, AnnotationId, AnnotationDataAttributes, DataConsumerAttributes, DataConsumerDefinition, BorderMarkAttributes, BorderMarkDefinition, BackgroundColorDefinition, } from './marks';
7
7
  export { unsupportedNodeTypesForMediaCards } from './unsupported';
8
8
  export { inlineNodes } from './inline-nodes';
9
9
  export { sanitizeNodes, createSchema } from './create-schema';
@@ -0,0 +1,15 @@
1
+ import { Mark, MarkSpec } from '@atlaskit/editor-prosemirror/model';
2
+ import { TextColorAttributes } from './text-color';
3
+ /**
4
+ * @name backgroundColor_mark
5
+ */
6
+ export interface BackgroundColorDefinition {
7
+ type: 'backgroundColor';
8
+ attrs: TextColorAttributes;
9
+ }
10
+ export interface BackgroundColorMark extends Mark {
11
+ attrs: TextColorAttributes;
12
+ }
13
+ export type BackgroundColorKey = 'Gray' | 'Teal' | 'Lime' | 'Orange' | 'Magenta' | 'Purple';
14
+ export declare const backgroundColorPalette: Map<string, BackgroundColorKey>;
15
+ export declare const backgroundColor: MarkSpec;
@@ -32,3 +32,5 @@ export type { FragmentAttributes, FragmentDefinition, LocalId, } from './fragmen
32
32
  export { fragment, toJSON as fragmentToJSON } from './fragment';
33
33
  export { border, borderColorPalette } from './border';
34
34
  export type { BorderMarkAttributes, BorderMarkDefinition } from './border';
35
+ export { backgroundColor, backgroundColorPalette } from './background-color';
36
+ export type { BackgroundColorDefinition } from './background-color';
@@ -20,4 +20,7 @@ export declare const colorPalette: Map<string, TextColorKey>;
20
20
  /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
21
21
  export declare const colorPaletteExtended: Map<string, TextColorKey>;
22
22
  export declare const setGlobalTheme: (theme: string) => void;
23
+ export declare const getGlobalTheme: () => {
24
+ colorMode: string;
25
+ };
23
26
  export declare const textColor: MarkSpec;
@@ -8,12 +8,12 @@ import { InlineCardDefinition as InlineCard } from '../inline-card';
8
8
  import { StatusDefinition as Status } from '../status';
9
9
  import { TextDefinition as Text } from '../text';
10
10
  import { MarksObject } from './mark';
11
- import { AnnotationMarkDefinition as Annotation, CodeDefinition as Code, EmDefinition as Em, LinkDefinition as Link, StrikeDefinition as Strike, StrongDefinition as Strong, SubSupDefinition as SubSup, TextColorDefinition as TextColor, UnderlineDefinition as Underline } from '../../marks';
11
+ import { AnnotationMarkDefinition as Annotation, CodeDefinition as Code, EmDefinition as Em, LinkDefinition as Link, StrikeDefinition as Strike, StrongDefinition as Strong, SubSupDefinition as SubSup, TextColorDefinition as TextColor, UnderlineDefinition as Underline, BackgroundColorDefinition as BackgroundColor } from '../../marks';
12
12
  import { MediaInlineDefinition } from '../media-inline';
13
13
  /**
14
14
  * @name formatted_text_inline_node
15
15
  */
16
- export type InlineFormattedText = Text & MarksObject<Link | Em | Strong | Strike | SubSup | Underline | TextColor | Annotation>;
16
+ export type InlineFormattedText = Text & MarksObject<Link | Em | Strong | Strike | SubSup | Underline | TextColor | Annotation | BackgroundColor>;
17
17
  /**
18
18
  * @name link_text_inline_node
19
19
  */
@@ -26,6 +26,7 @@ export declare const B75 = "#B3D4FF";
26
26
  export declare const B100 = "#4C9AFF";
27
27
  export declare const B400 = "#0052CC";
28
28
  export declare const B500 = "#0747A6";
29
+ export declare const L200 = "#D3F1A7";
29
30
  export declare const N0 = "#FFFFFF";
30
31
  export declare const N20 = "#F4F5F7";
31
32
  export declare const N30 = "#EBECF0";
@@ -36,20 +37,25 @@ export declare const N80 = "#97A0AF";
36
37
  export declare const N90 = "#8993A4";
37
38
  export declare const N200 = "#6B778C";
38
39
  export declare const N300 = "#5E6C84";
40
+ export declare const Neutral300 = "#DCDFE4";
39
41
  export declare const N300A = "#091E4224";
40
42
  export declare const N500 = "#42526E";
41
43
  export declare const N600 = "#758195";
42
44
  export declare const N800 = "#172B4D";
43
45
  export declare const N1000 = "#172B4D";
46
+ export declare const M200 = "#FDD0EC";
47
+ export declare const O200 = "#FEDEC8";
44
48
  export declare const P50 = "#EAE6FF";
45
49
  export declare const P75 = "#C0B6F2";
46
50
  export declare const P100 = "#998DD9";
51
+ export declare const P200 = "#DFD8FD";
47
52
  export declare const P300 = "#6554C0";
48
53
  export declare const P400 = "#5243AA";
49
54
  export declare const P500 = "#403294";
50
55
  export declare const T50 = "#E6FCFF";
51
56
  export declare const T75 = "#B3F5FF";
52
57
  export declare const T100 = "#79E2F2";
58
+ export declare const T200 = "#C6EDFB";
53
59
  export declare const T300 = "#00B8D9";
54
60
  export declare const T500 = "#008DA6";
55
61
  /**
@@ -90,6 +90,40 @@ export declare const editorTextPalette: {
90
90
  /** whiteGray - strong */
91
91
  '#172B4D': string;
92
92
  };
93
+ /**
94
+ * This takes an ADF hex color and returns a matching text background palette color.
95
+ *
96
+ * By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
97
+ *
98
+ * Example usage
99
+ * ```tsx
100
+ * const cssValue = hexToEditorTextBackgroundPaletteColor('#0747A6');
101
+ * // ^? const cssValue: string
102
+ * <span style={{backgroundColor: cssValue}} />
103
+ * ```
104
+ * The names of tokens can change over time, and the values of tokens will differ between themes.
105
+ * The exact output of this function is an implementation detail and should only be used when rendering
106
+ * content to the user, on a client with a matching major version of `@atlaskit/tokens`.
107
+ * - **DO NOT**: store the output of these functions in any user-generated content or back-end.
108
+ * - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
109
+ */
110
+ export declare function hexToEditorTextBackgroundPaletteColor<HexColor extends string>(hexColor: HexColor): HexColor extends TextBackgroundColorPaletteKey ? TextBackgroundColorPalette[HexColor] : string | undefined;
111
+ export declare const textBackgroundColorPalette: {
112
+ /** Gray - light */
113
+ '#DCDFE4': string;
114
+ /** Teal - light */
115
+ '#C6EDFB': string;
116
+ /** Lime - light */
117
+ '#D3F1A7': string;
118
+ /** Orange - light */
119
+ '#FEDEC8': string;
120
+ /** Magenta - light */
121
+ '#FDD0EC': string;
122
+ /** Purple - light */
123
+ '#DFD8FD': string;
124
+ };
125
+ type TextBackgroundColorPalette = typeof textBackgroundColorPalette;
126
+ export type TextBackgroundColorPaletteKey = keyof TextBackgroundColorPalette;
93
127
  /**
94
128
  * Takes an ADF hex color and returns the rendered hex code for the associated background palette design token using getTokenValue.
95
129
  * If the provided color does not exist in the Editor color palette, this function returns undefined.
@@ -492,6 +492,34 @@
492
492
  ],
493
493
  "additionalProperties": false
494
494
  },
495
+ "backgroundColor_mark": {
496
+ "type": "object",
497
+ "properties": {
498
+ "type": {
499
+ "enum": [
500
+ "backgroundColor"
501
+ ]
502
+ },
503
+ "attrs": {
504
+ "type": "object",
505
+ "properties": {
506
+ "color": {
507
+ "type": "string",
508
+ "pattern": "^#[0-9a-fA-F]{6}$"
509
+ }
510
+ },
511
+ "required": [
512
+ "color"
513
+ ],
514
+ "additionalProperties": false
515
+ }
516
+ },
517
+ "required": [
518
+ "type",
519
+ "attrs"
520
+ ],
521
+ "additionalProperties": false
522
+ },
495
523
  "hardBreak_node": {
496
524
  "type": "object",
497
525
  "properties": {
@@ -1106,6 +1134,9 @@
1106
1134
  },
1107
1135
  {
1108
1136
  "$ref": "#/definitions/annotation_mark"
1137
+ },
1138
+ {
1139
+ "$ref": "#/definitions/backgroundColor_mark"
1109
1140
  }
1110
1141
  ]
1111
1142
  }
@@ -492,6 +492,34 @@
492
492
  ],
493
493
  "additionalProperties": false
494
494
  },
495
+ "backgroundColor_mark": {
496
+ "type": "object",
497
+ "properties": {
498
+ "type": {
499
+ "enum": [
500
+ "backgroundColor"
501
+ ]
502
+ },
503
+ "attrs": {
504
+ "type": "object",
505
+ "properties": {
506
+ "color": {
507
+ "type": "string",
508
+ "pattern": "^#[0-9a-fA-F]{6}$"
509
+ }
510
+ },
511
+ "required": [
512
+ "color"
513
+ ],
514
+ "additionalProperties": false
515
+ }
516
+ },
517
+ "required": [
518
+ "type",
519
+ "attrs"
520
+ ],
521
+ "additionalProperties": false
522
+ },
495
523
  "hardBreak_node": {
496
524
  "type": "object",
497
525
  "properties": {
@@ -1112,6 +1140,9 @@
1112
1140
  },
1113
1141
  {
1114
1142
  "$ref": "#/definitions/annotation_mark"
1143
+ },
1144
+ {
1145
+ "$ref": "#/definitions/backgroundColor_mark"
1115
1146
  }
1116
1147
  ]
1117
1148
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "35.10.0",
3
+ "version": "35.12.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/"
@@ -41,7 +41,7 @@
41
41
  "memoize-one": "^6.0.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@atlassian/adf-schema-json": "^1.8.0",
44
+ "@atlassian/adf-schema-json": "^1.10.0",
45
45
  "@babel/cli": "^7.22.9",
46
46
  "@babel/core": "^7.22.9",
47
47
  "@babel/plugin-proposal-class-properties": "^7.18.6",