@atlaskit/editor-plugin-show-diff
Version:
ShowDiff plugin for @atlaskit/editor-core
46 lines (45 loc) • 2.84 kB
JavaScript
/* IndicatorBar.tsx generated by @compiled/babel-plugin v3.0.2 */
;
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.IndicatorBar = IndicatorBar;
require("./IndicatorBar.compiled.css");
var React = _interopRequireWildcard(require("react"));
var _runtime = require("@compiled/react/runtime");
var _fg = require("@atlaskit/platform-feature-flags/fg");
var _factory = require("../../pm-plugins/decorations/colorSchemes/factory");
var _schemes = require("../../pm-plugins/decorations/colorSchemes/schemes");
var _decorationKeys = require("../../pm-plugins/decorations/decorationKeys");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
var barStyles = null;
var barAlwaysVisibleStyles = null;
var getIndicatorColor = function getIndicatorColor(colorScheme, isInserted) {
if (colorScheme === undefined || colorScheme === 'standard' || colorScheme === 'traditional' || isInserted === undefined) {
return "var(--ds-border-information, #357DE8)";
}
return (0, _factory.getAccentBorderColor)(_schemes.colorSchemeRegistry[colorScheme][isInserted ? 'insertColor' : 'deleteColor']);
};
function IndicatorBar(_ref) {
var anchorTop = _ref.anchorTop,
anchorBottom = _ref.anchorBottom,
anchorLeft = _ref.anchorLeft,
anchorLeftFallback = _ref.anchorLeftFallback,
colorScheme = _ref.colorScheme,
isInserted = _ref.isInserted;
var leftAnchors = [anchorLeft, anchorLeftFallback, _decorationKeys.AnchorDocMarginKey].filter(Boolean).map(function (anchor) {
return "anchor(--".concat(anchor, " left)");
}).join(', ');
return /*#__PURE__*/React.createElement("span", {
"data-testid": "diff-indicator-bar",
style: {
backgroundColor: getIndicatorColor(colorScheme, isInserted),
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
left: "min(".concat(leftAnchors, ")"),
top: "anchor(--".concat(anchorTop, " top)"),
bottom: "anchor(--".concat(anchorBottom, " bottom)")
},
className: (0, _runtime.ax)(["_2rko1rr0 _kqswstnw _1bsb1l7b _lcxvglyw _18u0mgjw _17c61i8t _19pk196n _otyr196n", (0, _fg.fg)('platform_editor_ai_show_diff_patch_2') && "_17c6oga4"])
});
}