@ynput/ayon-addon-dev 0.2.1 → 0.4.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.
- package/dist/shell/index.js +111 -5
- package/package.json +3 -3
package/dist/shell/index.js
CHANGED
|
@@ -2,13 +2,13 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback, createContext, useContext, useState, useMemo, useEffect, useSyncExternalStore, Component, StrictMode } from "react";
|
|
3
3
|
import { createRoot } from "react-dom/client";
|
|
4
4
|
import { provideHost, isKnownSlot, getRegistry, contributionTitle, getHost, registerManifest, setManifestsLoading } from "@ynput/ayon-addon/host";
|
|
5
|
-
import { useGetProjectFoldersQuery, useGetCurrentUserQuery, usersApi, useListProjectsQuery, useGetEntitiesDetailsPanelQuery, useGetProjectQuery, useGetUsersAssigneeQuery, createStandaloneStore } from "@ynput/ayon-frontend-shared/api";
|
|
6
|
-
import { AddonMoreMenu, AddonEntityPicker, SlicerHost, ProjectPageLayoutHost, JsonViewer, AddonButton, useAddonCustomizeSections, useAddonTableShortcuts, shortcutEntities, SettingsPanel, AddonDialog, useStudioPageSlotContext, useProjectPageSlotContext, SplitterStyles, LoginPage, AddonServices } from "@ynput/ayon-frontend-shared/components";
|
|
5
|
+
import { useGetProjectFoldersQuery, useGetCurrentUserQuery, usersApi, useListProjectsQuery, useGetEntitiesDetailsPanelQuery, useGetUsersQuery, useGetProjectQuery, useGetUsersAssigneeQuery, createStandaloneStore } from "@ynput/ayon-frontend-shared/api";
|
|
6
|
+
import { AddonMoreMenu, AddonEntityPicker, SlicerHost, ProjectPageLayoutHost, useAddonContextMenu, JsonViewer, AddonButton, AddonProfileSections, useUserDetailsSlotContext, useAddonUserMenuItems, AddonUserDetailsSections, useAddonCustomizeSections, useAddonTableShortcuts, shortcutEntities, SettingsPanel, AddonDialog, useStudioPageSlotContext, useProjectPageSlotContext, SplitterStyles, LoginPage, AddonServices } from "@ynput/ayon-frontend-shared/components";
|
|
7
7
|
import { useGlobalContext, usePowerpack, useMenuContext, useSettingsPanel, useScopedDetailsPanel, EntityUpdatesProvider, GlobalProvider, PowerpackProvider, MenuProvider, URIProvider, DetailsPanelProvider, PiPProvider, DeleteEntitiesProvider, SettingsPanelProvider, ProjectContextProvider, ProjectFoldersContextProvider } from "@ynput/ayon-frontend-shared/context";
|
|
8
8
|
import { buildProjectsTableData, ProjectsTable, PROJECTS_LIST_MENU_ID, parseProjectFolderRowId } from "@ynput/ayon-frontend-shared/ProjectsTable";
|
|
9
9
|
import { getProjectDisplayName, clearAccessToken, storeAccessToken } from "@ynput/ayon-frontend-shared/util";
|
|
10
10
|
import { Button, Icon, Dropdown, Dialog, InputText } from "@ynput/ayon-react-components";
|
|
11
|
-
import { useContributions, prefetchPiece, runContribution, EntityPicker, ContributionView } from "@ynput/ayon-addon";
|
|
11
|
+
import { useContributions, prefetchPiece, runContribution, EntityPicker, ContributionView, useUser as useUser$1 } from "@ynput/ayon-addon";
|
|
12
12
|
import { useCreateContextMenu, ContextMenuProvider, GlobalContextMenu } from "@ynput/ayon-frontend-shared/ContextMenu";
|
|
13
13
|
import { useDispatch, Provider } from "react-redux";
|
|
14
14
|
import { BrowserRouter, useNavigate, useSearchParams, useParams, useLocation } from "react-router-dom";
|
|
@@ -158,6 +158,7 @@ const ProjectList = ({ multiSelect = false }) => {
|
|
|
158
158
|
};
|
|
159
159
|
const provideShellHost = () => provideHost({
|
|
160
160
|
useUser,
|
|
161
|
+
useContextMenu: useAddonContextMenu,
|
|
161
162
|
components: {
|
|
162
163
|
ProjectPageLayout: ProjectPageLayoutHost,
|
|
163
164
|
Slicer: SlicerHost,
|
|
@@ -405,6 +406,24 @@ const SLOT_AREAS = [
|
|
|
405
406
|
]
|
|
406
407
|
}
|
|
407
408
|
]
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
label: "Settings",
|
|
412
|
+
icon: "settings",
|
|
413
|
+
sections: [
|
|
414
|
+
{
|
|
415
|
+
label: "User details",
|
|
416
|
+
slots: [
|
|
417
|
+
{ slot: "userDetails.section", label: "Sections" },
|
|
418
|
+
{ slot: "userDetails.menuItem", label: "More menu" }
|
|
419
|
+
]
|
|
420
|
+
}
|
|
421
|
+
]
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
label: "Account",
|
|
425
|
+
icon: "account_circle",
|
|
426
|
+
sections: [{ label: "Profile", slots: [{ slot: "profile.section", label: "Sections" }] }]
|
|
408
427
|
}
|
|
409
428
|
];
|
|
410
429
|
const slotPath = (slot) => {
|
|
@@ -417,7 +436,15 @@ const slotPath = (slot) => {
|
|
|
417
436
|
return ["Other", slot];
|
|
418
437
|
};
|
|
419
438
|
const slotIcon = (slot) => SLOT_AREAS.find((area) => area.sections.some((s) => s.slots.some((x) => x.slot === slot)))?.icon || "extension";
|
|
420
|
-
const NO_PROJECT = [
|
|
439
|
+
const NO_PROJECT = [
|
|
440
|
+
"studio.page",
|
|
441
|
+
"header.item",
|
|
442
|
+
"projectList.menuItem",
|
|
443
|
+
"app.service",
|
|
444
|
+
"userDetails.section",
|
|
445
|
+
"userDetails.menuItem",
|
|
446
|
+
"profile.section"
|
|
447
|
+
];
|
|
421
448
|
const PROJECTS = ["studio.page", "projectList.menuItem"];
|
|
422
449
|
const ENTITIES = [
|
|
423
450
|
"detailsPanel.tab",
|
|
@@ -438,7 +465,8 @@ const RUN = [
|
|
|
438
465
|
"projectList.menuItem",
|
|
439
466
|
"slicer.menuItem",
|
|
440
467
|
"entityMenuItem",
|
|
441
|
-
"table.shortcut"
|
|
468
|
+
"table.shortcut",
|
|
469
|
+
"userDetails.menuItem"
|
|
442
470
|
];
|
|
443
471
|
const needsProject = (slot) => !!slot && !NO_PROJECT.includes(slot);
|
|
444
472
|
const needsProjects = (slot) => !!slot && PROJECTS.includes(slot);
|
|
@@ -1217,6 +1245,79 @@ const ServiceStage = ({ contribution, selection }) => {
|
|
|
1217
1245
|
useReport(contribution, context, true);
|
|
1218
1246
|
return /* @__PURE__ */ jsx(ServiceNote, {});
|
|
1219
1247
|
};
|
|
1248
|
+
const PROFILE_CONTEXT = {};
|
|
1249
|
+
const ProfileStage = ({ contribution }) => {
|
|
1250
|
+
const user2 = useUser$1();
|
|
1251
|
+
const { powerLicense, isLoading } = usePowerpack();
|
|
1252
|
+
const hidden = !!contribution.powerFeature && (isLoading || !powerLicense);
|
|
1253
|
+
useReport(contribution, PROFILE_CONTEXT, !!user2 && !hidden);
|
|
1254
|
+
if (!user2) return /* @__PURE__ */ jsx(Hint, { children: "Signing in…" });
|
|
1255
|
+
return /* @__PURE__ */ jsx("div", { className: "ayon-shell-body", style: { justifyContent: "center" }, children: /* @__PURE__ */ jsxs(
|
|
1256
|
+
"div",
|
|
1257
|
+
{
|
|
1258
|
+
style: { width: "min(600px, 100%)", display: "flex", flexDirection: "column", gap: 4 },
|
|
1259
|
+
"data-shell-surface": "profile",
|
|
1260
|
+
children: [
|
|
1261
|
+
/* @__PURE__ */ jsx("div", { className: "ayon-shell-bar", children: /* @__PURE__ */ jsx("strong", { children: user2.fullName || user2.name }) }),
|
|
1262
|
+
hidden && !isLoading && /* @__PURE__ */ jsx(Hint, { children: "A power feature: this section shows with a Power Pack licence only." }),
|
|
1263
|
+
/* @__PURE__ */ jsx(AddonProfileSections, {})
|
|
1264
|
+
]
|
|
1265
|
+
}
|
|
1266
|
+
) });
|
|
1267
|
+
};
|
|
1268
|
+
const UserDetailsStage = ({ contribution }) => {
|
|
1269
|
+
const signedIn = useUser$1();
|
|
1270
|
+
const { data: users = [], isLoading } = useGetUsersQuery({ selfName: signedIn?.name });
|
|
1271
|
+
const [picked, setPicked] = useState();
|
|
1272
|
+
const fallback = useMemo(
|
|
1273
|
+
() => users.find((u) => u.name === signedIn?.name && !u.isService) ?? users.find((u) => !u.isService && u.active !== false),
|
|
1274
|
+
[users, signedIn?.name]
|
|
1275
|
+
);
|
|
1276
|
+
const target = users.find((u) => u.name === picked) ?? fallback;
|
|
1277
|
+
const selected = useMemo(() => target ? [target] : [], [target]);
|
|
1278
|
+
const context = useUserDetailsSlotContext(selected, false);
|
|
1279
|
+
const isMenuItem = contribution.slot === "userDetails.menuItem";
|
|
1280
|
+
useReport(contribution, context, !!target, isMenuItem);
|
|
1281
|
+
const { topItems, items } = useAddonUserMenuItems(context);
|
|
1282
|
+
if (isLoading) return /* @__PURE__ */ jsx(Hint, { children: "Loading users…" });
|
|
1283
|
+
if (!target) return /* @__PURE__ */ jsx(Hint, { children: "No users to show." });
|
|
1284
|
+
return /* @__PURE__ */ jsx("div", { className: "ayon-shell-body", style: { justifyContent: "flex-end" }, children: /* @__PURE__ */ jsxs(
|
|
1285
|
+
"div",
|
|
1286
|
+
{
|
|
1287
|
+
style: { width: "min(420px, 100%)", display: "flex", flexDirection: "column", gap: 4 },
|
|
1288
|
+
"data-shell-surface": "user-details",
|
|
1289
|
+
children: [
|
|
1290
|
+
/* @__PURE__ */ jsxs("div", { className: "ayon-shell-bar", children: [
|
|
1291
|
+
/* @__PURE__ */ jsx(
|
|
1292
|
+
Dropdown,
|
|
1293
|
+
{
|
|
1294
|
+
value: [target.name],
|
|
1295
|
+
options: users.map((u) => ({
|
|
1296
|
+
value: u.name,
|
|
1297
|
+
label: u.isService ? `${u.name} (service)` : u.attrib?.fullName || u.name
|
|
1298
|
+
})),
|
|
1299
|
+
search: true,
|
|
1300
|
+
onChange: (names) => setPicked(names[0]),
|
|
1301
|
+
style: { minWidth: 200 }
|
|
1302
|
+
}
|
|
1303
|
+
),
|
|
1304
|
+
/* @__PURE__ */ jsx("span", { className: "spacer" }),
|
|
1305
|
+
[...topItems, ...items].map((item) => /* @__PURE__ */ jsx(
|
|
1306
|
+
Button,
|
|
1307
|
+
{
|
|
1308
|
+
icon: item.icon,
|
|
1309
|
+
label: item.label,
|
|
1310
|
+
variant: "text",
|
|
1311
|
+
onClick: () => item.onClick?.()
|
|
1312
|
+
},
|
|
1313
|
+
item.id
|
|
1314
|
+
))
|
|
1315
|
+
] }),
|
|
1316
|
+
/* @__PURE__ */ jsx(AddonUserDetailsSections, { context })
|
|
1317
|
+
]
|
|
1318
|
+
}
|
|
1319
|
+
) });
|
|
1320
|
+
};
|
|
1220
1321
|
const HeaderStage = ({ contribution, selection }) => {
|
|
1221
1322
|
const { contributions } = useContributions("header.item");
|
|
1222
1323
|
const [context, setContext] = useState();
|
|
@@ -1470,6 +1571,11 @@ const Stage = ({
|
|
|
1470
1571
|
return /* @__PURE__ */ jsx(TableStage, { ...props });
|
|
1471
1572
|
case "app.service":
|
|
1472
1573
|
return /* @__PURE__ */ jsx(ServiceStage, { ...props });
|
|
1574
|
+
case "userDetails.section":
|
|
1575
|
+
case "userDetails.menuItem":
|
|
1576
|
+
return /* @__PURE__ */ jsx(UserDetailsStage, { ...props });
|
|
1577
|
+
case "profile.section":
|
|
1578
|
+
return /* @__PURE__ */ jsx(ProfileStage, { ...props });
|
|
1473
1579
|
default:
|
|
1474
1580
|
return /* @__PURE__ */ jsxs(Hint, { children: [
|
|
1475
1581
|
"The shell has no stage for ",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ynput/ayon-addon-dev",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Dev tooling for AYON addon frontends: Vite plugin, dev server, CLI, lint preset",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@module-federation/vite": ">=1.14",
|
|
44
|
-
"@ynput/ayon-addon": "0.
|
|
44
|
+
"@ynput/ayon-addon": "0.5.0",
|
|
45
45
|
"vite": ">=6",
|
|
46
|
-
"@ynput/ayon-frontend-shared": ">=0.
|
|
46
|
+
"@ynput/ayon-frontend-shared": ">=0.9.0",
|
|
47
47
|
"@ynput/ayon-react-components": "^1.25.1",
|
|
48
48
|
"primereact": ">=9",
|
|
49
49
|
"react": ">=18",
|