@pretable/ui 0.0.11 → 0.0.13

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/README.md CHANGED
@@ -51,7 +51,9 @@ The full token set lives in [`src/tokens.css`](./src/tokens.css). Override any t
51
51
 
52
52
  ### Data-attribute hooks
53
53
 
54
- Pretable surfaces emit a stable set of data attributes on rendered DOM. The CSS files in this package target them; your custom styles can too. The full set lives in `grid.css` — common ones include `[data-pretable-cell]`, `[data-pretable-row]`, `[data-pretable-header]`, `[data-pretable-cell][data-pretable-focused="true"]`, `[data-pretable-cell][data-pretable-selected="true"]`, `[data-pretable-cell][data-pretable-pinned="left"]`, and `[data-pretable-cell][data-pretable-numeric="true"]`. Renaming or removing these attributes is a breaking change.
54
+ Pretable surfaces emit a stable set of data attributes on rendered DOM. The CSS files in this package target them; your custom styles can too. The full set lives in `grid.css` — common ones include `[data-pretable-cell]`, `[data-pretable-row]`, `[data-pretable-header-cell]`, `[data-pretable-cell][data-pretable-focused="true"]`, `[data-pretable-cell][data-pretable-selected="true"]`, `[data-pretable-cell][data-pretable-pinned="left"]`, `[data-pretable-cell][data-pretable-column-type="number"]`, and `[data-pretable-cell][data-pretable-column-align="end"]`. Renaming or removing these attributes is a breaking change.
55
+
56
+ `data-pretable-column-align` is omitted entirely for start-aligned columns — the default — and only written when a column resolves to `"end"` or `"center"`, or sets `align: "start"` explicitly. So style the start case off the attribute's _absence_ (`[data-pretable-cell]:not([data-pretable-column-align])`); a `[data-pretable-column-align="start"]` rule silently misses every column that is start-aligned by default.
55
57
 
56
58
  ### Cascade layer
57
59
 
package/dist/grid.css CHANGED
@@ -51,8 +51,13 @@
51
51
  font-size: var(--pretable-font-size-header);
52
52
  font-weight: 500;
53
53
  color: var(--pretable-text-header);
54
+ /* Header cells are <button>s, so without this reset the UA button fill
55
+ paints in any app that doesn't ship a CSS reset — both of ours import
56
+ Tailwind Preflight, which is why this went unnoticed. */
57
+ background: transparent;
54
58
  border: 0;
55
- border-right: 1px solid var(--pretable-rule);
59
+ border-right: var(--pretable-rule-width, 1px) solid
60
+ var(--pretable-rule-vertical, var(--pretable-rule));
56
61
  box-sizing: border-box;
57
62
  }
58
63
 
@@ -90,8 +95,15 @@
90
95
  font-size: var(--pretable-font-size-cell);
91
96
  color: var(--pretable-text-cell);
92
97
  background: var(--pretable-bg-grid);
93
- border-right: 1px solid var(--pretable-rule);
94
- border-bottom: 1px solid var(--pretable-rule);
98
+ /* Fallbacks matter here: `border-right`/`border-left` are SHORTHANDS
99
+ containing var() references, so if either custom property were unset
100
+ the whole shorthand goes invalid at computed-value time and every
101
+ longhand resets to initial — the divider vanishes instead of just
102
+ changing color. A theme that predates the vertical/horizontal split
103
+ must degrade to today's single-token cage, not lose its borders. */
104
+ border-right: var(--pretable-rule-width, 1px) solid
105
+ var(--pretable-rule-vertical, var(--pretable-rule));
106
+ border-bottom: var(--pretable-rule-width, 1px) solid var(--pretable-rule);
95
107
  /* Cells are absolutely positioned, so a value wider than its column paints
96
108
  straight over the next one. Clip at the column edge instead.
97
109
  NOTE: the cell is a flex container, and `text-overflow: ellipsis` has no
@@ -207,12 +219,17 @@
207
219
  [data-pretable-cell]:not([data-pretable-pinned="right"])
208
220
  + [data-pretable-cell][data-pretable-pinned="right"]
209
221
  ) {
210
- border-left: 1px solid var(--pretable-rule);
222
+ border-left: var(--pretable-rule-width, 1px) solid
223
+ var(--pretable-rule-vertical, var(--pretable-rule));
211
224
  }
212
225
 
213
- /* Selection — wins over zebra/hover via source order (they precede it) */
226
+ /* Selection text color. The selection FILL is drawn by the
227
+ [role="gridcell"][aria-selected="true"] rule below: @pretable/react sets
228
+ `aria-selected` and `data-pretable-selected` from the same condition, and
229
+ that rule follows this one at equal (0,0,0) specificity, so a `background`
230
+ declared here could never win. Only the color is load-bearing — nothing
231
+ else sets a color on a selected cell. */
214
232
  :where([data-pretable-cell][data-pretable-selected="true"]) {
215
- background: var(--pretable-bg-selected);
216
233
  color: var(--pretable-text-selected);
217
234
  }
218
235
 
@@ -236,20 +253,41 @@
236
253
  box-shadow: inset 0 0 0 2px var(--pretable-focus-ring);
