From c09913a614e7a266c18b0d488672389eaf5aa551 Mon Sep 17 00:00:00 2001 From: QxxxGit <71350626+QxxxGit@users.noreply.github.com> Date: Fri, 20 Jun 2025 02:03:22 -0400 Subject: [PATCH] Add useLightbox and useGalleryLightbox in plugin api (#5936) --- ui/v2.5/src/docs/en/Manual/UIPluginApi.md | 2 ++ ui/v2.5/src/pluginApi.d.ts | 10 ++++++++++ ui/v2.5/src/pluginApi.tsx | 3 +++ 3 files changed, 15 insertions(+) diff --git a/ui/v2.5/src/docs/en/Manual/UIPluginApi.md b/ui/v2.5/src/docs/en/Manual/UIPluginApi.md index c09428abe..4453dfb10 100644 --- a/ui/v2.5/src/docs/en/Manual/UIPluginApi.md +++ b/ui/v2.5/src/docs/en/Manual/UIPluginApi.md @@ -83,6 +83,8 @@ Returns a `Promise` that resolves when all of the components have been loa ### `hooks` This namespace provides access to the following core utility hooks: +- `useGalleryLightbox` +- `useLightbox` - `useSpriteInfo` - `useToast` diff --git a/ui/v2.5/src/pluginApi.d.ts b/ui/v2.5/src/pluginApi.d.ts index 3dfd9a6f1..2e6d23266 100644 --- a/ui/v2.5/src/pluginApi.d.ts +++ b/ui/v2.5/src/pluginApi.d.ts @@ -1046,6 +1046,16 @@ declare namespace PluginApi { uploadScript: (funscriptPath: string) => Promise; sync: () => Promise; }; + + function useLightbox(): { + state: any; + chapters: any; + }; + + function useGalleryLightbox(): { + id: string; + chapters: any; + }; } namespace patch { function before(target: PatchableComponentNames, fn: Function): void; diff --git a/ui/v2.5/src/pluginApi.tsx b/ui/v2.5/src/pluginApi.tsx index 40c021391..99d4a5992 100644 --- a/ui/v2.5/src/pluginApi.tsx +++ b/ui/v2.5/src/pluginApi.tsx @@ -19,6 +19,7 @@ import Event from "./hooks/event"; import { before, instead, after, components, RegisterComponent } from "./patch"; import { useSettings } from "./components/Settings/context"; import { useInteractive } from "./hooks/Interactive/context"; +import { useLightbox, useGalleryLightbox } from "./hooks/Lightbox/hooks"; // due to code splitting, some components may not have been loaded when a plugin // page is loaded. This function will load all components passed to it. @@ -161,6 +162,8 @@ export const PluginApi = { useToast, useSettings, useInteractive, + useLightbox, + useGalleryLightbox, }, patch: { // intercept the arguments of supported functions