wayBetter for X

This commit is contained in:
CRTkafa 2026-10-01 06:01:13 +07:00
commit 2f1e35ba20
720 changed files with 147465 additions and 0 deletions

View file

@ -0,0 +1,42 @@
// Which of X's `<svg>` boxes is which icon (framework themeIcons.ts draws a pack over them). The
// container is the matcher wherever X has a stable hook (test ids, link targets); the set state of
// an action comes from its own test id (`like` / `unlike`). Read live on x.com 2026-09-30 (nav,
// actions, composer toolbar); `share` and the composer tools are matched by their accessible
// container in the English UI only where no test id exists, so they sit in groups of their own.
import type { IconTable } from '../../../../waybetter/packages/runtime/src/themeIcons.ts';
const NAV = 'header[role="banner"] nav[role="navigation"]';
const ACT = 'article[data-testid="tweet"] [role="group"]';
const TOOLS = '[data-testid="toolBar"] nav';
export const X_ICONS: IconTable = {
home: { ctx: `${NAV} [data-testid="AppTabBar_Home_Link"] svg`, group: 'nav', core: true },
explore: { ctx: `${NAV} [data-testid="AppTabBar_Explore_Link"] svg`, group: 'nav', core: true },
notifications: { ctx: `${NAV} [data-testid="AppTabBar_Notifications_Link"] svg`, group: 'nav', core: true },
messages: { ctx: `${NAV} [data-testid="AppTabBar_DirectMessage_Link"] svg`, group: 'nav' },
grok: { ctx: `${NAV} a[href="/i/grok"] svg`, group: 'nav' },
bookmarks: { ctx: `${NAV} a[href="/i/bookmarks"] svg`, group: 'nav' },
lists: { ctx: `${NAV} a[href$="/lists"] svg`, group: 'nav' },
communities: { ctx: `${NAV} a[href$="/communities"] svg`, group: 'nav' },
premium: { ctx: `${NAV} a[href^="/i/premium"] svg,${NAV} a[href^="/i/verified"] svg`, group: 'nav' },
profile: { ctx: `${NAV} [data-testid="AppTabBar_Profile_Link"] svg`, group: 'nav', core: true },
more: { ctx: `${NAV} [data-testid="AppTabBar_More_Menu"] svg`, group: 'nav', core: true },
compose: { ctx: 'header[role="banner"] [data-testid="SideNav_NewTweet_Button"] svg', group: 'nav' },
reply: { ctx: `${ACT} [data-testid="reply"] svg`, group: 'actions', core: true },
repost: { ctx: `${ACT} [data-testid="retweet"] svg`, group: 'actions', core: true },
'repost.on': { ctx: `${ACT} [data-testid="unretweet"] svg`, group: 'actions' },
like: { ctx: `${ACT} [data-testid="like"] svg`, group: 'actions', core: true },
'like.on': { ctx: `${ACT} [data-testid="unlike"] svg`, group: 'actions' },
views: { ctx: `${ACT} a[href$="/analytics"] svg`, group: 'actions' },
bookmark: { ctx: `${ACT} [data-testid="bookmark"] svg`, group: 'actions' },
'bookmark.on': { ctx: `${ACT} [data-testid="removeBookmark"] svg`, group: 'actions' },
share: { ctx: `${ACT} > div:last-child [role="button"] svg`, group: 'actions' },
media: { ctx: `${TOOLS} [role="button"]:has(+ input[data-testid="fileInput"]) svg,${TOOLS} [data-testid="fileInput"] ~ [role="button"] svg`, group: 'composer' },
gif: { ctx: `${TOOLS} [data-testid="gifSearchButton"] svg`, group: 'composer' },
poll: { ctx: `${TOOLS} [data-testid="createPollButton"] svg`, group: 'composer' },
emoji: { ctx: `${TOOLS} [aria-label="Add emoji"] svg`, group: 'composer' },
schedule: { ctx: `${TOOLS} [data-testid="scheduleOption"] svg`, group: 'composer' },
location: { ctx: `${TOOLS} [data-testid="geoButton"] svg`, group: 'composer' },
search: { ctx: 'form[role="search"] [data-testid="SearchBox_Search_Input_label"] svg', group: 'misc' },
};