More 516 fixes and TGUI improvements (#26617)

* more 516 fixes and tweaks

* cleaned build output

---------

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
This commit is contained in:
Sean
2024-09-16 14:37:09 +00:00
committed by GitHub
co-authored by Burzah
parent a0c7867581
commit 98912fcea9
13 changed files with 1050 additions and 1000 deletions
+1 -1
View File
@@ -269,7 +269,7 @@
/client/New(TopicData)
// TODO: Remove with 516
if(byond_version >= 516) // Enable 516 compat browser storage mechanisms
winset(src, "", "browser-options=byondstorage")
winset(src, "", "browser-options=byondstorage,find")
var/tdata = TopicData //save this for later use
// Instantiate stat panel
@@ -34,6 +34,8 @@
// Force show the panel to see if there are any errors
winset(src, "output", "is-disabled=1&is-visible=0")
winset(src, "chat_panel", "is-disabled=0;is-visible=1")
if(byond_version >= 516)
winset(src, null, "browser-options=byondstorage,find")
/client/verb/refresh_tgui()
set name = "Refresh TGUI"
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -21,4 +21,4 @@ pnpEnableEsmLoader: false
preferInteractive: true
yarnPath: .yarn/releases/yarn-4.3.1.cjs
yarnPath: .yarn/releases/yarn-4.4.1.cjs
+1 -1
View File
@@ -2,7 +2,7 @@
"private": true,
"name": "tgui-workspace",
"version": "4.5.1-paradise",
"packageManager": "yarn@4.3.1",
"packageManager": "yarn@4.4.1",
"workspaces": [
"packages/*"
],
+17 -1
View File
@@ -25,7 +25,8 @@ export enum KEY {
Down = 'Down',
End = 'End',
Enter = 'Enter',
Escape = 'Esc',
Esc = 'Esc',
Escape = 'Escape',
Home = 'Home',
Insert = 'Insert',
Left = 'Left',
@@ -37,3 +38,18 @@ export enum KEY {
Tab = 'Tab',
Up = 'Up',
}
/**
* ### isEscape
*
* Checks if the user has hit the 'ESC' key on their keyboard.
* There's a weirdness in BYOND where this could be either the string
* 'Escape' or 'Esc' depending on the browser. This function handles
* both cases.
*
* @param key - the key to check, typically from event.key
* @returns true if key is Escape or Esc, false otherwise
*/
export const isEscape = (key: string): boolean => {
return key === KEY.Esc || key === KEY.Escape;
};
+3 -3
View File
@@ -69,15 +69,15 @@ class HubStorageBackend {
}
}
async set(key, value) {
set(key, value) {
window.hubStorage.setItem('paradise-' + key, JSON.stringify(value));
}
async remove(key) {
remove(key) {
window.hubStorage.removeItem('paradise-' + key);
}
async clear() {
clear() {
window.hubStorage.clear();
}
}
+5 -4
View File
@@ -6,7 +6,7 @@ import { byondMessages } from './timers';
import { dragStartHandler } from 'tgui/drag';
import { windowOpen, windowClose, windowSet } from './helpers';
import { BooleanLike } from 'common/react';
import { KEY } from 'common/keys';
import { isEscape, KEY } from 'common/keys';
type ByondOpen = {
channel: Channel;
@@ -258,9 +258,10 @@ export class TguiSay extends Component<{}, State> {
this.handleIncrementChannel();
break;
case KEY.Escape:
this.handleClose();
break;
default:
if (isEscape(event.key)) {
this.handleClose();
}
}
}
@@ -1,4 +1,4 @@
import { KEY } from 'common/keys';
import { isEscape, KEY } from 'common/keys';
import { useBackend, useLocalState } from '../backend';
import { Autofocus, Box, Button, Section, Stack } from '../components';
@@ -77,7 +77,7 @@ export const KeyComboModal = (props, context) => {
if (event.key === KEY.Enter) {
act('submit', { entry: input });
}
if (event.key === KEY.Escape) {
if (isEscape(event.key)) {
act('cancel');
}
return;
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long