@ynput/ayon-frontend-shared 0.5.0 → 0.6.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.
Files changed (74) hide show
  1. package/dist/DetailsPanel.es.js +88 -86
  2. package/dist/Feed.es.js +22 -22
  3. package/dist/ListTable.es.js +77 -67
  4. package/dist/ProjectTreeTable.es.js +1164 -1150
  5. package/dist/Slicer.es.js +2 -2
  6. package/dist/Views.es.js +1 -1
  7. package/dist/api.es.js +331 -329
  8. package/dist/chunks/Actions.es.js +23 -23
  9. package/dist/chunks/DeleteEntitiesContext.es.js +115 -115
  10. package/dist/chunks/DetailsDialog.es.js +3 -3
  11. package/dist/chunks/DetailsPanelContext.es.js +155 -0
  12. package/dist/chunks/EntityPath.es.js +20 -20
  13. package/dist/chunks/EntityPickerDialog.es.js +1 -1
  14. package/dist/chunks/EntityTooltip.es.js +12 -12
  15. package/dist/chunks/EntityUpdatesContext.es.js +1 -1
  16. package/dist/chunks/Feed.es.js +2208 -2611
  17. package/dist/chunks/FilterErrorActions.es.js +1 -1
  18. package/dist/chunks/GlobalContext.es.js +14 -14
  19. package/dist/chunks/Menu.es.js +1 -1
  20. package/dist/chunks/MenuContext.es.js +51 -242
  21. package/dist/chunks/MenuItem.es.js +1 -1
  22. package/dist/chunks/MetaWidget.es.js +3341 -3899
  23. package/dist/chunks/NewEntityContext.es.js +40 -40
  24. package/dist/chunks/PlayableIcon.es.js +4261 -1163
  25. package/dist/chunks/ProjectContext.es.js +13 -13
  26. package/dist/chunks/ProjectFoldersContext.es.js +5 -5
  27. package/dist/chunks/RepresentationsList.es.js +3 -3
  28. package/dist/chunks/ReviewablesSelector.es.js +85 -76
  29. package/dist/chunks/SimpleForm.es.js +9 -9
  30. package/dist/chunks/SimpleTable.es.js +1 -1
  31. package/dist/chunks/Slicer.es.js +173 -171
  32. package/dist/chunks/TableSettingsFallback.es.js +6 -6
  33. package/dist/chunks/ThumbnailSimple.es.js +410 -61
  34. package/dist/chunks/VersionUploadContext.es.js +29 -29
  35. package/dist/chunks/ViewsContext.es.js +90 -90
  36. package/dist/chunks/Watchers.es.js +628 -598
  37. package/dist/chunks/entityDefinitions.es.js +31 -31
  38. package/dist/chunks/expandRelativeDates.es.js +27 -0
  39. package/dist/chunks/getBundleMode.es.js +16 -61
  40. package/dist/chunks/getUris.es.js +271 -269
  41. package/dist/chunks/queryFilterToClientFilter.es.js +11 -10
  42. package/dist/chunks/searchTerms.es.js +177 -173
  43. package/dist/chunks/uriUtils.es.js +48 -0
  44. package/dist/chunks/useAttributeEnums.es.js +11 -11
  45. package/dist/chunks/useColumnDragRestriction.es.js +37 -27
  46. package/dist/chunks/useDateRangeFilter.es.js +3 -3
  47. package/dist/chunks/useLocalStorage.es.js +9 -9
  48. package/dist/chunks/useSessionStorage.es.js +61 -0
  49. package/dist/chunks/viewUpdateHelper.es.js +19 -19
  50. package/dist/components.es.js +165 -160
  51. package/dist/context.es.js +60 -58
  52. package/dist/hooks.es.js +104 -98
  53. package/dist/index.es.js +18 -13
  54. package/dist/types/Actions.d.ts +16 -16
  55. package/dist/types/ContextMenu.d.ts +16 -16
  56. package/dist/types/DetailsPanel.d.ts +16 -16
  57. package/dist/types/EntityPickerDialog.d.ts +16 -16
  58. package/dist/types/Feed.d.ts +16 -16
  59. package/dist/types/ListTable.d.ts +16 -16
  60. package/dist/types/NewEntity.d.ts +16 -16
  61. package/dist/types/ProjectTreeTable.d.ts +20 -16
  62. package/dist/types/RepresentationsList.d.ts +16 -16
  63. package/dist/types/SimpleTable.d.ts +16 -16
  64. package/dist/types/Slicer.d.ts +16 -16
  65. package/dist/types/Views.d.ts +17 -17
  66. package/dist/types/api.d.ts +391 -95
  67. package/dist/types/components.d.ts +79 -20
  68. package/dist/types/context.d.ts +60 -17
  69. package/dist/types/hooks.d.ts +16 -16
  70. package/dist/types/index.d.ts +16 -16
  71. package/dist/types/util.d.ts +16 -16
  72. package/dist/util.es.js +108 -97
  73. package/package.json +16 -4
  74. package/dist/chunks/mentionTypeOptions.es.js +0 -15
