mirror of
https://github.com/fluxerapp/fluxer.git
synced 2026-12-05 00:22:18 -08:00
refactor(app): unexport file-local values and drop unused ones
This commit is contained in:
17 files changed
+22
-51
No files matched your search
@@ -2,6 +2,6 @@
|
||||
|
||||
import * as path from 'node:path';
|
||||
|
||||
export const ROOT_DIR = path.resolve(import.meta.dirname, '..', '..');
|
||||
const ROOT_DIR = path.resolve(import.meta.dirname, '..', '..');
|
||||
export const SRC_DIR = path.join(ROOT_DIR, 'src');
|
||||
export const DIST_DIR = path.join(ROOT_DIR, 'dist');
|
||||
@@ -97,7 +97,7 @@ function generateRobotsTxt() {
|
||||
return 'User-agent: *\nAllow: /\n';
|
||||
}
|
||||
|
||||
export class StaticFilesPlugin {
|
||||
class StaticFilesPlugin {
|
||||
constructor(options = {}) {
|
||||
this.staticCdnEndpoint = options.staticCdnEndpoint;
|
||||
this.fontsDir = options.fontsDir;
|
||||
|
||||
@@ -20,7 +20,7 @@ function abortSignalAny(signals: Iterable<AbortSignal>): AbortSignal {
|
||||
return controller.signal;
|
||||
}
|
||||
|
||||
export function installAbortSignalPolyfill(target: typeof AbortSignal = AbortSignal): void {
|
||||
function installAbortSignalPolyfill(target: typeof AbortSignal = AbortSignal): void {
|
||||
if (typeof target.timeout !== 'function') {
|
||||
target.timeout = abortSignalTimeout;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import QuickSwitcher from '@app/features/search/state/QuickSwitcher';
|
||||
import MediaEngine from '@app/features/voice/engine/MediaEngineFacade';
|
||||
import type {Channel} from '@fluxer/schema/src/domains/channel/ChannelSchemas';
|
||||
|
||||
export type ChannelBulkUpdatePayload = Partial<Channel> & {
|
||||
type ChannelBulkUpdatePayload = Partial<Channel> & {
|
||||
id: string;
|
||||
type: number;
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@ export function getGuildAcronym(name: string): string {
|
||||
return name.replace(POSSESSIVE_SUFFIX, '').replace(WORD_RUN, firstGrapheme).replace(WHITESPACE, '');
|
||||
}
|
||||
|
||||
export function getGuildAcronymLength(acronym: string): number {
|
||||
function getGuildAcronymLength(acronym: string): number {
|
||||
if (graphemeSegmenter == null) return Array.from(acronym).length;
|
||||
let length = 0;
|
||||
for (const _segment of graphemeSegmenter.segment(acronym)) {
|
||||
@@ -42,7 +42,7 @@ export function getGuildAcronymLength(acronym: string): number {
|
||||
return length;
|
||||
}
|
||||
|
||||
export function getGuildAcronymFontScale(acronymLength: number): number {
|
||||
function getGuildAcronymFontScale(acronymLength: number): number {
|
||||
const index = Math.min(Math.max(acronymLength, 1), GUILD_ACRONYM_FONT_SIZES_PX.length) - 1;
|
||||
return GUILD_ACRONYM_FONT_SIZES_PX[index] / GUILD_ACRONYM_REFERENCE_ICON_SIZE_PX;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ function getGuildAcronymWidthPerEm(acronym: string): number | null {
|
||||
return widthPerEm;
|
||||
}
|
||||
|
||||
export function fitGuildAcronymFontScale(acronymLength: number, widthPerEm: number | null): number {
|
||||
function fitGuildAcronymFontScale(acronymLength: number, widthPerEm: number | null): number {
|
||||
const scale = getGuildAcronymFontScale(acronymLength);
|
||||
if (widthPerEm == null || widthPerEm <= 0) return scale;
|
||||
const maxScale = GUILD_ACRONYM_FIT_WIDTH_RATIO / widthPerEm;
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as PermissionUtils from '@app/features/permissions/utils/PermissionUtil
|
||||
import type {User} from '@app/features/user/models/User';
|
||||
import {Permissions} from '@fluxer/constants/src/ChannelConstants';
|
||||
|
||||
export interface GuildModerationCapabilityOptions {
|
||||
interface GuildModerationCapabilityOptions {
|
||||
isCurrentUser: boolean;
|
||||
canManageTarget: boolean;
|
||||
canKickMembers: boolean;
|
||||
@@ -25,9 +25,7 @@ export interface GuildModerationCapabilities {
|
||||
|
||||
export type MemberModerationActionKey = 'timeout' | 'remove_timeout' | 'kick' | 'ban';
|
||||
|
||||
export function resolveGuildModerationCapabilities(
|
||||
options: GuildModerationCapabilityOptions,
|
||||
): GuildModerationCapabilities {
|
||||
function resolveGuildModerationCapabilities(options: GuildModerationCapabilityOptions): GuildModerationCapabilities {
|
||||
const canModerateTarget = !options.isCurrentUser && options.canManageTarget;
|
||||
return {
|
||||
canKick: canModerateTarget && options.canKickMembers,
|
||||
|
||||
@@ -63,7 +63,7 @@ const fromSyncedKeyCombo = (combo: SyncedKeybindCombo | undefined): KeyCombo =>
|
||||
};
|
||||
};
|
||||
|
||||
export const toSyncedCustomKeybind = (entry: CustomKeybindEntry): SyncedCustomKeybindInit => ({
|
||||
const toSyncedCustomKeybind = (entry: CustomKeybindEntry): SyncedCustomKeybindInit => ({
|
||||
id: entry.id,
|
||||
action: entry.action ?? undefined,
|
||||
combo: toSyncedKeyCombo(entry.combo),
|
||||
|
||||
@@ -25,7 +25,7 @@ export type MessageFetchPreflightDecision =
|
||||
type: 'startFetch';
|
||||
};
|
||||
|
||||
export type MessageFetchPreflightState = 'inFlight' | 'accountTransition' | 'blocked' | 'cached' | 'network';
|
||||
type MessageFetchPreflightState = 'inFlight' | 'accountTransition' | 'blocked' | 'cached' | 'network';
|
||||
|
||||
export interface MessageFetchExecutionInput {
|
||||
forceFailure: boolean;
|
||||
@@ -65,10 +65,6 @@ function buildPreflightDecision(
|
||||
}
|
||||
}
|
||||
|
||||
function buildExecutionDecision(input: MessageFetchExecutionInput): MessageFetchExecutionDecision {
|
||||
return input.forceFailure ? {type: 'simulateFailure'} : {type: 'requestNetwork'};
|
||||
}
|
||||
|
||||
export function resolveMessageFetchPreflightDecision(input: MessageFetchPreflightInput): MessageFetchPreflightDecision {
|
||||
return buildPreflightDecision(resolvePreflightState(input), input);
|
||||
}
|
||||
|
||||
@@ -449,9 +449,3 @@ export function pinImage(src: string | null | undefined): () => void {
|
||||
export function warmImage(src: string | null | undefined): void {
|
||||
loadImage(src, () => {});
|
||||
}
|
||||
|
||||
export function _clearForTests(): void {
|
||||
for (const recovery of [...recoveries.values()]) stopRecovery(recovery);
|
||||
imageCache.clear();
|
||||
lastAttentionWakeAt = Number.NEGATIVE_INFINITY;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import MacPermissions, {type MacPermissionKind} from '@app/features/permissions/
|
||||
import {requestNativePermission} from '@app/features/permissions/system/utils/NativePermissions';
|
||||
import {getNativePlatformSync, isDesktop} from '@app/features/ui/utils/NativeUtils';
|
||||
|
||||
export type MacPermissionGateBehavior = 'interactive' | 'passive';
|
||||
type MacPermissionGateBehavior = 'interactive' | 'passive';
|
||||
export type MacPermissionGateResult = 'granted' | 'denied' | 'unsupported-platform';
|
||||
|
||||
interface MacPermissionGateOptions {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import type {ThreadMemberResponse} from '@fluxer/schema/src/domains/channel/ThreadSchemas';
|
||||
import {makeAutoObservable, observable} from 'mobx';
|
||||
|
||||
export interface ThreadMembership {
|
||||
interface ThreadMembership {
|
||||
readonly threadId: string;
|
||||
readonly joinTimestamp: string;
|
||||
readonly flags: number;
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
|
||||
const logger = new Logger('Typing');
|
||||
|
||||
export interface ComposerTypingInput {
|
||||
interface ComposerTypingInput {
|
||||
channelId: string;
|
||||
value: string;
|
||||
previousValue: string | null;
|
||||
|
||||
@@ -1,18 +1,5 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
const Axis = Object.freeze({
|
||||
HORIZONTAL: 'horizontal',
|
||||
VERTICAL: 'vertical',
|
||||
} as const);
|
||||
|
||||
export const AxisOrientation = Object.freeze({
|
||||
HORIZONTAL: Axis.HORIZONTAL,
|
||||
VERTICAL: Axis.VERTICAL,
|
||||
BOTH: 'both',
|
||||
} as const);
|
||||
|
||||
export type AxisOrientation = (typeof AxisOrientation)[keyof typeof AxisOrientation];
|
||||
|
||||
export const Edge = Object.freeze({
|
||||
LEFT: 'left',
|
||||
RIGHT: 'right',
|
||||
|
||||
@@ -9,28 +9,24 @@ import {clsx} from 'clsx';
|
||||
import type React from 'react';
|
||||
import {useEffect, useRef, useState} from 'react';
|
||||
|
||||
export type PaginationItem = number | 'ellipsis-left' | 'ellipsis-right';
|
||||
type PaginationItem = number | 'ellipsis-left' | 'ellipsis-right';
|
||||
|
||||
export const GO_TO_PAGE_DESCRIPTOR = msg({
|
||||
const GO_TO_PAGE_DESCRIPTOR = msg({
|
||||
message: 'Go to page {page}',
|
||||
comment: 'Accessible label of each pagination page button. page is the 1-indexed page number.',
|
||||
});
|
||||
|
||||
export const GO_TO_PAGE_2_DESCRIPTOR = msg({
|
||||
const GO_TO_PAGE_2_DESCRIPTOR = msg({
|
||||
message: 'Go to page',
|
||||
comment: 'Accessible label of the inline page-number input shown when the user opens the pagination ellipsis.',
|
||||
});
|
||||
|
||||
export const JUMP_TO_PAGE_DESCRIPTOR = msg({
|
||||
const JUMP_TO_PAGE_DESCRIPTOR = msg({
|
||||
message: 'Jump to page',
|
||||
comment: 'Accessible label of the ellipsis button in the pagination bar that reveals the page-number input.',
|
||||
});
|
||||
|
||||
export const buildPaginationRange = (
|
||||
currentPage: number,
|
||||
totalPages: number,
|
||||
maxVisible: number,
|
||||
): Array<PaginationItem> => {
|
||||
const buildPaginationRange = (currentPage: number, totalPages: number, maxVisible: number): Array<PaginationItem> => {
|
||||
if (totalPages <= 0) return [];
|
||||
const effectiveMax = Math.max(3, maxVisible);
|
||||
if (totalPages <= effectiveMax) {
|
||||
|
||||
@@ -12,7 +12,7 @@ export const LayerType = Object.freeze({
|
||||
|
||||
export type LayerType = (typeof LayerType)[keyof typeof LayerType];
|
||||
|
||||
export interface Layer {
|
||||
interface Layer {
|
||||
type: LayerType;
|
||||
key: string | PopoutKey;
|
||||
onClose?: () => void;
|
||||
|
||||
@@ -16,7 +16,7 @@ export interface SoundSettings {
|
||||
soundOverrides: Partial<Record<SoundType, number>>;
|
||||
}
|
||||
|
||||
export interface SoundPlayOptions {
|
||||
interface SoundPlayOptions {
|
||||
bypassSelfDeafened?: boolean;
|
||||
ignoreGroupCooldown?: boolean;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ function shouldRequestFocus(
|
||||
return context.step !== event.step || !context.focusOnStepChange;
|
||||
}
|
||||
|
||||
export const steppedCarouselStateMachine = setup({
|
||||
const steppedCarouselStateMachine = setup({
|
||||
types: {} as {
|
||||
context: SteppedCarouselMachineContext;
|
||||
events: SteppedCarouselMachineEvent;
|
||||
|
||||
Reference in new issue
Block a user