@atlaskit/editor-shared-styles 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-shared-styles
2
2
 
3
+ ## 3.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#155573](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/155573)
8
+ [`92ca0dc09c6ac`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/92ca0dc09c6ac) -
9
+ Create new participantColors constant to be used in future updates to avatar badges and
10
+ telepointers
11
+
3
12
  ## 3.0.1
4
13
 
5
14
  ### Patch Changes
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
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;
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 */
@@ -159,4 +159,61 @@ var getTableCellBackgroundDarkModeColors = exports.getTableCellBackgroundDarkMod
159
159
  function getTableCellBackgroundDarkModeColorCSS(colorName, colorValue) {
160
160
  return "\n &[colorname=\"".concat(colorName, "\"] {\n background-color: ").concat(colorValue, " !important; // !important to override default style color\n }\n ");
161
161
  }
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)"];
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
+
164
+ // MDS-569: Will update references to avatarColors to use participantColors instead, we will then deprecate avatarColors
165
+ var participantColors = exports.participantColors = [{
166
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
167
+ backgroundColor: "var(--ds-background-accent-red-bolder, #C9372C)"
168
+ }, {
169
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
170
+ backgroundColor: "var(--ds-background-accent-blue-bolder, #0C66E4)"
171
+ }, {
172
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
173
+ backgroundColor: "var(--ds-background-accent-green-bolder, #1F845A)"
174
+ }, {
175
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
176
+ backgroundColor: "var(--ds-background-accent-yellow-bolder, #946F00)"
177
+ }, {
178
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
179
+ backgroundColor: "var(--ds-background-accent-purple-bolder, #6E5DC6)"
180
+ }, {
181
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
182
+ backgroundColor: "var(--ds-background-accent-magenta-bolder, #AE4787)"
183
+ }, {
184
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
185
+ backgroundColor: "var(--ds-background-accent-teal-bolder, #227D9B)"
186
+ }, {
187
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
188
+ backgroundColor: "var(--ds-background-accent-orange-bolder, #C25100)"
189
+ }, {
190
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
191
+ backgroundColor: "var(--ds-background-accent-lime-bolder, #5B7F24)"
192
+ }, {
193
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
194
+ backgroundColor: "var(--ds-background-accent-gray-bolder, #626F86)"
195
+ }, {
196
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
197
+ backgroundColor: "var(--ds-background-accent-blue-subtle, #579DFF)"
198
+ }, {
199
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
200
+ backgroundColor: "var(--ds-background-accent-red-subtle, #F87168)"
201
+ }, {
202
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
203
+ backgroundColor: "var(--ds-background-accent-orange-subtle, #FEA362)"
204
+ }, {
205
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
206
+ backgroundColor: "var(--ds-background-accent-yellow-subtle, #F5CD47)"
207
+ }, {
208
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
209
+ backgroundColor: "var(--ds-background-accent-green-subtle, #4BCE97)"
210
+ }, {
211
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
212
+ backgroundColor: "var(--ds-background-accent-teal-subtle, #6CC3E0)"
213
+ }, {
214
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
215
+ backgroundColor: "var(--ds-background-accent-purple-subtle, #9F8FEF)"
216
+ }, {
217
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
218
+ backgroundColor: "var(--ds-background-accent-magenta-subtle, #E774BB)"
219
+ }];
@@ -453,6 +453,12 @@ Object.defineProperty(exports, "gridMediumMaxWidth", {
453
453
  return _consts.gridMediumMaxWidth;
454
454
  }
455
455
  });