237
254
  }
238
255
 
239
- /* Numeric cells (opt-in via [data-pretable-numeric="true"]) */
240
- :where([data-pretable-cell][data-pretable-numeric="true"]) {
241
- font-family: var(--pretable-font-mono);
242
- text-align: right;
243
- justify-content: flex-end;
244
- font-variant-numeric: tabular-nums;
256
+ /* Column alignment.
257
+ `justify-content`, not `text-align`: cells are flex containers and an
258
+ unwrapped value is an anonymous flex item, which text-align cannot move.
259
+ `safe`, not bare `flex-end`: with `overflow: hidden` and `nowrap`, a value
260
+ wider than its column would otherwise overflow and be clipped at its
261
+ LEADING edge — 1,234,567 renders as a legible, plausible, wrong 34,567.
262
+ `safe` degrades to start-alignment in exactly that case, so the truncation
263
+ stays visible at the trailing edge where a reader expects it.
264
+ Group cells are excluded: they own the twisty indent. */
265
+ :where(
266
+ [data-pretable-cell][data-pretable-column-align="end"]:not(
267
+ [data-pretable-group-cell]
268
+ ),
269
+ [data-pretable-header-cell][data-pretable-column-align="end"]
270
+ ) {
271
+ justify-content: safe flex-end;
245
272
  }
246
273
 
247
- /* Toolbar / status bar — applied if engine wraps in named data attribute */
248
- :where([data-pretable-toolbar], [data-pretable-status-bar]) {
249
- background: var(--pretable-bg-toolbar);
250
- color: var(--pretable-text-dim);
251
- font-family: var(--pretable-font-sans);
252
- font-size: var(--pretable-font-size-cell);
274
+ :where(
275
+ [data-pretable-cell][data-pretable-column-align="center"]:not(
276
+ [data-pretable-group-cell]
277
+ ),
278
+ [data-pretable-header-cell][data-pretable-column-align="center"]
279
+ ) {
280
+ justify-content: safe center;
281
+ }
282
+
283
+ /* Tabular, lining figures so digits line up down the column and share a
284
+ common height. Deliberately NOT a font-family switch — one family
285
+ throughout; the numerals do the aligning. */
286
+ :where(
287
+ [data-pretable-cell][data-pretable-column-type="number"],
288
+ [data-pretable-cell][data-pretable-column-type="date"]
289
+ ) {
290
+ font-variant-numeric: tabular-nums lining-nums;
253
291
  }
254
292
 
255
293
  /* Row-selection checkbox column (Phase 4) */
@@ -488,6 +526,13 @@
488
526
  align-items: center;
489
527
  gap: 4px;
490
528
  box-sizing: border-box;
529
+ /* No `flex: none` here, deliberately. The panel is a nowrap flex row, so
530
+ the obvious worry is that its chips shrink towards min-content instead
531
+ of letting the strip overflow and scroll. They do not: the label's
532
+ `white-space: nowrap` makes each chip's min-content size its full label
533
+ width, capped below by this `max-width`, and a flex item never shrinks
534
+ past its automatic minimum. Measured in both engines — adding `flex:
535
+ none` changes no rectangle. */
491
536
  max-width: 14em;
492
537
  padding: 2px 4px;
493
538
  border: 1px solid var(--pretable-rule);
@@ -23,6 +23,12 @@
23
23
  /* Lines */
24
24
  --pretable-rule: #d4d4d4; /* Excel desktop default RGB 211,211,211 */
25
25
  --pretable-rule-strong: #a6a6a6;
26
+ /* Excel draws the full cage: the vertical divider tracks the horizontal rule.
27
+ A theme that wants horizontal-only separation sets this to `transparent`.
28
+ --pretable-rule-width only governs the per-cell row/column dividers — the
29
+ -strong frame borders and popover/menu/editor borders are still hardcoded 1px. */
30
+ --pretable-rule-vertical: var(--pretable-rule);
31
+ --pretable-rule-width: 1px;
26
32
  --pretable-radius: 0; /* Sharp edges — Excel never rounds */
27
33
 
28
34
  /* State */
@@ -21,6 +21,13 @@
21
21
  /* Lines */
22
22
  --pretable-rule: #cccccc; /* outline-variant — decorative dividers */
23
23
  --pretable-rule-strong: #797979; /* outline */
24
+ /* Aliased to --pretable-rule so this theme's appearance is unchanged by the
25
+ axis split. Material's own list spec has no vertical rules; revisiting that
26
+ is a deliberate change, not a side effect of introducing the token.
27
+ --pretable-rule-width only governs the per-cell row/column dividers — the
28
+ -strong frame borders and popover/menu/editor borders are still hardcoded 1px. */
29
+ --pretable-rule-vertical: var(--pretable-rule);
30
+ --pretable-rule-width: 1px;
24
31
  --pretable-radius: 12px; /* M3 medium shape scale (matches Card) */
25
32
 
26
33
  /* State */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretable/ui",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "CSS themes, tokens, and grid styles for Pretable.",
5
5
  "license": "MIT",
6
6
  "repository": {