@atlaskit/editor-shared-styles 4.2.2 → 4.3.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 +12 -0
- package/dist/cjs/utils.js +20 -3
- package/dist/es2019/utils.js +20 -3
- package/dist/esm/utils.js +20 -3
- package/dist/types/utils.d.ts +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-shared-styles
|
|
2
2
|
|
|
3
|
+
## 4.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`a8b0726ce1e34`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a8b0726ce1e34) -
|
|
8
|
+
Adds shared semantic agent colour resolution and aligns diff history with agent telepointers
|
|
9
|
+
behind `confluence_ncs_step_diffing_version_history`.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 4.2.2
|
|
4
16
|
|
|
5
17
|
### 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
|
-
/**
|
|
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
|
|
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
|
|
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]
|
package/dist/es2019/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
|
-
/**
|
|
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
|
|
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
|
|
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
|
-
/**
|
|
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
|
|
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
|
|
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]
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { type ParticipantColor } from './consts';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare function getHashCode(str: string): number;
|
|
12
12
|
/**
|
|
13
|
-
* Returns
|
|
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.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "Style values used in the editor/renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"@atlaskit/agent-color": "^0.1.0",
|
|
31
32
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
32
33
|
"@atlaskit/tmp-editor-statsig": "^188.0.0",
|
|
33
34
|
"@atlaskit/tokens": "^16.12.0",
|