@bynder/compact-view 5.2.3 → 5.2.4
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/AccessToken2.js +1 -1
- package/ActiveFilters.js +49 -50
- package/AddMedia.js +19 -18
- package/Advanced.js +13 -13
- package/App.js +60 -59
- package/Arrow.js +1 -1
- package/AssetFilter.js +38 -38
- package/AssetItem.js +10 -17
- package/AssetList.js +5 -5
- package/AssetTypeItem.js +21 -21
- package/AssetsView.js +13 -13
- package/Axios2.js +82 -76
- package/AxiosError.js +36 -35
- package/ButtonAction.js +1 -1
- package/CanceledError.js +15 -8
- package/Card.js +1 -1
- package/Chip.js +1 -1
- package/CollectionCard.js +22 -22
- package/CollectionItem.js +9 -9
- package/CollectionList.js +5 -5
- package/CollectionView.js +11 -11
- package/ColorPicker.js +1 -1
- package/ColorPickerSolid.js +3 -3
- package/ColorPickerWithOpacity.js +3 -3
- package/Component.js +158 -0
- package/Component2.js +4 -0
- package/ConfigContext.js +7 -8
- package/Container.js +1 -1
- package/ContextAction.js +1 -1
- package/ControlGroup.js +6 -6
- package/Dat.js +33 -32
- package/DatDropdownItem.js +1 -1
- package/DesignSystemProvider.js +7 -7
- package/DirectionSelect.js +11 -10
- package/DomainInput.js +19 -11
- package/Draggable.js +337 -0
- package/Draggable2.js +4 -0
- package/DraggableCore.js +312 -0
- package/DraggableCore2.js +4 -0
- package/Dropdown.js +37 -37
- package/Dropdown2.js +1 -1
- package/DropdownListItem.js +1 -1
- package/FieldSelect.js +19 -17
- package/FileSelector.js +38 -37
- package/FontPicker.js +1 -1
- package/Form.js +1 -1
- package/Header.js +5 -4
- package/HttpStatusCode.js +7 -1
- package/InfiniteScroll.js +1 -1
- package/InlineBanner.js +1 -1
- package/Input.js +1 -1
- package/InterceptorManager.js +2 -1
- package/Item.js +8 -8
- package/Item4.js +2 -2
- package/LeftArrow.js +1 -1
- package/ListItem2.js +1 -1
- package/ModalBase.js +15 -15
- package/NoResults.js +1 -1
- package/Option_new.js +36 -29
- package/ReactPropTypesSecret.js +10 -0
- package/RightArrow.js +1 -1
- package/SearchInput.js +1 -1
- package/SearchInput2.js +1 -1
- package/SelectionFooter.js +41 -31
- package/Shield.js +2 -2
- package/Smartfilters_new.js +107 -98
- package/StatefulAssetList.js +50 -50
- package/StoreInitializer.js +32 -16
- package/SwitchNLS.js +1 -1
- package/TagItem.js +15 -15
- package/Tags.js +1 -1
- package/Toolbar.js +23 -20
- package/Tooltip2.js +1 -1
- package/ViewSwitch.js +17 -15
- package/_commonjsHelpers.js +28 -3
- package/adapters.js +54 -42
- package/api/filterAssets.d.ts +1 -1
- package/api/getAssets.d.ts +1 -1
- package/api/getFilters.d.ts +1 -1
- package/api/rest/index.d.ts +1 -1
- package/api/rest/types.d.ts +1 -1
- package/api2.js +1 -1
- package/asset.type.js +1 -1
- package/autocomplete.js +1 -1
- package/axios.js +1 -1
- package/bodyScrollLock.esm.js +68 -0
- package/buildURL.js +13 -15
- package/checkGlobals.js +1 -1
- package/cjs.js +7 -0
- package/cjs2.js +15 -0
- package/cjs3.js +4 -0
- package/clsx.m.js +6 -0
- package/clsx.m2.js +15 -0
- package/combineMetaproperties.js +3 -1
- package/composeSignals.js +1 -1
- package/cookieStore.js +1 -1
- package/cookies.js +13 -11
- package/currentScopes.js +1 -1
- package/data.js +1 -1
- package/devUtils.js +1 -1
- package/dispatchRequest.js +5 -5
- package/domFns.js +151 -0
- package/domFns2.js +4 -0
- package/factoryWithThrowingShims.js +52 -0
- package/fetch2.js +156 -128
- package/filter/AssetFilterContext.d.ts +3 -3
- package/filterAssets.js +1 -1
- package/getAsset.js +1 -1
- package/getAssetCounts.js +1 -1
- package/getAssets.js +1 -1
- package/getCollections.js +1 -1
- package/getFilterOptions.js +1 -1
- package/getFilters.js +1 -1
- package/getFilters_new.js +1 -1
- package/getPrefix.js +35 -0
- package/getPrefix2.js +4 -0
- package/getSimilarityAssets.js +1 -1
- package/goober.modern.js +75 -0
- package/handlers.js +1 -1
- package/iconBase.js +56 -0
- package/iconContext.js +12 -0
- package/iconsManifest.js +222 -0
- package/index-esm.js +1 -4
- package/index.browser.js +1 -1
- package/index.m.js +9 -0
- package/index.m2.js +17 -0
- package/index10.js +18 -2
- package/index11.js +181 -15
- package/index112.js +1 -1
- package/index12.js +313 -36
- package/index13.js +5 -2430
- package/index14.js +3 -557
- package/index15.js +15 -55
- package/index16.js +3 -2
- package/index17.js +3 -87
- package/index18.js +36 -60
- package/index19.js +3 -7
- package/index20.js +2429 -12
- package/index21.js +557 -10
- package/index22.js +1 -1
- package/index23.js +119 -6
- package/index24.js +39 -7
- package/index25.js +2 -5
- package/index26.js +86 -9
- package/index27.js +55 -8
- package/index28.js +6 -636
- package/index29.js +8692 -74
- package/index3.js +1684 -5
- package/index30.js +2 -5
- package/index31.js +4 -20
- package/index310.js +2 -0
- package/index32.js +11 -2
- package/index33.js +5083 -4
- package/index34.js +2 -18
- package/index35.js +59 -5
- package/index36.js +2 -2
- package/index37.js +13 -11
- package/index38.js +46 -10
- package/index39.js +6 -12
- package/index4.js +5 -1684
- package/index40.js +8 -11
- package/index41.js +26 -18
- package/index42.js +2 -64
- package/index43.js +63 -5
- package/index44.js +9 -55
- package/index45.js +7 -67
- package/index46.js +8 -31
- package/index47.js +5 -11
- package/index48.js +10 -121
- package/index49.js +9 -86
- package/index5.js +215 -23
- package/index50.js +636 -7
- package/index51.js +74 -11
- package/index52.js +4 -13
- package/index53.js +19 -13
- package/index54.js +4 -6
- package/index55.js +18 -7
- package/index56.js +5 -14
- package/index57.js +10 -28
- package/index58.js +10 -15
- package/index59.js +15 -0
- package/index6.js +250 -299
- package/index60.js +13 -0
- package/index61.js +21 -0
- package/index62.js +8 -0
- package/index63.js +57 -0
- package/index64.js +4 -0
- package/index65.js +69 -0
- package/index66.js +33 -0
- package/index67.js +13 -0
- package/index68.js +123 -0
- package/index69.js +88 -0
- package/index7.js +22 -5047
- package/index70.js +10 -0
- package/index71.js +13 -0
- package/index72.js +13 -225
- package/index73.js +16 -0
- package/index74.js +9 -0
- package/index75.js +228 -0
- package/index76.js +9 -0
- package/index77.js +17 -0
- package/index78.js +31 -0
- package/index79.js +18 -0
- package/index8.js +5044 -47
- package/index9.js +50 -15
- package/isAbsoluteURL.js +1 -1
- package/isURLSameOrigin.js +1 -1
- package/localization.js +15 -15
- package/log.js +14 -0
- package/log2.js +4 -0
- package/matchRequestUrl.js +1 -1
- package/mergeConfig.js +37 -32
- package/notify.js +2 -2
- package/package.json +1 -1
- package/positionFns.js +101 -0
- package/positionFns2.js +4 -0
- package/react-laag.esm.js +957 -0
- package/react.js +8 -8
- package/react2.js +9 -9
- package/resolveConfig.js +23 -23
- package/select/add-media/AddMedia.d.ts +3 -1
- package/select/current-selection/SelectedItems.d.ts +1 -1
- package/shims.js +29 -0
- package/shims2.js +4 -0
- package/store/StoreInitializer.d.ts +5 -1
- package/store/useAssetFilterStore.d.ts +55 -0
- package/store/useSelectionStore.d.ts +47 -0
- package/styled-components.browser.esm.js +2 -2
- package/throttle.js +1 -1
- package/toURLEncodedForm.js +11 -10
- package/tokenExpirationHelper.js +1 -1
- package/transformData.js +1 -1
- package/transitional.js +4 -3
- package/useAssetFilterStore.js +152 -0
- package/useDatStore.js +1 -1
- package/useEffectEvent.js +7 -7
- package/useFonts.js +2 -2
- package/useOrderingStore.js +1 -1
- package/useRouterStore.js +1 -1
- package/useSearchStore.js +1 -1
- package/useSelectionStore.js +131 -0
- package/useSimilaritySearchStore.js +1 -1
- package/useTranslate.js +1 -1
- package/utils/combineMetaproperties.d.ts +2 -0
- package/utils6.js +160 -118
- package/utils7.js +7 -68
- package/utils8.js +68 -7
- package/xhr.js +47 -46
- package/AssetFilterContext.js +0 -161
- package/SelectionContext.js +0 -143
- package/select/SelectionContext.d.ts +0 -30
- /package/{Middleware.js → Middleware2.js} +0 -0
- /package/{middleware2.js → middleware.js} +0 -0
package/utils8.js
CHANGED
|
@@ -1,9 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { produce as e } from "./immer.js";
|
|
2
|
+
import { API as a } from "./api2.js";
|
|
3
|
+
function F(i, t) {
|
|
4
|
+
return e(i, (n) => {
|
|
5
|
+
const o = n.findIndex((f) => f.id === t?.id);
|
|
6
|
+
o !== -1 && n.splice(o, 1), n.unshift(t);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
function c(i, t = !1) {
|
|
10
|
+
return t ? i.map((n) => ({
|
|
11
|
+
...n,
|
|
12
|
+
subfamilies: n.subfamilies.filter((o) => !o.is_italic)
|
|
13
|
+
})) : i;
|
|
14
|
+
}
|
|
15
|
+
function r(i, t) {
|
|
16
|
+
return i.subfamilies.find(
|
|
17
|
+
(o) => o.weight === t
|
|
18
|
+
) || i.subfamilies[0];
|
|
19
|
+
}
|
|
20
|
+
async function u(i, t = "400") {
|
|
21
|
+
const n = await s(), o = i || n.family.id;
|
|
22
|
+
if (!o)
|
|
23
|
+
throw new Error(`Fonts: Family not found for (default) id: ${o}`);
|
|
24
|
+
const f = await a.getFontFamilyById(o);
|
|
25
|
+
if (!f)
|
|
26
|
+
throw new Error(`Fonts: Family not found for id: ${o}`);
|
|
27
|
+
const l = r(f, t);
|
|
28
|
+
if (!l)
|
|
29
|
+
throw new Error(`Fonts: Subfamily not found for weight: ${t}`);
|
|
30
|
+
return {
|
|
31
|
+
family: f,
|
|
32
|
+
subfamily: l
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
async function m(i) {
|
|
36
|
+
const t = await a.getSubfamilyById(i);
|
|
37
|
+
if (!t)
|
|
38
|
+
throw new Error(`Fonts: Subfamily not found for id: ${i}`);
|
|
39
|
+
const n = await a.getFontFamilyById(t.font_id);
|
|
40
|
+
if (!n)
|
|
41
|
+
throw new Error(`Fonts: Family not found for id: ${t.font_id}`);
|
|
42
|
+
return {
|
|
43
|
+
family: n,
|
|
44
|
+
subfamily: t
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
async function s() {
|
|
48
|
+
const i = await a.getDefaultGlobalFont();
|
|
49
|
+
if (!i)
|
|
50
|
+
throw new Error("FontManager v2: (Default) Global Font Family not found");
|
|
51
|
+
const t = i.family.subfamilies.find(
|
|
52
|
+
(n) => n.id === i.default_subfamily_id
|
|
53
|
+
);
|
|
54
|
+
if (!t)
|
|
55
|
+
throw new Error("FontManager v2: (Default) Global Font Subfamily not found");
|
|
56
|
+
return {
|
|
57
|
+
family: i.family,
|
|
58
|
+
subfamily: t
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
async function w(i, t) {
|
|
62
|
+
let n;
|
|
63
|
+
return t ? n = await m(t) : n = await u(i), n;
|
|
64
|
+
}
|
|
3
65
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
r as origin
|
|
66
|
+
c as filterFamilies,
|
|
67
|
+
s as getDefaultFont,
|
|
68
|
+
w as getFamilyAndSubfamily,
|
|
69
|
+
F as moveSelectedFamilyToTop
|
|
9
70
|
};
|
package/xhr.js
CHANGED
|
@@ -1,69 +1,70 @@
|
|
|
1
|
-
import
|
|
1
|
+
import H from "./utils6.js";
|
|
2
2
|
import D from "./settle.js";
|
|
3
3
|
import L from "./transitional.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { progressEventReducer as
|
|
10
|
-
import
|
|
11
|
-
const N = typeof XMLHttpRequest < "u", Q = N && function(
|
|
12
|
-
return new Promise(function(
|
|
13
|
-
const t =
|
|
14
|
-
let
|
|
15
|
-
const
|
|
16
|
-
let { responseType:
|
|
17
|
-
function
|
|
18
|
-
u && u(),
|
|
4
|
+
import n from "./AxiosError.js";
|
|
5
|
+
import y from "./CanceledError.js";
|
|
6
|
+
import O from "./parseProtocol.js";
|
|
7
|
+
import U from "./index28.js";
|
|
8
|
+
import q from "./AxiosHeaders.js";
|
|
9
|
+
import { progressEventReducer as A } from "./progressEventReducer.js";
|
|
10
|
+
import v from "./resolveConfig.js";
|
|
11
|
+
const N = typeof XMLHttpRequest < "u", Q = N && function(s) {
|
|
12
|
+
return new Promise(function(C, i) {
|
|
13
|
+
const t = v(s);
|
|
14
|
+
let E = t.data;
|
|
15
|
+
const T = q.from(t.headers).normalize();
|
|
16
|
+
let { responseType: d, onUploadProgress: R, onDownloadProgress: h } = t, l, g, w, u, f;
|
|
17
|
+
function x() {
|
|
18
|
+
u && u(), f && f(), t.cancelToken && t.cancelToken.unsubscribe(l), t.signal && t.signal.removeEventListener("abort", l);
|
|
19
19
|
}
|
|
20
20
|
let e = new XMLHttpRequest();
|
|
21
21
|
e.open(t.method.toUpperCase(), t.url, !0), e.timeout = t.timeout;
|
|
22
|
-
function
|
|
22
|
+
function b() {
|
|
23
23
|
if (!e)
|
|
24
24
|
return;
|
|
25
|
-
const o =
|
|
25
|
+
const o = q.from(
|
|
26
26
|
"getAllResponseHeaders" in e && e.getAllResponseHeaders()
|
|
27
|
-
),
|
|
28
|
-
data: !
|
|
27
|
+
), a = {
|
|
28
|
+
data: !d || d === "text" || d === "json" ? e.responseText : e.response,
|
|
29
29
|
status: e.status,
|
|
30
30
|
statusText: e.statusText,
|
|
31
31
|
headers: o,
|
|
32
|
-
config:
|
|
32
|
+
config: s,
|
|
33
33
|
request: e
|
|
34
34
|
};
|
|
35
|
-
D(function(
|
|
36
|
-
|
|
37
|
-
}, function(
|
|
38
|
-
|
|
39
|
-
},
|
|
35
|
+
D(function(c) {
|
|
36
|
+
C(c), x();
|
|
37
|
+
}, function(c) {
|
|
38
|
+
i(c), x();
|
|
39
|
+
}, a), e = null;
|
|
40
40
|
}
|
|
41
|
-
"onloadend" in e ? e.onloadend =
|
|
42
|
-
!e || e.readyState !== 4 || e.status === 0 && !(e.responseURL && e.responseURL.indexOf("file:") === 0) || setTimeout(
|
|
41
|
+
"onloadend" in e ? e.onloadend = b : e.onreadystatechange = function() {
|
|
42
|
+
!e || e.readyState !== 4 || e.status === 0 && !(e.responseURL && e.responseURL.indexOf("file:") === 0) || setTimeout(b);
|
|
43
43
|
}, e.onabort = function() {
|
|
44
|
-
e && (
|
|
45
|
-
}, e.onerror = function() {
|
|
46
|
-
|
|
44
|
+
e && (i(new n("Request aborted", n.ECONNABORTED, s, e)), e = null);
|
|
45
|
+
}, e.onerror = function(r) {
|
|
46
|
+
const a = r && r.message ? r.message : "Network Error", p = new n(a, n.ERR_NETWORK, s, e);
|
|
47
|
+
p.event = r || null, i(p), e = null;
|
|
47
48
|
}, e.ontimeout = function() {
|
|
48
|
-
let
|
|
49
|
-
const
|
|
50
|
-
t.timeoutErrorMessage && (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
let r = t.timeout ? "timeout of " + t.timeout + "ms exceeded" : "timeout exceeded";
|
|
50
|
+
const a = t.transitional || L;
|
|
51
|
+
t.timeoutErrorMessage && (r = t.timeoutErrorMessage), i(new n(
|
|
52
|
+
r,
|
|
53
|
+
a.clarifyTimeoutError ? n.ETIMEDOUT : n.ECONNABORTED,
|
|
54
|
+
s,
|
|
54
55
|
e
|
|
55
56
|
)), e = null;
|
|
56
|
-
},
|
|
57
|
-
e.setRequestHeader(
|
|
58
|
-
}),
|
|
59
|
-
e && (
|
|
60
|
-
}, t.cancelToken && t.cancelToken.subscribe(
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
|
|
57
|
+
}, E === void 0 && T.setContentType(null), "setRequestHeader" in e && H.forEach(T.toJSON(), function(r, a) {
|
|
58
|
+
e.setRequestHeader(a, r);
|
|
59
|
+
}), H.isUndefined(t.withCredentials) || (e.withCredentials = !!t.withCredentials), d && d !== "json" && (e.responseType = t.responseType), h && ([w, f] = A(h, !0), e.addEventListener("progress", w)), R && e.upload && ([g, u] = A(R), e.upload.addEventListener("progress", g), e.upload.addEventListener("loadend", u)), (t.cancelToken || t.signal) && (l = (o) => {
|
|
60
|
+
e && (i(!o || o.type ? new y(null, s, e) : o), e.abort(), e = null);
|
|
61
|
+
}, t.cancelToken && t.cancelToken.subscribe(l), t.signal && (t.signal.aborted ? l() : t.signal.addEventListener("abort", l)));
|
|
62
|
+
const m = O(t.url);
|
|
63
|
+
if (m && U.protocols.indexOf(m) === -1) {
|
|
64
|
+
i(new n("Unsupported protocol " + m + ":", n.ERR_BAD_REQUEST, s));
|
|
64
65
|
return;
|
|
65
66
|
}
|
|
66
|
-
e.send(
|
|
67
|
+
e.send(E || null);
|
|
67
68
|
});
|
|
68
69
|
};
|
|
69
70
|
export {
|
package/AssetFilterContext.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { jsx as R } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as V, useState as c, useEffect as x, useMemo as X, useContext as Y } from "react";
|
|
3
|
-
const j = V(null);
|
|
4
|
-
function U({
|
|
5
|
-
children: o,
|
|
6
|
-
hideLimitedUse: u = !1,
|
|
7
|
-
predefinedFilter: s
|
|
8
|
-
}) {
|
|
9
|
-
const [b, l] = c(
|
|
10
|
-
s?.predefinedAssetType ? [...s?.predefinedAssetType] : []
|
|
11
|
-
), [p, g] = c([]), [E, C] = c(!1), [M, m] = c(
|
|
12
|
-
s?.predefinedTagNames ? [...s.predefinedTagNames] : []
|
|
13
|
-
), [O, I] = c(), [P, S] = c({}), [v, d] = c({}), [D, y] = c(null);
|
|
14
|
-
x(() => {
|
|
15
|
-
I(u ? !1 : void 0);
|
|
16
|
-
}, [u]), x(() => {
|
|
17
|
-
w();
|
|
18
|
-
}, [s?.predefinedMetapropertiesOptions]);
|
|
19
|
-
function L(e) {
|
|
20
|
-
l((t) => T(t, e));
|
|
21
|
-
}
|
|
22
|
-
function N(e) {
|
|
23
|
-
s?.showToolbar && s.predefinedAssetType?.includes(e) || l((t) => A(t, e));
|
|
24
|
-
}
|
|
25
|
-
function W(e) {
|
|
26
|
-
g((t) => T(t, e.id)), S((t) => ({
|
|
27
|
-
...t,
|
|
28
|
-
[e.id]: e
|
|
29
|
-
}));
|
|
30
|
-
}
|
|
31
|
-
function _(e) {
|
|
32
|
-
g(
|
|
33
|
-
(t) => A(t, e.id)
|
|
34
|
-
), S((t) => {
|
|
35
|
-
const { [e.id]: i, ...r } = t;
|
|
36
|
-
return r;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function w() {
|
|
40
|
-
s?.predefinedMetapropertiesOptions && d(() => Object.entries(
|
|
41
|
-
s.predefinedMetapropertiesOptions || {}
|
|
42
|
-
).reduce((e, [t, i]) => (e[t] = {}, Object.entries(i).forEach(([r, n]) => {
|
|
43
|
-
e[t][n] = {
|
|
44
|
-
id: n,
|
|
45
|
-
label: r,
|
|
46
|
-
metapropertyName: t
|
|
47
|
-
};
|
|
48
|
-
}), e), {}));
|
|
49
|
-
}
|
|
50
|
-
function k(e) {
|
|
51
|
-
m((t) => T(t, e));
|
|
52
|
-
}
|
|
53
|
-
function q(e) {
|
|
54
|
-
s?.showToolbar && s.predefinedTagNames?.includes(e) || m((t) => A(t, e));
|
|
55
|
-
}
|
|
56
|
-
function z(e, t, i) {
|
|
57
|
-
const r = {
|
|
58
|
-
id: t.id,
|
|
59
|
-
label: t.label,
|
|
60
|
-
metapropertyName: e
|
|
61
|
-
};
|
|
62
|
-
d((n) => {
|
|
63
|
-
const a = n[e] || {}, f = !!a[t.id];
|
|
64
|
-
return i ? {
|
|
65
|
-
...n,
|
|
66
|
-
[e]: f ? (
|
|
67
|
-
// Remove if already selected
|
|
68
|
-
Object.fromEntries(
|
|
69
|
-
Object.entries(a).filter(
|
|
70
|
-
([Q]) => Q !== t.id
|
|
71
|
-
)
|
|
72
|
-
)
|
|
73
|
-
) : (
|
|
74
|
-
// Add if not selected already
|
|
75
|
-
{
|
|
76
|
-
...a,
|
|
77
|
-
[t.id]: r
|
|
78
|
-
}
|
|
79
|
-
)
|
|
80
|
-
} : f ? {
|
|
81
|
-
...n,
|
|
82
|
-
[e]: {}
|
|
83
|
-
} : {
|
|
84
|
-
...n,
|
|
85
|
-
[e]: {
|
|
86
|
-
[t.id]: r
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
function B(e, t) {
|
|
92
|
-
d((i) => {
|
|
93
|
-
const { [e]: r, ...n } = i, { [t]: a, ...f } = r || {};
|
|
94
|
-
return f && Object.keys(f).length > 0 ? {
|
|
95
|
-
...i,
|
|
96
|
-
[e]: f
|
|
97
|
-
} : n;
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
function G(e) {
|
|
101
|
-
const t = e.count, i = Object.entries(t || {}).filter(
|
|
102
|
-
([r, n]) => r.startsWith("property") && n && Object.keys(n).length > 0
|
|
103
|
-
).reduce((r, [n, a]) => (r[n.replace("property_", "")] = a, r), {});
|
|
104
|
-
y(i);
|
|
105
|
-
}
|
|
106
|
-
function H() {
|
|
107
|
-
l(
|
|
108
|
-
s?.showToolbar && s?.predefinedAssetType ? [...s.predefinedAssetType] : []
|
|
109
|
-
), m(
|
|
110
|
-
s?.showToolbar && s?.predefinedTagNames ? [...s.predefinedTagNames] : []
|
|
111
|
-
), d({}), y(null);
|
|
112
|
-
}
|
|
113
|
-
const h = p.map((e) => P[e]);
|
|
114
|
-
function J(e) {
|
|
115
|
-
C(e);
|
|
116
|
-
}
|
|
117
|
-
const K = X(
|
|
118
|
-
() => ({
|
|
119
|
-
assetTypes: b,
|
|
120
|
-
metaproperties: h,
|
|
121
|
-
metapropertyIds: p,
|
|
122
|
-
tags: M,
|
|
123
|
-
isLimited: O,
|
|
124
|
-
addAssetType: L,
|
|
125
|
-
removeAssetType: N,
|
|
126
|
-
addMetaproperty: W,
|
|
127
|
-
removeMetaproperty: _,
|
|
128
|
-
setPredefinedMetaproperties: w,
|
|
129
|
-
addTag: k,
|
|
130
|
-
removeTag: q,
|
|
131
|
-
clear: H,
|
|
132
|
-
setDropdownState: J,
|
|
133
|
-
isDropdownActive: E,
|
|
134
|
-
selectSmartfilterOption: z,
|
|
135
|
-
removeSmartfilterOption: B,
|
|
136
|
-
selectedSmartfilterOptions: v,
|
|
137
|
-
setActiveFiltersState: G,
|
|
138
|
-
existingFilters: D
|
|
139
|
-
}),
|
|
140
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
141
|
-
[b, h, M, O, p, v]
|
|
142
|
-
);
|
|
143
|
-
return /* @__PURE__ */ R(j.Provider, { value: K, children: o });
|
|
144
|
-
}
|
|
145
|
-
function T(o, u) {
|
|
146
|
-
return o.includes(u) ? o : [...o, u];
|
|
147
|
-
}
|
|
148
|
-
function A(o, u) {
|
|
149
|
-
return o.filter((s) => s !== u);
|
|
150
|
-
}
|
|
151
|
-
function F() {
|
|
152
|
-
const o = Y(j);
|
|
153
|
-
if (o === null)
|
|
154
|
-
throw new Error("useAssetFilter must be used with a AssetFilterProvider");
|
|
155
|
-
return o;
|
|
156
|
-
}
|
|
157
|
-
export {
|
|
158
|
-
j as AssetFilterContext,
|
|
159
|
-
U as AssetFilterProvider,
|
|
160
|
-
F as useAssetFilter
|
|
161
|
-
};
|
package/SelectionContext.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { jsx as O } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as j, useState as v, useEffect as p, useMemo as k, useContext as q } from "react";
|
|
3
|
-
import { getAssetsByMediaId as B } from "./filterAssets.js";
|
|
4
|
-
import { isErr as I } from "./result.type.js";
|
|
5
|
-
import { useSelectionMode as L, useConfig as T } from "./ConfigContext.js";
|
|
6
|
-
import { useAuth as V } from "./LoginContext.js";
|
|
7
|
-
import { useDat as _ } from "./useDatStore.js";
|
|
8
|
-
const C = j(null);
|
|
9
|
-
function W(t) {
|
|
10
|
-
const [s, i] = v([]), [f, g] = v([]), [a, S] = v(), u = z(a), h = L(), { transformation: o } = _();
|
|
11
|
-
p(() => {
|
|
12
|
-
S(
|
|
13
|
-
(t.preselectedAssetIds ?? []).filter((e) => !!e).map((e) => window.btoa("(Asset_id " + e + ")"))
|
|
14
|
-
);
|
|
15
|
-
}, [t.preselectedAssetIds]), p(() => {
|
|
16
|
-
u.length && x(u);
|
|
17
|
-
}, [u]), p(() => {
|
|
18
|
-
o && Object.keys(o).length && (m(), x([o?.asset]));
|
|
19
|
-
}, [o]);
|
|
20
|
-
function d(e) {
|
|
21
|
-
e.tag === "Loaded" && e.value && g(e.value);
|
|
22
|
-
}
|
|
23
|
-
function y() {
|
|
24
|
-
i((e) => {
|
|
25
|
-
const n = f.filter(
|
|
26
|
-
(l) => !e.some((c) => c.value.id === l.id)
|
|
27
|
-
);
|
|
28
|
-
return [
|
|
29
|
-
...e,
|
|
30
|
-
...n.map((l) => ({
|
|
31
|
-
type: "asset",
|
|
32
|
-
value: l
|
|
33
|
-
}))
|
|
34
|
-
];
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
function m() {
|
|
38
|
-
i([]);
|
|
39
|
-
}
|
|
40
|
-
function x(e) {
|
|
41
|
-
i((n) => {
|
|
42
|
-
const l = e.filter((c) => !A(n, c));
|
|
43
|
-
return [
|
|
44
|
-
...n,
|
|
45
|
-
...l.map((c) => ({
|
|
46
|
-
type: "asset",
|
|
47
|
-
value: c
|
|
48
|
-
}))
|
|
49
|
-
];
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
function M(e) {
|
|
53
|
-
s.some((n) => n.value.id === e.id) ? i([]) : i([{ type: "asset", value: e }]);
|
|
54
|
-
}
|
|
55
|
-
function P(e) {
|
|
56
|
-
h !== "MultiSelect" ? M(e[0]) : i((n) => {
|
|
57
|
-
const l = e.filter(
|
|
58
|
-
(r) => !A(n, r)
|
|
59
|
-
), c = e.filter(
|
|
60
|
-
(r) => A(n, r)
|
|
61
|
-
);
|
|
62
|
-
return [
|
|
63
|
-
...n.filter(
|
|
64
|
-
(r) => !c.some(
|
|
65
|
-
(b) => b.id === r.value.id
|
|
66
|
-
)
|
|
67
|
-
),
|
|
68
|
-
...l.map((r) => ({
|
|
69
|
-
type: "asset",
|
|
70
|
-
value: r
|
|
71
|
-
}))
|
|
72
|
-
];
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
function E(e) {
|
|
76
|
-
i((n) => A(n, e) ? n.filter(
|
|
77
|
-
(l) => l.value.id !== e.id
|
|
78
|
-
) : [
|
|
79
|
-
...n,
|
|
80
|
-
{
|
|
81
|
-
type: "collection",
|
|
82
|
-
value: e
|
|
83
|
-
}
|
|
84
|
-
]);
|
|
85
|
-
}
|
|
86
|
-
const R = k(
|
|
87
|
-
() => ({
|
|
88
|
-
selection: s,
|
|
89
|
-
preselectedAssetIds: a,
|
|
90
|
-
clear: m,
|
|
91
|
-
selectAssets: x,
|
|
92
|
-
toggleAssets: P,
|
|
93
|
-
toggleCollection: E,
|
|
94
|
-
selectAll: y,
|
|
95
|
-
setAllAssets: d
|
|
96
|
-
}),
|
|
97
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
98
|
-
[s, f]
|
|
99
|
-
);
|
|
100
|
-
return /* @__PURE__ */ O(C.Provider, { value: R, children: t.children });
|
|
101
|
-
}
|
|
102
|
-
function A(t, s) {
|
|
103
|
-
return t.some((i) => i.value.id === s.id);
|
|
104
|
-
}
|
|
105
|
-
function w() {
|
|
106
|
-
const t = q(C);
|
|
107
|
-
if (t === null)
|
|
108
|
-
throw new Error("useSelection must be used with a SelectionProvider");
|
|
109
|
-
return t;
|
|
110
|
-
}
|
|
111
|
-
function X() {
|
|
112
|
-
const { selection: t } = w();
|
|
113
|
-
return t.filter((s) => s.type === "asset").map((s) => s.value.id);
|
|
114
|
-
}
|
|
115
|
-
function Y() {
|
|
116
|
-
const { selection: t } = w();
|
|
117
|
-
return t.filter((s) => s.type === "collection").map((s) => s.value.id);
|
|
118
|
-
}
|
|
119
|
-
function z(t) {
|
|
120
|
-
const [s, i] = v([]), { selectionMode: f, language: g, noCache: a } = T(), S = V();
|
|
121
|
-
let u = !1;
|
|
122
|
-
const h = async (o) => {
|
|
123
|
-
if (o.length) {
|
|
124
|
-
const d = await B({ ids: o, auth: S, language: g, noCache: a });
|
|
125
|
-
u || I(d) || (d.value?.sort((y, m) => o.indexOf(y.id) - o.indexOf(m.id)), i(d.value ?? []));
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
return p(() => {
|
|
129
|
-
if (t) {
|
|
130
|
-
let o = t ?? [];
|
|
131
|
-
f !== "MultiSelect" && (o = o[0] ? [o[0]] : []), h(o);
|
|
132
|
-
}
|
|
133
|
-
return () => {
|
|
134
|
-
u = !0;
|
|
135
|
-
};
|
|
136
|
-
}, [t]), s;
|
|
137
|
-
}
|
|
138
|
-
export {
|
|
139
|
-
W as SelectionProvider,
|
|
140
|
-
X as useSelectedAssetIds,
|
|
141
|
-
Y as useSelectedCollectionIds,
|
|
142
|
-
w as useSelection
|
|
143
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { Asset, AssetData } from '../views/asset/asset.type';
|
|
3
|
-
import { Collection } from '../views/collection/collection.types';
|
|
4
|
-
export type SelectedAsset = {
|
|
5
|
-
type: 'asset';
|
|
6
|
-
value: Asset;
|
|
7
|
-
};
|
|
8
|
-
export type SelectedCollection = {
|
|
9
|
-
type: 'collection';
|
|
10
|
-
value: Collection;
|
|
11
|
-
};
|
|
12
|
-
export type SelectedItem = SelectedAsset | SelectedCollection;
|
|
13
|
-
interface Context {
|
|
14
|
-
selection: SelectedItem[];
|
|
15
|
-
preselectedAssetIds?: string[];
|
|
16
|
-
clear: () => void;
|
|
17
|
-
selectAll: () => void;
|
|
18
|
-
selectAssets: (assets: Asset[]) => void;
|
|
19
|
-
toggleAssets: (assets: Asset[]) => void;
|
|
20
|
-
toggleCollection: (collection: Collection) => void;
|
|
21
|
-
setAllAssets: (assetData: AssetData) => void;
|
|
22
|
-
}
|
|
23
|
-
export declare function SelectionProvider(props: {
|
|
24
|
-
preselectedAssetIds: string[];
|
|
25
|
-
children: React.ReactNode;
|
|
26
|
-
}): React.JSX.Element;
|
|
27
|
-
export declare function useSelection(): Context;
|
|
28
|
-
export declare function useSelectedAssetIds(): string[];
|
|
29
|
-
export declare function useSelectedCollectionIds(): string[];
|
|
30
|
-
export {};
|
|
File without changes
|
|
File without changes
|