@atlaskit/adf-schema 35.2.0 → 35.4.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 (36) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/index.js +12 -0
  3. package/dist/cjs/schema/create-schema.js +2 -2
  4. package/dist/cjs/schema/index.js +12 -0
  5. package/dist/cjs/schema/marks/text-color.js +1 -37
  6. package/dist/cjs/schema/nodes/index.js +12 -0
  7. package/dist/cjs/schema/nodes/list-item.js +20 -2
  8. package/dist/cjs/schema/nodes/panel.js +33 -2
  9. package/dist/cjs/schema/nodes/tableNodes.js +1 -37
  10. package/dist/es2019/index.js +1 -1
  11. package/dist/es2019/schema/create-schema.js +3 -3
  12. package/dist/es2019/schema/index.js +1 -1
  13. package/dist/es2019/schema/marks/text-color.js +2 -38
  14. package/dist/es2019/schema/nodes/index.js +2 -2
  15. package/dist/es2019/schema/nodes/list-item.js +17 -0
  16. package/dist/es2019/schema/nodes/panel.js +28 -0
  17. package/dist/es2019/schema/nodes/tableNodes.js +1 -37
  18. package/dist/esm/index.js +1 -1
  19. package/dist/esm/schema/create-schema.js +3 -3
  20. package/dist/esm/schema/index.js +1 -1
  21. package/dist/esm/schema/marks/text-color.js +2 -38
  22. package/dist/esm/schema/nodes/index.js +2 -2
  23. package/dist/esm/schema/nodes/list-item.js +17 -0
  24. package/dist/esm/schema/nodes/panel.js +30 -0
  25. package/dist/esm/schema/nodes/tableNodes.js +1 -37
  26. package/dist/json-schema/v1/full.json +217 -193
  27. package/dist/json-schema/v1/stage-0.json +224 -200
  28. package/dist/types/index.d.ts +1 -1
  29. package/dist/types/schema/index.d.ts +1 -1
  30. package/dist/types/schema/nodes/index.d.ts +2 -2
  31. package/dist/types/schema/nodes/list-item.d.ts +5 -0
  32. package/dist/types/schema/nodes/panel.d.ts +14 -1
  33. package/dist/types/schema/nodes/types/list.d.ts +2 -1
  34. package/json-schema/v1/full.json +217 -193
  35. package/json-schema/v1/stage-0.json +224 -200
  36. package/package.json +2 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 35.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d915d07: EDF-26 Cleaned up platform.editor.use-lch-for-color-inversion_1qv8ol flag and removed platform feature flags as a package dependency as it is no longer used. Text and table cell background colors will now use the LCH inversion method in dark mode by default.
8
+
9
+ ## 35.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 529022b: ED-21611: Adding node-nesting rules for task inside list, and media, codeblock, rule, action and decision inside panel.
14
+
3
15
  ## 35.2.0
4
16
 
5
17
  ### Minor Changes
package/dist/cjs/index.js CHANGED
@@ -531,6 +531,12 @@ Object.defineProperty(exports, "expandToJSON", {
531
531
  return _schema.expandToJSON;
532
532
  }
533
533
  });
