@codefast/theme 0.8.2 → 0.8.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 CHANGED
@@ -1,5 +1,41 @@
1
1
  # @codefast/theme
2
2
 
3
+ ## 0.8.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#892](https://github.com/codefastlabs/codefast/pull/892) [`4c97c5b`](https://github.com/codefastlabs/codefast/commit/4c97c5b8c2314f25ee9df7eac5a4b5dd723d6d90) Thanks [@thevuong](https://github.com/thevuong)! - Lower the monorepo's Node floor from 24 to 22.12, so the packages install and run on the active Node 22 LTS line.
8
+
9
+ `engines.node` becomes `>=22.12.0` across every package — the floor the shared toolchain (oxlint, Vite, Vitest, TanStack
10
+ Start) already requires. Development stays on the latest Node (`.node-version`) for speed, and a CI matrix exercises the
11
+ floor and the active LTS directly, so the floor is a contract CI proves rather than one everyone has to run.
12
+ `@types/node` is pinned to the floor's major (`^22`), with a workspace override holding the whole tree there so a dev
13
+ tool's `@types/node: "*"` peer can no longer pull a newer major and mask an API the floor lacks. The floor stays
14
+ mechanical, not advisory: `@codefast/di` keeps its own `Map` upsert helpers rather than the ES2025
15
+ `Map.prototype.getOrInsert` (which would raise the floor to 26) and its `lib` stays `ES2024`. `@codefast/cli`'s mirror
16
+ step now calls the `node:path` functions directly instead of aliasing them, which the floor's types correctly flag as
17
+ unbound methods.
18
+
19
+ The shared `@codefast/typescript-config` presets pin `lib` and `target` to `ES2024` (was `ESNext`) so the compiler's
20
+ ECMAScript surface matches the Node floor: an ES2025 builtin such as `Map.prototype.getOrInsert` now fails to type-check
21
+ rather than compiling and crashing on Node 22.12. `@codefast/di` and `@codefast/di-testing` already pinned `lib` and are
22
+ unchanged.
23
+
24
+ Internal subpath imports move from a `#/` prefix to a bare `#` (`#core/token`, not `#/core/token`), and the
25
+ `package.json#imports` keys become `#*`/`#tests/*`/`#examples/*` to match. Node's native ESM resolver rejects a
26
+ `#/`-prefixed specifier with `ERR_INVALID_MODULE_SPECIFIER` on the whole Node 22 line (and on Node 24 before 24.14), and
27
+ each package ships those specifiers verbatim inside its published `dist/*.js` for a consumer's Node to resolve — so this
28
+ rename is what actually lets the packages import on the new floor. Purely internal: a consumer's own import paths are
29
+ unchanged.
30
+
31
+ ## 0.8.3
32
+
33
+ ### Patch Changes
34
+
35
+ - [#850](https://github.com/codefastlabs/codefast/pull/850) [`db17956`](https://github.com/codefastlabs/codefast/commit/db17956ca01e5f9c4cca545e194804e8d1591f09) Thanks [@thevuong](https://github.com/thevuong)! - Import Zod as a namespace (`import * as z from "zod"`) so bundlers can tree-shake it. The named `import { z }` kept
36
+ Zod's full locale set in the bundle; the appearance provider's browser bundle now drops roughly 80% (~91 KB → ~18 KB
37
+ gzip).
38
+
3
39
  ## 0.8.2
4
40
 
5
41
  ### Patch Changes
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 CodeFast Labs
3
+ Copyright (c) 2024 Codefast Labs
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -34,7 +34,7 @@ pnpm add @codefast/theme
34
34
  # yarn add @codefast/theme
35
35
  ```
36
36
 
37
- `react` and `react-dom` 19 or later are peer dependencies, and `@codefast/theme` requires Node.js 24 or later. The
37
+ `react` and `react-dom` 19 or later are peer dependencies, and `@codefast/theme` requires Node.js 22.12 or later. The
38
38
  package is published on 0.x and versioned on its own track: breaking changes ship as minor versions, so pin the minor
39
39
  version when you need stability.
40
40
 
@@ -1,5 +1,5 @@
1
1
  import type { Context } from "react";
2
- import type { AppearanceContextValue } from "#/appearance";
2
+ import type { AppearanceContextValue } from "#appearance";
3
3
  /**
4
4
  * React context for appearance state management.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import type { JSX, ReactNode } from "react";
2
- import type { Appearance } from "#/appearance";
2
+ import type { Appearance } from "#appearance";
3
3
  /**
4
4
  * Props for {@link AppearanceProvider}.
5
5
  *
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { startTransition, useCallback, useEffect, useEffectEvent, useLayoutEffect, useMemo, useOptimistic, useRef, useState, useSyncExternalStore, } from "react";
3
- import { appearanceSchema } from "#/appearance";
4
- import { AppearanceContext } from "#/appearance-context";
5
- import { getSystemColorScheme } from "#/color-scheme";
6
- import { DEFAULT_APPEARANCE, DEFAULT_COLOR_SCHEME, MEDIA, STORAGE_KEY, SYNC_CHANNEL } from "#/constants";
7
- import { applyColorScheme, suppressTransitions } from "#/dom";
3
+ import { appearanceSchema } from "#appearance";
4
+ import { AppearanceContext } from "#appearance-context";
5
+ import { getSystemColorScheme } from "#color-scheme";
6
+ import { DEFAULT_APPEARANCE, DEFAULT_COLOR_SCHEME, MEDIA, STORAGE_KEY, SYNC_CHANNEL } from "#constants";
7
+ import { applyColorScheme, suppressTransitions } from "#dom";
8
8
  /* -----------------------------------------------------------------------------
9
9
  * System Color Scheme Subscription
10
10
  *
@@ -1,5 +1,5 @@
1
1
  import type { JSX } from "react";
2
- import type { Appearance } from "#/appearance";
2
+ import type { Appearance } from "#appearance";
3
3
  /**
4
4
  * Props for {@link AppearanceScript}.
5
5
  *
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { appearances, appearanceSchema } from "#/appearance";
3
- import { DEFAULT_APPEARANCE, MEDIA, STORAGE_KEY } from "#/constants";
2
+ import { appearances, appearanceSchema } from "#appearance";
3
+ import { DEFAULT_APPEARANCE, MEDIA, STORAGE_KEY } from "#constants";
4
4
  /* JSON.stringify does not escape </script>, so we replace the three characters that
5
5
  * can form a closing tag: < > /. Unicode escapes are valid JS and safe in HTML. */
6
6
  function toScriptSafe(value) {
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import * as z from "zod";
2
2
  /**
3
3
  * Zod schema for appearance validation.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import * as z from "zod";
2
2
  /* -----------------------------------------------------------------------------
3
3
  * Schema & Types
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { Appearance, ColorScheme } from "#/appearance";
1
+ import type { Appearance, ColorScheme } from "#appearance";
2
2
  /**
3
3
  * Detects the OS color scheme preference.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { DEFAULT_COLOR_SCHEME, MEDIA } from "#/constants";
1
+ import { DEFAULT_COLOR_SCHEME, MEDIA } from "#constants";
2
2
  // ── Color Scheme Resolution ──────────────────────────────────────────────────────────────────────────────────────────
3
3
  /**
4
4
  * Detects the OS color scheme preference.
@@ -1,4 +1,4 @@
1
- import type { Appearance, ColorScheme } from "#/appearance";
1
+ import type { Appearance, ColorScheme } from "#appearance";
2
2
  /**
3
3
  * Default appearance preference when no stored value exists.
4
4
  *
package/dist/dom.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ColorScheme } from "#/appearance";
1
+ import type { ColorScheme } from "#appearance";
2
2
  /**
3
3
  * Applies a color scheme to the DOM by updating the `<html>` element.
4
4
  *
package/dist/index.d.ts CHANGED
@@ -11,12 +11,12 @@
11
11
  * - **`@codefast/theme/color-scheme` / `@codefast/theme/dom`**: `getSystemColorScheme`, `applyColorScheme`, `suppressTransitions`.
12
12
  * - **`@codefast/theme/appearance-context`**: `AppearanceContext` for rare custom wiring.
13
13
  */
14
- export type { Appearance, AppearanceContextValue, ColorScheme } from "#/appearance";
15
- export { appearances, appearanceSchema } from "#/appearance";
16
- export { DEFAULT_APPEARANCE, DEFAULT_COLOR_SCHEME } from "#/constants";
17
- export { AppearanceProvider } from "#/appearance-provider";
18
- export type { AppearanceProviderProps } from "#/appearance-provider";
19
- export { useAppearance } from "#/use-appearance";
20
- export { AppearanceScript } from "#/appearance-script";
21
- export type { AppearanceScriptProps } from "#/appearance-script";
22
- export { resolveColorScheme } from "#/color-scheme";
14
+ export type { Appearance, AppearanceContextValue, ColorScheme } from "#appearance";
15
+ export { appearances, appearanceSchema } from "#appearance";
16
+ export { DEFAULT_APPEARANCE, DEFAULT_COLOR_SCHEME } from "#constants";
17
+ export { AppearanceProvider } from "#appearance-provider";
18
+ export type { AppearanceProviderProps } from "#appearance-provider";
19
+ export { useAppearance } from "#use-appearance";
20
+ export { AppearanceScript } from "#appearance-script";
21
+ export type { AppearanceScriptProps } from "#appearance-script";
22
+ export { resolveColorScheme } from "#color-scheme";
package/dist/index.js CHANGED
@@ -11,13 +11,13 @@
11
11
  * - **`@codefast/theme/color-scheme` / `@codefast/theme/dom`**: `getSystemColorScheme`, `applyColorScheme`, `suppressTransitions`.
12
12
  * - **`@codefast/theme/appearance-context`**: `AppearanceContext` for rare custom wiring.
13
13
  */
14
- export { appearances, appearanceSchema } from "#/appearance";
14
+ export { appearances, appearanceSchema } from "#appearance";
15
15
  // Constants
16
- export { DEFAULT_APPEARANCE, DEFAULT_COLOR_SCHEME } from "#/constants";
16
+ export { DEFAULT_APPEARANCE, DEFAULT_COLOR_SCHEME } from "#constants";
17
17
  // Provider & Hook (use `@codefast/theme/appearance-context` for `AppearanceContext`)
18
- export { AppearanceProvider } from "#/appearance-provider";
19
- export { useAppearance } from "#/use-appearance";
18
+ export { AppearanceProvider } from "#appearance-provider";
19
+ export { useAppearance } from "#use-appearance";
20
20
  // Script (FOUC prevention)
21
- export { AppearanceScript } from "#/appearance-script";
21
+ export { AppearanceScript } from "#appearance-script";
22
22
  // Resolution: `getSystemColorScheme` lives under `@codefast/theme/color-scheme`
23
- export { resolveColorScheme } from "#/color-scheme";
23
+ export { resolveColorScheme } from "#color-scheme";
@@ -1,4 +1,4 @@
1
- import type { AppearanceContextValue } from "#/appearance";
1
+ import type { AppearanceContextValue } from "#appearance";
2
2
  /**
3
3
  * Hook to access appearance context.
4
4
  *
@@ -1,5 +1,5 @@
1
1
  import { use } from "react";
2
- import { AppearanceContext } from "#/appearance-context";
2
+ import { AppearanceContext } from "#appearance-context";
3
3
  // ── Hook ─────────────────────────────────────────────────────────────────────────────────────────────────────────────
4
4
  /**
5
5
  * Hook to access appearance context.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codefast/theme",
3
- "version": "0.8.2",
3
+ "version": "0.8.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",
@@ -16,7 +16,7 @@
16
16
  "url": "https://github.com/codefastlabs/codefast/issues"
17
17
  },
18
18
  "license": "MIT",
19
- "author": "Vuong Phan <mr.thevuong@gmail.com>",
19
+ "author": "Vuong Phan <mr.thevuong@gmail.com> (https://github.com/thevuong)",
20
20
  "repository": {
21
21
  "type": "git",
22
22
  "url": "git+https://github.com/codefastlabs/codefast.git",
@@ -34,14 +34,7 @@
34
34
  "module": "./dist/index.js",
35
35
  "types": "./dist/index.d.ts",
36
36
  "imports": {
37
- "#/tests/*": [
38
- "./tests/*",
39
- "./tests/*.ts",
40
- "./tests/*.tsx",
41
- "./tests/*/index.ts",
42
- "./tests/*/index.tsx"
43
- ],
44
- "#/*": {
37
+ "#*": {
45
38
  "types": "./dist/*.d.ts",
46
39
  "default": "./dist/*.js"
47
40
  }
@@ -89,21 +82,7 @@
89
82
  "access": "public"
90
83
  },
91
84
  "dependencies": {
92
- "zod": "^4.5.4"
93
- },
94
- "devDependencies": {
95
- "@testing-library/dom": "^10.4.1",
96
- "@testing-library/jest-dom": "^7.0.1",
97
- "@testing-library/react": "^16.3.3",
98
- "@testing-library/user-event": "^14.6.7",
99
- "@types/node": "^26.4.1",
100
- "@vitejs/plugin-react": "^6.1.1",
101
- "@vitest/coverage-v8": "^5.0.0",
102
- "jsdom": "^30.0.1",
103
- "typescript": "^7.0.2",
104
- "vite": "^8.2.2",
105
- "vitest": "^5.0.0",
106
- "@codefast/typescript-config": "0.9.0"
85
+ "zod": "^4.6.5"
107
86
  },
108
87
  "peerDependencies": {
109
88
  "@types/react": ">=19.0.0",
@@ -120,18 +99,6 @@
120
99
  }
121
100
  },
122
101
  "engines": {
123
- "node": ">=24.0.0"
124
- },
125
- "scripts": {
126
- "build": "rm -rf dist && tsc -p tsconfig.build.json",
127
- "check-types": "tsc --noEmit",
128
- "clean": "rm -rf dist",
129
- "test": "vitest run",
130
- "test:coverage": "vitest run --coverage",
131
- "test:e2e": "vitest run tests/e2e",
132
- "test:integration": "vitest run tests/integration",
133
- "test:type": "vitest run tests/types",
134
- "test:unit": "vitest run tests/unit",
135
- "test:watch": "vitest"
102
+ "node": ">=22.12.0"
136
103
  }
137
104
  }