@morscherlab/mint-sdk 1.3.3 → 1.3.5
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/index.js +2 -2
- package/dist/{components-CEePoD3W.js → components-BOA5e7kb.js} +5 -5
- package/dist/{components-CEePoD3W.js.map → components-BOA5e7kb.js.map} +1 -1
- package/dist/composables/index.js +4 -4
- package/dist/{composables-BbHozlA7.js → composables-izSQH8Ky.js} +4 -4
- package/dist/{composables-BbHozlA7.js.map → composables-izSQH8Ky.js.map} +1 -1
- package/dist/{experiment-DgllIc3I.js → experiment-D49y_Kro.js} +2 -2
- package/dist/{experiment-DgllIc3I.js.map → experiment-D49y_Kro.js.map} +1 -1
- package/dist/index.js +6 -6
- package/dist/install.js +1 -1
- package/dist/{settings-BLr8lzw6.js → settings-BG6v13Zq.js} +2 -2
- package/dist/settings-BG6v13Zq.js.map +1 -0
- package/dist/stores/index.js +2 -2
- package/dist/stores/settings.d.ts +1 -1
- package/dist/styles.css +15 -15
- package/dist/templates/index.js +1 -1
- package/dist/{templates-BU1pet28.js → templates-B2DB0MCM.js} +22 -22
- package/dist/{templates-BU1pet28.js.map → templates-B2DB0MCM.js.map} +1 -1
- package/dist/{validation-CukfLjy-.js → validation-C_eH_vIg.js} +4 -4
- package/dist/{validation-CukfLjy-.js.map → validation-C_eH_vIg.js.map} +1 -1
- package/package.json +1 -1
- package/src/stores/settings.ts +1 -1
- package/src/styles/components/button.css +2 -2
- package/src/styles/variables.css +13 -13
- package/src/templates/presetControlSchemas.ts +3 -3
- package/src/templates/templateControlSchemas.ts +7 -7
- package/dist/settings-BLr8lzw6.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morscherlab/mint-sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"description": "MINT Platform SDK — Vue 3 components, composables, and types for plugin development. MINT = Mass-spec INtegrated Toolkit.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
package/src/stores/settings.ts
CHANGED
|
@@ -65,7 +65,7 @@ export const colorPalettes: Record<ColorPalette, { name: string; hues: [number,
|
|
|
65
65
|
/**
|
|
66
66
|
* Custom properties a non-default palette overrides on `<html>`.
|
|
67
67
|
*
|
|
68
|
-
* The saturation/lightness pairs are lifted from the
|
|
68
|
+
* The saturation/lightness pairs are lifted from the original indigo/orange
|
|
69
69
|
* tokens in `styles/variables.css` so only the hue moves; the `default`
|
|
70
70
|
* palette writes nothing at all and the stylesheet values stand.
|
|
71
71
|
*/
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
.mint-button--primary {
|
|
69
69
|
background-color: var(--color-primary);
|
|
70
70
|
color: white;
|
|
71
|
-
box-shadow: 0 1px 2px rgba(
|
|
71
|
+
box-shadow: 0 1px 2px rgba(20, 184, 166, 0.20);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
.mint-button--primary:hover:not(.mint-button--disabled) {
|
|
75
75
|
background-color: var(--color-primary-hover);
|
|
76
|
-
box-shadow: 0 2px 5px rgba(
|
|
76
|
+
box-shadow: 0 2px 5px rgba(20, 184, 166, 0.28);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
.mint-button--secondary {
|
package/src/styles/variables.css
CHANGED
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
--text-secondary-strong: #475569;
|
|
48
48
|
|
|
49
49
|
/* Brand colors */
|
|
50
|
-
--color-primary: #
|
|
51
|
-
--color-primary-hover: #
|
|
52
|
-
--color-primary-soft: rgba(
|
|
53
|
-
--color-cta: #
|
|
54
|
-
--color-cta-hover: #
|
|
50
|
+
--color-primary: #14B8A6;
|
|
51
|
+
--color-primary-hover: #0F766E;
|
|
52
|
+
--color-primary-soft: rgba(20, 184, 166, 0.12);
|
|
53
|
+
--color-cta: #06B6D4;
|
|
54
|
+
--color-cta-hover: #0891B2;
|
|
55
55
|
--color-purple: #8B5CF6;
|
|
56
56
|
|
|
57
57
|
/* Entity accent colors — experiments (cyan) and projects (sky), from the
|
|
@@ -155,8 +155,8 @@
|
|
|
155
155
|
/* Soft focus rings — 3px translucent. Used by all form primitives
|
|
156
156
|
post-0.16 visual refresh. Solid variants above kept for legacy
|
|
157
157
|
components that haven't migrated yet. */
|
|
158
|
-
--focus-ring-soft: 0 0 0 3px rgba(
|
|
159
|
-
/* Red is perceptually brighter than
|
|
158
|
+
--focus-ring-soft: 0 0 0 3px rgba(20, 184, 166, 0.20);
|
|
159
|
+
/* Red is perceptually brighter than teal at equal alpha; drop 2pp to keep visual weight matched. */
|
|
160
160
|
--focus-ring-soft-error: 0 0 0 3px rgba(239, 68, 68, 0.18);
|
|
161
161
|
|
|
162
162
|
/* Legacy aliases — still consumed by components that haven't migrated to the
|
|
@@ -709,11 +709,11 @@ button, input, select, textarea {
|
|
|
709
709
|
}
|
|
710
710
|
|
|
711
711
|
.bg-mint-primary\/5 {
|
|
712
|
-
background-color: rgba(
|
|
712
|
+
background-color: rgba(20, 184, 166, 0.05);
|
|
713
713
|
}
|
|
714
714
|
|
|
715
715
|
.hover\:border-mint-primary\/50:hover {
|
|
716
|
-
border-color: rgba(
|
|
716
|
+
border-color: rgba(20, 184, 166, 0.5);
|
|
717
717
|
}
|
|
718
718
|
|
|
719
719
|
/* Danger/error color utilities */
|
|
@@ -786,11 +786,11 @@ button, input, select, textarea {
|
|
|
786
786
|
}
|
|
787
787
|
|
|
788
788
|
.bg-mint-primary\/10 {
|
|
789
|
-
background-color: rgba(
|
|
789
|
+
background-color: rgba(20, 184, 166, 0.1);
|
|
790
790
|
}
|
|
791
791
|
|
|
792
792
|
.hover\:bg-mint-primary\/20:hover {
|
|
793
|
-
background-color: rgba(
|
|
793
|
+
background-color: rgba(20, 184, 166, 0.2);
|
|
794
794
|
}
|
|
795
795
|
|
|
796
796
|
.bg-mint-info {
|
|
@@ -829,11 +829,11 @@ button, input, select, textarea {
|
|
|
829
829
|
}
|
|
830
830
|
|
|
831
831
|
.text-mint-primary\/80 {
|
|
832
|
-
color: rgba(
|
|
832
|
+
color: rgba(20, 184, 166, 0.8);
|
|
833
833
|
}
|
|
834
834
|
|
|
835
835
|
.hover\:text-mint-primary\/70:hover {
|
|
836
|
-
color: rgba(
|
|
836
|
+
color: rgba(20, 184, 166, 0.7);
|
|
837
837
|
}
|
|
838
838
|
|
|
839
839
|
/* ==========================================================================
|
|
@@ -40,7 +40,7 @@ export const presetControlSchemas = {
|
|
|
40
40
|
section: 'assay',
|
|
41
41
|
sectionLabel: 'Assay',
|
|
42
42
|
view: 'design',
|
|
43
|
-
sidebar: { icon: ICONS.plate, iconColor: '#
|
|
43
|
+
sidebar: { icon: ICONS.plate, iconColor: '#0d9488', iconBg: '#ccfbf1' },
|
|
44
44
|
},
|
|
45
45
|
...templateControlSchemas['qpcr-plate'],
|
|
46
46
|
},
|
|
@@ -184,7 +184,7 @@ export const presetControlSchemas = {
|
|
|
184
184
|
sectionLabel: 'Layout',
|
|
185
185
|
sectionSubtitle: 'Plate geometry',
|
|
186
186
|
view: 'design',
|
|
187
|
-
sidebar: { icon: ICONS.plate, iconColor: '#
|
|
187
|
+
sidebar: { icon: ICONS.plate, iconColor: '#0d9488', iconBg: '#ccfbf1' },
|
|
188
188
|
},
|
|
189
189
|
plateFormat: {
|
|
190
190
|
label: 'Format',
|
|
@@ -252,7 +252,7 @@ export const presetControlSchemas = {
|
|
|
252
252
|
section: 'normalization',
|
|
253
253
|
sectionLabel: 'Normalization',
|
|
254
254
|
view: 'analysis',
|
|
255
|
-
sidebar: { icon: ICONS.settings, iconColor: '#
|
|
255
|
+
sidebar: { icon: ICONS.settings, iconColor: '#0d9488', iconBg: '#ccfbf1' },
|
|
256
256
|
},
|
|
257
257
|
},
|
|
258
258
|
} satisfies Record<TemplatePresetId, BioTemplateControlSchema>
|
|
@@ -19,7 +19,7 @@ export const templateControlSchemas = {
|
|
|
19
19
|
sectionLabel: 'Layout',
|
|
20
20
|
sectionSubtitle: 'Plate geometry',
|
|
21
21
|
view: 'design',
|
|
22
|
-
sidebar: { icon: ICONS.plate, iconColor: '#
|
|
22
|
+
sidebar: { icon: ICONS.plate, iconColor: '#0d9488', iconBg: '#ccfbf1' },
|
|
23
23
|
},
|
|
24
24
|
plateFormat: {
|
|
25
25
|
label: 'Format',
|
|
@@ -121,7 +121,7 @@ export const templateControlSchemas = {
|
|
|
121
121
|
sectionLabel: 'Layout',
|
|
122
122
|
sectionSubtitle: 'Well assignment',
|
|
123
123
|
view: 'design',
|
|
124
|
-
sidebar: { icon: ICONS.plate, iconColor: '#
|
|
124
|
+
sidebar: { icon: ICONS.plate, iconColor: '#0d9488', iconBg: '#ccfbf1', defaultOpen: false },
|
|
125
125
|
},
|
|
126
126
|
},
|
|
127
127
|
'calibration-curve': {
|
|
@@ -141,7 +141,7 @@ export const templateControlSchemas = {
|
|
|
141
141
|
section: 'fit',
|
|
142
142
|
sectionLabel: 'Fit',
|
|
143
143
|
view: 'analysis',
|
|
144
|
-
sidebar: { icon: ICONS.settings, iconColor: '#
|
|
144
|
+
sidebar: { icon: ICONS.settings, iconColor: '#0d9488', iconBg: '#ccfbf1' },
|
|
145
145
|
},
|
|
146
146
|
minRSquared: {
|
|
147
147
|
type: 'number',
|
|
@@ -214,7 +214,7 @@ export const templateControlSchemas = {
|
|
|
214
214
|
section: 'analysis',
|
|
215
215
|
sectionLabel: 'Analysis',
|
|
216
216
|
view: 'analysis',
|
|
217
|
-
sidebar: { icon: ICONS.settings, iconColor: '#
|
|
217
|
+
sidebar: { icon: ICONS.settings, iconColor: '#0d9488', iconBg: '#ccfbf1', defaultOpen: false },
|
|
218
218
|
},
|
|
219
219
|
},
|
|
220
220
|
'reagent-list': {
|
|
@@ -253,7 +253,7 @@ export const templateControlSchemas = {
|
|
|
253
253
|
sectionLabel: 'Panel',
|
|
254
254
|
sectionSubtitle: 'Markers and controls',
|
|
255
255
|
view: 'design',
|
|
256
|
-
sidebar: { icon: ICONS.settings, iconColor: '#
|
|
256
|
+
sidebar: { icon: ICONS.settings, iconColor: '#0d9488', iconBg: '#ccfbf1' },
|
|
257
257
|
},
|
|
258
258
|
includeDefaultControls: {
|
|
259
259
|
label: 'Default controls',
|
|
@@ -285,7 +285,7 @@ export const templateControlSchemas = {
|
|
|
285
285
|
section: 'quality',
|
|
286
286
|
sectionLabel: 'Quality Control',
|
|
287
287
|
view: 'run',
|
|
288
|
-
sidebar: { icon: ICONS.settings, iconColor: '#
|
|
288
|
+
sidebar: { icon: ICONS.settings, iconColor: '#0d9488', iconBg: '#ccfbf1', defaultOpen: false },
|
|
289
289
|
},
|
|
290
290
|
},
|
|
291
291
|
'qpcr-plate': {
|
|
@@ -297,7 +297,7 @@ export const templateControlSchemas = {
|
|
|
297
297
|
sectionLabel: 'Assay',
|
|
298
298
|
sectionSubtitle: 'qPCR setup',
|
|
299
299
|
view: 'design',
|
|
300
|
-
sidebar: { icon: ICONS.plate, iconColor: '#
|
|
300
|
+
sidebar: { icon: ICONS.plate, iconColor: '#0d9488', iconBg: '#ccfbf1' },
|
|
301
301
|
},
|
|
302
302
|
replicates: {
|
|
303
303
|
type: 'number',
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"settings-BLr8lzw6.js","names":[],"sources":["../src/apiErrors.ts","../src/stores/settings.ts"],"sourcesContent":["export interface MintApiErrorEnvelope {\n code: string\n message: string\n status: number\n request_id: string | null\n details: unknown\n detail?: unknown\n}\n\nconst STATUS_MESSAGES: Readonly<Record<number, string>> = {\n 400: 'Bad request',\n 401: 'Authentication required',\n 403: 'Permission denied',\n 404: 'Resource not found',\n 405: 'Method not allowed',\n 409: 'Conflict',\n 413: 'Payload too large',\n 415: 'Unsupported media type',\n 422: 'Validation error',\n 429: 'Rate limit exceeded',\n 500: 'Internal server error',\n 502: 'Bad gateway',\n 503: 'Service unavailable',\n}\n\nfunction asRecord(value: unknown): Record<string, unknown> | null {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return null\n return value as Record<string, unknown>\n}\n\n/** Public error thrown by typed MINT SDK requests. */\nexport class MintApiError extends Error {\n override readonly name: string = 'MintApiError'\n\n constructor(\n message: string,\n readonly code: string,\n readonly status: number,\n readonly requestId: string | null,\n readonly details: unknown,\n readonly detail: unknown,\n readonly body: unknown,\n readonly cause?: unknown,\n ) {\n super(message)\n }\n}\n\nexport interface MintApiErrorOptions {\n requestId?: string | null\n cause?: unknown\n}\n\n/** Normalize current typed envelopes and the previous FastAPI detail shape. */\nexport function mintApiErrorFromResponse(\n status: number,\n payload: unknown,\n options: MintApiErrorOptions = {},\n): MintApiError {\n const body = asRecord(payload)\n const legacyDetail = body?.detail\n const inner = asRecord(legacyDetail) ?? body\n const text = (value: unknown): string | undefined =>\n typeof value === 'string' && value ? value : undefined\n // Complete envelopes own the public code; older wrappers defer to the plugin payload.\n const canonical = typeof body?.status === 'number' && text(body.code) && text(body.message)\n const code = (canonical ? text(body.code) : text(inner?.error) ?? text(inner?.code))\n ?? text(body?.code) ?? 'unknown'\n const message = (canonical ? text(body.message) : text(inner?.message))\n ?? text(body?.message) ?? text(legacyDetail)\n ?? STATUS_MESSAGES[status] ?? `HTTP ${status}`\n const details = body?.details ?? inner?.details ?? null\n const requestId = text(body?.request_id) ?? text(inner?.request_id) ?? options.requestId ?? null\n\n return new MintApiError(\n message,\n code,\n status,\n requestId,\n details,\n legacyDetail,\n payload,\n options.cause,\n )\n}\n","import { defineStore, getActivePinia } from 'pinia'\nimport { ref, watch } from 'vue'\nimport type { ThemeMode, ColorPalette, TableDensity } from '../types'\n\ndeclare global {\n interface ImportMetaEnv {\n readonly VITE_API_PREFIX?: string\n }\n\n interface ImportMeta {\n readonly env: ImportMetaEnv\n }\n}\n\nexport interface SettingsState {\n serverHost: string\n serverPort: number\n requestTimeout: number\n wsAutoReconnect: boolean\n wsReconnectInterval: number\n theme: ThemeMode\n colorPalette: ColorPalette\n tableDensity: TableDensity\n}\n\nconst STORAGE_KEY = 'mint-settings'\nconst LEGACY_STORAGE_KEY = 'mld-settings'\n\nfunction getDefaultServerHost(): string {\n if (typeof window !== 'undefined' && window.location.hostname !== 'localhost') {\n return window.location.hostname\n }\n return 'localhost'\n}\n\nfunction getDefaultServerPort(): number {\n if (typeof window !== 'undefined') {\n if (window.location.port) {\n return parseInt(window.location.port, 10)\n }\n // Standard ports: 443 for HTTPS, 80 for HTTP (browser omits from location.port)\n return window.location.protocol === 'https:' ? 443 : 80\n }\n return 8000\n}\n\nconst defaultSettings: SettingsState = {\n serverHost: getDefaultServerHost(),\n serverPort: getDefaultServerPort(),\n requestTimeout: 120000,\n wsAutoReconnect: true,\n wsReconnectInterval: 5000,\n theme: 'system',\n colorPalette: 'default',\n tableDensity: 'normal',\n}\n\nexport const colorPalettes: Record<ColorPalette, { name: string; hues: [number, number] }> = {\n default: { name: 'Default (Cyan-Pink)', hues: [180, 320] },\n colorblind: { name: 'Colorblind-friendly', hues: [45, 260] },\n viridis: { name: 'Viridis', hues: [280, 80] },\n pastel: { name: 'Pastel', hues: [200, 340] },\n}\n\n/**\n * Custom properties a non-default palette overrides on `<html>`.\n *\n * The saturation/lightness pairs are lifted from the canonical indigo/orange\n * tokens in `styles/variables.css` so only the hue moves; the `default`\n * palette writes nothing at all and the stylesheet values stand.\n */\nexport const PALETTE_CSS_VARIABLES = [\n '--color-primary',\n '--color-primary-hover',\n '--color-primary-soft',\n '--color-cta',\n '--color-cta-hover',\n] as const\n\n/** Build the `<html>` custom-property overrides for a palette. */\nexport function paletteCssVariables(palette: ColorPalette): Record<string, string> {\n if (palette === 'default') return {}\n const [primaryHue, accentHue] = colorPalettes[palette].hues\n return {\n '--color-primary': `hsl(${primaryHue} 84% 67%)`,\n '--color-primary-hover': `hsl(${primaryHue} 75% 59%)`,\n '--color-primary-soft': `hsl(${primaryHue} 84% 67% / 0.12)`,\n '--color-cta': `hsl(${accentHue} 95% 53%)`,\n '--color-cta-hover': `hsl(${accentHue} 90% 48%)`,\n }\n}\n\n/** `DataFrame`-style size that each table density maps onto. */\nconst DENSITY_TABLE_SIZE: Record<TableDensity, 'sm' | 'md' | 'lg'> = {\n compact: 'sm',\n normal: 'md',\n comfortable: 'lg',\n}\n\n/** Map a table density onto the `size` prop shared by the SDK table components. */\nexport function tableDensityToSize(density: TableDensity): 'sm' | 'md' | 'lg' {\n return DENSITY_TABLE_SIZE[density]\n}\n\nfunction loadSettings(): SettingsState {\n try {\n const stored = localStorage.getItem(STORAGE_KEY)\n if (stored) {\n const parsed = JSON.parse(stored)\n return { ...defaultSettings, ...parsed }\n }\n\n const legacyStored = localStorage.getItem(LEGACY_STORAGE_KEY)\n if (legacyStored) {\n const parsed = JSON.parse(legacyStored)\n const migrated = { ...defaultSettings, ...parsed }\n localStorage.setItem(STORAGE_KEY, JSON.stringify(migrated))\n localStorage.removeItem(LEGACY_STORAGE_KEY)\n return migrated\n }\n } catch (e) {\n console.warn('Failed to load settings from localStorage:', e)\n }\n return { ...defaultSettings }\n}\n\nfunction saveSettings(settings: SettingsState): void {\n try {\n localStorage.setItem(STORAGE_KEY, JSON.stringify(settings))\n } catch (e) {\n console.warn('Failed to save settings to localStorage:', e)\n }\n}\n\nfunction getSystemPrefersDark(): boolean {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return false\n return window.matchMedia('(prefers-color-scheme: dark)').matches\n}\n\nexport const useSettingsStore = defineStore('mint-settings', () => {\n // State\n const serverHost = ref(defaultSettings.serverHost)\n const serverPort = ref(defaultSettings.serverPort)\n const requestTimeout = ref(defaultSettings.requestTimeout)\n const wsAutoReconnect = ref(defaultSettings.wsAutoReconnect)\n const wsReconnectInterval = ref(defaultSettings.wsReconnectInterval)\n const theme = ref<ThemeMode>(defaultSettings.theme)\n const systemPrefersDark = ref(getSystemPrefersDark())\n const colorPalette = ref<ColorPalette>(defaultSettings.colorPalette)\n const tableDensity = ref<TableDensity>(defaultSettings.tableDensity)\n\n // API prefix - can be configured via env variable VITE_API_PREFIX\n const apiPrefix: string = (import.meta.env?.VITE_API_PREFIX as string | undefined) ?? '/api'\n\n function _isSameOrigin(): { same: boolean; currentHost: string; currentPort: string } {\n const currentHost = typeof window !== 'undefined' ? window.location.hostname : 'localhost'\n const currentPort = typeof window !== 'undefined' ? window.location.port : '8000'\n const effectivePort = currentPort || (window.location.protocol === 'https:' ? '443' : '80')\n const same =\n (serverHost.value === currentHost && String(serverPort.value) === effectivePort) ||\n (serverHost.value === 'localhost' && currentHost !== 'localhost')\n return { same, currentHost, currentPort }\n }\n\n function getApiBaseUrl(): string {\n const { same } = _isSameOrigin()\n if (same) return apiPrefix\n return `http://${serverHost.value}:${serverPort.value}${apiPrefix}`\n }\n\n function getWsBaseUrl(): string {\n const { same, currentHost, currentPort } = _isSameOrigin()\n const protocol = typeof window !== 'undefined' && window.location.protocol === 'https:' ? 'wss:' : 'ws:'\n if (same) return `${protocol}//${currentHost}${currentPort ? ':' + currentPort : ''}${apiPrefix}`\n return `ws://${serverHost.value}:${serverPort.value}${apiPrefix}`\n }\n\n let _initialized = false\n\n function initialize() {\n if (_initialized) return\n _initialized = true\n\n const loaded = loadSettings()\n serverHost.value = loaded.serverHost\n serverPort.value = loaded.serverPort\n requestTimeout.value = loaded.requestTimeout\n wsAutoReconnect.value = loaded.wsAutoReconnect\n wsReconnectInterval.value = loaded.wsReconnectInterval\n theme.value = loaded.theme\n colorPalette.value = loaded.colorPalette\n tableDensity.value = loaded.tableDensity\n\n applyTheme()\n applyPalette()\n applyDensity()\n }\n\n function applyTheme() {\n if (typeof document === 'undefined') return\n const dark = theme.value === 'system' ? systemPrefersDark.value : theme.value === 'dark'\n document.documentElement.classList.toggle('dark', dark)\n }\n\n /**\n * Write the selected palette's hues onto `<html>` as custom-property\n * overrides. The `default` palette clears them so `styles/variables.css`\n * keeps ownership of the brand colors.\n */\n function applyPalette() {\n if (typeof document === 'undefined') return\n const style = document.documentElement.style\n const overrides = paletteCssVariables(colorPalette.value)\n for (const name of PALETTE_CSS_VARIABLES) {\n const value = overrides[name]\n if (value) style.setProperty(name, value)\n else style.removeProperty(name)\n }\n }\n\n /** Mirror the table density onto `<html data-density>` for CSS consumers. */\n function applyDensity() {\n if (typeof document === 'undefined') return\n document.documentElement.dataset.density = tableDensity.value\n }\n\n watch(theme, () => {\n applyTheme()\n persistSettings()\n })\n\n watch(colorPalette, applyPalette)\n watch(tableDensity, applyDensity)\n\n if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (event) => {\n systemPrefersDark.value = event.matches\n if (theme.value === 'system') {\n applyTheme()\n }\n })\n }\n\n function persistSettings() {\n saveSettings({\n serverHost: serverHost.value,\n serverPort: serverPort.value,\n requestTimeout: requestTimeout.value,\n wsAutoReconnect: wsAutoReconnect.value,\n wsReconnectInterval: wsReconnectInterval.value,\n theme: theme.value,\n colorPalette: colorPalette.value,\n tableDensity: tableDensity.value,\n })\n }\n\n watch([serverHost, serverPort, requestTimeout, wsAutoReconnect, wsReconnectInterval, colorPalette, tableDensity], () => {\n persistSettings()\n })\n\n function resetToDefaults() {\n serverHost.value = defaultSettings.serverHost\n serverPort.value = defaultSettings.serverPort\n requestTimeout.value = defaultSettings.requestTimeout\n wsAutoReconnect.value = defaultSettings.wsAutoReconnect\n wsReconnectInterval.value = defaultSettings.wsReconnectInterval\n theme.value = defaultSettings.theme\n colorPalette.value = defaultSettings.colorPalette\n tableDensity.value = defaultSettings.tableDensity\n }\n\n function getPaletteHues(): [number, number] {\n return colorPalettes[colorPalette.value].hues\n }\n\n /** The `size` the SDK table components default to for the current density. */\n function getTableSize(): 'sm' | 'md' | 'lg' {\n return tableDensityToSize(tableDensity.value)\n }\n\n function isDark(): boolean {\n return theme.value === 'system' ? systemPrefersDark.value : theme.value === 'dark'\n }\n\n return {\n serverHost,\n serverPort,\n requestTimeout,\n wsAutoReconnect,\n wsReconnectInterval,\n theme,\n systemPrefersDark,\n colorPalette,\n tableDensity,\n initialize,\n applyTheme,\n applyPalette,\n applyDensity,\n persistSettings,\n resetToDefaults,\n getPaletteHues,\n getTableSize,\n isDark,\n getApiBaseUrl,\n getWsBaseUrl,\n }\n})\n\n/**\n * Read the settings store without requiring Pinia to be installed.\n *\n * SDK components are mounted standalone (unit tests, Histoire stories, plugin\n * previews) where no Pinia instance exists. They use this to pick up a user's\n * preferences when the platform is running and fall back to their own defaults\n * otherwise, instead of throwing.\n */\nexport function tryUseSettingsStore(): ReturnType<typeof useSettingsStore> | null {\n if (!getActivePinia()) return null\n try {\n return useSettingsStore()\n } catch {\n return null\n }\n}\n"],"mappings":";;;AASA,IAAM,kBAAoD;CACxD,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;AACP;AAEA,SAAS,SAAS,OAAgD;CAChE,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAAG,OAAO;CACxE,OAAO;AACT;;AAGA,IAAa,eAAb,cAAkC,MAAM;CAK3B;CACA;CACA;CACA;CACA;CACA;CACA;CAVX,OAAiC;CAEjC,YACE,SACA,MACA,QACA,WACA,SACA,QACA,MACA,OACA;EACA,MAAM,OAAO;EARJ,KAAA,OAAA;EACA,KAAA,SAAA;EACA,KAAA,YAAA;EACA,KAAA,UAAA;EACA,KAAA,SAAA;EACA,KAAA,OAAA;EACA,KAAA,QAAA;CAGX;AACF;;AAQA,SAAgB,yBACd,QACA,SACA,UAA+B,CAAC,GAClB;CACd,MAAM,OAAO,SAAS,OAAO;CAC7B,MAAM,eAAe,MAAM;CAC3B,MAAM,QAAQ,SAAS,YAAY,KAAK;CACxC,MAAM,QAAQ,UACZ,OAAO,UAAU,YAAY,QAAQ,QAAQ,KAAA;CAE/C,MAAM,YAAY,OAAO,MAAM,WAAW,YAAY,KAAK,KAAK,IAAI,KAAK,KAAK,KAAK,OAAO;CAC1F,MAAM,QAAQ,YAAY,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