diff --git a/package.json b/package.json index 1ab9d9d8b..072f45906 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "storybook:experimental-vite": "USE_VITE=1 storybook dev -p 6006", "storybook:build": "storybook build", "storybook:build-vite": "USE_VITE=1 storybook build", - "build": "yarn workspaces foreach -vpt -j unlimited run build", + "build": "yarn workspaces foreach -vp --topological-dev -j unlimited run build", "clean": "yarn workspaces foreach -vp run clean", "test": "vitest", "test:image-snapshot": "TEST_RUNNER=vrt concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"http-server storybook-static --port 6006 --silent\" \"wait-on tcp:127.0.0.1:6006 && test-storybook ${*}\"", diff --git a/packages/icons/src/PixivIcon.test.tsx b/packages/icons/src/PixivIcon.test.tsx index 37188ac47..2320511cd 100644 --- a/packages/icons/src/PixivIcon.test.tsx +++ b/packages/icons/src/PixivIcon.test.tsx @@ -17,7 +17,7 @@ describe('PixivIcon', () => { }) it('can createElement()', () => { - expect(icon).toBeInstanceOf(PixivIcon) + expect(icon.constructor.name).toBe('PixivIcon') }) // describe('loaders', () => { diff --git a/packages/styled/src/SetThemeScript.tsx b/packages/react/src/core/SetThemeScript.tsx similarity index 98% rename from packages/styled/src/SetThemeScript.tsx rename to packages/react/src/core/SetThemeScript.tsx index a6c7b3170..b1f358d74 100644 --- a/packages/styled/src/SetThemeScript.tsx +++ b/packages/react/src/core/SetThemeScript.tsx @@ -2,7 +2,7 @@ import { assertKeyString, DEFAULT_ROOT_ATTRIBUTE, LOCAL_STORAGE_KEY, -} from './helper' +} from './themeHelper' interface Props { localStorageKey: string diff --git a/packages/styled/src/helper.ts b/packages/react/src/core/themeHelper.ts similarity index 100% rename from packages/styled/src/helper.ts rename to packages/react/src/core/themeHelper.ts diff --git a/packages/react/src/index.ts b/packages/react/src/index.ts index 2fe019bf2..2fe492750 100644 --- a/packages/react/src/index.ts +++ b/packages/react/src/index.ts @@ -4,6 +4,17 @@ export { CharcoalProvider, type CharcoalProviderProps, } from './core/CharcoalProvider' +export { makeSetThemeScriptCode, SetThemeScript } from './core/SetThemeScript' +export { + getThemeSync, + themeSetter, + themeSelector, + prefersColorScheme, + useTheme, + useThemeSetter, + useLocalStorage, + useMedia, +} from './core/themeHelper' export { default as Button, type ButtonProps } from './components/Button' export { default as Clickable, diff --git a/packages/styled/package.json b/packages/styled/package.json index aeb90ea6a..7e91abec8 100644 --- a/packages/styled/package.json +++ b/packages/styled/package.json @@ -21,6 +21,7 @@ "test": "vitest run --passWithNoTests" }, "devDependencies": { + "@charcoal-ui/react": "^4.2.1", "@types/react": "^18.3.3", "@types/react-test-renderer": "^18.3.0", "@types/styled-components": "^5.1.21", @@ -44,6 +45,7 @@ "warning": "^4.0.3" }, "peerDependencies": { + "@charcoal-ui/react": "^4.2.1", "react": ">=17.0.0", "styled-components": ">=5.1.1" }, diff --git a/packages/styled/src/index.ts b/packages/styled/src/index.ts index 518b7793a..4de98d8df 100644 --- a/packages/styled/src/index.ts +++ b/packages/styled/src/index.ts @@ -14,10 +14,11 @@ export { useThemeSetter, useLocalStorage, useMedia, -} from './helper' + makeSetThemeScriptCode, + SetThemeScript, +} from '@charcoal-ui/react' export { defineThemeVariables } from './util' export { removeHalfLeadingCss } from './utils/typographyCss' -export * from './SetThemeScript' type Blank = null | undefined | false diff --git a/yarn.lock b/yarn.lock index dfe22de9c..2bc03cdbb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2248,6 +2248,7 @@ __metadata: resolution: "@charcoal-ui/styled@workspace:packages/styled" dependencies: "@charcoal-ui/foundation": ^4.2.1 + "@charcoal-ui/react": ^4.2.1 "@charcoal-ui/theme": ^4.2.1 "@charcoal-ui/utils": ^4.2.1 "@types/react": ^18.3.3 @@ -2267,6 +2268,7 @@ __metadata: vitest: ^2.0.2 warning: ^4.0.3 peerDependencies: + "@charcoal-ui/react": ^4.2.1 react: ">=17.0.0" styled-components: ">=5.1.1" languageName: unknown