dssoca 0.1.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.
Files changed (38) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +89 -0
  3. package/dist/components/Badge.svelte +16 -0
  4. package/dist/components/Badge.svelte.d.ts +8 -0
  5. package/dist/components/Button.svelte +16 -0
  6. package/dist/components/Button.svelte.d.ts +11 -0
  7. package/dist/components/Card.svelte +26 -0
  8. package/dist/components/Card.svelte.d.ts +10 -0
  9. package/dist/components/EmptyState.svelte +50 -0
  10. package/dist/components/EmptyState.svelte.d.ts +11 -0
  11. package/dist/components/Icon.svelte +46 -0
  12. package/dist/components/Icon.svelte.d.ts +10 -0
  13. package/dist/components/Input.svelte +53 -0
  14. package/dist/components/Input.svelte.d.ts +16 -0
  15. package/dist/components/LogStream.svelte +61 -0
  16. package/dist/components/LogStream.svelte.d.ts +14 -0
  17. package/dist/components/MetricTile.svelte +20 -0
  18. package/dist/components/MetricTile.svelte.d.ts +10 -0
  19. package/dist/components/PassocaMark.svelte +15 -0
  20. package/dist/components/PassocaMark.svelte.d.ts +7 -0
  21. package/dist/components/ServiceCard.svelte +44 -0
  22. package/dist/components/ServiceCard.svelte.d.ts +11 -0
  23. package/dist/components/Sidebar.svelte +49 -0
  24. package/dist/components/Sidebar.svelte.d.ts +20 -0
  25. package/dist/components/Sparkline.svelte +15 -0
  26. package/dist/components/Sparkline.svelte.d.ts +7 -0
  27. package/dist/components/Toaster.svelte +72 -0
  28. package/dist/components/Toaster.svelte.d.ts +18 -0
  29. package/dist/components/Topbar.svelte +60 -0
  30. package/dist/components/Topbar.svelte.d.ts +9 -0
  31. package/dist/config.d.ts +34 -0
  32. package/dist/config.js +42 -0
  33. package/dist/index.d.ts +16 -0
  34. package/dist/index.js +16 -0
  35. package/dist/theme.css +610 -0
  36. package/dist/toast.svelte.d.ts +25 -0
  37. package/dist/toast.svelte.js +32 -0
  38. package/package.json +68 -0
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ interface Props {
3
+ data: number[]
4
+ color?: string
5
+ }
6
+ let { data, color = 'var(--hs-primary)' }: Props = $props()
7
+
8
+ const max = $derived(Math.max(...data, 1))
9
+ </script>
10
+
11
+ <div class="hub-spark">
12
+ {#each data as v}
13
+ <i style="height:{Math.max(8, (v / max) * 100)}%;background:{color}"></i>
14
+ {/each}
15
+ </div>
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ data: number[];
3
+ color?: string;
4
+ }
5
+ declare const Sparkline: import("svelte").Component<Props, {}, "">;
6
+ type Sparkline = ReturnType<typeof Sparkline>;
7
+ export default Sparkline;
@@ -0,0 +1,72 @@
1
+ <script lang="ts">
2
+ import { fly } from 'svelte/transition'
3
+ import { toasts, type ToastKind } from '../toast.svelte.js'
4
+
5
+ const glyph: Record<ToastKind, string> = { success: '✓', error: '✕', info: 'i' }
6
+ </script>
7
+
8
+ <div class="hub-toaster" role="region" aria-live="polite" aria-label="Notifications">
9
+ {#each toasts.items as t (t.id)}
10
+ <output class="hub-toast {t.kind}" transition:fly={{ x: 16, duration: 180 }}>
11
+ <span class="ic">{glyph[t.kind]}</span>
12
+ <span class="msg">{t.message}</span>
13
+ <button class="x" type="button" aria-label="Dismiss" onclick={() => toasts.dismiss(t.id)}>×</button>
14
+ </output>
15
+ {/each}
16
+ </div>
17
+
18
+ <style>
19
+ .hub-toaster {
20
+ position: fixed;
21
+ top: var(--hs-s-4);
22
+ right: var(--hs-s-4);
23
+ z-index: 1000;
24
+ display: flex;
25
+ flex-direction: column;
26
+ gap: var(--hs-s-2);
27
+ max-width: min(360px, calc(100vw - var(--hs-s-8)));
28
+ pointer-events: none;
29
+ }
30
+ .hub-toast {
31
+ pointer-events: auto;
32
+ display: flex;
33
+ align-items: center;
34
+ gap: var(--hs-s-3);
35
+ padding: var(--hs-s-3) var(--hs-s-4);
36
+ background: var(--hs-bg-elev);
37
+ border: 1px solid var(--hs-line);
38
+ border-left: 3px solid var(--hs-fg-faint);
39
+ box-shadow: var(--hs-shadow-pop);
40
+ font-family: var(--hs-font-mono);
41
+ font-size: var(--hs-ui-md);
42
+ color: var(--hs-fg);
43
+ }
44
+ .hub-toast.success { border-left-color: var(--hs-primary); }
45
+ .hub-toast.error { border-left-color: var(--hs-red); }
46
+ .hub-toast.info { border-left-color: var(--hs-cyan); }
47
+ .ic {
48
+ display: inline-flex;
49
+ align-items: center;
50
+ justify-content: center;
51
+ width: 18px;
52
+ height: 18px;
53
+ font-size: var(--hs-ui-sm);
54
+ color: var(--hs-fg-on-primary);
55
+ flex: none;
56
+ }
57
+ .success .ic { background: var(--hs-primary); }
58
+ .error .ic { background: var(--hs-red); }
59
+ .info .ic { background: var(--hs-cyan); }
60
+ .msg { flex: 1; line-height: 1.3; }
61
+ .x {
62
+ flex: none;
63
+ background: none;
64
+ border: none;
65
+ color: var(--hs-fg-faint);
66
+ cursor: pointer;
67
+ font-size: var(--hs-size-h3);
68
+ line-height: 1;
69
+ padding: 0;
70
+ }
71
+ .x:hover { color: var(--hs-fg); }
72
+ </style>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Toaster: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type Toaster = InstanceType<typeof Toaster>;
18
+ export default Toaster;
@@ -0,0 +1,60 @@
1
+ <script lang="ts">
2
+ import PassocaMark from './PassocaMark.svelte'
3
+
4
+ interface Props {
5
+ active?: string
6
+ user?: string
7
+ tabs?: string[]
8
+ onTab?: (tab: string) => void
9
+ }
10
+ let {
11
+ active = 'overview',
12
+ user = 'rafael@hub.home',
13
+ tabs = ['overview', 'services', 'logs', 'shell'],
14
+ onTab,
15
+ }: Props = $props()
16
+
17
+ function pad(n: number) { return String(n).padStart(2, '0') }
18
+ function nowStr() {
19
+ const d = new Date()
20
+ return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
21
+ }
22
+
23
+ let clock = $state(nowStr())
24
+ $effect(() => {
25
+ const t = setInterval(() => { clock = nowStr() }, 1000)
26
+ return () => clearInterval(t)
27
+ })
28
+
29
+ const [h, m, s] = $derived(clock.split(':'))
30
+ </script>
31
+
32
+ <div class="hub-topbar">
33
+ <div class="seg logo">
34
+ <PassocaMark size={14} />
35
+ <span class="nm">hubssoca</span>
36
+ </div>
37
+ <div class="ws">
38
+ {#each tabs as tab, i}
39
+ <button
40
+ class="tab {tab === active ? 'active' : ''}"
41
+ onclick={() => onTab?.(tab)}
42
+ >
43
+ <span class="n">{i + 1}</span>{tab}
44
+ </button>
45
+ {/each}
46
+ </div>
47
+ <div class="grow"></div>
48
+ <div class="seg right" title="services">
49
+ <span class="dot"></span>
50
+ <span class="stat"><span class="v">6</span><span class="k">/7 up</span></span>
51
+ </div>
52
+ <div class="seg right stat" title="cpu"><span class="k">cpu</span><span class="v">62%</span></div>
53
+ <div class="seg right stat" title="memory"><span class="k">mem</span><span class="v">3.8G</span></div>
54
+ <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>
56
+ <div class="seg right click">{user}</div>
57
+ <div class="seg right clock">
58
+ <span>{h}</span><span class="sep">:</span><span>{m}</span><span class="sep">:</span><span>{s}</span>
59
+ </div>
60
+ </div>
@@ -0,0 +1,9 @@
1
+ interface Props {
2
+ active?: string;
3
+ user?: string;
4
+ tabs?: string[];
5
+ onTab?: (tab: string) => void;
6
+ }
7
+ declare const Topbar: import("svelte").Component<Props, {}, "">;
8
+ type Topbar = ReturnType<typeof Topbar>;
9
+ export default Topbar;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Design system runtime config.
3
+ *
4
+ * Two independent axes drive the whole system (see DESIGN.md):
5
+ * • color — `dark` | `light` → written as [data-theme]
6
+ * • density — `comfy` | `compact` → written as [data-density]
7
+ *
8
+ * `comfy` is the general-purpose default; the hub opts into `compact`.
9
+ */
10
+ export type ColorTheme = 'dark' | 'light';
11
+ export type Density = 'comfy' | 'compact';
12
+ export interface DesignConfig {
13
+ theme: ColorTheme;
14
+ density: Density;
15
+ }
16
+ export declare const defaultDesignConfig: DesignConfig;
17
+ /** Current resolved config (last applied, or defaults). */
18
+ export declare function getDesignConfig(): DesignConfig;
19
+ /**
20
+ * Build the `data-*` attribute map for a config — handy for SSR / markup
21
+ * so the correct density paints on first frame with no flash.
22
+ *
23
+ * <div {...designAttributes({ density: 'compact' })}> … </div>
24
+ */
25
+ export declare function designAttributes(config?: Partial<DesignConfig>): {
26
+ 'data-theme': ColorTheme;
27
+ 'data-density': Density;
28
+ };
29
+ /**
30
+ * Apply theme + density to a DOM element (defaults to <html>).
31
+ * Merges over the current config so callers can flip one axis at a time.
32
+ * SSR-safe: no-op when no document and no explicit target.
33
+ */
34
+ export declare function applyDesignConfig(config?: Partial<DesignConfig>, target?: HTMLElement): DesignConfig;
package/dist/config.js ADDED
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Design system runtime config.
3
+ *
4
+ * Two independent axes drive the whole system (see DESIGN.md):
5
+ * • color — `dark` | `light` → written as [data-theme]
6
+ * • density — `comfy` | `compact` → written as [data-density]
7
+ *
8
+ * `comfy` is the general-purpose default; the hub opts into `compact`.
9
+ */
10
+ export const defaultDesignConfig = {
11
+ theme: 'dark',
12
+ density: 'comfy',
13
+ };
14
+ let current = { ...defaultDesignConfig };
15
+ /** Current resolved config (last applied, or defaults). */
16
+ export function getDesignConfig() {
17
+ return { ...current };
18
+ }
19
+ /**
20
+ * Build the `data-*` attribute map for a config — handy for SSR / markup
21
+ * so the correct density paints on first frame with no flash.
22
+ *
23
+ * <div {...designAttributes({ density: 'compact' })}> … </div>
24
+ */
25
+ export function designAttributes(config = {}) {
26
+ const merged = { ...defaultDesignConfig, ...config };
27
+ return { 'data-theme': merged.theme, 'data-density': merged.density };
28
+ }
29
+ /**
30
+ * Apply theme + density to a DOM element (defaults to <html>).
31
+ * Merges over the current config so callers can flip one axis at a time.
32
+ * SSR-safe: no-op when no document and no explicit target.
33
+ */
34
+ export function applyDesignConfig(config = {}, target) {
35
+ current = { ...current, ...config };
36
+ const el = target ?? (typeof document !== 'undefined' ? document.documentElement : undefined);
37
+ if (el) {
38
+ el.setAttribute('data-theme', current.theme);
39
+ el.setAttribute('data-density', current.density);
40
+ }
41
+ return getDesignConfig();
42
+ }
@@ -0,0 +1,16 @@
1
+ export { type ColorTheme, type Density, type DesignConfig, defaultDesignConfig, getDesignConfig, designAttributes, applyDesignConfig, } from './config.js';
2
+ export { default as PassocaMark } from './components/PassocaMark.svelte';
3
+ export { default as Icon } from './components/Icon.svelte';
4
+ export { default as Badge } from './components/Badge.svelte';
5
+ export { default as Button } from './components/Button.svelte';
6
+ export { default as Input } from './components/Input.svelte';
7
+ export { default as Card } from './components/Card.svelte';
8
+ export { default as Sparkline } from './components/Sparkline.svelte';
9
+ export { default as ServiceCard } from './components/ServiceCard.svelte';
10
+ export { default as MetricTile } from './components/MetricTile.svelte';
11
+ export { default as Topbar } from './components/Topbar.svelte';
12
+ export { default as Sidebar } from './components/Sidebar.svelte';
13
+ export { default as LogStream } from './components/LogStream.svelte';
14
+ export { default as Toaster } from './components/Toaster.svelte';
15
+ export { default as EmptyState } from './components/EmptyState.svelte';
16
+ export { toast, toasts, type Toast, type ToastKind } from './toast.svelte.js';
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ export { defaultDesignConfig, getDesignConfig, designAttributes, applyDesignConfig, } from './config.js';
2
+ export { default as PassocaMark } from './components/PassocaMark.svelte';
3
+ export { default as Icon } from './components/Icon.svelte';
4
+ export { default as Badge } from './components/Badge.svelte';
5
+ export { default as Button } from './components/Button.svelte';
6
+ export { default as Input } from './components/Input.svelte';
7
+ export { default as Card } from './components/Card.svelte';
8
+ export { default as Sparkline } from './components/Sparkline.svelte';
9
+ export { default as ServiceCard } from './components/ServiceCard.svelte';
10
+ export { default as MetricTile } from './components/MetricTile.svelte';
11
+ export { default as Topbar } from './components/Topbar.svelte';
12
+ export { default as Sidebar } from './components/Sidebar.svelte';
13
+ export { default as LogStream } from './components/LogStream.svelte';
14
+ export { default as Toaster } from './components/Toaster.svelte';
15
+ export { default as EmptyState } from './components/EmptyState.svelte';
16
+ export { toast, toasts } from './toast.svelte.js';