@electrolux-oss/sanity-plugin-media 1.0.3 → 2.0.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/README.md +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Sanity Media Plugin - Electrolux Version (for Sanity Studio
|
|
1
|
+
# Sanity Media Plugin - Electrolux Version (for Sanity Studio v4)
|
|
2
2
|
|
|
3
|
-
> This plugin is for **Sanity Studio
|
|
3
|
+
> This plugin is for **Sanity Studio v4**.
|
|
4
4
|
> This is a forked version of Sanitys own [Media Plugin (v4.0.0)](https://github.com/sanity-io/sanity-plugin-media)
|
|
5
5
|
|
|
6
6
|
## What is it?
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AssetSourceComponentProps } from 'sanity'
|
|
2
2
|
import { ForwardRefExoticComponent } from 'react'
|
|
3
|
-
import { JSX
|
|
3
|
+
import { JSX } from 'react'
|
|
4
4
|
import { Plugin as Plugin_2 } from 'sanity'
|
|
5
5
|
import { RefAttributes } from 'react'
|
|
6
6
|
import { SVGProps } from 'react'
|
|
@@ -8,7 +8,7 @@ import { SVGProps } from 'react'
|
|
|
8
8
|
export declare const media: Plugin_2<void | MediaToolOptions>
|
|
9
9
|
|
|
10
10
|
export declare const mediaAssetSource: {
|
|
11
|
-
component: (props: AssetSourceComponentProps) =>
|
|
11
|
+
component: (props: AssetSourceComponentProps) => JSX.Element
|
|
12
12
|
icon: ForwardRefExoticComponent<
|
|
13
13
|
Omit<SVGProps<SVGSVGElement>, 'ref'> & RefAttributes<SVGSVGElement>
|
|
14
14
|
>
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AssetSourceComponentProps } from 'sanity'
|
|
2
2
|
import { ForwardRefExoticComponent } from 'react'
|
|
3
|
-
import { JSX
|
|
3
|
+
import { JSX } from 'react'
|
|
4
4
|
import { Plugin as Plugin_2 } from 'sanity'
|
|
5
5
|
import { RefAttributes } from 'react'
|
|
6
6
|
import { SVGProps } from 'react'
|
|
@@ -8,7 +8,7 @@ import { SVGProps } from 'react'
|
|
|
8
8
|
export declare const media: Plugin_2<void | MediaToolOptions>
|
|
9
9
|
|
|
10
10
|
export declare const mediaAssetSource: {
|
|
11
|
-
component: (props: AssetSourceComponentProps) =>
|
|
11
|
+
component: (props: AssetSourceComponentProps) => JSX.Element
|
|
12
12
|
icon: ForwardRefExoticComponent<
|
|
13
13
|
Omit<SVGProps<SVGSVGElement>, 'ref'> & RefAttributes<SVGSVGElement>
|
|
14
14
|
>
|
package/dist/index.js
CHANGED
|
@@ -4045,7 +4045,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
4045
4045
|
`
|
|
4046
4046
|
), StyledWarningOutlineIcon = styledComponents.styled(icons.WarningFilledIcon)(({ theme }) => ({
|
|
4047
4047
|
color: theme.sanity.color.spot.red
|
|
4048
|
-
})), CardAsset = (props) => {
|
|
4048
|
+
})), CardAsset$1 = (props) => {
|
|
4049
4049
|
const { id, selected } = props, scheme = sanity.useColorSchemeValue(), shiftPressed = useKeyPress("shift"), dispatch = reactRedux.useDispatch(), lastPicked = useTypedSelector((state) => state.assets.lastPicked), item = useTypedSelector((state) => selectAssetById(state, id)), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, { onSelect } = useAssetSourceActions();
|
|
4050
4050
|
if (!asset)
|
|
4051
4051
|
return null;
|
|
@@ -4175,7 +4175,7 @@ const imageDprUrl = (asset, options) => {
|
|
|
4175
4175
|
)
|
|
4176
4176
|
] }) });
|
|
4177
4177
|
};
|
|
4178
|
-
var CardAsset
|
|
4178
|
+
var CardAsset = react.memo(CardAsset$1);
|
|
4179
4179
|
const PREVIEW_WIDTH = 180, createBlob = (img) => new Promise((resolve) => {
|
|
4180
4180
|
const imageAspect = img.width / img.height, canvas = document.createElement("canvas");
|
|
4181
4181
|
canvas.width = PREVIEW_WIDTH, canvas.height = Math.max(PREVIEW_WIDTH / imageAspect, 1);
|
|
@@ -4532,7 +4532,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4532
4532
|
}
|
|
4533
4533
|
) });
|
|
4534
4534
|
}, CARD_HEIGHT = 220, CARD_WIDTH = 240, VirtualCell = react.memo(
|
|
4535
|
-
({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsxRuntime.jsx(CardAsset
|
|
4535
|
+
({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsxRuntime.jsx(CardAsset, { id: item.id, selected }) : item?.type === "upload" ? /* @__PURE__ */ jsxRuntime.jsx(CardUpload, { id: item.id }) : null
|
|
4536
4536
|
), StyledItemContainer = styledComponents.styled.div`
|
|
4537
4537
|
height: ${CARD_HEIGHT}px;
|
|
4538
4538
|
width: ${CARD_WIDTH}px;
|
|
@@ -4697,7 +4697,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4697
4697
|
`
|
|
4698
4698
|
), StyledWarningIcon = styledComponents.styled(icons.WarningFilledIcon)(({ theme }) => ({
|
|
4699
4699
|
color: theme.sanity.color.spot.red
|
|
4700
|
-
})), TableRowAsset = (props) => {
|
|
4700
|
+
})), TableRowAsset$1 = (props) => {
|
|
4701
4701
|
const { id, selected } = props, scheme = sanity.useColorSchemeValue(), shiftPressed = useKeyPress("shift"), [referenceCountVisible, setReferenceCountVisible] = react.useState(!1), refCountVisibleTimeout = react.useRef(null), dispatch = reactRedux.useDispatch(), lastPicked = useTypedSelector((state) => state.assets.lastPicked), item = useTypedSelector((state) => selectAssetById(state, id)), mediaIndex = ui.useMediaIndex(), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, { onSelect } = useAssetSourceActions(), handleContextActionClick = react.useCallback(
|
|
4702
4702
|
(e) => {
|
|
4703
4703
|
e.stopPropagation(), asset && (onSelect ? dispatch(dialogActions.showAssetEdit({ assetId: asset._id })) : shiftPressed.current && !picked ? dispatch(assetsActions.pickRange({ startId: lastPicked || asset._id, endId: asset._id })) : dispatch(assetsActions.pick({ assetId: asset._id, picked: !picked })));
|
|
@@ -4923,7 +4923,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
|
|
|
4923
4923
|
}
|
|
4924
4924
|
) : null;
|
|
4925
4925
|
};
|
|
4926
|
-
var TableRowAsset
|
|
4926
|
+
var TableRowAsset = react.memo(TableRowAsset$1);
|
|
4927
4927
|
const TableRowUpload = (props) => {
|
|
4928
4928
|
const { id } = props, scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), item = useTypedSelector((state) => selectUploadById(state, id)), mediaIndex = ui.useMediaIndex();
|
|
4929
4929
|
if (!item)
|
|
@@ -5037,7 +5037,7 @@ const TableRowUpload = (props) => {
|
|
|
5037
5037
|
}
|
|
5038
5038
|
);
|
|
5039
5039
|
}, VirtualRow = react.memo(
|
|
5040
|
-
({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { style: { height: "100px" }, children: /* @__PURE__ */ jsxRuntime.jsx(TableRowAsset
|
|
5040
|
+
({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { style: { height: "100px" }, children: /* @__PURE__ */ jsxRuntime.jsx(TableRowAsset, { id: item.id, selected }) }) : item?.type === "upload" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { style: { height: "100px" }, children: /* @__PURE__ */ jsxRuntime.jsx(TableRowUpload, { id: item.id }) }) : null
|
|
5041
5041
|
), AssetTableVirtualized = (props) => {
|
|
5042
5042
|
const { items, onLoadMore } = props, selectedAssets = useTypedSelector((state) => state.selected.assets), selectedIds = selectedAssets && selectedAssets.map((asset) => asset._id) || [], totalCount = items?.length;
|
|
5043
5043
|
return totalCount === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(
|