@ynput/ayon-frontend-shared 0.4.7 → 0.5.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 (48) hide show
  1. package/dist/DetailsPanel.es.js +684 -651
  2. package/dist/ListTable.es.js +8 -7
  3. package/dist/ProjectTreeTable.es.js +2223 -2184
  4. package/dist/Slicer.es.js +152 -120
  5. package/dist/api.es.js +202 -201
  6. package/dist/chunks/Actions.es.js +20 -20
  7. package/dist/chunks/ColumnDropIndicator.es.js +127 -241
  8. package/dist/chunks/DeleteEntitiesContext.es.js +36 -36
  9. package/dist/chunks/DetailsDialog.es.js +3 -3
  10. package/dist/chunks/EntityPath.es.js +22 -22
  11. package/dist/chunks/EntityPickerDialog.es.js +1 -1
  12. package/dist/chunks/EntityTooltip.es.js +12 -12
  13. package/dist/chunks/Feed.es.js +2 -2
  14. package/dist/chunks/FilterErrorActions.es.js +5 -5
  15. package/dist/chunks/GlobalContext.es.js +14 -14
  16. package/dist/chunks/InfoMessage.es.js +146 -0
  17. package/dist/chunks/Menu.es.js +5 -5
  18. package/dist/chunks/MenuContext.es.js +75 -73
  19. package/dist/chunks/MetaWidget.es.js +1968 -1960
  20. package/dist/chunks/NewEntityContext.es.js +538 -543
  21. package/dist/chunks/PlayableIcon.es.js +54 -54
  22. package/dist/chunks/ProjectContext.es.js +12 -12
  23. package/dist/chunks/ProjectFoldersContext.es.js +84 -76
  24. package/dist/chunks/RepresentationsList.es.js +1 -1
  25. package/dist/chunks/ReviewablesSelector.es.js +387 -384
  26. package/dist/chunks/SimpleTable.es.js +286 -283
  27. package/dist/chunks/Slicer.es.js +1121 -683
  28. package/dist/chunks/VersionUploadContext.es.js +26 -26
  29. package/dist/chunks/ViewsContext.es.js +31 -31
  30. package/dist/chunks/Watchers.es.js +1 -1
  31. package/dist/chunks/entityDefinitions.es.js +275 -133
  32. package/dist/chunks/getUris.es.js +236 -231
  33. package/dist/chunks/searchTerms.es.js +9 -0
  34. package/dist/chunks/useAttributeEnums.es.js +69 -61
  35. package/dist/chunks/useLocalStorage.es.js +10 -10
  36. package/dist/chunks/viewUpdateHelper.es.js +23 -23
  37. package/dist/components.es.js +166 -166
  38. package/dist/hooks.es.js +44 -43
  39. package/dist/index.es.js +11 -10
  40. package/dist/types/DetailsPanel.d.ts +6 -0
  41. package/dist/types/ProjectTreeTable.d.ts +28 -6
  42. package/dist/types/RepresentationsList.d.ts +3 -0
  43. package/dist/types/SimpleTable.d.ts +1 -0
  44. package/dist/types/Slicer.d.ts +103 -18
  45. package/dist/types/api.d.ts +13 -0
  46. package/dist/types/components.d.ts +7 -5
  47. package/package.json +11 -10
  48. package/dist/chunks/useSlicerSplitter.es.js +0 -18