456
+ Object.defineProperty(exports, "participantColors", {
457
+ enumerable: true,
458
+ get: function get() {
459
+ return _consts.participantColors;
460
+ }
461
+ });
456
462
  Object.defineProperty(exports, "relativeFontSizeToBase16", {
457
463
  enumerable: true,
458
464
  get: function get() {
package/dist/cjs/index.js CHANGED
@@ -441,6 +441,12 @@ Object.defineProperty(exports, "editorFontSize", {
441
441
  return _consts.editorFontSize;
442
442
  }
443
443
  });
444
+ Object.defineProperty(exports, "getParticipantColor", {
445
+ enumerable: true,
446
+ get: function get() {
447
+ return _utils.getParticipantColor;
448
+ }
449
+ });
444
450
  Object.defineProperty(exports, "getSelectionStyles", {
445
451
  enumerable: true,
446
452
  get: function get() {
@@ -471,6 +477,12 @@ Object.defineProperty(exports, "overflowShadow", {
471
477
  return _overflowShadow.overflowShadow;
472
478
  }
473
479
  });
480
+ Object.defineProperty(exports, "participantColors", {
481
+ enumerable: true,
482
+ get: function get() {
483
+ return _consts.participantColors;
484
+ }
485
+ });
474
486
  Object.defineProperty(exports, "relativeFontSizeToBase16", {
475
487
  enumerable: true,
476
488
  get: function get() {
@@ -485,4 +497,5 @@ Object.defineProperty(exports, "relativeSize", {
485
497
  });
486
498
  var _consts = require("./consts");
487
499
  var _selection = require("./selection");
488
- var _overflowShadow = require("./overflow-shadow");
500
+ var _overflowShadow = require("./overflow-shadow");
501
+ 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
+ }
@@ -140,4 +140,61 @@ export function getTableCellBackgroundDarkModeColorCSS(colorName, colorValue) {
140
140
  }
141
141
  `;
142
142
  }
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)"];
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
+
145
+ // MDS-569: Will update references to avatarColors to use participantColors instead, we will then deprecate avatarColors
146
+ export const participantColors = [{
147
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
148
+ backgroundColor: "var(--ds-background-accent-red-bolder, #C9372C)"
149
+ }, {
150
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
151
+ backgroundColor: "var(--ds-background-accent-blue-bolder, #0C66E4)"
152
+ }, {
153
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
154
+ backgroundColor: "var(--ds-background-accent-green-bolder, #1F845A)"
155
+ }, {
156
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
157
+ backgroundColor: "var(--ds-background-accent-yellow-bolder, #946F00)"
158
+ }, {
159
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
160
+ backgroundColor: "var(--ds-background-accent-purple-bolder, #6E5DC6)"
161
+ }, {
162
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
163
+ backgroundColor: "var(--ds-background-accent-magenta-bolder, #AE4787)"
164
+ }, {
165
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
166
+ backgroundColor: "var(--ds-background-accent-teal-bolder, #227D9B)"
167
+ }, {
168
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
169
+ backgroundColor: "var(--ds-background-accent-orange-bolder, #C25100)"
170
+ }, {
171
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
172
+ backgroundColor: "var(--ds-background-accent-lime-bolder, #5B7F24)"
173
+ }, {
174
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
175
+ backgroundColor: "var(--ds-background-accent-gray-bolder, #626F86)"
176
+ }, {
177
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
178
+ backgroundColor: "var(--ds-background-accent-blue-subtle, #579DFF)"
179
+ }, {
180
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
181
+ backgroundColor: "var(--ds-background-accent-red-subtle, #F87168)"
182
+ }, {
183
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
184
+ backgroundColor: "var(--ds-background-accent-orange-subtle, #FEA362)"
185
+ }, {
186
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
187
+ backgroundColor: "var(--ds-background-accent-yellow-subtle, #F5CD47)"
188
+ }, {
189
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
190
+ backgroundColor: "var(--ds-background-accent-green-subtle, #4BCE97)"
191
+ }, {
192
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
193
+ backgroundColor: "var(--ds-background-accent-teal-subtle, #6CC3E0)"
194
+ }, {
195
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
196
+ backgroundColor: "var(--ds-background-accent-purple-subtle, #9F8FEF)"
197
+ }, {
198
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
199
+ backgroundColor: "var(--ds-background-accent-magenta-subtle, #E774BB)"
200
+ }];
@@ -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 } 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 } 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
+ }
@@ -150,4 +150,61 @@ export var getTableCellBackgroundDarkModeColors = [['White', '#000000'], ['Light
150
150
  export function getTableCellBackgroundDarkModeColorCSS(colorName, colorValue) {
151
151
  return "\n &[colorname=\"".concat(colorName, "\"] {\n background-color: ").concat(colorValue, " !important; // !important to override default style color\n }\n ");
152
152
  }
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)"];
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
+
155
+ // MDS-569: Will update references to avatarColors to use participantColors instead, we will then deprecate avatarColors
156
+ export var participantColors = [{
157
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
158
+ backgroundColor: "var(--ds-background-accent-red-bolder, #C9372C)"
159
+ }, {
160
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
161
+ backgroundColor: "var(--ds-background-accent-blue-bolder, #0C66E4)"
162
+ }, {
163
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
164
+ backgroundColor: "var(--ds-background-accent-green-bolder, #1F845A)"
165
+ }, {
166
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
167
+ backgroundColor: "var(--ds-background-accent-yellow-bolder, #946F00)"
168
+ }, {
169
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
170
+ backgroundColor: "var(--ds-background-accent-purple-bolder, #6E5DC6)"
171
+ }, {
172
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
173
+ backgroundColor: "var(--ds-background-accent-magenta-bolder, #AE4787)"
174
+ }, {
175
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
176
+ backgroundColor: "var(--ds-background-accent-teal-bolder, #227D9B)"
177
+ }, {
178
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
179
+ backgroundColor: "var(--ds-background-accent-orange-bolder, #C25100)"
180
+ }, {
181
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
182
+ backgroundColor: "var(--ds-background-accent-lime-bolder, #5B7F24)"
183
+ }, {
184
+ textColor: "var(--ds-text-inverse, #FFFFFF)",
185
+ backgroundColor: "var(--ds-background-accent-gray-bolder, #626F86)"
186
+ }, {
187
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
188
+ backgroundColor: "var(--ds-background-accent-blue-subtle, #579DFF)"
189
+ }, {
190
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
191
+ backgroundColor: "var(--ds-background-accent-red-subtle, #F87168)"
192
+ }, {
193
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
194
+ backgroundColor: "var(--ds-background-accent-orange-subtle, #FEA362)"
195
+ }, {
196
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
197
+ backgroundColor: "var(--ds-background-accent-yellow-subtle, #F5CD47)"
198
+ }, {
199
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
200
+ backgroundColor: "var(--ds-background-accent-green-subtle, #4BCE97)"
201
+ }, {
202
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
203
+ backgroundColor: "var(--ds-background-accent-teal-subtle, #6CC3E0)"
204
+ }, {
205
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
206
+ backgroundColor: "var(--ds-background-accent-purple-subtle, #9F8FEF)"
207
+ }, {
208
+ textColor: "var(--ds-text-accent-gray-bolder, #091E42)",
209
+ backgroundColor: "var(--ds-background-accent-magenta-subtle, #E774BB)"
210
+ }];
@@ -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 } 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 } 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)";
@@ -112,3 +112,4 @@ export declare const akEditorMobileMaxWidth = 0;
112
112
  export declare const getTableCellBackgroundDarkModeColors: string;
113
113
  export declare function getTableCellBackgroundDarkModeColorCSS(colorName: string, colorValue: string): string;
114
114
  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)")[];
115
+ 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, } 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, } 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)";
@@ -112,3 +112,4 @@ export declare const akEditorMobileMaxWidth = 0;
112
112
  export declare const getTableCellBackgroundDarkModeColors: string;
113
113
  export declare function getTableCellBackgroundDarkModeColorCSS(colorName: string, colorValue: string): string;
114
114
  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)")[];
115
+ 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, } 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, } 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.0",
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');
@@ -192,3 +192,79 @@ export const avatarColors = [
192
192
  token('color.background.accent.yellow.bolder.hovered'),
193
193
  token('color.background.accent.yellow.bolder.pressed'),
194
194
  ];
195
+
196
+ // MDS-569: Will update references to avatarColors to use participantColors instead, we will then deprecate avatarColors
197
+ export const participantColors: Array<ParticipantColor> = [
198
+ {
199
+ textColor: token('color.text.inverse'),
200
+ backgroundColor: token('color.background.accent.red.bolder'),
201
+ },
202
+ {
203
+ textColor: token('color.text.inverse'),
204
+ backgroundColor: token('color.background.accent.blue.bolder'),
205
+ },
206
+ {
207
+ textColor: token('color.text.inverse'),
208
+ backgroundColor: token('color.background.accent.green.bolder'),
209
+ },
210
+ {
211
+ textColor: token('color.text.inverse'),
212
+ backgroundColor: token('color.background.accent.yellow.bolder'),
213
+ },
214
+ {
215
+ textColor: token('color.text.inverse'),
216
+ backgroundColor: token('color.background.accent.purple.bolder'),
217
+ },
218
+ {
219
+ textColor: token('color.text.inverse'),
220
+ backgroundColor: token('color.background.accent.magenta.bolder'),
221
+ },
222
+ {
223
+ textColor: token('color.text.inverse'),
224
+ backgroundColor: token('color.background.accent.teal.bolder'),
225
+ },
226
+ {
227
+ textColor: token('color.text.inverse'),
228
+ backgroundColor: token('color.background.accent.orange.bolder'),
229
+ },
230
+ {
231
+ textColor: token('color.text.inverse'),
232
+ backgroundColor: token('color.background.accent.lime.bolder'),
233
+ },
234
+ {
235
+ textColor: token('color.text.inverse'),
236
+ backgroundColor: token('color.background.accent.gray.bolder'),
237
+ },
238
+ {
239
+ textColor: token('color.text.accent.gray.bolder'),
240
+ backgroundColor: token('color.background.accent.blue.subtle'),
241
+ },
242
+ {
243
+ textColor: token('color.text.accent.gray.bolder'),
244
+ backgroundColor: token('color.background.accent.red.subtle'),
245
+ },
246
+ {
247
+ textColor: token('color.text.accent.gray.bolder'),
248
+ backgroundColor: token('color.background.accent.orange.subtle'),
249
+ },
250
+ {
251
+ textColor: token('color.text.accent.gray.bolder'),
252
+ backgroundColor: token('color.background.accent.yellow.subtle'),
253
+ },
254
+ {
255
+ textColor: token('color.text.accent.gray.bolder'),
256
+ backgroundColor: token('color.background.accent.green.subtle'),
257
+ },
258
+ {
259
+ textColor: token('color.text.accent.gray.bolder'),
260
+ backgroundColor: token('color.background.accent.teal.subtle'),
261
+ },
262
+ {
263
+ textColor: token('color.text.accent.gray.bolder'),
264
+ backgroundColor: token('color.background.accent.purple.subtle'),
265
+ },
266
+ {
267
+ textColor: token('color.text.accent.gray.bolder'),
268
+ backgroundColor: token('color.background.accent.magenta.subtle'),
269
+ },
270
+ ];
@@ -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,
@@ -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,
@@ -76,7 +77,7 @@ export {
76
77
  akEditorTableCellBlanketSelected,
77
78
  akEditorTableCellBlanketDeleted,
78
79
  } from './consts';
79
- export type { EditorTheme } from './consts';
80
+ export type { EditorTheme, ParticipantColor } from './consts';
80
81
 
81
82
  export {
82
83
  SelectionStyle,
@@ -85,3 +86,5 @@ export {
85
86
  } from './selection';
86
87
 
87
88
  export { overflowShadow } from './overflow-shadow';
89
+
90
+ 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
+ }