@atlaskit/editor-shared-styles 3.6.2 → 3.6.3
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 +7 -0
- package/package.json +2 -2
- package/afm-cc/tsconfig.json +0 -36
- package/afm-dev-agents/tsconfig.json +0 -36
- package/afm-jira/tsconfig.json +0 -36
- package/afm-passionfruit/tsconfig.json +0 -36
- package/afm-post-office/tsconfig.json +0 -36
- package/afm-rovo-extension/tsconfig.json +0 -36
- package/afm-townsquare/tsconfig.json +0 -36
- package/afm-volt/tsconfig.json +0 -36
- package/build/tsconfig.json +0 -23
- package/src/consts/consts.test.ts +0 -29
- package/src/consts/consts.ts +0 -310
- package/src/consts/index.ts +0 -90
- package/src/consts/types.ts +0 -9
- package/src/index.ts +0 -99
- package/src/overflow-shadow/overflow-shadow.ts +0 -69
- package/src/scrollbar-styles.ts +0 -29
- package/src/selection/__tests__/unit/utils.ts +0 -47
- package/src/selection/index.ts +0 -5
- package/src/selection/types.ts +0 -11
- package/src/selection/utils.ts +0 -87
- package/src/shortcut/index.ts +0 -4
- package/src/shortcut/shortcut.ts +0 -24
- package/src/utils.test.ts +0 -69
- package/src/utils.ts +0 -35
- package/tsconfig.app.json +0 -45
- package/tsconfig.dev.json +0 -48
- package/tsconfig.json +0 -9
package/src/selection/utils.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { token } from '@atlaskit/tokens';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
akEditorSelectedBorder,
|
|
5
|
-
akEditorSelectedBorderColor,
|
|
6
|
-
akEditorSelectedBoxShadow,
|
|
7
|
-
akEditorSmallZIndex,
|
|
8
|
-
} from '../consts';
|
|
9
|
-
|
|
10
|
-
import { SelectionStyle } from './types';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Adds correct selection styling for a node
|
|
14
|
-
* Pass in which selection style properties you want and it will return css string of necessary styles
|
|
15
|
-
*
|
|
16
|
-
* eg.
|
|
17
|
-
* .expand.ak-editor-selected-node {
|
|
18
|
-
* ${getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket])}
|
|
19
|
-
* }
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
export const getSelectionStyles = (selectionStyles: Array<SelectionStyle>): string =>
|
|
23
|
-
selectionStyles
|
|
24
|
-
.map((selectionStyle) => getSelectionStyle(selectionStyle))
|
|
25
|
-
.concat(hideNativeBrowserTextSelectionStyles)
|
|
26
|
-
.join('\n');
|
|
27
|
-
|
|
28
|
-
export const hideNativeBrowserTextSelectionStyles = `
|
|
29
|
-
::selection,*::selection {
|
|
30
|
-
background-color: transparent;
|
|
31
|
-
}
|
|
32
|
-
::-moz-selection,*::-moz-selection {
|
|
33
|
-
background-color: transparent;
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
const getSelectionStyle = (style: SelectionStyle): string => {
|
|
38
|
-
switch (style) {
|
|
39
|
-
case SelectionStyle.Border:
|
|
40
|
-
return `
|
|
41
|
-
border: ${akEditorSelectedBorder};
|
|
42
|
-
|
|
43
|
-
// Fixes ED-15246: Trello card is visible through a border of a table border
|
|
44
|
-
&::after {
|
|
45
|
-
height: 100%;
|
|
46
|
-
content: '\\00a0';
|
|
47
|
-
background: ${akEditorSelectedBorderColor};
|
|
48
|
-
position: absolute;
|
|
49
|
-
right: -1px;
|
|
50
|
-
top: 0;
|
|
51
|
-
bottom: 0;
|
|
52
|
-
width: 1px;
|
|
53
|
-
border: none;
|
|
54
|
-
display: inline-block;
|
|
55
|
-
}
|
|
56
|
-
`;
|
|
57
|
-
case SelectionStyle.BoxShadow:
|
|
58
|
-
return `
|
|
59
|
-
box-shadow: ${akEditorSelectedBoxShadow};
|
|
60
|
-
border-color: transparent;
|
|
61
|
-
`;
|
|
62
|
-
case SelectionStyle.Background:
|
|
63
|
-
return `background-color: ${token('color.background.selected')};`;
|
|
64
|
-
case SelectionStyle.Blanket:
|
|
65
|
-
return `
|
|
66
|
-
position: relative;
|
|
67
|
-
|
|
68
|
-
// Fixes ED-9263, where emoji or inline card in panel makes selection go outside the panel
|
|
69
|
-
// in Safari. Looks like it's caused by user-select: all in the emoji element
|
|
70
|
-
-webkit-user-select: text;
|
|
71
|
-
|
|
72
|
-
::before {
|
|
73
|
-
position: absolute;
|
|
74
|
-
content: '';
|
|
75
|
-
left: 0;
|
|
76
|
-
right: 0;
|
|
77
|
-
top: 0;
|
|
78
|
-
bottom: 0;
|
|
79
|
-
width: 100%;
|
|
80
|
-
pointer-events: none;
|
|
81
|
-
z-index: ${akEditorSmallZIndex};
|
|
82
|
-
background-color: ${token('color.blanket.selected')}
|
|
83
|
-
}`;
|
|
84
|
-
default:
|
|
85
|
-
return '';
|
|
86
|
-
}
|
|
87
|
-
};
|
package/src/shortcut/index.ts
DELETED
package/src/shortcut/shortcut.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
|
-
import { css } from '@emotion/react';
|
|
3
|
-
|
|
4
|
-
import { token } from '@atlaskit/tokens';
|
|
5
|
-
|
|
6
|
-
import { akEditorMobileMaxWidth, relativeFontSizeToBase16 } from '../consts';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @private
|
|
10
|
-
* @deprecated use `import { Shortcut } from '@atlaskit/editor-common/ui';` instead
|
|
11
|
-
*/
|
|
12
|
-
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
13
|
-
export const shortcutStyle = css`
|
|
14
|
-
background-color: ${token('color.background.neutral')};
|
|
15
|
-
color: ${token('color.text.subtle')};
|
|
16
|
-
border-radius: ${token('border.radius', '3px')};
|
|
17
|
-
padding: ${token('space.050', '4px')};
|
|
18
|
-
line-height: 12px;
|
|
19
|
-
font-size: ${relativeFontSizeToBase16(11.67)};
|
|
20
|
-
align-self: flex-end;
|
|
21
|
-
@media (max-width: ${akEditorMobileMaxWidth}px) {
|
|
22
|
-
display: none;
|
|
23
|
-
}
|
|
24
|
-
`;
|
package/src/utils.test.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
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
|
-
svgBackgroundColor: token('color.background.accent.green.subtler'),
|
|
24
|
-
textColor: token('color.text.inverse'),
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
expect(getParticipantColor('exB9qUN6fCHFlE-cAB0X')).toEqual({
|
|
28
|
-
index: 15,
|
|
29
|
-
color: {
|
|
30
|
-
backgroundColor: token('color.background.accent.teal.subtle'),
|
|
31
|
-
svgBackgroundColor: token('color.background.accent.teal.subtlest'),
|
|
32
|
-
textColor: token('color.text.accent.gray.bolder'),
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
expect(getParticipantColor('9NOVTX9WjLubYyVhAB0H')).toEqual({
|
|
36
|
-
index: 12,
|
|
37
|
-
color: {
|
|
38
|
-
backgroundColor: token('color.background.accent.orange.subtle'),
|
|
39
|
-
svgBackgroundColor: token('color.background.accent.orange.subtlest'),
|
|
40
|
-
textColor: token('color.text.accent.gray.bolder'),
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
expect(getParticipantColor('ceea2b46-6671-4827-a2ea-85e91a03f2ac')).toEqual({
|
|
44
|
-
index: 12,
|
|
45
|
-
color: {
|
|
46
|
-
backgroundColor: token('color.background.accent.orange.subtle'),
|
|
47
|
-
svgBackgroundColor: token('color.background.accent.orange.subtlest'),
|
|
48
|
-
textColor: token('color.text.accent.gray.bolder'),
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
expect(getParticipantColor('42b0923a-c388-4cb8-b4f3-3210f95a489e')).toEqual({
|
|
52
|
-
index: 16,
|
|
53
|
-
color: {
|
|
54
|
-
backgroundColor: token('color.background.accent.purple.subtle'),
|
|
55
|
-
svgBackgroundColor: token('color.background.accent.purple.subtlest'),
|
|
56
|
-
textColor: token('color.text.accent.gray.bolder'),
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
expect(getParticipantColor('d3b6e136-0f93-4bf2-a7e7-cd93dcce20e8')).toEqual({
|
|
60
|
-
index: 3,
|
|
61
|
-
color: {
|
|
62
|
-
backgroundColor: token('color.background.accent.yellow.bolder'),
|
|
63
|
-
svgBackgroundColor: token('color.background.accent.yellow.subtler'),
|
|
64
|
-
textColor: token('color.text.inverse'),
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
});
|
package/src/utils.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
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
|
-
}
|
package/tsconfig.app.json
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../tsconfig.base.json",
|
|
3
|
-
"include": ["./src/**/*.ts", "./src/**/*.tsx"],
|
|
4
|
-
"exclude": [
|
|
5
|
-
"**/docs/**/*",
|
|
6
|
-
"**/__tests__/**/*",
|
|
7
|
-
"**/vr-tests/**/*",
|
|
8
|
-
"**/__perf__/**/*",
|
|
9
|
-
"**/*.test.*",
|
|
10
|
-
"**/test.*",
|
|
11
|
-
"**/test-*",
|
|
12
|
-
"**/examples.ts",
|
|
13
|
-
"**/examples.tsx",
|
|
14
|
-
"**/examples/*.ts",
|
|
15
|
-
"**/examples/*.tsx",
|
|
16
|
-
"**/examples/**/*.ts",
|
|
17
|
-
"**/examples/**/*.tsx",
|
|
18
|
-
"**/storybook/**/*",
|
|
19
|
-
"**/constellation/**/*",
|
|
20
|
-
".storybook/*",
|
|
21
|
-
"./__fixtures__/**/*",
|
|
22
|
-
"./__generated__/**/*",
|
|
23
|
-
"./mocks/**/*",
|
|
24
|
-
"./__mocks__/**/*",
|
|
25
|
-
"**/mock.*",
|
|
26
|
-
"**/codemods/**/*.ts",
|
|
27
|
-
"**/codemods/**/*.tsx"
|
|
28
|
-
],
|
|
29
|
-
"compilerOptions": {
|
|
30
|
-
"composite": true,
|
|
31
|
-
"outDir": "../../../tsDist/@atlaskit__editor-shared-styles/app"
|
|
32
|
-
},
|
|
33
|
-
"references": [
|
|
34
|
-
{
|
|
35
|
-
"path": "../../platform/feature-flags/tsconfig.app.json"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"path": "../tmp-editor-statsig/tsconfig.app.json"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"path": "../../design-system/tokens/tsconfig.app.json"
|
|
42
|
-
}
|
|
43
|
-
],
|
|
44
|
-
"files": []
|
|
45
|
-
}
|
package/tsconfig.dev.json
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../tsconfig.base.json",
|
|
3
|
-
"include": [
|
|
4
|
-
"**/docs/**/*",
|
|
5
|
-
"**/__tests__/**/*",
|
|
6
|
-
"**/vr-tests/**/*",
|
|
7
|
-
"**/__perf__/**/*",
|
|
8
|
-
"**/*.test.*",
|
|
9
|
-
"**/test.*",
|
|
10
|
-
"**/test-*",
|
|
11
|
-
"**/examples.ts",
|
|
12
|
-
"**/examples.tsx",
|
|
13
|
-
"**/examples/*.ts",
|
|
14
|
-
"**/examples/*.tsx",
|
|
15
|
-
"**/examples/**/*.ts",
|
|
16
|
-
"**/examples/**/*.tsx",
|
|
17
|
-
"**/storybook/**/*",
|
|
18
|
-
"**/constellation/**/*",
|
|
19
|
-
".storybook/*",
|
|
20
|
-
"./__fixtures__/**/*",
|
|
21
|
-
"./__generated__/**/*",
|
|
22
|
-
"./mocks/**/*",
|
|
23
|
-
"./__mocks__/**/*",
|
|
24
|
-
"**/mock.*",
|
|
25
|
-
"**/codemods/**/*.ts",
|
|
26
|
-
"**/codemods/**/*.tsx",
|
|
27
|
-
"**/stories.ts",
|
|
28
|
-
"**/stories.tsx",
|
|
29
|
-
"**/stories/*.ts",
|
|
30
|
-
"**/stories/*.tsx",
|
|
31
|
-
"**/stories/**/*.ts",
|
|
32
|
-
"**/stories/**/*.tsx"
|
|
33
|
-
],
|
|
34
|
-
"exclude": ["./dist/**/*", "./build/**/*", "./node_modules/**/*"],
|
|
35
|
-
"compilerOptions": {
|
|
36
|
-
"composite": true,
|
|
37
|
-
"outDir": "../../../tsDist/@atlaskit__editor-shared-styles/dev"
|
|
38
|
-
},
|
|
39
|
-
"references": [
|
|
40
|
-
{
|
|
41
|
-
"path": "./tsconfig.app.json"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"path": "../../design-system/tokens/tsconfig.app.json"
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
"files": []
|
|
48
|
-
}
|