@atlaskit/editor-shared-styles 1.6.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +114 -0
  2. package/build/tsconfig.json +17 -0
  3. package/consts/package.json +7 -0
  4. package/dist/cjs/consts/consts.js +277 -0
  5. package/dist/cjs/consts/consts.test.js +25 -0
  6. package/dist/cjs/consts/index.js +541 -0
  7. package/dist/cjs/consts/types.js +5 -0
  8. package/dist/cjs/index.js +563 -0
  9. package/dist/cjs/overflow-shadow/index.js +13 -0
  10. package/dist/cjs/overflow-shadow/overflow-shadow.js +22 -0
  11. package/dist/cjs/selection/index.js +27 -0
  12. package/dist/cjs/selection/types.js +21 -0
  13. package/dist/cjs/selection/utils.js +49 -0
  14. package/dist/cjs/version.json +5 -0
  15. package/dist/es2019/consts/consts.js +152 -0
  16. package/dist/es2019/consts/consts.test.js +20 -0
  17. package/dist/es2019/consts/index.js +1 -0
  18. package/dist/es2019/consts/types.js +1 -0
  19. package/dist/es2019/index.js +3 -0
  20. package/dist/es2019/overflow-shadow/index.js +1 -0
  21. package/dist/es2019/overflow-shadow/overflow-shadow.js +23 -0
  22. package/dist/es2019/selection/index.js +2 -0
  23. package/dist/es2019/selection/types.js +13 -0
  24. package/dist/es2019/selection/utils.js +61 -0
  25. package/dist/es2019/version.json +5 -0
  26. package/dist/esm/consts/consts.js +162 -0
  27. package/dist/esm/consts/consts.test.js +22 -0
  28. package/dist/esm/consts/index.js +1 -0
  29. package/dist/esm/consts/types.js +1 -0
  30. package/dist/esm/index.js +3 -0
  31. package/dist/esm/overflow-shadow/index.js +1 -0
  32. package/dist/esm/overflow-shadow/overflow-shadow.js +10 -0
  33. package/dist/esm/selection/index.js +2 -0
  34. package/dist/esm/selection/types.js +13 -0
  35. package/dist/esm/selection/utils.js +38 -0
  36. package/dist/esm/version.json +5 -0
  37. package/dist/types/consts/consts.d.ts +124 -0
  38. package/dist/types/consts/index.d.ts +2 -0
  39. package/dist/types/consts/types.d.ts +3 -0
  40. package/dist/types/index.d.ts +4 -0
  41. package/dist/types/overflow-shadow/index.d.ts +1 -0
  42. package/dist/types/overflow-shadow/overflow-shadow.d.ts +5 -0
  43. package/dist/types/selection/index.d.ts +2 -0
  44. package/dist/types/selection/types.d.ts +11 -0
  45. package/dist/types/selection/utils.d.ts +13 -0
  46. package/package.json +46 -0
  47. package/selection/package.json +7 -0
  48. package/src/consts/consts.test.ts +21 -0
  49. package/src/consts/consts.ts +204 -0
  50. package/src/consts/index.ts +92 -0
  51. package/src/consts/types.ts +3 -0
  52. package/src/index.ts +99 -0
  53. package/src/overflow-shadow/index.ts +1 -0
  54. package/src/overflow-shadow/overflow-shadow.ts +29 -0
  55. package/src/selection/__tests__/unit/utils.ts +43 -0
  56. package/src/selection/index.ts +5 -0
  57. package/src/selection/types.ts +11 -0
  58. package/src/selection/utils.ts +71 -0
  59. package/tsconfig.json +11 -0
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "overflowShadow", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _overflowShadow.overflowShadow;
10
+ }
11
+ });
12
+
13
+ var _overflowShadow = require("./overflow-shadow");
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.overflowShadow = void 0;
9
+
10
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
12
+ var _styledComponents = require("styled-components");
13
+
14
+ var _templateObject;
15
+
16
+ var overflowShadow = function overflowShadow(_ref) {
17
+ var background = _ref.background,
18
+ width = _ref.width;
19
+ return (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n/* shadow cover right */ linear-gradient(\n to left,\n ", " ", ",\n transparent ", "\n),\n/* overflow shadow right */\n linear-gradient(\n to left,\n rgba(9, 30, 66, 0.13) 0,\n rgba(99, 114, 130, 0) ", "\n ),\n/* overflow shadow left */\n linear-gradient(\n to right,\n rgba(9, 30, 66, 0.13) 0,\n rgba(99, 114, 130, 0) ", "\n )\n"])), background, width, width, width, width);
20
+ };
21
+
22
+ exports.overflowShadow = overflowShadow;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "SelectionStyle", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _types.SelectionStyle;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "getSelectionStyles", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _utils.getSelectionStyles;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "hideNativeBrowserTextSelectionStyles", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _utils.hideNativeBrowserTextSelectionStyles;
22
+ }
23
+ });
24
+
25
+ var _types = require("./types");
26
+
27
+ var _utils = require("./utils");
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SelectionStyle = void 0;
7
+
8
+ /**
9
+ * These are generic selection styles for all nodes
10
+ * If you have custom behaviour needed for a node, add that in the plugin's styles
11
+ * file in editor-core
12
+ */
13
+ var SelectionStyle;
14
+ exports.SelectionStyle = SelectionStyle;
15
+
16
+ (function (SelectionStyle) {
17
+ SelectionStyle[SelectionStyle["Border"] = 0] = "Border";
18
+ SelectionStyle[SelectionStyle["BoxShadow"] = 1] = "BoxShadow";
19
+ SelectionStyle[SelectionStyle["Background"] = 2] = "Background";
20
+ SelectionStyle[SelectionStyle["Blanket"] = 3] = "Blanket";
21
+ })(SelectionStyle || (exports.SelectionStyle = SelectionStyle = {}));
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.hideNativeBrowserTextSelectionStyles = exports.getSelectionStyles = void 0;
7
+
8
+ var _consts = require("../consts");
9
+
10
+ var _types = require("./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
+ var getSelectionStyles = function getSelectionStyles(selectionStyles) {
23
+ return selectionStyles.map(function (selectionStyle) {
24
+ return getSelectionStyle(selectionStyle);
25
+ }).concat(hideNativeBrowserTextSelectionStyles).join('\n');
26
+ };
27
+
28
+ exports.getSelectionStyles = getSelectionStyles;
29
+ var hideNativeBrowserTextSelectionStyles = "\n ::selection,*::selection {\n background-color: transparent;\n }\n ::-moz-selection,*::-moz-selection {\n background-color: transparent;\n }\n";
30
+ exports.hideNativeBrowserTextSelectionStyles = hideNativeBrowserTextSelectionStyles;
31
+
32
+ var getSelectionStyle = function getSelectionStyle(style) {
33
+ switch (style) {
34
+ case _types.SelectionStyle.Border:
35
+ return "border: ".concat(_consts.akEditorSelectedBorder, ";");
36
+
37
+ case _types.SelectionStyle.BoxShadow:
38
+ return "\n box-shadow: ".concat(_consts.akEditorSelectedBoxShadow, ";\n border-color: transparent;\n ");
39
+
40
+ case _types.SelectionStyle.Background:
41
+ return "background-color: ".concat(_consts.akEditorSelectedBgColor, ";");
42
+
43
+ case _types.SelectionStyle.Blanket:
44
+ return "\n position: relative;\n\n // Fixes ED-9263, where emoji or inline card in panel makes selection go outside the panel\n // in Safari. Looks like it's caused by user-select: all in the emoji element\n -webkit-user-select: text;\n\n ::after {\n position: absolute;\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n opacity: ".concat(_consts.akEditorSelectedBlanketOpacity, ";\n pointer-events: none;\n background-color: ").concat(_consts.akEditorSelectedBlanketColor, "\n }");
45
+
46
+ default:
47
+ return '';
48
+ }
49
+ };
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "@atlaskit/editor-shared-styles",
3
+ "version": "1.6.0",
4
+ "sideEffects": false
5
+ }
@@ -0,0 +1,152 @@
1
+ import { B100, B300, B400, B50, B75, DN50, DN70, N0, N100, N20, N30, N40, N50, N500, N700, N900, R300, R400, R50, R75 } from '@atlaskit/theme/colors';
2
+ import { codeFontFamily, fontSize as defaultFontSize, gridSize, layers } from '@atlaskit/theme/constants';
3
+ export const akEditorFullPageDefaultFontSize = 16;
4
+ export const akEditorCodeFontFamily = codeFontFamily();
5
+ export const akEditorInactiveForeground = N500;
6
+ export const akEditorFocus = B100;
7
+ export const akEditorSubtleAccent = N40;
8
+ export const akEditorActiveBackground = N500;
9
+ export const akEditorActiveForeground = N0;
10
+ export const akEditorBlockquoteBorderColor = N40;
11
+ export const akEditorDropdownActiveBackground = N900;
12
+ export const akEditorPopupBackground = N700;
13
+ export const akEditorPopupText = B50;
14
+ export const akEditorPrimaryButton = B400;
15
+ export const akEditorCodeBackground = N20;
16
+ export const akEditorCodeBlockPadding = '12px';
17
+ export const akEditorCodeInlinePadding = '2px 4px';
18
+ export const akEditorDeleteBackground = R50;
19
+ export const akEditorDeleteBackgroundShaded = R50;
20
+ export const akEditorDeleteBackgroundWithOpacity = 'rgba(255, 189, 173, 0.5)'; // R75 with 50% opacity
21
+
22
+ export const akEditorDeleteBorder = R300;
23
+ export const akEditorDeleteIconColor = R400;
24
+ export const akEditorCustomIconSize = 20;
25
+ export const akEditorSelectedBorderColor = B300;
26
+ export const akEditorSelectedBgColor = B50;
27
+ export const akEditorSelectedBlanketColor = B75;
28
+ export const akEditorSelectedBorderSize = 1;
29
+ export const akEditorSelectedBorder = `${akEditorSelectedBorderSize}px solid ${akEditorSelectedBorderColor}`;
30
+ export const akEditorSelectedBoxShadow = `0 0 0 ${akEditorSelectedBorderSize}px ${akEditorSelectedBorderColor}`;
31
+ export const akEditorSelectedIconColor = B400;
32
+ export const akEditorSelectedBorderBoldSize = 2;
33
+ export const akEditorSelectedBlanketOpacity = 0.3;
34
+ export const akEditorUnitZIndex = 1;
35
+ export const akEditorShadowZIndex = 2;
36
+ export const akEditorStickyHeaderZIndex = 11; // filmstrip uses 10 for its shadow
37
+
38
+ export const akEditorSmallZIndex = akEditorStickyHeaderZIndex + 1;
39
+ export const akEditorGridLineZIndex = 9999; // z-index for main menu bar -
40
+ // this is highest as it should be above anything else in editor below.
41
+
42
+ export const akEditorMenuZIndex = layers.blanket(); // z-index used for floating toolbars like code block, table etc
43
+
44
+ export const akEditorFloatingPanelZIndex = layers.layer(); // z-index used for pickers (date, emoji, mentions) and type-aheads, hyperlinks
45
+
46
+ export const akEditorFloatingDialogZIndex = akEditorFloatingPanelZIndex + 10; // z-index used for floating toolbars table cell menu which are above block toolbars
47
+
48
+ export const akEditorFloatingOverlapPanelZIndex = akEditorFloatingPanelZIndex + 5;
49
+ export const akEditorMentionSelected = N100;
50
+ export const akEditorTableToolbarSize = 11;
51
+ export const akEditorTableBorder = N50;
52
+ export const akEditorTableBorderDark = DN70;
53
+ export const akEditorTableToolbar = N20;
54
+ export const akEditorTableToolbarDark = DN50;
55
+ export const akEditorTableFloatingControls = N20;
56
+ export const akEditorTableCellSelected = B75;
57
+ export const akEditorTableToolbarSelected = B100;
58
+ export const akEditorTableBorderSelected = B300;
59
+ export const akEditorTableCellDelete = R50;
60
+ export const akEditorTableBorderDelete = R300;
61
+ export const akEditorTableToolbarDelete = R75;
62
+ export const akEditorTableBorderRadius = '3px';
63
+ export const akEditorTableCellBackgroundOpacity = 0.5;
64
+ export const akEditorFullPageMaxWidth = 680;
65
+ export const akEditorDefaultLayoutWidth = 760;
66
+ export const akEditorWideLayoutWidth = 960;
67
+ export const akEditorFullWidthLayoutWidth = 1800;
68
+ export const akEditorFullWidthLayoutLineLength = 1792;
69
+ export const akEditorTableNumberColumnWidth = 42;
70
+ export const akEditorBreakoutPadding = 96;
71
+ export const akEditorGutterPadding = 32;
72
+ export const akEditorMobileBreakoutPoint = 720;
73
+ export const akEditorTableCellMinWidth = 48;
74
+ export const akEditorTableLegacyCellMinWidth = 128;
75
+ export const akEditorMediaResizeHandlerPaddingWide = 12;
76
+ export const akEditorMediaResizeHandlerPadding = 4;
77
+ export const akEditorSwoopCubicBezier = `cubic-bezier(0.15, 1, 0.3, 1)`;
78
+ export const gridMediumMaxWidth = 1024;
79
+ export const breakoutWideScaleRatio = 1.33;
80
+ export const akRichMediaResizeZIndex = akEditorUnitZIndex * 99;
81
+ export const akLayoutGutterOffset = gridSize() * 1.5;
82
+ export const akEditorLineHeight = 1.714;
83
+ export const akEditorRuleBackground = N30;
84
+ export const akEditorRuleBorderRadius = '1px';
85
+ export const akEditorToolbarKeylineHeight = 2;
86
+ export const akEditorContextPanelWidth = 320; // @see typography spreadsheet: https://docs.google.com/spreadsheets/d/1iYusRGCT4PoPfvxbJ8NrgjtfFgXLm5lpDWXzjua1W2E/edit#gid=93913128
87
+
88
+ export const blockNodesVerticalMargin = '0.75rem';
89
+ export const DEFAULT_EMBED_CARD_WIDTH = 680;
90
+ export const DEFAULT_EMBED_CARD_HEIGHT = 480;
91
+ export const ATLASSIAN_NAVIGATION_HEIGHT = '56px';
92
+ export const akEditorSelectedNodeClassName = 'ak-editor-selected-node';
93
+ export const editorFontSize = ({
94
+ theme
95
+ }) => theme && theme.baseFontSize ? theme.baseFontSize : defaultFontSize();
96
+ export const relativeSize = multiplier => ({
97
+ theme
98
+ }) => editorFontSize({
99
+ theme
100
+ }) * multiplier;
101
+ export const relativeFontSizeToBase16 = px => {
102
+ if (typeof px === 'string') {
103
+ px = parseInt(px);
104
+ }
105
+
106
+ if (isNaN(px)) {
107
+ throw new Error(`Invalid font size: '${px}'`);
108
+ }
109
+
110
+ return `${px / 16}rem`;
111
+ };
112
+ export const getAkEditorFullPageMaxWidth = (allowDynamicTextSizing = false) => allowDynamicTextSizing ? akEditorFullPageMaxWidth : akEditorDefaultLayoutWidth;
113
+ export const VIEWPORT_SIZES = {
114
+ laptopHiDPI: {
115
+ width: 1440,
116
+ height: 900
117
+ },
118
+ laptopMDPI: {
119
+ width: 1280,
120
+ height: 800
121
+ },
122
+ tabletL: {
123
+ width: 1024,
124
+ height: 1366
125
+ },
126
+ tabletS: {
127
+ width: 768,
128
+ height: 1024
129
+ },
130
+ mobileM: {
131
+ width: 414,
132
+ height: 736
133
+ },
134
+ mobileS: {
135
+ width: 375,
136
+ height: 667
137
+ },
138
+ mobileXS: {
139
+ width: 320,
140
+ height: 568
141
+ }
142
+ }; // to be updated in ED-10790: this should be variable threshold based on how many buttons enabled on main toolbar
143
+
144
+ export const akEditorMobileMaxWidth = 0;
145
+ export const getTableCellBackgroundDarkModeColors = [['White', '#000000'], ['Light blue', '#0C294F'], ['Light teal', '#0C343B'], ['Light green', '#052E21'], ['Light yellow', '#484123'], ['Light red', '#441C13'], ['Light purple', '#282249'], ['Light gray', '#202328'], ['Blue', '#0B3165'], ['Teal', '#044853'], ['Green', '#053927'], ['Yellow', '#6F5C25'], ['Red', '#582013'], ['Purple', '#3E327B'], ['Gray', '#475262'], ['Dark blue', '#003884'], ['Dark teal', '#055866'], ['Dark green', '#044932'], ['Dark yellow', '#82641C'], ['Dark red', '#6B2A19'], ['Dark purple', '#4D38B2']].map(([colorName, colorValue]) => getTableCellBackgroundDarkModeColorCSS(colorName, colorValue)).join('\n');
146
+ export function getTableCellBackgroundDarkModeColorCSS(colorName, colorValue) {
147
+ return `
148
+ &[colorname="${colorName}"] {
149
+ background-color: ${colorValue} !important; // !important to override default style color
150
+ }
151
+ `;
152
+ }
@@ -0,0 +1,20 @@
1
+ import { relativeFontSizeToBase16 } from './consts';
2
+ describe('consts', () => {
3
+ describe('relativeFontSizeToBase16', () => {
4
+ it('relativeFontSizeToBase16 should return 1rem with a base font size of 16px', () => {
5
+ expect(relativeFontSizeToBase16(16)).toBe('1rem');
6
+ });
7
+ it('relativeFontSizeToBase16 should return 0.875rem with a base font size of 14px', () => {
8
+ expect(relativeFontSizeToBase16(14)).toBe('0.875rem');
9
+ });
10
+ it('relativeFontSizeToBase16 should return 0.875rem with a base font size (string) of 14px', () => {
11
+ expect(relativeFontSizeToBase16('14')).toBe('0.875rem');
12
+ });
13
+ it('relativeFontSizeToBase16 should return 0.875rem with a base font size (string) of 14px', () => {
14
+ expect(relativeFontSizeToBase16('14px')).toBe('0.875rem');
15
+ });
16
+ it('relativeFontSizeToBase16 should throw an error for invalid string', () => {
17
+ expect(() => relativeFontSizeToBase16('px')).toThrowError();
18
+ });
19
+ });
20
+ });
@@ -0,0 +1 @@
1
+ export { akEditorActiveBackground, akEditorActiveForeground, akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundShaded, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorDropdownActiveBackground, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFocus, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorInactiveForeground, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMentionSelected, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorPopupBackground, akEditorPopupText, akEditorPrimaryButton, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorSelectedIconColor, akEditorCustomIconSize, akEditorSelectedBlanketColor, akEditorSelectedBgColor, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderDark, akEditorTableBorderDelete, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellDelete, akEditorTableCellMinWidth, akEditorTableCellSelected, akEditorTableFloatingControls, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarDark, akEditorTableToolbarDelete, akEditorTableToolbarSelected, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, getAkEditorFullPageMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBackground, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT } from './consts';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export { akEditorActiveBackground, akEditorActiveForeground, akEditorBlockquoteBorderColor, akEditorBreakoutPadding, akEditorCodeBackground, akEditorCodeBlockPadding, akEditorCodeFontFamily, akEditorCodeInlinePadding, akEditorContextPanelWidth, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundShaded, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorDeleteIconColor, akEditorDropdownActiveBackground, akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex, akEditorFloatingPanelZIndex, akEditorFocus, akEditorFullPageMaxWidth, akEditorFullPageDefaultFontSize, akEditorFullWidthLayoutWidth, akEditorFullWidthLayoutLineLength, akEditorGridLineZIndex, akEditorGutterPadding, akEditorInactiveForeground, akEditorMediaResizeHandlerPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMentionSelected, akEditorMenuZIndex, akEditorStickyHeaderZIndex, akEditorMobileBreakoutPoint, akEditorPopupBackground, akEditorPopupText, akEditorPrimaryButton, akEditorSelectedBorderColor, akEditorSelectedBorderBoldSize, akEditorSelectedBorderSize, akEditorSelectedBorder, akEditorSelectedBoxShadow, akEditorSelectedIconColor, akEditorSelectedBlanketColor, akEditorSelectedBgColor, akEditorSelectedBlanketOpacity, akEditorSmallZIndex, akEditorShadowZIndex, akEditorSubtleAccent, akEditorSwoopCubicBezier, akEditorTableBorder, akEditorTableBorderDark, akEditorTableBorderDelete, akEditorTableBorderRadius, akEditorTableBorderSelected, akEditorTableCellBackgroundOpacity, akEditorTableCellDelete, akEditorTableCellMinWidth, akEditorTableCellSelected, akEditorTableFloatingControls, akEditorTableLegacyCellMinWidth, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarDark, akEditorTableToolbarDelete, akEditorTableToolbarSelected, akEditorTableToolbarSize, akEditorUnitZIndex, akEditorWideLayoutWidth, akLayoutGutterOffset, akRichMediaResizeZIndex, blockNodesVerticalMargin, breakoutWideScaleRatio, editorFontSize, gridMediumMaxWidth, getAkEditorFullPageMaxWidth, relativeSize, relativeFontSizeToBase16, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH, akEditorLineHeight, akEditorRuleBackground, akEditorRuleBorderRadius, akEditorSelectedNodeClassName, akEditorToolbarKeylineHeight, VIEWPORT_SIZES, akEditorMobileMaxWidth, getTableCellBackgroundDarkModeColors, ATLASSIAN_NAVIGATION_HEIGHT } from './consts';
2
+ export { SelectionStyle, getSelectionStyles, hideNativeBrowserTextSelectionStyles } from './selection';
3
+ export { overflowShadow } from './overflow-shadow';
@@ -0,0 +1 @@
1
+ export { overflowShadow } from './overflow-shadow';
@@ -0,0 +1,23 @@
1
+ import { css } from 'styled-components';
2
+ export const overflowShadow = ({
3
+ background,
4
+ width
5
+ }) => css`
6
+ /* shadow cover right */ linear-gradient(
7
+ to left,
8
+ ${background} ${width},
9
+ transparent ${width}
10
+ ),
11
+ /* overflow shadow right */
12
+ linear-gradient(
13
+ to left,
14
+ rgba(9, 30, 66, 0.13) 0,
15
+ rgba(99, 114, 130, 0) ${width}
16
+ ),
17
+ /* overflow shadow left */
18
+ linear-gradient(
19
+ to right,
20
+ rgba(9, 30, 66, 0.13) 0,
21
+ rgba(99, 114, 130, 0) ${width}
22
+ )
23
+ `;
@@ -0,0 +1,2 @@
1
+ export { SelectionStyle } from './types';
2
+ export { getSelectionStyles, hideNativeBrowserTextSelectionStyles } from './utils';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * These are generic selection styles for all nodes
3
+ * If you have custom behaviour needed for a node, add that in the plugin's styles
4
+ * file in editor-core
5
+ */
6
+ export let SelectionStyle;
7
+
8
+ (function (SelectionStyle) {
9
+ SelectionStyle[SelectionStyle["Border"] = 0] = "Border";
10
+ SelectionStyle[SelectionStyle["BoxShadow"] = 1] = "BoxShadow";
11
+ SelectionStyle[SelectionStyle["Background"] = 2] = "Background";
12
+ SelectionStyle[SelectionStyle["Blanket"] = 3] = "Blanket";
13
+ })(SelectionStyle || (SelectionStyle = {}));
@@ -0,0 +1,61 @@
1
+ import { akEditorSelectedBgColor, akEditorSelectedBlanketColor, akEditorSelectedBlanketOpacity, akEditorSelectedBorder, akEditorSelectedBoxShadow } from '../consts';
2
+ import { SelectionStyle } from './types';
3
+ /**
4
+ * Adds correct selection styling for a node
5
+ * Pass in which selection style properties you want and it will return css string of necessary styles
6
+ *
7
+ * eg.
8
+ * .expand.ak-editor-selected-node {
9
+ * ${getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket])}
10
+ * }
11
+ *
12
+ */
13
+
14
+ export const getSelectionStyles = selectionStyles => selectionStyles.map(selectionStyle => getSelectionStyle(selectionStyle)).concat(hideNativeBrowserTextSelectionStyles).join('\n');
15
+ export const hideNativeBrowserTextSelectionStyles = `
16
+ ::selection,*::selection {
17
+ background-color: transparent;
18
+ }
19
+ ::-moz-selection,*::-moz-selection {
20
+ background-color: transparent;
21
+ }
22
+ `;
23
+
24
+ const getSelectionStyle = style => {
25
+ switch (style) {
26
+ case SelectionStyle.Border:
27
+ return `border: ${akEditorSelectedBorder};`;
28
+
29
+ case SelectionStyle.BoxShadow:
30
+ return `
31
+ box-shadow: ${akEditorSelectedBoxShadow};
32
+ border-color: transparent;
33
+ `;
34
+
35
+ case SelectionStyle.Background:
36
+ return `background-color: ${akEditorSelectedBgColor};`;
37
+
38
+ case SelectionStyle.Blanket:
39
+ return `
40
+ position: relative;
41
+
42
+ // Fixes ED-9263, where emoji or inline card in panel makes selection go outside the panel
43
+ // in Safari. Looks like it's caused by user-select: all in the emoji element
44
+ -webkit-user-select: text;
45
+
46
+ ::after {
47
+ position: absolute;
48
+ content: '';
49
+ left: 0;
50
+ right: 0;
51
+ top: 0;
52
+ bottom: 0;
53
+ opacity: ${akEditorSelectedBlanketOpacity};
54
+ pointer-events: none;
55
+ background-color: ${akEditorSelectedBlanketColor}
56
+ }`;
57
+
58
+ default:
59
+ return '';
60
+ }
61
+ };
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "@atlaskit/editor-shared-styles",
3
+ "version": "1.6.0",
4
+ "sideEffects": false
5
+ }