@pretable/ui 0.3.2 → 0.4.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/README.md CHANGED
@@ -28,7 +28,7 @@ For tailwind users, swap `grid.css` for `tailwind.css` (both work; `tailwind.css
28
28
 
29
29
  ## CSS API (v1 contract)
30
30
 
31
- `@pretable/ui` ships five CSS entrypoints. Their selectors and CSS variables form the v1 styling contract — pretable's React components (`<Pretable>`, `<PretableSurface>`, `<InspectionGrid>`, `<LabeledGridSurface>`) emit the data attributes these stylesheets target.
31
+ `@pretable/ui` ships five CSS entrypoints. Their selectors and CSS variables form the v1 styling contract — pretable's React components (`<Pretable>`, `<PretableSurface>`, `<LabeledGridSurface>`) emit the data attributes these stylesheets target.
32
32
 
33
33
  ### Entrypoints
34
34
 
package/dist/grid.css CHANGED
@@ -44,11 +44,17 @@
44
44
  height: var(--pretable-icon-size, 16px);
45
45
  }
46
46
 
47
- /* Outer viewport (scrollable container) */
47
+ /* Outer viewport (scrollable container).
48
+ The card shadow lets a theme separate the grid from the host page with
49
+ elevation instead of a drawn frame — the frame alone cannot go faint,
50
+ because --pretable-rule-strong is also the sticky header's underline and
51
+ owes 3:1 there. Both compatibility skins set it to `none` and are
52
+ unchanged. */
48
53
  :where([data-pretable-scroll-viewport]) {
49
54
  background: var(--pretable-bg-grid);
50
55
  border: 1px solid var(--pretable-rule-strong);
51
56
  border-radius: var(--pretable-radius);
57
+ box-shadow: var(--pretable-shadow-card);
52
58
  font-family: var(--pretable-font-sans);
53
59
  color: var(--pretable-text-cell);
54
60
  }
@@ -0,0 +1,274 @@
1
+ /**
2
+ * pretable — the house theme. The documented default.
3
+ *
4
+ * Excel and Material are imitations; this one is the product's own voice. Its
5
+ * identity is craft, not hue: hairline rules, horizontal-only separation,
6
+ * a quiet header, honest elevation, and a single functional interaction colour
7
+ * that is a system convention rather than a brand.
8
+ *
9
+ * THREE SURFACE TIERS. The reference designs get away with near-invisible
10
+ * hairlines because their cards sit on a grey page. pretable never paints the
11
+ * page, so it paints its own canvas instead — INSIDE the component:
12
+ *
13
+ * Tier 1 chrome / inset canvas --pretable-bg-header, --pretable-bg-toolbar
14
+ * The recessed plane. Everything that is not a record: the sticky
15
+ * header rail and the drag-to-group strip. Tinted so the hairlines
16
+ * drawn on it have something to read against.
17
+ * Tier 1.5 structure --pretable-bg-group-row
18
+ * Half a step off the canvas: group headers live inside the data
19
+ * plane but are chrome, so they must not flatten into the records
20
+ * they contain.
21
+ * Tier 2 paper / data --pretable-bg-grid, -grid-alt, -bg-pinned
22
+ * The records. Pure white, including the frozen columns — a pinned
23
+ * column is data, not chrome, and greying it was the old bug.
24
+ * Tier 3 lifted --pretable-bg-tooltip, --pretable-edit-bg
25
+ * Things that leave the plane: menus, popovers, the cell editor.
26
+ *
27
+ * How the tiers separate differs by mode, deliberately:
28
+ * light — tiers 1/2 separate by TONE, tier 3 by SHADOW (paper physics).
29
+ * dark — all three separate by TONE; shadows are invisible on dark ground,
30
+ * so tier 3 is the lightest surface in the theme.
31
+ *
32
+ * The container edge is a hairline plus --pretable-shadow-card, not a drawn
33
+ * frame. --pretable-rule-strong does three jobs at once (container edge,
34
+ * sticky-header seam, popover edge) and is the only thing separating a pinned
35
+ * header from rows scrolling under it, so it is held at >= 3:1 against BOTH
36
+ * the header it sits on and the grid it sits above. It is not near-white.
37
+ *
38
+ * Default density: standard. Designed against a #ffffff to #f4f4f6 page.
39
+ *
40
+ * Override any token at :root or a more specific scope:
41
+ * :root { --pretable-accent: hotpink; }
42
+ */
43
+
44
+ :root {
45
+ color-scheme: light;
46
+
47
+ /* --- Tier 1: chrome / the inset canvas ------------------------------- */
48
+ /* The header is TINTED on purpose. A white header would leave the sticky
49
+ rail separated from scrolling rows by tone alone at ~1.0:1, and would give
50
+ every hairline drawn on it nothing to read against. 1.14:1 off the data
51
+ surface is a whisper — enough to register as a plane, not as a fill. */
52
+ --pretable-bg-header: #eff0f4;
53
+ --pretable-bg-toolbar: #f1f1f4;
54
+
55
+ /* --- Tier 1.5: structure inside the data plane ----------------------- */
56
+ /* Group rows no longer borrow the header token. They sit between the canvas
57
+ and the paper: heavier than a record, lighter than the rail. */
58
+ --pretable-bg-group-row: #f7f7f9;
59
+
60
+ /* --- Tier 2: paper / the records ------------------------------------- */
61
+ --pretable-bg-grid: #ffffff;
62
+ --pretable-bg-grid-alt: #ffffff; /* No zebra — the hairline does the work */
63
+ --pretable-bg-pinned: #ffffff; /* Frozen columns are data, not chrome */
64
+
65
+ /* --- Tier 3: lifted -------------------------------------------------- */
66
+ /* Same white as the paper. In light mode elevation is a shadow, not a tone;
67
+ these surfaces are separated by --pretable-shadow-overlay and a hairline. */
68
+ --pretable-bg-tooltip: #ffffff;
69
+ --pretable-edit-bg: #f7f7fa;
70
+
71
+ /* --- Text ------------------------------------------------------------ */
72
+ /* A quiet header: the label is smaller AND greyer than the data beneath it.
73
+ text-dim is deliberately NOT a clone of text-header — the two shipped
74
+ themes set them to the same literal, which makes the header and the
75
+ secondary content impossible to tune apart. Here the header is the
76
+ quietest text in the grid (5.61:1 on the header it sits on) because it is
77
+ chrome; text-dim is secondary CONTENT (6.78:1 there, 7.72:1 on the grid) and includes a 9px sort-priority badge, so it
78
+ gets more contrast, not less. Both clear AA on every surface they touch. */
79
+ --pretable-text-cell: #1a1a1f;
80
+ --pretable-text-header: #5e5e6a;
81
+ --pretable-text-dim: #52525c;
82
+
83
+ /* --- Lines ----------------------------------------------------------- */
84
+ /* The row hairline. Decorative, so it is allowed to be faint (1.33:1). */
85
+ --pretable-rule: #dfdfe5;
86
+ /* Load-bearing. Container edge, sticky-header seam, popover edge, and the
87
+ boundary a pinned header presents to rows sliding underneath it.
88
+ 3.52:1 on the header, 4.00:1 on the grid — clears the 3:1 non-text floor
89
+ against both of its backgrounds. Near-white here is the classic trap. */
90
+ --pretable-rule-strong: #7e7e8b;
91
+ /* No cage. This is the single biggest visual difference from a spreadsheet,
92
+ and it matters more as rows get taller: in a wrapped 90px row a vertical
93
+ divider becomes a long empty channel running through whitespace. */
94
+ --pretable-rule-vertical: transparent;
95
+ --pretable-rule-width: 1px;
96
+
97
+ /* --- Radii ----------------------------------------------------------- */
98
+ --pretable-radius: 10px;
99
+ --pretable-radius-control: 6px;
100
+
101
+ /* --- State ----------------------------------------------------------- */
102
+ /* Hover must stay translucent: it composites over the surface, so an opaque
103
+ value would erase the pinned fill and the group-row fill underneath it. */
104
+ --pretable-bg-hover: rgba(24, 24, 32, 0.05);
105
+ --pretable-bg-selected: #dfe6fb;
106
+ --pretable-text-selected: #131826;
107
+ --pretable-focus-ring: #2554cf;
108
+ --pretable-text-error: #c0271c;
109
+
110
+ /* --- The one hue ----------------------------------------------------- */
111
+ /* Exactly one colour in the theme, and it means "interactive / selected" —
112
+ never a surface, never chrome text. A system blue rather than a brand
113
+ blue, so the grid reads as part of the host app instead of competing with
114
+ it. 7.11:1 on white: it is used as TEXT (the filter menu's Clear button,
115
+ the calendar nav) and as the fill behind a white checkmark, and one ratio
116
+ covers both directions. */
117
+ --pretable-accent: #3f5a7a;
118
+
119
+ /* --- Grid controls --------------------------------------------------- */
120
+ /* Written as literals rather than var() aliases so the dark block can move
121
+ them independently — aliasing checkbox-border to rule-strong is what lets
122
+ an affordance inherit a decorative value. */
123
+ --pretable-selection-bg: rgba(37, 84, 207, 0.1);
124
+ --pretable-checkbox-bg: #ffffff;
125
+ --pretable-checkbox-border: #787885;
126
+ --pretable-checkbox-checked-bg: #2554cf;
127
+ --pretable-checkbox-checked-fg: #ffffff;
128
+ --pretable-resize-handle: transparent;
129
+ --pretable-resize-handle-hover: #2554cf;
130
+ --pretable-reorder-ghost-bg: #ffffff;
131
+ --pretable-reorder-drop-indicator: #2554cf;
132
+
133
+ /* --- Elevation ------------------------------------------------------- */
134
+ /* Two layers each: a 1px contact shadow that grounds the edge, and a wide
135
+ negative-spread ambient that reads as distance. One-layer shadows are the
136
+ tell of a theme that was eyeballed. */
137
+ --pretable-shadow-overlay:
138
+ 0 1px 2px rgba(16, 17, 26, 0.06), 0 8px 24px -6px rgba(16, 17, 26, 0.16);
139
+ /* The container. This theme does NOT draw a frame — a hairline plus real
140
+ elevation. Requires grid.css to apply it to the scroll viewport; without
141
+ that the token is inert. */
142
+ --pretable-shadow-card:
143
+ 0 1px 2px rgba(16, 17, 26, 0.05), 0 2px 8px -4px rgba(16, 17, 26, 0.1);
144
+ /* The frozen-column edge, now that pinned cells no longer announce
145
+ themselves with a grey fill. Spread must be <= -blur/2 or the blur bleeds
146
+ above and below each pinned cell and bands every row boundary. */
147
+ --pretable-seam-color: rgba(16, 17, 26, 0.2);
148
+
149
+ /* --- Density — natural default = standard ---------------------------- */
150
+ /* Header 52 against rows 48: with the header nearly unfilled, separation
151
+ rests on one hairline, and the rail needs the extra air to read as chrome
152
+ rather than as a first data row. */
153
+ --pretable-row-height: 48px;
154
+ --pretable-header-height: 52px;
155
+ --pretable-group-panel-height: 44px;
156
+ --pretable-cell-padding-x: 16px;
157
+ --pretable-cell-padding-y: 12px;
158
+ --pretable-group-indent: 24px;
159
+ --pretable-font-size-cell: 14px;
160
+ --pretable-font-size-header: 12.5px; /* Smaller than the data it labels */
161
+
162
+ /* Every glyph draws at this size. 14px is the ceiling the chrome allows: the
163
+ glyph renders inside a 14x14 chip-remove button and inside a 16x16
164
+ checkbox minus its border. Not density-scoped — these are affordances,
165
+ not text. */
166
+ --pretable-icon-size: 14px;
167
+
168
+ /* --- Typography ------------------------------------------------------ */
169
+ /* No webfont. A house theme that ships a font dependency cannot disappear
170
+ into a host application, and it costs a network request before first
171
+ paint. The stack resolves to whatever the platform already renders UI in,
172
+ and grid.css supplies the tabular figures. */
173
+ --pretable-font-sans:
174
+ ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
175
+ Roboto, "Helvetica Neue", Arial, sans-serif;
176
+ --pretable-font-mono:
177
+ ui-monospace, SFMono-Regular, "SF Mono", "Cascadia Mono", Menlo, Consolas,
178
+ monospace;
179
+ }
180
+
181
+ /* :root is already standard; only non-default tiers need explicit selectors.
182
+ The three height tokens are read by JavaScript and must stay `<n>px` and
183
+ strictly growing across tiers. */
184
+
185
+ [data-density="compact"] {
186
+ --pretable-row-height: 40px;
187
+ --pretable-header-height: 44px;
188
+ --pretable-group-panel-height: 40px;
189
+ --pretable-cell-padding-x: 12px;
190
+ --pretable-cell-padding-y: 8px;
191
+ --pretable-group-indent: 20px;
192
+ --pretable-font-size-cell: 13px;
193
+ --pretable-font-size-header: 12px;
194
+ }
195
+
196
+ [data-density="spacious"] {
197
+ --pretable-row-height: 56px;
198
+ --pretable-header-height: 60px;
199
+ --pretable-group-panel-height: 52px;
200
+ --pretable-cell-padding-x: 24px;
201
+ --pretable-cell-padding-y: 16px;
202
+ --pretable-group-indent: 32px;
203
+ --pretable-font-size-cell: 15px;
204
+ --pretable-font-size-header: 13px;
205
+ }
206
+
207
+ /* Dark mode — colour-only overrides; density inherits from light.
208
+ Every colour token is restated. Nothing is aliased, so nothing can be
209
+ silently forgotten: a white edit-bg or a white checkmark surviving into
210
+ dark mode is the failure this block exists to prevent.
211
+ The tier order inverts: on dark ground, elevation is tone, so the lifted
212
+ tier is the LIGHTEST surface and the data plane is the darkest. */
213
+
214
+ [data-theme="dark"] {
215
+ color-scheme: dark;
216
+
217
+ /* Tier 1 — chrome / the inset canvas */
218
+ --pretable-bg-header: #1e1e24;
219
+ --pretable-bg-toolbar: #1e1e24;
220
+
221
+ /* Tier 1.5 — structure */
222
+ --pretable-bg-group-row: #191920;
223
+
224
+ /* Tier 2 — paper / the records */
225
+ --pretable-bg-grid: #141418;
226
+ --pretable-bg-grid-alt: #141418;
227
+ --pretable-bg-pinned: #141418;
228
+
229
+ /* Tier 3 — lifted. Lighter than the plane below it, because a shadow cast
230
+ onto #141418 is not visible. */
231
+ --pretable-bg-tooltip: #22222a;
232
+ --pretable-edit-bg: #22222a;
233
+
234
+ /* Text */
235
+ --pretable-text-cell: #ededf2;
236
+ --pretable-text-header: #9a9aa8;
237
+ --pretable-text-dim: #adadbb;
238
+
239
+ /* Lines */
240
+ --pretable-rule: #2c2c34;
241
+ --pretable-rule-strong: #70707e; /* 3.40:1 on the header, 3.77:1 on the grid */
242
+ --pretable-rule-vertical: transparent;
243
+
244
+ /* State */
245
+ --pretable-bg-hover: rgba(255, 255, 255, 0.07);
246
+ --pretable-bg-selected: #1e2d52;
247
+ --pretable-text-selected: #dce6ff;
248
+ --pretable-focus-ring: #8ab0ff;
249
+ --pretable-text-error: #ffa19a;
250
+
251
+ /* The one hue */
252
+ --pretable-accent: #8fb2d9;
253
+
254
+ /* Grid controls */
255
+ --pretable-selection-bg: rgba(138, 176, 255, 0.16);
256
+ --pretable-checkbox-bg: #141418;
257
+ --pretable-checkbox-border: #727281;
258
+ --pretable-checkbox-checked-bg: #8ab0ff;
259
+ /* Dark ink, not white. White on a light-blue chip is 1.70:1 — the defect
260
+ Material ships because it left this token out of its dark block. */
261
+ --pretable-checkbox-checked-fg: #10131c;
262
+ --pretable-resize-handle: transparent;
263
+ --pretable-resize-handle-hover: #8ab0ff;
264
+ --pretable-reorder-ghost-bg: #22222a;
265
+ --pretable-reorder-drop-indicator: #8ab0ff;
266
+
267
+ /* Elevation — black and deeper. Lightening a shadow in dark mode makes it a
268
+ glow; the separation comes from the tonal step above, not from the shadow. */
269
+ --pretable-shadow-overlay:
270
+ 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 28px -8px rgba(0, 0, 0, 0.7);
271
+ --pretable-shadow-card:
272
+ 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 10px -6px rgba(0, 0, 0, 0.5);
273
+ --pretable-seam-color: rgba(0, 0, 0, 0.62);
274
+ }
@@ -0,0 +1,2 @@
1
+ declare const stylesheet: string;
2
+ export default stylesheet;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretable/ui",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "description": "CSS themes, tokens, and grid styles for Pretable.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -41,6 +41,10 @@
41
41
  "types": "./dist/themes/material.css.d.ts",
42
42
  "default": "./dist/themes/material.css"
43
43
  },
44
+ "./themes/pretable.css": {
45
+ "types": "./dist/themes/pretable.css.d.ts",
46
+ "default": "./dist/themes/pretable.css"
47
+ },
44
48
  "./grid.css": {
45
49
  "types": "./dist/grid.css.d.ts",
46
50
  "default": "./dist/grid.css"
@@ -60,7 +64,7 @@
60
64
  "api:check": "api-extractor run --config api-extractor.json",
61
65
  "build": "tsup && node ./scripts/copy-css-assets.mjs",
62
66
  "lint": "eslint src --ext .ts",
63
- "lint:packaging": "publint --strict && attw --pack --exclude-entrypoints ./themes/excel.css ./themes/material.css ./grid.css ./tailwind.css ./tokens.css",
67
+ "lint:packaging": "publint --strict && attw --pack --exclude-entrypoints ./themes/excel.css ./themes/material.css ./themes/pretable.css ./grid.css ./tailwind.css ./tokens.css",
64
68
  "test": "vitest run",
65
69
  "typecheck": "tsc -p tsconfig.typecheck.json --noEmit"
66
70
  }