@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.
Files changed (241) hide show
  1. package/AccessToken2.js +1 -1
  2. package/ActiveFilters.js +49 -50
  3. package/AddMedia.js +19 -18
  4. package/Advanced.js +13 -13
  5. package/App.js +60 -59
  6. package/Arrow.js +1 -1
  7. package/AssetFilter.js +38 -38
  8. package/AssetItem.js +10 -17
  9. package/AssetList.js +5 -5
  10. package/AssetTypeItem.js +21 -21
  11. package/AssetsView.js +13 -13
  12. package/Axios2.js +82 -76
  13. package/AxiosError.js +36 -35
  14. package/ButtonAction.js +1 -1
  15. package/CanceledError.js +15 -8
  16. package/Card.js +1 -1
  17. package/Chip.js +1 -1
  18. package/CollectionCard.js +22 -22
  19. package/CollectionItem.js +9 -9
  20. package/CollectionList.js +5 -5
  21. package/CollectionView.js +11 -11
  22. package/ColorPicker.js +1 -1
  23. package/ColorPickerSolid.js +3 -3
  24. package/ColorPickerWithOpacity.js +3 -3
  25. package/Component.js +158 -0
  26. package/Component2.js +4 -0
  27. package/ConfigContext.js +7 -8
  28. package/Container.js +1 -1
  29. package/ContextAction.js +1 -1
  30. package/ControlGroup.js +6 -6
  31. package/Dat.js +33 -32
  32. package/DatDropdownItem.js +1 -1
  33. package/DesignSystemProvider.js +7 -7
  34. package/DirectionSelect.js +11 -10
  35. package/DomainInput.js +19 -11
  36. package/Draggable.js +337 -0
  37. package/Draggable2.js +4 -0
  38. package/DraggableCore.js +312 -0
  39. package/DraggableCore2.js +4 -0
  40. package/Dropdown.js +37 -37
  41. package/Dropdown2.js +1 -1
  42. package/DropdownListItem.js +1 -1
  43. package/FieldSelect.js +19 -17
  44. package/FileSelector.js +38 -37
  45. package/FontPicker.js +1 -1
  46. package/Form.js +1 -1
  47. package/Header.js +5 -4
  48. package/HttpStatusCode.js +7 -1
  49. package/InfiniteScroll.js +1 -1
  50. package/InlineBanner.js +1 -1
  51. package/Input.js +1 -1
  52. package/InterceptorManager.js +2 -1
  53. package/Item.js +8 -8
  54. package/Item4.js +2 -2
  55. package/LeftArrow.js +1 -1
  56. package/ListItem2.js +1 -1
  57. package/ModalBase.js +15 -15
  58. package/NoResults.js +1 -1
  59. package/Option_new.js +36 -29
  60. package/ReactPropTypesSecret.js +10 -0
  61. package/RightArrow.js +1 -1
  62. package/SearchInput.js +1 -1
  63. package/SearchInput2.js +1 -1
  64. package/SelectionFooter.js +41 -31
  65. package/Shield.js +2 -2
  66. package/Smartfilters_new.js +107 -98
  67. package/StatefulAssetList.js +50 -50
  68. package/StoreInitializer.js +32 -16
  69. package/SwitchNLS.js +1 -1
  70. package/TagItem.js +15 -15
  71. package/Tags.js +1 -1
  72. package/Toolbar.js +23 -20
  73. package/Tooltip2.js +1 -1
  74. package/ViewSwitch.js +17 -15
  75. package/_commonjsHelpers.js +28 -3
  76. package/adapters.js +54 -42
  77. package/api/filterAssets.d.ts +1 -1
  78. package/api/getAssets.d.ts +1 -1
  79. package/api/getFilters.d.ts +1 -1
  80. package/api/rest/index.d.ts +1 -1
  81. package/api/rest/types.d.ts +1 -1
  82. package/api2.js +1 -1
  83. package/asset.type.js +1 -1
  84. package/axios.js +1 -1
  85. package/bodyScrollLock.esm.js +68 -0
  86. package/buildURL.js +13 -15
  87. package/checkGlobals.js +1 -1
  88. package/cjs.js +7 -0
  89. package/cjs2.js +15 -0
  90. package/cjs3.js +4 -0
  91. package/clsx.m.js +6 -0
  92. package/clsx.m2.js +15 -0
  93. package/combineMetaproperties.js +3 -1
  94. package/composeSignals.js +1 -1
  95. package/cookieStore.js +1 -1
  96. package/cookies.js +13 -11
  97. package/currentScopes.js +1 -1
  98. package/data.js +1 -1
  99. package/devUtils.js +1 -1
  100. package/dispatchRequest.js +5 -5
  101. package/domFns.js +151 -0
  102. package/domFns2.js +4 -0
  103. package/factoryWithThrowingShims.js +52 -0
  104. package/fetch2.js +156 -128
  105. package/filter/AssetFilterContext.d.ts +3 -3
  106. package/getPrefix.js +35 -0
  107. package/getPrefix2.js +4 -0
  108. package/goober.modern.js +75 -0
  109. package/handlers.js +1 -1
  110. package/iconBase.js +56 -0
  111. package/iconContext.js +12 -0
  112. package/iconsManifest.js +222 -0
  113. package/index-esm.js +1 -4
  114. package/index.browser.js +1 -1
  115. package/index.m.js +9 -0
  116. package/index.m2.js +17 -0
  117. package/index10.js +1 -1
  118. package/index11.js +181 -15
  119. package/index112.js +1 -1
  120. package/index12.js +313 -36
  121. package/index13.js +5 -2430
  122. package/index14.js +3 -557
  123. package/index15.js +15 -55
  124. package/index16.js +3 -2
  125. package/index17.js +3 -87
  126. package/index18.js +36 -7
  127. package/index19.js +3 -60
  128. package/index20.js +2429 -12
  129. package/index21.js +557 -10
  130. package/index22.js +1 -1
  131. package/index23.js +119 -6
  132. package/index24.js +39 -7
  133. package/index25.js +2 -5
  134. package/index26.js +86 -9
  135. package/index27.js +55 -8
  136. package/index28.js +6 -636
  137. package/index29.js +8692 -74
  138. package/index3.js +1684 -5
  139. package/index30.js +2 -5
  140. package/index31.js +4 -20
  141. package/index310.js +2 -0
  142. package/index32.js +11 -2
  143. package/index33.js +5083 -4
  144. package/index34.js +2 -18
  145. package/index35.js +59 -5
  146. package/index36.js +2 -2
  147. package/index37.js +13 -11
  148. package/index38.js +46 -10
  149. package/index39.js +6 -12
  150. package/index4.js +5 -1684
  151. package/index40.js +8 -11
  152. package/index41.js +26 -18
  153. package/index42.js +2 -64
  154. package/index43.js +63 -5
  155. package/index44.js +9 -55
  156. package/index45.js +7 -67
  157. package/index46.js +8 -31
  158. package/index47.js +5 -11
  159. package/index48.js +10 -121
  160. package/index49.js +9 -86
  161. package/index5.js +215 -23
  162. package/index50.js +636 -7
  163. package/index51.js +74 -11
  164. package/index52.js +4 -13
  165. package/index53.js +19 -13
  166. package/index54.js +4 -6
  167. package/index55.js +18 -7
  168. package/index56.js +5 -14
  169. package/index57.js +10 -28
  170. package/index58.js +10 -15
  171. package/index59.js +15 -0
  172. package/index6.js +250 -299
  173. package/index60.js +13 -0
  174. package/index61.js +21 -0
  175. package/index62.js +8 -0
  176. package/index63.js +57 -0
  177. package/index64.js +4 -0
  178. package/index65.js +69 -0
  179. package/index66.js +33 -0
  180. package/index67.js +13 -0
  181. package/index68.js +123 -0
  182. package/index69.js +88 -0
  183. package/index7.js +25 -2
  184. package/index70.js +10 -0
  185. package/index71.js +13 -0
  186. package/index72.js +13 -225
  187. package/index73.js +16 -0
  188. package/index74.js +9 -0
  189. package/index75.js +228 -0
  190. package/index76.js +9 -0
  191. package/index77.js +17 -0
  192. package/index78.js +31 -0
  193. package/index79.js +18 -0
  194. package/index8.js +1537 -1536
  195. package/index9.js +1 -1
  196. package/isAbsoluteURL.js +1 -1
  197. package/isURLSameOrigin.js +1 -1
  198. package/localization.js +15 -15
  199. package/log.js +14 -0
  200. package/log2.js +4 -0
  201. package/matchRequestUrl.js +1 -1
  202. package/mergeConfig.js +37 -32
  203. package/notify.js +2 -2
  204. package/package.json +1 -1
  205. package/positionFns.js +101 -0
  206. package/positionFns2.js +4 -0
  207. package/react-laag.esm.js +957 -0
  208. package/react.js +8 -8
  209. package/react2.js +9 -9
  210. package/resolveConfig.js +23 -23
  211. package/select/add-media/AddMedia.d.ts +3 -1
  212. package/select/current-selection/SelectedItems.d.ts +1 -1
  213. package/shims.js +29 -0
  214. package/shims2.js +4 -0
  215. package/store/StoreInitializer.d.ts +5 -1
  216. package/store/useAssetFilterStore.d.ts +55 -0
  217. package/store/useSelectionStore.d.ts +47 -0
  218. package/styled-components.browser.esm.js +2 -2
  219. package/throttle.js +1 -1
  220. package/toURLEncodedForm.js +11 -10
  221. package/tokenExpirationHelper.js +1 -1
  222. package/transformData.js +1 -1
  223. package/transitional.js +4 -3
  224. package/useAssetFilterStore.js +152 -0
  225. package/useDatStore.js +1 -1
  226. package/useEffectEvent.js +7 -7
  227. package/useFonts.js +1 -1
  228. package/useOrderingStore.js +1 -1
  229. package/useRouterStore.js +1 -1
  230. package/useSearchStore.js +1 -1
  231. package/useSelectionStore.js +131 -0
  232. package/useSimilaritySearchStore.js +1 -1
  233. package/useTranslate.js +1 -1
  234. package/utils/combineMetaproperties.d.ts +2 -0
  235. package/utils6.js +160 -118
  236. package/xhr.js +47 -46
  237. package/AssetFilterContext.js +0 -161
  238. package/Middleware.js +0 -49
  239. package/SelectionContext.js +0 -143
  240. package/middleware2.js +0 -177
  241. package/select/SelectionContext.d.ts +0 -30
@@ -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
- };
@@ -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 {};