sanity-plugin-mux-input 3.0.5 → 4.0.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/dist/index.js +20 -92
- package/dist/index.js.map +1 -1
- package/package.json +5 -15
- package/dist/index.cjs +0 -5746
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -288
- package/dist/index.d.cts.map +0 -1
- package/sanity.json +0 -8
- package/src/_exports/index.ts +0 -73
- package/src/actions/assets.ts +0 -152
- package/src/actions/secrets.ts +0 -110
- package/src/actions/upload.ts +0 -308
- package/src/clients/upChunkObservable.ts +0 -54
- package/src/components/AddCaptionDialog.tsx +0 -440
- package/src/components/CaptionsDialog.tsx +0 -23
- package/src/components/ConfigureApi.styled.tsx +0 -19
- package/src/components/ConfigureApi.tsx +0 -296
- package/src/components/DraggableWatermark.tsx +0 -885
- package/src/components/EditCaptionDialog.tsx +0 -511
- package/src/components/EditThumbnailDialog.tsx +0 -121
- package/src/components/ErrorBoundaryCard.tsx +0 -97
- package/src/components/FileInputButton.tsx +0 -54
- package/src/components/FileInputMenuItem.styled.tsx +0 -36
- package/src/components/FileInputMenuItem.tsx +0 -85
- package/src/components/FormField.tsx +0 -38
- package/src/components/IconInfo.tsx +0 -22
- package/src/components/ImportVideosFromMux.tsx +0 -339
- package/src/components/Input.styled.tsx +0 -22
- package/src/components/Input.tsx +0 -78
- package/src/components/InputBrowser.tsx +0 -41
- package/src/components/MuxLogo.tsx +0 -42
- package/src/components/Onboard.tsx +0 -65
- package/src/components/PageSelector.tsx +0 -54
- package/src/components/Player.styled.tsx +0 -11
- package/src/components/Player.tsx +0 -117
- package/src/components/PlayerActionsMenu.tsx +0 -191
- package/src/components/ResyncMetadata.tsx +0 -278
- package/src/components/SelectAsset.tsx +0 -39
- package/src/components/SelectSortOptions.tsx +0 -45
- package/src/components/SpinnerBox.tsx +0 -16
- package/src/components/StudioTool.tsx +0 -24
- package/src/components/TextTracksEditor.tsx +0 -117
- package/src/components/TextTracksManager.tsx +0 -738
- package/src/components/UploadConfiguration.tsx +0 -696
- package/src/components/UploadPlaceholder.tsx +0 -88
- package/src/components/UploadProgress.tsx +0 -80
- package/src/components/Uploader.styled.tsx +0 -65
- package/src/components/Uploader.tsx +0 -499
- package/src/components/VideoDetails/DeleteDialog.tsx +0 -148
- package/src/components/VideoDetails/VideoDetails.tsx +0 -358
- package/src/components/VideoDetails/VideoReferences.tsx +0 -63
- package/src/components/VideoDetails/useVideoDetails.ts +0 -103
- package/src/components/VideoInBrowser.tsx +0 -245
- package/src/components/VideoMetadata.tsx +0 -45
- package/src/components/VideoPlayer.tsx +0 -241
- package/src/components/VideoThumbnail.tsx +0 -139
- package/src/components/VideosBrowser.tsx +0 -100
- package/src/components/documentPreview/DocumentPreview.tsx +0 -84
- package/src/components/documentPreview/DraftStatus.tsx +0 -34
- package/src/components/documentPreview/MissingSchemaType.tsx +0 -32
- package/src/components/documentPreview/PaneItemPreview.tsx +0 -67
- package/src/components/documentPreview/PublishedStatus.tsx +0 -35
- package/src/components/documentPreview/TimeAgo.tsx +0 -12
- package/src/components/icons/Audio.tsx +0 -13
- package/src/components/icons/Resolution.tsx +0 -12
- package/src/components/icons/StopWatch.tsx +0 -20
- package/src/components/icons/ToolIcon.tsx +0 -19
- package/src/components/uploadConfiguration/PlaybackPolicy.tsx +0 -133
- package/src/components/uploadConfiguration/PlaybackPolicyOption.tsx +0 -76
- package/src/components/uploadConfiguration/PlaybackPolicyWarning.tsx +0 -29
- package/src/components/uploadConfiguration/ResolutionTierSelector.tsx +0 -72
- package/src/components/uploadConfiguration/StaticRenditionSelector.tsx +0 -180
- package/src/components/withFocusRing/helpers.ts +0 -24
- package/src/components/withFocusRing/index.ts +0 -1
- package/src/components/withFocusRing/withFocusRing.ts +0 -30
- package/src/context/DialogStateContext.tsx +0 -33
- package/src/context/DrmPlaybackWarningContext.tsx +0 -97
- package/src/hooks/useAccessControl.ts +0 -13
- package/src/hooks/useAssetDocumentValues.ts +0 -11
- package/src/hooks/useAssets.ts +0 -73
- package/src/hooks/useCancelUpload.ts +0 -22
- package/src/hooks/useClient.ts +0 -8
- package/src/hooks/useDialogState.ts +0 -11
- package/src/hooks/useDocReferences.ts +0 -21
- package/src/hooks/useFetchFileSize.ts +0 -55
- package/src/hooks/useImportMuxAssets.ts +0 -132
- package/src/hooks/useInView.ts +0 -41
- package/src/hooks/useMediaMetadata.ts +0 -104
- package/src/hooks/useMuxAssets.ts +0 -179
- package/src/hooks/useMuxPolling.ts +0 -52
- package/src/hooks/useResyncAsset.ts +0 -110
- package/src/hooks/useResyncMuxMetadata.ts +0 -169
- package/src/hooks/useSaveSecrets.ts +0 -78
- package/src/hooks/useSecretsDocumentValues.ts +0 -38
- package/src/hooks/useSecretsFormState.ts +0 -47
- package/src/plugin.tsx +0 -31
- package/src/sanity-ui.d.ts +0 -5
- package/src/schema.ts +0 -196
- package/src/util/addKeysToMuxData.ts +0 -30
- package/src/util/asserters.ts +0 -23
- package/src/util/assetTitlePlaceholder.ts +0 -31
- package/src/util/constants.ts +0 -15
- package/src/util/convertWatermarkToMux.ts +0 -160
- package/src/util/createSearchFilter.ts +0 -76
- package/src/util/createUrlParamsObject.ts +0 -29
- package/src/util/extractFiles.ts +0 -67
- package/src/util/formatBytes.ts +0 -31
- package/src/util/formatDriveShareLink.ts +0 -64
- package/src/util/formatSeconds.ts +0 -48
- package/src/util/generateJwt.ts +0 -57
- package/src/util/getAnimatedPosterSrc.ts +0 -26
- package/src/util/getPlaybackPolicy.ts +0 -69
- package/src/util/getPosterSrc.ts +0 -28
- package/src/util/getVideoMetadata.ts +0 -23
- package/src/util/getVideoSrc.ts +0 -23
- package/src/util/parsers.ts +0 -5
- package/src/util/pluginVersion.ts +0 -5
- package/src/util/readSecrets.ts +0 -38
- package/src/util/roundPxString.ts +0 -16
- package/src/util/textTracks.ts +0 -222
- package/src/util/tryWithSuspend.ts +0 -22
- package/src/util/types.ts +0 -566
- package/v2-incompatible.js +0 -11
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import {DocumentVideoIcon, PlugIcon, SearchIcon, UploadIcon} from '@sanity/icons'
|
|
2
|
-
import {Button, Card, Flex, Inline, Text} from '@sanity/ui'
|
|
3
|
-
import {useCallback} from 'react'
|
|
4
|
-
|
|
5
|
-
import {useAccessControl} from '../hooks/useAccessControl'
|
|
6
|
-
import type {SetDialogState} from '../hooks/useDialogState'
|
|
7
|
-
import {type PluginConfig} from '../util/types'
|
|
8
|
-
import {FileInputButton, type FileInputButtonProps} from './FileInputButton'
|
|
9
|
-
|
|
10
|
-
function formatAcceptString(accept: string): string {
|
|
11
|
-
return accept
|
|
12
|
-
.split(',')
|
|
13
|
-
.map((type) => type.trim().replace('/*', ''))
|
|
14
|
-
.join(' or ')
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface UploadPlaceholderProps {
|
|
18
|
-
setDialogState: SetDialogState
|
|
19
|
-
readOnly: boolean
|
|
20
|
-
hovering: boolean
|
|
21
|
-
needsSetup: boolean
|
|
22
|
-
onSelect: FileInputButtonProps['onSelect']
|
|
23
|
-
config: PluginConfig
|
|
24
|
-
accept: string
|
|
25
|
-
}
|
|
26
|
-
export default function UploadPlaceholder(props: UploadPlaceholderProps) {
|
|
27
|
-
const {setDialogState, readOnly, onSelect, hovering, needsSetup, accept} = props
|
|
28
|
-
const handleBrowse = useCallback(() => setDialogState('select-video'), [setDialogState])
|
|
29
|
-
const handleConfigureApi = useCallback(() => setDialogState('secrets'), [setDialogState])
|
|
30
|
-
const {hasConfigAccess} = useAccessControl(props.config)
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<Card
|
|
34
|
-
sizing="border"
|
|
35
|
-
tone={readOnly ? 'transparent' : 'inherit'}
|
|
36
|
-
border
|
|
37
|
-
radius={2}
|
|
38
|
-
paddingX={3}
|
|
39
|
-
paddingY={1}
|
|
40
|
-
style={hovering ? {borderColor: 'transparent'} : undefined}
|
|
41
|
-
>
|
|
42
|
-
<Flex
|
|
43
|
-
align="center"
|
|
44
|
-
justify="space-between"
|
|
45
|
-
gap={4}
|
|
46
|
-
direction={['column', 'column', 'row']}
|
|
47
|
-
paddingY={2}
|
|
48
|
-
sizing="border"
|
|
49
|
-
>
|
|
50
|
-
<Flex align="center" justify="flex-start" gap={2} flex={1}>
|
|
51
|
-
<Flex justify="center">
|
|
52
|
-
<Text muted>
|
|
53
|
-
<DocumentVideoIcon />
|
|
54
|
-
</Text>
|
|
55
|
-
</Flex>
|
|
56
|
-
<Flex justify="center">
|
|
57
|
-
<Text size={1} muted>
|
|
58
|
-
Drag {formatAcceptString(accept)} file or paste URL here
|
|
59
|
-
</Text>
|
|
60
|
-
</Flex>
|
|
61
|
-
</Flex>
|
|
62
|
-
<Inline space={2}>
|
|
63
|
-
<FileInputButton
|
|
64
|
-
accept={accept}
|
|
65
|
-
mode="bleed"
|
|
66
|
-
tone="default"
|
|
67
|
-
icon={UploadIcon}
|
|
68
|
-
text="Upload"
|
|
69
|
-
onSelect={onSelect}
|
|
70
|
-
/>
|
|
71
|
-
<Button mode="bleed" icon={SearchIcon} text="Select" onClick={handleBrowse} />
|
|
72
|
-
|
|
73
|
-
{hasConfigAccess && (
|
|
74
|
-
<Button
|
|
75
|
-
padding={3}
|
|
76
|
-
radius={3}
|
|
77
|
-
tone={needsSetup ? 'critical' : undefined}
|
|
78
|
-
onClick={handleConfigureApi}
|
|
79
|
-
icon={PlugIcon}
|
|
80
|
-
mode="bleed"
|
|
81
|
-
title="Configure plugin credentials"
|
|
82
|
-
/>
|
|
83
|
-
)}
|
|
84
|
-
</Inline>
|
|
85
|
-
</Flex>
|
|
86
|
-
</Card>
|
|
87
|
-
)
|
|
88
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
// Lifted from sanity/form/inputs/files/common/UploadProgress
|
|
2
|
-
|
|
3
|
-
import {Button, Card, Code, Flex, Inline, Stack, Text} from '@sanity/ui'
|
|
4
|
-
import {LinearProgress} from 'sanity'
|
|
5
|
-
import {styled} from 'styled-components'
|
|
6
|
-
|
|
7
|
-
const CardWrapper = styled(Card)`
|
|
8
|
-
min-height: 82px;
|
|
9
|
-
box-sizing: border-box;
|
|
10
|
-
`
|
|
11
|
-
|
|
12
|
-
const FlexWrapper = styled(Flex)`
|
|
13
|
-
text-overflow: ellipsis;
|
|
14
|
-
overflow: hidden;
|
|
15
|
-
`
|
|
16
|
-
|
|
17
|
-
const LeftSection = styled(Stack)`
|
|
18
|
-
position: relative;
|
|
19
|
-
width: 60%;
|
|
20
|
-
`
|
|
21
|
-
|
|
22
|
-
const CodeWrapper = styled(Code)`
|
|
23
|
-
position: relative;
|
|
24
|
-
width: 100%;
|
|
25
|
-
|
|
26
|
-
code {
|
|
27
|
-
overflow: hidden;
|
|
28
|
-
text-overflow: ellipsis;
|
|
29
|
-
position: relative;
|
|
30
|
-
max-width: 200px;
|
|
31
|
-
}
|
|
32
|
-
`
|
|
33
|
-
|
|
34
|
-
export const UploadProgress = ({
|
|
35
|
-
progress = 100,
|
|
36
|
-
onCancel,
|
|
37
|
-
filename,
|
|
38
|
-
text = 'Uploading',
|
|
39
|
-
}: {
|
|
40
|
-
progress: number
|
|
41
|
-
filename?: React.ReactNode
|
|
42
|
-
onCancel?: React.MouseEventHandler<HTMLButtonElement>
|
|
43
|
-
text?: React.ReactNode
|
|
44
|
-
}) => {
|
|
45
|
-
// Disable cancel button when upload is 90% or more complete
|
|
46
|
-
// to prevent inconsistency between Mux and Sanity
|
|
47
|
-
const isCancelDisabled = progress >= 90
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<CardWrapper tone="primary" padding={4} border height="fill">
|
|
51
|
-
<FlexWrapper align="center" justify="space-between" height="fill" direction="row" gap={2}>
|
|
52
|
-
<LeftSection>
|
|
53
|
-
<Flex justify="center" gap={[3, 3, 2, 2]} direction={['column', 'column', 'row']}>
|
|
54
|
-
<Text size={1}>
|
|
55
|
-
<Inline space={2}>
|
|
56
|
-
{text}
|
|
57
|
-
<CodeWrapper size={1}>{filename ? filename : '...'}</CodeWrapper>
|
|
58
|
-
</Inline>
|
|
59
|
-
</Text>
|
|
60
|
-
</Flex>
|
|
61
|
-
|
|
62
|
-
<Card marginTop={3} radius={5} shadow={1}>
|
|
63
|
-
<LinearProgress value={progress} />
|
|
64
|
-
</Card>
|
|
65
|
-
</LeftSection>
|
|
66
|
-
|
|
67
|
-
{onCancel ? (
|
|
68
|
-
<Button
|
|
69
|
-
fontSize={2}
|
|
70
|
-
text="Cancel upload"
|
|
71
|
-
mode="ghost"
|
|
72
|
-
tone="critical"
|
|
73
|
-
onClick={onCancel}
|
|
74
|
-
disabled={isCancelDisabled}
|
|
75
|
-
/>
|
|
76
|
-
) : null}
|
|
77
|
-
</FlexWrapper>
|
|
78
|
-
</CardWrapper>
|
|
79
|
-
)
|
|
80
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import {Card, type CardTone} from '@sanity/ui'
|
|
2
|
-
import React, {forwardRef, useCallback, useRef} from 'react'
|
|
3
|
-
import {styled} from 'styled-components'
|
|
4
|
-
|
|
5
|
-
import {withFocusRing} from './withFocusRing'
|
|
6
|
-
|
|
7
|
-
const UploadCardWithFocusRing = withFocusRing(Card)
|
|
8
|
-
|
|
9
|
-
interface UploadCardProps {
|
|
10
|
-
tone?: CardTone
|
|
11
|
-
children: React.ReactNode
|
|
12
|
-
onPaste: React.ClipboardEventHandler<HTMLInputElement>
|
|
13
|
-
onDrop: React.DragEventHandler<HTMLDivElement>
|
|
14
|
-
onDragOver: React.DragEventHandler<HTMLDivElement>
|
|
15
|
-
onDragLeave: React.DragEventHandler<HTMLDivElement>
|
|
16
|
-
onDragEnter: React.DragEventHandler<HTMLDivElement>
|
|
17
|
-
}
|
|
18
|
-
export const UploadCard = forwardRef<HTMLDivElement, UploadCardProps>(
|
|
19
|
-
({children, tone, onPaste, onDrop, onDragEnter, onDragLeave, onDragOver}, forwardedRef) => {
|
|
20
|
-
const inputRef = useRef<HTMLInputElement>(null)
|
|
21
|
-
const handleKeyDown = useCallback<React.KeyboardEventHandler<HTMLDivElement>>((event) => {
|
|
22
|
-
const target = event.target as HTMLElement
|
|
23
|
-
|
|
24
|
-
// Don't steal focus when pasting into the VTT input
|
|
25
|
-
if (target.closest('#vtt-url')) {
|
|
26
|
-
return
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if ((event.ctrlKey || event.metaKey) && event.key === 'v') {
|
|
30
|
-
inputRef.current!.focus()
|
|
31
|
-
}
|
|
32
|
-
}, [])
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<UploadCardWithFocusRing
|
|
36
|
-
tone={tone}
|
|
37
|
-
ref={forwardedRef}
|
|
38
|
-
padding={0}
|
|
39
|
-
radius={2}
|
|
40
|
-
shadow={0}
|
|
41
|
-
tabIndex={0}
|
|
42
|
-
onKeyDown={handleKeyDown}
|
|
43
|
-
onPaste={onPaste}
|
|
44
|
-
onDrop={onDrop}
|
|
45
|
-
onDragEnter={onDragEnter}
|
|
46
|
-
onDragLeave={onDragLeave}
|
|
47
|
-
onDragOver={onDragOver}
|
|
48
|
-
>
|
|
49
|
-
<HiddenInput ref={inputRef} />
|
|
50
|
-
{children}
|
|
51
|
-
</UploadCardWithFocusRing>
|
|
52
|
-
)
|
|
53
|
-
},
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
const HiddenInput = styled.input.attrs({type: 'text'})`
|
|
57
|
-
position: absolute;
|
|
58
|
-
border: 0;
|
|
59
|
-
color: white;
|
|
60
|
-
opacity: 0;
|
|
61
|
-
|
|
62
|
-
&:focus {
|
|
63
|
-
outline: none;
|
|
64
|
-
}
|
|
65
|
-
`
|