dssoca 0.1.0 → 0.5.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/README.md +54 -18
- package/dist/components/Badge.svelte +43 -3
- package/dist/components/Badge.svelte.d.ts +3 -0
- package/dist/components/Button.svelte +46 -2
- package/dist/components/Button.svelte.d.ts +3 -0
- package/dist/components/Card.svelte +41 -5
- package/dist/components/Card.svelte.d.ts +5 -0
- package/dist/components/EmptyState.svelte +45 -34
- package/dist/components/EmptyState.svelte.d.ts +5 -0
- package/dist/components/Icon.svelte +17 -4
- package/dist/components/Icon.svelte.d.ts +7 -1
- package/dist/components/Input.svelte +58 -5
- package/dist/components/Input.svelte.d.ts +7 -0
- package/dist/components/LogStream.svelte +43 -2
- package/dist/components/LogStream.svelte.d.ts +3 -0
- package/dist/components/MetricTile.svelte +45 -3
- package/dist/components/MetricTile.svelte.d.ts +3 -0
- package/dist/components/ServiceCard.svelte +71 -6
- package/dist/components/ServiceCard.svelte.d.ts +3 -0
- package/dist/components/Sidebar.svelte +60 -5
- package/dist/components/Sidebar.svelte.d.ts +3 -0
- package/dist/components/Sparkline.svelte +26 -2
- package/dist/components/Sparkline.svelte.d.ts +5 -0
- package/dist/components/Toaster.svelte +91 -59
- package/dist/components/Toaster.svelte.d.ts +6 -16
- package/dist/components/Topbar.svelte +131 -6
- package/dist/components/Topbar.svelte.d.ts +3 -0
- package/dist/config.d.ts +32 -14
- package/dist/config.js +43 -17
- package/dist/dssoca.config.d.ts +50 -0
- package/dist/dssoca.config.js +39 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/theme.css +460 -497
- package/package.json +17 -3
- package/dist/components/PassocaMark.svelte +0 -15
- package/dist/components/PassocaMark.svelte.d.ts +0 -7
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import { resolveComponentSize, type Size } from '../config.js'
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
5
|
active?: string
|
|
6
6
|
user?: string
|
|
7
7
|
tabs?: string[]
|
|
8
8
|
onTab?: (tab: string) => void
|
|
9
|
+
/** Token size (sm|md|lg); inherits the global size when unset. */
|
|
10
|
+
size?: Size
|
|
9
11
|
}
|
|
10
12
|
let {
|
|
11
13
|
active = 'overview',
|
|
12
14
|
user = 'rafael@hub.home',
|
|
13
15
|
tabs = ['overview', 'services', 'logs', 'shell'],
|
|
14
16
|
onTab,
|
|
17
|
+
size,
|
|
15
18
|
}: Props = $props()
|
|
16
19
|
|
|
17
20
|
function pad(n: number) { return String(n).padStart(2, '0') }
|
|
@@ -29,32 +32,154 @@
|
|
|
29
32
|
const [h, m, s] = $derived(clock.split(':'))
|
|
30
33
|
</script>
|
|
31
34
|
|
|
32
|
-
<div class="
|
|
35
|
+
<div class="ss-topbar" data-size-variant={resolveComponentSize('Topbar', size)}>
|
|
33
36
|
<div class="seg logo">
|
|
34
|
-
<
|
|
37
|
+
<svg class="mark" viewBox="0 0 103 89" fill="var(--ss-primary)" width="14" height="14" aria-hidden="true">
|
|
38
|
+
<path
|
|
39
|
+
fill-rule="evenodd"
|
|
40
|
+
clip-rule="evenodd"
|
|
41
|
+
d="M51.5 0L0 89H103L51.5 0ZM23.8643 80.151H87.6468L71.6884 52.5724L23.8643 80.151ZM65.5911 42.0354L60.7383 33.649L46.1956 42.0354H65.5911ZM56.14 25.7024L51.5 17.6837L42.2125 33.7339L56.14 25.7024ZM32.0977 51.2138L20.2949 71.6111L55.6656 51.2138H32.0977Z"
|
|
42
|
+
/>
|
|
43
|
+
</svg>
|
|
35
44
|
<span class="nm">hubssoca</span>
|
|
36
45
|
</div>
|
|
37
46
|
<div class="ws">
|
|
38
47
|
{#each tabs as tab, i}
|
|
39
48
|
<button
|
|
40
49
|
class="tab {tab === active ? 'active' : ''}"
|
|
50
|
+
aria-current={tab === active ? 'page' : undefined}
|
|
41
51
|
onclick={() => onTab?.(tab)}
|
|
42
52
|
>
|
|
43
|
-
<span class="n">{i + 1}</span>{tab}
|
|
53
|
+
<span class="n" aria-hidden="true">{i + 1}</span>{tab}
|
|
44
54
|
</button>
|
|
45
55
|
{/each}
|
|
46
56
|
</div>
|
|
47
57
|
<div class="grow"></div>
|
|
48
58
|
<div class="seg right" title="services">
|
|
49
|
-
<span class="dot"></span>
|
|
59
|
+
<span class="dot" aria-hidden="true"></span>
|
|
50
60
|
<span class="stat"><span class="v">6</span><span class="k">/7 up</span></span>
|
|
51
61
|
</div>
|
|
52
62
|
<div class="seg right stat" title="cpu"><span class="k">cpu</span><span class="v">62%</span></div>
|
|
53
63
|
<div class="seg right stat" title="memory"><span class="k">mem</span><span class="v">3.8G</span></div>
|
|
54
64
|
<div class="seg right stat" title="network"><span class="k">net</span><span class="v">↓1.2 ↑0.3</span></div>
|
|
55
|
-
<div class="seg right click"><span class="kbd">⌘K</span></div>
|
|
65
|
+
<div class="seg right click"><span class="kbd" aria-hidden="true">⌘K</span></div>
|
|
56
66
|
<div class="seg right click">{user}</div>
|
|
57
67
|
<div class="seg right clock">
|
|
58
68
|
<span>{h}</span><span class="sep">:</span><span>{m}</span><span class="sep">:</span><span>{s}</span>
|
|
59
69
|
</div>
|
|
60
70
|
</div>
|
|
71
|
+
|
|
72
|
+
<style>.ss-topbar {
|
|
73
|
+
grid-column: 1/-1;
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: stretch;
|
|
76
|
+
background: var(--ss-bg);
|
|
77
|
+
border-bottom: 1px solid var(--ss-line);
|
|
78
|
+
font-family: var(--ss-font-mono);
|
|
79
|
+
font-size: var(--ss-ui-md);
|
|
80
|
+
color: var(--ss-fg-muted);
|
|
81
|
+
user-select: none;
|
|
82
|
+
position: sticky;
|
|
83
|
+
top: 0;
|
|
84
|
+
z-index: 10;
|
|
85
|
+
}
|
|
86
|
+
.ss-topbar .seg {
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
gap: 8px;
|
|
90
|
+
padding: 0 var(--ss-panel-head-px);
|
|
91
|
+
border-right: 1px solid var(--ss-line);
|
|
92
|
+
cursor: default;
|
|
93
|
+
}
|
|
94
|
+
.ss-topbar .seg.right {
|
|
95
|
+
border-right: none;
|
|
96
|
+
border-left: 1px solid var(--ss-line);
|
|
97
|
+
}
|
|
98
|
+
.ss-topbar .seg.click {
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
}
|
|
101
|
+
.ss-topbar .seg.click:hover {
|
|
102
|
+
background: var(--ss-hover);
|
|
103
|
+
color: var(--ss-fg);
|
|
104
|
+
}
|
|
105
|
+
.ss-topbar .logo {
|
|
106
|
+
color: var(--ss-fg);
|
|
107
|
+
}
|
|
108
|
+
.ss-topbar .logo .mark {
|
|
109
|
+
display: block;
|
|
110
|
+
}
|
|
111
|
+
.ss-topbar .logo .nm {
|
|
112
|
+
font-family: var(--ss-font-display);
|
|
113
|
+
font-size: var(--ss-ui-lg);
|
|
114
|
+
letter-spacing: 0.02em;
|
|
115
|
+
line-height: 1;
|
|
116
|
+
}
|
|
117
|
+
.ss-topbar .ws {
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: stretch;
|
|
120
|
+
}
|
|
121
|
+
.ss-topbar .ws .tab {
|
|
122
|
+
display: flex;
|
|
123
|
+
align-items: center;
|
|
124
|
+
padding: 0 var(--ss-row-px);
|
|
125
|
+
color: var(--ss-fg-faint);
|
|
126
|
+
border-right: 1px solid var(--ss-line);
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
font: 500 var(--ss-ui-md) var(--ss-font-mono);
|
|
129
|
+
background: transparent;
|
|
130
|
+
border-top: 0;
|
|
131
|
+
border-bottom: 0;
|
|
132
|
+
border-left: 0;
|
|
133
|
+
transition: all var(--ss-dur-fast) var(--ss-ease);
|
|
134
|
+
}
|
|
135
|
+
.ss-topbar .ws .tab:hover {
|
|
136
|
+
color: var(--ss-fg);
|
|
137
|
+
background: var(--ss-hover);
|
|
138
|
+
}
|
|
139
|
+
.ss-topbar .ws .tab .n {
|
|
140
|
+
color: var(--ss-fg-faint);
|
|
141
|
+
margin-right: 6px;
|
|
142
|
+
}
|
|
143
|
+
.ss-topbar .ws .tab.active {
|
|
144
|
+
color: var(--ss-fg);
|
|
145
|
+
background: rgba(102, 239, 115, 0.06);
|
|
146
|
+
box-shadow: inset 0 -2px 0 var(--ss-primary);
|
|
147
|
+
}
|
|
148
|
+
.ss-topbar .ws .tab.active .n {
|
|
149
|
+
color: var(--ss-primary);
|
|
150
|
+
}
|
|
151
|
+
.ss-topbar .grow {
|
|
152
|
+
flex: 1;
|
|
153
|
+
}
|
|
154
|
+
.ss-topbar .dot {
|
|
155
|
+
width: 6px;
|
|
156
|
+
height: 6px;
|
|
157
|
+
background: var(--ss-primary);
|
|
158
|
+
display: inline-block;
|
|
159
|
+
}
|
|
160
|
+
.ss-topbar .stat {
|
|
161
|
+
font-variant-numeric: tabular-nums;
|
|
162
|
+
}
|
|
163
|
+
.ss-topbar .stat .k {
|
|
164
|
+
color: var(--ss-fg-faint);
|
|
165
|
+
margin-right: 4px;
|
|
166
|
+
}
|
|
167
|
+
.ss-topbar .stat .v {
|
|
168
|
+
color: var(--ss-fg);
|
|
169
|
+
}
|
|
170
|
+
.ss-topbar .clock {
|
|
171
|
+
color: var(--ss-fg);
|
|
172
|
+
font-variant-numeric: tabular-nums;
|
|
173
|
+
}
|
|
174
|
+
.ss-topbar .clock .sep {
|
|
175
|
+
color: var(--ss-fg-faint);
|
|
176
|
+
margin: 0 2px;
|
|
177
|
+
}
|
|
178
|
+
.ss-topbar .kbd {
|
|
179
|
+
font-family: var(--ss-font-mono);
|
|
180
|
+
font-size: var(--ss-ui-sm);
|
|
181
|
+
color: var(--ss-fg-muted);
|
|
182
|
+
border: 1px solid var(--ss-line);
|
|
183
|
+
padding: 2px 5px;
|
|
184
|
+
line-height: 1;
|
|
185
|
+
}</style>
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { type Size } from '../config.js';
|
|
1
2
|
interface Props {
|
|
2
3
|
active?: string;
|
|
3
4
|
user?: string;
|
|
4
5
|
tabs?: string[];
|
|
5
6
|
onTab?: (tab: string) => void;
|
|
7
|
+
/** Token size (sm|md|lg); inherits the global size when unset. */
|
|
8
|
+
size?: Size;
|
|
6
9
|
}
|
|
7
10
|
declare const Topbar: import("svelte").Component<Props, {}, "">;
|
|
8
11
|
type Topbar = ReturnType<typeof Topbar>;
|
package/dist/config.d.ts
CHANGED
|
@@ -1,34 +1,52 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Design system runtime config.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The available axes, their values, and the defaults are declared once in
|
|
5
|
+
* `dssoca.config.ts`; this module derives its types + defaults from that
|
|
6
|
+
* manifest and provides the runtime helpers (see DESIGN.md):
|
|
7
|
+
* • color — written as [data-theme]
|
|
8
|
+
* • size — written as [data-size-variant] (renamed from `density` in 0.4.0)
|
|
7
9
|
*
|
|
8
|
-
*
|
|
10
|
+
* Sizing has three layers (highest priority first):
|
|
11
|
+
* 1. a component's `size` prop (per instance)
|
|
12
|
+
* 2. `componentsSize[Name]` (per-component default)
|
|
13
|
+
* 3. `sizeVariant` on an ancestor (global default; `md` out of the box)
|
|
9
14
|
*/
|
|
10
|
-
|
|
11
|
-
export
|
|
15
|
+
import { dssocaConfig, type ColorTheme, type Size, type ComponentName, type ComponentsSize } from './dssoca.config.js';
|
|
16
|
+
export { dssocaConfig };
|
|
17
|
+
export type { ColorTheme, Size, ComponentName, ComponentsSize };
|
|
18
|
+
export type { DssocaConfig, DesignAxis } from './dssoca.config.js';
|
|
12
19
|
export interface DesignConfig {
|
|
13
20
|
theme: ColorTheme;
|
|
14
|
-
|
|
21
|
+
/** Global default size for every component — written as [data-size-variant]. */
|
|
22
|
+
sizeVariant: Size;
|
|
23
|
+
/** Per-component default sizes; components not listed inherit `sizeVariant`. */
|
|
24
|
+
componentsSize: ComponentsSize;
|
|
15
25
|
}
|
|
26
|
+
/** Defaults derived from the manifest — change them in `dssoca.config.ts`. */
|
|
16
27
|
export declare const defaultDesignConfig: DesignConfig;
|
|
17
28
|
/** Current resolved config (last applied, or defaults). */
|
|
18
29
|
export declare function getDesignConfig(): DesignConfig;
|
|
19
30
|
/**
|
|
20
|
-
* Build the `data-*` attribute map for a config — handy for SSR / markup
|
|
21
|
-
*
|
|
31
|
+
* Build the `data-*` attribute map for a config — handy for SSR / markup so the
|
|
32
|
+
* correct theme + size paint on the first frame with no flash.
|
|
22
33
|
*
|
|
23
|
-
* <
|
|
34
|
+
* <html {...designAttributes({ sizeVariant: 'sm' })}> … </html>
|
|
24
35
|
*/
|
|
25
36
|
export declare function designAttributes(config?: Partial<DesignConfig>): {
|
|
26
37
|
'data-theme': ColorTheme;
|
|
27
|
-
'data-
|
|
38
|
+
'data-size-variant': Size;
|
|
28
39
|
};
|
|
29
40
|
/**
|
|
30
|
-
* Apply theme +
|
|
31
|
-
*
|
|
32
|
-
* SSR-safe: no-op when no document and no explicit target.
|
|
41
|
+
* Apply theme + size to a DOM element (defaults to <html>). Merges over the
|
|
42
|
+
* current config so callers can flip one axis at a time (`componentsSize` is
|
|
43
|
+
* merged key-by-key). SSR-safe: no-op when no document and no explicit target.
|
|
33
44
|
*/
|
|
34
45
|
export declare function applyDesignConfig(config?: Partial<DesignConfig>, target?: HTMLElement): DesignConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Resolve the size a component should APPLY on its own root (as
|
|
48
|
+
* `data-size-variant`), or `undefined` to inherit the global `sizeVariant`
|
|
49
|
+
* through the cascade. Resolution order: explicit `size` prop →
|
|
50
|
+
* `componentsSize[name]` → inherit.
|
|
51
|
+
*/
|
|
52
|
+
export declare function resolveComponentSize(name: ComponentName, size?: Size): Size | undefined;
|
package/dist/config.js
CHANGED
|
@@ -1,42 +1,68 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Design system runtime config.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The available axes, their values, and the defaults are declared once in
|
|
5
|
+
* `dssoca.config.ts`; this module derives its types + defaults from that
|
|
6
|
+
* manifest and provides the runtime helpers (see DESIGN.md):
|
|
7
|
+
* • color — written as [data-theme]
|
|
8
|
+
* • size — written as [data-size-variant] (renamed from `density` in 0.4.0)
|
|
7
9
|
*
|
|
8
|
-
*
|
|
10
|
+
* Sizing has three layers (highest priority first):
|
|
11
|
+
* 1. a component's `size` prop (per instance)
|
|
12
|
+
* 2. `componentsSize[Name]` (per-component default)
|
|
13
|
+
* 3. `sizeVariant` on an ancestor (global default; `md` out of the box)
|
|
9
14
|
*/
|
|
15
|
+
import { dssocaConfig, } from './dssoca.config.js';
|
|
16
|
+
// Re-exported so the `dssoca` / `./config` import paths expose the config vocab.
|
|
17
|
+
export { dssocaConfig };
|
|
18
|
+
/** Defaults derived from the manifest — change them in `dssoca.config.ts`. */
|
|
10
19
|
export const defaultDesignConfig = {
|
|
11
|
-
theme:
|
|
12
|
-
|
|
20
|
+
theme: dssocaConfig.theme.default,
|
|
21
|
+
sizeVariant: dssocaConfig.size.default,
|
|
22
|
+
componentsSize: {},
|
|
23
|
+
};
|
|
24
|
+
let current = {
|
|
25
|
+
...defaultDesignConfig,
|
|
26
|
+
componentsSize: { ...defaultDesignConfig.componentsSize },
|
|
13
27
|
};
|
|
14
|
-
let current = { ...defaultDesignConfig };
|
|
15
28
|
/** Current resolved config (last applied, or defaults). */
|
|
16
29
|
export function getDesignConfig() {
|
|
17
|
-
return { ...current };
|
|
30
|
+
return { ...current, componentsSize: { ...current.componentsSize } };
|
|
18
31
|
}
|
|
19
32
|
/**
|
|
20
|
-
* Build the `data-*` attribute map for a config — handy for SSR / markup
|
|
21
|
-
*
|
|
33
|
+
* Build the `data-*` attribute map for a config — handy for SSR / markup so the
|
|
34
|
+
* correct theme + size paint on the first frame with no flash.
|
|
22
35
|
*
|
|
23
|
-
* <
|
|
36
|
+
* <html {...designAttributes({ sizeVariant: 'sm' })}> … </html>
|
|
24
37
|
*/
|
|
25
38
|
export function designAttributes(config = {}) {
|
|
26
39
|
const merged = { ...defaultDesignConfig, ...config };
|
|
27
|
-
return { 'data-theme': merged.theme, 'data-
|
|
40
|
+
return { 'data-theme': merged.theme, 'data-size-variant': merged.sizeVariant };
|
|
28
41
|
}
|
|
29
42
|
/**
|
|
30
|
-
* Apply theme +
|
|
31
|
-
*
|
|
32
|
-
* SSR-safe: no-op when no document and no explicit target.
|
|
43
|
+
* Apply theme + size to a DOM element (defaults to <html>). Merges over the
|
|
44
|
+
* current config so callers can flip one axis at a time (`componentsSize` is
|
|
45
|
+
* merged key-by-key). SSR-safe: no-op when no document and no explicit target.
|
|
33
46
|
*/
|
|
34
47
|
export function applyDesignConfig(config = {}, target) {
|
|
35
|
-
current = {
|
|
48
|
+
current = {
|
|
49
|
+
...current,
|
|
50
|
+
...config,
|
|
51
|
+
componentsSize: { ...current.componentsSize, ...(config.componentsSize ?? {}) },
|
|
52
|
+
};
|
|
36
53
|
const el = target ?? (typeof document !== 'undefined' ? document.documentElement : undefined);
|
|
37
54
|
if (el) {
|
|
38
55
|
el.setAttribute('data-theme', current.theme);
|
|
39
|
-
el.setAttribute('data-
|
|
56
|
+
el.setAttribute('data-size-variant', current.sizeVariant);
|
|
40
57
|
}
|
|
41
58
|
return getDesignConfig();
|
|
42
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Resolve the size a component should APPLY on its own root (as
|
|
62
|
+
* `data-size-variant`), or `undefined` to inherit the global `sizeVariant`
|
|
63
|
+
* through the cascade. Resolution order: explicit `size` prop →
|
|
64
|
+
* `componentsSize[name]` → inherit.
|
|
65
|
+
*/
|
|
66
|
+
export function resolveComponentSize(name, size) {
|
|
67
|
+
return size ?? current.componentsSize[name];
|
|
68
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dssoca configuration manifest — the single source of truth for *how the
|
|
3
|
+
* design system is configured*: which axes exist, the values each one allows,
|
|
4
|
+
* and the system defaults. `config.ts` derives its types and defaults from
|
|
5
|
+
* here, so adding a value (or a whole new axis) is a one-place change.
|
|
6
|
+
*
|
|
7
|
+
* Two axes today (see DESIGN.md):
|
|
8
|
+
* • theme — color, written as [data-theme]
|
|
9
|
+
* • size — chrome scale (sm | md | lg), written as [data-size-variant]
|
|
10
|
+
*
|
|
11
|
+
* The `size` axis replaced the former `density` axis in 0.4.0 (DS-0012):
|
|
12
|
+
* compact → `sm`, comfy → `md`, plus a new `lg`. The global default is set by
|
|
13
|
+
* `sizeVariant`; per-component defaults by `componentsSize`; per instance by a
|
|
14
|
+
* component's `size` prop.
|
|
15
|
+
*/
|
|
16
|
+
/** One configurable axis: its allowed values + the default applied when unset. */
|
|
17
|
+
export interface DesignAxis<Values extends readonly string[] = readonly string[]> {
|
|
18
|
+
/** Allowed values for the axis (by convention the default appears here too). */
|
|
19
|
+
readonly values: Values;
|
|
20
|
+
/** The value applied when a consumer sets nothing. */
|
|
21
|
+
readonly default: Values[number];
|
|
22
|
+
}
|
|
23
|
+
/** Shape of the manifest — one entry per axis the design system understands. */
|
|
24
|
+
export interface DssocaConfig {
|
|
25
|
+
readonly theme: DesignAxis;
|
|
26
|
+
readonly size: DesignAxis;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The manifest. `as const` preserves the value/default literals so the unions
|
|
30
|
+
* below can be derived from it; `satisfies` validates the shape without widening.
|
|
31
|
+
*/
|
|
32
|
+
export declare const dssocaConfig: {
|
|
33
|
+
readonly theme: {
|
|
34
|
+
readonly values: readonly ["dark", "light"];
|
|
35
|
+
readonly default: "dark";
|
|
36
|
+
};
|
|
37
|
+
readonly size: {
|
|
38
|
+
readonly values: readonly ["sm", "md", "lg"];
|
|
39
|
+
readonly default: "md";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
/** Color axis values — derived from the manifest (`'dark' | 'light'`). */
|
|
43
|
+
export type ColorTheme = (typeof dssocaConfig)['theme']['values'][number];
|
|
44
|
+
/** Size axis values — derived from the manifest (`'sm' | 'md' | 'lg'`). */
|
|
45
|
+
export type Size = (typeof dssocaConfig)['size']['values'][number];
|
|
46
|
+
/** Names of the components that accept a `size` prop / `componentsSize` entry. */
|
|
47
|
+
export declare const COMPONENT_NAMES: readonly ["Badge", "Button", "Card", "EmptyState", "Icon", "Input", "LogStream", "MetricTile", "ServiceCard", "Sidebar", "Sparkline", "Toaster", "Topbar"];
|
|
48
|
+
export type ComponentName = (typeof COMPONENT_NAMES)[number];
|
|
49
|
+
/** Per-component default sizes; any omitted component inherits `sizeVariant`. */
|
|
50
|
+
export type ComponentsSize = Partial<Record<ComponentName, Size>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dssoca configuration manifest — the single source of truth for *how the
|
|
3
|
+
* design system is configured*: which axes exist, the values each one allows,
|
|
4
|
+
* and the system defaults. `config.ts` derives its types and defaults from
|
|
5
|
+
* here, so adding a value (or a whole new axis) is a one-place change.
|
|
6
|
+
*
|
|
7
|
+
* Two axes today (see DESIGN.md):
|
|
8
|
+
* • theme — color, written as [data-theme]
|
|
9
|
+
* • size — chrome scale (sm | md | lg), written as [data-size-variant]
|
|
10
|
+
*
|
|
11
|
+
* The `size` axis replaced the former `density` axis in 0.4.0 (DS-0012):
|
|
12
|
+
* compact → `sm`, comfy → `md`, plus a new `lg`. The global default is set by
|
|
13
|
+
* `sizeVariant`; per-component defaults by `componentsSize`; per instance by a
|
|
14
|
+
* component's `size` prop.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* The manifest. `as const` preserves the value/default literals so the unions
|
|
18
|
+
* below can be derived from it; `satisfies` validates the shape without widening.
|
|
19
|
+
*/
|
|
20
|
+
export const dssocaConfig = {
|
|
21
|
+
theme: { values: ['dark', 'light'], default: 'dark' },
|
|
22
|
+
size: { values: ['sm', 'md', 'lg'], default: 'md' },
|
|
23
|
+
};
|
|
24
|
+
/** Names of the components that accept a `size` prop / `componentsSize` entry. */
|
|
25
|
+
export const COMPONENT_NAMES = [
|
|
26
|
+
'Badge',
|
|
27
|
+
'Button',
|
|
28
|
+
'Card',
|
|
29
|
+
'EmptyState',
|
|
30
|
+
'Icon',
|
|
31
|
+
'Input',
|
|
32
|
+
'LogStream',
|
|
33
|
+
'MetricTile',
|
|
34
|
+
'ServiceCard',
|
|
35
|
+
'Sidebar',
|
|
36
|
+
'Sparkline',
|
|
37
|
+
'Toaster',
|
|
38
|
+
'Topbar',
|
|
39
|
+
];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { type ColorTheme, type
|
|
2
|
-
export {
|
|
1
|
+
export { type ColorTheme, type Size, type DesignConfig, defaultDesignConfig, getDesignConfig, designAttributes, applyDesignConfig, resolveComponentSize, } from './config.js';
|
|
2
|
+
export { dssocaConfig, type DssocaConfig, type DesignAxis, type ComponentName, type ComponentsSize, } from './dssoca.config.js';
|
|
3
3
|
export { default as Icon } from './components/Icon.svelte';
|
|
4
4
|
export { default as Badge } from './components/Badge.svelte';
|
|
5
5
|
export { default as Button } from './components/Button.svelte';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { defaultDesignConfig, getDesignConfig, designAttributes, applyDesignConfig, } from './config.js';
|
|
2
|
-
export {
|
|
1
|
+
export { defaultDesignConfig, getDesignConfig, designAttributes, applyDesignConfig, resolveComponentSize, } from './config.js';
|
|
2
|
+
export { dssocaConfig, } from './dssoca.config.js';
|
|
3
3
|
export { default as Icon } from './components/Icon.svelte';
|
|
4
4
|
export { default as Badge } from './components/Badge.svelte';
|
|
5
5
|
export { default as Button } from './components/Button.svelte';
|