@groeponline/pi-wishcraft 1.2.0 → 1.3.1

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.
@@ -1,39 +1,6 @@
1
1
  /**
2
- * src/theme/tokens/types.ts
3
- * ---------------------------------------------------------------------------
4
- * Semantic Design Tokens for Wishcraft (Crush pattern).
5
- * ---------------------------------------------------------------------------
2
+ * Compatibility exports for the canonical Wishcraft token contract.
3
+ * New code should import from src/config/types.ts.
6
4
  */
7
5
 
8
- import type { ThemeColor } from "@earendil-works/pi-coding-agent";
9
-
10
- export type ColorValue = ThemeColor | `#${string}`;
11
-
12
- export interface WishcraftTokens {
13
- // Surfaces & Backgrounds
14
- surface: ColorValue;
15
- surfaceRaised: ColorValue;
16
-
17
- // Typography
18
- text: ColorValue;
19
- textMuted: ColorValue;
20
-
21
- // Brand & Accents
22
- primary: ColorValue;
23
- secondary: ColorValue;
24
- accent: ColorValue;
25
-
26
- // Feedback & State
27
- success: ColorValue;
28
- warning: ColorValue;
29
- error: ColorValue;
30
-
31
- // Interaction
32
- focus: ColorValue;
33
- selection: ColorValue;
34
-
35
- // Motion & Animation Channels
36
- motionDim: ColorValue;
37
- motionHot: ColorValue;
38
- motionTrail: ColorValue;
39
- }
6
+ export type { ColorValue, WishcraftTokens } from "../../config/types.ts";
@@ -12,6 +12,12 @@ export interface TokenBudgetLevel {
12
12
  level: 0 | 80 | 100;
13
13
  }
14
14
 
15
+ export interface TokenBudgetSnapshot {
16
+ day: string;
17
+ dailyLimit: number | null;
18
+ dailyUsed: number;
19
+ }
20
+
15
21
  export function parseTokenBudget(wishcraftSettings: unknown): TokenBudget {
16
22
  if (!wishcraftSettings || typeof wishcraftSettings !== "object") {
17
23
  return { daily: null };
@@ -36,6 +42,23 @@ export function tokenBudgetLevel(used: number, daily: number | null): TokenBudge
36
42
  return { ratio, level: 0 };
37
43
  }
38
44
 
45
+ /**
46
+ * Return the budget visible for a local day. A long-lived session that crosses
47
+ * midnight must never carry yesterday's usage into the new day; the next
48
+ * lifecycle refresh will repopulate usage from disk after a new usage event.
49
+ */
50
+ export function tokenBudgetSnapshotForDay(
51
+ snapshot: TokenBudgetSnapshot,
52
+ day: string,
53
+ ): TokenBudgetSnapshot {
54
+ if (snapshot.day === day) return snapshot;
55
+ return {
56
+ day,
57
+ dailyLimit: snapshot.dailyLimit,
58
+ dailyUsed: 0,
59
+ };
60
+ }
61
+
39
62
  export function formatTokenBudgetWarning(
40
63
  used: number,
41
64
  daily: number,