Skip to content

Commit 0d117c2

Browse files
committed
deep source
1 parent 8e3ff6a commit 0d117c2

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

examples/nextjs/src/app/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { LandingPage } from "@repo/shared/dist/server";
2-
import { Demo } from "@repo/shared";
32
import ThemesList from "./themes-list";
43
import styles from "./page.module.css";
54
import LocalColorSwitch from "./local-color-switch";

lib/src/client/theme-switcher/theme-switcher.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import useRGS from "r18gs";
22
import type { SetStateAction } from "r18gs";
3-
import * as React from "react";
43
import type { ColorSchemePreference, ThemeState } from "../../constants";
54
import { DEFAULT_ID, DEFAULT_THEME_STATE } from "../../constants";
5+
import { useEffect } from "react";
66

77
export interface ThemeSwitcherProps {
88
/** id of target element to apply classes to. This is useful when you want to apply theme only to specific container. */
@@ -16,7 +16,7 @@ export interface ThemeSwitcherProps {
1616
}
1717

1818
const useMediaQuery = (setThemeState: SetStateAction<ThemeState>) => {
19-
React.useEffect(() => {
19+
useEffect(() => {
2020
// set event listener for media
2121
const media = matchMedia("(prefers-color-scheme: dark)");
2222
const updateSystemColorScheme = () => {
@@ -42,7 +42,7 @@ const parseState = (str?: string | null) => {
4242
let tInit = 0;
4343

4444
const useLoadSyncedState = ({ dontSync, targetId, setThemeState }: LoadSyncedStateProps) => {
45-
React.useEffect(() => {
45+
useEffect(() => {
4646
if (dontSync) return;
4747
tInit = Date.now();
4848
const key = targetId ?? DEFAULT_ID;
@@ -96,7 +96,7 @@ const applyClasses = ({ targets, theme, resolvedColorScheme, styles }: ApplyClas
9696
t?.classList.remove(cls[0]); // dark
9797
t?.classList.remove(cls[1]); // light
9898
t?.classList.forEach(c => {
99-
if (/(?:^|_)th-/.exec(c)) t.classList.remove(c);
99+
if (/(?:^|_)th-/.test(c)) t.classList.remove(c);
100100
});
101101
t?.classList.add(cls[2]); // theme
102102
t?.classList.add(cls[3]); // resolvedColorScheme
@@ -149,7 +149,7 @@ export const ThemeSwitcher = ({
149149
useLoadSyncedState({ dontSync, targetId, setThemeState });
150150

151151
/** update DOM and storage */
152-
React.useEffect(() => {
152+
useEffect(() => {
153153
const restoreTransitions = modifyTransition(themeTransition, targetId);
154154
updateDOM({ targetId, themeState, dontSync, styles });
155155
if (!dontSync && tInit < Date.now() - 300) {

lib/src/server/force-theme/force-theme.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as React from "react";
21
import type { HTMLProps } from "react";
32

43
interface ForceThemeProps extends HTMLProps<HTMLElement> {

lib/src/server/server-target/server-target.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as React from "react";
21
import { cookies } from "next/headers";
32
import { DEFAULT_ID } from "../../constants";
43

0 commit comments

Comments
 (0)