@behindthemusictree/app-kit 34.1.0 → 35.0.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/{chunk-QZXZHP4R.js → chunk-ULSVAC23.js} +29 -30
- package/dist/chunk-ULSVAC23.js.map +1 -0
- package/dist/genre-tree/index.cjs +28 -29
- package/dist/genre-tree/index.cjs.map +1 -1
- package/dist/genre-tree/index.d.ts +208 -209
- package/dist/genre-tree/index.js +1 -1
- package/dist/index.cjs +28 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-QZXZHP4R.js.map +0 -1
package/dist/genre-tree/index.js
CHANGED
|
@@ -124,7 +124,7 @@ import {
|
|
|
124
124
|
useTrackListSidebarVisibility,
|
|
125
125
|
useUpdateGenre,
|
|
126
126
|
useVisibleGenrePlaylists
|
|
127
|
-
} from "../chunk-
|
|
127
|
+
} from "../chunk-ULSVAC23.js";
|
|
128
128
|
import "../chunk-4TE4OSOM.js";
|
|
129
129
|
import "../chunk-T5D5T52J.js";
|
|
130
130
|
import "../chunk-4MEK3CNF.js";
|
package/dist/index.cjs
CHANGED
|
@@ -2116,12 +2116,12 @@ var CriteriaDetailedSchema = import_zod15.z.object({
|
|
|
2116
2116
|
wikidataId: import_zod15.z.string().nullable().optional(),
|
|
2117
2117
|
parent: CriteriaMinimumSchema.nullable(),
|
|
2118
2118
|
ascendants: import_zod15.z.array(CriteriaLineageRelWithoutDescendantSchema),
|
|
2119
|
-
descendants: import_zod15.z.array(CriteriaLineageRelWithoutAscendantSchema),
|
|
2119
|
+
descendants: import_zod15.z.array(CriteriaLineageRelWithoutAscendantSchema).optional(),
|
|
2120
2120
|
root: CriteriaMinimumSchema,
|
|
2121
2121
|
children: import_zod15.z.array(CriteriaMinimumSchema),
|
|
2122
2122
|
catalogue: GenreCatalogueCountsSchema.optional(),
|
|
2123
|
-
criteriaPlaylist: import_zod15.z.union([GenrePlaylistSummarySchema, CriteriaPlaylistMinimumSchema]),
|
|
2124
|
-
tracks: import_zod15.z.array(TrackMinimumSchema),
|
|
2123
|
+
criteriaPlaylist: import_zod15.z.union([GenrePlaylistSummarySchema, CriteriaPlaylistMinimumSchema]).nullable(),
|
|
2124
|
+
tracks: import_zod15.z.array(TrackMinimumSchema).optional(),
|
|
2125
2125
|
essentialSongs: import_zod15.z.array(TrackMinimumSchema),
|
|
2126
2126
|
tracksCount: import_zod15.z.number(),
|
|
2127
2127
|
updatedOn: import_zod15.z.string().datetime().nullable()
|
|
@@ -2177,7 +2177,7 @@ var CriteriaPlaylistSimpleSchema = CriteriaPlaylistDetailedSchema.pick({
|
|
|
2177
2177
|
// src/genre-tree/schemas/reference-genre.ts
|
|
2178
2178
|
var ReferenceGenreDetailedSchema = CriteriaDetailedSchema.extend({
|
|
2179
2179
|
catalogue: GenreCatalogueCountsSchema,
|
|
2180
|
-
criteriaPlaylist: GenrePlaylistSummarySchema
|
|
2180
|
+
criteriaPlaylist: GenrePlaylistSummarySchema.nullable()
|
|
2181
2181
|
});
|
|
2182
2182
|
var ReferenceGenrePlaylistSchema = CriteriaPlaylistSimpleSchema.extend({
|
|
2183
2183
|
...GenreCountsSchema.shape,
|
|
@@ -3224,43 +3224,40 @@ function useGenreTreeViewState({
|
|
|
3224
3224
|
getBackendBaseUrl,
|
|
3225
3225
|
viewMode: controlledViewMode,
|
|
3226
3226
|
artistUuid,
|
|
3227
|
-
|
|
3228
|
-
|
|
3227
|
+
selectedGenreUuid: controlledSelectedGenreUuid,
|
|
3228
|
+
onSelectedGenreUuidChange,
|
|
3229
3229
|
criteriaOverviewSchema
|
|
3230
3230
|
}) {
|
|
3231
3231
|
const [internalViewMode, setInternalViewMode] = (0, import_react18.useState)("pop-core");
|
|
3232
3232
|
const [allowWheelRotation, setAllowWheelRotation] = (0, import_react18.useState)(false);
|
|
3233
|
-
const [
|
|
3234
|
-
const isSelectionControlled =
|
|
3235
|
-
const
|
|
3236
|
-
const
|
|
3233
|
+
const [internalSelectedGenreUuid, setInternalSelectedGenreUuid] = (0, import_react18.useState)(null);
|
|
3234
|
+
const isSelectionControlled = controlledSelectedGenreUuid !== void 0;
|
|
3235
|
+
const selectedGenreUuid = isSelectionControlled ? controlledSelectedGenreUuid : internalSelectedGenreUuid;
|
|
3236
|
+
const selectGenre = (0, import_react18.useCallback)(
|
|
3237
3237
|
(nodeId) => {
|
|
3238
|
-
if (!isSelectionControlled)
|
|
3239
|
-
|
|
3238
|
+
if (!isSelectionControlled) setInternalSelectedGenreUuid(nodeId);
|
|
3239
|
+
onSelectedGenreUuidChange?.(nodeId);
|
|
3240
3240
|
},
|
|
3241
|
-
[isSelectionControlled,
|
|
3241
|
+
[isSelectionControlled, onSelectedGenreUuidChange]
|
|
3242
3242
|
);
|
|
3243
3243
|
const { isLoading, isFetching, genrePlaylists } = useVisibleGenrePlaylists({ scope, getBackendBaseUrl, artistUuid });
|
|
3244
3244
|
const genrePlaylistByNodeId = (0, import_react18.useMemo)(() => new Map(genrePlaylists.map((gp) => [gp.uuid, gp])), [genrePlaylists]);
|
|
3245
3245
|
const selectedGenrePlaylist = (0, import_react18.useMemo)(
|
|
3246
|
-
() => genrePlaylists.find((gp) => gp.uuid ===
|
|
3247
|
-
|
|
3248
|
-
genrePlaylists.find((gp) => gp.criteria?.uuid === requestedSelectedNodeId),
|
|
3249
|
-
[genrePlaylists, requestedSelectedNodeId]
|
|
3246
|
+
() => genrePlaylists.find((gp) => gp.criteria?.uuid === selectedGenreUuid),
|
|
3247
|
+
[genrePlaylists, selectedGenreUuid]
|
|
3250
3248
|
);
|
|
3251
|
-
const selectedNodeId = selectedGenrePlaylist?.uuid ??
|
|
3252
|
-
(0, import_react18.
|
|
3253
|
-
if (!
|
|
3254
|
-
|
|
3249
|
+
const selectedNodeId = selectedGenrePlaylist?.uuid ?? null;
|
|
3250
|
+
const selectNode = (0, import_react18.useCallback)((node) => {
|
|
3251
|
+
if (!node) selectGenre(null);
|
|
3252
|
+
else {
|
|
3253
|
+
const genreUuid = genrePlaylistByNodeId.get(node.id)?.criteria?.uuid;
|
|
3254
|
+
if (genreUuid) selectGenre(genreUuid);
|
|
3255
3255
|
}
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
const
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
(genrePlaylist) => setSelectedNodeId(genrePlaylist.uuid),
|
|
3262
|
-
[setSelectedNodeId]
|
|
3263
|
-
);
|
|
3256
|
+
}, [selectGenre, genrePlaylistByNodeId]);
|
|
3257
|
+
const clearSelection = (0, import_react18.useCallback)(() => selectGenre(null), [selectGenre]);
|
|
3258
|
+
const selectGenrePlaylist = (0, import_react18.useCallback)((playlist) => {
|
|
3259
|
+
if (playlist.criteria) selectGenre(playlist.criteria.uuid);
|
|
3260
|
+
}, [selectGenre]);
|
|
3264
3261
|
const prefetchGenreOverview = usePrefetchGenreOverview(scope, getBackendBaseUrl, criteriaOverviewSchema);
|
|
3265
3262
|
const hoverPrefetchTimerRef = (0, import_react18.useRef)(null);
|
|
3266
3263
|
(0, import_react18.useEffect)(
|
|
@@ -3310,6 +3307,8 @@ function useGenreTreeViewState({
|
|
|
3310
3307
|
genrePlaylistByNodeId,
|
|
3311
3308
|
visibleGenrePlaylists,
|
|
3312
3309
|
groupedGenrePlaylistsByRoot,
|
|
3310
|
+
selectedGenreUuid,
|
|
3311
|
+
selectGenre,
|
|
3313
3312
|
selectedNodeId,
|
|
3314
3313
|
selectedGenrePlaylist,
|
|
3315
3314
|
selectNode,
|