@atlaskit/editor-shared-styles 4.2.2 → 4.3.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,23 @@
1
1
  # @atlaskit/editor-shared-styles
2
2
 
3
+ ## 4.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 4.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`a8b0726ce1e34`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a8b0726ce1e34) -
14
+ Adds shared semantic agent colour resolution and aligns diff history with agent telepointers
15
+ behind `confluence_ncs_step_diffing_version_history`.
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 4.2.2
4
22
 
5
23
  ### Patch Changes
package/dist/cjs/utils.js CHANGED
@@ -5,13 +5,27 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getHashCode = getHashCode;
7
7
  exports.getParticipantColor = getParticipantColor;
8
+ var _getAgentColor = require("@atlaskit/agent-color/get-agent-color");
8
9
  var _consts = require("./consts");
9
- /** Agent types with a fixed participant colour instead of an identity-derived colour. */
10
+ /**
11
+ * Agent types with a fixed participant colour instead of an identity-derived colour.
12
+ *
13
+ * Claude uses orange, which is `participantColors[7]`. The palette's numbered positions also
14
+ * back the telepointer CSS classes, so preserve this position when editing the palette.
15
+ */
10
16
  var AGENT_PARTICIPANT_COLOR_OVERRIDES = {
11
17
  claude: 7,
12
18
  rovo_chat: 4
13
19
  };
14
20
 
21
+ /** Maps Agent Studio's semantic palette to the established telepointer palette slots. */
22
+ var AGENT_COLOR_TO_PARTICIPANT_COLOR_INDEX = {
23
+ yellow: 3,
24
+ purple: 4,
25
+ lime: 2,
26
+ blue: 1
27
+ };
28
+
15
29
  /**
16
30
  * Generates a hash code for a given string.
17
31
  *
@@ -33,7 +47,7 @@ function getHashCode(str) {
33
47
  }
34
48
 
35
49
  /**
36
- * Returns an agent brand colour when known, otherwise hashes the participant identity.
50
+ * Returns a fixed agent brand colour, an Agent Studio palette preference, or a hashed identity.
37
51
  *
38
52
  * @param str - The input string used to determine the participant color.
39
53
  * @param agentType - Optional agent type supplied by agent-aware callers.
@@ -49,7 +63,10 @@ function getParticipantColor(str, agentType) {
49
63
  isFixed: true
50
64
  };
51
65
  }
52
- var index = getHashCode(str) % _consts.participantColors.length;
66
+ var agentColor = agentType ? (0, _getAgentColor.getAgentColor)({
67
+ agentId: str
68
+ }) : undefined;
69
+ var index = agentColor ? AGENT_COLOR_TO_PARTICIPANT_COLOR_INDEX[agentColor] : getHashCode(str) % _consts.participantColors.length;
53
70
  return {
54
71
  index: index,
55
72
  color: _consts.participantColors[index]
@@ -1,11 +1,25 @@
1
+ import { getAgentColor } from '@atlaskit/agent-color/get-agent-color';
1
2
  import { participantColors } from './consts';
2
3
 
3
- /** Agent types with a fixed participant colour instead of an identity-derived colour. */
4
+ /**
5
+ * Agent types with a fixed participant colour instead of an identity-derived colour.
6
+ *
7
+ * Claude uses orange, which is `participantColors[7]`. The palette's numbered positions also
8
+ * back the telepointer CSS classes, so preserve this position when editing the palette.
9
+ */
4
10
  const AGENT_PARTICIPANT_COLOR_OVERRIDES = {
5
11
  claude: 7,
6
12
  rovo_chat: 4
7
13
  };
8
14
 
