@atlaskit/editor-common 65.0.0 → 66.0.2
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 +70 -0
- package/build/tsconfig.json +1 -2
- package/dist/cjs/i18n/en.js +27 -0
- package/dist/cjs/i18n/en_GB.js +27 -0
- package/dist/cjs/normalize-feature-flags.js +40 -4
- package/dist/cjs/panel.js +55 -0
- package/dist/cjs/styles/index.js +0 -44
- 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 +15 -6
- package/dist/cjs/styles/shared/rule.js +5 -2
- package/dist/cjs/styles/shared/table.js +1 -1
- package/dist/cjs/ui/BaseTheme/index.js +1 -5
- 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 +7 -5
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/i18n/en.js +19 -0
- package/dist/es2019/i18n/en_GB.js +19 -0
- package/dist/es2019/normalize-feature-flags.js +40 -4
- package/dist/es2019/panel.js +1 -0
- package/dist/es2019/styles/index.js +0 -1
- 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 +79 -76
- package/dist/es2019/styles/shared/rule.js +3 -3
- package/dist/es2019/styles/shared/table.js +9 -1
- package/dist/es2019/ui/BaseTheme/index.js +1 -4
- 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 +3 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/i18n/en.js +19 -0
- package/dist/esm/i18n/en_GB.js +19 -0
- package/dist/esm/normalize-feature-flags.js +39 -4
- package/dist/esm/panel.js +1 -0
- package/dist/esm/styles/index.js +0 -1
- 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 +10 -5
- package/dist/esm/styles/shared/rule.js +4 -2
- package/dist/esm/styles/shared/table.js +1 -1
- package/dist/esm/ui/BaseTheme/index.js +1 -4
- 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 +3 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/extensions/types/field-definitions.d.ts +1 -1
- package/dist/types/i18n/en.d.ts +19 -0
- package/dist/types/i18n/en_GB.d.ts +19 -0
- package/dist/types/normalize-feature-flags.d.ts +6 -3
- package/dist/types/panel.d.ts +1 -0
- package/dist/types/provider-factory/media-provider.d.ts +2 -2
- package/dist/types/provider-factory/types.d.ts +1 -1
- package/dist/types/styles/index.d.ts +0 -1
- package/dist/types/styles/shared/link.d.ts +1 -1
- package/dist/types/styles/shared/panel.d.ts +2 -1
- package/dist/types/styles/shared/rule.d.ts +2 -1
- package/dist/types/ui/EventHandlers/index.d.ts +2 -2
- 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 +18 -19
- package/panel/package.json +7 -0
- 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
|
@@ -7,13 +7,19 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.sharedExpandStyles = exports.messages = exports.
|
|
10
|
+
exports.sharedExpandStyles = exports.messages = exports.expandLayoutWrapperStyle = exports.ExpandLayoutWrapperWithRef = exports.ExpandIconWrapper = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
15
|
|
|
12
16
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
17
|
|
|
14
|
-
var
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
19
|
|
|
16
|
-
var
|
|
20
|
+
var _react2 = require("@emotion/react");
|
|
21
|
+
|
|
22
|
+
var _reactIntlNext = require("react-intl-next");
|
|
17
23
|
|
|
18
24
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
19
25
|
|
|
@@ -23,6 +29,8 @@ var _components = require("@atlaskit/theme/components");
|
|
|
23
29
|
|
|
24
30
|
var _constants = require("@atlaskit/theme/constants");
|
|
25
31
|
|
|
32
|
+
var _excluded = ["children"];
|
|
33
|
+
|
|
26
34
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
27
35
|
|
|
28
36
|
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); }
|
|
@@ -65,53 +73,83 @@ var EXPAND_EXPANDED_BORDER_COLOR = (0, _components.themed)({
|
|
|
65
73
|
dark: colors.DN50
|
|
66
74
|
});
|
|
67
75
|
|
|
68
|
-
var ExpandIconWrapper =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
76
|
+
var ExpandIconWrapper = function ExpandIconWrapper(_ref) {
|
|
77
|
+
var children = _ref.children,
|
|
78
|
+
expanded = _ref.expanded;
|
|
79
|
+
return (0, _react2.jsx)("div", {
|
|
80
|
+
css: function css(props) {
|
|
81
|
+
return expanded ? [expandIconWrapperStyle(props), expandIconWrapperExpandedStyle] : expandIconWrapperStyle(props);
|
|
82
|
+
}
|
|
83
|
+
}, children);
|
|
84
|
+
};
|
|
74
85
|
|
|
75
86
|
exports.ExpandIconWrapper = ExpandIconWrapper;
|
|
76
87
|
|
|
77
|
-
var
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}), EXPAND_SELECTED_BACKGROUND);
|
|
96
|
-
var ContentStyles = (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n"])), function (_ref3) {
|
|
97
|
-
var expanded = _ref3.expanded;
|
|
98
|
-
return (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n padding-top: ", "px;\n padding-right: ", "px;\n padding-left: ", "px;\n display: table;\n display: flow-root;\n\n // The follow rules inside @supports block are added as a part of ED-8893\n // The fix is targeting mobile bridge on iOS 12 or below,\n // We should consider remove this fix when we no longer support iOS 12\n @supports not (display: flow-root) {\n width: 100%;\n box-sizing: border-box;\n }\n\n ", "\n "])), expanded ? (0, _constants.gridSize)() : 0, (0, _constants.gridSize)(), (0, _constants.gridSize)() * 4 - (0, _constants.gridSize)() / 2, !expanded ? "\n .expand-content-wrapper, .nestedExpand-content-wrapper {\n /* We visually hide the content here to preserve the content during copy+paste */\n width: 100%;\n display: block;\n height: 0;\n overflow: hidden;\n clip: rect(1px, 1px, 1px, 1px);\n white-space: nowrap;\n user-select: none;\n }\n " : '');
|
|
88
|
+
var expandIconWrapperStyle = function expandIconWrapperStyle(props) {
|
|
89
|
+
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n cursor: pointer;\n display: flex;\n color: ", ";\n border-radius: ", "px;\n width: 24px;\n height: 24px;\n\n &:hover {\n background: ", ";\n }\n\n svg {\n transition: transform 0.2s ", ";\n }\n"])), (0, _components.themed)({
|
|
90
|
+
light: colors.N90,
|
|
91
|
+
dark: '#d9dde3'
|
|
92
|
+
})(props), (0, _constants.gridSize)() / 2, colors.N30A, _editorSharedStyles.akEditorSwoopCubicBezier);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
var expandIconWrapperExpandedStyle = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n svg {\n transform: rotate(90deg);\n }\n"])));
|
|
96
|
+
var expandLayoutWrapperStyle = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n width: ", "px;\n height: ", "px;\n"])), (0, _constants.gridSize)() * 3, (0, _constants.gridSize)() * 3);
|
|
97
|
+
exports.expandLayoutWrapperStyle = expandLayoutWrapperStyle;
|
|
98
|
+
var ExpandLayoutWrapperWithRef = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
99
|
+
var children = props.children,
|
|
100
|
+
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
101
|
+
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
102
|
+
css: expandLayoutWrapperStyle
|
|
103
|
+
}, rest, {
|
|
104
|
+
ref: ref
|
|
105
|
+
}), children);
|
|
99
106
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
exports.ExpandLayoutWrapperWithRef = ExpandLayoutWrapperWithRef;
|
|
108
|
+
|
|
109
|
+
var containerStyles = function containerStyles(styleProps) {
|
|
110
|
+
var expanded = styleProps.expanded,
|
|
111
|
+
focused = styleProps.focused;
|
|
112
|
+
var marginTop = "".concat((0, _constants.gridSize)() / 2 / (0, _constants.fontSize)(), "rem");
|
|
113
|
+
var marginBottom = 0; // Only only these margins if the expand isn't editable
|
|
114
|
+
// and is the root level expand.
|
|
115
|
+
|
|
116
|
+
var marginHorizontal = styleProps['data-node-type'] === 'expand' ? "-".concat(_editorSharedStyles.akLayoutGutterOffset, "px") : 0;
|
|
117
|
+
var margin = "".concat(marginTop, " ").concat(marginHorizontal, " ").concat(marginBottom);
|
|
118
|
+
return function (themeProps) {
|
|
119
|
+
return (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n border-radius: ", "px;\n min-height: 25px;\n background: ", ";\n margin: ", ";\n\n transition: background 0.3s ", ",\n border-color 0.3s ", ";\n padding: ", "px;\n\n &:hover {\n border: 1px solid\n ", ";\n background: ", ";\n }\n\n td > &:first-child {\n margin-top: 0;\n }\n "])), focused ? EXPAND_FOCUSED_BORDER_COLOR : expanded ? EXPAND_EXPANDED_BORDER_COLOR(themeProps) : EXPAND_COLLAPSED_BORDER_COLOR, BORDER_RADIUS, !expanded ? EXPAND_COLLAPSED_BACKGROUND : EXPAND_SELECTED_BACKGROUND(themeProps), margin, _editorSharedStyles.akEditorSwoopCubicBezier, _editorSharedStyles.akEditorSwoopCubicBezier, (0, _constants.gridSize)(), (0, _components.themed)({
|
|
120
|
+
light: colors.N50A,
|
|
121
|
+
dark: colors.DN50
|
|
122
|
+
})(themeProps), EXPAND_SELECTED_BACKGROUND(themeProps));
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
var contentStyles = function contentStyles(styleProps) {
|
|
127
|
+
return function (themeProps) {
|
|
128
|
+
return (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n padding-top: ", "px;\n padding-right: ", "px;\n padding-left: ", "px;\n display: flow-root;\n\n // The follow rules inside @supports block are added as a part of ED-8893\n // The fix is targeting mobile bridge on iOS 12 or below,\n // We should consider remove this fix when we no longer support iOS 12\n @supports not (display: flow-root) {\n width: 100%;\n box-sizing: border-box;\n }\n\n ", "\n"])), styleProps.expanded ? (0, _constants.gridSize)() : 0, (0, _constants.gridSize)(), (0, _constants.gridSize)() * 4 - (0, _constants.gridSize)() / 2, !styleProps.expanded ? "\n .expand-content-wrapper, .nestedExpand-content-wrapper {\n /* We visually hide the content here to preserve the content during copy+paste */\n width: 100%;\n display: block;\n height: 0;\n overflow: hidden;\n clip: rect(1px, 1px, 1px, 1px);\n white-space: nowrap;\n user-select: none;\n }\n " : '');
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
var titleInputStyles = function titleInputStyles(props) {
|
|
133
|
+
return (0, _react2.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n outline: none;\n border: none;\n font-size: ", ";\n line-height: ", ";\n font-weight: normal;\n color: ", ";\n background: transparent;\n display: flex;\n flex: 1;\n padding: 0 0 0 ", "px;\n width: 100%;\n\n &::placeholder {\n opacity: 0.6;\n color: ", ";\n }\n"])), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), _editorSharedStyles.akEditorLineHeight, (0, _components.themed)({
|
|
134
|
+
light: colors.N200A,
|
|
135
|
+
dark: colors.DN600
|
|
136
|
+
})(props), (0, _constants.gridSize)() / 2, (0, _components.themed)({
|
|
137
|
+
light: colors.N200A,
|
|
138
|
+
dark: colors.DN600
|
|
139
|
+
})(props));
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
var titleContainerStyles = function titleContainerStyles(props) {
|
|
143
|
+
return (0, _react2.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n padding: 0;\n display: flex;\n align-items: flex-start;\n background: none;\n border: none;\n font-size: ", ";\n width: 100%;\n color: ", ";\n overflow: hidden;\n cursor: pointer;\n // Prevent browser selection being inside the title container\n user-select: none;\n\n &:focus {\n outline: 0;\n }\n"])), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), (0, _components.themed)({
|
|
144
|
+
light: colors.N300A,
|
|
145
|
+
dark: colors.DN600
|
|
146
|
+
})(props));
|
|
147
|
+
};
|
|
148
|
+
|
|
111
149
|
var sharedExpandStyles = {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
150
|
+
titleInputStyles: titleInputStyles,
|
|
151
|
+
titleContainerStyles: titleContainerStyles,
|
|
152
|
+
containerStyles: containerStyles,
|
|
153
|
+
contentStyles: contentStyles
|
|
116
154
|
};
|
|
117
155
|
exports.sharedExpandStyles = sharedExpandStyles;
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.REACT_INTL_ERROR_MESSAGE = exports.
|
|
8
|
+
exports.REACT_INTL_ERROR_MESSAGE = exports.IntlErrorBoundary = void 0;
|
|
9
9
|
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
|
|
@@ -38,15 +38,15 @@ var isMissingIntlProviderInAncestryError = function isMissingIntlProviderInAnces
|
|
|
38
38
|
return err === null || err === void 0 ? void 0 : (_err$toString = err.toString()) === null || _err$toString === void 0 ? void 0 : _err$toString.includes('<IntlProvider> needs to exist in the component ancestry');
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
var
|
|
42
|
-
(0, _inherits2.default)(
|
|
41
|
+
var IntlErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
42
|
+
(0, _inherits2.default)(IntlErrorBoundary, _React$Component);
|
|
43
43
|
|
|
44
|
-
var _super = _createSuper(
|
|
44
|
+
var _super = _createSuper(IntlErrorBoundary);
|
|
45
45
|
|
|
46
|
-
function
|
|
46
|
+
function IntlErrorBoundary() {
|
|
47
47
|
var _this;
|
|
48
48
|
|
|
49
|
-
(0, _classCallCheck2.default)(this,
|
|
49
|
+
(0, _classCallCheck2.default)(this, IntlErrorBoundary);
|
|
50
50
|
|
|
51
51
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
52
52
|
args[_key] = arguments[_key];
|
|
@@ -59,7 +59,7 @@ var IntlNextErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
|
59
59
|
return _this;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
(0, _createClass2.default)(
|
|
62
|
+
(0, _createClass2.default)(IntlErrorBoundary, [{
|
|
63
63
|
key: "componentDidCatch",
|
|
64
64
|
value: function componentDidCatch(error, errorInfo) {
|
|
65
65
|
// if missing IntlProvider in ancestry, we setup a fallback IntlProvider ourselves
|
|
@@ -84,7 +84,7 @@ var IntlNextErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
|
84
84
|
return this.props.children;
|
|
85
85
|
}
|
|
86
86
|
}]);
|
|
87
|
-
return
|
|
87
|
+
return IntlErrorBoundary;
|
|
88
88
|
}(_react.default.Component);
|
|
89
89
|
|
|
90
|
-
exports.
|
|
90
|
+
exports.IntlErrorBoundary = IntlErrorBoundary;
|
|
@@ -13,6 +13,8 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
13
13
|
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
|
|
16
|
+
var _react2 = require("@emotion/react");
|
|
17
|
+
|
|
16
18
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
19
|
|
|
18
20
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
@@ -21,6 +23,7 @@ var _grid = require("./grid");
|
|
|
21
23
|
|
|
22
24
|
var _styled = require("./styled");
|
|
23
25
|
|
|
26
|
+
/** @jsx jsx */
|
|
24
27
|
var DEFAULT_IMAGE_WIDTH = 250;
|
|
25
28
|
exports.DEFAULT_IMAGE_WIDTH = DEFAULT_IMAGE_WIDTH;
|
|
26
29
|
var DEFAULT_IMAGE_HEIGHT = 200;
|
|
@@ -106,13 +109,15 @@ function MediaSingle(_ref) {
|
|
|
106
109
|
media = _children[0],
|
|
107
110
|
caption = _children[1];
|
|
108
111
|
|
|
109
|
-
return
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
return (0, _react2.jsx)("div", {
|
|
113
|
+
ref: handleMediaSingleRef,
|
|
114
|
+
css: (0, _styled.MediaSingleDimensionHelper)({
|
|
115
|
+
width: width,
|
|
116
|
+
layout: layout,
|
|
117
|
+
containerWidth: containerWidth,
|
|
118
|
+
pctWidth: pctWidth,
|
|
119
|
+
fullWidthMode: fullWidthMode
|
|
120
|
+
}),
|
|
116
121
|
"data-layout": layout,
|
|
117
122
|
"data-width": pctWidth,
|
|
118
123
|
"data-node-type": nodeType,
|
|
@@ -120,7 +125,7 @@ function MediaSingle(_ref) {
|
|
|
120
125
|
'is-loading': isLoading,
|
|
121
126
|
'rich-media-wrapped': layout === 'wrap-left' || layout === 'wrap-right'
|
|
122
127
|
})
|
|
123
|
-
},
|
|
128
|
+
}, (0, _react2.jsx)(_styled.MediaWrapper, {
|
|
124
129
|
hasFallbackContainer: hasFallbackContainer,
|
|
125
130
|
height: mediaWrapperHeight,
|
|
126
131
|
paddingBottom: paddingBottom
|
|
@@ -2,28 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
exports.MediaWrapper = exports.
|
|
8
|
+
exports.MediaWrapper = exports.MediaSingleDimensionHelper = void 0;
|
|
11
9
|
exports.calcLegacyWidth = calcLegacyWidth;
|
|
12
10
|
exports.calcResizedWidth = calcResizedWidth;
|
|
11
|
+
exports.mediaWrapperStyle = void 0;
|
|
12
|
+
|
|
13
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
14
|
|
|
14
15
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
16
|
|
|
16
|
-
var
|
|
17
|
+
var _react = _interopRequireDefault(require("react"));
|
|
18
|
+
|
|
19
|
+
var _react2 = require("@emotion/react");
|
|
17
20
|
|
|
18
21
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
19
22
|
|
|
20
23
|
var _breakout = require("../../utils/breakout");
|
|
21
24
|
|
|
22
|
-
var
|
|
25
|
+
var _excluded = ["children"];
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
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; }
|
|
27
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
27
28
|
|
|
28
29
|
function float(layout) {
|
|
29
30
|
switch (layout) {
|
|
@@ -150,7 +151,7 @@ var MediaSingleDimensionHelper = function MediaSingleDimensionHelper(_ref) {
|
|
|
150
151
|
layout = _ref.layout,
|
|
151
152
|
pctWidth = _ref.pctWidth,
|
|
152
153
|
width = _ref.width;
|
|
153
|
-
return (0,
|
|
154
|
+
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /* For nested rich media items, set max-width to 100% */\n tr &,\n [data-layout-column] &,\n [data-node-type='expand'] & {\n max-width: 100%;\n }\n\n width: ", ";\n max-width: ", ";\n float: ", ";\n margin: ", ";\n ", ";\n\n &:not(.is-resizing) {\n transition: width 100ms ease-in;\n }\n"])), pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized), calcMaxWidth(layout, containerWidth), float(layout), calcMargin(layout), isImageAligned(layout));
|
|
154
155
|
};
|
|
155
156
|
|
|
156
157
|
exports.MediaSingleDimensionHelper = MediaSingleDimensionHelper;
|
|
@@ -159,20 +160,22 @@ var RenderFallbackContainer = function RenderFallbackContainer(_ref2) {
|
|
|
159
160
|
var hasFallbackContainer = _ref2.hasFallbackContainer,
|
|
160
161
|
paddingBottom = _ref2.paddingBottom,
|
|
161
162
|
height = _ref2.height;
|
|
162
|
-
return (0,
|
|
163
|
+
return (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n"])), hasFallbackContainer ? "\n &::after {\n content: '';\n display: block;\n ".concat(height ? "height: ".concat(height, "px;") : paddingBottom ? "padding-bottom: ".concat(paddingBottom, ";") : '', "\n\n /* Fixes extra padding problem in Firefox */\n font-size: 0;\n line-height: 0;\n }\n ") : '');
|
|
163
164
|
};
|
|
164
165
|
|
|
165
|
-
var
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}, function (_ref4) {
|
|
169
|
-
var hasFallbackContainer = _ref4.hasFallbackContainer;
|
|
170
|
-
return hasFallbackContainer ? 'absolute' : 'relative';
|
|
171
|
-
});
|
|
166
|
+
var mediaWrapperStyle = function mediaWrapperStyle(props) {
|
|
167
|
+
return (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n\n ", "\n\n /* Editor */\n & > figure {\n position: ", ";\n height: 100%;\n width: 100%;\n }\n\n & > div {\n position: ", ";\n height: 100%;\n width: 100%;\n }\n\n &[data-node-type='embedCard'] > div {\n width: 100%;\n }\n\n /* Renderer */\n [data-node-type='media'] {\n position: static !important;\n\n > div {\n position: absolute;\n height: 100%;\n }\n }\n"])), RenderFallbackContainer(props), props.hasFallbackContainer ? 'absolute' : 'relative', props.hasFallbackContainer ? 'absolute' : 'relative');
|
|
168
|
+
};
|
|
172
169
|
|
|
173
|
-
exports.
|
|
170
|
+
exports.mediaWrapperStyle = mediaWrapperStyle;
|
|
174
171
|
|
|
175
|
-
var
|
|
172
|
+
var MediaWrapper = function MediaWrapper(_ref3) {
|
|
173
|
+
var children = _ref3.children,
|
|
174
|
+
rest = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
|
|
175
|
+
return (0, _react2.jsx)("div", {
|
|
176
|
+
css: mediaWrapperStyle(rest)
|
|
177
|
+
}, children);
|
|
178
|
+
};
|
|
176
179
|
|
|
177
|
-
exports.
|
|
180
|
+
exports.MediaWrapper = MediaWrapper;
|
|
178
181
|
MediaWrapper.displayName = 'WrapperMediaSingle';
|
|
@@ -51,6 +51,8 @@ var Popup = /*#__PURE__*/function (_React$Component) {
|
|
|
51
51
|
var _super = _createSuper(Popup);
|
|
52
52
|
|
|
53
53
|
function Popup() {
|
|
54
|
+
var _window;
|
|
55
|
+
|
|
54
56
|
var _this;
|
|
55
57
|
|
|
56
58
|
(0, _classCallCheck2.default)(this, Popup);
|
|
@@ -77,6 +79,9 @@ var Popup = /*#__PURE__*/function (_React$Component) {
|
|
|
77
79
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onResize", function () {
|
|
78
80
|
return _this.scheduledUpdatePosition(_this.props);
|
|
79
81
|
});
|
|
82
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resizeObserver", (_window = window) !== null && _window !== void 0 && _window.ResizeObserver ? new ResizeObserver(function () {
|
|
83
|
+
_this.scheduledUpdatePosition(_this.props);
|
|
84
|
+
}) : undefined);
|
|
80
85
|
return _this;
|
|
81
86
|
}
|
|
82
87
|
|
|
@@ -202,9 +207,14 @@ var Popup = /*#__PURE__*/function (_React$Component) {
|
|
|
202
207
|
value: function componentDidMount() {
|
|
203
208
|
window.addEventListener('resize', this.onResize);
|
|
204
209
|
var stick = this.props.stick;
|
|
210
|
+
this.scrollParentElement = (0, _utils.findOverflowScrollParent)(this.props.target);
|
|
211
|
+
|
|
212
|
+
if (this.scrollParentElement && this.resizeObserver) {
|
|
213
|
+
this.resizeObserver.observe(this.scrollParentElement);
|
|
214
|
+
}
|
|
205
215
|
|
|
206
216
|
if (stick) {
|
|
207
|
-
this.scrollElement =
|
|
217
|
+
this.scrollElement = this.scrollParentElement;
|
|
208
218
|
} else {
|
|
209
219
|
this.scrollElement = this.props.scrollableElement;
|
|
210
220
|
}
|
|
@@ -222,6 +232,10 @@ var Popup = /*#__PURE__*/function (_React$Component) {
|
|
|
222
232
|
this.scrollElement.removeEventListener('scroll', this.onResize);
|
|
223
233
|
}
|
|
224
234
|
|
|
235
|
+
if (this.scrollParentElement && this.resizeObserver) {
|
|
236
|
+
this.resizeObserver.unobserve(this.scrollParentElement);
|
|
237
|
+
}
|
|
238
|
+
|
|
225
239
|
this.scheduledUpdatePosition.cancel();
|
|
226
240
|
}
|
|
227
241
|
}, {
|
|
@@ -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;
|