@tristan2828/ui-foundation 4.77.0 → 4.79.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/conventions/docs/add-an-entity.md +34 -14
- package/conventions/docs/cell-patterns.md +21 -15
- package/conventions/docs/design-language.md +26 -16
- package/conventions/docs/entity-plan-template.md +2 -0
- package/dist/components/app/edit-in-place-presets.d.ts +22 -0
- package/dist/components/app/edit-in-place-presets.js +35 -0
- package/dist/components/app/markdown.js +7 -2
- package/dist/components/app/milkdown-editor.js +65 -5
- package/dist/components/app/month-day-field.d.ts +31 -0
- package/dist/components/app/month-day-field.js +134 -0
- package/dist/components/app/rich-text-table-grips.d.ts +5 -1
- package/dist/components/app/rich-text-table-grips.js +120 -6
- package/dist/components/app/rich-text-table.d.ts +23 -1
- package/dist/components/app/rich-text-table.js +98 -8
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/lib/markdown-highlight.js +2 -1
- package/dist/lib/markdown-merge.js +18 -6
- package/dist/lib/markdown-table-widths.d.ts +51 -0
- package/dist/lib/markdown-table-widths.js +179 -0
- package/dist/lib/month-day.d.ts +27 -0
- package/dist/lib/month-day.js +62 -0
- package/package.json +1 -1
- package/styles/index.css +27 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare const MIN_COLUMN_WIDTH = 56;
|
|
2
|
+
export declare const MAX_COLUMN_WIDTH = 1200;
|
|
3
|
+
/** The sizes a dragged edge catches on, within `COLUMN_CATCH` pixels. */
|
|
4
|
+
export declare const COLUMN_SIZES: readonly [{
|
|
5
|
+
readonly label: "S";
|
|
6
|
+
readonly width: 96;
|
|
7
|
+
}, {
|
|
8
|
+
readonly label: "M";
|
|
9
|
+
readonly width: 160;
|
|
10
|
+
}, {
|
|
11
|
+
readonly label: "L";
|
|
12
|
+
readonly width: 256;
|
|
13
|
+
}, {
|
|
14
|
+
readonly label: "XL";
|
|
15
|
+
readonly width: 384;
|
|
16
|
+
}];
|
|
17
|
+
export declare const COLUMN_CATCH = 10;
|
|
18
|
+
/** A width within the limits, whole pixels. */
|
|
19
|
+
export declare function clampColumnWidth(width: number): number;
|
|
20
|
+
/** A dragged width: within the limits, and on a size when it's that close to one. */
|
|
21
|
+
export declare function catchColumnWidth(width: number): {
|
|
22
|
+
width: number;
|
|
23
|
+
size: string | null;
|
|
24
|
+
};
|
|
25
|
+
type Entry = {
|
|
26
|
+
name: string;
|
|
27
|
+
width: number;
|
|
28
|
+
} | {
|
|
29
|
+
position: number;
|
|
30
|
+
width: number;
|
|
31
|
+
};
|
|
32
|
+
/** The entries of a widths comment, or null when it isn't one. */
|
|
33
|
+
export declare function parseTableWidths(comment: string): Entry[] | null;
|
|
34
|
+
/** Each column's width, in order: null is automatic. */
|
|
35
|
+
export declare function resolveTableWidths(entries: readonly Entry[], headers: readonly string[]): (number | null)[];
|
|
36
|
+
/** The comment for these columns' widths, or null when they're all automatic. */
|
|
37
|
+
export declare function formatTableWidths(headers: readonly string[], widths: readonly (number | null | undefined)[]): string | null;
|
|
38
|
+
type MdNode = {
|
|
39
|
+
type: string;
|
|
40
|
+
value?: string;
|
|
41
|
+
children?: MdNode[];
|
|
42
|
+
data?: Record<string, unknown>;
|
|
43
|
+
[key: string]: unknown;
|
|
44
|
+
};
|
|
45
|
+
/** A table node's header texts, as a reader sees them. */
|
|
46
|
+
export declare function tableHeaders(table: MdNode): string[];
|
|
47
|
+
/** The widths the block after a table gives it, or null when it gives none. */
|
|
48
|
+
export declare function widthsAfterTable(table: MdNode, next: MdNode | undefined): (number | null)[] | null;
|
|
49
|
+
/** Takes each widths comment off the tree and puts its widths on its table's cells. */
|
|
50
|
+
export declare function remarkTableWidths(): (tree: unknown) => void;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// A table's column widths, kept in the Markdown as one comment after the
|
|
2
|
+
// table, naming its columns (the developer's choice, 2026-11-09):
|
|
3
|
+
//
|
|
4
|
+
// | Item | Room | Cost |
|
|
5
|
+
// | ---- | ---- | ---: |
|
|
6
|
+
// | Paint | Hall | $42 |
|
|
7
|
+
//
|
|
8
|
+
// <!-- table widths: Item=140, Cost=72 -->
|
|
9
|
+
//
|
|
10
|
+
// GFM has nowhere to put a width, and the table has to stay a table to
|
|
11
|
+
// everything else that reads it. A comment hides itself on GitHub and in
|
|
12
|
+
// other renderers, and a chat or the connector can read or change it.
|
|
13
|
+
// By name, so a column moved outside the editor keeps its width: a
|
|
14
|
+
// column named nowhere is automatic (fit to its words), a name no column
|
|
15
|
+
// has is ignored. A blank or repeated header can't be named, and is its
|
|
16
|
+
// place instead (`#3=72`). A header that isn't plain words is quoted, as
|
|
17
|
+
// JSON (`"Cost, each"=72`).
|
|
18
|
+
//
|
|
19
|
+
// It's the one piece of HTML the rich-text editor writes, and neither
|
|
20
|
+
// renderer shows it: `remarkTableWidths` takes it off the tree and puts
|
|
21
|
+
// each width on its column's cells. A comment that isn't this one, or
|
|
22
|
+
// isn't straight after a table, is any other raw HTML: shown as its
|
|
23
|
+
// characters, never lost.
|
|
24
|
+
//
|
|
25
|
+
// Widths are pixels. In the editor they sit on the cells (ProseMirror's
|
|
26
|
+
// `colwidth`), so a column moved, added or deleted there, and a row added
|
|
27
|
+
// or sorted there, keeps them right; the comment is written from the
|
|
28
|
+
// cells on each save. Styled in styles/index.css ("Tables in written
|
|
29
|
+
// text"): a phone keeps fitting columns to their words.
|
|
30
|
+
export const MIN_COLUMN_WIDTH = 56;
|
|
31
|
+
export const MAX_COLUMN_WIDTH = 1200;
|
|
32
|
+
/** The sizes a dragged edge catches on, within `COLUMN_CATCH` pixels. */
|
|
33
|
+
export const COLUMN_SIZES = [
|
|
34
|
+
{ label: 'S', width: 96 },
|
|
35
|
+
{ label: 'M', width: 160 },
|
|
36
|
+
{ label: 'L', width: 256 },
|
|
37
|
+
{ label: 'XL', width: 384 },
|
|
38
|
+
];
|
|
39
|
+
export const COLUMN_CATCH = 10;
|
|
40
|
+
/** A width within the limits, whole pixels. */
|
|
41
|
+
export function clampColumnWidth(width) {
|
|
42
|
+
return Math.min(MAX_COLUMN_WIDTH, Math.max(MIN_COLUMN_WIDTH, Math.round(width)));
|
|
43
|
+
}
|
|
44
|
+
/** A dragged width: within the limits, and on a size when it's that close to one. */
|
|
45
|
+
export function catchColumnWidth(width) {
|
|
46
|
+
const clamped = clampColumnWidth(width);
|
|
47
|
+
const size = COLUMN_SIZES.find((one) => Math.abs(one.width - clamped) <= COLUMN_CATCH);
|
|
48
|
+
return size ? { width: size.width, size: size.label } : { width: clamped, size: null };
|
|
49
|
+
}
|
|
50
|
+
const COMMENT = /^<!--\s*table widths:\s*(.*?)\s*-->\s*$/s;
|
|
51
|
+
// One `key=width`: a quoted name, a place (`#3`), or bare words.
|
|
52
|
+
const ENTRY = /\s*(?:("(?:[^"\\]|\\.)*")|#(\d+)|([^,="]+?))\s*=\s*(\d+)\s*(,|$)/y;
|
|
53
|
+
/** The entries of a widths comment, or null when it isn't one. */
|
|
54
|
+
export function parseTableWidths(comment) {
|
|
55
|
+
const body = COMMENT.exec(comment.trim())?.[1];
|
|
56
|
+
if (!body)
|
|
57
|
+
return null;
|
|
58
|
+
const entries = [];
|
|
59
|
+
ENTRY.lastIndex = 0;
|
|
60
|
+
for (;;) {
|
|
61
|
+
const at = ENTRY.lastIndex;
|
|
62
|
+
const found = ENTRY.exec(body);
|
|
63
|
+
if (!found)
|
|
64
|
+
return null;
|
|
65
|
+
const [, quoted, position, bare, width, separator] = found;
|
|
66
|
+
let name = bare;
|
|
67
|
+
if (quoted !== undefined) {
|
|
68
|
+
try {
|
|
69
|
+
name = JSON.parse(quoted);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (position !== undefined)
|
|
76
|
+
entries.push({ position: Number(position), width: Number(width) });
|
|
77
|
+
else
|
|
78
|
+
entries.push({ name: cleanHeader(name), width: Number(width) });
|
|
79
|
+
if (!separator)
|
|
80
|
+
break;
|
|
81
|
+
// A `,` with nothing after it isn't one of ours.
|
|
82
|
+
if (ENTRY.lastIndex === at || ENTRY.lastIndex >= body.length)
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
return entries;
|
|
86
|
+
}
|
|
87
|
+
const cleanHeader = (text) => text.replace(/\s+/g, ' ').trim();
|
|
88
|
+
/** Each column's width, in order: null is automatic. */
|
|
89
|
+
export function resolveTableWidths(entries, headers) {
|
|
90
|
+
const names = headers.map(cleanHeader);
|
|
91
|
+
const widths = headers.map(() => null);
|
|
92
|
+
const used = new Set();
|
|
93
|
+
for (const entry of entries) {
|
|
94
|
+
const index = 'position' in entry
|
|
95
|
+
? entry.position - 1
|
|
96
|
+
: names.findIndex((name, column) => name === entry.name && name !== '' && !used.has(column));
|
|
97
|
+
if (index < 0 || index >= headers.length)
|
|
98
|
+
continue;
|
|
99
|
+
used.add(index);
|
|
100
|
+
widths[index] = clampColumnWidth(entry.width);
|
|
101
|
+
}
|
|
102
|
+
return widths;
|
|
103
|
+
}
|
|
104
|
+
// A name that can sit bare in the comment. `--` could end the comment, and
|
|
105
|
+
// `#3` would read as a place.
|
|
106
|
+
const isBare = (name) => /^[^,="\\<>\r\n]+$/.test(name) && !name.includes('--') && !/^#\d+$/.test(name);
|
|
107
|
+
// Quoted as JSON, with what could end the comment as an escape.
|
|
108
|
+
const quoted = (name) => JSON.stringify(name).replace(/-/g, '\\u002d').replace(/>/g, '\\u003e');
|
|
109
|
+
/** The comment for these columns' widths, or null when they're all automatic. */
|
|
110
|
+
export function formatTableWidths(headers, widths) {
|
|
111
|
+
const names = headers.map(cleanHeader);
|
|
112
|
+
const entries = [];
|
|
113
|
+
names.forEach((name, column) => {
|
|
114
|
+
const width = widths[column];
|
|
115
|
+
if (width === null || width === undefined)
|
|
116
|
+
return;
|
|
117
|
+
const nameable = name !== '' && names.indexOf(name) === names.lastIndexOf(name);
|
|
118
|
+
entries.push(`${nameable ? (isBare(name) ? name : quoted(name)) : `#${column + 1}`}=${width}`);
|
|
119
|
+
});
|
|
120
|
+
return entries.length ? `<!-- table widths: ${entries.join(', ')} -->` : null;
|
|
121
|
+
}
|
|
122
|
+
// `==words==` and `=={green}words==`: text to a tree the highlights
|
|
123
|
+
// haven't been read from (the merge's), so a header's name is the same
|
|
124
|
+
// in every tree.
|
|
125
|
+
const HIGHLIGHT = /==(?:\{(?:amber|yellow|green|red)\})?(\S(?:.*?\S)?)==/g;
|
|
126
|
+
function textOf(node) {
|
|
127
|
+
if (typeof node.value === 'string')
|
|
128
|
+
return node.value;
|
|
129
|
+
return (node.children ?? []).map(textOf).join('');
|
|
130
|
+
}
|
|
131
|
+
/** A table node's header texts, as a reader sees them. */
|
|
132
|
+
export function tableHeaders(table) {
|
|
133
|
+
return (table.children?.[0]?.children ?? []).map((cell) => cleanHeader(textOf(cell).replace(HIGHLIGHT, '$1')));
|
|
134
|
+
}
|
|
135
|
+
/** The widths the block after a table gives it, or null when it gives none. */
|
|
136
|
+
export function widthsAfterTable(table, next) {
|
|
137
|
+
// The rich-text editor's commonmark preset wraps a block of HTML in a
|
|
138
|
+
// paragraph before this reads it.
|
|
139
|
+
const block = next?.type === 'paragraph' && next.children?.length === 1 ? next.children[0] : next;
|
|
140
|
+
if (block?.type !== 'html' || typeof block.value !== 'string')
|
|
141
|
+
return null;
|
|
142
|
+
const entries = parseTableWidths(block.value);
|
|
143
|
+
return entries && resolveTableWidths(entries, tableHeaders(table));
|
|
144
|
+
}
|
|
145
|
+
function putOnCells(table, widths) {
|
|
146
|
+
for (const row of table.children ?? []) {
|
|
147
|
+
;
|
|
148
|
+
(row.children ?? []).forEach((cell, column) => {
|
|
149
|
+
const width = widths[column];
|
|
150
|
+
if (width === null || width === undefined)
|
|
151
|
+
return;
|
|
152
|
+
// The editor's parser reads `columnWidth`; the read view's HTML
|
|
153
|
+
// takes `hProperties`.
|
|
154
|
+
cell.columnWidth = width;
|
|
155
|
+
cell.data = { ...cell.data, hProperties: { dataColumnWidth: String(width), style: `--column-width: ${width}px` } };
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function walk(parent) {
|
|
160
|
+
const children = parent.children;
|
|
161
|
+
if (!children)
|
|
162
|
+
return;
|
|
163
|
+
for (let index = 0; index < children.length; index++) {
|
|
164
|
+
const node = children[index];
|
|
165
|
+
if (node.type !== 'table') {
|
|
166
|
+
walk(node);
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
const widths = widthsAfterTable(node, children[index + 1]);
|
|
170
|
+
if (!widths)
|
|
171
|
+
continue;
|
|
172
|
+
putOnCells(node, widths);
|
|
173
|
+
children.splice(index + 1, 1);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/** Takes each widths comment off the tree and puts its widths on its table's cells. */
|
|
177
|
+
export function remarkTableWidths() {
|
|
178
|
+
return (tree) => walk(tree);
|
|
179
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** A day of the year with no year, `'MM-DD'`, or `''` for not set. */
|
|
2
|
+
export type MonthDay = string;
|
|
3
|
+
/** How many days the month (1–12) can have: February's 29 counted. */
|
|
4
|
+
export declare function daysInMonth(month: number): number;
|
|
5
|
+
/** The month (1–12) and day of a real `'MM-DD'`, or null for anything else (`''`, `'02-30'`, `'3-14'`). */
|
|
6
|
+
export declare function monthDayParts(value: MonthDay): {
|
|
7
|
+
month: number;
|
|
8
|
+
day: number;
|
|
9
|
+
} | null;
|
|
10
|
+
/** Whether the value is a real day of the year as `'MM-DD'`: `'02-29'` is, `'02-30'` isn't. */
|
|
11
|
+
export declare function isMonthDay(value: MonthDay): boolean;
|
|
12
|
+
/** The month (1–12) and day as `'MM-DD'`. */
|
|
13
|
+
export declare function toMonthDay(month: number, day: number): MonthDay;
|
|
14
|
+
/**
|
|
15
|
+
* Shows a month and day ("Mar 14", or "14 March" in `en-GB` with
|
|
16
|
+
* `{ month: 'long', day: 'numeric' }`) in the locale's order, never a
|
|
17
|
+
* year or a weekday. `''` and anything that isn't a real `'MM-DD'` give `''`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function formatMonthDay(value: MonthDay, options?: Pick<Intl.DateTimeFormatOptions, 'month' | 'day'>, locale?: string): string;
|
|
20
|
+
/** A month's name ("March", or "Mar" with `'short'`), for a month 1–12. */
|
|
21
|
+
export declare function monthName(month: number, style?: 'long' | 'short', locale?: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Why a value isn't a day of the year, or null when it is (or is `''`):
|
|
24
|
+
* "February has 29 days" for `'02-30'`, "Pick a month and day" for
|
|
25
|
+
* anything not `'MM-DD'`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function monthDayProblem(value: MonthDay, locale?: string): string | null;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// A month and day with no year: something that comes round every year (a
|
|
2
|
+
// season's start, a yearly deadline). The value is `'MM-DD'` (`'03-14'`),
|
|
3
|
+
// or `''` for not set, so it sorts as text in calendar order. February 29
|
|
4
|
+
// is a day like any other (it comes round in leap years); February 30,
|
|
5
|
+
// April 31 and `13-01` are not days. MonthDayField edits one.
|
|
6
|
+
const MONTH_DAY = /^(\d{2})-(\d{2})$/;
|
|
7
|
+
// Days in each month of a leap year: February has its 29th.
|
|
8
|
+
const DAYS_IN_MONTH = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
9
|
+
/** How many days the month (1–12) can have: February's 29 counted. */
|
|
10
|
+
export function daysInMonth(month) {
|
|
11
|
+
return DAYS_IN_MONTH[month - 1] ?? 0;
|
|
12
|
+
}
|
|
13
|
+
/** The month (1–12) and day of a real `'MM-DD'`, or null for anything else (`''`, `'02-30'`, `'3-14'`). */
|
|
14
|
+
export function monthDayParts(value) {
|
|
15
|
+
const match = MONTH_DAY.exec(value);
|
|
16
|
+
if (!match)
|
|
17
|
+
return null;
|
|
18
|
+
const [month, day] = [Number(match[1]), Number(match[2])];
|
|
19
|
+
if (month < 1 || month > 12 || day < 1 || day > daysInMonth(month))
|
|
20
|
+
return null;
|
|
21
|
+
return { month, day };
|
|
22
|
+
}
|
|
23
|
+
/** Whether the value is a real day of the year as `'MM-DD'`: `'02-29'` is, `'02-30'` isn't. */
|
|
24
|
+
export function isMonthDay(value) {
|
|
25
|
+
return monthDayParts(value) !== null;
|
|
26
|
+
}
|
|
27
|
+
/** The month (1–12) and day as `'MM-DD'`. */
|
|
28
|
+
export function toMonthDay(month, day) {
|
|
29
|
+
return `${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
|
|
30
|
+
}
|
|
31
|
+
// A leap year, so February 29 formats; the year is never shown.
|
|
32
|
+
const LEAP_YEAR = 2000;
|
|
33
|
+
/**
|
|
34
|
+
* Shows a month and day ("Mar 14", or "14 March" in `en-GB` with
|
|
35
|
+
* `{ month: 'long', day: 'numeric' }`) in the locale's order, never a
|
|
36
|
+
* year or a weekday. `''` and anything that isn't a real `'MM-DD'` give `''`.
|
|
37
|
+
*/
|
|
38
|
+
export function formatMonthDay(value, options = { month: 'short', day: 'numeric' }, locale) {
|
|
39
|
+
const parts = monthDayParts(value);
|
|
40
|
+
if (!parts)
|
|
41
|
+
return '';
|
|
42
|
+
const { month = 'short', day = 'numeric' } = options;
|
|
43
|
+
return new Intl.DateTimeFormat(locale, { month, day, timeZone: 'UTC' }).format(Date.UTC(LEAP_YEAR, parts.month - 1, parts.day));
|
|
44
|
+
}
|
|
45
|
+
/** A month's name ("March", or "Mar" with `'short'`), for a month 1–12. */
|
|
46
|
+
export function monthName(month, style = 'long', locale) {
|
|
47
|
+
return new Intl.DateTimeFormat(locale, { month: style, timeZone: 'UTC' }).format(Date.UTC(LEAP_YEAR, month - 1, 1));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Why a value isn't a day of the year, or null when it is (or is `''`):
|
|
51
|
+
* "February has 29 days" for `'02-30'`, "Pick a month and day" for
|
|
52
|
+
* anything not `'MM-DD'`.
|
|
53
|
+
*/
|
|
54
|
+
export function monthDayProblem(value, locale) {
|
|
55
|
+
if (value === '' || isMonthDay(value))
|
|
56
|
+
return null;
|
|
57
|
+
const match = MONTH_DAY.exec(value);
|
|
58
|
+
const [month, day] = match ? [Number(match[1]), Number(match[2])] : [0, 0];
|
|
59
|
+
if (month >= 1 && month <= 12 && day > daysInMonth(month))
|
|
60
|
+
return `${monthName(month, 'long', locale)} has ${daysInMonth(month)} days`;
|
|
61
|
+
return 'Pick a month and day';
|
|
62
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tristan2828/ui-foundation",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.79.0",
|
|
4
4
|
"description": "Shared UI foundation for contract-first, database-backed React apps: shadcn primitives, DataTable/EntityForm composites, auth, the gateway error seam, design tokens, lint rules and the AI playbook.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
package/styles/index.css
CHANGED
|
@@ -360,6 +360,10 @@
|
|
|
360
360
|
- boxed: a rounded box, roomier cells, the header row on the muted
|
|
361
361
|
fill.
|
|
362
362
|
Both stripe their body rows (zebra, as DataTable's).
|
|
363
|
+
A column with a set width (src/lib/markdown-table-widths.ts) is exactly
|
|
364
|
+
that wide, its words wrapping inside it, from a phone's width up; on a
|
|
365
|
+
phone columns still fit their words. On paper the widths are only
|
|
366
|
+
preferences, so the table shrinks to the page rather than run off it.
|
|
363
367
|
Row headers (a header column: src/lib/markdown-table.ts) sit on the
|
|
364
368
|
muted fill, semibold. A coloured cell (its whole text one highlight)
|
|
365
369
|
is painted in that wash, its words' own wash dropped. Unlayered, so a
|
|
@@ -397,6 +401,16 @@
|
|
|
397
401
|
white-space: nowrap;
|
|
398
402
|
font-variant-numeric: tabular-nums;
|
|
399
403
|
}
|
|
404
|
+
@media (min-width: 768px) {
|
|
405
|
+
.prose-table :is(td, th)[data-column-width] {
|
|
406
|
+
box-sizing: border-box;
|
|
407
|
+
width: var(--column-width);
|
|
408
|
+
min-width: var(--column-width);
|
|
409
|
+
max-width: var(--column-width);
|
|
410
|
+
white-space: normal;
|
|
411
|
+
overflow-wrap: anywhere;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
400
414
|
.prose-table th:not([scope="row"], [data-row-header]) {
|
|
401
415
|
background: var(--heading-band);
|
|
402
416
|
font-weight: 600;
|
|
@@ -507,6 +521,19 @@
|
|
|
507
521
|
[data-print-notes] table {
|
|
508
522
|
border-collapse: collapse;
|
|
509
523
|
}
|
|
524
|
+
/* Paper can't scroll: the widths are what the columns would like, and
|
|
525
|
+
the table takes the page's width when they add up to more. */
|
|
526
|
+
[data-print-notes] [data-slot="table-container"] > table {
|
|
527
|
+
max-width: 100%;
|
|
528
|
+
}
|
|
529
|
+
[data-print-notes] [data-slot="table-container"] :is(td, th)[data-column-width] {
|
|
530
|
+
box-sizing: border-box;
|
|
531
|
+
width: var(--column-width);
|
|
532
|
+
min-width: 0;
|
|
533
|
+
max-width: none;
|
|
534
|
+
white-space: normal;
|
|
535
|
+
overflow-wrap: anywhere;
|
|
536
|
+
}
|
|
510
537
|
[data-print-notes] tr {
|
|
511
538
|
break-inside: avoid;
|
|
512
539
|
}
|