sanity-plugin-media 6.1.6 → 6.1.7

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 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,27 @@ function createReduxStore(props) {
6353
6356
  }
6354
6357
  }
6355
6358
  });
6356
- return epicMiddleware.run(rootEpic), store;
6359
+ return epicMiddleware.run((action$, state$, dependencies) => rootEpic(action$, state$, dependencies).pipe(takeUntil(action$.pipe(ofType(EPIC_END_TYPE))))), {
6360
+ store,
6361
+ endEpics: () => {
6362
+ store.dispatch({ type: EPIC_END_TYPE });
6363
+ }
6364
+ };
6357
6365
  }
6358
6366
  function ReduxProvider(t0) {
6359
- let $ = c(8), children, props;
6367
+ let $ = c(11), children, props;
6360
6368
  $[0] === t0 ? (children = $[1], props = $[2]) : ({children, ...props} = t0, $[0] = t0, $[1] = children, $[2] = props);
6361
6369
  let t1;
6362
6370
  $[3] === props ? t1 = $[4] : (t1 = () => createReduxStore(props), $[3] = props, $[4] = t1);
6363
- let [store] = useState(t1), t2;
6364
- return $[5] !== children || $[6] !== store ? (t2 = /* @__PURE__ */ jsx(Provider, {
6371
+ let [t2] = useState(t1), { endEpics, store } = t2, t3, t4;
6372
+ $[5] === endEpics ? (t3 = $[6], t4 = $[7]) : (t3 = () => () => {
6373
+ endEpics();
6374
+ }, t4 = [endEpics], $[5] = endEpics, $[6] = t3, $[7] = t4), useEffect(t3, t4);
6375
+ let t5;
6376
+ return $[8] !== children || $[9] !== store ? (t5 = /* @__PURE__ */ jsx(Provider, {
6365
6377
  store,
6366
6378
  children
6367
- }), $[5] = children, $[6] = store, $[7] = t2) : t2 = $[7], t2;
6379
+ }), $[8] = children, $[9] = store, $[10] = t5) : t5 = $[10], t5;
6368
6380
  }
6369
6381
  /**
6370
6382
  * Fetches the already-selected asset into the store and opens the `assetEdit`
@@ -6787,6 +6799,7 @@ const Controls = () => {
6787
6799
  display: t29,
6788
6800
  marginLeft: 2,
6789
6801
  children: /* @__PURE__ */ jsx(Button, {
6802
+ "aria-label": "Toggle tags panel",
6790
6803
  fontSize: 1,
6791
6804
  icon: t30,
6792
6805
  onClick: toggleTagsPanelToggle,