534
+ Object.defineProperty(exports, "extendedPanel", {
535
+ enumerable: true,
536
+ get: function get() {
537
+ return _schema.extendedPanel;
538
+ }
539
+ });
534
540
  Object.defineProperty(exports, "extension", {
535
541
  enumerable: true,
536
542
  get: function get() {
@@ -705,6 +711,12 @@ Object.defineProperty(exports, "listItem", {
705
711
  return _schema.listItem;
706
712
  }
707
713
  });
714
+ Object.defineProperty(exports, "listItemWithTask", {
715
+ enumerable: true,
716
+ get: function get() {
717
+ return _schema.listItemWithTask;
718
+ }
719
+ });
708
720
  Object.defineProperty(exports, "media", {
709
721
  enumerable: true,
710
722
  get: function get() {
@@ -81,7 +81,7 @@ var nodesInOrder = [{
81
81
  spec: _nodes.orderedListWithOrder
82
82
  }, {
83
83
  name: 'listItem',
84
- spec: _nodes.listItem
84
+ spec: _nodes.listItemWithTask
85
85
  }, {
86
86
  name: 'heading',
87
87
  spec: _nodes.heading
@@ -93,7 +93,7 @@ var nodesInOrder = [{
93
93
  spec: _nodes.codeBlock
94
94
  }, {
95
95
  name: 'panel',
96
- spec: (0, _nodes.panel)(true)
96
+ spec: (0, _nodes.extendedPanel)(true)
97
97
  }, {
98
98
  name: 'rule',
99
99
  spec: _nodes.rule
@@ -243,6 +243,12 @@ Object.defineProperty(exports, "expandToJSON", {
243
243
  return _nodes.expandToJSON;
244
244
  }
245
245
  });
246
+ Object.defineProperty(exports, "extendedPanel", {
247
+ enumerable: true,
248
+ get: function get() {
249
+ return _nodes.extendedPanel;
250
+ }
251
+ });
246
252
  Object.defineProperty(exports, "extension", {
247
253
  enumerable: true,
248
254
  get: function get() {
@@ -357,6 +363,12 @@ Object.defineProperty(exports, "listItem", {
357
363
  return _nodes.listItem;
358
364
  }
359
365
  });
366
+ Object.defineProperty(exports, "listItemWithTask", {
367
+ enumerable: true,
368
+ get: function get() {
369
+ return _nodes.listItemWithTask;
370
+ }
371
+ });
360
372
  Object.defineProperty(exports, "media", {
361
373
  enumerable: true,
362
374
  get: function get() {
@@ -10,7 +10,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
10
10
  var _editorPalette = require("../../utils/editor-palette");
11
11
  var _groups = require("../groups");
12
12
  var _colors = require("../../utils/colors");
13
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
13
  var _lchColorInversion = require("../../utils/lch-color-inversion");
15
14
  /**
16
15
  * @name textColor_mark
@@ -74,36 +73,6 @@ colorArrayPalette.forEach(function (_ref) {
74
73
  return colorPalette.set(color.toLowerCase(), label);
75
74
  });
76
75
 
77
- /**
78
- * This function is duplicated in @atlaskit/renderer and ../nodes/tableNodes
79
- * it takes a color string, and if the color string is a hex or rgb value
80
- * it will invert the color and return the inverted color.
81
- */
82
- function invertCustomColor(customColor) {
83
- var hex;
84
- if ((0, _colors.isHex)(customColor)) {
85
- hex = customColor;
86
- } else if ((0, _colors.isRgb)(customColor)) {
87
- hex = (0, _colors.rgbToHex)(customColor);
88
- if (hex === null) {
89
- // in some cases the rgb color is invalid, in this case we just return the color
90
- // See https://product-fabric.atlassian.net/browse/DTR-2003 for a ticket to improve the isRgb function
91
- // to align with the rgbToHex function
92
- return customColor;
93
- }
94
- } else {
95
- return customColor;
96
- }
97
- var hexWithoutHash = hex.replace('#', '');
98
-
99
- // This inverts the hex color by
100
- // 1. converting the hex code to a number
101
- // 2. XORing it with 0xffffff
102
- // 3. Converting the result back to hex
103
- // 4. Removing the leading 1 from the result
104
- return "#".concat((Number("0x1".concat(hexWithoutHash)) ^ 0xffffff).toString(16).substring(1).toUpperCase());
105
- }
106
-
107
76
  // these are for test only
108
77
  var testGlobalTheme;
109
78
  var setGlobalTheme = function setGlobalTheme(theme) {
@@ -199,12 +168,7 @@ var textColor = {
199
168
  } else {
200
169
  if (getGlobalTheme().colorMode === 'dark') {
201
170
  // if we have a custom color, we need to check if we are in dark mode
202
- // and if the feature flag is enabled we need to use the LCH conversion method
203
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.use-lch-for-color-inversion_1qv8ol')) {
204
- paletteColorValue = (0, _lchColorInversion.getDarkModeLCHColor)(mark.attrs.color);
205
- } else {
206
- paletteColorValue = invertCustomColor(mark.attrs.color);
207
- }
171
+ paletteColorValue = (0, _lchColorInversion.getDarkModeLCHColor)(mark.attrs.color);
208
172
  } else {
209
173
  // if we are in light mode, we can just set the color
210
174
  paletteColorValue = mark.attrs.color;
@@ -142,6 +142,12 @@ Object.defineProperty(exports, "expandToJSON", {
142
142
  return _expand.toJSON;
143
143
  }
144
144
  });
145
+ Object.defineProperty(exports, "extendedPanel", {
146
+ enumerable: true,
147
+ get: function get() {
148
+ return _panel.extendedPanel;
149
+ }
150
+ });
145
151
  Object.defineProperty(exports, "extension", {
146
152
  enumerable: true,
147
153
  get: function get() {
@@ -220,6 +226,12 @@ Object.defineProperty(exports, "listItem", {
220
226
  return _listItem.listItem;
221
227
  }
222
228
  });
229
+ Object.defineProperty(exports, "listItemWithTask", {
230
+ enumerable: true,
231
+ get: function get() {
232
+ return _listItem.listItemWithTask;
233
+ }
234
+ });
223
235
  Object.defineProperty(exports, "media", {
224
236
  enumerable: true,
225
237
  get: function get() {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.listItem = void 0;
6
+ exports.listItemWithTask = exports.listItem = void 0;
7
7
  var listItem = {
8
8
  content: '(paragraph | mediaSingle | codeBlock | unsupportedBlock) (paragraph | bulletList | orderedList | mediaSingle | codeBlock | unsupportedBlock)*',
9
9
  marks: 'unsupportedMark unsupportedNodeAttribute',
@@ -16,4 +16,22 @@ var listItem = {
16
16
  return ['li', 0];
17
17
  }
18
18
  };
19
- exports.listItem = listItem;
19
+
20
+ /**
21
+ * @name list_item_with_task
22
+ * @description this node allows task-list to be nested inside list-item
23
+ */
24
+ exports.listItem = listItem;
25
+ var listItemWithTask = {
26
+ content: '(paragraph | mediaSingle | codeBlock | unsupportedBlock) (paragraph | bulletList | orderedList | taskList | mediaSingle | codeBlock | unsupportedBlock)*',
27
+ marks: 'unsupportedMark unsupportedNodeAttribute',
28
+ defining: true,
29
+ selectable: false,
30
+ parseDOM: [{
31
+ tag: 'li'
32
+ }],
33
+ toDOM: function toDOM() {
34
+ return ['li', 0];
35
+ }
36
+ };
37
+ exports.listItemWithTask = listItemWithTask;
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.panel = exports.PanelType = void 0;
7
+ exports.panel = exports.extendedPanel = exports.PanelType = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
10
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(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; }
@@ -91,4 +91,35 @@ var panel = function panel(allowCustomPanel) {
91
91
  };
92
92
  return panelNodeSpec;
93
93
  };
94
- exports.panel = panel;
94
+
95
+ /**
96
+ * @name extended_panel
97
+ * @description it allows more content to be nested as compared to panel node.
98
+ * Specifically, it allows Media, action, code-block, rule and decision nodes in
99
+ * addition to content allowed inside panel
100
+ */
101
+ exports.panel = panel;
102
+ var extendedPanel = function extendedPanel(allowCustomPanel) {
103
+ var panelNodeSpec = {
104
+ group: 'block',
105
+ content: '(paragraph | heading | bulletList | orderedList | blockCard | mediaGroup | mediaSingle | codeBlock | taskList | rule | decisionList | unsupportedBlock)+',
106
+ marks: 'unsupportedMark unsupportedNodeAttribute',
107
+ attrs: getDefaultAttrs(),
108
+ selectable: true,
109
+ parseDOM: [{
110
+ tag: 'div[data-panel-type]',
111
+ getAttrs: function getAttrs(dom) {
112
+ return getParseDOMAttrs(allowCustomPanel, dom);
113
+ }
114
+ }],
115
+ toDOM: function toDOM(node) {
116
+ var attrs = getDomAttrs(node.attrs);
117
+ var contentAttrs = {
118
+ 'data-panel-content': 'true'
119
+ };
120
+ return ['div', attrs, ['div', contentAttrs, 0]];
121
+ }
122
+ };
123
+ return panelNodeSpec;
124
+ };
125
+ exports.extendedPanel = extendedPanel;
@@ -10,7 +10,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
10
10
  var _editorPalette = require("../../utils/editor-palette");
11
11
  var _colors = require("../../utils/colors");
12
12
  var _uuid = require("../../utils/uuid");
13
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
13
  var _lchColorInversion = require("../../utils/lch-color-inversion");
15
14
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
15
  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) { (0, _defineProperty2.default)(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; }
@@ -64,36 +63,6 @@ var getCellAttrs = function getCellAttrs(dom) {
64
63
  };
65
64
  };
66
65
  exports.getCellAttrs = getCellAttrs;
67
- /**
68
- * This function is duplicated in @atlaskit/renderer
69
- * it takes a color string, and if the color string is a hex or rgb value
70
- * it will invert the color and return the inverted color.
71
- */
72
- function invertCustomColor(customColor) {
73
- var hex;
74
- if ((0, _colors.isHex)(customColor)) {
75
- hex = customColor;
76
- } else if ((0, _colors.isRgb)(customColor)) {
77
- hex = (0, _colors.rgbToHex)(customColor);
78
- if (hex === null) {
79
- // in some cases the rgb color is invalid, in this case we just return the color
80
- // See https://product-fabric.atlassian.net/browse/DTR-2003 for a ticket to improve the isRgb function
81
- // to align with the rgbToHex function
82
- return customColor;
83
- }
84
- } else {
85
- return customColor;
86
- }
87
- var hexWithoutHash = hex.replace('#', '');
88
-
89
- // This inverts the hex color by
90
- // 1. converting the hex code to a number
91
- // 2. XORing it with 0xffffff
92
- // 3. Converting the result back to hex
93
- // 4. Removing the leading 1 from the result
94
- return "#".concat((Number("0x1".concat(hexWithoutHash)) ^ 0xffffff).toString(16).substring(1).toUpperCase());
95
- }
96
-
97
66
  // these are for test only
98
67
  var testGlobalTheme;
99
68
  var setGlobalTheme = function setGlobalTheme(theme) {
@@ -172,12 +141,7 @@ var getCellDomAttrs = function getCellDomAttrs(node) {
172
141
  // if we have a custom color, we need to check if we are in dark mode
173
142
  if (getGlobalTheme().colorMode === 'dark') {
174
143
  // if we have a custom color, we need to check if we are in dark mode
175
- // and if the feature flag is enabled we need to use the LCH conversion method
176
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.use-lch-for-color-inversion_1qv8ol')) {
177
- attrs.style = "background-color: ".concat((0, _lchColorInversion.getDarkModeLCHColor)(color), ";");
178
- } else {
179
- attrs.style = "background-color: ".concat(invertCustomColor(color), ";");
180
- }
144
+ attrs.style = "background-color: ".concat((0, _lchColorInversion.getDarkModeLCHColor)(color), ";");
181
145
  } else {
182
146
  // if we are in light mode, we can just set the color
183
147
  attrs.style = "background-color: ".concat(background, ";");
@@ -1,3 +1,3 @@
1
1
  export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockquote, blockquoteWithList, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
2
- 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, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleSpec, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, 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';
2
+ 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, orderedList, orderedListSelector, orderedListWithOrder, panel, extendedPanel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, 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';
3
3
  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';
@@ -1,7 +1,7 @@
1
1
  import { Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  import { COLOR, FONT_STYLE, SEARCH_QUERY, LINK } from './groups';
3
3
  import { link, em, strong, textColor, strike, subsup, underline, code, typeAheadQuery, confluenceInlineComment, breakout, alignment, indentation, annotation, unsupportedMark, unsupportedNodeAttribute, dataConsumer, fragment, border } from './marks';
4
- import { confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, doc, paragraph, text, bulletList, orderedListWithOrder, listItem, heading, blockquoteWithList, codeBlock, panel, 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, nestedExpand, embedCard, caption } from './nodes';
4
+ 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, nestedExpand, embedCard, caption } from './nodes';
5
5
  function addItems(builtInItems, config, customSpecs = {}) {
6
6
  if (!config) {
7
7
  return {};
@@ -66,7 +66,7 @@ const nodesInOrder = [{
66
66
  spec: orderedListWithOrder
67
67
  }, {
68
68
  name: 'listItem',
69
- spec: listItem
69
+ spec: listItemWithTask
70
70
  }, {
71
71
  name: 'heading',
72
72
  spec: heading
@@ -78,7 +78,7 @@ const nodesInOrder = [{
78
78
  spec: codeBlock
79
79
  }, {
80
80
  name: 'panel',
81
- spec: panel(true)
81
+ spec: extendedPanel(true)
82
82
  }, {
83
83
  name: 'rule',
84
84
  spec: rule
@@ -1,4 +1,4 @@
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, media, mediaGroup, mediaSingle, mediaSingleSpec, mediaInline, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, 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';
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, orderedList, orderedListSelector, orderedListWithOrder, panel, extendedPanel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, 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
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';
4
4
  export { unsupportedNodeTypesForMediaCards } from './unsupported';
@@ -1,7 +1,6 @@
1
1
  import { hexToEditorTextPaletteColor } from '../../utils/editor-palette';
2
2
  import { COLOR } from '../groups';
3
- import { rgbToHex, N0, N80, P50, P300, P500, T75, T300, T500, G75, G300, G500, R75, R300, R500, Y75, Y200, Y400, B75, B100, B500, isHex, isRgb } from '../../utils/colors';
4
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
+ import { rgbToHex, N0, N80, P50, P300, P500, T75, T300, T500, G75, G300, G500, R75, R300, R500, Y75, Y200, Y400, B75, B100, B500 } from '../../utils/colors';
5
4
  import { getDarkModeLCHColor } from '../../utils/lch-color-inversion';
6
5
 
7
6
  /**
@@ -59,36 +58,6 @@ export const colorPalette = new Map();
59
58
  export const colorPaletteExtended = colorPalette;
60
59
  colorArrayPalette.forEach(([color, label]) => colorPalette.set(color.toLowerCase(), label));
61
60
 
62
- /**
63
- * This function is duplicated in @atlaskit/renderer and ../nodes/tableNodes
64
- * it takes a color string, and if the color string is a hex or rgb value
65
- * it will invert the color and return the inverted color.
66
- */
67
- function invertCustomColor(customColor) {
68
- let hex;
69
- if (isHex(customColor)) {
70
- hex = customColor;
71
- } else if (isRgb(customColor)) {
72
- hex = rgbToHex(customColor);
73
- if (hex === null) {
74
- // in some cases the rgb color is invalid, in this case we just return the color
75
- // See https://product-fabric.atlassian.net/browse/DTR-2003 for a ticket to improve the isRgb function
76
- // to align with the rgbToHex function
77
- return customColor;
78
- }
79
- } else {
80
- return customColor;
81
- }
82
- const hexWithoutHash = hex.replace('#', '');
83
-
84
- // This inverts the hex color by
85
- // 1. converting the hex code to a number
86
- // 2. XORing it with 0xffffff
87
- // 3. Converting the result back to hex
88
- // 4. Removing the leading 1 from the result
89
- return `#${(Number(`0x1${hexWithoutHash}`) ^ 0xffffff).toString(16).substring(1).toUpperCase()}`;
90
- }
91
-
92
61
  // these are for test only
93
62
  let testGlobalTheme;
94
63
  export const setGlobalTheme = theme => {
@@ -183,12 +152,7 @@ export const textColor = {
183
152
  } else {
184
153
  if (getGlobalTheme().colorMode === 'dark') {
185
154
  // if we have a custom color, we need to check if we are in dark mode
186
- // and if the feature flag is enabled we need to use the LCH conversion method
187
- if (getBooleanFF('platform.editor.use-lch-for-color-inversion_1qv8ol')) {
188
- paletteColorValue = getDarkModeLCHColor(mark.attrs.color);
189
- } else {
190
- paletteColorValue = invertCustomColor(mark.attrs.color);
191
- }
155
+ paletteColorValue = getDarkModeLCHColor(mark.attrs.color);
192
156
  } else {
193
157
  // if we are in light mode, we can just set the color
194
158
  paletteColorValue = mark.attrs.color;
@@ -15,8 +15,8 @@ export { paragraph } from './paragraph';
15
15
  export { emoji } from './emoji';
16
16
  export { image } from './image';
17
17
  export { mention, toJSON as mentionToJSON } from './mention';
18
- export { listItem } from './list-item';
19
- export { panel, PanelType } from './panel';
18
+ export { listItem, listItemWithTask } from './list-item';
19
+ export { panel, extendedPanel, PanelType } from './panel';
20
20
  export { text } from './text';
21
21
  export { default as unknownBlock } from './unknown-block';
22
22
  export { caption } from './caption';
@@ -9,4 +9,21 @@ export const listItem = {
9
9
  toDOM() {
10
10
  return ['li', 0];
11
11
  }
12
+ };
13
+
14
+ /**
15
+ * @name list_item_with_task
16
+ * @description this node allows task-list to be nested inside list-item
17
+ */
18
+ export const listItemWithTask = {
19
+ content: '(paragraph | mediaSingle | codeBlock | unsupportedBlock) (paragraph | bulletList | orderedList | taskList | mediaSingle | codeBlock | unsupportedBlock)*',
20
+ marks: 'unsupportedMark unsupportedNodeAttribute',
21
+ defining: true,
22
+ selectable: false,
23
+ parseDOM: [{
24
+ tag: 'li'
25
+ }],
26
+ toDOM() {
27
+ return ['li', 0];
28
+ }
12
29
  };
@@ -80,4 +80,32 @@ export const panel = allowCustomPanel => {
80
80
  }
81
81
  };
82
82
  return panelNodeSpec;
83
+ };
84
+
85
+ /**
86
+ * @name extended_panel
87
+ * @description it allows more content to be nested as compared to panel node.
88
+ * Specifically, it allows Media, action, code-block, rule and decision nodes in
89
+ * addition to content allowed inside panel
90
+ */
91
+ export const extendedPanel = allowCustomPanel => {
92
+ const panelNodeSpec = {
93
+ group: 'block',
94
+ content: '(paragraph | heading | bulletList | orderedList | blockCard | mediaGroup | mediaSingle | codeBlock | taskList | rule | decisionList | unsupportedBlock)+',
95
+ marks: 'unsupportedMark unsupportedNodeAttribute',
96
+ attrs: getDefaultAttrs(),
97
+ selectable: true,
98
+ parseDOM: [{
99
+ tag: 'div[data-panel-type]',
100
+ getAttrs: dom => getParseDOMAttrs(allowCustomPanel, dom)
101
+ }],
102
+ toDOM(node) {
103
+ const attrs = getDomAttrs(node.attrs);
104
+ const contentAttrs = {
105
+ 'data-panel-content': 'true'
106
+ };
107
+ return ['div', attrs, ['div', contentAttrs, 0]];
108
+ }
109
+ };
110
+ return panelNodeSpec;
83
111
  };
@@ -1,7 +1,6 @@
1
1
  import { hexToEditorBackgroundPaletteRawValue } from '../../utils/editor-palette';
2
2
  import { B100, B50, B75, G200, G50, G75, hexToRgba, isHex, isRgb, N0, N20, N60, N800, P100, P50, P75, R100, R50, R75, rgbToHex, T100, T50, T75, Y200, Y50, Y75 } from '../../utils/colors';
3
3
  import { uuid } from '../../utils/uuid';
4
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
4
  import { getDarkModeLCHColor } from '../../utils/lch-color-inversion';
6
5
  export const tablePrefixSelector = 'pm-table';
7
6
  export const tableCellSelector = `${tablePrefixSelector}-cell-content-wrap`;
@@ -46,36 +45,6 @@ export const getCellAttrs = (dom, defaultValues = {}) => {
46
45
  background: backgroundHexCode
47
46
  };
48
47
  };
49
- /**
50
- * This function is duplicated in @atlaskit/renderer
51
- * it takes a color string, and if the color string is a hex or rgb value
52
- * it will invert the color and return the inverted color.
53
- */
54
- function invertCustomColor(customColor) {
55
- let hex;
56
- if (isHex(customColor)) {
57
- hex = customColor;
58
- } else if (isRgb(customColor)) {
59
- hex = rgbToHex(customColor);
60
- if (hex === null) {
61
- // in some cases the rgb color is invalid, in this case we just return the color
62
- // See https://product-fabric.atlassian.net/browse/DTR-2003 for a ticket to improve the isRgb function
63
- // to align with the rgbToHex function
64
- return customColor;
65
- }
66
- } else {
67
- return customColor;
68
- }
69
- const hexWithoutHash = hex.replace('#', '');
70
-
71
- // This inverts the hex color by
72
- // 1. converting the hex code to a number
73
- // 2. XORing it with 0xffffff
74
- // 3. Converting the result back to hex
75
- // 4. Removing the leading 1 from the result
76
- return `#${(Number(`0x1${hexWithoutHash}`) ^ 0xffffff).toString(16).substring(1).toUpperCase()}`;
77
- }
78
-
79
48
  // these are for test only
80
49
  let testGlobalTheme;
81
50
  export const setGlobalTheme = theme => {
@@ -155,12 +124,7 @@ export const getCellDomAttrs = node => {
155
124
  // if we have a custom color, we need to check if we are in dark mode
156
125
  if (getGlobalTheme().colorMode === 'dark') {
157
126
  // if we have a custom color, we need to check if we are in dark mode
158
- // and if the feature flag is enabled we need to use the LCH conversion method
159
- if (getBooleanFF('platform.editor.use-lch-for-color-inversion_1qv8ol')) {
160
- attrs.style = `background-color: ${getDarkModeLCHColor(color)};`;
161
- } else {
162
- attrs.style = `background-color: ${invertCustomColor(color)};`;
163
- }
127
+ attrs.style = `background-color: ${getDarkModeLCHColor(color)};`;
164
128
  } else {
165
129
  // if we are in light mode, we can just set the color
166
130
  attrs.style = `background-color: ${background};`;
package/dist/esm/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockquote, blockquoteWithList, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
2
- 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, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleSpec, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, 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';
2
+ 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, orderedList, orderedListSelector, orderedListWithOrder, panel, extendedPanel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, 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';
3
3
  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';
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { Schema } from '@atlaskit/editor-prosemirror/model';
5
5
  import { COLOR, FONT_STYLE, SEARCH_QUERY, LINK } from './groups';
6
6
  import { link, em, strong, textColor, strike, subsup, underline, code, typeAheadQuery, confluenceInlineComment, breakout, alignment, indentation, annotation, unsupportedMark, unsupportedNodeAttribute, dataConsumer, fragment, border } from './marks';
7
- import { confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, doc, paragraph, text, bulletList, orderedListWithOrder, listItem, heading, blockquoteWithList, codeBlock, panel, 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, nestedExpand, embedCard, caption } from './nodes';
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, nestedExpand, embedCard, caption } from './nodes';
8
8
  function addItems(builtInItems, config) {
9
9
  var customSpecs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
10
10
  if (!config) {
@@ -71,7 +71,7 @@ var nodesInOrder = [{
71
71
  spec: orderedListWithOrder
72
72
  }, {
73
73
  name: 'listItem',
74
- spec: listItem
74
+ spec: listItemWithTask
75
75
  }, {
76
76
  name: 'heading',
77
77
  spec: heading
@@ -83,7 +83,7 @@ var nodesInOrder = [{
83
83
  spec: codeBlock
84
84
  }, {
85
85
  name: 'panel',
86
- spec: panel(true)
86
+ spec: extendedPanel(true)
87
87
  }, {
88
88
  name: 'rule',
89
89
  spec: rule
@@ -1,4 +1,4 @@
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, media, mediaGroup, mediaSingle, mediaSingleSpec, mediaInline, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, 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';
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, orderedList, orderedListSelector, orderedListWithOrder, panel, extendedPanel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, 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
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';
4
4
  export { unsupportedNodeTypesForMediaCards } from './unsupported';