@atlaskit/editor-common 65.0.0 → 66.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 +22 -0
- package/dist/cjs/normalize-feature-flags.js +40 -4
- package/dist/cjs/styles/shared/link.js +2 -2
- package/dist/cjs/styles/shared/lists.js +1 -1
- package/dist/cjs/styles/shared/panel.js +7 -4
- package/dist/cjs/styles/shared/rule.js +5 -2
- package/dist/cjs/styles/shared/table.js +1 -1
- package/dist/cjs/ui/Expand/index.js +84 -46
- package/dist/cjs/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +9 -9
- package/dist/cjs/ui/MediaSingle/index.js +13 -8
- package/dist/cjs/ui/MediaSingle/styled.js +23 -20
- package/dist/cjs/ui/Popup/index.js +15 -1
- package/dist/cjs/ui/UnsupportedBlock/index.js +1 -1
- package/dist/cjs/ui/index.js +12 -22
- package/dist/cjs/utils/compare-props.js +136 -0
- package/dist/cjs/utils/index.js +23 -1
- package/dist/cjs/utils/performance/hooks/use-component-render-tracking/index.js +47 -0
- package/dist/cjs/utils/validator.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/normalize-feature-flags.js +40 -4
- package/dist/es2019/styles/shared/link.js +1 -1
- package/dist/es2019/styles/shared/lists.js +2 -0
- package/dist/es2019/styles/shared/panel.js +15 -15
- package/dist/es2019/styles/shared/rule.js +3 -3
- package/dist/es2019/styles/shared/table.js +9 -1
- package/dist/es2019/ui/Expand/index.js +97 -67
- package/dist/es2019/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +1 -1
- package/dist/es2019/ui/MediaSingle/index.js +13 -9
- package/dist/es2019/ui/MediaSingle/styled.js +13 -12
- package/dist/es2019/ui/Popup/index.js +16 -1
- package/dist/es2019/ui/UnsupportedBlock/index.js +0 -1
- package/dist/es2019/ui/index.js +2 -4
- package/dist/es2019/utils/compare-props.js +99 -0
- package/dist/es2019/utils/index.js +3 -1
- package/dist/es2019/utils/performance/hooks/use-component-render-tracking/index.js +36 -0
- package/dist/es2019/utils/validator.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/normalize-feature-flags.js +39 -4
- package/dist/esm/styles/shared/link.js +1 -1
- package/dist/esm/styles/shared/lists.js +1 -1
- package/dist/esm/styles/shared/panel.js +6 -4
- package/dist/esm/styles/shared/rule.js +4 -2
- package/dist/esm/styles/shared/table.js +1 -1
- package/dist/esm/ui/Expand/index.js +79 -42
- package/dist/esm/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +7 -7
- package/dist/esm/ui/MediaSingle/index.js +14 -9
- package/dist/esm/ui/MediaSingle/styled.js +17 -10
- package/dist/esm/ui/Popup/index.js +16 -1
- package/dist/esm/ui/UnsupportedBlock/index.js +1 -1
- package/dist/esm/ui/index.js +2 -4
- package/dist/esm/utils/compare-props.js +115 -0
- package/dist/esm/utils/index.js +3 -1
- package/dist/esm/utils/performance/hooks/use-component-render-tracking/index.js +37 -0
- package/dist/esm/utils/validator.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/extensions/types/field-definitions.d.ts +1 -1
- package/dist/types/normalize-feature-flags.d.ts +6 -3
- package/dist/types/styles/shared/link.d.ts +1 -1
- package/dist/types/styles/shared/panel.d.ts +1 -1
- package/dist/types/styles/shared/rule.d.ts +2 -1
- package/dist/types/ui/Expand/index.d.ts +12 -10
- package/dist/types/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.d.ts +1 -1
- package/dist/types/ui/MediaSingle/index.d.ts +4 -2
- package/dist/types/ui/MediaSingle/styled.d.ts +10 -5
- package/dist/types/ui/Popup/index.d.ts +3 -0
- package/dist/types/ui/index.d.ts +2 -4
- package/dist/types/utils/compare-props.d.ts +32 -0
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/performance/hooks/use-component-render-tracking/index.d.ts +19 -0
- package/package.json +13 -14
- package/dist/cjs/ui/IntlLegacyFallbackProvider/index.js +0 -60
- package/dist/cjs/ui/LegacyToNextIntlProvider/index.js +0 -67
- package/dist/es2019/ui/IntlLegacyFallbackProvider/index.js +0 -21
- package/dist/es2019/ui/LegacyToNextIntlProvider/index.js +0 -24
- package/dist/esm/ui/IntlLegacyFallbackProvider/index.js +0 -45
- package/dist/esm/ui/LegacyToNextIntlProvider/index.js +0 -51
- package/dist/types/ui/IntlLegacyFallbackProvider/index.d.ts +0 -8
- package/dist/types/ui/LegacyToNextIntlProvider/index.d.ts +0 -8
|
@@ -41,7 +41,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
41
41
|
|
|
42
42
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
43
43
|
|
|
44
|
-
var blockNodeStyle = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n
|
|
44
|
+
var blockNodeStyle = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: ", ";\n border: 1px dashed ", ";\n border-radius: ", "px;\n box-sizing: border-box;\n cursor: default;\n display: flex;\n font-size: ", ";\n margin: 10px 0;\n min-height: 24px;\n padding: 10px;\n text-align: center;\n vertical-align: text-bottom;\n min-width: 120px;\n align-items: center;\n justify-content: center;\n"])), _colors.N30, _colors.N50, (0, _constants.borderRadius)(), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()));
|
|
45
45
|
|
|
46
46
|
var UnsupportedBlockNode = function UnsupportedBlockNode(_ref) {
|
|
47
47
|
var node = _ref.node,
|
package/dist/cjs/ui/index.js
CHANGED
|
@@ -43,10 +43,10 @@ Object.defineProperty(exports, "ExpandIconWrapper", {
|
|
|
43
43
|
return _Expand.ExpandIconWrapper;
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
|
-
Object.defineProperty(exports, "
|
|
46
|
+
Object.defineProperty(exports, "ExpandLayoutWrapperWithRef", {
|
|
47
47
|
enumerable: true,
|
|
48
48
|
get: function get() {
|
|
49
|
-
return _Expand.
|
|
49
|
+
return _Expand.ExpandLayoutWrapperWithRef;
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
Object.defineProperty(exports, "HelperMessage", {
|
|
@@ -55,22 +55,10 @@ Object.defineProperty(exports, "HelperMessage", {
|
|
|
55
55
|
return _Messages.HelperMessage;
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
Object.defineProperty(exports, "
|
|
58
|
+
Object.defineProperty(exports, "IntlErrorBoundary", {
|
|
59
59
|
enumerable: true,
|
|
60
60
|
get: function get() {
|
|
61
|
-
return
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
Object.defineProperty(exports, "IntlNextErrorBoundary", {
|
|
65
|
-
enumerable: true,
|
|
66
|
-
get: function get() {
|
|
67
|
-
return _IntlNextErrorBoundary.IntlNextErrorBoundary;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
Object.defineProperty(exports, "LegacyToNextIntlProvider", {
|
|
71
|
-
enumerable: true,
|
|
72
|
-
get: function get() {
|
|
73
|
-
return _LegacyToNextIntlProvider.LegacyToNextIntlProvider;
|
|
61
|
+
return _IntlErrorBoundary.IntlErrorBoundary;
|
|
74
62
|
}
|
|
75
63
|
});
|
|
76
64
|
Object.defineProperty(exports, "MediaSingle", {
|
|
@@ -94,7 +82,7 @@ Object.defineProperty(exports, "Popup", {
|
|
|
94
82
|
Object.defineProperty(exports, "REACT_INTL_ERROR_MESSAGE", {
|
|
95
83
|
enumerable: true,
|
|
96
84
|
get: function get() {
|
|
97
|
-
return
|
|
85
|
+
return _IntlErrorBoundary.REACT_INTL_ERROR_MESSAGE;
|
|
98
86
|
}
|
|
99
87
|
});
|
|
100
88
|
Object.defineProperty(exports, "UnsupportedBlock", {
|
|
@@ -163,6 +151,12 @@ Object.defineProperty(exports, "clearNextSiblingMarginTopStyle", {
|
|
|
163
151
|
return _clearNextSiblingMarginTop.clearNextSiblingMarginTopStyle;
|
|
164
152
|
}
|
|
165
153
|
});
|
|
154
|
+
Object.defineProperty(exports, "expandLayoutWrapperStyle", {
|
|
155
|
+
enumerable: true,
|
|
156
|
+
get: function get() {
|
|
157
|
+
return _Expand.expandLayoutWrapperStyle;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
166
160
|
Object.defineProperty(exports, "expandMessages", {
|
|
167
161
|
enumerable: true,
|
|
168
162
|
get: function get() {
|
|
@@ -274,11 +268,7 @@ var _Messages = require("./Messages");
|
|
|
274
268
|
|
|
275
269
|
var _clearNextSiblingMarginTop = require("./clear-next-sibling-margin-top");
|
|
276
270
|
|
|
277
|
-
var
|
|
278
|
-
|
|
279
|
-
var _IntlLegacyFallbackProvider = require("./IntlLegacyFallbackProvider");
|
|
280
|
-
|
|
281
|
-
var _LegacyToNextIntlProvider = require("./LegacyToNextIntlProvider");
|
|
271
|
+
var _IntlErrorBoundary = require("./IntlErrorBoundary");
|
|
282
272
|
|
|
283
273
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
284
274
|
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.serializeValue = exports.getShallowPropsDifference = exports.getPropsDifference = exports.getKeysAddedRemovedCommon = exports.getKeys = void 0;
|
|
9
|
+
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var getKeys = Object.keys;
|
|
15
|
+
exports.getKeys = getKeys;
|
|
16
|
+
|
|
17
|
+
var getKeysAddedRemovedCommon = function getKeysAddedRemovedCommon(object1, object2) {
|
|
18
|
+
var oldKeys = object1 !== null ? getKeys(object1) : [];
|
|
19
|
+
var newKeys = object2 !== null ? getKeys(object2) : [];
|
|
20
|
+
var removed = oldKeys.filter(function (key) {
|
|
21
|
+
return !newKeys.includes(key);
|
|
22
|
+
});
|
|
23
|
+
var added = newKeys.filter(function (key) {
|
|
24
|
+
return !oldKeys.includes(key);
|
|
25
|
+
});
|
|
26
|
+
var common = oldKeys.filter(function (key) {
|
|
27
|
+
return newKeys.includes(key);
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
added: added,
|
|
31
|
+
common: common,
|
|
32
|
+
removed: removed
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.getKeysAddedRemovedCommon = getKeysAddedRemovedCommon;
|
|
37
|
+
|
|
38
|
+
var serializeValue = function serializeValue(value) {
|
|
39
|
+
var valueType = (0, _typeof2.default)(value);
|
|
40
|
+
|
|
41
|
+
if (value === null) {
|
|
42
|
+
return 'null';
|
|
43
|
+
} else if (value === undefined) {
|
|
44
|
+
return 'undefined';
|
|
45
|
+
} else if (valueType === 'string' || valueType === 'number') {
|
|
46
|
+
return value;
|
|
47
|
+
} else if (valueType === 'symbol') {
|
|
48
|
+
return value.toString();
|
|
49
|
+
} // Calling toString of function returns whole function text with body.
|
|
50
|
+
// So, just return function with name.
|
|
51
|
+
else if (valueType === 'function') {
|
|
52
|
+
return "function:".concat(value.name);
|
|
53
|
+
} else if (valueType === 'object') {
|
|
54
|
+
return {
|
|
55
|
+
type: 'object',
|
|
56
|
+
keys: Object.keys(value)
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.serializeValue = serializeValue;
|
|
62
|
+
|
|
63
|
+
var getPropsDifference = function getPropsDifference(object1, object2) {
|
|
64
|
+
var curDepth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
65
|
+
var maxDepth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 2;
|
|
66
|
+
var keysToIgnore = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
67
|
+
|
|
68
|
+
var _getKeysAddedRemovedC = getKeysAddedRemovedCommon(object1, object2),
|
|
69
|
+
added = _getKeysAddedRemovedC.added,
|
|
70
|
+
common = _getKeysAddedRemovedC.common,
|
|
71
|
+
removed = _getKeysAddedRemovedC.removed;
|
|
72
|
+
|
|
73
|
+
var changed = [];
|
|
74
|
+
common.forEach(function (key) {
|
|
75
|
+
var value1 = object1[key];
|
|
76
|
+
var value2 = object2[key];
|
|
77
|
+
var value1Type = (0, _typeof2.default)(value1);
|
|
78
|
+
var value2Type = (0, _typeof2.default)(value2); // Do comparision only if values doesn't match (or reference to same object in memory).
|
|
79
|
+
// Or if key does not exist in keys to ignore.
|
|
80
|
+
|
|
81
|
+
if (value1 !== value2 && keysToIgnore.indexOf(key) === -1) {
|
|
82
|
+
// if both key value are objects and not referencing same object in memory.
|
|
83
|
+
// then get recursive difference.
|
|
84
|
+
if ( /*#__PURE__*/_react.default.isValidElement(value1) || /*#__PURE__*/_react.default.isValidElement(value2)) {
|
|
85
|
+
changed.push({
|
|
86
|
+
key: key,
|
|
87
|
+
reactElementChanged: true
|
|
88
|
+
});
|
|
89
|
+
} else if (value1Type === 'object' && value2Type === 'object') {
|
|
90
|
+
if (curDepth <= maxDepth) {
|
|
91
|
+
var difference = getPropsDifference(value1, value2, curDepth + 1, maxDepth);
|
|
92
|
+
changed.push({
|
|
93
|
+
key: key,
|
|
94
|
+
difference: difference
|
|
95
|
+
});
|
|
96
|
+
} else {
|
|
97
|
+
changed.push({
|
|
98
|
+
key: key,
|
|
99
|
+
maxDepthReached: true
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
changed.push({
|
|
104
|
+
key: key,
|
|
105
|
+
oldValue: serializeValue(value1),
|
|
106
|
+
newValue: serializeValue(value2)
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
added: added,
|
|
113
|
+
changed: changed,
|
|
114
|
+
removed: removed
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
exports.getPropsDifference = getPropsDifference;
|
|
119
|
+
|
|
120
|
+
var getShallowPropsDifference = function getShallowPropsDifference(object1, object2) {
|
|
121
|
+
var _getKeysAddedRemovedC2 = getKeysAddedRemovedCommon(object1, object2),
|
|
122
|
+
added = _getKeysAddedRemovedC2.added,
|
|
123
|
+
common = _getKeysAddedRemovedC2.common,
|
|
124
|
+
removed = _getKeysAddedRemovedC2.removed;
|
|
125
|
+
|
|
126
|
+
var changed = common.filter(function (key) {
|
|
127
|
+
return object1[key] !== object2[key];
|
|
128
|
+
});
|
|
129
|
+
return {
|
|
130
|
+
added: added,
|
|
131
|
+
changed: changed,
|
|
132
|
+
removed: removed
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
exports.getShallowPropsDifference = getShallowPropsDifference;
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -179,12 +179,24 @@ Object.defineProperty(exports, "getModeFromTheme", {
|
|
|
179
179
|
return _getModeFromTheme.getModeFromTheme;
|
|
180
180
|
}
|
|
181
181
|
});
|
|
182
|
+
Object.defineProperty(exports, "getPropsDifference", {
|
|
183
|
+
enumerable: true,
|
|
184
|
+
get: function get() {
|
|
185
|
+
return _compareProps.getPropsDifference;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
182
188
|
Object.defineProperty(exports, "getResponseEndTime", {
|
|
183
189
|
enumerable: true,
|
|
184
190
|
get: function get() {
|
|
185
191
|
return _navigation.getResponseEndTime;
|
|
186
192
|
}
|
|
187
193
|
});
|
|
194
|
+
Object.defineProperty(exports, "getShallowPropsDifference", {
|
|
195
|
+
enumerable: true,
|
|
196
|
+
get: function get() {
|
|
197
|
+
return _compareProps.getShallowPropsDifference;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
188
200
|
Object.defineProperty(exports, "getTTISeverity", {
|
|
189
201
|
enumerable: true,
|
|
190
202
|
get: function get() {
|
|
@@ -335,6 +347,12 @@ Object.defineProperty(exports, "todayTimestampInUTC", {
|
|
|
335
347
|
return _date.todayTimestampInUTC;
|
|
336
348
|
}
|
|
337
349
|
});
|
|
350
|
+
Object.defineProperty(exports, "useComponentRenderTracking", {
|
|
351
|
+
enumerable: true,
|
|
352
|
+
get: function get() {
|
|
353
|
+
return _useComponentRenderTracking.useComponentRenderTracking;
|
|
354
|
+
}
|
|
355
|
+
});
|
|
338
356
|
Object.defineProperty(exports, "validateADFEntity", {
|
|
339
357
|
enumerable: true,
|
|
340
358
|
get: function get() {
|
|
@@ -404,4 +422,8 @@ var _browserExtensions = require("./browser-extensions");
|
|
|
404
422
|
|
|
405
423
|
var _renderCount = require("./profiler/render-count");
|
|
406
424
|
|
|
407
|
-
var _validateUsingSpec = require("./validate-using-spec");
|
|
425
|
+
var _validateUsingSpec = require("./validate-using-spec");
|
|
426
|
+
|
|
427
|
+
var _compareProps = require("./compare-props");
|
|
428
|
+
|
|
429
|
+
var _useComponentRenderTracking = require("./performance/hooks/use-component-render-tracking");
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useComponentRenderTracking = useComponentRenderTracking;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _adfSchema = require("@atlaskit/adf-schema");
|
|
11
|
+
|
|
12
|
+
var _compareProps = require("../../../compare-props");
|
|
13
|
+
|
|
14
|
+
function useComponentRenderTracking(_ref) {
|
|
15
|
+
var onRender = _ref.onRender,
|
|
16
|
+
propsDiffingOptions = _ref.propsDiffingOptions,
|
|
17
|
+
_ref$zeroBasedCount = _ref.zeroBasedCount,
|
|
18
|
+
zeroBasedCount = _ref$zeroBasedCount === void 0 ? true : _ref$zeroBasedCount;
|
|
19
|
+
var propsRef = (0, _react.useRef)();
|
|
20
|
+
var renderCountRef = (0, _react.useRef)(zeroBasedCount ? 0 : 1);
|
|
21
|
+
|
|
22
|
+
var _useRef = (0, _react.useRef)(_adfSchema.uuid.generate()),
|
|
23
|
+
componentId = _useRef.current;
|
|
24
|
+
|
|
25
|
+
(0, _react.useEffect)(function () {
|
|
26
|
+
var lastProps = propsRef.current;
|
|
27
|
+
var renderCount = renderCountRef.current;
|
|
28
|
+
var propsDifference;
|
|
29
|
+
|
|
30
|
+
if (propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.enabled && lastProps) {
|
|
31
|
+
propsDifference = propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.useShallow ? (0, _compareProps.getShallowPropsDifference)(lastProps, propsDiffingOptions.props) : (0, _compareProps.getPropsDifference)(lastProps, propsDiffingOptions.props, 0, 2, propsDiffingOptions === null || propsDiffingOptions === void 0 ? void 0 : propsDiffingOptions.propsToIgnore);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var result = {
|
|
35
|
+
renderCount: renderCount,
|
|
36
|
+
propsDifference: propsDifference,
|
|
37
|
+
componentId: componentId
|
|
38
|
+
};
|
|
39
|
+
onRender(result);
|
|
40
|
+
|
|
41
|
+
if (propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.enabled) {
|
|
42
|
+
propsRef.current = propsDiffingOptions.props;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
renderCountRef.current = renderCountRef.current + 1;
|
|
46
|
+
}); // No dependencies run on each render
|
|
47
|
+
}
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import camelCase from 'lodash/camelCase';
|
|
2
2
|
import kebabCase from 'lodash/kebabCase';
|
|
3
3
|
const EMPTY = {};
|
|
4
|
+
|
|
5
|
+
function isObjectFlagKey(key, value, objectFlagKeys) {
|
|
6
|
+
return Boolean(typeof value === 'string' && (objectFlagKeys === null || objectFlagKeys === void 0 ? void 0 : objectFlagKeys.includes(key)));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function isValidJSONObject(value) {
|
|
10
|
+
try {
|
|
11
|
+
let result = JSON.parse(value);
|
|
12
|
+
|
|
13
|
+
if (typeof result === 'object' && result !== null) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return false;
|
|
18
|
+
} catch (err) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
4
22
|
/**
|
|
5
23
|
* Normalise and filter a free Record<string, unknown> to match
|
|
6
24
|
* the rules for feature flags in editor and renderer
|
|
@@ -11,18 +29,36 @@ const EMPTY = {};
|
|
|
11
29
|
*
|
|
12
30
|
* Output matches
|
|
13
31
|
* 1. cased in camelCase (match [a-zA-Z])
|
|
14
|
-
* 2. has boolean value
|
|
32
|
+
* 2. has boolean value or object {} value
|
|
15
33
|
*
|
|
16
34
|
* @param rawFeatureFlags
|
|
17
35
|
*/
|
|
18
36
|
|
|
19
|
-
|
|
37
|
+
|
|
38
|
+
export function normalizeFeatureFlags(rawFeatureFlags, options) {
|
|
20
39
|
if (!rawFeatureFlags) {
|
|
21
40
|
return EMPTY;
|
|
22
41
|
}
|
|
23
42
|
|
|
24
|
-
return Object.entries(rawFeatureFlags).filter(e =>
|
|
25
|
-
|
|
43
|
+
return Object.entries(rawFeatureFlags).filter(e => {
|
|
44
|
+
if (typeof e[1] === 'boolean') {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (isObjectFlagKey(camelCase(e[0]), e[1], options === null || options === void 0 ? void 0 : options.objectFlagKeys) && isValidJSONObject(e[1])) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return false;
|
|
53
|
+
}).filter(([key]) => kebabCase(key) === key).map(([key, value]) => [camelCase(key), value]).reduce((flags, [key, value]) => {
|
|
54
|
+
if (isObjectFlagKey(key, value, options === null || options === void 0 ? void 0 : options.objectFlagKeys)) {
|
|
55
|
+
flags[key] = JSON.parse(value);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (typeof value === 'boolean') {
|
|
59
|
+
flags[key] = value;
|
|
60
|
+
}
|
|
61
|
+
|
|
26
62
|
return flags;
|
|
27
63
|
}, {});
|
|
28
64
|
}
|
|
@@ -42,8 +42,10 @@ export const listsSharedStyles = css`
|
|
|
42
42
|
@see https://css-tricks.com/display-flow-root/
|
|
43
43
|
*/
|
|
44
44
|
// For older browsers the do not support flow-root.
|
|
45
|
+
/* stylelint-disable declaration-block-no-duplicate-properties */
|
|
45
46
|
display: table;
|
|
46
47
|
display: flow-root;
|
|
48
|
+
/* stylelint-enable declaration-block-no-duplicate-properties */
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
/* =============== INDENTATION AESTHETICS ========= */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css } from '
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
2
|
import { PanelType } from '@atlaskit/adf-schema';
|
|
3
3
|
import { akEditorTableCellMinWidth, blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { akEditorCustomIconSize } from '@atlaskit/editor-shared-styles/consts';
|
|
@@ -173,7 +173,7 @@ const mainDynamicStyles = panelType => props => {
|
|
|
173
173
|
`;
|
|
174
174
|
};
|
|
175
175
|
|
|
176
|
-
export const panelSharedStyles = css`
|
|
176
|
+
export const panelSharedStyles = props => css`
|
|
177
177
|
.${PanelSharedCssClassName.prefix} {
|
|
178
178
|
border-radius: ${borderRadius()}px;
|
|
179
179
|
margin: ${blockNodesVerticalMargin} 0 0;
|
|
@@ -184,7 +184,7 @@ export const panelSharedStyles = css`
|
|
|
184
184
|
align-items: baseline;
|
|
185
185
|
word-break: break-word;
|
|
186
186
|
|
|
187
|
-
${mainDynamicStyles(PanelType.INFO)}
|
|
187
|
+
${mainDynamicStyles(PanelType.INFO)(props)}
|
|
188
188
|
|
|
189
189
|
.${PanelSharedCssClassName.icon} {
|
|
190
190
|
flex-shrink: 0;
|
|
@@ -197,7 +197,7 @@ export const panelSharedStyles = css`
|
|
|
197
197
|
-moz-user-select: none;
|
|
198
198
|
-webkit-user-select: none;
|
|
199
199
|
-ms-user-select: none;
|
|
200
|
-
${iconDynamicStyles(PanelType.INFO)}
|
|
200
|
+
${iconDynamicStyles(PanelType.INFO)(props)}
|
|
201
201
|
|
|
202
202
|
> span {
|
|
203
203
|
vertical-align: middle;
|
|
@@ -231,49 +231,49 @@ export const panelSharedStyles = css`
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
&[data-panel-type='${PanelType.NOTE}'] {
|
|
234
|
-
${mainDynamicStyles(PanelType.NOTE)}
|
|
234
|
+
${mainDynamicStyles(PanelType.NOTE)(props)}
|
|
235
235
|
|
|
236
236
|
.${PanelSharedCssClassName.icon} {
|
|
237
|
-
${iconDynamicStyles(PanelType.NOTE)}
|
|
237
|
+
${iconDynamicStyles(PanelType.NOTE)(props)}
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
&[data-panel-type='${PanelType.TIP}'] {
|
|
242
|
-
${mainDynamicStyles(PanelType.TIP)}
|
|
242
|
+
${mainDynamicStyles(PanelType.TIP)(props)}
|
|
243
243
|
|
|
244
244
|
.${PanelSharedCssClassName.icon} {
|
|
245
|
-
${iconDynamicStyles(PanelType.TIP)}
|
|
245
|
+
${iconDynamicStyles(PanelType.TIP)(props)}
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
&[data-panel-type='${PanelType.WARNING}'] {
|
|
250
|
-
${mainDynamicStyles(PanelType.WARNING)}
|
|
250
|
+
${mainDynamicStyles(PanelType.WARNING)(props)}
|
|
251
251
|
|
|
252
252
|
.${PanelSharedCssClassName.icon} {
|
|
253
|
-
${iconDynamicStyles(PanelType.WARNING)}
|
|
253
|
+
${iconDynamicStyles(PanelType.WARNING)(props)}
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
&[data-panel-type='${PanelType.ERROR}'] {
|
|
258
|
-
${mainDynamicStyles(PanelType.ERROR)}
|
|
258
|
+
${mainDynamicStyles(PanelType.ERROR)(props)}
|
|
259
259
|
|
|
260
260
|
.${PanelSharedCssClassName.icon} {
|
|
261
|
-
${iconDynamicStyles(PanelType.ERROR)}
|
|
261
|
+
${iconDynamicStyles(PanelType.ERROR)(props)}
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
&[data-panel-type='${PanelType.SUCCESS}'] {
|
|
266
|
-
${mainDynamicStyles(PanelType.SUCCESS)}
|
|
266
|
+
${mainDynamicStyles(PanelType.SUCCESS)(props)}
|
|
267
267
|
|
|
268
268
|
.${PanelSharedCssClassName.icon} {
|
|
269
|
-
${iconDynamicStyles(PanelType.SUCCESS)}
|
|
269
|
+
${iconDynamicStyles(PanelType.SUCCESS)(props)}
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
&[data-panel-type='${PanelType.CUSTOM}'] {
|
|
274
274
|
${themed({
|
|
275
275
|
dark: getPanelBackgroundDarkModeColors
|
|
276
|
-
})};
|
|
276
|
+
})(props)};
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css } from '
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
2
|
import { akEditorLineHeight } from '@atlaskit/editor-shared-styles';
|
|
3
3
|
import { DN50, N30A } from '@atlaskit/theme/colors';
|
|
4
4
|
import { themed } from '@atlaskit/theme/components';
|
|
@@ -7,10 +7,10 @@ const divider = themed({
|
|
|
7
7
|
dark: DN50
|
|
8
8
|
}); // @see typography spreadsheet: https://docs.google.com/spreadsheets/d/1iYusRGCT4PoPfvxbJ8NrgjtfFgXLm5lpDWXzjua1W2E/edit#gid=93913128
|
|
9
9
|
|
|
10
|
-
export const ruleSharedStyles = css`
|
|
10
|
+
export const ruleSharedStyles = props => css`
|
|
11
11
|
& hr {
|
|
12
12
|
border: none;
|
|
13
|
-
background-color: ${divider};
|
|
13
|
+
background-color: ${divider(props)};
|
|
14
14
|
margin: ${akEditorLineHeight}em 0;
|
|
15
15
|
height: 2px;
|
|
16
16
|
border-radius: 1px;
|
|
@@ -44,12 +44,20 @@ const tableSharedStyle = props => css`
|
|
|
44
44
|
padding-left: ${akEditorTableNumberColumnWidth - 1}px;
|
|
45
45
|
clear: both;
|
|
46
46
|
}
|
|
47
|
+
.${TableSharedCssClassName.TABLE_NODE_WRAPPER} > table {
|
|
48
|
+
margin: ${tableMarginTop}px 0 0 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.${TableSharedCssClassName.TABLE_CONTAINER} > table,
|
|
52
|
+
.${TableSharedCssClassName.TABLE_STICKY_WRAPPER} > table {
|
|
53
|
+
margin: ${tableMarginTop}px ${tableMarginSides}px 0 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
47
56
|
/* avoid applying styles to nested tables (possible via extensions) */
|
|
48
57
|
.${TableSharedCssClassName.TABLE_CONTAINER} > table,
|
|
49
58
|
.${TableSharedCssClassName.TABLE_NODE_WRAPPER} > table,
|
|
50
59
|
.${TableSharedCssClassName.TABLE_STICKY_WRAPPER} > table {
|
|
51
60
|
border-collapse: collapse;
|
|
52
|
-
margin: ${tableMarginTop}px ${tableMarginSides}px 0 0;
|
|
53
61
|
border: ${tableCellBorderWidth}px solid
|
|
54
62
|
${themed({
|
|
55
63
|
light: akEditorTableBorder,
|