@atlaskit/renderer 132.7.0 → 133.1.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/cjs/analytics/enums.js +1 -0
  3. package/dist/cjs/react/index.js +3 -0
  4. package/dist/cjs/react/nodes/codeBlock/codeBlock.js +5 -1
  5. package/dist/cjs/react/nodes/codeBlock/components/codeBlockButtonContainer.js +7 -1
  6. package/dist/cjs/react/nodes/codeBlock/components/codeBlockContainer.js +4 -0
  7. package/dist/cjs/react/nodes/codeBlock/components/codeBlockDownloadButton.js +133 -0
  8. package/dist/cjs/react/nodes/codeBlock/windowedCodeBlock.js +4 -1
  9. package/dist/cjs/react/nodes/layoutColumn-compiled.js +3 -1
  10. package/dist/cjs/react/nodes/layoutColumn-emotion.js +3 -1
  11. package/dist/cjs/react/utils/use-select-all-trap.js +4 -4
  12. package/dist/cjs/steps/index.js +4 -4
  13. package/dist/cjs/ui/Renderer/ErrorBoundary.js +4 -4
  14. package/dist/cjs/ui/Renderer/index.js +4 -1
  15. package/dist/cjs/ui/annotations/element/mark.js +5 -3
  16. package/dist/es2019/analytics/enums.js +1 -0
  17. package/dist/es2019/react/index.js +3 -0
  18. package/dist/es2019/react/nodes/codeBlock/codeBlock.js +4 -1
  19. package/dist/es2019/react/nodes/codeBlock/components/codeBlockButtonContainer.js +7 -1
  20. package/dist/es2019/react/nodes/codeBlock/components/codeBlockContainer.js +4 -0
  21. package/dist/es2019/react/nodes/codeBlock/components/codeBlockDownloadButton.js +123 -0
  22. package/dist/es2019/react/nodes/codeBlock/windowedCodeBlock.js +4 -1
  23. package/dist/es2019/react/nodes/layoutColumn-compiled.js +3 -1
  24. package/dist/es2019/react/nodes/layoutColumn-emotion.js +3 -1
  25. package/dist/es2019/react/utils/use-select-all-trap.js +5 -4
  26. package/dist/es2019/steps/index.js +5 -4
  27. package/dist/es2019/ui/Renderer/ErrorBoundary.js +5 -4
  28. package/dist/es2019/ui/Renderer/index.js +4 -1
  29. package/dist/es2019/ui/annotations/element/mark.js +5 -3
  30. package/dist/esm/analytics/enums.js +1 -0
  31. package/dist/esm/react/index.js +3 -0
  32. package/dist/esm/react/nodes/codeBlock/codeBlock.js +5 -1
  33. package/dist/esm/react/nodes/codeBlock/components/codeBlockButtonContainer.js +7 -1
  34. package/dist/esm/react/nodes/codeBlock/components/codeBlockContainer.js +4 -0
  35. package/dist/esm/react/nodes/codeBlock/components/codeBlockDownloadButton.js +125 -0
  36. package/dist/esm/react/nodes/codeBlock/windowedCodeBlock.js +4 -1
  37. package/dist/esm/react/nodes/layoutColumn-compiled.js +3 -1
  38. package/dist/esm/react/nodes/layoutColumn-emotion.js +3 -1
  39. package/dist/esm/react/utils/use-select-all-trap.js +5 -4
  40. package/dist/esm/steps/index.js +5 -4
  41. package/dist/esm/ui/Renderer/ErrorBoundary.js +5 -4
  42. package/dist/esm/ui/Renderer/index.js +4 -1
  43. package/dist/esm/ui/annotations/element/mark.js +5 -3
  44. package/dist/types/analytics/enums.d.ts +1 -0
  45. package/dist/types/react/index.d.ts +2 -0
  46. package/dist/types/react/nodes/codeBlock/codeBlock.d.ts +1 -0
  47. package/dist/types/react/nodes/codeBlock/components/codeBlockButtonContainer.d.ts +3 -1
  48. package/dist/types/react/nodes/codeBlock/components/codeBlockContainer.d.ts +1 -1
  49. package/dist/types/react/nodes/codeBlock/components/codeBlockDownloadButton.d.ts +14 -0
  50. package/dist/types/react/nodes/codeBlock/windowedCodeBlock.d.ts +1 -1
  51. package/dist/types/react/types.d.ts +1 -0
  52. package/dist/types/ui/Renderer/index.d.ts +1 -0
  53. package/dist/types/ui/renderer-props.d.ts +1 -0
  54. package/package.json +56 -56
