@atlaskit/renderer 107.2.0 → 107.3.1
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 +19 -0
- package/dist/cjs/analytics/enums.js +61 -1
- package/dist/cjs/react/index.js +10 -1
- package/dist/cjs/react/nodes/codeBlock/codeBlock.js +18 -6
- package/dist/cjs/react/nodes/codeBlock/components/codeBlockButtonContainer.js +67 -0
- package/dist/cjs/react/nodes/codeBlock/components/codeBlockContainer.js +15 -8
- package/dist/cjs/react/nodes/codeBlock/components/codeBlockCopyButton.js +71 -0
- package/dist/cjs/react/nodes/codeBlock/components/codeBlockWrapButton.js +76 -0
- package/dist/cjs/react/nodes/codeBlock/windowedCodeBlock.js +13 -2
- package/dist/cjs/react/nodes/media.js +18 -1
- package/dist/cjs/react/nodes/mediaInline.js +19 -4
- package/dist/cjs/ui/Renderer/index.js +14 -4
- package/dist/cjs/ui/Renderer/style.js +10 -4
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/enums.js +55 -1
- package/dist/es2019/react/index.js +7 -1
- package/dist/es2019/react/nodes/codeBlock/codeBlock.js +10 -3
- package/dist/es2019/react/nodes/codeBlock/components/codeBlockButtonContainer.js +59 -0
- package/dist/es2019/react/nodes/codeBlock/components/codeBlockContainer.js +25 -8
- package/dist/es2019/react/nodes/codeBlock/components/codeBlockCopyButton.js +52 -0
- package/dist/es2019/react/nodes/codeBlock/components/codeBlockWrapButton.js +67 -0
- package/dist/es2019/react/nodes/codeBlock/windowedCodeBlock.js +9 -4
- package/dist/es2019/react/nodes/media.js +18 -1
- package/dist/es2019/react/nodes/mediaInline.js +19 -4
- package/dist/es2019/ui/Renderer/index.js +14 -4
- package/dist/es2019/ui/Renderer/style.js +34 -15
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/enums.js +55 -1
- package/dist/esm/react/index.js +10 -1
- package/dist/esm/react/nodes/codeBlock/codeBlock.js +15 -3
- package/dist/esm/react/nodes/codeBlock/components/codeBlockButtonContainer.js +58 -0
- package/dist/esm/react/nodes/codeBlock/components/codeBlockContainer.js +15 -9
- package/dist/esm/react/nodes/codeBlock/components/codeBlockCopyButton.js +59 -0
- package/dist/esm/react/nodes/codeBlock/components/codeBlockWrapButton.js +67 -0
- package/dist/esm/react/nodes/codeBlock/windowedCodeBlock.js +14 -4
- package/dist/esm/react/nodes/media.js +18 -1
- package/dist/esm/react/nodes/mediaInline.js +19 -4
- package/dist/esm/ui/Renderer/index.js +14 -4
- package/dist/esm/ui/Renderer/style.js +10 -4
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/enums.d.ts +51 -0
- package/dist/types/analytics/events.d.ts +5 -1
- package/dist/types/react/index.d.ts +2 -0
- package/dist/types/react/nodes/codeBlock/codeBlock.d.ts +1 -0
- package/dist/types/react/nodes/codeBlock/components/codeBlockButtonContainer.d.ts +12 -0
- package/dist/types/react/nodes/codeBlock/components/codeBlockContainer.d.ts +5 -7
- package/dist/types/react/nodes/codeBlock/components/codeBlockWrapButton.d.ts +11 -0
- package/dist/types/react/nodes/codeBlock/windowedCodeBlock.d.ts +1 -1
- package/dist/types/react/nodes/media.d.ts +3 -2
- package/dist/types/react/nodes/mediaInline.d.ts +6 -0
- package/dist/types/react/types.d.ts +1 -0
- package/dist/types/ui/Renderer/style.d.ts +1 -0
- package/dist/types/ui/renderer-props.d.ts +1 -0
- package/package.json +11 -11
- package/report.api.md +19 -2
- package/dist/cjs/react/nodes/codeBlockCopyButton.js +0 -64
- package/dist/es2019/react/nodes/codeBlockCopyButton.js +0 -86
- package/dist/esm/react/nodes/codeBlockCopyButton.js +0 -54
- /package/dist/types/react/nodes/{codeBlockCopyButton.d.ts → codeBlock/components/codeBlockCopyButton.d.ts} +0 -0
package/report.api.md
CHANGED
|
@@ -69,6 +69,8 @@ type AnalyticsEventPayload<T = void> =
|
|
|
69
69
|
| AnchorLinkAEP
|
|
70
70
|
| AnnotationAEP
|
|
71
71
|
| AnnotationDeleteAEP
|
|
72
|
+
| CodeBlockCopyAEP
|
|
73
|
+
| CodeBlockWrapAEP
|
|
72
74
|
| ComponentCrashErrorAEP
|
|
73
75
|
| ExpandAEP
|
|
74
76
|
| HeadingAnchorLinkButtonAEP
|
|
@@ -152,6 +154,17 @@ type ButtonAEP<ActionSubjectID, Attributes> = UIAEP<
|
|
|
152
154
|
Attributes
|
|
153
155
|
>;
|
|
154
156
|
|
|
157
|
+
// @public (undocumented)
|
|
158
|
+
type CodeBlockCopyAEP = ButtonAEP<ACTION_SUBJECT_ID.CODEBLOCK_COPY, undefined>;
|
|
159
|
+
|
|
160
|
+
// @public (undocumented)
|
|
161
|
+
type CodeBlockWrapAEP = ButtonAEP<
|
|
162
|
+
ACTION_SUBJECT_ID.CODEBLOCK_WRAP,
|
|
163
|
+
{
|
|
164
|
+
wrapped: boolean;
|
|
165
|
+
}
|
|
166
|
+
>;
|
|
167
|
+
|
|
155
168
|
// @public (undocumented)
|
|
156
169
|
type ComponentCrashErrorAEP = OperationalAEP<
|
|
157
170
|
ACTION.CRASHED,
|
|
@@ -325,6 +338,8 @@ interface ReactSerializerInit {
|
|
|
325
338
|
// (undocumented)
|
|
326
339
|
allowWindowedCodeBlock?: boolean;
|
|
327
340
|
// (undocumented)
|
|
341
|
+
allowWrapCodeBlock?: boolean;
|
|
342
|
+
// (undocumented)
|
|
328
343
|
appearance?: RendererAppearance;
|
|
329
344
|
// (undocumented)
|
|
330
345
|
disableActions?: boolean;
|
|
@@ -416,6 +431,8 @@ export interface RendererProps {
|
|
|
416
431
|
// (undocumented)
|
|
417
432
|
allowUgcScrubber?: boolean;
|
|
418
433
|
// (undocumented)
|
|
434
|
+
allowWrapCodeBlock?: boolean;
|
|
435
|
+
// (undocumented)
|
|
419
436
|
analyticsEventSeverityTracking?: {
|
|
420
437
|
enabled: boolean;
|
|
421
438
|
severityNormalThreshold: number;
|
|
@@ -742,8 +759,8 @@ type VisitMediaLinkAEP = AEP<
|
|
|
742
759
|
|
|
743
760
|
```json
|
|
744
761
|
{
|
|
745
|
-
"@atlaskit/link-provider": "^1.5.
|
|
746
|
-
"@atlaskit/media-core": "^34.0.
|
|
762
|
+
"@atlaskit/link-provider": "^1.5.1",
|
|
763
|
+
"@atlaskit/media-core": "^34.0.2",
|
|
747
764
|
"react": "^16.8.0",
|
|
748
765
|
"react-dom": "^16.8.0"
|
|
749
766
|
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
-
var _react = require("@emotion/react");
|
|
12
|
-
var _react2 = _interopRequireWildcard(require("react"));
|
|
13
|
-
var _reactIntlNext = require("react-intl-next");
|
|
14
|
-
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
15
|
-
var _button = _interopRequireDefault(require("@atlaskit/button"));
|
|
16
|
-
var _copy = _interopRequireDefault(require("@atlaskit/icon/glyph/copy"));
|
|
17
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
18
|
-
var _clipboard = require("../utils/clipboard");
|
|
19
|
-
var _messages = require("@atlaskit/editor-common/messages");
|
|
20
|
-
var _templateObject;
|
|
21
|
-
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); }
|
|
22
|
-
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; }
|
|
23
|
-
var copyButtonWrapperStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n position: sticky;\n justify-content: flex-end;\n top: 0;\n\n button {\n position: absolute;\n display: flex;\n justify-content: center;\n height: 32px;\n width: 32px;\n right: 6px;\n top: 4px;\n padding: 2px;\n opacity: 0;\n transition: opacity 0.2s ease 0s;\n border: 2px solid ", ";\n border-radius: 4px;\n background-color: ", ";\n color: ", " !important;\n }\n\n button:hover {\n border: 2px solid ", ";\n background-color: ", ";\n }\n\n button:active {\n border: 2px solid ", ";\n background-color: ", ";\n }\n\n button.clicked {\n background-color: ", ";\n color: ", " !important;\n }\n button.clicked:hover {\n background-color: ", ";\n }\n"])), "var(--ds-border, #fff)", "var(--ds-surface-overlay, ".concat(_colors.N20, ")"), "var(--ds-text, rgb(66, 82, 110))", "var(--ds-border, transparent)", "var(--ds-surface-overlay-hovered, ".concat(_colors.N30, ")"), "var(--ds-border, transparent)", "var(--ds-surface-overlay-pressed, ".concat(_colors.N30, ")"), "var(--ds-surface-overlay, ".concat(_colors.N700, ")"), "var(--ds-text, #fff)", "var(--ds-surface-overlay-hovered, ".concat(_colors.N700, ")"));
|
|
24
|
-
var CopyButton = function CopyButton(_ref) {
|
|
25
|
-
var content = _ref.content,
|
|
26
|
-
intl = _ref.intl;
|
|
27
|
-
var _useState = (0, _react2.useState)(intl.formatMessage(_messages.codeBlockCopyButtonMessages.copyCodeToClipboard)),
|
|
28
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
29
|
-
tooltip = _useState2[0],
|
|
30
|
-
setTooltip = _useState2[1];
|
|
31
|
-
var _useState3 = (0, _react2.useState)('copy-to-clipboard'),
|
|
32
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
33
|
-
className = _useState4[0],
|
|
34
|
-
setClassName = _useState4[1];
|
|
35
|
-
var onMouseLeave = function onMouseLeave() {
|
|
36
|
-
setTooltip(intl.formatMessage(_messages.codeBlockCopyButtonMessages.copyCodeToClipboard));
|
|
37
|
-
setClassName('copy-to-clipboard');
|
|
38
|
-
};
|
|
39
|
-
return (0, _react.jsx)("span", {
|
|
40
|
-
css: copyButtonWrapperStyles
|
|
41
|
-
}, (0, _react.jsx)(_tooltip.default, {
|
|
42
|
-
content: tooltip,
|
|
43
|
-
hideTooltipOnClick: false,
|
|
44
|
-
position: "top"
|
|
45
|
-
}, (0, _react.jsx)("div", {
|
|
46
|
-
onMouseLeave: onMouseLeave
|
|
47
|
-
}, (0, _react.jsx)(_button.default, {
|
|
48
|
-
className: className,
|
|
49
|
-
"aria-label": tooltip,
|
|
50
|
-
spacing: "compact",
|
|
51
|
-
appearance: "subtle",
|
|
52
|
-
"aria-haspopup": true,
|
|
53
|
-
iconBefore: (0, _react.jsx)(_copy.default, {
|
|
54
|
-
label: tooltip
|
|
55
|
-
}),
|
|
56
|
-
onClick: function onClick() {
|
|
57
|
-
(0, _clipboard.copyTextToClipboard)(content);
|
|
58
|
-
setTooltip(intl.formatMessage(_messages.codeBlockCopyButtonMessages.copiedCodeToClipboard));
|
|
59
|
-
setClassName('copy-to-clipboard clicked');
|
|
60
|
-
}
|
|
61
|
-
}))));
|
|
62
|
-
};
|
|
63
|
-
var _default = (0, _reactIntlNext.injectIntl)(CopyButton);
|
|
64
|
-
exports.default = _default;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { css, jsx } from '@emotion/react';
|
|
3
|
-
import React, { useState } from 'react';
|
|
4
|
-
import { injectIntl } from 'react-intl-next';
|
|
5
|
-
import Tooltip from '@atlaskit/tooltip';
|
|
6
|
-
import Button from '@atlaskit/button';
|
|
7
|
-
import CopyIcon from '@atlaskit/icon/glyph/copy';
|
|
8
|
-
import { N20, N30, N700 } from '@atlaskit/theme/colors';
|
|
9
|
-
import { copyTextToClipboard } from '../utils/clipboard';
|
|
10
|
-
import { codeBlockCopyButtonMessages } from '@atlaskit/editor-common/messages';
|
|
11
|
-
const copyButtonWrapperStyles = css`
|
|
12
|
-
display: flex;
|
|
13
|
-
position: sticky;
|
|
14
|
-
justify-content: flex-end;
|
|
15
|
-
top: 0;
|
|
16
|
-
|
|
17
|
-
button {
|
|
18
|
-
position: absolute;
|
|
19
|
-
display: flex;
|
|
20
|
-
justify-content: center;
|
|
21
|
-
height: 32px;
|
|
22
|
-
width: 32px;
|
|
23
|
-
right: 6px;
|
|
24
|
-
top: 4px;
|
|
25
|
-
padding: 2px;
|
|
26
|
-
opacity: 0;
|
|
27
|
-
transition: opacity 0.2s ease 0s;
|
|
28
|
-
border: 2px solid ${"var(--ds-border, #fff)"};
|
|
29
|
-
border-radius: 4px;
|
|
30
|
-
background-color: ${`var(--ds-surface-overlay, ${N20})`};
|
|
31
|
-
color: ${"var(--ds-text, rgb(66, 82, 110))"} !important;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
button:hover {
|
|
35
|
-
border: 2px solid ${"var(--ds-border, transparent)"};
|
|
36
|
-
background-color: ${`var(--ds-surface-overlay-hovered, ${N30})`};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
button:active {
|
|
40
|
-
border: 2px solid ${"var(--ds-border, transparent)"};
|
|
41
|
-
background-color: ${`var(--ds-surface-overlay-pressed, ${N30})`};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
button.clicked {
|
|
45
|
-
background-color: ${`var(--ds-surface-overlay, ${N700})`};
|
|
46
|
-
color: ${"var(--ds-text, #fff)"} !important;
|
|
47
|
-
}
|
|
48
|
-
button.clicked:hover {
|
|
49
|
-
background-color: ${`var(--ds-surface-overlay-hovered, ${N700})`};
|
|
50
|
-
}
|
|
51
|
-
`;
|
|
52
|
-
const CopyButton = ({
|
|
53
|
-
content,
|
|
54
|
-
intl
|
|
55
|
-
}) => {
|
|
56
|
-
const [tooltip, setTooltip] = useState(intl.formatMessage(codeBlockCopyButtonMessages.copyCodeToClipboard));
|
|
57
|
-
const [className, setClassName] = useState('copy-to-clipboard');
|
|
58
|
-
const onMouseLeave = () => {
|
|
59
|
-
setTooltip(intl.formatMessage(codeBlockCopyButtonMessages.copyCodeToClipboard));
|
|
60
|
-
setClassName('copy-to-clipboard');
|
|
61
|
-
};
|
|
62
|
-
return jsx("span", {
|
|
63
|
-
css: copyButtonWrapperStyles
|
|
64
|
-
}, jsx(Tooltip, {
|
|
65
|
-
content: tooltip,
|
|
66
|
-
hideTooltipOnClick: false,
|
|
67
|
-
position: "top"
|
|
68
|
-
}, jsx("div", {
|
|
69
|
-
onMouseLeave: onMouseLeave
|
|
70
|
-
}, jsx(Button, {
|
|
71
|
-
className: className,
|
|
72
|
-
"aria-label": tooltip,
|
|
73
|
-
spacing: "compact",
|
|
74
|
-
appearance: "subtle",
|
|
75
|
-
"aria-haspopup": true,
|
|
76
|
-
iconBefore: jsx(CopyIcon, {
|
|
77
|
-
label: tooltip
|
|
78
|
-
}),
|
|
79
|
-
onClick: () => {
|
|
80
|
-
copyTextToClipboard(content);
|
|
81
|
-
setTooltip(intl.formatMessage(codeBlockCopyButtonMessages.copiedCodeToClipboard));
|
|
82
|
-
setClassName('copy-to-clipboard clicked');
|
|
83
|
-
}
|
|
84
|
-
}))));
|
|
85
|
-
};
|
|
86
|
-
export default injectIntl(CopyButton);
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
3
|
-
var _templateObject;
|
|
4
|
-
/** @jsx jsx */
|
|
5
|
-
import { css, jsx } from '@emotion/react';
|
|
6
|
-
import React, { useState } from 'react';
|
|
7
|
-
import { injectIntl } from 'react-intl-next';
|
|
8
|
-
import Tooltip from '@atlaskit/tooltip';
|
|
9
|
-
import Button from '@atlaskit/button';
|
|
10
|
-
import CopyIcon from '@atlaskit/icon/glyph/copy';
|
|
11
|
-
import { N20, N30, N700 } from '@atlaskit/theme/colors';
|
|
12
|
-
import { copyTextToClipboard } from '../utils/clipboard';
|
|
13
|
-
import { codeBlockCopyButtonMessages } from '@atlaskit/editor-common/messages';
|
|
14
|
-
var copyButtonWrapperStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n position: sticky;\n justify-content: flex-end;\n top: 0;\n\n button {\n position: absolute;\n display: flex;\n justify-content: center;\n height: 32px;\n width: 32px;\n right: 6px;\n top: 4px;\n padding: 2px;\n opacity: 0;\n transition: opacity 0.2s ease 0s;\n border: 2px solid ", ";\n border-radius: 4px;\n background-color: ", ";\n color: ", " !important;\n }\n\n button:hover {\n border: 2px solid ", ";\n background-color: ", ";\n }\n\n button:active {\n border: 2px solid ", ";\n background-color: ", ";\n }\n\n button.clicked {\n background-color: ", ";\n color: ", " !important;\n }\n button.clicked:hover {\n background-color: ", ";\n }\n"])), "var(--ds-border, #fff)", "var(--ds-surface-overlay, ".concat(N20, ")"), "var(--ds-text, rgb(66, 82, 110))", "var(--ds-border, transparent)", "var(--ds-surface-overlay-hovered, ".concat(N30, ")"), "var(--ds-border, transparent)", "var(--ds-surface-overlay-pressed, ".concat(N30, ")"), "var(--ds-surface-overlay, ".concat(N700, ")"), "var(--ds-text, #fff)", "var(--ds-surface-overlay-hovered, ".concat(N700, ")"));
|
|
15
|
-
var CopyButton = function CopyButton(_ref) {
|
|
16
|
-
var content = _ref.content,
|
|
17
|
-
intl = _ref.intl;
|
|
18
|
-
var _useState = useState(intl.formatMessage(codeBlockCopyButtonMessages.copyCodeToClipboard)),
|
|
19
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
-
tooltip = _useState2[0],
|
|
21
|
-
setTooltip = _useState2[1];
|
|
22
|
-
var _useState3 = useState('copy-to-clipboard'),
|
|
23
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
24
|
-
className = _useState4[0],
|
|
25
|
-
setClassName = _useState4[1];
|
|
26
|
-
var onMouseLeave = function onMouseLeave() {
|
|
27
|
-
setTooltip(intl.formatMessage(codeBlockCopyButtonMessages.copyCodeToClipboard));
|
|
28
|
-
setClassName('copy-to-clipboard');
|
|
29
|
-
};
|
|
30
|
-
return jsx("span", {
|
|
31
|
-
css: copyButtonWrapperStyles
|
|
32
|
-
}, jsx(Tooltip, {
|
|
33
|
-
content: tooltip,
|
|
34
|
-
hideTooltipOnClick: false,
|
|
35
|
-
position: "top"
|
|
36
|
-
}, jsx("div", {
|
|
37
|
-
onMouseLeave: onMouseLeave
|
|
38
|
-
}, jsx(Button, {
|
|
39
|
-
className: className,
|
|
40
|
-
"aria-label": tooltip,
|
|
41
|
-
spacing: "compact",
|
|
42
|
-
appearance: "subtle",
|
|
43
|
-
"aria-haspopup": true,
|
|
44
|
-
iconBefore: jsx(CopyIcon, {
|
|
45
|
-
label: tooltip
|
|
46
|
-
}),
|
|
47
|
-
onClick: function onClick() {
|
|
48
|
-
copyTextToClipboard(content);
|
|
49
|
-
setTooltip(intl.formatMessage(codeBlockCopyButtonMessages.copiedCodeToClipboard));
|
|
50
|
-
setClassName('copy-to-clipboard clicked');
|
|
51
|
-
}
|
|
52
|
-
}))));
|
|
53
|
-
};
|
|
54
|
-
export default injectIntl(CopyButton);
|
|
File without changes
|