refactor: Removed the use of d.ts files to support SDK generation for public plugins
This commit is contained in:
parent
06b7e4074d
commit
2683d46b16
114 changed files with 408 additions and 257 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { doesFocusableExist, FocusDetails, getCurrentFocusKey } from "@noriginmedia/norigin-spatial-navigation";
|
||||
import { useEffect, useLayoutEffect } from "react";
|
||||
import { useEffect } from "react";
|
||||
|
||||
export function AutoFocus (data: {
|
||||
parentKey?: string;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { FocusDetails, useFocusable } from "@noriginmedia/norigin-spatial-navigation";
|
||||
import { useFocusable } from "@noriginmedia/norigin-spatial-navigation";
|
||||
import classNames from "classnames";
|
||||
import { JSX } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import
|
|||
FocusContext,
|
||||
useFocusable,
|
||||
} from "@noriginmedia/norigin-spatial-navigation";
|
||||
import { GameMeta } from "../../shared/constants";
|
||||
import CardElement, { GameCardParams } from "./CardElement";
|
||||
import { JSX } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { FocusContext, useFocusable } from "@noriginmedia/norigin-spatial-navigation";
|
||||
import { Home, TriangleAlert } from "lucide-react";
|
||||
import { GamePadButtonCode, useShortcutContext, useShortcuts } from "../scripts/shortcuts";
|
||||
import { GamePadButtonCode, useShortcuts } from "../scripts/shortcuts";
|
||||
import { FloatingShortcuts } from "./Shortcuts";
|
||||
import { Button } from "./options/Button";
|
||||
import { useEffect } from "react";
|
||||
|
|
|
|||
|
|
@ -86,7 +86,6 @@ function List (data: {
|
|||
function NewFolderInput (data: { id: string, name: string | undefined, setName: (name: string) => void; className?: string; })
|
||||
{
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
const { control } = useActiveControl();
|
||||
const { ref, focused, focusSelf } = useFocusable({
|
||||
focusKey: data.id,
|
||||
onEnterPress: () => inputRef.current?.focus(),
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { FileQuestion, HardDrive, Store } from "lucide-react";
|
|||
import { JSX } from "react";
|
||||
import { FOCUS_KEYS } from "../scripts/types";
|
||||
import { useRouter } from "@tanstack/react-router";
|
||||
import { FrontEndGameType, FrontEndId } from "@/shared/types";
|
||||
|
||||
export default function FrontEndGameCard (data: { index: number, game: FrontEndGameType; showSource?: boolean; } & FocusParams & InteractParams)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
||||
import { useSuspenseQuery } from "@tanstack/react-query";
|
||||
import { GameMetaExtra, CardList } from "./CardList";
|
||||
import { DefaultRommStaleTime, GameListFilterType, RPC_URL } from "@shared/constants";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
import { HardDrive } from "lucide-react";
|
||||
import { JSX, Ref, useContext, useEffect } from "react";
|
||||
import { JSX, useContext } from "react";
|
||||
import { useLocalSetting } from "../scripts/utils";
|
||||
import { AnimatedBackgroundContext } from "../scripts/contexts";
|
||||
import { allGamesQuery } from "@queries/romm";
|
||||
import { FrontEndGameType, FrontEndId } from "@/shared/types";
|
||||
|
||||
export interface GameListParams extends FocusParams
|
||||
{
|
||||
|
|
@ -95,7 +96,7 @@ export function GameList (data: GameListParams)
|
|||
|
||||
const previewUrls = g.path_covers.map(c =>
|
||||
{
|
||||
const url = new URL(`${RPC_URL(__HOST__)}${c}`);
|
||||
const url = c.startsWith("http") ? new URL(c) : new URL(`${RPC_URL(__HOST__)}${c}`);
|
||||
url.searchParams.delete('ts');
|
||||
return url;
|
||||
});
|
||||
|
|
@ -103,7 +104,7 @@ export function GameList (data: GameListParams)
|
|||
let platformUrl: URL | undefined = undefined;
|
||||
if (g.path_platform_cover)
|
||||
{
|
||||
platformUrl = new URL(`${RPC_URL(__HOST__)}${g.path_platform_cover}`);
|
||||
platformUrl = g.path_platform_cover.startsWith("http") ? new URL(g.path_platform_cover) : new URL(`${RPC_URL(__HOST__)}${g.path_platform_cover}`);
|
||||
platformUrl.searchParams.set('width', "64");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ const KeyElements: Record<string, JSX.Element> = {
|
|||
'←': <ArrowLeft />,
|
||||
'→': <ArrowRight />,
|
||||
};
|
||||
const DZ = 0.22, TH = 0.85, NS = 'http://www.w3.org/2000/svg';
|
||||
const DZ = 0.22;
|
||||
|
||||
function ang (x: number, y: number)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ function SearchInput (data: {
|
|||
onSubmit: (search: string | undefined) => void;
|
||||
} & FocusParams)
|
||||
{
|
||||
const { control } = useActiveControl();
|
||||
const { ref, focusKey } = useFocusable({
|
||||
onBlur: () => inputRef.current?.blur(),
|
||||
onFocus: (l, p, d) =>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { FocusContext, useFocusable } from "@noriginmedia/norigin-spatial-navigation";
|
||||
import { Home, TriangleAlert } from "lucide-react";
|
||||
import { GamePadButtonCode, useShortcutContext, useShortcuts } from "../scripts/shortcuts";
|
||||
import { GamePadButtonCode, useShortcuts } from "../scripts/shortcuts";
|
||||
import { Button } from "./options/Button";
|
||||
import { useEffect } from "react";
|
||||
import { useRouter } from "@tanstack/react-router";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { RPC_URL } from "@/shared/constants";
|
||||
import { FrontendNotification } from "@/shared/types";
|
||||
import { Clock, CloudUpload, Save } from "lucide-react";
|
||||
import { useEffect } from "react";
|
||||
import toast, { ToastOptions } from "react-hot-toast";
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import { useNavigate } from "@tanstack/react-router";
|
|||
import { DefaultRommStaleTime, RPC_URL } from "@shared/constants";
|
||||
import { CardList, GameMetaExtra } from "./CardList";
|
||||
import { rommApi } from "../scripts/clientApi";
|
||||
import { JSX, useMemo, useState } from "react";
|
||||
import { Gamepad2, HardDrive } from "lucide-react";
|
||||
import { JSX, useMemo } from "react";
|
||||
import { HardDrive } from "lucide-react";
|
||||
import { mobileCheck } from "../scripts/utils";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
import placeholder from '../assets/256x256.png?url';
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import { useFocusable, FocusContext } from "@noriginmedia/norigin-spatial-naviga
|
|||
import { ArrowDownAz, ClockArrowDown, CalendarArrowDown, Rocket, HardDrive, SortDesc, User, Drama, FunnelX, Store } from "lucide-react";
|
||||
import { sourceIconMap } from "./Constants";
|
||||
import { useContextDialog, ContextList, DialogEntry } from "./ContextDialog";
|
||||
import { FrontEndFilterLists } from "@/shared/types";
|
||||
|
||||
function FilterButton (data: {
|
||||
id: string,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Ref, RefObject } from 'react';
|
||||
import { Ref } from 'react';
|
||||
import './dots.css';
|
||||
|
||||
export default function DotsLoading (data: { ref?: Ref<any>; })
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
import { FrontEndGameTypeDetailed, FrontEndGameTypeDetailedAchievement } from "@/shared/types";
|
||||
import { useFocusable } from "@noriginmedia/norigin-spatial-navigation";
|
||||
import { Medal } from "lucide-react";
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import ActionButton from "./ActionButton";
|
|||
import { useLocalStorage } from "usehooks-ts";
|
||||
import FocusTooltip from "../FocusTooltip";
|
||||
import { useBlocker, useNavigate, useRouter } from "@tanstack/react-router";
|
||||
import { FrontEndGameTypeDetailed } from "@/shared/types";
|
||||
|
||||
function AchievementsInfo (data: { game: FrontEndGameTypeDetailed; } & InteractParams)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { scrollIntoViewHandler } from "@/mainview/scripts/utils";
|
|||
import { RPC_URL } from "@/shared/constants";
|
||||
import { FocusContext, useFocusable } from "@noriginmedia/norigin-spatial-navigation";
|
||||
import classNames from "classnames";
|
||||
import { Clock, CloudBackup, CloudDownload, CloudUpload, Gamepad2, HardDrive, Store, TriangleAlert } from "lucide-react";
|
||||
import { Clock, CloudDownload, CloudUpload, HardDrive, TriangleAlert } from "lucide-react";
|
||||
import prettyBytes from "pretty-bytes";
|
||||
import { JSX } from "react";
|
||||
import ActionButtons from "./ActionButtons";
|
||||
|
|
@ -10,6 +10,7 @@ import prettyMilliseconds from 'pretty-ms';
|
|||
import { useQuery } from "@tanstack/react-query";
|
||||
import { validateSourceQuery } from "@/mainview/scripts/queries/romm";
|
||||
import { sourceIconMap } from "../Constants";
|
||||
import { FrontEndGameTypeDetailed } from "@/shared/types";
|
||||
|
||||
export function DetailElement (data: { icon: JSX.Element; tooltip?: string | null, children?: any | any[]; })
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { gameLookup } from "@/mainview/scripts/queries/romm";
|
||||
|
||||
import { FocusContext, useFocusable } from "@noriginmedia/norigin-spatial-navigation";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { Check, Search } from "lucide-react";
|
||||
|
|
@ -6,6 +6,8 @@ import HeaderSearchField from "../HeaderSearchField";
|
|||
import { GamePadButtonCode, useShortcuts } from "@/mainview/scripts/shortcuts";
|
||||
import { scrollIntoViewHandler } from "@/mainview/scripts/utils";
|
||||
import { FOCUS_KEYS } from "@/mainview/scripts/types";
|
||||
import { FrontEndId, GameLookup } from "@/shared/types";
|
||||
import { gameLookupQuery } from "@/mainview/scripts/queries/romm";
|
||||
|
||||
function Result (data: {
|
||||
match: GameLookup;
|
||||
|
|
@ -54,7 +56,7 @@ function SearchField (data: { setSearch: (search: string | undefined) => void; s
|
|||
</div>;
|
||||
}
|
||||
|
||||
export default function GameLookup (data: {
|
||||
export default function GameLookupElement (data: {
|
||||
search: string | undefined,
|
||||
setSearch: (search: string | undefined) => void,
|
||||
onSelect: (match: GameLookup) => void;
|
||||
|
|
@ -62,7 +64,7 @@ export default function GameLookup (data: {
|
|||
selected?: FrontEndId;
|
||||
})
|
||||
{
|
||||
const { data: lookups, isFetching } = useQuery({ ...gameLookup(data.search), staleTime: 1000 * 60 * 60 });
|
||||
const { data: lookups, isFetching } = useQuery({ ...gameLookupQuery(data.search), staleTime: 1000 * 60 * 60 });
|
||||
|
||||
return <div>
|
||||
<SearchField setSearch={data.setSearch} search={data.search} />
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import ActionButton from "./ActionButton";
|
|||
import { useRouter } from "@tanstack/react-router";
|
||||
import { DownloadSourceType } from "@/shared/constants";
|
||||
import { GamePadButtonCode, Shortcut, useShortcuts } from "@/mainview/scripts/shortcuts";
|
||||
import { CommandEntry, FrontEndGameTypeDetailed } from "@/shared/types";
|
||||
|
||||
export default function MainActions (data: { game?: FrontEndGameTypeDetailed, source: string, id: string; })
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { PathSettingsOptionBase, PathSettingsOptionParams } from "./PathSettings
|
|||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { changeDownloadsMutation, getSettingQuery } from "@queries/settings";
|
||||
import { SettingsType } from "@/shared/constants";
|
||||
import { KeysWithValueAssignableTo } from "@/shared/types";
|
||||
|
||||
export default function DownloadDirectoryOption (data: PathSettingsOptionParams & { id: KeysWithValueAssignableTo<SettingsType, string>; })
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import { useFocusable } from "@noriginmedia/norigin-spatial-navigation";
|
|||
import { CheckIcon, X } from "lucide-react";
|
||||
import { oneShot } from "@/mainview/scripts/audio/audio";
|
||||
import { GamePadButtonCode, Shortcut, useShortcuts } from "@/mainview/scripts/shortcuts";
|
||||
import useActiveControl from "@/mainview/scripts/gamepads";
|
||||
|
||||
export function OptionInput (data: {
|
||||
name: string;
|
||||
|
|
@ -35,7 +34,6 @@ export function OptionInput (data: {
|
|||
}
|
||||
oneShot('click');
|
||||
};
|
||||
const { control } = useActiveControl();
|
||||
const [inputFocused, setInputFocused] = useState(false);
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
const { ref, focusKey } = useFocusable({
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import { ContextDialog } from "../ContextDialog";
|
|||
import FilePicker from "../FilePicker";
|
||||
import { setFocus } from "@noriginmedia/norigin-spatial-navigation";
|
||||
import { getSettingQuery, setSettingMutation } from "@queries/settings";
|
||||
import { KeysWithValueAssignableTo } from "@/shared/types";
|
||||
|
||||
export interface PathSettingsOptionParams
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { useMutation, useQuery } from "@tanstack/react-query";
|
|||
import { OptionSpace } from "./OptionSpace";
|
||||
import { getSettingQuery, setSettingMutation } from "@queries/settings";
|
||||
import { OptionDropdown } from "./OptionDropdown";
|
||||
import { KeysWithValueAssignableTo } from "@/shared/types";
|
||||
|
||||
export function SettingsDropdown (data: {
|
||||
label: string;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { useMutation, useQuery } from "@tanstack/react-query";
|
|||
import { OptionSpace } from "./OptionSpace";
|
||||
import { OptionInput } from "./OptionInput";
|
||||
import { getSettingQuery, setSettingMutation } from "@queries/settings";
|
||||
import { KeysWithValueAssignableTo } from "@/shared/types";
|
||||
|
||||
export function SettingsOption (data: {
|
||||
label: string;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import { StoreEmulatorCard } from "./StoreEmulatorCard";
|
|||
import { FOCUS_KEYS } from "@/mainview/scripts/types";
|
||||
import Carousel from "../Carousel";
|
||||
import { useRouter } from "@tanstack/react-router";
|
||||
import { FrontEndEmulator } from "@/shared/types";
|
||||
|
||||
function SeeAllCard (data: { id: string; onAction: () => void; onFocus?: (details: { node: HTMLElement, instant?: boolean; }) => void; })
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import FrontEndGameCard from "../FrontEndGameCard";
|
|||
import { FOCUS_KEYS } from "@/mainview/scripts/types";
|
||||
import Carousel from "../Carousel";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
import { FrontEndGameType, FrontEndId } from "@/shared/types";
|
||||
|
||||
export function GamesSection (data: {
|
||||
games?: FrontEndGameType[];
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import { GamePadButtonCode, useShortcuts } from "@/mainview/scripts/shortcuts";
|
|||
import { RPC_URL } from "@/shared/constants";
|
||||
import { FOCUS_KEYS } from "@/mainview/scripts/types";
|
||||
import { oneShot } from "@/mainview/scripts/audio/audio";
|
||||
import { FrontEndEmulator } from "@/shared/types";
|
||||
|
||||
// ── Single missing-emulator card ───────────────────────────────────────────
|
||||
interface MissingCardProps
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import { JSX } from "react";
|
|||
import { oneShot } from "@/mainview/scripts/audio/audio";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { getUpdateInfoForEmulator } from "@/mainview/scripts/queries/store";
|
||||
import { FrontEndEmulator } from "@/shared/types";
|
||||
|
||||
export const emulatorStatusIcons: Record<string, JSX.Element> = {
|
||||
store: <Store />,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue