@ynput/ayon-frontend-shared 0.6.3 → 0.6.5

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 (51) hide show
  1. package/dist/DetailsPanel.es.js +480 -477
  2. package/dist/ListTable.es.js +24 -25
  3. package/dist/NewEntity.es.js +6 -7
  4. package/dist/ProjectTreeTable.es.js +2016 -1996
  5. package/dist/Views.es.js +28 -28
  6. package/dist/api.es.js +291 -289
  7. package/dist/chunks/Actions.es.js +12 -12
  8. package/dist/chunks/ColumnDropIndicator.es.js +8 -9
  9. package/dist/chunks/DeleteEntitiesConfirmDialog.es.js +31 -25
  10. package/dist/chunks/DeleteEntitiesContextInstance.es.js +1 -1
  11. package/dist/chunks/DetailsDialog.es.js +1 -1
  12. package/dist/chunks/EmptyPlaceholder.es.js +13 -12
  13. package/dist/chunks/EntityPath.es.js +67 -67
  14. package/dist/chunks/EntityPickerDialog.es.js +1 -1
  15. package/dist/chunks/EntityTooltip.es.js +8 -8
  16. package/dist/chunks/Feed.es.js +692 -689
  17. package/dist/chunks/MetaWidget.es.js +1283 -1279
  18. package/dist/chunks/PlayableIcon.es.js +458 -451
  19. package/dist/chunks/ProjectContext.es.js +20 -20
  20. package/dist/chunks/RepresentationsList.es.js +9 -9
  21. package/dist/chunks/ReviewablesSelector.es.js +1504 -1374
  22. package/dist/chunks/Slicer.es.js +68 -69
  23. package/dist/chunks/ThumbnailSimple.es.js +4 -4
  24. package/dist/chunks/Watchers.es.js +104 -105
  25. package/dist/chunks/activeEntities.es.js +58 -0
  26. package/dist/chunks/columnConfigConverter.es.js +57 -63
  27. package/dist/chunks/getUris.es.js +886 -831
  28. package/dist/chunks/iconUtils.es.js +151 -0
  29. package/dist/chunks/realtimeUpdatesUtils.es.js +113 -80
  30. package/dist/chunks/searchTerms.es.js +329 -247
  31. package/dist/chunks/useAttributeEnums.es.js +34 -34
  32. package/dist/chunks/viewUpdateHelper.es.js +11 -11
  33. package/dist/components.es.js +340 -337
  34. package/dist/context.es.js +48 -48
  35. package/dist/hooks.es.js +34 -34
  36. package/dist/index.es.js +1 -1
  37. package/dist/types/ContextMenu.d.ts +1 -1
  38. package/dist/types/Feed.d.ts +1 -1
  39. package/dist/types/ListTable.d.ts +1 -1
  40. package/dist/types/ProjectTreeTable.d.ts +4 -1
  41. package/dist/types/SimpleTable.d.ts +1 -1
  42. package/dist/types/Slicer.d.ts +5 -5
  43. package/dist/types/Views.d.ts +4 -4
  44. package/dist/types/api.d.ts +545 -171
  45. package/dist/types/components.d.ts +64 -9
  46. package/dist/types/context.d.ts +5 -5
  47. package/dist/types/util.d.ts +237 -2
  48. package/dist/util.es.js +127 -114
  49. package/package.json +1 -1
  50. package/dist/chunks/extractEntityHierarchyFromParents.es.js +0 -28
  51. package/dist/chunks/parseHtmlToPlainTextWithLinks.es.js +0 -138
