@svadmin/lite 0.1.0 → 0.2.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/README.md +49 -6
- package/package.json +5 -1
- package/src/components/LiteArrayField.svelte +112 -0
- package/src/components/LiteAuditLog.svelte +104 -0
- package/src/components/LiteBreadcrumbs.svelte +39 -0
- package/src/components/LiteChatDialog.svelte +101 -0
- package/src/components/LiteConfirmDialog.svelte +60 -0
- package/src/components/LiteEmptyState.svelte +39 -0
- package/src/components/LiteLayout.svelte +58 -10
- package/src/components/LitePermissionMatrix.svelte +147 -0
- package/src/components/LiteShow.svelte +3 -38
- package/src/components/LiteShowField.svelte +51 -0
- package/src/components/LiteStatsCard.svelte +70 -0
- package/src/components/LiteTabs.svelte +57 -0
- package/src/components/advanced/LiteAutoSaveIndicator.svelte +26 -0
- package/src/components/advanced/LiteDraggableHeader.svelte +33 -0
- package/src/components/advanced/LiteDrawerForm.svelte +42 -0
- package/src/components/advanced/LiteInlineEdit.svelte +32 -0
- package/src/components/advanced/LiteModalForm.svelte +44 -0
- package/src/components/advanced/LiteToast.svelte +34 -0
- package/src/components/advanced/LiteUndoableNotification.svelte +25 -0
- package/src/components/advanced/LiteVirtualTable.svelte +44 -0
- package/src/components/advanced/index.ts +8 -0
- package/src/components/buttons/LiteCloneButton.svelte +33 -0
- package/src/components/buttons/LiteCreateButton.svelte +31 -0
- package/src/components/buttons/LiteDeleteButton.svelte +57 -0
- package/src/components/buttons/LiteEditButton.svelte +33 -0
- package/src/components/buttons/LiteExportButton.svelte +31 -0
- package/src/components/buttons/LiteImportButton.svelte +50 -0
- package/src/components/buttons/LiteListButton.svelte +31 -0
- package/src/components/buttons/LiteRefreshButton.svelte +27 -0
- package/src/components/buttons/LiteSaveButton.svelte +27 -0
- package/src/components/buttons/LiteShowButton.svelte +33 -0
- package/src/components/buttons/index.ts +10 -0
- package/src/components/fields/LiteBooleanField.svelte +41 -0
- package/src/components/fields/LiteDateField.svelte +51 -0
- package/src/components/fields/LiteEmailField.svelte +40 -0
- package/src/components/fields/LiteFileField.svelte +53 -0
- package/src/components/fields/LiteImageField.svelte +57 -0
- package/src/components/fields/LiteJsonField.svelte +43 -0
- package/src/components/fields/LiteMarkdownField.svelte +33 -0
- package/src/components/fields/LiteMultiSelectField.svelte +57 -0
- package/src/components/fields/LiteNumberField.svelte +34 -0
- package/src/components/fields/LiteRelationField.svelte +66 -0
- package/src/components/fields/LiteRichTextField.svelte +45 -0
- package/src/components/fields/LiteSelectField.svelte +47 -0
- package/src/components/fields/LiteTagField.svelte +44 -0
- package/src/components/fields/LiteTextField.svelte +34 -0
- package/src/components/fields/LiteUrlField.svelte +40 -0
- package/src/components/fields/index.ts +15 -0
- package/src/components/layout/LiteAuthenticated.svelte +23 -0
- package/src/components/layout/LiteCanAccess.svelte +27 -0
- package/src/components/layout/LiteCatchAllNavigate.svelte +20 -0
- package/src/components/layout/LiteErrorBoundary.svelte +20 -0
- package/src/components/layout/LiteErrorComponent.svelte +37 -0
- package/src/components/layout/LiteHeader.svelte +19 -0
- package/src/components/layout/LiteNavigateToResource.svelte +25 -0
- package/src/components/layout/LiteSidebar.svelte +93 -0
- package/src/components/layout/index.ts +8 -0
- package/src/components/pages/LiteCreatePage.svelte +39 -0
- package/src/components/pages/LiteEditPage.svelte +54 -0
- package/src/components/pages/LiteForgotPasswordPage.svelte +60 -0
- package/src/components/pages/LiteListPage.svelte +77 -0
- package/src/components/pages/LiteProfilePage.svelte +61 -0
- package/src/components/pages/LiteRegisterPage.svelte +64 -0
- package/src/components/pages/LiteShowPage.svelte +61 -0
- package/src/components/pages/LiteUpdatePasswordPage.svelte +51 -0
- package/src/components/pages/index.ts +8 -0
- package/src/components/widgets/LiteAnomalyBadge.svelte +40 -0
- package/src/components/widgets/LiteBarChart.svelte +45 -0
- package/src/components/widgets/LiteInsightCard.svelte +28 -0
- package/src/components/widgets/LiteLineChart.svelte +48 -0
- package/src/components/widgets/LitePieChart.svelte +44 -0
- package/src/components/widgets/index.ts +5 -0
- package/src/index.ts +28 -0
- package/src/lite.css +372 -124
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* SSR InsightCard — Degraded to static pre-rendered content.
|
|
4
|
+
* The SPA version streams AI-generated insights via ChatProvider.
|
|
5
|
+
* In lite mode, insights must be pre-computed on the server and
|
|
6
|
+
* passed as a static string. No AI streaming is available.
|
|
7
|
+
*/
|
|
8
|
+
interface Props {
|
|
9
|
+
title?: string;
|
|
10
|
+
content?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let { title = 'Insights', content = '' }: Props = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<div class="lite-card" style="margin-bottom: 16px;">
|
|
17
|
+
<div style="padding: 12px 16px; border-bottom: 1px solid #e2e8f0; font-weight: 600; font-size: 14px; color: #0f172a; display: flex; align-items: center; gap: 8px;">
|
|
18
|
+
<span style="color: #f59e0b;">✦</span>
|
|
19
|
+
{title}
|
|
20
|
+
</div>
|
|
21
|
+
<div style="padding: 16px; font-size: 14px; color: #334155; line-height: 1.6;">
|
|
22
|
+
{#if content}
|
|
23
|
+
{@html content}
|
|
24
|
+
{:else}
|
|
25
|
+
<p style="color: #94a3b8; font-style: italic;">No insights available. AI analysis requires JavaScript.</p>
|
|
26
|
+
{/if}
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* SSR LineChart — Degraded to an HTML data table.
|
|
4
|
+
* Drawing SVG/Canvas line charts inline is possible but complex.
|
|
5
|
+
* For maximum compatibility (IE11), we render data as a simple table.
|
|
6
|
+
*/
|
|
7
|
+
interface DataPoint {
|
|
8
|
+
label: string;
|
|
9
|
+
value: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
data: DataPoint[];
|
|
14
|
+
title?: string;
|
|
15
|
+
valueLabel?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let { data, title, valueLabel = 'Value' }: Props = $props();
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<div class="lite-card" style="margin-bottom: 16px;">
|
|
22
|
+
{#if title}
|
|
23
|
+
<div style="padding: 12px 16px; border-bottom: 1px solid #e2e8f0; font-weight: 600; font-size: 14px; color: #0f172a;">
|
|
24
|
+
{title}
|
|
25
|
+
</div>
|
|
26
|
+
{/if}
|
|
27
|
+
<table style="width: 100%; border-collapse: collapse;">
|
|
28
|
+
<thead>
|
|
29
|
+
<tr>
|
|
30
|
+
<th style="text-align: left; padding: 10px 16px; font-size: 12px; color: #64748b; border-bottom: 1px solid #e2e8f0;">Label</th>
|
|
31
|
+
<th style="text-align: right; padding: 10px 16px; font-size: 12px; color: #64748b; border-bottom: 1px solid #e2e8f0;">{valueLabel}</th>
|
|
32
|
+
</tr>
|
|
33
|
+
</thead>
|
|
34
|
+
<tbody>
|
|
35
|
+
{#each data as point, i}
|
|
36
|
+
<tr style="background: {i % 2 === 0 ? '#ffffff' : '#f8fafc'};">
|
|
37
|
+
<td style="padding: 8px 16px; font-size: 13px; color: #334155;">{point.label}</td>
|
|
38
|
+
<td style="padding: 8px 16px; font-size: 13px; color: #0f172a; text-align: right; font-weight: 500;">{point.value}</td>
|
|
39
|
+
</tr>
|
|
40
|
+
{/each}
|
|
41
|
+
{#if data.length === 0}
|
|
42
|
+
<tr>
|
|
43
|
+
<td colspan="2" style="padding: 16px; text-align: center; color: #94a3b8; font-style: italic;">No data</td>
|
|
44
|
+
</tr>
|
|
45
|
+
{/if}
|
|
46
|
+
</tbody>
|
|
47
|
+
</table>
|
|
48
|
+
</div>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* SSR PieChart — Degraded to a list with colored dots.
|
|
4
|
+
* Drawing SVG pie charts inline is technically possible but IE11
|
|
5
|
+
* doesn't support CSS conic-gradient. We fall back to a plain list.
|
|
6
|
+
*/
|
|
7
|
+
interface DataPoint {
|
|
8
|
+
label: string;
|
|
9
|
+
value: number;
|
|
10
|
+
color?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
data: DataPoint[];
|
|
15
|
+
title?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let { data, title }: Props = $props();
|
|
19
|
+
|
|
20
|
+
const total = $derived(data.reduce((sum, d) => sum + d.value, 0));
|
|
21
|
+
const defaultColors = ['#6366f1', '#f59e0b', '#10b981', '#ef4444', '#8b5cf6', '#06b6d4', '#f97316', '#ec4899'];
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<div class="lite-card" style="margin-bottom: 16px;">
|
|
25
|
+
{#if title}
|
|
26
|
+
<div style="padding: 12px 16px; border-bottom: 1px solid #e2e8f0; font-weight: 600; font-size: 14px; color: #0f172a;">
|
|
27
|
+
{title}
|
|
28
|
+
</div>
|
|
29
|
+
{/if}
|
|
30
|
+
<div style="padding: 16px; display: flex; flex-direction: column; gap: 10px;">
|
|
31
|
+
{#each data as point, i}
|
|
32
|
+
{@const pct = total > 0 ? ((point.value / total) * 100).toFixed(1) : '0.0'}
|
|
33
|
+
<div style="display: flex; align-items: center; gap: 10px; font-size: 13px;">
|
|
34
|
+
<span style="width: 12px; height: 12px; border-radius: 50%; background: {point.color ?? defaultColors[i % defaultColors.length]}; flex-shrink: 0;"></span>
|
|
35
|
+
<span style="flex: 1; color: #334155;">{point.label}</span>
|
|
36
|
+
<span style="color: #64748b; font-weight: 500;">{point.value}</span>
|
|
37
|
+
<span style="color: #94a3b8; font-size: 12px; min-width: 48px; text-align: right;">{pct}%</span>
|
|
38
|
+
</div>
|
|
39
|
+
{/each}
|
|
40
|
+
{#if data.length === 0}
|
|
41
|
+
<p style="color: #94a3b8; font-style: italic; text-align: center;">No data</p>
|
|
42
|
+
{/if}
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as LiteInsightCard } from './LiteInsightCard.svelte';
|
|
2
|
+
export { default as LiteAnomalyBadge } from './LiteAnomalyBadge.svelte';
|
|
3
|
+
export { default as LiteBarChart } from './LiteBarChart.svelte';
|
|
4
|
+
export { default as LiteLineChart } from './LiteLineChart.svelte';
|
|
5
|
+
export { default as LitePieChart } from './LitePieChart.svelte';
|
package/src/index.ts
CHANGED
|
@@ -30,3 +30,31 @@ export { default as LiteLogin } from './components/LiteLogin.svelte';
|
|
|
30
30
|
export { default as LiteShow } from './components/LiteShow.svelte';
|
|
31
31
|
export { default as LiteSearch } from './components/LiteSearch.svelte';
|
|
32
32
|
export { default as LiteAlert } from './components/LiteAlert.svelte';
|
|
33
|
+
export { default as LitePermissionMatrix } from './components/LitePermissionMatrix.svelte';
|
|
34
|
+
export { default as LiteAuditLog } from './components/LiteAuditLog.svelte';
|
|
35
|
+
export { default as LiteArrayField } from './components/LiteArrayField.svelte';
|
|
36
|
+
export { default as LiteBreadcrumbs } from './components/LiteBreadcrumbs.svelte';
|
|
37
|
+
export { default as LiteStatsCard } from './components/LiteStatsCard.svelte';
|
|
38
|
+
export { default as LiteConfirmDialog } from './components/LiteConfirmDialog.svelte';
|
|
39
|
+
export { default as LiteEmptyState } from './components/LiteEmptyState.svelte';
|
|
40
|
+
export { default as LiteTabs } from './components/LiteTabs.svelte';
|
|
41
|
+
export { default as LiteShowField } from './components/LiteShowField.svelte';
|
|
42
|
+
export { default as LiteChatDialog } from './components/LiteChatDialog.svelte';
|
|
43
|
+
|
|
44
|
+
// Action Buttons
|
|
45
|
+
export * from './components/buttons/index';
|
|
46
|
+
|
|
47
|
+
// Fields
|
|
48
|
+
export * from './components/fields/index';
|
|
49
|
+
|
|
50
|
+
// Pages
|
|
51
|
+
export * from './components/pages/index';
|
|
52
|
+
|
|
53
|
+
// Layout & Navigation
|
|
54
|
+
export * from './components/layout/index';
|
|
55
|
+
|
|
56
|
+
// Advanced UX (gracefully degraded)
|
|
57
|
+
export * from './components/advanced/index';
|
|
58
|
+
|
|
59
|
+
// Widgets & Charts (SSR static alternatives)
|
|
60
|
+
export * from './components/widgets/index';
|