@titan-design/react-ui 0.9.3 → 0.11.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 (120) hide show
  1. package/dist/bodymap.js +78 -24
  2. package/dist/bodymap.js.map +1 -1
  3. package/dist/bodymap.mjs +78 -24
  4. package/dist/bodymap.mjs.map +1 -1
  5. package/dist/index.d.mts +429 -11
  6. package/dist/index.d.ts +429 -11
  7. package/dist/index.js +2386 -885
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +2306 -836
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/{pages-DyEx-lBf.d.ts → pages-B1hqnGIC.d.ts} +149 -15
  12. package/dist/{pages-D7hOD4Vj.d.mts → pages-CvsFqNtx.d.mts} +149 -15
  13. package/dist/pages.d.mts +1 -1
  14. package/dist/pages.d.ts +1 -1
  15. package/dist/pages.js +1900 -1609
  16. package/dist/pages.js.map +1 -1
  17. package/dist/pages.mjs +1901 -1610
  18. package/dist/pages.mjs.map +1 -1
  19. package/dist/theme/index.d.mts +129 -34
  20. package/dist/theme/index.d.ts +129 -34
  21. package/dist/theme/index.js +95 -19
  22. package/dist/theme/index.js.map +1 -1
  23. package/dist/theme/index.mjs +92 -20
  24. package/dist/theme/index.mjs.map +1 -1
  25. package/dist/theme/tokens-css.js +88 -24
  26. package/dist/theme/tokens-css.js.map +1 -1
  27. package/dist/theme/tokens-css.mjs +88 -24
  28. package/dist/theme/tokens-css.mjs.map +1 -1
  29. package/package.json +8 -3
  30. package/src/components/custom/Fatigue/DualGhostSpark.stories.tsx +258 -0
  31. package/src/components/custom/Fatigue/DualGhostSpark.test.tsx +138 -0
  32. package/src/components/custom/Fatigue/DualGhostSpark.tsx +208 -0
  33. package/src/components/custom/Fatigue/FatigueLights.stories.tsx +74 -0
  34. package/src/components/custom/Fatigue/FatigueLights.test.tsx +33 -0
  35. package/src/components/custom/Fatigue/FatigueLights.tsx +83 -0
  36. package/src/components/custom/Fatigue/GhostBand.test.tsx +235 -0
  37. package/src/components/custom/Fatigue/GhostBand.tsx +246 -0
  38. package/src/components/custom/Fatigue/GhostBloom.tsx +132 -0
  39. package/src/components/custom/Fatigue/GhostSpark.stories.tsx +175 -0
  40. package/src/components/custom/Fatigue/GhostSpark.test.tsx +45 -0
  41. package/src/components/custom/Fatigue/GhostSpark.tsx +126 -0
  42. package/src/components/custom/Fatigue/LiveFatigueCard.stories.tsx +126 -0
  43. package/src/components/custom/Fatigue/LiveFatigueCard.test.tsx +28 -0
  44. package/src/components/custom/Fatigue/LiveFatigueCard.tsx +86 -0
  45. package/src/components/custom/Fatigue/LiveFatiguePanel.stories.tsx +95 -0
  46. package/src/components/custom/Fatigue/LiveFatiguePanel.tsx +151 -0
  47. package/src/components/custom/Fatigue/README.md +93 -0
  48. package/src/components/custom/Fatigue/RomProgressionChart.stories.tsx +94 -0
  49. package/src/components/custom/Fatigue/RomProgressionChart.test.tsx +31 -0
  50. package/src/components/custom/Fatigue/RomProgressionChart.tsx +132 -0
  51. package/src/components/custom/Fatigue/SilverRedPalette.stories.tsx +226 -0
  52. package/src/components/custom/Fatigue/VelocityHero.stories.tsx +70 -0
  53. package/src/components/custom/Fatigue/VelocityHero.test.tsx +26 -0
  54. package/src/components/custom/Fatigue/VelocityHero.tsx +46 -0
  55. package/src/components/custom/Fatigue/VerdictHero.stories.tsx +59 -0
  56. package/src/components/custom/Fatigue/VerdictHero.test.tsx +49 -0
  57. package/src/components/custom/Fatigue/VerdictHero.tsx +79 -0
  58. package/src/components/custom/Fatigue/fatigue-mock.test.ts +59 -0
  59. package/src/components/custom/Fatigue/fatigue-mock.ts +268 -0
  60. package/src/components/custom/Fatigue/fatigue-model.ts +129 -0
  61. package/src/components/custom/Fatigue/fatigue-tokens.test.ts +70 -0
  62. package/src/components/custom/Fatigue/fatigue-tokens.ts +180 -0
  63. package/src/components/custom/Fatigue/index.ts +41 -0
  64. package/src/components/custom/Fatigue/tempo-pacing.test.ts +176 -0
  65. package/src/components/custom/Fatigue/tempo-pacing.ts +112 -0
  66. package/src/components/custom/Workout/BaseBadge.tsx +5 -5
  67. package/src/components/custom/Workout/DualVelocityStrip.test.tsx +685 -0
  68. package/src/components/custom/Workout/ExerciseCard.test.tsx +4 -4
  69. package/src/components/custom/Workout/ExerciseCard.tsx +3 -1
  70. package/src/components/custom/Workout/ExerciseDetailPage.tsx +7 -1
  71. package/src/components/custom/Workout/README.md +62 -16
  72. package/src/components/custom/Workout/RowInventory.stories.tsx +5 -2
  73. package/src/components/custom/Workout/S3FullRail.stories.tsx +13 -1
  74. package/src/components/custom/Workout/SegmentedBar.stories.tsx +3 -3
  75. package/src/components/custom/Workout/SessionHeader.tsx +2 -2
  76. package/src/components/custom/Workout/SessionRail.stories.tsx +4 -1
  77. package/src/components/custom/Workout/SessionRail.test.tsx +43 -0
  78. package/src/components/custom/Workout/SessionRail.tsx +55 -18
  79. package/src/components/custom/Workout/SetRow.test.tsx +6 -6
  80. package/src/components/custom/Workout/SetRow.tsx +9 -2
  81. package/src/components/custom/Workout/SupersetWrapper.stories.tsx +16 -25
  82. package/src/components/custom/Workout/SupersetWrapper.tsx +1 -1
  83. package/src/components/custom/Workout/TempoDisplay.tsx +3 -7
  84. package/src/components/custom/Workout/VelocityStrip.compact.stories.tsx +191 -0
  85. package/src/components/custom/Workout/VelocityStrip.dual.stories.tsx +186 -0
  86. package/src/components/custom/Workout/VelocityStrip.expanded.stories.tsx +296 -0
  87. package/src/components/custom/Workout/VelocityStrip.hero.stories.tsx +259 -0
  88. package/src/components/custom/Workout/VelocityStrip.stories.tsx +217 -250
  89. package/src/components/custom/Workout/VelocityStrip.test.tsx +196 -79
  90. package/src/components/custom/Workout/VelocityStrip.tsx +953 -609
  91. package/src/components/custom/Workout/VolumeLandmarkBar.stories.tsx +4 -1
  92. package/src/components/custom/Workout/WorkoutPill.tsx +2 -2
  93. package/src/components/custom/Workout/index.ts +3 -0
  94. package/src/components/custom/Workout/velocity-story-kit.tsx +438 -0
  95. package/src/components/custom/charts/SetBarChart.test.tsx +275 -0
  96. package/src/components/custom/charts/SetBarChart.tsx +651 -0
  97. package/src/components/custom/charts/live-rep-growth.ts +91 -0
  98. package/src/components/custom/index.ts +1 -0
  99. package/src/components/ui/surface/Surface.stories.tsx +195 -1
  100. package/src/components/ui/surface/Surface.test.tsx +148 -9
  101. package/src/components/ui/surface/Surface.tsx +37 -9
  102. package/src/components/ui/surface/SurfaceContext.ts +48 -8
  103. package/src/components/ui/surface/index.ts +1 -0
  104. package/src/components/ui/surface/surface.contract.test.ts +283 -0
  105. package/src/test/raw-color-patterns.test.ts +71 -0
  106. package/src/theme/ColorPalettes.stories.tsx +871 -0
  107. package/src/theme/ColorPrimitives.stories.tsx +300 -0
  108. package/src/theme/bar-paper.ts +59 -0
  109. package/src/theme/color-stories.coverage.test.ts +130 -0
  110. package/src/theme/color-story-kit.tsx +170 -0
  111. package/src/theme/config.ts +12 -0
  112. package/src/theme/elevation.ts +90 -67
  113. package/src/theme/global.css +35 -9
  114. package/src/theme/tokens/primitives.ts +40 -0
  115. package/src/theme/tokens/semantic.ts +63 -14
  116. package/tailwind.config.js +8 -0
  117. package/src/components/custom/Workout/VelocityStrip.modalities.stories.tsx +0 -254
  118. package/src/components/custom/Workout/VelocityStrip.responsive.stories.tsx +0 -145
  119. package/src/theme/ColorSystem.stories.tsx +0 -323
  120. package/src/theme/Colors.stories.tsx +0 -323