@@ -0,0 +1,151 @@
1
+ import { e as g, g as _ } from "./getEntityTypeIcon.es.js";
2
+ import { deburr as y, snakeCase as N } from "lodash";
3
+ const w = (e, r, o) => {
4
+ let n = "format_list_bulleted";
5
+ const l = {
6
+ status: "arrow_circle_right",
7
+ assignees: "person",
8
+ author: "person",
9
+ tags: "local_offer",
10
+ priority: "keyboard_double_arrow_up",
11
+ fps: "30fps_select",
12
+ resolutionWidth: "settings_overscan",
13
+ resolutionHeight: "settings_overscan",
14
+ pixelAspect: "stop",
15
+ clipIn: "line_start_diamond",
16
+ clipOut: "line_end_diamond",
17
+ frameStart: "line_start_circle",
18
+ frameEnd: "line_end_circle",
19
+ handleStart: "line_start_square",
20
+ handleEnd: "line_end_square",
21
+ fullName: "id_card",
22
+ email: "alternate_email",
23
+ developerMode: "code",
24
+ productGroup: "inventory_2",
25
+ machine: "computer",
26
+ comment: "comment",
27
+ colorSpace: "palette",
28
+ description: "description",
29
+ latest: "verified"
30
+ }, d = {
31
+ integer: "pin",
32
+ float: "speed_1_2",
33
+ boolean: "check_box",
34
+ datetime: "calendar_month",
35
+ list_of_strings: "format_list_bulleted",
36
+ list_of_integers: "format_list_numbered",
37
+ list_of_any: "format_list_bulleted",
38
+ list_of_submodels: "format_list_bulleted",
39
+ dict: "format_list_bulleted",
40
+ string: "title"
41
+ };
42
+ return l[e] ? n = l[e] : g.includes(e) ? n = _(e) : o && r === "string" ? n = "format_list_bulleted" : o ? n = "checklist" : r && d[r] && (n = d[r]), n;
43
+ }, b = (e) => e ? /\s/.test(e) ? { valid: !1, error: "Spaces are not allowed in name" } : /^[a-zA-Z0-9_\.\-]+$/.test(e) ? /^[.-]/.test(e) ? { valid: !1, error: "Name cannot start with dot or dash" } : /[.-]$/.test(e) ? { valid: !1, error: "Name cannot end with dot or dash" } : { valid: !0 } : {
44
+ valid: !1,
45
+ error: "Name can only contain letters, numbers, underscores, dashes or dots"
46
+ } : { valid: !1, error: "Name is required" }, A = (e) => e ? e.includes("'") ? { valid: !1, error: "Label cannot contain single quotes (')" } : { valid: !0 } : { valid: !1, error: "Label is required" }, L = (e, r = { capitalization: "lower", separator: "" }) => {
47
+ const { capitalization: o = "lower", separator: n = "" } = r;
48
+ if (!e) return "";
49
+ const p = e.trim().split(/\s+/).filter(Boolean).map((i) => {
50
+ let a = i.normalize("NFD");
51
+ return a = y(a), a = a.replace(/[^a-zA-Z0-9_\-\.]+/g, ""), a = a.replace(/[.-]+$/g, ""), a;
52
+ }).filter(Boolean);
53
+ let t = ((i) => {
54
+ switch (o) {
55
+ case "upper":
56
+ return i.map((a) => a.toUpperCase());
57
+ case "pascal":
58
+ return i.map((a) => a.charAt(0).toUpperCase() + a.slice(1).toLowerCase());
59
+ case "camel":
60
+ return i.map(
61
+ (a, h) => h === 0 ? a.toLowerCase() : a.charAt(0).toUpperCase() + a.slice(1).toLowerCase()
62
+ );
63
+ case "keep":
64
+ return i;
65
+ default:
66
+ return i.map((a) => a.toLowerCase());
67
+ }
68
+ })(p).join(n);
69
+ t = t.replace(/^[^a-zA-Z0-9]+|[^a-zA-Z0-9]+$/g, "");
70
+ const { valid: s } = b(t);
71
+ return s || (t = N(t)), t;
72
+ }, C = (e) => {
73
+ const r = document.createElement("div");
74
+ r.innerHTML = e;
75
+ const o = [];
76
+ let n = 0;
77
+ const l = (c) => {
78
+ if (c.nodeType === Node.TEXT_NODE)
79
+ return c.textContent || "";
80
+ if (c.nodeType === Node.ELEMENT_NODE) {
81
+ const t = c;
82
+ if (t.tagName === "A") {
83
+ const s = t.getAttribute("href"), i = t.textContent || "";
84
+ return s && i ? (o.push({
85
+ type: "url",
86
+ content: i,
87
+ href: s,
88
+ key: n++
89
+ }), `__LINK_${n - 1}__`) : i;
90
+ }
91
+ if (t.tagName === "LI") {
92
+ const s = Array.from(t.childNodes).map(l).join("").trim();
93
+ return s ? `• ${s}` : "";
94
+ }
95
+ if (t.tagName === "OL" || t.tagName === "UL")
96
+ return Array.from(t.children).filter((i) => i.tagName === "LI").map(l).filter((i) => i.trim()).join(`
97
+ `);
98
+ if (t.tagName === "P") {
99
+ const s = Array.from(t.childNodes).map(l).join("");
100
+ return s.trim() ? s + `
101
+ ` : "";
102
+ }
103
+ return t.tagName === "BR" ? `
104
+ ` : Array.from(t.childNodes).map(l).join("");
105
+ }
106
+ return "";
107
+ };
108
+ let d = l(r);
109
+ d = d.replace(/\n{3,}/g, `
110
+
111
+ `).replace(/[ \t]+/g, " ").trim();
112
+ const p = [];
113
+ let u = d, f = 0;
114
+ return o.forEach((c) => {
115
+ const t = `__LINK_${c.key}__`, s = u.split(t);
116
+ s.length > 1 && (s[0] && p.push({
117
+ type: "text",
118
+ content: s[0],
119
+ key: f++
120
+ }), p.push({
121
+ type: "url",
122
+ content: c.content,
123
+ href: c.href,
124
+ key: f++
125
+ }), u = s.slice(1).join(t));
126
+ }), u && p.push({
127
+ type: "text",
128
+ content: u,
129
+ key: f++
130
+ }), p.length > 0 ? p : [{ type: "text", content: d, key: 0 }];
131
+ }, m = (e, r, o) => {
132
+ switch (e) {
133
+ case "folder":
134
+ return o.folder_types?.find((n) => n.name === r);
135
+ case "task":
136
+ return o.task_types?.find((n) => n.name === r);
137
+ case "product":
138
+ return o.product_base_types?.definitions?.find((n) => n.name === r) || o.product_base_types?.default;
139
+ default:
140
+ return;
141
+ }
142
+ }, x = (e, r, o) => m(e, r, o)?.icon || _(e), E = (e, r, o) => m(e, r, o)?.color;
143
+ export {
144
+ b as a,
145
+ E as b,
146
+ A as c,
147
+ x as d,
148
+ C as e,
149
+ w as g,
150
+ L as p
151
+ };
@@ -1,112 +1,145 @@
1
- import { v1 as w } from "uuid";
2
- const N = () => w().replace(/-/g, ""), v = (t) => /^[0-9a-f]{32}$/i.test(t), M = "__row_selection__", O = "drag-handle", h = 50, S = 4, D = h + S * 2;
3
- let s = null;
4
- const c = /* @__PURE__ */ new Set();
5
- let m, f = [], u;
1
+ import { v1 as y } from "uuid";
2
+ const N = () => y().replace(/-/g, ""), k = (e) => /^[0-9a-f]{32}$/i.test(e), O = "__row_selection__", D = "drag-handle", S = 50, A = 4, P = S + A * 2, E = 5, d = "-", W = (e, s) => {
3
+ if (!e) return [];
4
+ if (typeof e == "string") return [{ id: e, desc: !!s }];
5
+ const o = [];
6
+ for (const t of e) {
7
+ if (typeof t != "string") continue;
8
+ const n = t.startsWith(d), a = n ? t.slice(d.length) : t;
9
+ !a || o.some((i) => i.id === a) || o.push({ id: a, desc: n });
10
+ }
11
+ return o.slice(0, E);
12
+ }, C = (e) => {
13
+ if (e?.length)
14
+ return e.slice(0, E).map((s) => s.desc ? `${d}${s.id}` : s.id);
15
+ }, U = (e) => {
16
+ const s = [];
17
+ for (const { key: n, desc: a } of e)
18
+ !n || s.some((i) => i.key === n) || s.push({ key: n, desc: !!a });
19
+ const o = s.slice(0, E);
20
+ if (!o.length) return { sortBy: void 0, desc: !1 };
21
+ const t = o[0].desc;
22
+ return o.length === 1 ? { sortBy: o[0].key, desc: t } : {
23
+ sortBy: o.map((n) => n.desc !== t ? `${d}${n.key}` : n.key),
24
+ desc: t
25
+ };
26
+ }, $ = (e) => {
27
+ const s = Array.isArray(e) ? e[0] : e;
28
+ if (s)
29
+ return s.startsWith(d) ? s.slice(d.length) : s;
30
+ };
31
+ let r = null;
32
+ const u = /* @__PURE__ */ new Set();
33
+ let p, m = [], l;
6
34
  const I = () => {
7
- if (f.length === 0) return;
8
- const t = [...f];
9
- f = [], c.forEach(({ updater: a, entityTypes: o }) => {
10
- const e = o ? t.filter((n) => o.includes(n.summary.entityType)) : t;
11
- e.length > 0 && a(e);
35
+ if (m.length === 0) return;
36
+ const e = [...m];
37
+ m = [], u.forEach(({ updater: s, entityTypes: o }) => {
38
+ const t = o ? e.filter((n) => o.includes(n.summary.entityType)) : e;
39
+ t.length > 0 && s(t);
12
40
  });
13
- }, y = (t) => {
14
- f.push(t), u && window.clearTimeout(u);
15
- const a = 3e3 + Math.random() * 1e3;
16
- u = window.setTimeout(() => {
17
- u = void 0, I();
18
- }, a);
19
- }, T = () => {
20
- if (s && (s.readyState === WebSocket.OPEN || s.readyState === WebSocket.CONNECTING))
41
+ }, R = (e) => {
42
+ m.push(e), l && window.clearTimeout(l);
43
+ const s = 3e3 + Math.random() * 1e3;
44
+ l = window.setTimeout(() => {
45
+ l = void 0, I();
46
+ }, s);
47
+ }, _ = () => {
48
+ if (r && (r.readyState === WebSocket.OPEN || r.readyState === WebSocket.CONNECTING))
21
49
  return;
22
- const a = `${window.location.protocol.replace("http", "ws")}//${window.location.host}/ws`;
23
- s = new WebSocket(a), s.onopen = () => {
50
+ const s = `${window.location.protocol.replace("http", "ws")}//${window.location.host}/ws`;
51
+ r = new WebSocket(s), r.onopen = () => {
24
52
  const o = localStorage.getItem("accessToken");
25
- s?.readyState === WebSocket.OPEN && s.send(
53
+ r?.readyState === WebSocket.OPEN && r.send(
26
54
  JSON.stringify({
27
55
  topic: "auth",
28
56
  token: o,
29
57
  subscribe: ["thumbnail.updated"]
30
58
  })
31
59
  );
32
- }, s.onmessage = (o) => {
60
+ }, r.onmessage = (o) => {
33
61
  try {
34
- const e = JSON.parse(o.data);
35
- if (e.topic === "thumbnail.updated") {
36
- const n = e;
37
- n.sender && n.sender === window.senderId ? c.forEach(({ updater: l, entityTypes: r }) => {
38
- (!r || r.includes(n.summary.entityType)) && l([n]);
39
- }) : y(n);
62
+ const t = JSON.parse(o.data);
63
+ if (t.topic === "thumbnail.updated") {
64
+ const n = t;
65
+ n.sender && n.sender === window.senderId ? u.forEach(({ updater: a, entityTypes: i }) => {
66
+ (!i || i.includes(n.summary.entityType)) && a([n]);
67
+ }) : R(n);
40
68
  }
41
- } catch (e) {
42
- console.error("Failed to parse thumbnail update websocket message", e);
69
+ } catch (t) {
70
+ console.error("Failed to parse thumbnail update websocket message", t);
43
71
  }
44
- }, s.onclose = () => {
45
- s = null, c.size > 0 && (m = window.setTimeout(() => T(), 5e3));
72
+ }, r.onclose = () => {
73
+ r = null, u.size > 0 && (p = window.setTimeout(() => _(), 5e3));
46
74
  };
47
- }, P = (t, a) => {
48
- const o = { updater: t, entityTypes: a };
49
- return c.add(o), c.size === 1 && T(), () => {
50
- c.delete(o), c.size === 0 && (m && (window.clearTimeout(m), m = void 0), u && (window.clearTimeout(u), u = void 0, f = []), s && (s.onclose = null, s.close(), s = null));
75
+ }, z = (e, s) => {
76
+ const o = { updater: e, entityTypes: s };
77
+ return u.add(o), u.size === 1 && _(), () => {
78
+ u.delete(o), u.size === 0 && (p && (window.clearTimeout(p), p = void 0), l && (window.clearTimeout(l), l = void 0, m = []), r && (r.onclose = null, r.close(), r = null));
51
79
  };
52
- }, A = 1e4, R = 25, b = 1e3, C = ["status", "tags", "assignees", "type"];
53
- function W(t, a, o) {
54
- if (!o.includes(t)) return;
55
- const e = a?.value;
56
- if (e !== void 0)
57
- return t === "tags" ? {
80
+ }, b = 1e4, v = 25, L = 1e3, G = ["status", "tags", "assignees", "type"];
81
+ function H(e, s, o) {
82
+ if (!o.includes(e)) return;
83
+ const t = s?.value;
84
+ if (t !== void 0)
85
+ return e === "tags" ? {
58
86
  field: "tags",
59
- value: Array.isArray(e) ? e.map(String) : []
60
- } : t === "assignees" ? {
87
+ value: Array.isArray(t) ? t.map(String) : []
88
+ } : e === "assignees" ? {
61
89
  field: "assignees",
62
- value: Array.isArray(e) ? e.map(String) : []
63
- } : { field: t, value: String(e) };
90
+ value: Array.isArray(t) ? t.map(String) : []
91
+ } : { field: e, value: String(t) };
64
92
  }
65
- const k = () => new Promise((t) => setTimeout(t, Math.random() * b));
66
- function U(t, a, o = A) {
67
- const e = /* @__PURE__ */ new Map();
68
- let n = null, l = !1, r = !1;
69
- const E = () => {
93
+ const F = () => new Promise((e) => setTimeout(e, Math.random() * L));
94
+ function J(e, s, o = b) {
95
+ const t = /* @__PURE__ */ new Map();
96
+ let n = null, a = !1, i = !1;
97
+ const T = () => {
70
98
  n && (clearTimeout(n), n = null);
71
- }, _ = async () => {
72
- if (E(), r || l || e.size === 0) return;
73
- l = !0;
74
- const i = Array.from(e.entries()).slice(0, R), g = i.map(([, d]) => d);
75
- i.forEach(([d]) => e.delete(d));
99
+ }, h = async () => {
100
+ if (T(), i || a || t.size === 0) return;
101
+ a = !0;
102
+ const c = Array.from(t.entries()).slice(0, v), w = c.map(([, f]) => f);
103
+ c.forEach(([f]) => t.delete(f));
76
104
  try {
77
- await t(g, () => !r);
78
- } catch (d) {
79
- console.error("Realtime batch processing failed", d);
105
+ await e(w, () => !i);
106
+ } catch (f) {
107
+ console.error("Realtime batch processing failed", f);
80
108
  } finally {
81
- l = !1, !r && e.size > 0 && p(0);
109
+ a = !1, !i && t.size > 0 && g(0);
82
110
  }
83
- }, p = (i = o) => {
84
- r || n || l || (n = setTimeout(_, i));
111
+ }, g = (c = o) => {
112
+ i || n || a || (n = setTimeout(h, c));
85
113
  };
86
114
  return {
87
- add(i) {
88
- r || (e.set(a(i), i), p());
115
+ add(c) {
116
+ i || (t.set(s(c), c), g());
89
117
  },
90
- schedule: p,
118
+ schedule: g,
91
119
  clear() {
92
- r = !0, e.clear(), E();
120
+ i = !0, t.clear(), T();
93
121
  }
94
122
  };
95
123
  }
96
124
  export {
97
- S as C,
98
- O as D,
99
- M as R,
100
- h as W,
101
- R as a,
102
- b,
103
- U as c,
104
- C as d,
105
- A as e,
106
- W as f,
125
+ A as C,
126
+ D,
127
+ E as M,
128
+ O as R,
129
+ S as W,
130
+ v as a,
131
+ L as b,
132
+ J as c,
133
+ G as d,
134
+ b as e,
135
+ U as f,
107
136
  N as g,
108
- D as h,
109
- P as s,
110
- v,
111
- k as w
137
+ $ as h,
138
+ H as i,
139
+ z as j,
140
+ P as k,
141
+ W as p,
142
+ C as s,
143
+ k as v,
144
+ F as w
112
145
  };