@pretable/ui 0.0.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Brian Love
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # @pretable/ui
2
+
3
+ CSS theme + a small JS helper for [pretable](https://pretable.dev/). Pair with [`@pretable/react`](../react) for the full surface, or use the JS helper standalone in non-React adapters.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm install @pretable/ui
9
+ # or pnpm add @pretable/ui, yarn add @pretable/ui
10
+ ```
11
+
12
+ ## Minimal usage
13
+
14
+ Import the CSS once at the root of your app:
15
+
16
+ ```ts
17
+ import "@pretable/ui/grid.css";
18
+ ```
19
+
20
+ Optionally layer a theme:
21
+
22
+ ```ts
23
+ import "@pretable/ui/themes/excel.css";
24
+ import "@pretable/ui/grid.css";
25
+ ```
26
+
27
+ For tailwind users, swap `grid.css` for `tailwind.css` (both work; `tailwind.css` reads from your tailwind tokens).
28
+
29
+ ## CSS API (v1 contract)
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.
32
+
33
+ ### Entrypoints
34
+
35
+ - `@pretable/ui/grid.css` — the default styles. Imports `tokens.css`. Use this in a vanilla CSS or Sass setup.
36
+ - `@pretable/ui/tailwind.css` — same grid styles authored against tailwind tokens. Use this in a tailwind app.
37
+ - `@pretable/ui/tokens.css` — the CSS-variable definitions only. Imported by `grid.css` automatically; use directly only when you want tokens without grid styles.
38
+ - `@pretable/ui/themes/excel.css` — Excel-flavored theme. Layer on top of `grid.css`.
39
+ - `@pretable/ui/themes/material.css` — Material-flavored theme. Layer on top of `grid.css`.
40
+
41
+ ### Density CSS variables
42
+
43
+ The two density-related variables `getDensityHeights()` reads:
44
+
45
+ | Variable | Default (in `tokens.css`) | Purpose |
46
+ | -------------------------- | ------------------------- | ------------------ |
47
+ | `--pretable-row-height` | `32px` | Body row height. |
48
+ | `--pretable-header-height` | `36px` | Header row height. |
49
+
50
+ The full token set lives in [`src/tokens.css`](./src/tokens.css). Override any token at `:root` or on a scoped element to change the look.
51
+
52
+ ### Data-attribute hooks
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-focused]`, and `[data-pretable-cell-selected]`. Renaming or removing these attributes is a breaking change.
55
+
56
+ ## JS API
57
+
58
+ ```ts
59
+ import { getDensityHeights } from "@pretable/ui";
60
+
61
+ const { rowHeight, headerHeight } = getDensityHeights();
62
+ ```
63
+
64
+ `getDensityHeights()` is a synchronous snapshot of `--pretable-row-height` and `--pretable-header-height` on `document.documentElement`, with fallbacks of 32 / 36. SSR-safe (returns fallback values when `document` is undefined).
65
+
66
+ See **[`ui.api.md`](./ui.api.md)** for the generated public-API report.
67
+
68
+ ## License
69
+
70
+ MIT — see [LICENSE](../../LICENSE).
package/dist/grid.css ADDED
@@ -0,0 +1,213 @@
1
+ /**
2
+ * @pretable/ui/grid.css
3
+ * Selector-based grid skin. Targets data attributes exposed by @pretable/react;
4
+ * values reference --pretable-* tokens defined by theme files.
5
+ *
6
+ * Consumer recipe:
7
+ * @import "@pretable/ui/themes/excel.css";
8
+ * @import "@pretable/ui/grid.css";
9
+ */
10
+
11
+ /* Visually hidden — used for ARIA live region announcements. */
12
+ .pt-sr-only {
13
+ position: absolute;
14
+ width: 1px;
15
+ height: 1px;
16
+ padding: 0;
17
+ margin: -1px;
18
+ overflow: hidden;
19
+ clip: rect(0, 0, 0, 0);
20
+ white-space: nowrap;
21
+ border: 0;
22
+ }
23
+
24
+ /* Outer viewport (scrollable container) */
25
+ [data-pretable-scroll-viewport] {
26
+ background: var(--pretable-bg-grid);
27
+ border: 1px solid var(--pretable-rule-strong);
28
+ border-radius: var(--pretable-radius);
29
+ font-family: var(--pretable-font-sans);
30
+ color: var(--pretable-text-cell);
31
+ }
32
+
33
+ /* Header row */
34
+ [data-pretable-header-row] {
35
+ background: var(--pretable-bg-header);
36
+ border-bottom: 1px solid var(--pretable-rule-strong);
37
+ height: var(--pretable-header-height);
38
+ }
39
+
40
+ [data-pretable-header-cell] {
41
+ display: flex;
42
+ align-items: center;
43
+ padding: 0 var(--pretable-cell-padding-x);
44
+ font-size: var(--pretable-font-size-header);
45
+ font-weight: 500;
46
+ color: var(--pretable-text-header);
47
+ border-right: 1px solid var(--pretable-rule);
48
+ box-sizing: border-box;
49
+ }
50
+
51
+ [data-pretable-header-cell]:last-of-type {
52
+ border-right: none;
53
+ }
54
+
55
+ /* Body cells */
56
+ [data-pretable-cell] {
57
+ display: flex;
58
+ align-items: center;
59
+ box-sizing: border-box;
60
+ padding: var(--pretable-cell-padding-y) var(--pretable-cell-padding-x);
61
+ font-size: var(--pretable-font-size-cell);
62
+ color: var(--pretable-text-cell);
63
+ background: var(--pretable-bg-grid);
64
+ border-right: 1px solid var(--pretable-rule);
65
+ border-bottom: 1px solid var(--pretable-rule);
66
+ }
67
+
68
+ [data-pretable-cell]:last-of-type {
69
+ border-right: none;
70
+ }
71
+
72
+ /* Zebra striping — only effective when --pretable-bg-grid-alt differs */
73
+ [data-pretable-row]:nth-child(even) [data-pretable-cell] {
74
+ background: var(--pretable-bg-grid-alt);
75
+ }
76
+
77
+ /* Hover */
78
+ [data-pretable-row]:hover [data-pretable-cell] {
79
+ background: var(--pretable-bg-hover);
80
+ }
81
+
82
+ /* Pinned cells (sticky left/right) — reuse header background */
83
+ [data-pretable-cell][data-pinned="left"],
84
+ [data-pretable-cell][data-pinned="right"] {
85
+ background: var(--pretable-bg-header);
86
+ z-index: 1;
87
+ }
88
+
89
+ /* Selection */
90
+ [data-pretable-cell][data-selected="true"] {
91
+ background: var(--pretable-bg-selected);
92
+ color: var(--pretable-text-selected);
93
+ }
94
+
95
+ /* Focus */
96
+ [data-pretable-cell][data-focused="true"] {
97
+ outline: 2px solid var(--pretable-focus-ring);
98
+ outline-offset: -2px;
99
+ }
100
+
101
+ /**
102
+ * Theme-agnostic cell-range selection visuals (Phase 3).
103
+ * Targets the ARIA role + aria-selected attribute exposed by @pretable/react,
104
+ * so consumers using only @pretable/ui's tokens.css (no theme file) still get
105
+ * a usable visual. Theme-prefixed rules above take precedence when a theme is
106
+ * loaded.
107
+ */
108
+ [role="gridcell"][aria-selected="true"] {
109
+ background: var(--pt-color-selection-bg);
110
+ }
111
+
112
+ [role="gridcell"][data-focused="true"] {
113
+ box-shadow: inset 0 0 0 2px var(--pt-color-focus-ring);
114
+ }
115
+
116
+ /* Numeric cells (opt-in via [data-pretable-numeric="true"]) */
117
+ [data-pretable-cell][data-pretable-numeric="true"] {
118
+ font-family: var(--pretable-font-mono);
119
+ text-align: right;
120
+ justify-content: flex-end;
121
+ font-variant-numeric: tabular-nums;
122
+ }
123
+
124
+ /* Toolbar / status bar — applied if engine wraps in named data attribute */
125
+ [data-pretable-toolbar],
126
+ [data-pretable-status-bar] {
127
+ background: var(--pretable-bg-toolbar);
128
+ color: var(--pretable-text-dim);
129
+ font-family: var(--pretable-font-sans);
130
+ font-size: var(--pretable-font-size-cell);
131
+ }
132
+
133
+ /* Row-selection checkbox column (Phase 4) */
134
+ [data-pretable-cell][data-row-select-cell="true"],
135
+ [data-pretable-header-cell][data-pretable-row-select-header] {
136
+ display: flex;
137
+ align-items: center;
138
+ justify-content: center;
139
+ padding: 0;
140
+ }
141
+ button[data-pretable-row-select],
142
+ button[data-pretable-row-select-all] {
143
+ width: 16px;
144
+ height: 16px;
145
+ border: 1px solid var(--pt-color-checkbox-border);
146
+ background: var(--pt-color-checkbox-bg);
147
+ border-radius: 3px;
148
+ cursor: pointer;
149
+ padding: 0;
150
+ display: inline-flex;
151
+ align-items: center;
152
+ justify-content: center;
153
+ font-size: 11px;
154
+ line-height: 1;
155
+ color: var(--pt-color-checkbox-checked-fg);
156
+ }
157
+ button[data-pretable-row-select][aria-checked="true"],
158
+ button[data-pretable-row-select-all][aria-checked="true"] {
159
+ background: var(--pt-color-checkbox-checked-bg);
160
+ border-color: var(--pt-color-checkbox-checked-bg);
161
+ color: var(--pt-color-checkbox-checked-fg);
162
+ }
163
+ button[data-pretable-row-select][aria-checked="mixed"],
164
+ button[data-pretable-row-select-all][aria-checked="mixed"] {
165
+ background: var(--pt-color-checkbox-checked-bg);
166
+ border-color: var(--pt-color-checkbox-checked-bg);
167
+ color: var(--pt-color-checkbox-checked-fg);
168
+ }
169
+
170
+ /* Column resize handle (sub-project C) */
171
+ [data-pretable-resize-handle] {
172
+ position: absolute;
173
+ top: 0;
174
+ right: 0;
175
+ width: 4px;
176
+ height: 100%;
177
+ cursor: col-resize;
178
+ background: var(--pt-color-resize-handle);
179
+ z-index: 2;
180
+ user-select: none;
181
+ touch-action: none;
182
+ }
183
+ [data-pretable-resize-handle]:hover,
184
+ [data-pretable-resize-handle][data-dragging="true"] {
185
+ background: var(--pt-color-resize-handle-hover);
186
+ }
187
+
188
+ /* Column reorder gesture (sub-project C) */
189
+ [data-pretable-reorder-ghost] {
190
+ position: fixed;
191
+ pointer-events: none;
192
+ background: var(--pt-color-reorder-ghost-bg);
193
+ box-shadow: var(--pt-color-reorder-ghost-shadow);
194
+ opacity: 0.6;
195
+ z-index: 10;
196
+ user-select: none;
197
+ }
198
+ [data-pretable-reorder-drop-indicator] {
199
+ position: absolute;
200
+ top: 0;
201
+ width: 2px;
202
+ background: var(--pt-color-reorder-drop-indicator);
203
+ z-index: 9;
204
+ pointer-events: none;
205
+ }
206
+
207
+ /* Tooltip / popover */
208
+ [data-pretable-popover] {
209
+ background: var(--pretable-bg-tooltip);
210
+ color: var(--pretable-text-cell);
211
+ border: 1px solid var(--pretable-rule);
212
+ border-radius: var(--pretable-radius);
213
+ }
@@ -0,0 +1,2 @@
1
+ declare const stylesheet: string;
2
+ export default stylesheet;
package/dist/index.cjs ADDED
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ // src/density.ts
4
+ var FALLBACK_ROW_HEIGHT = 32;
5
+ var FALLBACK_HEADER_HEIGHT = 36;
6
+ function parsePx(value) {
7
+ const trimmed = value.trim();
8
+ const match = trimmed.match(/^([\d.]+)px$/);
9
+ return match ? parseFloat(match[1]) : null;
10
+ }
11
+ function getDensityHeights() {
12
+ if (typeof document === "undefined") {
13
+ return {
14
+ rowHeight: FALLBACK_ROW_HEIGHT,
15
+ headerHeight: FALLBACK_HEADER_HEIGHT
16
+ };
17
+ }
18
+ const styles = getComputedStyle(document.documentElement);
19
+ const read = (name) => {
20
+ if (typeof styles?.getPropertyValue !== "function") return "";
21
+ return styles.getPropertyValue(name);
22
+ };
23
+ return {
24
+ rowHeight: parsePx(read("--pretable-row-height")) ?? FALLBACK_ROW_HEIGHT,
25
+ headerHeight: parsePx(read("--pretable-header-height")) ?? FALLBACK_HEADER_HEIGHT
26
+ };
27
+ }
28
+
29
+ exports.getDensityHeights = getDensityHeights;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Density-related heights (in CSS pixels) read from the active theme.
3
+ *
4
+ * @public
5
+ */
6
+ interface DensityHeights {
7
+ rowHeight: number;
8
+ headerHeight: number;
9
+ }
10
+ /**
11
+ * Synchronous snapshot of the resolved density-related CSS variables on
12
+ * `document.documentElement`.
13
+ *
14
+ * Returns `{ rowHeight, headerHeight }` parsed from `--pretable-row-height`
15
+ * and `--pretable-header-height`. Falls back to 32 / 36 when a variable is
16
+ * unset, empty, or not parseable as a `<number>px` value.
17
+ *
18
+ * SSR-safe: returns the fallback values when `document` is undefined.
19
+ *
20
+ * For non-React consumers, tests, custom virtualizers, and power users.
21
+ * The reactive React hook (`useResolvedHeights`) lives in `@pretable/react`.
22
+ *
23
+ * @public
24
+ */
25
+ declare function getDensityHeights(): DensityHeights;
26
+
27
+ export { type DensityHeights, getDensityHeights };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Density-related heights (in CSS pixels) read from the active theme.
3
+ *
4
+ * @public
5
+ */
6
+ interface DensityHeights {
7
+ rowHeight: number;
8
+ headerHeight: number;
9
+ }
10
+ /**
11
+ * Synchronous snapshot of the resolved density-related CSS variables on
12
+ * `document.documentElement`.
13
+ *
14
+ * Returns `{ rowHeight, headerHeight }` parsed from `--pretable-row-height`
15
+ * and `--pretable-header-height`. Falls back to 32 / 36 when a variable is
16
+ * unset, empty, or not parseable as a `<number>px` value.
17
+ *
18
+ * SSR-safe: returns the fallback values when `document` is undefined.
19
+ *
20
+ * For non-React consumers, tests, custom virtualizers, and power users.
21
+ * The reactive React hook (`useResolvedHeights`) lives in `@pretable/react`.
22
+ *
23
+ * @public
24
+ */
25
+ declare function getDensityHeights(): DensityHeights;
26
+
27
+ export { type DensityHeights, getDensityHeights };
package/dist/index.mjs ADDED
@@ -0,0 +1,27 @@
1
+ // src/density.ts
2
+ var FALLBACK_ROW_HEIGHT = 32;
3
+ var FALLBACK_HEADER_HEIGHT = 36;
4
+ function parsePx(value) {
5
+ const trimmed = value.trim();
6
+ const match = trimmed.match(/^([\d.]+)px$/);
7
+ return match ? parseFloat(match[1]) : null;
8
+ }
9
+ function getDensityHeights() {
10
+ if (typeof document === "undefined") {
11
+ return {
12
+ rowHeight: FALLBACK_ROW_HEIGHT,
13
+ headerHeight: FALLBACK_HEADER_HEIGHT
14
+ };
15
+ }
16
+ const styles = getComputedStyle(document.documentElement);
17
+ const read = (name) => {
18
+ if (typeof styles?.getPropertyValue !== "function") return "";
19
+ return styles.getPropertyValue(name);
20
+ };
21
+ return {
22
+ rowHeight: parsePx(read("--pretable-row-height")) ?? FALLBACK_ROW_HEIGHT,
23
+ headerHeight: parsePx(read("--pretable-header-height")) ?? FALLBACK_HEADER_HEIGHT
24
+ };
25
+ }
26
+
27
+ export { getDensityHeights };
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @pretable/ui/tailwind.css
3
+ * Opt-in Tailwind v4 bridge. Aliases --pretable-* tokens to --color-* / --font-*
4
+ * shortcuts under the `pt-` prefix to avoid collisions with consumer's colors.
5
+ *
6
+ * Consumer recipe (Tailwind v4):
7
+ * @import "tailwindcss";
8
+ * @import "@pretable/ui/themes/material.css";
9
+ * @import "@pretable/ui/grid.css";
10
+ * @import "@pretable/ui/tailwind.css";
11
+ */
12
+
13
+ @theme inline {
14
+ /* Surfaces */
15
+ --color-pt-bg-grid: var(--pretable-bg-grid);
16
+ --color-pt-bg-grid-alt: var(--pretable-bg-grid-alt);
17
+ --color-pt-bg-header: var(--pretable-bg-header);
18
+ --color-pt-bg-toolbar: var(--pretable-bg-toolbar);
19
+ --color-pt-bg-tooltip: var(--pretable-bg-tooltip);
20
+
21
+ /* Text */
22
+ --color-pt-text-cell: var(--pretable-text-cell);
23
+ --color-pt-text-header: var(--pretable-text-header);
24
+ --color-pt-text-dim: var(--pretable-text-dim);
25
+
26
+ /* Lines */
27
+ --color-pt-rule: var(--pretable-rule);
28
+ --color-pt-rule-strong: var(--pretable-rule-strong);
29
+
30
+ /* State */
31
+ --color-pt-bg-hover: var(--pretable-bg-hover);
32
+ --color-pt-bg-selected: var(--pretable-bg-selected);
33
+ --color-pt-text-selected: var(--pretable-text-selected);
34
+ --color-pt-focus-ring: var(--pretable-focus-ring);
35
+
36
+ /* Accent */
37
+ --color-pt-accent: var(--pretable-accent);
38
+
39
+ /* Typography */
40
+ --font-pt-sans: var(--pretable-font-sans);
41
+ --font-pt-mono: var(--pretable-font-mono);
42
+ }
@@ -0,0 +1,2 @@
1
+ declare const stylesheet: string;
2
+ export default stylesheet;
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Excel — gray, technical, dense.
3
+ * Aptos Narrow at 11pt (15px), green active-cell border, no row hover.
4
+ * Light-only by design. Default density: compact.
5
+ *
6
+ * Override any token at :root or a more specific scope:
7
+ * :root { --pretable-accent: hotpink; }
8
+ */
9
+
10
+ :root {
11
+ /* Surfaces */
12
+ --pretable-bg-grid: #ffffff;
13
+ --pretable-bg-grid-alt: #ffffff; /* No striping by default — Excel doesn't band */
14
+ --pretable-bg-header: #f3f3f3; /* Excel-for-web header strip */
15
+ --pretable-bg-toolbar: #f3f3f3;
16
+ --pretable-bg-tooltip: #ffffff;
17
+
18
+ /* Text */
19
+ --pretable-text-cell: #1f1f1f;
20
+ --pretable-text-header: #5c5c5c; /* Softer than body; Excel chrome convention */
21
+ --pretable-text-dim: #5c5c5c;
22
+
23
+ /* Lines */
24
+ --pretable-rule: #d4d4d4; /* Excel desktop default RGB 211,211,211 */
25
+ --pretable-rule-strong: #a6a6a6;
26
+ --pretable-radius: 0; /* Sharp edges — Excel never rounds */
27
+
28
+ /* State */
29
+ --pretable-bg-hover: transparent; /* No row hover — iconic Excel; consumers opt in */
30
+ --pretable-bg-selected: rgba(16, 124, 65, 0.1); /* Excel green range tint */
31
+ --pretable-text-selected: #1f1f1f; /* Don't invert selection text */
32
+ --pretable-focus-ring: #107c41; /* Excel app brand green active-cell border */
33
+
34
+ /* Accent */
35
+ --pretable-accent: #107c41; /* Excel brand green */
36
+
37
+ /* Density — natural default = compact (Excel "Compact" tier) */
38
+ --pretable-row-height: 20px; /* 15pt at 96 DPI */
39
+ --pretable-header-height: 24px;
40
+ --pretable-cell-padding-x: 6px;
41
+ --pretable-cell-padding-y: 2px;
42
+ --pretable-font-size-cell: 15px; /* Aptos Narrow 11pt */
43
+ --pretable-font-size-header: 13px;
44
+
45
+ /* Typography */
46
+ --pretable-font-sans:
47
+ "Aptos Narrow", "Aptos", "Segoe UI", -apple-system, BlinkMacSystemFont,
48
+ "Helvetica Neue", Arial, sans-serif;
49
+ --pretable-font-mono:
50
+ ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
51
+ }
52
+
53
+ /* :root is already compact; only non-default tiers need explicit selectors. */
54
+
55
+ [data-density="standard"] {
56
+ --pretable-row-height: 24px;
57
+ --pretable-header-height: 32px;
58
+ --pretable-cell-padding-x: 8px;
59
+ --pretable-cell-padding-y: 4px;
60
+ --pretable-font-size-cell: 15px;
61
+ --pretable-font-size-header: 14px;
62
+ }
63
+
64
+ [data-density="spacious"] {
65
+ --pretable-row-height: 32px;
66
+ --pretable-header-height: 40px;
67
+ --pretable-cell-padding-x: 12px;
68
+ --pretable-cell-padding-y: 8px;
69
+ --pretable-font-size-cell: 15px;
70
+ --pretable-font-size-header: 14px;
71
+ }
@@ -0,0 +1,2 @@
1
+ declare const stylesheet: string;
2
+ export default stylesheet;
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Material 3 — baseline scheme (seed #6750A4).
3
+ * Light at :root; dark at [data-theme="dark"]. Default density: standard.
4
+ * Surface tier: light grid uses `surface`; dark grid uses `surface-container-low`
5
+ * (raw `surface` reads as a void in dark mode per M3 guidance).
6
+ */
7
+
8
+ :root {
9
+ /* Surfaces — M3 neutral grayscale (untinted by primary seed) */
10
+ --pretable-bg-grid: #fcfcfc; /* N99 */
11
+ --pretable-bg-grid-alt: #fcfcfc; /* No striping by default — Material list pattern */
12
+ --pretable-bg-header: #f3f3f3; /* N96 — one tonal step up */
13
+ --pretable-bg-toolbar: #f3f3f3;
14
+ --pretable-bg-tooltip: #f3f3f3;
15
+
16
+ /* Text */
17
+ --pretable-text-cell: #1c1c1c; /* on-surface */
18
+ --pretable-text-header: #49494c; /* on-surface-variant */
19
+ --pretable-text-dim: #49494c;
20
+
21
+ /* Lines */
22
+ --pretable-rule: #cccccc; /* outline-variant — decorative dividers */
23
+ --pretable-rule-strong: #797979; /* outline */
24
+ --pretable-radius: 12px; /* M3 medium shape scale (matches Card) */
25
+
26
+ /* State */
27
+ --pretable-bg-hover: rgba(
28
+ 28,
29
+ 28,
30
+ 28,
31
+ 0.08
32
+ ); /* on-surface @ 8% — M3 hover state layer */
33
+ --pretable-bg-selected: #d1e4ff; /* secondary-container — M3 baseline blue */
34
+ --pretable-text-selected: #001d36; /* on-secondary-container */
35
+ --pretable-focus-ring: #0061a4; /* primary */
36
+
37
+ /* Accent */
38
+ --pretable-accent: #0061a4; /* primary — M3 baseline blue */
39
+
40
+ /* Density — natural default = standard */
41
+ --pretable-row-height: 48px;
42
+ --pretable-header-height: 52px;
43
+ --pretable-cell-padding-x: 16px;
44
+ --pretable-cell-padding-y: 12px;
45
+ --pretable-font-size-cell: 14px; /* body-medium */
46
+ --pretable-font-size-header: 14px; /* label-large (px equal; weight differs in grid.css) */
47
+
48
+ /* Typography */
49
+ --pretable-font-sans:
50
+ "Roboto Flex", "Roboto", system-ui, -apple-system, BlinkMacSystemFont,
51
+ "Segoe UI", sans-serif;
52
+ --pretable-font-mono: "Roboto Mono", ui-monospace, monospace;
53
+ }
54
+
55
+ /* :root is already standard; only non-default tiers need explicit selectors. */
56
+
57
+ [data-density="compact"] {
58
+ --pretable-row-height: 40px;
59
+ --pretable-header-height: 44px;
60
+ --pretable-cell-padding-x: 12px;
61
+ --pretable-cell-padding-y: 6px;
62
+ --pretable-font-size-cell: 12px; /* body-small */
63
+ --pretable-font-size-header: 12px;
64
+ }
65
+
66
+ [data-density="spacious"] {
67
+ --pretable-row-height: 56px;
68
+ --pretable-header-height: 64px;
69
+ --pretable-cell-padding-x: 24px;
70
+ --pretable-cell-padding-y: 16px;
71
+ --pretable-font-size-cell: 14px;
72
+ --pretable-font-size-header: 14px;
73
+ }
74
+
75
+ /* Dark mode — M3 baseline dark; color-only overrides; density inherits from light. */
76
+
77
+ [data-theme="dark"] {
78
+ --pretable-bg-grid: #1c1c1c; /* surface-container-low */
79
+ --pretable-bg-grid-alt: #1c1c1c;
80
+ --pretable-bg-header: #212121; /* surface-container */
81
+ --pretable-bg-toolbar: #212121;
82
+ --pretable-bg-tooltip: #212121;
83
+
84
+ --pretable-text-cell: #e6e6e6; /* on-surface (dark) */
85
+ --pretable-text-header: #c9c9c9; /* on-surface-variant (dark) */
86
+ --pretable-text-dim: #c9c9c9;
87
+
88
+ --pretable-rule: #494949; /* outline-variant (dark) */
89
+ --pretable-rule-strong: #939393; /* outline (dark) */
90
+
91
+ --pretable-bg-hover: rgba(230, 230, 230, 0.08); /* on-surface @ 8% — dark */
92
+ --pretable-bg-selected: #00497d; /* secondary-container — M3 baseline blue (dark) */
93
+ --pretable-text-selected: #d1e4ff; /* on-secondary-container */
94
+ --pretable-focus-ring: #9ecaff; /* primary (dark) */
95
+
96
+ --pretable-accent: #9ecaff;
97
+ }
@@ -0,0 +1,2 @@
1
+ declare const stylesheet: string;
2
+ export default stylesheet;
@@ -0,0 +1,94 @@
1
+ /**
2
+ * pretable design tokens — Alpenglow palette
3
+ *
4
+ * Light mode, Bend/skiing-inspired: warm cream paper + dusk peach + cobalt.
5
+ * Consumer imports this file once at the app's entry point. All component
6
+ * styles reference these variables. To retheme, override any variable at a
7
+ * more specific scope (e.g. [data-theme="dark"]).
8
+ *
9
+ * Alpenglow palette (2026-05-01 redesign — Task 1).
10
+ */
11
+ :root {
12
+ /* Page surfaces */
13
+ --pt-bg-page: #fefcf9;
14
+ --pt-bg-card: #fff8f1;
15
+ --pt-bg-raised: #fef3e2;
16
+ --pt-text-primary: #0c0a09;
17
+ --pt-text-secondary: #44403c;
18
+ --pt-text-muted: #78716c;
19
+ --pt-text-dim: #a8a29e;
20
+
21
+ /* Singular accent (warm peach/orange) */
22
+ --pt-accent: #ea580c;
23
+ --pt-accent-deep: #b45309;
24
+ --pt-accent-soft: #fef3e2;
25
+
26
+ /* Cool accent (cobalt) */
27
+ --pt-cool: #1d4ed8;
28
+
29
+ /* Severity */
30
+ --pt-sev-info: #1d4ed8;
31
+ --pt-sev-warn: #b45309;
32
+ --pt-sev-err: #b91c1c;
33
+ --pt-sev-ok: #15803d;
34
+
35
+ /* Grid surfaces */
36
+ --pt-rule: #f5e6d3;
37
+ --pt-rule-soft: #faf3eb;
38
+ --pt-grid-bg: #ffffff;
39
+ --pt-grid-rule: #f5e6d3;
40
+ --pt-grid-text: #1c1917;
41
+ --pt-grid-dim: #a8a29e;
42
+
43
+ /* Drawer (dark sidebar) */
44
+ --pt-drawer-bg: #1e293b;
45
+ --pt-drawer-text: #fbbf24;
46
+
47
+ /* Typography stacks — Fraunces + Inter + JetBrains Mono via fontsource */
48
+ --pt-font-serif: "Fraunces Variable", Georgia, "Times New Roman", serif;
49
+ --pt-font-sans:
50
+ "Inter Variable", ui-sans-serif, -apple-system, BlinkMacSystemFont,
51
+ "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
52
+ --pt-font-mono:
53
+ "JetBrains Mono Variable", ui-monospace, SFMono-Regular, Menlo,
54
+ "Cascadia Code", "Roboto Mono", monospace;
55
+
56
+ /* Type scale */
57
+ --pt-fs-display-xl: 60px;
58
+ --pt-fs-display-lg: 44px;
59
+ --pt-fs-display-md: 32px;
60
+ --pt-fs-dek: 18px;
61
+ --pt-fs-body: 15px;
62
+ --pt-fs-ui: 13.5px;
63
+ --pt-fs-eyebrow: 11px;
64
+ --pt-fs-data: 12.5px;
65
+
66
+ /* Cell-range selection (Phase 3 — derived from accent) */
67
+ --pt-color-selection-bg: rgb(234 88 12 / 0.08);
68
+ --pt-color-selection-border: rgb(234 88 12 / 0.6);
69
+ --pt-color-focus-ring: var(--pt-accent);
70
+
71
+ /* Column resize handle (sub-project C) */
72
+ --pt-color-resize-handle: transparent;
73
+ --pt-color-resize-handle-hover: var(--pt-color-selection-border);
74
+
75
+ /* Column reorder ghost + drop indicator (sub-project C) */
76
+ --pt-color-reorder-ghost-bg: var(--pt-color-surface, #fff);
77
+ --pt-color-reorder-ghost-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
78
+ --pt-color-reorder-drop-indicator: var(--pt-color-focus-ring);
79
+
80
+ /* Row-selection checkbox column (Phase 4) */
81
+ --pt-color-checkbox-bg: #fff;
82
+ --pt-color-checkbox-border: #d1d5db;
83
+ --pt-color-checkbox-checked-bg: var(--pt-accent);
84
+ --pt-color-checkbox-checked-fg: #fff;
85
+
86
+ /* Layout tokens */
87
+ --pt-page-max: 1440px;
88
+ --pt-header-h: 60px;
89
+ --pt-sidebar-w: 260px;
90
+ --pt-toc-w: 224px;
91
+ --pt-prose-max: 720px;
92
+ --pt-code-max: 900px;
93
+ --pt-modal-w: 560px;
94
+ }
@@ -0,0 +1,2 @@
1
+ declare const stylesheet: string;
2
+ export default stylesheet;
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@pretable/ui",
3
+ "version": "0.0.2",
4
+ "description": "CSS themes, tokens, and grid styles for Pretable.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/cacheplane/pretable.git",
9
+ "directory": "packages/ui"
10
+ },
11
+ "homepage": "https://pretable.ai/docs/theming",
12
+ "bugs": {
13
+ "url": "https://github.com/cacheplane/pretable/issues"
14
+ },
15
+ "type": "module",
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "main": "./dist/index.cjs",
20
+ "module": "./dist/index.mjs",
21
+ "types": "./dist/index.d.ts",
22
+ "sideEffects": [
23
+ "**/*.css"
24
+ ],
25
+ "exports": {
26
+ ".": {
27
+ "import": {
28
+ "types": "./dist/index.d.ts",
29
+ "default": "./dist/index.mjs"
30
+ },
31
+ "require": {
32
+ "types": "./dist/index.d.cts",
33
+ "default": "./dist/index.cjs"
34
+ }
35
+ },
36
+ "./themes/excel.css": {
37
+ "types": "./dist/themes/excel.css.d.ts",
38
+ "default": "./dist/themes/excel.css"
39
+ },
40
+ "./themes/material.css": {
41
+ "types": "./dist/themes/material.css.d.ts",
42
+ "default": "./dist/themes/material.css"
43
+ },
44
+ "./grid.css": {
45
+ "types": "./dist/grid.css.d.ts",
46
+ "default": "./dist/grid.css"
47
+ },
48
+ "./tailwind.css": {
49
+ "types": "./dist/tailwind.css.d.ts",
50
+ "default": "./dist/tailwind.css"
51
+ },
52
+ "./tokens.css": {
53
+ "types": "./dist/tokens.css.d.ts",
54
+ "default": "./dist/tokens.css"
55
+ },
56
+ "./package.json": "./package.json"
57
+ },
58
+ "scripts": {
59
+ "api": "api-extractor run --local --config api-extractor.json",
60
+ "api:check": "api-extractor run --config api-extractor.json",
61
+ "build": "tsup && node ./scripts/copy-css-assets.mjs",
62
+ "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",
64
+ "test": "vitest run",
65
+ "typecheck": "tsc -p tsconfig.typecheck.json --noEmit"
66
+ }
67
+ }