Upgrades and tweaks

This commit is contained in:
Dustin Brett 2023-05-09 19:31:05 -07:00
parent d11334b918
commit 6658969b50
14 changed files with 1305 additions and 402 deletions

View File

@ -149,7 +149,9 @@
"unicorn/no-array-reduce": "off",
"unicorn/no-await-expression-member": "off",
"unicorn/numeric-separators-style": "off",
"unicorn/prefer-at": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/prefer-string-replace-all": "off",
"unicorn/prevent-abbreviations": "off",
"unicorn/switch-case-braces": ["error", "avoid"],
"unused-imports/no-unused-imports": "error",

View File

@ -2,10 +2,7 @@ import useFileDrop from "components/system/Files/FileManager/useFileDrop";
import { useProcesses } from "contexts/process";
import dynamic from "next/dynamic";
import { useMemo, useRef, useState } from "react";
import type {
DefaultTheme,
StyledComponent as StyledComponentType,
} from "styled-components";
import type { IStyledComponent } from "styled-components";
const StyledLoading = dynamic(
() => import("components/system/Files/FileManager/StyledLoading")
@ -20,7 +17,13 @@ type ContainerHook = (
) => void;
type AppContainerProps = {
StyledComponent: StyledComponentType<"div", DefaultTheme>;
StyledComponent: IStyledComponent<
"web",
"div",
React.ClassAttributes<HTMLDivElement> &
React.HTMLAttributes<HTMLDivElement> &
object
>;
id: string;
useHook: ContainerHook;
};

View File

@ -47,7 +47,7 @@ const StyledInputArea = styled.div<StyledInputAreaProps>`
resize: none;
width: 100%;
::placeholder {
&::placeholder {
color: rgba(200, 200, 200, 75%);
}
}

View File

@ -17,7 +17,7 @@ const StyledVideoPlayer = styled.div`
background-color: rgb(240, 240, 240);
padding: 0 1;
:not(.no-interaction) {
&:not(.no-interaction) {
display: flex !important;
opacity: 100% !important;
}

View File

@ -311,7 +311,7 @@ const useWallpaper = (
video.style.objectPosition = "center center";
video.style.zIndex = "-1";
desktopRef.current?.appendChild(video);
desktopRef.current?.append(video);
} else {
const applyWallpaper = (url: string): void => {
const repeat = newWallpaperFit === "tile" ? "repeat" : "no-repeat";

View File

@ -85,6 +85,7 @@ const Transfer: FC<ComponentProcessProps> = ({ id }) => {
},
ONE_TIME_PASSIVE_EVENT
);
// eslint-disable-next-line unicorn/prefer-blob-reading-methods
reader.readAsArrayBuffer(file);
},
[completeTransfer]

View File

@ -2,7 +2,7 @@ import styled from "styled-components";
import { MAX_FILE_NAME_LENGTH } from "utils/constants";
const StyledRenameBox = styled.textarea.attrs({
autocomplete: "off",
autoComplete: "off",
enterKeyHint: "done",
maxLength: MAX_FILE_NAME_LENGTH,
rows: 1,

View File

@ -2,7 +2,6 @@ import StyledIconFileEntry from "components/system/Files/Views/Icon/StyledFileEn
import StyledIconFileManager from "components/system/Files/Views/Icon/StyledFileManager";
import StyledListFileEntry from "components/system/Files/Views/List/StyledFileEntry";
import StyledListFileManager from "components/system/Files/Views/List/StyledFileManager";
import type { DefaultTheme, StyledComponent } from "styled-components";
import type { IconProps } from "styles/common/Icon";
export type StyledFileEntryProps = {
@ -16,12 +15,10 @@ export type StyledFileManagerProps = {
};
type FileManagerView = {
StyledFileEntry: StyledComponent<"li", DefaultTheme, StyledFileEntryProps>;
StyledFileManager: StyledComponent<
"ol",
DefaultTheme,
StyledFileManagerProps
>;
StyledFileEntry: typeof StyledIconFileEntry | typeof StyledListFileEntry;
StyledFileManager:
| typeof StyledIconFileManager
| typeof StyledListFileManager;
};
export type FileManagerViewNames = "icon" | "list";

View File

@ -45,8 +45,8 @@ const Titlebar: FC<TitlebarProps> = ({ id }) => {
const touchStartTimeRef = useRef<number>(0);
const touchStartPositionRef = useRef<DOMRect>();
const touchesRef = useRef<TouchList>();
const onTouchEnd = useCallback(
(event: React.TouchEvent<HTMLHeadingElement>) => {
const onTouchEnd = useCallback<React.TouchEventHandler<HTMLButtonElement>>(
(event) => {
const { x, y } = componentWindow?.getBoundingClientRect() || {};
if (
@ -64,8 +64,8 @@ const Titlebar: FC<TitlebarProps> = ({ id }) => {
},
[componentWindow, titlebarContextMenu]
);
const onTouchStart = useCallback(
({ touches }: React.TouchEvent<HTMLHeadingElement>) => {
const onTouchStart = useCallback<React.TouchEventHandler<HTMLButtonElement>>(
({ touches }) => {
if (componentWindow) {
componentWindow.blur();
componentWindow.focus(PREVENT_SCROLL);

View File

@ -39,11 +39,8 @@
"*.{ts,tsx}": "stylelint --fix",
"*.{js,ts,tsx}": "eslint --fix"
},
"resolutions": {
"styled-components": "^5"
},
"dependencies": {
"@monaco-editor/react": "^4.5.0",
"@monaco-editor/react": "^4.5.1",
"@panzoom/panzoom": "^4.5.1",
"@prettier/plugin-xml": "^2.2.0",
"@wasmer/wasm-terminal": "^0.12.0",
@ -54,7 +51,7 @@
"fflate": "^0.7.4",
"file-type": "^18.3.0",
"fix-webm-duration": "^1.0.5",
"framer-motion": "^10.12.5",
"framer-motion": "^10.12.9",
"gif.js": "^0.2.0",
"idb": "^7.1.1",
"ini": "^4.1.0",
@ -62,7 +59,7 @@
"minimist": "^1.2.8",
"multiformats": "^11.0.2",
"music-metadata-browser": "^2.5.10",
"next": "^13.3.4",
"next": "^13.4.1",
"opentype.js": "^1.3.4",
"playlist-parser": "^0.0.12",
"prettier": "^2.8.8",
@ -72,34 +69,34 @@
"react-rnd": "^10.4.1",
"resedit": "^2.0.0",
"rtf.js": "^3.0.9",
"styled-components": "^5.3.10",
"styled-components": "^6.0.0-rc.1",
"utif": "https://github.com/photopea/UTIF.js",
"wasi-js": "^1.7.3"
},
"devDependencies": {
"7z-wasm": "^1.0.2",
"@next/bundle-analyzer": "^13.3.4",
"@next/eslint-plugin-next": "^13.3.4",
"@next/bundle-analyzer": "^13.4.1",
"@next/eslint-plugin-next": "^13.4.1",
"@types/gif.js": "^0.2.2",
"@types/ini": "^1.3.31",
"@types/jest": "^29.5.1",
"@types/lunr": "^2.3.4",
"@types/node": "^18.16.3",
"@types/node": "^20.1.1",
"@types/offscreencanvas": "^2019.7.0",
"@types/opentype.js": "^1.3.4",
"@types/react": "^18.2.0",
"@types/react": "^18.2.6",
"@types/styled-components": "^5.1.26",
"@types/ua-parser-js": "^0.7.36",
"@types/video.js": "^7.3.51",
"@types/wicg-file-system-access": "^2020.9.6",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",
"@typescript-eslint/eslint-plugin": "^5.59.5",
"@typescript-eslint/parser": "^5.59.5",
"emulators": "^0.73.8",
"emulators-ui": "^0.73.9",
"eruda": "^3.0.0",
"eslint": "^8.39.0",
"eslint": "^8.40.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-next": "^13.3.4",
"eslint-config-next": "^13.4.1",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.1",
@ -109,7 +106,7 @@
"eslint-plugin-sonarjs": "^0.19.0",
"eslint-plugin-sort-keys-fix": "^1.1.2",
"eslint-plugin-typescript-sort-keys": "^2.3.0",
"eslint-plugin-unicorn": "^46.0.0",
"eslint-plugin-unicorn": "^47.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
"html-minifier-terser": "^7.2.0",
"html-to-image": "^1.11.11",
@ -118,14 +115,14 @@
"jest-environment-jsdom": "^29.5.0",
"lint-staged": "^13.2.2",
"lunr": "^2.3.9",
"monaco-editor": "^0.37.1",
"pdfjs-dist": "^3.5.141",
"monaco-editor": "^0.38.0",
"pdfjs-dist": "^3.6.172",
"postcss-styled-syntax": "^0.4.0",
"postcss-syntax": "^0.36.2",
"stylelint": "^15.6.0",
"stylelint": "^15.6.1",
"stylelint-config-standard": "^33.0.0",
"stylelint-order": "^6.0.3",
"terser": "^5.17.1",
"terser": "^5.17.3",
"tinymce": "^6.4.2",
"ts-prune": "^0.10.3",
"typescript": "^5.0.4",

View File

@ -17,19 +17,16 @@ type StyledIconProps = Pick<IconProps, "$eager" | "$moving"> & {
$width: number;
};
const StyledIcon = styled.img
.withConfig({
shouldForwardProp: (prop, defaultValidatorFn) =>
["fetchpriority"].includes(prop) || defaultValidatorFn(prop),
})
.attrs<StyledIconProps>(({ $eager = false, $height, $width }) => ({
const StyledIcon = styled.img.attrs<StyledIconProps>(
({ $eager = false, $height, $width }) => ({
decoding: "async",
draggable: false,
fetchpriority: $eager ? "high" : undefined,
height: $height,
loading: $eager ? "eager" : "lazy",
width: $width,
}))<StyledIconProps>`
})
)<StyledIconProps>`
aspect-ratio: 1;
left: ${({ $offset }) => $offset || undefined};
max-height: ${({ $height }) => $height}px;
@ -37,7 +34,7 @@ const StyledIcon = styled.img
min-height: ${({ $height }) => $height}px;
min-width: ${({ $width }) => $width}px;
object-fit: contain;
opacity: ${({ $moving }) => ($moving ? 0.5 : 1)};
opacity: ${({ $moving }) => ($moving ? "50%" : "100%")};
top: ${({ $offset }) => $offset || undefined};
visibility: ${({ $loaded }) => ($loaded ? "visible" : "hidden")};
`;

View File

@ -1,4 +1,4 @@
import type { FlattenSimpleInterpolation } from "styled-components";
import type { RuleSet } from "styled-components";
import { css } from "styled-components";
import { DOWN, LEFT, RIGHT, UP } from "styles/ArrowIcons";
@ -37,7 +37,7 @@ const ScrollBars = (
verticalX = 0,
verticalY = 0,
scheme: ColorSchemes = "dark"
): FlattenSimpleInterpolation => css`
): RuleSet<object> => css`
overflow: auto;
scrollbar-color: ${colorScheme[scheme].thumb} ${colorScheme[scheme].track};
scrollbar-gutter: stable;

View File

@ -11,4 +11,5 @@ declare module "styled-components" {
name: string;
sizes: typeof sizes;
}
export function useTheme(): DefaultTheme;
}

1609
yarn.lock

File diff suppressed because it is too large Load Diff