dssoca 0.13.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/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;
@@ -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.13.0",
3
+ "version": "0.14.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",