@pretable/ui 0.15.1 → 0.15.3

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/grid.css CHANGED
@@ -91,7 +91,10 @@
91
91
  the whole strip, but each header cell on top of it is a transparent box,
92
92
  so an unpinned header's label reads straight through a pinned one once it
93
93
  scrolls underneath. Pinned header cells need their own opaque fill, the
94
- same one their body counterparts get below. */
94
+ same one their body counterparts get below. The seam that marks the
95
+ frozen edge is NOT here: it is one gradient per plane, drawn at the end
96
+ of this file's pinned section, because no per-cell rule can draw a
97
+ continuous edge. */
95
98
  :where(
96
99
  [data-pretable-header-cell][data-pretable-pinned="left"],
97
100
  [data-pretable-header-cell][data-pretable-pinned="right"]
@@ -243,38 +246,107 @@
243
246
  );
244
247
  }
245
248
 
246
- /* Pinned cells (sticky left) — an opaque fill so scrolled columns pass
247
- underneath, on their own token rather than the header's.
248
- The seam shadow marks the frozen edge for themes that do not mark it any
249
- other way. A theme that drops the vertical rule AND gives --pretable-bg-pinned
250
- no tone step has no boundary at all otherwise: unpinned cells scroll under
251
- these at z-index 1, so text would appear clipped mid-glyph at an invisible
252
- line. The spread is <= -blur/2 on purpose — any less negative and the blur
253
- bleeds above and below each cell and paints a dark band at every row
254
- boundary inside the pinned region.
255
- This box-shadow slot is the seam's alone. It used to be contested: the
256
- cell focus ring was an inset box-shadow too, and box-shadow is not
257
- additive across rules, so a FOCUSED pinned cell showed the ring and lost
258
- its seam for as long as it held focus. That was accepted while both
259
- shipped themes set --pretable-seam-color: transparent and the loss was
260
- unobservable — a precondition that failed the moment the house theme drew
261
- a visible seam. The focus ring is now an `outline` (see the Focus rule
262
- below), which composes with this shadow, so the seam survives focus.
263
- Anything added here must keep that property: a second box-shadow on this
264
- element silently wins the whole slot. */
265
- :where([data-pretable-cell][data-pretable-pinned="left"]) {
249
+ /* Pinned cells — an opaque fill so scrolled columns pass underneath, on
250
+ their own token rather than the header's. The seam that marks the frozen
251
+ edge is drawn once per plane below, NOT here; these rules carry only the
252
+ fill and the stacking that lets the scrolled columns run under them. */
253
+ :where(
254
+ [data-pretable-cell][data-pretable-pinned="left"],
255
+ [data-pretable-cell][data-pretable-pinned="right"]
256
+ ) {
266
257
  background: var(--pretable-bg-pinned);
267
- box-shadow: 8px 0 8px -8px var(--pretable-seam-color);
268
258
  z-index: 1;
269
259
  }
270
260
 
271
- /* Pinned cells (sticky right) — mirror of the left rule, including the seam,
272
- whose offset has to flip. That mirroring is why --pretable-seam-color holds
273
- a COLOUR and not a whole shadow: one shadow value cannot be reversed. */
274
- :where([data-pretable-cell][data-pretable-pinned="right"]) {
275
- background: var(--pretable-bg-pinned);
276
- box-shadow: -8px 0 8px -8px var(--pretable-seam-color);
277
- z-index: 1;
261
+ /* ---- The frozen edge's seam ------------------------------------------
262
+ It marks the boundary for themes that do not mark it any other way. A
263
+ theme that drops the vertical rule AND gives --pretable-bg-pinned no tone
264
+ step has no boundary at all otherwise: unpinned cells scroll under the
265
+ pinned ones at z-index 1, so text would appear clipped mid-glyph at an
266
+ invisible line.
267
+
268
+ ONE gradient per plane, not a shadow per cell. A per-cell `box-shadow`
269
+ cannot tile into a continuous edge, and both ways of trying are visibly
270
+ wrong: a spread at or below -blur/2 keeps the blur inside each cell, so
271
+ the seam fades to nothing at every row boundary and reads as a dashed
272
+ edge; a spread large enough to reach the cell's own edges makes
273
+ neighbouring shadows overlap and doubles the alpha into a dark band at
274
+ each boundary instead. This file shipped the first of those. A gradient
275
+ has no falloff along its own axis, so one box spanning a whole plane is
276
+ uniform top to bottom, and the two planes — the sticky header row and the
277
+ scroll content — meet exactly at the header's lower edge with nothing
278
+ between them.
279
+
280
+ Each plane draws both sides from its own two pseudo-elements, which is
281
+ why the planes are laid out as flex here: two in-flow boxes in a block
282
+ container would stack VERTICALLY, putting the second seam below the
283
+ content instead of beside the first. Rows are absolutely positioned, so
284
+ making their container a flex box moves nothing that is already drawn.
285
+
286
+ Sticky, and anchored by `left` on BOTH sides — the same way the cells
287
+ themselves are pinned (a right-pinned cell is stuck by a computed `left`,
288
+ never a `right` inset), so the seam clamps exactly as its columns do when
289
+ the content is narrower than the viewport. The two edges arrive as custom
290
+ properties from the surface, which is the only place that knows them; the
291
+ attributes are what gate the rules, so a side with nothing pinned draws
292
+ nothing rather than a seam at x=0. */
293
+ :where(
294
+ [data-pretable-pinned-left] [data-pretable-header-row],
295
+ [data-pretable-pinned-left] [data-pretable-scroll-content],
296
+ [data-pretable-pinned-right] [data-pretable-header-row],
297
+ [data-pretable-pinned-right] [data-pretable-scroll-content]
298
+ ) {
299
+ display: flex;
300
+ }
301
+ :where(
302
+ [data-pretable-pinned-left] [data-pretable-header-row],
303
+ [data-pretable-pinned-left] [data-pretable-scroll-content]
304
+ )::after,
305
+ :where(
306
+ [data-pretable-pinned-right] [data-pretable-header-row],
307
+ [data-pretable-pinned-right] [data-pretable-scroll-content]
308
+ )::before {
309
+ content: "";
310
+ position: sticky;
311
+ align-self: stretch;
312
+ /* 8px wide, and ZERO wide as far as the flow is concerned. The header
313
+ row's pinned cells are in flow (they are sticky, not absolute), so a
314
+ seam that consumed 8px of the line would shove the frozen columns 8px
315
+ clear of the grid's own left edge — which is exactly what it did, and
316
+ what apps/website/e2e/smoke.spec.ts caught. The negative end margin
317
+ gives the space straight back; the box itself is placed by `left`
318
+ anyway, never by where the flow put it. */
319
+ flex: 0 0 8px;
320
+ margin-inline-end: -8px;
321
+ /* Above the columns that scroll under it (z-index auto), and never a
322
+ pointer target: it is a boundary, not a control. */
323
+ z-index: 2;
324
+ pointer-events: none;
325
+ }
326
+ :where(
327
+ [data-pretable-pinned-left] [data-pretable-header-row],
328
+ [data-pretable-pinned-left] [data-pretable-scroll-content]
329
+ )::after {
330
+ left: var(--pretable-pinned-left-edge);
331
+ background: linear-gradient(
332
+ to right,
333
+ var(--pretable-seam-color),
334
+ transparent
335
+ );
336
+ }
337
+ /* The mirror. Its own 8px sits to the LEFT of the edge, so it starts where
338
+ the right-pinned group does — this is why --pretable-seam-color holds a
339
+ COLOUR rather than a whole shadow: one value could not be reversed. */
340
+ :where(
341
+ [data-pretable-pinned-right] [data-pretable-header-row],
342
+ [data-pretable-pinned-right] [data-pretable-scroll-content]
343
+ )::before {
344
+ left: calc(var(--pretable-pinned-right-edge) - 8px);
345
+ background: linear-gradient(
346
+ to left,
347
+ var(--pretable-seam-color),
348
+ transparent
349
+ );
278
350
  }
279
351
 
280
352
  /* A pinned cell inside a group row is still part of the band. Both pinned
@@ -784,10 +856,16 @@
784
856
  opacity: 0.6;
785
857
  z-index: 10;
786
858
  user-select: none;
787
- /* Portaled into <body> — see the filter menu below. The font-family and
788
- color declared on the scroll viewport are no longer inherited. */
859
+ /* Portaled into <body> — see the filter menu below. Nothing declared on
860
+ the scroll viewport is inherited, and what this draws is a copy of a
861
+ HEADER CELL, so it takes the header's trio rather than the cell's: the
862
+ ghost was rendering the host page's body font (16px/400 against the
863
+ header's 12.5px/500 on our own site) in the cell colour, so the label
864
+ under the cursor did not match the column it came from. */
789
865
  font-family: var(--pretable-font-sans);
790
- color: var(--pretable-text-cell);
866
+ font-size: var(--pretable-font-size-header);
867
+ font-weight: 500;
868
+ color: var(--pretable-text-header);
791
869
  }
792
870
  :where([data-pretable-reorder-drop-indicator]) {
793
871
  position: absolute;
@@ -889,10 +967,16 @@
889
967
  gap: 8px;
890
968
  padding: 10px;
891
969
  box-shadow: var(--pretable-shadow-overlay);
892
- font: inherit;
893
- /* Portaled into <body>, so the font-family declared on the scroll
894
- viewport is no longer inherited — declare it here. */
970
+ /* Portaled into <body>, so NOTHING declared on the scroll viewport is
971
+ inherited — the whole trio has to be declared here, as every other
972
+ portaled surface does. `font: inherit` used to stand in for this and
973
+ did the opposite of what it looks like: the shorthand pulled the HOST
974
+ PAGE's size and line-height in, so the dialog rendered at whatever the
975
+ consumer's body font is (16px on our own site) while every other
976
+ popover sat at the cell size. */
895
977
  font-family: var(--pretable-font-sans);
978
+ font-size: var(--pretable-font-size-cell);
979
+ color: var(--pretable-text-cell);
896
980
  }
897
981
  :where([data-pretable-filter-menu]) select,
898
982
  :where([data-pretable-filter-menu]) input[type="text"],
@@ -900,13 +984,32 @@
900
984
  :where([data-pretable-filter-menu]) input:not([type]) {
901
985
  width: 100%;
902
986
  box-sizing: border-box;
903
- padding: 5px 7px;
987
+ /* An explicit box, like the tool pane's identical controls: Chrome forces
988
+ `line-height: normal` on a <select> and ignores what it is given, so a
989
+ select and an input with the same padding come out different heights —
990
+ 28 and 33 here, a stacked pair a few pixels apart. Both centre their
991
+ own text vertically once the height is set, so the block padding goes. */
992
+ block-size: 28px;
993
+ padding-inline: 7px;
904
994
  border: 1px solid var(--pretable-rule);
905
995
  border-radius: var(--pretable-radius-control);
906
996
  background: var(--pretable-bg-grid);
907
997
  color: var(--pretable-text-cell);
908
998
  font: inherit;
909
999
  }
1000
+ /* The product's focus ring, not the host page's. Without this the dialog's
1001
+ fields keep the UA ring — which takes the CONSUMER's accent-color, so
1002
+ tabbing from the pane's copy of these same controls to this one changed
1003
+ the ring's colour, width and offset. The declaration the builder rows
1004
+ already share. */
1005
+ :where(
1006
+ [data-pretable-filter-menu] select:focus-visible,
1007
+ [data-pretable-filter-menu] input:focus-visible,
1008
+ [data-pretable-filter-clear]:focus-visible
1009
+ ) {
1010
+ outline: 2px solid var(--pretable-focus-ring);
1011
+ outline-offset: -2px;
1012
+ }
910
1013
  :where([data-pretable-filter-set]) label {
911
1014
  display: flex;
912
1015
  gap: 6px;
@@ -1098,6 +1201,7 @@
1098
1201
  /* Portaled into <body>, so nothing is inherited from the viewport. */
1099
1202
  font-family: var(--pretable-font-sans);
1100
1203
  font-size: var(--pretable-font-size-cell);
1204
+ color: var(--pretable-text-cell);
1101
1205
  }
1102
1206
  :where([data-pretable-menu-item]) {
1103
1207
  display: block;
@@ -1111,9 +1215,19 @@
1111
1215
  text-align: left;
1112
1216
  cursor: pointer;
1113
1217
  }
1114
- :where([data-pretable-menu-item]:hover) {
1218
+ :where([data-pretable-menu-item]:hover:not(:disabled)) {
1115
1219
  background: var(--pretable-selection-bg);
1116
1220
  }
1221
+ /* The standard disabled treatment — dims by token and drops the pointer
1222
+ affordance, exactly as the tool pane's action buttons do. Load-bearing
1223
+ here rather than cosmetic: a pin menu disables the placement the column
1224
+ is ALREADY in, so with the enabled items' color, the hover highlight and
1225
+ a pointer cursor, the item that says what is true reads as the one thing
1226
+ to click. */
1227
+ :where([data-pretable-menu-item]:disabled) {
1228
+ color: var(--pretable-text-dim);
1229
+ cursor: default;
1230
+ }
1117
1231
  :where([data-pretable-menu-item]:focus-visible) {
1118
1232
  outline: 2px solid var(--pretable-focus-ring);
1119
1233
  outline-offset: -2px;
@@ -1129,6 +1243,17 @@
1129
1243
  justify-content: space-between;
1130
1244
  gap: 8px;
1131
1245
  }
1246
+ /* Divides KINDS of item, not groups of them: above it the one-shot
1247
+ commands that close the menu, below it the mode bits that stay open.
1248
+ A border on a role="separator" element — the menu's own accessible
1249
+ divider — rather than a border-top on the item after it, so the rule
1250
+ survives that item moving or a second one joining it. */
1251
+ :where([data-pretable-menu-separator]) {
1252
+ height: 0;
1253
+ margin: 4px 0;
1254
+ border: 0;
1255
+ border-top: 1px solid var(--pretable-rule);
1256
+ }
1132
1257
 
1133
1258
  /* Enum combobox listbox (cell editor) */
1134
1259
  :where([data-pretable-enum-editor]) {
@@ -1207,9 +1332,16 @@
1207
1332
  padding: 0 6px;
1208
1333
  }
1209
1334
 
1210
- :where([data-pretable-date-header] button:hover) {
1335
+ :where([data-pretable-date-header] button:hover:not(:disabled)) {
1211
1336
  color: var(--pretable-accent);
1212
1337
  }
1338
+ /* The month steppers disable at the calendar's min/max month. Without this
1339
+ they kept the enabled colour, the pointer cursor and the hover accent —
1340
+ the same defect the menu items had. */
1341
+ :where([data-pretable-date-header] button:disabled) {
1342
+ color: var(--pretable-text-dim);
1343
+ cursor: default;
1344
+ }
1213
1345
 
1214
1346
  :where([data-pretable-date-popover] [role="row"]) {
1215
1347
  display: grid;
@@ -2237,4 +2369,80 @@
2237
2369
  transform: translateX(-50%);
2238
2370
  }
2239
2371
  }
2372
+
2373
+ /* ---- Platform preferences --------------------------------------------
2374
+ Two settings the OS carries and a data grid has to answer for itself: a
2375
+ consumer cannot patch either from outside without re-implementing rules
2376
+ they do not own. */
2377
+
2378
+ /* Windows High Contrast and friends. Forced colours REPLACE every author
2379
+ background, border and text colour with a system pair, and drop
2380
+ background-image and box-shadow outright. Most of this grid survives that
2381
+ unaided — the cage of borders carries the structure, the row-select
2382
+ glyph is drawn in `currentColor`, and the focus ring is an outline the UA
2383
+ forces to CanvasText. The frozen edge loses its gradient, and needs
2384
+ nothing: the pinned cell's own border-right is forced to a system colour
2385
+ and marks the boundary.
2386
+
2387
+ SELECTION does not survive, and that is the one thing here that had to
2388
+ be answered. It is a translucent background-image over the cell (see the
2389
+ range-fill rule above), and forced colours drop the image and force the
2390
+ colour underneath to Canvas — so an eleven-cell range came out identical
2391
+ to no selection at all, with only the single FOCUSED cell marked. What
2392
+ the grid is about to copy became unreadable. System colours, not author
2393
+ ones: `Highlight`/`HighlightText` are the pair the platform guarantees
2394
+ against each other, and inside this block they are honoured rather than
2395
+ forced away. */
2396
+ @media (forced-colors: active) {
2397
+ :where([role="gridcell"][aria-selected="true"]) {
2398
+ /* `forced-color-adjust: none` is load-bearing, not an escape hatch, and
2399
+ it is safe only because the two colours below are the SYSTEM's: the
2400
+ cell still paints in the user's own palette, it is simply painting a
2401
+ state the UA would otherwise have erased.
2402
+ Without it Chromium draws a text BACKPLATE — an opaque Canvas
2403
+ rectangle behind text that sits over a background image, which this
2404
+ cell counts as (the range fill is one). The fill then arrived
2405
+ correctly and every word inside it came out as a solid white block.
2406
+ Computed styles looked right in both cases; only a screenshot told
2407
+ them apart. Dropping the background-image here does NOT lift the
2408
+ backplate — that was tried first. */
2409
+ forced-color-adjust: none;
2410
+ background-color: Highlight;
2411
+ color: HighlightText;
2412
+ }
2413
+ /* A cell opted out of forcing hands its descendants author colours again,
2414
+ so a P&L in red or a badge in amber would paint itself onto the
2415
+ Highlight fill at whatever contrast it happened to have. Inheriting the
2416
+ cell's HighlightText is the only pairing guaranteed against it. */
2417
+ :where([role="gridcell"][aria-selected="true"] *) {
2418
+ color: inherit;
2419
+ }
2420
+ /* On a Highlight ground the ring has to change with it: CanvasText is
2421
+ only guaranteed against Canvas, and this cell is no longer Canvas. */
2422
+ :where(
2423
+ [role="gridcell"][aria-selected="true"][data-pretable-focused="true"]
2424
+ ) {
2425
+ outline-color: HighlightText;
2426
+ }
2427
+ /* GrayText is the system's own disabled ink. Without it a disabled item
2428
+ is forced to CanvasText — the enabled colour — and the menu goes back
2429
+ to offering the one thing that cannot be chosen. */
2430
+ :where([data-pretable-menu-item]:disabled) {
2431
+ color: GrayText;
2432
+ }
2433
+ }
2434
+
2435
+ /* Reduced motion. Every animated declaration in this file is named here:
2436
+ they are all decoration — a twisty swinging, two icons fading in — so
2437
+ each is simply switched off rather than shortened. A consumer's own
2438
+ motion is theirs to handle; this is the grid answering for its own. */
2439
+ @media (prefers-reduced-motion: reduce) {
2440
+ :where(
2441
+ [data-pretable-group-twisty],
2442
+ [data-pretable-filter-funnel],
2443
+ [data-pretable-column-menu-button]
2444
+ ) {
2445
+ transition: none;
2446
+ }
2447
+ }
2240
2448
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretable/ui",
3
- "version": "0.15.1",
3
+ "version": "0.15.3",
4
4
  "description": "CSS themes, tokens, and grid styles for Pretable.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/themes/excel.css CHANGED
@@ -8,6 +8,14 @@
8
8
  */
9
9
 
10
10
  :root {
11
+ /* Declared for the same reason pretable.css does: the browser paints the
12
+ scroll viewport's scrollbars and every native control inside the grid —
13
+ the filter dialog's operator select, its popup list — from this, not from
14
+ the tokens. Without it a dark-mode host keeps this grid's scrollbars light and a light
15
+ select popup, which is the one part of the surface a theme cannot reach
16
+ with a custom property. */
17
+ color-scheme: light;
18
+
11
19
  /* Surfaces */
12
20
  --pretable-bg-grid: #ffffff;
13
21
  --pretable-bg-grid-alt: #ffffff; /* No striping by default — Excel doesn't band */
@@ -13,6 +13,14 @@
13
13
  */
14
14
 
15
15
  :root {
16
+ /* Declared for the same reason pretable.css does: the browser paints the
17
+ scroll viewport's scrollbars and every native control inside the grid —
18
+ the filter dialog's operator select, its popup list — from this, not from
19
+ the tokens. Without it a dark-mode grid keeps light scrollbars and a light
20
+ select popup, which is the one part of the surface a theme cannot reach
21
+ with a custom property. */
22
+ color-scheme: light;
23
+
16
24
  /* Surfaces — M3 neutral grayscale (untinted by primary seed) */
17
25
  --pretable-bg-grid: #fcfcfc; /* N99 */
18
26
  --pretable-bg-grid-alt: #fcfcfc; /* No striping by default — Material list pattern */
@@ -163,6 +171,8 @@
163
171
  /* Dark mode — M3 baseline dark; color-only overrides; density inherits from light. */
164
172
 
165
173
  [data-theme="dark"] {
174
+ color-scheme: dark;
175
+
166
176
  --pretable-bg-grid: #1c1c1c; /* surface-container-low */
167
177
  --pretable-bg-grid-alt: #1c1c1c;
168
178
  --pretable-bg-header: #212121; /* surface-container */