@codefast/theme 0.5.0-canary.3 → 0.5.0-canary.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/appearance-context.d.mts +2 -3
- package/dist/appearance.d.mts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/use-appearance.d.mts +2 -2
- package/package.json +3 -3
- package/src/appearance-context.ts +2 -4
- package/src/appearance-provider.tsx +2 -2
- package/src/appearance.ts +1 -1
- package/src/index.ts +1 -1
- package/src/use-appearance.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @codefast/theme
|
|
2
2
|
|
|
3
|
+
## 0.5.0-canary.4
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c634b17`](https://github.com/codefastlabs/codefast/commit/c634b17e6a8d742cbc54e4074408eea51fb55d40) Thanks [@thevuong](https://github.com/thevuong)! - Rename `AppearanceContextType` to `AppearanceContextValue` — the "Type" suffix carried no information (every exported type is a type), while "Value" states the role: the payload provided through `AppearanceContext` and returned by `useAppearance`.
|
|
8
|
+
|
|
3
9
|
## 0.5.0-canary.3
|
|
4
10
|
|
|
5
11
|
## 0.5.0-canary.2
|
package/README.md
CHANGED
|
@@ -314,7 +314,7 @@ The root `@codefast/theme` entry re-exports the common surface. Granular subpath
|
|
|
314
314
|
| Subpath | Contents |
|
|
315
315
|
| ------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
316
316
|
| `@codefast/theme` | `AppearanceProvider`, `useAppearance`, `AppearanceScript`, `resolveColorScheme`, types, defaults |
|
|
317
|
-
| `@codefast/theme/appearance` | `Appearance`, `ColorScheme`, `
|
|
317
|
+
| `@codefast/theme/appearance` | `Appearance`, `ColorScheme`, `AppearanceContextValue`, `appearances`, `appearanceSchema` |
|
|
318
318
|
| `@codefast/theme/appearance-provider` | `AppearanceProvider` |
|
|
319
319
|
| `@codefast/theme/appearance-script` | `AppearanceScript` |
|
|
320
320
|
| `@codefast/theme/appearance-context` | Raw `AppearanceContext` for custom providers |
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AppearanceContextValue } from "./appearance.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/appearance-context.d.ts
|
|
4
|
-
type AppearanceContextValue = null | AppearanceContextType;
|
|
5
4
|
/**
|
|
6
5
|
* React context for appearance state management.
|
|
7
6
|
*
|
|
@@ -13,6 +12,6 @@ type AppearanceContextValue = null | AppearanceContextType;
|
|
|
13
12
|
*
|
|
14
13
|
* @since 0.5.0-canary.2
|
|
15
14
|
*/
|
|
16
|
-
declare const AppearanceContext: import("react").Context<AppearanceContextValue>;
|
|
15
|
+
declare const AppearanceContext: import("react").Context<AppearanceContextValue | null>;
|
|
17
16
|
//#endregion
|
|
18
17
|
export { AppearanceContext };
|
package/dist/appearance.d.mts
CHANGED
|
@@ -50,11 +50,11 @@ declare const appearances: ("light" | "dark" | "automatic")[];
|
|
|
50
50
|
*
|
|
51
51
|
* @since 0.5.0-canary.2
|
|
52
52
|
*/
|
|
53
|
-
type
|
|
53
|
+
type AppearanceContextValue = {
|
|
54
54
|
readonly isPending: boolean;
|
|
55
55
|
readonly colorScheme: ColorScheme;
|
|
56
56
|
readonly setAppearance: (value: Appearance) => Promise<void>;
|
|
57
57
|
readonly appearance: Appearance;
|
|
58
58
|
};
|
|
59
59
|
//#endregion
|
|
60
|
-
export { Appearance,
|
|
60
|
+
export { Appearance, AppearanceContextValue, ColorScheme, appearanceSchema, appearances };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Appearance,
|
|
1
|
+
import { Appearance, AppearanceContextValue, ColorScheme, appearanceSchema, appearances } from "./appearance.mjs";
|
|
2
2
|
import { AppearanceProvider, AppearanceProviderProps } from "./appearance-provider.mjs";
|
|
3
3
|
import { AppearanceScript, AppearanceScriptProps } from "./appearance-script.mjs";
|
|
4
4
|
import { resolveColorScheme } from "./color-scheme.mjs";
|
|
5
5
|
import { DEFAULT_APPEARANCE, DEFAULT_COLOR_SCHEME } from "./constants.mjs";
|
|
6
6
|
import { useAppearance } from "./use-appearance.mjs";
|
|
7
|
-
export { type Appearance, type
|
|
7
|
+
export { type Appearance, type AppearanceContextValue, AppearanceProvider, type AppearanceProviderProps, AppearanceScript, type AppearanceScriptProps, type ColorScheme, DEFAULT_APPEARANCE, DEFAULT_COLOR_SCHEME, appearanceSchema, appearances, resolveColorScheme, useAppearance };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AppearanceContextValue } from "./appearance.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/use-appearance.d.ts
|
|
4
4
|
/**
|
|
@@ -29,6 +29,6 @@ import { AppearanceContextType } from "./appearance.mjs";
|
|
|
29
29
|
*
|
|
30
30
|
* @since 0.5.0-canary.2
|
|
31
31
|
*/
|
|
32
|
-
declare function useAppearance():
|
|
32
|
+
declare function useAppearance(): AppearanceContextValue;
|
|
33
33
|
//#endregion
|
|
34
34
|
export { useAppearance };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codefast/theme",
|
|
3
|
-
"version": "0.5.0-canary.
|
|
3
|
+
"version": "0.5.0-canary.4",
|
|
4
4
|
"description": "Appearance management for React 19 with HIG-inspired vocabulary - optimistic updates, cross-tab sync, and FOUC-free SSR",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dark-mode",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"@testing-library/react": "^16.3.2",
|
|
111
111
|
"@testing-library/user-event": "^14.6.1",
|
|
112
112
|
"@types/node": "^26.1.0",
|
|
113
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
113
|
+
"@typescript/native-preview": "7.0.0-dev.20260704.1",
|
|
114
114
|
"@vitejs/plugin-react": "^6.0.3",
|
|
115
115
|
"@vitest/coverage-v8": "^4.1.9",
|
|
116
116
|
"jsdom": "^29.1.1",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"typescript": "^6.0.3",
|
|
119
119
|
"vite": "^8.1.3",
|
|
120
120
|
"vitest": "^4.1.9",
|
|
121
|
-
"@codefast/typescript-config": "0.5.0-canary.
|
|
121
|
+
"@codefast/typescript-config": "0.5.0-canary.4"
|
|
122
122
|
},
|
|
123
123
|
"peerDependencies": {
|
|
124
124
|
"@types/react": ">=19.0.0",
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { AppearanceContextValue } from "#/appearance";
|
|
4
4
|
|
|
5
5
|
/* -----------------------------------------------------------------------------
|
|
6
6
|
* Context
|
|
7
7
|
* -------------------------------------------------------------------------- */
|
|
8
8
|
|
|
9
|
-
type AppearanceContextValue = null | AppearanceContextType;
|
|
10
|
-
|
|
11
9
|
/**
|
|
12
10
|
* React context for appearance state management.
|
|
13
11
|
*
|
|
@@ -19,4 +17,4 @@ type AppearanceContextValue = null | AppearanceContextType;
|
|
|
19
17
|
*
|
|
20
18
|
* @since 0.5.0-canary.2
|
|
21
19
|
*/
|
|
22
|
-
export const AppearanceContext = createContext<AppearanceContextValue>(null);
|
|
20
|
+
export const AppearanceContext = createContext<null | AppearanceContextValue>(null);
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useSyncExternalStore,
|
|
12
12
|
} from "react";
|
|
13
13
|
|
|
14
|
-
import type { Appearance,
|
|
14
|
+
import type { Appearance, AppearanceContextValue, ColorScheme } from "#/appearance";
|
|
15
15
|
import { appearanceSchema } from "#/appearance";
|
|
16
16
|
import { AppearanceContext } from "#/appearance-context";
|
|
17
17
|
import { getSystemColorScheme } from "#/color-scheme";
|
|
@@ -349,7 +349,7 @@ export function AppearanceProvider({
|
|
|
349
349
|
);
|
|
350
350
|
|
|
351
351
|
// Expose the optimistic appearance so consumers see immediate updates
|
|
352
|
-
const value = useMemo<
|
|
352
|
+
const value = useMemo<AppearanceContextValue>(
|
|
353
353
|
() => ({
|
|
354
354
|
isPending,
|
|
355
355
|
colorScheme,
|
package/src/appearance.ts
CHANGED
|
@@ -58,7 +58,7 @@ export const appearances = appearanceSchema.options;
|
|
|
58
58
|
*
|
|
59
59
|
* @since 0.5.0-canary.2
|
|
60
60
|
*/
|
|
61
|
-
export type
|
|
61
|
+
export type AppearanceContextValue = {
|
|
62
62
|
readonly isPending: boolean;
|
|
63
63
|
readonly colorScheme: ColorScheme;
|
|
64
64
|
readonly setAppearance: (value: Appearance) => Promise<void>;
|
package/src/index.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
// Types & Schema
|
|
16
|
-
export type { Appearance,
|
|
16
|
+
export type { Appearance, AppearanceContextValue, ColorScheme } from "#/appearance";
|
|
17
17
|
export { appearances, appearanceSchema } from "#/appearance";
|
|
18
18
|
|
|
19
19
|
// Constants
|
package/src/use-appearance.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { use } from "react";
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { AppearanceContextValue } from "#/appearance";
|
|
4
4
|
import { AppearanceContext } from "#/appearance-context";
|
|
5
5
|
|
|
6
6
|
/* -----------------------------------------------------------------------------
|
|
@@ -35,7 +35,7 @@ import { AppearanceContext } from "#/appearance-context";
|
|
|
35
35
|
*
|
|
36
36
|
* @since 0.5.0-canary.2
|
|
37
37
|
*/
|
|
38
|
-
export function useAppearance():
|
|
38
|
+
export function useAppearance(): AppearanceContextValue {
|
|
39
39
|
const value = use(AppearanceContext);
|
|
40
40
|
|
|
41
41
|
if (!value) {
|