@svadmin/ui 0.122.0 → 0.125.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.css +561 -4
- package/dist/app.theme.css +561 -4
- package/dist/components/AbacPolicyMatrix.svelte +356 -0
- package/dist/components/AbacPolicyMatrix.svelte.d.ts +30 -0
- package/dist/components/AboutSettings.svelte +1 -1
- package/dist/components/ActionPalette.svelte +272 -0
- package/dist/components/ActionPalette.svelte.d.ts +23 -0
- package/dist/components/AdminCopilotWidget.svelte +316 -0
- package/dist/components/AdminCopilotWidget.svelte.d.ts +33 -0
- package/dist/components/AnnouncementBanner.svelte +12 -1
- package/dist/components/AnnouncementBanner.svelte.d.ts +4 -0
- package/dist/components/ApiPlayground.svelte +255 -0
- package/dist/components/ApiPlayground.svelte.d.ts +24 -0
- package/dist/components/ApprovalChainBuilder.svelte +262 -0
- package/dist/components/ApprovalChainBuilder.svelte.d.ts +20 -0
- package/dist/components/ApprovalTimeline.svelte +8 -1
- package/dist/components/AsyncExportModal.svelte +1 -1
- package/dist/components/AudioFeedbackProvider.svelte +1 -1
- package/dist/components/AuditTrailInspector.svelte +448 -0
- package/dist/components/AuditTrailInspector.svelte.d.ts +44 -0
- package/dist/components/BatchEditModal.svelte +266 -0
- package/dist/components/BatchEditModal.svelte.d.ts +27 -0
- package/dist/components/BillingInvoiceDrawer.svelte +206 -0
- package/dist/components/BillingInvoiceDrawer.svelte.d.ts +30 -0
- package/dist/components/ChartAnnotationOverlay.svelte +228 -0
- package/dist/components/ChartAnnotationOverlay.svelte.d.ts +21 -0
- package/dist/components/ClusterTopologyGraph.svelte +317 -0
- package/dist/components/ClusterTopologyGraph.svelte.d.ts +31 -0
- package/dist/components/ColumnMappingTable.svelte +174 -0
- package/dist/components/ColumnMappingTable.svelte.d.ts +23 -0
- package/dist/components/ConversionFunnel.svelte +1 -1
- package/dist/components/CursorListFooter.svelte +67 -0
- package/dist/components/CursorListFooter.svelte.d.ts +17 -0
- package/dist/components/DashboardGridLayout.svelte +309 -0
- package/dist/components/DashboardGridLayout.svelte.d.ts +30 -0
- package/dist/components/DashboardLayoutStorage.svelte +278 -0
- package/dist/components/DashboardLayoutStorage.svelte.d.ts +23 -0
- package/dist/components/DataFreshnessIndicator.svelte +149 -0
- package/dist/components/DataFreshnessIndicator.svelte.d.ts +20 -0
- package/dist/components/DataImportDropzone.svelte +215 -0
- package/dist/components/DataImportDropzone.svelte.d.ts +24 -0
- package/dist/components/DataLineageGraph.svelte +203 -0
- package/dist/components/DataLineageGraph.svelte.d.ts +26 -0
- package/dist/components/DataMaskPolicyEngine.svelte +291 -0
- package/dist/components/DataMaskPolicyEngine.svelte.d.ts +25 -0
- package/dist/components/DataScopeRuleEditor.svelte +142 -0
- package/dist/components/DataScopeRuleEditor.svelte.d.ts +19 -0
- package/dist/components/DataScreenContainer.svelte +160 -0
- package/dist/components/DataScreenContainer.svelte.d.ts +15 -0
- package/dist/components/DevTools.svelte +3 -3
- package/dist/components/DualApprovalGate.svelte +132 -65
- package/dist/components/DualApprovalGate.svelte.d.ts +20 -1
- package/dist/components/ElectronicSealStamp.svelte +102 -0
- package/dist/components/ElectronicSealStamp.svelte.d.ts +14 -0
- package/dist/components/EnvVariableEditor.svelte +284 -0
- package/dist/components/EnvVariableEditor.svelte.d.ts +17 -0
- package/dist/components/FeatureAnnouncementModal.svelte +173 -0
- package/dist/components/FeatureAnnouncementModal.svelte.d.ts +21 -0
- package/dist/components/FilterTagBar.svelte +210 -0
- package/dist/components/FilterTagBar.svelte.d.ts +23 -0
- package/dist/components/FormulaField.svelte +149 -0
- package/dist/components/FormulaField.svelte.d.ts +18 -0
- package/dist/components/GeoScatterMap.svelte +225 -0
- package/dist/components/GeoScatterMap.svelte.d.ts +22 -0
- package/dist/components/HmacSignatureCalculator.svelte +199 -0
- package/dist/components/HmacSignatureCalculator.svelte.d.ts +10 -0
- package/dist/components/I18nLanguagePackEditor.svelte +208 -0
- package/dist/components/I18nLanguagePackEditor.svelte.d.ts +17 -0
- package/dist/components/ImportPreviewValidator.svelte +239 -0
- package/dist/components/ImportPreviewValidator.svelte.d.ts +26 -0
- package/dist/components/IncidentWarRoomDrawer.svelte +194 -0
- package/dist/components/IncidentWarRoomDrawer.svelte.d.ts +24 -0
- package/dist/components/JsonSchemaForm.svelte +4 -4
- package/dist/components/ListPagination.svelte +39 -3
- package/dist/components/LiveStreamLogViewer.svelte +185 -0
- package/dist/components/LiveStreamLogViewer.svelte.d.ts +21 -0
- package/dist/components/MasterSubTableDrawer.svelte +223 -0
- package/dist/components/MasterSubTableDrawer.svelte.d.ts +25 -0
- package/dist/components/MockDataInterceptor.svelte +292 -0
- package/dist/components/MockDataInterceptor.svelte.d.ts +27 -0
- package/dist/components/OmnibarCommandPalette.svelte +320 -0
- package/dist/components/OmnibarCommandPalette.svelte.d.ts +27 -0
- package/dist/components/PageSkeleton.svelte +19 -5
- package/dist/components/PageSkeleton.svelte.d.ts +5 -3
- package/dist/components/PeriodComparisonCard.svelte +142 -0
- package/dist/components/PeriodComparisonCard.svelte.d.ts +16 -0
- package/dist/components/PermissionSimulator.svelte +319 -0
- package/dist/components/PermissionSimulator.svelte.d.ts +34 -0
- package/dist/components/PivotMatrix.svelte +271 -0
- package/dist/components/PivotMatrix.svelte.d.ts +32 -0
- package/dist/components/PlanUsageQuotaBar.svelte +154 -0
- package/dist/components/PlanUsageQuotaBar.svelte.d.ts +26 -0
- package/dist/components/Popconfirm.svelte +20 -8
- package/dist/components/Popconfirm.svelte.d.ts +3 -1
- package/dist/components/ProSkeleton.svelte +4 -0
- package/dist/components/ProSkeleton.svelte.d.ts +2 -0
- package/dist/components/QueryAiExplainer.svelte +148 -0
- package/dist/components/QueryAiExplainer.svelte.d.ts +16 -0
- package/dist/components/QueryBuilder.svelte +456 -0
- package/dist/components/QueryBuilder.svelte.d.ts +33 -0
- package/dist/components/RolePermissionComparator.svelte +273 -0
- package/dist/components/RolePermissionComparator.svelte.d.ts +28 -0
- package/dist/components/RuleExpressionBuilder.svelte +380 -0
- package/dist/components/RuleExpressionBuilder.svelte.d.ts +31 -0
- package/dist/components/ScheduledJobManager.svelte +225 -0
- package/dist/components/ScheduledJobManager.svelte.d.ts +23 -0
- package/dist/components/ScreenAntiLeakGuard.svelte +88 -0
- package/dist/components/ScreenAntiLeakGuard.svelte.d.ts +12 -0
- package/dist/components/SecureDataExporter.svelte +296 -0
- package/dist/components/SecureDataExporter.svelte.d.ts +29 -0
- package/dist/components/ServerStatusGrid.svelte +179 -0
- package/dist/components/ServerStatusGrid.svelte.d.ts +21 -0
- package/dist/components/SnapshotTimelineReplay.svelte +219 -0
- package/dist/components/SnapshotTimelineReplay.svelte.d.ts +19 -0
- package/dist/components/SqlConsole.svelte +247 -0
- package/dist/components/SqlConsole.svelte.d.ts +20 -0
- package/dist/components/StepWizard.svelte +1 -1
- package/dist/components/SystemCapacityForecastCard.svelte +132 -0
- package/dist/components/SystemCapacityForecastCard.svelte.d.ts +19 -0
- package/dist/components/SystemHealthCheckDashboard.svelte +306 -0
- package/dist/components/SystemHealthCheckDashboard.svelte.d.ts +24 -0
- package/dist/components/TableAggregationFooter.svelte +173 -0
- package/dist/components/TableAggregationFooter.svelte.d.ts +22 -0
- package/dist/components/TaskCenter.svelte +37 -29
- package/dist/components/TenantContextSwitcher.svelte +314 -0
- package/dist/components/TenantContextSwitcher.svelte.d.ts +35 -0
- package/dist/components/TenantQuotasMatrix.svelte +229 -0
- package/dist/components/TenantQuotasMatrix.svelte.d.ts +22 -0
- package/dist/components/ThreadedCommentDrawer.svelte +246 -0
- package/dist/components/ThreadedCommentDrawer.svelte.d.ts +26 -0
- package/dist/components/TierFeatureComparison.svelte +147 -0
- package/dist/components/TierFeatureComparison.svelte.d.ts +28 -0
- package/dist/components/TreeTransferSelect.svelte +333 -0
- package/dist/components/TreeTransferSelect.svelte.d.ts +18 -0
- package/dist/components/VirtualCardGrid.svelte +180 -0
- package/dist/components/VirtualCardGrid.svelte.d.ts +65 -0
- package/dist/components/WebhookSimulator.svelte +263 -0
- package/dist/components/WebhookSimulator.svelte.d.ts +26 -0
- package/dist/components/WidgetContainer.svelte +204 -0
- package/dist/components/WidgetContainer.svelte.d.ts +31 -0
- package/dist/components/WorkflowExecutionTracker.svelte +131 -0
- package/dist/components/WorkflowExecutionTracker.svelte.d.ts +19 -0
- package/dist/components/WorkflowGraphDesigner.svelte +202 -0
- package/dist/components/WorkflowGraphDesigner.svelte.d.ts +24 -0
- package/dist/components/WorkflowNodeInspector.svelte +217 -0
- package/dist/components/WorkflowNodeInspector.svelte.d.ts +24 -0
- package/dist/components/WorkflowStepper.svelte +1 -1
- package/dist/components/list-i18n.d.ts +7 -0
- package/dist/components/list-i18n.js +14 -0
- package/dist/components/ui/button/button.svelte +3 -1
- package/dist/components/ui/button/button.svelte.d.ts +1 -0
- package/dist/components/ui/tooltip/tooltip-content.svelte +1 -1
- package/dist/components/useDynamicLocale.d.svelte.ts +1 -0
- package/dist/components/useDynamicLocale.svelte.d.ts +10 -0
- package/dist/components/useDynamicLocale.svelte.js +40 -0
- package/dist/components/useFormulaEngine.d.svelte.ts +1 -0
- package/dist/components/useFormulaEngine.svelte.d.ts +9 -0
- package/dist/components/useFormulaEngine.svelte.js +209 -0
- package/dist/components/useStorageCache.d.svelte.ts +1 -0
- package/dist/components/useStorageCache.svelte.d.ts +49 -0
- package/dist/components/useStorageCache.svelte.js +229 -0
- package/dist/components.css +1 -1
- package/dist/index.d.ts +69 -3
- package/dist/index.js +112 -2
- package/package.json +4 -4
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
KeyRound,
|
|
4
|
+
Plus,
|
|
5
|
+
Trash2,
|
|
6
|
+
Eye,
|
|
7
|
+
EyeOff,
|
|
8
|
+
Check,
|
|
9
|
+
Save,
|
|
10
|
+
Upload,
|
|
11
|
+
} from '@lucide/svelte';
|
|
12
|
+
import { untrack } from 'svelte';
|
|
13
|
+
import { useTranslation } from '@svadmin/core/i18n';
|
|
14
|
+
import { cn } from '../utils.js';
|
|
15
|
+
import { Button } from './ui/button/index.js';
|
|
16
|
+
|
|
17
|
+
export interface EnvVariableItem {
|
|
18
|
+
key: string;
|
|
19
|
+
value: string;
|
|
20
|
+
isSecret?: boolean | undefined;
|
|
21
|
+
description?: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface EnvVariableEditorProps {
|
|
25
|
+
environment?: string | undefined;
|
|
26
|
+
initialVariables?: EnvVariableItem[] | undefined;
|
|
27
|
+
title?: string | undefined;
|
|
28
|
+
description?: string | undefined;
|
|
29
|
+
class?: string | undefined;
|
|
30
|
+
onSaveEnv?: ((variables: Record<string, string>, environment: string) => void) | undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let {
|
|
34
|
+
environment = 'production',
|
|
35
|
+
initialVariables = [
|
|
36
|
+
{ key: 'DATABASE_URL', value: 'postgresql://postgres:secret@db.internal:5432/app', isSecret: true },
|
|
37
|
+
{ key: 'STRIPE_SECRET_KEY', value: 'mock_secret_key_demo_placeholder', isSecret: true },
|
|
38
|
+
{ key: 'NEXT_PUBLIC_APP_URL', value: 'https://svadmin.example.com', isSecret: false },
|
|
39
|
+
{ key: 'PORT', value: '3000', isSecret: false },
|
|
40
|
+
],
|
|
41
|
+
title,
|
|
42
|
+
description,
|
|
43
|
+
class: className = '',
|
|
44
|
+
onSaveEnv,
|
|
45
|
+
}: EnvVariableEditorProps = $props();
|
|
46
|
+
|
|
47
|
+
const i18n = useTranslation();
|
|
48
|
+
const chinese = $derived(i18n.locale.startsWith('zh'));
|
|
49
|
+
|
|
50
|
+
let activeEnv = $state(untrack(() => environment));
|
|
51
|
+
let variables = $state<EnvVariableItem[]>(untrack(() => JSON.parse(JSON.stringify(initialVariables))));
|
|
52
|
+
let revealedKeys = $state(new Set<string>());
|
|
53
|
+
let showImportModal = $state(false);
|
|
54
|
+
let importRawText = $state('');
|
|
55
|
+
let isSaved = $state(false);
|
|
56
|
+
|
|
57
|
+
function toggleReveal(key: string) {
|
|
58
|
+
const next = new Set(revealedKeys);
|
|
59
|
+
if (next.has(key)) next.delete(key);
|
|
60
|
+
else next.add(key);
|
|
61
|
+
revealedKeys = next;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function addVariable() {
|
|
65
|
+
variables = [
|
|
66
|
+
...variables,
|
|
67
|
+
{
|
|
68
|
+
key: `NEW_VAR_${variables.length + 1}`,
|
|
69
|
+
value: '',
|
|
70
|
+
isSecret: true,
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function removeVariable(idx: number) {
|
|
76
|
+
variables = variables.filter((_, i) => i !== idx);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function handleParseEnvText() {
|
|
80
|
+
const lines = importRawText.split('\n');
|
|
81
|
+
const newVars: EnvVariableItem[] = [];
|
|
82
|
+
|
|
83
|
+
for (const line of lines) {
|
|
84
|
+
const trimmed = line.trim();
|
|
85
|
+
if (!trimmed || trimmed.startsWith('#')) continue;
|
|
86
|
+
const eqIdx = trimmed.indexOf('=');
|
|
87
|
+
if (eqIdx > 0) {
|
|
88
|
+
const k = trimmed.slice(0, eqIdx).trim();
|
|
89
|
+
let v = trimmed.slice(eqIdx + 1).trim();
|
|
90
|
+
if ((v.startsWith('"') && v.endsWith('"')) || (v.startsWith("'") && v.endsWith("'"))) {
|
|
91
|
+
v = v.slice(1, -1);
|
|
92
|
+
}
|
|
93
|
+
newVars.push({
|
|
94
|
+
key: k,
|
|
95
|
+
value: v,
|
|
96
|
+
isSecret: /SECRET|KEY|PASSWORD|TOKEN|URL|AUTH/i.test(k),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (newVars.length > 0) {
|
|
102
|
+
variables = newVars;
|
|
103
|
+
showImportModal = false;
|
|
104
|
+
importRawText = '';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function handleSave() {
|
|
109
|
+
const map: Record<string, string> = {};
|
|
110
|
+
variables.forEach((v) => {
|
|
111
|
+
map[v.key] = v.value;
|
|
112
|
+
});
|
|
113
|
+
onSaveEnv?.(map, activeEnv);
|
|
114
|
+
isSaved = true;
|
|
115
|
+
setTimeout(() => {
|
|
116
|
+
isSaved = false;
|
|
117
|
+
}, 2000);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const resolvedTitle = $derived(title ?? (chinese ? '多环境配置与敏感密钥管理器' : 'Environment & Secret Vault'));
|
|
121
|
+
const resolvedDesc = $derived(
|
|
122
|
+
description ?? (chinese ? '多环境配置项隔离、敏感 API 密钥掩码显隐与 .env 批量导入导出' : 'Manage multi-environment secrets and env configs'),
|
|
123
|
+
);
|
|
124
|
+
</script>
|
|
125
|
+
|
|
126
|
+
<div
|
|
127
|
+
data-svadmin-component="EnvVariableEditor"
|
|
128
|
+
class={cn(
|
|
129
|
+
'w-full rounded-2xl border border-border bg-card text-card-foreground shadow-xs p-6 space-y-4 flex flex-col text-xs',
|
|
130
|
+
className,
|
|
131
|
+
)}
|
|
132
|
+
>
|
|
133
|
+
<!-- Header Bar -->
|
|
134
|
+
<div class="flex items-center justify-between border-b border-border/70 pb-4">
|
|
135
|
+
<div class="flex items-center gap-2.5">
|
|
136
|
+
<div class="flex h-9 w-9 items-center justify-center rounded-xl bg-primary/10 text-primary border border-primary/20">
|
|
137
|
+
<KeyRound class="h-5 w-5" />
|
|
138
|
+
</div>
|
|
139
|
+
<div>
|
|
140
|
+
<h3 class="text-base font-semibold text-foreground">{resolvedTitle}</h3>
|
|
141
|
+
<p class="text-xs text-muted-foreground">{resolvedDesc}</p>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
|
|
145
|
+
<!-- Env Switcher Tabs -->
|
|
146
|
+
<div class="flex rounded-lg border border-border bg-muted/40 p-1 text-xs">
|
|
147
|
+
{#each ['development', 'staging', 'production'] as env (env)}
|
|
148
|
+
<button
|
|
149
|
+
type="button"
|
|
150
|
+
onclick={() => (activeEnv = env)}
|
|
151
|
+
class={cn(
|
|
152
|
+
'px-2.5 py-1 rounded-md font-mono capitalize transition-all',
|
|
153
|
+
activeEnv === env ? 'bg-card text-foreground font-bold shadow-2xs' : 'text-muted-foreground hover:text-foreground',
|
|
154
|
+
)}
|
|
155
|
+
>
|
|
156
|
+
{env}
|
|
157
|
+
</button>
|
|
158
|
+
{/each}
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<!-- Actions Toolbar -->
|
|
163
|
+
<div class="flex items-center justify-between bg-muted/20 p-3 rounded-xl border border-border/60">
|
|
164
|
+
<div class="flex items-center gap-2">
|
|
165
|
+
<Button variant="outline" size="sm" class="h-7 text-xs gap-1" onclick={addVariable}>
|
|
166
|
+
<Plus class="h-3.5 w-3.5" />
|
|
167
|
+
<span>{chinese ? '新增变量' : 'Add Variable'}</span>
|
|
168
|
+
</Button>
|
|
169
|
+
|
|
170
|
+
<Button
|
|
171
|
+
variant="outline"
|
|
172
|
+
size="sm"
|
|
173
|
+
class="h-7 text-xs gap-1"
|
|
174
|
+
onclick={() => (showImportModal = true)}
|
|
175
|
+
>
|
|
176
|
+
<Upload class="h-3.5 w-3.5" />
|
|
177
|
+
<span>{chinese ? '导入 .env' : 'Import .env'}</span>
|
|
178
|
+
</Button>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
<Button size="sm" class="h-7 text-xs gap-1.5" onclick={handleSave}>
|
|
182
|
+
{#if isSaved}
|
|
183
|
+
<Check class="h-3.5 w-3.5 text-success" />
|
|
184
|
+
<span>{chinese ? '已保存生效' : 'Saved'}</span>
|
|
185
|
+
{:else}
|
|
186
|
+
<Save class="h-3.5 w-3.5" />
|
|
187
|
+
<span>{chinese ? `保存并应用 (${variables.length})` : 'Save Changes'}</span>
|
|
188
|
+
{/if}
|
|
189
|
+
</Button>
|
|
190
|
+
</div>
|
|
191
|
+
|
|
192
|
+
<!-- Variables List Table -->
|
|
193
|
+
<div class="rounded-xl border border-border overflow-hidden">
|
|
194
|
+
<table class="w-full text-left text-xs border-collapse">
|
|
195
|
+
<thead class="bg-muted/40 border-b border-border text-muted-foreground font-semibold">
|
|
196
|
+
<tr>
|
|
197
|
+
<th class="p-3 w-64">{chinese ? '配置键名 (Key)' : 'Key'}</th>
|
|
198
|
+
<th class="p-3">{chinese ? '配置取值 (Value)' : 'Value'}</th>
|
|
199
|
+
<th class="p-3 w-24 text-center">{chinese ? '保密掩码' : 'Secret'}</th>
|
|
200
|
+
<th class="p-3 w-16 text-center">{chinese ? '操作' : 'Action'}</th>
|
|
201
|
+
</tr>
|
|
202
|
+
</thead>
|
|
203
|
+
<tbody class="divide-y divide-border/60">
|
|
204
|
+
{#each variables as v, idx (idx)}
|
|
205
|
+
{@const isMasked = v.isSecret && !revealedKeys.has(v.key)}
|
|
206
|
+
<tr class="hover:bg-muted/20">
|
|
207
|
+
<td class="p-2.5">
|
|
208
|
+
<input
|
|
209
|
+
type="text"
|
|
210
|
+
bind:value={v.key}
|
|
211
|
+
class="h-7.5 w-full rounded border border-input bg-background px-2 font-mono text-xs font-semibold text-foreground"
|
|
212
|
+
/>
|
|
213
|
+
</td>
|
|
214
|
+
<td class="p-2.5">
|
|
215
|
+
<div class="relative flex items-center">
|
|
216
|
+
<input
|
|
217
|
+
type={isMasked ? 'password' : 'text'}
|
|
218
|
+
bind:value={v.value}
|
|
219
|
+
class="h-7.5 w-full rounded border border-input bg-background px-2.5 font-mono text-xs text-foreground pr-8"
|
|
220
|
+
/>
|
|
221
|
+
{#if v.isSecret}
|
|
222
|
+
<button
|
|
223
|
+
type="button"
|
|
224
|
+
onclick={() => toggleReveal(v.key)}
|
|
225
|
+
class="absolute right-2 text-muted-foreground hover:text-foreground"
|
|
226
|
+
aria-label={isMasked ? 'Reveal secret' : 'Hide secret'}
|
|
227
|
+
>
|
|
228
|
+
{#if isMasked}
|
|
229
|
+
<Eye class="h-3.5 w-3.5" />
|
|
230
|
+
{:else}
|
|
231
|
+
<EyeOff class="h-3.5 w-3.5" />
|
|
232
|
+
{/if}
|
|
233
|
+
</button>
|
|
234
|
+
{/if}
|
|
235
|
+
</div>
|
|
236
|
+
</td>
|
|
237
|
+
<td class="p-2.5 text-center">
|
|
238
|
+
<input type="checkbox" bind:checked={v.isSecret} />
|
|
239
|
+
</td>
|
|
240
|
+
<td class="p-2.5 text-center">
|
|
241
|
+
<button
|
|
242
|
+
type="button"
|
|
243
|
+
onclick={() => removeVariable(idx)}
|
|
244
|
+
class="rounded p-1 text-muted-foreground hover:text-destructive hover:bg-destructive/10"
|
|
245
|
+
aria-label="Remove variable"
|
|
246
|
+
>
|
|
247
|
+
<Trash2 class="h-3.5 w-3.5" />
|
|
248
|
+
</button>
|
|
249
|
+
</td>
|
|
250
|
+
</tr>
|
|
251
|
+
{/each}
|
|
252
|
+
</tbody>
|
|
253
|
+
</table>
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
256
|
+
|
|
257
|
+
<!-- Import Modal Dialog -->
|
|
258
|
+
{#if showImportModal}
|
|
259
|
+
<div
|
|
260
|
+
role="dialog"
|
|
261
|
+
aria-modal="true"
|
|
262
|
+
aria-label="Import .env"
|
|
263
|
+
class="fixed inset-0 z-50 flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm"
|
|
264
|
+
>
|
|
265
|
+
<div class="w-full max-w-lg rounded-2xl border border-border bg-card p-6 shadow-2xl text-xs space-y-3">
|
|
266
|
+
<div class="flex items-center justify-between border-b border-border/70 pb-3">
|
|
267
|
+
<h4 class="text-sm font-bold text-foreground">{chinese ? '批量导入 .env 文本' : 'Import .env Content'}</h4>
|
|
268
|
+
<button type="button" onclick={() => (showImportModal = false)} class="text-muted-foreground hover:text-foreground">✕</button>
|
|
269
|
+
</div>
|
|
270
|
+
|
|
271
|
+
<textarea
|
|
272
|
+
bind:value={importRawText}
|
|
273
|
+
placeholder="KEY1=val1\nKEY2=val2"
|
|
274
|
+
rows="8"
|
|
275
|
+
class="w-full rounded-lg border border-input bg-muted/20 p-2.5 font-mono text-xs focus-visible:outline-none"
|
|
276
|
+
></textarea>
|
|
277
|
+
|
|
278
|
+
<div class="flex justify-end gap-2 pt-2">
|
|
279
|
+
<Button variant="ghost" size="sm" onclick={() => (showImportModal = false)}>{chinese ? '取消' : 'Cancel'}</Button>
|
|
280
|
+
<Button size="sm" onclick={handleParseEnvText}>{chinese ? '解析并追加' : 'Parse & Import'}</Button>
|
|
281
|
+
</div>
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
{/if}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface EnvVariableItem {
|
|
2
|
+
key: string;
|
|
3
|
+
value: string;
|
|
4
|
+
isSecret?: boolean | undefined;
|
|
5
|
+
description?: string | undefined;
|
|
6
|
+
}
|
|
7
|
+
export interface EnvVariableEditorProps {
|
|
8
|
+
environment?: string | undefined;
|
|
9
|
+
initialVariables?: EnvVariableItem[] | undefined;
|
|
10
|
+
title?: string | undefined;
|
|
11
|
+
description?: string | undefined;
|
|
12
|
+
class?: string | undefined;
|
|
13
|
+
onSaveEnv?: ((variables: Record<string, string>, environment: string) => void) | undefined;
|
|
14
|
+
}
|
|
15
|
+
declare const EnvVariableEditor: import("svelte").Component<EnvVariableEditorProps, {}, "">;
|
|
16
|
+
type EnvVariableEditor = ReturnType<typeof EnvVariableEditor>;
|
|
17
|
+
export default EnvVariableEditor;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from 'svelte';
|
|
3
|
+
import {
|
|
4
|
+
Rocket,
|
|
5
|
+
ArrowRight,
|
|
6
|
+
Zap,
|
|
7
|
+
X,
|
|
8
|
+
} from '@lucide/svelte';
|
|
9
|
+
import { useTranslation } from '@svadmin/core/i18n';
|
|
10
|
+
import { cn } from '../utils.js';
|
|
11
|
+
import { Button } from './ui/button/index.js';
|
|
12
|
+
|
|
13
|
+
export interface FeatureCardItem {
|
|
14
|
+
id: string;
|
|
15
|
+
title: string;
|
|
16
|
+
description: string;
|
|
17
|
+
tag?: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface FeatureAnnouncementModalProps {
|
|
21
|
+
open?: boolean | undefined;
|
|
22
|
+
version?: string | undefined;
|
|
23
|
+
releaseDate?: string | undefined;
|
|
24
|
+
title?: string | undefined;
|
|
25
|
+
description?: string | undefined;
|
|
26
|
+
features?: FeatureCardItem[] | undefined;
|
|
27
|
+
storageKey?: string | undefined;
|
|
28
|
+
class?: string | undefined;
|
|
29
|
+
onExplore?: (() => void) | undefined;
|
|
30
|
+
onClose?: (() => void) | undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let {
|
|
34
|
+
open = $bindable(false),
|
|
35
|
+
version = 'v0.5.15',
|
|
36
|
+
releaseDate = '2026-11-11',
|
|
37
|
+
title,
|
|
38
|
+
description,
|
|
39
|
+
features = [
|
|
40
|
+
{ id: '1', title: '多级审批流设计器', description: '纵向节点编排,支持会签、或签与多级路由分支。', tag: 'NEW' },
|
|
41
|
+
{ id: '2', title: '全景微服务拓扑图', description: '0KB 纯原生 SVG 矢量绘制三层集群网关、服务与数据库。', tag: 'ENHANCED' },
|
|
42
|
+
{ id: '3', title: '动态公式沙箱计算', description: '无 eval() 安全公式字段,支持四则运算与统计函数。', tag: 'SECURITY' },
|
|
43
|
+
{ id: '4', title: '全键盘动作托盘', description: '按 ⌘. 瞬时呼出 Raycast 极速动作托盘,支持拼音模糊检索。', tag: 'PRODUCTIVITY' },
|
|
44
|
+
],
|
|
45
|
+
storageKey = 'svadmin_dismissed_version',
|
|
46
|
+
class: className = '',
|
|
47
|
+
onExplore,
|
|
48
|
+
onClose,
|
|
49
|
+
}: FeatureAnnouncementModalProps = $props();
|
|
50
|
+
|
|
51
|
+
const i18n = useTranslation();
|
|
52
|
+
const chinese = $derived(i18n.locale.startsWith('zh'));
|
|
53
|
+
|
|
54
|
+
let dontShowAgain = $state(false);
|
|
55
|
+
|
|
56
|
+
onMount(() => {
|
|
57
|
+
if (storageKey && typeof window !== 'undefined') {
|
|
58
|
+
try {
|
|
59
|
+
const saved = localStorage.getItem(storageKey);
|
|
60
|
+
if (saved === version) {
|
|
61
|
+
open = false;
|
|
62
|
+
}
|
|
63
|
+
} catch {
|
|
64
|
+
// Storage unavailable
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
function handleDismiss() {
|
|
70
|
+
if (dontShowAgain && storageKey && typeof window !== 'undefined') {
|
|
71
|
+
try {
|
|
72
|
+
localStorage.setItem(storageKey, version);
|
|
73
|
+
} catch {
|
|
74
|
+
// Ignore
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
open = false;
|
|
78
|
+
onClose?.();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function handleExploreClick() {
|
|
82
|
+
handleDismiss();
|
|
83
|
+
onExplore?.();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const resolvedTitle = $derived(title ?? (chinese ? '新功能特性发布' : "What's New in SVAdmin"));
|
|
87
|
+
const resolvedDesc = $derived(
|
|
88
|
+
description ?? (chinese ? '欢迎体验最新升级的企业级生产力套件' : 'Explore newly shipped enterprise productivity suites'),
|
|
89
|
+
);
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
{#if open}
|
|
93
|
+
<div
|
|
94
|
+
role="dialog"
|
|
95
|
+
aria-modal="true"
|
|
96
|
+
aria-label="What is new modal"
|
|
97
|
+
data-svadmin-component="FeatureAnnouncementModal"
|
|
98
|
+
class="fixed inset-0 z-50 flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm select-none"
|
|
99
|
+
>
|
|
100
|
+
<!-- Modal Container -->
|
|
101
|
+
<div
|
|
102
|
+
class={cn(
|
|
103
|
+
'relative z-10 w-full max-w-lg rounded-2xl border border-border bg-card text-card-foreground shadow-2xl overflow-hidden animate-in fade-in zoom-in-95 duration-150',
|
|
104
|
+
className,
|
|
105
|
+
)}
|
|
106
|
+
>
|
|
107
|
+
<!-- Top Radial Ambient Header -->
|
|
108
|
+
<div class="relative bg-gradient-to-br from-primary/15 via-primary/5 to-transparent px-6 pt-6 pb-4 border-b border-border/70">
|
|
109
|
+
<button
|
|
110
|
+
type="button"
|
|
111
|
+
onclick={handleDismiss}
|
|
112
|
+
class="absolute top-4 right-4 rounded-lg p-1 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors"
|
|
113
|
+
aria-label="Close"
|
|
114
|
+
>
|
|
115
|
+
<X class="h-4 w-4" />
|
|
116
|
+
</button>
|
|
117
|
+
|
|
118
|
+
<div class="flex items-center gap-2 mb-2">
|
|
119
|
+
<span class="inline-flex items-center gap-1 rounded-full bg-primary/20 px-2.5 py-0.5 text-xs font-mono font-bold text-primary border border-primary/30">
|
|
120
|
+
<Rocket class="h-3.5 w-3.5" />
|
|
121
|
+
<span>{version}</span>
|
|
122
|
+
</span>
|
|
123
|
+
<span class="text-[11px] font-mono text-muted-foreground">{releaseDate}</span>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<h3 class="text-lg font-bold tracking-tight text-foreground">{resolvedTitle}</h3>
|
|
127
|
+
<p class="text-xs text-muted-foreground mt-0.5">{resolvedDesc}</p>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<!-- Features Cards Stack -->
|
|
131
|
+
<div class="max-h-80 overflow-y-auto p-5 space-y-2.5">
|
|
132
|
+
{#each features as feat (feat.id)}
|
|
133
|
+
<div class="flex items-start gap-3 rounded-xl border border-border/70 bg-muted/20 p-3 hover:bg-muted/40 transition-colors">
|
|
134
|
+
<div class="flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary border border-primary/20 mt-0.5">
|
|
135
|
+
<Zap class="h-3.5 w-3.5" />
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
<div class="flex-1 space-y-0.5 min-w-0">
|
|
139
|
+
<div class="flex items-center gap-2">
|
|
140
|
+
<span class="font-bold text-xs text-foreground">{feat.title}</span>
|
|
141
|
+
{#if feat.tag}
|
|
142
|
+
<span class="rounded bg-primary/10 px-1.5 py-0.2 text-[9px] font-mono font-bold text-primary uppercase">
|
|
143
|
+
{feat.tag}
|
|
144
|
+
</span>
|
|
145
|
+
{/if}
|
|
146
|
+
</div>
|
|
147
|
+
<p class="text-[11px] text-muted-foreground leading-relaxed">{feat.description}</p>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
{/each}
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
<!-- Footer Bar -->
|
|
154
|
+
<div class="flex items-center justify-between border-t border-border/70 px-6 py-4 bg-card">
|
|
155
|
+
<label class="flex items-center gap-1.5 cursor-pointer text-xs text-muted-foreground select-none">
|
|
156
|
+
<input type="checkbox" bind:checked={dontShowAgain} />
|
|
157
|
+
<span>{chinese ? '此版本不再弹出提示' : "Don't show again"}</span>
|
|
158
|
+
</label>
|
|
159
|
+
|
|
160
|
+
<div class="flex items-center gap-2">
|
|
161
|
+
<Button variant="ghost" size="sm" onclick={handleDismiss} class="text-xs">
|
|
162
|
+
{chinese ? '稍后查看' : 'Dismiss'}
|
|
163
|
+
</Button>
|
|
164
|
+
|
|
165
|
+
<Button size="sm" onclick={handleExploreClick} class="gap-1 text-xs font-semibold">
|
|
166
|
+
<span>{chinese ? '立即去体验' : 'Explore Now'}</span>
|
|
167
|
+
<ArrowRight class="h-3.5 w-3.5" />
|
|
168
|
+
</Button>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
{/if}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface FeatureCardItem {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
tag?: string | undefined;
|
|
6
|
+
}
|
|
7
|
+
export interface FeatureAnnouncementModalProps {
|
|
8
|
+
open?: boolean | undefined;
|
|
9
|
+
version?: string | undefined;
|
|
10
|
+
releaseDate?: string | undefined;
|
|
11
|
+
title?: string | undefined;
|
|
12
|
+
description?: string | undefined;
|
|
13
|
+
features?: FeatureCardItem[] | undefined;
|
|
14
|
+
storageKey?: string | undefined;
|
|
15
|
+
class?: string | undefined;
|
|
16
|
+
onExplore?: (() => void) | undefined;
|
|
17
|
+
onClose?: (() => void) | undefined;
|
|
18
|
+
}
|
|
19
|
+
declare const FeatureAnnouncementModal: import("svelte").Component<FeatureAnnouncementModalProps, {}, "open">;
|
|
20
|
+
type FeatureAnnouncementModal = ReturnType<typeof FeatureAnnouncementModal>;
|
|
21
|
+
export default FeatureAnnouncementModal;
|