@ynput/ayon-frontend-shared 0.6.5 → 0.6.7

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 (46) hide show
  1. package/dist/DetailsPanel.es.js +3 -3
  2. package/dist/NewEntity.es.js +15 -15
  3. package/dist/ProjectTreeTable.es.js +430 -433
  4. package/dist/Slicer.es.js +11 -11
  5. package/dist/Views.es.js +213 -206
  6. package/dist/chunks/CodeEditor.es.js +30 -0
  7. package/dist/chunks/ColumnDropIndicator.styled.es.js +24 -24
  8. package/dist/chunks/ColumnHeaderMenuUI.es.js +2 -2
  9. package/dist/chunks/DeleteEntitiesContextInstance.es.js +103 -103
  10. package/dist/chunks/EntityPath.es.js +2 -2
  11. package/dist/chunks/EntityTooltip.es.js +1 -1
  12. package/dist/chunks/Feed.es.js +958 -931
  13. package/dist/chunks/JsonViewer.es.js +1 -1
  14. package/dist/chunks/Menu.es.js +169 -167
  15. package/dist/chunks/MenuItem.es.js +109 -74
  16. package/dist/chunks/MetaWidget.es.js +1537 -1516
  17. package/dist/chunks/PlayableIcon.es.js +127 -127
  18. package/dist/chunks/ReviewablesSelector.es.js +199 -196
  19. package/dist/chunks/SimpleForm.es.js +78 -75
  20. package/dist/chunks/SimpleTable.es.js +110 -110
  21. package/dist/chunks/Slicer.es.js +22 -22
  22. package/dist/chunks/TableSettingsFallback.es.js +1 -1
  23. package/dist/chunks/ThumbnailSimple.es.js +2 -2
  24. package/dist/chunks/VideoPlayer.es.js +1 -1
  25. package/dist/chunks/Watchers.es.js +19 -19
  26. package/dist/chunks/afterStartup.es.js +13 -0
  27. package/dist/chunks/getUris.es.js +926 -964
  28. package/dist/chunks/queryFilterToClientFilter.es.js +90 -81
  29. package/dist/chunks/searchTerms.es.js +1 -0
  30. package/dist/chunks/useHierarchySelection.es.js +2 -2
  31. package/dist/chunks/useLoadModule.es.js +24 -23
  32. package/dist/components.es.js +202 -200
  33. package/dist/context.es.js +521 -492
  34. package/dist/hooks.es.js +190 -166
  35. package/dist/types/ContextMenu.d.ts +1 -0
  36. package/dist/types/Feed.d.ts +1 -1
  37. package/dist/types/ProjectTreeTable.d.ts +4 -5
  38. package/dist/types/Slicer.d.ts +1 -1
  39. package/dist/types/Views.d.ts +13 -2
  40. package/dist/types/api.d.ts +203 -1175
  41. package/dist/types/components.d.ts +14 -3
  42. package/dist/types/context.d.ts +3 -2
  43. package/dist/types/hooks.d.ts +25 -1
  44. package/dist/types/util.d.ts +11 -1
  45. package/dist/util.es.js +44 -41
  46. package/package.json +2 -2
@@ -1,19 +1,27 @@
1
- import { jsx as c, jsxs as O, Fragment as I } from "react/jsx-runtime";
2
- import { useState as V, useEffect as v, useMemo as D, useRef as B, useCallback as R } from "react";
3
- import { getTextColor as K, InputTextarea as P, InputText as W, InputSwitch as z, InputNumber as k, Dropdown as F, DefaultItemTemplate as M, FormLayout as U, FormRow as q } from "@ynput/ayon-react-components";
4
- import { a$ as G } from "./searchTerms.es.js";
1
+ import { jsx as c, jsxs as V, Fragment as B } from "react/jsx-runtime";
2
+ import { useState as _, useEffect as v, useMemo as D, useRef as R, useCallback as K } from "react";
3
+ import { getTextColor as P, InputTextarea as W, InputText as z, InputSwitch as M, InputNumber as C, Dropdown as F, DefaultItemTemplate as U, FormLayout as q, FormRow as G } from "@ynput/ayon-react-components";
4
+ import { a$ as J } from "./searchTerms.es.js";
5
5
  import "./getUris.es.js";