@@ -14,6 +14,10 @@ import { PLATFORM } from '../../analytics/events';
14
14
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
15
15
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
16
16
  import uuid from 'uuid';
17
+
18
+ // Ignored via go/ees005
19
+ // eslint-disable-next-line require-unicode-regexp
20
+ var FAILED_TO_EXECUTE_REGEX = /Failed to execute.*on 'Node'.*/;
17
21
  // Ignored via go/ees005
18
22
  // eslint-disable-next-line @repo/internal/react/no-class-components
19
23
  export var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
@@ -72,10 +76,7 @@ export var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
72
76
  logException(error, {
73
77
  location: 'renderer'
74
78
  });
75
- // Ignored via go/ees005
76
- // eslint-disable-next-line require-unicode-regexp
77
- var pattern = /Failed to execute.*on 'Node'.*/;
78
- var matchesPattern = pattern.test(error.message);
79
+ var matchesPattern = FAILED_TO_EXECUTE_REGEX.test(error.message);
79
80
  if (matchesPattern) {
80
81
  this.fireAnalyticsEvent({
81
82
  action: ACTION.CAUGHT_DOM_ERROR,
@@ -63,7 +63,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
63
63
  var TABLE_INFO_TIMEOUT = 10000;
64
64
  var RENDER_EVENT_SAMPLE_RATE = 0.2;
65
65
  var packageName = "@atlaskit/renderer";
66
- var packageVersion = "132.7.0";
66
+ var packageVersion = "133.0.0";
67
67
  var setAsQueryContainerStyles = css({
68
68
  containerName: 'ak-renderer-wrapper',
69
69
  containerType: 'inline-size'
@@ -254,6 +254,7 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
254
254
  extensionViewportSizes: props.extensionViewportSizes,
255
255
  getExtensionHeight: props.getExtensionHeight,
256
256
  allowCopyToClipboard: props.allowCopyToClipboard,
257
+ allowDownloadCodeBlock: props.allowDownloadCodeBlock,
257
258
  allowWrapCodeBlock: props.allowWrapCodeBlock,
258
259
  allowCustomPanels: props.allowCustomPanels,
259
260
  allowAnnotations: props.allowAnnotations,
@@ -473,6 +474,7 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
473
474
  allowNestedHeaderLinks: isNestedHeaderLinksEnabled(props.allowHeadingAnchorLinks),
474
475
  allowColumnSorting: props.allowColumnSorting,
475
476
  allowCopyToClipboard: props.allowCopyToClipboard,
477
+ allowDownloadCodeBlock: props.allowDownloadCodeBlock,
476
478
  allowWrapCodeBlock: props.allowWrapCodeBlock,
477
479
  allowCustomPanels: props.allowCustomPanels,
478
480
  allowPlaceholderText: props.allowPlaceholderText,
@@ -512,6 +514,7 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
512
514
  appearance: props.appearance,
513
515
  contentMode: props.contentMode || 'standard',
514
516
  allowCopyToClipboard: props.allowCopyToClipboard,
517
+ allowDownloadCodeBlock: props.allowDownloadCodeBlock,
515
518
  allowWrapCodeBlock: props.allowWrapCodeBlock,
516
519
  allowPlaceholderText: props.allowPlaceholderText,
517
520
  allowColumnSorting: props.allowColumnSorting,
@@ -84,10 +84,12 @@ var markStylesWithCommentsPanel = css(_defineProperty({}, "&[data-mark-annotatio
84
84
  boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #1E1F2126, 0px 0px 1px #1E1F214f)"
85
85
  }
86
86
  }));
87
+
88
+ // Ignored via go/ees005
89
+ // eslint-disable-next-line require-unicode-regexp
90
+ var MOBILE_USER_AGENT_REGEX = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;
87
91
  var isMobile = function isMobile() {
88
- // Ignored via go/ees005
89
- // eslint-disable-next-line require-unicode-regexp
90
- return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
92
+ return MOBILE_USER_AGENT_REGEX.test(navigator.userAgent);
91
93
  };
92
94
  var accessibilityStylesNew = css({
93
95
  '&::before, &::after': {
@@ -48,6 +48,7 @@ export declare enum ACTION_SUBJECT_ID {
48
48
  HOVER_LABEL = "hoverLabel",
49
49
  INLINE_COMMENT = "inlineComment",
50
50
  CODEBLOCK_COPY = "codeBlockCopy",
51
+ CODEBLOCK_DOWNLOAD = "codeBlockDownload",
51
52
  CODEBLOCK_WRAP = "codeBlockWrap"
52
53
  }
53
54
  export type AEP<Action, ActionSubject, ActionSubjectID, Attributes, EventType> = {
@@ -16,6 +16,7 @@ export interface ReactSerializerInit {
16
16
  allowColumnSorting?: boolean;
17
17
  allowCopyToClipboard?: boolean;
18
18
  allowCustomPanels?: boolean;
19
+ allowDownloadCodeBlock?: boolean;
19
20
  allowFixedColumnWidthOption?: boolean;
20
21
  allowHeadingAnchorLinks?: HeadingAnchorLinksProps;
21
22
  allowMediaLinking?: boolean;
@@ -85,6 +86,7 @@ export default class ReactSerializer implements Serializer<JSX.Element> {
85
86
  private allowHeadingAnchorLinks?;
86
87
  private allowColumnSorting?;
87
88
  private allowCopyToClipboard?;
89
+ private allowDownloadCodeBlock?;
88
90
  private allowWrapCodeBlock?;
89
91
  private allowPlaceholderText?;
90
92
  private allowCustomPanels?;
@@ -7,6 +7,7 @@ import type { WithIntlProps, WrappedComponentProps } from 'react-intl';
7
7
  import type { SupportedLanguages } from '@atlaskit/code';
8
8
  export interface Props {
9
9
  allowCopyToClipboard?: boolean;
10
+ allowDownloadCodeBlock?: boolean;
10
11
  allowWrapCodeBlock?: boolean;
11
12
  className?: string;
12
13
  codeBidiWarningTooltipEnabled: boolean;
@@ -6,10 +6,12 @@ import { jsx } from '@emotion/react';
6
6
  import type { Dispatch, SetStateAction } from 'react';
7
7
  export interface CodeBlockButtonContainerProps {
8
8
  allowCopyToClipboard?: boolean;
9
+ allowDownloadCodeBlock?: boolean;
9
10
  allowWrapCodeBlock?: boolean;
11
+ language?: string | null;
10
12
  setWrapLongLines: Dispatch<SetStateAction<boolean>>;
11
13
  text: string;
12
14
  wrapLongLines: boolean;
13
15
  }
14
- declare const CodeBlockButtonContainer: ({ allowCopyToClipboard, allowWrapCodeBlock, setWrapLongLines, text, wrapLongLines, }: CodeBlockButtonContainerProps) => jsx.JSX.Element;
16
+ declare const CodeBlockButtonContainer: ({ allowCopyToClipboard, allowDownloadCodeBlock, allowWrapCodeBlock, language, setWrapLongLines, text, wrapLongLines, }: CodeBlockButtonContainerProps) => jsx.JSX.Element;
15
17
  export default CodeBlockButtonContainer;
@@ -10,5 +10,5 @@ interface ContainerProps extends CodeBlockButtonContainerProps {
10
10
  className?: string;
11
11
  localId?: string;
12
12
  }
13
- declare const CodeBlockContainer: ({ allowCopyToClipboard, allowWrapCodeBlock, children, className, localId, setWrapLongLines, text, wrapLongLines, }: ContainerProps) => jsx.JSX.Element;
13
+ declare const CodeBlockContainer: ({ allowCopyToClipboard, allowDownloadCodeBlock, allowWrapCodeBlock, children, className, language, localId, setWrapLongLines, text, wrapLongLines, }: ContainerProps) => jsx.JSX.Element;
14
14
  export default CodeBlockContainer;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import type { ComponentType, FC } from 'react';
6
+ import type { WithIntlProps, WrappedComponentProps } from 'react-intl';
7
+ type Props = {
8
+ content: string;
9
+ language: string | null;
10
+ };
11
+ declare const _default_1: FC<WithIntlProps<Props & WrappedComponentProps>> & {
12
+ WrappedComponent: ComponentType<Props & WrappedComponentProps>;
13
+ };
14
+ export default _default_1;
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import type { Props as CodeBlockProps } from './codeBlock';
3
- declare const WindowedCodeBlock: ({ text, language, allowCopyToClipboard, allowWrapCodeBlock, codeBidiWarningTooltipEnabled, hideLineNumbers, className: rootClassName, wrap, }: CodeBlockProps) => jsx.JSX.Element;
3
+ declare const WindowedCodeBlock: ({ text, language, allowCopyToClipboard, allowDownloadCodeBlock, allowWrapCodeBlock, codeBidiWarningTooltipEnabled, hideLineNumbers, className: rootClassName, wrap, }: CodeBlockProps) => jsx.JSX.Element;
4
4
  export default WindowedCodeBlock;
@@ -18,6 +18,7 @@ export interface NodeMeta {
18
18
  [key: string]: any;
19
19
  allowCopyToClipboard?: boolean;
20
20
  allowCustomPanels?: boolean;
21
+ allowDownloadCodeBlock?: boolean;
21
22
  allowHeadingAnchorLinks?: HeadingAnchorLinksProps;
22
23
  allowPlaceholderText?: boolean;
23
24
  allowWrapCodeBlock?: boolean;
@@ -28,6 +28,7 @@ export type RendererWrapperProps = {
28
28
  allowColumnSorting?: boolean;
29
29
  allowCopyToClipboard?: boolean;
30
30
  allowCustomPanels?: boolean;
31
+ allowDownloadCodeBlock?: boolean;
31
32
  allowNestedHeaderLinks: boolean;
32
33
  allowPlaceholderText?: boolean;
33
34
  allowRendererContainerStyles?: boolean;
@@ -35,6 +35,7 @@ export interface RendererProps {
35
35
  allowColumnSorting?: boolean;
36
36
  allowCopyToClipboard?: boolean;
37
37
  allowCustomPanels?: boolean;
38
+ allowDownloadCodeBlock?: boolean;
38
39
  allowFixedColumnWidthOption?: boolean;
39
40
  allowHeadingAnchorLinks?: HeadingAnchorLinksProps;
40
41
  allowPlaceholderText?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "132.7.0",
3
+ "version": "133.1.0",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -30,46 +30,46 @@
30
30
  }
31
31
  },
32
32
  "dependencies": {
33
- "@atlaskit/adf-schema": "^54.0.0",
34
- "@atlaskit/adf-utils": "^19.33.0",
33
+ "@atlaskit/adf-schema": "^55.0.0",
34
+ "@atlaskit/adf-utils": "^20.0.0",
35
35
  "@atlaskit/afm-i18n-platform-editor-renderer": "2.10.0",
36
- "@atlaskit/analytics-listeners": "^10.1.0",
37
- "@atlaskit/analytics-namespaced-context": "^7.3.0",
38
- "@atlaskit/analytics-next": "^11.3.0",
39
- "@atlaskit/browser-apis": "^0.0.2",
40
- "@atlaskit/button": "^23.11.0",
41
- "@atlaskit/code": "^17.5.0",
42
- "@atlaskit/editor-json-transformer": "^8.33.0",
43
- "@atlaskit/editor-palette": "^2.2.0",
44
- "@atlaskit/editor-prosemirror": "^7.3.0",
45
- "@atlaskit/editor-shared-styles": "^3.11.0",
46
- "@atlaskit/editor-smart-link-draggable": "^0.5.0",
47
- "@atlaskit/emoji": "^70.17.0",
48
- "@atlaskit/feature-gate-js-client": "^5.8.0",
49
- "@atlaskit/icon": "^35.4.0",
50
- "@atlaskit/link": "^3.4.0",
51
- "@atlaskit/link-datasource": "^5.6.0",
52
- "@atlaskit/link-extractors": "^2.7.0",
53
- "@atlaskit/linking-common": "^9.13.0",
54
- "@atlaskit/media-card": "^80.8.0",
55
- "@atlaskit/media-client": "^36.4.0",
56
- "@atlaskit/media-client-react": "^5.2.0",
57
- "@atlaskit/media-common": "^13.3.0",
58
- "@atlaskit/media-filmstrip": "^51.3.0",
59
- "@atlaskit/media-ui": "^29.3.0",
60
- "@atlaskit/media-viewer": "^53.2.0",
61
- "@atlaskit/platform-feature-flags": "^1.1.0",
62
- "@atlaskit/platform-feature-flags-react": "^0.5.0",
63
- "@atlaskit/pragmatic-drag-and-drop": "^1.8.0",
64
- "@atlaskit/react-ufo": "^6.7.0",
65
- "@atlaskit/smart-card": "^44.29.0",
66
- "@atlaskit/status": "^4.1.0",
67
- "@atlaskit/task-decision": "^20.2.0",
68
- "@atlaskit/theme": "^25.0.0",
69
- "@atlaskit/tmp-editor-statsig": "^103.0.0",
70
- "@atlaskit/tokens": "^13.4.0",
71
- "@atlaskit/tooltip": "^22.6.0",
72
- "@atlaskit/visually-hidden": "^3.1.0",
36
+ "@atlaskit/analytics-listeners": "^11.0.0",
37
+ "@atlaskit/analytics-namespaced-context": "^8.0.0",
38
+ "@atlaskit/analytics-next": "^12.0.0",
39
+ "@atlaskit/browser-apis": "^1.0.0",
40
+ "@atlaskit/button": "^24.0.0",
41
+ "@atlaskit/code": "^18.0.0",
42
+ "@atlaskit/editor-json-transformer": "^9.0.0",
43
+ "@atlaskit/editor-palette": "^3.0.0",
44
+ "@atlaskit/editor-prosemirror": "^8.0.0",
45
+ "@atlaskit/editor-shared-styles": "^4.0.0",
46
+ "@atlaskit/editor-smart-link-draggable": "^1.0.0",
47
+ "@atlaskit/emoji": "^71.0.0",
48
+ "@atlaskit/feature-gate-js-client": "^6.0.0",
49
+ "@atlaskit/icon": "^36.0.0",
50
+ "@atlaskit/link": "^4.0.0",
51
+ "@atlaskit/link-datasource": "^6.0.0",
52
+ "@atlaskit/link-extractors": "^3.0.0",
53
+ "@atlaskit/linking-common": "^10.0.0",
54
+ "@atlaskit/media-card": "^81.0.0",
55
+ "@atlaskit/media-client": "^37.0.0",
56
+ "@atlaskit/media-client-react": "^6.0.0",
57
+ "@atlaskit/media-common": "^14.0.0",
58
+ "@atlaskit/media-filmstrip": "^52.0.0",
59
+ "@atlaskit/media-ui": "^30.0.0",
60
+ "@atlaskit/media-viewer": "^54.0.0",
61
+ "@atlaskit/platform-feature-flags": "^2.0.0",
62
+ "@atlaskit/platform-feature-flags-react": "^1.0.0",
63
+ "@atlaskit/pragmatic-drag-and-drop": "^2.0.0",
64
+ "@atlaskit/react-ufo": "^7.0.0",
65
+ "@atlaskit/smart-card": "^45.0.0",
66
+ "@atlaskit/status": "^5.0.0",
67
+ "@atlaskit/task-decision": "^21.0.0",
68
+ "@atlaskit/theme": "^26.0.0",
69
+ "@atlaskit/tmp-editor-statsig": "^105.0.0",
70
+ "@atlaskit/tokens": "^14.0.0",
71
+ "@atlaskit/tooltip": "^23.0.0",
72
+ "@atlaskit/visually-hidden": "^4.0.0",
73
73
  "@babel/runtime": "^7.0.0",
74
74
  "@compiled/react": "^0.20.0",
75
75
  "@emotion/react": "^11.7.1",
@@ -80,9 +80,9 @@
80
80
  "uuid": "^3.1.0"
81
81
  },
82
82
  "peerDependencies": {
83
- "@atlaskit/editor-common": "^115.16.0",
84
- "@atlaskit/link-provider": "^4.7.0",
85
- "@atlaskit/media-core": "^37.1.0",
83
+ "@atlaskit/editor-common": "^116.1.0",
84
+ "@atlaskit/link-provider": "^5.0.0",
85
+ "@atlaskit/media-core": "^38.0.0",
86
86
  "react": "^18.2.0",
87
87
  "react-dom": "^18.2.0",
88
88
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -90,20 +90,20 @@
90
90
  "devDependencies": {
91
91
  "@af/integration-testing": "workspace:^",
92
92
  "@af/visual-regression": "workspace:^",
93
- "@atlaskit/analytics-gas-types": "^5.1.0",
94
- "@atlaskit/checkbox": "^17.3.0",
95
- "@atlaskit/editor-card-provider": "^6.8.0",
96
- "@atlaskit/link-provider": "^4.7.0",
97
- "@atlaskit/link-test-helpers": "^10.4.0",
98
- "@atlaskit/media-core": "^37.1.0",
93
+ "@atlaskit/analytics-gas-types": "^6.0.0",
94
+ "@atlaskit/checkbox": "^18.0.0",
95
+ "@atlaskit/editor-card-provider": "^7.0.0",
96
+ "@atlaskit/link-provider": "^5.0.0",
97
+ "@atlaskit/link-test-helpers": "^11.0.0",
98
+ "@atlaskit/media-core": "^38.0.0",
99
99
  "@atlaskit/media-integration-test-helpers": "workspace:^",
100
- "@atlaskit/media-test-helpers": "^41.2.0",
101
- "@atlaskit/mention": "^26.3.0",
102
- "@atlaskit/modal-dialog": "^15.3.0",
103
- "@atlaskit/navigation-system": "^9.4.0",
104
- "@atlaskit/profilecard": "^25.9.0",
105
- "@atlaskit/side-nav-items": "^1.14.0",
106
- "@atlaskit/util-data-test": "^18.6.0",
100
+ "@atlaskit/media-test-helpers": "^42.0.0",
101
+ "@atlaskit/mention": "^27.0.0",
102
+ "@atlaskit/modal-dialog": "^16.0.0",
103
+ "@atlaskit/navigation-system": "^10.0.0",
104
+ "@atlaskit/profilecard": "^26.0.0",
105
+ "@atlaskit/side-nav-items": "^2.0.0",
106
+ "@atlaskit/util-data-test": "^19.0.0",
107
107
  "@atlassian/a11y-jest-testing": "^0.12.0",
108
108
  "@atlassian/a11y-playwright-testing": "^0.10.0",
109
109
  "@atlassian/feature-flags-test-utils": "^1.1.0",