@atlaskit/editor-shared-styles 4.3.19 → 4.3.20

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,26 @@
1
1
  # @atlaskit/editor-shared-styles
2
2
 
3
+ ## 4.3.20
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b378d1dd86483`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b378d1dd86483) -
8
+ Brand ChatGPT contributor tags with the ChatGPT icon and a fixed colour.
9
+
10
+ Centralised agent brand metadata in `@atlaskit/agent-color`: added `agent-brand-claude`,
11
+ `agent-brand-chatgpt` and `agent-brand-rovo` colour schemes, and extended
12
+ `getThirdPartyAgentColor` (`./get-third-party-agent-color`) to also resolve the
13
+ `claude`/`chatgpt`/`rovo`/`rovo_chat` aliases and return a canonical display `name`. Removed the
14
+ now-redundant `./chatgpt-brand-color` export (`CHATGPT_BRAND_COLOR`) — its value is now the
15
+ `agent-brand-chatgpt` scheme's `bold`/`boldText` fields, reachable through
16
+ `getThirdPartyAgentColor`.
17
+
18
+ `editor-shared-styles` and `editor-plugin-show-diff` now resolve their brand colours and
19
+ contributor-tag names through this shared lookup instead of maintaining their own per-package
20
+ brand tables, with no behaviour change.
21
+
22
+ - Updated dependencies
23
+
3
24
  ## 4.3.19
4
25
 
5
26
  ### Patch Changes
package/dist/cjs/utils.js CHANGED
@@ -6,21 +6,31 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getHashCode = getHashCode;
7
7
  exports.getParticipantColor = getParticipantColor;
8
8
  var _getAgentColor = require("@atlaskit/agent-color/get-agent-color");
9
+ var _getThirdPartyAgentColor = require("@atlaskit/agent-color/get-third-party-agent-color");
9
10
  var _fg = require("@atlaskit/platform-feature-flags/fg");
10
11
  var _consts = require("./consts");
11
12
  /**
12
- * Agent types and brands with a fixed participant colour instead of an identity-derived colour.
13
+ * Fixed telepointer palette slot for each `@atlaskit/agent-color` brand this editor recognises by
14
+ * a reserved identity colour rather than a hashed one.
13
15
  *
14
- * Claude uses orange and ChatGPT uses gray. The palette's numbered positions also back the
15
- * telepointer CSS classes, so preserve these positions when editing the palette.
16
+ * Claude uses orange (`participantColors[7]`), Rovo purple (`[4]`), ChatGPT gray (`[9]`, but with
17
+ * its own brand colour rather than the palette's — see `BRAND_EXACT_COLOR_SCHEMES`). The palette's
18
+ * numbered positions also back the telepointer CSS classes, so preserve these positions when
19
+ * editing the palette. Brands `@atlaskit/agent-color` resolves but this table omits (e.g. Figma,
20
+ * Replit) fall through to the identity-hashed colour below.
16
21
  */
17
- var AGENT_PARTICIPANT_COLOR_OVERRIDES = {
18
- claude: 7,
19
- chatgpt: 9,
20
- rovo: 4,
21
- rovo_chat: 4
22
+ var BRAND_PARTICIPANT_COLOR_INDEX = {
23
+ 'agent-brand-claude': 7,
24
+ 'agent-brand-rovo': 4,
25
+ 'agent-brand-chatgpt': 9
22
26
  };
23
27
 
28
+ /**
29
+ * Brands whose own colour (`getThirdPartyAgentColor`'s `bold`/`boldText`) is used instead of their
30
+ * palette slot's — no ADS token matches these brands' colour, so the palette slot would be wrong.
31
+ */
32
+ var BRAND_EXACT_COLOR_SCHEMES = new Set(['agent-brand-chatgpt']);
33
+
24
34
  /** Maps Agent Studio's semantic palette to the established telepointer palette slots. */
25
35
  var AGENT_COLOR_TO_PARTICIPANT_COLOR_INDEX = {
26
36
  yellow: 3,
@@ -74,14 +84,23 @@ function getHashCode(str) {
74
84
  * @returns The palette colour and index; `isFixed` prevents callers from reallocating brand colours.
75
85
  */
76
86
  function getParticipantColor(str, agentType) {
77
- var fixedColorIndex = agentType ? AGENT_PARTICIPANT_COLOR_OVERRIDES[agentType.trim().toLowerCase()] : undefined;
78
- if (fixedColorIndex !== undefined) {
79
- var _index = fixedColorIndex;
80
- return {
81
- index: _index,
82
- color: _consts.participantColors[_index],
83
- isFixed: true
84
- };
87
+ var brand = agentType ? (0, _getThirdPartyAgentColor.getThirdPartyAgentColor)({
88
+ agentName: agentType
89
+ }) : undefined;
90
+ if (brand) {
91
+ var fixedIndex = BRAND_PARTICIPANT_COLOR_INDEX[brand.scheme];
92
+ if (fixedIndex !== undefined) {
93
+ var color = BRAND_EXACT_COLOR_SCHEMES.has(brand.scheme) ? {
94
+ backgroundColor: brand.bold,
95
+ svgBackgroundColor: brand.bold,
96
+ textColor: brand.boldText
97
+ } : _consts.participantColors[fixedIndex];
98
+ return {
99
+ index: fixedIndex,
100
+ color: color,
101
+ isFixed: true
102
+ };
103
+ }
85
104
  }
86
105
  var agentColor = agentType ? (0, _getAgentColor.getAgentColor)({
87
106
  agentId: str
@@ -1,20 +1,30 @@
1
1
  import { getAgentColor } from '@atlaskit/agent-color/get-agent-color';
2
+ import { getThirdPartyAgentColor } from '@atlaskit/agent-color/get-third-party-agent-color';
2
3
  import { fg } from '@atlaskit/platform-feature-flags/fg';
3
4
  import { participantColors } from './consts';
4
5
 
5
6
  /**
6
- * Agent types and brands with a fixed participant colour instead of an identity-derived colour.
7
+ * Fixed telepointer palette slot for each `@atlaskit/agent-color` brand this editor recognises by
8
+ * a reserved identity colour rather than a hashed one.
7
9
  *
8
- * Claude uses orange and ChatGPT uses gray. The palette's numbered positions also back the
9
- * telepointer CSS classes, so preserve these positions when editing the palette.
10
+ * Claude uses orange (`participantColors[7]`), Rovo purple (`[4]`), ChatGPT gray (`[9]`, but with
11
+ * its own brand colour rather than the palette's — see `BRAND_EXACT_COLOR_SCHEMES`). The palette's
12
+ * numbered positions also back the telepointer CSS classes, so preserve these positions when
13
+ * editing the palette. Brands `@atlaskit/agent-color` resolves but this table omits (e.g. Figma,
14
+ * Replit) fall through to the identity-hashed colour below.
10
15
  */
11
- const AGENT_PARTICIPANT_COLOR_OVERRIDES = {
12
- claude: 7,
13
- chatgpt: 9,
14
- rovo: 4,
15
- rovo_chat: 4
16
+ const BRAND_PARTICIPANT_COLOR_INDEX = {
17
+ 'agent-brand-claude': 7,
18
+ 'agent-brand-rovo': 4,
19
+ 'agent-brand-chatgpt': 9
16
20
  };
17
21
 
22
+ /**
23
+ * Brands whose own colour (`getThirdPartyAgentColor`'s `bold`/`boldText`) is used instead of their
24
+ * palette slot's — no ADS token matches these brands' colour, so the palette slot would be wrong.
25
+ */
26
+ const BRAND_EXACT_COLOR_SCHEMES = new Set(['agent-brand-chatgpt']);
27
+
18
28
  /** Maps Agent Studio's semantic palette to the established telepointer palette slots. */
19
29
  const AGENT_COLOR_TO_PARTICIPANT_COLOR_INDEX = {
20
30
  yellow: 3,
@@ -68,14 +78,23 @@ export function getHashCode(str) {
68
78
  * @returns The palette colour and index; `isFixed` prevents callers from reallocating brand colours.
69
79
  */
70
80
  export function getParticipantColor(str, agentType) {
71
- const fixedColorIndex = agentType ? AGENT_PARTICIPANT_COLOR_OVERRIDES[agentType.trim().toLowerCase()] : undefined;
72
- if (fixedColorIndex !== undefined) {
73
- const index = fixedColorIndex;
74
- return {
75
- index,
76
- color: participantColors[index],
77
- isFixed: true
78
- };
81
+ const brand = agentType ? getThirdPartyAgentColor({
82
+ agentName: agentType
83
+ }) : undefined;
84
+ if (brand) {
85
+ const fixedIndex = BRAND_PARTICIPANT_COLOR_INDEX[brand.scheme];
86
+ if (fixedIndex !== undefined) {
87
+ const color = BRAND_EXACT_COLOR_SCHEMES.has(brand.scheme) ? {
88
+ backgroundColor: brand.bold,
89
+ svgBackgroundColor: brand.bold,
90
+ textColor: brand.boldText
91
+ } : participantColors[fixedIndex];
92
+ return {
93
+ index: fixedIndex,
94
+ color,
95
+ isFixed: true
96
+ };
97
+ }
79
98
  }
80
99
  const agentColor = agentType ? getAgentColor({
81
100
  agentId: str
package/dist/esm/utils.js CHANGED
@@ -1,20 +1,30 @@
1
1
  import { getAgentColor } from '@atlaskit/agent-color/get-agent-color';
2
+ import { getThirdPartyAgentColor } from '@atlaskit/agent-color/get-third-party-agent-color';
2
3
  import { fg } from '@atlaskit/platform-feature-flags/fg';
3
4
  import { participantColors } from './consts';
4
5
 
5
6
  /**
6
- * Agent types and brands with a fixed participant colour instead of an identity-derived colour.
7
+ * Fixed telepointer palette slot for each `@atlaskit/agent-color` brand this editor recognises by
8
+ * a reserved identity colour rather than a hashed one.
7
9
  *
8
- * Claude uses orange and ChatGPT uses gray. The palette's numbered positions also back the
9
- * telepointer CSS classes, so preserve these positions when editing the palette.
10
+ * Claude uses orange (`participantColors[7]`), Rovo purple (`[4]`), ChatGPT gray (`[9]`, but with
11
+ * its own brand colour rather than the palette's — see `BRAND_EXACT_COLOR_SCHEMES`). The palette's
12
+ * numbered positions also back the telepointer CSS classes, so preserve these positions when
13
+ * editing the palette. Brands `@atlaskit/agent-color` resolves but this table omits (e.g. Figma,
14
+ * Replit) fall through to the identity-hashed colour below.
10
15
  */
11
- var AGENT_PARTICIPANT_COLOR_OVERRIDES = {
12
- claude: 7,
13
- chatgpt: 9,
14
- rovo: 4,
15
- rovo_chat: 4
16
+ var BRAND_PARTICIPANT_COLOR_INDEX = {
17
+ 'agent-brand-claude': 7,
18
+ 'agent-brand-rovo': 4,
19
+ 'agent-brand-chatgpt': 9
16
20
  };
17
21
 
22
+ /**
23
+ * Brands whose own colour (`getThirdPartyAgentColor`'s `bold`/`boldText`) is used instead of their
24
+ * palette slot's — no ADS token matches these brands' colour, so the palette slot would be wrong.
25
+ */
26
+ var BRAND_EXACT_COLOR_SCHEMES = new Set(['agent-brand-chatgpt']);
27
+
18
28
  /** Maps Agent Studio's semantic palette to the established telepointer palette slots. */
19
29
  var AGENT_COLOR_TO_PARTICIPANT_COLOR_INDEX = {
20
30
  yellow: 3,
@@ -68,14 +78,23 @@ export function getHashCode(str) {
68
78
  * @returns The palette colour and index; `isFixed` prevents callers from reallocating brand colours.
69
79
  */
70
80
  export function getParticipantColor(str, agentType) {
71
- var fixedColorIndex = agentType ? AGENT_PARTICIPANT_COLOR_OVERRIDES[agentType.trim().toLowerCase()] : undefined;
72
- if (fixedColorIndex !== undefined) {
73
- var _index = fixedColorIndex;
74
- return {
75
- index: _index,
76
- color: participantColors[_index],
77
- isFixed: true
78
- };
81
+ var brand = agentType ? getThirdPartyAgentColor({
82
+ agentName: agentType
83
+ }) : undefined;
84
+ if (brand) {
85
+ var fixedIndex = BRAND_PARTICIPANT_COLOR_INDEX[brand.scheme];
86
+ if (fixedIndex !== undefined) {
87
+ var color = BRAND_EXACT_COLOR_SCHEMES.has(brand.scheme) ? {
88
+ backgroundColor: brand.bold,
89
+ svgBackgroundColor: brand.bold,
90
+ textColor: brand.boldText
91
+ } : participantColors[fixedIndex];
92
+ return {
93
+ index: fixedIndex,
94
+ color: color,
95
+ isFixed: true
96
+ };
97
+ }
79
98
  }
80
99
  var agentColor = agentType ? getAgentColor({
81
100
  agentId: str
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-shared-styles",
3
- "version": "4.3.19",
3
+ "version": "4.3.20",
4
4
  "description": "Style values used in the editor/renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,9 +29,9 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@atlaskit/agent-color": "^0.2.0",
32
+ "@atlaskit/agent-color": "^1.0.0",
33
33
  "@atlaskit/platform-feature-flags": "^2.2.0",
34
- "@atlaskit/tmp-editor-statsig": "^202.0.0",
34
+ "@atlaskit/tmp-editor-statsig": "^203.0.0",
35
35
  "@atlaskit/tokens": "^19.0.0",
36
36
  "@babel/runtime": "^7.0.0",
37
37
  "@emotion/react": "^11.7.1"