@atlaskit/editor-shared-styles 4.1.17 → 4.2.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,24 @@
1
1
  # @atlaskit/editor-shared-styles
2
2
 
3
+ ## 4.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 4.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`920a9bc294e07`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/920a9bc294e07) -
14
+ Show names for supported external agents, plus Claude branding and its consistent orange diff
15
+ colour. Share the Claude colour override through getParticipantColor for diff attribution and
16
+ collaboration telepointers behind confluence_ncs_step_diffing_version_history.
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 4.1.17
4
23
 
5
24
  ### Patch Changes
package/dist/cjs/utils.js CHANGED
@@ -6,6 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getHashCode = getHashCode;
7
7
  exports.getParticipantColor = getParticipantColor;
8
8
  var _consts = require("./consts");
9
+ /** Agent types with a fixed participant colour instead of an identity-derived colour. */
10
+ var AGENT_PARTICIPANT_COLOR_OVERRIDES = {
11
+ claude: 7,
12
+ rovo_chat: 4
13
+ };
14
+
9
15
  /**
10
16
  * Generates a hash code for a given string.
11
17
  *
@@ -27,12 +33,22 @@ function getHashCode(str) {
27
33
  }
28
34
 
29
35
  /**
30
- * Returns the participant color based on the hash code of the input string.
36
+ * Returns an agent brand colour when known, otherwise hashes the participant identity.
31
37
  *
32
38
  * @param str - The input string used to determine the participant color.
33
- * @returns An object containing the index and the corresponding participant color.
39
+ * @param agentType - Optional agent type supplied by agent-aware callers.
40
+ * @returns The palette colour and index; `isFixed` prevents callers from reallocating brand colours.
34
41
  */
35
- function getParticipantColor(str) {
42
+ function getParticipantColor(str, agentType) {
43
+ var fixedColorIndex = agentType ? AGENT_PARTICIPANT_COLOR_OVERRIDES[agentType.trim().toLowerCase()] : undefined;
44
+ if (fixedColorIndex !== undefined) {
45
+ var _index = fixedColorIndex;
46
+ return {
47
+ index: _index,
48
+ color: _consts.participantColors[_index],
49
+ isFixed: true
50
+ };
51
+ }
36
52
  var index = getHashCode(str) % _consts.participantColors.length;
37
53
  return {
38
54
  index: index,
@@ -1,5 +1,11 @@
1
1
  import { participantColors } from './consts';
2
2
 
3
+ /** Agent types with a fixed participant colour instead of an identity-derived colour. */
4
+ const AGENT_PARTICIPANT_COLOR_OVERRIDES = {
5
+ claude: 7,
6
+ rovo_chat: 4
7
+ };
8
+
3
9
  /**
4
10
  * Generates a hash code for a given string.
5
11
  *
@@ -21,12 +27,22 @@ export function getHashCode(str) {
21
27
  }
22
28
 
23
29
  /**
24
- * Returns the participant color based on the hash code of the input string.
30
+ * Returns an agent brand colour when known, otherwise hashes the participant identity.
25
31
  *
26
32
  * @param str - The input string used to determine the participant color.
27
- * @returns An object containing the index and the corresponding participant color.
33
+ * @param agentType - Optional agent type supplied by agent-aware callers.
34
+ * @returns The palette colour and index; `isFixed` prevents callers from reallocating brand colours.
28
35
  */
29
- export function getParticipantColor(str) {
36
+ export function getParticipantColor(str, agentType) {
37
+ const fixedColorIndex = agentType ? AGENT_PARTICIPANT_COLOR_OVERRIDES[agentType.trim().toLowerCase()] : undefined;
38
+ if (fixedColorIndex !== undefined) {
39
+ const index = fixedColorIndex;
40
+ return {
41
+ index,
42
+ color: participantColors[index],
43
+ isFixed: true
44
+ };
45
+ }
30
46
  const index = getHashCode(str) % participantColors.length;
31
47
  return {
32
48
  index,
package/dist/esm/utils.js CHANGED
@@ -1,5 +1,11 @@
1
1
  import { participantColors } from './consts';
2
2
 
3
+ /** Agent types with a fixed participant colour instead of an identity-derived colour. */
4
+ var AGENT_PARTICIPANT_COLOR_OVERRIDES = {
5
+ claude: 7,
6
+ rovo_chat: 4
7
+ };
8
+
3
9
  /**
4
10
  * Generates a hash code for a given string.
5
11
  *
@@ -21,12 +27,22 @@ export function getHashCode(str) {
21
27
  }
22
28
 
23
29
  /**
24
- * Returns the participant color based on the hash code of the input string.
30
+ * Returns an agent brand colour when known, otherwise hashes the participant identity.
25
31
  *
26
32
  * @param str - The input string used to determine the participant color.
27
- * @returns An object containing the index and the corresponding participant color.
33
+ * @param agentType - Optional agent type supplied by agent-aware callers.
34
+ * @returns The palette colour and index; `isFixed` prevents callers from reallocating brand colours.
28
35
  */
29
- export function getParticipantColor(str) {
36
+ export function getParticipantColor(str, agentType) {
37
+ var fixedColorIndex = agentType ? AGENT_PARTICIPANT_COLOR_OVERRIDES[agentType.trim().toLowerCase()] : undefined;
38
+ if (fixedColorIndex !== undefined) {
39
+ var _index = fixedColorIndex;
40
+ return {
41
+ index: _index,
42
+ color: participantColors[_index],
43
+ isFixed: true
44
+ };
45
+ }
30
46
  var index = getHashCode(str) % participantColors.length;
31
47
  return {
32
48
  index: index,
@@ -10,12 +10,14 @@ import { type ParticipantColor } from './consts';
10
10
  */
11
11
  export declare function getHashCode(str: string): number;
12
12
  /**
13
- * Returns the participant color based on the hash code of the input string.
13
+ * Returns an agent brand colour when known, otherwise hashes the participant identity.
14
14
  *
15
15
  * @param str - The input string used to determine the participant color.
16
- * @returns An object containing the index and the corresponding participant color.
16
+ * @param agentType - Optional agent type supplied by agent-aware callers.
17
+ * @returns The palette colour and index; `isFixed` prevents callers from reallocating brand colours.
17
18
  */
18
- export declare function getParticipantColor(str: string): {
19
+ export declare function getParticipantColor(str: string, agentType?: string): {
19
20
  color: ParticipantColor;
20
21
  index: number;
22
+ isFixed?: true;
21
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-shared-styles",
3
- "version": "4.1.17",
3
+ "version": "4.2.1",
4
4
  "description": "Style values used in the editor/renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@atlaskit/platform-feature-flags": "^2.2.0",
32
- "@atlaskit/tmp-editor-statsig": "^185.0.0",
33
- "@atlaskit/tokens": "^16.11.0",
32
+ "@atlaskit/tmp-editor-statsig": "^187.0.0",
33
+ "@atlaskit/tokens": "^16.12.0",
34
34
  "@babel/runtime": "^7.0.0",
35
35
  "@emotion/react": "^11.7.1"
36
36
  }