@micha.bigler/ui-core-micha 3.0.0 → 3.1.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.
- package/WORK_ORDERS.md +2 -1
- package/dist/components/charts/BarChart.js +1 -0
- package/dist/components/charts/ChartFrame.js +33 -27
- package/dist/components/charts/LineChart.js +1 -0
- package/dist/components/charts/ScatterChart.js +1 -0
- package/dist/components/charts/chartDefaults.js +88 -29
- package/docs/CHART-LAYOUT.md +28 -13
- package/package.json +1 -1
- package/src/components/charts/BarChart.jsx +1 -0
- package/src/components/charts/ChartFrame.jsx +27 -31
- package/src/components/charts/LineChart.jsx +1 -0
- package/src/components/charts/ScatterChart.jsx +1 -0
- package/src/components/charts/chartDefaults.js +88 -30
- package/tests/ChartFrame.test.jsx +44 -27
- package/tests/chartDefaults.test.js +157 -1
- package/work-orders/UCM-CHART-13.md +122 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# UCM-CHART-13 — A card has no size of its own. Remove `height` and `aspect` from `ChartFrame`.
|
|
2
|
+
|
|
3
|
+
- **Repo:** `ui-core-micha`, branch `main`
|
|
4
|
+
- **Tier:** 3 — shared-core API removal, **four measured consumer call sites** (see below). Breaking:
|
|
5
|
+
`4.0.0`, sequenced with `FM-CHART-1`.
|
|
6
|
+
- **Status:** planned
|
|
7
|
+
- **Workstream:** `CHART-*`
|
|
8
|
+
- **Files:** `src/components/charts/ChartFrame.jsx` and its tests.
|
|
9
|
+
|
|
10
|
+
> **Why. Twice reversed — the reasoning below is what settled it, not the earlier prop-inventory.**
|
|
11
|
+
>
|
|
12
|
+
> Draft 1 said remove `height` **and** `aspect`, on the grounds that both were dead code. That
|
|
13
|
+
> premise was wrong: `aspect` **is** applied — `ChartFrame.jsx:136-139` sets
|
|
14
|
+
> `sx={{ width: '100%', minHeight, aspectRatio: aspect, ... }}`.
|
|
15
|
+
>
|
|
16
|
+
> Draft 2 therefore kept `aspect`. **That was the worse error**, and the operator caught it: it
|
|
17
|
+
> reintroduces through the card exactly what `UCM-CHART-12` removed from the chart.
|
|
18
|
+
>
|
|
19
|
+
> **The structural argument, which neither earlier draft made.** After the migration a consumer
|
|
20
|
+
> looks like this:
|
|
21
|
+
>
|
|
22
|
+
> ```jsx
|
|
23
|
+
> <ChartFrame minHeight={320} aspect="960 / 380"> // height derived from WIDTH
|
|
24
|
+
> <LineChart size="tall" /> // height from a TOKEN
|
|
25
|
+
> </ChartFrame>
|
|
26
|
+
> ```
|
|
27
|
+
>
|
|
28
|
+
> **Two independent size sources for nested boxes that have to agree.** Before the migration they
|
|
29
|
+
> were coherent — same ratio on both. Afterwards the frame tracks width and the chart tracks a token,
|
|
30
|
+
> and they coincide only by accident. Whichever way they diverge is a defect this series already has
|
|
31
|
+
> a name for: the frame taller than its content is dead space, the frame shorter is the
|
|
32
|
+
> `UCM-CHART-9` overflow.
|
|
33
|
+
>
|
|
34
|
+
> **A card must have no size of its own.** Its height is its content's height, with `minHeight` as a
|
|
35
|
+
> floor so an empty or loading state does not collapse. That is what `UCM-CHART-9` established — it
|
|
36
|
+
> found the defect at a fixed `height`; `aspect` is the same defect derived from width instead of
|
|
37
|
+
> stated directly.
|
|
38
|
+
>
|
|
39
|
+
> | prop | applied today | verdict |
|
|
40
|
+
> |---|---|---|
|
|
41
|
+
> | `minHeight` | yes (`:138`) | **stays** — the floor, and the only legitimate one |
|
|
42
|
+
> | `aspect` | yes (`:139`) | **goes** — a second size source on a box that must follow its content |
|
|
43
|
+
> | `height` | no — only feeds a warning | **goes** — accepted and silently ignored |
|
|
44
|
+
>
|
|
45
|
+
> **This one has consumer impact**, unlike draft 2's claim: four `ChartFrame`s pass `aspect` —
|
|
46
|
+
> `fitness-monitor/BodyHistoryPage.jsx:328, :449` and `EnvironmentPage.jsx:250, :284`. They are
|
|
47
|
+
> migrated by `FM-CHART-1`, not here.
|
|
48
|
+
|
|
49
|
+
## Part A — Envelope (authoritative WHAT/WHY)
|
|
50
|
+
|
|
51
|
+
### Goal
|
|
52
|
+
|
|
53
|
+
`ChartFrame` has no size source of its own. Its height is its content's height, floored by
|
|
54
|
+
`minHeight`. `aspect` and `height` are gone.
|
|
55
|
+
|
|
56
|
+
### Definition of Done
|
|
57
|
+
|
|
58
|
+
- [ ] **`aspect` removed** from the signature and from the applied `sx` (`:139`). A card that sizes
|
|
59
|
+
itself from its width can be shorter than its content (the `UCM-CHART-9` overflow) or taller
|
|
60
|
+
(dead space); both are defects this series already has names for.
|
|
61
|
+
- [ ] **`height` removed** from `ChartFrame`'s signature, and `warnOnChartFrameHeightMismatch` deleted
|
|
62
|
+
with it — the warning exists only to explain a prop that should not be accepted in the first
|
|
63
|
+
place. **A prop that is accepted and silently ignored is worse than one that errors**: it lets a
|
|
64
|
+
caller believe the card was sized when it was not, which is precisely the `UCM-CHART-9`
|
|
65
|
+
regression in slow motion.
|
|
66
|
+
- [ ] **`minHeight` stays, unchanged.** It is the one justified prop: a card with a loading or empty
|
|
67
|
+
state would otherwise collapse, and `UCM-CHART-9` established the floor as correct. Do not
|
|
68
|
+
touch its behaviour.
|
|
69
|
+
- [ ] **Passing `height` or `aspect` to `ChartFrame` is a dev-mode error naming what to do instead**
|
|
70
|
+
— `minHeight` for a floor, or `size` on the chart *inside* the frame if the caller meant the
|
|
71
|
+
chart's height. Consistent with how `UCM-CHART-12` treats the presets' removed props.
|
|
72
|
+
- [ ] **`docs/CHART-LAYOUT.md`'s "What stays unchanged" entry is made precise.** It lists the frame's
|
|
73
|
+
`minHeight`/`height`/`aspect` as retained without saying which are applied. Replace it: the frame
|
|
74
|
+
keeps **`minHeight` only**, as a floor; it has no size source of its own, and a chart's height
|
|
75
|
+
comes from its `size` token.
|
|
76
|
+
|
|
77
|
+
### Non-goals
|
|
78
|
+
|
|
79
|
+
- Do not change `minHeight`'s semantics, and do not give `ChartFrame` a `size` token. The frame is
|
|
80
|
+
not a chart (`UCM-CHART-9`); its height follows its content with a floor, and that is correct.
|
|
81
|
+
- Do not touch the four presets. `UCM-CHART-12` settled them.
|
|
82
|
+
- No consumer migration here. The four `ChartFrame`s passing `aspect` are fitness-monitor's, and
|
|
83
|
+
`FM-CHART-1` removes them — **sequence this after `FM-CHART-1`, or land both together**, or those
|
|
84
|
+
four cards hit the new error.
|
|
85
|
+
|
|
86
|
+
### Risks
|
|
87
|
+
|
|
88
|
+
- **`height` is free — no consumer passes it and it does nothing.** `aspect` is not: four cards
|
|
89
|
+
depend on it and lose their shape when it goes. That is intended (their height becomes their
|
|
90
|
+
content's), but it is a **visible change in fitness-monitor**, so `FM-CHART-1`'s rendered two-width
|
|
91
|
+
check is what confirms it, not this WO's unit tests.
|
|
92
|
+
- **Re-run the consumer scan by reading the call sites, not by grepping.** Both earlier drafts of this
|
|
93
|
+
WO were wrong about `aspect` — once from a grep that matched nothing, once from a `head`-truncated
|
|
94
|
+
grep that cut off the line where it is applied. Open the files.
|
|
95
|
+
|
|
96
|
+
### Tests to WRITE — narrow
|
|
97
|
+
|
|
98
|
+
- `ChartFrame` with `minHeight`: floor applied, `UCM-CHART-9`'s existing assertions unchanged.
|
|
99
|
+
- `ChartFrame` given `height` or `aspect`: dev-mode error naming the replacement, and **no
|
|
100
|
+
`aspectRatio` or `height` on the box**.
|
|
101
|
+
- **A `ChartFrame` whose content is taller than `minHeight` grows to fit** — `UCM-CHART-9`'s
|
|
102
|
+
regression test, unchanged, and now the only thing that decides the card's height.
|
|
103
|
+
- The `UCM-CHART-9` regression test (content taller than the floor grows the box) stays green,
|
|
104
|
+
unchanged.
|
|
105
|
+
|
|
106
|
+
No full suite.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Part B — Implementation map
|
|
111
|
+
|
|
112
|
+
> **TO BE FILLED BY THE ORCHESTRATOR** on `git pull`. Must carry `ChartFrame.jsx`'s signature
|
|
113
|
+
> (`:56-58`), the applied `sx` (`:138`), `warnOnChartFrameHeightMismatch` (`:27-35`), the
|
|
114
|
+
> `docs/CHART-LAYOUT.md` line to correct, the absolute working directory, the progress contract, and
|
|
115
|
+
> the preamble. **Do not dispatch while this placeholder stands.**
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Part C — Orchestrator-only
|
|
120
|
+
|
|
121
|
+
> **TO BE FILLED BY THE ORCHESTRATOR.** Review routing, register maintenance, registry publish
|
|
122
|
+
> verification, commit, and the execution directive with its self-address guard.
|