dssoca 0.12.0 → 0.14.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/dist/components/Kbd.svelte +120 -0
- package/dist/components/Kbd.svelte.d.ts +30 -0
- package/dist/components/SearchPalette.svelte +526 -0
- package/dist/components/SearchPalette.svelte.d.ts +82 -0
- package/dist/components/ShortcutsHelp.svelte +365 -0
- package/dist/components/ShortcutsHelp.svelte.d.ts +34 -0
- package/dist/components/Switch.svelte +32 -2
- package/dist/components/Switch.svelte.d.ts +5 -0
- package/dist/components/Topbar.svelte +39 -24
- package/dist/components/Topbar.svelte.d.ts +5 -2
- package/dist/dssoca.config.d.ts +1 -1
- package/dist/dssoca.config.js +2 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +7 -0
- package/dist/presets.d.ts +44 -0
- package/dist/presets.js +295 -0
- package/dist/shortcuts.svelte.d.ts +192 -0
- package/dist/shortcuts.svelte.js +633 -0
- package/package.json +2 -2
|
@@ -29,8 +29,11 @@ interface Props {
|
|
|
29
29
|
tabs?: Array<string | TopbarTab>;
|
|
30
30
|
/** Fired with the tab id when a tab is activated (also for `href` tabs). */
|
|
31
31
|
onTab?: (tab: string) => void;
|
|
32
|
-
/** Fired when the command menu is opened (chip click or Cmd
|
|
33
|
-
*
|
|
32
|
+
/** Fired when the command menu is opened (chip click or mod+K — Cmd+K on
|
|
33
|
+
* Apple platforms, Ctrl+K elsewhere). Registered through the shortcut
|
|
34
|
+
* registry as `ss:topbar-command` (DS-0139), so it lists in ShortcutsHelp
|
|
35
|
+
* and obeys `setEnabled`/`remap`. The ⌘K chip and the shortcut only
|
|
36
|
+
* exist when this handler is provided. */
|
|
34
37
|
onCommand?: () => void;
|
|
35
38
|
/** Fired when the user chip is activated (when no `userMenu` snippet given). */
|
|
36
39
|
onUser?: () => void;
|
package/dist/dssoca.config.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export interface Palette {
|
|
|
81
81
|
/** Size axis values — derived from the manifest (`'sm' | 'md' | 'lg'`). */
|
|
82
82
|
export type Size = (typeof dssocaConfig)['size']['values'][number];
|
|
83
83
|
/** Names of the components that accept a `size` prop / `componentsSize` entry. */
|
|
84
|
-
export declare const COMPONENT_NAMES: readonly ["Accordion", "Avatar", "Badge", "BottomNav", "Button", "Card", "Chart", "Container", "DateField", "EmptyState", "FileDrop", "Heading", "Icon", "Image", "Input", "Link", "LogStream", "Menu", "MetricTile", "Modal", "NumberField", "Pagination", "SegmentedControl", "Select", "ServiceCard", "Sidebar", "Sparkline", "Spinner", "Switch", "Table", "Textarea", "Toaster", "Tooltip", "Topbar"];
|
|
84
|
+
export declare const COMPONENT_NAMES: readonly ["Accordion", "Avatar", "Badge", "BottomNav", "Button", "Card", "Chart", "Container", "DateField", "EmptyState", "FileDrop", "Heading", "Icon", "Image", "Input", "Kbd", "Link", "LogStream", "Menu", "MetricTile", "Modal", "NumberField", "Pagination", "SearchPalette", "SegmentedControl", "Select", "ServiceCard", "Sidebar", "Sparkline", "Spinner", "Switch", "Table", "Textarea", "Toaster", "Tooltip", "Topbar"];
|
|
85
85
|
export type ComponentName = (typeof COMPONENT_NAMES)[number];
|
|
86
86
|
/** Per-component default sizes; any omitted component inherits `sizeVariant`. */
|
|
87
87
|
export type ComponentsSize = Partial<Record<ComponentName, Size>>;
|
package/dist/dssoca.config.js
CHANGED
|
@@ -85,6 +85,7 @@ export const COMPONENT_NAMES = [
|
|
|
85
85
|
'Icon',
|
|
86
86
|
'Image',
|
|
87
87
|
'Input',
|
|
88
|
+
'Kbd',
|
|
88
89
|
'Link',
|
|
89
90
|
'LogStream',
|
|
90
91
|
'Menu',
|
|
@@ -92,6 +93,7 @@ export const COMPONENT_NAMES = [
|
|
|
92
93
|
'Modal',
|
|
93
94
|
'NumberField',
|
|
94
95
|
'Pagination',
|
|
96
|
+
'SearchPalette',
|
|
95
97
|
'SegmentedControl',
|
|
96
98
|
'Select',
|
|
97
99
|
'ServiceCard',
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { type ColorTheme, type Size, type DesignConfig, defaultDesignConfig, getDesignConfig, designAttributes, applyDesignConfig, paletteToCss, paletteSlotVar, resolveComponentSize, resolveSpinnerVariant, } from './config.js';
|
|
2
2
|
export { dssocaConfig, SPINNER_VARIANT_NAMES, PALETTE_SLOTS, type DssocaConfig, type DesignAxis, type ComponentName, type ComponentsSize, type SpinnerVariant, type Palette, type ThemePalette, type PaletteSlot, } from './dssoca.config.js';
|
|
3
3
|
export { CHART_PALETTE } from './palette.js';
|
|
4
|
+
export { PRESET_THEMES, presetPalette, type PresetTheme, type PresetName } from './presets.js';
|
|
4
5
|
export { default as Icon, registerIcon, type IconName, type IconSize, } from './components/Icon.svelte';
|
|
5
6
|
export { default as Badge } from './components/Badge.svelte';
|
|
6
7
|
export { default as Button } from './components/Button.svelte';
|
|
@@ -39,8 +40,12 @@ export { default as Tooltip } from './components/Tooltip.svelte';
|
|
|
39
40
|
export { default as Avatar } from './components/Avatar.svelte';
|
|
40
41
|
export { default as Pagination } from './components/Pagination.svelte';
|
|
41
42
|
export { default as Switch } from './components/Switch.svelte';
|
|
43
|
+
export { default as SearchPalette, type SearchPaletteItem } from './components/SearchPalette.svelte';
|
|
42
44
|
export { default as ScatterPlot, type ScatterPoint } from './components/ScatterPlot.svelte';
|
|
43
45
|
export { default as BoxPlot, type BoxGroup } from './components/BoxPlot.svelte';
|
|
44
46
|
export { default as BumpChart, type BumpSeries } from './components/BumpChart.svelte';
|
|
45
47
|
export { default as Heatmap } from './components/Heatmap.svelte';
|
|
48
|
+
export { default as Kbd } from './components/Kbd.svelte';
|
|
49
|
+
export { default as ShortcutsHelp } from './components/ShortcutsHelp.svelte';
|
|
50
|
+
export { shortcuts, shortcut, formatShortcut, ariaKeyshortcuts, type ShortcutOptions, type ShortcutInfo, type ShortcutOverride, type ShortcutOverrides, type ShortcutScope, type ShortcutPlatform, type ShortcutFormat, type FormatShortcutOptions, } from './shortcuts.svelte.js';
|
|
46
51
|
export { toast, toasts, type Toast, type ToastKind, type ToastAction, type ToastOptions, type ToastPatch, type PromiseMessages, } from './toast.svelte.js';
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,8 @@ export { defaultDesignConfig, getDesignConfig, designAttributes, applyDesignConf
|
|
|
2
2
|
export { dssocaConfig, SPINNER_VARIANT_NAMES, PALETTE_SLOTS, } from './dssoca.config.js';
|
|
3
3
|
// Categorical palette shared by the chart family + Avatar (stable order/length).
|
|
4
4
|
export { CHART_PALETTE } from './palette.js';
|
|
5
|
+
// Preset terminal palettes (DS-0142): ready-made 19-slot themes.
|
|
6
|
+
export { PRESET_THEMES, presetPalette } from './presets.js';
|
|
5
7
|
export { default as Icon, registerIcon, } from './components/Icon.svelte';
|
|
6
8
|
export { default as Badge } from './components/Badge.svelte';
|
|
7
9
|
export { default as Button } from './components/Button.svelte';
|
|
@@ -43,9 +45,14 @@ export { default as Tooltip } from './components/Tooltip.svelte';
|
|
|
43
45
|
export { default as Avatar } from './components/Avatar.svelte';
|
|
44
46
|
export { default as Pagination } from './components/Pagination.svelte';
|
|
45
47
|
export { default as Switch } from './components/Switch.svelte';
|
|
48
|
+
export { default as SearchPalette } from './components/SearchPalette.svelte';
|
|
46
49
|
// geossoca stats-dashboard charts (DS-0102).
|
|
47
50
|
export { default as ScatterPlot } from './components/ScatterPlot.svelte';
|
|
48
51
|
export { default as BoxPlot } from './components/BoxPlot.svelte';
|
|
49
52
|
export { default as BumpChart } from './components/BumpChart.svelte';
|
|
50
53
|
export { default as Heatmap } from './components/Heatmap.svelte';
|
|
54
|
+
// Keyboard-shortcuts feature (DS-0135): registry core + display chip.
|
|
55
|
+
export { default as Kbd } from './components/Kbd.svelte';
|
|
56
|
+
export { default as ShortcutsHelp } from './components/ShortcutsHelp.svelte';
|
|
57
|
+
export { shortcuts, shortcut, formatShortcut, ariaKeyshortcuts, } from './shortcuts.svelte.js';
|
|
51
58
|
export { toast, toasts, } from './toast.svelte.js';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preset terminal palettes (DS-0142).
|
|
3
|
+
*
|
|
4
|
+
* Ready-made 19-slot palettes ported from well-known terminal themes — the
|
|
5
|
+
* palette architecture (DS-0125) means any terminal theme can be a website
|
|
6
|
+
* theme. Apply one at runtime or emit it as CSS:
|
|
7
|
+
*
|
|
8
|
+
* applyDesignConfig({ palette: presetPalette('dracula') })
|
|
9
|
+
* paletteToCss(presetPalette('gruvbox'))
|
|
10
|
+
*
|
|
11
|
+
* Fidelity policy: hue slots are upstream-verbatim; the neutral slots
|
|
12
|
+
* (black / white / brightBlack / brightWhite) are role-mapped onto dssoca's
|
|
13
|
+
* conventions (black = darkest ink, brightWhite = lightest surface/shine,
|
|
14
|
+
* brightBlack = muted text) using the theme's own official colors. Slots that
|
|
15
|
+
* failed the theme-builder's WCAG 2.2 AA checks were nudged along OKLCH
|
|
16
|
+
* lightness only (hue/chroma untouched) and carry an `AA-fixed` comment with
|
|
17
|
+
* the upstream value. See docs/themes.md → "Preset palettes".
|
|
18
|
+
*
|
|
19
|
+
* A preset only carries the modes its upstream actually defines (Nord has no
|
|
20
|
+
* official light variant; Coffee is a light-only theme) — `presetPalette`
|
|
21
|
+
* mirrors a single mode into both, so the theme toggle keeps the same colors.
|
|
22
|
+
*/
|
|
23
|
+
import type { Palette, ThemePalette } from './dssoca.config.js';
|
|
24
|
+
export type PresetName = 'dracula' | 'tokyo-night' | 'gruvbox' | 'nord' | 'solarized' | 'coffee';
|
|
25
|
+
export interface PresetTheme {
|
|
26
|
+
/** Slug, e.g. `'tokyo-night'`. */
|
|
27
|
+
name: PresetName;
|
|
28
|
+
/** Display name, e.g. `'Tokyo Night'`. */
|
|
29
|
+
label: string;
|
|
30
|
+
/** Signature color — swatch/seed for pickers (mirrors the palette's accent slot). */
|
|
31
|
+
accent: string;
|
|
32
|
+
/** Dark-mode slots — absent when the upstream theme has no dark variant. */
|
|
33
|
+
dark?: ThemePalette;
|
|
34
|
+
/** Light-mode slots — absent when the upstream theme has no light variant. */
|
|
35
|
+
light?: ThemePalette;
|
|
36
|
+
}
|
|
37
|
+
export declare const PRESET_THEMES: readonly PresetTheme[];
|
|
38
|
+
/**
|
|
39
|
+
* Resolve a preset (by object or slug) to a full `Palette` for
|
|
40
|
+
* `applyDesignConfig({ palette })` / `paletteToCss()`. Single-mode presets
|
|
41
|
+
* mirror their one theme into both, so flipping `data-theme` keeps the same
|
|
42
|
+
* colors. Throws on an unknown slug.
|
|
43
|
+
*/
|
|
44
|
+
export declare function presetPalette(preset: PresetTheme | PresetName): Palette;
|
package/dist/presets.js
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preset terminal palettes (DS-0142).
|
|
3
|
+
*
|
|
4
|
+
* Ready-made 19-slot palettes ported from well-known terminal themes — the
|
|
5
|
+
* palette architecture (DS-0125) means any terminal theme can be a website
|
|
6
|
+
* theme. Apply one at runtime or emit it as CSS:
|
|
7
|
+
*
|
|
8
|
+
* applyDesignConfig({ palette: presetPalette('dracula') })
|
|
9
|
+
* paletteToCss(presetPalette('gruvbox'))
|
|
10
|
+
*
|
|
11
|
+
* Fidelity policy: hue slots are upstream-verbatim; the neutral slots
|
|
12
|
+
* (black / white / brightBlack / brightWhite) are role-mapped onto dssoca's
|
|
13
|
+
* conventions (black = darkest ink, brightWhite = lightest surface/shine,
|
|
14
|
+
* brightBlack = muted text) using the theme's own official colors. Slots that
|
|
15
|
+
* failed the theme-builder's WCAG 2.2 AA checks were nudged along OKLCH
|
|
16
|
+
* lightness only (hue/chroma untouched) and carry an `AA-fixed` comment with
|
|
17
|
+
* the upstream value. See docs/themes.md → "Preset palettes".
|
|
18
|
+
*
|
|
19
|
+
* A preset only carries the modes its upstream actually defines (Nord has no
|
|
20
|
+
* official light variant; Coffee is a light-only theme) — `presetPalette`
|
|
21
|
+
* mirrors a single mode into both, so the theme toggle keeps the same colors.
|
|
22
|
+
*/
|
|
23
|
+
export const PRESET_THEMES = [
|
|
24
|
+
{
|
|
25
|
+
// Dracula — https://spec.draculatheme.com (ANSI mapping); light mode is
|
|
26
|
+
// the official Alucard Classic variant.
|
|
27
|
+
name: 'dracula',
|
|
28
|
+
label: 'Dracula',
|
|
29
|
+
accent: '#bd93f9',
|
|
30
|
+
dark: {
|
|
31
|
+
bg: '#282a36',
|
|
32
|
+
fg: '#f8f8f2',
|
|
33
|
+
accent: '#bd93f9',
|
|
34
|
+
black: '#21222c',
|
|
35
|
+
red: '#ff5555',
|
|
36
|
+
green: '#50fa7b',
|
|
37
|
+
yellow: '#f1fa8c',
|
|
38
|
+
blue: '#bd93f9',
|
|
39
|
+
magenta: '#ff79c6',
|
|
40
|
+
cyan: '#8be9fd',
|
|
41
|
+
white: '#f8f8f2',
|
|
42
|
+
brightBlack: '#7f90c4', // AA-fixed from #6272a4
|
|
43
|
+
brightRed: '#ff6e6e',
|
|
44
|
+
brightGreen: '#69ff94',
|
|
45
|
+
brightYellow: '#ffffa5',
|
|
46
|
+
brightBlue: '#d6acff',
|
|
47
|
+
brightMagenta: '#ff92df',
|
|
48
|
+
brightCyan: '#a4ffff',
|
|
49
|
+
brightWhite: '#ffffff',
|
|
50
|
+
},
|
|
51
|
+
light: {
|
|
52
|
+
bg: '#fffbeb',
|
|
53
|
+
fg: '#1f1f1f',
|
|
54
|
+
accent: '#644ac9',
|
|
55
|
+
black: '#1f1f1f',
|
|
56
|
+
red: '#cb3a2a',
|
|
57
|
+
green: '#14710a',
|
|
58
|
+
yellow: '#846e15',
|
|
59
|
+
blue: '#644ac9',
|
|
60
|
+
magenta: '#a3144d',
|
|
61
|
+
cyan: '#036a96',
|
|
62
|
+
white: '#cfcfde', // Alucard selection — soft light neutral
|
|
63
|
+
brightBlack: '#6c664b', // Alucard comment
|
|
64
|
+
brightRed: '#d74c3d',
|
|
65
|
+
brightGreen: '#198d0c',
|
|
66
|
+
brightYellow: '#9e841a',
|
|
67
|
+
brightBlue: '#7862d0',
|
|
68
|
+
brightMagenta: '#bf185a',
|
|
69
|
+
brightCyan: '#047fb4',
|
|
70
|
+
brightWhite: '#ffffff', // no Alucard neutral is lighter than bg
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
// Tokyo Night — folke/tokyonight.nvim terminal extras, Night + Day.
|
|
75
|
+
name: 'tokyo-night',
|
|
76
|
+
label: 'Tokyo Night',
|
|
77
|
+
accent: '#7aa2f7',
|
|
78
|
+
dark: {
|
|
79
|
+
bg: '#1a1b26',
|
|
80
|
+
fg: '#c0caf5',
|
|
81
|
+
accent: '#7aa2f7',
|
|
82
|
+
black: '#15161e',
|
|
83
|
+
red: '#f7768e',
|
|
84
|
+
green: '#9ece6a',
|
|
85
|
+
yellow: '#e0af68',
|
|
86
|
+
blue: '#7aa2f7',
|
|
87
|
+
magenta: '#bb9af7',
|
|
88
|
+
cyan: '#7dcfff',
|
|
89
|
+
white: '#a9b1d6',
|
|
90
|
+
brightBlack: '#7c84a7', // AA-fixed from #414868
|
|
91
|
+
brightRed: '#ff899d',
|
|
92
|
+
brightGreen: '#9fe044',
|
|
93
|
+
brightYellow: '#faba4a',
|
|
94
|
+
brightBlue: '#8db0ff',
|
|
95
|
+
brightMagenta: '#c7a9ff',
|
|
96
|
+
brightCyan: '#a4daff',
|
|
97
|
+
brightWhite: '#c0caf5',
|
|
98
|
+
},
|
|
99
|
+
light: {
|
|
100
|
+
bg: '#e1e2e7',
|
|
101
|
+
fg: '#1a3f9b', // AA-fixed from #3760bf (Day keeps its blue-ink identity)
|
|
102
|
+
accent: '#0e64ce', // AA-fixed from #2e7de9
|
|
103
|
+
black: '#1a3f9b', // AA-fixed from #3760bf — Day has no near-black neutral
|
|
104
|
+
red: '#f52a65',
|
|
105
|
+
green: '#587539',
|
|
106
|
+
yellow: '#8c6c3e',
|
|
107
|
+
blue: '#2e7de9',
|
|
108
|
+
magenta: '#9854f1',
|
|
109
|
+
cyan: '#007197',
|
|
110
|
+
white: '#b4b5b9',
|
|
111
|
+
brightBlack: '#50609d', // AA-fixed from #6172b0
|
|
112
|
+
brightRed: '#ff4774',
|
|
113
|
+
brightGreen: '#5c8524',
|
|
114
|
+
brightYellow: '#a27629',
|
|
115
|
+
brightBlue: '#358aff',
|
|
116
|
+
brightMagenta: '#a463ff',
|
|
117
|
+
brightCyan: '#007ea8',
|
|
118
|
+
brightWhite: '#e9e9ec',
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
// Gruvbox — morhetz/gruvbox. black uses the official dark0_hard so code
|
|
123
|
+
// blocks stay distinct from bg; light neutrals come from the light scale
|
|
124
|
+
// (dark0 ink, light2, light0_hard).
|
|
125
|
+
name: 'gruvbox',
|
|
126
|
+
label: 'Gruvbox',
|
|
127
|
+
accent: '#fe8019',
|
|
128
|
+
dark: {
|
|
129
|
+
bg: '#282828',
|
|
130
|
+
fg: '#ebdbb2',
|
|
131
|
+
accent: '#fe8019',
|
|
132
|
+
black: '#1d2021',
|
|
133
|
+
red: '#d73128', // AA-fixed from #cc241d
|
|
134
|
+
green: '#98971a',
|
|
135
|
+
yellow: '#d79921',
|
|
136
|
+
blue: '#458588',
|
|
137
|
+
magenta: '#b16286',
|
|
138
|
+
cyan: '#689d6a',
|
|
139
|
+
white: '#a89984',
|
|
140
|
+
brightBlack: '#9b8c7d', // AA-fixed from #928374
|
|
141
|
+
brightRed: '#fb4934',
|
|
142
|
+
brightGreen: '#b8bb26',
|
|
143
|
+
brightYellow: '#fabd2f',
|
|
144
|
+
brightBlue: '#83a598',
|
|
145
|
+
brightMagenta: '#d3869b',
|
|
146
|
+
brightCyan: '#8ec07c',
|
|
147
|
+
brightWhite: '#ebdbb2',
|
|
148
|
+
},
|
|
149
|
+
light: {
|
|
150
|
+
bg: '#fbf1c7',
|
|
151
|
+
fg: '#3c3836',
|
|
152
|
+
accent: '#af3a03', // official light-mode (faded) orange
|
|
153
|
+
black: '#282828',
|
|
154
|
+
red: '#cc241d',
|
|
155
|
+
green: '#8f8e03', // AA-fixed from #98971a
|
|
156
|
+
yellow: '#b67f00', // AA-fixed from #d79921
|
|
157
|
+
blue: '#458588',
|
|
158
|
+
magenta: '#b16286',
|
|
159
|
+
cyan: '#629764', // AA-fixed from #689d6a
|
|
160
|
+
white: '#d5c4a1',
|
|
161
|
+
brightBlack: '#77695a', // AA-fixed from #928374
|
|
162
|
+
brightRed: '#9d0006',
|
|
163
|
+
brightGreen: '#79740e',
|
|
164
|
+
brightYellow: '#b57614',
|
|
165
|
+
brightBlue: '#076678',
|
|
166
|
+
brightMagenta: '#8f3f71',
|
|
167
|
+
brightCyan: '#427b58',
|
|
168
|
+
brightWhite: '#f9f5d7',
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
// Nord — nordtheme.com terminal spec. Dark only: Nord has no official
|
|
173
|
+
// light variant. Accent = nord8, the docs' "primary UI" color.
|
|
174
|
+
name: 'nord',
|
|
175
|
+
label: 'Nord',
|
|
176
|
+
accent: '#88c0d0',
|
|
177
|
+
dark: {
|
|
178
|
+
bg: '#2e3440',
|
|
179
|
+
fg: '#d8dee9',
|
|
180
|
+
accent: '#88c0d0',
|
|
181
|
+
black: '#3b4252',
|
|
182
|
+
red: '#bf616a',
|
|
183
|
+
green: '#a3be8c',
|
|
184
|
+
yellow: '#ebcb8b',
|
|
185
|
+
blue: '#81a1c1',
|
|
186
|
+
magenta: '#b48ead',
|
|
187
|
+
cyan: '#88c0d0',
|
|
188
|
+
white: '#e5e9f0',
|
|
189
|
+
brightBlack: '#919cb3', // AA-fixed from #4c566a
|
|
190
|
+
brightRed: '#bf616a',
|
|
191
|
+
brightGreen: '#a3be8c',
|
|
192
|
+
brightYellow: '#ebcb8b',
|
|
193
|
+
brightBlue: '#81a1c1',
|
|
194
|
+
brightMagenta: '#b48ead',
|
|
195
|
+
brightCyan: '#8fbcbb',
|
|
196
|
+
brightWhite: '#eceff4',
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
// Solarized — Ethan Schoonover's official ANSI mapping. brightBlack is
|
|
201
|
+
// role-mapped to base01/base1 (the designated secondary-content tones; the
|
|
202
|
+
// ANSI mapping's own brightBlack equals the bg). The base-tone bright hues
|
|
203
|
+
// stay upstream-verbatim — dssoca's semantic layer never reads them.
|
|
204
|
+
name: 'solarized',
|
|
205
|
+
label: 'Solarized',
|
|
206
|
+
accent: '#3294dc', // AA-fixed from #268bd2 (mirrors the dark accent slot)
|
|
207
|
+
dark: {
|
|
208
|
+
bg: '#002b36',
|
|
209
|
+
fg: '#a5b6b8', // AA-fixed from #839496
|
|
210
|
+
accent: '#3294dc', // AA-fixed from #268bd2
|
|
211
|
+
black: '#073642',
|
|
212
|
+
red: '#dc322f',
|
|
213
|
+
green: '#859900',
|
|
214
|
+
yellow: '#b58900',
|
|
215
|
+
blue: '#268bd2',
|
|
216
|
+
magenta: '#d33682',
|
|
217
|
+
cyan: '#2aa198',
|
|
218
|
+
white: '#eee8d5',
|
|
219
|
+
brightBlack: '#7b9299', // AA-fixed from #586e75 (base01)
|
|
220
|
+
brightRed: '#cb4b16',
|
|
221
|
+
brightGreen: '#586e75',
|
|
222
|
+
brightYellow: '#657b83',
|
|
223
|
+
brightBlue: '#839496',
|
|
224
|
+
brightMagenta: '#6c71c4',
|
|
225
|
+
brightCyan: '#93a1a1',
|
|
226
|
+
brightWhite: '#fdf6e3',
|
|
227
|
+
},
|
|
228
|
+
light: {
|
|
229
|
+
bg: '#fdf6e3',
|
|
230
|
+
fg: '#42575e', // AA-fixed from #586e75
|
|
231
|
+
accent: '#097cc1', // AA-fixed from #268bd2
|
|
232
|
+
black: '#073642',
|
|
233
|
+
red: '#dc322f',
|
|
234
|
+
green: '#829600', // AA-fixed from #859900
|
|
235
|
+
yellow: '#b18600', // AA-fixed from #b58900
|
|
236
|
+
blue: '#268bd2',
|
|
237
|
+
magenta: '#d33682',
|
|
238
|
+
cyan: '#259e95', // AA-fixed from #2aa198
|
|
239
|
+
white: '#eee8d5',
|
|
240
|
+
brightBlack: '#647171', // AA-fixed from #93a1a1 (base1)
|
|
241
|
+
brightRed: '#cb4b16',
|
|
242
|
+
brightGreen: '#586e75',
|
|
243
|
+
brightYellow: '#657b83',
|
|
244
|
+
brightBlue: '#839496',
|
|
245
|
+
brightMagenta: '#6c71c4',
|
|
246
|
+
brightCyan: '#93a1a1',
|
|
247
|
+
brightWhite: '#ffffff', // no Solarized neutral is lighter than base3
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
// Coffee — the author's site theme (custom; no upstream). Light only:
|
|
252
|
+
// warm ANSI hues derived from the site's brown accent with the mono
|
|
253
|
+
// palette math, anchored to the site's cream bg / black text.
|
|
254
|
+
name: 'coffee',
|
|
255
|
+
label: 'Coffee',
|
|
256
|
+
accent: '#6a461e',
|
|
257
|
+
light: {
|
|
258
|
+
bg: '#f9dec9',
|
|
259
|
+
fg: '#000000',
|
|
260
|
+
accent: '#6a461e',
|
|
261
|
+
black: '#1a1511',
|
|
262
|
+
red: '#856662',
|
|
263
|
+
green: '#6c7055',
|
|
264
|
+
yellow: '#6b6349',
|
|
265
|
+
blue: '#746780',
|
|
266
|
+
magenta: '#84656d',
|
|
267
|
+
cyan: '#5b735f',
|
|
268
|
+
white: '#d9d7d5',
|
|
269
|
+
brightBlack: '#595450',
|
|
270
|
+
brightRed: '#75544f',
|
|
271
|
+
brightGreen: '#5c6143',
|
|
272
|
+
brightYellow: '#585032',
|
|
273
|
+
brightBlue: '#655772',
|
|
274
|
+
brightMagenta: '#74535b',
|
|
275
|
+
brightCyan: '#4b6550',
|
|
276
|
+
brightWhite: '#fdfbfa',
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
];
|
|
280
|
+
/**
|
|
281
|
+
* Resolve a preset (by object or slug) to a full `Palette` for
|
|
282
|
+
* `applyDesignConfig({ palette })` / `paletteToCss()`. Single-mode presets
|
|
283
|
+
* mirror their one theme into both, so flipping `data-theme` keeps the same
|
|
284
|
+
* colors. Throws on an unknown slug.
|
|
285
|
+
*/
|
|
286
|
+
export function presetPalette(preset) {
|
|
287
|
+
const resolved = typeof preset === 'string' ? PRESET_THEMES.find((p) => p.name === preset) : preset;
|
|
288
|
+
if (!resolved)
|
|
289
|
+
throw new Error(`dssoca: unknown preset theme '${String(preset)}'`);
|
|
290
|
+
const dark = resolved.dark ?? resolved.light;
|
|
291
|
+
const light = resolved.light ?? resolved.dark;
|
|
292
|
+
if (!dark || !light)
|
|
293
|
+
throw new Error(`dssoca: preset '${resolved.name}' has no palette`);
|
|
294
|
+
return { dark: { ...dark }, light: { ...light } };
|
|
295
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import type { Attachment } from 'svelte/attachments';
|
|
2
|
+
/** Where a shortcut listens: everywhere, or only while focus is inside the attached element. */
|
|
3
|
+
export type ShortcutScope = 'global' | 'focus';
|
|
4
|
+
/** Modifier rendering family: Apple (⌘/⌥) vs everything else (Ctrl/Alt). */
|
|
5
|
+
export type ShortcutPlatform = 'apple' | 'other';
|
|
6
|
+
/** Presentation style for `formatShortcut`. */
|
|
7
|
+
export type ShortcutFormat = 'glyph' | 'label';
|
|
8
|
+
export interface ShortcutOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Stable unique identifier — the handle for `setEnabled` / `remap` and the
|
|
11
|
+
* key under which overrides persist. dssoca-owned shortcuts use the `ss:*`
|
|
12
|
+
* namespace; apps should pick their own prefix.
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
/** Human-readable action name (shown by ShortcutsHelp, read by AT). */
|
|
16
|
+
label: string;
|
|
17
|
+
/**
|
|
18
|
+
* Key combo(s): `+`-joined modifiers (`mod`|`ctrl`|`alt`|`shift`|`meta`)
|
|
19
|
+
* plus exactly one key (lowercased `event.key`: `k`, `?`, `escape`,
|
|
20
|
+
* `arrowup`, `f1`). `mod` resolves to `meta` on Apple platforms and `ctrl`
|
|
21
|
+
* elsewhere. Comma separates alternatives (`'?, mod+/'`). Space is
|
|
22
|
+
* reserved (sequences are a parse error). Malformed input throws at
|
|
23
|
+
* registration time.
|
|
24
|
+
*/
|
|
25
|
+
keys: string;
|
|
26
|
+
/** Invoked when the shortcut fires (after `preventDefault` unless opted out). */
|
|
27
|
+
onPress: (event: KeyboardEvent) => void;
|
|
28
|
+
/** Optional grouping label for display (ShortcutsHelp sections). */
|
|
29
|
+
group?: string;
|
|
30
|
+
/**
|
|
31
|
+
* `'global'` (default) listens on `window`; `'focus'` only fires while the
|
|
32
|
+
* event target is inside the attached element — use via the `shortcut()`
|
|
33
|
+
* attachment (a focus-scoped shortcut without an element never fires).
|
|
34
|
+
*/
|
|
35
|
+
scope?: ShortcutScope;
|
|
36
|
+
/**
|
|
37
|
+
* Contextual availability gate owned by the registering code. A user-level
|
|
38
|
+
* `setEnabled(id, false)` override additionally silences the shortcut; the
|
|
39
|
+
* shortcut fires only when *both* agree.
|
|
40
|
+
*/
|
|
41
|
+
enabled?: boolean | (() => boolean);
|
|
42
|
+
/** Fire even when typing in inputs/textareas/selects/contenteditable. */
|
|
43
|
+
allowInInputs?: boolean;
|
|
44
|
+
/** Fire on held-key auto-repeat events. */
|
|
45
|
+
allowRepeat?: boolean;
|
|
46
|
+
/** Call `event.preventDefault()` before `onPress`. Default `true`. */
|
|
47
|
+
preventDefault?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/** Read-only view of a registered shortcut (feeds ShortcutsHelp). */
|
|
50
|
+
export interface ShortcutInfo {
|
|
51
|
+
id: string;
|
|
52
|
+
label: string;
|
|
53
|
+
group?: string;
|
|
54
|
+
scope: ShortcutScope;
|
|
55
|
+
/** Effective canonical combo — the remap override when one is set. */
|
|
56
|
+
keys: string;
|
|
57
|
+
/** Canonical combo as registered (what `remap(id, null)` restores). */
|
|
58
|
+
defaultKeys: string;
|
|
59
|
+
/** Effective state: user override AND the registration's own `enabled`. */
|
|
60
|
+
enabled: boolean;
|
|
61
|
+
}
|
|
62
|
+
/** Per-shortcut user override (both fields optional and independent). */
|
|
63
|
+
export interface ShortcutOverride {
|
|
64
|
+
enabled?: boolean;
|
|
65
|
+
/** Canonical remapped combo string. */
|
|
66
|
+
keys?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Serializable snapshot of every user-facing shortcut setting — including the
|
|
70
|
+
* global `enabled` / `characterKeys` toggles (WCAG 2.1.4 compliance that
|
|
71
|
+
* resets every visit isn't compliance). Persist it wherever your app keeps
|
|
72
|
+
* preferences and feed it back through `applyOverrides`.
|
|
73
|
+
*/
|
|
74
|
+
export interface ShortcutOverrides {
|
|
75
|
+
enabled?: boolean;
|
|
76
|
+
characterKeys?: boolean;
|
|
77
|
+
shortcuts?: Record<string, ShortcutOverride>;
|
|
78
|
+
}
|
|
79
|
+
export interface FormatShortcutOptions {
|
|
80
|
+
/** `'glyph'` (default): `⌘K` / `Ctrl+K`. `'label'`: `Command+K` / `Ctrl+K`. */
|
|
81
|
+
format?: ShortcutFormat;
|
|
82
|
+
/** Defaults to the detected platform. */
|
|
83
|
+
platform?: ShortcutPlatform;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Canonical combo string for a captured keydown — feeds the editable
|
|
87
|
+
* ShortcutsHelp recorder. Modifier-only presses return `null` (the user is
|
|
88
|
+
* mid-chord; keep waiting). Shifted printables keep the produced character
|
|
89
|
+
* (`?`, never `shift+/`), matching the matcher's shift rule. The result may
|
|
90
|
+
* still fail `parseKeys` (e.g. the space key) — recorders validate via
|
|
91
|
+
* `remap`. File-level export — not part of the public barrel surface.
|
|
92
|
+
*/
|
|
93
|
+
export declare function comboFromEvent(event: KeyboardEvent): string | null;
|
|
94
|
+
/**
|
|
95
|
+
* Whether any alternative in `keys` is a combo the browser/OS reserves for
|
|
96
|
+
* tab/window control. Registration merely dev-warns (`warnReservedCombos`);
|
|
97
|
+
* the ShortcutsHelp recorder rejects these outright. Accepts the literal
|
|
98
|
+
* `ctrl+`/`meta+` forms a recorded event produces as well as `mod+`
|
|
99
|
+
* spellings. Throws on malformed input (same grammar as registration).
|
|
100
|
+
* File-level export — not part of the public barrel surface.
|
|
101
|
+
*/
|
|
102
|
+
export declare function isReservedCombo(keys: string): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Detected modifier-rendering platform. File-level export for `<Kbd>`'s
|
|
105
|
+
* client-side correction effect — not part of the public barrel surface.
|
|
106
|
+
*/
|
|
107
|
+
export declare function detectPlatform(): ShortcutPlatform;
|
|
108
|
+
/**
|
|
109
|
+
* Module-singleton keyboard-shortcut registry (Svelte 5 runes; house pattern
|
|
110
|
+
* of `toast.svelte.ts`). One lazy `window` keydown listener (bubble phase)
|
|
111
|
+
* serves every registration: attached on the first browser-side `add()`,
|
|
112
|
+
* detached when the registry empties. Exactly one shortcut fires per event —
|
|
113
|
+
* focus-scoped beats global, last-registered wins within a tier.
|
|
114
|
+
*
|
|
115
|
+
* The class is intentionally NOT exported: a second instance would break the
|
|
116
|
+
* "exactly one fires" guarantee. Use the `shortcuts` singleton.
|
|
117
|
+
*/
|
|
118
|
+
declare class ShortcutRegistry {
|
|
119
|
+
#private;
|
|
120
|
+
/** Global kill switch (WCAG 2.1.4 "turn off"). */
|
|
121
|
+
enabled: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* When `false`, modifier-less ("character key") bindings never fire — the
|
|
124
|
+
* GitHub-style WCAG 2.1.4 switch. `mod+`/`ctrl+`/`alt+` combos are unaffected.
|
|
125
|
+
*/
|
|
126
|
+
characterKeys: boolean;
|
|
127
|
+
/** Reactive read-only list of registered shortcuts, registration order. */
|
|
128
|
+
readonly items: readonly ShortcutInfo[];
|
|
129
|
+
/**
|
|
130
|
+
* Register a shortcut; returns an idempotent disposer. Throws on a
|
|
131
|
+
* malformed `keys` string. On the server (no `window`) this is a full
|
|
132
|
+
* no-op that returns a working noop disposer.
|
|
133
|
+
*
|
|
134
|
+
* The optional `element` is supplied by the `shortcut()` attachment and
|
|
135
|
+
* anchors `scope: 'focus'` registrations.
|
|
136
|
+
*/
|
|
137
|
+
add(options: ShortcutOptions, element?: Element): () => void;
|
|
138
|
+
/** User-level enable/disable override for one shortcut (persists in overrides). */
|
|
139
|
+
setEnabled(id: string, enabled: boolean): void;
|
|
140
|
+
/**
|
|
141
|
+
* Rebind a shortcut to new keys (parsed/validated immediately — throws on
|
|
142
|
+
* malformed input). `remap(id, null)` removes the override, restoring the
|
|
143
|
+
* registered default.
|
|
144
|
+
*/
|
|
145
|
+
remap(id: string, keys: string | null): void;
|
|
146
|
+
/** Serializable snapshot of the global toggles + every per-id override. */
|
|
147
|
+
getOverrides(): ShortcutOverrides;
|
|
148
|
+
/**
|
|
149
|
+
* Merge a persisted overrides snapshot back in. Overrides for ids that are
|
|
150
|
+
* not (yet) registered are kept and take effect when the shortcut mounts.
|
|
151
|
+
* Malformed persisted combos are skipped with a dev warning (stale storage
|
|
152
|
+
* must not crash the app).
|
|
153
|
+
*/
|
|
154
|
+
applyOverrides(overrides: ShortcutOverrides): void;
|
|
155
|
+
/** Clear every per-id override and restore the global toggles to defaults. */
|
|
156
|
+
resetOverrides(): void;
|
|
157
|
+
}
|
|
158
|
+
/** The one app-wide shortcut registry. */
|
|
159
|
+
export declare const shortcuts: ShortcutRegistry;
|
|
160
|
+
/**
|
|
161
|
+
* `{@attach}` sugar over `shortcuts.add()`: registers on mount, cleans up on
|
|
162
|
+
* unmount, and re-registers reactively when a thunk's dependencies change.
|
|
163
|
+
* The attached element anchors `scope: 'focus'` shortcuts (they only fire
|
|
164
|
+
* while the event target is inside it).
|
|
165
|
+
*
|
|
166
|
+
* ```svelte
|
|
167
|
+
* <section {@attach shortcut(() => ({ id: 'app:save', label: 'Save', keys: 'mod+s', onPress: save }))}>
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export declare function shortcut(options: ShortcutOptions | (() => ShortcutOptions)): Attachment;
|
|
171
|
+
/**
|
|
172
|
+
* Structured form behind `formatShortcut`: one keycap-string array per
|
|
173
|
+
* comma-alternative (`'?, mod+/'` on other → `[['?'], ['Ctrl', '/']]`).
|
|
174
|
+
* File-level export so `<Kbd>` can render one `<kbd>` per key without
|
|
175
|
+
* re-deriving the glyph/label tables — not part of the public barrel surface.
|
|
176
|
+
* Throws on malformed input (same grammar as registration).
|
|
177
|
+
*/
|
|
178
|
+
export declare function formatShortcutParts(keys: string, options?: FormatShortcutOptions): string[][];
|
|
179
|
+
/**
|
|
180
|
+
* Human-readable rendering of a combo string, for `<Kbd>`-style display.
|
|
181
|
+
* Alternatives are joined with ` / `. Apple glyphs concatenate (`⌘K`, the
|
|
182
|
+
* macOS convention); everything else joins with `+` (`Ctrl+K`). Throws on
|
|
183
|
+
* malformed input (same grammar as registration).
|
|
184
|
+
*/
|
|
185
|
+
export declare function formatShortcut(keys: string, options?: FormatShortcutOptions): string;
|
|
186
|
+
/**
|
|
187
|
+
* The combo in `aria-keyshortcuts` spec syntax (`Meta+K`), with `mod`
|
|
188
|
+
* resolved for the given (default: detected) platform. Alternatives are
|
|
189
|
+
* space-separated per the spec. Throws on malformed input.
|
|
190
|
+
*/
|
|
191
|
+
export declare function ariaKeyshortcuts(keys: string, platform?: ShortcutPlatform): string;
|
|
192
|
+
export {};
|