mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2025-10-30 14:17:55 +00:00
remove icon special cases
This commit is contained in:
@@ -140,7 +140,7 @@ export interface Config {
|
||||
}
|
||||
|
||||
export const defaultConfig = (): Config => ({
|
||||
configVersion: 22,
|
||||
configVersion: 17,
|
||||
overlayKey: "Shift + Space",
|
||||
overlayBackground: "rgba(129, 139, 149, 0.15)",
|
||||
overlayBackgroundClose: true,
|
||||
@@ -512,6 +512,27 @@ function upgradeConfig(_config: Config): Config {
|
||||
}
|
||||
}
|
||||
|
||||
if (config.configVersion < 17) {
|
||||
for (const widget of config.widgets) {
|
||||
for (let i = 0; i < widget.wmFlags.length; ++i) {
|
||||
if (widget.wmFlags[i] === "skip-menu") {
|
||||
widget.wmFlags[i] = "menu::skip";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const itemSearch = config.widgets.find(
|
||||
(w) => w.wmType === "item-search",
|
||||
) as widget.Widget;
|
||||
itemSearch.wmTitle = "{icon=fa-search}";
|
||||
const settings = config.widgets.find(
|
||||
(w) => w.wmType === "settings",
|
||||
) as widget.Widget;
|
||||
settings.wmTitle = "{icon=fa-cog}";
|
||||
|
||||
config.configVersion = 17;
|
||||
}
|
||||
|
||||
return config as unknown as Config;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ export default {
|
||||
wmTitle: "",
|
||||
wmWants: "hide",
|
||||
wmZorder: "exclusive",
|
||||
wmFlags: ["hide-on-blur", "skip-menu"],
|
||||
wmFlags: ["hide-on-blur", "menu::skip"],
|
||||
hotkey: null,
|
||||
wikiKey: null,
|
||||
poedbKey: null,
|
||||
|
||||
@@ -140,7 +140,7 @@ export default {
|
||||
return {
|
||||
wmId: 0,
|
||||
wmType: "item-search",
|
||||
wmTitle: "",
|
||||
wmTitle: "{icon=fa-search}",
|
||||
wmWants: "hide",
|
||||
wmZorder: null,
|
||||
wmFlags: ["invisible-on-blur"],
|
||||
|
||||
@@ -43,7 +43,7 @@ export default {
|
||||
wmTitle: '',
|
||||
wmWants: 'hide',
|
||||
wmZorder: null,
|
||||
wmFlags: ['hide-on-focus', 'skip-menu'],
|
||||
wmFlags: ['hide-on-focus', 'menu::skip'],
|
||||
toggleKey: null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"
|
||||
class="bg-gray-800 rounded text-gray-100 p-2 leading-none whitespace-nowrap border"
|
||||
>
|
||||
<<<<<<< HEAD
|
||||
<i
|
||||
v-if="widget.wmType === 'settings'"
|
||||
class="fas fa-cog align-bottom"
|
||||
@@ -28,6 +29,14 @@
|
||||
<template v-else>{{
|
||||
widget.wmTitle || `#${widget.wmId}`
|
||||
}}</template>
|
||||
=======
|
||||
<i
|
||||
v-if="widget.icon"
|
||||
class="fas align-bottom"
|
||||
:class="widget.icon"
|
||||
/>
|
||||
<template v-if="widget.title">{{ widget.title }}</template>
|
||||
>>>>>>> e6936f6 (remove icon special cases)
|
||||
</button>
|
||||
</template>
|
||||
<ui-popover>
|
||||
@@ -99,7 +108,7 @@ export default defineComponent({
|
||||
wmTitle: "",
|
||||
wmWants: "show",
|
||||
wmZorder: 1,
|
||||
wmFlags: ["invisible-on-blur", "skip-menu"],
|
||||
wmFlags: ["invisible-on-blur", "menu::skip"],
|
||||
anchor: {
|
||||
pos: "tl",
|
||||
x: 5,
|
||||
@@ -123,11 +132,25 @@ export default defineComponent({
|
||||
return [
|
||||
wm.widgets.value.find((widget) => widget.wmType === "settings")!,
|
||||
...wm.widgets.value.filter((widget) => widget.wmType !== "settings"),
|
||||
].filter(
|
||||
(widget) =>
|
||||
!widget.wmFlags.includes("skip-menu") &&
|
||||
(props.config.alwaysShow || widget.wmWants === "hide"),
|
||||
);
|
||||
]
|
||||
.filter(
|
||||
(widget) =>
|
||||
!widget.wmFlags.includes("menu::skip") &&
|
||||
(props.config.alwaysShow || widget.wmWants === "hide"),
|
||||
)
|
||||
.map((widget) => {
|
||||
const regexMatch = widget.wmTitle.match(
|
||||
/^(?:\{icon=(?<icon>[^}]+)\}\s*)?(?<title>.*)$/,
|
||||
);
|
||||
return {
|
||||
wmId: widget.wmId,
|
||||
wmWants: widget.wmWants,
|
||||
title:
|
||||
regexMatch?.groups!.title ||
|
||||
(!regexMatch?.groups!.icon ? `#${widget.wmId}` : undefined),
|
||||
icon: regexMatch?.groups!.icon,
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
const { t } = useI18nNs("widget_menu");
|
||||
@@ -143,7 +166,7 @@ export default defineComponent({
|
||||
createOfType(type: string) {
|
||||
wm.create(type);
|
||||
},
|
||||
toggle(widget: IWidget) {
|
||||
toggle(widget: Pick<IWidget, "wmId" | "wmWants">) {
|
||||
if (widget.wmWants === "hide") {
|
||||
wm.show(widget.wmId);
|
||||
} else {
|
||||
|
||||
@@ -20,12 +20,14 @@ export const registry = {
|
||||
}
|
||||
}
|
||||
|
||||
// Core
|
||||
registry.widgets.push(WidgetMenu as unknown as WidgetComponent)
|
||||
registry.widgets.push(WidgetSettings as unknown as WidgetComponent)
|
||||
// Extra
|
||||
registry.widgets.push(WidgetItemSearch as unknown as WidgetComponent)
|
||||
registry.widgets.push(WidgetTimer as unknown as WidgetComponent)
|
||||
registry.widgets.push(WidgetStashSearch as unknown as WidgetComponent)
|
||||
registry.widgets.push(PriceCheckWindow as unknown as WidgetComponent)
|
||||
registry.widgets.push(WidgetItemCheck as unknown as WidgetComponent)
|
||||
registry.widgets.push(WidgetImageStrip as unknown as WidgetComponent)
|
||||
registry.widgets.push(WidgetDelveGrid as unknown as WidgetComponent)
|
||||
registry.widgets.push(WidgetItemSearch as unknown as WidgetComponent)
|
||||
registry.widgets.push(WidgetSettings as unknown as WidgetComponent)
|
||||
|
||||
@@ -8,16 +8,16 @@ export interface Widget {
|
||||
}
|
||||
|
||||
export interface WidgetSpec {
|
||||
type: string
|
||||
instances: 'single' | 'multi'
|
||||
trNameKey?: string
|
||||
initInstance?: () => Widget
|
||||
defaultInstances?: () => Widget[]
|
||||
type: string;
|
||||
instances: "single" | "multi";
|
||||
trNameKey?: string;
|
||||
initInstance?: () => Widget;
|
||||
defaultInstances?: () => Widget[];
|
||||
}
|
||||
|
||||
export type WellKnownFlag =
|
||||
| "uninitialized"
|
||||
| "skip-menu"
|
||||
| "menu::skip"
|
||||
| "has-browser"
|
||||
| "invisible-on-blur"
|
||||
| "hide-on-blur"
|
||||
|
||||
@@ -170,7 +170,7 @@ export default defineComponent({
|
||||
wmTitle: "",
|
||||
wmWants: "hide",
|
||||
wmZorder: "exclusive",
|
||||
wmFlags: ["hide-on-blur", "skip-menu"],
|
||||
wmFlags: ["hide-on-blur", "menu::skip"],
|
||||
showRateLimitState: false,
|
||||
apiLatencySeconds: 2,
|
||||
collapseListings: "api",
|
||||
@@ -218,7 +218,7 @@ export default defineComponent({
|
||||
|
||||
nextTick(() => {
|
||||
props.config.wmWants = "hide";
|
||||
props.config.wmFlags = ["hide-on-blur", "skip-menu"];
|
||||
props.config.wmFlags = ["hide-on-blur", "menu::skip"];
|
||||
});
|
||||
|
||||
const item = shallowRef<null | Result<ParsedItem, ParseError>>(null);
|
||||
|
||||
@@ -172,7 +172,7 @@ export default defineComponent({
|
||||
return {
|
||||
wmId: 0,
|
||||
wmType: "settings",
|
||||
wmTitle: "",
|
||||
wmTitle: "{icon=fa-cog}",
|
||||
wmWants: "hide",
|
||||
wmZorder: "exclusive",
|
||||
wmFlags: ["invisible-on-blur", "ignore-ui-visibility"],
|
||||
|
||||
Reference in New Issue
Block a user