sanity-plugin-media 6.1.7 → 6.2.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 +6 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +62 -45
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -124,6 +124,12 @@ export default defineConfig({
|
|
|
124
124
|
// any of these tags are omitted from the Media browser grid and asset picker queries,
|
|
125
125
|
// and those tags are hidden in the tag sidebar and tag search facet. The asset edit
|
|
126
126
|
// dialog still lists all tags so you can assign or remove them on an open asset.
|
|
127
|
+
showMediaLibraryAssets: true,
|
|
128
|
+
// boolean (optional, default true) - when false, assets managed by the Sanity Media
|
|
129
|
+
// Library are omitted from the Media browser grid, asset picker queries, folder counts
|
|
130
|
+
// and realtime listeners. Media Library assets are detected by their `media` reference
|
|
131
|
+
// (`media-library:...`) - the reliable signal - with `source.name`
|
|
132
|
+
// (`sanity-media-library`) as an optional confirmation.
|
|
127
133
|
components: {
|
|
128
134
|
details: CustomDetails,
|
|
129
135
|
// Custom component for asset details (see below)
|
package/dist/index.d.ts
CHANGED
|
@@ -139,6 +139,15 @@ type MediaToolOptions = {
|
|
|
139
139
|
* https://www.sanity.io/docs/studio/localization#k4da239411955
|
|
140
140
|
*/
|
|
141
141
|
locales?: Locale[];
|
|
142
|
+
/**
|
|
143
|
+
* When `false`, assets managed by the Sanity Media Library are omitted from
|
|
144
|
+
* the Media browser grid, asset source/picker queries, folder counts and
|
|
145
|
+
* realtime listeners. Media Library assets are detected by their `media`
|
|
146
|
+
* reference (`media-library:...`) — the reliable signal — with `source.name`
|
|
147
|
+
* (`sanity-media-library`) as an optional confirmation. Defaults to `true`
|
|
148
|
+
* (Media Library assets are shown).
|
|
149
|
+
*/
|
|
150
|
+
showMediaLibraryAssets?: boolean;
|
|
142
151
|
};
|
|
143
152
|
type Locale = {
|
|
144
153
|
title: string;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/components/FormBuilderTool/index.tsx","../src/components/DialogAssetEdit/Details.tsx","../src/formSchema/index.ts","../src/types/index.ts","../src/plugin.tsx","../src/components/AutoTagInputWrapper/index.tsx","../src/utils/mediaField.ts"],"mappings":";;;;;;;;cAQM,kBAAe,OAAW,8CAAyB,IAAA;KCsB7C;EACV;EACA,kBAAkB;EAClB,SAAS,QAAQ;EACjB,QAAQ,YAAY;EACpB,UAAU,gBAAgB;EAC1B,eAAe;EACf,iBAAiB;EACjB,cAAc;EACd;EACA;EACA;EACA;EACA;IACE;IACA;;EAEF,UAAU;;cCjCC,iBAAe,EAAA;;;;;;;;;;iBAKZ,mBAAmB;EAAW;MAAa,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCJ/C;EACV;;KAGU;EACV;EACA;EACA;IACE,UAAU,cACR;MAAgB,uBAAuB,OAAO,iBAAiB,IAAI;;;EAGvE;IACE;IACA;;EAEF;;;;;;;EAOA;;;;;EAKA,UAAU;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/components/FormBuilderTool/index.tsx","../src/components/DialogAssetEdit/Details.tsx","../src/formSchema/index.ts","../src/types/index.ts","../src/plugin.tsx","../src/components/AutoTagInputWrapper/index.tsx","../src/utils/mediaField.ts"],"mappings":";;;;;;;;cAQM,kBAAe,OAAW,8CAAyB,IAAA;KCsB7C;EACV;EACA,kBAAkB;EAClB,SAAS,QAAQ;EACjB,QAAQ,YAAY;EACpB,UAAU,gBAAgB;EAC1B,eAAe;EACf,iBAAiB;EACjB,cAAc;EACd;EACA;EACA;EACA;EACA;IACE;IACA;;EAEF,UAAU;;cCjCC,iBAAe,EAAA;;;;;;;;;;iBAKZ,mBAAmB;EAAW;MAAa,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCJ/C;EACV;;KAGU;EACV;EACA;EACA;IACE,UAAU,cACR;MAAgB,uBAAuB,OAAO,iBAAiB,IAAI;;;EAGvE;IACE;IACA;;EAEF;;;;;;;EAOA;;;;;EAKA,UAAU;;;;;;;;;EASV;;KAGU;EACV;EACA;GACC;;KAGE,2BAA2B;KAE3B;EACH,UAAU;EACV,cAAc;EACd;IACE;MACE,SAAS;MACT,OAAO;;;EAGX,QAAQ;;KAYE,QAAQ,YAAY;KAEpB,gBAAgB,EAAE,MAAM,kBAAkB;KAgJ1C,YAAY,sBACtB;EACE;;KAuBQ,aAAa,2BACvB;EACE;EACA,aAAa;;KAqBL;EACV;EACA;EACA;;KA0IU,kBAAkB,EAAE,aAAa;cClZhC;;;;;;cAmBA,wBAAK,cAAA;KCrBN,oBAAoB;EAC9B;;;;;;;;;;;;;;;;;;;;;iBAsBc,aAAa,OAAO,oCAAiB,IAAA;KC7BhD,wBAAwB,KAAK,8BAChC;EACE;EACA;EACA,UAAU;;KAGT,uBAAuB,KAAK,6BAC/B;EACE;EACA;EACA,UAAU;;KAGT,wBAAwB,KAAK,8BAChC;EACE,UAAU;IAA8B;;EACxC;IAAa,cAAc;;IACzB,kBACJ;KAEG,uBAAuB,KAAK,6BAC/B;EACE,UAAU;IAA6B;;EACvC;IAAa,cAAc;;IACzB,kBACJ;;;;;;;;;;;;;;;;;;;;;;iBAuBc,WAAW,QAAQ,wBAAwB;iBAC3C,WAAW,QAAQ,uBAAuB"}
|
package/dist/index.js
CHANGED
|
@@ -501,10 +501,10 @@ const useTypedSelector = useSelector, useVersionedClient = () => {
|
|
|
501
501
|
}, buildExcludeTagsFragment = (excludeTagSlugs) => {
|
|
502
502
|
let serializedExcludeTagSlugs = excludeTagSlugs?.length ? JSON.stringify(excludeTagSlugs) : void 0;
|
|
503
503
|
return serializedExcludeTagSlugs ? groq`!(defined(opt.media.tags) && count(opt.media.tags[@._ref in *[_type == "${TAG_DOCUMENT_NAME}" && name.current in ${serializedExcludeTagSlugs}]._id]) > 0)` : void 0;
|
|
504
|
-
}, constructFilter = ({ assetTypes, currentFolderId, excludeTagSlugs, searchFacets, searchQuery }) => {
|
|
504
|
+
}, buildExcludeMediaLibraryFragment = (showMediaLibraryAssets) => showMediaLibraryAssets ? void 0 : groq`(!defined(source.name) || source.name != "${"sanity-media-library"}") && (!defined(media._ref) || !string::startsWith(media._ref, "${"media-library:"}"))`, constructFilter = ({ assetTypes, currentFolderId, excludeTagSlugs, searchFacets, searchQuery, showMediaLibraryAssets = !0 }) => {
|
|
505
505
|
let documentAssetTypes = assetTypes.map((type) => `sanity.${type}Asset`), baseFilter = groq`
|
|
506
506
|
_type in ${JSON.stringify(documentAssetTypes)} && !(_id in path("drafts.**"))
|
|
507
|
-
`, excludeTagsFragment = buildExcludeTagsFragment(excludeTagSlugs), searchFacetFragments = searchFacets.reduce((acc, facet) => {
|
|
507
|
+
`, excludeTagsFragment = buildExcludeTagsFragment(excludeTagSlugs), excludeMediaLibraryFragment = buildExcludeMediaLibraryFragment(showMediaLibraryAssets), searchFacetFragments = searchFacets.reduce((acc, facet) => {
|
|
508
508
|
if (facet.type === "number") {
|
|
509
509
|
let { field, modifier, modifiers, operatorType, value } = facet, operator = operators[operatorType], currentModifier = modifiers?.find((m) => m.name === modifier), facetField = currentModifier?.fieldModifier ? currentModifier.fieldModifier(field) : field, fragment = operator.fn(value, facetField);
|
|
510
510
|
fragment && acc.push(fragment);
|
|
@@ -525,6 +525,7 @@ const useTypedSelector = useSelector, useVersionedClient = () => {
|
|
|
525
525
|
}, []), folderFilter = currentFolderId ? `opt.media.folder._ref == ${JSON.stringify(currentFolderId)}` : void 0;
|
|
526
526
|
return [
|
|
527
527
|
baseFilter,
|
|
528
|
+
...excludeMediaLibraryFragment ? [excludeMediaLibraryFragment] : [],
|
|
528
529
|
...excludeTagsFragment ? [excludeTagsFragment] : [],
|
|
529
530
|
...searchQuery ? [groq`[_id, altText, assetId, creditLine, description, originalFilename, title, url] match '*${searchQuery.trim()}*'`] : [],
|
|
530
531
|
...folderFilter ? [folderFilter] : [],
|
|
@@ -914,6 +915,7 @@ const UPLOADS_ACTIONS = { uploadComplete: createAction("uploads/uploadComplete",
|
|
|
914
915
|
},
|
|
915
916
|
pageIndex: 0,
|
|
916
917
|
pageSize: 100,
|
|
918
|
+
showMediaLibraryAssets: !0,
|
|
917
919
|
view: "grid"
|
|
918
920
|
}, assetsSlice = createSlice({
|
|
919
921
|
name: "assets",
|
|
@@ -1173,7 +1175,8 @@ const UPLOADS_ACTIONS = { uploadComplete: createAction("uploads/uploadComplete",
|
|
|
1173
1175
|
currentFolderId: state.folders.currentFolderId,
|
|
1174
1176
|
excludeTagSlugs: state.assets.excludeTagSlugs,
|
|
1175
1177
|
searchFacets: state.search.facets,
|
|
1176
|
-
searchQuery: state.search.query
|
|
1178
|
+
searchQuery: state.search.query,
|
|
1179
|
+
showMediaLibraryAssets: state.assets.showMediaLibraryAssets
|
|
1177
1180
|
}), params = {
|
|
1178
1181
|
...documentId ? { documentId } : {},
|
|
1179
1182
|
documentAssetIds
|
|
@@ -1392,7 +1395,7 @@ const initialState = {
|
|
|
1392
1395
|
}
|
|
1393
1396
|
}
|
|
1394
1397
|
}), foldersFetchEpic = (action$, state$, { client }) => action$.pipe(filter(foldersSlice.actions.fetchRequest.match), withLatestFrom(state$), switchMap(([action, state]) => of(action).pipe(debugThrottle(state.debug.badConnection), mergeMap(() => {
|
|
1395
|
-
let assetTypes = state.assets.assetTypes.map((type) => `sanity.${type}Asset`),
|
|
1398
|
+
let assetTypes = state.assets.assetTypes.map((type) => `sanity.${type}Asset`), excludeAssetsClause = [buildExcludeTagsFragment(state.assets.excludeTagSlugs), buildExcludeMediaLibraryFragment(state.assets.showMediaLibraryAssets)].filter(Boolean).map((fragment) => `&& ${fragment}`).join("\n ");
|
|
1396
1399
|
return client.observable.fetch(groq`{
|
|
1397
1400
|
"folders": *[
|
|
1398
1401
|
_type == "${FOLDER_DOCUMENT_NAME}"
|
|
@@ -1405,14 +1408,14 @@ const initialState = {
|
|
|
1405
1408
|
_type in ${JSON.stringify(assetTypes)}
|
|
1406
1409
|
&& !(_id in path("drafts.**"))
|
|
1407
1410
|
&& opt.media.folder._ref == ^._id
|
|
1408
|
-
${
|
|
1411
|
+
${excludeAssetsClause}
|
|
1409
1412
|
])
|
|
1410
1413
|
},
|
|
1411
1414
|
"unfiledCount": count(*[
|
|
1412
1415
|
_type in ${JSON.stringify(assetTypes)}
|
|
1413
1416
|
&& !(_id in path("drafts.**"))
|
|
1414
1417
|
&& !defined(opt.media.folder._ref)
|
|
1415
|
-
${
|
|
1418
|
+
${excludeAssetsClause}
|
|
1416
1419
|
])
|
|
1417
1420
|
}`);
|
|
1418
1421
|
}), mergeMap((result) => {
|
|
@@ -1793,7 +1796,8 @@ const customScrollbar = css`::-webkit-scrollbar{width:14px;}::-webkit-scrollbar-
|
|
|
1793
1796
|
},
|
|
1794
1797
|
directUploads: options?.directUploads ?? !0,
|
|
1795
1798
|
excludeTagSlugs: options?.excludeTags?.length ? [...options.excludeTags] : [],
|
|
1796
|
-
locales: options?.locales
|
|
1799
|
+
locales: options?.locales,
|
|
1800
|
+
showMediaLibraryAssets: options?.showMediaLibraryAssets ?? !0
|
|
1797
1801
|
};
|
|
1798
1802
|
}, [
|
|
1799
1803
|
options?.creditLine?.enabled,
|
|
@@ -1803,7 +1807,8 @@ const customScrollbar = css`::-webkit-scrollbar{width:14px;}::-webkit-scrollbar-
|
|
|
1803
1807
|
options?.excludeTags,
|
|
1804
1808
|
options?.maximumUploadSize,
|
|
1805
1809
|
options?.directUploads,
|
|
1806
|
-
options?.locales
|
|
1810
|
+
options?.locales,
|
|
1811
|
+
options?.showMediaLibraryAssets
|
|
1807
1812
|
]);
|
|
1808
1813
|
return /* @__PURE__ */ jsx(ToolOptionsContext.Provider, {
|
|
1809
1814
|
value,
|
|
@@ -2882,7 +2887,7 @@ const DialogAssetEdit = (props) => {
|
|
|
2882
2887
|
t19 = !0;
|
|
2883
2888
|
break bb0;
|
|
2884
2889
|
}
|
|
2885
|
-
let configuredIds = new Set(locales.map(_temp4$
|
|
2890
|
+
let configuredIds = new Set(locales.map(_temp4$6));
|
|
2886
2891
|
t19 = fields.some((f_0) => isLocaleObj(f_0) ? Object.keys(f_0).some((k) => !configuredIds.has(k)) : !1);
|
|
2887
2892
|
}
|
|
2888
2893
|
$[41] = currentAsset, $[42] = locales, $[43] = t19;
|
|
@@ -3190,7 +3195,7 @@ function _temp2$22(field_0, t0) {
|
|
|
3190
3195
|
function _temp3$10(v_0) {
|
|
3191
3196
|
return typeof v_0 == "object" && !!v_0 && !Array.isArray(v_0);
|
|
3192
3197
|
}
|
|
3193
|
-
function _temp4$
|
|
3198
|
+
function _temp4$6(l) {
|
|
3194
3199
|
return l.id;
|
|
3195
3200
|
}
|
|
3196
3201
|
function _temp5$4(v_1) {
|
|
@@ -3712,7 +3717,8 @@ const createThrottler = (concurrency = 4) => {
|
|
|
3712
3717
|
currentFolderId: state.folders.currentFolderId,
|
|
3713
3718
|
excludeTagSlugs: state.assets.excludeTagSlugs,
|
|
3714
3719
|
searchFacets: state.search.facets,
|
|
3715
|
-
searchQuery: state.search.query
|
|
3720
|
+
searchQuery: state.search.query,
|
|
3721
|
+
showMediaLibraryAssets: state.assets.showMediaLibraryAssets
|
|
3716
3722
|
}), query = groq`
|
|
3717
3723
|
*[${constructedFilter} && _id in $documentIds].sha1hash
|
|
3718
3724
|
`;
|
|
@@ -3962,7 +3968,7 @@ function omitFacetId(facet) {
|
|
|
3962
3968
|
return withoutId;
|
|
3963
3969
|
}
|
|
3964
3970
|
const ReplaceAssetsOverview = () => {
|
|
3965
|
-
let $ = c(36), dispatch = useDispatch(), store = useStore(), combinedItems = useTypedSelector(selectCombinedItems), assetsById = useTypedSelector(_temp$33), fetchCount = useTypedSelector(_temp2$19), fetching = useTypedSelector(_temp3$9), fetchingError = useTypedSelector(_temp4$
|
|
3971
|
+
let $ = c(36), dispatch = useDispatch(), store = useStore(), combinedItems = useTypedSelector(selectCombinedItems), assetsById = useTypedSelector(_temp$33), fetchCount = useTypedSelector(_temp2$19), fetching = useTypedSelector(_temp3$9), fetchingError = useTypedSelector(_temp4$5), pageSize = useTypedSelector(_temp5$3), searchQuery = useTypedSelector(_temp6$1), searchFacets = useTypedSelector(_temp7), currentFolderId = useTypedSelector(_temp8), currentFolderUnfiled = useTypedSelector(_temp9), assetToReplaceId = useTypedSelector(_temp11), savedBrowserStateRef = useRef(null), t0;
|
|
3966
3972
|
$[0] !== currentFolderId || $[1] !== currentFolderUnfiled || $[2] !== searchFacets || $[3] !== searchQuery.length ? (t0 = () => searchQuery.length > 0 || searchFacets.length > 0 || !!currentFolderId || currentFolderUnfiled, $[0] = currentFolderId, $[1] = currentFolderUnfiled, $[2] = searchFacets, $[3] = searchQuery.length, $[4] = t0) : t0 = $[4];
|
|
3967
3973
|
let [awaitingRefetch, setAwaitingRefetch] = useState(t0), t1, t2;
|
|
3968
3974
|
$[5] !== dispatch || $[6] !== store ? (t1 = () => {
|
|
@@ -4052,7 +4058,7 @@ function _temp2$19(state_0) {
|
|
|
4052
4058
|
function _temp3$9(state_1) {
|
|
4053
4059
|
return state_1.assets.fetching;
|
|
4054
4060
|
}
|
|
4055
|
-
function _temp4$
|
|
4061
|
+
function _temp4$5(state_2) {
|
|
4056
4062
|
return state_2.assets.fetchingError;
|
|
4057
4063
|
}
|
|
4058
4064
|
function _temp5$3(state_3) {
|
|
@@ -5400,7 +5406,7 @@ const SearchFacetsControl = () => {
|
|
|
5400
5406
|
if ($[0] !== assetTypes || $[1] !== creditLine?.enabled || $[2] !== dispatch || $[3] !== isTool || $[4] !== searchFacets) {
|
|
5401
5407
|
let t3;
|
|
5402
5408
|
$[11] !== assetTypes || $[12] !== creditLine?.enabled || $[13] !== isTool ? (t3 = (facet) => !creditLine?.enabled && facet?.type === "string" && facet?.name === "creditLine" ? !1 : facet.type === "group" || facet.type === "divider" ? !0 : isTool ? !facet?.selectOnly : facet.assetTypes.filter((assetType) => assetTypes.includes(assetType)).length > 0, $[11] = assetTypes, $[12] = creditLine?.enabled, $[13] = isTool, $[14] = t3) : t3 = $[14];
|
|
5403
|
-
let filteredFacets = FACETS.filter(t3).filter(_temp4$
|
|
5409
|
+
let filteredFacets = FACETS.filter(t3).filter(_temp4$4), hasSearchFacets = filteredFacets.length > 0, renderMenuFacets = (facets_0, t4) => {
|
|
5404
5410
|
let level = t4 === void 0 ? 0 : t4;
|
|
5405
5411
|
return /* @__PURE__ */ jsx(Fragment, { children: facets_0?.map((facet_1, index_0) => {
|
|
5406
5412
|
if (facet_1.type === "divider") return /* @__PURE__ */ jsx(MenuDivider, {}, index_0);
|
|
@@ -5467,7 +5473,7 @@ function _temp2$13(state_0) {
|
|
|
5467
5473
|
function _temp3$6(state_1) {
|
|
5468
5474
|
return state_1.selected.document;
|
|
5469
5475
|
}
|
|
5470
|
-
function _temp4$
|
|
5476
|
+
function _temp4$4(facet_0, index, facets) {
|
|
5471
5477
|
let previousFacet = facets[index - 1];
|
|
5472
5478
|
return !(facet_0.type === "divider" && (index === 0 || index === facets.length - 1) || facet_0.type === "divider" && previousFacet?.type === "divider");
|
|
5473
5479
|
}
|
|
@@ -5898,7 +5904,7 @@ const TagContainer = styled(Flex).withConfig({
|
|
|
5898
5904
|
let tagIdsSegmented = pickedTagIdsUnique.reduce(t1, {
|
|
5899
5905
|
appliedToAll: [],
|
|
5900
5906
|
appliedToSome: []
|
|
5901
|
-
}), tagsAppliedToAll = tags.filter((tag_1) => tagIdsSegmented.appliedToAll.includes(tag_1.tag._id)).map(_temp3$5), tagsAppliedToSome = tags.filter((tag_2) => tagIdsSegmented.appliedToSome.includes(tag_2.tag._id)).map(_temp4$
|
|
5907
|
+
}), tagsAppliedToAll = tags.filter((tag_1) => tagIdsSegmented.appliedToAll.includes(tag_1.tag._id)).map(_temp3$5), tagsAppliedToSome = tags.filter((tag_2) => tagIdsSegmented.appliedToSome.includes(tag_2.tag._id)).map(_temp4$3), tagsUnused = tags.filter((tag_3) => !pickedTagIdsUnique.includes(tag_3.tag._id)).map(_temp5$2);
|
|
5902
5908
|
items = [], assetsPicked.length === 0 ? items = tags.map(_temp6) : (tagsAppliedToAll?.length > 0 && (items = [
|
|
5903
5909
|
...items,
|
|
5904
5910
|
assetsPicked.length === 1 ? "Used" : "Used by all",
|
|
@@ -5956,7 +5962,7 @@ function _temp3$5(tagItem) {
|
|
|
5956
5962
|
]
|
|
5957
5963
|
};
|
|
5958
5964
|
}
|
|
5959
|
-
function _temp4$
|
|
5965
|
+
function _temp4$3(tagItem_0) {
|
|
5960
5966
|
return {
|
|
5961
5967
|
...tagItem_0,
|
|
5962
5968
|
actions: [
|
|
@@ -6311,7 +6317,8 @@ function createReduxStore(props) {
|
|
|
6311
6317
|
assets: {
|
|
6312
6318
|
...initialState$1,
|
|
6313
6319
|
assetTypes: isSupportedAssetType(props?.assetType) ? [props.assetType] : ["file", "image"],
|
|
6314
|
-
excludeTagSlugs: props.excludeTagSlugs?.length ? [...props.excludeTagSlugs] : []
|
|
6320
|
+
excludeTagSlugs: props.excludeTagSlugs?.length ? [...props.excludeTagSlugs] : [],
|
|
6321
|
+
showMediaLibraryAssets: props.showMediaLibraryAssets ?? !0
|
|
6315
6322
|
},
|
|
6316
6323
|
debug: {
|
|
6317
6324
|
badConnection: !1,
|
|
@@ -6356,27 +6363,32 @@ function createReduxStore(props) {
|
|
|
6356
6363
|
}
|
|
6357
6364
|
}
|
|
6358
6365
|
});
|
|
6359
|
-
|
|
6366
|
+
epicMiddleware.run((action$, state$, dependencies) => rootEpic(action$, state$, dependencies).pipe(takeUntil(action$.pipe(ofType(EPIC_END_TYPE)))));
|
|
6367
|
+
let pendingEnd = null;
|
|
6368
|
+
return {
|
|
6360
6369
|
store,
|
|
6361
|
-
|
|
6362
|
-
|
|
6370
|
+
scheduleEnd: () => {
|
|
6371
|
+
pendingEnd === null && (pendingEnd = setTimeout(() => {
|
|
6372
|
+
pendingEnd = null, store.dispatch({ type: EPIC_END_TYPE });
|
|
6373
|
+
}, 0));
|
|
6374
|
+
},
|
|
6375
|
+
cancelEnd: () => {
|
|
6376
|
+
pendingEnd !== null && (clearTimeout(pendingEnd), pendingEnd = null);
|
|
6363
6377
|
}
|
|
6364
6378
|
};
|
|
6365
6379
|
}
|
|
6366
6380
|
function ReduxProvider(t0) {
|
|
6367
|
-
let $ = c(
|
|
6381
|
+
let $ = c(12), children, props;
|
|
6368
6382
|
$[0] === t0 ? (children = $[1], props = $[2]) : ({children, ...props} = t0, $[0] = t0, $[1] = children, $[2] = props);
|
|
6369
6383
|
let t1;
|
|
6370
6384
|
$[3] === props ? t1 = $[4] : (t1 = () => createReduxStore(props), $[3] = props, $[4] = t1);
|
|
6371
|
-
let [t2] = useState(t1), {
|
|
6372
|
-
$[5]
|
|
6373
|
-
endEpics();
|
|
6374
|
-
}, t4 = [endEpics], $[5] = endEpics, $[6] = t3, $[7] = t4), useEffect(t3, t4);
|
|
6385
|
+
let [t2] = useState(t1), { cancelEnd, scheduleEnd, store } = t2, t3, t4;
|
|
6386
|
+
$[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);
|
|
6375
6387
|
let t5;
|
|
6376
|
-
return $[
|
|
6388
|
+
return $[9] !== children || $[10] !== store ? (t5 = /* @__PURE__ */ jsx(Provider, {
|
|
6377
6389
|
store,
|
|
6378
6390
|
children
|
|
6379
|
-
}), $[
|
|
6391
|
+
}), $[9] = children, $[10] = store, $[11] = t5) : t5 = $[11], t5;
|
|
6380
6392
|
}
|
|
6381
6393
|
/**
|
|
6382
6394
|
* Fetches the already-selected asset into the store and opens the `assetEdit`
|
|
@@ -6621,7 +6633,7 @@ function _temp$15(state) {
|
|
|
6621
6633
|
return state.search.query;
|
|
6622
6634
|
}
|
|
6623
6635
|
const Controls = () => {
|
|
6624
|
-
let $ = c(62), dispatch = useDispatch(), fetching = useTypedSelector(_temp$14), foldersPanelVisible = useTypedSelector(_temp2$8), pageIndex = useTypedSelector(_temp3$4), searchFacets = useTypedSelector(_temp4$
|
|
6636
|
+
let $ = c(62), dispatch = useDispatch(), fetching = useTypedSelector(_temp$14), foldersPanelVisible = useTypedSelector(_temp2$8), pageIndex = useTypedSelector(_temp3$4), searchFacets = useTypedSelector(_temp4$2), tagsPanelVisible = useTypedSelector(_temp5$1), mediaIndex = useMediaIndex(), t0;
|
|
6625
6637
|
$[0] === dispatch ? t0 = $[1] : (t0 = () => {
|
|
6626
6638
|
dispatch(dialogActions.showSearchFacets());
|
|
6627
6639
|
}, $[0] = dispatch, $[1] = t0);
|
|
@@ -6836,7 +6848,7 @@ function _temp2$8(state_0) {
|
|
|
6836
6848
|
function _temp3$4(state_1) {
|
|
6837
6849
|
return state_1.assets.pageIndex;
|
|
6838
6850
|
}
|
|
6839
|
-
function _temp4$
|
|
6851
|
+
function _temp4$2(state_2) {
|
|
6840
6852
|
return state_2.search.facets;
|
|
6841
6853
|
}
|
|
6842
6854
|
function _temp5$1(state_3) {
|
|
@@ -7919,7 +7931,7 @@ function _temp3$3() {
|
|
|
7919
7931
|
return /* @__PURE__ */ jsx(TableHeader, {});
|
|
7920
7932
|
}
|
|
7921
7933
|
const Items = () => {
|
|
7922
|
-
let $ = c(15), dispatch = useDispatch(), fetchCount = useTypedSelector(_temp$5), fetching = useTypedSelector(_temp2$3), foldersPanelVisible = useTypedSelector(_temp3$2), tagsPanelVisible = useTypedSelector(_temp4), view = useTypedSelector(_temp5), combinedItems = useTypedSelector(selectCombinedItems), mediaIndex = useMediaIndex(), hasFetchedOnce = fetchCount >= 0, hasItems = combinedItems.length > 0, t0;
|
|
7934
|
+
let $ = c(15), dispatch = useDispatch(), fetchCount = useTypedSelector(_temp$5), fetching = useTypedSelector(_temp2$3), foldersPanelVisible = useTypedSelector(_temp3$2), tagsPanelVisible = useTypedSelector(_temp4$1), view = useTypedSelector(_temp5), combinedItems = useTypedSelector(selectCombinedItems), mediaIndex = useMediaIndex(), hasFetchedOnce = fetchCount >= 0, hasItems = combinedItems.length > 0, t0;
|
|
7923
7935
|
$[0] !== dispatch || $[1] !== fetching ? (t0 = () => {
|
|
7924
7936
|
fetching || dispatch(assetsActions.loadNextPage());
|
|
7925
7937
|
}, $[0] = dispatch, $[1] = fetching, $[2] = t0) : t0 = $[2];
|
|
@@ -7963,7 +7975,7 @@ function _temp2$3(state_0) {
|
|
|
7963
7975
|
function _temp3$2(state_1) {
|
|
7964
7976
|
return state_1.folders.panelVisible;
|
|
7965
7977
|
}
|
|
7966
|
-
function _temp4(state_2) {
|
|
7978
|
+
function _temp4$1(state_2) {
|
|
7967
7979
|
return state_2.tags.panelVisible;
|
|
7968
7980
|
}
|
|
7969
7981
|
function _temp5(state_3) {
|
|
@@ -8312,26 +8324,27 @@ function createTagHandler(dispatch) {
|
|
|
8312
8324
|
};
|
|
8313
8325
|
}
|
|
8314
8326
|
function useBrowserInit(client, schemaType) {
|
|
8315
|
-
let $ = c(
|
|
8327
|
+
let $ = c(17), dispatch = useDispatch(), tagsByIds = useSelector(_temp$1), tagsFetchCount = useSelector(_temp2), showMediaLibraryAssets = useSelector(_temp3), t0;
|
|
8316
8328
|
$[0] === schemaType ? t0 = $[1] : (t0 = getMediaTagNames(schemaType), $[0] = schemaType, $[1] = t0);
|
|
8317
8329
|
let tagNames = t0, hasMediaTags = tagNames.length > 0, t1, t2;
|
|
8318
|
-
$[2] !== client || $[3] !== dispatch || $[4] !== hasMediaTags ? (t1 = () => {
|
|
8330
|
+
$[2] !== client || $[3] !== dispatch || $[4] !== hasMediaTags || $[5] !== showMediaLibraryAssets ? (t1 = () => {
|
|
8319
8331
|
hasMediaTags || dispatch(searchActions.facetsClear()), dispatch(tagsActions.fetchRequest()), dispatch(foldersActions.fetchRequest());
|
|
8320
|
-
let assetSubscription = client.listen(groq`*[_type in ["sanity.fileAsset", "sanity.imageAsset"] && !(_id in path("drafts.**"))]`).subscribe(createAssetHandler(dispatch)), tagSubscription = client.listen(groq`*[_type == "${TAG_DOCUMENT_NAME}" && !(_id in path("drafts.**"))]`).subscribe(createTagHandler(dispatch)), folderSubscription = client.listen(groq`*[_type == "${FOLDER_DOCUMENT_NAME}" && !(_id in path("drafts.**"))]`).subscribe(() => dispatch(foldersActions.fetchRequest()));
|
|
8332
|
+
let excludeMediaLibraryFragment = buildExcludeMediaLibraryFragment(showMediaLibraryAssets), excludeMediaLibraryClause = excludeMediaLibraryFragment ? ` && ${excludeMediaLibraryFragment}` : "", assetSubscription = client.listen(groq`*[_type in ["sanity.fileAsset", "sanity.imageAsset"] && !(_id in path("drafts.**"))${excludeMediaLibraryClause}]`).subscribe(createAssetHandler(dispatch)), tagSubscription = client.listen(groq`*[_type == "${TAG_DOCUMENT_NAME}" && !(_id in path("drafts.**"))]`).subscribe(createTagHandler(dispatch)), folderSubscription = client.listen(groq`*[_type == "${FOLDER_DOCUMENT_NAME}" && !(_id in path("drafts.**"))]`).subscribe(() => dispatch(foldersActions.fetchRequest()));
|
|
8321
8333
|
return () => {
|
|
8322
8334
|
assetSubscription.unsubscribe(), tagSubscription.unsubscribe(), folderSubscription.unsubscribe();
|
|
8323
8335
|
};
|
|
8324
8336
|
}, t2 = [
|
|
8325
8337
|
client,
|
|
8326
8338
|
dispatch,
|
|
8327
|
-
hasMediaTags
|
|
8328
|
-
|
|
8339
|
+
hasMediaTags,
|
|
8340
|
+
showMediaLibraryAssets
|
|
8341
|
+
], $[2] = client, $[3] = dispatch, $[4] = hasMediaTags, $[5] = showMediaLibraryAssets, $[6] = t1, $[7] = t2) : (t1 = $[6], t2 = $[7]), useEffect(t1, t2);
|
|
8329
8342
|
let t3;
|
|
8330
|
-
$[
|
|
8343
|
+
$[8] !== dispatch || $[9] !== hasMediaTags || $[10] !== tagNames || $[11] !== tagsByIds || $[12] !== tagsFetchCount ? (t3 = () => {
|
|
8331
8344
|
if (!hasMediaTags || tagsFetchCount < 0) return;
|
|
8332
8345
|
let tagFacetInput = inputs.tag;
|
|
8333
8346
|
if (tagFacetInput.type !== "searchable") return;
|
|
8334
|
-
let resolvedTags = tagNames.map((name) => Object.values(tagsByIds).find((item) => item.tag.name.current === name)).filter(
|
|
8347
|
+
let resolvedTags = tagNames.map((name) => Object.values(tagsByIds).find((item) => item.tag.name.current === name)).filter(_temp4);
|
|
8335
8348
|
dispatch(searchActions.facetsClear());
|
|
8336
8349
|
for (let tagItem of resolvedTags) dispatch(searchActions.facetsAdd({ facet: {
|
|
8337
8350
|
...tagFacetInput,
|
|
@@ -8341,13 +8354,16 @@ function useBrowserInit(client, schemaType) {
|
|
|
8341
8354
|
value: tagItem.tag._id
|
|
8342
8355
|
}
|
|
8343
8356
|
} }));
|
|
8344
|
-
}, $[
|
|
8357
|
+
}, $[8] = dispatch, $[9] = hasMediaTags, $[10] = tagNames, $[11] = tagsByIds, $[12] = tagsFetchCount, $[13] = t3) : t3 = $[13];
|
|
8345
8358
|
let t4;
|
|
8346
|
-
$[
|
|
8359
|
+
$[14] !== hasMediaTags || $[15] !== tagsFetchCount ? (t4 = [tagsFetchCount, hasMediaTags], $[14] = hasMediaTags, $[15] = tagsFetchCount, $[16] = t4) : t4 = $[16], useEffect(t3, t4);
|
|
8347
8360
|
}
|
|
8348
|
-
function
|
|
8361
|
+
function _temp4(item_0) {
|
|
8349
8362
|
return !!item_0;
|
|
8350
8363
|
}
|
|
8364
|
+
function _temp3(state_1) {
|
|
8365
|
+
return state_1.assets.showMediaLibraryAssets;
|
|
8366
|
+
}
|
|
8351
8367
|
function _temp2(state_0) {
|
|
8352
8368
|
return state_0.tags.fetchCount;
|
|
8353
8369
|
}
|
|
@@ -8408,7 +8424,7 @@ const BrowserContent = (t0) => {
|
|
|
8408
8424
|
children: t9
|
|
8409
8425
|
}), $[11] = portalElement, $[12] = t9, $[13] = t10) : t10 = $[13], t10;
|
|
8410
8426
|
}, Browser = (props) => {
|
|
8411
|
-
let $ = c(
|
|
8427
|
+
let $ = c(16), client = useVersionedClient(), { excludeTagSlugs, showMediaLibraryAssets } = useToolOptions(), t0 = props?.assetType, t1 = props?.document, t2 = props?.selectedAssets, t3 = props?.isMultiSelect, t4 = props?.onSelect, t5;
|
|
8412
8428
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t5 = /* @__PURE__ */ jsx(GlobalStyle, {}), $[0] = t5) : t5 = $[0];
|
|
8413
8429
|
let t6 = props?.onClose, t7 = props?.schemaType, t8;
|
|
8414
8430
|
$[1] !== t6 || $[2] !== t7 ? (t8 = /* @__PURE__ */ jsx(BrowserContent, {
|
|
@@ -8422,14 +8438,15 @@ const BrowserContent = (t0) => {
|
|
|
8422
8438
|
children: [t5, t8]
|
|
8423
8439
|
}), $[4] = t3, $[5] = t4, $[6] = t8, $[7] = t9) : t9 = $[7];
|
|
8424
8440
|
let t10;
|
|
8425
|
-
return $[8] !== client || $[9] !== excludeTagSlugs || $[10] !==
|
|
8441
|
+
return $[8] !== client || $[9] !== excludeTagSlugs || $[10] !== showMediaLibraryAssets || $[11] !== t0 || $[12] !== t1 || $[13] !== t2 || $[14] !== t9 ? (t10 = /* @__PURE__ */ jsx(ReduxProvider, {
|
|
8426
8442
|
assetType: t0,
|
|
8427
8443
|
client,
|
|
8428
8444
|
document: t1,
|
|
8429
8445
|
excludeTagSlugs,
|
|
8430
8446
|
selectedAssets: t2,
|
|
8447
|
+
showMediaLibraryAssets,
|
|
8431
8448
|
children: t9
|
|
8432
|
-
}), $[8] = client, $[9] = excludeTagSlugs, $[10] =
|
|
8449
|
+
}), $[8] = client, $[9] = excludeTagSlugs, $[10] = showMediaLibraryAssets, $[11] = t0, $[12] = t1, $[13] = t2, $[14] = t9, $[15] = t10) : t10 = $[15], t10;
|
|
8433
8450
|
}, FormBuilderTool = (props) => {
|
|
8434
8451
|
let $ = c(13), { onClose } = props, portalElement = useRootPortalElement(), t0;
|
|
8435
8452
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [], $[0] = t0) : t0 = $[0];
|