@bynder/compact-view 5.2.2 → 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/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/getPrefix.js +35 -0
- package/getPrefix2.js +4 -0
- 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 +1 -1
- 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 -7
- package/index19.js +3 -60
- 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 +25 -2
- 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 +1537 -1536
- package/index9.js +1 -1
- 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 +1 -1
- 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/xhr.js +47 -46
- package/AssetFilterContext.js +0 -161
- package/Middleware.js +0 -49
- package/SelectionContext.js +0 -143
- package/middleware2.js +0 -177
- package/select/SelectionContext.d.ts +0 -30
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/Middleware.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { RULESET as g, KEYFRAMES as x, DECLARATION as $, WEBKIT as w, MOZ as n, MS as y } from "./Enum.js";
|
|
2
|
-
import { combine as A, replace as u, sizeof as M, match as R, assign as h, filter as E } from "./Utility.js";
|
|
3
|
-
import { copy as i, lift as t } from "./Tokenizer.js";
|
|
4
|
-
import { serialize as S } from "./Serializer.js";
|
|
5
|
-
import { prefix as T } from "./Prefixer.js";
|
|
6
|
-
function B(r) {
|
|
7
|
-
var o = M(r);
|
|
8
|
-
return function(f, s, p, d) {
|
|
9
|
-
for (var c = "", a = 0; a < o; a++)
|
|
10
|
-
c += r[a](f, s, p, d) || "";
|
|
11
|
-
return c;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
function C(r) {
|
|
15
|
-
return function(o) {
|
|
16
|
-
o.root || (o = o.return) && r(o);
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function D(r, o, f, s) {
|
|
20
|
-
if (r.length > -1 && !r.return)
|
|
21
|
-
switch (r.type) {
|
|
22
|
-
case $:
|
|
23
|
-
r.return = T(r.value, r.length, f);
|
|
24
|
-
return;
|
|
25
|
-
case x:
|
|
26
|
-
return S([i(r, { value: u(r.value, "@", "@" + w) })], s);
|
|
27
|
-
case g:
|
|
28
|
-
if (r.length)
|
|
29
|
-
return A(f = r.props, function(p) {
|
|
30
|
-
switch (R(p, s = /(::plac\w+|:read-\w+)/)) {
|
|
31
|
-
// :read-(only|write)
|
|
32
|
-
case ":read-only":
|
|
33
|
-
case ":read-write":
|
|
34
|
-
t(i(r, { props: [u(p, /:(read-\w+)/, ":" + n + "$1")] })), t(i(r, { props: [p] })), h(r, { props: E(f, s) });
|
|
35
|
-
break;
|
|
36
|
-
// :placeholder
|
|
37
|
-
case "::placeholder":
|
|
38
|
-
t(i(r, { props: [u(p, /:(plac\w+)/, ":" + w + "input-$1")] })), t(i(r, { props: [u(p, /:(plac\w+)/, ":" + n + "$1")] })), t(i(r, { props: [u(p, /:(plac\w+)/, y + "input-$1")] })), t(i(r, { props: [p] })), h(r, { props: E(f, s) });
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
return "";
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export {
|
|
46
|
-
B as middleware,
|
|
47
|
-
D as prefixer,
|
|
48
|
-
C as rulesheet
|
|
49
|
-
};
|
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
|
-
};
|
package/middleware2.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
const g = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, S = /* @__PURE__ */ new Map(), h = (i) => {
|
|
2
|
-
const c = S.get(i);
|
|
3
|
-
return c ? Object.fromEntries(
|
|
4
|
-
Object.entries(c.stores).map(([o, d]) => [o, d.getState()])
|
|
5
|
-
) : {};
|
|
6
|
-
}, E = (i, c, o) => {
|
|
7
|
-
if (i === void 0)
|
|
8
|
-
return {
|
|
9
|
-
type: "untracked",
|
|
10
|
-
connection: c.connect(o)
|
|
11
|
-
};
|
|
12
|
-
const d = S.get(o.name);
|
|
13
|
-
if (d)
|
|
14
|
-
return { type: "tracked", store: i, ...d };
|
|
15
|
-
const e = {
|
|
16
|
-
connection: c.connect(o),
|
|
17
|
-
stores: {}
|
|
18
|
-
};
|
|
19
|
-
return S.set(o.name, e), { type: "tracked", store: i, ...e };
|
|
20
|
-
}, C = (i, c) => {
|
|
21
|
-
if (c === void 0) return;
|
|
22
|
-
const o = S.get(i);
|
|
23
|
-
o && (delete o.stores[c], Object.keys(o.stores).length === 0 && S.delete(i));
|
|
24
|
-
}, w = (i) => {
|
|
25
|
-
var c, o;
|
|
26
|
-
if (!i) return;
|
|
27
|
-
const d = i.split(`
|
|
28
|
-
`), e = d.findIndex(
|
|
29
|
-
(m) => m.includes("api.setState")
|
|
30
|
-
);
|
|
31
|
-
if (e < 0) return;
|
|
32
|
-
const y = ((c = d[e + 1]) == null ? void 0 : c.trim()) || "";
|
|
33
|
-
return (o = /.+ (.+) .+/.exec(y)) == null ? void 0 : o[1];
|
|
34
|
-
}, I = (i, c = {}) => (o, d, e) => {
|
|
35
|
-
const { enabled: y, anonymousActionType: m, store: s, ...f } = c;
|
|
36
|
-
let O;
|
|
37
|
-
try {
|
|
38
|
-
O = (y ?? (g ? "production" : void 0) !== "production") && window.__REDUX_DEVTOOLS_EXTENSION__;
|
|
39
|
-
} catch {
|
|
40
|
-
}
|
|
41
|
-
if (!O)
|
|
42
|
-
return i(o, d, e);
|
|
43
|
-
const { connection: t, ...p } = E(s, O, f);
|
|
44
|
-
let v = !0;
|
|
45
|
-
e.setState = (r, l, n) => {
|
|
46
|
-
const a = o(r, l);
|
|
47
|
-
if (!v) return a;
|
|
48
|
-
const b = n === void 0 ? {
|
|
49
|
-
type: m || w(new Error().stack) || "anonymous"
|
|
50
|
-
} : typeof n == "string" ? { type: n } : n;
|
|
51
|
-
return s === void 0 ? (t?.send(b, d()), a) : (t?.send(
|
|
52
|
-
{
|
|
53
|
-
...b,
|
|
54
|
-
type: `${s}/${b.type}`
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
...h(f.name),
|
|
58
|
-
[s]: e.getState()
|
|
59
|
-
}
|
|
60
|
-
), a);
|
|
61
|
-
}, e.devtools = {
|
|
62
|
-
cleanup: () => {
|
|
63
|
-
t && typeof t.unsubscribe == "function" && t.unsubscribe(), C(f.name, s);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const u = (...r) => {
|
|
67
|
-
const l = v;
|
|
68
|
-
v = !1, o(...r), v = l;
|
|
69
|
-
}, _ = i(e.setState, d, e);
|
|
70
|
-
if (p.type === "untracked" ? t?.init(_) : (p.stores[p.store] = e, t?.init(
|
|
71
|
-
Object.fromEntries(
|
|
72
|
-
Object.entries(p.stores).map(([r, l]) => [
|
|
73
|
-
r,
|
|
74
|
-
r === p.store ? _ : l.getState()
|
|
75
|
-
])
|
|
76
|
-
)
|
|
77
|
-
)), e.dispatchFromDevtools && typeof e.dispatch == "function") {
|
|
78
|
-
let r = !1;
|
|
79
|
-
const l = e.dispatch;
|
|
80
|
-
e.dispatch = (...n) => {
|
|
81
|
-
(g ? "production" : void 0) !== "production" && n[0].type === "__setState" && !r && (console.warn(
|
|
82
|
-
'[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'
|
|
83
|
-
), r = !0), l(...n);
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
return t.subscribe((r) => {
|
|
87
|
-
var l;
|
|
88
|
-
switch (r.type) {
|
|
89
|
-
case "ACTION":
|
|
90
|
-
if (typeof r.payload != "string") {
|
|
91
|
-
console.error(
|
|
92
|
-
"[zustand devtools middleware] Unsupported action format"
|
|
93
|
-
);
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
return T(
|
|
97
|
-
r.payload,
|
|
98
|
-
(n) => {
|
|
99
|
-
if (n.type === "__setState") {
|
|
100
|
-
if (s === void 0) {
|
|
101
|
-
u(n.state);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
Object.keys(n.state).length !== 1 && console.error(
|
|
105
|
-
`
|
|
106
|
-
[zustand devtools middleware] Unsupported __setState action format.
|
|
107
|
-
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
|
|
108
|
-
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
|
|
109
|
-
`
|
|
110
|
-
);
|
|
111
|
-
const a = n.state[s];
|
|
112
|
-
if (a == null)
|
|
113
|
-
return;
|
|
114
|
-
JSON.stringify(e.getState()) !== JSON.stringify(a) && u(a);
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
e.dispatchFromDevtools && typeof e.dispatch == "function" && e.dispatch(n);
|
|
118
|
-
}
|
|
119
|
-
);
|
|
120
|
-
case "DISPATCH":
|
|
121
|
-
switch (r.payload.type) {
|
|
122
|
-
case "RESET":
|
|
123
|
-
return u(_), s === void 0 ? t?.init(e.getState()) : t?.init(h(f.name));
|
|
124
|
-
case "COMMIT":
|
|
125
|
-
if (s === void 0) {
|
|
126
|
-
t?.init(e.getState());
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
return t?.init(h(f.name));
|
|
130
|
-
case "ROLLBACK":
|
|
131
|
-
return T(r.state, (n) => {
|
|
132
|
-
if (s === void 0) {
|
|
133
|
-
u(n), t?.init(e.getState());
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
u(n[s]), t?.init(h(f.name));
|
|
137
|
-
});
|
|
138
|
-
case "JUMP_TO_STATE":
|
|
139
|
-
case "JUMP_TO_ACTION":
|
|
140
|
-
return T(r.state, (n) => {
|
|
141
|
-
if (s === void 0) {
|
|
142
|
-
u(n);
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
JSON.stringify(e.getState()) !== JSON.stringify(n[s]) && u(n[s]);
|
|
146
|
-
});
|
|
147
|
-
case "IMPORT_STATE": {
|
|
148
|
-
const { nextLiftedState: n } = r.payload, a = (l = n.computedStates.slice(-1)[0]) == null ? void 0 : l.state;
|
|
149
|
-
if (!a) return;
|
|
150
|
-
u(s === void 0 ? a : a[s]), t?.send(
|
|
151
|
-
null,
|
|
152
|
-
// FIXME no-any
|
|
153
|
-
n
|
|
154
|
-
);
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
case "PAUSE_RECORDING":
|
|
158
|
-
return v = !v;
|
|
159
|
-
}
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
}), _;
|
|
163
|
-
}, D = I, T = (i, c) => {
|
|
164
|
-
let o;
|
|
165
|
-
try {
|
|
166
|
-
o = JSON.parse(i);
|
|
167
|
-
} catch (d) {
|
|
168
|
-
console.error(
|
|
169
|
-
"[zustand devtools middleware] Could not parse the received json",
|
|
170
|
-
d
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
o !== void 0 && c(o);
|
|
174
|
-
};
|
|
175
|
-
export {
|
|
176
|
-
D as devtools
|
|
177
|
-
};
|
|
@@ -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 {};
|