@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.
- package/CHANGELOG.md +8 -0
- package/ROADMAP.md +142 -204
- package/docs/design/signal.md +51 -48
- package/package.json +1 -1
- package/src/config/appearance.ts +0 -1
- package/src/extension/core/segment-context.ts +20 -20
- package/src/extension/core/state.ts +2 -1
- package/src/extension/core/types.ts +4 -1
- package/src/extension/session/session-lifecycle.ts +9 -65
- package/src/extension/session/session-notifications.ts +91 -0
- package/src/extension/ui/deck/component.ts +46 -13
- package/src/extension/ui/deck/render.ts +4 -4
- package/src/extension/ui/deck/session-snapshot.ts +52 -34
- package/src/extension/ui/deck/types.ts +14 -7
- package/src/extension/ui/signal-layout.ts +0 -1
- package/src/signal/controller.ts +12 -0
- package/src/signal/integration.ts +7 -3
- package/src/theme/tokens/mapping.ts +11 -52
- package/src/theme/tokens/types.ts +3 -36
- package/src/usage/token-budget.ts +23 -0
|
@@ -1,39 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
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
|
-
|
|
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,
|