sanity-plugin-mux-input 4.1.7 → 4.1.8
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.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -24
- package/dist/index.js.map +1 -1
- package/package.json +6 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "sanity";
|
|
1
2
|
import MuxPlayerElement from "@mux/mux-player";
|
|
2
3
|
import { PartialDeep } from "type-fest";
|
|
3
4
|
/**
|
|
@@ -109,9 +110,9 @@ interface MuxInputConfig {
|
|
|
109
110
|
/**
|
|
110
111
|
* The mime types that are accepted by the input.
|
|
111
112
|
*
|
|
112
|
-
|
|
113
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/accept}
|
|
113
114
|
* @defaultValue ['video/*','audio/*']
|
|
114
|
-
|
|
115
|
+
*/
|
|
115
116
|
acceptedMimeTypes?: ('audio/*' | 'video/*')[];
|
|
116
117
|
/**
|
|
117
118
|
* Maximum file size allowed for video uploads in bytes.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/util/types.ts","../src/_exports/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/util/types.ts","../src/_exports/index.ts"],"mappings":";;;;;;KAOY;UAYK;;;;;;;;;;;;EAYf,mBAAmB;;;;;;;;EASnB;;;;;;;EAQA;;;;;;;;EASA;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA;;;;;EAMA;;;;;;EAOA;;;;;;;;EASA,oCAAoC;;;;;;;EAQpC,mCAAmC;;;;;;;;EASnC;;;;;;;;EASA;;;;;;EAOA;;;;;;;EASA;;;;;;;;EASA;;;;;;;;EASA;;;;;;;;;;;;;;;;EAiBA,YAAY;;UAGG,qBAAqB;;;;;;;EAOpC;IAGM;IACA,OAAO,MAAM;;;;;;;;EASnB;;cA4BW;KAED,+BAA+B;KA6L/B;UAEK;EACf;EACA;;UAGe;EACf;EACA,QAAQ;;UAGO;EACf;EACA;EACA;EACA;EAEA;EAEA;;UAEe;EACf;EACA;EACA;EACA;EACA;;UAEe;EACf;EACA;EACA;EAEA;EAOA;EAEA;EACA;EAEA;EACA;EACA;IACE;IACA;;;KAGQ,WAAW,gBAAgB,gBAAgB;UAEtC;EACf;;EAEA;EACA;EACA;EACA;EACA;EAEA;EAEA;EACA,cAAc;EACd,QAAQ;EACR,SAAS;EACT;EACA;EAEA;EACA;EACA;IACE;IAGA;;EAEF;EACA;EAEA;EAEA;EAEA;IACE;IACA;MACE;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;;;EAGJ;IACE;IACA;IACA;;EAGF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;;;UAIa;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA,OAAO,YAAY;;cCviBR,eAAe;cAiCf,2BAAQ,cAAA,QAAA"}
|
package/dist/index.js
CHANGED
|
@@ -342,7 +342,7 @@ function useAssets() {
|
|
|
342
342
|
function useDialogState() {
|
|
343
343
|
return useState(!1);
|
|
344
344
|
}
|
|
345
|
-
const PLUGIN_VERSION_QUERY = { sanityVersion: "4.1.
|
|
345
|
+
const PLUGIN_VERSION_QUERY = { sanityVersion: "4.1.8" };
|
|
346
346
|
function saveSecrets(client, token, secretKey, enableSignedUrls, signingKeyId, signingKeyPrivate, drmConfigId) {
|
|
347
347
|
let doc = {
|
|
348
348
|
_id: "secrets.mux",
|
|
@@ -884,7 +884,7 @@ function generateAssetPlaceholder(assetId) {
|
|
|
884
884
|
* @returns true if the filename is empty or matches the placeholder format
|
|
885
885
|
*/
|
|
886
886
|
function isEmptyOrPlaceholderTitle(filename, assetId) {
|
|
887
|
-
return !filename || filename.trim() === ""
|
|
887
|
+
return !filename || filename.trim() === "" || filename === generateAssetPlaceholder(assetId);
|
|
888
888
|
}
|
|
889
889
|
function parseMuxDate(date) {
|
|
890
890
|
return /* @__PURE__ */ new Date(Number(date) * 1e3);
|
|
@@ -1112,7 +1112,7 @@ function muxAssetToSanityDocument(asset) {
|
|
|
1112
1112
|
}
|
|
1113
1113
|
const useAssetsInSanity = createHookFromObservableFactory((documentStore) => documentStore.listenQuery("*[_type == \"mux.videoAsset\"] {\n \"uploadId\": coalesce(uploadId, data.upload_id),\n \"assetId\": coalesce(assetId, data.id),\n }", {}, { apiVersion: SANITY_API_VERSION }));
|
|
1114
1114
|
function assetExistsInSanity(asset, existingAssets) {
|
|
1115
|
-
return asset.status === "ready"
|
|
1115
|
+
return asset.status === "ready" && existingAssets.some((existing) => existing.assetId === asset.id || existing.uploadId === asset.upload_id);
|
|
1116
1116
|
}
|
|
1117
1117
|
function useInView(ref, options = {}) {
|
|
1118
1118
|
let [inView, setInView] = useState(!1);
|
|
@@ -3716,7 +3716,11 @@ function EditThumbnailDialog({ asset, currentTime = 0 }) {
|
|
|
3716
3716
|
placeholder: "hh:mm:ss",
|
|
3717
3717
|
onChange: (event) => {
|
|
3718
3718
|
let value = event.currentTarget.value;
|
|
3719
|
-
setTimeFormatted(value), isValidTimeFormat(value)
|
|
3719
|
+
if (setTimeFormatted(value), isValidTimeFormat(value)) {
|
|
3720
|
+
setInputError("");
|
|
3721
|
+
let totalSeconds = getSecondsFromTimeFormat(value);
|
|
3722
|
+
setNextTime(totalSeconds);
|
|
3723
|
+
} else setInputError("Invalid time format");
|
|
3720
3724
|
},
|
|
3721
3725
|
customValidity: inputError
|
|
3722
3726
|
})]
|
|
@@ -3861,7 +3865,7 @@ function VideoPlayer({ asset, thumbnailWidth = 250, children, hlsConfig, ...prop
|
|
|
3861
3865
|
crossOrigin: "anonymous",
|
|
3862
3866
|
metadata: {
|
|
3863
3867
|
player_name: "Sanity Admin Dashboard",
|
|
3864
|
-
player_version: "4.1.
|
|
3868
|
+
player_version: "4.1.8",
|
|
3865
3869
|
page_type: "Preview Player"
|
|
3866
3870
|
},
|
|
3867
3871
|
audio: isAudio,
|
|
@@ -4036,7 +4040,18 @@ const Container = styled(Box).withConfig({
|
|
|
4036
4040
|
componentId: "sc-tqydu5-0"
|
|
4037
4041
|
})`*{color:${(props) => props.theme.sanity.color.base.fg};}a{text-decoration:none;}h2{font-size:${(props) => props.theme.sanity.fonts.text.sizes[1]};}`, VideoReferences = (props) => {
|
|
4038
4042
|
let schema = useSchema();
|
|
4039
|
-
|
|
4043
|
+
if (!props.isLoaded) return /* @__PURE__ */ jsx(SpinnerBox, {});
|
|
4044
|
+
if (!props.references?.length) return /* @__PURE__ */ jsx(Card, {
|
|
4045
|
+
border: !0,
|
|
4046
|
+
radius: 3,
|
|
4047
|
+
padding: 3,
|
|
4048
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
4049
|
+
size: 2,
|
|
4050
|
+
children: "No documents are using this video"
|
|
4051
|
+
})
|
|
4052
|
+
});
|
|
4053
|
+
let documentPairs = collate(props.references || []);
|
|
4054
|
+
return /* @__PURE__ */ jsx(Container, { children: documentPairs?.map((documentPair) => /* @__PURE__ */ jsx(Card, {
|
|
4040
4055
|
marginBottom: 2,
|
|
4041
4056
|
padding: 2,
|
|
4042
4057
|
radius: 2,
|
|
@@ -4046,15 +4061,7 @@ const Container = styled(Box).withConfig({
|
|
|
4046
4061
|
documentPair,
|
|
4047
4062
|
schemaType: schema.get(documentPair.type)
|
|
4048
4063
|
}) })
|
|
4049
|
-
}, documentPair.id)) })
|
|
4050
|
-
border: !0,
|
|
4051
|
-
radius: 3,
|
|
4052
|
-
padding: 3,
|
|
4053
|
-
children: /* @__PURE__ */ jsx(Text, {
|
|
4054
|
-
size: 2,
|
|
4055
|
-
children: "No documents are using this video"
|
|
4056
|
-
})
|
|
4057
|
-
}) : /* @__PURE__ */ jsx(SpinnerBox, {});
|
|
4064
|
+
}, documentPair.id)) });
|
|
4058
4065
|
};
|
|
4059
4066
|
function DeleteDialog({ asset, references, referencesLoading, cancelDelete, succeededDeleting }) {
|
|
4060
4067
|
let client = useClient$1(), [state, setState] = useState("checkingReferences"), [deleteOnMux, setDeleteOnMux] = useState(!0), toast = useToast();
|
|
@@ -5349,11 +5356,12 @@ const StyledDialog = styled(Dialog).withConfig({
|
|
|
5349
5356
|
componentId: "sc-z1aqru-0"
|
|
5350
5357
|
})`> div[data-ui='DialogCard'] > div[data-ui='Card']{height:100%;}`;
|
|
5351
5358
|
function InputBrowser({ setDialogState, asset, onChange, config }) {
|
|
5359
|
+
let id = `InputBrowser${useId()}`, handleClose = useCallback(() => setDialogState(!1), [setDialogState]);
|
|
5352
5360
|
return /* @__PURE__ */ jsx(StyledDialog, {
|
|
5353
5361
|
__unstable_autoFocus: !0,
|
|
5354
5362
|
header: "Select video",
|
|
5355
|
-
id
|
|
5356
|
-
onClose:
|
|
5363
|
+
id,
|
|
5364
|
+
onClose: handleClose,
|
|
5357
5365
|
width: 2,
|
|
5358
5366
|
children: /* @__PURE__ */ jsx(SelectAssets, {
|
|
5359
5367
|
config,
|
|
@@ -5997,7 +6005,8 @@ function WatermarkControls({ watermark, onChange, onValidationChange, previewCon
|
|
|
5997
6005
|
}
|
|
5998
6006
|
setIsValidating(!0), setIsValid(null), setUrlError(null), validationTimeoutRef.current = setTimeout(() => {
|
|
5999
6007
|
try {
|
|
6000
|
-
|
|
6008
|
+
let pathname = new URL(url).pathname.toLowerCase();
|
|
6009
|
+
if (isValidExtension(pathname)) {
|
|
6001
6010
|
setIsValid(!0), setUrlError(null), onValidationChange?.(null);
|
|
6002
6011
|
let img = new Image();
|
|
6003
6012
|
img.onload = () => {
|
|
@@ -6264,10 +6273,12 @@ function WatermarkControls({ watermark, onChange, onValidationChange, previewCon
|
|
|
6264
6273
|
text: "Manual",
|
|
6265
6274
|
mode: mode === "manual" ? "default" : "ghost",
|
|
6266
6275
|
onClick: () => {
|
|
6267
|
-
setMode("manual")
|
|
6276
|
+
setMode("manual");
|
|
6277
|
+
let overlay = convertWatermarkToMuxOverlay({
|
|
6268
6278
|
...watermark,
|
|
6269
6279
|
enabled: !0
|
|
6270
|
-
})
|
|
6280
|
+
});
|
|
6281
|
+
updateOverlaySettings(overlay ?? {});
|
|
6271
6282
|
}
|
|
6272
6283
|
})]
|
|
6273
6284
|
})]
|
|
@@ -7441,7 +7452,9 @@ function withFocusRing(component) {
|
|
|
7441
7452
|
}
|
|
7442
7453
|
const UploadCardWithFocusRing = withFocusRing(Card);
|
|
7443
7454
|
function UploadCard({ children, tone, onPaste, onDrop, onDragEnter, onDragLeave, onDragOver, ref }) {
|
|
7444
|
-
let inputRef = useRef(null)
|
|
7455
|
+
let inputRef = useRef(null), handleKeyDown = useCallback((event) => {
|
|
7456
|
+
event.target.closest("#vtt-url") || (event.ctrlKey || event.metaKey) && event.key === "v" && inputRef.current.focus();
|
|
7457
|
+
}, []);
|
|
7445
7458
|
return /* @__PURE__ */ jsxs(UploadCardWithFocusRing, {
|
|
7446
7459
|
tone,
|
|
7447
7460
|
ref,
|
|
@@ -7449,9 +7462,7 @@ function UploadCard({ children, tone, onPaste, onDrop, onDragEnter, onDragLeave,
|
|
|
7449
7462
|
radius: 2,
|
|
7450
7463
|
shadow: 0,
|
|
7451
7464
|
tabIndex: 0,
|
|
7452
|
-
onKeyDown:
|
|
7453
|
-
event.target.closest("#vtt-url") || (event.ctrlKey || event.metaKey) && event.key === "v" && inputRef.current.focus();
|
|
7454
|
-
}, []),
|
|
7465
|
+
onKeyDown: handleKeyDown,
|
|
7455
7466
|
onPaste,
|
|
7456
7467
|
onDrop,
|
|
7457
7468
|
onDragEnter,
|