@behindthemusictree/app-kit 24.0.1 → 26.1.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-Y52MKNHR.js → chunk-T4IDICOJ.js} +32 -13
- package/dist/chunk-T4IDICOJ.js.map +1 -0
- package/dist/genre-tree/index.cjs +32 -12
- package/dist/genre-tree/index.cjs.map +1 -1
- package/dist/genre-tree/index.d.ts +81 -3
- package/dist/genre-tree/index.js +3 -1
- package/dist/index.cjs +32 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
- package/dist/chunk-Y52MKNHR.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -108,6 +108,7 @@ __export(src_exports, {
|
|
|
108
108
|
genrePlaylistEndpoints: () => genrePlaylistEndpoints,
|
|
109
109
|
genrePlaylistQueryKeys: () => genrePlaylistQueryKeys,
|
|
110
110
|
genreQueryKeys: () => genreQueryKeys,
|
|
111
|
+
genreUpdateMutationKey: () => genreUpdateMutationKey,
|
|
111
112
|
getGenrePlaylistsGroupedByRoot: () => getGenrePlaylistsGroupedByRoot,
|
|
112
113
|
getReparentCandidates: () => getReparentCandidates,
|
|
113
114
|
getSpotifyAllowlistMailtoHref: () => getSpotifyAllowlistMailtoHref,
|
|
@@ -1728,6 +1729,8 @@ var CriteriaPlaylistDetailedSchema = import_zod7.z.object({
|
|
|
1728
1729
|
uuid: GenrePlaylistUuidSchema,
|
|
1729
1730
|
name: import_zod7.z.string(),
|
|
1730
1731
|
tracksCount: import_zod7.z.number(),
|
|
1732
|
+
// Summed YouTube views of the same songs as `tracksCount`.
|
|
1733
|
+
viewsCount: import_zod7.z.number(),
|
|
1731
1734
|
durationInSec: import_zod7.z.number().min(0).nullable().optional(),
|
|
1732
1735
|
durationStrInHourMinSec: import_zod7.z.string().nullable().optional(),
|
|
1733
1736
|
// Nullable: the "Genreless" root playlist has no criteria attached and is never updated.
|
|
@@ -1746,13 +1749,16 @@ var CriteriaPlaylistSimpleSchema = CriteriaPlaylistDetailedSchema.pick({
|
|
|
1746
1749
|
parent: true,
|
|
1747
1750
|
root: true,
|
|
1748
1751
|
tracksCount: true,
|
|
1752
|
+
viewsCount: true,
|
|
1749
1753
|
createdOn: true,
|
|
1750
1754
|
updatedOn: true
|
|
1751
1755
|
}).extend({
|
|
1752
1756
|
// Only on the tree/list payloads, not the detail endpoint — hence not on the detailed schema.
|
|
1753
1757
|
isUnacceptedRoot: import_zod8.z.boolean(),
|
|
1754
1758
|
// Optional: a backend that does not curate umbrella genres omits it.
|
|
1755
|
-
isUmbrella: import_zod8.z.boolean().optional()
|
|
1759
|
+
isUmbrella: import_zod8.z.boolean().optional(),
|
|
1760
|
+
// Optional: only the grow tree payload carries it; null when the genre has no scene.
|
|
1761
|
+
scene: import_zod8.z.enum(["commercial", "underground"]).nullable().optional()
|
|
1756
1762
|
});
|
|
1757
1763
|
|
|
1758
1764
|
// src/genre-tree/api/genre-playlists/queryKeys.ts
|
|
@@ -2047,6 +2053,7 @@ var genreQueryKeys = {
|
|
|
2047
2053
|
overview: (id) => ["referenceGenres", "overview", id]
|
|
2048
2054
|
}
|
|
2049
2055
|
};
|
|
2056
|
+
var genreUpdateMutationKey = ["genres", "update"];
|
|
2050
2057
|
|
|
2051
2058
|
// src/genre-tree/api/genres/endpoints.ts
|
|
2052
2059
|
var makeGenreEndpoints = (prefix) => ({
|
|
@@ -2174,7 +2181,10 @@ function useUpdateGenre(scope, getBackendBaseUrl) {
|
|
|
2174
2181
|
});
|
|
2175
2182
|
return response;
|
|
2176
2183
|
},
|
|
2177
|
-
|
|
2184
|
+
mutationKey: genreUpdateMutationKey,
|
|
2185
|
+
onSuccess: (_, { uuid }) => {
|
|
2186
|
+
void refreshGenreTree({ changedUuid: uuid });
|
|
2187
|
+
}
|
|
2178
2188
|
});
|
|
2179
2189
|
const renameGenre = (uuid, name) => {
|
|
2180
2190
|
mutate({ uuid, data: { name } });
|
|
@@ -2329,14 +2339,18 @@ function useArtistSearch(getBackendBaseUrl, text) {
|
|
|
2329
2339
|
enabled,
|
|
2330
2340
|
placeholderData: import_react_query6.keepPreviousData
|
|
2331
2341
|
});
|
|
2342
|
+
const settled = enabled && !isFetching && query === trimmed;
|
|
2343
|
+
const failed = enabled && isError;
|
|
2332
2344
|
return {
|
|
2333
2345
|
artists: trimmed.length >= MIN_QUERY_LENGTH ? data ?? [] : [],
|
|
2334
|
-
isError:
|
|
2335
|
-
settled
|
|
2346
|
+
isError: failed,
|
|
2347
|
+
settled,
|
|
2348
|
+
pending: trimmed.length >= MIN_QUERY_LENGTH && !settled && !failed
|
|
2336
2349
|
};
|
|
2337
2350
|
}
|
|
2338
2351
|
|
|
2339
2352
|
// src/genre-tree/useArtistGenreCounts.ts
|
|
2353
|
+
var import_react_query7 = require("@tanstack/react-query");
|
|
2340
2354
|
var import_zod27 = require("zod");
|
|
2341
2355
|
|
|
2342
2356
|
// src/genre-tree/schemas/artist-genre-count.ts
|
|
@@ -2359,6 +2373,7 @@ function useArtistGenreCounts(artistUuid, getBackendBaseUrl) {
|
|
|
2359
2373
|
queryFn: () => fetch2(artistEndpoints.genreCounts(artistUuid), true, false, void 0, void 0, false, true),
|
|
2360
2374
|
schema: import_zod27.z.array(ArtistGenreCountSchema),
|
|
2361
2375
|
enabled: artistUuid !== null,
|
|
2376
|
+
placeholderData: import_react_query7.keepPreviousData,
|
|
2362
2377
|
retry: (failureCount, error) => !isNotFound2(error) && failureCount < 3,
|
|
2363
2378
|
context: "useArtistGenreCounts"
|
|
2364
2379
|
});
|
|
@@ -2430,20 +2445,23 @@ var pruneGenrePlaylistsForArtist = (playlists, counts) => {
|
|
|
2430
2445
|
}
|
|
2431
2446
|
return playlists.filter((playlist) => kept.has(playlist.uuid)).map((playlist) => ({
|
|
2432
2447
|
...playlist,
|
|
2433
|
-
tracksCount: countByPlaylist.get(playlist.uuid)?.tracksCount ?? 0
|
|
2448
|
+
tracksCount: countByPlaylist.get(playlist.uuid)?.tracksCount ?? 0,
|
|
2449
|
+
// Per-artist view totals are not served, so the views metric is unavailable on a pruned tree.
|
|
2450
|
+
viewsCount: 0
|
|
2434
2451
|
}));
|
|
2435
2452
|
};
|
|
2436
2453
|
|
|
2437
2454
|
// src/genre-tree/useVisibleGenrePlaylists.ts
|
|
2438
2455
|
function useVisibleGenrePlaylists({ scope, getBackendBaseUrl, artistUuid = null }) {
|
|
2439
|
-
const { data: tree, isPending: isTreePending } = useListFullGenrePlaylists(scope, getBackendBaseUrl);
|
|
2456
|
+
const { data: tree, isPending: isTreePending, isFetching: isTreeFetching } = useListFullGenrePlaylists(scope, getBackendBaseUrl);
|
|
2440
2457
|
const counts = useArtistGenreCounts(artistUuid, getBackendBaseUrl);
|
|
2441
|
-
const
|
|
2458
|
+
const artistCounts = artistUuid !== null ? counts.data : void 0;
|
|
2459
|
+
const isCountsLoading = artistUuid !== null && (counts.isPending || counts.isPlaceholderData);
|
|
2442
2460
|
const genrePlaylists = (0, import_react15.useMemo)(() => {
|
|
2443
|
-
if (!tree
|
|
2444
|
-
return
|
|
2445
|
-
}, [tree,
|
|
2446
|
-
return { isLoading: isTreePending ||
|
|
2461
|
+
if (!tree) return [];
|
|
2462
|
+
return artistCounts ? pruneGenrePlaylistsForArtist(tree, artistCounts) : tree;
|
|
2463
|
+
}, [tree, artistCounts]);
|
|
2464
|
+
return { isLoading: isTreePending, isFetching: isCountsLoading || !isTreePending && isTreeFetching, genrePlaylists };
|
|
2447
2465
|
}
|
|
2448
2466
|
|
|
2449
2467
|
// src/genre-tree/lib/genre-playlist-helpers.ts
|
|
@@ -2479,7 +2497,7 @@ function useGenreTreeViewState({
|
|
|
2479
2497
|
},
|
|
2480
2498
|
[isSelectionControlled, onSelectedNodeIdChange]
|
|
2481
2499
|
);
|
|
2482
|
-
const { isLoading, genrePlaylists } = useVisibleGenrePlaylists({ scope, getBackendBaseUrl, artistUuid });
|
|
2500
|
+
const { isLoading, isFetching, genrePlaylists } = useVisibleGenrePlaylists({ scope, getBackendBaseUrl, artistUuid });
|
|
2483
2501
|
const genrePlaylistByNodeId = (0, import_react16.useMemo)(() => new Map(genrePlaylists.map((gp) => [gp.uuid, gp])), [genrePlaylists]);
|
|
2484
2502
|
const selectedGenrePlaylist = (0, import_react16.useMemo)(
|
|
2485
2503
|
() => genrePlaylists.find((gp) => gp.uuid === selectedNodeId),
|
|
@@ -2535,6 +2553,7 @@ function useGenreTreeViewState({
|
|
|
2535
2553
|
}, [genrePlaylists, viewMode]);
|
|
2536
2554
|
return {
|
|
2537
2555
|
isLoading,
|
|
2556
|
+
isFetching,
|
|
2538
2557
|
genrePlaylists,
|
|
2539
2558
|
genrePlaylistByNodeId,
|
|
2540
2559
|
visibleGenrePlaylists,
|
|
@@ -3136,6 +3155,7 @@ function editGenreSongPages(data, edit) {
|
|
|
3136
3155
|
genrePlaylistEndpoints,
|
|
3137
3156
|
genrePlaylistQueryKeys,
|
|
3138
3157
|
genreQueryKeys,
|
|
3158
|
+
genreUpdateMutationKey,
|
|
3139
3159
|
getGenrePlaylistsGroupedByRoot,
|
|
3140
3160
|
getReparentCandidates,
|
|
3141
3161
|
getSpotifyAllowlistMailtoHref,
|