@ynput/ayon-frontend-shared 0.5.0 → 0.6.1

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 (92) hide show
  1. package/dist/ContextMenu.es.js +34 -16
  2. package/dist/DetailsPanel.es.js +307 -311
  3. package/dist/Feed.es.js +179 -50
  4. package/dist/ListTable.es.js +99 -92
  5. package/dist/NewEntity.es.js +1256 -11
  6. package/dist/ProjectTreeTable.es.js +4459 -2959
  7. package/dist/SimpleTable.es.js +8 -7
  8. package/dist/Slicer.es.js +451 -147
  9. package/dist/Views.es.js +918 -310
  10. package/dist/api.es.js +331 -329
  11. package/dist/chunks/Actions.es.js +32 -27
  12. package/dist/chunks/ColumnDropIndicator.es.js +174 -328
  13. package/dist/chunks/ColumnDropIndicator.styled.es.js +281 -0
  14. package/dist/chunks/ColumnHeaderMenuUI.es.js +52 -0
  15. package/dist/chunks/ContextMenuContextInstance.es.js +12 -0
  16. package/dist/chunks/DeleteEntitiesConfirmDialog.es.js +229 -0
  17. package/dist/chunks/DeleteEntitiesContextInstance.es.js +827 -0
  18. package/dist/chunks/DetailsDialog.es.js +3 -3
  19. package/dist/chunks/EmptyPlaceholder.es.js +4 -4
  20. package/dist/chunks/EntityPath.es.js +74 -69
  21. package/dist/chunks/EntityPickerDialog.es.js +25 -21
  22. package/dist/chunks/EntityTooltip.es.js +29 -22
  23. package/dist/chunks/EntityUpdatesContext.es.js +38 -96
  24. package/dist/chunks/Feed.es.js +2321 -2668
  25. package/dist/chunks/FilterErrorActions.es.js +25 -229
  26. package/dist/chunks/Menu.es.js +21 -17
  27. package/dist/chunks/MenuContext.es.js +14 -256
  28. package/dist/chunks/MenuItem.es.js +34 -24
  29. package/dist/chunks/MetaWidget.es.js +2895 -4919
  30. package/dist/chunks/NewEntityContextInstance.es.js +11 -0
  31. package/dist/chunks/PlayableIcon.es.js +4215 -1179
  32. package/dist/chunks/ProjectContext.es.js +102 -66
  33. package/dist/chunks/RepresentationsList.es.js +4 -4
  34. package/dist/chunks/ReviewablesSelector.es.js +468 -460
  35. package/dist/chunks/SimpleForm.es.js +18 -18
  36. package/dist/chunks/SimpleTable.es.js +15 -13
  37. package/dist/chunks/Slicer.es.js +109 -98
  38. package/dist/chunks/TableSettingsFallback.es.js +22 -10
  39. package/dist/chunks/ThumbnailSimple.es.js +290 -52
  40. package/dist/chunks/VersionUploadContextInstance.es.js +12 -0
  41. package/dist/chunks/VideoPlayer.es.js +24 -28
  42. package/dist/chunks/Watchers.es.js +669 -644
  43. package/dist/chunks/entityDefinitions.es.js +2 -350
  44. package/dist/chunks/expandRelativeDates.es.js +27 -0
  45. package/dist/chunks/extractVersionFromFilename.es.js +28 -0
  46. package/dist/chunks/getBundleMode.es.js +1 -1
  47. package/dist/chunks/getUris.es.js +737 -710
  48. package/dist/chunks/queryFilterToClientFilter.es.js +11 -10
  49. package/dist/chunks/searchTerms.es.js +179 -174
  50. package/dist/chunks/useAttributeEnums.es.js +9 -9
  51. package/dist/chunks/useCreateContextMenu.es.js +66 -90
  52. package/dist/chunks/useDateRangeFilter.es.js +3 -3
  53. package/dist/chunks/useHierarchySelection.es.js +24 -0
  54. package/dist/chunks/useLoadModule.es.js +74 -0
  55. package/dist/chunks/useQueryArgumentChangeLoading.es.js +11 -0
  56. package/dist/chunks/versionUploadHelpers.es.js +16 -42
  57. package/dist/chunks/viewUpdateHelper.es.js +74 -57
  58. package/dist/components.es.js +1432 -1001
  59. package/dist/context.es.js +791 -78
  60. package/dist/hooks.es.js +95 -94
  61. package/dist/index.es.js +27 -26
  62. package/dist/types/Actions.d.ts +15 -15
  63. package/dist/types/ContextMenu.d.ts +19 -16
  64. package/dist/types/DetailsPanel.d.ts +110 -17
  65. package/dist/types/EntityPickerDialog.d.ts +15 -15
  66. package/dist/types/Feed.d.ts +19 -16
  67. package/dist/types/ListTable.d.ts +15 -15
  68. package/dist/types/NewEntity.d.ts +24 -18
  69. package/dist/types/ProjectTreeTable.d.ts +34 -123
  70. package/dist/types/RepresentationsList.d.ts +15 -15
  71. package/dist/types/SimpleTable.d.ts +19 -16
  72. package/dist/types/Slicer.d.ts +18 -15
  73. package/dist/types/Views.d.ts +19 -16
  74. package/dist/types/api.d.ts +515 -207
  75. package/dist/types/components.d.ts +84 -20
  76. package/dist/types/context.d.ts +108 -25
  77. package/dist/types/hooks.d.ts +15 -15
  78. package/dist/types/index.d.ts +15 -15
  79. package/dist/types/util.d.ts +20 -15
  80. package/dist/util.es.js +117 -105
  81. package/package.json +16 -4
  82. package/dist/chunks/DeleteEntitiesContext.es.js +0 -748
  83. package/dist/chunks/GlobalContext.es.js +0 -52
  84. package/dist/chunks/NewEntityContext.es.js +0 -1242
  85. package/dist/chunks/ProjectFoldersContext.es.js +0 -134
  86. package/dist/chunks/ProjectFoldersContextInstance.es.js +0 -7
  87. package/dist/chunks/VersionUploadContext.es.js +0 -232
  88. package/dist/chunks/ViewsContext.es.js +0 -878
  89. package/dist/chunks/mentionTypeOptions.es.js +0 -15
  90. package/dist/chunks/useColumnDragRestriction.es.js +0 -148
  91. package/dist/chunks/useLocalStorage.es.js +0 -355
  92. /package/dist/{useCreateContextMenu.css → ContextMenuContextInstance.css} +0 -0
