@atlaskit/editor-shared-styles 3.0.1 → 3.1.1

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/editor-shared-styles
2
2
 
3
+ ## 3.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#156360](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/156360)
8
+ [`482dbb03dbf68`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/482dbb03dbf68) -
9
+ Add akEditorWrappedNodeZIndex constant
10
+
11
+ ## 3.1.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#155573](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/155573)
16
+ [`92ca0dc09c6ac`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/92ca0dc09c6ac) -
17
+ Create new participantColors constant to be used in future updates to avatar badges and
18
+ telepointers
19
+
3
20
  ## 3.0.1
4
21
 
5
22
  ### Patch Changes
@@ -4,9 +4,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.editorFontSize = exports.breakoutWideScaleRatio = exports.blockNodesVerticalMargin = exports.avatarColors = exports.akRichMediaResizeZIndex = exports.akLayoutGutterOffset = exports.akEditorWideLayoutWidth = exports.akEditorUnitZIndex = exports.akEditorToolbarKeylineHeight = exports.akEditorTableToolbarSize = exports.akEditorTableToolbar = exports.akEditorTableNumberColumnWidth = exports.akEditorTableLegacyCellMinWidth = exports.akEditorTableHeaderCellBackgroundDark = exports.akEditorTableHeaderCellBackground = exports.akEditorTableCellOnStickyHeaderZIndex = exports.akEditorTableCellMinWidth = exports.akEditorTableCellBlanketSelected = exports.akEditorTableCellBlanketDeleted = exports.akEditorTableCellBackgroundOpacity = exports.akEditorTableBorderSelected = exports.akEditorTableBorderRadius = exports.akEditorTableBorder = exports.akEditorSwoopCubicBezier = exports.akEditorSubtleAccent = exports.akEditorStickyHeaderZIndex = exports.akEditorSmallZIndex = exports.akEditorShadowZIndex = exports.akEditorSelectedNodeClassName = exports.akEditorSelectedBoxShadow = exports.akEditorSelectedBorderSize = exports.akEditorSelectedBorderColor = exports.akEditorSelectedBorderBoldSize = exports.akEditorSelectedBorder = exports.akEditorSelectedBlanketOpacity = exports.akEditorRuleBorderRadius = exports.akEditorMobileMaxWidth = exports.akEditorMobileBreakoutPoint = exports.akEditorMenuZIndex = exports.akEditorMediaResizeHandlerPaddingWide = exports.akEditorMediaResizeHandlerPadding = exports.akEditorLineHeight = exports.akEditorGutterPaddingDynamic = exports.akEditorGutterPadding = exports.akEditorGridLineZIndex = exports.akEditorFullWidthLayoutWidth = exports.akEditorFullWidthLayoutLineLength = exports.akEditorFullPageMaxWidth = exports.akEditorFullPageDefaultFontSize = exports.akEditorFloatingPanelZIndex = exports.akEditorFloatingOverlapPanelZIndex = exports.akEditorFloatingDialogZIndex = exports.akEditorDeleteIconColor = exports.akEditorDeleteBorder = exports.akEditorDeleteBackgroundWithOpacity = exports.akEditorDeleteBackground = exports.akEditorDefaultLayoutWidth = exports.akEditorCustomIconSize = exports.akEditorContextPanelWidth = exports.akEditorCodeInlinePadding = exports.akEditorCodeFontFamily = exports.akEditorCodeBlockPadding = exports.akEditorCodeBackground = exports.akEditorCalculatedWideLayoutWidthSmallViewport = exports.akEditorCalculatedWideLayoutWidth = exports.akEditorBreakoutPadding = exports.akEditorBlockquoteBorderColor = exports.VIEWPORT_SIZES = exports.MAX_BROWSER_SCROLLBAR_HEIGHT = exports.FULL_PAGE_EDITOR_TOOLBAR_HEIGHT = exports.DEFAULT_EMBED_CARD_WIDTH = exports.DEFAULT_EMBED_CARD_HEIGHT = exports.ATLASSIAN_NAVIGATION_HEIGHT = void 0;
7
+ exports.editorFontSize = exports.breakoutWideScaleRatio = exports.blockNodesVerticalMargin = exports.avatarColors = exports.akRichMediaResizeZIndex = exports.akLayoutGutterOffset = exports.akEditorWrappedNodeZIndex = exports.akEditorWideLayoutWidth = exports.akEditorUnitZIndex = exports.akEditorToolbarKeylineHeight = exports.akEditorTableToolbarSize = exports.akEditorTableToolbar = exports.akEditorTableNumberColumnWidth = exports.akEditorTableLegacyCellMinWidth = exports.akEditorTableHeaderCellBackgroundDark = exports.akEditorTableHeaderCellBackground = exports.akEditorTableCellOnStickyHeaderZIndex = exports.akEditorTableCellMinWidth = exports.akEditorTableCellBlanketSelected = exports.akEditorTableCellBlanketDeleted = exports.akEditorTableCellBackgroundOpacity = exports.akEditorTableBorderSelected = exports.akEditorTableBorderRadius = exports.akEditorTableBorder = exports.akEditorSwoopCubicBezier = exports.akEditorSubtleAccent = exports.akEditorStickyHeaderZIndex = exports.akEditorSmallZIndex = exports.akEditorShadowZIndex = exports.akEditorSelectedNodeClassName = exports.akEditorSelectedBoxShadow = exports.akEditorSelectedBorderSize = exports.akEditorSelectedBorderColor = exports.akEditorSelectedBorderBoldSize = exports.akEditorSelectedBorder = exports.akEditorSelectedBlanketOpacity = exports.akEditorRuleBorderRadius = exports.akEditorMobileMaxWidth = exports.akEditorMobileBreakoutPoint = exports.akEditorMenuZIndex = exports.akEditorMediaResizeHandlerPaddingWide = exports.akEditorMediaResizeHandlerPadding = exports.akEditorLineHeight = exports.akEditorGutterPaddingDynamic = exports.akEditorGutterPadding = exports.akEditorGridLineZIndex = exports.akEditorFullWidthLayoutWidth = exports.akEditorFullWidthLayoutLineLength = exports.akEditorFullPageMaxWidth = exports.akEditorFullPageDefaultFontSize = exports.akEditorFloatingPanelZIndex = exports.akEditorFloatingOverlapPanelZIndex = exports.akEditorFloatingDialogZIndex = exports.akEditorDeleteIconColor = exports.akEditorDeleteBorder = exports.akEditorDeleteBackgroundWithOpacity = exports.akEditorDeleteBackground = exports.akEditorDefaultLayoutWidth = exports.akEditorCustomIconSize = exports.akEditorContextPanelWidth = exports.akEditorCodeInlinePadding = exports.akEditorCodeFontFamily = exports.akEditorCodeBlockPadding = exports.akEditorCodeBackground = exports.akEditorCalculatedWideLayoutWidthSmallViewport = exports.akEditorCalculatedWideLayoutWidth = exports.akEditorBreakoutPadding = exports.akEditorBlockquoteBorderColor = exports.VIEWPORT_SIZES = exports.MAX_BROWSER_SCROLLBAR_HEIGHT = exports.FULL_PAGE_EDITOR_TOOLBAR_HEIGHT = exports.DEFAULT_EMBED_CARD_WIDTH = exports.DEFAULT_EMBED_CARD_HEIGHT = exports.ATLASSIAN_NAVIGATION_HEIGHT = void 0;
8
8
  exports.getTableCellBackgroundDarkModeColorCSS = getTableCellBackgroundDarkModeColorCSS;
9
- exports.relativeSize = exports.relativeFontSizeToBase16 = exports.gridMediumMaxWidth = exports.getTableCellBackgroundDarkModeColors = void 0;
9
+ exports.relativeSize = exports.relativeFontSizeToBase16 = exports.participantColors = exports.gridMediumMaxWidth = exports.getTableCellBackgroundDarkModeColors = void 0;
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
11
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
12
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
@@ -82,6 +82,7 @@ var akEditorToolbarKeylineHeight = exports.akEditorToolbarKeylineHeight = 2;
82
82
  var akEditorContextPanelWidth = exports.akEditorContextPanelWidth = 320;
