sanity-plugin-media 2.3.2 → 2.4.0
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/LICENSE +1 -1
- package/dist/index.d.mts +19 -0
- package/dist/index.d.ts +3 -9
- package/dist/index.js +4228 -10784
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5341 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +18 -24
- package/src/components/AssetGridVirtualized/index.tsx +2 -2
- package/src/components/AssetMetadata/index.tsx +2 -2
- package/src/components/AssetTableVirtualized/index.tsx +2 -2
- package/src/components/Browser/index.tsx +2 -2
- package/src/components/ButtonAssetCopy/index.tsx +1 -1
- package/src/components/CardAsset/index.tsx +3 -3
- package/src/components/DebugControls/index.tsx +1 -1
- package/src/components/Dialog/index.tsx +1 -1
- package/src/components/DialogAssetEdit/index.tsx +3 -3
- package/src/components/DialogConfirm/index.tsx +2 -2
- package/src/components/DialogSearchFacets/index.tsx +2 -2
- package/src/components/DialogTagCreate/index.tsx +3 -3
- package/src/components/DialogTagEdit/index.tsx +3 -3
- package/src/components/DialogTags/index.tsx +2 -2
- package/src/components/Dialogs/index.tsx +1 -1
- package/src/components/DocumentList/index.tsx +1 -1
- package/src/components/FileAssetPreview/index.tsx +1 -1
- package/src/components/FileIcon/index.tsx +2 -2
- package/src/components/FormBuilderTool/index.tsx +2 -2
- package/src/components/FormFieldInputText/index.tsx +1 -1
- package/src/components/FormFieldInputTextarea/index.tsx +1 -1
- package/src/components/FormSubmitButton/index.tsx +1 -1
- package/src/components/Image/index.tsx +2 -2
- package/src/components/Items/index.tsx +1 -1
- package/src/components/ReduxProvider/index.tsx +4 -4
- package/src/components/SearchFacet/index.tsx +3 -3
- package/src/components/SearchFacetNumber/index.tsx +1 -1
- package/src/components/SearchFacetSelect/index.tsx +1 -1
- package/src/components/SearchFacetString/index.tsx +2 -2
- package/src/components/SearchFacetTags/index.tsx +1 -1
- package/src/components/SearchFacets/index.tsx +1 -1
- package/src/components/SearchFacetsControl/index.tsx +1 -1
- package/src/components/TableHeader/index.tsx +2 -2
- package/src/components/TableRowAsset/index.tsx +10 -2
- package/src/components/Tag/index.tsx +2 -2
- package/src/components/TagsVirtualized/index.tsx +2 -2
- package/src/components/TextInputNumber/index.tsx +1 -1
- package/src/components/TextInputSearch/index.tsx +1 -1
- package/src/components/UploadDropzone/index.tsx +2 -2
- package/src/config/searchFacets.ts +1 -1
- package/src/constants.ts +6 -1
- package/src/contexts/AssetSourceDispatchContext.tsx +1 -1
- package/src/contexts/DropzoneDispatchContext.tsx +1 -1
- package/src/contexts/ToolOptionsContext.tsx +3 -3
- package/src/hooks/useKeyPress.ts +1 -1
- package/src/hooks/useOnScreen.ts +1 -1
- package/src/hooks/usePortalPopoverProps.ts +1 -1
- package/src/hooks/useTypedSelector.ts +2 -2
- package/src/modules/assets/actions.ts +1 -1
- package/src/modules/assets/index.ts +3 -3
- package/src/modules/debug/index.ts +1 -1
- package/src/modules/dialog/index.ts +2 -2
- package/src/modules/index.ts +3 -3
- package/src/modules/notifications/index.ts +1 -1
- package/src/modules/search/index.ts +1 -1
- package/src/modules/selectors.ts +2 -2
- package/src/modules/tags/index.ts +2 -2
- package/src/modules/uploads/index.ts +2 -2
- package/src/operators/debugThrottle.ts +1 -1
- package/src/plugin.tsx +5 -3
- package/src/styled/react-select/creatable.tsx +2 -2
- package/src/styled/react-select/single.tsx +2 -2
- package/src/types/index.ts +2 -2
- package/src/utils/blocksToText.ts +1 -1
- package/src/utils/constructFilter.ts +1 -1
- package/src/utils/getAssetResolution.ts +1 -1
- package/src/utils/getSchemeColor.ts +1 -1
- package/src/utils/getTagSelectOptions.ts +1 -1
- package/src/utils/getUniqueDocuments.ts +1 -1
- package/src/utils/imageDprUrl.ts +1 -1
- package/src/utils/typeGuards.ts +1 -1
- package/src/utils/uploadSanityAsset.ts +1 -1
- package/dist/index.cjs.mjs +0 -5
- package/dist/index.esm.js +0 -11850
- package/dist/index.esm.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {createSelector, createSlice, PayloadAction} from '@reduxjs/toolkit'
|
|
1
|
+
import {createSelector, createSlice, type PayloadAction} from '@reduxjs/toolkit'
|
|
2
2
|
import type {ClientError, Patch, Transaction} from '@sanity/client'
|
|
3
|
-
import {
|
|
3
|
+
import type {
|
|
4
4
|
Asset,
|
|
5
5
|
AssetItem,
|
|
6
6
|
AssetType,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from '@types'
|
|
14
14
|
import groq from 'groq'
|
|
15
15
|
import {nanoid} from 'nanoid'
|
|
16
|
-
import {Selector} from 'react-redux'
|
|
16
|
+
import type {Selector} from 'react-redux'
|
|
17
17
|
import {ofType} from 'redux-observable'
|
|
18
18
|
import {empty, from, of} from 'rxjs'
|
|
19
19
|
import {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {createSlice, PayloadAction} from '@reduxjs/toolkit'
|
|
2
|
-
import {AssetItem, Dialog, MyEpic, Tag} from '@types'
|
|
1
|
+
import {createSlice, type PayloadAction} from '@reduxjs/toolkit'
|
|
2
|
+
import type {AssetItem, Dialog, MyEpic, Tag} from '@types'
|
|
3
3
|
import pluralize from 'pluralize'
|
|
4
4
|
import {ofType} from 'redux-observable'
|
|
5
5
|
import {empty, of} from 'rxjs'
|
package/src/modules/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {PayloadAction, createSelector, createSlice} from '@reduxjs/toolkit'
|
|
1
|
+
import {type PayloadAction, createSelector, createSlice} from '@reduxjs/toolkit'
|
|
2
2
|
import type {MyEpic, SearchFacetInputProps, SearchFacetOperatorType, WithId} from '@types'
|
|
3
3
|
import {empty, of} from 'rxjs'
|
|
4
4
|
import {filter, mergeMap, withLatestFrom} from 'rxjs/operators'
|
package/src/modules/selectors.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {createSelector} from '@reduxjs/toolkit'
|
|
2
|
-
import {CardAssetData, CardUploadData} from '@types'
|
|
2
|
+
import type {CardAssetData, CardUploadData} from '@types'
|
|
3
3
|
|
|
4
|
-
import {RootReducerState} from './types'
|
|
4
|
+
import type {RootReducerState} from './types'
|
|
5
5
|
|
|
6
6
|
export const selectCombinedItems = createSelector(
|
|
7
7
|
[
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {createSelector, createSlice, PayloadAction} from '@reduxjs/toolkit'
|
|
1
|
+
import {createSelector, createSlice, type PayloadAction} from '@reduxjs/toolkit'
|
|
2
2
|
import type {ClientError, Transaction} from '@sanity/client'
|
|
3
3
|
import type {Asset, HttpError, MyEpic, TagSelectOption, Tag, TagItem} from '@types'
|
|
4
4
|
import groq from 'groq'
|
|
5
|
-
import {Selector} from 'react-redux'
|
|
5
|
+
import type {Selector} from 'react-redux'
|
|
6
6
|
import {ofType} from 'redux-observable'
|
|
7
7
|
import {from, Observable, of} from 'rxjs'
|
|
8
8
|
import {bufferTime, catchError, filter, mergeMap, switchMap, withLatestFrom} from 'rxjs/operators'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {createSelector, createSlice, PayloadAction} from '@reduxjs/toolkit'
|
|
1
|
+
import {createSelector, createSlice, type PayloadAction} from '@reduxjs/toolkit'
|
|
2
2
|
import type {ClientError, SanityAssetDocument, SanityImageAssetDocument} from '@sanity/client'
|
|
3
3
|
import type {HttpError, MyEpic, SanityUploadProgressEvent, UploadItem} from '@types'
|
|
4
4
|
import groq from 'groq'
|
|
5
|
-
import {Selector} from 'react-redux'
|
|
5
|
+
import type {Selector} from 'react-redux'
|
|
6
6
|
import {empty, merge, of} from 'rxjs'
|
|
7
7
|
import {catchError, delay, filter, mergeMap, takeUntil, withLatestFrom} from 'rxjs/operators'
|
|
8
8
|
import constructFilter from '../../utils/constructFilter'
|
package/src/plugin.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {AssetSource, Tool as SanityTool, definePlugin} from 'sanity'
|
|
2
|
+
import {type AssetSource, type Tool as SanityTool, definePlugin} from 'sanity'
|
|
3
3
|
import {ImageIcon} from '@sanity/icons'
|
|
4
4
|
import FormBuilderTool from './components/FormBuilderTool'
|
|
5
5
|
import Tool from './components/Tool'
|
|
6
6
|
import mediaTag from './schemas/tag'
|
|
7
|
-
import {MediaToolOptions} from '@types'
|
|
7
|
+
import type {MediaToolOptions} from '@types'
|
|
8
8
|
import {ToolOptionsProvider} from './contexts/ToolOptionsContext'
|
|
9
9
|
|
|
10
10
|
const plugin = {
|
|
@@ -20,7 +20,9 @@ export const mediaAssetSource = {
|
|
|
20
20
|
|
|
21
21
|
const tool = {
|
|
22
22
|
...plugin,
|
|
23
|
-
component: Tool
|
|
23
|
+
component: Tool,
|
|
24
|
+
// @ts-expect-error TS doesn't know about this internal field see https://github.com/sanity-io/sanity/pull/7980
|
|
25
|
+
__internalApplicationType: 'sanity/media'
|
|
24
26
|
} satisfies SanityTool
|
|
25
27
|
|
|
26
28
|
export const media = definePlugin<MediaToolOptions | void>(options => ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {AddIcon, ChevronDownIcon, CloseIcon} from '@sanity/icons'
|
|
2
|
-
import {Box, Card, Flex, rem, studioTheme, Text, ThemeColorSchemeKey} from '@sanity/ui'
|
|
2
|
+
import {Box, Card, Flex, rem, studioTheme, Text, type ThemeColorSchemeKey} from '@sanity/ui'
|
|
3
3
|
import React from 'react'
|
|
4
|
-
import {components, StylesConfig} from 'react-select'
|
|
4
|
+
import {components, type StylesConfig} from 'react-select'
|
|
5
5
|
import {Virtuoso} from 'react-virtuoso'
|
|
6
6
|
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {CloseIcon} from '@sanity/icons'
|
|
2
|
-
import {Box, Card, rem, studioTheme, Text, ThemeColorSchemeKey} from '@sanity/ui'
|
|
2
|
+
import {Box, Card, rem, studioTheme, Text, type ThemeColorSchemeKey} from '@sanity/ui'
|
|
3
3
|
import React from 'react'
|
|
4
|
-
import {components, StylesConfig} from 'react-select'
|
|
4
|
+
import {components, type StylesConfig} from 'react-select'
|
|
5
5
|
import {Virtuoso} from 'react-virtuoso'
|
|
6
6
|
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
7
7
|
|
package/src/types/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {AnyAction} from '@reduxjs/toolkit'
|
|
1
|
+
import type {AnyAction} from '@reduxjs/toolkit'
|
|
2
2
|
import type {
|
|
3
3
|
SanityAssetDocument,
|
|
4
4
|
SanityClient,
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
import type {Epic} from 'redux-observable'
|
|
9
9
|
import * as z from 'zod'
|
|
10
10
|
import {assetFormSchema, tagFormSchema, tagOptionSchema} from '../formSchema'
|
|
11
|
-
import {RootReducerState} from '../modules/types'
|
|
11
|
+
import type {RootReducerState} from '../modules/types'
|
|
12
12
|
|
|
13
13
|
export type MediaToolOptions = {
|
|
14
14
|
maximumUploadSize?: number
|
package/src/utils/imageDprUrl.ts
CHANGED
package/src/utils/typeGuards.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// https://github.com/sanity-io/sanity/blob/ccb777e115a8cdf20d81a9a2bc9d8c228568faff/packages/%40sanity/form-builder/src/sanity/inputs/client-adapters/assets.ts
|
|
3
3
|
|
|
4
4
|
import type {SanityAssetDocument, SanityClient, SanityImageAssetDocument} from '@sanity/client'
|
|
5
|
-
import {HttpError} from '@types'
|
|
5
|
+
import type {HttpError} from '@types'
|
|
6
6
|
import {Observable, of, throwError} from 'rxjs'
|
|
7
7
|
import {map, mergeMap} from 'rxjs/operators'
|
|
8
8
|
import {withMaxConcurrency} from './withMaxConcurrency'
|