@@ -17,7 +17,13 @@
17
17
  * - interactive-* : Hover/focus/active/disabled states
18
18
  */
19
19
 
20
- import { primitiveColors as p, primitiveRamps as ramp, discreteRainbow } from './primitives'
20
+ import {
21
+ primitiveColors as p,
22
+ primitiveRamps as ramp,
23
+ discreteRainbow,
24
+ surfaceRampDark as surf,
25
+ backgroundFrameDark,
26
+ } from './primitives'
21
27
 
22
28
  // Light mode semantic colors (default)
23
29
  export const semanticColorsLight = {
@@ -120,11 +126,20 @@ export const semanticColorsLight = {
120
126
  'surface-raised': p.neutral[100], // light gray for raised cards
121
127
  'surface-overlay': p.white,
122
128
  'surface-input': p.neutral[50], // Input field background (filled variant)
129
+ // Deepest pressed pit (TD-surface-tokens, S-3) — light-mode counterpart of
130
+ // the dark ramp's `inset` plane; a placeholder pairing, not part of the
131
+ // dark-ramp investigation (surface.contract.test.ts is dark-mode only).
132
+ 'surface-inset': p.neutral[300],
123
133
 
124
134
  // Background colors (background-*)
125
135
  'background-base': '#EBEBEB',
126
136
  'background-default': p.white,
127
137
  'background-subtle': p.neutral[50],
138
+ // Frame/bezel chrome (TD-surface-tokens, S-3) — top bar + side nav shell,
139
+ // one step below `background-base` (darker still than `surface-inset`
140
+ // above, mirroring the dark-mode ordering). Placeholder pairing for light
141
+ // mode (see dark-mode note on `surface-inset` above).
142
+ 'background-frame': p.neutral[400],
128
143
 
129
144
  // Border colors (border-*)
130
145
  'border-default': '#E8E9EB',
@@ -137,6 +152,12 @@ export const semanticColorsLight = {
137
152
  'border-input-focus': p.blue[600], // Input field border on focus
138
153
  'border-input-error': p.red[600], // Input field border on error
139
154
 
155
+ // Alpha hairline separators (surface-independent — composite toward black on
156
+ // light surfaces, mirroring the dark-mode white-alpha family). See §4/S-2.
157
+ 'hairline-subtle': 'rgba(0, 0, 0, 0.06)',
158
+ 'hairline-default': 'rgba(0, 0, 0, 0.09)',
159
+ 'hairline-strong': 'rgba(0, 0, 0, 0.14)',
160
+
140
161
  // Interactive states (interactive-*)
141
162
  'interactive-hover': 'rgba(55, 65, 81, 0.04)',
142
163
  'interactive-focus': 'rgba(55, 65, 81, 0.12)',
@@ -247,19 +268,38 @@ export const semanticColorsDark = {
247
268
  'text-link': '#828DF8',
248
269
  'text-link-hover': p.blue[400],
249
270
 
250
- // Surface colors - dark backgrounds
251
- 'surface-base': p.charcoal[700], // main surface
252
- 'surface-elevated': p.charcoal[600], // elevated surface
253
- 'surface-raised': p.charcoal[500], // raised surface
254
- 'surface-overlay': p.charcoal[600], // overlay surface
255
- 'surface-input': p.charcoal[600], // input surface
256
-
257
- // Background colors
258
- 'background-base': p.charcoal[900], // darkest charcoal
259
- 'background-default': p.charcoal[700], // main background
260
- 'background-subtle': p.charcoal[500], // subtle background
261
-
262
- // Border colors
271
+ // Surface colors - dark backgrounds — warm-tapered DERIVED ramp (TD-surface-tokens,
272
+ // S-1, re-spaced S-3). Shipped verbatim from `deriveSurfaceRamp()` — see
273
+ // `surfaceRampDark` in primitives.ts for the full derivation note. `surface-overlay`
274
+ // and `surface-elevated` are distinct (were both #191919 pre-S-1); `surface-input`
275
+ // tracks one plane above `surface-base`, same relative position as before the remap.
276
+ // `background-base` backs `Surface level="background"` (SurfaceContext.SURFACE_LEVEL_TOKEN),
277
+ // so it takes the ramp's `background` (shell/frame) role, NOT `inset`. The ramp's
278
+ // deepest `inset` plane is now promoted to `surface-inset` below (S-3) — still no
279
+ // `SurfaceLevel` member for it (follow-up, alongside the elevation.ts -1/-2 pressed
280
+ // levels — parallel workstream, not this branch).
281
+ 'surface-base': surf.base, // main surface (#252321, L*13.5)
282
+ 'surface-elevated': surf.elevated, // elevated surface (#2C2A28, L*17 — nav/rail)
283
+ 'surface-raised': surf.raised, // raised surface (#31302F, L*20 — cards)
284
+ 'surface-overlay': surf.overlay, // overlay surface (#373635, L*22.5 — hero/popover)
285
+ 'surface-input': surf.elevated, // input surface (#2C2A28 — one plane above base)
286
+ 'surface-inset': surf.inset, // deepest pressed pit (#13100D, L*4.5 — sub-shell well)
287
+
288
+ // Background colors — same ramp, the frame/shell end of it.
289
+ 'background-base': surf.background, // shell / frame (#1C1916, L*9 — Surface level="background")
290
+ 'background-default': surf.base, // main background (#252321, L*13.5 — matches surface-base)
291
+ 'background-subtle': surf.elevated, // subtle background (#2C2A28, L*17 — matches surface-elevated)
292
+ // Frame/bezel chrome (S-3) — the top bar + side nav shell; one step BELOW
293
+ // `background-base`, darker even than `surface-inset` — it exits the content
294
+ // ramp entirely rather than sitting in it. See `backgroundFrameDark` in
295
+ // primitives.ts.
296
+ 'background-frame': backgroundFrameDark, // frame / bezel (#100D0A, L*3.79)
297
+
298
+ // Border colors — `border-subtle` (#1C1C1C) previously collided with
299
+ // `surface-raised` (also #1C1C1C, an invisible border on raised cards). The
300
+ // re-spaced ramp above moved `surface-raised` to #2D2C2B, so this value is now
301
+ // distinct from every surface hex without needing to change it — see
302
+ // `surface.contract.test.ts` R2/R4.
263
303
  'border-default': p.charcoal[400], // default border
264
304
  'border-subtle': p.charcoal[500], // subtle border
265
305
  'border-strong': p.charcoal[300], // strong border
@@ -270,6 +310,15 @@ export const semanticColorsDark = {
270
310
  'border-input-focus': '#828DF8',
271
311
  'border-input-error': p.red[500],
272
312
 
313
+ // Alpha hairline separators — the primary separation cue (§4/S-2). Self-
314
+ // normalizing: composites toward white by ~the same amount on ANY plane, so
315
+ // one family works at every elevation instead of per-surface border tokens.
316
+ // Shadows are demoted to floating-overlay use only (not shipped as a fill
317
+ // separator here — see elevation.ts, follow-up S-4).
318
+ 'hairline-subtle': 'rgba(255, 255, 255, 0.06)',
319
+ 'hairline-default': 'rgba(255, 255, 255, 0.09)',
320
+ 'hairline-strong': 'rgba(255, 255, 255, 0.14)',
321
+
273
322
  // Interactive states
274
323
  'interactive-hover': 'rgba(255, 255, 255, 0.04)',
275
324
  'interactive-focus': 'rgba(255, 255, 255, 0.12)',
@@ -119,12 +119,14 @@ module.exports = {
119
119
  raised: 'var(--color-surface-raised)',
120
120
  overlay: 'var(--color-surface-overlay)',
121
121
  input: 'var(--color-surface-input)',
122
+ inset: 'var(--color-surface-inset)',
122
123
  },
123
124
  // Background colors
124
125
  background: {
125
126
  base: 'var(--color-background-base)',
126
127
  DEFAULT: 'var(--color-background-default)',
127
128
  subtle: 'var(--color-background-subtle)',
129
+ frame: 'var(--color-background-frame)',
128
130
  },
129
131
  // Text colors
130
132
  text: {
@@ -163,6 +165,12 @@ module.exports = {
163
165
  text: 'var(--color-interactive-disabled-text)',
164
166
  },
165
167
  },
168
+ // Alpha hairline separators (surface-independent — §4/S-2)
169
+ hairline: {
170
+ subtle: 'var(--color-hairline-subtle)',
171
+ DEFAULT: 'var(--color-hairline-default)',
172
+ strong: 'var(--color-hairline-strong)',
173
+ },
166
174
  // Divider
167
175
  divider: 'var(--color-divider)',
168
176
  // Avatar
@@ -1,254 +0,0 @@
1
- /**
2
- * Set modalities — every per-rep strength set-type rendered by the REAL
3
- * {@link VelocityStrip}. One strip model for every set type: it defaults to the
4
- * target rep count as grey slots, overshoot grows the strip, and open-ended sets
5
- * (AMRAP · the myo tail) carry a persistent cyan "continue" slot. Each card
6
- * carries a `Collapse` accordion showing how to configure the `set` prop for that
7
- * view. Promoted from the Lab/Explorations "Set Modalities" specimen once the
8
- * vocabulary hardened into VelocityStrip's `set` descriptor.
9
- */
10
- import type { Meta, StoryObj } from '@storybook/react-vite'
11
- import { View, Text } from 'react-native'
12
- import { VelocityStrip, type VelocitySet } from './VelocityStrip'
13
- import { Collapse, CollapseButton, CollapseContent } from '../../ui/collapse/Collapse'
14
- import { SET_STRIP_VARIABLE_COLOR as CYAN } from './SetStrip'
15
- import {
16
- GREY,
17
- velColor,
18
- T_PRIMARY,
19
- T_SECONDARY,
20
- T_TERTIARY,
21
- INSET,
22
- BORDER_SUBTLE,
23
- Page,
24
- } from './setHeadingKit'
25
-
26
- const INTER = 'Inter, sans-serif'
27
- const VAR_EDGE = '#22465F' // cyan-800 — the continue-slot outline
28
- const CYAN_TEXT = '#22D3EE'
29
-
30
- /** Pretty-print a value as a compact TS literal (single-line arrays). */
31
- function formatValue(value: unknown): string {
32
- if (Array.isArray(value)) {
33
- if (value.length > 0 && Array.isArray(value[0])) {
34
- return `[${value.map((v) => formatValue(v)).join(', ')}]`
35
- }
36
- return `[${(value as number[]).join(', ')}]`
37
- }
38
- return typeof value === 'string' ? `'${value}'` : String(value)
39
- }
40
-
41
- /** The exact `set` prop, pretty-printed as a TS object for the accordion. */
42
- function formatSet(set: VelocitySet): string {
43
- const body = Object.entries(set)
44
- .map(([key, value]) => ` ${key}: ${formatValue(value)},`)
45
- .join('\n')
46
- return `set={{\n${body}\n}}`
47
- }
48
-
49
- type Modality = {
50
- name: string
51
- alias: string
52
- tags: string[]
53
- def: string
54
- useWhen: string
55
- set: VelocitySet
56
- }
57
-
58
- // Representative velocities per colour bucket, matching the exploration's VEL map
59
- // (g/a/o/r → the real velColor() ramp: fastest green → slowest red).
60
- const G = 1.1
61
- const A = 0.85
62
- const O = 0.6
63
- const R = 0.4
64
-
65
- const MODS: Modality[] = [
66
- {
67
- name: 'Straight set',
68
- alias: '3 × 10',
69
- tags: ['fixed reps'],
70
- def: 'A fixed number of reps at a fixed load — the baseline every other type varies from. Done reps colour; the remainder to the planned count sits grey.',
71
- useWhen: 'A prescribed rep count at a fixed load — the default set.',
72
- set: { type: 'straight', velocities: [G, A, A, O, O, R], planned: 10 },
73
- },
74
- {
75
- name: 'Rep-range',
76
- alias: '8–12',
77
- tags: ['bounded reps'],
78
- def: 'A floor and a ceiling — committed reps to the floor (grey todo), then a variable window (cyan) to the ceiling. A done variable rep is a real rep and colours normally.',
79
- useWhen: 'A hypertrophy set prescribed as a range (e.g. 8–12) rather than a fixed count.',
80
- set: { type: 'range', velocities: [G, A, A, O, O, O, R, R, A], floor: 8, max: 12 },
81
- },
82
- {
83
- name: 'AMRAP',
84
- alias: 'as many reps as possible',
85
- tags: ['open-ended'],
86
- def: 'One set, no cap — the target is a floor to beat. Velocity decay is the story; the trailing cyan slot never closes.',
87
- useWhen: 'A final "leave nothing" set, or a rep-out test where the count is the outcome.',
88
- set: { type: 'amrap', velocities: [G, G, A, A, O, O, O, R, R, R], target: 8 },
89
- },
90
- {
91
- name: 'Drop set',
92
- alias: 'strip / dropset',
93
- tags: ['load drops', 'open-ended'],
94
- def: 'Reps to failure at a load, then DROP the load (no rest) and continue — 1–3 drops. Sub-loads split by a WIDE notch gap.',
95
- useWhen: 'Extending a set past failure by shedding load — the notch marks each weight drop.',
96
- set: { type: 'drop', subloads: [[G, A, O, O, R], [A, O, R], [O, R]] },
97
- },
98
- {
99
- name: 'Myo-reps',
100
- alias: 'rest-pause',
101
- tags: ['clusters', 'open-ended'],
102
- def: 'Activation set to near-failure, then rest-pause mini-clusters at the SAME load until a cluster fails. Open tail → cyan continue.',
103
- useWhen: 'High-density hypertrophy: one activation set milked for extra clusters.',
104
- set: { type: 'myo', activation: [G, A, A, O, O, R], clusters: [[A, O, R], [O, R]], open: true },
105
- },
106
- {
107
- name: 'Cluster set',
108
- alias: 'intra-set rest',
109
- tags: ['fixed reps', 'intra-rest'],
110
- def: 'A fixed rep count at a HIGH load, broken by short intra-set rests so every rep stays fast — power, not failure. Fixed count → no cyan tail.',
111
- useWhen: 'Strength/power work where each rep must stay fast; rests are planned, count is fixed.',
112
- set: { type: 'cluster', velocities: [G, G, G, A, G, G, A, G], groupSize: 2, planned: 10 },
113
- },
114
- ]
115
-
116
- function tagStyle(open: boolean) {
117
- return {
118
- fontFamily: INTER,
119
- fontSize: 10,
120
- fontWeight: '600' as const,
121
- letterSpacing: 0.5,
122
- textTransform: 'uppercase' as const,
123
- color: open ? CYAN_TEXT : T_TERTIARY,
124
- borderWidth: 1,
125
- borderColor: open ? VAR_EDGE : '#2A2A2E',
126
- borderRadius: 999,
127
- paddingVertical: 3,
128
- paddingHorizontal: 8,
129
- overflow: 'hidden' as const,
130
- }
131
- }
132
-
133
- function ConfigAccordion({ set, useWhen }: { set: VelocitySet; useWhen: string }) {
134
- return (
135
- <Collapse>
136
- <CollapseButton className="px-0 py-2 rounded-none">
137
- <Text style={{ fontFamily: INTER, fontSize: 11, fontWeight: '700', letterSpacing: 0.4, color: CYAN_TEXT }}>
138
- How to configure this view
139
- </Text>
140
- </CollapseButton>
141
- <CollapseContent className="px-0">
142
- <View style={{ backgroundColor: '#0A0A0A', borderWidth: 1, borderColor: '#2A2A2E', borderRadius: 8, padding: 12, gap: 8 }}>
143
- <Text style={{ fontFamily: 'monospace', fontSize: 11, lineHeight: 17, color: T_SECONDARY }}>
144
- {`<VelocityStrip\n variant="mini"\n ${formatSet(set).replace(/\n/g, '\n ')}\n/>`}
145
- </Text>
146
- <Text style={{ fontFamily: INTER, fontSize: 12, color: T_TERTIARY, lineHeight: 17 }}>
147
- Use when: {useWhen}
148
- </Text>
149
- </View>
150
- </CollapseContent>
151
- </Collapse>
152
- )
153
- }
154
-
155
- function Card({ m }: { m: Modality }) {
156
- return (
157
- <View style={{ backgroundColor: INSET, borderWidth: 1, borderColor: '#2A2A2E', borderRadius: 12, padding: 18, gap: 12, width: 460 }}>
158
- <View style={{ flexDirection: 'row', alignItems: 'baseline', justifyContent: 'space-between', flexWrap: 'wrap', gap: 8 }}>
159
- <Text style={{ fontFamily: INTER, fontSize: 16, fontWeight: '700', color: T_PRIMARY }}>
160
- {m.name} <Text style={{ fontSize: 12, fontWeight: '500', color: T_TERTIARY }}>{m.alias}</Text>
161
- </Text>
162
- <View style={{ flexDirection: 'row', gap: 6 }}>
163
- {m.tags.map((t) => {
164
- const open = /open-ended/.test(t)
165
- return (
166
- <Text key={t} style={tagStyle(open)}>
167
- {t}
168
- </Text>
169
- )
170
- })}
171
- </View>
172
- </View>
173
- <Text style={{ fontFamily: INTER, fontSize: 13, color: T_SECONDARY, lineHeight: 19 }}>{m.def}</Text>
174
- <View style={{ paddingVertical: 6 }}>
175
- <VelocityStrip variant="mini" set={m.set} />
176
- </View>
177
- <View style={{ height: 1, backgroundColor: BORDER_SUBTLE }} />
178
- <ConfigAccordion set={m.set} useWhen={m.useWhen} />
179
- </View>
180
- )
181
- }
182
-
183
- function Principle({ k, title, body }: { k: string; title: string; body: string }) {
184
- return (
185
- <View style={{ flex: 1, backgroundColor: INSET, borderWidth: 1, borderColor: '#2A2A2E', borderRadius: 10, padding: 16, gap: 7, minWidth: 220 }}>
186
- <Text style={{ fontFamily: INTER, fontSize: 10, fontWeight: '600', letterSpacing: 1.2, textTransform: 'uppercase', color: CYAN_TEXT }}>{k}</Text>
187
- <Text style={{ fontFamily: INTER, fontSize: 14, fontWeight: '600', color: T_PRIMARY }}>{title}</Text>
188
- <Text style={{ fontFamily: INTER, fontSize: 12.5, color: T_SECONDARY, lineHeight: 18 }}>{body}</Text>
189
- </View>
190
- )
191
- }
192
-
193
- function Swatch({ color, label, outlined }: { color: string; label: string; outlined?: boolean }) {
194
- return (
195
- <View style={{ flexDirection: 'row', alignItems: 'center', gap: 7 }}>
196
- <View style={{ width: 22, height: 10, borderRadius: 2, backgroundColor: color, ...(outlined ? { borderWidth: 1, borderColor: VAR_EDGE } : {}) }} />
197
- <Text style={{ fontFamily: INTER, fontSize: 12, color: T_SECONDARY }}>{label}</Text>
198
- </View>
199
- )
200
- }
201
-
202
- const meta: Meta = {
203
- title: 'Workout/DataViz/VelocityStrip/Set Modalities',
204
- parameters: { layout: 'fullscreen' },
205
- }
206
- export default meta
207
- type Story = StoryObj
208
-
209
- export const StripVocabulary: Story = {
210
- name: 'One strip vocabulary · every set type',
211
- render: () => (
212
- <Page
213
- title="Set modalities — the VelocityStrip set-type vocabulary"
214
- note="Every per-rep strength set-type, rendered by the real VelocityStrip via its `set` prop. One strip model: defaults to the target rep count (grey slots) · overshoot grows the strip · open-ended sets (AMRAP · the myo tail) carry a persistent cyan 'continue' slot. Real velocity colours + the cyan variable token. Open each card's accordion for the exact `set` configuration and a 'use when' note."
215
- >
216
- <View style={{ flexDirection: 'row', gap: 14, flexWrap: 'wrap', maxWidth: 940 }}>
217
- <Principle k="default" title="Target reps as slots" body="A set opens as N grey placeholder slots — the prescribed count. Each done rep fills its slot with its velocity colour." />
218
- <Principle k="overshoot" title="Extra reps grow it" body="Beat the prescription and the strip keeps adding slots. The plan is a floor to draw against, not a cap." />
219
- <Principle k="open-ended" title="A cyan continue tail" body="AMRAP and the myo tail carry a persistent cyan slot; new reps insert before it — it argues 'there's more'." />
220
- </View>
221
-
222
- <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 14, alignItems: 'center', marginTop: 4 }}>
223
- <Swatch color={velColor(G)} label="fastest" />
224
- <Swatch color={velColor(A)} label="fast" />
225
- <Swatch color={velColor(O)} label="moderate" />
226
- <Swatch color={velColor(R)} label="slow" />
227
- <Swatch color={GREY} label="planned / to-do" />
228
- <Swatch color={CYAN} label="variable · continue" outlined />
229
- </View>
230
-
231
- <View style={{ height: 1, backgroundColor: BORDER_SUBTLE, marginVertical: 4 }} />
232
-
233
- <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 16 }}>
234
- {MODS.map((m) => (
235
- <Card key={m.name} m={m} />
236
- ))}
237
- </View>
238
- </Page>
239
- ),
240
- }
241
-
242
- export const ActiveSetExpanded: Story = {
243
- name: 'Straight set · expanded spotlight',
244
- render: () => (
245
- <Page
246
- title="Straight set — the expanded active-set spotlight"
247
- note="The expanded VelocityStrip for a live straight set: done reps as velocity-height bars, the planned remainder as short grey stubs, and the mean · loss summary derived from the done reps."
248
- >
249
- <View style={{ width: 520, gap: 10 }}>
250
- <VelocityStrip set={{ type: 'straight', velocities: [1.12, 1.05, 0.98, 0.9, 0.82, 0.7], planned: 10 }} expanded />
251
- </View>
252
- </Page>
253
- ),
254
- }
@@ -1,145 +0,0 @@
1
- /**
2
- * Notch across widths — the between-group notch (drop sub-loads / myo clusters /
3
- * cluster intra-rests) is a fixed 8px gap, held constant at every strip width. This
4
- * page renders the real {@link VelocityStrip} across a ladder of widths (session-rail
5
- * → wall dashboard) and across rep / rep-grouping counts, so the notch can be judged
6
- * at the size it will actually ship at. Same set, stacked and left-aligned across
7
- * widths: the notch stays put while the bars grow, so it reads as a group break at
8
- * rail scale without ballooning at wall scale.
9
- */
10
- import type { Meta, StoryObj } from '@storybook/react-vite'
11
- import { View, Text } from 'react-native'
12
- import { VelocityStrip, type VelocitySet } from './VelocityStrip'
13
- import { T_PRIMARY, T_SECONDARY, T_TERTIARY, INSET, BORDER_SUBTLE, Page } from './setHeadingKit'
14
-
15
- const INTER = 'Inter, sans-serif'
16
- const MONO = 'monospace'
17
-
18
- // The width ladder: a session-rail row, two mid app widths, a modality card, a wall
19
- // dashboard. These bracket everywhere the strip renders.
20
- const WIDTHS = [130, 200, 300, 440, 620] as const
21
-
22
- // Preview height — the production mini strip is 3px tall; shown a touch taller here so
23
- // the horizontal notch is legible on screen. Width (the axis under test) is untouched.
24
- const PREVIEW_HEIGHT = 8
25
-
26
- // Velocity colour buckets (match the modalities exploration: fastest green → slowest red).
27
- const G = 1.1
28
- const A = 0.85
29
- const O = 0.6
30
- const R = 0.4
31
-
32
- /** A descending velocity ramp of length n (1.15 → 0.40), for realistic fatigue. */
33
- function ramp(n: number): number[] {
34
- if (n <= 1) return [G]
35
- return Array.from({ length: n }, (_, i) => {
36
- const t = i / (n - 1)
37
- return Math.round((1.15 - t * 0.75) * 100) / 100
38
- })
39
- }
40
-
41
- type Config = { name: string; detail: string; set: VelocitySet }
42
-
43
- const CONFIGS: Config[] = [
44
- {
45
- name: 'Straight · 5',
46
- detail: '5 reps · one group · no notch',
47
- set: { type: 'straight', velocities: [G, A, A, O, R], planned: 5 },
48
- },
49
- {
50
- name: 'Straight · 12',
51
- detail: '12 reps · one group · no notch',
52
- set: { type: 'straight', velocities: ramp(12), planned: 12 },
53
- },
54
- {
55
- name: 'Drop · 3 loads',
56
- detail: '3 groups (5 / 3 / 2) · 2 notches',
57
- set: { type: 'drop', subloads: [[G, A, O, O, R], [A, O, R], [O, R]] },
58
- },
59
- {
60
- name: 'Cluster · groups of 2',
61
- detail: '10 reps · 5 groups · 4 notches',
62
- set: { type: 'cluster', velocities: ramp(10), groupSize: 2, planned: 10 },
63
- },
64
- {
65
- name: 'Cluster · groups of 3',
66
- detail: '15 reps · 5 groups · 4 notches (dense)',
67
- set: { type: 'cluster', velocities: ramp(15), groupSize: 3, planned: 15 },
68
- },
69
- {
70
- name: 'Myo · open',
71
- detail: 'activation + 2 clusters · 2 notches + cyan tail',
72
- set: { type: 'myo', activation: [G, A, A, O, O, R], clusters: [[A, O, R], [O, R]], open: true },
73
- },
74
- ]
75
-
76
- function WidthRow({ set, width }: { set: VelocitySet; width: number }) {
77
- return (
78
- <View style={{ flexDirection: 'row', alignItems: 'center', gap: 12 }}>
79
- <Text style={{ fontFamily: MONO, fontSize: 10, color: T_TERTIARY, width: 44, textAlign: 'right' }}>
80
- {width}px
81
- </Text>
82
- <View style={{ width }}>
83
- <VelocityStrip variant="mini" set={set} style={{ height: PREVIEW_HEIGHT }} />
84
- </View>
85
- </View>
86
- )
87
- }
88
-
89
- function ConfigPanel({ c }: { c: Config }) {
90
- return (
91
- <View
92
- style={{
93
- backgroundColor: INSET,
94
- borderWidth: 1,
95
- borderColor: '#2A2A2E',
96
- borderRadius: 12,
97
- padding: 18,
98
- gap: 14,
99
- width: 620 + 44 + 12 + 36, // widest strip + label col + gap + panel padding
100
- }}
101
- >
102
- <View style={{ gap: 3 }}>
103
- <Text style={{ fontFamily: INTER, fontSize: 15, fontWeight: '700', color: T_PRIMARY }}>{c.name}</Text>
104
- <Text style={{ fontFamily: INTER, fontSize: 12, color: T_TERTIARY }}>{c.detail}</Text>
105
- </View>
106
- <View style={{ height: 1, backgroundColor: BORDER_SUBTLE }} />
107
- <View style={{ gap: 12 }}>
108
- {WIDTHS.map((w) => (
109
- <WidthRow key={w} set={c.set} width={w} />
110
- ))}
111
- </View>
112
- </View>
113
- )
114
- }
115
-
116
- const meta: Meta = {
117
- title: 'Workout/DataViz/VelocityStrip/Responsive Width',
118
- parameters: { layout: 'fullscreen' },
119
- }
120
- export default meta
121
- type Story = StoryObj
122
-
123
- export const NotchAcrossWidths: Story = {
124
- name: 'Between-group notch · across widths',
125
- render: () => (
126
- <Page
127
- title="Notch across widths — a fixed 8px group break"
128
- note="The notch that separates drop sub-loads, myo clusters and cluster intra-rests is a fixed 8px gap, held constant at every strip width — so it reads as a group break at session-rail scale AND at wall-dashboard scale without ballooning as the strip grows. Each panel is one set type, stacked and left-aligned across the width ladder (130px rail → 620px wall); both the 2px rep gap and the 8px notch hold fixed while only the bars grow. Straight sets carry no notch (baseline). Preview strips are shown at 8px tall for legibility; the production mini strip is 3px."
129
- >
130
- <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 18 }}>
131
- {CONFIGS.map((c) => (
132
- <ConfigPanel key={c.name} c={c} />
133
- ))}
134
- </View>
135
-
136
- <Text style={{ fontFamily: INTER, fontSize: 12.5, color: T_SECONDARY, lineHeight: 19, maxWidth: 760, marginTop: 4 }}>
137
- Reading the ladder: the notch holds at 8px everywhere, so at rail scale it is a clear group break
138
- (4× the rep gap) and at wall scale it stays a tidy break rather than a canyon. Watch the dense
139
- cluster (groups of 3, 15 reps): even where the bars are thin, the 8px notch separates groups without
140
- a proportional gap swallowing the strip at large sizes. The single knob is WIDE_GAP in
141
- VelocityStrip.tsx.
142
- </Text>
143
- </Page>
144
- ),
145
- }