@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
@@ -1,9 +1,9 @@
1
- import { u as W, a as ce } from "./useLocalStorage.es.js";
1
+ import { a as W, u as ce } from "./useLocalStorage.es.js";
2
2
  import { jsx as ue } from "react/jsx-runtime";
3
3
  import { useState as Se, useEffect as M, useRef as I, useCallback as S, useMemo as G, useContext as ae } from "react";
4
- import { r as U, w as ie, f as ye } from "./MenuContext.es.js";
5
- import { S as fe, b as X } from "./MetaWidget.es.js";
6
- const he = () => {
4
+ import { r as U, w as ie, u as ye } from "./useSessionStorage.es.js";
5
+ import { S as he, b as X } from "./MetaWidget.es.js";
6
+ const fe = () => {
7
7
  const r = () => ({
8
8
  formatStatuses: () => [],
9
9
  formatTaskTypes: () => [],
@@ -19,22 +19,22 @@ const he = () => {
19
19
  fallback: r,
20
20
  skip: !n
21
21
  // skip loading if powerpack license is not available
22
- }), [f] = ce({
22
+ }), [h] = ce({
23
23
  addon: "powerpack",
24
24
  remote: "slicer",
25
25
  module: "SlicerDropdown",
26
- fallback: fe,
26
+ fallback: he,
27
27
  skip: !n
28
28
  // skip loading if powerpack license is not available
29
29
  });
30
- return { useExtraSlices: c, isLoadingExtraSlices: a, SlicerDropdown: f };
30
+ return { useExtraSlices: c, isLoadingExtraSlices: a, SlicerDropdown: h };
31
31
  }, xe = ["slicer-selection-", "slicer-expanded-"], oe = (r, n, c) => c === "hierarchy" ? `slicer-selection-hierarchy-${r}` : `slicer-selection-${r}-${n}-${c}`, re = (r, n, c) => c === "hierarchy" ? `slicer-expanded-hierarchy-${r}` : `slicer-expanded-${r}-${n}-${c}`, ve = ({
32
32
  sliceTypes: r,
33
33
  page: n,
34
34
  projectName: c,
35
35
  ...a
36
36
  }) => {
37
- const [f, _] = Se(0);
37
+ const [h, _] = Se(0);
38
38
  M(() => {
39
39
  const e = (i) => {
40
40
  const o = i.detail?.key ?? ("key" in i ? i.key : void 0);
@@ -44,38 +44,38 @@ const he = () => {
44
44
  window.removeEventListener("session-storage", e), window.removeEventListener("storage", e);
45
45
  };
46
46
  }, []);
47
- const L = I(/* @__PURE__ */ new Map()), h = S((e, i) => {
47
+ const L = I(/* @__PURE__ */ new Map()), f = S((e, i) => {
48
48
  const o = typeof window > "u" ? null : sessionStorage.getItem(e), y = L.current.get(e);
49
49
  if (y && y.raw === o) return y.value;
50
50
  const T = U(e, i);
51
51
  return L.current.set(e, { raw: o, value: T }), T;
52
52
  }, []), s = r[0], u = S(
53
- (e) => a.rowSelection !== void 0 && e === s ? a.rowSelection : h(oe(c, n, e), {}),
53
+ (e) => a.rowSelection !== void 0 && e === s ? a.rowSelection : f(oe(c, n, e), {}),
54
54
  // storageVersion invalidates memoized reads when any bucket changes
55
- [a.rowSelection, s, c, n, h, f]
55
+ [a.rowSelection, s, c, n, f, h]
56
56
  ), x = S(
57
57
  (e, i) => {
58
58
  if (a.setRowSelection && e === s) {
59
59
  a.setRowSelection(i);
60
60
  return;
61
61
  }
62
- const o = oe(c, n, e), y = typeof i == "function" ? i(h(o, {})) : i;
62
+ const o = oe(c, n, e), y = typeof i == "function" ? i(f(o, {})) : i;
63
63
  ie(o, y);
64
64
  },
65
- [a.setRowSelection, s, c, n, h]
65
+ [a.setRowSelection, s, c, n, f]
66
66
  ), D = S(
67
- (e) => a.expanded !== void 0 && e === s ? a.expanded : h(re(c, n, e), {}),
68
- [a.expanded, s, c, n, h, f]
67
+ (e) => a.expanded !== void 0 && e === s ? a.expanded : f(re(c, n, e), {}),
68
+ [a.expanded, s, c, n, f, h]
69
69
  ), P = S(
70
70
  (e, i) => {
71
71
  if (a.setExpanded && e === s) {
72
72
  a.setExpanded(i);
73
73
  return;
74
74
  }
75
- const o = re(c, n, e), y = typeof i == "function" ? i(h(o, {})) : i;
75
+ const o = re(c, n, e), y = typeof i == "function" ? i(f(o, {})) : i;
76
76
  ie(o, y);
77
77
  },
78
- [a.setExpanded, s, c, n, h]
78
+ [a.setExpanded, s, c, n, f]
79
79
  ), w = u(s), b = S(
80
80
  (e, i = s) => x(i, e),
81
81
  [x, s]
@@ -129,10 +129,10 @@ const he = () => {
129
129
  page: n,
130
130
  projectName: c,
131
131
  viewSettings: a,
132
- isLoadingViews: f,
132
+ isLoadingViews: h,
133
133
  updateViewSettings: _,
134
134
  onOpenViewer: L,
135
- onAddToList: h,
135
+ onAddToList: f,
136
136
  ...s
137
137
  }) => {
138
138
  const [u, x] = ye(
@@ -191,11 +191,11 @@ const he = () => {
191
191
  [o, v, e]
192
192
  ), $ = `${c}-${n}`, Q = I(/* @__PURE__ */ new Set());
193
193
  M(() => {
194
- !g || f || Q.current.has($) || (Q.current.add($), Object.keys(H("hierarchy")).length || (R("hierarchy", u.rowSelection), C("hierarchy", u.expanded)), v(e));
195
- }, [g, f, $]);
194
+ !g || h || Q.current.has($) || (Q.current.add($), Object.keys(H("hierarchy")).length || (R("hierarchy", u.rowSelection), C("hierarchy", u.expanded)), v(e));
195
+ }, [g, h, $]);
196
196
  const Y = I(/* @__PURE__ */ new Set());
197
197
  M(() => {
198
- if (Y.current.has($) || f || s.sliceType || s.rowSelection || s.setRowSelection || w?.length)
198
+ if (Y.current.has($) || h || s.sliceType || s.rowSelection || s.setRowSelection || w?.length)
199
199
  return;
200
200
  Y.current.add($);
201
201
  const t = `slicer-selection-${c}-${n}`, d = `slicer-expanded-${c}-${n}`, l = k[0];
@@ -211,9 +211,9 @@ const he = () => {
211
211
  }
212
212
  }
213
213
  sessionStorage.removeItem(t), sessionStorage.removeItem(d);
214
- }, [f, w, $]), M(() => {
215
- le.includes(n) && !s.sliceType && !f && u && !g && x(null);
216
- }, [n, s.sliceType, f, u, g, x]);
214
+ }, [h, w, $]), M(() => {
215
+ le.includes(n) && !s.sliceType && !h && u && !g && x(null);
216
+ }, [n, s.sliceType, h, u, g, x]);
217
217
  const Z = S(
218
218
  (t, d) => {
219
219
  if (D && e.slice(1).includes(t)) return;
@@ -268,7 +268,7 @@ const he = () => {
268
268
  B(t);
269
269
  },
270
270
  [B]
271
- ), { useExtraSlices: ee, isLoadingExtraSlices: te, SlicerDropdown: se } = he(), de = G(
271
+ ), { useExtraSlices: ee, isLoadingExtraSlices: te, SlicerDropdown: se } = fe(), de = G(
272
272
  () => ({
273
273
  projectName: c,
274
274
  page: n,
@@ -298,9 +298,9 @@ const he = () => {
298
298
  expanded: O,
299
299
  onExpandedChange: N,
300
300
  // loading state
301
- isViewSyncPending: f,
301
+ isViewSyncPending: h,
302
302
  onOpenViewer: L,
303
- onAddToList: h
303
+ onAddToList: f
304
304
  }),
305
305
  [
306
306
  n,
@@ -325,9 +325,9 @@ const he = () => {
325
325
  x,
326
326
  O,
327
327
  N,
328
- f,
328
+ h,
329
329
  L,
330
- h
330
+ f
331
331
  ]
332
332
  );
333
333
  return /* @__PURE__ */ ue(X.Provider, { value: de, children: r });
@@ -356,7 +356,7 @@ export {
356
356
  Te as a,
357
357
  Ce as b,
358
358
  Ee as c,
359
- he as d,
359
+ fe as d,
360
360
  ve as e,
361
361
  $e as n,
362
362
  Re as u
@@ -0,0 +1,27 @@
1
+ import { f as r } from "./PlayableIcon.es.js";
2
+ const a = "relative:", i = (t) => typeof t == "string" && t.startsWith(a), o = (t) => {
3
+ const e = t.replace(a, "").split(":");
4
+ if (e.length !== 2) return null;
5
+ const n = e[0], s = parseInt(e[1], 10);
6
+ return !(n in r) || isNaN(s) ? null : { patternId: n, index: s };
7
+ }, c = (t) => {
8
+ const e = o(t);
9
+ return e ? r[e.patternId]()[e.index]?.id ?? t : t;
10
+ }, d = (t, e) => `${a}${t}:${e}`, l = (t) => {
11
+ if (!t.conditions || t.conditions.length === 0)
12
+ return t;
13
+ const e = t.conditions.map((n) => {
14
+ if ("key" in n) {
15
+ const s = n;
16
+ return i(s.value) ? { ...s, value: c(s.value) } : s;
17
+ } else
18
+ return l(n);
19
+ });
20
+ return { ...t, conditions: e };
21
+ };
22
+ export {
23
+ d as c,
24
+ l as e,
25
+ i,
26
+ c as r
27
+ };
@@ -1,68 +1,23 @@
1
- import { b1 as g } from "./searchTerms.es.js";
2
- import { toast as f } from "react-toastify";
3
- const p = (t) => {
4
- const s = t.split("://")[1].split("?"), e = s[0], r = s[1];
5
- return {
6
- baseUri: e,
7
- queryParams: new URLSearchParams(r || "")
8
- };
9
- }, P = ({
10
- projectName: t,
11
- folderPath: s,
12
- taskName: e,
13
- productName: r,
14
- versionName: a
15
- }) => {
16
- const n = new URL(`ayon+entity://${t}/${s}`);
17
- return e && n.searchParams.append("task", e), r && n.searchParams.append("product", r), a && n.searchParams.append("version", a), n.toString();
18
- }, u = (t) => {
19
- const { baseUri: s, queryParams: e } = p(t), r = s.split("/"), a = r[0], n = r.slice(1), [o, c] = a.split(":"), d = e.get("site") ?? void 0, i = e.get("project") ?? void 0;
20
- return {
21
- addonName: o,
22
- addonVersion: c,
23
- settingsPath: n,
24
- site: d,
25
- project: i
26
- };
27
- }, l = (t) => {
28
- const { baseUri: s, queryParams: e } = p(t), r = s.split("/"), a = r[0], n = r.slice(1).join("/"), o = e.get("task") ?? void 0, c = e.get("product") ?? void 0, d = e.get("version") ?? void 0;
29
- let i;
30
- return d ? i = "version" : c ? i = "product" : o ? i = "task" : i = "folder", {
31
- projectName: a,
32
- entityType: i,
33
- folderPath: n,
34
- taskName: o,
35
- productName: c,
36
- versionName: d
37
- };
38
- }, U = (t) => t ? t.startsWith("ayon+settings://") ? {
39
- type: "settings",
40
- settings: u(t)
41
- } : t.startsWith("ayon+entity://") ? {
42
- type: "entity",
43
- entity: l(t)
44
- } : { type: void 0 } : { type: void 0 }, v = (t) => t?.attrib?.developerMode ? "developer" : t?.data?.frontendPreferences?.stagingMode ? "staging" : "production", M = (t, s) => {
45
- const [e] = g();
46
- return [t?.data?.frontendPreferences?.stagingMode ?? !1, async (n) => {
1
+ import { b2 as a } from "./searchTerms.es.js";
2
+ import { toast as s } from "react-toastify";
3
+ const f = (e) => e?.attrib?.developerMode ? "developer" : e?.data?.frontendPreferences?.stagingMode ? "staging" : "production", u = (e, r) => {
4
+ const [n] = a();
5
+ return [e?.data?.frontendPreferences?.stagingMode ?? !1, async (o) => {
47
6
  try {
48
- const o = {
49
- ...t?.data?.frontendPreferences || {},
50
- stagingMode: n
7
+ const t = {
8
+ ...e?.data?.frontendPreferences || {},
9
+ stagingMode: o
51
10
  };
52
- e({
53
- userName: t.name,
54
- patchData: o
55
- }).unwrap(), s && s(o);
56
- } catch (o) {
57
- console.error(o), f.error("Failed to update staging mode");
11
+ n({
12
+ userName: e.name,
13
+ patchData: t
14
+ }).unwrap(), r && r(t);
15
+ } catch (t) {
16
+ console.error(t), s.error("Failed to update staging mode");
58
17
  }
59
18
  }];
60
19
  };
61
20
  export {
62
- l as a,
63
- P as b,
64
- u as c,
65
- v as g,
66
- U as p,
67
- M as u
21
+ f as g,
22
+ u
68
23
  };