diff --git a/packages/dium/src/components/icon.ts b/packages/dium/src/components/icon.ts new file mode 100644 index 00000000..c5740383 --- /dev/null +++ b/packages/dium/src/components/icon.ts @@ -0,0 +1,4 @@ +import {Finder} from "../api"; + +// chevron small down icon +export const IconArrow = /* @__PURE__ */ Finder.bySource(["d:\"M5.29289 9"], {entries: true}); diff --git a/packages/dium/src/components/index.ts b/packages/dium/src/components/index.ts index 9762193e..fd94f37b 100644 --- a/packages/dium/src/components/index.ts +++ b/packages/dium/src/components/index.ts @@ -5,6 +5,7 @@ export * from "./embed"; export * from "./flex"; export * from "./form"; export * from "./guild"; +export * from "./icon"; export * from "./link"; export * from "./margins"; export * from "./menu"; diff --git a/packages/dium/src/components/input.ts b/packages/dium/src/components/input.ts index 794af176..fe385ba3 100644 --- a/packages/dium/src/components/input.ts +++ b/packages/dium/src/components/input.ts @@ -1,3 +1,4 @@ +import {Finder} from "../api"; import {Common} from "./common"; export const enum TextInputSizes { @@ -48,3 +49,7 @@ interface InputComponents { } export const {TextInput, InputError} = Common as InputComponents; + +export const ImageInput: React.ComponentClass = /* @__PURE__ */ Finder.find( + (target) => typeof target.defaultProps?.multiple === "boolean" && typeof target.defaultProps?.maxFileSizeBytes === "number" +); diff --git a/packages/dium/src/modules/index.ts b/packages/dium/src/modules/index.ts index 48aba11e..789abf6f 100644 --- a/packages/dium/src/modules/index.ts +++ b/packages/dium/src/modules/index.ts @@ -11,5 +11,6 @@ export * from "./npm"; export * from "./popout-window"; export * from "./router"; export * from "./user"; +export * from "./util"; export type Untyped = T & Record; diff --git a/packages/dium/src/modules/util.ts b/packages/dium/src/modules/util.ts new file mode 100644 index 00000000..9227f2a6 --- /dev/null +++ b/packages/dium/src/modules/util.ts @@ -0,0 +1,11 @@ +import {Filters, Finder} from "../api"; + +export interface AudioConvert { + amplitudeToPerceptual(amplitude: number): number; + perceptualToAmplitude(perceptual: number): number; +} + +export const AudioConvert: AudioConvert = /* @__PURE__ */ Finder.demangle({ + amplitudeToPerceptual: Filters.bySource("Math.log10"), + perceptualToAmplitude: Filters.bySource("Math.pow(10") +}); diff --git a/src/BetterFolders/uploader.tsx b/src/BetterFolders/uploader.tsx index 916600fd..47b5a154 100644 --- a/src/BetterFolders/uploader.tsx +++ b/src/BetterFolders/uploader.tsx @@ -1,13 +1,9 @@ -import {Finder, React} from "dium"; +import {React} from "dium"; import {GuildsTreeFolder} from "@dium/modules"; -import {Flex, Button, FormSwitch, FormText, margins} from "@dium/components"; +import {Flex, Button, FormSwitch, FormText, ImageInput, margins} from "@dium/components"; import {FolderData} from "./settings"; import {BetterFolderIcon} from "./icon"; -const ImageInput: React.ComponentClass = Finder.find( - (target) => typeof target.defaultProps?.multiple === "boolean" && typeof target.defaultProps?.maxFileSizeBytes === "number" -); - export interface BetterFolderUploaderProps extends FolderData { folderNode: GuildsTreeFolder; onChange(data: FolderData): void; diff --git a/src/BetterVolume/index.tsx b/src/BetterVolume/index.tsx index 23b2c847..553c41d5 100644 --- a/src/BetterVolume/index.tsx +++ b/src/BetterVolume/index.tsx @@ -1,21 +1,11 @@ import {createPlugin, Finder, Filters, Patcher, React} from "dium"; -import {Snowflake, MediaEngineStore, MediaEngineActions, MediaEngineContext} from "@dium/modules"; +import {Snowflake, MediaEngineStore, MediaEngineActions, MediaEngineContext, AudioConvert} from "@dium/modules"; import {MenuItem, FormSwitch} from "@dium/components"; import {Settings} from "./settings"; import {NumberInput} from "./input"; import {handleExperiment, hasExperiment, resetExperiment} from "./experiment"; import {css} from "./styles.module.scss"; -interface AudioConvert { - amplitudeToPerceptual(amplitude: number): number; - perceptualToAmplitude(perceptual: number): number; -} - -const AudioConvert: AudioConvert = Finder.demangle({ - amplitudeToPerceptual: Filters.bySource("Math.log10"), - perceptualToAmplitude: Filters.bySource("Math.pow(10") -}); - type UseUserVolumeItem = (userId: Snowflake, context: MediaEngineContext) => JSX.Element; export default createPlugin({ diff --git a/src/CollapseEmbeds/hider.tsx b/src/CollapseEmbeds/hider.tsx index 5194bd07..185820ff 100644 --- a/src/CollapseEmbeds/hider.tsx +++ b/src/CollapseEmbeds/hider.tsx @@ -1,11 +1,9 @@ -import {Finder, React} from "dium"; +import {React} from "dium"; import {classNames} from "@dium/modules"; -import {Flex, Clickable, Text} from "@dium/components"; +import {Flex, Clickable, Text, IconArrow} from "@dium/components"; import {Settings} from "./settings"; import styles from "./styles.module.scss"; -const Arrow = Finder.bySource(["d:\"M5.293 9"], {entries: true}); - export const enum AccessoryType { Embed = "embed", Attachment = "attachment" @@ -37,7 +35,7 @@ export const Hider = ({placeholders, type, children}: HiderProps): JSX.Element = className={styles.hideButton} onClick={() => setShown(!shown)} > - + ); diff --git a/src/CollapseEmbeds/package.json b/src/CollapseEmbeds/package.json index 8c39e151..da7fbe57 100644 --- a/src/CollapseEmbeds/package.json +++ b/src/CollapseEmbeds/package.json @@ -1,7 +1,7 @@ { "name": "CollapseEmbeds", "author": "Zerthox", - "version": "1.0.4", + "version": "1.0.5", "description": "Adds a button to collapse embeds & attachments.", "dependencies": { "dium": "*"