@atlaskit/editor-common 60.0.0 → 61.0.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 +89 -0
- package/card/package.json +7 -0
- package/dist/cjs/card/cardOptions.js +5 -0
- package/dist/cjs/emoji.js +23 -0
- package/dist/cjs/extensions/index.js +6 -0
- package/dist/cjs/extensions/types/field-definitions.js +7 -1
- package/dist/cjs/extensions/types/index.js +6 -0
- package/dist/cjs/extensions.js +6 -0
- package/dist/cjs/i18n/cs.js +1 -0
- package/dist/cjs/i18n/da.js +1 -0
- package/dist/cjs/i18n/de.js +1 -0
- package/dist/cjs/i18n/es.js +1 -0
- package/dist/cjs/i18n/fi.js +1 -0
- package/dist/cjs/i18n/fr.js +1 -0
- package/dist/cjs/i18n/hu.js +1 -0
- package/dist/cjs/i18n/it.js +1 -0
- package/dist/cjs/i18n/ja.js +1 -0
- package/dist/cjs/i18n/ko.js +1 -0
- package/dist/cjs/i18n/nb.js +1 -0
- package/dist/cjs/i18n/nl.js +1 -0
- package/dist/cjs/i18n/pl.js +1 -0
- package/dist/cjs/i18n/pt_BR.js +1 -0
- package/dist/cjs/i18n/ru.js +1 -0
- package/dist/cjs/i18n/sv.js +1 -0
- package/dist/cjs/i18n/th.js +1 -0
- package/dist/cjs/i18n/tr.js +1 -0
- package/dist/cjs/i18n/uk.js +1 -0
- package/dist/cjs/i18n/vi.js +1 -0
- package/dist/cjs/i18n/zh.js +1 -1
- package/dist/cjs/i18n/zh_TW.js +1 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/mention.js +23 -0
- package/dist/cjs/messages/codeBidiWarning.js +21 -0
- package/dist/cjs/messages/index.js +8 -0
- package/dist/cjs/styles/index.js +6 -0
- package/dist/cjs/styles/shared/panel.js +92 -37
- package/dist/cjs/styles/shared/table.js +2 -2
- package/dist/cjs/ufo/experience-store.js +160 -0
- package/dist/cjs/ufo/index.js +25 -0
- package/dist/cjs/ui/Messages/index.js +1 -3
- package/dist/cjs/utils/compareNodes.js +6 -0
- package/dist/cjs/utils/index.js +23 -1
- package/dist/cjs/utils/profiler/render-count.js +135 -0
- package/dist/cjs/utils/validator.js +46 -26
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/card/cardOptions.js +1 -0
- package/dist/es2019/emoji.js +2 -0
- package/dist/es2019/extensions/index.js +1 -1
- package/dist/es2019/extensions/types/field-definitions.js +3 -0
- package/dist/es2019/extensions/types/index.js +1 -1
- package/dist/es2019/extensions.js +1 -1
- package/dist/es2019/i18n/cs.js +1 -0
- package/dist/es2019/i18n/da.js +1 -0
- package/dist/es2019/i18n/de.js +1 -0
- package/dist/es2019/i18n/es.js +1 -0
- package/dist/es2019/i18n/fi.js +1 -0
- package/dist/es2019/i18n/fr.js +1 -0
- package/dist/es2019/i18n/hu.js +1 -0
- package/dist/es2019/i18n/it.js +1 -0
- package/dist/es2019/i18n/ja.js +1 -0
- package/dist/es2019/i18n/ko.js +1 -0
- package/dist/es2019/i18n/nb.js +1 -0
- package/dist/es2019/i18n/nl.js +1 -0
- package/dist/es2019/i18n/pl.js +1 -0
- package/dist/es2019/i18n/pt_BR.js +1 -0
- package/dist/es2019/i18n/ru.js +1 -0
- package/dist/es2019/i18n/sv.js +1 -0
- package/dist/es2019/i18n/th.js +1 -0
- package/dist/es2019/i18n/tr.js +1 -0
- package/dist/es2019/i18n/uk.js +1 -0
- package/dist/es2019/i18n/vi.js +1 -0
- package/dist/es2019/i18n/zh.js +1 -1
- package/dist/es2019/i18n/zh_TW.js +1 -0
- package/dist/es2019/index.js +26 -8
- package/dist/es2019/mention.js +2 -0
- package/dist/es2019/messages/codeBidiWarning.js +12 -0
- package/dist/es2019/messages/index.js +1 -0
- package/dist/es2019/styles/index.js +4 -2
- package/dist/es2019/styles/shared/panel.js +104 -39
- package/dist/es2019/styles/shared/table.js +2 -1
- package/dist/es2019/ufo/experience-store.js +116 -0
- package/dist/es2019/ufo/index.js +1 -0
- package/dist/es2019/ui/Messages/index.js +1 -2
- package/dist/es2019/ui/index.js +8 -3
- package/dist/es2019/utils/compareNodes.js +6 -0
- package/dist/es2019/utils/index.js +3 -1
- package/dist/es2019/utils/profiler/render-count.js +107 -0
- package/dist/es2019/utils/validator.js +36 -13
- package/dist/es2019/version.json +1 -1
- package/dist/esm/card/cardOptions.js +1 -0
- package/dist/esm/emoji.js +2 -0
- package/dist/esm/extensions/index.js +1 -1
- package/dist/esm/extensions/types/field-definitions.js +3 -0
- package/dist/esm/extensions/types/index.js +1 -1
- package/dist/esm/extensions.js +1 -1
- package/dist/esm/i18n/cs.js +1 -0
- package/dist/esm/i18n/da.js +1 -0
- package/dist/esm/i18n/de.js +1 -0
- package/dist/esm/i18n/es.js +1 -0
- package/dist/esm/i18n/fi.js +1 -0
- package/dist/esm/i18n/fr.js +1 -0
- package/dist/esm/i18n/hu.js +1 -0
- package/dist/esm/i18n/it.js +1 -0
- package/dist/esm/i18n/ja.js +1 -0
- package/dist/esm/i18n/ko.js +1 -0
- package/dist/esm/i18n/nb.js +1 -0
- package/dist/esm/i18n/nl.js +1 -0
- package/dist/esm/i18n/pl.js +1 -0
- package/dist/esm/i18n/pt_BR.js +1 -0
- package/dist/esm/i18n/ru.js +1 -0
- package/dist/esm/i18n/sv.js +1 -0
- package/dist/esm/i18n/th.js +1 -0
- package/dist/esm/i18n/tr.js +1 -0
- package/dist/esm/i18n/uk.js +1 -0
- package/dist/esm/i18n/vi.js +1 -0
- package/dist/esm/i18n/zh.js +1 -1
- package/dist/esm/i18n/zh_TW.js +1 -0
- package/dist/esm/index.js +26 -8
- package/dist/esm/mention.js +2 -0
- package/dist/esm/messages/codeBidiWarning.js +12 -0
- package/dist/esm/messages/index.js +1 -0
- package/dist/esm/styles/index.js +4 -2
- package/dist/esm/styles/shared/panel.js +87 -38
- package/dist/esm/styles/shared/table.js +2 -2
- package/dist/esm/ufo/experience-store.js +144 -0
- package/dist/esm/ufo/index.js +1 -0
- package/dist/esm/ui/Messages/index.js +1 -2
- package/dist/esm/ui/index.js +8 -3
- package/dist/esm/utils/compareNodes.js +6 -0
- package/dist/esm/utils/index.js +3 -1
- package/dist/esm/utils/profiler/render-count.js +123 -0
- package/dist/esm/utils/validator.js +46 -26
- package/dist/esm/version.json +1 -1
- package/dist/types/card/cardOptions.d.ts +9 -0
- package/dist/types/card/index.d.ts +1 -9
- package/dist/types/collab/types.d.ts +5 -0
- package/dist/types/collab.d.ts +1 -1
- package/dist/types/emoji.d.ts +3 -0
- package/dist/types/extensions/index.d.ts +1 -1
- package/dist/types/extensions/types/extension-handler.d.ts +6 -2
- package/dist/types/extensions/types/extension-parameters.d.ts +1 -0
- package/dist/types/extensions/types/field-definitions.d.ts +2 -0
- package/dist/types/extensions/types/index.d.ts +1 -1
- package/dist/types/extensions.d.ts +1 -1
- package/dist/types/i18n/cs.d.ts +1 -0
- package/dist/types/i18n/da.d.ts +1 -0
- package/dist/types/i18n/de.d.ts +1 -0
- package/dist/types/i18n/es.d.ts +1 -0
- package/dist/types/i18n/fi.d.ts +1 -0
- package/dist/types/i18n/fr.d.ts +1 -0
- package/dist/types/i18n/hu.d.ts +1 -0
- package/dist/types/i18n/it.d.ts +1 -0
- package/dist/types/i18n/ja.d.ts +1 -0
- package/dist/types/i18n/ko.d.ts +1 -0
- package/dist/types/i18n/nb.d.ts +1 -0
- package/dist/types/i18n/nl.d.ts +1 -0
- package/dist/types/i18n/pl.d.ts +1 -0
- package/dist/types/i18n/pt_BR.d.ts +1 -0
- package/dist/types/i18n/ru.d.ts +1 -0
- package/dist/types/i18n/sv.d.ts +1 -0
- package/dist/types/i18n/th.d.ts +1 -0
- package/dist/types/i18n/tr.d.ts +1 -0
- package/dist/types/i18n/uk.d.ts +1 -0
- package/dist/types/i18n/vi.d.ts +1 -0
- package/dist/types/i18n/zh.d.ts +1 -0
- package/dist/types/i18n/zh_TW.d.ts +1 -0
- package/dist/types/index.d.ts +7 -3
- package/dist/types/mention.d.ts +2 -0
- package/dist/types/messages/codeBidiWarning.d.ts +11 -0
- package/dist/types/messages/index.d.ts +1 -0
- package/dist/types/provider-factory.d.ts +1 -0
- package/dist/types/styles/index.d.ts +1 -1
- package/dist/types/styles/shared/panel.d.ts +3 -1
- package/dist/types/ufo/experience-store.d.ts +33 -0
- package/dist/types/ufo/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/profiler/render-count.d.ts +50 -0
- package/emoji/package.json +7 -0
- package/mention/package.json +7 -0
- package/package.json +33 -21
- package/provider-helpers/package.json +7 -0
- package/types/package.json +7 -0
- package/ufo/package.json +7 -0
- package/ui/package.json +7 -0
- package/utils/package.json +7 -0
- package/dist/cjs/ui/Caption/index.test.js +0 -82
- package/dist/cjs/utils/performance/measure-tti.test.js +0 -183
- package/dist/es2019/ui/Caption/index.test.js +0 -73
- package/dist/es2019/utils/performance/measure-tti.test.js +0 -124
- package/dist/esm/ui/Caption/index.test.js +0 -73
- package/dist/esm/utils/performance/measure-tti.test.js +0 -174
|
@@ -7,16 +7,21 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.
|
|
10
|
+
exports.getPanelDarkModeCSS = getPanelDarkModeCSS;
|
|
11
|
+
exports.panelSharedStyles = exports.getPanelTypeBackground = exports.PanelSharedSelectors = exports.PanelSharedCssClassName = exports.getPanelBackgroundDarkModeColors = void 0;
|
|
11
12
|
|
|
12
13
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
14
|
|
|
15
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
|
+
|
|
14
17
|
var _styledComponents = require("styled-components");
|
|
15
18
|
|
|
16
19
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
17
20
|
|
|
18
21
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
19
22
|
|
|
23
|
+
var _consts = require("@atlaskit/editor-shared-styles/consts");
|
|
24
|
+
|
|
20
25
|
var _emoji = require("@atlaskit/emoji");
|
|
21
26
|
|
|
22
27
|
var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
|
|
@@ -39,22 +44,67 @@ var lightPanelColor = {
|
|
|
39
44
|
warning: colors.Y50,
|
|
40
45
|
error: colors.R50
|
|
41
46
|
};
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
info:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
var darkPanelColors = {
|
|
48
|
+
// standard panels
|
|
49
|
+
info: '#0C294F',
|
|
50
|
+
error: "#441C13",
|
|
51
|
+
warning: "#413001",
|
|
52
|
+
tip: "#052E21",
|
|
53
|
+
success: "#052E21",
|
|
54
|
+
note: "#282249",
|
|
55
|
+
// Reds
|
|
56
|
+
R900: '#601D16',
|
|
57
|
+
// Red Saturated
|
|
58
|
+
R100S: "#FFEFEB",
|
|
59
|
+
R300S: "#FFB5A3",
|
|
60
|
+
R500S: "#FF6B47",
|
|
61
|
+
R800S: "#C4320E",
|
|
62
|
+
R1200S: "#441C13",
|
|
63
|
+
// Yellows
|
|
64
|
+
Y900: '#533F04',
|
|
65
|
+
// Yellow Saturated
|
|
66
|
+
Y100S: "#FFF3D1",
|
|
67
|
+
Y300S: "#FFDC7A",
|
|
68
|
+
Y500S: "#FFC933",
|
|
69
|
+
Y800S: "#D8A003",
|
|
70
|
+
Y1200S: "#413001",
|
|
71
|
+
// Greens
|
|
72
|
+
G900: '#164B35',
|
|
73
|
+
// Green Saturated
|
|
74
|
+
G100S: "#E3FCF0",
|
|
75
|
+
G300S: "#95EEC5",
|
|
76
|
+
G400S: "#60DCA8",
|
|
77
|
+
G900S: "#086848",
|
|
78
|
+
G1200S: "#052E21",
|
|
79
|
+
// Blues
|
|
80
|
+
B900: '#09326C',
|
|
81
|
+
// Saturated Blues
|
|
82
|
+
B100S: '#E5F0FF',
|
|
83
|
+
B300S: '#A3C9FF',
|
|
84
|
+
B500S: '#4794FF',
|
|
85
|
+
B800S: '#0055CC',
|
|
86
|
+
B1200S: '#0C294F',
|
|
87
|
+
// Purples
|
|
88
|
+
P900: "#352C63",
|
|
89
|
+
// Purple Saturated
|
|
90
|
+
P100S: "#EEEBFF",
|
|
91
|
+
P300S: "#CCC3FE",
|
|
92
|
+
P500S: "#A292F7",
|
|
93
|
+
P800S: "#5E49CA",
|
|
94
|
+
P1200S: "#282249",
|
|
95
|
+
// Teals
|
|
96
|
+
T900: '#1D474C',
|
|
97
|
+
// Teal Saturated
|
|
98
|
+
T100S: "#DBFAFF",
|
|
99
|
+
T300S: "#78EBFC",
|
|
100
|
+
T400S: "#3AD6EE",
|
|
101
|
+
T900S: "#056270",
|
|
102
|
+
T1200S: "#0B3037",
|
|
103
|
+
// Dark Mode Alpha
|
|
104
|
+
DNA20A: 'rgba(150, 176, 210, 0.53)',
|
|
105
|
+
DNA40A: 'rgba(134, 156, 180, 0.29)',
|
|
106
|
+
DNA80A: '#161A1D',
|
|
107
|
+
TextColor: '#D9DDE3'
|
|
58
108
|
};
|
|
59
109
|
var lightIconColor = {
|
|
60
110
|
info: colors.B400,
|
|
@@ -71,15 +121,24 @@ var darkIconColor = {
|
|
|
71
121
|
success: colors.G200,
|
|
72
122
|
warning: colors.Y100,
|
|
73
123
|
error: colors.R200
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
124
|
+
}; // New custom icons are a little smaller than predefined icons.
|
|
125
|
+
// To fix alignment issues with custom icons, vertical alignment is updated.
|
|
126
|
+
|
|
127
|
+
var panelEmojiSpriteVerticalAlignment = -((0, _constants.gridSize)() * 3 - _consts.akEditorCustomIconSize) / 2;
|
|
128
|
+
var panelEmojiImageVerticalAlignment = panelEmojiSpriteVerticalAlignment - 1;
|
|
129
|
+
var getPanelBackgroundDarkModeColors = [[colors.B50, darkPanelColors.B1200S], [colors.B75, darkPanelColors.B900], [colors.B100, darkPanelColors.B800S], [colors.N0, darkPanelColors.DNA80A], [colors.N20, darkPanelColors.DNA40A], [colors.N60, darkPanelColors.DNA20A], [colors.T50, darkPanelColors.T1200S], [colors.T75, darkPanelColors.T900], [colors.T100, darkPanelColors.T900S], [colors.G50, darkPanelColors.G1200S], [colors.G75, darkPanelColors.G900], [colors.G200, darkPanelColors.G900S], [colors.Y50, darkPanelColors.Y1200S], [colors.Y75, darkPanelColors.Y900], [colors.Y200, darkPanelColors.Y800S], [colors.R50, darkPanelColors.R1200S], [colors.R75, darkPanelColors.R900], [colors.R100, darkPanelColors.R800S], [colors.P50, darkPanelColors.P1200S], [colors.P75, darkPanelColors.P900], [colors.P100, darkPanelColors.P800S]].map(function (_ref) {
|
|
130
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
131
|
+
colorName = _ref2[0],
|
|
132
|
+
colorValue = _ref2[1];
|
|
133
|
+
|
|
134
|
+
return getPanelDarkModeCSS(colorName, colorValue);
|
|
135
|
+
}).join('\n');
|
|
136
|
+
exports.getPanelBackgroundDarkModeColors = getPanelBackgroundDarkModeColors;
|
|
137
|
+
|
|
138
|
+
function getPanelDarkModeCSS(colorName, colorValue) {
|
|
139
|
+
return "\n &[data-panel-color=\"".concat(colorName, "\"] {\n background-color: ").concat(colorValue, " !important; // !important to override default style color\n color: ").concat(darkPanelColors.TextColor, ";\n }\n ");
|
|
140
|
+
}
|
|
141
|
+
|
|
83
142
|
var prefix = 'ak-editor-panel';
|
|
84
143
|
var PanelSharedCssClassName = {
|
|
85
144
|
prefix: prefix,
|
|
@@ -97,7 +156,7 @@ var PanelSharedSelectors = {
|
|
|
97
156
|
removeButton: "button[aria-label=\"Remove\"]",
|
|
98
157
|
colorPalette: "[aria-label=\"Background color\"]",
|
|
99
158
|
selectedColor: "[aria-label=\"The smell\"]",
|
|
100
|
-
|
|
159
|
+
removeEmojiIcon: "[aria-label=\"Remove emoji\"]",
|
|
101
160
|
emojiIcon: "[aria-label=\"editor-add-emoji\"]",
|
|
102
161
|
selectedEmoji: "[aria-label=\":grinning:\"]",
|
|
103
162
|
title: "#editor-title"
|
|
@@ -119,7 +178,7 @@ var iconDynamicStyles = function iconDynamicStyles(panelType) {
|
|
|
119
178
|
var getPanelTypeBackground = function getPanelTypeBackground(panelType) {
|
|
120
179
|
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
121
180
|
var light = lightPanelColor[panelType];
|
|
122
|
-
var dark =
|
|
181
|
+
var dark = darkPanelColors[panelType];
|
|
123
182
|
var background = (0, _components.themed)({
|
|
124
183
|
light: light,
|
|
125
184
|
dark: dark
|
|
@@ -132,19 +191,15 @@ exports.getPanelTypeBackground = getPanelTypeBackground;
|
|
|
132
191
|
var mainDynamicStyles = function mainDynamicStyles(panelType) {
|
|
133
192
|
return function (props) {
|
|
134
193
|
var background = getPanelTypeBackground(panelType, props);
|
|
135
|
-
var darkText = darkTextColor[panelType];
|
|
136
|
-
var darkBorder = '1px solid ' + darkPanelBorderColor[panelType];
|
|
137
|
-
var border = (0, _components.themed)({
|
|
138
|
-
light: 'none',
|
|
139
|
-
dark: darkBorder
|
|
140
|
-
})(props);
|
|
141
194
|
var text = (0, _components.themed)({
|
|
142
195
|
light: 'inherit',
|
|
143
|
-
dark:
|
|
196
|
+
dark: darkPanelColors.TextColor
|
|
144
197
|
})(props);
|
|
145
|
-
return "\n background-color: ".concat(background, ";\n
|
|
198
|
+
return "\n background-color: ".concat(background, ";\n color: ").concat(text, ";\n ");
|
|
146
199
|
};
|
|
147
200
|
};
|
|
148
201
|
|
|
149
|
-
var panelSharedStyles = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n border-radius: ", "px;\n margin: ", " 0 0;\n padding: ", "px;\n min-width: ", "px;\n display: flex;\n align-items: baseline;\n word-break: break-word;\n\n ", "\n\n .", " {\n
|
|
202
|
+
var panelSharedStyles = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n border-radius: ", "px;\n margin: ", " 0 0;\n padding: ", "px;\n min-width: ", "px;\n display: flex;\n position: relative;\n align-items: baseline;\n word-break: break-word;\n\n ", "\n\n .", " {\n flex-shrink: 0;\n height: ", "px;\n width: ", "px;\n box-sizing: content-box;\n padding-right: ", "px;\n text-align: center;\n user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n ", "\n\n > span {\n vertical-align: middle;\n display: inline;\n }\n\n .", " {\n vertical-align: ", "px;\n }\n\n .", " {\n vertical-align: ", "px;\n\n // Vertical align only works for inline-block elements in Firefox\n @-moz-document url-prefix() {\n img {\n display: inline-block;\n }\n }\n }\n }\n\n .ak-editor-panel__content {\n margin: 1px 0 1px;\n flex: 1 0 0;\n /*\n https://ishadeed.com/article/min-max-css/#setting-min-width-to-zero-with-flexbox\n The default value for min-width is auto, which is computed to zero. When an element is a flex item, the value of min-width doesn\u2019t compute to zero. The minimum size of a flex item is equal to the size of its contents.\n */\n min-width: 0;\n }\n\n &[data-panel-type='", "'] {\n ", "\n\n .", " {\n ", "\n }\n }\n\n &[data-panel-type='", "'] {\n ", "\n\n .", " {\n ", "\n }\n }\n\n &[data-panel-type='", "'] {\n ", "\n\n .", " {\n ", "\n }\n }\n\n &[data-panel-type='", "'] {\n ", "\n\n .", " {\n ", "\n }\n }\n\n &[data-panel-type='", "'] {\n ", "\n\n .", " {\n ", "\n }\n }\n\n &[data-panel-type='", "'] {\n ", ";\n }\n }\n"])), PanelSharedCssClassName.prefix, (0, _constants.borderRadius)(), _editorSharedStyles.blockNodesVerticalMargin, (0, _constants.gridSize)(), _editorSharedStyles.akEditorTableCellMinWidth, mainDynamicStyles(_adfSchema.PanelType.INFO), PanelSharedCssClassName.icon, (0, _constants.gridSize)() * 3, (0, _constants.gridSize)() * 3, (0, _constants.gridSize)(), iconDynamicStyles(_adfSchema.PanelType.INFO), _emoji.emojiSprite, panelEmojiSpriteVerticalAlignment, _emoji.emojiImage, panelEmojiImageVerticalAlignment, _adfSchema.PanelType.NOTE, mainDynamicStyles(_adfSchema.PanelType.NOTE), PanelSharedCssClassName.icon, iconDynamicStyles(_adfSchema.PanelType.NOTE), _adfSchema.PanelType.TIP, mainDynamicStyles(_adfSchema.PanelType.TIP), PanelSharedCssClassName.icon, iconDynamicStyles(_adfSchema.PanelType.TIP), _adfSchema.PanelType.WARNING, mainDynamicStyles(_adfSchema.PanelType.WARNING), PanelSharedCssClassName.icon, iconDynamicStyles(_adfSchema.PanelType.WARNING), _adfSchema.PanelType.ERROR, mainDynamicStyles(_adfSchema.PanelType.ERROR), PanelSharedCssClassName.icon, iconDynamicStyles(_adfSchema.PanelType.ERROR), _adfSchema.PanelType.SUCCESS, mainDynamicStyles(_adfSchema.PanelType.SUCCESS), PanelSharedCssClassName.icon, iconDynamicStyles(_adfSchema.PanelType.SUCCESS), _adfSchema.PanelType.CUSTOM, (0, _components.themed)({
|
|
203
|
+
dark: getPanelBackgroundDarkModeColors
|
|
204
|
+
}));
|
|
150
205
|
exports.panelSharedStyles = panelSharedStyles;
|
|
@@ -54,13 +54,13 @@ var TableSharedCssClassName = {
|
|
|
54
54
|
TABLE_CELL_WRAPPER: _adfSchema.tableCellSelector
|
|
55
55
|
};
|
|
56
56
|
exports.TableSharedCssClassName = TableSharedCssClassName;
|
|
57
|
-
var tableSharedStyle = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n position: relative;\n margin: 0 auto ", "px;\n box-sizing: border-box;\n\n /**\n * Fix block top alignment inside table cells.\n */\n .decisionItemView-content-wrap:first-child > div {\n margin-top: 0;\n }\n }\n .", "[data-number-column='true'] {\n padding-left: ", "px;\n }\n /* avoid applying styles to nested tables (possible via extensions) */\n .", " > table,\n .", " > table,\n .", " > table {\n border-collapse: collapse;\n margin: ", "px ", "px 0 0;\n border: ", "px solid\n ", ";\n table-layout: fixed;\n font-size: 1em;\n width: 100%;\n\n &[data-autosize='true'] {\n table-layout: auto;\n }\n\n & {\n * {\n box-sizing: border-box;\n }\n hr {\n box-sizing: content-box;\n }\n\n tbody {\n border-bottom: none;\n }\n th td {\n background-color: white;\n }\n th,\n td {\n min-width: ", "px;\n font-weight: normal;\n vertical-align: top;\n border: 1px solid\n ", ";\n border-right-width: 0;\n border-bottom-width: 0;\n padding: ", "px;\n /* https://stackoverflow.com/questions/7517127/borders-not-shown-in-firefox-with-border-collapse-on-table-position-relative-o */\n ", "\n\n ", ";\n\n > *:first-child {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor.-right:first-child + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child + span + * {\n margin-top: 0;\n }\n\n th p:not(:first-of-type),\n td p:not(:first-of-type) {\n margin-top: 12px;\n }\n }\n th {\n background-color: ", ";\n text-align: left;\n\n /* only apply this styling to codeblocks in default background headercells */\n /* TODO this needs to be overhauled as it relies on unsafe selectors */\n &:not([style]) {\n .code-block {\n background-image: ", ";\n background-attachment: local, scroll, scroll;\n background-position: 100% 0, 100% 0, 0 0;\n background-color: ", ";\n\n .line-number-gutter {\n background-color: ", ";\n }\n\n /* this is only relevant to the element taken care of by renderer */\n > [data-ds--code--code-block] {\n background-image: ", "!important;\n\n background-color: ", "!important;\n\n // selector lives inside @atlaskit/code\n --ds--code--line-number-bg-color: ", ";\n }\n }\n }\n }\n }\n }\n"])), TableSharedCssClassName.TABLE_CONTAINER, tableMarginBottom, TableSharedCssClassName.TABLE_CONTAINER, _editorSharedStyles.akEditorTableNumberColumnWidth - 1, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_NODE_WRAPPER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableMarginTop, tableMarginSides, tableCellBorderWidth, (0, _components.themed)({
|
|
57
|
+
var tableSharedStyle = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n position: relative;\n margin: 0 auto ", "px;\n box-sizing: border-box;\n\n /**\n * Fix block top alignment inside table cells.\n */\n .decisionItemView-content-wrap:first-child > div {\n margin-top: 0;\n }\n }\n .", "[data-number-column='true'] {\n padding-left: ", "px;\n clear: both;\n }\n /* avoid applying styles to nested tables (possible via extensions) */\n .", " > table,\n .", " > table,\n .", " > table {\n border-collapse: collapse;\n margin: ", "px ", "px 0 0;\n border: ", "px solid\n ", ";\n table-layout: fixed;\n font-size: 1em;\n width: 100%;\n\n &[data-autosize='true'] {\n table-layout: auto;\n }\n\n & {\n * {\n box-sizing: border-box;\n }\n hr {\n box-sizing: content-box;\n }\n\n tbody {\n border-bottom: none;\n }\n th td {\n background-color: white;\n }\n th,\n td {\n min-width: ", "px;\n font-weight: normal;\n vertical-align: top;\n border: 1px solid\n ", ";\n border-right-width: 0;\n border-bottom-width: 0;\n padding: ", "px;\n /* https://stackoverflow.com/questions/7517127/borders-not-shown-in-firefox-with-border-collapse-on-table-position-relative-o */\n ", "\n\n ", ";\n\n > *:first-child {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor.-right:first-child + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child + span + * {\n margin-top: 0;\n }\n\n th p:not(:first-of-type),\n td p:not(:first-of-type) {\n margin-top: 12px;\n }\n }\n th {\n background-color: ", ";\n text-align: left;\n\n /* only apply this styling to codeblocks in default background headercells */\n /* TODO this needs to be overhauled as it relies on unsafe selectors */\n &:not([style]) {\n .code-block {\n background-image: ", ";\n background-attachment: local, scroll, scroll;\n background-position: 100% 0, 100% 0, 0 0;\n background-color: ", ";\n\n .line-number-gutter {\n background-color: ", ";\n }\n\n /* this is only relevant to the element taken care of by renderer */\n > [data-ds--code--code-block] {\n background-image: ", "!important;\n\n background-color: ", "!important;\n\n // selector lives inside @atlaskit/code\n --ds--code--line-number-bg-color: ", ";\n }\n }\n }\n }\n }\n }\n"])), TableSharedCssClassName.TABLE_CONTAINER, tableMarginBottom, TableSharedCssClassName.TABLE_CONTAINER, _editorSharedStyles.akEditorTableNumberColumnWidth - 1, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_NODE_WRAPPER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableMarginTop, tableMarginSides, tableCellBorderWidth, (0, _components.themed)({
|
|
58
58
|
light: _editorSharedStyles.akEditorTableBorder,
|
|
59
59
|
dark: _editorSharedStyles.akEditorTableBorderDark
|
|
60
60
|
}), tableCellMinWidth, (0, _components.themed)({
|
|
61
61
|
light: _editorSharedStyles.akEditorTableBorder,
|
|
62
62
|
dark: _editorSharedStyles.akEditorTableBorderDark
|
|
63
|
-
}), tableCellPadding, _browser.default.gecko || _browser.default.ie ? 'background-clip: padding-box;' : '', (0, _components.themed)({
|
|
63
|
+
}), tableCellPadding, _browser.default.gecko || _browser.default.ie || _browser.default.mac && _browser.default.chrome ? 'background-clip: padding-box;' : '', (0, _components.themed)({
|
|
64
64
|
dark: _editorSharedStyles.getTableCellBackgroundDarkModeColors
|
|
65
65
|
}), (0, _components.themed)({
|
|
66
66
|
light: _editorSharedStyles.akEditorTableToolbar,
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ExperienceStore = exports.RELIABILITY_INTERVAL = exports.EditorExperience = exports.experienceConfig = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
16
|
+
var _ufo = require("@atlaskit/ufo");
|
|
17
|
+
|
|
18
|
+
var experienceConfig = {
|
|
19
|
+
type: _ufo.ExperienceTypes.Operation,
|
|
20
|
+
performanceType: _ufo.ExperiencePerformanceTypes.Custom,
|
|
21
|
+
platform: {
|
|
22
|
+
component: 'editor'
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.experienceConfig = experienceConfig;
|
|
26
|
+
var EditorExperience;
|
|
27
|
+
exports.EditorExperience = EditorExperience;
|
|
28
|
+
|
|
29
|
+
(function (EditorExperience) {
|
|
30
|
+
EditorExperience["loadEditor"] = "load";
|
|
31
|
+
EditorExperience["typing"] = "type";
|
|
32
|
+
EditorExperience["interaction"] = "interact";
|
|
33
|
+
EditorExperience["editSession"] = "editSession";
|
|
34
|
+
})(EditorExperience || (exports.EditorExperience = EditorExperience = {}));
|
|
35
|
+
|
|
36
|
+
var RELIABILITY_INTERVAL = 30000;
|
|
37
|
+
exports.RELIABILITY_INTERVAL = RELIABILITY_INTERVAL;
|
|
38
|
+
|
|
39
|
+
var ExperienceStore = /*#__PURE__*/function () {
|
|
40
|
+
function ExperienceStore() {
|
|
41
|
+
(0, _classCallCheck2.default)(this, ExperienceStore);
|
|
42
|
+
this.experiences = new Map();
|
|
43
|
+
|
|
44
|
+
for (var _i = 0, _Object$values = Object.values(EditorExperience); _i < _Object$values.length; _i++) {
|
|
45
|
+
var experienceId = _Object$values[_i];
|
|
46
|
+
var experience = new _ufo.UFOExperience(experienceId, experienceConfig);
|
|
47
|
+
this.experiences.set(experienceId, experience);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
(0, _createClass2.default)(ExperienceStore, [{
|
|
52
|
+
key: "get",
|
|
53
|
+
value: function get(experienceId) {
|
|
54
|
+
return this.experiences.get(experienceId);
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "getActive",
|
|
58
|
+
value: function getActive(experienceId) {
|
|
59
|
+
var experience = this.experiences.get(experienceId);
|
|
60
|
+
|
|
61
|
+
if (!(experience !== null && experience !== void 0 && experience.state.final)) {
|
|
62
|
+
return experience;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
key: "getAll",
|
|
67
|
+
value: function getAll() {
|
|
68
|
+
return Array.from(this.experiences.values());
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "start",
|
|
72
|
+
value: function start(experienceId, startTime) {
|
|
73
|
+
var _this$get;
|
|
74
|
+
|
|
75
|
+
(_this$get = this.get(experienceId)) === null || _this$get === void 0 ? void 0 : _this$get.start(startTime);
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
key: "addMetadata",
|
|
79
|
+
value: function addMetadata(experienceId, metadata) {
|
|
80
|
+
var _this$get2;
|
|
81
|
+
|
|
82
|
+
(_this$get2 = this.get(experienceId)) === null || _this$get2 === void 0 ? void 0 : _this$get2.addMetadata(metadata);
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
85
|
+
key: "mark",
|
|
86
|
+
value: function mark(experienceId, _mark, value) {
|
|
87
|
+
var _this$get3;
|
|
88
|
+
|
|
89
|
+
(_this$get3 = this.get(experienceId)) === null || _this$get3 === void 0 ? void 0 : _this$get3.mark(_mark, value);
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
key: "success",
|
|
93
|
+
value: function success(experienceId, metadata) {
|
|
94
|
+
var _this$getActive;
|
|
95
|
+
|
|
96
|
+
return (_this$getActive = this.getActive(experienceId)) === null || _this$getActive === void 0 ? void 0 : _this$getActive.success({
|
|
97
|
+
metadata: metadata
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
key: "fail",
|
|
102
|
+
value: function fail(experienceId, metadata) {
|
|
103
|
+
var _this$getActive2;
|
|
104
|
+
|
|
105
|
+
(_this$getActive2 = this.getActive(experienceId)) === null || _this$getActive2 === void 0 ? void 0 : _this$getActive2.failure({
|
|
106
|
+
metadata: metadata
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
key: "abort",
|
|
111
|
+
value: function abort(experienceId, metadata) {
|
|
112
|
+
var _this = this;
|
|
113
|
+
|
|
114
|
+
// We add this wait in here because when React catches an error it unmounts the component
|
|
115
|
+
// before the error boundary's componentDidCatch is called
|
|
116
|
+
// In this case we want to fail the experience, but without this wait, abort is called first
|
|
117
|
+
setTimeout(function () {
|
|
118
|
+
var _this$getActive3;
|
|
119
|
+
|
|
120
|
+
(_this$getActive3 = _this.getActive(experienceId)) === null || _this$getActive3 === void 0 ? void 0 : _this$getActive3.abort({
|
|
121
|
+
metadata: metadata
|
|
122
|
+
});
|
|
123
|
+
}, 0);
|
|
124
|
+
}
|
|
125
|
+
}, {
|
|
126
|
+
key: "abortAll",
|
|
127
|
+
value: function abortAll(metadata) {
|
|
128
|
+
var _this2 = this;
|
|
129
|
+
|
|
130
|
+
this.experiences.forEach(function (experience) {
|
|
131
|
+
_this2.abort(experience.id, metadata);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}, {
|
|
135
|
+
key: "failAll",
|
|
136
|
+
value: function failAll(metadata) {
|
|
137
|
+
var _this3 = this;
|
|
138
|
+
|
|
139
|
+
this.experiences.forEach(function (experience) {
|
|
140
|
+
_this3.fail(experience.id, metadata);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}], [{
|
|
144
|
+
key: "getInstance",
|
|
145
|
+
value: function getInstance(view) {
|
|
146
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
147
|
+
|
|
148
|
+
if (!this.stores.get(view) || options !== null && options !== void 0 && options.forceNewInstance) {
|
|
149
|
+
var store = new ExperienceStore();
|
|
150
|
+
this.stores.set(view, store);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return this.stores.get(view);
|
|
154
|
+
}
|
|
155
|
+
}]);
|
|
156
|
+
return ExperienceStore;
|
|
157
|
+
}();
|
|
158
|
+
|
|
159
|
+
exports.ExperienceStore = ExperienceStore;
|
|
160
|
+
(0, _defineProperty2.default)(ExperienceStore, "stores", new WeakMap());
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ExperienceStore", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _experienceStore.ExperienceStore;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "EditorExperience", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _experienceStore.EditorExperience;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "RELIABILITY_INTERVAL", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _experienceStore.RELIABILITY_INTERVAL;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
var _experienceStore = require("./experience-store");
|
|
@@ -21,8 +21,6 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
21
21
|
|
|
22
22
|
var _constants = require("@atlaskit/theme/constants");
|
|
23
23
|
|
|
24
|
-
var _math = require("@atlaskit/theme/math");
|
|
25
|
-
|
|
26
24
|
var _typography = require("@atlaskit/theme/typography");
|
|
27
25
|
|
|
28
26
|
var _templateObject, _templateObject2;
|
|
@@ -37,7 +35,7 @@ var Message = _styledComponents.default.div(_templateObject || (_templateObject
|
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
return _colors.N200;
|
|
40
|
-
}, (0,
|
|
38
|
+
}, (0, _constants.gridSize)() / 2);
|
|
41
39
|
|
|
42
40
|
var IconWrapper = _styledComponents.default.span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n margin-right: 4px;\n"])));
|
|
43
41
|
|
|
@@ -146,6 +146,12 @@ function compareValue(valueA, valueB) {
|
|
|
146
146
|
return 0;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
if (typeof valueA === 'string' && typeof valueB === 'string') {
|
|
150
|
+
return valueA.localeCompare(valueB, window.navigator.language, {
|
|
151
|
+
caseFirst: 'upper'
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
149
155
|
return valueA > valueB ? 1 : -1;
|
|
150
156
|
}
|
|
151
157
|
/**
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -335,6 +335,24 @@ Object.defineProperty(exports, "sniffUserBrowserExtensions", {
|
|
|
335
335
|
return _browserExtensions.sniffUserBrowserExtensions;
|
|
336
336
|
}
|
|
337
337
|
});
|
|
338
|
+
Object.defineProperty(exports, "RenderCountProfiler", {
|
|
339
|
+
enumerable: true,
|
|
340
|
+
get: function get() {
|
|
341
|
+
return _renderCount.RenderCountProfiler;
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
Object.defineProperty(exports, "validateADFEntity", {
|
|
345
|
+
enumerable: true,
|
|
346
|
+
get: function get() {
|
|
347
|
+
return _validateUsingSpec.validateADFEntity;
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
Object.defineProperty(exports, "validationErrorHandler", {
|
|
351
|
+
enumerable: true,
|
|
352
|
+
get: function get() {
|
|
353
|
+
return _validateUsingSpec.validationErrorHandler;
|
|
354
|
+
}
|
|
355
|
+
});
|
|
338
356
|
|
|
339
357
|
var _annotation = require("./annotation");
|
|
340
358
|
|
|
@@ -382,4 +400,8 @@ var _shouldForceTracking = require("./should-force-tracking");
|
|
|
382
400
|
|
|
383
401
|
var _getModeFromTheme = require("./getModeFromTheme");
|
|
384
402
|
|
|
385
|
-
var _browserExtensions = require("./browser-extensions");
|
|
403
|
+
var _browserExtensions = require("./browser-extensions");
|
|
404
|
+
|
|
405
|
+
var _renderCount = require("./profiler/render-count");
|
|
406
|
+
|
|
407
|
+
var _validateUsingSpec = require("./validate-using-spec");
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.RenderCountProfiler = exports.PROFILER_KEY = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
+
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
19
|
+
|
|
20
|
+
var PROFILER_KEY = '__editorRenderCountProfiler';
|
|
21
|
+
exports.PROFILER_KEY = PROFILER_KEY;
|
|
22
|
+
|
|
23
|
+
var RenderCountProfiler = /*#__PURE__*/function () {
|
|
24
|
+
/**
|
|
25
|
+
* The singleton/cached instance of RenderCountProfiler that will be shared
|
|
26
|
+
* betweenRenderCountProfiler.getInstance() calls
|
|
27
|
+
*/
|
|
28
|
+
function RenderCountProfiler(_ref) {
|
|
29
|
+
var store = _ref.store;
|
|
30
|
+
(0, _classCallCheck2.default)(this, RenderCountProfiler);
|
|
31
|
+
this.store = store;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Returns the singleton/cached instance of RenderCountProfiler that
|
|
35
|
+
* currently exists. If it hasn't been instantiated yet, the singleton
|
|
36
|
+
* instance will be created using the given params. Returns the latest
|
|
37
|
+
* singleton/instance.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
(0, _createClass2.default)(RenderCountProfiler, [{
|
|
42
|
+
key: "getData",
|
|
43
|
+
value: function getData(profilerKey) {
|
|
44
|
+
var _this$store;
|
|
45
|
+
|
|
46
|
+
return (_this$store = this.store) === null || _this$store === void 0 ? void 0 : _this$store[profilerKey];
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
key: "enable",
|
|
50
|
+
value: function enable() {
|
|
51
|
+
this.store[PROFILER_KEY] = _objectSpread(_objectSpread({}, this.store[PROFILER_KEY]), {}, {
|
|
52
|
+
enabled: true
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}, {
|
|
56
|
+
key: "remove",
|
|
57
|
+
value: function remove() {
|
|
58
|
+
delete this.store[PROFILER_KEY];
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "isEnabled",
|
|
62
|
+
value: function isEnabled() {
|
|
63
|
+
var _this$store2, _this$store2$PROFILER;
|
|
64
|
+
|
|
65
|
+
return Boolean((_this$store2 = this.store) === null || _this$store2 === void 0 ? void 0 : (_this$store2$PROFILER = _this$store2[PROFILER_KEY]) === null || _this$store2$PROFILER === void 0 ? void 0 : _this$store2$PROFILER.enabled);
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
key: "setRenderCount",
|
|
69
|
+
value: function setRenderCount(_ref2) {
|
|
70
|
+
var componentId = _ref2.componentId,
|
|
71
|
+
renderCount = _ref2.renderCount,
|
|
72
|
+
instanceId = _ref2.instanceId;
|
|
73
|
+
var profilerData = this.store[PROFILER_KEY];
|
|
74
|
+
var instance = {
|
|
75
|
+
count: renderCount
|
|
76
|
+
};
|
|
77
|
+
var existingComponents = profilerData === null || profilerData === void 0 ? void 0 : profilerData.components;
|
|
78
|
+
var existingInstances = existingComponents === null || existingComponents === void 0 ? void 0 : existingComponents[componentId];
|
|
79
|
+
|
|
80
|
+
var updatedComponent = _objectSpread(_objectSpread({}, existingInstances), {}, (0, _defineProperty2.default)({}, instanceId, instance));
|
|
81
|
+
|
|
82
|
+
this.store[PROFILER_KEY] = _objectSpread(_objectSpread({}, profilerData), {}, {
|
|
83
|
+
components: _objectSpread(_objectSpread({}, existingComponents), {}, (0, _defineProperty2.default)({}, componentId, updatedComponent))
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
87
|
+
key: "getInstanceRenderCounters",
|
|
88
|
+
value: function getInstanceRenderCounters(_ref3) {
|
|
89
|
+
var _this$store$PROFILER_, _this$store3, _this$store3$PROFILER, _this$store3$PROFILER2;
|
|
90
|
+
|
|
91
|
+
var componentId = _ref3.componentId;
|
|
92
|
+
var component = (_this$store$PROFILER_ = (_this$store3 = this.store) === null || _this$store3 === void 0 ? void 0 : (_this$store3$PROFILER = _this$store3[PROFILER_KEY]) === null || _this$store3$PROFILER === void 0 ? void 0 : (_this$store3$PROFILER2 = _this$store3$PROFILER.components) === null || _this$store3$PROFILER2 === void 0 ? void 0 : _this$store3$PROFILER2[componentId]) !== null && _this$store$PROFILER_ !== void 0 ? _this$store$PROFILER_ : {};
|
|
93
|
+
var counters = [];
|
|
94
|
+
|
|
95
|
+
for (var _instanceId in component) {
|
|
96
|
+
var counter = {
|
|
97
|
+
instanceId: _instanceId,
|
|
98
|
+
count: component[_instanceId].count
|
|
99
|
+
};
|
|
100
|
+
counters.push(counter);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return counters;
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
key: "getRenderCount",
|
|
107
|
+
value: function getRenderCount(_ref4) {
|
|
108
|
+
var _this$store$PROFILER_2, _this$store4, _this$store4$PROFILER, _this$store4$PROFILER2;
|
|
109
|
+
|
|
110
|
+
var componentId = _ref4.componentId;
|
|
111
|
+
var component = (_this$store$PROFILER_2 = (_this$store4 = this.store) === null || _this$store4 === void 0 ? void 0 : (_this$store4$PROFILER = _this$store4[PROFILER_KEY]) === null || _this$store4$PROFILER === void 0 ? void 0 : (_this$store4$PROFILER2 = _this$store4$PROFILER.components) === null || _this$store4$PROFILER2 === void 0 ? void 0 : _this$store4$PROFILER2[componentId]) !== null && _this$store$PROFILER_2 !== void 0 ? _this$store$PROFILER_2 : {};
|
|
112
|
+
var total = 0;
|
|
113
|
+
|
|
114
|
+
for (var _instanceId2 in component) {
|
|
115
|
+
total += component[_instanceId2].count;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return total;
|
|
119
|
+
}
|
|
120
|
+
}], [{
|
|
121
|
+
key: "getInstance",
|
|
122
|
+
value: function getInstance(params) {
|
|
123
|
+
if (!RenderCountProfiler.instance) {
|
|
124
|
+
RenderCountProfiler.instance = new RenderCountProfiler({
|
|
125
|
+
store: params.store
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return RenderCountProfiler.instance;
|
|
130
|
+
}
|
|
131
|
+
}]);
|
|
132
|
+
return RenderCountProfiler;
|
|
133
|
+
}();
|
|
134
|
+
|
|
135
|
+
exports.RenderCountProfiler = RenderCountProfiler;
|