diff --git a/src/app/components/AccountDataEditor.tsx b/src/app/components/AccountDataEditor.tsx
index 8c28b935..2dbaf1f1 100644
--- a/src/app/components/AccountDataEditor.tsx
+++ b/src/app/components/AccountDataEditor.tsx
@@ -16,7 +16,6 @@ import {
} from 'folds';
import { MatrixError } from 'matrix-js-sdk';
import { Cursor } from '../plugins/text-area';
-import { PhoneHit } from '../styles/PhoneHit.css';
import { syntaxErrorPosition } from '../utils/dom';
import { AsyncStatus, useAsyncCallback } from '../hooks/useAsyncCallback';
import { Page, PageHeader } from './page';
@@ -295,7 +294,7 @@ export function AccountDataEditor({
-
+
diff --git a/src/app/components/BackupRestore.tsx b/src/app/components/BackupRestore.tsx
index 57a18674..068f437b 100644
--- a/src/app/components/BackupRestore.tsx
+++ b/src/app/components/BackupRestore.tsx
@@ -30,7 +30,6 @@ import {
} from '../hooks/useKeyBackup';
import { stopPropagation } from '../utils/keyboard';
import { useRestoreBackupOnVerification } from '../hooks/useRestoreBackupOnVerification';
-import { PhoneHit } from '../styles/PhoneHit.css';
type BackupStatusProps = {
enabled: boolean;
@@ -178,7 +177,6 @@ export function BackupRestoreTile({ crypto }: BackupRestoreTileProps) {
)}
Device Verification
-
+
diff --git a/src/app/components/DeviceVerificationSetup.tsx b/src/app/components/DeviceVerificationSetup.tsx
index 68f42221..433fa6a1 100644
--- a/src/app/components/DeviceVerificationSetup.tsx
+++ b/src/app/components/DeviceVerificationSetup.tsx
@@ -25,7 +25,6 @@ import { ActionUIA, ActionUIAFlowsLoader } from './ActionUIA';
import { useMatrixClient } from '../hooks/useMatrixClient';
import { useAlive } from '../hooks/useAlive';
import { UseStateProvider } from './UseStateProvider';
-import { PhoneHit } from '../styles/PhoneHit.css';
type UIACallback = (
authDict: AuthDict | null
@@ -302,7 +301,7 @@ export const DeviceVerificationSetup = forwardRef
Setup Device Verification
-
+
@@ -337,7 +336,7 @@ export const DeviceVerificationReset = forwardRef
Reset Device Verification
-
+
diff --git a/src/app/components/Pdf-viewer/PdfViewer.tsx b/src/app/components/Pdf-viewer/PdfViewer.tsx
index d0e5f715..9c7fd980 100644
--- a/src/app/components/Pdf-viewer/PdfViewer.tsx
+++ b/src/app/components/Pdf-viewer/PdfViewer.tsx
@@ -27,7 +27,6 @@ import { AsyncStatus } from '../../hooks/useAsyncCallback';
import { useZoom } from '../../hooks/useZoom';
import { createPage, usePdfDocumentLoader, usePdfJSLoader } from '../../plugins/pdfjs-dist';
import { stopPropagation } from '../../utils/keyboard';
-import { PhoneHit, PhoneHitSpread24 } from '../../styles/PhoneHit.css';
export type PdfViewerProps = {
name: string;
@@ -109,7 +108,7 @@ export const PdfViewer = as<'div', PdfViewerProps>(
-
+
@@ -118,7 +117,6 @@ export const PdfViewer = as<'div', PdfViewerProps>(
(
{Math.round(zoom * 100)}%
1 ? 'Success' : 'SurfaceVariant'}
outlined={zoom > 1}
size="300"
diff --git a/src/app/components/UIAFlowOverlay.tsx b/src/app/components/UIAFlowOverlay.tsx
index 49e1d821..a2bdd1b8 100644
--- a/src/app/components/UIAFlowOverlay.tsx
+++ b/src/app/components/UIAFlowOverlay.tsx
@@ -13,7 +13,6 @@ import {
IconButton,
} from 'folds';
import FocusTrap from 'focus-trap-react';
-import { PhoneHit } from '../styles/PhoneHit.css';
export type UIAFlowOverlayProps = {
currentStep: number;
@@ -54,7 +53,6 @@ export function UIAFlowOverlay({
>
{(anchorRef) => (
{(triggerRef) => (
{(triggerRef) => (
{(triggerRef) => (
handleMenuSelect(1)}
size="400"
@@ -182,7 +178,6 @@ export function HeadingBlockButton() {
>
{(triggerRef) => (
handleMenuSelect(2)}
size="400"
@@ -198,7 +193,6 @@ export function HeadingBlockButton() {
>
{(triggerRef) => (
handleMenuSelect(3)}
size="400"
@@ -214,7 +208,6 @@ export function HeadingBlockButton() {
}
>
{(triggerRef) => (
{(triggerRef) => (
setIsMarkdown(!isMarkdown)}
diff --git a/src/app/components/emoji-board/components/Sidebar.tsx b/src/app/components/emoji-board/components/Sidebar.tsx
index d2d5f197..de22b483 100644
--- a/src/app/components/emoji-board/components/Sidebar.tsx
+++ b/src/app/components/emoji-board/components/Sidebar.tsx
@@ -14,7 +14,6 @@ import {
} from 'folds';
import classNames from 'classnames';
import * as css from './styles.css';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
export function Sidebar({ children }: { children: ReactNode }) {
return (
@@ -69,7 +68,6 @@ function SidebarBtn({
>
{(ref) => (
(
Seen by
-
+
diff --git a/src/app/components/image-editor/ImageEditor.tsx b/src/app/components/image-editor/ImageEditor.tsx
index 0f072bb0..1ec474e8 100644
--- a/src/app/components/image-editor/ImageEditor.tsx
+++ b/src/app/components/image-editor/ImageEditor.tsx
@@ -2,7 +2,6 @@ import React from 'react';
import classNames from 'classnames';
import { Box, Chip, Header, Icon, IconButton, Icons, Text, as } from 'folds';
import * as css from './ImageEditor.css';
-import { PhoneHit } from '../../styles/PhoneHit.css';
export type ImageEditorProps = {
name: string;
@@ -25,7 +24,7 @@ export const ImageEditor = as<'div', ImageEditorProps>(
>
-
+
diff --git a/src/app/components/image-pack-view/ImagePackView.tsx b/src/app/components/image-pack-view/ImagePackView.tsx
index 15b1cd08..ab81d503 100644
--- a/src/app/components/image-pack-view/ImagePackView.tsx
+++ b/src/app/components/image-pack-view/ImagePackView.tsx
@@ -1,7 +1,6 @@
import React from 'react';
import { Box, IconButton, Text, Icon, Icons, Scroll, Chip } from 'folds';
import { PackAddress } from '../../plugins/custom-emoji';
-import { PhoneHit } from '../../styles/PhoneHit.css';
import { Page, PageHeader, PageContent } from '../page';
import { useMatrixClient } from '../../hooks/useMatrixClient';
import { RoomImagePack } from './RoomImagePack';
@@ -30,7 +29,7 @@ export function ImagePackView({ address, requestClose }: ImagePackViewProps) {
-
+
diff --git a/src/app/components/image-viewer/ImageViewer.tsx b/src/app/components/image-viewer/ImageViewer.tsx
index 4d2d7694..4956a7b6 100644
--- a/src/app/components/image-viewer/ImageViewer.tsx
+++ b/src/app/components/image-viewer/ImageViewer.tsx
@@ -7,7 +7,6 @@ import * as css from './ImageViewer.css';
import { useZoom } from '../../hooks/useZoom';
import { usePan } from '../../hooks/usePan';
import { downloadMedia } from '../../utils/matrix';
-import { PhoneHit, PhoneHitSpread24 } from '../../styles/PhoneHit.css';
export type ImageViewerProps = {
alt: string;
@@ -34,7 +33,7 @@ export const ImageViewer = as<'div', ImageViewerProps>(
>
-
+
@@ -43,7 +42,6 @@ export const ImageViewer = as<'div', ImageViewerProps>(
(
{Math.round(zoom * 100)}%
1 ? 'Success' : 'SurfaceVariant'}
outlined={zoom > 1}
size="300"
diff --git a/src/app/components/invite-user-prompt/InviteUserPrompt.tsx b/src/app/components/invite-user-prompt/InviteUserPrompt.tsx
index a503fe13..ddac0576 100644
--- a/src/app/components/invite-user-prompt/InviteUserPrompt.tsx
+++ b/src/app/components/invite-user-prompt/InviteUserPrompt.tsx
@@ -42,7 +42,6 @@ import { AsyncStatus, useAsyncCallback } from '../../hooks/useAsyncCallback';
import { useMatrixClient } from '../../hooks/useMatrixClient';
import { BreakWord } from '../../styles/Text.css';
import { useAlive } from '../../hooks/useAlive';
-import { PhoneHit } from '../../styles/PhoneHit.css';
const SEARCH_OPTIONS: UseAsyncSearchOptions = {
limit: 1000,
@@ -174,7 +173,7 @@ export function InviteUserPrompt({ room, requestClose }: InviteUserProps) {
-
+
diff --git a/src/app/components/join-address-prompt/JoinAddressPrompt.tsx b/src/app/components/join-address-prompt/JoinAddressPrompt.tsx
index ffd5241c..50a89418 100644
--- a/src/app/components/join-address-prompt/JoinAddressPrompt.tsx
+++ b/src/app/components/join-address-prompt/JoinAddressPrompt.tsx
@@ -20,7 +20,6 @@ import { stopPropagation } from '../../utils/keyboard';
import { isRoomAlias, isRoomId } from '../../utils/matrix';
import { parseMatrixToRoom, parseMatrixToRoomEvent, testMatrixTo } from '../../plugins/matrix-to';
import { tryDecodeURIComponent } from '../../utils/dom';
-import { PhoneHit } from '../../styles/PhoneHit.css';
type JoinAddressProps = {
onOpen: (roomIdOrAlias: string, via?: string[], eventId?: string) => void;
@@ -83,7 +82,7 @@ export function JoinAddressPrompt({ onOpen, onCancel }: JoinAddressProps) {
Join with Address
-
+
diff --git a/src/app/components/leave-room-prompt/LeaveRoomPrompt.tsx b/src/app/components/leave-room-prompt/LeaveRoomPrompt.tsx
index 832dd59d..217491e6 100644
--- a/src/app/components/leave-room-prompt/LeaveRoomPrompt.tsx
+++ b/src/app/components/leave-room-prompt/LeaveRoomPrompt.tsx
@@ -20,7 +20,6 @@ import { MatrixError } from 'matrix-js-sdk';
import { useMatrixClient } from '../../hooks/useMatrixClient';
import { AsyncStatus, useAsyncCallback } from '../../hooks/useAsyncCallback';
import { stopPropagation } from '../../utils/keyboard';
-import { PhoneHit } from '../../styles/PhoneHit.css';
type LeaveRoomPromptProps = {
roomId: string;
@@ -69,7 +68,7 @@ export function LeaveRoomPrompt({ roomId, onDone, onCancel }: LeaveRoomPromptPro
Leave Room
-
+
diff --git a/src/app/components/leave-space-prompt/LeaveSpacePrompt.tsx b/src/app/components/leave-space-prompt/LeaveSpacePrompt.tsx
index 6c75ef99..8709b942 100644
--- a/src/app/components/leave-space-prompt/LeaveSpacePrompt.tsx
+++ b/src/app/components/leave-space-prompt/LeaveSpacePrompt.tsx
@@ -20,7 +20,6 @@ import { MatrixError } from 'matrix-js-sdk';
import { useMatrixClient } from '../../hooks/useMatrixClient';
import { AsyncStatus, useAsyncCallback } from '../../hooks/useAsyncCallback';
import { stopPropagation } from '../../utils/keyboard';
-import { PhoneHit } from '../../styles/PhoneHit.css';
type LeaveSpacePromptProps = {
roomId: string;
@@ -69,7 +68,7 @@ export function LeaveSpacePrompt({ roomId, onDone, onCancel }: LeaveSpacePromptP
Leave Space
-
+
diff --git a/src/app/components/message/FileHeader.tsx b/src/app/components/message/FileHeader.tsx
index 41cef5f4..2ffc9ec4 100644
--- a/src/app/components/message/FileHeader.tsx
+++ b/src/app/components/message/FileHeader.tsx
@@ -2,7 +2,6 @@ import { Badge, Box, Icon, IconButton, Icons, Spinner, Text, as, toRem } from 'f
import React, { ReactNode, useCallback } from 'react';
import { EncryptedAttachmentInfo } from 'browser-encrypt-attachment';
import FileSaver from 'file-saver';
-import { PhoneHit } from '../../styles/PhoneHit.css';
import { mimeTypeToExt } from '../../utils/mimeTypes';
import { useMatrixClient } from '../../hooks/useMatrixClient';
import { useMediaAuthentication } from '../../hooks/useMediaAuthentication';
@@ -49,7 +48,6 @@ export function FileDownloadButton({ filename, url, mimeType, encInfo }: FileDow
variant={hasError ? 'Critical' : 'SurfaceVariant'}
size="300"
radii="300"
- className={PhoneHit}
>
{downloading ? (
diff --git a/src/app/components/message/Reaction.css.ts b/src/app/components/message/Reaction.css.ts
index 08003f0e..6c9052ec 100644
--- a/src/app/components/message/Reaction.css.ts
+++ b/src/app/components/message/Reaction.css.ts
@@ -1,7 +1,7 @@
import { createVar, style } from '@vanilla-extract/css';
import { DefaultReset, FocusOutline, color, config, toRem } from 'folds';
import { MOBILE_BREAKPOINT } from '../../hooks/useScreenSize';
-import { PHONE_TAP } from '../../styles/PhoneHit.css';
+import { PHONE_TAP } from '../../../phoneGlyph.css';
const PHONE = `screen and (max-width: ${MOBILE_BREAKPOINT}px)`;
const Container = createVar();
diff --git a/src/app/components/message/content/AudioContent.tsx b/src/app/components/message/content/AudioContent.tsx
index 94132cea..478486a4 100644
--- a/src/app/components/message/content/AudioContent.tsx
+++ b/src/app/components/message/content/AudioContent.tsx
@@ -3,7 +3,6 @@ import React, { ReactNode, useCallback, useRef, useState } from 'react';
import { Badge, Chip, Icon, IconButton, Icons, ProgressBar, Spinner, Text, toRem } from 'folds';
import { EncryptedAttachmentInfo } from 'browser-encrypt-attachment';
import { Range } from 'react-range';
-import { PhoneHitSpread24 } from '../../../styles/PhoneHit.css';
import { useMatrixClient } from '../../../hooks/useMatrixClient';
import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
import { IAudioInfo } from '../../../../types/matrix/common';
@@ -160,7 +159,6 @@ export function AudioContent({
variant="SurfaceVariant"
size="300"
radii="Pill"
- className={PhoneHitSpread24}
onClick={() => setMute(!mute)}
aria-pressed={mute}
>
diff --git a/src/app/components/password-input/PasswordInput.tsx b/src/app/components/password-input/PasswordInput.tsx
index 6aa0d4f3..4ffe0d83 100644
--- a/src/app/components/password-input/PasswordInput.tsx
+++ b/src/app/components/password-input/PasswordInput.tsx
@@ -1,7 +1,6 @@
import React, { ComponentProps, forwardRef } from 'react';
import { Icon, IconButton, Input, config, Icons } from 'folds';
import { UseStateProvider } from '../UseStateProvider';
-import { PhoneHit } from '../../styles/PhoneHit.css';
type PasswordInputProps = Omit, 'type' | 'size'> & {
size: '400' | '500';
@@ -24,7 +23,6 @@ export const PasswordInput = forwardRef(
<>
{after}
setVisible(!visible)}
type="button"
variant={visible ? 'Warning' : variant}
diff --git a/src/app/components/room-topic-viewer/RoomTopicViewer.tsx b/src/app/components/room-topic-viewer/RoomTopicViewer.tsx
index 0d091e7e..52128772 100644
--- a/src/app/components/room-topic-viewer/RoomTopicViewer.tsx
+++ b/src/app/components/room-topic-viewer/RoomTopicViewer.tsx
@@ -4,7 +4,6 @@ import classNames from 'classnames';
import Linkify from 'linkify-react';
import * as css from './style.css';
import { LINKIFY_OPTS, scaleSystemEmoji } from '../../plugins/react-custom-html-parser';
-import { PhoneHit } from '../../styles/PhoneHit.css';
export const RoomTopicViewer = as<
'div',
@@ -27,7 +26,7 @@ export const RoomTopicViewer = as<
{name}
-
+
diff --git a/src/app/components/text-viewer/TextViewer.tsx b/src/app/components/text-viewer/TextViewer.tsx
index e9e150b5..ec4ed0a5 100644
--- a/src/app/components/text-viewer/TextViewer.tsx
+++ b/src/app/components/text-viewer/TextViewer.tsx
@@ -5,7 +5,6 @@ import { Box, Chip, Header, Icon, IconButton, Icons, Scroll, Text, as } from 'fo
import { ErrorBoundary } from 'react-error-boundary';
import * as css from './TextViewer.css';
import { copyToClipboard } from '../../utils/dom';
-import { PhoneHit } from '../../styles/PhoneHit.css';
const ReactPrism = lazy(() => import('../../plugins/react-prism/ReactPrism'));
@@ -54,7 +53,7 @@ export const TextViewer = as<'div', TextViewerProps>(
>
-
+
diff --git a/src/app/components/uia-stages/PasswordStage.tsx b/src/app/components/uia-stages/PasswordStage.tsx
index a7ca2d06..0164cae6 100644
--- a/src/app/components/uia-stages/PasswordStage.tsx
+++ b/src/app/components/uia-stages/PasswordStage.tsx
@@ -4,7 +4,6 @@ import { AuthType } from 'matrix-js-sdk';
import { StageComponentProps } from './types';
import { ErrorCode } from '../../cs-errorcode';
import { PasswordInput } from '../password-input';
-import { PhoneHit } from '../../styles/PhoneHit.css';
export function PasswordStage({
stageData,
@@ -46,7 +45,7 @@ export function PasswordStage({
Account Password
-
+
diff --git a/src/app/components/uia-stages/SSOStage.tsx b/src/app/components/uia-stages/SSOStage.tsx
index 20decb6c..e3d6126a 100644
--- a/src/app/components/uia-stages/SSOStage.tsx
+++ b/src/app/components/uia-stages/SSOStage.tsx
@@ -1,7 +1,6 @@
import { Box, Button, color, config, Dialog, Header, Icon, IconButton, Icons, Text } from 'folds';
import React, { useCallback, useEffect, useState } from 'react';
import { StageComponentProps } from './types';
-import { PhoneHit } from '../../styles/PhoneHit.css';
export function SSOStage({
ssoRedirectURL,
@@ -57,7 +56,7 @@ export function SSOStage({
SSO Login
-
+
diff --git a/src/app/components/upload-card/CompactUploadCardRenderer.tsx b/src/app/components/upload-card/CompactUploadCardRenderer.tsx
index 5fe73a10..3f0246a4 100644
--- a/src/app/components/upload-card/CompactUploadCardRenderer.tsx
+++ b/src/app/components/upload-card/CompactUploadCardRenderer.tsx
@@ -7,7 +7,6 @@ import { TUploadContent } from '../../utils/matrix';
import { bytesToSize, getFileTypeIcon } from '../../utils/common';
import { useMediaConfig } from '../../hooks/useMediaConfig';
import { UploadFailureNote } from './UploadFailureNote';
-import { PhoneHitSpread28 } from '../../styles/PhoneHit.css';
type CompactUploadCardRendererProps = {
isEncrypted?: boolean;
@@ -65,7 +64,6 @@ export function CompactUploadCardRenderer({
)}
)}
(({ children, ...props }, ref) => {
<>
(({ children, ...props }, ref) => {
<>
Self Demotion
-
+
@@ -121,7 +120,7 @@ function SharedPowerAlert({ power, onCancel, onChange }: SharedPowerAlertProps)
Shared Power
-
+
diff --git a/src/app/features/add-existing/AddExisting.tsx b/src/app/features/add-existing/AddExisting.tsx
index a57a6b10..d100096b 100644
--- a/src/app/features/add-existing/AddExisting.tsx
+++ b/src/app/features/add-existing/AddExisting.tsx
@@ -54,7 +54,6 @@ import { StateEvent } from '../../../types/matrix/room';
import { getViaServers } from '../../plugins/via-servers';
import { rateLimitedActions } from '../../utils/matrix';
import { useAlive } from '../../hooks/useAlive';
-import { PhoneHit } from '../../styles/PhoneHit.css';
const SEARCH_OPTS: UseAsyncSearchOptions = {
limit: 500,
@@ -202,7 +201,7 @@ export function AddExistingModal({ parentId, space, requestClose }: AddExistingM
Add Existing
-
+
diff --git a/src/app/features/call-status/CallControl.tsx b/src/app/features/call-status/CallControl.tsx
index d63f8709..3cf38b1f 100644
--- a/src/app/features/call-status/CallControl.tsx
+++ b/src/app/features/call-status/CallControl.tsx
@@ -5,7 +5,6 @@ import { StatusDivider } from './components';
import { CallEmbed, useCallControlState } from '../../plugins/call';
import { AsyncStatus, useAsyncCallback } from '../../hooks/useAsyncCallback';
import { callEmbedAtom } from '../../state/callEmbed';
-import { PhoneHitSpread26 } from '../../styles/PhoneHit.css';
type MicrophoneButtonProps = {
enabled: boolean;
@@ -27,7 +26,6 @@ function MicrophoneButton({ enabled, onToggle, disabled }: MicrophoneButtonProps
>
{(anchorRef) => (
{(anchorRef) => (
{(anchorRef) => (
{(anchorRef) => (
{(anchorRef) => (
{(anchorRef) => (
{(anchorRef) => (
{(anchorRef) => (
{(anchorRef) => (
void;
@@ -93,7 +92,7 @@ export function DeveloperTools({ requestClose }: DeveloperToolsProps) {
-
+
diff --git a/src/app/features/common-settings/developer-tools/SendRoomEvent.tsx b/src/app/features/common-settings/developer-tools/SendRoomEvent.tsx
index a6e60a7b..f25ba7c3 100644
--- a/src/app/features/common-settings/developer-tools/SendRoomEvent.tsx
+++ b/src/app/features/common-settings/developer-tools/SendRoomEvent.tsx
@@ -22,7 +22,6 @@ import { useTextAreaCodeEditor } from '../../../hooks/useTextAreaCodeEditor';
import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
import { syntaxErrorPosition } from '../../../utils/dom';
import { Cursor } from '../../../plugins/text-area';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
const EDITOR_INTENT_SPACE_COUNT = 2;
@@ -119,7 +118,7 @@ export function SendRoomEvent({ type, stateKey, requestClose }: SendRoomEventPro
-
+
diff --git a/src/app/features/common-settings/developer-tools/StateEventEditor.tsx b/src/app/features/common-settings/developer-tools/StateEventEditor.tsx
index 0f9f4034..0ea96901 100644
--- a/src/app/features/common-settings/developer-tools/StateEventEditor.tsx
+++ b/src/app/features/common-settings/developer-tools/StateEventEditor.tsx
@@ -31,7 +31,6 @@ import { usePowerLevels } from '../../../hooks/usePowerLevels';
import { useTextAreaCodeEditor } from '../../../hooks/useTextAreaCodeEditor';
import { useRoomCreators } from '../../../hooks/useRoomCreators';
import { useRoomPermissions } from '../../../hooks/useRoomPermissions';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
const EDITOR_INTENT_SPACE_COUNT = 2;
@@ -276,7 +275,7 @@ export function StateEventEditor({ type, stateKey, requestClose }: StateEventEdi
-
+
diff --git a/src/app/features/common-settings/emojis-stickers/EmojisStickers.tsx b/src/app/features/common-settings/emojis-stickers/EmojisStickers.tsx
index f7e901d5..ad8ffae6 100644
--- a/src/app/features/common-settings/emojis-stickers/EmojisStickers.tsx
+++ b/src/app/features/common-settings/emojis-stickers/EmojisStickers.tsx
@@ -4,7 +4,6 @@ import { Page, PageContent, PageHeader } from '../../../components/page';
import { ImagePack } from '../../../plugins/custom-emoji';
import { ImagePackView } from '../../../components/image-pack-view';
import { RoomPacks } from './RoomPacks';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
type EmojisStickersProps = {
requestClose: () => void;
@@ -30,7 +29,7 @@ export function EmojisStickers({ requestClose }: EmojisStickersProps) {
-
+
diff --git a/src/app/features/common-settings/emojis-stickers/RoomPacks.tsx b/src/app/features/common-settings/emojis-stickers/RoomPacks.tsx
index 7be8de35..fdbe546e 100644
--- a/src/app/features/common-settings/emojis-stickers/RoomPacks.tsx
+++ b/src/app/features/common-settings/emojis-stickers/RoomPacks.tsx
@@ -40,7 +40,6 @@ import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
import { useAlive } from '../../../hooks/useAlive';
import { useRoomCreators } from '../../../hooks/useRoomCreators';
import { useRoomPermissions } from '../../../hooks/useRoomPermissions';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
type CreatePackTileProps = {
packs: ImagePack[];
@@ -216,7 +215,6 @@ export function RoomPacks({ onViewPack }: RoomPacksProps) {
{canEdit &&
(removed ? (
) : (
Enable Encryption
setPrompt(false)}
radii="300"
diff --git a/src/app/features/common-settings/general/RoomUpgrade.tsx b/src/app/features/common-settings/general/RoomUpgrade.tsx
index 2971d565..45a480aa 100644
--- a/src/app/features/common-settings/general/RoomUpgrade.tsx
+++ b/src/app/features/common-settings/general/RoomUpgrade.tsx
@@ -39,7 +39,6 @@ import { useAlive } from '../../../hooks/useAlive';
import { creatorsSupported } from '../../../utils/matrix';
import { useRoomCreators } from '../../../hooks/useRoomCreators';
import { BreakWord } from '../../../styles/Text.css';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
function RoomUpgradeDialog({ requestClose }: { requestClose: () => void }) {
const mx = useMatrixClient();
@@ -106,7 +105,7 @@ function RoomUpgradeDialog({ requestClose }: { requestClose: () => void }) {
{room.isSpaceRoom() ? 'Space Upgrade' : 'Room Upgrade'}
-
+
diff --git a/src/app/features/common-settings/members/Members.tsx b/src/app/features/common-settings/members/Members.tsx
index a1dddb54..15cd1d08 100644
--- a/src/app/features/common-settings/members/Members.tsx
+++ b/src/app/features/common-settings/members/Members.tsx
@@ -56,7 +56,6 @@ import { useSpaceOptionally } from '../../../hooks/useSpace';
import { useFlattenPowerTagMembers, useGetMemberPowerTag } from '../../../hooks/useMemberPowerTag';
import { useRoomCreators } from '../../../hooks/useRoomCreators';
import { getMouseEventCords } from '../../../utils/dom';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
const SEARCH_OPTIONS: UseAsyncSearchOptions = {
limit: 1000,
@@ -162,7 +161,7 @@ export function Members({ requestClose }: MembersProps) {
-
+
@@ -278,7 +277,6 @@ export function Members({ requestClose }: MembersProps) {
anchorRef={scrollTopAnchorRef}
>
virtualizer.scrollToOffset(0)}
variant="Surface"
radii="Pill"
diff --git a/src/app/features/common-settings/permissions/PowersEditor.tsx b/src/app/features/common-settings/permissions/PowersEditor.tsx
index 0684a48a..97305946 100644
--- a/src/app/features/common-settings/permissions/PowersEditor.tsx
+++ b/src/app/features/common-settings/permissions/PowersEditor.tsx
@@ -49,7 +49,6 @@ import { useAlive } from '../../../hooks/useAlive';
import { BetaNoticeBadge } from '../../../components/BetaNoticeBadge';
import { getPowerTagIconSrc } from '../../../hooks/useMemberPowerTag';
import { creatorsSupported } from '../../../utils/matrix';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
type EditPowerProps = {
maxPower: number;
@@ -370,7 +369,7 @@ export function PowersEditor({ powerLevels, requestClose }: PowersEditorProps) {
-
+
diff --git a/src/app/features/create-room/CreateRoomModal.tsx b/src/app/features/create-room/CreateRoomModal.tsx
index 9332f35c..d5d8c92d 100644
--- a/src/app/features/create-room/CreateRoomModal.tsx
+++ b/src/app/features/create-room/CreateRoomModal.tsx
@@ -24,7 +24,6 @@ import {
import { CreateRoomModalState } from '../../state/createRoomModal';
import { stopPropagation } from '../../utils/keyboard';
import { CreateRoomType } from '../../components/create-room/types';
-import { PhoneHit } from '../../styles/PhoneHit.css';
type CreateRoomModalProps = {
state: CreateRoomModalState;
@@ -64,7 +63,7 @@ function CreateRoomModal({ state }: CreateRoomModalProps) {
-
+
diff --git a/src/app/features/create-space/CreateSpaceModal.tsx b/src/app/features/create-space/CreateSpaceModal.tsx
index faa53b25..c1bc6898 100644
--- a/src/app/features/create-space/CreateSpaceModal.tsx
+++ b/src/app/features/create-space/CreateSpaceModal.tsx
@@ -23,7 +23,6 @@ import {
} from '../../state/hooks/createSpaceModal';
import { CreateSpaceModalState } from '../../state/createSpaceModal';
import { stopPropagation } from '../../utils/keyboard';
-import { PhoneHit } from '../../styles/PhoneHit.css';
type CreateSpaceModalProps = {
state: CreateSpaceModalState;
@@ -62,7 +61,7 @@ function CreateSpaceModal({ state }: CreateSpaceModalProps) {
New Space
-
+
diff --git a/src/app/features/desk/Desk.tsx b/src/app/features/desk/Desk.tsx
index d6795ac4..b29ae9ec 100644
--- a/src/app/features/desk/Desk.tsx
+++ b/src/app/features/desk/Desk.tsx
@@ -1,7 +1,6 @@
import React, { useMemo } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { Box, Icon, IconButton, Icons, Scroll, Text } from 'folds';
-import { PhoneHit } from '../../styles/PhoneHit.css';
import { Page, PageContent, PageContentCenter, PageHeader } from '../../components/page';
import { ScreenSize, useScreenSizeContext } from '../../hooks/useScreenSize';
import { getHomePath } from '../../pages/pathUtils';
@@ -28,7 +27,6 @@ export function Desk() {
{phone && (
navigate(getHomePath())}
>
diff --git a/src/app/features/join-before-navigate/JoinBeforeNavigate.tsx b/src/app/features/join-before-navigate/JoinBeforeNavigate.tsx
index 43576cff..028cd560 100644
--- a/src/app/features/join-before-navigate/JoinBeforeNavigate.tsx
+++ b/src/app/features/join-before-navigate/JoinBeforeNavigate.tsx
@@ -10,7 +10,6 @@ import { useMatrixClient } from '../../hooks/useMatrixClient';
import { allRoomsAtom } from '../../state/room-list/roomList';
import { ScreenSize, useScreenSizeContext } from '../../hooks/useScreenSize';
import { BackRouteHandler } from '../../components/BackRouteHandler';
-import { PhoneHit } from '../../styles/PhoneHit.css';
type JoinBeforeNavigateProps = { roomIdOrAlias: string; eventId?: string; viaServers?: string[] };
export function JoinBeforeNavigate({
@@ -39,7 +38,7 @@ export function JoinBeforeNavigate({
{screenSize === ScreenSize.Mobile && (
{(onBack) => (
-
+
)}
diff --git a/src/app/features/lobby/HierarchyItemMenu.tsx b/src/app/features/lobby/HierarchyItemMenu.tsx
index cdfa2d8a..1802e3b0 100644
--- a/src/app/features/lobby/HierarchyItemMenu.tsx
+++ b/src/app/features/lobby/HierarchyItemMenu.tsx
@@ -30,7 +30,6 @@ import { IPowerLevels } from '../../hooks/usePowerLevels';
import { getRoomCreatorsForRoomId } from '../../hooks/useRoomCreators';
import { getRoomPermissionsAPI } from '../../hooks/useRoomPermissions';
import { InviteUserPrompt } from '../../components/invite-user-prompt';
-import { PhoneHitSpread24 } from '../../styles/PhoneHit.css';
type HierarchyItemWithParent = HierarchyItem & {
parentId: string;
@@ -232,7 +231,6 @@ export function HierarchyItemMenu({
return (
virtualizer.scrollToOffset(0)}
variant="SurfaceVariant"
radii="Pill"
diff --git a/src/app/features/lobby/LobbyHeader.tsx b/src/app/features/lobby/LobbyHeader.tsx
index ce248fe5..ed526c68 100644
--- a/src/app/features/lobby/LobbyHeader.tsx
+++ b/src/app/features/lobby/LobbyHeader.tsx
@@ -38,7 +38,6 @@ import { useOpenSpaceSettings } from '../../state/hooks/spaceSettings';
import { useRoomCreators } from '../../hooks/useRoomCreators';
import { useRoomPermissions } from '../../hooks/useRoomPermissions';
import { InviteUserPrompt } from '../../components/invite-user-prompt';
-import { PhoneHit } from '../../styles/PhoneHit.css';
type LobbyMenuProps = {
powerLevels: IPowerLevels;
@@ -166,7 +165,7 @@ export function LobbyHeader({ showProfile, powerLevels }: LobbyHeaderProps) {
{(onBack) => (
-
+
)}
@@ -241,7 +240,6 @@ export function LobbyHeader({ showProfile, powerLevels }: LobbyHeaderProps) {
>
{(triggerRef) => (
useMemo(
@@ -194,7 +193,6 @@ export function MessageSearch({
virtualizer.scrollToOffset(0)}
variant="SurfaceVariant"
radii="Pill"
diff --git a/src/app/features/room-nav/RoomNavItem.tsx b/src/app/features/room-nav/RoomNavItem.tsx
index 8d53ce7f..e8a349f0 100644
--- a/src/app/features/room-nav/RoomNavItem.tsx
+++ b/src/app/features/room-nav/RoomNavItem.tsx
@@ -66,7 +66,6 @@ import { useAutoDiscoveryInfo } from '../../hooks/useAutoDiscoveryInfo';
import { livekitSupport } from '../../hooks/useLivekitSupport';
import { StateEvent } from '../../../types/matrix/room';
import { webRTCSupported } from '../../utils/rtc';
-import { PhoneHitSpread24 } from '../../styles/PhoneHit.css';
type RoomNavItemMenuProps = {
room: Room;
@@ -230,7 +229,6 @@ function CallChatToggle() {
return (
setChat(!chat)}
aria-pressed={chat}
aria-label="Toggle Chat"
@@ -438,7 +436,6 @@ export function RoomNavItem({
}
>
{screenSize === ScreenSize.Mobile && (
-
+
)}
diff --git a/src/app/features/room-settings/general/General.tsx b/src/app/features/room-settings/general/General.tsx
index e29fe2da..15157304 100644
--- a/src/app/features/room-settings/general/General.tsx
+++ b/src/app/features/room-settings/general/General.tsx
@@ -15,7 +15,6 @@ import {
} from '../../common-settings/general';
import { useRoomCreators } from '../../../hooks/useRoomCreators';
import { useRoomPermissions } from '../../../hooks/useRoomPermissions';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
type GeneralProps = {
requestClose: () => void;
@@ -36,7 +35,7 @@ export function General({ requestClose }: GeneralProps) {
-
+
diff --git a/src/app/features/room-settings/permissions/Permissions.tsx b/src/app/features/room-settings/permissions/Permissions.tsx
index d513dda9..7572a71b 100644
--- a/src/app/features/room-settings/permissions/Permissions.tsx
+++ b/src/app/features/room-settings/permissions/Permissions.tsx
@@ -9,7 +9,6 @@ import { usePermissionGroups } from './usePermissionItems';
import { PermissionGroups, Powers, PowersEditor } from '../../common-settings/permissions';
import { useRoomCreators } from '../../../hooks/useRoomCreators';
import { useRoomPermissions } from '../../../hooks/useRoomPermissions';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
type PermissionsProps = {
requestClose: () => void;
@@ -46,7 +45,7 @@ export function Permissions({ requestClose }: PermissionsProps) {
-
+
diff --git a/src/app/features/room/CallChatView.tsx b/src/app/features/room/CallChatView.tsx
index fe40eb50..4a10fceb 100644
--- a/src/app/features/room/CallChatView.tsx
+++ b/src/app/features/room/CallChatView.tsx
@@ -6,7 +6,6 @@ import { Page, PageHeader } from '../../components/page';
import { callChatAtom } from '../../state/callEmbed';
import { RoomView } from './RoomView';
import { ScreenSize, useScreenSizeContext } from '../../hooks/useScreenSize';
-import { PhoneHit } from '../../styles/PhoneHit.css';
export function CallChatView() {
const { eventId } = useParams();
@@ -43,7 +42,6 @@ export function CallChatView() {
>
{(triggerRef) => (
{(triggerRef) => (
setPeopleDrawer(false)}
@@ -361,7 +359,6 @@ export function MembersDrawer({ room, members }: MembersDrawerProps) {
virtualizer.scrollToOffset(0)}
variant="Surface"
radii="Pill"
diff --git a/src/app/features/room/RoomInput.tsx b/src/app/features/room/RoomInput.tsx
index 2d63cbf1..257e88ad 100644
--- a/src/app/features/room/RoomInput.tsx
+++ b/src/app/features/room/RoomInput.tsx
@@ -116,7 +116,6 @@ import { useTheme } from '../../hooks/useTheme';
import { useRoomCreatorsTag } from '../../hooks/useRoomCreatorsTag';
import { usePowerLevelTags } from '../../hooks/usePowerLevelTags';
import { useComposingCheck } from '../../hooks/useComposingCheck';
-import { PhoneHitSpread24, PhoneHitSpread32 } from '../../styles/PhoneHit.css';
interface RoomInputProps {
editor: Editor;
@@ -606,7 +605,6 @@ export const RoomInput = forwardRef(
style={{ padding: `${config.space.S200} ${config.space.S300} 0` }}
>
setReplyDraft(undefined)}
variant="SurfaceVariant"
size="300"
@@ -640,7 +638,6 @@ export const RoomInput = forwardRef(
}
before={
pickFile('*')}
variant="SurfaceVariant"
size="300"
@@ -652,7 +649,6 @@ export const RoomInput = forwardRef(
after={
<>
(
>
{!hideStickerBtn && (
setEmojiBoardTab(EmojiBoardTab.Sticker)}
variant="SurfaceVariant"
@@ -709,7 +704,6 @@ export const RoomInput = forwardRef(
)}
(
)}
{(triggerRef) => (
{(onBack) => (
-
+
@@ -534,7 +532,6 @@ export function RoomViewHeader({ callView }: { callView?: boolean }) {
>
{(triggerRef) => (
{(triggerRef) => (
{(triggerRef) => (
{(triggerRef) => (
(
)}
void;
@@ -109,7 +108,7 @@ export function JumpToTime({ onCancel, onSubmit }: JumpToTimeProps) {
Jump to Time
-
+
diff --git a/src/app/features/room/message/Message.tsx b/src/app/features/room/message/Message.tsx
index a1bc17c9..d82ea8e9 100644
--- a/src/app/features/room/message/Message.tsx
+++ b/src/app/features/room/message/Message.tsx
@@ -86,7 +86,6 @@ import colorMXID from '../../../../util/colorMXID';
import { useSkyInk } from '../../../hooks/useTheme';
import { userColorInk } from '../../scene/skyInk';
import { getPowerTagIconSrc } from '../../../hooks/useMemberPowerTag';
-import { PhoneHitRoom26, PhoneHitSpread32 } from '../../../styles/PhoneHit.css';
export type ReactionHandler = (keyOrMxc: string, shortcode: string) => void;
@@ -112,7 +111,7 @@ export const MessageQuickReactions = as<'div', MessageQuickReactionsProps>(
{recentEmojis.map((emoji) => (
Delete Message
Report Message
(
}
>
(
)}
(
{!isThreadedMessage && (
onReplyClick(ev, true)}
data-event-id={mEvent.getId()}
variant="SurfaceVariant"
@@ -996,7 +990,6 @@ export const Message = as<'div', MessageProps>(
)}
{canEditEvent(mx, mEvent) && onEditId && (
onEditId(mEvent.getId())}
variant="SurfaceVariant"
size="300"
@@ -1162,7 +1155,6 @@ export const Message = as<'div', MessageProps>(
}
>
(
}
>
(
(
}
>
diff --git a/src/app/features/room/message/styles.css.ts b/src/app/features/room/message/styles.css.ts
index 4be501bd..b2d027f6 100644
--- a/src/app/features/room/message/styles.css.ts
+++ b/src/app/features/room/message/styles.css.ts
@@ -1,5 +1,7 @@
-import { style } from '@vanilla-extract/css';
+import { globalStyle, style } from '@vanilla-extract/css';
import { DefaultReset, config, toRem } from 'folds';
+import { ICON_BUTTON_CLASS } from '../../../../phoneGlyph.css';
+import { MOBILE_BREAKPOINT } from '../../../hooks/useScreenSize';
export const MessageBase = style({
position: 'relative',
@@ -24,6 +26,10 @@ export const MessageOptionsBar = style([
},
]);
+globalStyle(`${MessageOptionsBar} .${ICON_BUTTON_CLASS}`, {
+ '@media': { [`screen and (max-width: ${MOBILE_BREAKPOINT}px)`]: { margin: 9 } },
+});
+
export const BubbleAvatarBase = style({
paddingTop: 0,
});
diff --git a/src/app/features/room/reaction-viewer/ReactionViewer.tsx b/src/app/features/room/reaction-viewer/ReactionViewer.tsx
index b1a674d9..6c686bc5 100644
--- a/src/app/features/room/reaction-viewer/ReactionViewer.tsx
+++ b/src/app/features/room/reaction-viewer/ReactionViewer.tsx
@@ -28,7 +28,6 @@ import { useMediaAuthentication } from '../../../hooks/useMediaAuthentication';
import { useOpenUserRoomProfile } from '../../../state/hooks/userRoomProfile';
import { useSpaceOptionally } from '../../../hooks/useSpace';
import { getMouseEventCords } from '../../../utils/dom';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
export type ReactionViewerProps = {
room: Room;
@@ -101,7 +100,7 @@ export const ReactionViewer = as<'div', ReactionViewerProps>(
{`Reacted with :${selectedShortcode}:`}
-
+
diff --git a/src/app/features/room/room-pin-menu/RoomPinMenu.tsx b/src/app/features/room/room-pin-menu/RoomPinMenu.tsx
index 25fe835f..9986849f 100644
--- a/src/app/features/room/room-pin-menu/RoomPinMenu.tsx
+++ b/src/app/features/room/room-pin-menu/RoomPinMenu.tsx
@@ -86,7 +86,6 @@ import {
useGetMemberPowerTag,
} from '../../../hooks/useMemberPowerTag';
import { useRoomCreatorsTag } from '../../../hooks/useRoomCreatorsTag';
-import { PhoneHit, PhoneHitSpread26 } from '../../../styles/PhoneHit.css';
type PinnedMessageProps = {
room: Room;
@@ -147,7 +146,6 @@ function PinnedMessage({
{canPinEvent && (
(
Pinned Messages
-
+
diff --git a/src/app/features/scene/SceneViewEntry.tsx b/src/app/features/scene/SceneViewEntry.tsx
index 941b01b3..9282c10b 100644
--- a/src/app/features/scene/SceneViewEntry.tsx
+++ b/src/app/features/scene/SceneViewEntry.tsx
@@ -1,6 +1,5 @@
import React from 'react';
import { Icon, IconButton, Icons } from 'folds';
-import { PhoneHit } from '../../styles/PhoneHit.css';
import { useSceneViewOffered } from '../../hooks/useSceneView';
import { loadSceneView, openSceneView } from './sceneView';
@@ -17,7 +16,6 @@ export function SceneViewEntry() {
};
return (
{
});
describe('the view while its code loads', () => {
- it('shows a Return that closes the view, with the phone tap target', () => {
+ it('shows a Return that closes the view', () => {
const ret = walk(SceneViewLoading()).find((e) => e.props?.['aria-label'] === 'Return');
- expect(String(ret?.props?.className)).toContain(PhoneHit);
(ret?.props?.onClick as () => void)();
expect(held.closed).toBe(1);
});
diff --git a/src/app/features/scene/SceneViewHost.tsx b/src/app/features/scene/SceneViewHost.tsx
index ba299a25..70844d41 100644
--- a/src/app/features/scene/SceneViewHost.tsx
+++ b/src/app/features/scene/SceneViewHost.tsx
@@ -1,7 +1,6 @@
import React, { ComponentType, useEffect, useState } from 'react';
import { createPortal } from 'react-dom';
import { Icon, IconButton, Icons } from 'folds';
-import { PhoneHit } from '../../styles/PhoneHit.css';
import { useSceneViewOffered, useSceneViewState } from '../../hooks/useSceneView';
import { closeSceneView, loadSceneViewOrClose, restoreEntryFocus } from './sceneView';
import * as css from './sceneShell.css';
@@ -23,7 +22,7 @@ export function SceneViewLoading() {
}, []);
return (
{
).toEqual(['Return', 'View', 'Time', 'Sky', 'Place']);
});
- it('every rail icon is an IconButton carrying PhoneHit, with a label and a roving tab stop on Return', () => {
+ it('every rail icon is an IconButton, with a label and a roving tab stop on Return', () => {
const buttons = rail()
.filter((e) => typeof e.props?.label === 'string')
.map((e) =>
- walk((e.type as (p: unknown) => unknown)(e.props)).find(
- (x) => x.props?.className === PhoneHit
- )
+ walk((e.type as (p: unknown) => unknown)(e.props)).find((x) => x.type === IconButton)
);
expect(buttons).toHaveLength(5);
buttons.forEach((b) => expect(b?.props?.['aria-label']).toBeTruthy());
diff --git a/src/app/features/scene/view/SceneView.tsx b/src/app/features/scene/view/SceneView.tsx
index 854320b5..bb4cbd6b 100644
--- a/src/app/features/scene/view/SceneView.tsx
+++ b/src/app/features/scene/view/SceneView.tsx
@@ -1,7 +1,6 @@
import React, { KeyboardEvent, useEffect, useMemo, useRef, useState } from 'react';
import { Icon, IconButton, Icons } from 'folds';
import FocusTrap from 'focus-trap-react';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
import { useRidgeManifest, useSceneViewState } from '../../../hooks/useSceneView';
import { closeSceneView, setSubmenu } from '../sceneView';
import type { Submenu } from '../sceneView';
@@ -23,7 +22,7 @@ export const SUBMENUS: ReadonlyArray<{ id: Submenu; label: string; icon: IconSrc
{ id: 'place', label: 'Place', icon: Icons.Pin },
];
-/** One icon of the rail: 44 px to tap on a phone (PhoneHit). */
+/** One icon of the rail. */
function RailButton({
label,
icon,
@@ -42,7 +41,6 @@ function RailButton({
return (
{screenSize === ScreenSize.Mobile && (
-
+
)}
diff --git a/src/app/features/settings/about/About.tsx b/src/app/features/settings/about/About.tsx
index 19407bdf..9ec74305 100644
--- a/src/app/features/settings/about/About.tsx
+++ b/src/app/features/settings/about/About.tsx
@@ -8,7 +8,6 @@ import { LogoMark } from '../../../components/logo/logoMark.css';
import RatatoskrSVG from '../../../../../public/res/svg/ratatoskr.svg';
import { clearCacheAndReload } from '../../../../client/initMatrix';
import { useMatrixClient } from '../../../hooks/useMatrixClient';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
type AboutProps = {
requestClose: () => void;
@@ -26,7 +25,7 @@ export function About({ requestClose }: AboutProps) {
-
+
diff --git a/src/app/features/settings/account/Account.tsx b/src/app/features/settings/account/Account.tsx
index 77ee8671..c4b56e47 100644
--- a/src/app/features/settings/account/Account.tsx
+++ b/src/app/features/settings/account/Account.tsx
@@ -5,7 +5,6 @@ import { MatrixId } from './MatrixId';
import { Profile } from './Profile';
import { ContactInformation } from './ContactInfo';
import { IgnoredUserList } from './IgnoredUserList';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
type AccountProps = {
requestClose: () => void;
@@ -21,7 +20,7 @@ export function Account({ requestClose }: AccountProps) {
-
+
diff --git a/src/app/features/settings/account/IgnoredUserList.tsx b/src/app/features/settings/account/IgnoredUserList.tsx
index 791a407b..98db9459 100644
--- a/src/app/features/settings/account/IgnoredUserList.tsx
+++ b/src/app/features/settings/account/IgnoredUserList.tsx
@@ -8,7 +8,6 @@ import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
import { isUserId } from '../../../utils/matrix';
import { useIgnoredUsers } from '../../../hooks/useIgnoredUsers';
import { useAlive } from '../../../hooks/useAlive';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
function IgnoreUserInput({ userList }: { userList: string[] }) {
const mx = useMatrixClient();
@@ -68,7 +67,6 @@ function IgnoreUserInput({ userList }: { userList: string[] }) {
userId &&
!ignoring && (
Remove Avatar
setAlertRemove(false)}
radii="300"
@@ -279,7 +277,6 @@ function ProfileDisplayName({ profile, userId }: ProfileProps) {
hasChanges &&
!changingDisplayName && (
void;
@@ -52,7 +51,7 @@ export function DeveloperTools({ requestClose }: DeveloperToolsProps) {
-
+
diff --git a/src/app/features/settings/devices/DeviceTile.tsx b/src/app/features/settings/devices/DeviceTile.tsx
index c4912dc0..71b684f5 100644
--- a/src/app/features/settings/devices/DeviceTile.tsx
+++ b/src/app/features/settings/devices/DeviceTile.tsx
@@ -29,7 +29,6 @@ import { LogoutDialog } from '../../../components/LogoutDialog';
import { stopPropagation } from '../../../utils/keyboard';
import { useSetting } from '../../../state/hooks/settings';
import { settingsAtom } from '../../../state/settings';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
export function DeviceTilePlaceholder() {
return (
@@ -289,7 +288,6 @@ export function DeviceTile({
-
+
diff --git a/src/app/features/settings/devices/Verification.tsx b/src/app/features/settings/devices/Verification.tsx
index c09dff55..6c7eab17 100644
--- a/src/app/features/settings/devices/Verification.tsx
+++ b/src/app/features/settings/devices/Verification.tsx
@@ -35,7 +35,6 @@ import { stopPropagation } from '../../../utils/keyboard';
import { useAuthMetadata } from '../../../hooks/useAuthMetadata';
import { withSearchParam } from '../../../pages/pathUtils';
import { useAccountManagementActions } from '../../../hooks/useAccountManagement';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
type VerificationStatusBadgeProps = {
verificationStatus: VerificationStatus;
@@ -289,7 +288,6 @@ export function DeviceVerificationOptions() {
return (
<>
void;
@@ -31,7 +30,7 @@ export function EmojisStickers({ requestClose }: EmojisStickersProps) {
-
+
diff --git a/src/app/features/settings/emojis-stickers/GlobalPacks.tsx b/src/app/features/settings/emojis-stickers/GlobalPacks.tsx
index 38647b13..a9288728 100644
--- a/src/app/features/settings/emojis-stickers/GlobalPacks.tsx
+++ b/src/app/features/settings/emojis-stickers/GlobalPacks.tsx
@@ -43,7 +43,6 @@ import { allRoomsAtom } from '../../../state/room-list/roomList';
import { AccountDataEvent } from '../../../../types/matrix/accountData';
import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
import { stopPropagation } from '../../../utils/keyboard';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
function GlobalPackSelector({
packs,
@@ -369,7 +368,6 @@ export function GlobalPacks({ onViewPack }: GlobalPacksProps) {
{removed ? (
) : (
;
@@ -496,7 +495,6 @@ function DateHint({ hasChanges, handleReset }: DateHintProps) {
>
{hasChanges ? (
) : (
-
+
diff --git a/src/app/features/settings/notifications/KeywordMessages.tsx b/src/app/features/settings/notifications/KeywordMessages.tsx
index b77cae21..f3af28ae 100644
--- a/src/app/features/settings/notifications/KeywordMessages.tsx
+++ b/src/app/features/settings/notifications/KeywordMessages.tsx
@@ -15,7 +15,6 @@ import {
} from '../../../hooks/useNotificationMode';
import { NotificationModeSwitcher } from './NotificationModeSwitcher';
import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
const NOTIFY_MODE_OPS: NotificationModeOptions = {
highlight: true,
@@ -76,7 +75,6 @@ function KeywordInput() {
keyword &&
!addingKeyword && (
void;
@@ -24,7 +23,7 @@ export function Notifications({ requestClose }: NotificationsProps) {
-
+
diff --git a/src/app/features/space-settings/SpaceSettings.tsx b/src/app/features/space-settings/SpaceSettings.tsx
index 1030972f..b5fefc93 100644
--- a/src/app/features/space-settings/SpaceSettings.tsx
+++ b/src/app/features/space-settings/SpaceSettings.tsx
@@ -17,7 +17,6 @@ import { Members } from '../common-settings/members';
import { DeveloperTools } from '../common-settings/developer-tools';
import { General } from './general';
import { Permissions } from './permissions';
-import { PhoneHit } from '../../styles/PhoneHit.css';
type SpaceSettingsMenuItem = {
page: SpaceSettingsPage;
@@ -118,7 +117,7 @@ export function SpaceSettings({ initialPage, requestClose }: SpaceSettingsProps)
{screenSize === ScreenSize.Mobile && (
-
+
)}
diff --git a/src/app/features/space-settings/general/General.tsx b/src/app/features/space-settings/general/General.tsx
index e99a4906..72040632 100644
--- a/src/app/features/space-settings/general/General.tsx
+++ b/src/app/features/space-settings/general/General.tsx
@@ -13,7 +13,6 @@ import {
} from '../../common-settings/general';
import { useRoomCreators } from '../../../hooks/useRoomCreators';
import { useRoomPermissions } from '../../../hooks/useRoomPermissions';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
type GeneralProps = {
requestClose: () => void;
@@ -34,7 +33,7 @@ export function General({ requestClose }: GeneralProps) {
-
+
diff --git a/src/app/features/space-settings/permissions/Permissions.tsx b/src/app/features/space-settings/permissions/Permissions.tsx
index d513dda9..7572a71b 100644
--- a/src/app/features/space-settings/permissions/Permissions.tsx
+++ b/src/app/features/space-settings/permissions/Permissions.tsx
@@ -9,7 +9,6 @@ import { usePermissionGroups } from './usePermissionItems';
import { PermissionGroups, Powers, PowersEditor } from '../../common-settings/permissions';
import { useRoomCreators } from '../../../hooks/useRoomCreators';
import { useRoomPermissions } from '../../../hooks/useRoomPermissions';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
type PermissionsProps = {
requestClose: () => void;
@@ -46,7 +45,7 @@ export function Permissions({ requestClose }: PermissionsProps) {
-
+
diff --git a/src/app/pages/auth/ServerPicker.tsx b/src/app/pages/auth/ServerPicker.tsx
index 393cf34e..a2a78106 100644
--- a/src/app/pages/auth/ServerPicker.tsx
+++ b/src/app/pages/auth/ServerPicker.tsx
@@ -23,7 +23,6 @@ import FocusTrap from 'focus-trap-react';
import { useDebounce } from '../../hooks/useDebounce';
import { stopPropagation } from '../../utils/keyboard';
-import { PhoneHit } from '../../styles/PhoneHit.css';
export function ServerPicker({
server,
@@ -130,7 +129,6 @@ export function ServerPicker({
}
>
();
@@ -97,7 +96,6 @@ function UsernameHint({ server }: { server: string }) {
}
>
{(onBack) => (
-
+
)}
diff --git a/src/app/pages/client/explore/Explore.tsx b/src/app/pages/client/explore/Explore.tsx
index 6944c9f7..afb9103f 100644
--- a/src/app/pages/client/explore/Explore.tsx
+++ b/src/app/pages/client/explore/Explore.tsx
@@ -37,7 +37,6 @@ import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
import { useNavToActivePathMapper } from '../../../hooks/useNavToActivePathMapper';
import { PageNav, PageNavContent, PageNavHeader } from '../../../components/page';
import { stopPropagation } from '../../../utils/keyboard';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
export function AddServer() {
const mx = useMatrixClient();
@@ -98,7 +97,6 @@ export function AddServer() {
Add Server
setDialog(false)}
radii="300"
diff --git a/src/app/pages/client/explore/Featured.tsx b/src/app/pages/client/explore/Featured.tsx
index c28fad0a..f056cbb5 100644
--- a/src/app/pages/client/explore/Featured.tsx
+++ b/src/app/pages/client/explore/Featured.tsx
@@ -18,7 +18,6 @@ import * as css from './style.css';
import { useRoomNavigate } from '../../../hooks/useRoomNavigate';
import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize';
import { BackRouteHandler } from '../../../components/BackRouteHandler';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
export function FeaturedRooms() {
const { featuredCommunities } = useClientConfig();
@@ -34,7 +33,7 @@ export function FeaturedRooms() {
{(onBack) => (
-
+
)}
diff --git a/src/app/pages/client/explore/Server.tsx b/src/app/pages/client/explore/Server.tsx
index 036c6488..48f267cc 100644
--- a/src/app/pages/client/explore/Server.tsx
+++ b/src/app/pages/client/explore/Server.tsx
@@ -45,7 +45,6 @@ import { getMxIdServer } from '../../../utils/matrix';
import { stopPropagation } from '../../../utils/keyboard';
import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize';
import { BackRouteHandler } from '../../../components/BackRouteHandler';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
const useServerSearchParams = (searchParams: URLSearchParams): ExploreServerPathSearchParams =>
useMemo(
@@ -500,7 +499,7 @@ export function PublicRooms() {
{screenSize === ScreenSize.Mobile && (
{(onBack) => (
-
+
)}
diff --git a/src/app/pages/client/home/CreateRoom.tsx b/src/app/pages/client/home/CreateRoom.tsx
index 8e277889..fddd75aa 100644
--- a/src/app/pages/client/home/CreateRoom.tsx
+++ b/src/app/pages/client/home/CreateRoom.tsx
@@ -12,7 +12,6 @@ import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize';
import { BackRouteHandler } from '../../../components/BackRouteHandler';
import { CreateRoomForm } from '../../../features/create-room';
import { useRoomNavigate } from '../../../hooks/useRoomNavigate';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
export function HomeCreateRoom() {
const screenSize = useScreenSizeContext();
@@ -26,7 +25,7 @@ export function HomeCreateRoom() {
{(onBack) => (
-
+
)}
diff --git a/src/app/pages/client/home/Search.tsx b/src/app/pages/client/home/Search.tsx
index aa454d2c..d5ddfb77 100644
--- a/src/app/pages/client/home/Search.tsx
+++ b/src/app/pages/client/home/Search.tsx
@@ -5,7 +5,6 @@ import { MessageSearch } from '../../../features/message-search';
import { useHomeRooms } from './useHomeRooms';
import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize';
import { BackRouteHandler } from '../../../components/BackRouteHandler';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
export function HomeSearch() {
const scrollRef = useRef(null);
@@ -20,7 +19,7 @@ export function HomeSearch() {
{screenSize === ScreenSize.Mobile && (
{(onBack) => (
-
+
)}
diff --git a/src/app/pages/client/inbox/Invites.tsx b/src/app/pages/client/inbox/Invites.tsx
index 4d1580af..ca26bac3 100644
--- a/src/app/pages/client/inbox/Invites.tsx
+++ b/src/app/pages/client/inbox/Invites.tsx
@@ -63,7 +63,6 @@ import { useIgnoredUsers } from '../../../hooks/useIgnoredUsers';
import { useReportRoomSupported } from '../../../hooks/useReportRoomSupported';
import { useSetting } from '../../../state/hooks/settings';
import { settingsAtom } from '../../../state/settings';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
const COMPACT_CARD_WIDTH = 548;
@@ -746,7 +745,7 @@ export function Invites() {
{screenSize === ScreenSize.Mobile && (
{(onBack) => (
-
+
)}
diff --git a/src/app/pages/client/inbox/Notifications.tsx b/src/app/pages/client/inbox/Notifications.tsx
index 8fddba44..9592224f 100644
--- a/src/app/pages/client/inbox/Notifications.tsx
+++ b/src/app/pages/client/inbox/Notifications.tsx
@@ -97,7 +97,6 @@ import {
} from '../../../hooks/useMemberPowerTag';
import { useRoomCreatorsTag } from '../../../hooks/useRoomCreatorsTag';
import { useRoomCreators } from '../../../hooks/useRoomCreators';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
type RoomNotificationsGroup = {
roomId: string;
@@ -643,7 +642,7 @@ export function Notifications() {
{screenSize === ScreenSize.Mobile && (
{(onBack) => (
-
+
)}
@@ -695,7 +694,6 @@ export function Notifications() {
onVisibilityChange={handleScrollTopVisibility}
>
virtualizer.scrollToOffset(0)}
variant="SurfaceVariant"
radii="Pill"
diff --git a/src/app/pages/client/space/Search.tsx b/src/app/pages/client/space/Search.tsx
index a2849ab8..017262b5 100644
--- a/src/app/pages/client/space/Search.tsx
+++ b/src/app/pages/client/space/Search.tsx
@@ -11,7 +11,6 @@ import { roomToParentsAtom } from '../../../state/room/roomToParents';
import { useMatrixClient } from '../../../hooks/useMatrixClient';
import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize';
import { BackRouteHandler } from '../../../components/BackRouteHandler';
-import { PhoneHit } from '../../../styles/PhoneHit.css';
export function SpaceSearch() {
const mx = useMatrixClient();
@@ -35,7 +34,7 @@ export function SpaceSearch() {
{screenSize === ScreenSize.Mobile && (
{(onBack) => (
-
+
)}
diff --git a/src/app/phoneGlyph.test.ts b/src/app/phoneGlyph.test.ts
index 6969da0e..1f31dae6 100644
--- a/src/app/phoneGlyph.test.ts
+++ b/src/app/phoneGlyph.test.ts
@@ -1,64 +1,15 @@
import { readFileSync } from 'fs';
import { describe, expect, it } from 'vitest';
-import { MOBILE_BREAKPOINT } from './hooks/useScreenSize';
-import { emitted } from './phoneHitTestKit';
import { ICON_BUTTON_CLASS, PHONE_GLYPHS } from '../phoneGlyph.css';
-const foldsJs = readFileSync(`${process.cwd()}/node_modules/folds/dist/index.js`, 'utf8');
const foldsCss = readFileSync(`${process.cwd()}/node_modules/folds/dist/style.css`, 'utf8');
-/** The px folds draws an Icon class at: its width variable's rem value, at the 16 px root. */
-const foldsPx = (cls: string) => {
- const v = foldsCss.match(new RegExp(`\\.${cls} \\{\\s*width: var\\((--[\\w-]+)\\)`))?.[1];
- const rem = v && foldsCss.match(new RegExp(`${v}: ([\\d.]+)rem`))?.[1];
- return rem ? Number(rem) * 16 : undefined;
-};
-
-describe('phone glyphs inside IconButtons', () => {
- it("name folds' own classes: the IconButton base class and one Icon class per size", () => {
- expect(foldsJs).toContain(
- `var IconButton$1 = createRuntimeFn({ defaultClassName: "${ICON_BUTTON_CLASS} `
- );
- const iconSizes = foldsJs.match(
- /var Icon\$1 = createRuntimeFn\(\{[^\n]*variantClassNames: \{ size: \{([^}]*)\}/
- )?.[1];
- expect(iconSizes).toBeDefined();
- Object.entries(PHONE_GLYPHS).forEach(([size, { cls }]) =>
- expect(iconSizes).toContain(`"${size}": "${cls}"`)
- );
- });
-
- it("start from the px folds draws each Icon size at (the scale's divisor is not a guess)", () =>
- Object.values(PHONE_GLYPHS).forEach(({ cls, px }) => expect(foldsPx(cls)).toBe(px)));
-
- it('draw the folds Icon px (16 18 20 22 24) at 22..28 px, never smaller, never past the smallest button box', () => {
- // folds IconButton padding is 4 px a side at the smallest size, so its box is the glyph plus 8.
- Object.values(PHONE_GLYPHS).forEach(({ px, phonePx }) => {
- expect(phonePx).toBeGreaterThanOrEqual(22);
- expect(phonePx).toBeLessThanOrEqual(28);
+describe('phoneGlyph folds classes', () => {
+ it('references IconButton and Icon size classes present in folds/dist/style.css', () => {
+ expect(foldsCss).toMatch(new RegExp(`\\.${ICON_BUTTON_CLASS}\\b`));
+ Object.values(PHONE_GLYPHS).forEach(({ cls, px, phonePx }) => {
+ expect(foldsCss).toMatch(new RegExp(`\\.${cls}\\b`));
expect(phonePx).toBeGreaterThan(px);
- expect(phonePx).toBeLessThanOrEqual(px + 8);
- });
- });
-
- it('are a paint-time scale on phones only: no size, margin or padding, and no rule outside the phone query', async () => {
- const css = await emitted('../phoneGlyph.css.ts');
- const phone = `@media screen and (max-width: ${MOBILE_BREAKPOINT}px)`;
- expect(
- css.replace(new RegExp(`${phone.replace(/[()]/g, '\\$&')} \\{\\n[\\s\\S]*?\\n\\}`, 'g'), '')
- ).not.toMatch(/\.brs7ce5/);
- Object.entries(PHONE_GLYPHS).forEach(([size, { cls, px, phonePx }]) => {
- const rule = css.match(
- new RegExp(`\\.${ICON_BUTTON_CLASS} > \\.${cls} \\{\\n([^}]*)\\}`)
- )?.[1];
- expect(rule, `rule for Icon size ${size}`).toBeDefined();
- expect(
- rule!
- .trim()
- .split('\n')
- .map((l) => l.trim().split(':')[0])
- ).toEqual(['scale']);
- expect(Number(rule!.match(/scale: ([\d.]+)/)![1])).toBeCloseTo(phonePx / px, 6);
});
});
});
diff --git a/src/app/phoneHit.call.test.ts b/src/app/phoneHit.call.test.ts
deleted file mode 100644
index 56971b05..00000000
--- a/src/app/phoneHit.call.test.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { describe, it } from 'vitest';
-import { expectPhoneHitClasses, expectSizeTie } from './phoneHitTestKit';
-
-// Every IconButton of the call bars carries the phone hit-area variant of its drawn size, in source order
-// (mic, sound, video, share, chat; the menu button; the call-status mic, sound, video, share).
-describe('icon buttons in the call controls', () => {
- it.each([
- ['features/call/Controls.tsx', Array(5).fill('PhoneHitSpread40')],
- ['features/call/CallControls.tsx', ['PhoneHitSpread40']],
- ['features/call-status/CallControl.tsx', Array(4).fill('PhoneHitSpread26')],
- ])('%s', (file, want) => {
- expectPhoneHitClasses(file as string, want as string[]);
- expectSizeTie(file as string);
- });
-});
diff --git a/src/app/phoneHit.commonSettings.test.ts b/src/app/phoneHit.commonSettings.test.ts
deleted file mode 100644
index fdb2c4e0..00000000
--- a/src/app/phoneHit.commonSettings.test.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { describe, it } from 'vitest';
-import { expectPhoneHitClasses, expectSizeTie } from './phoneHitTestKit';
-
-// Every IconButton under features/common-settings, in source order. Header close buttons are alone at the
-// header end (the title beside them is text), the dialog close buttons are alone in their Header, the
-// scroll-to-top button floats alone, and the RoomPacks pair is a ternary (only one renders): all PhoneHit.
-const files: [string, string[]][] = [
- ['features/common-settings/members/Members.tsx', ['PhoneHit', 'PhoneHit']],
- ['features/common-settings/developer-tools/SendRoomEvent.tsx', ['PhoneHit']],
- ['features/common-settings/developer-tools/StateEventEditor.tsx', ['PhoneHit']],
- ['features/common-settings/developer-tools/DevelopTools.tsx', ['PhoneHit']],
- ['features/common-settings/permissions/PowersEditor.tsx', ['PhoneHit']],
- ['features/common-settings/emojis-stickers/EmojisStickers.tsx', ['PhoneHit']],
- ['features/common-settings/emojis-stickers/RoomPacks.tsx', ['PhoneHit', 'PhoneHit']],
- ['features/common-settings/general/RoomEncryption.tsx', ['PhoneHit']],
- ['features/common-settings/general/RoomUpgrade.tsx', ['PhoneHit']],
-];
-
-describe.each(files)('phone hit area: %s', (file, want) => {
- it('carries the variant its drawn size and neighbours call for', () => {
- expectPhoneHitClasses(file, want);
- });
- it('names a size that matches what it draws', () => {
- expectSizeTie(file);
- });
-});
diff --git a/src/app/phoneHit.content.test.ts b/src/app/phoneHit.content.test.ts
deleted file mode 100644
index 741a5828..00000000
--- a/src/app/phoneHit.content.test.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { describe, it } from 'vitest';
-import { expectPhoneHitClasses, expectSizeTie } from './phoneHitTestKit';
-
-describe('icon buttons in message content and data editors', () => {
- // The class each IconButton must carry, in source order.
- const expected: Record = {
- // mute toggle, 16 px icon + 8 padding = 24 px, 8 px from the volume slider (tappable)
- 'components/message/content/AudioContent.tsx': ['PhoneHitSpread24'],
- // download, alone at the end of the header row (26 px)
- 'components/message/FileHeader.tsx': ['PhoneHit'],
- // code block expand/collapse, 24 px, 8 px from the Copy chip
- 'plugins/react-custom-html-parser.tsx': ['PhoneHitSpread24'],
- // close at the header end, alone
- 'components/AccountDataEditor.tsx': ['PhoneHit'],
- 'components/image-pack-view/ImagePackView.tsx': ['PhoneHit'],
- };
-
- it.each(Object.entries(expected))(
- '%s: each IconButton carries its own PhoneHit class',
- (file, want) => expectPhoneHitClasses(file, want)
- );
-
- it.each(Object.keys(expected))('%s: a sized variant matches the drawn size', (file) =>
- expectSizeTie(file)
- );
-});
diff --git a/src/app/phoneHit.coverage.test.ts b/src/app/phoneHit.coverage.test.ts
deleted file mode 100644
index f87b9a1a..00000000
--- a/src/app/phoneHit.coverage.test.ts
+++ /dev/null
@@ -1,80 +0,0 @@
-import { readdirSync, readFileSync } from 'fs';
-import { describe, expect, it } from 'vitest';
-import {
- classLists,
- emitted,
- expectPhoneHitClasses,
- uncoveredIconButtons,
-} from './phoneHitTestKit';
-
-// Every IconButton under src carries a PhoneHit class, or is named here with the reason it has none. The per-group
-// suites pin which variant a listed file's buttons carry; this one sees files no group lists, so a new bare
-// IconButton fails here instead of shipping with a sub-44px phone hit area.
-const EXEMPT: Record = {
- 'app/features/estate/EstateNavigator.tsx': {
- indices: [0],
- why: 'Find a room sits in a css.Targets row that already gives it a 44 px phone target',
- },
- 'app/features/lobby/LobbyHeader.tsx': {
- indices: [1],
- why: 'Members button, hidden on mobile',
- },
-};
-
-// Every script file, not only .tsx: an IconButton can be rendered from a .ts or .js module too. A file that never
-// says IconButton is skipped; one that does is parsed and every mention of it must be a tag the guard can check.
-const SCRIPT = /\.(?:[cm]?[jt]s|[jt]sx)$/;
-const sourceFiles = (dir: string): string[] =>
- readdirSync(`${process.cwd()}/src/${dir}`, { withFileTypes: true }).flatMap((e) => {
- if (e.isDirectory()) return sourceFiles(`${dir}${e.name}/`);
- return SCRIPT.test(e.name) ? [`${dir}${e.name}`] : [];
- });
-
-describe('phone hit areas: every IconButton is covered or named', () => {
- const scanned = sourceFiles('').flatMap((file) => {
- const src = readFileSync(`${process.cwd()}/src/${file}`, 'utf8');
- return src.includes('IconButton') ? [{ file, ...uncoveredIconButtons(src, file) }] : [];
- });
-
- it('lists exactly the IconButtons without a PhoneHit class', () => {
- expect(scanned.length).toBeGreaterThan(0);
- const bare: Record = {};
- scanned.forEach(({ file, bare: missing }) => {
- if (missing.length > 0) bare[file] = missing;
- });
- expect(bare).toEqual(
- Object.fromEntries(Object.entries(EXEMPT).map(([f, e]) => [f, e.indices]))
- );
- });
-
- // An IconButton passed as a value (as={IconButton}), re-bound, re-exported or destructured cannot be tied to a
- // PhoneHit class, so the guard names it instead of passing over it. Render it as a tag, or extend the
- // guard to read the new form.
- it('finds no IconButton the guard cannot check', () => {
- const unhandled: Record = {};
- scanned.forEach(({ file, unhandled: found }) => {
- if (found.length > 0) unhandled[file] = found;
- });
- expect(unhandled).toEqual({});
- });
-});
-
-// UrlPreviewCard's arrows are absolutely positioned by their own class; PhoneHit would set position: relative on them
-// and win or lose by stylesheet order, so they carry the variant that adds only the hit area.
-describe('phone hit area of a button positioned by its own class', () => {
- it('the arrows carry PhoneHitInPlace', () => {
- expectPhoneHitClasses('components/url-preview/UrlPreviewCard.tsx', [
- 'PhoneHitInPlace',
- 'PhoneHitInPlace',
- ]);
- });
-
- it('PhoneHitInPlace draws the ::after and sets no position of its own', async () => {
- const lists = await classLists('styles/PhoneHit.css.ts');
- expect(lists.PhoneHitInPlace).toHaveLength(1);
- const css = await emitted('styles/PhoneHit.css.ts');
- const rules = [...css.matchAll(/^([^{}\n]*PhoneHitInPlace__[^{}\n]*) \{$/gm)].map((m) => m[1]);
- expect(rules.length).toBeGreaterThan(0);
- rules.forEach((sel) => expect(sel).toMatch(/::after$/));
- });
-});
diff --git a/src/app/phoneHit.dialogs.test.ts b/src/app/phoneHit.dialogs.test.ts
deleted file mode 100644
index 8b3416a5..00000000
--- a/src/app/phoneHit.dialogs.test.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { describe, it } from 'vitest';
-import { expectPhoneHitClasses, expectSizeTie } from './phoneHitTestKit';
-
-// Dialog and prompt close buttons: each is a 32 px button (24 px Icon + 8 px padding) alone at the end of a
-// header whose title is not tappable, so the plain PhoneHit; no neighbour to spread from, no clipping container.
-describe('icon buttons in dialogs and prompts', () => {
- const expected: Record = {
- 'features/create-space/CreateSpaceModal.tsx': ['PhoneHit'],
- 'features/create-room/CreateRoomModal.tsx': ['PhoneHit'],
- 'features/add-existing/AddExisting.tsx': ['PhoneHit'],
- 'components/room-topic-viewer/RoomTopicViewer.tsx': ['PhoneHit'],
- 'components/leave-room-prompt/LeaveRoomPrompt.tsx': ['PhoneHit'],
- 'components/leave-space-prompt/LeaveSpacePrompt.tsx': ['PhoneHit'],
- 'components/event-readers/EventReaders.tsx': ['PhoneHit'],
- 'components/invite-user-prompt/InviteUserPrompt.tsx': ['PhoneHit'],
- 'components/join-address-prompt/JoinAddressPrompt.tsx': ['PhoneHit'], // join cancel
- 'components/user-profile/PowerChip.tsx': ['PhoneHit', 'PhoneHit'], // self demotion, shared power
- };
-
- it.each(Object.entries(expected))(
- '%s: each IconButton carries its own PhoneHit class',
- (file, want) => expectPhoneHitClasses(file, want)
- );
-
- it.each(Object.keys(expected))('%s: a sized variant matches the drawn size', (file) =>
- expectSizeTie(file)
- );
-});
diff --git a/src/app/phoneHit.editor.test.ts b/src/app/phoneHit.editor.test.ts
deleted file mode 100644
index d758662d..00000000
--- a/src/app/phoneHit.editor.test.ts
+++ /dev/null
@@ -1,119 +0,0 @@
-import { describe, expect, it } from 'vitest';
-import { MOBILE_BREAKPOINT } from './hooks/useScreenSize';
-import {
- classLists,
- emitted,
- expectPhoneHitClasses,
- expectSizeTie,
- iconButtonTags,
- readSource,
- rulesFor,
- type SizeAllow,
-} from './phoneHitTestKit';
-
-describe('icon buttons in the editor, emoji board, upload cards and client root', () => {
- // The class each IconButton must carry, in source order.
- const expected: Record = {
- 'components/editor/Toolbar.tsx': [
- 'PhoneHitSpread36', // mark button: size 400 + 20 px icon, in a row 4 px apart
- 'PhoneHitSpread36', // block button, same row
- 'PhoneHitRoom36', // heading 1, inside the heading Menu (overflow hidden)
- 'PhoneHitRoom36', // heading 2
- 'PhoneHitRoom36', // heading 3
- 'PhoneHit', // heading opener: two 20 px icons, 56 px wide, only its height is short
- 'PhoneHit', // Exit chip: text label, wider than 44 px
- 'PhoneHit', // markdown toggle, alone at the end of the toolbar
- ],
- // A column of 40 px buttons 4 px apart (the stack's gap="100", pinned below): there is no vertical variant, so only
- // PhoneHit; the 44 px areas then touch with no overlap.
- 'components/emoji-board/components/Sidebar.tsx': ['PhoneHit'],
- // Both cards put a Retry chip beside the cancel button when the upload failed.
- 'components/upload-card/UploadCardRenderer.tsx': ['PhoneHitSpread28'],
- 'components/upload-card/CompactUploadCardRenderer.tsx': ['PhoneHitSpread28'],
- 'pages/client/ClientRoot.tsx': ['PhoneHit'], // alone, absolute in the corner
- };
-
- const sizeAllow: SizeAllow = {};
-
- it.each(Object.entries(expected))(
- '%s: each IconButton carries its own PhoneHit class',
- (file, want) => expectPhoneHitClasses(file, want)
- );
-
- it.each(Object.keys(expected))('%s: Spread and Room variants name the size they draw', (file) =>
- expectSizeTie(file, sizeAllow)
- );
-});
-
-/** The JSX element opened at `open` (index of its ``: nesting is counted, not guessed (no self-closing Box here). */
-const boxSpan = (src: string, open: number) => {
- const marks = [...src.slice(open).matchAll(/])|<\/Box>/g)];
- const depths = marks.map((m, i) =>
- marks.slice(0, i + 1).reduce((d, x) => d + (x[0] === '' ? -1 : 1), 0)
- );
- const end = depths.indexOf(0);
- if (end === -1) throw new Error('unbalanced ');
- return [open, open + (marks[end].index ?? 0) + marks[end][0].length] as const;
-};
-
-describe('the estate navigator find button', () => {
- // The only IconButton there needs no PhoneHit: every button in the navigator header is 44 px on a phone because
- // the Targets class sets a min size, and the button sits inside the Box that carries that class.
- it('is 44 px by the Targets class instead', async () => {
- const src = readSource('features/estate/EstateNavigator.tsx');
- const tags = iconButtonTags(src);
- expect(tags).toHaveLength(1);
- expect(tags[0]).not.toMatch(/PhoneHit/);
-
- const header = src.indexOf('');
- const boxStart = src.indexOf('', boxStart))).toMatch(/className=\{css\.Targets\}/);
- const button = src.indexOf(' {
- // PhoneHit makes the button position: relative on a phone; the inline style wins over a class, so the corner
- // button stays absolute and its ::after anchors to it.
- it('ClientRoot keeps its corner button absolutely positioned inline', () => {
- const [tag] = iconButtonTags(readSource('pages/client/ClientRoot.tsx'));
- expect(tag).toMatch(/style=\{\{[^}]*position:\s*'absolute'/);
- });
-
- // A 40 px button with a 44 px area, in a column 4 px apart: the areas touch and do not overlap. A smaller gap
- // overlaps them, a larger one leaves a dead strip.
- it('the emoji sidebar stack keeps its 4 px gap', () => {
- const src = readSource('components/emoji-board/components/Sidebar.tsx');
- const stack = src.slice(
- src.indexOf('export const SidebarStack'),
- src.indexOf('export function SidebarDivider')
- );
- expect(stack).toMatch(/direction="Column"/);
- expect(stack).toMatch(/gap="100"/);
- });
-
- // The same column rhythm in the scrolling Sidebar: its 40 px buttons sit in a Column of Box gap="100" (4 px).
- it('the emoji sidebar column keeps its 4 px gap', () => {
- const src = readSource('components/emoji-board/components/Sidebar.tsx');
- const column = src.slice(
- src.indexOf('export function Sidebar('),
- src.indexOf('export const SidebarStack')
- );
- expect(column).toMatch(
- /]*gap="100"/
- );
- });
-});
diff --git a/src/app/phoneHit.pages.test.ts b/src/app/phoneHit.pages.test.ts
deleted file mode 100644
index 97eb77b8..00000000
--- a/src/app/phoneHit.pages.test.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { describe, it } from 'vitest';
-import { expectPhoneHitClasses, expectSizeTie } from './phoneHitTestKit';
-
-// Page back buttons (and two lone buttons beside them). Every one is alone in its row, 40 px drawn (default
-// IconButton and Icon), so plain PhoneHit; the vertical stacks of the page have no variant.
-// null = deliberately without: LobbyHeader's Members button renders only when screenSize !== Mobile.
-const files: Record = {
- 'features/lobby/LobbyHeader.tsx': ['PhoneHit', null, 'PhoneHit'],
- 'features/join-before-navigate/JoinBeforeNavigate.tsx': ['PhoneHit'],
- 'pages/client/space/Search.tsx': ['PhoneHit'],
- 'pages/client/explore/Server.tsx': ['PhoneHit'],
- 'pages/client/explore/Featured.tsx': ['PhoneHit'],
- 'pages/client/home/CreateRoom.tsx': ['PhoneHit'],
- 'pages/client/home/Search.tsx': ['PhoneHit'],
- // the second is the 30 px scroll-to-top pill, floating alone at the top centre
- 'pages/client/inbox/Notifications.tsx': ['PhoneHit', 'PhoneHit'],
- 'pages/client/inbox/Invites.tsx': ['PhoneHit'],
- 'pages/client/direct/DirectCreate.tsx': ['PhoneHit'],
-};
-
-describe.each(Object.entries(files))('phone hit area: %s', (file, want) => {
- it('gives each IconButton its variant', () => {
- expectPhoneHitClasses(file, want);
- });
- // plain PhoneHit has no size to tie; this fails when a sized variant appears whose number is not the drawn px
- it('ties any sized variant to the drawn size', () => {
- expectSizeTie(file);
- });
-});
diff --git a/src/app/phoneHit.roomSpace.test.ts b/src/app/phoneHit.roomSpace.test.ts
deleted file mode 100644
index c98c2b09..00000000
--- a/src/app/phoneHit.roomSpace.test.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { describe, it } from 'vitest';
-import { expectPhoneHitClasses, expectSizeTie } from './phoneHitTestKit';
-
-describe('icon buttons in room settings, space settings, lobby, search and explore', () => {
- // The class each IconButton must carry, in source order. Vertical stacks and lone buttons: the plain PhoneHit.
- const expected: Record = {
- 'features/room-settings/RoomSettings.tsx': ['PhoneHit'], // close, phone only, alone at the header end
- 'features/room-settings/general/General.tsx': ['PhoneHit'], // close, 40 px
- 'features/room-settings/permissions/Permissions.tsx': ['PhoneHit'],
- 'features/space-settings/SpaceSettings.tsx': ['PhoneHit'],
- 'features/space-settings/general/General.tsx': ['PhoneHit'],
- 'features/space-settings/permissions/Permissions.tsx': ['PhoneHit'],
- // 16 px icon + 8 padding = 24 px, 8-12 px from the Open / Add chips beside it in a hierarchy card
- 'features/lobby/HierarchyItemMenu.tsx': ['PhoneHitSpread24'],
- 'features/lobby/Lobby.tsx': ['PhoneHit'], // floating scroll-to-top, alone
- 'features/message-search/MessageSearch.tsx': ['PhoneHit'], // floating scroll-to-top, alone
- 'pages/client/explore/Explore.tsx': ['PhoneHit'], // Add Server dialog close
- };
-
- it.each(Object.entries(expected))(
- '%s: each IconButton carries its own PhoneHit class',
- (file, want) => expectPhoneHitClasses(file, want)
- );
-
- it.each(Object.keys(expected))('%s: a sized variant matches the drawn size', (file) =>
- expectSizeTie(file)
- );
-});
diff --git a/src/app/phoneHit.settingsA.test.ts b/src/app/phoneHit.settingsA.test.ts
deleted file mode 100644
index 37f1f3c2..00000000
--- a/src/app/phoneHit.settingsA.test.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { describe, it } from 'vitest';
-import { expectPhoneHitClasses, expectSizeTie } from './phoneHitTestKit';
-
-describe('icon buttons in settings A', () => {
- // The class each IconButton must carry, in source order. Every one is alone in its row (a header close next to
- // non-tappable title text, an input slot, or a list tile beside a non-tappable Avatar), so the plain PhoneHit.
- const expected: Record = {
- 'features/settings/developer-tools/DevelopTools.tsx': ['PhoneHit'], // header close, 40 px
- 'features/settings/notifications/Notifications.tsx': ['PhoneHit'], // header close, 40 px
- 'features/settings/notifications/KeywordMessages.tsx': ['PhoneHit', 'PhoneHit'], // input reset, remove: 26 px, alone
- 'features/settings/emojis-stickers/EmojisStickers.tsx': ['PhoneHit'], // header close, 40 px
- 'features/settings/emojis-stickers/GlobalPacks.tsx': ['PhoneHit', 'PhoneHit'], // undo / remove, a ternary pair, 26 px
- 'features/settings/Settings.tsx': ['PhoneHit'], // mobile-only header close, 40 px
- 'features/settings/about/About.tsx': ['PhoneHit'], // header close, 40 px
- 'features/settings/general/General.tsx': ['PhoneHit', 'PhoneHit', 'PhoneHit'], // reset / info (ternary), header close
- 'features/settings/account/Account.tsx': ['PhoneHit'], // header close, 40 px
- 'features/settings/devices/Devices.tsx': ['PhoneHit'], // header close, 40 px
- };
-
- it.each(Object.entries(expected))('%s carries the right hit-area class', (file, want) => {
- expectPhoneHitClasses(file, want);
- });
-
- // Plain PhoneHit has no size to tie, so nothing is allow-listed; the check still fails an allow-list entry
- // or a sized variant that disagrees with the drawn size if one is added later.
- it.each(Object.keys(expected))('%s ties a sized variant to the drawn size', (file) => {
- expectSizeTie(file);
- });
-});
diff --git a/src/app/phoneHit.settingsB.test.ts b/src/app/phoneHit.settingsB.test.ts
deleted file mode 100644
index 4d2e3dee..00000000
--- a/src/app/phoneHit.settingsB.test.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { describe, it } from 'vitest';
-import { expectPhoneHitClasses, expectSizeTie } from './phoneHitTestKit';
-
-// Each IconButton here is alone in its slot (a dialog header's close, an input's clear button, a tile's lone
-// menu or chevron button, its neighbours being text or a badge), so each takes PhoneHit. Every size is derivable
-// from the source, so nothing is allow-listed; plain PhoneHit has no number to tie.
-const files: [string, string[]][] = [
- ['features/settings/account/Profile.tsx', ['PhoneHit', 'PhoneHit']],
- ['features/settings/account/IgnoredUserList.tsx', ['PhoneHit']],
- ['features/settings/devices/Verification.tsx', ['PhoneHit']],
- ['features/settings/devices/DeviceTile.tsx', ['PhoneHit']],
- ['pages/auth/ServerPicker.tsx', ['PhoneHit']],
- ['components/BackupRestore.tsx', ['PhoneHit']],
- ['components/DeviceVerification.tsx', ['PhoneHit']],
- ['components/DeviceVerificationSetup.tsx', ['PhoneHit', 'PhoneHit']],
-];
-
-describe.each(files)('phone hit area: %s', (file, want) => {
- it('gives each icon button its variant', () => expectPhoneHitClasses(file, want));
- it('ties each sized variant to the size it draws', () => expectSizeTie(file));
-});
diff --git a/src/app/phoneHit.viewers.test.ts b/src/app/phoneHit.viewers.test.ts
deleted file mode 100644
index 3e579f4c..00000000
--- a/src/app/phoneHit.viewers.test.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { describe, it } from 'vitest';
-import { expectPhoneHitClasses, expectSizeTie } from './phoneHitTestKit';
-
-// Viewer headers and the UIA stages. The back/close button sits beside a title that is not tappable, so it is a
-// plain PhoneHit; the zoom out/in buttons sit either side of a tappable zoom Chip, so they spread at their drawn
-// 24 px (IconButton size 300 around a 16 px Icon).
-// Not covered: the two scroll arrows of components/url-preview/UrlPreviewCard.tsx. They are position: absolute and
-// PhoneHit sets position: relative on phones, which would pull them into the flow; they need a variant that keeps
-// the position, which PhoneHit.css.ts does not have yet.
-const files: [string, string[]][] = [
- ['components/uia-stages/PasswordStage.tsx', ['PhoneHit']],
- ['components/uia-stages/SSOStage.tsx', ['PhoneHit']],
- ['components/UIAFlowOverlay.tsx', ['PhoneHit']],
- ['components/text-viewer/TextViewer.tsx', ['PhoneHit']],
- ['components/image-editor/ImageEditor.tsx', ['PhoneHit']],
- ['components/image-viewer/ImageViewer.tsx', ['PhoneHit', 'PhoneHitSpread24', 'PhoneHitSpread24']],
- ['components/Pdf-viewer/PdfViewer.tsx', ['PhoneHit', 'PhoneHitSpread24', 'PhoneHitSpread24']],
-];
-
-describe.each(files)('phone hit area: %s', (file, want) => {
- it('gives each icon button the variant of its surroundings', () => {
- expectPhoneHitClasses(file, want);
- });
- it('ties each sized variant to the size the button draws', () => {
- expectSizeTie(file);
- });
-});
diff --git a/src/app/phoneHitTestKit.test.ts b/src/app/phoneHitTestKit.test.ts
deleted file mode 100644
index 77bfc9fd..00000000
--- a/src/app/phoneHitTestKit.test.ts
+++ /dev/null
@@ -1,276 +0,0 @@
-import { describe, expect, it } from 'vitest';
-import { mkdtempSync, rmSync, writeFileSync } from 'fs';
-import { tmpdir } from 'os';
-import { relative } from 'path';
-import {
- drawnPx,
- expectPhoneHitClasses,
- expectSizeTie,
- iconButtons,
- phoneHitOf,
- uncoveredIconButtons,
-} from './phoneHitTestKit';
-
-describe('phone hit test kit', () => {
- it('reads {
- const src =
- '';
- expect(iconButtons(src).map((b) => b.tag)).toEqual([
- '',
- '',
- ]);
- });
-
- it('derives a drawn size from literal size props, defaults being 400', () => {
- expect(drawnPx('', '')).toEqual({ px: 24 });
- expect(drawnPx('', '')).toEqual({ px: 40 });
- });
-
- it('reads {
- expect(
- drawnPx('', '')
- ).toEqual({
- px: 24,
- });
- });
-
- it('calls a size undetermined when props are spread into the IconButton or the Icon', () => {
- expect(drawnPx('', '')).toHaveProperty('undetermined');
- expect(drawnPx('', '')).toHaveProperty(
- 'undetermined'
- );
- expect(drawnPx('', '')).toHaveProperty(
- 'undetermined'
- );
- expect(drawnPx('', '')).toHaveProperty('undetermined');
- });
-
- it('fails a file with no IconButton, which would otherwise pass vacuously', () => {
- expect(() => expectSizeTie('styles/PhoneHit.css.ts')).toThrow(/no IconButton/);
- });
-
- describe('phoneHitOf reads the imported class off the AST, applied unconditionally', () => {
- const tag = (expr: string) => ``;
- const ok = (expr: string, name: string) => expect(phoneHitOf(tag(expr))).toBe(name);
- const no = (expr: string) => expect(phoneHitOf(tag(expr))).toBeNull();
-
- it('accepts the bare identifier and merges that always include it', () => {
- ok('PhoneHitSpread26', 'PhoneHitSpread26');
- ok('classNames(PhoneHitRoom36, css.other)', 'PhoneHitRoom36');
- ok('clsx(css.a, { [css.b]: on }, PhoneHit)', 'PhoneHit');
- ok('cx(PhoneHit)', 'PhoneHit');
- ok('`${PhoneHit} ${css.other}`', 'PhoneHit');
- ok('classNames(/* PhoneHit */ PhoneHit)', 'PhoneHit');
- });
-
- it('rejects the name as a string, a concatenation or a comment', () => {
- no("'PhoneHitSpread26'");
- no('`PhoneHitSpread26`');
- no('"PhoneHitSpread26" + "x"');
- no("'PhoneHit' + 'Spread26'");
- no('/* PhoneHit */ undefined');
- no('css.a // PhoneHit');
- });
-
- it('rejects a conditionally applied name', () => {
- no('cond ? PhoneHitSpread26 : undefined');
- no('cond && PhoneHitSpread26');
- no('cond || PhoneHitSpread26');
- no('maybe ?? PhoneHitSpread26');
- no("classNames(cond ? PhoneHit : '', css.a)");
- no('classNames(PhoneHit, cond && PhoneHit)');
- });
-
- it('rejects every other expression shape the name can hide in', () => {
- no('classNames({ PhoneHit: on })');
- no('clsx({ [PhoneHit]: on })');
- no('`${`${PhoneHit}`}`');
- no('typeof PhoneHit');
- no("(PhoneHit = 'x')");
- no('(PhoneHit, css.a)');
- no('(PhoneHit)');
- no('() => PhoneHit');
- no('PhoneHit.foo');
- no('other.PhoneHit');
- no('classNames(css.a, [PhoneHit])');
- no('wrap(PhoneHit)');
- no('PhoneHitSpread26é');
- no('`${css.a}`');
- });
-
- it('rejects a tag without className, with two, or with a non-expression one', () => {
- expect(phoneHitOf('')).toBeNull();
- expect(phoneHitOf('')).toBeNull();
- expect(phoneHitOf('')).toBeNull();
- expect(phoneHitOf('')).toBe('PhoneHit');
- });
-
- it('rejects a spread after className, which can override it, and accepts one before', () => {
- expect(phoneHitOf('')).toBeNull();
- expect(phoneHitOf('')).toBeNull();
- expect(phoneHitOf('')).toBe('PhoneHit');
- });
-
- it('reads a className past braces inside strings', () => {
- ok("classNames('{', PhoneHit)", 'PhoneHit');
- });
- });
-
- describe('expectPhoneHitClasses', () => {
- const check = (src: string, want: (string | null)[]) => {
- const dir = mkdtempSync(`${tmpdir()}/phone-hit-kit-`);
- try {
- writeFileSync(`${dir}/Probe.tsx`, src);
- expectPhoneHitClasses(relative(`${process.cwd()}/src/app`, `${dir}/Probe.tsx`), want);
- } finally {
- rmSync(dir, { recursive: true });
- }
- };
- const imp = "import { PhoneHit, PhoneHitSpread26 } from '../../styles/PhoneHit.css';\n";
- const src =
- imp +
- 'const A = () => (<>>);';
-
- it('pins each button in order, null meaning no class', () => {
- check(src, ['PhoneHit', 'PhoneHitSpread26', null]);
- expect(() => check(src, ['PhoneHit', 'PhoneHit', null])).toThrow();
- expect(() => check(src, ['PhoneHit', 'PhoneHitSpread26', 'PhoneHit'])).toThrow();
- expect(() => check(src, ['PhoneHit', 'PhoneHitSpread26'])).toThrow();
- });
-
- it('fails a name that is not read from PhoneHit.css or is applied conditionally', () => {
- const local = "const PhoneHit = 'x';\n";
- expect(() => check(local, ['PhoneHit'])).toThrow();
- expect(() => check(local, [null])).not.toThrow();
- const cond = imp + '';
- expect(() => check(cond, ['PhoneHit'])).toThrow();
- const aliased =
- "import { Other as PhoneHit } from '../../styles/PhoneHit.css';\n";
- expect(() => check(aliased, ['PhoneHit'])).toThrow();
- const wrongModule =
- "import { PhoneHit } from './other';\n";
- expect(() => check(wrongModule, ['PhoneHit'])).toThrow();
- });
- });
-
- describe('uncoveredIconButtons: the coverage guard is not blind to a spelling of IconButton', () => {
- const imp = "import { PhoneHit } from '../styles/PhoneHit.css';\n";
- const none = { bare: [], unhandled: [] };
-
- it('sees an IconButton imported under an alias, as a tag', () => {
- const bare = "import { IconButton as IB } from 'folds';\nconst A = () => ;";
- expect(uncoveredIconButtons(bare)).toEqual({ bare: [0], unhandled: [] });
- const ok = `${imp}import { IconButton as IB } from 'folds';\nconst A = () => ;`;
- expect(uncoveredIconButtons(ok)).toEqual(none);
- });
-
- it('sees a namespace member tag', () => {
- const bare = "import * as F from 'folds';\nconst A = () => ;";
- expect(uncoveredIconButtons(bare)).toEqual({ bare: [0], unhandled: [] });
- const ok = `${imp}import * as F from 'folds';\nconst A = () => ;`;
- expect(uncoveredIconButtons(ok)).toEqual(none);
- });
-
- it('fails loudly on an IconButton passed or bound as a value, and on a re-export', () => {
- const asProp =
- "import { IconButton } from 'folds';\nconst A = () => ;";
- expect(uncoveredIconButtons(asProp).unhandled).toEqual(['2:26']);
- const aliasValue =
- "import { IconButton as IB } from 'folds';\nconst A = () => ;";
- expect(uncoveredIconButtons(aliasValue).unhandled).toEqual(['2:26']);
- const rebound = "import { IconButton } from 'folds';\nconst B = IconButton;";
- expect(uncoveredIconButtons(rebound).unhandled).toEqual(['2:11']);
- const destructured = "import * as F from 'folds';\nconst { IconButton: IB } = F;";
- expect(uncoveredIconButtons(destructured).unhandled).toEqual(['2:9']);
- const member = "import * as F from 'folds';\nconst B = F.IconButton;";
- expect(uncoveredIconButtons(member).unhandled).toEqual(['2:13']);
- const indexed = "import * as F from 'folds';\nconst B = F['IconButton'];";
- expect(uncoveredIconButtons(indexed).unhandled).toEqual(['2:13']);
- expect(uncoveredIconButtons("export { IconButton } from 'folds';").unhandled).toHaveLength(1);
- });
-
- it('reads a non-.tsx file by its extension', () => {
- const ts =
- "import { IconButton } from 'folds';\nexport const x = (v: T) => ;";
- expect(uncoveredIconButtons(ts, 'x.tsx').bare).toEqual([0]);
- const js = "import { IconButton } from 'folds';\nexport const B = IconButton;";
- expect(uncoveredIconButtons(js, 'x.ts').unhandled).toEqual(['2:18']);
- expect(uncoveredIconButtons(js, 'x.js').unhandled).toEqual(['2:18']);
- const jsx = "import { IconButton } from 'folds';\nexport const A = () => ;";
- expect(uncoveredIconButtons(jsx, 'x.jsx').bare).toEqual([0]);
- });
-
- it('does not count IconButtonX, a comment or a string as an IconButton', () => {
- const src =
- "import { IconButtonGroup } from 'folds';\n// IconButton\nconst a = 'IconButton';\nconst A = () => ;";
- expect(uncoveredIconButtons(src)).toEqual(none);
- });
-
- it('does not count a PhoneHit that an inner scope rebinds', () => {
- const tag = '';
- const cases = [
- `const A = (PhoneHit) => ${tag};`,
- `const A = ({ PhoneHit }) => ${tag};`,
- `const A = ([a, PhoneHit]) => ${tag};`,
- `function A() { const PhoneHit = 'x'; return ${tag}; }`,
- `function A() { return ${tag}; var PhoneHit; }`,
- `function A() { if (a) { var PhoneHit = 'x'; } return ${tag}; }`,
- `function A() { { let { PhoneHit } = o; return ${tag}; } }`,
- `function A() { function PhoneHit() {} return ${tag}; }`,
- `function A() { for (const PhoneHit of xs) { return ${tag}; } }`,
- `function A() { try { f(); } catch (PhoneHit) { return ${tag}; } }`,
- `const A = function PhoneHit() { return ${tag}; };`,
- `function A() { switch (x) { case 1: const PhoneHit = 'x'; return ${tag}; } }`,
- ];
- cases.forEach((c) => expect(uncoveredIconButtons(`${imp}${c}`).bare, c).toEqual([0]));
- // the same shapes without the rebinding count, and a rebinding that is not in scope does not hide it
- expect(uncoveredIconButtons(`${imp}const A = () => ${tag};`).bare).toEqual([]);
- expect(
- uncoveredIconButtons(`${imp}const f = (PhoneHit) => 1;\nconst A = () => ${tag};`).bare
- ).toEqual([]);
- expect(uncoveredIconButtons(`${imp}function A() { return ${tag}; }`).bare).toEqual([]);
- });
-
- it('does not count an import type of PhoneHit', () => {
- const tag = 'const A = () => ;';
- const typeOnly = `import type { PhoneHit } from '../styles/PhoneHit.css';\n${tag}`;
- expect(uncoveredIconButtons(typeOnly).bare).toEqual([0]);
- const typeSpecifier = `import { type PhoneHit } from '../styles/PhoneHit.css';\n${tag}`;
- expect(uncoveredIconButtons(typeSpecifier).bare).toEqual([0]);
- expect(uncoveredIconButtons(`${imp}${tag}`).bare).toEqual([]);
- });
- });
-
- describe('drawnPx reads the parsed tag, not its text', () => {
- it('ignores a size in a string, comment or other prop name', () => {
- expect(drawnPx('', '')).toEqual({ px: 40 });
- expect(drawnPx('', '')).toEqual({
- px: 40,
- });
- expect(
- drawnPx('', '{/* */}')
- ).toEqual({
- px: 24,
- });
- expect(drawnPx('', '{""}')).toHaveProperty(
- 'undetermined'
- );
- });
-
- it('reads a size from a braced string, and the last size wins', () => {
- expect(drawnPx("", '')).toEqual({ px: 24 });
- expect(drawnPx('', '')).toEqual({
- px: 40,
- });
- });
-
- it('reads an Icon spread after a size, and a size past a braced prop with a > inside', () => {
- expect(drawnPx(' a > b} size="300">', '')).toEqual({
- px: 32,
- });
- expect(drawnPx('', '')).toHaveProperty(
- 'undetermined'
- );
- });
- });
-});
diff --git a/src/app/phoneHitTestKit.ts b/src/app/phoneHitTestKit.ts
deleted file mode 100644
index b6752183..00000000
--- a/src/app/phoneHitTestKit.ts
+++ /dev/null
@@ -1,384 +0,0 @@
-// Shared helpers for the phone hit-area tests (phoneTapTargets.test.ts and one phoneHit..test.ts per later
-// group of IconButtons). Not a test file: it registers nothing, the test files call it.
-import { readFileSync } from 'fs';
-import { expect } from 'vitest';
-import ts from 'typescript';
-import zlib from 'zlib';
-import { compile, processVanillaFile } from '@vanilla-extract/integration';
-
-// The CSS a .css.ts file emits, read back from vanilla-extract's own compile (as pages/auth/footerBand.test.ts does;
-// vanilla-extract gzips the inlined source only when it is large, so both forms are read).
-const compiled = async (file: string) => {
- const filePath = `${process.cwd()}/src/app/${file}`;
- const { source } = await compile({ filePath, cwd: process.cwd(), identOption: 'debug' });
- return processVanillaFile({ source, filePath, identOption: 'debug' });
-};
-
-/** The class list each export of a .css.ts file resolves to (a composed class lists the classes it composes). */
-export const classLists = async (file: string): Promise> =>
- Object.fromEntries(
- [...(await compiled(file)).matchAll(/^export var (\w+) = '([^']*)';$/gm)].map((m) => [
- m[1],
- m[2].split(' '),
- ])
- );
-
-export const emitted = async (file: string) => {
- const code = await compiled(file);
- // A file with recipes inlines one source per rule group; read them all.
- return [...code.matchAll(/source=#?([A-Za-z0-9+/=]+)/g)]
- .map((m) => {
- const bytes = Buffer.from(m[1], 'base64');
- return (bytes[0] === 0x1f && bytes[1] === 0x8b ? zlib.gunzipSync(bytes) : bytes).toString();
- })
- .join('\n');
-};
-
-export type Decls = Record;
-const parse = (body: string): Decls =>
- Object.fromEntries(
- body
- .split('\n')
- .map((l) => l.trim().replace(/;$/, ''))
- .filter((l) => /^[a-z-]+: -?\d+px$/.test(l))
- .map((l) => [l.split(':')[0], Number(l.split(': ')[1].replace('px', ''))])
- );
-
-/** Pixel declarations of the rules whose selector matches, inside or outside a media query. */
-export const rulesFor = (css: string, selector: RegExp, media: string | undefined): Decls[] => {
- const scope = media
- ? [...css.matchAll(/@media ([^{]+) \{\n([\s\S]*?\n)\}(?:\n|$)/g)]
- .filter((m) => m[1] === media)
- .map((m) => m[2])
- .join('\n')
- : css.replace(/@media [^{]+ \{\n[\s\S]*?\n\}(?:\n|$)/g, '');
- return [...scope.matchAll(/^\s*([^{}\n]+) \{\n([^}]*)\}/gm)]
- .filter((m) => selector.test(m[1]))
- .map((m) => parse(m[2]));
-};
-
-/** The source of a file under src/app. */
-export const readSource = (file: string) =>
- readFileSync(`${process.cwd()}/src/app/${file}`, 'utf8');
-
-// The extension picks the script kind (.ts reads `x` as an assertion, .tsx and .jsx read it as JSX).
-const tsx = (src: string, fileName = 'source.tsx') =>
- ts.createSourceFile(fileName, src, ts.ScriptTarget.Latest, true);
-
-type Opening = ts.JsxOpeningElement | ts.JsxSelfClosingElement;
-
-const isTag = (n: ts.Node): n is Opening =>
- ts.isJsxOpeningElement(n) || ts.isJsxSelfClosingElement(n);
-
-/** Local names the source binds IconButton to by import: IconButton itself and any alias (IconButton as IB). */
-const iconButtonNames = (sf: ts.SourceFile) => {
- const names = new Set(['IconButton']);
- sf.statements.forEach((st) => {
- const nb = ts.isImportDeclaration(st) ? st.importClause?.namedBindings : undefined;
- if (nb && ts.isNamedImports(nb))
- nb.elements.forEach((e) => {
- if ((e.propertyName ?? e.name).text === 'IconButton') names.add(e.name.text);
- });
- });
- return names;
-};
-
-/** Whether a JSX tag name is an IconButton: the plain or aliased identifier, or a namespace member (). */
-const isIconButtonTag = (tag: ts.JsxTagNameExpression, names: Set) =>
- (ts.isIdentifier(tag) && names.has(tag.text)) ||
- (ts.isPropertyAccessExpression(tag) && tag.name.text === 'IconButton');
-
-/** Every IconButton element (not IconButtonX) of a parsed source, in source order, however its tag is spelled. */
-const elements = (sf: ts.SourceFile) => {
- const names = iconButtonNames(sf);
- const found: Opening[] = [];
- const walk = (n: ts.Node) => {
- if (isTag(n) && isIconButtonTag(n.tagName, names)) found.push(n);
- ts.forEachChild(n, walk);
- };
- walk(sf);
- return found;
-};
-
-/** Every mention of IconButton that is not a JSX tag or the import itself: passed as a value (as={IconButton}),
- * re-bound, re-exported, reached by destructuring or by an element access. Such a render cannot be tied to a
- * PhoneHit class, so each is reported ("line:col") and the guard fails on it. */
-const unhandledMentions = (sf: ts.SourceFile) => {
- const names = iconButtonNames(sf);
- const out: string[] = [];
- const at = (n: ts.Node) => {
- const { line, character } = sf.getLineAndCharacterOfPosition(n.getStart());
- out.push(`${line + 1}:${character + 1}`);
- };
- const walk = (n: ts.Node) => {
- if (ts.isIdentifier(n) && names.has(n.text)) {
- const p = n.parent;
- const tagged = (x: ts.Node) =>
- (isTag(x) || ts.isJsxClosingElement(x)) && x.tagName === (n as ts.Node);
- const member =
- ts.isPropertyAccessExpression(p) &&
- p.name === n &&
- (isTag(p.parent) || ts.isJsxClosingElement(p.parent)) &&
- p.parent.tagName === p;
- if (!ts.isImportSpecifier(p) && !tagged(p) && !member) at(n);
- } else if (
- ts.isStringLiteralLike(n) &&
- n.text === 'IconButton' &&
- ts.isElementAccessExpression(n.parent)
- )
- at(n);
- ts.forEachChild(n, walk);
- };
- walk(sf);
- return out;
-};
-
-const bodyOf = (el: Opening) =>
- ts.isJsxOpeningElement(el) && ts.isJsxElement(el.parent)
- ? el.getSourceFile().text.slice(el.end, el.parent.closingElement.getStart())
- : '';
-
-/** Every
- elements(tsx(src)).map((el) => ({ tag: el.getText(), body: bodyOf(el) }));
-
-export const iconButtonTags = (src: string) => iconButtons(src).map((b) => b.tag);
-
-/** Local names the source imports as values from the PhoneHit.css module (as written, not aliased). An
- * `import type`, or a `type` specifier, binds no value and is not read. */
-const importedHits = (sf: ts.SourceFile) =>
- new Set(
- sf.statements.flatMap((st) => {
- if (!ts.isImportDeclaration(st) || !ts.isStringLiteral(st.moduleSpecifier)) return [];
- const nb = st.importClause?.namedBindings;
- return nb &&
- !st.importClause?.isTypeOnly &&
- ts.isNamedImports(nb) &&
- /^(\.\.\/)+styles\/PhoneHit\.css$/.test(st.moduleSpecifier.text)
- ? nb.elements.filter((e) => !e.propertyName && !e.isTypeOnly).map((e) => e.name.text)
- : [];
- })
- );
-
-const bindingNames = (b: ts.BindingName): string[] =>
- ts.isIdentifier(b)
- ? [b.text]
- : b.elements.flatMap((e) => (ts.isOmittedExpression(e) ? [] : bindingNames(e.name)));
-
-const declaresVar = (list: ts.VariableDeclarationList, name: string) =>
- list.declarations.some((d) => bindingNames(d.name).includes(name));
-
-/** Whether `var name` is declared anywhere in a function body, outside nested functions (var hoists to the function). */
-const hoistsVar = (fn: ts.Node, name: string) => {
- let found = false;
- const walk = (n: ts.Node) => {
- if (found || (n !== fn && ts.isFunctionLike(n))) return;
- if (
- ts.isVariableDeclarationList(n) &&
- // eslint-disable-next-line no-bitwise -- NodeFlags is a bit set; var is the one declaration kind with neither flag
- (n.flags & ts.NodeFlags.BlockScoped) === 0 &&
- declaresVar(n, name)
- )
- found = true;
- ts.forEachChild(n, walk);
- };
- walk(fn);
- return found;
-};
-
-/** Whether one scope node declares `name` of its own: parameters, a function expression's own name, block-level
- * let/const/function/class, a for-loop head or a catch variable. */
-const scopeDeclares = (scope: ts.Node, name: string): boolean => {
- const inStatements = (sts: readonly ts.Statement[]) =>
- sts.some(
- (st) =>
- (ts.isVariableStatement(st) && declaresVar(st.declarationList, name)) ||
- ((ts.isFunctionDeclaration(st) || ts.isClassDeclaration(st)) && st.name?.text === name)
- );
- if (ts.isBlock(scope) || ts.isModuleBlock(scope)) return inStatements(scope.statements);
- if (ts.isCaseBlock(scope)) return inStatements(scope.clauses.flatMap((c) => [...c.statements]));
- if (ts.isFunctionLike(scope))
- return (
- scope.parameters.some((p) => bindingNames(p.name).includes(name)) ||
- ((ts.isFunctionExpression(scope) || ts.isClassExpression(scope)) &&
- scope.name?.text === name) ||
- hoistsVar(scope, name)
- );
- if (ts.isForStatement(scope) || ts.isForInStatement(scope) || ts.isForOfStatement(scope))
- return (
- !!scope.initializer &&
- ts.isVariableDeclarationList(scope.initializer) &&
- declaresVar(scope.initializer, name)
- );
- if (ts.isCatchClause(scope))
- return (
- !!scope.variableDeclaration && bindingNames(scope.variableDeclaration.name).includes(name)
- );
- return false;
-};
-
-/** Whether an inner scope between the identifier and the module rebinds its name, so it is not the import. */
-const shadowed = (id: ts.Identifier) => {
- for (let n: ts.Node | undefined = id.parent; n && !ts.isSourceFile(n); n = n.parent)
- if (scopeDeclares(n, id.text)) return true;
- return false;
-};
-
-const MERGERS = new Set(['classNames', 'clsx', 'cx']);
-
-/** The PhoneHit* class an IconButton carries, or null. className must appear exactly once, with no props spread
- * after it (a spread can override it at runtime), and its expression must be: the bare identifier; a classNames /
- * clsx / cx call with it as a direct argument; or a template with it as a direct span. The identifier must occur
- * nowhere else in the expression, so a key, a member, a closure, a conditional or a comma can never carry it. When
- * `imported` is given, the identifier must also resolve to a value binding imported from the PhoneHit.css module
- * (not an `import type`, not rebound by an inner scope). */
-const hitOf = (el: Opening, imported?: Set): string | null => {
- const props = el.attributes.properties;
- const at = props.flatMap((p, i) =>
- ts.isJsxAttribute(p) && ts.isIdentifier(p.name) && p.name.text === 'className' ? [i] : []
- );
- if (at.length !== 1 || props.slice(at[0] + 1).some(ts.isJsxSpreadAttribute)) return null;
- const attr = props[at[0]] as ts.JsxAttribute;
- const expr =
- attr.initializer && ts.isJsxExpression(attr.initializer) && attr.initializer.expression;
- if (!expr) return null;
- const isHit = (n: ts.Node): n is ts.Identifier =>
- ts.isIdentifier(n) &&
- /^PhoneHit\w*$/.test(n.text) &&
- (!imported || (imported.has(n.text) && !shadowed(n)));
- let direct: ts.Node[] = [];
- if (ts.isIdentifier(expr)) direct = [expr];
- else if (
- ts.isCallExpression(expr) &&
- ts.isIdentifier(expr.expression) &&
- MERGERS.has(expr.expression.text)
- )
- direct = [...expr.arguments];
- else if (ts.isTemplateExpression(expr)) direct = expr.templateSpans.map((sp) => sp.expression);
- const hits = direct.filter(isHit);
- if (hits.length !== 1) return null;
- let occurrences = 0;
- const count = (n: ts.Node) => {
- if (ts.isIdentifier(n) && n.text === hits[0].text) occurrences += 1;
- ts.forEachChild(n, count);
- };
- count(expr);
- return occurrences === 1 ? hits[0].text : null;
-};
-
-/** The PhoneHit* class of one tag's text (see hitOf), without the import-binding check. */
-export const phoneHitOf = (tag: string) => {
- const els = elements(tsx(tag.endsWith('/>') ? tag : `${tag}`));
- return els.length === 1 ? hitOf(els[0]) : null;
-};
-
-/** The PhoneHit* class of each IconButton of a source, in source order; null when it has none or the name is not
- * the one imported from PhoneHit.css. */
-export const phoneHitClasses = (src: string) => {
- const sf = tsx(src);
- const imported = importedHits(sf);
- return elements(sf).map((el) => hitOf(el, imported));
-};
-
-/** What a source file leaves uncovered: the indices (source order) of its IconButton elements without a PhoneHit
- * class, and the "line:col" of every mention of IconButton that is not a tag and so cannot be checked at all. The
- * fileName picks the parser (.ts, .tsx, .js, ...). */
-export const uncoveredIconButtons = (src: string, fileName = 'source.tsx') => {
- const sf = tsx(src, fileName);
- const imported = importedHits(sf);
- return {
- bare: elements(sf).flatMap((el, i) => (hitOf(el, imported) === null ? [i] : [])),
- unhandled: unhandledMentions(sf),
- };
-};
-
-/** The class each IconButton must carry, in source order (null = must carry none): the variant is chosen by the
- * button's drawn size and whether a clipping container or neighbours surround it, so a swapped variant is a wrong
- * hit area. The name must also be the one PhoneHit.css exports, not a local of the same name. */
-export const expectPhoneHitClasses = (file: string, want: (string | null)[]) =>
- expect(phoneHitClasses(readSource(file))).toEqual(want);
-
-// IconButton `size` -> padding on each side, Icon `size` -> px (folds 2.7.2). Both default to 400.
-const BUTTON_PAD: Record = { '300': 4, '400': 8, '500': 12, '600': 16 };
-const ICON_PX: Record = {
- '50': 16,
- '100': 18,
- '200': 20,
- '300': 22,
- '400': 24,
- '500': 28,
-};
-
-/** The size prop of a tag: its literal value, the default when absent, or undefined when it is an expression. */
-const sizeProp = (el: Opening) => {
- const props = el.attributes.properties;
- // props spread in may carry a size of their own
- if (props.some(ts.isJsxSpreadAttribute)) return undefined;
- const sizes = props.filter(
- (p): p is ts.JsxAttribute =>
- ts.isJsxAttribute(p) && ts.isIdentifier(p.name) && p.name.text === 'size'
- );
- if (sizes.length === 0) return '400';
- const init = sizes[sizes.length - 1].initializer;
- const lit = init && ts.isJsxExpression(init) ? init.expression : init;
- return lit && ts.isStringLiteralLike(lit) ? lit.text : undefined;
-};
-
-/** The px an IconButton draws, from its size prop and the Icon inside; undefined with a reason when the source
- * does not say (a variable size, no Icon, Icons of different sizes). Both are read off the parsed tag and body. */
-export const drawnPx = (tag: string, body: string): { px: number } | { undetermined: string } => {
- let button: Opening | undefined;
- const first = (n: ts.Node) => {
- if (!button && isTag(n)) button = n;
- else if (!button) ts.forEachChild(n, first);
- };
- first(tsx(tag.endsWith('/>') ? tag : `${tag}`));
- const pad = BUTTON_PAD[(button && sizeProp(button)) ?? ''];
- if (pad === undefined)
- return { undetermined: 'size of the IconButton is not a literal (or props are spread in)' };
- const icons: (number | undefined)[] = [];
- const find = (n: ts.Node) => {
- if (isTag(n) && ts.isIdentifier(n.tagName) && n.tagName.text === 'Icon')
- icons.push(ICON_PX[sizeProp(n) ?? '']);
- ts.forEachChild(n, find);
- };
- find(tsx(`<>${body}>`));
- if (icons.length === 0) return { undetermined: 'no inside' };
- if (icons.some((p) => p === undefined))
- return { undetermined: 'size of an Icon is not a literal (or props are spread in)' };
- if (new Set(icons).size > 1) return { undetermined: 'Icons of different sizes inside' };
- return { px: (icons[0] as number) + 2 * pad };
-};
-
-/** Per file, per IconButton index (source order): why its drawn size cannot be derived from the source. */
-export type SizeAllow = Record>;
-
-/** A button carrying PhoneHitSpread or PhoneHitRoom draws N px. Plain PhoneHit has no number to tie. An
- * undetermined size passes only with an entry in `allow`, and an entry for a size that can be derived fails. */
-export const expectSizeTie = (file: string, allow: SizeAllow = {}) => {
- const allowed = allow[file] ?? {};
- const seen = new Set();
- const src = readSource(file);
- const buttons = iconButtons(src);
- const classes = phoneHitClasses(src);
- expect(buttons.length, `${file} has no IconButton`).toBeGreaterThan(0);
- buttons.forEach(({ tag, body }, i) => {
- const variant = classes[i]?.match(/^PhoneHit(?:Spread|Room)(\d+)$/);
- if (!variant) {
- expect(allowed[i], `${file} #${i} is allow-listed but has no sized variant`).toBeUndefined();
- return;
- }
- const drawn = drawnPx(tag, body);
- if ('undetermined' in drawn) {
- expect(
- allowed[i],
- `${file} #${i}: ${drawn.undetermined}; add it to the allow-list`
- ).toBeDefined();
- seen.add(i);
- return;
- }
- expect(allowed[i], `${file} #${i} is allow-listed but its size is derivable`).toBeUndefined();
- expect(Number(variant[1]), `${file} #${i} draws ${drawn.px} px`).toBe(drawn.px);
- });
- expect(Object.keys(allowed).map(Number).sort()).toEqual([...seen].sort());
-};
diff --git a/src/app/phoneTapTargets.test.ts b/src/app/phoneTapTargets.test.ts
deleted file mode 100644
index bbcde9e6..00000000
--- a/src/app/phoneTapTargets.test.ts
+++ /dev/null
@@ -1,225 +0,0 @@
-import { describe, expect, it } from 'vitest';
-import { MOBILE_BREAKPOINT } from './hooks/useScreenSize';
-import {
- classLists,
- emitted,
- expectPhoneHitClasses,
- expectSizeTie,
- rulesFor,
- type SizeAllow,
-} from './phoneHitTestKit';
-
-const PHONE = `screen and (max-width: ${MOBILE_BREAKPOINT}px)`;
-const TAP = 44;
-
-// [target, css file, selector, measured height in CSS px on the Starfire phone run (390x844), free space measured
-// above and below the target before its neighbour's box (taps2-REPORT.md): the hit area may reach out of the layout
-// box (negative margin) by no more than that, or it takes taps from its neighbour. Space it needs beyond that is
-// real layout growth, which the rules above take from the padding the margin does not give back.
-const targets: [string, string, RegExp, number, number, number][] = [
- [
- 'sender-name button',
- 'components/message/layout/layout.css.ts',
- /^button\.layout_Username__/,
- 23,
- 11,
- 11,
- ],
- [
- 'room-topic button',
- 'features/room/RoomViewHeader.css.ts',
- /RoomViewHeader_HeaderTopic__\w+$/,
- 18,
- 0,
- 26,
- ],
- ['sign-in card links', 'pages/auth/styles.css.ts', /styles_AuthCard__\w+ a$/, 16, 14, 14],
- [
- 'forget-password link',
- 'pages/auth/styles.css.ts',
- /styles_AuthCard__\w+ a\.styles_ForgotLink__\w+$/,
- 16,
- 5,
- 16,
- ],
- // The footer's rows are 22 px apart on a phone (AuthFooterLinks), 11 px for each side of the gap.
- ['sign-in footer links', 'pages/auth/styles.css.ts', /styles_AuthFooter__\w+ a$/, 22, 11, 11],
-];
-
-describe.each(targets)('phone tap target: %s', (_name, file, selector, height, above, below) => {
- it(`grows its hit area to ${TAP} px without moving layout`, async () => {
- const css = await emitted(file);
- const [phone] = rulesFor(css, selector, PHONE);
- expect(phone, 'a phone rule exists').toBeDefined();
- const top = phone['padding-top'] ?? phone['padding-block'] ?? 0;
- const bottom = phone['padding-bottom'] ?? phone['padding-block'] ?? 0;
- const marginTop = phone['margin-top'] ?? phone['margin-block'] ?? 0;
- const marginBottom = phone['margin-bottom'] ?? phone['margin-block'] ?? 0;
- expect(height + top + bottom).toBeGreaterThanOrEqual(TAP);
- // the hit area reaches out of the layout box by no more than the free space on that side
- expect(-marginTop).toBeLessThanOrEqual(above);
- expect(-marginBottom).toBeLessThanOrEqual(below);
- expect(marginTop).toBeLessThanOrEqual(0);
- expect(marginBottom).toBeLessThanOrEqual(0);
- });
-
- it('leaves every other screen as it was: no padding or margin outside the phone query', async () => {
- const css = await emitted(file);
- rulesFor(css, selector, undefined).forEach((decls) =>
- expect(Object.keys(decls).filter((k) => /^(padding|margin)/.test(k))).toEqual([])
- );
- });
-});
-
-describe('phone navigator rows', () => {
- // The links and buttons inside a row are 44 px (EstateNavigator.css.ts); a row shorter than that lets them spill
- // onto the next row (the 38 px pitch of taps2-REPORT.md), so the row and the section header are 44 too.
- it('are as tall as their tap targets', async () => {
- const css = await emitted('components/nav/styles.css.ts');
- const phone = [
- ...css.matchAll(/@media screen and \(max-width: 750px\) \{\n([\s\S]*?\n)\}(?:\n|$)/g),
- ]
- .map((m) => m[1])
- .join('\n');
- expect(phone.match(/min-height: 2\.75rem/g)?.length).toBeGreaterThanOrEqual(2);
- });
-});
-
-describe('phone icon-button hit areas', () => {
- const stripPhone = (css: string) => css.replace(/@media [^{]+ \{\n[\s\S]*?\n\}(?:\n|$)/g, '');
-
- it('draw a 44 x 44 box around the button on a phone and nothing on any other screen', async () => {
- const css = await emitted('styles/PhoneHit.css.ts');
- const phone = [...css.matchAll(/@media ([^{]+) \{\n([\s\S]*?\n)\}(?:\n|$)/g)];
- expect(phone.map((m) => m[1])).toEqual([PHONE]);
- expect(css).toMatch(/::after \{[^}]*width: max\(100%, 44px\);[^}]*height: max\(100%, 44px\);/);
- // no content, no box: the pseudo-element is not rendered at all
- expect(css).toMatch(/::after \{[^}]*content: "";/);
- expect(css).toMatch(/::after \{[^}]*position: absolute;/);
- // centred on the button: top and left at half, pulled back by half its own size
- expect(css).toMatch(/::after \{[^}]*top: 50%;/);
- expect(css).toMatch(/::after \{[^}]*left: 50%;/);
- expect(css).toMatch(/::after \{[^}]*transform: translate\(-50%, -50%\);/);
- // the box anchors to its own button, receives the tap, and sits above nothing it should not
- expect(css).toMatch(/@media [^{]+ \{\n\s*\.PhoneHit_PhoneHit__\w+ \{\n\s*position: relative;/);
- // PhoneHit and PhoneHitInPlace each draw it; the Spread and Room classes compose PhoneHit
- const afters = [...css.matchAll(/::after \{\n([^}]*)\}/g)];
- expect(afters).toHaveLength(2);
- const afterDecls = afters.flatMap((m) =>
- m[1]
- .split('\n')
- .map((l) => l.trim().split(':')[0])
- .filter(Boolean)
- );
- expect([...new Set(afterDecls)].sort()).toEqual([
- 'content',
- 'height',
- 'left',
- 'position',
- 'top',
- 'transform',
- 'width',
- ]);
- // nothing on a phone moves a button off its own anchor: only relative (the button) and absolute (the boxes)
- expect([...css.matchAll(/position: (\w+);/g)].map((m) => m[1]).sort()).toEqual([
- 'absolute',
- 'absolute',
- 'relative',
- ]);
- expect(stripPhone(css).trim()).toBe('');
- });
-
- it('open a row up by half the shortfall, so neighbouring hit areas meet and do not overlap', async () => {
- const css = await emitted('styles/PhoneHit.css.ts');
- const margins = (selector: RegExp) =>
- rulesFor(css, selector, PHONE).map((d) => d['margin-inline']);
- // 32 px composer buttons, 40 px header buttons, 26 px message-option buttons (which also open vertically,
- // the menu around them clips a hit area drawn outside its box)
- // each class owns its own margin: (44 - drawn size) / 2
- const own = (size: number) => margins(new RegExp(`PhoneHit_PhoneHitSpread${size}__`));
- expect([24, 26, 28, 32, 36, 40].map(own)).toEqual([[10], [9], [8], [6], [4], [2]]);
- // the Room variants open the block axis by the same amount, on top of their Spread class
- const room = (size: number) =>
- rulesFor(css, new RegExp(`PhoneHit_PhoneHitRoom${size}__`), PHONE);
- expect([room(26), room(36)]).toEqual([[{ 'margin-block': 9 }], [{ 'margin-block': 4 }]]);
- });
-
- it('compose a Room variant from the Spread class of the same size, which composes PhoneHit', async () => {
- const lists = await classLists('styles/PhoneHit.css.ts');
- const named = (list: string[], name: string) => list.filter((c) => c.includes(`_${name}__`));
- [26, 36].forEach((size) => {
- const room = lists[`PhoneHitRoom${size}`];
- expect(
- named(room, `PhoneHitSpread${size}`),
- `Room${size} composes Spread${size}`
- ).toHaveLength(1);
- expect(named(room, 'PhoneHit'), `Room${size} composes PhoneHit`).toHaveLength(1);
- });
- expect(lists.PhoneHitRoom36.some((c) => c.includes('_PhoneHitSpread26__'))).toBe(false);
- });
-
- it("make a message's reaction chip 44 px to tap by opening 9 px above and below it", async () => {
- const css = await emitted('components/message/Reaction.css.ts');
- const [chip] = rulesFor(css, /^button\.Reaction_Reaction__\w+$/, PHONE);
- expect(chip['margin-block']).toBe((TAP - 26) / 2);
- expect(css).toMatch(/::after \{[^}]*inset: -9px 0;/);
- rulesFor(css, /^button\.Reaction_Reaction__\w+$/, undefined).forEach((d) =>
- expect(Object.keys(d)).not.toContain('margin-block')
- );
- });
-
- it('give a sender name a 44 px wide button too, text kept at its start', async () => {
- const css = await emitted('components/message/layout/layout.css.ts');
- const [phone] = rulesFor(css, /^button\.layout_Username__/, PHONE);
- expect(phone['min-width']).toBe(TAP);
- expect(css).toMatch(/text-align: start;/);
- });
-});
-
-describe('icon buttons in the room view', () => {
- // The class each IconButton must carry, in source order: the variant is chosen by the button's drawn size
- // and whether a clipping container or neighbours surround it, so a swapped variant is a wrong hit area.
- const expected: Record = {
- 'features/room/message/Message.tsx': [
- 'PhoneHitSpread32', // quick-reaction emoji buttons
- 'PhoneHitSpread32', // delete dialog close
- 'PhoneHitSpread32', // report dialog close
- ...Array(6).fill('PhoneHitRoom26'), // message options bar, inside a clipping menu
- ],
- 'features/room/RoomInput.tsx': ['PhoneHitSpread24', ...Array(5).fill('PhoneHitSpread32')], // reply cancel is a 16 px icon, the rest 24 px
- 'features/room/RoomViewHeader.tsx': Array(6).fill('PhoneHitSpread40'),
- // The chat path's other buttons. Two neighbours in a row: Spread32. One on its own: the plain PhoneHit.
- 'features/room/message/MessageEditor.tsx': ['PhoneHitSpread32', 'PhoneHitSpread32'], // toolbar, emoji
- 'features/room-nav/RoomNavItem.tsx': ['PhoneHitSpread24', 'PhoneHitSpread24'], // chat toggle, options: 16 px icon + 8 padding = 24 px, 0 gap
- 'features/room/MembersDrawer.tsx': ['PhoneHit', 'PhoneHit'], // close, scroll to top
- 'features/room/reaction-viewer/ReactionViewer.tsx': ['PhoneHit'],
- 'features/room/room-pin-menu/RoomPinMenu.tsx': ['PhoneHitSpread26', 'PhoneHit'], // unpin (26 px, 8 px from the Open chip), close
- 'features/room/RoomViewTyping.tsx': ['PhoneHit'],
- 'features/room/CallChatView.tsx': ['PhoneHit'],
- 'features/room/jump-to-time/JumpToTime.tsx': ['PhoneHit'],
- // Buttons that were fixed with #125 and had no test.
- 'components/password-input/PasswordInput.tsx': ['PhoneHit'],
- 'features/desk/Desk.tsx': ['PhoneHit'],
- 'features/scene/SceneViewEntry.tsx': ['PhoneHit'], // the scene view's entry
- 'features/scene/SceneViewHost.tsx': ['PhoneHit'], // Return while the scene view loads
- 'features/scene/view/SceneView.tsx': ['PhoneHit'], // one rail button, five icons
- 'pages/auth/login/PasswordLoginForm.tsx': ['PhoneHit'],
- };
-
- // IconButtons whose drawn size the source does not say (file -> index in source order -> why). Everything else
- // is derived from the size props, so a Spread32 on a 24 px button fails.
- const sizeAllow: SizeAllow = {
- 'features/room/message/Message.tsx': {
- 0: 'quick-reaction button wraps an emoji , no Icon; 32 px by its CSS class',
- },
- };
-
- it.each(Object.entries(expected))(
- '%s: each IconButton carries its own PhoneHit class',
- (file, want) => expectPhoneHitClasses(file, want)
- );
-
- it.each(Object.keys(expected))('%s: each sized variant equals the px its button draws', (file) =>
- expectSizeTie(file, sizeAllow)
- );
-});
diff --git a/src/app/plugins/react-custom-html-parser.tsx b/src/app/plugins/react-custom-html-parser.tsx
index 2398a4c9..961131d9 100644
--- a/src/app/plugins/react-custom-html-parser.tsx
+++ b/src/app/plugins/react-custom-html-parser.tsx
@@ -22,7 +22,6 @@ import Linkify from 'linkify-react';
import { ErrorBoundary } from 'react-error-boundary';
import { ChildNode } from 'domhandler';
import * as css from '../styles/CustomHtml.css';
-import { PhoneHitSpread24 } from '../styles/PhoneHit.css';
import {
getMxIdLocalPart,
getCanonicalAliasRoomId,
@@ -283,7 +282,6 @@ export function CodeBlock({
variant="SurfaceVariant"
outlined
radii="300"
- className={PhoneHitSpread24}
onClick={toggleExpand}
aria-label={expanded ? 'Collapse' : 'Expand'}
>
diff --git a/src/app/styles/PhoneHit.css.ts b/src/app/styles/PhoneHit.css.ts
deleted file mode 100644
index e971ecb3..00000000
--- a/src/app/styles/PhoneHit.css.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-import { style } from '@vanilla-extract/css';
-import { MOBILE_BREAKPOINT } from '../hooks/useScreenSize';
-
-// Phone tap target for an icon button: on a phone the button's hit area is 44 x 44 px centred on the drawn
-// button (a ::after the button's own click reaches), so nothing drawn changes size. A button with neighbours
-// 44 px closer than that would take their taps, so the `Spread` classes also give it horizontal margin of half
-// the shortfall: the row grows by that, on phones only, and the hit areas meet instead of overlapping.
-// Vertical room is cheaper than horizontal on a phone, so only the horizontal axis pays.
-export const PHONE_TAP = 44;
-const PHONE = `screen and (max-width: ${MOBILE_BREAKPOINT}px)`;
-
-const hitArea = {
- '@media': {
- [PHONE]: {
- content: '""',
- position: 'absolute',
- top: '50%',
- left: '50%',
- width: `max(100%, ${PHONE_TAP}px)`,
- height: `max(100%, ${PHONE_TAP}px)`,
- transform: 'translate(-50%, -50%)',
- },
- },
-} as const;
-
-/** An icon button on its own: the hit area grows, nothing else moves. */
-export const PhoneHit = style({
- '@media': { [PHONE]: { position: 'relative' } },
- selectors: { '&::after': hitArea },
-});
-
-/** For a button that is already positioned (absolute or fixed) by its own class: PhoneHit's `position: relative`
- * would fight that class by stylesheet order, and the positioned button already contains its ::after. */
-export const PhoneHitInPlace = style({ selectors: { '&::after': hitArea } });
-
-const spreads = new Map();
-
-/** An icon button in a row, `visual` px wide: the row opens up so its 44 px hit area meets its neighbours'. */
-const spread = (visual: number) => {
- const cls = style(
- [PhoneHit, { '@media': { [PHONE]: { marginInline: (PHONE_TAP - visual) / 2 } } }],
- `PhoneHitSpread${visual}`
- );
- spreads.set(visual, cls);
- return cls;
-};
-
-export const PhoneHitSpread24 = spread(24);
-export const PhoneHitSpread26 = spread(26);
-export const PhoneHitSpread28 = spread(28);
-export const PhoneHitSpread32 = spread(32);
-export const PhoneHitSpread36 = spread(36);
-export const PhoneHitSpread40 = spread(40);
-
-/** For a button in a clipping container (a Menu's overflow hidden eats a hit area drawn outside the box): the row
- * opens up on both axes, so the 44 px sits inside the container. It is the Spread class of the same size plus the
- * block margin, so the two axes cannot disagree about the size. */
-const room = (visual: number) => {
- const spreadClass = spreads.get(visual);
- if (!spreadClass) throw new Error(`PhoneHitRoom${visual} needs a PhoneHitSpread${visual}`);
- return style(
- [spreadClass, { '@media': { [PHONE]: { marginBlock: (PHONE_TAP - visual) / 2 } } }],
- `PhoneHitRoom${visual}`
- );
-};
-
-export const PhoneHitRoom26 = room(26);
-export const PhoneHitRoom36 = room(36);
diff --git a/src/phoneGlyph.css.ts b/src/phoneGlyph.css.ts
index 14707f63..c9d601f6 100644
--- a/src/phoneGlyph.css.ts
+++ b/src/phoneGlyph.css.ts
@@ -1,14 +1,13 @@
import { globalStyle } from '@vanilla-extract/css';
import { MOBILE_BREAKPOINT } from './app/hooks/useScreenSize';
-// Phone glyph size. On a phone the glyph inside an IconButton is drawn larger, by `scale` (a paint-time transform:
-// the button's box, its PhoneHit area and every row of buttons keep the layout they have, so nothing reflows at
-// 320 px). folds draws a glyph at one of its Icon sizes and the IconButton's box is padding plus that glyph, so the
-// factor is chosen per Icon size. Desktop is not touched.
+// Phone IconButton ergonomics: on a phone each IconButton gets a centred 44 x 44 px ::after hit
+// area and its glyph scales up at paint time, so nothing reflows at 320 px. Desktop is not touched.
//
// The class names are folds 2.7.2's own (the Icon size classes and the IconButton base class); phoneGlyph.test.ts
-// reads them back from folds' dist, so a folds upgrade that renames them fails there instead of silently here.
+// checks them against folds/dist/style.css, so a folds upgrade that renames them fails there instead of silently here.
export const ICON_BUTTON_CLASS = 'brs7ce5';
+export const PHONE_TAP = 44;
/** folds Icon size -> [its class, its px, the px it is drawn at on a phone]. The 24 px glyph is the folds default and
* reads small in a 40 px button, so it grows too; 28 px and up are already large. */
export const PHONE_GLYPHS = {
@@ -21,6 +20,24 @@ export const PHONE_GLYPHS = {
const PHONE = `screen and (max-width: ${MOBILE_BREAKPOINT}px)`;
+globalStyle(`:where(.${ICON_BUTTON_CLASS})`, {
+ '@media': { [PHONE]: { position: 'relative' } },
+});
+
+globalStyle(`.${ICON_BUTTON_CLASS}::after`, {
+ '@media': {
+ [PHONE]: {
+ content: '""',
+ position: 'absolute',
+ top: '50%',
+ left: '50%',
+ width: `max(100%, ${PHONE_TAP}px)`,
+ height: `max(100%, ${PHONE_TAP}px)`,
+ transform: 'translate(-50%, -50%)',
+ },
+ },
+});
+
Object.values(PHONE_GLYPHS).forEach(({ cls, px, phonePx }) =>
globalStyle(`.${ICON_BUTTON_CLASS} > .${cls}`, {
'@media': { [PHONE]: { scale: `${phonePx / px}` } },