@@ -7,7 +7,7 @@ import { c as B } from "./copyToClipboard.es.js";
7
7
  import "uuid";
8
8
  import "./searchTerms.es.js";
9
9
  import { useState as l, useEffect as u, useContext as k } from "react";
10
- import { bE as G } from "./getUris.es.js";
10
+ import { bF as G } from "./getUris.es.js";
11
11
  import { u as J } from "./GlobalContext.es.js";
12
12
  import { F as w } from "./ColumnDropIndicator.es.js";
13
13
  const ie = ({ children: i }) => {
@@ -1,9 +1,9 @@
1
- import { jsx as g } from "react/jsx-runtime";
1
+ import { jsx as L } from "react/jsx-runtime";
2
2
  import { createContext as v, useContext as x, useMemo as I } from "react";
3
3
  import "./searchTerms.es.js";
4
- import { cf as C, bo as G, cR as P, cA as b } from "./getUris.es.js";
4
+ import { cg as C, bp as G, cS as P, cB as b } from "./getUris.es.js";
5
5
  import "primereact/confirmdialog";
6
- const a = v(void 0), M = ({ children: r, skip: t = !1 }) => {
6
+ const a = v(void 0), A = ({ children: r, skip: t = !1 }) => {
7
7
  const {
8
8
  data: e = {},
9
9
  isLoading: i,
@@ -12,19 +12,19 @@ const a = v(void 0), M = ({ children: r, skip: t = !1 }) => {
12
12
  data: o = [],
13
13
  isLoading: l,
14
14
  error: d
15
- } = P({}, { skip: t }), f = I(() => o.filter((L) => L.active), [o]), {
16
- data: m,
17
- isLoading: p,
18
- error: j
15
+ } = P({}, { skip: t }), f = I(() => o.filter((j) => j.active), [o]), {
16
+ data: p,
17
+ isLoading: m,
18
+ error: g
19
19
  } = b(void 0, { skip: !s?.name });
20
- return /* @__PURE__ */ g(
20
+ return /* @__PURE__ */ L(
21
21
  a.Provider,
22
22
  {
23
23
  value: {
24
24
  siteInfo: e,
25
25
  attributes: e?.attributes || [],
26
26
  user: s,
27
- cloudInfo: m,
27
+ cloudInfo: p,
28
28
  projects: {
29
29
  all: o,
30
30
  active: f
@@ -32,21 +32,21 @@ const a = v(void 0), M = ({ children: r, skip: t = !1 }) => {
32
32
  isLoading: {
33
33
  siteInfo: i,
34
34
  user: u,
35
- cloudInfo: p,
35
+ cloudInfo: m,
36
36
  projects: l
37
37
  },
38
38
  error: {
39
39
  siteInfo: n,
40
40
  user: c,
41
- cloudInfo: j,
41
+ cloudInfo: g,
42
42
  projects: d
43
43
  }
44
44
  },
45
45
  children: r
46
46
  }
47
47
  );
48
- }, R = () => x(a) || {};
48
+ }, B = () => x(a) || {};
49
49
  export {
50
- M as G,
51
- R as u
50
+ A as G,
51
+ B as u
52
52
  };
@@ -4,7 +4,7 @@ import { jsx as L, jsxs as Q, Fragment as yt } from "react/jsx-runtime";
4
4
  import X, { useRef as Z, useEffect as U, useLayoutEffect as st, useState as lt, useCallback as bt } from "react";
5
5
  import { M as xt, a as Et, b as Pt, c as K, D as $, d as Lt, e as Rt, S as Ct, F as St } from "./MenuItem.es.js";
6
6
  import { Icon as Tt, Button as Ot } from "@ynput/ayon-react-components";
7
- import { u as ct } from "./useLocalStorage.es.js";
7
+ import { a as ct } from "./useLocalStorage.es.js";
8
8
  import { u as at } from "./MenuContext.es.js";
9
9
  import { createPortal as kt } from "react-dom";
10
10
  import Dt from "clsx";
@@ -1,265 +1,74 @@
1
- import { jsx as D } from "react/jsx-runtime";
2
- import { createContext as N, useState as w, useEffect as T, useCallback as d, useContext as A, useRef as ae } from "react";
3
- import { u as ue, r as de, w as pe } from "./useLocalStorage.es.js";
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import { createContext as p, useState as f, useEffect as P, useCallback as v, useContext as U } from "react";
4
3
  import "lodash";
5
4
  import "primereact/confirmdialog";
6
5
  import "react-toastify";
7
6
  import "uuid";
8
- import { p as le, b as fe, g as ge } from "./getBundleMode.es.js";
7
+ import { p as b, b as E } from "./uriUtils.es.js";
9
8
  import "./searchTerms.es.js";
10
- import { cX as Se } from "./getUris.es.js";
11
- const Me = "uri", V = N(void 0), Le = ({ children: e }) => {
12
- const t = location.pathname, [n, s] = w(""), c = ["projects", "settings", "dashboard/tasks"];
13
- T(() => {
14
- c.some((v) => t.startsWith(`/${v}`)) || s("");
15
- }, [t, s]);
16
- const { type: u, entity: a, settings: i } = le(n), o = d(
17
- ({ projectName: l, folderPath: v, taskName: x, productName: M, versionName: L }) => {
18
- const y = fe({ projectName: l, folderPath: v, taskName: x, productName: M, versionName: L });
19
- s(y);
9
+ import { cY as I } from "./getUris.es.js";
10
+ const L = "uri", x = p(void 0), N = ({ children: e }) => {
11
+ const r = location.pathname, [o, t] = f(""), a = ["projects", "settings", "dashboard/tasks"];
12
+ P(() => {
13
+ a.some((u) => r.startsWith(`/${u}`)) || t("");
14
+ }, [r, t]);
15
+ const { type: i, entity: l, settings: c } = b(o), s = v(
16
+ ({ projectName: n, folderPath: u, taskName: h, productName: C, versionName: w }) => {
17
+ const y = E({ projectName: n, folderPath: u, taskName: h, productName: C, versionName: w });
18
+ t(y);
20
19
  },
21
- [s]
22
- ), [g] = Se(), S = d(async () => {
23
- if (u !== "entity" || !n) return [];
20
+ [t]
21
+ ), [m] = I(), g = v(async () => {
22
+ if (i !== "entity" || !o) return [];
24
23
  try {
25
- const l = await g({ resolveRequestModel: { uris: [n] } }).unwrap();
26
- return console.log("Resolved entity from URI:", l), l;
27
- } catch (l) {
28
- return console.warn("Failed to resolve URI:", l), [];
29
- }
30
- }, [g, n, u]), p = {
31
- uri: n,
32
- uriType: u,
33
- entity: a,
34
- settings: i,
35
- setUri: s,
36
- setEntityUri: o,
37
- getUriEntities: S
38
- };
39
- return /* @__PURE__ */ D(V.Provider, { value: p, children: e });
40
- }, we = () => {
41
- const e = A(V);
42
- if (e === void 0)
43
- throw new Error("useURIContext must be used within a URIProvider");
44
- return e;
45
- }, U = (e, t = null) => {
46
- if (!e) return t;
47
- try {
48
- return JSON.parse(e);
49
- } catch {
50
- return t;
51
- }
52
- }, Re = (e, t) => {
53
- if (typeof window > "u") return t;
54
- try {
55
- return U(sessionStorage.getItem(e), t);
56
- } catch {
57
- return t;
58
- }
59
- }, Ce = (e, t) => {
60
- if (!(typeof window > "u"))
61
- try {
62
- sessionStorage.setItem(e, JSON.stringify(t)), window.dispatchEvent(new CustomEvent("session-storage", { detail: { key: e } }));
24
+ const n = await m({ resolveRequestModel: { uris: [o] } }).unwrap();
25
+ return console.log("Resolved entity from URI:", n), n;
63
26
  } catch (n) {
64
- console.error(n);
65
- }
66
- };
67
- function W(e, t) {
68
- const n = ae(t);
69
- n.current = t;
70
- const [s, c] = w(() => typeof window > "u" ? t : U(sessionStorage.getItem(e), t));
71
- T(() => {
72
- const a = sessionStorage.getItem(e);
73
- c(U(a, n.current)), a || sessionStorage.setItem(e, JSON.stringify(n.current));
74
- function i(o) {
75
- if ("key" in o && o.key && o.key !== e) return;
76
- const g = o.detail?.key;
77
- if (g && g !== e) return;
78
- const S = sessionStorage.getItem(e);
79
- c(U(S, n.current));
80
- }
81
- return window.addEventListener("session-storage", i), window.addEventListener("storage", i), () => {
82
- window.removeEventListener("session-storage", i), window.removeEventListener("storage", i);
83
- };
84
- }, [e]);
85
- const u = d(
86
- (a) => {
87
- try {
88
- c((i) => {
89
- const o = typeof a == "function" ? a(i) : a;
90
- return sessionStorage.setItem(e, JSON.stringify(o)), typeof window < "u" && window.dispatchEvent(new CustomEvent("session-storage", { detail: { key: e } })), o;
91
- });
92
- } catch (i) {
93
- console.error(i);
94
- }
95
- },
96
- [e]
97
- );
98
- return [s, u];
99
- }
100
- const Y = N(void 0), me = ["feed", "subtasks", "details", "files"], q = (e) => typeof e == "string" && me.includes(e), De = ({
101
- children: e,
102
- defaultTab: t = "feed",
103
- hasLicense: n,
104
- debug: s = {},
105
- ...c
106
- }) => {
107
- const u = c.user, a = ge(u), i = "isGuest" in s ? s.isGuest : u?.data?.isGuest, { powerLicense: o, setPowerpackDialog: g } = ue(), S = "hasLicense" in s ? s.hasLicense : !!o || n, [p, l] = w({}), [v, x] = w([]), M = d(
108
- (r) => p[r] ? p[r] : !1,
109
- [p]
110
- ), L = d(
111
- (r, m) => {
112
- const f = { ...p };
113
- f[r] = m, l(f);
114
- },
115
- [p]
116
- ), [y, X] = W(b, {}), $ = d(
117
- (r) => {
118
- const m = y[r];
119
- return q(m) ? m : t;
120
- },
121
- [y, t]
122
- ), [B, F] = w(null), z = d((r) => {
123
- F(r);
124
- }, []), j = d(() => {
125
- F(null), B && C([]);
126
- }, []);
127
- T(() => {
128
- j();
129
- }, [c.useLocation().pathname]);
130
- const [Q, _] = w(null), Z = d((r) => {
131
- _(r);
132
- }, []), k = d(() => {
133
- _(null);
134
- }, []), [ee, R] = w(null), [te, C] = w([]), { uriType: ne, uri: se, entity: h, getUriEntities: oe } = we(), [P] = c.useSearchParams(), E = P.get("project"), O = P.get("type"), I = P.get("id"), J = P.get("activity");
135
- T(() => {
136
- if (!(!E && !O && !I)) {
137
- if (ne === "entity" && h && h.entityType !== "product") {
138
- oe().then((r) => {
139
- if (r.length === 0) return;
140
- const m = r.find((ce) => ce.uri === se), f = m?.entities?.[0];
141
- if (!m || !f) return;
142
- const G = f?.projectName || h.projectName || "", K = f.representationId || f.versionId || f.productId || f.taskId || f.folderId;
143
- if (!G || !K) return;
144
- const re = {
145
- entityType: h.entityType,
146
- entities: [
147
- {
148
- id: K,
149
- projectName: G
150
- }
151
- ],
152
- source: "uri"
153
- };
154
- R(re);
155
- }).catch((r) => {
156
- console.warn("Failed to get URI entities:", r);
157
- });
158
- return;
159
- }
160
- E && O && I && (R({
161
- entityType: O,
162
- entities: [
163
- {
164
- id: I,
165
- projectName: E
166
- }
167
- ],
168
- source: "url"
169
- }), J && (C([J]), X({
170
- ...y,
171
- overview: "feed"
172
- })));
27
+ return console.warn("Failed to resolve URI:", n), [];
173
28
  }
174
- }, [E, O, I]);
175
- const ie = {
176
- // open state for the panel by scope
177
- panelOpenByScope: p,
178
- getOpenForScope: M,
179
- setPanelOpen: L,
180
- setPanelOpenByScope: l,
181
- // tab preferences
182
- tabsByScope: y,
183
- getTabForScope: $,
184
- // slide out state
185
- slideOut: B,
186
- openSlideOut: z,
187
- closeSlideOut: j,
188
- // highlighted activities
189
- highlightedActivities: te,
190
- setHighlightedActivities: C,
191
- // PiP state
192
- pip: Q,
193
- openPip: Z,
194
- closePip: k,
195
- // entities state
196
- entities: ee,
197
- setEntities: R,
198
- feedAnnotations: v,
199
- setFeedAnnotations: x,
200
- bundleMode: a,
201
- isGuest: i,
202
- hasLicense: S,
203
- onPowerFeature: g,
204
- ...c
29
+ }, [m, o, i]), R = {
30
+ uri: o,
31
+ uriType: i,
32
+ entity: l,
33
+ settings: c,
34
+ setUri: t,
35
+ setEntityUri: s,
36
+ getUriEntities: g
205
37
  };
206
- return /* @__PURE__ */ D(Y.Provider, { value: ie, children: e });
207
- }, ye = () => {
208
- const e = A(Y);
38
+ return /* @__PURE__ */ d(x.Provider, { value: R, children: e });
39
+ }, T = () => {
40
+ const e = U(x);
209
41
  if (e === void 0)
210
- throw new Error("useDetailsPanel must be used within a DetailsPanelProvider");
42
+ throw new Error("useURIContext must be used within a URIProvider");
211
43
  return e;
212
- }, b = "details/tabs-by-scope", Ne = (e, t) => {
213
- const n = de(b, {});
214
- pe(b, { ...n, [e]: t });
215
- }, Ae = (e) => {
216
- const { getOpenForScope: t, setPanelOpen: n, getTabForScope: s } = ye(), [c, u] = W(b, {}), a = c[e], i = q(a) ? a : s(e), o = d(
217
- (S) => {
218
- u((p) => ({ ...p, [e]: S }));
219
- },
220
- [e, u]
221
- ), g = i === "feed";
222
- return {
223
- isOpen: t(e),
224
- setOpen: (S) => n(e, S),
225
- currentTab: i,
226
- setTab: o,
227
- isFeed: g
228
- };
229
- }, H = N(void 0), Be = ({ children: e, useNavigate: t }) => {
230
- const [n, s] = w(!1), c = t(), i = {
231
- menuOpen: n,
232
- setMenuOpen: (o) => {
233
- s(o);
44
+ }, V = p(void 0), M = p(void 0), W = ({ children: e, useNavigate: r }) => {
45
+ const [o, t] = f(!1), a = r(), c = {
46
+ menuOpen: o,
47
+ setMenuOpen: (s) => {
48
+ t(s);
234
49
  },
235
- toggleMenuOpen: (o) => {
236
- if (!o) {
237
- s(!1);
50
+ toggleMenuOpen: (s) => {
51
+ if (!s) {
52
+ t(!1);
238
53
  return;
239
54
  }
240
- s(o === n ? !1 : o);
55
+ t(s === o ? !1 : s);
241
56
  },
242
- navigate: c
57
+ navigate: a
243
58
  };
244
- return /* @__PURE__ */ D(H.Provider, { value: i, children: e });
245
- }, Fe = () => {
246
- const e = A(H);
59
+ return /* @__PURE__ */ d(M.Provider, { value: c, children: e });
60
+ }, Y = () => {
61
+ const e = U(M);
247
62
  if (e === void 0)
248
63
  throw new Error("useMenuContext must be used within a MenuProvider");
249
64
  return e;
250
65
  };
251
66
  export {
252
- De as D,
253
- Be as M,
254
- Le as U,
255
- H as a,
256
- Me as b,
257
- ye as c,
258
- Ae as d,
259
- we as e,
260
- W as f,
261
- Re as r,
262
- Ne as s,
263
- Fe as u,
264
- Ce as w
67
+ V as D,
68
+ W as M,
69
+ N as U,
70
+ M as a,
71
+ L as b,
72
+ T as c,
73
+ Y as u
265
74
  };
@@ -5,7 +5,7 @@ import r, { keyframes as z } from "styled-components";
5
5
  import { isArray as E } from "lodash";
6
6
  import { Link as L } from "react-router-dom";
7
7
  import P from "clsx";
8
- import { u as G } from "./useLocalStorage.es.js";
8
+ import { a as G } from "./useLocalStorage.es.js";
9
9
  const u = 42, S = 8, Q = u + S, V = r.dialog`
10
10
  position: fixed;
11
11
  margin: 0;