mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 07:37:19 +02:00
Add BxIconRaw tyoe
This commit is contained in:
parent
03b7c7358e
commit
fc5219705c
2
dist/better-xcloud.lite.user.js
vendored
2
dist/better-xcloud.lite.user.js
vendored
@ -787,7 +787,7 @@ function createElement(elmName, props, ..._) {
|
|||||||
}
|
}
|
||||||
var domParser = new DOMParser;
|
var domParser = new DOMParser;
|
||||||
function createSvgIcon(icon) {
|
function createSvgIcon(icon) {
|
||||||
return domParser.parseFromString(icon.toString(), "image/svg+xml").documentElement;
|
return domParser.parseFromString(icon, "image/svg+xml").documentElement;
|
||||||
}
|
}
|
||||||
var ButtonStyleIndices = Object.keys(ButtonStyleClass).map((i) => parseInt(i));
|
var ButtonStyleIndices = Object.keys(ButtonStyleClass).map((i) => parseInt(i));
|
||||||
function createButton(options) {
|
function createButton(options) {
|
||||||
|
2
dist/better-xcloud.user.js
vendored
2
dist/better-xcloud.user.js
vendored
@ -819,7 +819,7 @@ function createElement(elmName, props, ..._) {
|
|||||||
}
|
}
|
||||||
var domParser = new DOMParser;
|
var domParser = new DOMParser;
|
||||||
function createSvgIcon(icon) {
|
function createSvgIcon(icon) {
|
||||||
return domParser.parseFromString(icon.toString(), "image/svg+xml").documentElement;
|
return domParser.parseFromString(icon, "image/svg+xml").documentElement;
|
||||||
}
|
}
|
||||||
var ButtonStyleIndices = Object.keys(ButtonStyleClass).map((i) => parseInt(i));
|
var ButtonStyleIndices = Object.keys(ButtonStyleClass).map((i) => parseInt(i));
|
||||||
function createButton(options) {
|
function createButton(options) {
|
||||||
|
@ -5,7 +5,7 @@ import { BxEvent } from "@utils/bx-event";
|
|||||||
import { CE, createSvgIcon, humanFileSize } from "@utils/html";
|
import { CE, createSvgIcon, humanFileSize } from "@utils/html";
|
||||||
import { STATES } from "@utils/global";
|
import { STATES } from "@utils/global";
|
||||||
import { BxLogger } from "@/utils/bx-logger";
|
import { BxLogger } from "@/utils/bx-logger";
|
||||||
import { BxIcon } from "@/utils/bx-icon";
|
import { BxIcon, type BxIconRaw } from "@/utils/bx-icon";
|
||||||
import { GuideMenuTab } from "../ui/guide-menu";
|
import { GuideMenuTab } from "../ui/guide-menu";
|
||||||
import { StreamStatsCollector } from "@/utils/stream-stats-collector";
|
import { StreamStatsCollector } from "@/utils/stream-stats-collector";
|
||||||
import { StreamStat } from "@/enums/pref-values";
|
import { StreamStat } from "@/enums/pref-values";
|
||||||
@ -14,7 +14,7 @@ import { StreamStat } from "@/enums/pref-values";
|
|||||||
type StreamBadgeInfo = {
|
type StreamBadgeInfo = {
|
||||||
name: string,
|
name: string,
|
||||||
$element?: HTMLElement,
|
$element?: HTMLElement,
|
||||||
icon: typeof BxIcon,
|
icon: BxIconRaw,
|
||||||
color: string,
|
color: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { STATES } from "@utils/global.ts";
|
import { STATES } from "@utils/global.ts";
|
||||||
import { createSvgIcon } from "@utils/html.ts";
|
import { createSvgIcon } from "@utils/html.ts";
|
||||||
import { BxIcon } from "@utils/bx-icon";
|
import { BxIcon, type BxIconRaw } from "@utils/bx-icon";
|
||||||
import { t } from "@utils/translation.ts";
|
import { t } from "@utils/translation.ts";
|
||||||
import { StreamBadges } from "./stream-badges.ts";
|
import { StreamBadges } from "./stream-badges.ts";
|
||||||
import { StreamStats } from "./stream-stats.ts";
|
import { StreamStats } from "./stream-stats.ts";
|
||||||
@ -15,7 +15,7 @@ export class StreamUiHandler {
|
|||||||
private static $btnHome: HTMLElement | null | undefined;
|
private static $btnHome: HTMLElement | null | undefined;
|
||||||
private static observer: MutationObserver | undefined;
|
private static observer: MutationObserver | undefined;
|
||||||
|
|
||||||
private static cloneStreamHudButton($btnOrg: HTMLElement, label: string, svgIcon: typeof BxIcon): HTMLElement | null {
|
private static cloneStreamHudButton($btnOrg: HTMLElement, label: string, svgIcon: BxIconRaw): HTMLElement | null {
|
||||||
if (!$btnOrg) {
|
if (!$btnOrg) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ export class StreamUiHandler {
|
|||||||
return $container;
|
return $container;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static cloneCloseButton($btnOrg: HTMLElement, icon: typeof BxIcon, className: string, onChange: any): HTMLElement | null {
|
private static cloneCloseButton($btnOrg: HTMLElement, icon: BxIconRaw, className: string, onChange: any): HTMLElement | null {
|
||||||
if (!$btnOrg) {
|
if (!$btnOrg) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import { SoundShortcut } from "@/modules/shortcuts/sound-shortcut";
|
|||||||
import { StreamStats } from "@/modules/stream/stream-stats";
|
import { StreamStats } from "@/modules/stream/stream-stats";
|
||||||
import { TouchController } from "@/modules/touch-controller";
|
import { TouchController } from "@/modules/touch-controller";
|
||||||
import { BxEvent } from "@/utils/bx-event";
|
import { BxEvent } from "@/utils/bx-event";
|
||||||
import { BxIcon } from "@/utils/bx-icon";
|
import { BxIcon, type BxIconRaw } from "@/utils/bx-icon";
|
||||||
import { STATES, AppInterface, deepClone, SCRIPT_VERSION, STORAGE, SCRIPT_VARIANT } from "@/utils/global";
|
import { STATES, AppInterface, deepClone, SCRIPT_VERSION, STORAGE, SCRIPT_VARIANT } from "@/utils/global";
|
||||||
import { t, Translations } from "@/utils/translation";
|
import { t, Translations } from "@/utils/translation";
|
||||||
import { BxSelectElement } from "@/web-components/bx-select";
|
import { BxSelectElement } from "@/web-components/bx-select";
|
||||||
@ -65,7 +65,7 @@ type SettingTabSection = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type SettingTab = {
|
type SettingTab = {
|
||||||
icon: SVGElement;
|
icon: BxIconRaw;
|
||||||
group: SettingTabGroup,
|
group: SettingTabGroup,
|
||||||
items: Array<SettingTabSection | HTMLElement | false> | (() => Array<SettingTabSection | false>);
|
items: Array<SettingTabSection | HTMLElement | false> | (() => Array<SettingTabSection | false>);
|
||||||
requiredVariants?: BuildVariant | Array<BuildVariant>;
|
requiredVariants?: BuildVariant | Array<BuildVariant>;
|
||||||
|
25
src/types/index.d.ts
vendored
25
src/types/index.d.ts
vendored
@ -101,12 +101,27 @@ type XcloudWaitTimeInfo = Partial<{
|
|||||||
estimatedTotalWaitTimeInSeconds: number,
|
estimatedTotalWaitTimeInSeconds: number,
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
declare module '*.js';
|
declare module '*.js' {
|
||||||
declare module '*.svg';
|
const content: string;
|
||||||
declare module '*.styl';
|
export default content;
|
||||||
|
}
|
||||||
|
declare module '*.svg' {
|
||||||
|
const content: string;
|
||||||
|
export default content;
|
||||||
|
}
|
||||||
|
declare module '*.styl' {
|
||||||
|
const content: string;
|
||||||
|
export default content;
|
||||||
|
}
|
||||||
|
|
||||||
declare module '*.fs';
|
declare module '*.fs' {
|
||||||
declare module '*.vert';
|
const content: string;
|
||||||
|
export default content;
|
||||||
|
}
|
||||||
|
declare module '*.vert' {
|
||||||
|
const content: string;
|
||||||
|
export default content;
|
||||||
|
}
|
||||||
|
|
||||||
type MkbMouseMove = {
|
type MkbMouseMove = {
|
||||||
movementX: number;
|
movementX: number;
|
||||||
|
@ -83,3 +83,5 @@ export const BxIcon = {
|
|||||||
UPLOAD: iconUpload,
|
UPLOAD: iconUpload,
|
||||||
AUDIO: iconSpeakerHigh,
|
AUDIO: iconSpeakerHigh,
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
export type BxIconRaw = (typeof BxIcon)[keyof typeof BxIcon];
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type { BxIcon } from "@utils/bx-icon";
|
import type { BxIconRaw } from "@utils/bx-icon";
|
||||||
import { setNearby } from "./navigation-utils";
|
import { setNearby } from "./navigation-utils";
|
||||||
import type { NavigationNearbyElements } from "@/modules/ui/dialog/navigation-dialog";
|
import type { NavigationNearbyElements } from "@/modules/ui/dialog/navigation-dialog";
|
||||||
import type { PresetRecord, AllPresets } from "@/types/presets";
|
import type { PresetRecord, AllPresets } from "@/types/presets";
|
||||||
@ -43,7 +43,7 @@ export type BxButtonOptions = Partial<{
|
|||||||
style: ButtonStyle;
|
style: ButtonStyle;
|
||||||
url: string;
|
url: string;
|
||||||
classes: string[];
|
classes: string[];
|
||||||
icon: typeof BxIcon;
|
icon: BxIconRaw;
|
||||||
label: string;
|
label: string;
|
||||||
secondaryText: HTMLElement | string;
|
secondaryText: HTMLElement | string;
|
||||||
title: string;
|
title: string;
|
||||||
@ -149,8 +149,8 @@ function createElement<T extends keyof HTMLElementTagNameMap>(elmName: T, props?
|
|||||||
|
|
||||||
|
|
||||||
const domParser = new DOMParser();
|
const domParser = new DOMParser();
|
||||||
export function createSvgIcon(icon: typeof BxIcon) {
|
export function createSvgIcon(icon: BxIconRaw) {
|
||||||
return domParser.parseFromString(icon.toString(), 'image/svg+xml').documentElement;
|
return domParser.parseFromString(icon, 'image/svg+xml').documentElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ButtonStyleIndices = Object.keys(ButtonStyleClass).map(i => parseInt(i));
|
const ButtonStyleIndices = Object.keys(ButtonStyleClass).map(i => parseInt(i));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user