dssoca 0.13.0 → 0.15.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/Modal.svelte +39 -0
- package/dist/components/Modal.svelte.d.ts +8 -0
- package/dist/components/Tooltip.svelte +18 -3
- package/dist/components/Tooltip.svelte.d.ts +8 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/presets.d.ts +44 -0
- package/dist/presets.js +295 -0
- package/package.json +1 -1
|
@@ -25,6 +25,14 @@
|
|
|
25
25
|
title?: string
|
|
26
26
|
/** Token size (sm|md|lg); controls max-width. Inherits the global size when unset. */
|
|
27
27
|
size?: Size
|
|
28
|
+
/**
|
|
29
|
+
* Fill the viewport instead of rendering a centred, capped panel (DS-0145).
|
|
30
|
+
* The size axis no longer affects width, and — since the panel is full-bleed —
|
|
31
|
+
* there is no backdrop left to click, so `closeOnBackdrop` is unreachable:
|
|
32
|
+
* the close button and Esc are the exits. Drive responsiveness from the
|
|
33
|
+
* caller (`fullscreen={width < 640}`). @default false
|
|
34
|
+
*/
|
|
35
|
+
fullscreen?: boolean
|
|
28
36
|
/** Clicking the backdrop (outside the panel) closes the modal. @default true */
|
|
29
37
|
closeOnBackdrop?: boolean
|
|
30
38
|
/** Esc closes the modal. When false, Esc is swallowed (cancel prevented). @default true */
|
|
@@ -47,6 +55,7 @@
|
|
|
47
55
|
open = $bindable(false),
|
|
48
56
|
title,
|
|
49
57
|
size,
|
|
58
|
+
fullscreen = false,
|
|
50
59
|
closeOnBackdrop = true,
|
|
51
60
|
closeOnEsc = true,
|
|
52
61
|
danger = false,
|
|
@@ -97,6 +106,7 @@
|
|
|
97
106
|
class="ss-modal"
|
|
98
107
|
class:danger
|
|
99
108
|
data-size-variant={resolveComponentSize('Modal', size)}
|
|
109
|
+
data-fullscreen={fullscreen ? '' : undefined}
|
|
100
110
|
aria-labelledby={title ? titleId : undefined}
|
|
101
111
|
aria-label={title ? undefined : ariaLabel}
|
|
102
112
|
onclose={onDialogClose}
|
|
@@ -148,6 +158,20 @@
|
|
|
148
158
|
.ss-modal[data-size-variant=lg] {
|
|
149
159
|
--ss-modal-w: 48rem;
|
|
150
160
|
}
|
|
161
|
+
.ss-modal[data-fullscreen] {
|
|
162
|
+
width: 100vw;
|
|
163
|
+
height: 100vh;
|
|
164
|
+
max-width: none;
|
|
165
|
+
max-height: none;
|
|
166
|
+
margin: 0;
|
|
167
|
+
border: 0;
|
|
168
|
+
}
|
|
169
|
+
@supports (height: 100dvh) {
|
|
170
|
+
.ss-modal[data-fullscreen] {
|
|
171
|
+
width: 100dvw;
|
|
172
|
+
height: 100dvh;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
151
175
|
|
|
152
176
|
.panel {
|
|
153
177
|
display: flex;
|
|
@@ -155,6 +179,21 @@
|
|
|
155
179
|
max-height: inherit;
|
|
156
180
|
}
|
|
157
181
|
|
|
182
|
+
.ss-modal[data-fullscreen] .panel {
|
|
183
|
+
height: 100%;
|
|
184
|
+
max-height: none;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.ss-modal[data-fullscreen] .head,
|
|
188
|
+
.ss-modal[data-fullscreen] .foot {
|
|
189
|
+
flex: none;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.ss-modal[data-fullscreen] .body {
|
|
193
|
+
flex: 1 1 auto;
|
|
194
|
+
min-height: 0;
|
|
195
|
+
}
|
|
196
|
+
|
|
158
197
|
.head {
|
|
159
198
|
display: flex;
|
|
160
199
|
align-items: center;
|
|
@@ -7,6 +7,14 @@ interface Props {
|
|
|
7
7
|
title?: string;
|
|
8
8
|
/** Token size (sm|md|lg); controls max-width. Inherits the global size when unset. */
|
|
9
9
|
size?: Size;
|
|
10
|
+
/**
|
|
11
|
+
* Fill the viewport instead of rendering a centred, capped panel (DS-0145).
|
|
12
|
+
* The size axis no longer affects width, and — since the panel is full-bleed —
|
|
13
|
+
* there is no backdrop left to click, so `closeOnBackdrop` is unreachable:
|
|
14
|
+
* the close button and Esc are the exits. Drive responsiveness from the
|
|
15
|
+
* caller (`fullscreen={width < 640}`). @default false
|
|
16
|
+
*/
|
|
17
|
+
fullscreen?: boolean;
|
|
10
18
|
/** Clicking the backdrop (outside the panel) closes the modal. @default true */
|
|
11
19
|
closeOnBackdrop?: boolean;
|
|
12
20
|
/** Esc closes the modal. When false, Esc is swallowed (cancel prevented). @default true */
|
|
@@ -6,8 +6,14 @@
|
|
|
6
6
|
type Placement = 'top' | 'bottom' | 'left' | 'right'
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Tooltip content (the accessible description of the trigger): a plain string, or a
|
|
11
|
+
* snippet for a small rendered template. Snippets must stay **phrasing content**
|
|
12
|
+
* (`code`, `strong`, `kbd`, `br`, `Icon`, …) and must not contain interactive
|
|
13
|
+
* elements — the tip is `pointer-events: none` and hidden while closed, per the
|
|
14
|
+
* WAI-ARIA tooltip pattern.
|
|
15
|
+
*/
|
|
16
|
+
text: string | Snippet
|
|
11
17
|
/** Where the tooltip attaches relative to the trigger. Default `top`. */
|
|
12
18
|
placement?: Placement
|
|
13
19
|
/** Token size (sm|md|lg); inherits the global size when unset. */
|
|
@@ -36,6 +42,9 @@
|
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
const sizeAttr = $derived(resolveComponentSize('Tooltip', size))
|
|
45
|
+
|
|
46
|
+
// Snippets are functions, so a runtime typeof check narrows the union.
|
|
47
|
+
const tipSnippet = $derived(typeof text === 'function' ? text : undefined)
|
|
39
48
|
</script>
|
|
40
49
|
|
|
41
50
|
<!--
|
|
@@ -44,6 +53,9 @@
|
|
|
44
53
|
tooltip; Escape dismisses it. While open the wrapper carries aria-describedby
|
|
45
54
|
pointing at the tooltip; the tip itself is kept in the DOM but hidden (and
|
|
46
55
|
given `hidden`) when closed so it is never announced.
|
|
56
|
+
|
|
57
|
+
`text` is either a string or a snippet (DS-0144); a snippet renders inside the
|
|
58
|
+
same tip element, so the accessible description stays whatever the tip contains.
|
|
47
59
|
-->
|
|
48
60
|
<!-- svelte-ignore a11y_no_static_element_interactions -- the wrapper is a passive
|
|
49
61
|
container; the real interactive element is the trigger snippet inside it, and the
|
|
@@ -60,7 +72,9 @@
|
|
|
60
72
|
onkeydown={onKeydown}
|
|
61
73
|
>
|
|
62
74
|
<span class="trigger">{@render children()}</span>
|
|
63
|
-
<span id={tipId} class="tip" class:open role="tooltip" hidden={!open}>
|
|
75
|
+
<span id={tipId} class="tip" class:open role="tooltip" hidden={!open}>
|
|
76
|
+
{#if tipSnippet}{@render tipSnippet()}{:else}{text}{/if}
|
|
77
|
+
</span>
|
|
64
78
|
</span>
|
|
65
79
|
|
|
66
80
|
<style>.ss-tooltip {
|
|
@@ -75,6 +89,7 @@
|
|
|
75
89
|
.tip {
|
|
76
90
|
position: absolute;
|
|
77
91
|
z-index: 60;
|
|
92
|
+
display: block;
|
|
78
93
|
width: max-content;
|
|
79
94
|
max-width: var(--ss-tooltip-max-w, 240px);
|
|
80
95
|
padding: var(--ss-tooltip-py, 4px) var(--ss-tooltip-px, 8px);
|
|
@@ -3,8 +3,14 @@ import { type Size } from '../config.js';
|
|
|
3
3
|
/** Side the tooltip attaches to relative to the trigger. */
|
|
4
4
|
type Placement = 'top' | 'bottom' | 'left' | 'right';
|
|
5
5
|
interface Props {
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Tooltip content (the accessible description of the trigger): a plain string, or a
|
|
8
|
+
* snippet for a small rendered template. Snippets must stay **phrasing content**
|
|
9
|
+
* (`code`, `strong`, `kbd`, `br`, `Icon`, …) and must not contain interactive
|
|
10
|
+
* elements — the tip is `pointer-events: none` and hidden while closed, per the
|
|
11
|
+
* WAI-ARIA tooltip pattern.
|
|
12
|
+
*/
|
|
13
|
+
text: string | Snippet;
|
|
8
14
|
/** Where the tooltip attaches relative to the trigger. Default `top`. */
|
|
9
15
|
placement?: Placement;
|
|
10
16
|
/** Token size (sm|md|lg); inherits the global size when unset. */
|
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';
|
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';
|
|
@@ -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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dssoca",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Svelte 5 design system — signal green on near-black, monospace-forward, zero border-radius; configured along two axes (color: dark/light, density: comfy/compact).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Rafael Passoca",
|