Other exports
Values exported from @tangible/ui that belong to no single component.
GENERATIVE_COLORS:GenerativeColor[]. Bag order matters:stringToGenerativeColorindexes into it by hash.stringToGenerativeColor:(str: string) => GenerativeColor. Deterministically pick a bag color for a string (name, tag, id). Case-insensitive: "Ada" and "ada" get the same bean.markThemeSwitch:(doc?: Document) => void. Mark the document as mid-switch, so a theme change made now styles every control at once instead of fading it in. Call it before you changedata-themeyourself, for example in the toggle handler of a React app that rendersdata-theme={theme}in JSX:onClick={() => { markThemeSwitch(); setTheme(next); }}The marker comes off two animation frames later (or after 100ms if frames are paused). React commits a click's update before the next frame, so the first style pass sees the new theme with durations at zero; the second frame removes the marker, which changes only durations and starts nothing. Overlapping calls are counted, so an earlier call never removes a later call's marker. The count lives in the attribute, so two copies of TUI on one page share it.setColorScheme:(scheme: ColorScheme, root?: Element | null) => void. Set the color scheme onroot, instantly: no control fades into the new theme (seemarkThemeSwitch). Writesdata-themeonrootitself; it does not look for an ancestor that carries one.'light': removesdata-theme(the default state);'dark': setsdata-theme="dark";'auto': setsdata-theme="auto"(followsprefers-color-scheme; light wherematchMediais unsupported) Limit: under'auto', an OS-level light/dark change still fades, since no script call precedes it.getColorScheme:(root?: Element | null) => ColorScheme. Read the color scheme set onroot.getResolvedColorScheme:(root?: Element | null) => "light" | "dark". Read the scheme actually displayed:'auto'resolves throughprefers-color-scheme.toggleColorScheme:(root?: Element | null) => ColorScheme. Toggle between light and dark (skips auto), instantly, likesetColorScheme.THEME_SWITCHING_ATTR:"data-tui-theme-switching". Marker that zeroes--tui-motion-durationon every.tui-interfacewhile present (seesrc/styles/index.scss).markThemeSwitch()manages it; set it by hand only on<html>or<body>, since a body-level portal root is a sibling of the page's interface and a marker on the interface misses it.