6
6
  import "primereact/confirmdialog";
7
7
  import b from "styled-components";
8
- import J from "react-markdown";
8
+ import Q from "react-markdown";
9
9
  import { toast as A } from "react-toastify";
10
- import { p as Q } from "./parseFilename.es.js";
11
- const H = (e, r) => {
10
+ import { p as H } from "./parseFilename.es.js";
11
+ const X = (e, r) => {
12
12
  const t = {};
13
13
  return e.forEach((n) => {
14
14
  n.name in r ? t[n.name] = r[n.name] : n.value ? t[n.name] = n.value : n.type === "boolean" ? t[n.name] = !1 : n.type === "integer" || n.type === "float" ? t[n.name] = 0 : n.type === "text" ? t[n.name] = "" : n.type === "multiselect" ? t[n.name] = [] : n.type === "file" && (t[n.name] = void 0);
15
15
  }), t;
16
- }, w = (e) => e == null || e === "" || Array.isArray(e) && e.length === 0, g = (e) => Array.isArray(e) ? e : w(e) ? [] : [e], X = (e) => "conditions" in e, Y = (e, r) => {
16
+ }, w = (e) => e == null || e === "" || Array.isArray(e) && e.length === 0, g = (e) => Array.isArray(e) ? e : w(e) ? [] : [e], Y = (e) => "conditions" in e, E = (e, r) => {
17
+ if (typeof e != "string" || typeof r != "string") return !1;
18
+ const t = r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/%/g, ".*").replace(/_/g, ".");
19
+ try {
20
+ return new RegExp(`^${t}$`, "i").test(e);
21
+ } catch {
22
+ return !1;
23
+ }
24
+ }, Z = (e, r) => {
17
25
  const t = r[e.key], n = e.value;
18
26
  switch (e.operator || "eq") {
19
27
  case "isnull":
@@ -32,15 +40,10 @@ const H = (e, r) => {
32
40
  return typeof t == "number" && typeof n == "number" && t <= n;
33
41
  case "gte":
34
42
  return typeof t == "number" && typeof n == "number" && t >= n;
35
- case "like": {
36
- if (typeof t != "string" || typeof n != "string") return !1;
37
- const o = n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/%/g, ".*").replace(/_/g, ".");
38
- try {
39
- return new RegExp(`^${o}$`, "i").test(t);
40
- } catch {
41
- return !1;
42
- }
43
- }
43
+ case "like":
44
+ return E(t, n);
45
+ case "notlike":
46
+ return typeof n == "string" && !E(t, n);
44
47
  case "in":
45
48
  return Array.isArray(n) && n.includes(t);
46
49
  case "notin":
@@ -60,34 +63,34 @@ const H = (e, r) => {
60
63
  default:
61
64
  return !1;
62
65
  }
63
- }, _ = (e, r) => {
66
+ }, j = (e, r) => {
64
67
  const t = e.conditions || [];
65
68
  if (t.length === 0) return !0;
66
69
  const n = t.map(
67
- (s) => X(s) ? _(s, r) : Y(s, r)
70
+ (s) => Y(s) ? j(s, r) : Z(s, r)
68
71
  );
69
72
  return (e.operator || "and") === "and" ? n.every(Boolean) : n.some(Boolean);
70
- }, Z = (e, r) => {
73
+ }, ee = (e, r) => {
71
74
  const t = {};
72
75
  for (const n of e) {
73
76
  if (!n.rules?.length) continue;
74
77
  let s;
75
78
  for (const o of n.rules)
76
- _(o.when, r) && (s = { ...s, ...o.set });
79
+ j(o.when, r) && (s = { ...s, ...o.set });
77
80
  s && (t[n.name] = s);
78
81
  }
79
82
  return t;
80
- }, j = /\{\{\s*([^{}\s]+)\s*\}\}/g, ee = (e) => {
83
+ }, T = /\{\{\s*([^{}\s]+)\s*\}\}/g, te = (e) => {
81
84
  const r = /* @__PURE__ */ new Set(), t = (n) => {
82
85
  if (typeof n == "string")
83
- for (const s of n.matchAll(j)) r.add(s[1]);
86
+ for (const s of n.matchAll(T)) r.add(s[1]);
84
87
  else Array.isArray(n) ? n.forEach(t) : n && typeof n == "object" && Object.values(n).forEach(t);
85
88
  };
86
89
  return t(e), [...r];
87
90
  }, x = (e, r) => {
88
91
  if (typeof e == "string") {
89
92
  const t = e.match(/^\{\{\s*([^{}\s]+)\s*\}\}$/);
90
- return t ? r[t[1]] : e.replace(j, (n, s) => {
93
+ return t ? r[t[1]] : e.replace(T, (n, s) => {
91
94
  const o = r[s];
92
95
  return w(o) ? "" : String(o);
93
96
  });
@@ -95,8 +98,8 @@ const H = (e, r) => {
95
98
  return Array.isArray(e) ? e.map((t) => x(t, r)) : e && typeof e == "object" ? Object.fromEntries(
96
99
  Object.entries(e).map(([t, n]) => [t, x(n, r)])
97
100
  ) : e;
98
- }, te = (e) => e == null || e === "", ne = (e, r) => {
99
- const [t, n] = V({}), [s] = G(), o = e.filter((u) => !!u.enum_resolver), m = JSON.stringify(
101
+ }, ne = (e) => e == null || e === "", re = (e, r) => {
102
+ const [t, n] = _({}), [s] = J(), o = e.filter((u) => !!u.enum_resolver), m = JSON.stringify(
100
103
  o.map((u) => [
101
104
  u.name,
102
105
  u.enum_resolver,
@@ -108,7 +111,7 @@ const H = (e, r) => {
108
111
  let u = !1;
109
112
  return o.forEach(async (a) => {
110
113
  const l = a.enum_resolver_params || {};
111
- if (ee(l).some((p) => te(r[p]))) {
114
+ if (te(l).some((p) => ne(r[p]))) {
112
115
  n((p) => ({ ...p, [a.name]: { options: [], loading: !1 } }));
113
116
  return;
114
117
  }
@@ -132,12 +135,12 @@ const H = (e, r) => {
132
135
  u = !0;
133
136
  };
134
137
  }, [m]), t;
135
- }, re = (e, r) => {
136
- const [t, n] = V(null), s = D(() => JSON.stringify(e), [e]);
138
+ }, oe = (e, r) => {
139
+ const [t, n] = _(null), s = D(() => JSON.stringify(e), [e]);
137
140
  v(() => {
138
- n((a) => H(e, { ...r, ...a }));
141
+ n((a) => X(e, { ...r, ...a }));
139
142
  }, [s]);
140
- const o = D(() => Z(e, t || {}), [e, t]), m = ne(e, t || {});
143
+ const o = D(() => ee(e, t || {}), [e, t]), m = re(e, t || {});
141
144
  return v(() => {
142
145
  if (!t) return;
143
146
  const a = {};
@@ -163,18 +166,18 @@ const H = (e, r) => {
163
166
  d = i.options ?? [];
164
167
  const f = new Set(d.map((h) => `${h.value}`)), p = t[i.name];
165
168
  if (i.type === "multiselect") {
166
- const h = Array.isArray(p) ? p : [], C = h.filter((N) => f.has(`${N}`));
167
- C.length !== h.length && (a[i.name] = C, l = !0);
169
+ const h = Array.isArray(p) ? p : [], k = h.filter((I) => f.has(`${I}`));
170
+ k.length !== h.length && (a[i.name] = k, l = !0);
168
171
  } else p != null && p !== "" && !f.has(`${p}`) && (a[i.name] = void 0, l = !0);
169
172
  }
170
173
  l && n((i) => i && { ...i, ...a });
171
174
  }, [e, o, m, t]), { formData: t, patches: o, resolvedOptions: m, setFieldValue: (a, l) => {
172
175
  n((i) => ({ ...i, [a]: l }));
173
176
  } };
174
- }, oe = (e, r, t) => {
177
+ }, ae = (e, r, t) => {
175
178
  if (!(e.type !== "select" && e.type !== "multiselect"))
176
179
  return r?.options ? r.options : e.enum_resolver ? t[e.name]?.options ?? [] : e.options ?? [];
177
- }, ae = b.div`
180
+ }, se = b.div`
178
181
  &.normal {
179
182
  // maybe something here
180
183
  }
@@ -197,10 +200,10 @@ const H = (e, r) => {
197
200
  &.error {
198
201
  background-color: var(--md-sys-color-on-error-dark);
199
202
  }
200
- `, se = ({ field: e }) => {
203
+ `, le = ({ field: e }) => {
201
204
  const r = typeof e.value == "string" ? e.value : "Invalid label value";
202
- return /* @__PURE__ */ c(ae, { className: e.highlight || "normal", children: /* @__PURE__ */ c(J, { children: r }) });
203
- }, le = b.span`
205
+ return /* @__PURE__ */ c(se, { className: e.highlight || "normal", children: /* @__PURE__ */ c(Q, { children: r }) });
206
+ }, ie = b.span`
204
207
  overflow: hidden;
205
208
  white-space: nowrap;
206
209
  text-overflow: ellipsis;
@@ -213,13 +216,13 @@ const H = (e, r) => {
213
216
  &.placeholder {
214
217
  color: var(--md-sys-color-outline);
215
218
  }
216
- `, E = ["studio", "project", "production", "staging", "developer"], ie = (e) => {
219
+ `, L = ["studio", "project", "production", "staging", "developer"], ce = (e) => {
217
220
  const { label: r, color: t, style: n, className: s, ...o } = e, m = { ...n };
218
221
  let u;
219
- t ? t.startsWith("#") || t.startsWith("rgb") ? u = t : E.includes(t.toLowerCase()) && (u = `var(--color-hl-${t})`) : r && E.includes(r.toLowerCase()) && (u = `var(--color-hl-${r.toLowerCase()})`);
220
- const a = u ? K(u) : "#e0e0e0";
222
+ t ? t.startsWith("#") || t.startsWith("rgb") ? u = t : L.includes(t.toLowerCase()) && (u = `var(--color-hl-${t})`) : r && L.includes(r.toLowerCase()) && (u = `var(--color-hl-${r.toLowerCase()})`);
223
+ const a = u ? P(u) : "#e0e0e0";
221
224
  return m.backgroundColor = u, m.color = a, u && (m.fontSize = "0.9rem"), /* @__PURE__ */ c(
222
- le,
225
+ ie,
223
226
  {
224
227
  style: m,
225
228
  className: s,
@@ -235,7 +238,7 @@ const H = (e, r) => {
235
238
  gap: var(--base-gap-small);
236
239
  padding: 0 4px;
237
240
  margin-left: 12px;
238
- `, T = b.button`
241
+ `, N = b.button`
239
242
  width: auto;
240
243
  background: none;
241
244
  border: none;
@@ -244,7 +247,7 @@ const H = (e, r) => {
244
247
  cursor: pointer;
245
248
  padding: 2px;
246
249
  font: inherit;
247
- `, ce = b.div`
250
+ `, ue = b.div`
248
251
  border: 2px dashed var(--md-sys-color-outline);
249
252
  border-radius: 8px;
250
253
  display: flex;
@@ -257,13 +260,13 @@ const H = (e, r) => {
257
260
  input {
258
261
  display: none;
259
262
  }
260
- `, ue = (e) => {
261
- const r = B(null), t = D(
263
+ `, pe = (e) => {
264
+ const r = R(null), t = D(
262
265
  () => e.validExtensions?.map(
263
266
  (a) => a.startsWith(".") ? a.toLowerCase() : `.${a.toLowerCase()}`
264
267
  ),
265
268
  [e.validExtensions]
266
- ), n = R(
269
+ ), n = K(
267
270
  (a) => {
268
271
  if (a) {
269
272
  if (a.size === 0) {
@@ -282,7 +285,7 @@ const H = (e, r) => {
282
285
  }
283
286
  }
284
287
  if (a) {
285
- const l = Q(a.name), i = new FileReader();
288
+ const l = H(a.name), i = new FileReader();
286
289
  i.onload = () => {
287
290
  const y = i.result.split(",")[1];
288
291
  e.onChange({ payload: y, filename: l });
@@ -292,7 +295,7 @@ const H = (e, r) => {
292
295
  },
293
296
  [e, t]
294
297
  );
295
- return /* @__PURE__ */ O(ce, { onDragOver: (a) => {
298
+ return /* @__PURE__ */ V(ue, { onDragOver: (a) => {
296
299
  a.preventDefault();
297
300
  }, onDragLeave: (a) => {
298
301
  a.preventDefault();
@@ -315,25 +318,25 @@ const H = (e, r) => {
315
318
  style: { display: "none" }
316
319
  }
317
320
  ),
318
- /* @__PURE__ */ c(T, { type: "button", onClick: () => r.current?.click(), children: e.value ? `Change file (${e.value.filename})` : "Upload file" })
321
+ /* @__PURE__ */ c(N, { type: "button", onClick: () => r.current?.click(), children: e.value ? `Change file (${e.value.filename})` : "Upload file" })
319
322
  ] });
320
- }, pe = b.div`
323
+ }, me = b.div`
321
324
  display: flex;
322
325
  flex-direction: row;
323
326
  align-items: center;
324
327
  justify-content: flex-start;
325
328
  background: none;
326
329
  border: none;
327
- `, me = (e) => /* @__PURE__ */ c(pe, { children: /* @__PURE__ */ c(T, { onClick: () => {
330
+ `, de = (e) => /* @__PURE__ */ c(me, { children: /* @__PURE__ */ c(N, { onClick: () => {
328
331
  const t = document.createElement("a");
329
332
  t.href = `data:application/octet-stream;base64,${e.value.payload}`, t.download = e.value.filename, document.body.appendChild(t), t.click(), document.body.removeChild(t);
330
333
  }, children: e.value.filename }) }), $ = (e) => {
331
- const r = /* @__PURE__ */ O(I, { children: [
334
+ const r = /* @__PURE__ */ V(B, { children: [
332
335
  /* @__PURE__ */ c("div", { style: { flex: 1 } }),
333
- e.badges && e.badges.map((t, n) => /* @__PURE__ */ c(ie, { label: t }, n))
336
+ e.badges && e.badges.map((t, n) => /* @__PURE__ */ c(ce, { label: t }, n))
334
337
  ] });
335
338
  return /* @__PURE__ */ c(
336
- M,
339
+ U,
337
340
  {
338
341
  option: e,
339
342
  dataKey: "value",
@@ -342,12 +345,12 @@ const H = (e, r) => {
342
345
  endContent: r
343
346
  }
344
347
  );
345
- }, L = (e = []) => e.map((r) => ({ ...r, value: `${r.value}` })), S = (e = [], r) => e.find((t) => `${t.value}` === r)?.value ?? r, de = ({ field: e, value: r, onChange: t }) => {
348
+ }, S = (e = []) => e.map((r) => ({ ...r, value: `${r.value}` })), O = (e = [], r) => e.find((t) => `${t.value}` === r)?.value ?? r, ye = ({ field: e, value: r, onChange: t }) => {
346
349
  const n = !!(e.disabled || e.readOnly);
347
350
  if (e.type === "text") {
348
351
  const s = typeof r == "string" ? r : "";
349
352
  return e.multiline ? /* @__PURE__ */ c(
350
- P,
353
+ W,
351
354
  {
352
355
  value: s,
353
356
  onChange: (o) => t(o.target.value),
@@ -355,7 +358,7 @@ const H = (e, r) => {
355
358
  disabled: n
356
359
  }
357
360
  ) : /* @__PURE__ */ c(
358
- W,
361
+ z,
359
362
  {
360
363
  value: s,
361
364
  onChange: (o) => t(o.target.value),
@@ -365,12 +368,12 @@ const H = (e, r) => {
365
368
  );
366
369
  }
367
370
  if (e.type === "boolean")
368
- return /* @__PURE__ */ c(z, { checked: typeof r == "boolean" ? r : !1, onChange: (m) => {
371
+ return /* @__PURE__ */ c(M, { checked: typeof r == "boolean" ? r : !1, onChange: (m) => {
369
372
  "target" in m && "checked" in m.target && t(m.target.checked);
370
373
  }, disabled: n });
371
374
  if (e.type === "integer")
372
375
  return /* @__PURE__ */ c(
373
- k,
376
+ C,
374
377
  {
375
378
  value: typeof r == "number" ? r : 0,
376
379
  onChange: (o) => t(parseInt(o.target.value)),
@@ -380,7 +383,7 @@ const H = (e, r) => {
380
383
  );
381
384
  if (e.type === "float")
382
385
  return /* @__PURE__ */ c(
383
- k,
386
+ C,
384
387
  {
385
388
  type: "number",
386
389
  value: typeof r == "number" ? r : 0,
@@ -395,9 +398,9 @@ const H = (e, r) => {
395
398
  F,
396
399
  {
397
400
  widthExpand: !0,
398
- options: L(e.options),
401
+ options: S(e.options),
399
402
  value: s ? [s] : [],
400
- onSelectionChange: (o) => t(S(e.options, o[0])),
403
+ onSelectionChange: (o) => t(O(e.options, o[0])),
401
404
  className: "form-field",
402
405
  multiSelect: !1,
403
406
  itemTemplate: $,
@@ -412,9 +415,9 @@ const H = (e, r) => {
412
415
  F,
413
416
  {
414
417
  widthExpand: !0,
415
- options: L(e.options),
418
+ options: S(e.options),
416
419
  value: s,
417
- onSelectionChange: (o) => t(o.map((m) => S(e.options, m))),
420
+ onSelectionChange: (o) => t(o.map((m) => O(e.options, m))),
418
421
  className: "form-field",
419
422
  multiSelect: !0,
420
423
  itemTemplate: $,
@@ -424,20 +427,20 @@ const H = (e, r) => {
424
427
  );
425
428
  }
426
429
  if (e.type === "file")
427
- return r && r?.download ? /* @__PURE__ */ c(me, { value: r }) : /* @__PURE__ */ c(
428
- ue,
430
+ return r && r?.download ? /* @__PURE__ */ c(de, { value: r }) : /* @__PURE__ */ c(
431
+ pe,
429
432
  {
430
433
  value: r,
431
434
  onChange: t,
432
435
  validExtensions: e.valid_extensions
433
436
  }
434
437
  );
435
- }, ke = ({ fields: e, values: r, onChange: t, className: n, style: s }) => {
436
- const { formData: o, patches: m, resolvedOptions: u, setFieldValue: a } = re(e, r);
438
+ }, Fe = ({ fields: e, values: r, onChange: t, className: n, style: s }) => {
439
+ const { formData: o, patches: m, resolvedOptions: u, setFieldValue: a } = oe(e, r);
437
440
  return v(() => {
438
441
  o && t?.(o);
439
442
  }, [o]), o ? /* @__PURE__ */ c(
440
- U,
443
+ q,
441
444
  {
442
445
  className: n,
443
446
  style: s,
@@ -445,11 +448,11 @@ const H = (e, r) => {
445
448
  l.stopPropagation();
446
449
  },
447
450
  children: e.map((l) => {
448
- const i = m[l.name], y = oe(l, i, u), d = { ...l, ...i };
451
+ const i = m[l.name], y = ae(l, i, u), d = { ...l, ...i };
449
452
  y !== void 0 && (d.options = y, l.enum_resolver && u[l.name]?.loading && d.placeholder === void 0 && (d.placeholder = "Loading..."));
450
453
  const f = {};
451
- return d.hidden && (f.display = "none"), d.type === "label" ? /* @__PURE__ */ c(se, { field: d }, l.name) : /* @__PURE__ */ c(q, { label: d.label || "", style: f, children: /* @__PURE__ */ c(
452
- de,
454
+ return d.hidden && (f.display = "none"), d.type === "label" ? /* @__PURE__ */ c(le, { field: d }, l.name) : /* @__PURE__ */ c(G, { label: d.label || "", style: f, children: /* @__PURE__ */ c(
455
+ ye,
453
456
  {
454
457
  field: d,
455
458
  value: o[l.name],
@@ -461,7 +464,7 @@ const H = (e, r) => {
461
464
  ) : null;
462
465
  };
463
466
  export {
464
- ie as B,
465
- ke as S,
467
+ ce as B,
468
+ Fe as S,
466
469
  Ce as a
467
470
  };