@@ -1,345 +1,4 @@
1
- import { u as W, a as ce } from "./useLocalStorage.es.js";
2
- import { jsx as ue } from "react/jsx-runtime";
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 = () => {
7
- const r = () => ({
8
- formatStatuses: () => [],
9
- formatTaskTypes: () => [],
10
- formatTypes: () => [],
11
- formatAssignees: () => [],
12
- formatAttribute: () => [],
13
- formatProductTypes: () => [],
14
- formatAuthors: () => []
15
- }), { powerLicense: n } = W(), [c, { isLoading: a }] = ce({
16
- addon: "powerpack",
17
- remote: "slicer",
18
- module: "useExtraSlices",
19
- fallback: r,
20
- skip: !n
21
- // skip loading if powerpack license is not available
22
- }), [f] = ce({
23
- addon: "powerpack",
24
- remote: "slicer",
25
- module: "SlicerDropdown",
26
- fallback: fe,
27
- skip: !n
28
- // skip loading if powerpack license is not available
29
- });
30
- return { useExtraSlices: c, isLoadingExtraSlices: a, SlicerDropdown: f };
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
- sliceTypes: r,
33
- page: n,
34
- projectName: c,
35
- ...a
36
- }) => {
37
- const [f, _] = Se(0);
38
- M(() => {
39
- const e = (i) => {
40
- const o = i.detail?.key ?? ("key" in i ? i.key : void 0);
41
- o && !xe.some((y) => o.startsWith(y)) || _((y) => y + 1);
42
- };
43
- return window.addEventListener("session-storage", e), window.addEventListener("storage", e), () => {
44
- window.removeEventListener("session-storage", e), window.removeEventListener("storage", e);
45
- };
46
- }, []);
47
- const L = I(/* @__PURE__ */ new Map()), h = S((e, i) => {
48
- const o = typeof window > "u" ? null : sessionStorage.getItem(e), y = L.current.get(e);
49
- if (y && y.raw === o) return y.value;
50
- const T = U(e, i);
51
- return L.current.set(e, { raw: o, value: T }), T;
52
- }, []), s = r[0], u = S(
53
- (e) => a.rowSelection !== void 0 && e === s ? a.rowSelection : h(oe(c, n, e), {}),
54
- // storageVersion invalidates memoized reads when any bucket changes
55
- [a.rowSelection, s, c, n, h, f]
56
- ), x = S(
57
- (e, i) => {
58
- if (a.setRowSelection && e === s) {
59
- a.setRowSelection(i);
60
- return;
61
- }
62
- const o = oe(c, n, e), y = typeof i == "function" ? i(h(o, {})) : i;
63
- ie(o, y);
64
- },
65
- [a.setRowSelection, s, c, n, h]
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]
69
- ), P = S(
70
- (e, i) => {
71
- if (a.setExpanded && e === s) {
72
- a.setExpanded(i);
73
- return;
74
- }
75
- const o = re(c, n, e), y = typeof i == "function" ? i(h(o, {})) : i;
76
- ie(o, y);
77
- },
78
- [a.setExpanded, s, c, n, h]
79
- ), w = u(s), b = S(
80
- (e, i = s) => x(i, e),
81
- [x, s]
82
- ), k = D(s), g = S(
83
- (e, i = s) => P(i, e),
84
- [P, s]
85
- );
86
- return {
87
- rowSelection: w,
88
- setRowSelection: b,
89
- expanded: k,
90
- setExpanded: g,
91
- getPanelSelection: u,
92
- setPanelSelection: x,
93
- getPanelExpanded: D,
94
- setPanelExpanded: P
95
- };
96
- }, be = {
97
- progress: {
98
- fields: [
99
- { value: "hierarchy" },
100
- { value: "assignees" },
101
- { value: "status" },
102
- { value: "taskType" }
103
- ]
104
- },
105
- overview: {
106
- fields: [
107
- { value: "hierarchy" },
108
- { value: "assignees" },
109
- { value: "status" },
110
- { value: "type" },
111
- { value: "taskType" },
112
- { value: "attributes" },
113
- { value: "entityList" }
114
- ]
115
- },
116
- versions: {
117
- fields: [
118
- { value: "hierarchy" },
119
- { value: "assignees", label: "Task assignee" },
120
- { value: "status", label: "Version status" },
121
- { value: "author", label: "Version author" },
122
- { value: "productType" },
123
- { value: "taskType" },
124
- { value: "entityList" }
125
- ]
126
- }
127
- }, le = ["overview", "products"], Te = ({
128
- children: r,
129
- page: n,
130
- projectName: c,
131
- viewSettings: a,
132
- isLoadingViews: f,
133
- updateViewSettings: _,
134
- onOpenViewer: L,
135
- onAddToList: h,
136
- ...s
137
- }) => {
138
- const [u, x] = ye(
139
- `slicer-pinned-slice-${n}`,
140
- null
141
- ), { powerLicense: D } = W(), P = a, w = P?.sliceTypes, b = P?.sliceType, k = w?.length ? b && b !== w[0] ? [b, ...w.slice(1)] : w : [b ?? "hierarchy"], g = le.includes(n) && !s.sliceType && !w?.length && k[0] !== "hierarchy" && u?.sliceType === "hierarchy" && Object.values(u.rowSelection || {}).some(Boolean), e = G(
142
- () => [
143
- ...new Set(
144
- s.sliceType ? [s.sliceType] : g ? [...k, "hierarchy"] : k
145
- )
146
- ],
147
- [s.sliceType, k.join("|"), g]
148
- ), i = P?.collapsedSliceTypes, o = G(() => i ?? [], [i?.join("|")]), y = G(
149
- () => e.map((t) => ({ id: t, sliceType: t })),
150
- [e]
151
- ), T = y[0].sliceType, {
152
- rowSelection: A,
153
- setRowSelection: K,
154
- expanded: O,
155
- setExpanded: B,
156
- getPanelSelection: H,
157
- setPanelSelection: R,
158
- getPanelExpanded: q,
159
- setPanelExpanded: C
160
- } = ve({
161
- sliceTypes: e,
162
- page: n,
163
- projectName: c,
164
- ...s
165
- }), z = S(
166
- (t) => {
167
- K(t);
168
- },
169
- [K]
170
- ), v = S(
171
- (t, d) => {
172
- const l = () => {
173
- };
174
- _(
175
- {
176
- sliceTypes: t,
177
- sliceType: t[0],
178
- collapsedSliceTypes: (d ?? o).filter((m) => t.includes(m))
179
- },
180
- l,
181
- l,
182
- {}
183
- );
184
- },
185
- [_, o]
186
- ), J = S(
187
- (t) => {
188
- const d = o.includes(t) ? o.filter((l) => l !== t) : [...o, t];
189
- v(e, d);
190
- },
191
- [o, v, e]
192
- ), $ = `${c}-${n}`, Q = I(/* @__PURE__ */ new Set());
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, $]);
196
- const Y = I(/* @__PURE__ */ new Set());
197
- M(() => {
198
- if (Y.current.has($) || f || s.sliceType || s.rowSelection || s.setRowSelection || w?.length)
199
- return;
200
- Y.current.add($);
201
- const t = `slicer-selection-${c}-${n}`, d = `slicer-expanded-${c}-${n}`, l = k[0];
202
- if (l !== "hierarchy") {
203
- const m = U(t, null);
204
- if (m && Object.keys(m).length) {
205
- R(
206
- l,
207
- (ne) => Object.keys(ne).length ? ne : m
208
- );
209
- const E = U(d, null);
210
- E && C(l, E);
211
- }
212
- }
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]);
217
- const Z = S(
218
- (t, d) => {
219
- if (D && e.slice(1).includes(t)) return;
220
- s.onSliceTypeChange ? s.onSliceTypeChange(t, d) : v([t, ...e.slice(1).filter((E) => E !== t)]);
221
- const l = (E) => s.setRowSelection ? s.setRowSelection(E) : K(E, t), m = (E) => s.setExpanded ? s.setExpanded(E) : B(E, t);
222
- u && t === u.sliceType ? (l(u.rowSelection), m(u.expanded), x(null)) : t !== "hierarchy" && (l({}), m({})), d && x({
223
- sliceType: T,
224
- rowSelection: A,
225
- expanded: O
226
- });
227
- },
228
- [
229
- v,
230
- e,
231
- A,
232
- K,
233
- u,
234
- x,
235
- O,
236
- B,
237
- s.setRowSelection,
238
- s.setExpanded,
239
- D
240
- ]
241
- ), F = S(
242
- (t) => {
243
- t !== "hierarchy" && (R(t, {}), C(t, {}));
244
- },
245
- [R, C]
246
- ), V = S(
247
- (t) => {
248
- !t || e.includes(t) || (v([...e, t]), F(t));
249
- },
250
- [e, v, F]
251
- ), j = S(
252
- (t) => {
253
- if (e.length <= 1 || !e.includes(t)) return;
254
- const d = e.filter((l) => l !== t);
255
- v(d, d.length > 1 ? void 0 : []);
256
- },
257
- [e, v]
258
- ), p = S(
259
- (t, d) => {
260
- !e.includes(t) || e.includes(d) || (v(
261
- e.map((l) => l === t ? d : l),
262
- o.map((l) => l === t ? d : l)
263
- ), F(d));
264
- },
265
- [e, v, F, o]
266
- ), N = S(
267
- (t) => {
268
- B(t);
269
- },
270
- [B]
271
- ), { useExtraSlices: ee, isLoadingExtraSlices: te, SlicerDropdown: se } = he(), de = G(
272
- () => ({
273
- projectName: c,
274
- page: n,
275
- useExtraSlices: ee,
276
- isLoadingExtraSlices: te,
277
- SlicerDropdown: se,
278
- // SLICE TYPE
279
- sliceType: T,
280
- onSliceTypeChange: Z,
281
- // SLICE PANELS
282
- slices: y,
283
- addSlicePanel: V,
284
- removeSlicePanel: j,
285
- setPanelSliceType: p,
286
- getPanelSelection: H,
287
- setPanelSelection: R,
288
- getPanelExpanded: q,
289
- setPanelExpanded: C,
290
- collapsedPanels: o,
291
- togglePanelCollapsed: J,
292
- // ROW SELECTION
293
- rowSelection: A,
294
- onRowSelectionChange: z,
295
- // PINNED SLICE
296
- pinnedSlice: u,
297
- setPinnedSlice: x,
298
- expanded: O,
299
- onExpandedChange: N,
300
- // loading state
301
- isViewSyncPending: f,
302
- onOpenViewer: L,
303
- onAddToList: h
304
- }),
305
- [
306
- n,
307
- ee,
308
- te,
309
- se,
310
- T,
311
- Z,
312
- y,
313
- o,
314
- J,
315
- V,
316
- j,
317
- p,
318
- H,
319
- R,
320
- q,
321
- C,
322
- A,
323
- z,
324
- u,
325
- x,
326
- O,
327
- N,
328
- f,
329
- L,
330
- h
331
- ]
332
- );
333
- return /* @__PURE__ */ ue(X.Provider, { value: de, children: r });
334
- }, Re = () => {
335
- const r = ae(X);
336
- if (r === void 0)
337
- throw new Error("useSlicerContext must be used within a SlicerProvider");
338
- return r;
339
- }, Ee = () => ae(X), Ce = () => {
340
- const r = Ee(), { powerLicense: n } = W();
341
- return r ? (n ? r.slices : r.slices?.slice(0, 1))?.some((a) => a.sliceType === "hierarchy") ? r.getPanelSelection("hierarchy") : r.pinnedSlice?.rowSelection ?? null : null;
342
- }, $e = {
1
+ const e = {
343
2
  folder: {
344
3
  label: "Folder",
345
4
  createLabel: "Create folder",
@@ -352,12 +11,5 @@ const he = () => {
352
11
  }
353
12
  };
354
13
  export {
355
- be as S,
356
- Te as a,
357
- Ce as b,
358
- Ee as c,
359
- he as d,
360
- ve as e,
361
- $e as n,
362
- Re as u
14
+ e as n
363
15
  };
@@ -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
+ };
@@ -0,0 +1,28 @@
1
+ function c(s) {
2
+ const e = s.replace(/\.[^/.]+$/, ""), r = [
3
+ // Pattern: file_v001, file_v1, file_v01 (with 'v' prefix)
4
+ /.*[_\-\s]v(\d+)(?:[_\-\s].*|$)/i,
5
+ // Pattern: file_001, file_01, file_1 (at end of filename)
6
+ /.*[_\-\s](\d+)$/,
7
+ // Pattern: file_001_name, file_1_description (version in middle)
8
+ /.*[_\-\s](\d{2,})(?:[_\-\s].*)/,
9
+ // Pattern: 001_file, 1_file (at start of filename)
10
+ /^(\d+)[_\-\s]/,
11
+ // Pattern: fileV1, fileV001 (no separator)
12
+ /.*v(\d+)$/i,
13
+ // Pattern: file1, file001 (number at end, no separator)
14
+ /.*?(\d{2,})$/
15
+ ];
16
+ for (const o of r) {
17
+ const n = e.match(o);
18
+ if (n) {
19
+ const a = n[1], t = parseInt(a, 10);
20
+ if (!isNaN(t) && t > 0)
21
+ return t;
22
+ }
23
+ }
24
+ return null;
25
+ }
26
+ export {
27
+ c as e
28
+ };
@@ -1,4 +1,4 @@
1
- import { b1 as g } from "./searchTerms.es.js";
1
+ import { b2 as g } from "./searchTerms.es.js";
2
2
  import { toast as f } from "react-toastify";
3
3
  const p = (t) => {
4
4
  const s = t.split("://")[1].split("?"), e = s[0], r = s[1];