15
+ /** Maps Agent Studio's semantic palette to the established telepointer palette slots. */
16
+ const AGENT_COLOR_TO_PARTICIPANT_COLOR_INDEX = {
17
+ yellow: 3,
18
+ purple: 4,
19
+ lime: 2,
20
+ blue: 1
21
+ };
22
+
9
23
  /**
10
24
  * Generates a hash code for a given string.
11
25
  *
@@ -27,7 +41,7 @@ export function getHashCode(str) {
27
41
  }
28
42
 
29
43
  /**
30
- * Returns an agent brand colour when known, otherwise hashes the participant identity.
44
+ * Returns a fixed agent brand colour, an Agent Studio palette preference, or a hashed identity.
31
45
  *
32
46
  * @param str - The input string used to determine the participant color.
33
47
  * @param agentType - Optional agent type supplied by agent-aware callers.
@@ -43,7 +57,10 @@ export function getParticipantColor(str, agentType) {
43
57
  isFixed: true
44
58
  };
45
59
  }
46
- const index = getHashCode(str) % participantColors.length;
60
+ const agentColor = agentType ? getAgentColor({
61
+ agentId: str
62
+ }) : undefined;
63
+ const index = agentColor ? AGENT_COLOR_TO_PARTICIPANT_COLOR_INDEX[agentColor] : getHashCode(str) % participantColors.length;
47
64
  return {
48
65
  index,
49
66
  color: participantColors[index]
package/dist/esm/utils.js CHANGED
@@ -1,11 +1,25 @@
1
+ import { getAgentColor } from '@atlaskit/agent-color/get-agent-color';
1
2
  import { participantColors } from './consts';
2
3
 
3
- /** Agent types with a fixed participant colour instead of an identity-derived colour. */
4
+ /**
5
+ * Agent types with a fixed participant colour instead of an identity-derived colour.
6
+ *
7
+ * Claude uses orange, which is `participantColors[7]`. The palette's numbered positions also
8
+ * back the telepointer CSS classes, so preserve this position when editing the palette.
9
+ */
4
10
  var AGENT_PARTICIPANT_COLOR_OVERRIDES = {
5
11
  claude: 7,
6
12
  rovo_chat: 4
7
13
  };
8
14
 
15
+ /** Maps Agent Studio's semantic palette to the established telepointer palette slots. */
16
+ var AGENT_COLOR_TO_PARTICIPANT_COLOR_INDEX = {
17
+ yellow: 3,
18
+ purple: 4,
19
+ lime: 2,
20
+ blue: 1
21
+ };
22
+
9
23
  /**
10
24
  * Generates a hash code for a given string.
11
25
  *
@@ -27,7 +41,7 @@ export function getHashCode(str) {
27
41
  }
28
42
 
29
43
  /**
30
- * Returns an agent brand colour when known, otherwise hashes the participant identity.
44
+ * Returns a fixed agent brand colour, an Agent Studio palette preference, or a hashed identity.
31
45
  *
32
46
  * @param str - The input string used to determine the participant color.
33
47
  * @param agentType - Optional agent type supplied by agent-aware callers.
@@ -43,7 +57,10 @@ export function getParticipantColor(str, agentType) {
43
57
  isFixed: true
44
58
  };
45
59
  }
46
- var index = getHashCode(str) % participantColors.length;
60
+ var agentColor = agentType ? getAgentColor({
61
+ agentId: str
62
+ }) : undefined;
63
+ var index = agentColor ? AGENT_COLOR_TO_PARTICIPANT_COLOR_INDEX[agentColor] : getHashCode(str) % participantColors.length;
47
64
  return {
48
65
  index: index,
49
66
  color: participantColors[index]
@@ -10,7 +10,7 @@ import { type ParticipantColor } from './consts';
10
10
  */
11
11
  export declare function getHashCode(str: string): number;
12
12
  /**
13
- * Returns an agent brand colour when known, otherwise hashes the participant identity.
13
+ * Returns a fixed agent brand colour, an Agent Studio palette preference, or a hashed identity.
14
14
  *
15
15
  * @param str - The input string used to determine the participant color.
16
16
  * @param agentType - Optional agent type supplied by agent-aware callers.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-shared-styles",
3
- "version": "4.2.2",
3
+ "version": "4.3.1",
4
4
  "description": "Style values used in the editor/renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -28,8 +28,9 @@
28
28
  }
29
29
  },
30
30
  "dependencies": {
31
+ "@atlaskit/agent-color": "^0.1.0",
31
32
  "@atlaskit/platform-feature-flags": "^2.2.0",
32
- "@atlaskit/tmp-editor-statsig": "^188.0.0",
33
+ "@atlaskit/tmp-editor-statsig": "^189.0.0",
33
34
  "@atlaskit/tokens": "^16.12.0",
34
35
  "@babel/runtime": "^7.0.0",
35
36
  "@emotion/react": "^11.7.1"