83
83
  var akEditorTableCellBlanketSelected = exports.akEditorTableCellBlanketSelected = 'rgba(179, 212, 255, 0.3)';
84
84
  var akEditorTableCellBlanketDeleted = exports.akEditorTableCellBlanketDeleted = 'rgba(255, 235, 230, 0.3)';
85
+ var akEditorWrappedNodeZIndex = exports.akEditorWrappedNodeZIndex = akEditorUnitZIndex * 2; //prevent paragraph nodes from rendering above wrapped nodes
85
86
 
86
87
  // @see typography spreadsheet: https://docs.google.com/spreadsheets/d/1iYusRGCT4PoPfvxbJ8NrgjtfFgXLm5lpDWXzjua1W2E/edit#gid=93913128
87
88
  var blockNodesVerticalMargin = exports.blockNodesVerticalMargin = '0.75rem';
@@ -159,4 +160,61 @@ var getTableCellBackgroundDarkModeColors = exports.getTableCellBackgroundDarkMod
159
160
  function getTableCellBackgroundDarkModeColorCSS(colorName, colorValue) {
160
161
  return "\n &[colorname=\"".concat(colorName, "\"] {\n background-color: ").concat(colorValue, " !important; // !important to override default style color\n }\n ");
161
162
  }
162
- var avatarColors = exports.avatarColors = ["var(--ds-icon-accent-red, #C9372C)", "var(--ds-background-accent-red-bolder-hovered, #AE2E24)", "var(--ds-icon-accent-magenta, #CD519D)", "var(--ds-background-accent-magenta-bolder-hovered, #943D73)", "var(--ds-icon-accent-orange, #E56910)", "var(--ds-background-accent-orange-bolder-hovered, #A54800)", "var(--ds-icon-accent-green, #22A06B)", "var(--ds-background-accent-green-bolder-hovered, #216E4E)", "var(--ds-icon-accent-blue, #1D7AFC)", "var(--ds-background-accent-blue-bolder-hovered, #0055CC)", "var(--ds-icon-accent-teal, #2898BD)", "var(--ds-background-accent-teal-bolder-hovered, #206A83)", "var(--ds-icon-accent-lime, #6A9A23)", "var(--ds-background-accent-lime-bolder-hovered, #4C6B1F)", "var(--ds-icon-accent-purple, #8270DB)", "var(--ds-background-accent-purple-bolder-hovered, #5E4DB2)", "var(--ds-icon-accent-gray, #758195)", "var(--ds-background-accent-gray-bolder-hovered, #44546F)", "var(--ds-icon-accent-yellow, #B38600)", "var(--ds-background-accent-yellow-bolder-hovered, #7F5F01)", "var(--ds-background-accent-yellow-bolder-pressed, #533F04)"];
163
+ var avatarColors = exports.avatarColors = ["var(--ds-icon-accent-red, #C9372C)", "var(--ds-background-accent-red-bolder-hovered, #AE2E24)", "var(--ds-icon-accent-magenta, #CD519D)", "var(--ds-background-accent-magenta-bolder-hovered, #943D73)", "var(--ds-icon-accent-orange, #E56910)", "var(--ds-background-accent-orange-bolder-hovered, #A54800)", "var(--ds-icon-accent-green, #22A06B)", "var(--ds-background-accent-green-bolder-hovered, #216E4E)", "var(--ds-icon-accent-blue, #1D7AFC)", "var(--ds-background-accent-blue-bolder-hovered, #0055CC)", "var(--ds-icon-accent-teal, #2898BD)", "var(--ds-background-accent-teal-bolder-hovered, #206A83)", "var(--ds-icon-accent-lime, #6A9A23)", "var(--ds-background-accent-lime-bolder-hovered, #4C6B1F)", "var(--ds-icon-accent-purple, #8270DB)", "var(--ds-background-accent-purple-bolder-hovered, #5E4DB2)", "var(--ds-icon-accent-gray, #758195)", "var(--ds-background-accent-gray-bolder-hovered, #44546F)", "var(--ds-icon-accent-yellow, #B38600)", "var(--ds-background-accent-yellow-bolder-hovered, #7F5F01)", "var(--ds-background-accent-yellow-bolder-pressed, #533F04)"];
164
+
165
+ // MDS-569: Will update references to avatarColors to use participantColors instead, we will then deprecate avatarColors
166
+ var participantColors = exports.participantColors = [{
167
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
168
+ backgroundColor: "var(--ds-background-accent-red-bolder, #C9372C)"
169
+ }, {
170
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
171
+ backgroundColor: "var(--ds-background-accent-blue-bolder, #0C66E4)"
172
+ }, {
173
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
174
+ backgroundColor: "var(--ds-background-accent-green-bolder, #1F845A)"
175
+ }, {
176
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
177
+ backgroundColor: "var(--ds-background-accent-yellow-bolder, #946F00)"
178
+ }, {
179
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
180
+ backgroundColor: "var(--ds-background-accent-purple-bolder, #6E5DC6)"
181
+ }, {
182
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
183
+ backgroundColor: "var(--ds-background-accent-magenta-bolder, #AE4787)"
184
+ }, {
185
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
186
+ backgroundColor: "var(--ds-background-accent-teal-bolder, #227D9B)"
187
+ }, {
188
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
189
+ backgroundColor: "var(--ds-background-accent-orange-bolder, #C25100)"
190
+ }, {
191
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
192
+ backgroundColor: "var(--ds-background-accent-lime-bolder, #5B7F24)"
193
+ }, {
194
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
195
+ backgroundColor: "var(--ds-background-accent-gray-bolder, #626F86)"
196
+ }, {
197
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
198
+ backgroundColor: "var(--ds-background-accent-blue-subtle, #579DFF)"
199
+ }, {
200
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
201
+ backgroundColor: "var(--ds-background-accent-red-subtle, #F87168)"
202
+ }, {
203
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
204
+ backgroundColor: "var(--ds-background-accent-orange-subtle, #FEA362)"
205
+ }, {
206
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
207
+ backgroundColor: "var(--ds-background-accent-yellow-subtle, #F5CD47)"
208
+ }, {
209
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
210
+ backgroundColor: "var(--ds-background-accent-green-subtle, #4BCE97)"
211
+ }, {
212
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
213
+ backgroundColor: "var(--ds-background-accent-teal-subtle, #6CC3E0)"
214
+ }, {
215
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
216
+ backgroundColor: "var(--ds-background-accent-purple-subtle, #9F8FEF)"
217
+ }, {
218
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
219
+ backgroundColor: "var(--ds-background-accent-magenta-subtle, #E774BB)"
220
+ }];
@@ -405,6 +405,12 @@ Object.defineProperty(exports, "akEditorWideLayoutWidth", {
405
405
  return _consts.akEditorWideLayoutWidth;
406
406
  }
407
407
  });
