@harmonia-core/ui 1.0.0

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.
Files changed (77) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +267 -0
  3. package/dist/capacity/animation.d.ts +77 -0
  4. package/dist/capacity/animation.d.ts.map +1 -0
  5. package/dist/capacity/constants.d.ts +119 -0
  6. package/dist/capacity/constants.d.ts.map +1 -0
  7. package/dist/capacity/feedback.d.ts +55 -0
  8. package/dist/capacity/feedback.d.ts.map +1 -0
  9. package/dist/capacity/fields/field-manager.d.ts +45 -0
  10. package/dist/capacity/fields/field-manager.d.ts.map +1 -0
  11. package/dist/capacity/index.d.ts +15 -0
  12. package/dist/capacity/index.d.ts.map +1 -0
  13. package/dist/capacity/index.js +1313 -0
  14. package/dist/capacity/index.js.map +1 -0
  15. package/dist/capacity/index.mjs +1267 -0
  16. package/dist/capacity/index.mjs.map +1 -0
  17. package/dist/capacity/mode.d.ts +50 -0
  18. package/dist/capacity/mode.d.ts.map +1 -0
  19. package/dist/capacity/prediction/hooks.d.ts +11 -0
  20. package/dist/capacity/prediction/hooks.d.ts.map +1 -0
  21. package/dist/capacity/prediction/pattern-extractor.d.ts +26 -0
  22. package/dist/capacity/prediction/pattern-extractor.d.ts.map +1 -0
  23. package/dist/capacity/prediction/pattern-store.d.ts +35 -0
  24. package/dist/capacity/prediction/pattern-store.d.ts.map +1 -0
  25. package/dist/capacity/prediction/prediction-engine.d.ts +39 -0
  26. package/dist/capacity/prediction/prediction-engine.d.ts.map +1 -0
  27. package/dist/capacity/prediction/types.d.ts +24 -0
  28. package/dist/capacity/prediction/types.d.ts.map +1 -0
  29. package/dist/capacity/provider.d.ts +119 -0
  30. package/dist/capacity/provider.d.ts.map +1 -0
  31. package/dist/capacity/signals/aggregator.d.ts +38 -0
  32. package/dist/capacity/signals/aggregator.d.ts.map +1 -0
  33. package/dist/capacity/signals/detectors/environment-detector.d.ts +31 -0
  34. package/dist/capacity/signals/detectors/environment-detector.d.ts.map +1 -0
  35. package/dist/capacity/signals/detectors/input-detector.d.ts +23 -0
  36. package/dist/capacity/signals/detectors/input-detector.d.ts.map +1 -0
  37. package/dist/capacity/signals/detectors/interaction-detector.d.ts +27 -0
  38. package/dist/capacity/signals/detectors/interaction-detector.d.ts.map +1 -0
  39. package/dist/capacity/signals/detectors/scroll-detector.d.ts +35 -0
  40. package/dist/capacity/signals/detectors/scroll-detector.d.ts.map +1 -0
  41. package/dist/capacity/signals/detectors/session-detector.d.ts +23 -0
  42. package/dist/capacity/signals/detectors/session-detector.d.ts.map +1 -0
  43. package/dist/capacity/signals/detectors/time-detector.d.ts +20 -0
  44. package/dist/capacity/signals/detectors/time-detector.d.ts.map +1 -0
  45. package/dist/capacity/signals/detectors/types.d.ts +25 -0
  46. package/dist/capacity/signals/detectors/types.d.ts.map +1 -0
  47. package/dist/capacity/signals/signal-bus.d.ts +50 -0
  48. package/dist/capacity/signals/signal-bus.d.ts.map +1 -0
  49. package/dist/capacity/types.d.ts +239 -0
  50. package/dist/capacity/types.d.ts.map +1 -0
  51. package/dist/capacity/utils/index.d.ts +7 -0
  52. package/dist/capacity/utils/index.d.ts.map +1 -0
  53. package/dist/capacity/utils/typography.d.ts +176 -0
  54. package/dist/capacity/utils/typography.d.ts.map +1 -0
  55. package/dist/components/ambient-field-monitor.d.ts +10 -0
  56. package/dist/components/ambient-field-monitor.d.ts.map +1 -0
  57. package/dist/components/capacity-controls.d.ts +15 -0
  58. package/dist/components/capacity-controls.d.ts.map +1 -0
  59. package/dist/components/capacity-demo-card.d.ts +13 -0
  60. package/dist/components/capacity-demo-card.d.ts.map +1 -0
  61. package/dist/components/index.d.ts +18 -0
  62. package/dist/components/index.d.ts.map +1 -0
  63. package/dist/components/index.js +1703 -0
  64. package/dist/components/index.js.map +1 -0
  65. package/dist/components/index.mjs +1688 -0
  66. package/dist/components/index.mjs.map +1 -0
  67. package/dist/components/ui/badge.d.ts +8 -0
  68. package/dist/components/ui/badge.d.ts.map +1 -0
  69. package/dist/components/ui/button.d.ts +10 -0
  70. package/dist/components/ui/button.d.ts.map +1 -0
  71. package/dist/components/ui/card.d.ts +10 -0
  72. package/dist/components/ui/card.d.ts.map +1 -0
  73. package/dist/components/ui/select.d.ts +6 -0
  74. package/dist/components/ui/select.d.ts.map +1 -0
  75. package/dist/components/ui/slider.d.ts +14 -0
  76. package/dist/components/ui/slider.d.ts.map +1 -0
  77. package/package.json +98 -0
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Typography Utilities - Renge (Proportional Form)
3
+ *
4
+ * Font scaling based on golden ratio with subtle randomness
5
+ * and energy-based adjustments for cognitive load adaptation.
6
+ *
7
+ * Philosophy:
8
+ * - Legibility first: minimum sizes and contrast are non-negotiable
9
+ * - φ-based modular scale prevents arbitrary sizing
10
+ * - Small random jitter (±5%) prevents mechanical rigidity
11
+ * - Energy-based bias: low energy = larger (readability), high = smaller (density)
12
+ */
13
+ import type { DensityMode } from "../types";
14
+ /**
15
+ * Typography roles in the UI hierarchy
16
+ * Maps to semantic HTML elements
17
+ */
18
+ export type TypographyRole = "h1" | "h2" | "h3" | "h4" | "body" | "caption" | "label";
19
+ /**
20
+ * Energy levels derived from EnergyField
21
+ * Influences sizing bias for cognitive adaptation
22
+ */
23
+ export type EnergyLevel = "low" | "medium" | "high";
24
+ /**
25
+ * Attention levels derived from AttentionField
26
+ * Influences weight and spacing for focus
27
+ */
28
+ export type AttentionLevel = "low" | "medium" | "high";
29
+ /**
30
+ * Modular scale function using golden ratio
31
+ *
32
+ * @param step - Power of φ to scale by (can be negative for smaller sizes)
33
+ * @param base - Base size in pixels (default: 16)
34
+ * @returns Scaled size in pixels
35
+ *
36
+ * Example:
37
+ * modularScale(2) → 16 * φ^2 ≈ 41.89px
38
+ * modularScale(-1) → 16 * φ^-1 ≈ 9.89px
39
+ */
40
+ export declare function modularScale(step: number, base?: number): number;
41
+ /**
42
+ * Get font size with φ-based scaling, random jitter, and energy bias
43
+ *
44
+ * @param role - Typography role (h1, h2, body, etc.)
45
+ * @param energy - Energy level from EnergyField (default: medium)
46
+ * @param options - Optional overrides
47
+ * @returns Font size in pixels (clamped to minimum)
48
+ *
49
+ * Design decisions:
50
+ * 1. Uses φ-based modular scale for natural proportions
51
+ * 2. Adds ±5% random jitter to prevent mechanical feel
52
+ * 3. Biases size based on energy: low = larger, high = smaller
53
+ * 4. Always respects minimum font size for accessibility
54
+ */
55
+ export declare function getFontSize(role: TypographyRole, energy?: EnergyLevel, options?: {
56
+ base?: number;
57
+ jitter?: boolean;
58
+ minSize?: number;
59
+ }): number;
60
+ /**
61
+ * Get font weight based on attention level
62
+ *
63
+ * @param attention - Attention level from AttentionField
64
+ * @returns Font weight value (400-500)
65
+ *
66
+ * Higher attention = bolder text to help maintain focus
67
+ */
68
+ export declare function getFontWeight(attention?: AttentionLevel): number;
69
+ /**
70
+ * Get letter spacing based on attention level
71
+ *
72
+ * @param attention - Attention level from AttentionField
73
+ * @returns Letter spacing in em units
74
+ *
75
+ * Tighter tracking when focused, looser when relaxed
76
+ */
77
+ export declare function getLetterSpacing(attention?: AttentionLevel): number;
78
+ /**
79
+ * Get line height based on typography role
80
+ *
81
+ * @param role - Typography role
82
+ * @returns Line height as unitless multiplier
83
+ *
84
+ * Design decisions:
85
+ * - Headings: tighter (1.2-1.3) for visual impact
86
+ * - Body: comfortable reading (1.5-1.6)
87
+ * - Always maintains readability standards
88
+ */
89
+ export declare function getLineHeight(role: TypographyRole): number;
90
+ /**
91
+ * Get complete typography styles for a role
92
+ *
93
+ * @param role - Typography role
94
+ * @param energy - Energy level from EnergyField
95
+ * @param attention - Attention level from AttentionField
96
+ * @returns Complete CSS-in-JS typography object
97
+ *
98
+ * Returns all typography properties in one call for convenience
99
+ */
100
+ export declare function getTypographyStyles(role: TypographyRole, energy?: EnergyLevel, attention?: AttentionLevel): {
101
+ fontSize: string;
102
+ fontWeight: number;
103
+ lineHeight: number;
104
+ letterSpacing: string;
105
+ };
106
+ /**
107
+ * Get responsive font size with clamp()
108
+ *
109
+ * @param role - Typography role
110
+ * @param energy - Energy level
111
+ * @returns CSS clamp() expression for fluid typography
112
+ *
113
+ * Creates fluid typography that scales between viewport sizes
114
+ * while respecting φ-based proportions
115
+ */
116
+ export declare function getFluidFontSize(role: TypographyRole, energy?: EnergyLevel): string;
117
+ /**
118
+ * Fibonacci-based spacing scale.
119
+ * Each step is a Fibonacci number × SPACING_BASE (4px):
120
+ *
121
+ * Step | Fibonacci | px | rem
122
+ * -----|-----------|-----|-----
123
+ * 0 | 1 | 4 | 0.25
124
+ * 1 | 1 | 4 | 0.25
125
+ * 2 | 2 | 8 | 0.5
126
+ * 3 | 3 | 12 | 0.75
127
+ * 4 | 5 | 20 | 1.25
128
+ * 5 | 8 | 32 | 2
129
+ * 6 | 13 | 52 | 3.25
130
+ * 7 | 21 | 84 | 5.25
131
+ * 8 | 34 | 136 | 8.5
132
+ * 9 | 55 | 220 | 13.75
133
+ */
134
+ export declare const SPACING_SCALE: number[];
135
+ /**
136
+ * Get spacing value from Fibonacci scale.
137
+ *
138
+ * @param step - Scale step (0–11, maps to FIBONACCI sequence)
139
+ * @param unit - Return "px" string, "rem" string, or raw number (default: "px")
140
+ * @returns Spacing value
141
+ *
142
+ * @example
143
+ * getSpacing(4) // "20px" (Fibonacci[4]=5 × 4)
144
+ * getSpacing(5, "rem") // "2rem" (Fibonacci[5]=8 × 4 / 16)
145
+ * getSpacing(3, "raw") // 12
146
+ */
147
+ export declare function getSpacing(step: number, unit?: "px" | "rem" | "raw"): string | number;
148
+ /**
149
+ * Get proportional padding/gap values based on current density mode.
150
+ *
151
+ * Returns CSS-ready spacing strings using the Fibonacci scale,
152
+ * scaled back at low density (less space) and up at high density (more breathing room).
153
+ *
154
+ * @param density - Current density mode from InterfaceMode
155
+ * @returns Object of CSS spacing values for padding, gap, etc.
156
+ */
157
+ export declare function getProportionalSpacing(density: DensityMode): {
158
+ xs: string;
159
+ sm: string;
160
+ md: string;
161
+ lg: string;
162
+ gap: string;
163
+ };
164
+ /**
165
+ * Get a φ-based size ratio for proportional component scaling.
166
+ *
167
+ * @param steps - Number of φ steps (positive = larger, negative = smaller)
168
+ * @returns Unitless multiplier based on powers of φ
169
+ *
170
+ * @example
171
+ * phiRatio(1) // 1.618 — golden ratio
172
+ * phiRatio(-1) // 0.618 — inverse golden ratio
173
+ * phiRatio(2) // 2.618 — φ²
174
+ */
175
+ export declare function phiRatio(steps: number): number;
176
+ //# sourceMappingURL=typography.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../../lib/capacity/utils/typography.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAM3C;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAA;AAErF;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAA;AAEnD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAA;AAgEtD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAuB,GAAG,MAAM,CAEhF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,cAAc,EACpB,MAAM,GAAE,WAAsB,EAC9B,OAAO,CAAC,EAAE;IACR,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,GACA,MAAM,CAiBR;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,SAAS,GAAE,cAAyB,GAAG,MAAM,CAE1E;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,GAAE,cAAyB,GAAG,MAAM,CAE7E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAY1D;AAMD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,cAAc,EACpB,MAAM,GAAE,WAAsB,EAC9B,SAAS,GAAE,cAAyB;;;;;EAQrC;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,GAAE,WAAsB,GAAG,MAAM,CAM7F;AASD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,UAAyC,CAAA;AAEnE;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,IAAI,GAAG,KAAK,GAAG,KAAY,GAChC,MAAM,GAAG,MAAM,CAOjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG;IAC5D,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;CACZ,CAWA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9C"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Mode Derivation Monitor - Shows how inputs become interface modes
3
+ *
4
+ * Three columns:
5
+ * 1. Your Inputs (4 values with live gauges)
6
+ * 2. Derived Mode (label + token pills)
7
+ * 3. UI Effects (active effect list)
8
+ */
9
+ export declare function AmbientFieldMonitor(): import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=ambient-field-monitor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ambient-field-monitor.d.ts","sourceRoot":"","sources":["../../lib/components/ambient-field-monitor.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,wBAAgB,mBAAmB,4CAOlC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Capacity-Adaptive UI Controls - Phase 1 Manual Input System (4 Inputs)
3
+ *
4
+ * STRICT SEPARATION OF CONCERNS:
5
+ * ┌─────────────┬────────────────────────────────────┬─────────────────────────────┐
6
+ * │ Slider │ Controls │ Must NOT Control │
7
+ * ├─────────────┼────────────────────────────────────┼─────────────────────────────┤
8
+ * │ Cognitive │ density, hierarchy, concurrency │ tone, animation speed │
9
+ * │ Temporal │ content length, shortcuts, defaults│ color, layout structure │
10
+ * │ Emotional │ motion restraint, friction │ content importance │
11
+ * │ Valence │ tone, expressiveness │ information volume │
12
+ * └─────────────┴────────────────────────────────────┴─────────────────────────────┘
13
+ */
14
+ export declare function CapacityControls(): import("react/jsx-runtime").JSX.Element;
15
+ //# sourceMappingURL=capacity-controls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capacity-controls.d.ts","sourceRoot":"","sources":["../../lib/components/capacity-controls.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAiKH,wBAAgB,gBAAgB,4CAgR/B"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Capacity Demo Card
3
+ *
4
+ * A live demonstration of how UI adapts to capacity state.
5
+ *
6
+ * STRICT SEPARATION OF CONCERNS:
7
+ * - Cognitive → density (how many items shown, visual complexity)
8
+ * - Temporal → content length (full vs abbreviated text)
9
+ * - Emotional → motion restraint (animation intensity)
10
+ * - Valence → tone only (greeting warmth, accent color)
11
+ */
12
+ export declare function CapacityDemoCard(): import("react/jsx-runtime").JSX.Element;
13
+ //# sourceMappingURL=capacity-demo-card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capacity-demo-card.d.ts","sourceRoot":"","sources":["../../lib/components/capacity-demo-card.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAuEH,wBAAgB,gBAAgB,4CAmG/B"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @harmonia-core/ui — Pre-built Components
3
+ *
4
+ * Drop-in components for the capacity system.
5
+ * Requires DaisyUI for styling and `motion` for CapacityControls animations.
6
+ *
7
+ * @example
8
+ * import { CapacityControls, CapacityDemoCard, AmbientFieldMonitor } from "@harmonia-core/ui/components"
9
+ */
10
+ export { CapacityControls } from "./capacity-controls";
11
+ export { CapacityDemoCard } from "./capacity-demo-card";
12
+ export { AmbientFieldMonitor } from "./ambient-field-monitor";
13
+ export { Badge } from "./ui/badge";
14
+ export { Button } from "./ui/button";
15
+ export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, } from "./ui/card";
16
+ export { Select } from "./ui/select";
17
+ export { Slider } from "./ui/slider";
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/components/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAG7D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EACL,IAAI,EACJ,UAAU,EACV,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,GACZ,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA"}