sanity-plugin-media 6.1.6 → 6.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.js +26 -8
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -11,8 +11,8 @@ import { combineReducers, configureStore, createAction, createSelector, createSl
|
|
|
11
11
|
import groq from "groq";
|
|
12
12
|
import { nanoid } from "nanoid";
|
|
13
13
|
import { combineEpics, createEpicMiddleware, ofType } from "redux-observable";
|
|
14
|
-
import { EMPTY, Observable, Subject, from, iif, merge, of, throwError } from "rxjs";
|
|
15
|
-
import { bufferTime, catchError, concatMap, debounceTime, delay, filter, first, map, mergeMap, switchMap, takeUntil, withLatestFrom } from "rxjs/operators";
|
|
14
|
+
import { EMPTY, Observable, Subject, from, iif, merge, of, takeUntil, throwError } from "rxjs";
|
|
15
|
+
import { bufferTime, catchError, concatMap, debounceTime, delay, filter, first, map, mergeMap, switchMap, takeUntil as takeUntil$1, withLatestFrom } from "rxjs/operators";
|
|
16
16
|
import { uuid } from "@sanity/uuid";
|
|
17
17
|
import pluralize from "pluralize";
|
|
18
18
|
import { createGlobalStyle, css, styled } from "styled-components";
|
|
@@ -3669,7 +3669,7 @@ const createThrottler = (concurrency = 4) => {
|
|
|
3669
3669
|
return merge(of(null).pipe(mergeMap(() => generatePreviewBlobUrl$(file)), mergeMap((url) => of(uploadsActions.previewReady({
|
|
3670
3670
|
blobUrl: url,
|
|
3671
3671
|
hash: uploadItem.hash
|
|
3672
|
-
})))), of(null).pipe(mergeMap(() => uploadAsset$(client, uploadItem.assetType, file, uploadItem.hash)), takeUntil(action$.pipe(filter(uploadsActions.uploadCancel.match), filter((v) => v.payload.hash === uploadItem.hash))), mergeMap((event) => {
|
|
3672
|
+
})))), of(null).pipe(mergeMap(() => uploadAsset$(client, uploadItem.assetType, file, uploadItem.hash)), takeUntil$1(action$.pipe(filter(uploadsActions.uploadCancel.match), filter((v) => v.payload.hash === uploadItem.hash))), mergeMap((event) => {
|
|
3673
3673
|
if (event?.type === "complete") {
|
|
3674
3674
|
let folderId = uploadItem.folderId || null;
|
|
3675
3675
|
return folderId ? from(client.patch(event.asset._id).setIfMissing({ opt: {} }).setIfMissing({ "opt.media": {} }).set({ "opt.media.folder": {
|
|
@@ -6028,6 +6028,7 @@ const TagViewHeader = (t0) => {
|
|
|
6028
6028
|
icon: ComposeIcon,
|
|
6029
6029
|
mode: "bleed",
|
|
6030
6030
|
onClick: handleTagCreate,
|
|
6031
|
+
"aria-label": "Create tag",
|
|
6031
6032
|
style: {
|
|
6032
6033
|
background: "transparent",
|
|
6033
6034
|
boxShadow: "none"
|
|
@@ -6296,6 +6297,8 @@ const rootEpic = combineEpics(assetsDeleteEpic, assetsFetchEpic, assetsFetchAfte
|
|
|
6296
6297
|
function isSupportedAssetType(assetType) {
|
|
6297
6298
|
return assetType ? SUPPORTED_ASSET_TYPES.includes(assetType) : !1;
|
|
6298
6299
|
}
|
|
6300
|
+
/** Stops the root epic when the Media browser unmounts (tool close / dialog dismiss / tests). */
|
|
6301
|
+
const EPIC_END_TYPE = "media/epicEnd";
|
|
6299
6302
|
function createReduxStore(props) {
|
|
6300
6303
|
let epicMiddleware = createEpicMiddleware({ dependencies: { client: props.client } }), store = configureStore({
|
|
6301
6304
|
reducer: rootReducer,
|
|
@@ -6353,18 +6356,32 @@ function createReduxStore(props) {
|
|
|
6353
6356
|
}
|
|
6354
6357
|
}
|
|
6355
6358
|
});
|
|
6356
|
-
|
|
6359
|
+
epicMiddleware.run((action$, state$, dependencies) => rootEpic(action$, state$, dependencies).pipe(takeUntil(action$.pipe(ofType(EPIC_END_TYPE)))));
|
|
6360
|
+
let pendingEnd = null;
|
|
6361
|
+
return {
|
|
6362
|
+
store,
|
|
6363
|
+
scheduleEnd: () => {
|
|
6364
|
+
pendingEnd === null && (pendingEnd = setTimeout(() => {
|
|
6365
|
+
pendingEnd = null, store.dispatch({ type: EPIC_END_TYPE });
|
|
6366
|
+
}, 0));
|
|
6367
|
+
},
|
|
6368
|
+
cancelEnd: () => {
|
|
6369
|
+
pendingEnd !== null && (clearTimeout(pendingEnd), pendingEnd = null);
|
|
6370
|
+
}
|
|
6371
|
+
};
|
|
6357
6372
|
}
|
|
6358
6373
|
function ReduxProvider(t0) {
|
|
6359
|
-
let $ = c(
|
|
6374
|
+
let $ = c(12), children, props;
|
|
6360
6375
|
$[0] === t0 ? (children = $[1], props = $[2]) : ({children, ...props} = t0, $[0] = t0, $[1] = children, $[2] = props);
|
|
6361
6376
|
let t1;
|
|
6362
6377
|
$[3] === props ? t1 = $[4] : (t1 = () => createReduxStore(props), $[3] = props, $[4] = t1);
|
|
6363
|
-
let [
|
|
6364
|
-
|
|
6378
|
+
let [t2] = useState(t1), { cancelEnd, scheduleEnd, store } = t2, t3, t4;
|
|
6379
|
+
$[5] !== cancelEnd || $[6] !== scheduleEnd ? (t3 = () => (cancelEnd(), () => scheduleEnd()), t4 = [cancelEnd, scheduleEnd], $[5] = cancelEnd, $[6] = scheduleEnd, $[7] = t3, $[8] = t4) : (t3 = $[7], t4 = $[8]), useEffect(t3, t4);
|
|
6380
|
+
let t5;
|
|
6381
|
+
return $[9] !== children || $[10] !== store ? (t5 = /* @__PURE__ */ jsx(Provider, {
|
|
6365
6382
|
store,
|
|
6366
6383
|
children
|
|
6367
|
-
}), $[
|
|
6384
|
+
}), $[9] = children, $[10] = store, $[11] = t5) : t5 = $[11], t5;
|
|
6368
6385
|
}
|
|
6369
6386
|
/**
|
|
6370
6387
|
* Fetches the already-selected asset into the store and opens the `assetEdit`
|
|
@@ -6787,6 +6804,7 @@ const Controls = () => {
|
|
|
6787
6804
|
display: t29,
|
|
6788
6805
|
marginLeft: 2,
|
|
6789
6806
|
children: /* @__PURE__ */ jsx(Button, {
|
|
6807
|
+
"aria-label": "Toggle tags panel",
|
|
6790
6808
|
fontSize: 1,
|
|
6791
6809
|
icon: t30,
|
|
6792
6810
|
onClick: toggleTagsPanelToggle,
|