@zendir/ui 0.3.0 → 0.3.1
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.js +62 -62
- package/dist/react/3d/ZenSpace3D.js +3 -2
- package/dist/react/3d/ZenSpace3DShaders.js +478 -0
- package/dist/react/3d/ZenSpace3DShaders.js.map +1 -0
- package/dist/react/3d/capturePngAnalysis.js +42 -0
- package/dist/react/3d/capturePngAnalysis.js.map +1 -0
- package/dist/react/3d/index.js +57 -0
- package/dist/react/3d/index.js.map +1 -0
- package/dist/react/3d/threeLoader.js +4 -0
- package/dist/react/3d/threeLoader.js.map +1 -1
- package/dist/react/astro/ClassificationBanner.js +1 -1
- package/dist/react/astro/GlobalStatusBar.js +1 -1
- package/dist/react/astro/MissionClock.js +8 -5
- package/dist/react/astro/MissionClock.js.map +1 -1
- package/dist/react/astro/MonitoringIcon.js +1 -1
- package/dist/react/astro/Notification.js +1 -1
- package/dist/react/astro/Progress.js +1 -1
- package/dist/react/astro/SimulationControls.js +1 -1
- package/dist/react/astro/StatusIndicator.js +1 -1
- package/dist/react/astro/UnifiedTimeline.js +1 -1
- package/dist/react/astro/index.js +34 -0
- package/dist/react/astro/index.js.map +1 -0
- package/dist/react/cards/AccessCard.js +410 -0
- package/dist/react/cards/AccessCard.js.map +1 -0
- package/dist/react/cards/OrbitCard.js +372 -0
- package/dist/react/cards/OrbitCard.js.map +1 -0
- package/dist/react/cards/SpacecraftCard.js +941 -0
- package/dist/react/cards/SpacecraftCard.js.map +1 -0
- package/dist/react/cards/TelemetryCard.js +742 -0
- package/dist/react/cards/TelemetryCard.js.map +1 -0
- package/dist/react/cards/TelemetryStreamCard.js +309 -0
- package/dist/react/cards/TelemetryStreamCard.js.map +1 -0
- package/dist/react/cards/index.js +13 -0
- package/dist/react/cards/index.js.map +1 -0
- package/dist/react/charts/GroundTrackMap.js +1 -1
- package/dist/react/charts/GroundTrackMapLeaflet.js +1 -1
- package/dist/react/charts/index.js +104 -0
- package/dist/react/charts/index.js.map +1 -0
- package/dist/react/charts/unified/AstroChart.js +1 -1
- package/dist/react/charts/unified/PowerOverviewChart.js +488 -0
- package/dist/react/charts/unified/PowerOverviewChart.js.map +1 -0
- package/dist/react/charts/unified/domain.js +3168 -0
- package/dist/react/charts/unified/domain.js.map +1 -0
- package/dist/react/charts/unified/generators.js +518 -0
- package/dist/react/charts/unified/generators.js.map +1 -0
- package/dist/react/charts/unified/presets.js +1000 -0
- package/dist/react/charts/unified/presets.js.map +1 -0
- package/dist/react/charts/unified/sync.js +219 -0
- package/dist/react/charts/unified/sync.js.map +1 -0
- package/dist/react/charts/unified/theme.js +331 -4
- package/dist/react/charts/unified/theme.js.map +1 -1
- package/dist/react/charts/unified/useChartStream.js +226 -0
- package/dist/react/charts/unified/useChartStream.js.map +1 -0
- package/dist/react/chatgpt/index.js +163 -0
- package/dist/react/chatgpt/index.js.map +1 -0
- package/dist/react/core/data/DataTable.js +1 -1
- package/dist/react/core/data/DataValue.js +1 -1
- package/dist/react/core/display/AstroIcon.js +1 -1
- package/dist/react/core/display/Badge.js +1 -1
- package/dist/react/core/display/CardHeader.js +1 -1
- package/dist/react/core/display/Container.js +1 -1
- package/dist/react/core/display/GlassCard.js +1 -1
- package/dist/react/core/display/HeaderIconWithStatus.js +1 -1
- package/dist/react/core/feedback/Dialog.js +1 -1
- package/dist/react/core/feedback/Toast.js +1 -1
- package/dist/react/core/index.js +161 -0
- package/dist/react/core/index.js.map +1 -0
- package/dist/react/core/inputs/Button.js +1 -1
- package/dist/react/core/inputs/Checkbox.js +1 -1
- package/dist/react/core/inputs/Input.js +1 -1
- package/dist/react/core/inputs/NumberInput.js +1 -1
- package/dist/react/core/inputs/PinInput.js +1 -1
- package/dist/react/core/inputs/Select.js +1 -1
- package/dist/react/core/inputs/Toggle.js +1 -1
- package/dist/react/core/layout/Box.js +1 -1
- package/dist/react/core/layout/Flex.js +1 -1
- package/dist/react/core/layout/Grid.js +1 -1
- package/dist/react/core/layout/Stack.js +1 -1
- package/dist/react/core/navigation/AppBar.js +1 -1
- package/dist/react/core/navigation/Pagination.js +1 -1
- package/dist/react/core/navigation/SideNav.js +1 -1
- package/dist/react/core/navigation/Tabs.js +1 -1
- package/dist/react/core/overlays/SidePanel.js +1 -1
- package/dist/react/core/overlays/Tooltip.js +1 -1
- package/dist/react/core/widgets/Capture.js +1 -1
- package/dist/react/core/widgets/ChatPanel.js +1 -1
- package/dist/react/core/widgets/ColorPickerPanel.js +1 -1
- package/dist/react/core/widgets/ConnectionForm.js +1 -1
- package/dist/react/core/widgets/FileExplorer.js +1 -1
- package/dist/react/core/widgets/ImageGallery.js +1 -1
- package/dist/react/core/widgets/MessageStream.js +1 -1
- package/dist/react/core/widgets/MissionCalendar.js +1 -1
- package/dist/react/hooks/useCompactMode.js +1 -1
- package/dist/react/panels/index.js +8 -0
- package/dist/react/panels/index.js.map +1 -0
- package/dist/react/theme/config.js +30 -0
- package/dist/react/theme/config.js.map +1 -0
- package/dist/react/theme/index.js +19 -0
- package/dist/react/theme/index.js.map +1 -0
- package/dist/react/utils/index.js +8 -0
- package/dist/react/utils/index.js.map +1 -1
- package/dist/react.js +62 -62
- package/package.json +45 -37
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/react/utils/index.ts"],"sourcesContent":["/**\n * @zendir/ui - Enterprise Utility Functions\n * \n * Shared utilities for null-safety, formatting, and defensive coding.\n * These utilities ensure components never crash due to undefined data.\n */\n\n// ============================================================================\n// NULL SAFETY UTILITIES\n// ============================================================================\n\n/**\n * Safely access a value with a fallback for null/undefined\n * @example withNullSafety(data?.temperature, 0) // Returns 0 if undefined\n */\nexport function withNullSafety<T>(value: T | null | undefined, fallback: T): T {\n return value ?? fallback;\n}\n\n/**\n * Safely format a number, returning '--' if undefined\n * @example safeNumber(data?.value, 2) // \"123.45\" or \"--\"\n */\nexport function safeNumber(\n value: number | null | undefined,\n decimals: number = 2,\n fallback: string = '--'\n): string {\n if (value === null || value === undefined || !Number.isFinite(value)) {\n return fallback;\n }\n return value.toFixed(decimals);\n}\n\n/**\n * Check if value is a valid finite number\n */\nexport function isValidNumber(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value);\n}\n\n// ============================================================================\n// NUMBER FORMATTING\n// ============================================================================\n\nexport interface FormatNumberOptions {\n decimals?: number;\n locale?: string;\n notation?: 'standard' | 'scientific' | 'engineering' | 'compact';\n unit?: string;\n signDisplay?: 'auto' | 'never' | 'always' | 'exceptZero';\n}\n\n/**\n * Format a number with locale-aware formatting and optional unit\n * @example formatNumber(1234567, { notation: 'compact' }) // \"1.2M\"\n */\nexport function formatNumber(\n value: number | null | undefined,\n options: FormatNumberOptions = {}\n): string {\n if (value === null || value === undefined || !Number.isFinite(value)) {\n return '--';\n }\n\n const {\n decimals = 2,\n locale = 'en-US',\n notation = 'standard',\n unit,\n signDisplay = 'auto',\n } = options;\n\n try {\n const formatted = new Intl.NumberFormat(locale, {\n notation,\n minimumFractionDigits: notation === 'compact' ? 0 : decimals,\n maximumFractionDigits: decimals,\n signDisplay,\n }).format(value);\n\n return unit ? `${formatted} ${unit}` : formatted;\n } catch {\n return value.toFixed(decimals);\n }\n}\n\n/**\n * Format a number with tabular (monospace) digits for alignment\n * Uses font-feature-settings: 'tnum' 1\n */\nexport function formatTabular(\n value: number | null | undefined,\n decimals: number = 2\n): string {\n return safeNumber(value, decimals);\n}\n\n// ============================================================================\n// UNIT-AWARE FORMATTING\n// ============================================================================\n\n/**\n * Format temperature with unit conversion\n * @example formatTemperature(25) // \"25.0°C\"\n * @example formatTemperature(25, 'fahrenheit') // \"77.0°F\"\n */\nexport function formatTemperature(\n celsius: number | null | undefined,\n unit: 'celsius' | 'fahrenheit' | 'kelvin' = 'celsius',\n decimals: number = 1\n): string {\n if (celsius === null || celsius === undefined || !Number.isFinite(celsius)) {\n return '--°C';\n }\n\n switch (unit) {\n case 'fahrenheit':\n return `${((celsius * 9) / 5 + 32).toFixed(decimals)}°F`;\n case 'kelvin':\n return `${(celsius + 273.15).toFixed(decimals)}K`;\n default:\n return `${celsius.toFixed(decimals)}°C`;\n }\n}\n\n/**\n * Format data rate with automatic unit scaling\n * @example formatDataRate(1500000) // \"1.50 Mbps\"\n */\nexport function formatDataRate(bitsPerSecond: number | null | undefined): string {\n if (bitsPerSecond === null || bitsPerSecond === undefined || !Number.isFinite(bitsPerSecond)) {\n return '-- bps';\n }\n\n const units = ['bps', 'Kbps', 'Mbps', 'Gbps', 'Tbps'];\n let unitIndex = 0;\n let value = bitsPerSecond;\n\n while (value >= 1000 && unitIndex < units.length - 1) {\n value /= 1000;\n unitIndex++;\n }\n\n return `${value.toFixed(2)} ${units[unitIndex]}`;\n}\n\n/**\n * Format distance with automatic unit scaling\n * @example formatDistance(1500) // \"1.50 km\"\n */\nexport function formatDistance(meters: number | null | undefined): string {\n if (meters === null || meters === undefined || !Number.isFinite(meters)) {\n return '-- m';\n }\n\n if (meters >= 1_000_000) {\n return `${(meters / 1_000_000).toFixed(2)} Mm`;\n } else if (meters >= 1_000) {\n return `${(meters / 1_000).toFixed(2)} km`;\n } else if (meters < 1) {\n return `${(meters * 100).toFixed(1)} cm`;\n }\n return `${meters.toFixed(1)} m`;\n}\n\n/**\n * Format altitude (always in km for space ops)\n * @example formatAltitude(418.2) // \"418.2 km\"\n */\nexport function formatAltitude(km: number | null | undefined): string {\n if (km === null || km === undefined || !Number.isFinite(km)) {\n return '-- km';\n }\n return `${km.toFixed(1)} km`;\n}\n\n/**\n * Format velocity\n * @example formatVelocity(7.66) // \"7.66 km/s\"\n */\nexport function formatVelocity(kmPerSec: number | null | undefined): string {\n if (kmPerSec === null || kmPerSec === undefined || !Number.isFinite(kmPerSec)) {\n return '-- km/s';\n }\n return `${kmPerSec.toFixed(2)} km/s`;\n}\n\n/**\n * Format percentage with bounds checking\n * @example formatPercentage(0.856) // \"85.6%\"\n * @example formatPercentage(85.6, false) // \"85.6%\" (already percentage)\n */\nexport function formatPercentage(\n value: number | null | undefined,\n isDecimal: boolean = false,\n decimals: number = 1\n): string {\n if (value === null || value === undefined || !Number.isFinite(value)) {\n return '--%';\n }\n\n const percentage = isDecimal ? value * 100 : value;\n return `${percentage.toFixed(decimals)}%`;\n}\n\n/**\n * Format power (watts) with auto-scaling\n * @example formatPower(1500) // \"1.50 kW\"\n */\nexport function formatPower(watts: number | null | undefined): string {\n if (watts === null || watts === undefined || !Number.isFinite(watts)) {\n return '-- W';\n }\n\n if (Math.abs(watts) >= 1_000_000) {\n return `${(watts / 1_000_000).toFixed(2)} MW`;\n } else if (Math.abs(watts) >= 1_000) {\n return `${(watts / 1_000).toFixed(2)} kW`;\n } else if (Math.abs(watts) < 1) {\n return `${(watts * 1000).toFixed(1)} mW`;\n }\n return `${watts.toFixed(1)} W`;\n}\n\n/**\n * Format frequency (Hz) with auto-scaling\n * @example formatFrequency(2400000000) // \"2.40 GHz\"\n */\nexport function formatFrequency(hz: number | null | undefined): string {\n if (hz === null || hz === undefined || !Number.isFinite(hz)) {\n return '-- Hz';\n }\n\n if (hz >= 1_000_000_000) {\n return `${(hz / 1_000_000_000).toFixed(2)} GHz`;\n } else if (hz >= 1_000_000) {\n return `${(hz / 1_000_000).toFixed(2)} MHz`;\n } else if (hz >= 1_000) {\n return `${(hz / 1_000).toFixed(2)} kHz`;\n }\n return `${hz.toFixed(0)} Hz`;\n}\n\n// ============================================================================\n// TIME FORMATTING\n// ============================================================================\n\n/**\n * Format duration in human-readable form\n * @example formatDuration(3661) // \"1h 1m 1s\"\n */\nexport function formatDuration(seconds: number | null | undefined): string {\n if (seconds === null || seconds === undefined || !Number.isFinite(seconds)) {\n return '--:--';\n }\n\n const absSeconds = Math.abs(seconds);\n const sign = seconds < 0 ? '-' : '';\n\n if (absSeconds < 60) {\n return `${sign}${absSeconds.toFixed(0)}s`;\n } else if (absSeconds < 3600) {\n const mins = Math.floor(absSeconds / 60);\n const secs = Math.floor(absSeconds % 60);\n return `${sign}${mins}m ${secs}s`;\n } else if (absSeconds < 86400) {\n const hours = Math.floor(absSeconds / 3600);\n const mins = Math.floor((absSeconds % 3600) / 60);\n return `${sign}${hours}h ${mins}m`;\n } else {\n const days = Math.floor(absSeconds / 86400);\n const hours = Math.floor((absSeconds % 86400) / 3600);\n return `${sign}${days}d ${hours}h`;\n }\n}\n\n/**\n * Format countdown timer (supports negative values for past events)\n * @example formatCountdown(125) // \"T-02:05\"\n * @example formatCountdown(-60) // \"T+01:00\"\n */\nexport function formatCountdown(seconds: number | null | undefined): string {\n if (seconds === null || seconds === undefined || !Number.isFinite(seconds)) {\n return 'T--:--';\n }\n\n const prefix = seconds >= 0 ? 'T-' : 'T+';\n const absSeconds = Math.abs(seconds);\n\n if (absSeconds >= 3600) {\n const hours = Math.floor(absSeconds / 3600);\n const mins = Math.floor((absSeconds % 3600) / 60);\n const secs = Math.floor(absSeconds % 60);\n return `${prefix}${hours}:${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;\n }\n\n const mins = Math.floor(absSeconds / 60);\n const secs = Math.floor(absSeconds % 60);\n return `${prefix}${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;\n}\n\n/**\n * Format UTC timestamp\n * @example formatUTC(new Date()) // \"2026-01-27 14:30:00Z\"\n */\nexport function formatUTC(date: Date | string | null | undefined): string {\n if (!date) return '--:--:-- UTC';\n\n try {\n const d = typeof date === 'string' ? new Date(date) : date;\n if (isNaN(d.getTime())) return '--:--:-- UTC';\n\n return d.toISOString().replace('T', ' ').slice(0, 19) + 'Z';\n } catch {\n return '--:--:-- UTC';\n }\n}\n\n/**\n * Format time only (HH:MM:SS)\n * @example formatTime(new Date()) // \"14:30:00\"\n */\nexport function formatTime(date: Date | string | null | undefined, includeSeconds = true): string {\n if (!date) return includeSeconds ? '--:--:--' : '--:--';\n\n try {\n const d = typeof date === 'string' ? new Date(date) : date;\n if (isNaN(d.getTime())) return includeSeconds ? '--:--:--' : '--:--';\n\n const hours = d.getUTCHours().toString().padStart(2, '0');\n const mins = d.getUTCMinutes().toString().padStart(2, '0');\n const secs = d.getUTCSeconds().toString().padStart(2, '0');\n\n return includeSeconds ? `${hours}:${mins}:${secs}` : `${hours}:${mins}`;\n } catch {\n return includeSeconds ? '--:--:--' : '--:--';\n }\n}\n\n// ============================================================================\n// COORDINATE FORMATTING\n// ============================================================================\n\n/**\n * Format latitude/longitude\n * @example formatCoordinate(32.4, 'lat') // \"32.40° N\"\n * @example formatCoordinate(-117.2, 'lon') // \"117.20° W\"\n */\nexport function formatCoordinate(\n value: number | null | undefined,\n type: 'lat' | 'lon'\n): string {\n if (value === null || value === undefined || !Number.isFinite(value)) {\n return '--°';\n }\n\n const absValue = Math.abs(value);\n let direction: string;\n\n if (type === 'lat') {\n direction = value >= 0 ? 'N' : 'S';\n } else {\n direction = value >= 0 ? 'E' : 'W';\n }\n\n return `${absValue.toFixed(2)}° ${direction}`;\n}\n\n/**\n * Format lat/lon pair\n * @example formatLatLon(32.4, -117.2) // \"32.40° N, 117.20° W\"\n */\nexport function formatLatLon(\n lat: number | null | undefined,\n lon: number | null | undefined\n): string {\n return `${formatCoordinate(lat, 'lat')}, ${formatCoordinate(lon, 'lon')}`;\n}\n\n// ============================================================================\n// ANGLE FORMATTING\n// ============================================================================\n\n/**\n * Format angle in degrees\n * @example formatDegrees(45.5) // \"45.5°\"\n */\nexport function formatDegrees(\n value: number | null | undefined,\n decimals: number = 1\n): string {\n if (value === null || value === undefined || !Number.isFinite(value)) {\n return '--°';\n }\n return `${value.toFixed(decimals)}°`;\n}\n\n/**\n * Format decibels\n * @example formatDecibels(3.5) // \"3.5 dB\"\n */\nexport function formatDecibels(\n value: number | null | undefined,\n decimals: number = 1\n): string {\n if (value === null || value === undefined || !Number.isFinite(value)) {\n return '-- dB';\n }\n return `${value.toFixed(decimals)} dB`;\n}\n\n// ============================================================================\n// VALUE UTILITIES\n// ============================================================================\n\n/**\n * Clamp a value between min and max\n * @example clamp(150, 0, 100) // 100\n */\nexport function clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\n/**\n * Linear interpolation\n * @example lerp(0, 100, 0.5) // 50\n */\nexport function lerp(start: number, end: number, t: number): number {\n return start + (end - start) * clamp(t, 0, 1);\n}\n\n/**\n * Map a value from one range to another\n * @example mapRange(50, 0, 100, 0, 1) // 0.5\n */\nexport function mapRange(\n value: number,\n inMin: number,\n inMax: number,\n outMin: number,\n outMax: number\n): number {\n const t = (value - inMin) / (inMax - inMin);\n return lerp(outMin, outMax, t);\n}\n\n// ============================================================================\n// STATUS UTILITIES\n// ============================================================================\n\nexport type StatusLevel = 'off' | 'standby' | 'normal' | 'caution' | 'serious' | 'critical';\n\n/**\n * Astro UX Design System status colors\n * These match the official Astro status semantics\n */\nexport const STATUS_COLORS: Record<StatusLevel, string> = {\n off: '#a4abb6',\n standby: '#2dccff',\n normal: '#56f000',\n caution: '#fce83a',\n serious: '#ffb302',\n critical: '#ff3838',\n};\n\n/**\n * Get status color from level\n * @example getStatusColor('normal') // '#56f000'\n */\nexport function getStatusColor(status: StatusLevel | null | undefined): string {\n return STATUS_COLORS[status ?? 'off'];\n}\n\n/**\n * Derive status for battery specifically (low is bad)\n * @example deriveBatteryStatus(25) // 'caution'\n */\nexport function deriveBatteryStatus(level: number | undefined | null): StatusLevel {\n if (level === undefined || level === null) return 'off';\n if (level <= 10) return 'critical';\n if (level <= 20) return 'serious';\n if (level <= 30) return 'caution';\n return 'normal';\n}\n\n/**\n * Determine status level from a value and thresholds\n * @example getStatusFromValue(85, { critical: 20, serious: 40, caution: 60, normal: 80 }) // 'normal'\n */\nexport function getStatusFromValue(\n value: number | null | undefined,\n thresholds: {\n critical?: number;\n serious?: number;\n caution?: number;\n normal?: number;\n },\n higherIsBetter: boolean = true\n): StatusLevel {\n if (value === null || value === undefined || !Number.isFinite(value)) {\n return 'off';\n }\n\n const { critical = 10, serious = 25, caution = 50, normal = 75 } = thresholds;\n\n if (higherIsBetter) {\n if (value <= critical) return 'critical';\n if (value <= serious) return 'serious';\n if (value <= caution) return 'caution';\n if (value <= normal) return 'standby';\n return 'normal';\n } else {\n if (value >= critical) return 'critical';\n if (value >= serious) return 'serious';\n if (value >= caution) return 'caution';\n if (value >= normal) return 'standby';\n return 'normal';\n }\n}\n\n// ============================================================================\n// STATUS NORMALIZATION\n// ============================================================================\n\n/**\n * Domain status terms that map to UI StatusLevel\n * This handles common backend/sensor terminology\n */\nconst STATUS_MAPPING: Record<string, StatusLevel> = {\n // → 'off'\n 'off': 'off',\n 'disabled': 'off',\n 'inactive': 'off',\n 'offline': 'off',\n 'unknown': 'off',\n 'null': 'off',\n 'none': 'off',\n \n // → 'standby'\n 'standby': 'standby',\n 'idle': 'standby',\n 'waiting': 'standby',\n 'ready': 'standby',\n 'pending': 'standby',\n 'queued': 'standby',\n \n // → 'normal'\n 'normal': 'normal',\n 'nominal': 'normal',\n 'healthy': 'normal',\n 'ok': 'normal',\n 'good': 'normal',\n 'success': 'normal',\n 'operational': 'normal',\n 'active': 'normal',\n 'online': 'normal',\n 'connected': 'normal',\n 'stable': 'normal',\n 'transmitting': 'normal',\n 'receiving': 'normal',\n \n // → 'caution'\n 'caution': 'caution',\n 'warning': 'caution',\n 'degraded': 'caution',\n 'elevated': 'caution',\n 'alert': 'caution',\n 'attention': 'caution',\n 'limited': 'caution',\n \n // → 'serious'\n 'serious': 'serious',\n 'unstable': 'serious',\n 'danger': 'serious',\n 'severe': 'serious',\n \n // → 'critical'\n 'critical': 'critical',\n 'error': 'critical',\n 'failed': 'critical',\n 'failure': 'critical',\n 'emergency': 'critical',\n 'fault': 'critical',\n 'alarm': 'critical',\n};\n\n/**\n * Normalize any status string to the 6-level StatusLevel system\n * \n * @param status - Any status string from domain/backend\n * @param defaultStatus - Fallback if status is not recognized (default: 'off')\n * @returns StatusLevel\n * \n * @example\n * ```typescript\n * normalizeStatus('degraded') // 'caution'\n * normalizeStatus('nominal') // 'normal'\n * normalizeStatus('transmitting') // 'normal'\n * normalizeStatus('warning') // 'caution'\n * normalizeStatus('error') // 'critical'\n * normalizeStatus(undefined) // 'off'\n * ```\n */\nexport function normalizeStatus(\n status: string | undefined | null,\n defaultStatus: StatusLevel = 'off'\n): StatusLevel {\n if (!status) return defaultStatus;\n \n const normalized = status.toLowerCase().trim();\n return STATUS_MAPPING[normalized] ?? defaultStatus;\n}\n\n/**\n * Check if a string is a valid StatusLevel\n */\nexport function isStatusLevel(value: string): value is StatusLevel {\n return ['off', 'standby', 'normal', 'caution', 'serious', 'critical'].includes(value);\n}\n\n/**\n * Get the severity order of a status (higher = more severe)\n * Useful for sorting or finding worst status\n */\nexport function getStatusSeverity(status: StatusLevel): number {\n const order: Record<StatusLevel, number> = {\n off: 0,\n standby: 1,\n normal: 2,\n caution: 3,\n serious: 4,\n critical: 5,\n };\n return order[status];\n}\n\n/**\n * Get the worst (most severe) status from an array\n * \n * @example\n * ```typescript\n * getWorstStatus(['normal', 'caution', 'normal']) // 'caution'\n * getWorstStatus(['normal', 'critical', 'caution']) // 'critical'\n * ```\n */\nexport function getWorstStatus(statuses: StatusLevel[]): StatusLevel {\n if (statuses.length === 0) return 'off';\n return statuses.reduce((worst, current) => \n getStatusSeverity(current) > getStatusSeverity(worst) ? current : worst\n );\n}\n\n// ============================================================================\n// COLOR UTILITIES\n// ============================================================================\n\n/**\n * Safely add alpha to any CSS color string.\n * Handles hex (#RRGGBB → #RRGGBBAA), rgb(), and rgba() formats.\n *\n * Avoids the common bug of appending a hex alpha string to an rgba() color,\n * which produces invalid CSS (e.g. \"rgba(15, 20, 35, 0.85)80\").\n *\n * @param color - CSS color string (hex, rgb, or rgba)\n * @param alpha - Alpha value 0–1\n * @returns Valid CSS color string with alpha applied\n *\n * @example\n * addAlpha('#1b2d3e', 0.5) // '#1b2d3e80'\n * addAlpha('rgba(15, 20, 35, 0.85)', 0.5) // 'rgba(15, 20, 35, 0.5)'\n * addAlpha('rgb(15, 20, 35)', 0.031) // 'rgba(15, 20, 35, 0.031)'\n */\nexport function addAlpha(color: string, alpha: number): string {\n if (!color) return color;\n const a = Math.max(0, Math.min(1, alpha));\n if (color.startsWith('rgba(')) {\n return color.replace(/,\\s*[\\d.]+\\)\\s*$/, `, ${a})`);\n }\n if (color.startsWith('rgb(')) {\n return color.replace(/^rgb\\(/, 'rgba(').replace(/\\)\\s*$/, `, ${a})`);\n }\n if (color.startsWith('#')) {\n const hexA = Math.round(a * 255).toString(16).padStart(2, '0');\n return `${color}${hexA}`;\n }\n return color;\n}\n\n// ============================================================================\n// COMPONENT STYLE UTILITIES\n// ============================================================================\n\n/**\n * Merge class names, filtering out falsy values\n * @example classNames('base', isActive && 'active', className) // \"base active custom\"\n */\nexport function classNames(...classes: (string | boolean | undefined | null)[]): string {\n return classes.filter(Boolean).join(' ');\n}\n\n/**\n * Generate CSS for tabular numbers (monospace digits)\n */\nexport const tabularNumsStyle: React.CSSProperties = {\n fontVariantNumeric: 'tabular-nums',\n fontFeatureSettings: '\"tnum\" 1',\n};\n\n/**\n * CSS transition presets\n */\nexport const transitions = {\n fast: 'all 150ms ease-out',\n normal: 'all 250ms ease-out',\n slow: 'all 400ms ease-out',\n spring: 'all 300ms cubic-bezier(0.34, 1.56, 0.64, 1)',\n} as const;\n\n/**\n * Focus ring styles for accessibility\n */\nexport const focusRingStyle: React.CSSProperties = {\n outline: '2px solid #4dc3ff',\n outlineOffset: '2px',\n};\n\n/**\n * Compute a WCAG AA safe version of an accent color for use as foreground text\n * on dark backgrounds. If the accent already passes 4.5:1 contrast on typical\n * dark surfaces (L ≈ 0.01), returns it unchanged. Otherwise lightens toward\n * white until the minimum contrast is met.\n *\n * @example safeAccentText('#8b5cf6') // '#a885f8' — lightened to pass 4.5:1\n */\nexport function safeAccentText(accent: string): string {\n const hex = accent.replace('#', '');\n if (hex.length < 6) return accent;\n\n const r = parseInt(hex.slice(0, 2), 16) / 255;\n const g = parseInt(hex.slice(2, 4), 16) / 255;\n const b = parseInt(hex.slice(4, 6), 16) / 255;\n const toLinear = (c: number) =>\n c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);\n const L = 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b);\n\n // Threshold: on a dark surface with L≈0.01 we need text L ≥ 0.22 for 4.5:1\n if (L >= 0.22) return accent;\n\n // Lighten by mixing 25% toward white — reaches ~5.5:1 on typical dark bgs\n const mix = 0.25;\n const lr = Math.min(255, Math.round((r + (1 - r) * mix) * 255));\n const lg = Math.min(255, Math.round((g + (1 - g) * mix) * 255));\n const lb = Math.min(255, Math.round((b + (1 - b) * mix) * 255));\n return `#${lr.toString(16).padStart(2, '0')}${lg.toString(16).padStart(2, '0')}${lb.toString(16).padStart(2, '0')}`;\n}\n\n// =============================================================================\n// Category Palette\n// =============================================================================\n\nexport { CategoryPalette } from './categoryPalette';\n"],"names":["mins","secs"],"mappings":"AAeO,SAAS,eAAkB,OAA6B,UAAgB;AAC7E,SAAO,SAAS;AAClB;AAMO,SAAS,WACd,OACA,WAAmB,GACnB,WAAmB,MACX;AACR,MAAI,UAAU,QAAQ,UAAU,UAAa,CAAC,OAAO,SAAS,KAAK,GAAG;AACpE,WAAO;AAAA,EACT;AACA,SAAO,MAAM,QAAQ,QAAQ;AAC/B;AAKO,SAAS,cAAc,OAAiC;AAC7D,SAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK;AAC3D;AAkBO,SAAS,aACd,OACA,UAA+B,IACvB;AACR,MAAI,UAAU,QAAQ,UAAU,UAAa,CAAC,OAAO,SAAS,KAAK,GAAG;AACpE,WAAO;AAAA,EACT;AAEA,QAAM;AAAA,IACJ,WAAW;AAAA,IACX,SAAS;AAAA,IACT,WAAW;AAAA,IACX;AAAA,IACA,cAAc;AAAA,EAAA,IACZ;AAEJ,MAAI;AACF,UAAM,YAAY,IAAI,KAAK,aAAa,QAAQ;AAAA,MAC9C;AAAA,MACA,uBAAuB,aAAa,YAAY,IAAI;AAAA,MACpD,uBAAuB;AAAA,MACvB;AAAA,IAAA,CACD,EAA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AK,KAAK,OAAO,KAAK,IAAI,KAAK,OAAO,GAAG,CAAC;AAC9D,QAAM,KAAK,KAAK,IAAI,KAAK,KAAK,OAAO,KAAK,IAAI,KAAK,OAAO,GAAG,CAAC;AAC9D,QAAM,KAAK,KAAK,IAAI,KAAK,KAAK,OAAO,KAAK,IAAI,KAAK,OAAO,GAAG,CAAC;AAC9D,SAAO,IAAI,GAAG,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,GAAG,GAAG,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,GAAG,GAAG,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC;AACnH;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/react/utils/index.ts"],"sourcesContent":["/**\n * @zendir/ui - Enterprise Utility Functions\n * \n * Shared utilities for null-safety, formatting, and defensive coding.\n * These utilities ensure components never crash due to undefined data.\n */\n\n// ============================================================================\n// NULL SAFETY UTILITIES\n// ============================================================================\n\n/**\n * Safely access a value with a fallback for null/undefined\n * @example withNullSafety(data?.temperature, 0) // Returns 0 if undefined\n */\nexport function withNullSafety<T>(value: T | null | undefined, fallback: T): T {\n return value ?? fallback;\n}\n\n/**\n * Safely format a number, returning '--' if undefined\n * @example safeNumber(data?.value, 2) // \"123.45\" or \"--\"\n */\nexport function safeNumber(\n value: number | null | undefined,\n decimals: number = 2,\n fallback: string = '--'\n): string {\n if (value === null || value === undefined || !Number.isFinite(value)) {\n return fallback;\n }\n return value.toFixed(decimals);\n}\n\n/**\n * Check if value is a valid finite number\n */\nexport function isValidNumber(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value);\n}\n\n// ============================================================================\n// NUMBER FORMATTING\n// ============================================================================\n\nexport interface FormatNumberOptions {\n decimals?: number;\n locale?: string;\n notation?: 'standard' | 'scientific' | 'engineering' | 'compact';\n unit?: string;\n signDisplay?: 'auto' | 'never' | 'always' | 'exceptZero';\n}\n\n/**\n * Format a number with locale-aware formatting and optional unit\n * @example formatNumber(1234567, { notation: 'compact' }) // \"1.2M\"\n */\nexport function formatNumber(\n value: number | null | undefined,\n options: FormatNumberOptions = {}\n): string {\n if (value === null || value === undefined || !Number.isFinite(value)) {\n return '--';\n }\n\n const {\n decimals = 2,\n locale = 'en-US',\n notation = 'standard',\n unit,\n signDisplay = 'auto',\n } = options;\n\n try {\n const formatted = new Intl.NumberFormat(locale, {\n notation,\n minimumFractionDigits: notation === 'compact' ? 0 : decimals,\n maximumFractionDigits: decimals,\n signDisplay,\n }).format(value);\n\n return unit ? `${formatted} ${unit}` : formatted;\n } catch {\n return value.toFixed(decimals);\n }\n}\n\n/**\n * Format a number with tabular (monospace) digits for alignment\n * Uses font-feature-settings: 'tnum' 1\n */\nexport function formatTabular(\n value: number | null | undefined,\n decimals: number = 2\n): string {\n return safeNumber(value, decimals);\n}\n\n// ============================================================================\n// UNIT-AWARE FORMATTING\n// ============================================================================\n\n/**\n * Format temperature with unit conversion\n * @example formatTemperature(25) // \"25.0°C\"\n * @example formatTemperature(25, 'fahrenheit') // \"77.0°F\"\n */\nexport function formatTemperature(\n celsius: number | null | undefined,\n unit: 'celsius' | 'fahrenheit' | 'kelvin' = 'celsius',\n decimals: number = 1\n): string {\n if (celsius === null || celsius === undefined || !Number.isFinite(celsius)) {\n return '--°C';\n }\n\n switch (unit) {\n case 'fahrenheit':\n return `${((celsius * 9) / 5 + 32).toFixed(decimals)}°F`;\n case 'kelvin':\n return `${(celsius + 273.15).toFixed(decimals)}K`;\n default:\n return `${celsius.toFixed(decimals)}°C`;\n }\n}\n\n/**\n * Format data rate with automatic unit scaling\n * @example formatDataRate(1500000) // \"1.50 Mbps\"\n */\nexport function formatDataRate(bitsPerSecond: number | null | undefined): string {\n if (bitsPerSecond === null || bitsPerSecond === undefined || !Number.isFinite(bitsPerSecond)) {\n return '-- bps';\n }\n\n const units = ['bps', 'Kbps', 'Mbps', 'Gbps', 'Tbps'];\n let unitIndex = 0;\n let value = bitsPerSecond;\n\n while (value >= 1000 && unitIndex < units.length - 1) {\n value /= 1000;\n unitIndex++;\n }\n\n return `${value.toFixed(2)} ${units[unitIndex]}`;\n}\n\n/**\n * Format distance with automatic unit scaling\n * @example formatDistance(1500) // \"1.50 km\"\n */\nexport function formatDistance(meters: number | null | undefined): string {\n if (meters === null || meters === undefined || !Number.isFinite(meters)) {\n return '-- m';\n }\n\n if (meters >= 1_000_000) {\n return `${(meters / 1_000_000).toFixed(2)} Mm`;\n } else if (meters >= 1_000) {\n return `${(meters / 1_000).toFixed(2)} km`;\n } else if (meters < 1) {\n return `${(meters * 100).toFixed(1)} cm`;\n }\n return `${meters.toFixed(1)} m`;\n}\n\n/**\n * Format altitude (always in km for space ops)\n * @example formatAltitude(418.2) // \"418.2 km\"\n */\nexport function formatAltitude(km: number | null | undefined): string {\n if (km === null || km === undefined || !Number.isFinite(km)) {\n return '-- km';\n }\n return `${km.toFixed(1)} km`;\n}\n\n/**\n * Format velocity\n * @example formatVelocity(7.66) // \"7.66 km/s\"\n */\nexport function formatVelocity(kmPerSec: number | null | undefined): string {\n if (kmPerSec === null || kmPerSec === undefined || !Number.isFinite(kmPerSec)) {\n return '-- km/s';\n }\n return `${kmPerSec.toFixed(2)} km/s`;\n}\n\n/**\n * Format percentage with bounds checking\n * @example formatPercentage(0.856) // \"85.6%\"\n * @example formatPercentage(85.6, false) // \"85.6%\" (already percentage)\n */\nexport function formatPercentage(\n value: number | null | undefined,\n isDecimal: boolean = false,\n decimals: number = 1\n): string {\n if (value === null || value === undefined || !Number.isFinite(value)) {\n return '--%';\n }\n\n const percentage = isDecimal ? value * 100 : value;\n return `${percentage.toFixed(decimals)}%`;\n}\n\n/**\n * Format power (watts) with auto-scaling\n * @example formatPower(1500) // \"1.50 kW\"\n */\nexport function formatPower(watts: number | null | undefined): string {\n if (watts === null || watts === undefined || !Number.isFinite(watts)) {\n return '-- W';\n }\n\n if (Math.abs(watts) >= 1_000_000) {\n return `${(watts / 1_000_000).toFixed(2)} MW`;\n } else if (Math.abs(watts) >= 1_000) {\n return `${(watts / 1_000).toFixed(2)} kW`;\n } else if (Math.abs(watts) < 1) {\n return `${(watts * 1000).toFixed(1)} mW`;\n }\n return `${watts.toFixed(1)} W`;\n}\n\n/**\n * Format frequency (Hz) with auto-scaling\n * @example formatFrequency(2400000000) // \"2.40 GHz\"\n */\nexport function formatFrequency(hz: number | null | undefined): string {\n if (hz === null || hz === undefined || !Number.isFinite(hz)) {\n return '-- Hz';\n }\n\n if (hz >= 1_000_000_000) {\n return `${(hz / 1_000_000_000).toFixed(2)} GHz`;\n } else if (hz >= 1_000_000) {\n return `${(hz / 1_000_000).toFixed(2)} MHz`;\n } else if (hz >= 1_000) {\n return `${(hz / 1_000).toFixed(2)} kHz`;\n }\n return `${hz.toFixed(0)} Hz`;\n}\n\n// ============================================================================\n// TIME FORMATTING\n// ============================================================================\n\n/**\n * Format duration in human-readable form\n * @example formatDuration(3661) // \"1h 1m 1s\"\n */\nexport function formatDuration(seconds: number | null | undefined): string {\n if (seconds === null || seconds === undefined || !Number.isFinite(seconds)) {\n return '--:--';\n }\n\n const absSeconds = Math.abs(seconds);\n const sign = seconds < 0 ? '-' : '';\n\n if (absSeconds < 60) {\n return `${sign}${absSeconds.toFixed(0)}s`;\n } else if (absSeconds < 3600) {\n const mins = Math.floor(absSeconds / 60);\n const secs = Math.floor(absSeconds % 60);\n return `${sign}${mins}m ${secs}s`;\n } else if (absSeconds < 86400) {\n const hours = Math.floor(absSeconds / 3600);\n const mins = Math.floor((absSeconds % 3600) / 60);\n return `${sign}${hours}h ${mins}m`;\n } else {\n const days = Math.floor(absSeconds / 86400);\n const hours = Math.floor((absSeconds % 86400) / 3600);\n return `${sign}${days}d ${hours}h`;\n }\n}\n\n/**\n * Format countdown timer (supports negative values for past events)\n * @example formatCountdown(125) // \"T-02:05\"\n * @example formatCountdown(-60) // \"T+01:00\"\n */\nexport function formatCountdown(seconds: number | null | undefined): string {\n if (seconds === null || seconds === undefined || !Number.isFinite(seconds)) {\n return 'T--:--';\n }\n\n const prefix = seconds >= 0 ? 'T-' : 'T+';\n const absSeconds = Math.abs(seconds);\n\n if (absSeconds >= 3600) {\n const hours = Math.floor(absSeconds / 3600);\n const mins = Math.floor((absSeconds % 3600) / 60);\n const secs = Math.floor(absSeconds % 60);\n return `${prefix}${hours}:${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;\n }\n\n const mins = Math.floor(absSeconds / 60);\n const secs = Math.floor(absSeconds % 60);\n return `${prefix}${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;\n}\n\n/**\n * Format UTC timestamp\n * @example formatUTC(new Date()) // \"2026-01-27 14:30:00Z\"\n */\nexport function formatUTC(date: Date | string | null | undefined): string {\n if (!date) return '--:--:-- UTC';\n\n try {\n const d = typeof date === 'string' ? new Date(date) : date;\n if (isNaN(d.getTime())) return '--:--:-- UTC';\n\n return d.toISOString().replace('T', ' ').slice(0, 19) + 'Z';\n } catch {\n return '--:--:-- UTC';\n }\n}\n\n/**\n * Format time only (HH:MM:SS)\n * @example formatTime(new Date()) // \"14:30:00\"\n */\nexport function formatTime(date: Date | string | null | undefined, includeSeconds = true): string {\n if (!date) return includeSeconds ? '--:--:--' : '--:--';\n\n try {\n const d = typeof date === 'string' ? new Date(date) : date;\n if (isNaN(d.getTime())) return includeSeconds ? '--:--:--' : '--:--';\n\n const hours = d.getUTCHours().toString().padStart(2, '0');\n const mins = d.getUTCMinutes().toString().padStart(2, '0');\n const secs = d.getUTCSeconds().toString().padStart(2, '0');\n\n return includeSeconds ? `${hours}:${mins}:${secs}` : `${hours}:${mins}`;\n } catch {\n return includeSeconds ? '--:--:--' : '--:--';\n }\n}\n\n// ============================================================================\n// COORDINATE FORMATTING\n// ============================================================================\n\n/**\n * Format latitude/longitude\n * @example formatCoordinate(32.4, 'lat') // \"32.40° N\"\n * @example formatCoordinate(-117.2, 'lon') // \"117.20° W\"\n */\nexport function formatCoordinate(\n value: number | null | undefined,\n type: 'lat' | 'lon'\n): string {\n if (value === null || value === undefined || !Number.isFinite(value)) {\n return '--°';\n }\n\n const absValue = Math.abs(value);\n let direction: string;\n\n if (type === 'lat') {\n direction = value >= 0 ? 'N' : 'S';\n } else {\n direction = value >= 0 ? 'E' : 'W';\n }\n\n return `${absValue.toFixed(2)}° ${direction}`;\n}\n\n/**\n * Format lat/lon pair\n * @example formatLatLon(32.4, -117.2) // \"32.40° N, 117.20° W\"\n */\nexport function formatLatLon(\n lat: number | null | undefined,\n lon: number | null | undefined\n): string {\n return `${formatCoordinate(lat, 'lat')}, ${formatCoordinate(lon, 'lon')}`;\n}\n\n// ============================================================================\n// ANGLE FORMATTING\n// ============================================================================\n\n/**\n * Format angle in degrees\n * @example formatDegrees(45.5) // \"45.5°\"\n */\nexport function formatDegrees(\n value: number | null | undefined,\n decimals: number = 1\n): string {\n if (value === null || value === undefined || !Number.isFinite(value)) {\n return '--°';\n }\n return `${value.toFixed(decimals)}°`;\n}\n\n/**\n * Format decibels\n * @example formatDecibels(3.5) // \"3.5 dB\"\n */\nexport function formatDecibels(\n value: number | null | undefined,\n decimals: number = 1\n): string {\n if (value === null || value === undefined || !Number.isFinite(value)) {\n return '-- dB';\n }\n return `${value.toFixed(decimals)} dB`;\n}\n\n// ============================================================================\n// VALUE UTILITIES\n// ============================================================================\n\n/**\n * Clamp a value between min and max\n * @example clamp(150, 0, 100) // 100\n */\nexport function clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\n/**\n * Linear interpolation\n * @example lerp(0, 100, 0.5) // 50\n */\nexport function lerp(start: number, end: number, t: number): number {\n return start + (end - start) * clamp(t, 0, 1);\n}\n\n/**\n * Map a value from one range to another\n * @example mapRange(50, 0, 100, 0, 1) // 0.5\n */\nexport function mapRange(\n value: number,\n inMin: number,\n inMax: number,\n outMin: number,\n outMax: number\n): number {\n const t = (value - inMin) / (inMax - inMin);\n return lerp(outMin, outMax, t);\n}\n\n// ============================================================================\n// STATUS UTILITIES\n// ============================================================================\n\nexport type StatusLevel = 'off' | 'standby' | 'normal' | 'caution' | 'serious' | 'critical';\n\n/**\n * Astro UX Design System status colors\n * These match the official Astro status semantics\n */\nexport const STATUS_COLORS: Record<StatusLevel, string> = {\n off: '#a4abb6',\n standby: '#2dccff',\n normal: '#56f000',\n caution: '#fce83a',\n serious: '#ffb302',\n critical: '#ff3838',\n};\n\n/**\n * Get status color from level\n * @example getStatusColor('normal') // '#56f000'\n */\nexport function getStatusColor(status: StatusLevel | null | undefined): string {\n return STATUS_COLORS[status ?? 'off'];\n}\n\n/**\n * Derive status for battery specifically (low is bad)\n * @example deriveBatteryStatus(25) // 'caution'\n */\nexport function deriveBatteryStatus(level: number | undefined | null): StatusLevel {\n if (level === undefined || level === null) return 'off';\n if (level <= 10) return 'critical';\n if (level <= 20) return 'serious';\n if (level <= 30) return 'caution';\n return 'normal';\n}\n\n/**\n * Determine status level from a value and thresholds\n * @example getStatusFromValue(85, { critical: 20, serious: 40, caution: 60, normal: 80 }) // 'normal'\n */\nexport function getStatusFromValue(\n value: number | null | undefined,\n thresholds: {\n critical?: number;\n serious?: number;\n caution?: number;\n normal?: number;\n },\n higherIsBetter: boolean = true\n): StatusLevel {\n if (value === null || value === undefined || !Number.isFinite(value)) {\n return 'off';\n }\n\n const { critical = 10, serious = 25, caution = 50, normal = 75 } = thresholds;\n\n if (higherIsBetter) {\n if (value <= critical) return 'critical';\n if (value <= serious) return 'serious';\n if (value <= caution) return 'caution';\n if (value <= normal) return 'standby';\n return 'normal';\n } else {\n if (value >= critical) return 'critical';\n if (value >= serious) return 'serious';\n if (value >= caution) return 'caution';\n if (value >= normal) return 'standby';\n return 'normal';\n }\n}\n\n// ============================================================================\n// STATUS NORMALIZATION\n// ============================================================================\n\n/**\n * Domain status terms that map to UI StatusLevel\n * This handles common backend/sensor terminology\n */\nconst STATUS_MAPPING: Record<string, StatusLevel> = {\n // → 'off'\n 'off': 'off',\n 'disabled': 'off',\n 'inactive': 'off',\n 'offline': 'off',\n 'unknown': 'off',\n 'null': 'off',\n 'none': 'off',\n \n // → 'standby'\n 'standby': 'standby',\n 'idle': 'standby',\n 'waiting': 'standby',\n 'ready': 'standby',\n 'pending': 'standby',\n 'queued': 'standby',\n \n // → 'normal'\n 'normal': 'normal',\n 'nominal': 'normal',\n 'healthy': 'normal',\n 'ok': 'normal',\n 'good': 'normal',\n 'success': 'normal',\n 'operational': 'normal',\n 'active': 'normal',\n 'online': 'normal',\n 'connected': 'normal',\n 'stable': 'normal',\n 'transmitting': 'normal',\n 'receiving': 'normal',\n \n // → 'caution'\n 'caution': 'caution',\n 'warning': 'caution',\n 'degraded': 'caution',\n 'elevated': 'caution',\n 'alert': 'caution',\n 'attention': 'caution',\n 'limited': 'caution',\n \n // → 'serious'\n 'serious': 'serious',\n 'unstable': 'serious',\n 'danger': 'serious',\n 'severe': 'serious',\n \n // → 'critical'\n 'critical': 'critical',\n 'error': 'critical',\n 'failed': 'critical',\n 'failure': 'critical',\n 'emergency': 'critical',\n 'fault': 'critical',\n 'alarm': 'critical',\n};\n\n/**\n * Normalize any status string to the 6-level StatusLevel system\n * \n * @param status - Any status string from domain/backend\n * @param defaultStatus - Fallback if status is not recognized (default: 'off')\n * @returns StatusLevel\n * \n * @example\n * ```typescript\n * normalizeStatus('degraded') // 'caution'\n * normalizeStatus('nominal') // 'normal'\n * normalizeStatus('transmitting') // 'normal'\n * normalizeStatus('warning') // 'caution'\n * normalizeStatus('error') // 'critical'\n * normalizeStatus(undefined) // 'off'\n * ```\n */\nexport function normalizeStatus(\n status: string | undefined | null,\n defaultStatus: StatusLevel = 'off'\n): StatusLevel {\n if (!status) return defaultStatus;\n \n const normalized = status.toLowerCase().trim();\n return STATUS_MAPPING[normalized] ?? defaultStatus;\n}\n\n/**\n * Check if a string is a valid StatusLevel\n */\nexport function isStatusLevel(value: string): value is StatusLevel {\n return ['off', 'standby', 'normal', 'caution', 'serious', 'critical'].includes(value);\n}\n\n/**\n * Get the severity order of a status (higher = more severe)\n * Useful for sorting or finding worst status\n */\nexport function getStatusSeverity(status: StatusLevel): number {\n const order: Record<StatusLevel, number> = {\n off: 0,\n standby: 1,\n normal: 2,\n caution: 3,\n serious: 4,\n critical: 5,\n };\n return order[status];\n}\n\n/**\n * Get the worst (most severe) status from an array\n * \n * @example\n * ```typescript\n * getWorstStatus(['normal', 'caution', 'normal']) // 'caution'\n * getWorstStatus(['normal', 'critical', 'caution']) // 'critical'\n * ```\n */\nexport function getWorstStatus(statuses: StatusLevel[]): StatusLevel {\n if (statuses.length === 0) return 'off';\n return statuses.reduce((worst, current) => \n getStatusSeverity(current) > getStatusSeverity(worst) ? current : worst\n );\n}\n\n// ============================================================================\n// COLOR UTILITIES\n// ============================================================================\n\n/**\n * Safely add alpha to any CSS color string.\n * Handles hex (#RRGGBB → #RRGGBBAA), rgb(), and rgba() formats.\n *\n * Avoids the common bug of appending a hex alpha string to an rgba() color,\n * which produces invalid CSS (e.g. \"rgba(15, 20, 35, 0.85)80\").\n *\n * @param color - CSS color string (hex, rgb, or rgba)\n * @param alpha - Alpha value 0–1\n * @returns Valid CSS color string with alpha applied\n *\n * @example\n * addAlpha('#1b2d3e', 0.5) // '#1b2d3e80'\n * addAlpha('rgba(15, 20, 35, 0.85)', 0.5) // 'rgba(15, 20, 35, 0.5)'\n * addAlpha('rgb(15, 20, 35)', 0.031) // 'rgba(15, 20, 35, 0.031)'\n */\nexport function addAlpha(color: string, alpha: number): string {\n if (!color) return color;\n const a = Math.max(0, Math.min(1, alpha));\n if (color.startsWith('rgba(')) {\n return color.replace(/,\\s*[\\d.]+\\)\\s*$/, `, ${a})`);\n }\n if (color.startsWith('rgb(')) {\n return color.replace(/^rgb\\(/, 'rgba(').replace(/\\)\\s*$/, `, ${a})`);\n }\n if (color.startsWith('#')) {\n const hexA = Math.round(a * 255).toString(16).padStart(2, '0');\n return `${color}${hexA}`;\n }\n return color;\n}\n\n// ============================================================================\n// COMPONENT STYLE UTILITIES\n// ============================================================================\n\n/**\n * Merge class names, filtering out falsy values\n * @example classNames('base', isActive && 'active', className) // \"base active custom\"\n */\nexport function classNames(...classes: (string | boolean | undefined | null)[]): string {\n return classes.filter(Boolean).join(' ');\n}\n\n/**\n * Generate CSS for tabular numbers (monospace digits)\n */\nexport const tabularNumsStyle: React.CSSProperties = {\n fontVariantNumeric: 'tabular-nums',\n fontFeatureSettings: '\"tnum\" 1',\n};\n\n/**\n * CSS transition presets\n */\nexport const transitions = {\n fast: 'all 150ms ease-out',\n normal: 'all 250ms ease-out',\n slow: 'all 400ms ease-out',\n spring: 'all 300ms cubic-bezier(0.34, 1.56, 0.64, 1)',\n} as const;\n\n/**\n * Focus ring styles for accessibility\n */\nexport const focusRingStyle: React.CSSProperties = {\n outline: '2px solid #4dc3ff',\n outlineOffset: '2px',\n};\n\n/**\n * Compute a WCAG AA safe version of an accent color for use as foreground text\n * on dark backgrounds. If the accent already passes 4.5:1 contrast on typical\n * dark surfaces (L ≈ 0.01), returns it unchanged. Otherwise lightens toward\n * white until the minimum contrast is met.\n *\n * @example safeAccentText('#8b5cf6') // '#a885f8' — lightened to pass 4.5:1\n */\nexport function safeAccentText(accent: string): string {\n const hex = accent.replace('#', '');\n if (hex.length < 6) return accent;\n\n const r = parseInt(hex.slice(0, 2), 16) / 255;\n const g = parseInt(hex.slice(2, 4), 16) / 255;\n const b = parseInt(hex.slice(4, 6), 16) / 255;\n const toLinear = (c: number) =>\n c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);\n const L = 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b);\n\n // Threshold: on a dark surface with L≈0.01 we need text L ≥ 0.22 for 4.5:1\n if (L >= 0.22) return accent;\n\n // Lighten by mixing 25% toward white — reaches ~5.5:1 on typical dark bgs\n const mix = 0.25;\n const lr = Math.min(255, Math.round((r + (1 - r) * mix) * 255));\n const lg = Math.min(255, Math.round((g + (1 - g) * mix) * 255));\n const lb = Math.min(255, Math.round((b + (1 - b) * mix) * 255));\n return `#${lr.toString(16).padStart(2, '0')}${lg.toString(16).padStart(2, '0')}${lb.toString(16).padStart(2, '0')}`;\n}\n\n// =============================================================================\n// Category Palette\n// =============================================================================\n\nexport { CategoryPalette } from './categoryPalette';\n"],"names":["mins","secs"],"mappings":"AAeO,SAAS,eAAkB,OAA6B,UAAgB;AAC7E,SAAO,SAAS;AAClB;AAMO,SAAS,WACd,OACA,WAAmB,GACnB,WAAmB,MACX;AACR,MAAI,UAAU,QAAQ,UAAU,UAAa,CAAC,OAAO,SAAS,KAAK,GAAG;AACpE,WAAO;AAAA,EACT;AACA,SAAO,MAAM,QAAQ,QAAQ;AAC/B;AAKO,SAAS,cAAc,OAAiC;AAC7D,SAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK;AAC3D;AAkBO,SAAS,aACd,OACA,UAA+B,IACvB;AACR,MAAI,UAAU,QAAQ,UAAU,UAAa,CAAC,OAAO,SAAS,KAAK,GAAG;AACpE,WAAO;AAAA,EACT;AAEA,QAAM;AAAA,IACJ,WAAW;AAAA,IACX,SAAS;AAAA,IACT,WAAW;AAAA,IACX;AAAA,IACA,cAAc;AAAA,EAAA,IACZ;AAEJ,MAAI;AACF,UAAM,YAAY,IAAI,KAAK,aAAa,QAAQ;AAAA,MAC9C;AAAA,MACA,uBAAuB,aAAa,YAAY,IAAI;AAAA,MACpD,uBAAuB;AAAA,MACvB;AAAA,IAAA,CACD,EAAE,OAAO,KAAK;AAEf,WAAO,OAAO,GAAG,SAAS,IAAI,IAAI,KAAK;AAAA,EACzC,QAAQ;AACN,WAAO,MAAM,QAAQ,QAAQ;AAAA,EAC/B;AACF;AAMO,SAAS,cACd,OACA,WAAmB,GACX;AACR,SAAO,WAAW,OAAO,QAAQ;AACnC;AAWO,SAAS,kBACd,SACA,OAA4C,WAC5C,WAAmB,GACX;AACR,MAAI,YAAY,QAAQ,YAAY,UAAa,CAAC,OAAO,SAAS,OAAO,GAAG;AAC1E,WAAO;AAAA,EACT;AAEA,UAAQ,MAAA;AA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KAAK,IAAI,KAAK,OAAO,GAAG,CAAC;AAC9D,SAAO,IAAI,GAAG,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,GAAG,GAAG,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,GAAG,GAAG,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC;AACnH;"}
|
package/dist/react.js
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Skeleton3D, SkeletonBox, SkeletonCard, SkeletonChart, SkeletonCircle, SkeletonText } from "./react/shared/Skeleton.js";
|
|
3
|
-
import { STATUS_COLORS, addAlpha, clamp, classNames, focusRingStyle, formatAltitude, formatCoordinate, formatCountdown, formatDataRate, formatDecibels, formatDegrees, formatDistance, formatDuration, formatFrequency, formatLatLon, formatNumber, formatPercentage, formatPower, formatTabular, formatTemperature, formatTime, formatUTC, formatVelocity, getStatusColor, getStatusFromValue, getStatusSeverity, getWorstStatus, isStatusLevel, isValidNumber, lerp, mapRange, normalizeStatus, safeAccentText, safeNumber, tabularNumsStyle, transitions, withNullSafety } from "./react/utils/index.js";
|
|
4
|
-
import { useCompactMode } from "./react/hooks/useCompactMode.js";
|
|
5
|
-
import { PLANETS, auToKm, estimateOrbitalPeriod, estimateOrbitalVelocity, getPlanet, normalizePlanetName } from "./react/types.js";
|
|
6
|
-
import { ActivityPlanner } from "./react/core/widgets/ActivityPlanner.js";
|
|
7
|
-
import { AppBar } from "./react/core/navigation/AppBar.js";
|
|
8
|
-
import { AstroChart } from "./react/charts/unified/AstroChart.js";
|
|
9
|
-
import { BREAKPOINTS, useBreakpoint } from "./react/core/layout/useBreakpoint.js";
|
|
10
|
-
import { Badge } from "./react/core/display/Badge.js";
|
|
11
|
-
import { Body1, Body2, Body3, Compact, DataText, Display1, Display2, FONT_FAMILY_MONO, FONT_FAMILY_PRIMARY, FONT_WEIGHTS, H1, H2, H3, H4, H5, H6, Label, Micro, Mono, Typography } from "./react/core/display/Typography.js";
|
|
12
|
-
import { Box } from "./react/core/layout/Box.js";
|
|
1
|
+
import { Icon, getIconNames, isValidIconName } from "./react/core/display/Icon.js";
|
|
13
2
|
import { Button } from "./react/core/inputs/Button.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { Capture, loadCapturePlaceholderImage, useCapture } from "./react/core/widgets/Capture.js";
|
|
18
|
-
import { CardHeader } from "./react/core/display/CardHeader.js";
|
|
19
|
-
import { CategoryPalette } from "./react/utils/categoryPalette.js";
|
|
20
|
-
import { CategoryProvider, useCategoryPalette, useCategoryPaletteRequired } from "./react/context/CategoryContext.js";
|
|
21
|
-
import { Center } from "./react/core/layout/Center.js";
|
|
3
|
+
import { Input } from "./react/core/inputs/Input.js";
|
|
4
|
+
import { Select } from "./react/core/inputs/Select.js";
|
|
5
|
+
import { Toggle } from "./react/core/inputs/Toggle.js";
|
|
22
6
|
import { Checkbox } from "./react/core/inputs/Checkbox.js";
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import { ConnectionForm } from "./react/core/widgets/ConnectionForm.js";
|
|
7
|
+
import { Tooltip } from "./react/core/overlays/Tooltip.js";
|
|
8
|
+
import { Dialog } from "./react/core/feedback/Dialog.js";
|
|
9
|
+
import { Badge } from "./react/core/display/Badge.js";
|
|
10
|
+
import { Tabs } from "./react/core/navigation/Tabs.js";
|
|
28
11
|
import { Container } from "./react/core/display/Container.js";
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
12
|
+
import { GLASS_COLOR_OVERLAYS, GlassCard } from "./react/core/display/GlassCard.js";
|
|
13
|
+
import { Pagination } from "./react/core/navigation/Pagination.js";
|
|
31
14
|
import { DataValue, DataValueGroup } from "./react/core/data/DataValue.js";
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
15
|
+
import { HeaderIconWithStatus } from "./react/core/display/HeaderIconWithStatus.js";
|
|
16
|
+
import { CardHeader } from "./react/core/display/CardHeader.js";
|
|
17
|
+
import { CATEGORY_ICONS, CATEGORY_LABELS, PROPERTY_PRESETS, createPropertyConfig, deriveBatteryStatus, deriveStatus, formatPropertyLabel, formatPropertyValue, getPropertiesByCategory, getPropertyConfig } from "./react/core/data/propertyConfig.js";
|
|
18
|
+
import { MessageStream } from "./react/core/widgets/MessageStream.js";
|
|
19
|
+
import { AppBar } from "./react/core/navigation/AppBar.js";
|
|
20
|
+
import { ColorPickerPanel } from "./react/core/widgets/ColorPickerPanel.js";
|
|
21
|
+
import { Body1, Body2, Body3, Compact, DataText, Display1, Display2, FONT_FAMILY_MONO, FONT_FAMILY_PRIMARY, FONT_WEIGHTS, H1, H2, H3, H4, H5, H6, Label, Micro, Mono, Typography } from "./react/core/display/Typography.js";
|
|
22
|
+
import { NumberInput } from "./react/core/inputs/NumberInput.js";
|
|
23
|
+
import { SIDENAV_HEADER_LOGO_SLOT_HEIGHT_PX, SideNav } from "./react/core/navigation/SideNav.js";
|
|
24
|
+
import { ToastProvider, useToast, useToastManager } from "./react/core/feedback/Toast.js";
|
|
25
|
+
import { Menu, Popover } from "./react/core/overlays/Popover.js";
|
|
26
|
+
import { Box } from "./react/core/layout/Box.js";
|
|
36
27
|
import { Flex } from "./react/core/layout/Flex.js";
|
|
37
|
-
import { GLASS_COLOR_OVERLAYS, GlassCard } from "./react/core/display/GlassCard.js";
|
|
38
|
-
import { GlobalStatusBar } from "./react/astro/GlobalStatusBar.js";
|
|
39
28
|
import { Grid } from "./react/core/layout/Grid.js";
|
|
40
|
-
import { GroundTrackMap } from "./react/charts/GroundTrackMap.js";
|
|
41
29
|
import { HStack, Stack, VStack } from "./react/core/layout/Stack.js";
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
30
|
+
import { Center } from "./react/core/layout/Center.js";
|
|
31
|
+
import { Spacer } from "./react/core/layout/Spacer.js";
|
|
32
|
+
import { Divider } from "./react/core/layout/Divider.js";
|
|
33
|
+
import { BREAKPOINTS, useBreakpoint } from "./react/core/layout/useBreakpoint.js";
|
|
34
|
+
import { resolveResponsive, resolveSpacing } from "./react/core/layout/responsive.js";
|
|
35
|
+
import { ConfirmDialog, ConfirmProvider, useConfirm } from "./react/core/feedback/ConfirmDialog.js";
|
|
36
|
+
import { PinInput } from "./react/core/inputs/PinInput.js";
|
|
37
|
+
import { CopyButton, useCopyToClipboard } from "./react/core/display/CopyButton.js";
|
|
38
|
+
import { DataTable, DataTableRowDetail } from "./react/core/data/DataTable.js";
|
|
45
39
|
import { ImageGallery } from "./react/core/widgets/ImageGallery.js";
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
40
|
+
import { CHAT_RESPONSE_JSON_PROMPT, CHAT_RESPONSE_MCP_TOOL, CHAT_RESPONSE_TOOL_SCHEMA, CHAT_RESPONSE_YAML_PROMPT, CHAT_STATUS_RULES_PROMPT, ChatPanel, createChatResponseParser, parseChatResponse, parseMcpToolResult } from "./react/core/widgets/ChatPanel.js";
|
|
41
|
+
import { ConnectionForm } from "./react/core/widgets/ConnectionForm.js";
|
|
42
|
+
import { SidePanel } from "./react/core/overlays/SidePanel.js";
|
|
43
|
+
import { HexViewer, REGION_BORDER_COLORS, REGION_COLORS } from "./react/core/widgets/HexViewer.js";
|
|
48
44
|
import { LimitsBar } from "./react/core/inputs/LimitsBar.js";
|
|
49
45
|
import { LogViewer } from "./react/core/widgets/LogViewer.js";
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
46
|
+
import { PacketViewer } from "./react/core/widgets/PacketViewer.js";
|
|
47
|
+
import { CommandBuilder } from "./react/core/widgets/CommandBuilder.js";
|
|
48
|
+
import { FileExplorer } from "./react/core/widgets/FileExplorer.js";
|
|
53
49
|
import { MissionCalendar } from "./react/core/widgets/MissionCalendar.js";
|
|
50
|
+
import { ActivityPlanner } from "./react/core/widgets/ActivityPlanner.js";
|
|
51
|
+
import { Capture, loadCapturePlaceholderImage, useCapture } from "./react/core/widgets/Capture.js";
|
|
52
|
+
import { ZenSpace3D } from "./react/3d/ZenSpace3D.js";
|
|
53
|
+
import { ecefEulerXyzToHpr, ecefMetersToSdkPosition } from "./react/3d/CesiumCaptureSource.js";
|
|
54
|
+
import { useSimulationScene } from "./react/hooks/useSimulationScene.js";
|
|
55
|
+
import { ThemeProvider, useScrollbarStyles, useTheme, useThemeTokens } from "./react/theme/ThemeProvider.js";
|
|
56
|
+
import { CARD_ACCENT_COLORS, CardAccentProvider, SPACE_SYSTEM_COLORS, getAccentColorOptions, getSystemAccentColor, useCardAccent } from "./react/theme/cardAccent.js";
|
|
57
|
+
import { ErrorBoundary, withErrorBoundary } from "./react/shared/ErrorBoundary.js";
|
|
58
|
+
import { Skeleton3D, SkeletonBox, SkeletonCard, SkeletonChart, SkeletonCircle, SkeletonText } from "./react/shared/Skeleton.js";
|
|
59
|
+
import { STATUS_COLORS, addAlpha, clamp, classNames, focusRingStyle, formatAltitude, formatCoordinate, formatCountdown, formatDataRate, formatDecibels, formatDegrees, formatDistance, formatDuration, formatFrequency, formatLatLon, formatNumber, formatPercentage, formatPower, formatTabular, formatTemperature, formatTime, formatUTC, formatVelocity, getStatusColor, getStatusFromValue, getStatusSeverity, getWorstStatus, isStatusLevel, isValidNumber, lerp, mapRange, normalizeStatus, safeAccentText, safeNumber, tabularNumsStyle, transitions, withNullSafety } from "./react/utils/index.js";
|
|
60
|
+
import { StatusIndicator } from "./react/astro/StatusIndicator.js";
|
|
61
|
+
import { ClassificationBanner } from "./react/astro/ClassificationBanner.js";
|
|
62
|
+
import { GlobalStatusBar } from "./react/astro/GlobalStatusBar.js";
|
|
54
63
|
import { MissionClock } from "./react/astro/MissionClock.js";
|
|
64
|
+
import { MiniSimulationControls, SimulationControls, SimulationControlsWithClock } from "./react/astro/SimulationControls.js";
|
|
55
65
|
import { MonitoringIcon } from "./react/astro/MonitoringIcon.js";
|
|
56
|
-
import { Notification } from "./react/astro/Notification.js";
|
|
57
|
-
import { NumberInput } from "./react/core/inputs/NumberInput.js";
|
|
58
|
-
import { ObjectInventoryPanel, recommendedFlyDistance } from "./react/panels/ObjectInventoryPanel.js";
|
|
59
|
-
import { PacketViewer } from "./react/core/widgets/PacketViewer.js";
|
|
60
|
-
import { Pagination } from "./react/core/navigation/Pagination.js";
|
|
61
|
-
import { PinInput } from "./react/core/inputs/PinInput.js";
|
|
62
66
|
import { Progress } from "./react/astro/Progress.js";
|
|
63
|
-
import {
|
|
64
|
-
import { Select } from "./react/core/inputs/Select.js";
|
|
65
|
-
import { SidePanel } from "./react/core/overlays/SidePanel.js";
|
|
66
|
-
import { Spacer } from "./react/core/layout/Spacer.js";
|
|
67
|
-
import { StatusIndicator } from "./react/astro/StatusIndicator.js";
|
|
68
|
-
import { Tabs } from "./react/core/navigation/Tabs.js";
|
|
69
|
-
import { ThemeProvider, useScrollbarStyles, useTheme, useThemeTokens } from "./react/theme/ThemeProvider.js";
|
|
67
|
+
import { Notification } from "./react/astro/Notification.js";
|
|
70
68
|
import { UnifiedTimeline } from "./react/astro/UnifiedTimeline.js";
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
76
|
-
import {
|
|
77
|
-
import {
|
|
69
|
+
import { GroundTrackMap } from "./react/charts/GroundTrackMap.js";
|
|
70
|
+
import { useCompactMode } from "./react/hooks/useCompactMode.js";
|
|
71
|
+
import { ObjectInventoryPanel, recommendedFlyDistance } from "./react/panels/ObjectInventoryPanel.js";
|
|
72
|
+
import { LayerControlPanel } from "./react/panels/LayerControlPanel.js";
|
|
73
|
+
import { PLANETS, auToKm, estimateOrbitalPeriod, estimateOrbitalVelocity, getPlanet, normalizePlanetName } from "./react/types.js";
|
|
74
|
+
import { AstroChart } from "./react/charts/unified/AstroChart.js";
|
|
75
|
+
import { CategoryPalette } from "./react/utils/categoryPalette.js";
|
|
76
|
+
import { CategoryProvider, useCategoryPalette, useCategoryPaletteRequired } from "./react/context/CategoryContext.js";
|
|
77
|
+
import { DisplaySettingsProvider, GLASS_TINTS, PRESET_COLORS, getEffectiveCompactMode, useDisplaySettings, useDisplaySettingsOptional } from "./react/context/DisplaySettingsContext.js";
|
|
78
78
|
export {
|
|
79
79
|
ActivityPlanner,
|
|
80
80
|
AppBar,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendir/ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "React UI components for space operations, built on the Astro UX Design System",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,76 +39,84 @@
|
|
|
39
39
|
"import": "./dist/react/chatgpt/index.js"
|
|
40
40
|
},
|
|
41
41
|
"./react/theme": {
|
|
42
|
-
"types": "./dist/react/theme/
|
|
43
|
-
"import": "./dist/react/theme/
|
|
42
|
+
"types": "./dist/react/theme/index.d.ts",
|
|
43
|
+
"import": "./dist/react/theme/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./react/cards": {
|
|
46
|
+
"types": "./dist/react/cards/index.d.ts",
|
|
47
|
+
"import": "./dist/react/cards/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./react/panels": {
|
|
50
|
+
"types": "./dist/react/panels/index.d.ts",
|
|
51
|
+
"import": "./dist/react/panels/index.js"
|
|
44
52
|
},
|
|
45
53
|
"./react/core/GlassCard": {
|
|
46
|
-
"types": "./dist/react/core/GlassCard.d.ts",
|
|
47
|
-
"import": "./dist/react/core/GlassCard.js"
|
|
54
|
+
"types": "./dist/react/core/display/GlassCard.d.ts",
|
|
55
|
+
"import": "./dist/react/core/display/GlassCard.js"
|
|
48
56
|
},
|
|
49
57
|
"./react/core/Button": {
|
|
50
|
-
"types": "./dist/react/core/Button.d.ts",
|
|
51
|
-
"import": "./dist/react/core/Button.js"
|
|
58
|
+
"types": "./dist/react/core/inputs/Button.d.ts",
|
|
59
|
+
"import": "./dist/react/core/inputs/Button.js"
|
|
52
60
|
},
|
|
53
61
|
"./react/core/Input": {
|
|
54
|
-
"types": "./dist/react/core/Input.d.ts",
|
|
55
|
-
"import": "./dist/react/core/Input.js"
|
|
62
|
+
"types": "./dist/react/core/inputs/Input.d.ts",
|
|
63
|
+
"import": "./dist/react/core/inputs/Input.js"
|
|
56
64
|
},
|
|
57
65
|
"./react/core/Select": {
|
|
58
|
-
"types": "./dist/react/core/Select.d.ts",
|
|
59
|
-
"import": "./dist/react/core/Select.js"
|
|
66
|
+
"types": "./dist/react/core/inputs/Select.d.ts",
|
|
67
|
+
"import": "./dist/react/core/inputs/Select.js"
|
|
60
68
|
},
|
|
61
69
|
"./react/core/Checkbox": {
|
|
62
|
-
"types": "./dist/react/core/Checkbox.d.ts",
|
|
63
|
-
"import": "./dist/react/core/Checkbox.js"
|
|
70
|
+
"types": "./dist/react/core/inputs/Checkbox.d.ts",
|
|
71
|
+
"import": "./dist/react/core/inputs/Checkbox.js"
|
|
64
72
|
},
|
|
65
73
|
"./react/core/Badge": {
|
|
66
|
-
"types": "./dist/react/core/Badge.d.ts",
|
|
67
|
-
"import": "./dist/react/core/Badge.js"
|
|
74
|
+
"types": "./dist/react/core/display/Badge.d.ts",
|
|
75
|
+
"import": "./dist/react/core/display/Badge.js"
|
|
68
76
|
},
|
|
69
77
|
"./react/core/Typography": {
|
|
70
|
-
"types": "./dist/react/core/Typography.d.ts",
|
|
71
|
-
"import": "./dist/react/core/Typography.js"
|
|
78
|
+
"types": "./dist/react/core/display/Typography.d.ts",
|
|
79
|
+
"import": "./dist/react/core/display/Typography.js"
|
|
72
80
|
},
|
|
73
81
|
"./react/core/Dialog": {
|
|
74
|
-
"types": "./dist/react/core/Dialog.d.ts",
|
|
75
|
-
"import": "./dist/react/core/Dialog.js"
|
|
82
|
+
"types": "./dist/react/core/feedback/Dialog.d.ts",
|
|
83
|
+
"import": "./dist/react/core/feedback/Dialog.js"
|
|
76
84
|
},
|
|
77
85
|
"./react/core/ConfirmDialog": {
|
|
78
|
-
"types": "./dist/react/core/ConfirmDialog.d.ts",
|
|
79
|
-
"import": "./dist/react/core/ConfirmDialog.js"
|
|
86
|
+
"types": "./dist/react/core/feedback/ConfirmDialog.d.ts",
|
|
87
|
+
"import": "./dist/react/core/feedback/ConfirmDialog.js"
|
|
80
88
|
},
|
|
81
89
|
"./react/core/Tabs": {
|
|
82
|
-
"types": "./dist/react/core/Tabs.d.ts",
|
|
83
|
-
"import": "./dist/react/core/Tabs.js"
|
|
90
|
+
"types": "./dist/react/core/navigation/Tabs.d.ts",
|
|
91
|
+
"import": "./dist/react/core/navigation/Tabs.js"
|
|
84
92
|
},
|
|
85
93
|
"./react/core/Toggle": {
|
|
86
|
-
"types": "./dist/react/core/Toggle.d.ts",
|
|
87
|
-
"import": "./dist/react/core/Toggle.js"
|
|
94
|
+
"types": "./dist/react/core/inputs/Toggle.d.ts",
|
|
95
|
+
"import": "./dist/react/core/inputs/Toggle.js"
|
|
88
96
|
},
|
|
89
97
|
"./react/core/Tooltip": {
|
|
90
|
-
"types": "./dist/react/core/Tooltip.d.ts",
|
|
91
|
-
"import": "./dist/react/core/Tooltip.js"
|
|
98
|
+
"types": "./dist/react/core/overlays/Tooltip.d.ts",
|
|
99
|
+
"import": "./dist/react/core/overlays/Tooltip.js"
|
|
92
100
|
},
|
|
93
101
|
"./react/core/Popover": {
|
|
94
|
-
"types": "./dist/react/core/Popover.d.ts",
|
|
95
|
-
"import": "./dist/react/core/Popover.js"
|
|
102
|
+
"types": "./dist/react/core/overlays/Popover.d.ts",
|
|
103
|
+
"import": "./dist/react/core/overlays/Popover.js"
|
|
96
104
|
},
|
|
97
105
|
"./react/core/Toast": {
|
|
98
|
-
"types": "./dist/react/core/Toast.d.ts",
|
|
99
|
-
"import": "./dist/react/core/Toast.js"
|
|
106
|
+
"types": "./dist/react/core/feedback/Toast.d.ts",
|
|
107
|
+
"import": "./dist/react/core/feedback/Toast.js"
|
|
100
108
|
},
|
|
101
109
|
"./react/core/NumberInput": {
|
|
102
|
-
"types": "./dist/react/core/NumberInput.d.ts",
|
|
103
|
-
"import": "./dist/react/core/NumberInput.js"
|
|
110
|
+
"types": "./dist/react/core/inputs/NumberInput.d.ts",
|
|
111
|
+
"import": "./dist/react/core/inputs/NumberInput.js"
|
|
104
112
|
},
|
|
105
113
|
"./react/core/PinInput": {
|
|
106
|
-
"types": "./dist/react/core/PinInput.d.ts",
|
|
107
|
-
"import": "./dist/react/core/PinInput.js"
|
|
114
|
+
"types": "./dist/react/core/inputs/PinInput.d.ts",
|
|
115
|
+
"import": "./dist/react/core/inputs/PinInput.js"
|
|
108
116
|
},
|
|
109
117
|
"./react/core/SideNav": {
|
|
110
|
-
"types": "./dist/react/core/SideNav.d.ts",
|
|
111
|
-
"import": "./dist/react/core/SideNav.js"
|
|
118
|
+
"types": "./dist/react/core/navigation/SideNav.d.ts",
|
|
119
|
+
"import": "./dist/react/core/navigation/SideNav.js"
|
|
112
120
|
},
|
|
113
121
|
"./react/layout/Flex": {
|
|
114
122
|
"types": "./dist/react/core/layout/Flex.d.ts",
|