@pretable/ui 0.0.12 → 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 +3 -1
- package/dist/grid.css +56 -18
- package/dist/themes/excel.css +6 -0
- package/dist/themes/material.css +7 -0
- package/package.json +1 -1
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-
|
|
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:
|
|
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
|
|
94
|
-
|
|
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:
|
|
222
|
+
border-left: var(--pretable-rule-width, 1px) solid
|
|
223
|
+
var(--pretable-rule-vertical, var(--pretable-rule));
|
|
211
224
|
}
|
|
212
225
|
|
|
213
|
-
/* Selection
|
|
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
|
-
/*
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
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) */
|
package/dist/themes/excel.css
CHANGED
|
@@ -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 */
|
package/dist/themes/material.css
CHANGED
|
@@ -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 */
|