@bigpixelrocket/uiok 0.0.0-stage → 0.1.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/CHANGELOG.md +42 -0
- package/LICENSE +21 -0
- package/NOTICE +569 -0
- package/README.md +44 -2
- package/dist/VisuallyHidden.d.ts +13 -0
- package/dist/VisuallyHidden.js +13 -0
- package/dist/activity/ActivityBar.d.ts +29 -0
- package/dist/activity/ActivityBar.js +21 -0
- package/dist/activity/activity.css +43 -0
- package/dist/activity/index.d.ts +2 -0
- package/dist/activity/index.js +2 -0
- package/dist/button/Button.d.ts +26 -0
- package/dist/button/Button.js +14 -0
- package/dist/button/IconButton.d.ts +18 -0
- package/dist/button/IconButton.js +14 -0
- package/dist/button/button.css +95 -0
- package/dist/button/index.d.ts +3 -0
- package/dist/button/index.js +3 -0
- package/dist/charts/Drawing.d.ts +27 -0
- package/dist/charts/Drawing.js +117 -0
- package/dist/charts/Drawing.logic.d.ts +2 -0
- package/dist/charts/Drawing.logic.js +22 -0
- package/dist/charts/Line.logic.d.ts +33 -0
- package/dist/charts/Line.logic.js +72 -0
- package/dist/charts/LineChart.d.ts +34 -0
- package/dist/charts/LineChart.js +100 -0
- package/dist/charts/Pie.logic.d.ts +16 -0
- package/dist/charts/Pie.logic.js +28 -0
- package/dist/charts/PieChart.d.ts +20 -0
- package/dist/charts/PieChart.js +16 -0
- package/dist/charts/ResultChart.d.ts +47 -0
- package/dist/charts/ResultChart.js +175 -0
- package/dist/charts/ResultChart.logic.d.ts +42 -0
- package/dist/charts/ResultChart.logic.js +165 -0
- package/dist/charts/Scatter.logic.d.ts +55 -0
- package/dist/charts/Scatter.logic.js +134 -0
- package/dist/charts/ScatterChart.d.ts +36 -0
- package/dist/charts/ScatterChart.js +99 -0
- package/dist/charts/charts.css +310 -0
- package/dist/charts/index.d.ts +14 -0
- package/dist/charts/index.js +11 -0
- package/dist/charts/seriesColour.d.ts +2 -0
- package/dist/charts/seriesColour.js +8 -0
- package/dist/clock/index.d.ts +2 -0
- package/dist/clock/index.js +2 -0
- package/dist/clock/useClock.d.ts +14 -0
- package/dist/clock/useClock.js +57 -0
- package/dist/datetime/DateTimePicker.d.ts +50 -0
- package/dist/datetime/DateTimePicker.js +98 -0
- package/dist/datetime/DateTimePicker.logic.d.ts +59 -0
- package/dist/datetime/DateTimePicker.logic.js +103 -0
- package/dist/datetime/datetime.css +115 -0
- package/dist/datetime/index.d.ts +7 -0
- package/dist/datetime/index.js +7 -0
- package/dist/dialog/ConfirmDialog.d.ts +73 -0
- package/dist/dialog/ConfirmDialog.js +30 -0
- package/dist/dialog/DialogLegend.d.ts +21 -0
- package/dist/dialog/DialogLegend.js +28 -0
- package/dist/dialog/DialogLegend.logic.d.ts +145 -0
- package/dist/dialog/DialogLegend.logic.js +71 -0
- package/dist/dialog/ModalDialog.d.ts +101 -0
- package/dist/dialog/ModalDialog.js +184 -0
- package/dist/dialog/dialog.css +283 -0
- package/dist/dialog/index.d.ts +8 -0
- package/dist/dialog/index.js +8 -0
- package/dist/filter/FilterEscape.d.ts +16 -0
- package/dist/filter/FilterEscape.js +15 -0
- package/dist/filter/FilterIcon.d.ts +8 -0
- package/dist/filter/FilterIcon.js +11 -0
- package/dist/filter/filter.css +42 -0
- package/dist/filter/index.d.ts +3 -0
- package/dist/filter/index.js +3 -0
- package/dist/grid/DataGrid.d.ts +149 -0
- package/dist/grid/DataGrid.js +373 -0
- package/dist/grid/DataGrid.logic.d.ts +57 -0
- package/dist/grid/DataGrid.logic.js +121 -0
- package/dist/grid/grid.css +206 -0
- package/dist/grid/index.d.ts +7 -0
- package/dist/grid/index.js +7 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +32 -0
- package/dist/keyboard/BrowserKeys.d.ts +15 -0
- package/dist/keyboard/BrowserKeys.js +28 -0
- package/dist/keyboard/KeyChord.logic.d.ts +25 -0
- package/dist/keyboard/KeyChord.logic.js +50 -0
- package/dist/keyboard/Keyboard.logic.d.ts +84 -0
- package/dist/keyboard/Keyboard.logic.js +137 -0
- package/dist/keyboard/OverlayWatch.d.ts +28 -0
- package/dist/keyboard/OverlayWatch.js +119 -0
- package/dist/keyboard/PageSelectAll.d.ts +14 -0
- package/dist/keyboard/PageSelectAll.js +22 -0
- package/dist/keyboard/index.d.ts +9 -0
- package/dist/keyboard/index.js +9 -0
- package/dist/keychord/KeyChord.d.ts +16 -0
- package/dist/keychord/KeyChord.js +55 -0
- package/dist/keychord/index.d.ts +2 -0
- package/dist/keychord/index.js +2 -0
- package/dist/keychord/keychord.css +41 -0
- package/dist/labels/UiokLabels.d.ts +41 -0
- package/dist/labels/UiokLabels.js +31 -0
- package/dist/labels/UiokProvider.d.ts +44 -0
- package/dist/labels/UiokProvider.js +54 -0
- package/dist/labels/charts.d.ts +34 -0
- package/dist/labels/charts.js +15 -0
- package/dist/labels/dateTime.d.ts +32 -0
- package/dist/labels/dateTime.js +14 -0
- package/dist/labels/dialog.d.ts +18 -0
- package/dist/labels/dialog.js +6 -0
- package/dist/labels/index.d.ts +13 -0
- package/dist/labels/index.js +13 -0
- package/dist/labels/keys.d.ts +28 -0
- package/dist/labels/keys.js +53 -0
- package/dist/labels/legend.d.ts +21 -0
- package/dist/labels/legend.js +7 -0
- package/dist/labels/listing.d.ts +16 -0
- package/dist/labels/listing.js +8 -0
- package/dist/labels/pager.d.ts +32 -0
- package/dist/labels/pager.js +20 -0
- package/dist/labels/palette.d.ts +17 -0
- package/dist/labels/palette.js +6 -0
- package/dist/labels/selectAll.d.ts +15 -0
- package/dist/labels/selectAll.js +6 -0
- package/dist/labels/terminal.d.ts +25 -0
- package/dist/labels/terminal.js +9 -0
- package/dist/legend/KeyLegend.logic.d.ts +84 -0
- package/dist/legend/KeyLegend.logic.js +109 -0
- package/dist/legend/KeyLegendStrip.d.ts +36 -0
- package/dist/legend/KeyLegendStrip.js +82 -0
- package/dist/legend/index.d.ts +3 -0
- package/dist/legend/index.js +3 -0
- package/dist/legend/legend.css +148 -0
- package/dist/listing/CurrentDot.d.ts +15 -0
- package/dist/listing/CurrentDot.js +13 -0
- package/dist/listing/Listing.d.ts +230 -0
- package/dist/listing/Listing.js +265 -0
- package/dist/listing/PathParts.logic.d.ts +17 -0
- package/dist/listing/PathParts.logic.js +18 -0
- package/dist/listing/index.d.ts +10 -0
- package/dist/listing/index.js +10 -0
- package/dist/listing/listing.css +867 -0
- package/dist/menu/MenuQuery.logic.d.ts +69 -0
- package/dist/menu/MenuQuery.logic.js +75 -0
- package/dist/menu/fuzzyMatch.d.ts +31 -0
- package/dist/menu/fuzzyMatch.js +296 -0
- package/dist/menu/index.d.ts +9 -0
- package/dist/menu/index.js +9 -0
- package/dist/menu/menu.css +203 -0
- package/dist/menu/useBellBeat.d.ts +8 -0
- package/dist/menu/useBellBeat.js +26 -0
- package/dist/namecut/NameCut.d.ts +22 -0
- package/dist/namecut/NameCut.js +28 -0
- package/dist/namecut/NameCut.logic.d.ts +51 -0
- package/dist/namecut/NameCut.logic.js +120 -0
- package/dist/namecut/index.d.ts +3 -0
- package/dist/namecut/index.js +3 -0
- package/dist/namecut/namecut.css +67 -0
- package/dist/pager/Pager.d.ts +37 -0
- package/dist/pager/Pager.js +38 -0
- package/dist/pager/Pager.logic.d.ts +13 -0
- package/dist/pager/Pager.logic.js +63 -0
- package/dist/pager/index.d.ts +7 -0
- package/dist/pager/index.js +7 -0
- package/dist/pager/pager.css +62 -0
- package/dist/palette/Palette.d.ts +79 -0
- package/dist/palette/Palette.js +60 -0
- package/dist/palette/index.d.ts +6 -0
- package/dist/palette/index.js +6 -0
- package/dist/palette/palette.css +159 -0
- package/dist/pane/PaneActions.d.ts +104 -0
- package/dist/pane/PaneActions.js +62 -0
- package/dist/pane/PaneFrame.d.ts +51 -0
- package/dist/pane/PaneFrame.js +28 -0
- package/dist/pane/PaneKeys.d.ts +41 -0
- package/dist/pane/PaneKeys.js +104 -0
- package/dist/pane/PaneKeys.logic.d.ts +95 -0
- package/dist/pane/PaneKeys.logic.js +109 -0
- package/dist/pane/index.d.ts +11 -0
- package/dist/pane/index.js +11 -0
- package/dist/pane/usePaneKeys.d.ts +141 -0
- package/dist/pane/usePaneKeys.js +313 -0
- package/dist/run/RunHeader.d.ts +50 -0
- package/dist/run/RunHeader.js +31 -0
- package/dist/run/RunProgress.logic.d.ts +29 -0
- package/dist/run/RunProgress.logic.js +34 -0
- package/dist/run/index.d.ts +3 -0
- package/dist/run/index.js +3 -0
- package/dist/run/run.css +190 -0
- package/dist/segmented/SegmentedChoice.d.ts +22 -0
- package/dist/segmented/SegmentedChoice.js +31 -0
- package/dist/segmented/index.d.ts +2 -0
- package/dist/segmented/index.js +2 -0
- package/dist/segmented/segmented.css +49 -0
- package/dist/selectall/CheckRange.logic.d.ts +8 -0
- package/dist/selectall/CheckRange.logic.js +23 -0
- package/dist/selectall/SelectAllBar.d.ts +25 -0
- package/dist/selectall/SelectAllBar.js +24 -0
- package/dist/selectall/index.d.ts +7 -0
- package/dist/selectall/index.js +7 -0
- package/dist/selectall/selectall.css +31 -0
- package/dist/store/KeepUnchanged.logic.d.ts +19 -0
- package/dist/store/KeepUnchanged.logic.js +33 -0
- package/dist/store/SameProps.d.ts +15 -0
- package/dist/store/SameProps.js +46 -0
- package/dist/store/ValueStore.d.ts +17 -0
- package/dist/store/ValueStore.js +23 -0
- package/dist/store/index.d.ts +8 -0
- package/dist/store/index.js +8 -0
- package/dist/store/useStableHandlers.d.ts +13 -0
- package/dist/store/useStableHandlers.js +22 -0
- package/dist/styles.css +85 -0
- package/dist/tabs/PageTabs.d.ts +38 -0
- package/dist/tabs/PageTabs.js +33 -0
- package/dist/tabs/index.d.ts +2 -0
- package/dist/tabs/index.js +2 -0
- package/dist/tabs/tabs.css +64 -0
- package/dist/terminal/Terminal.d.ts +104 -0
- package/dist/terminal/Terminal.js +309 -0
- package/dist/terminal/Terminal.logic.d.ts +66 -0
- package/dist/terminal/Terminal.logic.js +156 -0
- package/dist/terminal/TerminalMenu.d.ts +36 -0
- package/dist/terminal/TerminalMenu.js +87 -0
- package/dist/terminal/TerminalMenu.logic.d.ts +78 -0
- package/dist/terminal/TerminalMenu.logic.js +68 -0
- package/dist/terminal/TerminalScrollback.d.ts +10 -0
- package/dist/terminal/TerminalScrollback.js +11 -0
- package/dist/terminal/ghostty/LICENSE +21 -0
- package/dist/terminal/ghostty/core.d.ts +315 -0
- package/dist/terminal/ghostty/core.js +1189 -0
- package/dist/terminal/ghostty/fallbackColors.d.ts +12 -0
- package/dist/terminal/ghostty/fallbackColors.js +23 -0
- package/dist/terminal/ghostty/fonts/LICENSE +21 -0
- package/dist/terminal/ghostty/fonts/SymbolsNerdFontMono-Regular.woff2 +0 -0
- package/dist/terminal/ghostty/keyCodes.logic.d.ts +20 -0
- package/dist/terminal/ghostty/keyCodes.logic.js +249 -0
- package/dist/terminal/ghostty/links.logic.d.ts +39 -0
- package/dist/terminal/ghostty/links.logic.js +84 -0
- package/dist/terminal/ghostty/renderer.d.ts +98 -0
- package/dist/terminal/ghostty/renderer.js +481 -0
- package/dist/terminal/ghostty/runtime.d.ts +126 -0
- package/dist/terminal/ghostty/runtime.js +346 -0
- package/dist/terminal/ghostty/spriteGlyphs.logic.d.ts +64 -0
- package/dist/terminal/ghostty/spriteGlyphs.logic.js +546 -0
- package/dist/terminal/ghostty/surface.d.ts +285 -0
- package/dist/terminal/ghostty/surface.js +1565 -0
- package/dist/terminal/ghostty/surface.logic.d.ts +181 -0
- package/dist/terminal/ghostty/surface.logic.js +392 -0
- package/dist/terminal/ghostty/vendor/LICENSE +21 -0
- package/dist/terminal/ghostty/vendor/ghostty-effects.wasm +0 -0
- package/dist/terminal/ghostty/vendor/ghostty-vt.wasm +0 -0
- package/dist/terminal/index.d.ts +12 -0
- package/dist/terminal/index.js +12 -0
- package/dist/terminal/terminal.css +169 -0
- package/dist/text/MarkedText.d.ts +14 -0
- package/dist/text/MarkedText.js +11 -0
- package/dist/text/highlightSegments.d.ts +13 -0
- package/dist/text/highlightSegments.js +29 -0
- package/dist/text/index.d.ts +3 -0
- package/dist/text/index.js +3 -0
- package/dist/text/text.css +11 -0
- package/dist/themes/attributes.d.ts +21 -0
- package/dist/themes/attributes.js +41 -0
- package/dist/themes/catalog.d.ts +125 -0
- package/dist/themes/catalog.js +940 -0
- package/dist/themes/color.d.ts +29 -0
- package/dist/themes/color.js +52 -0
- package/dist/themes/ids.d.ts +139 -0
- package/dist/themes/ids.js +59 -0
- package/dist/themes/index.d.ts +12 -0
- package/dist/themes/index.js +12 -0
- package/dist/themes/themes.generated.css +1830 -0
- package/dist/themes/tokens.d.ts +189 -0
- package/dist/themes/tokens.js +462 -0
- package/dist/tooltip/Tooltip.d.ts +21 -0
- package/dist/tooltip/Tooltip.js +105 -0
- package/dist/tooltip/Tooltip.logic.d.ts +49 -0
- package/dist/tooltip/Tooltip.logic.js +50 -0
- package/dist/tooltip/index.d.ts +3 -0
- package/dist/tooltip/index.js +3 -0
- package/dist/tooltip/tooltip.css +45 -0
- package/package.json +91 -4
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The colour arithmetic the theme tokens are derived with: sRGB hex colours,
|
|
3
|
+
* mixes, translucent forms, and WCAG 2 contrast ratios. Pure, with no DOM, so
|
|
4
|
+
* the token generator, tests, and a host process that paints a window's
|
|
5
|
+
* ground before any stylesheet loads can share it.
|
|
6
|
+
*/
|
|
7
|
+
/** An opaque colour as six lowercase hex digits, the form every palette entry takes. */
|
|
8
|
+
export type Hex = `#${string}`;
|
|
9
|
+
/** A colour's red, green, and blue channels, each 0 to 255. */
|
|
10
|
+
export interface Rgb {
|
|
11
|
+
/** Red, 0 to 255. */
|
|
12
|
+
readonly r: number;
|
|
13
|
+
/** Green, 0 to 255. */
|
|
14
|
+
readonly g: number;
|
|
15
|
+
/** Blue, 0 to 255. */
|
|
16
|
+
readonly b: number;
|
|
17
|
+
}
|
|
18
|
+
/** The channels of a six-digit hex colour; throws on any other form, so a palette typo fails loudly. */
|
|
19
|
+
export declare function rgbOf(hex: Hex): Rgb;
|
|
20
|
+
/** `rgb` as six lowercase hex digits, each channel rounded to the nearest step. */
|
|
21
|
+
export declare function hexOf(rgb: Rgb): Hex;
|
|
22
|
+
/** `share` percent of `a` over the rest of `b`, mixed in sRGB and rounded, as CSS `color-mix(in srgb)` mixes. */
|
|
23
|
+
export declare function mix(a: Hex, b: Hex, share: number): Hex;
|
|
24
|
+
/** `hex` at `opacity` percent, written `rgb(r g b / opacity%)`, a form a terminal engine's colour reader can parse. */
|
|
25
|
+
export declare function translucent(hex: Hex, opacity: number): string;
|
|
26
|
+
/** WCAG 2 relative luminance. */
|
|
27
|
+
export declare function luminance(hex: Hex): number;
|
|
28
|
+
/** WCAG 2 contrast ratio between two opaque colours, 1 to 21. */
|
|
29
|
+
export declare function contrast(a: Hex, b: Hex): number;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The colour arithmetic the theme tokens are derived with: sRGB hex colours,
|
|
3
|
+
* mixes, translucent forms, and WCAG 2 contrast ratios. Pure, with no DOM, so
|
|
4
|
+
* the token generator, tests, and a host process that paints a window's
|
|
5
|
+
* ground before any stylesheet loads can share it.
|
|
6
|
+
*/
|
|
7
|
+
const HEX_COLOR = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/;
|
|
8
|
+
/** The channels of a six-digit hex colour; throws on any other form, so a palette typo fails loudly. */
|
|
9
|
+
export function rgbOf(hex) {
|
|
10
|
+
const match = HEX_COLOR.exec(hex);
|
|
11
|
+
if (match === null)
|
|
12
|
+
throw new Error(`Not a six-digit lowercase hex colour: ${hex}`);
|
|
13
|
+
return {
|
|
14
|
+
r: Number.parseInt(match[1] ?? '', 16),
|
|
15
|
+
g: Number.parseInt(match[2] ?? '', 16),
|
|
16
|
+
b: Number.parseInt(match[3] ?? '', 16)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** `rgb` as six lowercase hex digits, each channel rounded to the nearest step. */
|
|
20
|
+
export function hexOf(rgb) {
|
|
21
|
+
const digits = [rgb.r, rgb.g, rgb.b].map((channel) => Math.min(255, Math.max(0, Math.round(channel)))
|
|
22
|
+
.toString(16)
|
|
23
|
+
.padStart(2, '0'));
|
|
24
|
+
return `#${digits.join('')}`;
|
|
25
|
+
}
|
|
26
|
+
/** `share` percent of `a` over the rest of `b`, mixed in sRGB and rounded, as CSS `color-mix(in srgb)` mixes. */
|
|
27
|
+
export function mix(a, b, share) {
|
|
28
|
+
const x = rgbOf(a);
|
|
29
|
+
const y = rgbOf(b);
|
|
30
|
+
const weight = share / 100;
|
|
31
|
+
const channel = (from, to) => from * weight + to * (1 - weight);
|
|
32
|
+
return hexOf({ r: channel(x.r, y.r), g: channel(x.g, y.g), b: channel(x.b, y.b) });
|
|
33
|
+
}
|
|
34
|
+
/** `hex` at `opacity` percent, written `rgb(r g b / opacity%)`, a form a terminal engine's colour reader can parse. */
|
|
35
|
+
export function translucent(hex, opacity) {
|
|
36
|
+
const { r, g, b } = rgbOf(hex);
|
|
37
|
+
return `rgb(${r} ${g} ${b} / ${opacity}%)`;
|
|
38
|
+
}
|
|
39
|
+
/** WCAG 2 relative luminance. */
|
|
40
|
+
export function luminance(hex) {
|
|
41
|
+
const linear = (channel) => {
|
|
42
|
+
const value = channel / 255;
|
|
43
|
+
return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
|
|
44
|
+
};
|
|
45
|
+
const { r, g, b } = rgbOf(hex);
|
|
46
|
+
return 0.2126 * linear(r) + 0.7152 * linear(g) + 0.0722 * linear(b);
|
|
47
|
+
}
|
|
48
|
+
/** WCAG 2 contrast ratio between two opaque colours, 1 to 21. */
|
|
49
|
+
export function contrast(a, b) {
|
|
50
|
+
const [light, dark] = [luminance(a), luminance(b)].sort((x, y) => y - x);
|
|
51
|
+
return ((light ?? 0) + 0.05) / ((dark ?? 0) + 0.05);
|
|
52
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The themes of the catalog by id: each one's name and the appearance it is
|
|
3
|
+
* worn under, with no colours. A theme picker, saved settings, and any code
|
|
4
|
+
* that passes a theme choice around read themes through this list; only the
|
|
5
|
+
* catalog (`catalog.ts`) holds their palettes, keyed by these ids, so code can
|
|
6
|
+
* name a theme without shipping or painting with its colours.
|
|
7
|
+
*/
|
|
8
|
+
/** Whether a theme is worn under the system's light or dark appearance. */
|
|
9
|
+
export type ThemeAppearance = 'light' | 'dark';
|
|
10
|
+
/**
|
|
11
|
+
* The attribute on a page's root element that names the theme each
|
|
12
|
+
* appearance wears; the generated stylesheet's block for that theme takes
|
|
13
|
+
* over under its appearance, and the page wears the default without one.
|
|
14
|
+
*/
|
|
15
|
+
export declare const THEME_ATTRIBUTES: Readonly<Record<ThemeAppearance, string>>;
|
|
16
|
+
/**
|
|
17
|
+
* The attribute that has an element paint one theme's preview, whatever
|
|
18
|
+
* the page wears: the generated stylesheet sets that theme's preview
|
|
19
|
+
* tokens (`PREVIEW_TOKENS` in `tokens.ts`) under it, so a theme picker draws
|
|
20
|
+
* each theme's miniature by naming its id alone.
|
|
21
|
+
*/
|
|
22
|
+
export declare const THEME_PREVIEW_ATTRIBUTE = "data-theme-preview";
|
|
23
|
+
/** A theme as the list names it. */
|
|
24
|
+
export interface ThemeEntry {
|
|
25
|
+
/** Kebab-case, unique in the list, and stable: saved settings name it. */
|
|
26
|
+
readonly id: string;
|
|
27
|
+
/** The display name a theme picker shows. */
|
|
28
|
+
readonly name: string;
|
|
29
|
+
/** The appearance the theme is worn under. */
|
|
30
|
+
readonly appearance: ThemeAppearance;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Every theme, light themes first, each appearance's in the order a theme
|
|
34
|
+
* picker lists them.
|
|
35
|
+
*/
|
|
36
|
+
export declare const THEME_ENTRIES: readonly [{
|
|
37
|
+
readonly id: "catppuccin-latte";
|
|
38
|
+
readonly name: "Catppuccin Latte";
|
|
39
|
+
readonly appearance: "light";
|
|
40
|
+
}, {
|
|
41
|
+
readonly id: "github-light";
|
|
42
|
+
readonly name: "GitHub Light";
|
|
43
|
+
readonly appearance: "light";
|
|
44
|
+
}, {
|
|
45
|
+
readonly id: "gruvbox-light";
|
|
46
|
+
readonly name: "Gruvbox Light";
|
|
47
|
+
readonly appearance: "light";
|
|
48
|
+
}, {
|
|
49
|
+
readonly id: "one-light";
|
|
50
|
+
readonly name: "One Light";
|
|
51
|
+
readonly appearance: "light";
|
|
52
|
+
}, {
|
|
53
|
+
readonly id: "rose-pine-dawn";
|
|
54
|
+
readonly name: "Rosé Pine Dawn";
|
|
55
|
+
readonly appearance: "light";
|
|
56
|
+
}, {
|
|
57
|
+
readonly id: "solarized-light";
|
|
58
|
+
readonly name: "Solarized Light";
|
|
59
|
+
readonly appearance: "light";
|
|
60
|
+
}, {
|
|
61
|
+
readonly id: "tokyo-night-day";
|
|
62
|
+
readonly name: "Tokyo Night Day";
|
|
63
|
+
readonly appearance: "light";
|
|
64
|
+
}, {
|
|
65
|
+
readonly id: "catppuccin-frappe";
|
|
66
|
+
readonly name: "Catppuccin Frappé";
|
|
67
|
+
readonly appearance: "dark";
|
|
68
|
+
}, {
|
|
69
|
+
readonly id: "catppuccin-macchiato";
|
|
70
|
+
readonly name: "Catppuccin Macchiato";
|
|
71
|
+
readonly appearance: "dark";
|
|
72
|
+
}, {
|
|
73
|
+
readonly id: "catppuccin-mocha";
|
|
74
|
+
readonly name: "Catppuccin Mocha";
|
|
75
|
+
readonly appearance: "dark";
|
|
76
|
+
}, {
|
|
77
|
+
readonly id: "dracula";
|
|
78
|
+
readonly name: "Dracula";
|
|
79
|
+
readonly appearance: "dark";
|
|
80
|
+
}, {
|
|
81
|
+
readonly id: "github-dark";
|
|
82
|
+
readonly name: "GitHub Dark";
|
|
83
|
+
readonly appearance: "dark";
|
|
84
|
+
}, {
|
|
85
|
+
readonly id: "gruvbox-dark";
|
|
86
|
+
readonly name: "Gruvbox Dark";
|
|
87
|
+
readonly appearance: "dark";
|
|
88
|
+
}, {
|
|
89
|
+
readonly id: "nord";
|
|
90
|
+
readonly name: "Nord";
|
|
91
|
+
readonly appearance: "dark";
|
|
92
|
+
}, {
|
|
93
|
+
readonly id: "one-dark";
|
|
94
|
+
readonly name: "One Dark";
|
|
95
|
+
readonly appearance: "dark";
|
|
96
|
+
}, {
|
|
97
|
+
readonly id: "rose-pine";
|
|
98
|
+
readonly name: "Rosé Pine";
|
|
99
|
+
readonly appearance: "dark";
|
|
100
|
+
}, {
|
|
101
|
+
readonly id: "solarized-dark";
|
|
102
|
+
readonly name: "Solarized Dark";
|
|
103
|
+
readonly appearance: "dark";
|
|
104
|
+
}, {
|
|
105
|
+
readonly id: "tokyo-night";
|
|
106
|
+
readonly name: "Tokyo Night";
|
|
107
|
+
readonly appearance: "dark";
|
|
108
|
+
}];
|
|
109
|
+
type Entry = (typeof THEME_ENTRIES)[number];
|
|
110
|
+
/** The id of any theme of the catalog. */
|
|
111
|
+
export type ThemeId = Entry['id'];
|
|
112
|
+
/** The id of a theme worn under the light appearance. */
|
|
113
|
+
export type LightThemeId = Extract<Entry, {
|
|
114
|
+
readonly appearance: 'light';
|
|
115
|
+
}>['id'];
|
|
116
|
+
/** The id of a theme worn under the dark appearance. */
|
|
117
|
+
export type DarkThemeId = Extract<Entry, {
|
|
118
|
+
readonly appearance: 'dark';
|
|
119
|
+
}>['id'];
|
|
120
|
+
/** Every light theme's id, in the list's order. */
|
|
121
|
+
export declare const LIGHT_THEME_IDS: readonly LightThemeId[];
|
|
122
|
+
/** Every dark theme's id, in the list's order. */
|
|
123
|
+
export declare const DARK_THEME_IDS: readonly DarkThemeId[];
|
|
124
|
+
/** The theme the light appearance wears until the user picks another. */
|
|
125
|
+
export declare const DEFAULT_LIGHT_THEME_ID: LightThemeId;
|
|
126
|
+
/** The theme the dark appearance wears until the user picks another. */
|
|
127
|
+
export declare const DEFAULT_DARK_THEME_ID: DarkThemeId;
|
|
128
|
+
/** Whether `value` names a light theme of the catalog. */
|
|
129
|
+
export declare const isLightThemeId: (value: unknown) => value is LightThemeId;
|
|
130
|
+
/** Whether `value` names a dark theme of the catalog. */
|
|
131
|
+
export declare const isDarkThemeId: (value: unknown) => value is DarkThemeId;
|
|
132
|
+
/** The theme each appearance wears: one light theme and one dark theme. */
|
|
133
|
+
export interface AppearanceThemes {
|
|
134
|
+
/** The theme worn while the system appearance is light. */
|
|
135
|
+
readonly light: LightThemeId;
|
|
136
|
+
/** The theme worn while the system appearance is dark. */
|
|
137
|
+
readonly dark: DarkThemeId;
|
|
138
|
+
}
|
|
139
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The themes of the catalog by id: each one's name and the appearance it is
|
|
3
|
+
* worn under, with no colours. A theme picker, saved settings, and any code
|
|
4
|
+
* that passes a theme choice around read themes through this list; only the
|
|
5
|
+
* catalog (`catalog.ts`) holds their palettes, keyed by these ids, so code can
|
|
6
|
+
* name a theme without shipping or painting with its colours.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The attribute on a page's root element that names the theme each
|
|
10
|
+
* appearance wears; the generated stylesheet's block for that theme takes
|
|
11
|
+
* over under its appearance, and the page wears the default without one.
|
|
12
|
+
*/
|
|
13
|
+
export const THEME_ATTRIBUTES = {
|
|
14
|
+
light: 'data-light-theme',
|
|
15
|
+
dark: 'data-dark-theme'
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The attribute that has an element paint one theme's preview, whatever
|
|
19
|
+
* the page wears: the generated stylesheet sets that theme's preview
|
|
20
|
+
* tokens (`PREVIEW_TOKENS` in `tokens.ts`) under it, so a theme picker draws
|
|
21
|
+
* each theme's miniature by naming its id alone.
|
|
22
|
+
*/
|
|
23
|
+
export const THEME_PREVIEW_ATTRIBUTE = 'data-theme-preview';
|
|
24
|
+
/**
|
|
25
|
+
* Every theme, light themes first, each appearance's in the order a theme
|
|
26
|
+
* picker lists them.
|
|
27
|
+
*/
|
|
28
|
+
export const THEME_ENTRIES = [
|
|
29
|
+
{ id: 'catppuccin-latte', name: 'Catppuccin Latte', appearance: 'light' },
|
|
30
|
+
{ id: 'github-light', name: 'GitHub Light', appearance: 'light' },
|
|
31
|
+
{ id: 'gruvbox-light', name: 'Gruvbox Light', appearance: 'light' },
|
|
32
|
+
{ id: 'one-light', name: 'One Light', appearance: 'light' },
|
|
33
|
+
{ id: 'rose-pine-dawn', name: 'Rosé Pine Dawn', appearance: 'light' },
|
|
34
|
+
{ id: 'solarized-light', name: 'Solarized Light', appearance: 'light' },
|
|
35
|
+
{ id: 'tokyo-night-day', name: 'Tokyo Night Day', appearance: 'light' },
|
|
36
|
+
{ id: 'catppuccin-frappe', name: 'Catppuccin Frappé', appearance: 'dark' },
|
|
37
|
+
{ id: 'catppuccin-macchiato', name: 'Catppuccin Macchiato', appearance: 'dark' },
|
|
38
|
+
{ id: 'catppuccin-mocha', name: 'Catppuccin Mocha', appearance: 'dark' },
|
|
39
|
+
{ id: 'dracula', name: 'Dracula', appearance: 'dark' },
|
|
40
|
+
{ id: 'github-dark', name: 'GitHub Dark', appearance: 'dark' },
|
|
41
|
+
{ id: 'gruvbox-dark', name: 'Gruvbox Dark', appearance: 'dark' },
|
|
42
|
+
{ id: 'nord', name: 'Nord', appearance: 'dark' },
|
|
43
|
+
{ id: 'one-dark', name: 'One Dark', appearance: 'dark' },
|
|
44
|
+
{ id: 'rose-pine', name: 'Rosé Pine', appearance: 'dark' },
|
|
45
|
+
{ id: 'solarized-dark', name: 'Solarized Dark', appearance: 'dark' },
|
|
46
|
+
{ id: 'tokyo-night', name: 'Tokyo Night', appearance: 'dark' }
|
|
47
|
+
];
|
|
48
|
+
/** Every light theme's id, in the list's order. */
|
|
49
|
+
export const LIGHT_THEME_IDS = THEME_ENTRIES.filter((entry) => entry.appearance === 'light').map((entry) => entry.id);
|
|
50
|
+
/** Every dark theme's id, in the list's order. */
|
|
51
|
+
export const DARK_THEME_IDS = THEME_ENTRIES.filter((entry) => entry.appearance === 'dark').map((entry) => entry.id);
|
|
52
|
+
/** The theme the light appearance wears until the user picks another. */
|
|
53
|
+
export const DEFAULT_LIGHT_THEME_ID = 'catppuccin-latte';
|
|
54
|
+
/** The theme the dark appearance wears until the user picks another. */
|
|
55
|
+
export const DEFAULT_DARK_THEME_ID = 'catppuccin-mocha';
|
|
56
|
+
/** Whether `value` names a light theme of the catalog. */
|
|
57
|
+
export const isLightThemeId = (value) => LIGHT_THEME_IDS.includes(value);
|
|
58
|
+
/** Whether `value` names a dark theme of the catalog. */
|
|
59
|
+
export const isDarkThemeId = (value) => DARK_THEME_IDS.includes(value);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Themes: the theme list and its root attributes, the colour arithmetic, the
|
|
3
|
+
* palettes, the rules that derive every colour token from a palette, the
|
|
4
|
+
* stylesheet generator an app extends with tokens of its own, and the
|
|
5
|
+
* attribute helpers a page wears its themes with. The generated stylesheet
|
|
6
|
+
* itself ships inside `@bigpixelrocket/uiok/styles.css`.
|
|
7
|
+
*/
|
|
8
|
+
export { subscribeThemeChange, wearThemes } from './attributes.js';
|
|
9
|
+
export { DEFAULT_DARK_THEME, DEFAULT_LIGHT_THEME, THEMES, themeById, type GroupHue, type TerminalPalette, type Theme, type ThemePalette } from './catalog.js';
|
|
10
|
+
export { contrast, hexOf, luminance, mix, rgbOf, translucent, type Hex, type Rgb } from './color.js';
|
|
11
|
+
export { DARK_THEME_IDS, DEFAULT_DARK_THEME_ID, DEFAULT_LIGHT_THEME_ID, isDarkThemeId, isLightThemeId, LIGHT_THEME_IDS, THEME_ATTRIBUTES, THEME_ENTRIES, THEME_PREVIEW_ATTRIBUTE, type AppearanceThemes, type DarkThemeId, type LightThemeId, type ThemeAppearance, type ThemeEntry, type ThemeId } from './ids.js';
|
|
12
|
+
export { FIXED_TOKENS, PREVIEW_TOKENS, previewTokens, themeStylesheet, themeTokens, type ThemeOverrides, type ThemeStylesheetOptions, type ThemeTokenName, type ThemeTokens } from './tokens.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Themes: the theme list and its root attributes, the colour arithmetic, the
|
|
3
|
+
* palettes, the rules that derive every colour token from a palette, the
|
|
4
|
+
* stylesheet generator an app extends with tokens of its own, and the
|
|
5
|
+
* attribute helpers a page wears its themes with. The generated stylesheet
|
|
6
|
+
* itself ships inside `@bigpixelrocket/uiok/styles.css`.
|
|
7
|
+
*/
|
|
8
|
+
export { subscribeThemeChange, wearThemes } from './attributes.js';
|
|
9
|
+
export { DEFAULT_DARK_THEME, DEFAULT_LIGHT_THEME, THEMES, themeById } from './catalog.js';
|
|
10
|
+
export { contrast, hexOf, luminance, mix, rgbOf, translucent } from './color.js';
|
|
11
|
+
export { DARK_THEME_IDS, DEFAULT_DARK_THEME_ID, DEFAULT_LIGHT_THEME_ID, isDarkThemeId, isLightThemeId, LIGHT_THEME_IDS, THEME_ATTRIBUTES, THEME_ENTRIES, THEME_PREVIEW_ATTRIBUTE } from './ids.js';
|
|
12
|
+
export { FIXED_TOKENS, PREVIEW_TOKENS, previewTokens, themeStylesheet, themeTokens } from './tokens.js';
|