408
+ Object.defineProperty(exports, "akEditorWrappedNodeZIndex", {
409
+ enumerable: true,
410
+ get: function get() {
411
+ return _consts.akEditorWrappedNodeZIndex;
412
+ }
413
+ });
408
414
  Object.defineProperty(exports, "akLayoutGutterOffset", {
409
415
  enumerable: true,
410
416
  get: function get() {
@@ -453,6 +459,12 @@ Object.defineProperty(exports, "gridMediumMaxWidth", {
453
459
  return _consts.gridMediumMaxWidth;
454
460
  }
455
461
  });
462
+ Object.defineProperty(exports, "participantColors", {
463
+ enumerable: true,
464
+ get: function get() {
465
+ return _consts.participantColors;
466
+ }
467
+ });
456
468
  Object.defineProperty(exports, "relativeFontSizeToBase16", {
457
469
  enumerable: true,
458
470
  get: function get() {
package/dist/cjs/index.js CHANGED
@@ -405,6 +405,12 @@ Object.defineProperty(exports, "akEditorWideLayoutWidth", {
405
405
  return _consts.akEditorWideLayoutWidth;
406
406
  }
407
407
  });
408
+ Object.defineProperty(exports, "akEditorWrappedNodeZIndex", {
409
+ enumerable: true,
410
+ get: function get() {
411
+ return _consts.akEditorWrappedNodeZIndex;
412
+ }
413
+ });
408
414
  Object.defineProperty(exports, "akLayoutGutterOffset", {
409
415
  enumerable: true,
410
416
  get: function get() {
@@ -441,6 +447,12 @@ Object.defineProperty(exports, "editorFontSize", {
441
447
  return _consts.editorFontSize;
442
448
  }
443
449
  });
450
+ Object.defineProperty(exports, "getParticipantColor", {
451
+ enumerable: true,
452
+ get: function get() {
453
+ return _utils.getParticipantColor;
454
+ }
455
+ });
444
456
  Object.defineProperty(exports, "getSelectionStyles", {
445
457
  enumerable: true,
446
458
  get: function get() {
@@ -471,6 +483,12 @@ Object.defineProperty(exports, "overflowShadow", {
471
483
  return _overflowShadow.overflowShadow;
472
484
  }
473
485
  });
486
+ Object.defineProperty(exports, "participantColors", {
487
+ enumerable: true,
488
+ get: function get() {
489
+ return _consts.participantColors;
490
+ }
491
+ });
474
492
  Object.defineProperty(exports, "relativeFontSizeToBase16", {
475
493
  enumerable: true,
476
494
  get: function get() {
@@ -485,4 +503,5 @@ Object.defineProperty(exports, "relativeSize", {
485
503
  });
486
504
  var _consts = require("./consts");
487
505
  var _selection = require("./selection");
488
- var _overflowShadow = require("./overflow-shadow");
506
+ var _overflowShadow = require("./overflow-shadow");
507
+ var _utils = require("./utils");
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getHashCode = getHashCode;
7
+ exports.getParticipantColor = getParticipantColor;
8
+ var _consts = require("./consts");
9
+ /**
10
+ * Generates a hash code for a given string.
11
+ *
12
+ * This function computes a hash code by iterating over each character
13
+ * in the string and applying bitwise operations to accumulate the hash value.
14
+ *
15
+ * @param str - The input string for which the hash code is to be generated.
16
+ * @returns The computed hash code as a number.
17
+ */
18
+ function getHashCode(str) {
19
+ var hash = 0;
20
+ for (var i = 0; i < str.length; i++) {
21
+ /* eslint-disable no-bitwise */
22
+ hash = (hash << 5) - hash + str.charCodeAt(i);
23
+ hash = (hash & hash) >>> 0;
24
+ /* eslint-enable no-bitwise */
25
+ }
26
+ return hash;
27
+ }
28
+
29
+ /**
30
+ * Returns the participant color based on the hash code of the input string.
31
+ *
32
+ * @param str - The input string used to determine the participant color.
33
+ * @returns An object containing the index and the corresponding participant color.
34
+ */
35
+ function getParticipantColor(str) {
36
+ var index = getHashCode(str) % _consts.participantColors.length;
37
+ return {
38
+ index: index,
39
+ color: _consts.participantColors[index]
40
+ };
41
+ }
@@ -70,6 +70,7 @@ export const akEditorToolbarKeylineHeight = 2;
70
70
  export const akEditorContextPanelWidth = 320;
71
71
  export const akEditorTableCellBlanketSelected = 'rgba(179, 212, 255, 0.3)';
72
72
  export const akEditorTableCellBlanketDeleted = 'rgba(255, 235, 230, 0.3)';
73
+ export const akEditorWrappedNodeZIndex = akEditorUnitZIndex * 2; //prevent paragraph nodes from rendering above wrapped nodes
73
74
 
74
75
  // @see typography spreadsheet: https://docs.google.com/spreadsheets/d/1iYusRGCT4PoPfvxbJ8NrgjtfFgXLm5lpDWXzjua1W2E/edit#gid=93913128
75
76
  export const blockNodesVerticalMargin = '0.75rem';
@@ -140,4 +141,61 @@ export function getTableCellBackgroundDarkModeColorCSS(colorName, colorValue) {
140
141
  }
141
142
  `;
142
143
  }
143
- export const avatarColors = ["var(--ds-icon-accent-red, #C9372C)", "var(--ds-background-accent-red-bolder-hovered, #AE2E24)", "var(--ds-icon-accent-magenta, #CD519D)", "var(--ds-background-accent-magenta-bolder-hovered, #943D73)", "var(--ds-icon-accent-orange, #E56910)", "var(--ds-background-accent-orange-bolder-hovered, #A54800)", "var(--ds-icon-accent-green, #22A06B)", "var(--ds-background-accent-green-bolder-hovered, #216E4E)", "var(--ds-icon-accent-blue, #1D7AFC)", "var(--ds-background-accent-blue-bolder-hovered, #0055CC)", "var(--ds-icon-accent-teal, #2898BD)", "var(--ds-background-accent-teal-bolder-hovered, #206A83)", "var(--ds-icon-accent-lime, #6A9A23)", "var(--ds-background-accent-lime-bolder-hovered, #4C6B1F)", "var(--ds-icon-accent-purple, #8270DB)", "var(--ds-background-accent-purple-bolder-hovered, #5E4DB2)", "var(--ds-icon-accent-gray, #758195)", "var(--ds-background-accent-gray-bolder-hovered, #44546F)", "var(--ds-icon-accent-yellow, #B38600)", "var(--ds-background-accent-yellow-bolder-hovered, #7F5F01)", "var(--ds-background-accent-yellow-bolder-pressed, #533F04)"];
144
+ export const avatarColors = ["var(--ds-icon-accent-red, #C9372C)", "var(--ds-background-accent-red-bolder-hovered, #AE2E24)", "var(--ds-icon-accent-magenta, #CD519D)", "var(--ds-background-accent-magenta-bolder-hovered, #943D73)", "var(--ds-icon-accent-orange, #E56910)", "var(--ds-background-accent-orange-bolder-hovered, #A54800)", "var(--ds-icon-accent-green, #22A06B)", "var(--ds-background-accent-green-bolder-hovered, #216E4E)", "var(--ds-icon-accent-blue, #1D7AFC)", "var(--ds-background-accent-blue-bolder-hovered, #0055CC)", "var(--ds-icon-accent-teal, #2898BD)", "var(--ds-background-accent-teal-bolder-hovered, #206A83)", "var(--ds-icon-accent-lime, #6A9A23)", "var(--ds-background-accent-lime-bolder-hovered, #4C6B1F)", "var(--ds-icon-accent-purple, #8270DB)", "var(--ds-background-accent-purple-bolder-hovered, #5E4DB2)", "var(--ds-icon-accent-gray, #758195)", "var(--ds-background-accent-gray-bolder-hovered, #44546F)", "var(--ds-icon-accent-yellow, #B38600)", "var(--ds-background-accent-yellow-bolder-hovered, #7F5F01)", "var(--ds-background-accent-yellow-bolder-pressed, #533F04)"];
145
+
146
+ // MDS-569: Will update references to avatarColors to use participantColors instead, we will then deprecate avatarColors
147
+ export const participantColors = [{
148
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
149
+ backgroundColor: "var(--ds-background-accent-red-bolder, #C9372C)"
150
+ }, {
151
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
152
+ backgroundColor: "var(--ds-background-accent-blue-bolder, #0C66E4)"
153
+ }, {
154
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
155
+ backgroundColor: "var(--ds-background-accent-green-bolder, #1F845A)"
156
+ }, {
157
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
158
+ backgroundColor: "var(--ds-background-accent-yellow-bolder, #946F00)"
159
+ }, {
160
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
161
+ backgroundColor: "var(--ds-background-accent-purple-bolder, #6E5DC6)"
162
+ }, {
163
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
164
+ backgroundColor: "var(--ds-background-accent-magenta-bolder, #AE4787)"
165
+ }, {
166
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
167
+ backgroundColor: "var(--ds-background-accent-teal-bolder, #227D9B)"
168
+ }, {
169
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
170
+ backgroundColor: "var(--ds-background-accent-orange-bolder, #C25100)"
171
+ }, {
172
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
173
+ backgroundColor: "var(--ds-background-accent-lime-bolder, #5B7F24)"
174
+ }, {
175
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
176
+ backgroundColor: "var(--ds-background-accent-gray-bolder, #626F86)"
177
+ }, {
178
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
179
+ backgroundColor: "var(--ds-background-accent-blue-subtle, #579DFF)"
180
+ }, {
181
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
182
+ backgroundColor: "var(--ds-background-accent-red-subtle, #F87168)"
183
+ }, {
184
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
185
+ backgroundColor: "var(--ds-background-accent-orange-subtle, #FEA362)"
186
+ }, {
187
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
188
+ backgroundColor: "var(--ds-background-accent-yellow-subtle, #F5CD47)"
189
+ }, {
190
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
191
+ backgroundColor: "var(--ds-background-accent-green-subtle, #4BCE97)"
192
+ }, {
193
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
194
+ backgroundColor: "var(--ds-background-accent-teal-subtle, #6CC3E0)"
195
+ }, {
196
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
197
+ backgroundColor: "var(--ds-background-accent-purple-subtle, #9F8FEF)"
198
+ }, {
199
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
200
+ backgroundColor: "var(--ds-background-accent-magenta-subtle, #E774BB)"
201
+ }];
@@ -1 +1 @@
1
- export { akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorCustomIconSize, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellMinWidth, akEditorTableCellOnStickyHeaderZIndex, akEditorTableHeaderCellBackground, akEditorTableHeaderCellBackgroundDark, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, avatarColors, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, MAX_BROWSER_SCROLLBAR_HEIGHT, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT, FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorTableCellBlanketSelected, akEditorTableCellBlanketDeleted } from './consts';
1
+ export { akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorCustomIconSize, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellMinWidth, akEditorTableCellOnStickyHeaderZIndex, akEditorTableHeaderCellBackground, akEditorTableHeaderCellBackgroundDark, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, avatarColors, participantColors, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, MAX_BROWSER_SCROLLBAR_HEIGHT, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT, FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorTableCellBlanketSelected, akEditorTableCellBlanketDeleted, akEditorWrappedNodeZIndex } from './consts';
@@ -1,3 +1,4 @@
1
- export { akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellMinWidth, akEditorTableCellOnStickyHeaderZIndex, akEditorTableHeaderCellBackground, akEditorTableHeaderCellBackgroundDark, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, avatarColors, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, MAX_BROWSER_SCROLLBAR_HEIGHT, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT, FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorTableCellBlanketSelected, akEditorTableCellBlanketDeleted } from './consts';
1
+ export { akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellMinWidth, akEditorTableCellOnStickyHeaderZIndex, akEditorTableHeaderCellBackground, akEditorTableHeaderCellBackgroundDark, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, avatarColors, participantColors, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, MAX_BROWSER_SCROLLBAR_HEIGHT, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT, FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorTableCellBlanketSelected, akEditorTableCellBlanketDeleted, akEditorWrappedNodeZIndex } from './consts';
2
2
  export { SelectionStyle, getSelectionStyles, hideNativeBrowserTextSelectionStyles } from './selection';
3
- export { overflowShadow } from './overflow-shadow';
3
+ export { overflowShadow } from './overflow-shadow';
4
+ export { getParticipantColor } from './utils';
@@ -0,0 +1,35 @@
1
+ import { participantColors } from './consts';
2
+
3
+ /**
4
+ * Generates a hash code for a given string.
5
+ *
6
+ * This function computes a hash code by iterating over each character
7
+ * in the string and applying bitwise operations to accumulate the hash value.
8
+ *
9
+ * @param str - The input string for which the hash code is to be generated.
10
+ * @returns The computed hash code as a number.
11
+ */
12
+ export function getHashCode(str) {
13
+ let hash = 0;
14
+ for (let i = 0; i < str.length; i++) {
15
+ /* eslint-disable no-bitwise */
16
+ hash = (hash << 5) - hash + str.charCodeAt(i);
17
+ hash = (hash & hash) >>> 0;
18
+ /* eslint-enable no-bitwise */
19
+ }
20
+ return hash;
21
+ }
22
+
23
+ /**
24
+ * Returns the participant color based on the hash code of the input string.
25
+ *
26
+ * @param str - The input string used to determine the participant color.
27
+ * @returns An object containing the index and the corresponding participant color.
28
+ */
29
+ export function getParticipantColor(str) {
30
+ const index = getHashCode(str) % participantColors.length;
31
+ return {
32
+ index,
33
+ color: participantColors[index]
34
+ };
35
+ }
@@ -73,6 +73,7 @@ export var akEditorToolbarKeylineHeight = 2;
73
73
  export var akEditorContextPanelWidth = 320;
74
74
  export var akEditorTableCellBlanketSelected = 'rgba(179, 212, 255, 0.3)';
75
75
  export var akEditorTableCellBlanketDeleted = 'rgba(255, 235, 230, 0.3)';
76
+ export var akEditorWrappedNodeZIndex = akEditorUnitZIndex * 2; //prevent paragraph nodes from rendering above wrapped nodes
76
77
 
77
78
  // @see typography spreadsheet: https://docs.google.com/spreadsheets/d/1iYusRGCT4PoPfvxbJ8NrgjtfFgXLm5lpDWXzjua1W2E/edit#gid=93913128
78
79
  export var blockNodesVerticalMargin = '0.75rem';
@@ -150,4 +151,61 @@ export var getTableCellBackgroundDarkModeColors = [['White', '#000000'], ['Light
150
151
  export function getTableCellBackgroundDarkModeColorCSS(colorName, colorValue) {
151
152
  return "\n &[colorname=\"".concat(colorName, "\"] {\n background-color: ").concat(colorValue, " !important; // !important to override default style color\n }\n ");
152
153
  }
153
- export var avatarColors = ["var(--ds-icon-accent-red, #C9372C)", "var(--ds-background-accent-red-bolder-hovered, #AE2E24)", "var(--ds-icon-accent-magenta, #CD519D)", "var(--ds-background-accent-magenta-bolder-hovered, #943D73)", "var(--ds-icon-accent-orange, #E56910)", "var(--ds-background-accent-orange-bolder-hovered, #A54800)", "var(--ds-icon-accent-green, #22A06B)", "var(--ds-background-accent-green-bolder-hovered, #216E4E)", "var(--ds-icon-accent-blue, #1D7AFC)", "var(--ds-background-accent-blue-bolder-hovered, #0055CC)", "var(--ds-icon-accent-teal, #2898BD)", "var(--ds-background-accent-teal-bolder-hovered, #206A83)", "var(--ds-icon-accent-lime, #6A9A23)", "var(--ds-background-accent-lime-bolder-hovered, #4C6B1F)", "var(--ds-icon-accent-purple, #8270DB)", "var(--ds-background-accent-purple-bolder-hovered, #5E4DB2)", "var(--ds-icon-accent-gray, #758195)", "var(--ds-background-accent-gray-bolder-hovered, #44546F)", "var(--ds-icon-accent-yellow, #B38600)", "var(--ds-background-accent-yellow-bolder-hovered, #7F5F01)", "var(--ds-background-accent-yellow-bolder-pressed, #533F04)"];
154
+ export var avatarColors = ["var(--ds-icon-accent-red, #C9372C)", "var(--ds-background-accent-red-bolder-hovered, #AE2E24)", "var(--ds-icon-accent-magenta, #CD519D)", "var(--ds-background-accent-magenta-bolder-hovered, #943D73)", "var(--ds-icon-accent-orange, #E56910)", "var(--ds-background-accent-orange-bolder-hovered, #A54800)", "var(--ds-icon-accent-green, #22A06B)", "var(--ds-background-accent-green-bolder-hovered, #216E4E)", "var(--ds-icon-accent-blue, #1D7AFC)", "var(--ds-background-accent-blue-bolder-hovered, #0055CC)", "var(--ds-icon-accent-teal, #2898BD)", "var(--ds-background-accent-teal-bolder-hovered, #206A83)", "var(--ds-icon-accent-lime, #6A9A23)", "var(--ds-background-accent-lime-bolder-hovered, #4C6B1F)", "var(--ds-icon-accent-purple, #8270DB)", "var(--ds-background-accent-purple-bolder-hovered, #5E4DB2)", "var(--ds-icon-accent-gray, #758195)", "var(--ds-background-accent-gray-bolder-hovered, #44546F)", "var(--ds-icon-accent-yellow, #B38600)", "var(--ds-background-accent-yellow-bolder-hovered, #7F5F01)", "var(--ds-background-accent-yellow-bolder-pressed, #533F04)"];
155
+
156
+ // MDS-569: Will update references to avatarColors to use participantColors instead, we will then deprecate avatarColors
157
+ export var participantColors = [{
158
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
159
+ backgroundColor: "var(--ds-background-accent-red-bolder, #C9372C)"
160
+ }, {
161
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
162
+ backgroundColor: "var(--ds-background-accent-blue-bolder, #0C66E4)"
163
+ }, {
164
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
165
+ backgroundColor: "var(--ds-background-accent-green-bolder, #1F845A)"
166
+ }, {
167
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
168
+ backgroundColor: "var(--ds-background-accent-yellow-bolder, #946F00)"
169
+ }, {
170
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
171
+ backgroundColor: "var(--ds-background-accent-purple-bolder, #6E5DC6)"
172
+ }, {
173
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
174
+ backgroundColor: "var(--ds-background-accent-magenta-bolder, #AE4787)"
175
+ }, {
176
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
177
+ backgroundColor: "var(--ds-background-accent-teal-bolder, #227D9B)"
178
+ }, {
179
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
180
+ backgroundColor: "var(--ds-background-accent-orange-bolder, #C25100)"
181
+ }, {
182
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
183
+ backgroundColor: "var(--ds-background-accent-lime-bolder, #5B7F24)"
184
+ }, {
185
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
186
+ backgroundColor: "var(--ds-background-accent-gray-bolder, #626F86)"
187
+ }, {
188
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
189
+ backgroundColor: "var(--ds-background-accent-blue-subtle, #579DFF)"
190
+ }, {
191
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
192
+ backgroundColor: "var(--ds-background-accent-red-subtle, #F87168)"
193
+ }, {
194
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
195
+ backgroundColor: "var(--ds-background-accent-orange-subtle, #FEA362)"
196
+ }, {
197
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
198
+ backgroundColor: "var(--ds-background-accent-yellow-subtle, #F5CD47)"
199
+ }, {
200
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
201
+ backgroundColor: "var(--ds-background-accent-green-subtle, #4BCE97)"
202
+ }, {
203
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
204
+ backgroundColor: "var(--ds-background-accent-teal-subtle, #6CC3E0)"
205
+ }, {
206
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
207
+ backgroundColor: "var(--ds-background-accent-purple-subtle, #9F8FEF)"
208
+ }, {
209
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
210
+ backgroundColor: "var(--ds-background-accent-magenta-subtle, #E774BB)"
211
+ }];
@@ -1 +1 @@
1
- export { akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorCustomIconSize, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellMinWidth, akEditorTableCellOnStickyHeaderZIndex, akEditorTableHeaderCellBackground, akEditorTableHeaderCellBackgroundDark, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, avatarColors, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, MAX_BROWSER_SCROLLBAR_HEIGHT, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT, FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorTableCellBlanketSelected, akEditorTableCellBlanketDeleted } from './consts';
1
+ export { akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorCustomIconSize, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellMinWidth, akEditorTableCellOnStickyHeaderZIndex, akEditorTableHeaderCellBackground, akEditorTableHeaderCellBackgroundDark, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, avatarColors, participantColors, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, MAX_BROWSER_SCROLLBAR_HEIGHT, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT, FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorTableCellBlanketSelected, akEditorTableCellBlanketDeleted, akEditorWrappedNodeZIndex } from './consts';
package/dist/esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
- export { akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellMinWidth, akEditorTableCellOnStickyHeaderZIndex, akEditorTableHeaderCellBackground, akEditorTableHeaderCellBackgroundDark, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, avatarColors, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, MAX_BROWSER_SCROLLBAR_HEIGHT, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT, FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorTableCellBlanketSelected, akEditorTableCellBlanketDeleted } from './consts';
1
+ export { akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellMinWidth, akEditorTableCellOnStickyHeaderZIndex, akEditorTableHeaderCellBackground, akEditorTableHeaderCellBackgroundDark, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, avatarColors, participantColors, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, MAX_BROWSER_SCROLLBAR_HEIGHT, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT, FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorTableCellBlanketSelected, akEditorTableCellBlanketDeleted, akEditorWrappedNodeZIndex } from './consts';
2
2
  export { SelectionStyle, getSelectionStyles, hideNativeBrowserTextSelectionStyles } from './selection';
3
- export { overflowShadow } from './overflow-shadow';
3
+ export { overflowShadow } from './overflow-shadow';
4
+ export { getParticipantColor } from './utils';
@@ -0,0 +1,35 @@
1
+ import { participantColors } from './consts';
2
+
3
+ /**
4
+ * Generates a hash code for a given string.
5
+ *
6
+ * This function computes a hash code by iterating over each character
7
+ * in the string and applying bitwise operations to accumulate the hash value.
8
+ *
9
+ * @param str - The input string for which the hash code is to be generated.
10
+ * @returns The computed hash code as a number.
11
+ */
12
+ export function getHashCode(str) {
13
+ var hash = 0;
14
+ for (var i = 0; i < str.length; i++) {
15
+ /* eslint-disable no-bitwise */
16
+ hash = (hash << 5) - hash + str.charCodeAt(i);
17
+ hash = (hash & hash) >>> 0;
18
+ /* eslint-enable no-bitwise */
19
+ }
20
+ return hash;
21
+ }
22
+
23
+ /**
24
+ * Returns the participant color based on the hash code of the input string.
25
+ *
26
+ * @param str - The input string used to determine the participant color.
27
+ * @returns An object containing the index and the corresponding participant color.
28
+ */
29
+ export function getParticipantColor(str) {
30
+ var index = getHashCode(str) % participantColors.length;
31
+ return {
32
+ index: index,
33
+ color: participantColors[index]
34
+ };
35
+ }
@@ -1,4 +1,4 @@
1
- import type { EditorTheme } from './types';
1
+ import type { EditorTheme, ParticipantColor } from './types';
2
2
  export declare const akEditorFullPageDefaultFontSize = 16;
3
3
  export declare const akEditorCodeFontFamily: "var(--ds-font-family-code)";
4
4
  export declare const akEditorSubtleAccent: "var(--ds-background-accent-gray-subtler)";
@@ -62,6 +62,7 @@ export declare const akEditorToolbarKeylineHeight = 2;
62
62
  export declare const akEditorContextPanelWidth = 320;
63
63
  export declare const akEditorTableCellBlanketSelected = "rgba(179, 212, 255, 0.3)";
64
64
  export declare const akEditorTableCellBlanketDeleted = "rgba(255, 235, 230, 0.3)";
65
+ export declare const akEditorWrappedNodeZIndex: number;
65
66
  export declare const blockNodesVerticalMargin = "0.75rem";
66
67
  export declare const DEFAULT_EMBED_CARD_WIDTH = 680;
67
68
  export declare const DEFAULT_EMBED_CARD_HEIGHT = 480;
@@ -112,3 +113,4 @@ export declare const akEditorMobileMaxWidth = 0;
112
113
  export declare const getTableCellBackgroundDarkModeColors: string;
113
114
  export declare function getTableCellBackgroundDarkModeColorCSS(colorName: string, colorValue: string): string;
114
115
  export declare const avatarColors: ("var(--ds-icon-accent-red)" | "var(--ds-background-accent-red-bolder-hovered)" | "var(--ds-icon-accent-magenta)" | "var(--ds-background-accent-magenta-bolder-hovered)" | "var(--ds-icon-accent-orange)" | "var(--ds-background-accent-orange-bolder-hovered)" | "var(--ds-icon-accent-green)" | "var(--ds-background-accent-green-bolder-hovered)" | "var(--ds-icon-accent-blue)" | "var(--ds-background-accent-blue-bolder-hovered)" | "var(--ds-icon-accent-teal)" | "var(--ds-background-accent-teal-bolder-hovered)" | "var(--ds-icon-accent-lime)" | "var(--ds-background-accent-lime-bolder-hovered)" | "var(--ds-icon-accent-purple)" | "var(--ds-background-accent-purple-bolder-hovered)" | "var(--ds-icon-accent-gray)" | "var(--ds-background-accent-gray-bolder-hovered)" | "var(--ds-icon-accent-yellow)" | "var(--ds-background-accent-yellow-bolder-hovered)" | "var(--ds-background-accent-yellow-bolder-pressed)")[];
116
+ export declare const participantColors: Array<ParticipantColor>;
@@ -1,2 +1,2 @@
1
- export type { EditorTheme } from './types';
2
- export { akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorCustomIconSize, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellMinWidth, akEditorTableCellOnStickyHeaderZIndex, akEditorTableHeaderCellBackground, akEditorTableHeaderCellBackgroundDark, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, avatarColors, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, MAX_BROWSER_SCROLLBAR_HEIGHT, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT, FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorTableCellBlanketSelected, akEditorTableCellBlanketDeleted, } from './consts';
1
+ export type { EditorTheme, ParticipantColor } from './types';
2
+ export { akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorCustomIconSize, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellMinWidth, akEditorTableCellOnStickyHeaderZIndex, akEditorTableHeaderCellBackground, akEditorTableHeaderCellBackgroundDark, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, avatarColors, participantColors, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, MAX_BROWSER_SCROLLBAR_HEIGHT, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT, FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorTableCellBlanketSelected, akEditorTableCellBlanketDeleted, akEditorWrappedNodeZIndex, } from './consts';
@@ -1,3 +1,7 @@
1
1
  export type EditorTheme = {
2
2
  baseFontSize?: number;
3
3
  };
4
+ export type ParticipantColor = {
5
+ textColor: string;
6
+ backgroundColor: string;
7
+ };
@@ -1,4 +1,5 @@
1
- export { akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellMinWidth, akEditorTableCellOnStickyHeaderZIndex, akEditorTableHeaderCellBackground, akEditorTableHeaderCellBackgroundDark, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, avatarColors, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, MAX_BROWSER_SCROLLBAR_HEIGHT, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT, FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorTableCellBlanketSelected, akEditorTableCellBlanketDeleted, } from './consts';
2
- export type { EditorTheme } from './consts';
1
+ export { akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellMinWidth, akEditorTableCellOnStickyHeaderZIndex, akEditorTableHeaderCellBackground, akEditorTableHeaderCellBackgroundDark, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, avatarColors, participantColors, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, MAX_BROWSER_SCROLLBAR_HEIGHT, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT, FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorTableCellBlanketSelected, akEditorTableCellBlanketDeleted, akEditorWrappedNodeZIndex, } from './consts';
2
+ export type { EditorTheme, ParticipantColor } from './consts';
3
3
  export { SelectionStyle, getSelectionStyles, hideNativeBrowserTextSelectionStyles, } from './selection';
4
4
  export { overflowShadow } from './overflow-shadow';
5
+ export { getParticipantColor } from './utils';
@@ -0,0 +1,21 @@
1
+ import { type ParticipantColor } from './consts';
2
+ /**
3
+ * Generates a hash code for a given string.
4
+ *
5
+ * This function computes a hash code by iterating over each character
6
+ * in the string and applying bitwise operations to accumulate the hash value.
7
+ *
8
+ * @param str - The input string for which the hash code is to be generated.
9
+ * @returns The computed hash code as a number.
10
+ */
11
+ export declare function getHashCode(str: string): number;
12
+ /**
13
+ * Returns the participant color based on the hash code of the input string.
14
+ *
15
+ * @param str - The input string used to determine the participant color.
16
+ * @returns An object containing the index and the corresponding participant color.
17
+ */
18
+ export declare function getParticipantColor(str: string): {
19
+ index: number;
20
+ color: ParticipantColor;
21
+ };
@@ -1,4 +1,4 @@
1
- import type { EditorTheme } from './types';
1
+ import type { EditorTheme, ParticipantColor } from './types';
2
2
  export declare const akEditorFullPageDefaultFontSize = 16;
3
3
  export declare const akEditorCodeFontFamily: "var(--ds-font-family-code)";
4
4
  export declare const akEditorSubtleAccent: "var(--ds-background-accent-gray-subtler)";
@@ -62,6 +62,7 @@ export declare const akEditorToolbarKeylineHeight = 2;
62
62
  export declare const akEditorContextPanelWidth = 320;
63
63
  export declare const akEditorTableCellBlanketSelected = "rgba(179, 212, 255, 0.3)";
64
64
  export declare const akEditorTableCellBlanketDeleted = "rgba(255, 235, 230, 0.3)";
65
+ export declare const akEditorWrappedNodeZIndex: number;
65
66
  export declare const blockNodesVerticalMargin = "0.75rem";
66
67
  export declare const DEFAULT_EMBED_CARD_WIDTH = 680;
67
68
  export declare const DEFAULT_EMBED_CARD_HEIGHT = 480;
@@ -112,3 +113,4 @@ export declare const akEditorMobileMaxWidth = 0;
112
113
  export declare const getTableCellBackgroundDarkModeColors: string;
113
114
  export declare function getTableCellBackgroundDarkModeColorCSS(colorName: string, colorValue: string): string;
114
115
  export declare const avatarColors: ("var(--ds-icon-accent-red)" | "var(--ds-background-accent-red-bolder-hovered)" | "var(--ds-icon-accent-magenta)" | "var(--ds-background-accent-magenta-bolder-hovered)" | "var(--ds-icon-accent-orange)" | "var(--ds-background-accent-orange-bolder-hovered)" | "var(--ds-icon-accent-green)" | "var(--ds-background-accent-green-bolder-hovered)" | "var(--ds-icon-accent-blue)" | "var(--ds-background-accent-blue-bolder-hovered)" | "var(--ds-icon-accent-teal)" | "var(--ds-background-accent-teal-bolder-hovered)" | "var(--ds-icon-accent-lime)" | "var(--ds-background-accent-lime-bolder-hovered)" | "var(--ds-icon-accent-purple)" | "var(--ds-background-accent-purple-bolder-hovered)" | "var(--ds-icon-accent-gray)" | "var(--ds-background-accent-gray-bolder-hovered)" | "var(--ds-icon-accent-yellow)" | "var(--ds-background-accent-yellow-bolder-hovered)" | "var(--ds-background-accent-yellow-bolder-pressed)")[];
116
+ export declare const participantColors: Array<ParticipantColor>;
@@ -1,2 +1,2 @@
1
- export type { EditorTheme } from './types';
2
- export { akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorCustomIconSize, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellMinWidth, akEditorTableCellOnStickyHeaderZIndex, akEditorTableHeaderCellBackground, akEditorTableHeaderCellBackgroundDark, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, avatarColors, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, MAX_BROWSER_SCROLLBAR_HEIGHT, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT, FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorTableCellBlanketSelected, akEditorTableCellBlanketDeleted, } from './consts';
1
+ export type { EditorTheme, ParticipantColor } from './types';
2
+ export { akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorCustomIconSize, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellMinWidth, akEditorTableCellOnStickyHeaderZIndex, akEditorTableHeaderCellBackground, akEditorTableHeaderCellBackgroundDark, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, avatarColors, participantColors, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, MAX_BROWSER_SCROLLBAR_HEIGHT, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT, FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorTableCellBlanketSelected, akEditorTableCellBlanketDeleted, akEditorWrappedNodeZIndex, } from './consts';
@@ -1,3 +1,7 @@
1
1
  export type EditorTheme = {
2
2
  baseFontSize?: number;
3
3
  };
4
+ export type ParticipantColor = {
5
+ textColor: string;
6
+ backgroundColor: string;
7
+ };
@@ -1,4 +1,5 @@
1
- export { akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellMinWidth, akEditorTableCellOnStickyHeaderZIndex, akEditorTableHeaderCellBackground, akEditorTableHeaderCellBackgroundDark, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, avatarColors, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, MAX_BROWSER_SCROLLBAR_HEIGHT, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT, FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorTableCellBlanketSelected, akEditorTableCellBlanketDeleted, } from './consts';
2
- export type { EditorTheme } from './consts';
1
+ export { akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellMinWidth, akEditorTableCellOnStickyHeaderZIndex, akEditorTableHeaderCellBackground, akEditorTableHeaderCellBackgroundDark, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, avatarColors, participantColors, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, MAX_BROWSER_SCROLLBAR_HEIGHT, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT, FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorTableCellBlanketSelected, akEditorTableCellBlanketDeleted, akEditorWrappedNodeZIndex, } from './consts';
2
+ export type { EditorTheme, ParticipantColor } from './consts';
3
3
  export { SelectionStyle, getSelectionStyles, hideNativeBrowserTextSelectionStyles, } from './selection';
4
4
  export { overflowShadow } from './overflow-shadow';
5
+ export { getParticipantColor } from './utils';
@@ -0,0 +1,21 @@
1
+ import { type ParticipantColor } from './consts';
2
+ /**
3
+ * Generates a hash code for a given string.
4
+ *
5
+ * This function computes a hash code by iterating over each character
6
+ * in the string and applying bitwise operations to accumulate the hash value.
7
+ *
8
+ * @param str - The input string for which the hash code is to be generated.
9
+ * @returns The computed hash code as a number.
10
+ */
11
+ export declare function getHashCode(str: string): number;
12
+ /**
13
+ * Returns the participant color based on the hash code of the input string.
14
+ *
15
+ * @param str - The input string used to determine the participant color.
16
+ * @returns An object containing the index and the corresponding participant color.
17
+ */
18
+ export declare function getParticipantColor(str: string): {
19
+ index: number;
20
+ color: ParticipantColor;
21
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-shared-styles",
3
- "version": "3.0.1",
3
+ "version": "3.1.1",
4
4
  "description": "Style values used in the editor/renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -46,7 +46,6 @@
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "@emotion/react": "^11.7.1"
48
48
  },
49
- "peerDependencies": {},
50
49
  "devDependencies": {
51
50
  "typescript": "~5.4.2"
52
51
  },
@@ -1,6 +1,12 @@
1
- import { relativeFontSizeToBase16 } from './consts';
1
+ import { participantColors, relativeFontSizeToBase16 } from './consts';
2
2
 
3
3
  describe('consts', () => {
4
+ describe('participantColors', () => {
5
+ it('should be an array of 18 colors', () => {
6
+ expect(participantColors).toHaveLength(18);
7
+ });
8
+ });
9
+
4
10
  describe('relativeFontSizeToBase16', () => {
5
11
  it('relativeFontSizeToBase16 should return 1rem with a base font size of 16px', () => {
6
12
  expect(relativeFontSizeToBase16(16)).toBe('1rem');
@@ -2,7 +2,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
2
2
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
3
  import { token } from '@atlaskit/tokens';
4
4
 
5
- import type { EditorTheme } from './types';
5
+ import type { EditorTheme, ParticipantColor } from './types';
6
6
 
7
7
  export const akEditorFullPageDefaultFontSize = 16;
8
8
  export const akEditorCodeFontFamily = token('font.family.code');
@@ -78,6 +78,7 @@ export const akEditorToolbarKeylineHeight = 2;
78
78
  export const akEditorContextPanelWidth = 320;
79
79
  export const akEditorTableCellBlanketSelected = 'rgba(179, 212, 255, 0.3)';
80
80
  export const akEditorTableCellBlanketDeleted = 'rgba(255, 235, 230, 0.3)';
81
+ export const akEditorWrappedNodeZIndex = akEditorUnitZIndex * 2; //prevent paragraph nodes from rendering above wrapped nodes
81
82
 
82
83
  // @see typography spreadsheet: https://docs.google.com/spreadsheets/d/1iYusRGCT4PoPfvxbJ8NrgjtfFgXLm5lpDWXzjua1W2E/edit#gid=93913128
83
84
  export const blockNodesVerticalMargin = '0.75rem';
@@ -192,3 +193,79 @@ export const avatarColors = [
192
193
  token('color.background.accent.yellow.bolder.hovered'),
193
194
  token('color.background.accent.yellow.bolder.pressed'),
194
195
  ];
196
+
197
+ // MDS-569: Will update references to avatarColors to use participantColors instead, we will then deprecate avatarColors
198
+ export const participantColors: Array<ParticipantColor> = [
199
+ {
200
+ textColor: token('color.text.inverse'),
201
+ backgroundColor: token('color.background.accent.red.bolder'),
202
+ },
203
+ {
204
+ textColor: token('color.text.inverse'),
205
+ backgroundColor: token('color.background.accent.blue.bolder'),
206
+ },
207
+ {
208
+ textColor: token('color.text.inverse'),
209
+ backgroundColor: token('color.background.accent.green.bolder'),
210
+ },
211
+ {
212
+ textColor: token('color.text.inverse'),
213
+ backgroundColor: token('color.background.accent.yellow.bolder'),
214
+ },
215
+ {
216
+ textColor: token('color.text.inverse'),
217
+ backgroundColor: token('color.background.accent.purple.bolder'),
218
+ },
219
+ {
220
+ textColor: token('color.text.inverse'),
221
+ backgroundColor: token('color.background.accent.magenta.bolder'),
222
+ },
223
+ {
224
+ textColor: token('color.text.inverse'),
225
+ backgroundColor: token('color.background.accent.teal.bolder'),
226
+ },
227
+ {
228
+ textColor: token('color.text.inverse'),
229
+ backgroundColor: token('color.background.accent.orange.bolder'),
230
+ },
231
+ {
232
+ textColor: token('color.text.inverse'),
233
+ backgroundColor: token('color.background.accent.lime.bolder'),
234
+ },
235
+ {
236
+ textColor: token('color.text.inverse'),
237
+ backgroundColor: token('color.background.accent.gray.bolder'),
238
+ },
239
+ {
240
+ textColor: token('color.text.accent.gray.bolder'),
241
+ backgroundColor: token('color.background.accent.blue.subtle'),
242
+ },
243
+ {
244
+ textColor: token('color.text.accent.gray.bolder'),
245
+ backgroundColor: token('color.background.accent.red.subtle'),
246
+ },
247
+ {
248
+ textColor: token('color.text.accent.gray.bolder'),
249
+ backgroundColor: token('color.background.accent.orange.subtle'),
250
+ },
251
+ {
252
+ textColor: token('color.text.accent.gray.bolder'),
253
+ backgroundColor: token('color.background.accent.yellow.subtle'),
254
+ },
255
+ {
256
+ textColor: token('color.text.accent.gray.bolder'),
257
+ backgroundColor: token('color.background.accent.green.subtle'),
258
+ },
259
+ {
260
+ textColor: token('color.text.accent.gray.bolder'),
261
+ backgroundColor: token('color.background.accent.teal.subtle'),
262
+ },
263
+ {
264
+ textColor: token('color.text.accent.gray.bolder'),
265
+ backgroundColor: token('color.background.accent.purple.subtle'),
266
+ },
267
+ {
268
+ textColor: token('color.text.accent.gray.bolder'),
269
+ backgroundColor: token('color.background.accent.magenta.subtle'),
270
+ },
271
+ ];
@@ -1,4 +1,4 @@
1
- export type { EditorTheme } from './types';
1
+ export type { EditorTheme, ParticipantColor } from './types';
2
2
  export {
3
3
  akEditorBlockquoteBorderColor,
4
4
  akEditorBreakoutPadding,
@@ -57,6 +57,7 @@ export {
57
57
  akLayoutGutterOffset,
58
58
  akRichMediaResizeZIndex,
59
59
  avatarColors,
60
+ participantColors,
60
61
  blockNodesVerticalMargin,
61
62
  breakoutWideScaleRatio,
62
63
  editorFontSize,
@@ -77,4 +78,5 @@ export {
77
78
  FULL_PAGE_EDITOR_TOOLBAR_HEIGHT,
78
79
  akEditorTableCellBlanketSelected,
79
80
  akEditorTableCellBlanketDeleted,
81
+ akEditorWrappedNodeZIndex,
80
82
  } from './consts';
@@ -1,3 +1,8 @@
1
1
  export type EditorTheme = {
2
2
  baseFontSize?: number;
3
3
  };
4
+
5
+ export type ParticipantColor = {
6
+ textColor: string;
7
+ backgroundColor: string;
8
+ };
package/src/index.ts CHANGED
@@ -55,6 +55,7 @@ export {
55
55
  akLayoutGutterOffset,
56
56
  akRichMediaResizeZIndex,
57
57
  avatarColors,
58
+ participantColors,
58
59
  blockNodesVerticalMargin,
59
60
  breakoutWideScaleRatio,
60
61
  editorFontSize,
@@ -75,8 +76,9 @@ export {
75
76
  FULL_PAGE_EDITOR_TOOLBAR_HEIGHT,
76
77
  akEditorTableCellBlanketSelected,
77
78
  akEditorTableCellBlanketDeleted,
79
+ akEditorWrappedNodeZIndex,
78
80
  } from './consts';
79
- export type { EditorTheme } from './consts';
81
+ export type { EditorTheme, ParticipantColor } from './consts';
80
82
 
81
83
  export {
82
84
  SelectionStyle,
@@ -85,3 +87,5 @@ export {
85
87
  } from './selection';
86
88
 
87
89
  export { overflowShadow } from './overflow-shadow';
90
+
91
+ export { getParticipantColor } from './utils';
@@ -0,0 +1,63 @@
1
+ import { token } from '@atlaskit/tokens';
2
+
3
+ import { getHashCode, getParticipantColor } from './utils';
4
+
5
+ describe('utils', () => {
6
+ describe('getHashCode', () => {
7
+ it('should return a hash code for a given string', () => {
8
+ expect(getHashCode('FawAXOcgL7ixM9qtAB0L')).toBe(2021471462);
9
+ expect(getHashCode('exB9qUN6fCHFlE-cAB0X')).toBe(2785253289);
10
+ expect(getHashCode('9NOVTX9WjLubYyVhAB0H')).toBe(3240394968);
11
+ expect(getHashCode('ceea2b46-6671-4827-a2ea-85e91a03f2ac')).toBe(308780004);
12
+ expect(getHashCode('42b0923a-c388-4cb8-b4f3-3210f95a489e')).toBe(1660294582);
13
+ expect(getHashCode('d3b6e136-0f93-4bf2-a7e7-cd93dcce20e8')).toBe(3395311041);
14
+ });
15
+ });
16
+
17
+ describe('getParticipantColor', () => {
18
+ it('should return a participant color based on the hash code of the input string', () => {
19
+ expect(getParticipantColor('FawAXOcgL7ixM9qtAB0L')).toEqual({
20
+ index: 2,
21
+ color: {
22
+ backgroundColor: token('color.background.accent.green.bolder'),
23
+ textColor: token('color.text.inverse'),
24
+ },
25
+ });
26
+ expect(getParticipantColor('exB9qUN6fCHFlE-cAB0X')).toEqual({
27
+ index: 15,
28
+ color: {
29
+ backgroundColor: token('color.background.accent.teal.subtle'),
30
+ textColor: token('color.text.accent.gray.bolder'),
31
+ },
32
+ });
33
+ expect(getParticipantColor('9NOVTX9WjLubYyVhAB0H')).toEqual({
34
+ index: 12,
35
+ color: {
36
+ backgroundColor: token('color.background.accent.orange.subtle'),
37
+ textColor: token('color.text.accent.gray.bolder'),
38
+ },
39
+ });
40
+ expect(getParticipantColor('ceea2b46-6671-4827-a2ea-85e91a03f2ac')).toEqual({
41
+ index: 12,
42
+ color: {
43
+ backgroundColor: token('color.background.accent.orange.subtle'),
44
+ textColor: token('color.text.accent.gray.bolder'),
45
+ },
46
+ });
47
+ expect(getParticipantColor('42b0923a-c388-4cb8-b4f3-3210f95a489e')).toEqual({
48
+ index: 16,
49
+ color: {
50
+ backgroundColor: token('color.background.accent.purple.subtle'),
51
+ textColor: token('color.text.accent.gray.bolder'),
52
+ },
53
+ });
54
+ expect(getParticipantColor('d3b6e136-0f93-4bf2-a7e7-cd93dcce20e8')).toEqual({
55
+ index: 3,
56
+ color: {
57
+ backgroundColor: token('color.background.accent.yellow.bolder'),
58
+ textColor: token('color.text.inverse'),
59
+ },
60
+ });
61
+ });
62
+ });
63
+ });
package/src/utils.ts ADDED
@@ -0,0 +1,35 @@
1
+ import { type ParticipantColor, participantColors } from './consts';
2
+
3
+ /**
4
+ * Generates a hash code for a given string.
5
+ *
6
+ * This function computes a hash code by iterating over each character
7
+ * in the string and applying bitwise operations to accumulate the hash value.
8
+ *
9
+ * @param str - The input string for which the hash code is to be generated.
10
+ * @returns The computed hash code as a number.
11
+ */
12
+ export function getHashCode(str: string): number {
13
+ let hash = 0;
14
+
15
+ for (let i = 0; i < str.length; i++) {
16
+ /* eslint-disable no-bitwise */
17
+ hash = (hash << 5) - hash + str.charCodeAt(i);
18
+ hash = (hash & hash) >>> 0;
19
+ /* eslint-enable no-bitwise */
20
+ }
21
+
22
+ return hash;
23
+ }
24
+
25
+ /**
26
+ * Returns the participant color based on the hash code of the input string.
27
+ *
28
+ * @param str - The input string used to determine the participant color.
29
+ * @returns An object containing the index and the corresponding participant color.
30
+ */
31
+ export function getParticipantColor(str: string): { index: number; color: ParticipantColor } {
32
+ const index = getHashCode(str) % participantColors.length;
33
+
34
+ return { index, color: participantColors[index] };
35
+ }