@atlaskit/media-viewer 54.11.21 → 54.11.23
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 +31 -0
- package/dist/cjs/DownloadButton.js +14 -5
- package/dist/cjs/DownloadItem.js +3 -1
- package/dist/cjs/ErrorViewDownloadButton.js +3 -0
- package/dist/cjs/ItemViewerBase.js +8 -7
- package/dist/cjs/ToolbarDownloadButton.js +5 -2
- package/dist/cjs/analytics/ufoExperiences.js +1 -1
- package/dist/cjs/errorMessage.compiled.css +1 -0
- package/dist/cjs/errorMessage.js +11 -7
- package/dist/cjs/errorMessageWithAnalytics.js +2 -1
- package/dist/cjs/header.js +2 -1
- package/dist/cjs/insetViewerContext.js +15 -15
- package/dist/cjs/loading.js +7 -2
- package/dist/cjs/navigation.js +7 -5
- package/dist/cjs/styleWrappers.compiled.css +5 -1
- package/dist/cjs/styleWrappers.js +53 -18
- package/dist/cjs/viewers/archiveSidebar/archive-viewer-base.js +3 -3
- package/dist/cjs/viewers/audio.js +68 -27
- package/dist/cjs/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.compiled.css +6 -1
- package/dist/cjs/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.js +37 -9
- package/dist/cjs/viewers/codeViewer/CodeRendererAdvanced/theme.js +68 -53
- package/dist/cjs/viewers/codeViewer/CodeViewRenderer-2.js +15 -1
- package/dist/cjs/viewers/codeViewer/CodeViewerFooter.compiled.css +10 -0
- package/dist/cjs/viewers/codeViewer/CodeViewerFooter.js +41 -0
- package/dist/cjs/viewers/codeViewer/CodeViewerHeaderBar.js +6 -0
- package/dist/cjs/viewers/codeViewer/codeViewerRenderer-compiled.compiled.css +3 -1
- package/dist/cjs/viewers/codeViewer/codeViewerRenderer-compiled.js +8 -1
- package/dist/cjs/viewers/doc/DocViewer.js +7 -2
- package/dist/cjs/viewers/doc/passwordInput.compiled.css +3 -1
- package/dist/cjs/viewers/doc/passwordInput.js +27 -13
- package/dist/cjs/viewers/video.js +6 -6
- package/dist/es2019/DownloadButton.js +12 -4
- package/dist/es2019/DownloadItem.js +3 -1
- package/dist/es2019/ErrorViewDownloadButton.js +3 -0
- package/dist/es2019/ItemViewerBase.js +3 -2
- package/dist/es2019/ToolbarDownloadButton.js +4 -1
- package/dist/es2019/analytics/ufoExperiences.js +1 -1
- package/dist/es2019/errorMessage.compiled.css +1 -0
- package/dist/es2019/errorMessage.js +9 -5
- package/dist/es2019/errorMessageWithAnalytics.js +2 -1
- package/dist/es2019/header.js +2 -1
- package/dist/es2019/insetViewerContext.js +11 -11
- package/dist/es2019/loading.js +7 -2
- package/dist/es2019/navigation.js +3 -1
- package/dist/es2019/styleWrappers.compiled.css +4 -0
- package/dist/es2019/styleWrappers.js +62 -27
- package/dist/es2019/viewers/archiveSidebar/archive-viewer-base.js +3 -3
- package/dist/es2019/viewers/audio.js +52 -17
- package/dist/es2019/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.compiled.css +6 -1
- package/dist/es2019/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.js +29 -9
- package/dist/es2019/viewers/codeViewer/CodeRendererAdvanced/theme.js +21 -5
- package/dist/es2019/viewers/codeViewer/CodeViewRenderer-2.js +15 -1
- package/dist/es2019/viewers/codeViewer/CodeViewerFooter.compiled.css +10 -0
- package/dist/es2019/viewers/codeViewer/CodeViewerFooter.js +33 -0
- package/dist/es2019/viewers/codeViewer/CodeViewerHeaderBar.js +6 -0
- package/dist/es2019/viewers/codeViewer/codeViewerRenderer-compiled.compiled.css +3 -1
- package/dist/es2019/viewers/codeViewer/codeViewerRenderer-compiled.js +5 -1
- package/dist/es2019/viewers/doc/DocViewer.js +7 -2
- package/dist/es2019/viewers/doc/passwordInput.compiled.css +3 -1
- package/dist/es2019/viewers/doc/passwordInput.js +19 -5
- package/dist/es2019/viewers/video.js +7 -7
- package/dist/esm/DownloadButton.js +14 -5
- package/dist/esm/DownloadItem.js +3 -1
- package/dist/esm/ErrorViewDownloadButton.js +3 -0
- package/dist/esm/ItemViewerBase.js +3 -2
- package/dist/esm/ToolbarDownloadButton.js +4 -1
- package/dist/esm/analytics/ufoExperiences.js +1 -1
- package/dist/esm/errorMessage.compiled.css +1 -0
- package/dist/esm/errorMessage.js +11 -7
- package/dist/esm/errorMessageWithAnalytics.js +2 -1
- package/dist/esm/header.js +2 -1
- package/dist/esm/insetViewerContext.js +14 -14
- package/dist/esm/loading.js +7 -2
- package/dist/esm/navigation.js +3 -1
- package/dist/esm/styleWrappers.compiled.css +5 -1
- package/dist/esm/styleWrappers.js +51 -16
- package/dist/esm/viewers/archiveSidebar/archive-viewer-base.js +3 -3
- package/dist/esm/viewers/audio.js +69 -28
- package/dist/esm/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.compiled.css +6 -1
- package/dist/esm/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.js +38 -11
- package/dist/esm/viewers/codeViewer/CodeRendererAdvanced/theme.js +67 -52
- package/dist/esm/viewers/codeViewer/CodeViewRenderer-2.js +15 -1
- package/dist/esm/viewers/codeViewer/CodeViewerFooter.compiled.css +10 -0
- package/dist/esm/viewers/codeViewer/CodeViewerFooter.js +32 -0
- package/dist/esm/viewers/codeViewer/CodeViewerHeaderBar.js +6 -0
- package/dist/esm/viewers/codeViewer/codeViewerRenderer-compiled.compiled.css +3 -1
- package/dist/esm/viewers/codeViewer/codeViewerRenderer-compiled.js +8 -1
- package/dist/esm/viewers/doc/DocViewer.js +7 -2
- package/dist/esm/viewers/doc/passwordInput.compiled.css +3 -1
- package/dist/esm/viewers/doc/passwordInput.js +19 -5
- package/dist/esm/viewers/video.js +7 -7
- package/dist/types/DownloadButton.d.ts +1 -1
- package/dist/types/DownloadButtonProps.d.ts +1 -0
- package/dist/types/DownloadItem.d.ts +1 -1
- package/dist/types/DownloadItemProps.d.ts +1 -0
- package/dist/types/errorMessage.d.ts +6 -1
- package/dist/types/insetViewerContext.d.ts +3 -3
- package/dist/types/styleWrappers.d.ts +2 -2
- package/dist/types/viewers/audio.d.ts +2 -16
- package/dist/types/viewers/codeViewer/CodeRendererAdvanced/theme.d.ts +1 -0
- package/dist/types/viewers/codeViewer/CodeViewerFooter.d.ts +7 -0
- package/dist/types/viewers/codeViewer/CodeViewerHeaderBar.d.ts +1 -1
- package/example-helpers/NativeMediaPreview.tsx +3 -1
- package/package.json +8 -8
|
@@ -10,10 +10,12 @@
|
|
|
10
10
|
._yyhycs5v{grid-column:2}
|
|
11
11
|
._yyhykb7n{grid-column:1}._11pt15ty svg{filter:drop-shadow(0 1px 1px rgb(9 30 66/25%)) drop-shadow(0 0 1px rgb(9 30 66/31%))}
|
|
12
12
|
._152tidpf{inset-block-start:0}
|
|
13
|
+
._154i1dlc{top:var(--_7soeen)}
|
|
13
14
|
._154i1ejb{top:var(--ds-space-300,24px)}
|
|
14
15
|
._154i1ssb{top:50%}
|
|
15
16
|
._154i1wug{top:auto}
|
|
16
17
|
._154iidpf{top:0}
|
|
18
|
+
._154iyct9{top:var(--_3tx9jb)}
|
|
17
19
|
._16jlidpf{flex-grow:0}
|
|
18
20
|
._16jlkb7n{flex-grow:1}
|
|
19
21
|
._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
|
|
@@ -40,6 +42,7 @@
|
|
|
40
42
|
._1bsb1osq{width:100%}
|
|
41
43
|
._1bsb1tcg{width:24px}
|
|
42
44
|
._1bsbauwl{width:100vw}
|
|
45
|
+
._1bsbs947{width:var(--_llywoj)}
|
|
43
46
|
._1bsbyazj{width:calc(100% - 26pc)}
|
|
44
47
|
._1bsbze3t{width:var(--ds-space-0,0)}
|
|
45
48
|
._1bto1l2s{text-overflow:ellipsis}
|
|
@@ -95,13 +98,13 @@
|
|
|
95
98
|
._4cvr1fhb{align-items:stretch}
|
|
96
99
|
._4cvr1h6o{align-items:center}
|
|
97
100
|
._4cvresu3{align-items:flex-end}
|
|
98
|
-
._4t3i11a6{height:var(--_1goz90u)}
|
|
99
101
|
._4t3i1kdj{height:25pc}
|
|
100
102
|
._4t3i1kxc{height:100vh}
|
|
101
103
|
._4t3i1osq{height:100%}
|
|
102
104
|
._4t3i1uc6{height:98px}
|
|
103
105
|
._4t3ixncg{height:var(--ds-space-800,4pc)}
|
|
104
106
|
._4t3ixy5q{height:var(--ds-space-400,2pc)}
|
|
107
|
+
._4t3iz5ib{height:calc(var(--ds-space-800, 4pc) + var(--ds-space-050, 4px))}
|
|
105
108
|
._4t3izwfg{height:2pc}
|
|
106
109
|
._5ral1f51{object-fit:contain}
|
|
107
110
|
._5ralzm06{object-fit:scale-down}
|
|
@@ -117,6 +120,7 @@
|
|
|
117
120
|
._bfhk1i5c{background-color:var(--ds-blanket,#050c1f75)}
|
|
118
121
|
._bfhk1j28{background-color:transparent}
|
|
119
122
|
._bfhk1tzm{background-color:#22272b}
|
|
123
|
+
._bfhki8nm{background-color:var(--ds-background-neutral,#0515240f)}
|
|
120
124
|
._bfhkr3uz{background-color:#000}
|
|
121
125
|
._bfhkvuon{background-color:var(--ds-surface,#fff)}
|
|
122
126
|
._c71l1osq{max-height:100%}
|
|
@@ -17,14 +17,18 @@ import Heading from '@atlaskit/heading/heading';
|
|
|
17
17
|
import ExitingPersistence from '@atlaskit/motion/exiting-persistence';
|
|
18
18
|
import SlideIn from '@atlaskit/motion/slide-in';
|
|
19
19
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
20
|
-
import { Box
|
|
21
|
-
|
|
20
|
+
import { Box } from '@atlaskit/primitives/box';
|
|
21
|
+
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
22
|
+
import { xcss } from '@atlaskit/primitives/xcss/xcss';
|
|
23
|
+
import { useHasMediaFooterPlayerControls, useIsInsetViewer, useSetMediaFooterControls } from './insetViewerContext';
|
|
22
24
|
var INSET_HEADER_HEIGHT = "var(--ds-space-800, 64px)";
|
|
23
25
|
// The horizontal gutter of the inset header, footer and fitted media, shared so they can't drift.
|
|
24
26
|
// It is `space.300` at the default root font size, hard-coded because the fit maths needs a number
|
|
25
27
|
// and resolving the token would mean reading the DOM on every resize.
|
|
26
28
|
export var INSET_VIEWER_GUTTER_PX = 24;
|
|
27
29
|
var INSET_SIDEBAR_WIDTH = '400px';
|
|
30
|
+
// The media footer is the header's height, and taller when it holds player controls.
|
|
31
|
+
var INSET_PLAYER_FOOTER_HEIGHT = "calc(".concat(INSET_HEADER_HEIGHT, " + ", "var(--ds-space-050, 4px)", ")");
|
|
28
32
|
var insetSidebarWidthTransitionStyles = null;
|
|
29
33
|
var insetSidebarSlotStyles = null;
|
|
30
34
|
var insetSidebarSlotOpenStyles = null;
|
|
@@ -47,7 +51,7 @@ var insetViewerSidebarHeaderContentStyles = null;
|
|
|
47
51
|
var insetViewerSidebarHeaderTitleStyles = null;
|
|
48
52
|
var insetViewerMediaStageStyles = null;
|
|
49
53
|
var insetViewerMediaFooterBarStyles = null;
|
|
50
|
-
var
|
|
54
|
+
var insetViewerPlayerMediaFooterBarStyles = null;
|
|
51
55
|
var listWrapperStyles = null;
|
|
52
56
|
var insetViewerListWrapperStyles = null;
|
|
53
57
|
var itemStageStyles = null;
|
|
@@ -72,7 +76,11 @@ var pdfWrapperStyles = null;
|
|
|
72
76
|
var arrowStyles = null;
|
|
73
77
|
var arrowWrapperStyles = null;
|
|
74
78
|
var insetViewerArrowStyles = null;
|
|
79
|
+
|
|
80
|
+
// The arrows' container is the stage above the footer, so half the footer is added to centre them on
|
|
81
|
+
// the whole media column, wherever the footer's height changes.
|
|
75
82
|
var insetViewerArrowWrapperStyles = null;
|
|
83
|
+
var insetViewerPlayerArrowWrapperStyles = null;
|
|
76
84
|
var insetViewerLeftWrapperStyles = null;
|
|
77
85
|
var insetViewerRightWrapperStyles = null;
|
|
78
86
|
var arrowsWrapperStyles = null;
|
|
@@ -105,13 +113,23 @@ var metadataIconWrapperStyles = xcss({
|
|
|
105
113
|
var rightHeaderStyles = null;
|
|
106
114
|
var insetViewerRightHeaderStyles = null;
|
|
107
115
|
var customAudioPlayerWrapperStyles = null;
|
|
116
|
+
|
|
117
|
+
// The controls are in the footer, so the player's play/pause blanket covers the whole stage.
|
|
118
|
+
var insetViewerCustomAudioPlayerWrapperStyles = null;
|
|
108
119
|
var audioPlayerStyles = null;
|
|
120
|
+
var insetViewerAudioPlayerStyles = null;
|
|
121
|
+
var insetViewerAudioCoverStyles = null;
|
|
109
122
|
var audioStyles = null;
|
|
110
123
|
var audioCoverStyles = null;
|
|
111
124
|
var defaultCoverWrapperStyles = null;
|
|
125
|
+
var defaultCoverScaleStyles = null;
|
|
112
126
|
var downloadButtonWrapperStyles = null;
|
|
127
|
+
|
|
128
|
+
// The media button's text is fixed dark on its light blue, so it stays dark on hover. The inset
|
|
129
|
+
// viewer's themed button sets its own hover colors.
|
|
130
|
+
var downloadButtonWrapperHoverStyles = null;
|
|
113
131
|
var customVideoPlayerWrapperStyles = null;
|
|
114
|
-
var
|
|
132
|
+
var insetViewerCustomMediaPlayerWrapperStyles = null;
|
|
115
133
|
var insetViewerFittedVideoFrameStyles = null;
|
|
116
134
|
var sidebarWrapperStyles = null;
|
|
117
135
|
var insetViewerSidebarWrapperStyles = null;
|
|
@@ -217,14 +235,13 @@ export var MediaStage = function MediaStage(_ref9) {
|
|
|
217
235
|
};
|
|
218
236
|
export var MediaFooterBar = function MediaFooterBar() {
|
|
219
237
|
var setMediaFooterControls = useSetMediaFooterControls();
|
|
220
|
-
var
|
|
238
|
+
var hasPlayerControls = useHasMediaFooterPlayerControls();
|
|
221
239
|
return /*#__PURE__*/React.createElement("div", {
|
|
222
240
|
ref: setMediaFooterControls,
|
|
223
241
|
"data-testid": "media-viewer-media-footer",
|
|
224
|
-
className: ax(["_1reoewfl _18m9ewfl _1o9zidpf _4t3ixncg _vchhusvi _1bsb1osq _1e0c1txw _4cvr1h6o _1bah1h6o _ca0qpxbi _u5f315ne _n3tdpxbi _19bv15ne _kqswh2mm _lcxv1rj4",
|
|
242
|
+
className: ax(["_1reoewfl _18m9ewfl _1o9zidpf _4t3ixncg _vchhusvi _1bsb1osq _1e0c1txw _4cvr1h6o _1bah1h6o _ca0qpxbi _u5f315ne _n3tdpxbi _19bv15ne _kqswh2mm _lcxv1rj4", hasPlayerControls && "_4t3iz5ib _ca0qv47k"]),
|
|
225
243
|
style: {
|
|
226
|
-
"--_1spe40c": ix("".concat(INSET_VIEWER_GUTTER_PX, "px"))
|
|
227
|
-
"--_1goz90u": ix("calc(".concat(INSET_HEADER_HEIGHT, " + ", "var(--ds-space-050, 4px)", ")"))
|
|
244
|
+
"--_1spe40c": ix("".concat(INSET_VIEWER_GUTTER_PX, "px"))
|
|
228
245
|
}
|
|
229
246
|
});
|
|
230
247
|
};
|
|
@@ -361,15 +378,25 @@ export var LeftWrapper = function LeftWrapper(_ref23) {
|
|
|
361
378
|
var children = _ref23.children,
|
|
362
379
|
isArchiveSideBarVisible = _ref23.isArchiveSideBarVisible;
|
|
363
380
|
var isInsetViewer = useIsInsetViewer();
|
|
381
|
+
var hasPlayerControls = useHasMediaFooterPlayerControls();
|
|
364
382
|
return /*#__PURE__*/React.createElement("div", {
|
|
365
|
-
className: ax(["_kqswstnw _154i1ssb _t9ec1i34 _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k", "_y3gn1e5h _1ltvidpf", isArchiveSideBarVisible && "_1ltv1mjv", isInsetViewer && "_ca0qze3t _n3tdze3t _19bvze3t _u5f3ze3t", isInsetViewer && "_1ltv1ejb"])
|
|
383
|
+
className: ax(["_kqswstnw _154i1ssb _t9ec1i34 _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k", "_y3gn1e5h _1ltvidpf", isArchiveSideBarVisible && "_1ltv1mjv", isInsetViewer && "_154iyct9 _ca0qze3t _n3tdze3t _19bvze3t _u5f3ze3t", isInsetViewer && hasPlayerControls && "_154i1dlc", isInsetViewer && "_1ltv1ejb"]),
|
|
384
|
+
style: {
|
|
385
|
+
"--_3tx9jb": ix("calc(50% + ".concat(INSET_HEADER_HEIGHT, " / 2)")),
|
|
386
|
+
"--_7soeen": ix("calc(50% + ".concat(INSET_PLAYER_FOOTER_HEIGHT, " / 2)"))
|
|
387
|
+
}
|
|
366
388
|
}, children);
|
|
367
389
|
};
|
|
368
390
|
export var RightWrapper = function RightWrapper(_ref24) {
|
|
369
391
|
var children = _ref24.children;
|
|
370
392
|
var isInsetViewer = useIsInsetViewer();
|
|
393
|
+
var hasPlayerControls = useHasMediaFooterPlayerControls();
|
|
371
394
|
return /*#__PURE__*/React.createElement("div", {
|
|
372
|
-
className: ax(["_kqswstnw _154i1ssb _t9ec1i34 _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k", "_y3gnusic _1xi2idpf", isInsetViewer && "_ca0qze3t _n3tdze3t _19bvze3t _u5f3ze3t", isInsetViewer && "_1xi21ejb"])
|
|
395
|
+
className: ax(["_kqswstnw _154i1ssb _t9ec1i34 _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k", "_y3gnusic _1xi2idpf", isInsetViewer && "_154iyct9 _ca0qze3t _n3tdze3t _19bvze3t _u5f3ze3t", isInsetViewer && hasPlayerControls && "_154i1dlc", isInsetViewer && "_1xi21ejb"]),
|
|
396
|
+
style: {
|
|
397
|
+
"--_3tx9jb": ix("calc(50% + ".concat(INSET_HEADER_HEIGHT, " / 2)")),
|
|
398
|
+
"--_7soeen": ix("calc(50% + ".concat(INSET_PLAYER_FOOTER_HEIGHT, " / 2)"))
|
|
399
|
+
}
|
|
373
400
|
}, children);
|
|
374
401
|
};
|
|
375
402
|
|
|
@@ -503,16 +530,21 @@ export var RightHeader = function RightHeader(_ref34) {
|
|
|
503
530
|
};
|
|
504
531
|
export var CustomAudioPlayerWrapper = function CustomAudioPlayerWrapper(_ref35) {
|
|
505
532
|
var children = _ref35.children;
|
|
533
|
+
var isInsetViewer = useIsInsetViewer();
|
|
506
534
|
return /*#__PURE__*/React.createElement("div", {
|
|
507
|
-
className: ax(["_kqswstnw _94n5idpf _1ltvidpf _1bsb1osq"])
|
|
535
|
+
className: ax(["_kqswstnw _94n5idpf _1ltvidpf _1bsb1osq", isInsetViewer && "_154iidpf _4t3i1osq"])
|
|
508
536
|
}, children);
|
|
509
537
|
};
|
|
510
538
|
export var AudioPlayer = function AudioPlayer(_ref36) {
|
|
511
539
|
var datatestId = _ref36['data-testid'],
|
|
512
540
|
children = _ref36.children;
|
|
541
|
+
var isInsetViewer = useIsInsetViewer();
|
|
513
542
|
return /*#__PURE__*/React.createElement("div", {
|
|
514
543
|
"data-testid": datatestId,
|
|
515
|
-
className: ax(["_2rkofajl _1reo15vq _18m915vq _bfhk1tzm _4cvr1h6o _1bah1h6o _1bsb1kdj _4t3i1kdj _1e0c1txw _2lx21bp4 _kqswh2mm"])
|
|
544
|
+
className: ax(["_2rkofajl _1reo15vq _18m915vq _bfhk1tzm _4cvr1h6o _1bah1h6o _1bsb1kdj _4t3i1kdj _1e0c1txw _2lx21bp4 _kqswh2mm", isInsetViewer && "_2rko1mok _bfhki8nm _1bsbs947 _4t3i1osq"]),
|
|
545
|
+
style: {
|
|
546
|
+
"--_llywoj": ix("calc(100% - ".concat(INSET_VIEWER_GUTTER_PX * 2, "px)"))
|
|
547
|
+
}
|
|
516
548
|
}, children);
|
|
517
549
|
};
|
|
518
550
|
AudioPlayer.displayName = 'AudioPlayer';
|
|
@@ -533,25 +565,28 @@ export var Audio = /*#__PURE__*/forwardRef(function (_ref37, ref) {
|
|
|
533
565
|
export var AudioCover = function AudioCover(_ref38) {
|
|
534
566
|
var src = _ref38.src,
|
|
535
567
|
alt = _ref38.alt;
|
|
568
|
+
var isInsetViewer = useIsInsetViewer();
|
|
536
569
|
return /*#__PURE__*/React.createElement("img", {
|
|
537
570
|
alt: alt,
|
|
538
571
|
src: src,
|
|
539
|
-
className: ax(["_1bsb1osq _4t3i1osq _5ralzm06 _bfhkr3uz"])
|
|
572
|
+
className: ax(["_1bsb1osq _4t3i1osq _5ralzm06 _bfhkr3uz", isInsetViewer && "_bfhki8nm"])
|
|
540
573
|
});
|
|
541
574
|
};
|
|
542
575
|
export var DefaultCoverWrapper = function DefaultCoverWrapper(_ref39) {
|
|
543
576
|
var children = _ref39.children;
|
|
577
|
+
var isInsetViewer = useIsInsetViewer();
|
|
544
578
|
return /*#__PURE__*/React.createElement("div", {
|
|
545
|
-
className: ax(["_1bsb1osq _4t3i1osq _1e0c1txw _4cvr1h6o _1bah1h6o _syazi7uo _umc418ws"])
|
|
579
|
+
className: ax(["_1bsb1osq _4t3i1osq _1e0c1txw _4cvr1h6o _1bah1h6o _syazi7uo", !isInsetViewer && "_umc418ws"])
|
|
546
580
|
}, children);
|
|
547
581
|
};
|
|
548
582
|
export var DownloadButtonWrapper = function DownloadButtonWrapper(_ref40) {
|
|
549
583
|
var children = _ref40.children;
|
|
584
|
+
var isInsetViewer = useIsInsetViewer();
|
|
550
585
|
return /*#__PURE__*/React.createElement("div", {
|
|
551
|
-
className: ax(["_19pk1ejb _y3gn1h6o _1sfy1fjg _4pkp1fjg"])
|
|
586
|
+
className: ax(["_19pk1ejb _y3gn1h6o", !isInsetViewer && "_1sfy1fjg _4pkp1fjg"])
|
|
552
587
|
}, children);
|
|
553
588
|
};
|
|
554
|
-
export var
|
|
589
|
+
export var CustomMediaPlayerWrapper = /*#__PURE__*/forwardRef(function (_ref41, ref) {
|
|
555
590
|
var datatestId = _ref41['data-testid'],
|
|
556
591
|
children = _ref41.children;
|
|
557
592
|
var isInsetViewer = useIsInsetViewer();
|
|
@@ -20,7 +20,7 @@ import { getLanguageType } from '@atlaskit/media-ui/getLanguageType';
|
|
|
20
20
|
import { isCodeViewerItem } from '@atlaskit/media-ui/isCodeViewerItem';
|
|
21
21
|
import { messages } from '@atlaskit/media-ui/messages';
|
|
22
22
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
23
|
-
import { Text } from '@atlaskit/primitives/compiled';
|
|
23
|
+
import { Text } from '@atlaskit/primitives/compiled/text';
|
|
24
24
|
import { createPreviewUnsupportedEvent } from '../../analytics/events/operational/previewUnsupported';
|
|
25
25
|
import { createZipEntryLoadFailedEvent } from '../../analytics/events/operational/zipEntryLoadFailed';
|
|
26
26
|
import { createZipEntryLoadSucceededEvent } from '../../analytics/events/operational/zipEntryLoadSucceeded';
|
|
@@ -32,7 +32,7 @@ import ErrorMessage from '../../errorMessageWithAnalytics';
|
|
|
32
32
|
import { isMediaViewerError } from '../../isMediaViewerError';
|
|
33
33
|
import { MAX_FILE_SIZE_SUPPORTED_BY_CODEVIEWER } from '../../item-viewer';
|
|
34
34
|
import { Spinner } from '../../loading';
|
|
35
|
-
import {
|
|
35
|
+
import { CustomMediaPlayerWrapper, AudioPlayer, CustomAudioPlayerWrapper, DefaultCoverWrapper, ListWrapper } from '../../styleWrappers';
|
|
36
36
|
import { getMediaTypeFromFilename } from '../../utils/getMediaTypeFromFilename';
|
|
37
37
|
import { getMimeTypeFromFilename } from '../../utils/getMimeTypeFromFilename';
|
|
38
38
|
import { rejectAfter } from '../../utils/rejectAfter';
|
|
@@ -334,7 +334,7 @@ export var ArchiveViewerBase = /*#__PURE__*/function (_BaseViewer) {
|
|
|
334
334
|
onError: this.onViewerError('archiveviewer-imageviewer-onerror', selectedArchiveEntry)
|
|
335
335
|
}));
|
|
336
336
|
case 'video':
|
|
337
|
-
return /*#__PURE__*/React.createElement(ArchiveItemViewerWrapper, null, /*#__PURE__*/React.createElement(
|
|
337
|
+
return /*#__PURE__*/React.createElement(ArchiveItemViewerWrapper, null, /*#__PURE__*/React.createElement(CustomMediaPlayerWrapper, {
|
|
338
338
|
"data-testid": "media-viewer-video-content"
|
|
339
339
|
}, /*#__PURE__*/React.createElement(CustomMediaPlayer, {
|
|
340
340
|
type: "video",
|
|
@@ -3,18 +3,23 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
+
import _get from "@babel/runtime/helpers/get";
|
|
6
7
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
10
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
10
11
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
|
+
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
11
13
|
import React from 'react';
|
|
12
14
|
import AudioIcon from '@atlaskit/icon/core/audio';
|
|
15
|
+
import IconTile from '@atlaskit/icon/icon-tile';
|
|
13
16
|
import { globalMediaEventEmitter } from '@atlaskit/media-client/global-media-event-emitter';
|
|
14
17
|
import { CustomMediaPlayer } from '@atlaskit/media-ui/customMediaPlayer';
|
|
18
|
+
import { InsetViewerProvider } from '@atlaskit/media-ui/insetViewerProvider';
|
|
15
19
|
import { Outcome } from '../domain/outcome';
|
|
20
|
+
import { withInsetViewerFooter } from '../insetViewerContext';
|
|
16
21
|
import { MediaViewerError } from '../MediaViewerError';
|
|
17
|
-
import { AudioPlayer, AudioCover, Audio, DefaultCoverWrapper, CustomAudioPlayerWrapper } from '../styleWrappers';
|
|
22
|
+
import { AudioPlayer, AudioCover, Audio, DefaultCoverWrapper, CustomAudioPlayerWrapper, CustomMediaPlayerWrapper } from '../styleWrappers';
|
|
18
23
|
import { getObjectUrlFromFileState } from '../utils/getObjectUrlFromFileState';
|
|
19
24
|
import { isIE } from '../utils/isIE';
|
|
20
25
|
import { BaseViewer } from './base-viewer';
|
|
@@ -27,14 +32,14 @@ var getCoverUrl = function getCoverUrl(item, mediaClient, collectionName) {
|
|
|
27
32
|
collection: collectionName
|
|
28
33
|
});
|
|
29
34
|
};
|
|
30
|
-
|
|
31
|
-
function
|
|
35
|
+
var _AudioViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
36
|
+
function _AudioViewer() {
|
|
32
37
|
var _this;
|
|
33
|
-
_classCallCheck(this,
|
|
38
|
+
_classCallCheck(this, _AudioViewer);
|
|
34
39
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
35
40
|
args[_key] = arguments[_key];
|
|
36
41
|
}
|
|
37
|
-
_this = _callSuper(this,
|
|
42
|
+
_this = _callSuper(this, _AudioViewer, [].concat(args));
|
|
38
43
|
_defineProperty(_this, "renderCover", function () {
|
|
39
44
|
var item = _this.props.item;
|
|
40
45
|
var coverUrl = _this.state.coverUrl;
|
|
@@ -43,6 +48,13 @@ export var AudioViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
43
48
|
src: coverUrl,
|
|
44
49
|
alt: item.name
|
|
45
50
|
});
|
|
51
|
+
} else if (_this.props.isInsetViewer) {
|
|
52
|
+
return /*#__PURE__*/React.createElement(DefaultCoverWrapper, null, /*#__PURE__*/React.createElement(IconTile, {
|
|
53
|
+
icon: AudioIcon,
|
|
54
|
+
label: "cover",
|
|
55
|
+
appearance: "gray",
|
|
56
|
+
size: "xlarge"
|
|
57
|
+
}));
|
|
46
58
|
} else {
|
|
47
59
|
return defaultCover;
|
|
48
60
|
}
|
|
@@ -122,8 +134,26 @@ export var AudioViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
122
134
|
})));
|
|
123
135
|
return _this;
|
|
124
136
|
}
|
|
125
|
-
_inherits(
|
|
126
|
-
return _createClass(
|
|
137
|
+
_inherits(_AudioViewer, _BaseViewer);
|
|
138
|
+
return _createClass(_AudioViewer, [{
|
|
139
|
+
key: "componentDidMount",
|
|
140
|
+
value: function componentDidMount() {
|
|
141
|
+
_superPropGet(_AudioViewer, "componentDidMount", this, 3)([]);
|
|
142
|
+
if (this.props.isInsetViewer) {
|
|
143
|
+
var _this$props$setHasPla, _this$props2;
|
|
144
|
+
(_this$props$setHasPla = (_this$props2 = this.props).setHasPlayerControls) === null || _this$props$setHasPla === void 0 || _this$props$setHasPla.call(_this$props2, true);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}, {
|
|
148
|
+
key: "componentWillUnmount",
|
|
149
|
+
value: function componentWillUnmount() {
|
|
150
|
+
if (this.props.isInsetViewer) {
|
|
151
|
+
var _this$props$setHasPla2, _this$props3;
|
|
152
|
+
(_this$props$setHasPla2 = (_this$props3 = this.props).setHasPlayerControls) === null || _this$props$setHasPla2 === void 0 || _this$props$setHasPla2.call(_this$props3, false);
|
|
153
|
+
}
|
|
154
|
+
_superPropGet(_AudioViewer, "componentWillUnmount", this, 3)([]);
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
127
157
|
key: "initialState",
|
|
128
158
|
get: function get() {
|
|
129
159
|
return {
|
|
@@ -133,26 +163,36 @@ export var AudioViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
133
163
|
}, {
|
|
134
164
|
key: "renderSuccessful",
|
|
135
165
|
value: function renderSuccessful(src) {
|
|
136
|
-
var _this$
|
|
137
|
-
item = _this$
|
|
138
|
-
showControls = _this$
|
|
139
|
-
previewCount = _this$
|
|
140
|
-
onCanPlay = _this$
|
|
166
|
+
var _this$props4 = this.props,
|
|
167
|
+
item = _this$props4.item,
|
|
168
|
+
showControls = _this$props4.showControls,
|
|
169
|
+
previewCount = _this$props4.previewCount,
|
|
170
|
+
onCanPlay = _this$props4.onCanPlay,
|
|
171
|
+
isInsetViewer = _this$props4.isInsetViewer,
|
|
172
|
+
mediaFooterControls = _this$props4.mediaFooterControls;
|
|
141
173
|
var useCustomAudioPlayer = !isIE();
|
|
142
174
|
var isAutoPlay = previewCount === 0;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
175
|
+
if (useCustomAudioPlayer) {
|
|
176
|
+
var player = /*#__PURE__*/React.createElement(AudioPlayer, {
|
|
177
|
+
"data-testid": "media-viewer-audio-content"
|
|
178
|
+
}, this.renderCover(), /*#__PURE__*/React.createElement(CustomAudioPlayerWrapper, null, /*#__PURE__*/React.createElement(InsetViewerProvider, {
|
|
179
|
+
isInsetViewer: isInsetViewer
|
|
180
|
+
}, /*#__PURE__*/React.createElement(CustomMediaPlayer, {
|
|
181
|
+
type: "audio",
|
|
182
|
+
isAutoPlay: isAutoPlay,
|
|
183
|
+
src: src,
|
|
184
|
+
fileId: item.id,
|
|
185
|
+
isShortcutEnabled: true,
|
|
186
|
+
showControls: showControls,
|
|
187
|
+
onCanPlay: onCanPlay,
|
|
188
|
+
onFirstPlay: this.onFirstPlay,
|
|
189
|
+
onError: this.onError,
|
|
190
|
+
controlsPortalElement: mediaFooterControls
|
|
191
|
+
}))));
|
|
192
|
+
// Same stage wrapper as the video, so audio fills the stage the same way.
|
|
193
|
+
return isInsetViewer ? /*#__PURE__*/React.createElement(CustomMediaPlayerWrapper, null, player) : player;
|
|
194
|
+
}
|
|
195
|
+
return /*#__PURE__*/React.createElement(AudioPlayer, null, this.renderCover(), /*#__PURE__*/React.createElement(CustomAudioPlayerWrapper, null, /*#__PURE__*/React.createElement(Audio, {
|
|
156
196
|
autoPlay: isAutoPlay,
|
|
157
197
|
controls: true,
|
|
158
198
|
ref: this.saveAudioElement,
|
|
@@ -164,11 +204,11 @@ export var AudioViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
164
204
|
key: "init",
|
|
165
205
|
value: function () {
|
|
166
206
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
167
|
-
var _this$
|
|
207
|
+
var _this$props5, mediaClient, item, collectionName, audioUrl, _t2;
|
|
168
208
|
return _regeneratorRuntime.wrap(function (_context3) {
|
|
169
209
|
while (1) switch (_context3.prev = _context3.next) {
|
|
170
210
|
case 0:
|
|
171
|
-
_this$
|
|
211
|
+
_this$props5 = this.props, mediaClient = _this$props5.mediaClient, item = _this$props5.item, collectionName = _this$props5.collectionName;
|
|
172
212
|
_context3.prev = 1;
|
|
173
213
|
if (!(item.status === 'processed')) {
|
|
174
214
|
_context3.next = 4;
|
|
@@ -233,4 +273,5 @@ export var AudioViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
233
273
|
URL.revokeObjectURL(content.data);
|
|
234
274
|
}
|
|
235
275
|
}]);
|
|
236
|
-
}(BaseViewer);
|
|
276
|
+
}(BaseViewer);
|
|
277
|
+
export var AudioViewer = withInsetViewerFooter(_AudioViewer);
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
._154iidpf{top:0}
|
|
1
|
+
._2rko1mok{border-radius:var(--ds-radius-large,8px)}._154iidpf{top:0}
|
|
2
|
+
._18m915vq{overflow-y:hidden}
|
|
2
3
|
._18m91wug{overflow-y:auto}
|
|
4
|
+
._1ltv15ne{left:var(--_1spe40c)}
|
|
3
5
|
._1ltvidpf{left:0}
|
|
6
|
+
._1reo15vq{overflow-x:hidden}
|
|
4
7
|
._1reo1wug{overflow-x:auto}
|
|
8
|
+
._1xi215ne{right:var(--_1spe40c)}
|
|
5
9
|
._1xi2idpf{right:0}
|
|
10
|
+
._4t3i1osq{height:100%}
|
|
6
11
|
._4t3i8ved{height:75px}
|
|
7
12
|
._94n5idpf{bottom:0}
|
|
8
13
|
._bfhk1nox{background-color:#1d2125}
|
|
@@ -1,31 +1,50 @@
|
|
|
1
1
|
/* CodeRendererAdvanced.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import "./CodeRendererAdvanced.compiled.css";
|
|
3
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
-
import React, { useRef } from 'react';
|
|
5
|
+
import React, { useRef, useState } from 'react';
|
|
5
6
|
import { syntaxHighlighting } from '@codemirror/language';
|
|
6
7
|
import { languages } from '@codemirror/language-data';
|
|
7
8
|
import { Compartment, EditorState } from '@codemirror/state';
|
|
8
9
|
import { EditorView, lineNumbers, gutters } from '@codemirror/view';
|
|
9
|
-
import {
|
|
10
|
+
import { useIsInsetViewer, useMediaFooterControls } from '../../../insetViewerContext';
|
|
11
|
+
import { INSET_VIEWER_GUTTER_PX } from '../../../styleWrappers';
|
|
12
|
+
import { CodeViewerFooter } from '../CodeViewerFooter';
|
|
13
|
+
import { cmTheme, highlightStyle, insetViewerCmTheme } from './theme';
|
|
10
14
|
var codeViewWrapperStyles = null;
|
|
15
|
+
var insetViewerCodeViewWrapperStyles = null;
|
|
16
|
+
|
|
17
|
+
// Gives the editor a definite height to fill, so its own scroller scrolls.
|
|
18
|
+
var insetViewerEditorHostStyles = null;
|
|
11
19
|
var codeViewerHeaderBarStyles = null;
|
|
12
20
|
export var CodeRendererAdvanced = function CodeRendererAdvanced(props) {
|
|
21
|
+
var _props$item$name$spli;
|
|
22
|
+
var isInsetViewer = useIsInsetViewer();
|
|
23
|
+
var footerElement = useMediaFooterControls();
|
|
24
|
+
// CodeMirror already splits the document into lines, so the footer gets the count for free.
|
|
25
|
+
var _useState = useState(),
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
+
lineCount = _useState2[0],
|
|
28
|
+
setLineCount = _useState2[1];
|
|
29
|
+
var extension = (_props$item$name$spli = props.item.name.split('.').pop()) !== null && _props$item$name$spli !== void 0 ? _props$item$name$spli : '';
|
|
30
|
+
var language = languages.find(function (lang) {
|
|
31
|
+
return lang.extensions.includes(extension);
|
|
32
|
+
});
|
|
13
33
|
var nodeRef = useRef(function (elem) {
|
|
14
|
-
var _props$
|
|
34
|
+
var _props$onSuccess;
|
|
15
35
|
if (!elem) {
|
|
16
36
|
return;
|
|
17
37
|
}
|
|
18
|
-
var extension = (_props$item$name$spli = props.item.name.split('.').pop()) !== null && _props$item$name$spli !== void 0 ? _props$item$name$spli : '';
|
|
19
38
|
var languageCompartment = new Compartment();
|
|
20
39
|
var view = new EditorView({
|
|
21
40
|
doc: props.src,
|
|
22
41
|
parent: elem,
|
|
23
|
-
extensions: [lineNumbers(), gutters(), EditorState.readOnly.of(true), EditorView.editable.of(false), EditorView.lineWrapping, cmTheme, syntaxHighlighting(highlightStyle), languageCompartment.of([])]
|
|
42
|
+
extensions: [lineNumbers(), gutters(), EditorState.readOnly.of(true), EditorView.editable.of(false), EditorView.lineWrapping, isInsetViewer ? insetViewerCmTheme : cmTheme, syntaxHighlighting(highlightStyle), languageCompartment.of([])]
|
|
24
43
|
});
|
|
44
|
+
if (isInsetViewer) {
|
|
45
|
+
setLineCount(view.state.doc.lines);
|
|
46
|
+
}
|
|
25
47
|
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 || _props$onSuccess.call(props);
|
|
26
|
-
var language = languages.find(function (lang) {
|
|
27
|
-
return lang.extensions.includes(extension);
|
|
28
|
-
});
|
|
29
48
|
language === null || language === void 0 || language.load().then(function (val) {
|
|
30
49
|
view.dispatch({
|
|
31
50
|
effects: languageCompartment.reconfigure(val)
|
|
@@ -37,10 +56,18 @@ export var CodeRendererAdvanced = function CodeRendererAdvanced(props) {
|
|
|
37
56
|
});
|
|
38
57
|
return /*#__PURE__*/React.createElement("div", {
|
|
39
58
|
"data-testid": props.testId,
|
|
40
|
-
className: ax(["_1reo1wug _18m91wug _kqswstnw _1ltvidpf _154iidpf _1xi2idpf _94n5idpf _bfhkvuon"])
|
|
41
|
-
|
|
59
|
+
className: ax(["_1reo1wug _18m91wug _kqswstnw _1ltvidpf _154iidpf _1xi2idpf _94n5idpf _bfhkvuon", isInsetViewer && "_2rko1mok _1reo15vq _18m915vq _1ltv15ne _1xi215ne"]),
|
|
60
|
+
style: {
|
|
61
|
+
"--_1spe40c": ix("".concat(INSET_VIEWER_GUTTER_PX, "px"))
|
|
62
|
+
}
|
|
63
|
+
}, !isInsetViewer && /*#__PURE__*/React.createElement("div", {
|
|
42
64
|
className: ax(["_4t3i8ved _bfhk1nox"])
|
|
43
65
|
}), /*#__PURE__*/React.createElement("div", {
|
|
44
|
-
ref: nodeRef.current
|
|
66
|
+
ref: nodeRef.current,
|
|
67
|
+
className: ax([isInsetViewer && "_4t3i1osq"])
|
|
68
|
+
}), isInsetViewer && /*#__PURE__*/React.createElement(CodeViewerFooter, {
|
|
69
|
+
lineCount: lineCount,
|
|
70
|
+
languageName: language === null || language === void 0 ? void 0 : language.name,
|
|
71
|
+
footerElement: footerElement
|
|
45
72
|
}));
|
|
46
73
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2
4
|
import { HighlightStyle } from '@codemirror/language';
|
|
3
5
|
import { EditorView as CodeMirror } from '@codemirror/view';
|
|
4
6
|
import { tags } from '@lezer/highlight';
|
|
@@ -8,58 +10,71 @@ import { tags } from '@lezer/highlight';
|
|
|
8
10
|
*/
|
|
9
11
|
|
|
10
12
|
var LINE_HEIGHT = '1.5rem';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
13
|
+
var createCmTheme = function createCmTheme(isInsetViewer) {
|
|
14
|
+
return CodeMirror.theme({
|
|
15
|
+
'&': _objectSpread(_defineProperty(_defineProperty({
|
|
16
|
+
backgroundColor: "var(--ds-background-neutral, #0515240F)",
|
|
17
|
+
padding: '0',
|
|
18
|
+
marginTop: isInsetViewer ? "var(--ds-space-0, 0px)" : "var(--ds-space-100, 8px)",
|
|
19
|
+
marginBottom: isInsetViewer ? "var(--ds-space-0, 0px)" : "var(--ds-space-100, 8px)"
|
|
20
|
+
}, 'fontSize', '0.875rem'), 'lineHeight', LINE_HEIGHT), isInsetViewer ? {
|
|
21
|
+
height: '100%',
|
|
22
|
+
overflow: 'hidden',
|
|
23
|
+
borderRadius: "var(--ds-radius-large, 8px)"
|
|
24
|
+
} : {}),
|
|
25
|
+
'&.cm-focused': {
|
|
26
|
+
outline: 'none'
|
|
27
|
+
},
|
|
28
|
+
'.cm-line': {
|
|
29
|
+
padding: '0'
|
|
30
|
+
},
|
|
31
|
+
'&.cm-editor.code-block.danger': {
|
|
32
|
+
backgroundColor: "var(--ds-background-danger, #FFECEB)"
|
|
33
|
+
},
|
|
34
|
+
'.cm-content[aria-readonly="true"]': {
|
|
35
|
+
caretColor: 'transparent'
|
|
36
|
+
},
|
|
37
|
+
'.cm-content': {
|
|
38
|
+
cursor: 'text',
|
|
39
|
+
caretColor: "var(--ds-text, #292A2E)",
|
|
40
|
+
margin: "var(--ds-space-100, 8px)",
|
|
41
|
+
padding: "var(--ds-space-0, 0px)"
|
|
42
|
+
},
|
|
43
|
+
'.cm-scroller': _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
44
|
+
backgroundColor: "var(--ds-background-neutral, #0515240F)"
|
|
45
|
+
}, 'lineHeight', 'unset'), "fontFamily", "var(--ds-font-family-code, \"Atlassian Mono\", ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)"), "borderRadius", "var(--ds-radius-small, 4px)"), "backgroundImage", overflowShadow({
|
|
46
|
+
leftCoverWidth: "var(--ds-space-300, 24px)"
|
|
47
|
+
})), "backgroundAttachment", 'local, local, local, local, scroll, scroll, scroll, scroll'),
|
|
48
|
+
'&.cm-focused .cm-cursor': {
|
|
49
|
+
borderLeftColor: "var(--ds-text, #292A2E)"
|
|
50
|
+
},
|
|
51
|
+
'.cm-gutters': _objectSpread({
|
|
52
|
+
backgroundColor: "var(--ds-background-neutral, #0515240F)",
|
|
53
|
+
border: 'none',
|
|
54
|
+
padding: "var(--ds-space-100, 8px)",
|
|
55
|
+
color: "var(--ds-text-subtlest, #6B6E76)"
|
|
56
|
+
}, isInsetViewer ? {
|
|
57
|
+
height: 'auto',
|
|
58
|
+
minHeight: '100%'
|
|
59
|
+
} : {}),
|
|
60
|
+
'.cm-lineNumbers .cm-gutterElement': {
|
|
61
|
+
paddingLeft: "var(--ds-space-0, 0px)",
|
|
62
|
+
paddingRight: "var(--ds-space-0, 0px)",
|
|
63
|
+
minWidth: 'unset'
|
|
64
|
+
},
|
|
65
|
+
// Set the gutter element min height to prevent flicker of styling while
|
|
66
|
+
// codemirror is calculating (which happens after an animation frame).
|
|
67
|
+
// Example problem: https://github.com/codemirror/dev/issues/1076
|
|
68
|
+
// Ignore the first gutter element as it is a special hidden element.
|
|
69
|
+
'.cm-gutterElement:not(:first-child)': {
|
|
70
|
+
minHeight: LINE_HEIGHT
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
export var cmTheme = createCmTheme(false);
|
|
75
|
+
|
|
76
|
+
// The inset viewer's wrapper already frames the editor, so it has no margin, and the editor does the scrolling.
|
|
77
|
+
export var insetViewerCmTheme = createCmTheme(true);
|
|
63
78
|
function overflowShadow(_ref) {
|
|
64
79
|
var leftCoverWidth = _ref.leftCoverWidth,
|
|
65
80
|
rightCoverWidth = _ref.rightCoverWidth;
|