@tristan2828/ui-foundation 4.157.0 → 5.0.1
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/design-language.md +69 -62
- package/dist/components/app/app-shell.js +2 -2
- package/dist/components/app/look-settings.js +2 -2
- package/dist/components/app/markdown.d.ts +4 -2
- package/dist/components/app/markdown.js +37 -10
- package/dist/components/app/rich-text-editor.d.ts +2 -1
- package/dist/components/app/rich-text-fold.js +20 -2
- package/dist/lib/markdown-fold.d.ts +6 -1
- package/dist/lib/markdown-fold.js +9 -2
- package/dist/lib/palettes.d.ts +9 -2
- package/dist/lib/palettes.js +14 -8
- package/package.json +1 -1
- package/styles/index.css +18 -0
- package/styles/theme.css +124 -239
- package/vite/index.d.ts +1 -1
- package/vite/pwa.js +8 -2
|
@@ -3,51 +3,51 @@
|
|
|
3
3
|
<!-- index: written by `npm run docs:index` in the package from the headings below; never edit it by hand -->
|
|
4
4
|
## Index
|
|
5
5
|
|
|
6
|
-
- [Palettes](#palettes) · lines 60–
|
|
7
|
-
- [Glow](#glow) · lines
|
|
8
|
-
- [Semantic tones](#semantic-tones) · lines
|
|
9
|
-
- [The three badge styles](#the-three-badge-styles) · lines
|
|
10
|
-
- [Status marks](#status-marks) · lines
|
|
11
|
-
- [Mapping an enum to tones](#mapping-an-enum-to-tones) · lines
|
|
12
|
-
- [Glyphs and icons: 3:1](#glyphs-and-icons-31) · lines
|
|
13
|
-
- [Logos and brand marks](#logos-and-brand-marks) · lines
|
|
14
|
-
- [Emoji](#emoji) · lines
|
|
15
|
-
- [Categorical colour](#categorical-colour) · lines
|
|
16
|
-
- [Heat scale](#heat-scale) · lines
|
|
17
|
-
- [Depth ramps](#depth-ramps) · lines
|
|
18
|
-
- [A stored colour](#a-stored-colour) · lines
|
|
19
|
-
- [Shapes and sizes](#shapes-and-sizes) · lines
|
|
20
|
-
- [Typography](#typography) · lines
|
|
21
|
-
- [Words on screen: Title Case and sentence case](#words-on-screen-title-case-and-sentence-case) · lines
|
|
22
|
-
- [Written text (notes)](#written-text-notes) · lines
|
|
23
|
-
- [Density](#density) · lines
|
|
24
|
-
- [Rows on this device](#rows-on-this-device) · lines
|
|
25
|
-
- [Page width (a record on a wide screen)](#page-width-a-record-on-a-wide-screen) · lines
|
|
26
|
-
- [Widget cards (hub pages)](#widget-cards-hub-pages) · lines
|
|
27
|
-
- [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines
|
|
28
|
-
- [Notices](#notices) · lines
|
|
29
|
-
- [A value over time](#a-value-over-time) · lines
|
|
30
|
-
- [Several values over time](#several-values-over-time) · lines
|
|
31
|
-
- [Parts of a whole over time](#parts-of-a-whole-over-time) · lines
|
|
32
|
-
- [A list as a board](#a-list-as-a-board) · lines
|
|
33
|
-
- [Order, groups and the header](#order-groups-and-the-header) · lines
|
|
34
|
-
- [A list as cards](#a-list-as-cards) · lines
|
|
35
|
-
- [Images full screen](#images-full-screen) · lines
|
|
36
|
-
- [Key numbers on a record](#key-numbers-on-a-record) · lines
|
|
37
|
-
- [Parts of the page standards](#parts-of-the-page-standards) · lines
|
|
38
|
-
- [A few equal things](#a-few-equal-things) · lines
|
|
39
|
-
- [An overview page](#an-overview-page) · lines
|
|
40
|
-
- [A record's header and empty values](#a-records-header-and-empty-values) · lines
|
|
41
|
-
- [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines
|
|
42
|
-
- [Picking at random](#picking-at-random) · lines
|
|
43
|
-
- [Filling in what's missing](#filling-in-whats-missing) · lines
|
|
44
|
-
- [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines
|
|
45
|
-
- [A quick add line](#a-quick-add-line) · lines
|
|
46
|
-
- [A date field's quick picks](#a-date-fields-quick-picks) · lines
|
|
47
|
-
- [A few choices, then the month](#a-few-choices-then-the-month) · lines
|
|
48
|
-
- [A month calendar](#a-month-calendar) · lines
|
|
49
|
-
- [A settings page](#a-settings-page) · lines
|
|
50
|
-
- [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines
|
|
6
|
+
- [Palettes](#palettes) · lines 60–150
|
|
7
|
+
- [Glow](#glow) · lines 152–171
|
|
8
|
+
- [Semantic tones](#semantic-tones) · lines 173–201
|
|
9
|
+
- [The three badge styles](#the-three-badge-styles) · lines 203–220
|
|
10
|
+
- [Status marks](#status-marks) · lines 222–265
|
|
11
|
+
- [Mapping an enum to tones](#mapping-an-enum-to-tones) · lines 267–296
|
|
12
|
+
- [Glyphs and icons: 3:1](#glyphs-and-icons-31) · lines 298–309
|
|
13
|
+
- [Logos and brand marks](#logos-and-brand-marks) · lines 311–351
|
|
14
|
+
- [Emoji](#emoji) · lines 353–393
|
|
15
|
+
- [Categorical colour](#categorical-colour) · lines 395–460
|
|
16
|
+
- [Heat scale](#heat-scale) · lines 462–514
|
|
17
|
+
- [Depth ramps](#depth-ramps) · lines 516–583
|
|
18
|
+
- [A stored colour](#a-stored-colour) · lines 585–632
|
|
19
|
+
- [Shapes and sizes](#shapes-and-sizes) · lines 634–655
|
|
20
|
+
- [Typography](#typography) · lines 657–827
|
|
21
|
+
- [Words on screen: Title Case and sentence case](#words-on-screen-title-case-and-sentence-case) · lines 691–723
|
|
22
|
+
- [Written text (notes)](#written-text-notes) · lines 725–827
|
|
23
|
+
- [Density](#density) · lines 829–958
|
|
24
|
+
- [Rows on this device](#rows-on-this-device) · lines 902–930
|
|
25
|
+
- [Page width (a record on a wide screen)](#page-width-a-record-on-a-wide-screen) · lines 932–958
|
|
26
|
+
- [Widget cards (hub pages)](#widget-cards-hub-pages) · lines 960–1077
|
|
27
|
+
- [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines 1079–1151
|
|
28
|
+
- [Notices](#notices) · lines 1153–1180
|
|
29
|
+
- [A value over time](#a-value-over-time) · lines 1182–1312
|
|
30
|
+
- [Several values over time](#several-values-over-time) · lines 1231–1269
|
|
31
|
+
- [Parts of a whole over time](#parts-of-a-whole-over-time) · lines 1271–1312
|
|
32
|
+
- [A list as a board](#a-list-as-a-board) · lines 1314–1424
|
|
33
|
+
- [Order, groups and the header](#order-groups-and-the-header) · lines 1367–1424
|
|
34
|
+
- [A list as cards](#a-list-as-cards) · lines 1426–1473
|
|
35
|
+
- [Images full screen](#images-full-screen) · lines 1475–1521
|
|
36
|
+
- [Key numbers on a record](#key-numbers-on-a-record) · lines 1523–1559
|
|
37
|
+
- [Parts of the page standards](#parts-of-the-page-standards) · lines 1561–1597
|
|
38
|
+
- [A few equal things](#a-few-equal-things) · lines 1599–1714
|
|
39
|
+
- [An overview page](#an-overview-page) · lines 1716–1781
|
|
40
|
+
- [A record's header and empty values](#a-records-header-and-empty-values) · lines 1783–1846
|
|
41
|
+
- [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1848–1935
|
|
42
|
+
- [Picking at random](#picking-at-random) · lines 1937–1968
|
|
43
|
+
- [Filling in what's missing](#filling-in-whats-missing) · lines 1970–2037
|
|
44
|
+
- [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 2039–2058
|
|
45
|
+
- [A quick add line](#a-quick-add-line) · lines 2060–2088
|
|
46
|
+
- [A date field's quick picks](#a-date-fields-quick-picks) · lines 2090–2114
|
|
47
|
+
- [A few choices, then the month](#a-few-choices-then-the-month) · lines 2116–2142
|
|
48
|
+
- [A month calendar](#a-month-calendar) · lines 2144–2176
|
|
49
|
+
- [A settings page](#a-settings-page) · lines 2178–2235
|
|
50
|
+
- [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 2237–2296
|
|
51
51
|
|
|
52
52
|
<!-- /index -->
|
|
53
53
|
|
|
@@ -60,14 +60,20 @@ composites don't grow that way; they are built against a real app's screen.
|
|
|
60
60
|
## Palettes
|
|
61
61
|
|
|
62
62
|
A palette is an app's own look: its surfaces, text, accent and a
|
|
63
|
-
second colour. Four dark ones serve every app:
|
|
63
|
+
second colour. Four dark ones serve every app. They are all graphite:
|
|
64
|
+
the same neutral grey surfaces, text and borders, each with its own main
|
|
65
|
+
colour (the accent, its light and deep shades, the text on it, and a
|
|
66
|
+
second colour):
|
|
64
67
|
|
|
65
68
|
| Name | `palette` | Accent | Second colour |
|
|
66
69
|
|---|---|---|---|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
| Graphite and
|
|
70
|
-
|
|
|
70
|
+
| Graphite and Periwinkle | `graphite-periwinkle` | periwinkle | lilac |
|
|
71
|
+
| Graphite and Amber | `graphite-amber` | amber | orange |
|
|
72
|
+
| Graphite and Sky | `graphite-sky` | sky blue | periwinkle blue |
|
|
73
|
+
| Graphite and Green | `graphite-green` | green | olive |
|
|
74
|
+
|
|
75
|
+
Amber, Sky and Green have Periwinkle's lightness and strength, at their
|
|
76
|
+
own hue, so each reads as loud as the others.
|
|
71
77
|
|
|
72
78
|
And one light one, which an app opts into by name (`LIGHT_PALETTES`):
|
|
73
79
|
|
|
@@ -75,7 +81,7 @@ And one light one, which an app opts into by name (`LIGHT_PALETTES`):
|
|
|
75
81
|
|---|---|---|---|
|
|
76
82
|
| Palm LCD | `palm-lcd` | a Palm OS LCD's green, flat (cards are the same green) | dark ink; ink is also the primary fill and the field border |
|
|
77
83
|
|
|
78
|
-
**How an app picks one.** `<FoundationProviders palette="
|
|
84
|
+
**How an app picks one.** `<FoundationProviders palette="graphite-periwinkle">`
|
|
79
85
|
names the app's default. Add `palettePicker` and the app shell's header
|
|
80
86
|
offers the four dark ones (with swatches), or a page does, as tiles
|
|
81
87
|
(`PaletteSetting`, "A settings page"); the one picked is remembered
|
|
@@ -113,28 +119,29 @@ uses no raw colours:
|
|
|
113
119
|
in light ([Depth ramps](#depth-ramps)). Every heat and depth fill
|
|
114
120
|
takes white text.
|
|
115
121
|
|
|
116
|
-
**Where it lives.** `styles/theme.css`:
|
|
117
|
-
|
|
118
|
-
palette
|
|
119
|
-
`.dark[data-palette
|
|
120
|
-
|
|
122
|
+
**Where it lives.** `styles/theme.css`: the shared greys as primitives
|
|
123
|
+
(`--palette-graphite-*`), each palette's main colour as five more
|
|
124
|
+
(`--palette-<name>-*`), with ratios beside them. One block,
|
|
125
|
+
`.dark[data-palette^="graphite-"]`, maps them onto the tokens; each
|
|
126
|
+
palette's own block, `.dark[data-palette="<name>"]`, only names its main
|
|
127
|
+
colour. `[data-palette="palm-lcd"]`, on top of `:root`, is Palm LCD's. `data-palette` goes on `<html>`, so popups
|
|
121
128
|
portaled to `<body>` wear it too. An installed app's colours follow it with
|
|
122
129
|
`pwa({ palette })`. For Palm LCD that is the ink and the green.
|
|
123
130
|
|
|
124
131
|
**The accent is never small text.** It fails 4.5:1 as small text on
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
Links are accent light (`--link`,
|
|
132
|
+
every palette's cards (4.3 to 4.9): it is the ring, the primary fill and
|
|
133
|
+
the active item's tint.
|
|
134
|
+
Links are accent light (`--link`, 9.1:1 or more on cards; the `link` Button
|
|
128
135
|
variant is `text-link`), and so is the theme colour as text
|
|
129
136
|
(`--primary-text`: the open tab's name, a picked choice's word). The
|
|
130
137
|
status colours as text are `--success-text`, `--warning-text` and
|
|
131
138
|
`--destructive-text` (soft badges, icons, coloured words); solid fills
|
|
132
139
|
keep the deeper shades with white text. Field borders (`--input`)
|
|
133
|
-
measure 2.
|
|
140
|
+
measure 2.9 against the page, under 3:1; axe doesn't check
|
|
134
141
|
borders.
|
|
135
142
|
|
|
136
143
|
**An app's own axe specs** check its palettes instead of light and dark:
|
|
137
|
-
`defineA11ySuite({ …, palettes: ['
|
|
144
|
+
`defineA11ySuite({ …, palettes: ['graphite-periwinkle'] })` (and
|
|
138
145
|
`defineDataEnvironmentBannerSuite`'s `palettes`) saves each as the
|
|
139
146
|
device's choice before the page loads and checks it in the theme it
|
|
140
147
|
forces: dark, or light for `palettes: ['palm-lcd']`. Pass the app's
|
|
@@ -901,7 +908,7 @@ toggle in an app without a palette). `RowsSetting` offers the same choice
|
|
|
901
908
|
on a page ("A settings page").
|
|
902
909
|
|
|
903
910
|
```tsx
|
|
904
|
-
<FoundationProviders palette="
|
|
911
|
+
<FoundationProviders palette="graphite-periwinkle" palettePicker rowsPicker …>
|
|
905
912
|
```
|
|
906
913
|
|
|
907
914
|
| Rows | Table cell padding (vertical) | Header height |
|
|
@@ -17,7 +17,7 @@ import { useShellDocumentTitle } from '../../hooks/use-document-title.js';
|
|
|
17
17
|
import { usePalette } from '../../hooks/use-palette.js';
|
|
18
18
|
import { useRows } from '../../hooks/use-rows.js';
|
|
19
19
|
import { clearRecentRecords } from '../../lib/search-palette.js';
|
|
20
|
-
import { isPaletteName, PALETTE_LABELS, PALETTES } from '../../lib/palettes.js';
|
|
20
|
+
import { isPaletteName, PALETTE_LABELS, paletteColour, PALETTES } from '../../lib/palettes.js';
|
|
21
21
|
import { isRowsName, ROWS, ROWS_LABELS } from '../../lib/rows.js';
|
|
22
22
|
import { cn } from 'cn';
|
|
23
23
|
import { Button, buttonVariants } from '../ui/button.js';
|
|
@@ -63,7 +63,7 @@ function LookControl({ menu }) {
|
|
|
63
63
|
// colour on it, read from the palette primitives, so the menu shows all
|
|
64
64
|
// four whichever is on screen.
|
|
65
65
|
function PaletteSwatch({ name }) {
|
|
66
|
-
const colour = (part) =>
|
|
66
|
+
const colour = (part) => paletteColour(name, part);
|
|
67
67
|
return (_jsxs("span", { "aria-hidden": true, className: "flex h-4 w-7 shrink-0 items-center justify-center gap-0.5 rounded-sm border border-border", style: { background: colour('background') }, children: [_jsx("span", { className: "size-2 rounded-full", style: { background: colour('accent') } }), _jsx("span", { className: "size-2 rounded-full", style: { background: colour('second') } })] }));
|
|
68
68
|
}
|
|
69
69
|
// `palette` is null when only the rows are offered: the trigger is then
|
|
@@ -3,7 +3,7 @@ import { cn } from 'cn';
|
|
|
3
3
|
import { RadioGroup, RadioGroupItem } from '../ui/radio-group.js';
|
|
4
4
|
import { usePalette } from '../../hooks/use-palette.js';
|
|
5
5
|
import { useRows } from '../../hooks/use-rows.js';
|
|
6
|
-
import { isPaletteName, PALETTE_LABELS, PALETTES } from '../../lib/palettes.js';
|
|
6
|
+
import { isPaletteName, PALETTE_LABELS, paletteColour, PALETTES } from '../../lib/palettes.js';
|
|
7
7
|
import { ROWS, ROWS_LABELS } from '../../lib/rows.js';
|
|
8
8
|
import { ChoiceButtons } from './choice-buttons.js';
|
|
9
9
|
import { SettingsRow } from './settings-page.js';
|
|
@@ -16,7 +16,7 @@ const TILE = cn('relative cursor-pointer overflow-hidden rounded-lg border borde
|
|
|
16
16
|
// title, a line and a button. Read from the palette primitives, so every
|
|
17
17
|
// tile shows its own whichever palette is on screen.
|
|
18
18
|
function PalettePreview({ name }) {
|
|
19
|
-
const colour = (part) =>
|
|
19
|
+
const colour = (part) => paletteColour(name, part);
|
|
20
20
|
const bar = (part, className) => (_jsx("span", { className: cn('h-1.25 rounded-full', className), style: { background: colour(part) } }));
|
|
21
21
|
return (_jsxs("span", { "aria-hidden": true, className: "grid h-16 grid-cols-[--spacing(8.5)_minmax(0,1fr)] border-b border-border", style: { background: colour('background') }, children: [_jsxs("span", { className: "flex flex-col gap-1.25 px-1.5 py-2", style: { background: colour('panel') }, children: [bar('accent'), bar('dim'), bar('dim')] }), _jsxs("span", { className: "flex flex-col gap-1.5 p-2.25", children: [bar('dim', 'w-[70%]'), bar('second', 'w-[40%]'), bar('accent', 'h-2.5 w-[28%]')] })] }));
|
|
22
22
|
}
|
|
@@ -24,8 +24,10 @@ export type MarkdownProps = {
|
|
|
24
24
|
* folds what's under it (to the next heading of its level or higher).
|
|
25
25
|
* A plain heading never folds. What's folded is remembered on this device under this key
|
|
26
26
|
* (name it for the app and the record: `"my-app:task:84:notes"`), and
|
|
27
|
-
* shared with a RichTextEditor or NotesOutline given the same key.
|
|
28
|
-
* text
|
|
27
|
+
* shared with a RichTextEditor or NotesOutline given the same key.
|
|
28
|
+
* Find in page reaching folded text opens its section (Chromium,
|
|
29
|
+
* Firefox; Safari's find skips folded text). The text is never
|
|
30
|
+
* changed.
|
|
29
31
|
*/
|
|
30
32
|
foldKey?: string;
|
|
31
33
|
/**
|
|
@@ -73,13 +73,13 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
73
73
|
// is a real checkbox, named for its item's words, that ticks or unticks the
|
|
74
74
|
// item and hands the whole new text over to save (src/lib/markdown-tasks.ts):
|
|
75
75
|
// only that item's `[ ]` or `[x]` changes.
|
|
76
|
-
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
76
|
+
import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
77
77
|
import ReactMarkdown, {} from 'react-markdown';
|
|
78
78
|
import remarkGfm from 'remark-gfm';
|
|
79
79
|
import { cn } from 'cn';
|
|
80
80
|
import { ChevronDownIcon, ExternalLinkIcon, SquareCheckIcon, SquareIcon } from 'lucide-react';
|
|
81
81
|
import { Checkbox } from '../ui/checkbox.js';
|
|
82
|
-
import { useFolds } from '../../hooks/fold-store.js';
|
|
82
|
+
import { foldStore, useFolds } from '../../hooks/fold-store.js';
|
|
83
83
|
import { CALLOUT_KINDS, remarkCallouts } from '../../lib/markdown-callout.js';
|
|
84
84
|
import { rehypeFold, toggleFold } from '../../lib/markdown-fold.js';
|
|
85
85
|
import { rehypeInline } from '../../lib/markdown-inline.js';
|
|
@@ -113,7 +113,7 @@ function omitNode(props) {
|
|
|
113
113
|
// A GFM table in its box that scrolls sideways: a tab stop and a named
|
|
114
114
|
// region only while the table overflows it. Watched again after each
|
|
115
115
|
// render, so a header row with new words renames it.
|
|
116
|
-
function NotesTable({ hidden, ...props }) {
|
|
116
|
+
function NotesTable({ hidden, 'data-fold-in': foldIn, ...props }) {
|
|
117
117
|
const boxRef = useRef(null);
|
|
118
118
|
useEffect(() => {
|
|
119
119
|
const box = boxRef.current;
|
|
@@ -123,7 +123,7 @@ function NotesTable({ hidden, ...props }) {
|
|
|
123
123
|
const region = watchTableScroll(box, table, headerTexts(table));
|
|
124
124
|
return () => region.destroy();
|
|
125
125
|
});
|
|
126
|
-
return (_jsx("div", { ref: boxRef, "data-slot": "table-container", className: cn('prose-table', TABLE_SCROLL_FOCUS
|
|
126
|
+
return (_jsx("div", { ref: boxRef, "data-slot": "table-container", hidden: hidden, "data-fold-in": foldIn, className: cn('prose-table', TABLE_SCROLL_FOCUS), children: _jsx("table", { ...props }) }));
|
|
127
127
|
}
|
|
128
128
|
// Ticks a task item by where it starts in the text: given only with
|
|
129
129
|
// `onTasksChange`. Each task item hands its box its own start and words.
|
|
@@ -220,16 +220,16 @@ function heading(level, top, textTop) {
|
|
|
220
220
|
const Tag = headingTag(level, top, textTop);
|
|
221
221
|
return function Heading(props) {
|
|
222
222
|
const toggle = useContext(FoldContext);
|
|
223
|
-
const { 'data-fold-id': foldId, 'data-foldable': foldable, 'data-folded': folded, 'data-fold-label': label, 'data-toggle': isToggle, hidden, ...rest } = omitNode(props);
|
|
223
|
+
const { 'data-fold-id': foldId, 'data-foldable': foldable, 'data-folded': folded, 'data-fold-label': label, 'data-toggle': isToggle, 'data-fold-in': foldIn, hidden, ...rest } = omitNode(props);
|
|
224
224
|
const look = cn('text-foreground', headingClass(level));
|
|
225
225
|
const band = headingBand(level) || undefined;
|
|
226
226
|
if (!toggle || foldId === undefined)
|
|
227
|
-
return _jsx(Tag, { ...rest, hidden: hidden, "data-band": band, className: look });
|
|
227
|
+
return _jsx(Tag, { ...rest, hidden: hidden, "data-fold-in": foldIn, "data-band": band, className: look });
|
|
228
228
|
// Plain: still found by its fold id (NotesOutline's jump), never folded.
|
|
229
229
|
if (isToggle !== 'true')
|
|
230
|
-
return _jsx(Tag, { ...rest, "data-fold-id": foldId, hidden: hidden, "data-band": band, className: look });
|
|
230
|
+
return _jsx(Tag, { ...rest, "data-fold-id": foldId, hidden: hidden, "data-fold-in": foldIn, "data-band": band, className: look });
|
|
231
231
|
const open = folded !== 'true';
|
|
232
|
-
return (_jsxs("div", { "data-fold-id": foldId, hidden: hidden, "data-band": band, className: cn(FOLD_HEADING, look), children: [foldable === 'true' ? (_jsx("button", { type: "button", "aria-expanded": open, "aria-label": label || 'Section', "data-slot": "fold-button", className: FOLD_BUTTON, onClick: () => toggle(foldId), children: _jsx(ChevronDownIcon, { "aria-hidden": "true", className: cn('size-4 transition-transform', !open && '-rotate-90') }) })) : (_jsx("span", { "aria-hidden": "true", className: "-ml-1 w-5 shrink-0" })), _jsx(Tag, { ...rest, className: "min-w-0 flex-1" })] }));
|
|
232
|
+
return (_jsxs("div", { "data-fold-id": foldId, hidden: hidden, "data-fold-in": foldIn, "data-band": band, className: cn(FOLD_HEADING, look), children: [foldable === 'true' ? (_jsx("button", { type: "button", "aria-expanded": open, "aria-label": label || 'Section', "data-slot": "fold-button", className: FOLD_BUTTON, onClick: () => toggle(foldId), children: _jsx(ChevronDownIcon, { "aria-hidden": "true", className: cn('size-4 transition-transform', !open && '-rotate-90') }) })) : (_jsx("span", { "aria-hidden": "true", className: "-ml-1 w-5 shrink-0" })), _jsx(Tag, { ...rest, className: "min-w-0 flex-1" })] }));
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
235
|
// Everything but the headings, which follow `headingLevel` (componentsFor).
|
|
@@ -277,7 +277,7 @@ const COMPONENTS = {
|
|
|
277
277
|
return _jsx("div", { ...rest, children: children });
|
|
278
278
|
const look = CALLOUT_LOOK[kind];
|
|
279
279
|
const Icon = look.icon;
|
|
280
|
-
return (_jsxs("div", { role: "note", "data-callout": kind, hidden: rest.hidden, className: cn(CALLOUT_BOX, look.box), children: [_jsx(Icon, { "aria-hidden": "true", className: cn('mt-0.5 size-4 shrink-0', look.tint) }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [_jsxs("span", { className: "sr-only", children: [look.label, ": "] }), children] })] }));
|
|
280
|
+
return (_jsxs("div", { role: "note", "data-callout": kind, hidden: rest.hidden, "data-fold-in": rest['data-fold-in'], className: cn(CALLOUT_BOX, look.box), children: [_jsx(Icon, { "aria-hidden": "true", className: cn('mt-0.5 size-4 shrink-0', look.tint) }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [_jsxs("span", { className: "sr-only", children: [look.label, ": "] }), children] })] }));
|
|
281
281
|
},
|
|
282
282
|
pre: (props) => (_jsx("pre", { ...omitNode(props), className: "overflow-x-auto rounded-lg bg-muted p-3 font-mono text-foreground [&_code]:bg-transparent [&_code]:p-0" })),
|
|
283
283
|
code: (props) => _jsx("code", { ...omitNode(props), className: "rounded bg-muted px-1 py-0.5 font-mono text-foreground" }),
|
|
@@ -324,6 +324,33 @@ function BlockMarkdown({ children, headingLevel = DEFAULT_HEADING_LEVEL, heading
|
|
|
324
324
|
const [folded, setFolded] = useFolds(foldKey);
|
|
325
325
|
const rehypePlugins = useMemo(() => (foldKey === undefined ? [rehypeTables] : [rehypeTables, [rehypeFold, { folded }]]), [foldKey, folded]);
|
|
326
326
|
const toggle = useCallback((id) => setFolded(toggleFold(folded, id)), [folded, setFolded]);
|
|
327
|
+
// Find in page reaching folded text (`hidden="until-found"`, where the
|
|
328
|
+
// browser has it): the browser shows the block, and the headings folding
|
|
329
|
+
// it open, so what's folded stays what's shown.
|
|
330
|
+
const rootRef = useRef(null);
|
|
331
|
+
// React sets `hidden` as a boolean (`hidden=""`), so the folded blocks
|
|
332
|
+
// get their value here, before they're painted; React leaves it until the
|
|
333
|
+
// block opens (and drops the attribute).
|
|
334
|
+
useLayoutEffect(() => {
|
|
335
|
+
for (const block of rootRef.current?.querySelectorAll('[data-fold-in][hidden]') ?? [])
|
|
336
|
+
block.setAttribute('hidden', 'until-found');
|
|
337
|
+
});
|
|
338
|
+
useEffect(() => {
|
|
339
|
+
const root = rootRef.current;
|
|
340
|
+
if (!root || foldKey === undefined)
|
|
341
|
+
return;
|
|
342
|
+
const onMatch = (event) => {
|
|
343
|
+
const block = event.target instanceof HTMLElement ? event.target.closest('[data-fold-in]') : null;
|
|
344
|
+
if (!block?.dataset.foldIn)
|
|
345
|
+
return;
|
|
346
|
+
const ids = JSON.parse(block.dataset.foldIn);
|
|
347
|
+
const now = foldStore.get(foldKey);
|
|
348
|
+
if (ids.some((id) => now.has(id)))
|
|
349
|
+
foldStore.set(foldKey, new Set([...now].filter((id) => !ids.includes(id))));
|
|
350
|
+
};
|
|
351
|
+
root.addEventListener('beforematch', onMatch);
|
|
352
|
+
return () => root.removeEventListener('beforematch', onMatch);
|
|
353
|
+
}, [foldKey]);
|
|
327
354
|
// Ticks not yet back as `children`: shown, and built on by the next
|
|
328
355
|
// tick, so two quick ticks on a slow save both land. Kept while
|
|
329
356
|
// `children` is the text they started from or one of their own saves
|
|
@@ -338,5 +365,5 @@ function BlockMarkdown({ children, headingLevel = DEFAULT_HEADING_LEVEL, heading
|
|
|
338
365
|
if (saving && typeof saving.then === 'function')
|
|
339
366
|
saving.then(undefined, () => setPending((current) => (current?.sent.includes(next) ? null : current)));
|
|
340
367
|
}, [onTasksChange, children, shown, live]);
|
|
341
|
-
return (_jsx("div", { "data-slot": "markdown", "data-table-look": tableLook, "data-fold-scope": foldKey, ...rest, className: cn('flex min-w-0 flex-col gap-3 type-body text-foreground break-words', PROSE_INSET, className), children: _jsx(PageLinkContext.Provider, { value: pageLink ?? null, children: _jsx(FoldContext.Provider, { value: foldKey === undefined ? null : toggle, children: _jsx(TaskToggleContext.Provider, { value: onTasksChange ? tickTask : null, children: _jsx(ReactMarkdown, { remarkPlugins: REMARK_PLUGINS, rehypePlugins: rehypePlugins, components: components, children: onTasksChange ? shown : children }) }) }) }) }));
|
|
368
|
+
return (_jsx("div", { ref: rootRef, "data-slot": "markdown", "data-table-look": tableLook, "data-fold-scope": foldKey, ...rest, className: cn('flex min-w-0 flex-col gap-3 type-body text-foreground break-words', PROSE_INSET, className), children: _jsx(PageLinkContext.Provider, { value: pageLink ?? null, children: _jsx(FoldContext.Provider, { value: foldKey === undefined ? null : toggle, children: _jsx(TaskToggleContext.Provider, { value: onTasksChange ? tickTask : null, children: _jsx(ReactMarkdown, { remarkPlugins: REMARK_PLUGINS, rehypePlugins: rehypePlugins, components: components, children: onTasksChange ? shown : children }) }) }) }) }));
|
|
342
369
|
}
|
|
@@ -123,7 +123,8 @@ export type RichTextEditorProps = {
|
|
|
123
123
|
* top level has a button that folds what's under it (a plain heading
|
|
124
124
|
* never folds), Ctrl/Cmd+Alt+[ folds the section the caret is in and
|
|
125
125
|
* Ctrl/Cmd+Alt+] opens the heading it's on, and the caret moving into a
|
|
126
|
-
* folded section opens it
|
|
126
|
+
* folded section opens it, as find in page reaching its text does
|
|
127
|
+
* (Chromium, Firefox; Safari's find skips folded text). Remembered on this device under this key,
|
|
127
128
|
* and shared with `<Markdown>` and NotesOutline given the same one.
|
|
128
129
|
* Only the view folds: the Markdown saved never changes. Read once,
|
|
129
130
|
* when it mounts.
|
|
@@ -16,7 +16,7 @@ function build(doc, folded) {
|
|
|
16
16
|
const heading = headings.get(index);
|
|
17
17
|
const attrs = {};
|
|
18
18
|
if (plan.hidden.has(index))
|
|
19
|
-
attrs.hidden = '';
|
|
19
|
+
attrs.hidden = 'until-found';
|
|
20
20
|
if (heading) {
|
|
21
21
|
const spec = {
|
|
22
22
|
id: heading.id,
|
|
@@ -148,6 +148,21 @@ export function foldPlugin(options) {
|
|
|
148
148
|
let sent = foldPluginKey.getState(editorView.state)?.plan.headings ?? [];
|
|
149
149
|
let frame = 0;
|
|
150
150
|
options.onHeadings?.(sent);
|
|
151
|
+
// Find in page reached folded text: the headings folding its block
|
|
152
|
+
// open, before the browser shows it, so the two never disagree.
|
|
153
|
+
const onMatch = (event) => {
|
|
154
|
+
const fold = foldPluginKey.getState(editorView.state);
|
|
155
|
+
if (!fold)
|
|
156
|
+
return;
|
|
157
|
+
let found = -1;
|
|
158
|
+
editorView.state.doc.forEach((_node, offset, index) => {
|
|
159
|
+
if (editorView.nodeDOM(offset) === event.target)
|
|
160
|
+
found = index;
|
|
161
|
+
});
|
|
162
|
+
if (found >= 0 && fold.plan.hidden.has(found))
|
|
163
|
+
options.onChange(openAt(fold.plan, fold.folded, found));
|
|
164
|
+
};
|
|
165
|
+
editorView.dom.addEventListener('beforematch', onMatch);
|
|
151
166
|
const sendHeadings = (view) => {
|
|
152
167
|
frame = 0;
|
|
153
168
|
const headings = foldPluginKey.getState(view.state)?.plan.headings;
|
|
@@ -157,7 +172,10 @@ export function foldPlugin(options) {
|
|
|
157
172
|
options.onHeadings?.(headings);
|
|
158
173
|
};
|
|
159
174
|
return {
|
|
160
|
-
destroy: () =>
|
|
175
|
+
destroy: () => {
|
|
176
|
+
cancelAnimationFrame(frame);
|
|
177
|
+
editorView.dom.removeEventListener('beforematch', onMatch);
|
|
178
|
+
},
|
|
161
179
|
update: (view, previous) => {
|
|
162
180
|
const fold = foldPluginKey.getState(view.state);
|
|
163
181
|
if (!fold)
|
|
@@ -54,10 +54,15 @@ export declare function openTo(plan: {
|
|
|
54
54
|
export declare function openAt(plan: FoldPlan, folded: ReadonlySet<string>, index: number): Set<string>;
|
|
55
55
|
/** `folded` with `id` turned the other way. */
|
|
56
56
|
export declare function toggleFold(folded: ReadonlySet<string>, id: string): Set<string>;
|
|
57
|
+
/** The folded headings whose sections hold the top-level block at `index`: what opening it opens. */
|
|
58
|
+
export declare function foldedAround(plan: FoldPlan, folded: ReadonlySet<string>, index: number): string[];
|
|
57
59
|
/**
|
|
58
60
|
* For <Markdown> (react-markdown's rehype plugins): marks each top-level
|
|
59
61
|
* heading with its fold id and state, and hides every top-level block a
|
|
60
|
-
* folded heading covers (`hidden
|
|
62
|
+
* folded heading covers (`hidden="until-found"`, so the browser's find in
|
|
63
|
+
* page still reaches it), naming the headings that fold it
|
|
64
|
+
* (`data-fold-in`, a JSON list of ids) for the `beforematch` that opens
|
|
65
|
+
* them. Raw HTML at the top level, which
|
|
61
66
|
* <Markdown> shows as its characters, is hidden as a paragraph of the same
|
|
62
67
|
* characters. GFM's footnotes, gathered at the end, are never hidden.
|
|
63
68
|
*/
|
|
@@ -127,10 +127,17 @@ function hastText(node) {
|
|
|
127
127
|
return (node.children ?? []).map(hastText).join('');
|
|
128
128
|
}
|
|
129
129
|
const HEADING = /^h([1-6])$/;
|
|
130
|
+
/** The folded headings whose sections hold the top-level block at `index`: what opening it opens. */
|
|
131
|
+
export function foldedAround(plan, folded, index) {
|
|
132
|
+
return plan.headings.filter((heading) => heading.index < index && index < heading.end && folded.has(heading.id)).map((heading) => heading.id);
|
|
133
|
+
}
|
|
130
134
|
/**
|
|
131
135
|
* For <Markdown> (react-markdown's rehype plugins): marks each top-level
|
|
132
136
|
* heading with its fold id and state, and hides every top-level block a
|
|
133
|
-
* folded heading covers (`hidden
|
|
137
|
+
* folded heading covers (`hidden="until-found"`, so the browser's find in
|
|
138
|
+
* page still reaches it), naming the headings that fold it
|
|
139
|
+
* (`data-fold-in`, a JSON list of ids) for the `beforematch` that opens
|
|
140
|
+
* them. Raw HTML at the top level, which
|
|
134
141
|
* <Markdown> shows as its characters, is hidden as a paragraph of the same
|
|
135
142
|
* characters. GFM's footnotes, gathered at the end, are never hidden.
|
|
136
143
|
*/
|
|
@@ -171,7 +178,7 @@ export function rehypeFold(options) {
|
|
|
171
178
|
node = { type: 'element', tagName: 'p', properties: {}, children: [{ type: 'text', value: node.value ?? '' }] };
|
|
172
179
|
children[index] = node;
|
|
173
180
|
}
|
|
174
|
-
node.properties = { ...node.properties, hidden:
|
|
181
|
+
node.properties = { ...node.properties, hidden: 'until-found', dataFoldIn: JSON.stringify(foldedAround(plan, options.folded, block)) };
|
|
175
182
|
}
|
|
176
183
|
};
|
|
177
184
|
}
|
package/dist/lib/palettes.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { type DeviceChoiceStore, type StorageLike } from './device-choice.js';
|
|
2
|
-
export declare const PALETTES: readonly ["
|
|
2
|
+
export declare const PALETTES: readonly ["graphite-periwinkle", "graphite-amber", "graphite-sky", "graphite-green"];
|
|
3
3
|
export type PaletteName = (typeof PALETTES)[number];
|
|
4
|
-
/** Each palette's name as a person reads it, in the
|
|
4
|
+
/** Each palette's name as a person reads it, in the picker's order. */
|
|
5
5
|
export declare const PALETTE_LABELS: Record<PaletteName, string>;
|
|
6
6
|
/** Where a device's chosen palette is kept. */
|
|
7
7
|
export declare const PALETTE_STORAGE_KEY = "ui-foundation:palette";
|
|
8
|
+
/** The parts of a dark palette every one shares (its greys) and the parts that are its main colour. */
|
|
9
|
+
declare const GREY_PARTS: readonly ["background", "panel", "raised", "border", "strong-border", "text", "dim"];
|
|
10
|
+
type MainPart = 'accent' | 'accent-light' | 'accent-deep' | 'on-accent' | 'second';
|
|
11
|
+
export type PalettePart = (typeof GREY_PARTS)[number] | MainPart;
|
|
12
|
+
/** The theme.css primitive holding one part of a dark palette, for a swatch that shows it whichever palette is on screen. */
|
|
13
|
+
export declare function paletteColour(name: PaletteName, part: PalettePart): string;
|
|
8
14
|
export declare function isPaletteName(value: unknown): value is PaletteName;
|
|
9
15
|
/** The light palettes, which an app opts into by name: never in the picker (design-language.md "Palettes"). */
|
|
10
16
|
export declare const LIGHT_PALETTES: readonly ["palm-lcd"];
|
|
@@ -21,3 +27,4 @@ export type PaletteStore = DeviceChoiceStore<PaletteName>;
|
|
|
21
27
|
export declare function createPaletteStore(getStorage: () => StorageLike | undefined): PaletteStore;
|
|
22
28
|
export declare const browserPaletteStore: PaletteStore;
|
|
23
29
|
export declare const subscribeToBrowserPaletteStore: (listener: () => void) => () => void;
|
|
30
|
+
export {};
|
package/dist/lib/palettes.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// The four palettes (design-language.md "Palettes"): an app's own
|
|
2
|
-
// look,
|
|
1
|
+
// The four dark palettes (design-language.md "Palettes"): an app's own
|
|
2
|
+
// look, graphite greys with one main colour each. FoundationProviders'
|
|
3
3
|
// `palette` names the app's default; with `palettePicker` the app shell's
|
|
4
4
|
// look menu or a settings page (PaletteSetting) offers all four and the
|
|
5
5
|
// choice is remembered on this device (localStorage, this store). A new device starts on the default. The
|
|
6
6
|
// palette rides on <html> as data-palette, so popups portaled to <body>
|
|
7
|
-
// wear it too, and styles/theme.css's `.dark[data-palette]` blocks do the
|
|
7
|
+
// wear it too, and styles/theme.css's `.dark[data-palette^="graphite-"]` blocks do the
|
|
8
8
|
// rest (components/app/palette-provider.tsx, hooks/use-palette.ts).
|
|
9
9
|
//
|
|
10
10
|
// The light palettes (LIGHT_PALETTES, so far one: Palm LCD) are opt-in: an
|
|
@@ -12,16 +12,22 @@
|
|
|
12
12
|
// it is never in the picker, and it has no glow. Its block is
|
|
13
13
|
// `[data-palette="<name>"]` on top of :root.
|
|
14
14
|
import { browserStorage, createDeviceChoiceStore, otherTabsSubscriber } from './device-choice.js';
|
|
15
|
-
export const PALETTES = ['
|
|
16
|
-
/** Each palette's name as a person reads it, in the
|
|
15
|
+
export const PALETTES = ['graphite-periwinkle', 'graphite-amber', 'graphite-sky', 'graphite-green'];
|
|
16
|
+
/** Each palette's name as a person reads it, in the picker's order. */
|
|
17
17
|
export const PALETTE_LABELS = {
|
|
18
|
-
'indigo-cyan': 'Indigo and Cyan',
|
|
19
|
-
'indigo-rose': 'Indigo and Rose',
|
|
20
18
|
'graphite-periwinkle': 'Graphite and Periwinkle',
|
|
21
|
-
|
|
19
|
+
'graphite-amber': 'Graphite and Amber',
|
|
20
|
+
'graphite-sky': 'Graphite and Sky',
|
|
21
|
+
'graphite-green': 'Graphite and Green',
|
|
22
22
|
};
|
|
23
23
|
/** Where a device's chosen palette is kept. */
|
|
24
24
|
export const PALETTE_STORAGE_KEY = 'ui-foundation:palette';
|
|
25
|
+
/** The parts of a dark palette every one shares (its greys) and the parts that are its main colour. */
|
|
26
|
+
const GREY_PARTS = ['background', 'panel', 'raised', 'border', 'strong-border', 'text', 'dim'];
|
|
27
|
+
/** The theme.css primitive holding one part of a dark palette, for a swatch that shows it whichever palette is on screen. */
|
|
28
|
+
export function paletteColour(name, part) {
|
|
29
|
+
return GREY_PARTS.includes(part) ? `var(--palette-graphite-${part})` : `var(--palette-${name}-${part})`;
|
|
30
|
+
}
|
|
25
31
|
export function isPaletteName(value) {
|
|
26
32
|
return typeof value === 'string' && PALETTES.includes(value);
|
|
27
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tristan2828/ui-foundation",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
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
|
@@ -359,6 +359,24 @@
|
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
361
|
|
|
362
|
+
/* A folded block in written text (<Markdown>'s `foldKey`, the editor's):
|
|
363
|
+
`hidden="until-found"`, so find in page still reaches it. Where the
|
|
364
|
+
browser has it, the block keeps a box (its content unpainted), so it is
|
|
365
|
+
drawn as nothing: no height, padding, border or fill, and a margin that
|
|
366
|
+
takes back the gap the text's column puts before it (`gap-3`, the gap
|
|
367
|
+
of both). Where the browser hasn't, it's `display: none`, as `hidden`.
|
|
368
|
+
A folded block always follows its heading, so never the first. */
|
|
369
|
+
:is([data-slot="markdown"], .ProseMirror) > [hidden="until-found"] {
|
|
370
|
+
block-size: 0;
|
|
371
|
+
min-block-size: 0;
|
|
372
|
+
margin: calc(var(--spacing) * -3) 0 0;
|
|
373
|
+
padding: 0;
|
|
374
|
+
border: 0;
|
|
375
|
+
background: none;
|
|
376
|
+
box-shadow: none;
|
|
377
|
+
outline: none;
|
|
378
|
+
}
|
|
379
|
+
|
|
362
380
|
/* Tables in written text (<Markdown> and the rich-text editor; each puts
|
|
363
381
|
its table in a `.prose-table` box that scrolls sideways). Columns fit
|
|
364
382
|
their content: the table is only as wide as its words, a cell wraps at
|
package/styles/theme.css
CHANGED
|
@@ -304,77 +304,61 @@
|
|
|
304
304
|
|
|
305
305
|
/*
|
|
306
306
|
* Palette primitives (design-language.md "Palettes"). A palette is an
|
|
307
|
-
* app's own look
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* palette's own background (bg), card and raised surfaces (WCAG 2.x,
|
|
314
|
-
* sRGB), listed 1 Indigo and Cyan / 2 Indigo and Rose / 3 Graphite and
|
|
315
|
-
* Periwinkle / 4 Violet:
|
|
307
|
+
* app's own look. The four dark ones are graphite: they share one set
|
|
308
|
+
* of neutral greys (--palette-graphite-*) and each has its own main
|
|
309
|
+
* colour, five values (--palette-graphite-<hue>-*). The semantic block
|
|
310
|
+
* under `.dark[data-palette^="graphite-"]`, at the end of this file,
|
|
311
|
+
* maps them onto the tokens components use. Ratios are against the
|
|
312
|
+
* greys' background (bg), card and raised surfaces (WCAG 2.x, sRGB).
|
|
316
313
|
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
314
|
+
* The greys, every graphite palette:
|
|
315
|
+
* text on bg 15.0, on card 13.4
|
|
316
|
+
* dim on bg 7.54, on raised 5.79
|
|
317
|
+
* strong-border on bg 2.89: under 3:1, kept as designed (axe does
|
|
318
|
+
* not check borders)
|
|
319
|
+
*
|
|
320
|
+
* Each main colour, listed Periwinkle / Amber / Sky / Green:
|
|
321
|
+
* accent on bg 4.87 / 4.99 / 5.25 / 5.54, on card 4.32 / 4.43 /
|
|
322
|
+
* 4.66 / 4.92: never small text; the ring and fills only
|
|
323
|
+
* on-accent on accent 5.28 / 5.43 / 5.68 / 5.97
|
|
324
|
+
* accent-light on bg 10.4 / 10.4 / 10.6 / 10.9, on card 9.19 / 9.23 /
|
|
325
|
+
* 9.44 / 9.65, on raised 7.95 at the least: links
|
|
326
|
+
* accent-deep a chart's third series, never text
|
|
327
|
+
* second on card 5.08 / 5.07 / 5.24 / 5.50
|
|
328
|
+
* Amber, Sky and Green are Periwinkle's lightness and strength in
|
|
329
|
+
* OKLCH, at their own hue.
|
|
326
330
|
*/
|
|
327
|
-
--palette-
|
|
328
|
-
--palette-
|
|
329
|
-
--palette-
|
|
330
|
-
--palette-
|
|
331
|
-
--palette-
|
|
332
|
-
--palette-
|
|
333
|
-
--palette-
|
|
334
|
-
--palette-indigo-cyan-accent: #6682f5;
|
|
335
|
-
--palette-indigo-cyan-accent-light: #b2c1fa;
|
|
336
|
-
--palette-indigo-cyan-accent-deep: #224cf1;
|
|
337
|
-
--palette-indigo-cyan-on-accent: #090f25;
|
|
338
|
-
--palette-indigo-cyan-second: #6dd4ee;
|
|
339
|
-
|
|
340
|
-
--palette-indigo-rose-background: #101219;
|
|
341
|
-
--palette-indigo-rose-panel: #181c28;
|
|
342
|
-
--palette-indigo-rose-raised: #202534;
|
|
343
|
-
--palette-indigo-rose-border: #32394e;
|
|
344
|
-
--palette-indigo-rose-strong-border: #4c5570;
|
|
345
|
-
--palette-indigo-rose-text: #e6e8ef;
|
|
346
|
-
--palette-indigo-rose-dim: #9da3b4;
|
|
347
|
-
--palette-indigo-rose-accent: #6868f3;
|
|
348
|
-
--palette-indigo-rose-accent-light: #b4b4f9;
|
|
349
|
-
--palette-indigo-rose-accent-deep: #2626ed;
|
|
350
|
-
--palette-indigo-rose-on-accent: #090925;
|
|
351
|
-
--palette-indigo-rose-second: #ec6f8e;
|
|
331
|
+
--palette-graphite-background: #171717;
|
|
332
|
+
--palette-graphite-panel: #222222;
|
|
333
|
+
--palette-graphite-raised: #2d2d2d;
|
|
334
|
+
--palette-graphite-border: #424242;
|
|
335
|
+
--palette-graphite-strong-border: #616161;
|
|
336
|
+
--palette-graphite-text: #ebebeb;
|
|
337
|
+
--palette-graphite-dim: #a8a8a8;
|
|
352
338
|
|
|
353
|
-
--palette-graphite-periwinkle-background: #171717;
|
|
354
|
-
--palette-graphite-periwinkle-panel: #222222;
|
|
355
|
-
--palette-graphite-periwinkle-raised: #2d2d2d;
|
|
356
|
-
--palette-graphite-periwinkle-border: #424242;
|
|
357
|
-
--palette-graphite-periwinkle-strong-border: #616161;
|
|
358
|
-
--palette-graphite-periwinkle-text: #ebebeb;
|
|
359
|
-
--palette-graphite-periwinkle-dim: #a8a8a8;
|
|
360
339
|
--palette-graphite-periwinkle-accent: #7f75f0;
|
|
361
340
|
--palette-graphite-periwinkle-accent-light: #c3bff8;
|
|
362
341
|
--palette-graphite-periwinkle-accent-deep: #4435e9;
|
|
363
342
|
--palette-graphite-periwinkle-on-accent: #0b0925;
|
|
364
343
|
--palette-graphite-periwinkle-second: #a97bea;
|
|
365
344
|
|
|
366
|
-
--palette-
|
|
367
|
-
--palette-
|
|
368
|
-
--palette-
|
|
369
|
-
--palette-
|
|
370
|
-
--palette-
|
|
371
|
-
|
|
372
|
-
--palette-
|
|
373
|
-
--palette-
|
|
374
|
-
--palette-
|
|
375
|
-
--palette-
|
|
376
|
-
--palette-
|
|
377
|
-
|
|
345
|
+
--palette-graphite-amber-accent: #bd7801;
|
|
346
|
+
--palette-graphite-amber-accent-light: #e8be8e;
|
|
347
|
+
--palette-graphite-amber-accent-deep: #845200;
|
|
348
|
+
--palette-graphite-amber-on-accent: #160a00;
|
|
349
|
+
--palette-graphite-amber-second: #e86d40;
|
|
350
|
+
|
|
351
|
+
--palette-graphite-sky-accent: #0093d7;
|
|
352
|
+
--palette-graphite-sky-accent-light: #97cef5;
|
|
353
|
+
--palette-graphite-sky-accent-deep: #006697;
|
|
354
|
+
--palette-graphite-sky-on-accent: #000f1b;
|
|
355
|
+
--palette-graphite-sky-second: #7b8bfa;
|
|
356
|
+
|
|
357
|
+
--palette-graphite-green-accent: #06a54c;
|
|
358
|
+
--palette-graphite-green-accent-light: #a2d6ab;
|
|
359
|
+
--palette-graphite-green-accent-deep: #017332;
|
|
360
|
+
--palette-graphite-green-on-accent: #001204;
|
|
361
|
+
--palette-graphite-green-second: #9d9d09;
|
|
378
362
|
|
|
379
363
|
/*
|
|
380
364
|
* The status colours every palette shares, as TEXT shades (--*-text):
|
|
@@ -1213,202 +1197,103 @@
|
|
|
1213
1197
|
* Palettes (design-language.md "Palettes"): an app's own dark look.
|
|
1214
1198
|
* FoundationProviders' `palette` puts data-palette on <html> and forces
|
|
1215
1199
|
* the dark theme (Palm LCD, the light one, is at the end of this file),
|
|
1216
|
-
* so
|
|
1217
|
-
*
|
|
1218
|
-
*
|
|
1219
|
-
*
|
|
1220
|
-
*
|
|
1200
|
+
* so the block below always sits on top of .dark and sets only what
|
|
1201
|
+
* differs from it. Every dark palette is graphite: one block maps the
|
|
1202
|
+
* shared greys and the palette's main colour, read through five
|
|
1203
|
+
* --palette-main-* names that each palette's own small block sets. The
|
|
1204
|
+
* solid fills (--destructive, --success, --warning, --info, each with
|
|
1205
|
+
* white -foreground), --info-text, the highlight washes, the categorical
|
|
1206
|
+
* slots, the heat scale and the depth ramps stay .dark's.
|
|
1221
1207
|
*
|
|
1222
|
-
* --ring is the accent (4.
|
|
1223
|
-
*
|
|
1224
|
-
* --link is accent light: the accent fails 4.5 as small text on
|
|
1208
|
+
* --ring is the accent (4.87 to 5.54 on the page), not accent deep
|
|
1209
|
+
* (2.50 to 2.99, under the 3:1 a focus ring needs).
|
|
1210
|
+
* --link is accent light: the accent fails 4.5 as small text on cards.
|
|
1225
1211
|
* --*-text are the shared status shades; the fills are unchanged.
|
|
1226
1212
|
* --sidebar-accent, the active and hovered item, is a soft accent tint
|
|
1227
|
-
* on the panel (16%): text on it 10.8
|
|
1228
|
-
* at the least.
|
|
1213
|
+
* on the panel (16%): text on it 10.8 at the least, dim 5.41.
|
|
1229
1214
|
* Derived in .dark and resolved with these values, since both blocks
|
|
1230
|
-
* apply to <html>: --table-stripe
|
|
1231
|
-
*
|
|
1232
|
-
* --rule is the strong border (2.53 to 2.89; .dark's was 2.54).
|
|
1215
|
+
* apply to <html>: --table-stripe, --table-highlight, --heading-band.
|
|
1216
|
+
* --rule is the strong border (2.89; .dark's was 2.54).
|
|
1233
1217
|
*
|
|
1234
1218
|
* Printed notes still print light: index.css's print override is more
|
|
1235
|
-
* specific than
|
|
1219
|
+
* specific than this block (tests: entity-view-print.spec.ts).
|
|
1236
1220
|
*/
|
|
1237
1221
|
|
|
1238
|
-
.dark[data-palette
|
|
1239
|
-
--background: var(--palette-
|
|
1240
|
-
--foreground: var(--palette-
|
|
1241
|
-
--card: var(--palette-
|
|
1242
|
-
--card-foreground: var(--palette-
|
|
1243
|
-
--popover: var(--palette-
|
|
1244
|
-
--popover-foreground: var(--palette-
|
|
1245
|
-
--primary: var(--palette-
|
|
1246
|
-
--primary-foreground: var(--palette-
|
|
1247
|
-
--secondary: var(--palette-
|
|
1248
|
-
--secondary-foreground: var(--palette-
|
|
1249
|
-
--muted: var(--palette-
|
|
1250
|
-
--muted-foreground: var(--palette-
|
|
1251
|
-
--accent: var(--palette-
|
|
1252
|
-
--accent-foreground: var(--palette-
|
|
1253
|
-
--accent-second: var(--palette-
|
|
1222
|
+
.dark[data-palette^="graphite-"] {
|
|
1223
|
+
--background: var(--palette-graphite-background);
|
|
1224
|
+
--foreground: var(--palette-graphite-text);
|
|
1225
|
+
--card: var(--palette-graphite-panel);
|
|
1226
|
+
--card-foreground: var(--palette-graphite-text);
|
|
1227
|
+
--popover: var(--palette-graphite-panel);
|
|
1228
|
+
--popover-foreground: var(--palette-graphite-text);
|
|
1229
|
+
--primary: var(--palette-main-accent);
|
|
1230
|
+
--primary-foreground: var(--palette-main-on-accent);
|
|
1231
|
+
--secondary: var(--palette-graphite-raised);
|
|
1232
|
+
--secondary-foreground: var(--palette-graphite-text);
|
|
1233
|
+
--muted: var(--palette-graphite-raised);
|
|
1234
|
+
--muted-foreground: var(--palette-graphite-dim);
|
|
1235
|
+
--accent: var(--palette-graphite-raised);
|
|
1236
|
+
--accent-foreground: var(--palette-graphite-text);
|
|
1237
|
+
--accent-second: var(--palette-main-second);
|
|
1254
1238
|
--destructive-text: var(--palette-danger);
|
|
1255
1239
|
--success-text: var(--palette-success);
|
|
1256
1240
|
--warning-text: var(--palette-warning);
|
|
1257
1241
|
--status-done-text: var(--palette-done);
|
|
1258
1242
|
--status-ended-text: var(--palette-ended);
|
|
1259
|
-
--link: var(--palette-
|
|
1260
|
-
--primary-text: var(--palette-
|
|
1261
|
-
--heading-bar: var(--palette-
|
|
1262
|
-
--rule: var(--palette-
|
|
1263
|
-
--table-highlight-muted-foreground: var(--palette-
|
|
1264
|
-
--border: var(--palette-
|
|
1265
|
-
--input: var(--palette-
|
|
1266
|
-
--ring: var(--palette-
|
|
1267
|
-
--chart-1: var(--palette-
|
|
1268
|
-
--chart-2: var(--palette-
|
|
1269
|
-
--chart-3: var(--palette-
|
|
1270
|
-
--chart-4: var(--palette-
|
|
1271
|
-
--chart-5: var(--palette-
|
|
1272
|
-
--sidebar: var(--palette-
|
|
1273
|
-
--sidebar-foreground: var(--palette-
|
|
1274
|
-
--sidebar-primary: var(--palette-
|
|
1275
|
-
--sidebar-primary-foreground: var(--palette-
|
|
1276
|
-
--sidebar-accent: color-mix(in srgb, var(--palette-
|
|
1277
|
-
--sidebar-accent-foreground: var(--palette-
|
|
1278
|
-
--sidebar-border: var(--palette-
|
|
1279
|
-
--sidebar-ring: var(--palette-
|
|
1243
|
+
--link: var(--palette-main-accent-light);
|
|
1244
|
+
--primary-text: var(--palette-main-accent-light);
|
|
1245
|
+
--heading-bar: var(--palette-main-accent-light);
|
|
1246
|
+
--rule: var(--palette-graphite-strong-border);
|
|
1247
|
+
--table-highlight-muted-foreground: var(--palette-graphite-dim);
|
|
1248
|
+
--border: var(--palette-graphite-border);
|
|
1249
|
+
--input: var(--palette-graphite-strong-border);
|
|
1250
|
+
--ring: var(--palette-main-accent);
|
|
1251
|
+
--chart-1: var(--palette-main-accent-light);
|
|
1252
|
+
--chart-2: var(--palette-main-accent);
|
|
1253
|
+
--chart-3: var(--palette-main-accent-deep);
|
|
1254
|
+
--chart-4: var(--palette-main-second);
|
|
1255
|
+
--chart-5: var(--palette-graphite-border);
|
|
1256
|
+
--sidebar: var(--palette-graphite-panel);
|
|
1257
|
+
--sidebar-foreground: var(--palette-graphite-text);
|
|
1258
|
+
--sidebar-primary: var(--palette-main-accent);
|
|
1259
|
+
--sidebar-primary-foreground: var(--palette-main-on-accent);
|
|
1260
|
+
--sidebar-accent: color-mix(in srgb, var(--palette-main-accent) 16%, var(--palette-graphite-panel));
|
|
1261
|
+
--sidebar-accent-foreground: var(--palette-graphite-text);
|
|
1262
|
+
--sidebar-border: var(--palette-graphite-border);
|
|
1263
|
+
--sidebar-ring: var(--palette-main-accent);
|
|
1280
1264
|
}
|
|
1281
1265
|
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
--
|
|
1285
|
-
--
|
|
1286
|
-
--
|
|
1287
|
-
--
|
|
1288
|
-
--
|
|
1289
|
-
--primary: var(--palette-indigo-rose-accent);
|
|
1290
|
-
--primary-foreground: var(--palette-indigo-rose-on-accent);
|
|
1291
|
-
--secondary: var(--palette-indigo-rose-raised);
|
|
1292
|
-
--secondary-foreground: var(--palette-indigo-rose-text);
|
|
1293
|
-
--muted: var(--palette-indigo-rose-raised);
|
|
1294
|
-
--muted-foreground: var(--palette-indigo-rose-dim);
|
|
1295
|
-
--accent: var(--palette-indigo-rose-raised);
|
|
1296
|
-
--accent-foreground: var(--palette-indigo-rose-text);
|
|
1297
|
-
--accent-second: var(--palette-indigo-rose-second);
|
|
1298
|
-
--destructive-text: var(--palette-danger);
|
|
1299
|
-
--success-text: var(--palette-success);
|
|
1300
|
-
--warning-text: var(--palette-warning);
|
|
1301
|
-
--status-done-text: var(--palette-done);
|
|
1302
|
-
--status-ended-text: var(--palette-ended);
|
|
1303
|
-
--link: var(--palette-indigo-rose-accent-light);
|
|
1304
|
-
--primary-text: var(--palette-indigo-rose-accent-light);
|
|
1305
|
-
--heading-bar: var(--palette-indigo-rose-accent-light);
|
|
1306
|
-
--rule: var(--palette-indigo-rose-strong-border);
|
|
1307
|
-
--table-highlight-muted-foreground: var(--palette-indigo-rose-dim);
|
|
1308
|
-
--border: var(--palette-indigo-rose-border);
|
|
1309
|
-
--input: var(--palette-indigo-rose-strong-border);
|
|
1310
|
-
--ring: var(--palette-indigo-rose-accent);
|
|
1311
|
-
--chart-1: var(--palette-indigo-rose-accent-light);
|
|
1312
|
-
--chart-2: var(--palette-indigo-rose-accent);
|
|
1313
|
-
--chart-3: var(--palette-indigo-rose-accent-deep);
|
|
1314
|
-
--chart-4: var(--palette-indigo-rose-second);
|
|
1315
|
-
--chart-5: var(--palette-indigo-rose-border);
|
|
1316
|
-
--sidebar: var(--palette-indigo-rose-panel);
|
|
1317
|
-
--sidebar-foreground: var(--palette-indigo-rose-text);
|
|
1318
|
-
--sidebar-primary: var(--palette-indigo-rose-accent);
|
|
1319
|
-
--sidebar-primary-foreground: var(--palette-indigo-rose-on-accent);
|
|
1320
|
-
--sidebar-accent: color-mix(in srgb, var(--palette-indigo-rose-accent) 16%, var(--palette-indigo-rose-panel));
|
|
1321
|
-
--sidebar-accent-foreground: var(--palette-indigo-rose-text);
|
|
1322
|
-
--sidebar-border: var(--palette-indigo-rose-border);
|
|
1323
|
-
--sidebar-ring: var(--palette-indigo-rose-accent);
|
|
1266
|
+
/* Each graphite palette's main colour (design-language.md "Palettes"). */
|
|
1267
|
+
.dark[data-palette="graphite-periwinkle"] {
|
|
1268
|
+
--palette-main-accent: var(--palette-graphite-periwinkle-accent);
|
|
1269
|
+
--palette-main-accent-light: var(--palette-graphite-periwinkle-accent-light);
|
|
1270
|
+
--palette-main-accent-deep: var(--palette-graphite-periwinkle-accent-deep);
|
|
1271
|
+
--palette-main-on-accent: var(--palette-graphite-periwinkle-on-accent);
|
|
1272
|
+
--palette-main-second: var(--palette-graphite-periwinkle-second);
|
|
1324
1273
|
}
|
|
1325
1274
|
|
|
1326
|
-
.dark[data-palette="graphite-
|
|
1327
|
-
--
|
|
1328
|
-
--
|
|
1329
|
-
--
|
|
1330
|
-
--
|
|
1331
|
-
--
|
|
1332
|
-
--popover-foreground: var(--palette-graphite-periwinkle-text);
|
|
1333
|
-
--primary: var(--palette-graphite-periwinkle-accent);
|
|
1334
|
-
--primary-foreground: var(--palette-graphite-periwinkle-on-accent);
|
|
1335
|
-
--secondary: var(--palette-graphite-periwinkle-raised);
|
|
1336
|
-
--secondary-foreground: var(--palette-graphite-periwinkle-text);
|
|
1337
|
-
--muted: var(--palette-graphite-periwinkle-raised);
|
|
1338
|
-
--muted-foreground: var(--palette-graphite-periwinkle-dim);
|
|
1339
|
-
--accent: var(--palette-graphite-periwinkle-raised);
|
|
1340
|
-
--accent-foreground: var(--palette-graphite-periwinkle-text);
|
|
1341
|
-
--accent-second: var(--palette-graphite-periwinkle-second);
|
|
1342
|
-
--destructive-text: var(--palette-danger);
|
|
1343
|
-
--success-text: var(--palette-success);
|
|
1344
|
-
--warning-text: var(--palette-warning);
|
|
1345
|
-
--status-done-text: var(--palette-done);
|
|
1346
|
-
--status-ended-text: var(--palette-ended);
|
|
1347
|
-
--link: var(--palette-graphite-periwinkle-accent-light);
|
|
1348
|
-
--primary-text: var(--palette-graphite-periwinkle-accent-light);
|
|
1349
|
-
--heading-bar: var(--palette-graphite-periwinkle-accent-light);
|
|
1350
|
-
--rule: var(--palette-graphite-periwinkle-strong-border);
|
|
1351
|
-
--table-highlight-muted-foreground: var(--palette-graphite-periwinkle-dim);
|
|
1352
|
-
--border: var(--palette-graphite-periwinkle-border);
|
|
1353
|
-
--input: var(--palette-graphite-periwinkle-strong-border);
|
|
1354
|
-
--ring: var(--palette-graphite-periwinkle-accent);
|
|
1355
|
-
--chart-1: var(--palette-graphite-periwinkle-accent-light);
|
|
1356
|
-
--chart-2: var(--palette-graphite-periwinkle-accent);
|
|
1357
|
-
--chart-3: var(--palette-graphite-periwinkle-accent-deep);
|
|
1358
|
-
--chart-4: var(--palette-graphite-periwinkle-second);
|
|
1359
|
-
--chart-5: var(--palette-graphite-periwinkle-border);
|
|
1360
|
-
--sidebar: var(--palette-graphite-periwinkle-panel);
|
|
1361
|
-
--sidebar-foreground: var(--palette-graphite-periwinkle-text);
|
|
1362
|
-
--sidebar-primary: var(--palette-graphite-periwinkle-accent);
|
|
1363
|
-
--sidebar-primary-foreground: var(--palette-graphite-periwinkle-on-accent);
|
|
1364
|
-
--sidebar-accent: color-mix(in srgb, var(--palette-graphite-periwinkle-accent) 16%, var(--palette-graphite-periwinkle-panel));
|
|
1365
|
-
--sidebar-accent-foreground: var(--palette-graphite-periwinkle-text);
|
|
1366
|
-
--sidebar-border: var(--palette-graphite-periwinkle-border);
|
|
1367
|
-
--sidebar-ring: var(--palette-graphite-periwinkle-accent);
|
|
1275
|
+
.dark[data-palette="graphite-amber"] {
|
|
1276
|
+
--palette-main-accent: var(--palette-graphite-amber-accent);
|
|
1277
|
+
--palette-main-accent-light: var(--palette-graphite-amber-accent-light);
|
|
1278
|
+
--palette-main-accent-deep: var(--palette-graphite-amber-accent-deep);
|
|
1279
|
+
--palette-main-on-accent: var(--palette-graphite-amber-on-accent);
|
|
1280
|
+
--palette-main-second: var(--palette-graphite-amber-second);
|
|
1368
1281
|
}
|
|
1369
1282
|
|
|
1370
|
-
.dark[data-palette="
|
|
1371
|
-
--
|
|
1372
|
-
--
|
|
1373
|
-
--
|
|
1374
|
-
--
|
|
1375
|
-
--
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
--
|
|
1380
|
-
--
|
|
1381
|
-
--
|
|
1382
|
-
--
|
|
1383
|
-
--
|
|
1384
|
-
--accent-foreground: var(--palette-violet-text);
|
|
1385
|
-
--accent-second: var(--palette-violet-second);
|
|
1386
|
-
--destructive-text: var(--palette-danger);
|
|
1387
|
-
--success-text: var(--palette-success);
|
|
1388
|
-
--warning-text: var(--palette-warning);
|
|
1389
|
-
--status-done-text: var(--palette-done);
|
|
1390
|
-
--status-ended-text: var(--palette-ended);
|
|
1391
|
-
--link: var(--palette-violet-accent-light);
|
|
1392
|
-
--primary-text: var(--palette-violet-accent-light);
|
|
1393
|
-
--heading-bar: var(--palette-violet-accent-light);
|
|
1394
|
-
--rule: var(--palette-violet-strong-border);
|
|
1395
|
-
--table-highlight-muted-foreground: var(--palette-violet-dim);
|
|
1396
|
-
--border: var(--palette-violet-border);
|
|
1397
|
-
--input: var(--palette-violet-strong-border);
|
|
1398
|
-
--ring: var(--palette-violet-accent);
|
|
1399
|
-
--chart-1: var(--palette-violet-accent-light);
|
|
1400
|
-
--chart-2: var(--palette-violet-accent);
|
|
1401
|
-
--chart-3: var(--palette-violet-accent-deep);
|
|
1402
|
-
--chart-4: var(--palette-violet-second);
|
|
1403
|
-
--chart-5: var(--palette-violet-border);
|
|
1404
|
-
--sidebar: var(--palette-violet-panel);
|
|
1405
|
-
--sidebar-foreground: var(--palette-violet-text);
|
|
1406
|
-
--sidebar-primary: var(--palette-violet-accent);
|
|
1407
|
-
--sidebar-primary-foreground: var(--palette-violet-on-accent);
|
|
1408
|
-
--sidebar-accent: color-mix(in srgb, var(--palette-violet-accent) 16%, var(--palette-violet-panel));
|
|
1409
|
-
--sidebar-accent-foreground: var(--palette-violet-text);
|
|
1410
|
-
--sidebar-border: var(--palette-violet-border);
|
|
1411
|
-
--sidebar-ring: var(--palette-violet-accent);
|
|
1283
|
+
.dark[data-palette="graphite-sky"] {
|
|
1284
|
+
--palette-main-accent: var(--palette-graphite-sky-accent);
|
|
1285
|
+
--palette-main-accent-light: var(--palette-graphite-sky-accent-light);
|
|
1286
|
+
--palette-main-accent-deep: var(--palette-graphite-sky-accent-deep);
|
|
1287
|
+
--palette-main-on-accent: var(--palette-graphite-sky-on-accent);
|
|
1288
|
+
--palette-main-second: var(--palette-graphite-sky-second);
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
.dark[data-palette="graphite-green"] {
|
|
1292
|
+
--palette-main-accent: var(--palette-graphite-green-accent);
|
|
1293
|
+
--palette-main-accent-light: var(--palette-graphite-green-accent-light);
|
|
1294
|
+
--palette-main-accent-deep: var(--palette-graphite-green-accent-deep);
|
|
1295
|
+
--palette-main-on-accent: var(--palette-graphite-green-on-accent);
|
|
1296
|
+
--palette-main-second: var(--palette-graphite-green-second);
|
|
1412
1297
|
}
|
|
1413
1298
|
|
|
1414
1299
|
/*
|
package/vite/index.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export type PwaOptions = {
|
|
|
36
36
|
* below default to its accent, its text on the accent and its background
|
|
37
37
|
* instead of the light theme's.
|
|
38
38
|
*/
|
|
39
|
-
palette?: '
|
|
39
|
+
palette?: 'graphite-periwinkle' | 'graphite-amber' | 'graphite-sky' | 'graphite-green' | 'palm-lcd'
|
|
40
40
|
/** `#rrggbb`. Defaults to the package's `--primary` token (or the palette's accent). */
|
|
41
41
|
themeColor?: string
|
|
42
42
|
/** The letter's colour on the SVG icon, `#rrggbb`. Defaults to `--primary-foreground`. */
|
package/vite/pwa.js
CHANGED
|
@@ -79,8 +79,14 @@ export function oklchToHex(value) {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
// A palette's own colours for each token pwa() reads (styles/theme.css's
|
|
82
|
-
// --palette-<name>-* primitives, already #rrggbb).
|
|
82
|
+
// --palette-<name>-* primitives, already #rrggbb). A graphite palette's
|
|
83
|
+
// greys are shared, as --palette-graphite-*.
|
|
83
84
|
const PALETTE_PARTS = { primary: 'accent', 'primary-foreground': 'on-accent', background: 'background' }
|
|
85
|
+
const GRAPHITE_GREYS = new Set(['background'])
|
|
86
|
+
|
|
87
|
+
function palettePrimitive(palette, part) {
|
|
88
|
+
return palette.startsWith('graphite-') && GRAPHITE_GREYS.has(part) ? `palette-graphite-${part}` : `palette-${palette}-${part}`
|
|
89
|
+
}
|
|
84
90
|
|
|
85
91
|
function colour(value, token, palette) {
|
|
86
92
|
if (value !== undefined) {
|
|
@@ -89,7 +95,7 @@ function colour(value, token, palette) {
|
|
|
89
95
|
}
|
|
90
96
|
const css = fs.readFileSync(THEME_CSS, 'utf8')
|
|
91
97
|
if (palette !== undefined) {
|
|
92
|
-
const hex = themeToken(css,
|
|
98
|
+
const hex = themeToken(css, palettePrimitive(palette, PALETTE_PARTS[token]))
|
|
93
99
|
if (!HEX.test(hex)) throw new Error(`pwa: no palette "${palette}" in the theme.`)
|
|
94
100
|
return hex.toLowerCase()
|
|
95
101
|
}
|