@@ -0,0 +1,146 @@
1
+ import { jsxs as n, jsx as c } from "react/jsx-runtime";
2
+ import { forwardRef as g } from "react";
3
+ import u from "styled-components";
4
+ import m from "clsx";
5
+ import { Icon as s, Button as b } from "@ynput/ayon-react-components";
6
+ const v = u.div`
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: space-between;
10
+ gap: 16px;
11
+ padding: var(--padding-m) var(--padding-l);
12
+ border-radius: var(--border-radius-m);
13
+ font-weight: 600;
14
+
15
+ .content {
16
+ display: flex;
17
+ align-items: center;
18
+ gap: 16px;
19
+ }
20
+
21
+ .icon {
22
+ font-size: 24px;
23
+ }
24
+
25
+ &.compact {
26
+ gap: var(--base-gap-large);
27
+ padding: var(--padding-s) var(--padding-s) var(--padding-s) var(--padding-m);
28
+
29
+ .content {
30
+ gap: var(--base-gap-large);
31
+ }
32
+
33
+ .icon {
34
+ font-size: 20px;
35
+ }
36
+
37
+ button {
38
+ &,
39
+ &.hasIcon {
40
+ padding: 2px 6px;
41
+ }
42
+ gap: 4px;
43
+ }
44
+ }
45
+
46
+ /* default background */
47
+ &.info {
48
+ --message-background-color: var(--md-sys-color-secondary-container);
49
+ --message-color: var(--md-sys-color-on-secondary-container);
50
+ --button-background-color: var(--md-sys-color-secondary);
51
+ --button-background-color-hover: var(--md-sys-color-secondary-hover);
52
+ --button-color: var(--md-sys-color-on-secondary);
53
+ }
54
+
55
+ /* warning background */
56
+ &.warning {
57
+ --message-background-color: var(--md-sys-color-warning-container);
58
+ --message-color: var(--md-sys-color-on-warning-container);
59
+ --button-background-color: var(--md-sys-color-warning);
60
+ --button-background-color-hover: hsl(25, 100%, 80%);
61
+ --button-color: var(--md-sys-color-on-warning);
62
+ }
63
+
64
+ /* error background */
65
+ &.error {
66
+ --message-background-color: var(--md-sys-color-error-container);
67
+ --message-color: var(--md-sys-color-on-error-container);
68
+ --button-background-color: var(--md-sys-color-error);
69
+ --button-background-color-hover: var(--md-sys-color-error-hover);
70
+ --button-color: var(--md-sys-color-on-error);
71
+ }
72
+
73
+ /* success background */
74
+ &.success {
75
+ --message-background-color: var(--md-sys-color-tertiary-container);
76
+ --message-color: var(--md-sys-color-on-tertiary-container);
77
+ --button-background-color: var(--md-sys-color-tertiary);
78
+ --button-background-color-hover: var(--md-sys-color-tertiary-hover);
79
+ --button-color: var(--md-sys-color-on-tertiary);
80
+ }
81
+
82
+ background-color: var(--message-background-color);
83
+ &,
84
+ .icon {
85
+ color: var(--message-color);
86
+ }
87
+
88
+ button {
89
+ &,
90
+ &.hasIcon {
91
+ padding: 4px;
92
+ }
93
+ background-color: var(--button-background-color);
94
+ &,
95
+ .icon {
96
+ color: var(--button-color);
97
+ }
98
+ &:hover {
99
+ background-color: var(--button-background-color-hover);
100
+ }
101
+ }
102
+ `, w = g(
103
+ ({ variant: r = "info", message: e, icon: t, action: o, compact: d, ...a }, l) => /* @__PURE__ */ n(
104
+ v,
105
+ {
106
+ ...a,
107
+ className: m("message", a.className, r, { compact: d }),
108
+ ref: l,
109
+ children: [
110
+ /* @__PURE__ */ n("div", { className: "content", children: [
111
+ /* @__PURE__ */ c(s, { icon: t || p(r) }),
112
+ e
113
+ ] }),
114
+ o && /* @__PURE__ */ n(
115
+ b,
116
+ {
117
+ icon: o.iconPosition === "right" ? void 0 : o.icon,
118
+ onClick: (i) => {
119
+ i.stopPropagation(), o.callback();
120
+ },
121
+ children: [
122
+ o.label,
123
+ o.iconPosition === "right" && /* @__PURE__ */ c(s, { icon: o.icon })
124
+ ]
125
+ }
126
+ )
127
+ ]
128
+ }
129
+ )
130
+ ), p = (r) => {
131
+ switch (r) {
132
+ case "info":
133
+ return "info";
134
+ case "warning":
135
+ return "warning";
136
+ case "error":
137
+ return "error";
138
+ case "success":
139
+ return "done_all";
140
+ default:
141
+ return "info";
142
+ }
143
+ };
144
+ export {
145
+ w as I
146
+ };
@@ -395,10 +395,10 @@ const it = "ayon-menu-dialog", ft = "ayon-menu-content", ne = ({
395
395
  };
396
396
  export {
397
397
  te as E,
398
- ft as M,
399
- ee as a,
400
- it as b,
401
- oe as c,
402
- ne as d,
398
+ ne as M,
399
+ oe as a,
400
+ ee as b,
401
+ ft as c,
402
+ it as d,
403
403
  ot as e
404
404
  };
@@ -1,42 +1,42 @@
1
- import { jsx as C } from "react/jsx-runtime";
2
- import { createContext as N, useState as g, useEffect as T, useCallback as p, useContext as A, useRef as ae } from "react";
3
- import { u as ue, r as pe, w as de } from "./useLocalStorage.es.js";
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";
4
4
  import "lodash";
5
5
  import "primereact/confirmdialog";
6
6
  import "react-toastify";
7
7
  import "uuid";
8
8
  import { p as le, b as fe, g as ge } from "./getBundleMode.es.js";
9
9
  import "./searchTerms.es.js";
10
- import { cW as Se } from "./getUris.es.js";
10
+ import { cX as Se } from "./getUris.es.js";
11
11
  const Me = "uri", V = N(void 0), Le = ({ children: e }) => {
12
- const t = location.pathname, [n, s] = g(""), c = ["projects", "settings", "dashboard/tasks"];
12
+ const t = location.pathname, [n, s] = w(""), c = ["projects", "settings", "dashboard/tasks"];
13
13
  T(() => {
14
14
  c.some((v) => t.startsWith(`/${v}`)) || s("");
15
15
  }, [t, s]);
16
- const { type: u, entity: a, settings: i } = le(n), o = p(
16
+ const { type: u, entity: a, settings: i } = le(n), o = d(
17
17
  ({ projectName: l, folderPath: v, taskName: x, productName: M, versionName: L }) => {
18
- const m = fe({ projectName: l, folderPath: v, taskName: x, productName: M, versionName: L });
19
- s(m);
18
+ const y = fe({ projectName: l, folderPath: v, taskName: x, productName: M, versionName: L });
19
+ s(y);
20
20
  },
21
21
  [s]
22
- ), [S] = Se(), w = p(async () => {
22
+ ), [g] = Se(), S = d(async () => {
23
23
  if (u !== "entity" || !n) return [];
24
24
  try {
25
- const l = await S({ resolveRequestModel: { uris: [n] } }).unwrap();
25
+ const l = await g({ resolveRequestModel: { uris: [n] } }).unwrap();
26
26
  return console.log("Resolved entity from URI:", l), l;
27
27
  } catch (l) {
28
28
  return console.warn("Failed to resolve URI:", l), [];
29
29
  }
30
- }, [S, n, u]), d = {
30
+ }, [g, n, u]), p = {
31
31
  uri: n,
32
32
  uriType: u,
33
33
  entity: a,
34
34
  settings: i,
35
35
  setUri: s,
36
36
  setEntityUri: o,
37
- getUriEntities: w
37
+ getUriEntities: S
38
38
  };
39
- return /* @__PURE__ */ C(V.Provider, { value: d, children: e });
39
+ return /* @__PURE__ */ D(V.Provider, { value: p, children: e });
40
40
  }, we = () => {
41
41
  const e = A(V);
42
42
  if (e === void 0)
@@ -56,23 +56,25 @@ const Me = "uri", V = N(void 0), Le = ({ children: e }) => {
56
56
  } catch {
57
57
  return t;
58
58
  }
59
- }, De = (e, t) => {
59
+ }, Ce = (e, t) => {
60
60
  if (!(typeof window > "u"))
61
61
  try {
62
- sessionStorage.setItem(e, JSON.stringify(t)), window.dispatchEvent(new Event("session-storage"));
62
+ sessionStorage.setItem(e, JSON.stringify(t)), window.dispatchEvent(new CustomEvent("session-storage", { detail: { key: e } }));
63
63
  } catch (n) {
64
64
  console.error(n);
65
65
  }
66
66
  };
67
- function Y(e, t) {
67
+ function W(e, t) {
68
68
  const n = ae(t);
69
69
  n.current = t;
70
- const [s, c] = g(() => typeof window > "u" ? t : U(sessionStorage.getItem(e), t));
70
+ const [s, c] = w(() => typeof window > "u" ? t : U(sessionStorage.getItem(e), t));
71
71
  T(() => {
72
72
  const a = sessionStorage.getItem(e);
73
73
  c(U(a, n.current)), a || sessionStorage.setItem(e, JSON.stringify(n.current));
74
74
  function i(o) {
75
75
  if ("key" in o && o.key && o.key !== e) return;
76
+ const g = o.detail?.key;
77
+ if (g && g !== e) return;
76
78
  const S = sessionStorage.getItem(e);
77
79
  c(U(S, n.current));
78
80
  }
@@ -80,12 +82,12 @@ function Y(e, t) {
80
82
  window.removeEventListener("session-storage", i), window.removeEventListener("storage", i);
81
83
  };
82
84
  }, [e]);
83
- const u = p(
85
+ const u = d(
84
86
  (a) => {
85
87
  try {
86
88
  c((i) => {
87
89
  const o = typeof a == "function" ? a(i) : a;
88
- return sessionStorage.setItem(e, JSON.stringify(o)), typeof window < "u" && window.dispatchEvent(new Event("session-storage")), o;
90
+ return sessionStorage.setItem(e, JSON.stringify(o)), typeof window < "u" && window.dispatchEvent(new CustomEvent("session-storage", { detail: { key: e } })), o;
89
91
  });
90
92
  } catch (i) {
91
93
  console.error(i);
@@ -95,55 +97,55 @@ function Y(e, t) {
95
97
  );
96
98
  return [s, u];
97
99
  }
98
- const q = N(void 0), ye = ["feed", "subtasks", "details", "files"], H = (e) => typeof e == "string" && ye.includes(e), Ce = ({
100
+ const Y = N(void 0), me = ["feed", "subtasks", "details", "files"], q = (e) => typeof e == "string" && me.includes(e), De = ({
99
101
  children: e,
100
102
  defaultTab: t = "feed",
101
103
  hasLicense: n,
102
104
  debug: s = {},
103
105
  ...c
104
106
  }) => {
105
- const u = c.user, a = ge(u), i = "isGuest" in s ? s.isGuest : u?.data?.isGuest, { powerLicense: o, setPowerpackDialog: S } = ue(), w = "hasLicense" in s ? s.hasLicense : !!o || n, [d, l] = g({}), [v, x] = g([]), M = p(
106
- (r) => d[r] ? d[r] : !1,
107
- [d]
108
- ), L = p(
109
- (r, y) => {
110
- const f = { ...d };
111
- f[r] = y, l(f);
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);
112
114
  },
113
- [d]
114
- ), [m, $] = Y(b, {}), z = p(
115
+ [p]
116
+ ), [y, X] = W(b, {}), $ = d(
115
117
  (r) => {
116
- const y = m[r];
117
- return H(y) ? y : t;
118
+ const m = y[r];
119
+ return q(m) ? m : t;
118
120
  },
119
- [m, t]
120
- ), [B, F] = g(null), Q = p((r) => {
121
+ [y, t]
122
+ ), [B, F] = w(null), z = d((r) => {
121
123
  F(r);
122
- }, []), j = p(() => {
123
- F(null), B && D([]);
124
+ }, []), j = d(() => {
125
+ F(null), B && C([]);
124
126
  }, []);
125
127
  T(() => {
126
128
  j();
127
129
  }, [c.useLocation().pathname]);
128
- const [X, _] = g(null), Z = p((r) => {
130
+ const [Q, _] = w(null), Z = d((r) => {
129
131
  _(r);
130
- }, []), k = p(() => {
132
+ }, []), k = d(() => {
131
133
  _(null);
132
- }, []), [ee, R] = g(null), [te, D] = g([]), { 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");
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");
133
135
  T(() => {
134
136
  if (!(!E && !O && !I)) {
135
137
  if (ne === "entity" && h && h.entityType !== "product") {
136
138
  oe().then((r) => {
137
139
  if (r.length === 0) return;
138
- const y = r.find((ce) => ce.uri === se), f = y?.entities?.[0];
139
- if (!y || !f) return;
140
- const G = f?.projectName || h.projectName || "", W = f.representationId || f.versionId || f.productId || f.taskId || f.folderId;
141
- if (!G || !W) 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;
142
144
  const re = {
143
145
  entityType: h.entityType,
144
146
  entities: [
145
147
  {
146
- id: W,
148
+ id: K,
147
149
  projectName: G
148
150
  }
149
151
  ],
@@ -164,30 +166,30 @@ const q = N(void 0), ye = ["feed", "subtasks", "details", "files"], H = (e) => t
164
166
  }
165
167
  ],
166
168
  source: "url"
167
- }), J && (D([J]), $({
168
- ...m,
169
+ }), J && (C([J]), X({
170
+ ...y,
169
171
  overview: "feed"
170
172
  })));
171
173
  }
172
174
  }, [E, O, I]);
173
175
  const ie = {
174
176
  // open state for the panel by scope
175
- panelOpenByScope: d,
177
+ panelOpenByScope: p,
176
178
  getOpenForScope: M,
177
179
  setPanelOpen: L,
178
180
  setPanelOpenByScope: l,
179
181
  // tab preferences
180
- tabsByScope: m,
181
- getTabForScope: z,
182
+ tabsByScope: y,
183
+ getTabForScope: $,
182
184
  // slide out state
183
185
  slideOut: B,
184
- openSlideOut: Q,
186
+ openSlideOut: z,
185
187
  closeSlideOut: j,
186
188
  // highlighted activities
187
189
  highlightedActivities: te,
188
- setHighlightedActivities: D,
190
+ setHighlightedActivities: C,
189
191
  // PiP state
190
- pip: X,
192
+ pip: Q,
191
193
  openPip: Z,
192
194
  closePip: k,
193
195
  // entities state
@@ -197,35 +199,35 @@ const q = N(void 0), ye = ["feed", "subtasks", "details", "files"], H = (e) => t
197
199
  setFeedAnnotations: x,
198
200
  bundleMode: a,
199
201
  isGuest: i,
200
- hasLicense: w,
201
- onPowerFeature: S,
202
+ hasLicense: S,
203
+ onPowerFeature: g,
202
204
  ...c
203
205
  };
204
- return /* @__PURE__ */ C(q.Provider, { value: ie, children: e });
205
- }, me = () => {
206
- const e = A(q);
206
+ return /* @__PURE__ */ D(Y.Provider, { value: ie, children: e });
207
+ }, ye = () => {
208
+ const e = A(Y);
207
209
  if (e === void 0)
208
210
  throw new Error("useDetailsPanel must be used within a DetailsPanelProvider");
209
211
  return e;
210
212
  }, b = "details/tabs-by-scope", Ne = (e, t) => {
211
- const n = pe(b, {});
212
- de(b, { ...n, [e]: t });
213
+ const n = de(b, {});
214
+ pe(b, { ...n, [e]: t });
213
215
  }, Ae = (e) => {
214
- const { getOpenForScope: t, setPanelOpen: n, getTabForScope: s } = me(), [c, u] = Y(b, {}), a = c[e], i = H(a) ? a : s(e), o = p(
215
- (w) => {
216
- u((d) => ({ ...d, [e]: w }));
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 }));
217
219
  },
218
220
  [e, u]
219
- ), S = i === "feed";
221
+ ), g = i === "feed";
220
222
  return {
221
223
  isOpen: t(e),
222
- setOpen: (w) => n(e, w),
224
+ setOpen: (S) => n(e, S),
223
225
  currentTab: i,
224
226
  setTab: o,
225
- isFeed: S
227
+ isFeed: g
226
228
  };
227
- }, K = N(void 0), Be = ({ children: e, useNavigate: t }) => {
228
- const [n, s] = g(!1), c = t(), i = {
229
+ }, H = N(void 0), Be = ({ children: e, useNavigate: t }) => {
230
+ const [n, s] = w(!1), c = t(), i = {
229
231
  menuOpen: n,
230
232
  setMenuOpen: (o) => {
231
233
  s(o);
@@ -239,25 +241,25 @@ const q = N(void 0), ye = ["feed", "subtasks", "details", "files"], H = (e) => t
239
241
  },
240
242
  navigate: c
241
243
  };
242
- return /* @__PURE__ */ C(K.Provider, { value: i, children: e });
244
+ return /* @__PURE__ */ D(H.Provider, { value: i, children: e });
243
245
  }, Fe = () => {
244
- const e = A(K);
246
+ const e = A(H);
245
247
  if (e === void 0)
246
248
  throw new Error("useMenuContext must be used within a MenuProvider");
247
249
  return e;
248
250
  };
249
251
  export {
250
- Ce as D,
252
+ De as D,
251
253
  Be as M,
252
254
  Le as U,
253
- K as a,
255
+ H as a,
254
256
  Me as b,
255
- me as c,
257
+ ye as c,
256
258
  Ae as d,
257
259
  we as e,
258
- Y as f,
260
+ W as f,
259
261
  Re as r,
260
262
  Ne as s,
261
263
  Fe as u,
262
- De as w
264
+ Ce as w
263
265
  };