@svadmin/lite 0.16.11 → 0.22.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/README.md +71 -2
- package/dist/components/LiteActivityFeed.svelte +31 -9
- package/dist/components/LiteActivityFeed.svelte.d.ts +6 -0
- package/dist/components/LiteAffix.svelte +29 -0
- package/dist/components/LiteAffix.svelte.d.ts +13 -0
- package/dist/components/LiteAnchor.svelte +38 -0
- package/dist/components/LiteAnchor.svelte.d.ts +14 -0
- package/dist/components/LiteApprovalActionCard.svelte +8 -5
- package/dist/components/LiteApprovalActionCard.svelte.d.ts +2 -0
- package/dist/components/LiteAuditLog.svelte +9 -9
- package/dist/components/LiteAutoComplete.svelte +41 -0
- package/dist/components/LiteAutoComplete.svelte.d.ts +13 -0
- package/dist/components/LiteBackTop.svelte +16 -0
- package/dist/components/LiteBackTop.svelte.d.ts +8 -0
- package/dist/components/LiteBreadcrumbs.svelte +4 -1
- package/dist/components/LiteBreadcrumbs.svelte.d.ts +2 -0
- package/dist/components/LiteCalendar.svelte +124 -0
- package/dist/components/LiteCalendar.svelte.d.ts +20 -0
- package/dist/components/LiteCanvasAnnotation.svelte +13 -13
- package/dist/components/LiteCarousel.svelte +72 -0
- package/dist/components/LiteCarousel.svelte.d.ts +14 -0
- package/dist/components/LiteChatDialog.svelte +8 -8
- package/dist/components/LiteCollapse.svelte +49 -0
- package/dist/components/LiteCollapse.svelte.d.ts +15 -0
- package/dist/components/LiteColumnHeaderFilter.svelte +4 -1
- package/dist/components/LiteColumnHeaderFilter.svelte.d.ts +2 -0
- package/dist/components/LiteColumnSettings.svelte +7 -4
- package/dist/components/LiteColumnSettings.svelte.d.ts +2 -0
- package/dist/components/LiteCommentThread.svelte +113 -0
- package/dist/components/LiteCommentThread.svelte.d.ts +26 -0
- package/dist/components/LiteConfirmDialog.svelte +2 -2
- package/dist/components/LiteCountdown.svelte +49 -0
- package/dist/components/LiteCountdown.svelte.d.ts +10 -0
- package/dist/components/LiteDecisionTable.svelte +14 -14
- package/dist/components/LiteDetailDrawer.svelte +45 -0
- package/dist/components/LiteDetailDrawer.svelte.d.ts +14 -0
- package/dist/components/LiteDraggableRowTable.svelte +5 -2
- package/dist/components/LiteDraggableRowTable.svelte.d.ts +2 -0
- package/dist/components/LiteDrawerForm.svelte +11 -8
- package/dist/components/LiteDrawerForm.svelte.d.ts +2 -0
- package/dist/components/LiteDynamicFormList.svelte +5 -5
- package/dist/components/LiteEditableTable.svelte +5 -2
- package/dist/components/LiteEditableTable.svelte.d.ts +2 -0
- package/dist/components/LiteEmptyState.svelte +11 -4
- package/dist/components/LiteEmptyState.svelte.d.ts +3 -0
- package/dist/components/LiteFilterBuilder.svelte +8 -5
- package/dist/components/LiteFilterBuilder.svelte.d.ts +2 -0
- package/dist/components/LiteFloatButton.svelte +54 -0
- package/dist/components/LiteFloatButton.svelte.d.ts +15 -0
- package/dist/components/LiteGanttChart.svelte +20 -20
- package/dist/components/LiteGrid.svelte +34 -0
- package/dist/components/LiteGrid.svelte.d.ts +11 -0
- package/dist/components/LiteImage.svelte +54 -0
- package/dist/components/LiteImage.svelte.d.ts +14 -0
- package/dist/components/LiteImageCropper.svelte +7 -4
- package/dist/components/LiteImageCropper.svelte.d.ts +2 -0
- package/dist/components/LiteImagePreview.svelte +36 -0
- package/dist/components/LiteImagePreview.svelte.d.ts +13 -0
- package/dist/components/LiteImportWizard.svelte +7 -7
- package/dist/components/LiteItemList.svelte +50 -0
- package/dist/components/LiteItemList.svelte.d.ts +15 -0
- package/dist/components/LiteJsonSchemaForm.svelte +10 -7
- package/dist/components/LiteJsonSchemaForm.svelte.d.ts +2 -0
- package/dist/components/LiteKanbanBoard.svelte +19 -19
- package/dist/components/LiteLayout.svelte +18 -6
- package/dist/components/LiteLayout.svelte.d.ts +8 -0
- package/dist/components/LiteLink.svelte +32 -0
- package/dist/components/LiteLink.svelte.d.ts +11 -0
- package/dist/components/LiteLogin.svelte +9 -2
- package/dist/components/LiteLogin.svelte.d.ts +2 -0
- package/dist/components/LiteMasterDetailView.svelte +13 -10
- package/dist/components/LiteMasterDetailView.svelte.d.ts +2 -0
- package/dist/components/LiteMediaLibraryModal.svelte +8 -5
- package/dist/components/LiteMediaLibraryModal.svelte.d.ts +2 -0
- package/dist/components/LiteMediaThumbnail.svelte +3 -3
- package/dist/components/LiteMentionsInput.svelte +9 -9
- package/dist/components/LiteMenu.svelte +22 -0
- package/dist/components/LiteMenu.svelte.d.ts +12 -0
- package/dist/components/LiteMenuList.svelte +55 -0
- package/dist/components/LiteMenuList.svelte.d.ts +17 -0
- package/dist/components/LiteModalForm.svelte +9 -6
- package/dist/components/LiteModalForm.svelte.d.ts +2 -0
- package/dist/components/LiteMultiTabKeepAlive.svelte +6 -6
- package/dist/components/LiteNotificationCenter.svelte +85 -0
- package/dist/components/LiteNotificationCenter.svelte.d.ts +22 -0
- package/dist/components/LiteOfflineSyncBanner.svelte +6 -6
- package/dist/components/LiteOtpInput.svelte +50 -0
- package/dist/components/LiteOtpInput.svelte.d.ts +15 -0
- package/dist/components/LitePageHeader.svelte +34 -0
- package/dist/components/LitePageHeader.svelte.d.ts +13 -0
- package/dist/components/LitePagination.svelte +10 -2
- package/dist/components/LitePagination.svelte.d.ts +2 -0
- package/dist/components/LitePdfDocumentViewer.svelte +14 -14
- package/dist/components/LitePermissionMatrix.svelte +8 -8
- package/dist/components/LitePivotTable.svelte +11 -11
- package/dist/components/LitePopconfirm.svelte +49 -0
- package/dist/components/LitePopconfirm.svelte.d.ts +14 -0
- package/dist/components/LitePresenceAvatarGroup.svelte +8 -5
- package/dist/components/LitePresenceAvatarGroup.svelte.d.ts +2 -0
- package/dist/components/LitePrintableBill.svelte +12 -9
- package/dist/components/LitePrintableBill.svelte.d.ts +2 -0
- package/dist/components/LiteProgress.svelte +46 -0
- package/dist/components/LiteProgress.svelte.d.ts +12 -0
- package/dist/components/LiteQRCode.svelte +62 -0
- package/dist/components/LiteQRCode.svelte.d.ts +14 -0
- package/dist/components/LiteResizeBox.svelte +34 -0
- package/dist/components/LiteResizeBox.svelte.d.ts +12 -0
- package/dist/components/LiteResult.svelte +52 -0
- package/dist/components/LiteResult.svelte.d.ts +14 -0
- package/dist/components/LiteRowActions.svelte +36 -0
- package/dist/components/LiteRowActions.svelte.d.ts +17 -0
- package/dist/components/LiteSensitiveDataMask.svelte +4 -1
- package/dist/components/LiteSensitiveDataMask.svelte.d.ts +2 -0
- package/dist/components/LiteShow.svelte +1 -1
- package/dist/components/LiteShowField.svelte +2 -2
- package/dist/components/LiteSignaturePad.svelte +9 -9
- package/dist/components/LiteSkeleton.svelte +100 -0
- package/dist/components/LiteSkeleton.svelte.d.ts +19 -0
- package/dist/components/LiteSpace.svelte +31 -0
- package/dist/components/LiteSpace.svelte.d.ts +12 -0
- package/dist/components/LiteSpin.svelte +27 -0
- package/dist/components/LiteSpin.svelte.d.ts +10 -0
- package/dist/components/LiteSplitPaneLayout.svelte +18 -6
- package/dist/components/LiteSplitPaneLayout.svelte.d.ts +8 -0
- package/dist/components/LiteSpreadsheetView.svelte +8 -8
- package/dist/components/LiteStatistic.svelte +63 -0
- package/dist/components/LiteStatistic.svelte.d.ts +15 -0
- package/dist/components/LiteStatsCard.svelte +5 -2
- package/dist/components/LiteStatsCard.svelte.d.ts +2 -0
- package/dist/components/LiteStatusBadge.svelte +33 -0
- package/dist/components/LiteStatusBadge.svelte.d.ts +12 -0
- package/dist/components/LiteStatusTabs.svelte +35 -0
- package/dist/components/LiteStatusTabs.svelte.d.ts +14 -0
- package/dist/components/LiteStepForm.svelte +14 -11
- package/dist/components/LiteStepForm.svelte.d.ts +2 -0
- package/dist/components/LiteSteps.svelte +64 -0
- package/dist/components/LiteSteps.svelte.d.ts +18 -0
- package/dist/components/LiteTable.svelte +5 -2
- package/dist/components/LiteTable.svelte.d.ts +2 -0
- package/dist/components/LiteTableSummary.svelte +8 -5
- package/dist/components/LiteTableSummary.svelte.d.ts +2 -0
- package/dist/components/LiteTabs.svelte +30 -20
- package/dist/components/LiteTabs.svelte.d.ts +11 -2
- package/dist/components/LiteTag.svelte +31 -0
- package/dist/components/LiteTag.svelte.d.ts +13 -0
- package/dist/components/LiteTimeline.svelte +48 -0
- package/dist/components/LiteTimeline.svelte.d.ts +17 -0
- package/dist/components/LiteTour.svelte +54 -0
- package/dist/components/LiteTour.svelte.d.ts +15 -0
- package/dist/components/LiteTransfer.svelte +9 -6
- package/dist/components/LiteTransfer.svelte.d.ts +2 -0
- package/dist/components/LiteTree.svelte +48 -0
- package/dist/components/LiteTree.svelte.d.ts +17 -0
- package/dist/components/LiteTreeTable.svelte +1 -1
- package/dist/components/LiteTwoFactorStepper.svelte +53 -0
- package/dist/components/LiteTwoFactorStepper.svelte.d.ts +16 -0
- package/dist/components/LiteVersionDiffViewer.svelte +16 -13
- package/dist/components/LiteVersionDiffViewer.svelte.d.ts +2 -0
- package/dist/components/LiteVideoPlayer.svelte +67 -0
- package/dist/components/LiteVideoPlayer.svelte.d.ts +22 -0
- package/dist/components/LiteVirtualTable.svelte +1 -1
- package/dist/components/advanced/LiteAutoSaveIndicator.svelte +42 -13
- package/dist/components/advanced/LiteAutoSaveIndicator.svelte.d.ts +10 -4
- package/dist/components/advanced/LiteDraggableHeader.svelte +2 -2
- package/dist/components/advanced/LiteDrawerForm.svelte +4 -1
- package/dist/components/advanced/LiteDrawerForm.svelte.d.ts +2 -0
- package/dist/components/advanced/LiteInlineEdit.svelte +1 -1
- package/dist/components/advanced/LiteModalForm.svelte +4 -1
- package/dist/components/advanced/LiteModalForm.svelte.d.ts +2 -0
- package/dist/components/advanced/LiteToast.svelte +3 -3
- package/dist/components/advanced/LiteUndoableNotification.svelte +1 -1
- package/dist/components/compatibility/LiteRealtimeStatus.svelte +41 -2
- package/dist/components/compatibility/LiteRealtimeStatus.svelte.d.ts +15 -0
- package/dist/components/fields/LiteBooleanField.svelte +4 -2
- package/dist/components/fields/LiteBooleanField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteCascader.svelte +5 -2
- package/dist/components/fields/LiteCascader.svelte.d.ts +2 -0
- package/dist/components/fields/LiteDateField.svelte +39 -9
- package/dist/components/fields/LiteDateField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteDateRangeField.svelte +1 -1
- package/dist/components/fields/LiteImageField.svelte +6 -2
- package/dist/components/fields/LiteImageField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteJsonField.svelte +1 -1
- package/dist/components/fields/LiteMarkdownField.svelte +49 -3
- package/dist/components/fields/LiteMarkdownField.svelte.d.ts +5 -0
- package/dist/components/fields/LiteNumberField.svelte +5 -3
- package/dist/components/fields/LiteNumberField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteRichTextField.svelte +49 -12
- package/dist/components/fields/LiteRichTextField.svelte.d.ts +3 -0
- package/dist/components/fields/LiteSelectField.svelte +5 -3
- package/dist/components/fields/LiteSelectField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteTagField.svelte +38 -15
- package/dist/components/fields/LiteTagField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteTextField.svelte +26 -5
- package/dist/components/fields/LiteTextField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteTreeSelect.svelte +5 -2
- package/dist/components/fields/LiteTreeSelect.svelte.d.ts +2 -0
- package/dist/components/fields/LiteUrlField.svelte +5 -3
- package/dist/components/fields/LiteUrlField.svelte.d.ts +2 -0
- package/dist/components/layout/LiteAuthenticated.svelte +2 -2
- package/dist/components/layout/LiteCanAccess.svelte +1 -1
- package/dist/components/layout/LiteErrorComponent.svelte +4 -4
- package/dist/components/layout/LiteHeader.svelte +2 -2
- package/dist/components/layout/LiteSidebar.svelte +6 -3
- package/dist/components/layout/LiteSidebar.svelte.d.ts +2 -0
- package/dist/components/pages/LiteCreatePage.svelte +4 -1
- package/dist/components/pages/LiteCreatePage.svelte.d.ts +2 -0
- package/dist/components/pages/LiteEditPage.svelte +4 -1
- package/dist/components/pages/LiteEditPage.svelte.d.ts +2 -0
- package/dist/components/pages/LiteForgotPasswordPage.svelte +7 -7
- package/dist/components/pages/LiteListPage.svelte +6 -3
- package/dist/components/pages/LiteListPage.svelte.d.ts +2 -0
- package/dist/components/pages/LiteProfilePage.svelte +2 -2
- package/dist/components/pages/LiteRegisterPage.svelte +6 -6
- package/dist/components/pages/LiteShowPage.svelte +6 -3
- package/dist/components/pages/LiteShowPage.svelte.d.ts +2 -0
- package/dist/components/pages/LiteUpdatePasswordPage.svelte +4 -4
- package/dist/components/widgets/LiteAnomalyBadge.svelte +6 -3
- package/dist/components/widgets/LiteAnomalyBadge.svelte.d.ts +2 -0
- package/dist/components/widgets/LiteAreaChart.svelte +20 -0
- package/dist/components/widgets/LiteAreaChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteBarChart.svelte +6 -6
- package/dist/components/widgets/LiteChartSvg.svelte +102 -0
- package/dist/components/widgets/LiteChartSvg.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteChartTable.svelte +44 -0
- package/dist/components/widgets/LiteChartTable.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteDonutChart.svelte +20 -0
- package/dist/components/widgets/LiteDonutChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteFunnelChart.svelte +20 -0
- package/dist/components/widgets/LiteFunnelChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteGaugeChart.svelte +20 -0
- package/dist/components/widgets/LiteGaugeChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteHeatmapChart.svelte +20 -0
- package/dist/components/widgets/LiteHeatmapChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteInsightCard.svelte +35 -13
- package/dist/components/widgets/LiteInsightCard.svelte.d.ts +7 -4
- package/dist/components/widgets/LiteLineChart.svelte +13 -10
- package/dist/components/widgets/LiteLineChart.svelte.d.ts +0 -5
- package/dist/components/widgets/LitePieChart.svelte +11 -9
- package/dist/components/widgets/LitePieChart.svelte.d.ts +0 -5
- package/dist/components/widgets/LiteRadarChart.svelte +20 -0
- package/dist/components/widgets/LiteRadarChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteRoseChart.svelte +20 -0
- package/dist/components/widgets/LiteRoseChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteScatterChart.svelte +20 -0
- package/dist/components/widgets/LiteScatterChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteWaterfallChart.svelte +20 -0
- package/dist/components/widgets/LiteWaterfallChart.svelte.d.ts +10 -0
- package/dist/components/widgets/chart-geometry.d.ts +65 -0
- package/dist/components/widgets/chart-geometry.js +229 -0
- package/dist/components/widgets/index.d.ts +10 -0
- package/dist/components/widgets/index.js +10 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +47 -0
- package/dist/lite-code-theme.css +139 -0
- package/dist/lite.css +234 -127
- package/dist/rich-content.d.ts +47 -0
- package/dist/rich-content.js +498 -0
- package/dist/schema-generator.js +3 -1
- package/dist/server-adapter.js +6 -11
- package/dist/value-normalization.d.ts +4 -0
- package/dist/value-normalization.js +13 -0
- package/package.json +18 -4
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface CalendarEvent {
|
|
2
|
+
id: string;
|
|
3
|
+
date: string;
|
|
4
|
+
label: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
tone?: 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
7
|
+
}
|
|
8
|
+
interface Props {
|
|
9
|
+
value?: string;
|
|
10
|
+
events?: CalendarEvent[];
|
|
11
|
+
locale?: string;
|
|
12
|
+
weekStartsOn?: 0 | 1;
|
|
13
|
+
min?: string;
|
|
14
|
+
max?: string;
|
|
15
|
+
title?: string;
|
|
16
|
+
hrefFor?: (iso: string) => string;
|
|
17
|
+
}
|
|
18
|
+
declare const LiteCalendar: import("svelte").Component<Props, {}, "">;
|
|
19
|
+
type LiteCalendar = ReturnType<typeof LiteCalendar>;
|
|
20
|
+
export default LiteCalendar;
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
<style>
|
|
63
63
|
.sv-lite-annotation-box {
|
|
64
64
|
display: block;
|
|
65
|
-
border: 1px solid #
|
|
65
|
+
border: 1px solid #E5E6EB;
|
|
66
66
|
border-radius: 6px;
|
|
67
67
|
padding: 12px;
|
|
68
68
|
background-color: #ffffff;
|
|
@@ -71,17 +71,17 @@
|
|
|
71
71
|
.sv-lite-anno-header {
|
|
72
72
|
margin-bottom: 10px;
|
|
73
73
|
font-size: 13px;
|
|
74
|
-
color: #
|
|
74
|
+
color: #1D2129;
|
|
75
75
|
}
|
|
76
76
|
.sv-lite-anno-count {
|
|
77
|
-
color: #
|
|
77
|
+
color: #4E5969;
|
|
78
78
|
font-size: 11px;
|
|
79
79
|
margin-left: 6px;
|
|
80
80
|
}
|
|
81
81
|
.sv-lite-anno-preview {
|
|
82
82
|
text-align: center;
|
|
83
|
-
background-color: #
|
|
84
|
-
border: 1px solid #
|
|
83
|
+
background-color: #F7F8FA;
|
|
84
|
+
border: 1px solid #E5E6EB;
|
|
85
85
|
border-radius: 4px;
|
|
86
86
|
padding: 8px;
|
|
87
87
|
margin-bottom: 10px;
|
|
@@ -94,12 +94,12 @@
|
|
|
94
94
|
.sv-lite-anno-list {
|
|
95
95
|
margin-bottom: 10px;
|
|
96
96
|
padding: 8px;
|
|
97
|
-
background-color: #
|
|
97
|
+
background-color: #F7F8FA;
|
|
98
98
|
border-radius: 4px;
|
|
99
99
|
}
|
|
100
100
|
.sv-lite-list-title {
|
|
101
101
|
font-weight: 600;
|
|
102
|
-
color: #
|
|
102
|
+
color: #4E5969;
|
|
103
103
|
margin-bottom: 6px;
|
|
104
104
|
}
|
|
105
105
|
.sv-lite-anno-item {
|
|
@@ -108,19 +108,19 @@
|
|
|
108
108
|
.sv-lite-anno-badge {
|
|
109
109
|
display: inline-block;
|
|
110
110
|
padding: 1px 5px;
|
|
111
|
-
background-color: #
|
|
112
|
-
color: #
|
|
111
|
+
background-color: #FFECE8;
|
|
112
|
+
color: #CB272D;
|
|
113
113
|
border-radius: 3px;
|
|
114
114
|
font-size: 10px;
|
|
115
|
-
text-transform:
|
|
115
|
+
text-transform: none;
|
|
116
116
|
margin-right: 6px;
|
|
117
117
|
}
|
|
118
118
|
.sv-lite-anno-text {
|
|
119
|
-
color: #
|
|
119
|
+
color: #1D2129;
|
|
120
120
|
}
|
|
121
121
|
.sv-lite-anno-upload {
|
|
122
122
|
padding-top: 8px;
|
|
123
|
-
border-top: 1px solid #
|
|
123
|
+
border-top: 1px solid #E5E6EB;
|
|
124
124
|
}
|
|
125
125
|
.sv-lite-file-input {
|
|
126
126
|
font-size: 11px;
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
.sv-lite-upload-btn {
|
|
130
130
|
padding: 4px 10px;
|
|
131
131
|
font-size: 11px;
|
|
132
|
-
background-color: #
|
|
132
|
+
background-color: #165DFF;
|
|
133
133
|
color: #ffffff;
|
|
134
134
|
border: none;
|
|
135
135
|
border-radius: 3px;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
count: number;
|
|
6
|
+
label?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
/** Zero-based slide rendered as current (matches the reference `index`). */
|
|
9
|
+
index?: number;
|
|
10
|
+
/** Caller class merged with the built-in class list. */
|
|
11
|
+
class?: string;
|
|
12
|
+
children?: Snippet<[number]>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
count,
|
|
17
|
+
label = 'Carousel',
|
|
18
|
+
id = 'lite-carousel',
|
|
19
|
+
index = 0,
|
|
20
|
+
class: className = '',
|
|
21
|
+
children,
|
|
22
|
+
}: Props = $props();
|
|
23
|
+
|
|
24
|
+
const current = $derived(count > 0 ? Math.min(Math.max(0, Math.trunc(index)), count - 1) : 0);
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<section
|
|
28
|
+
class={`lite-carousel ${className}`.trim()}
|
|
29
|
+
aria-label={label}
|
|
30
|
+
aria-roledescription="carousel"
|
|
31
|
+
data-current={current + 1}
|
|
32
|
+
>
|
|
33
|
+
<div class="lite-carousel__track">
|
|
34
|
+
{#each Array.from({ length: Math.max(0, count) }, (_, index) => index) as index (index)}
|
|
35
|
+
<div
|
|
36
|
+
class="lite-carousel__slide"
|
|
37
|
+
id={`${id}-${index + 1}`}
|
|
38
|
+
role="group"
|
|
39
|
+
aria-roledescription="slide"
|
|
40
|
+
aria-label={`${index + 1} / ${count}`}
|
|
41
|
+
data-current={index === current || undefined}
|
|
42
|
+
>
|
|
43
|
+
{#if children}{@render children(index)}{:else}<p class="lite-muted">Slide {index + 1}</p>{/if}
|
|
44
|
+
</div>
|
|
45
|
+
{/each}
|
|
46
|
+
</div>
|
|
47
|
+
{#if count > 1}
|
|
48
|
+
<nav class="lite-carousel__dots" aria-label="Slides">
|
|
49
|
+
{#each Array.from({ length: count }, (_, index) => index) as index (index)}
|
|
50
|
+
<a
|
|
51
|
+
href={`#${id}-${index + 1}`}
|
|
52
|
+
aria-label={`Go to slide ${index + 1}`}
|
|
53
|
+
aria-current={index === current ? 'true' : undefined}
|
|
54
|
+
class={index === current ? 'active' : undefined}
|
|
55
|
+
>{index + 1}</a>
|
|
56
|
+
{/each}
|
|
57
|
+
</nav>
|
|
58
|
+
{/if}
|
|
59
|
+
</section>
|
|
60
|
+
|
|
61
|
+
<style>
|
|
62
|
+
.lite-carousel { display: block; }
|
|
63
|
+
.lite-carousel__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border: 1px solid #E5E6EB; border-radius: 8px; background: #fff; }
|
|
64
|
+
.lite-carousel__slide { flex: 0 0 100%; min-width: 0; padding: 16px; scroll-snap-align: start; }
|
|
65
|
+
.lite-carousel__dots { display: flex; flex-wrap: wrap; justify-content: center; }
|
|
66
|
+
.lite-carousel__dots a { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border: 1px solid #E5E6EB; border-radius: 999px; color: #4E5969; font-size: 11px; text-decoration: none; }
|
|
67
|
+
.lite-carousel__dots a:hover { border-color: #165DFF; color: #165DFF; text-decoration: none; }
|
|
68
|
+
.lite-carousel__dots a.active { border-color: #165DFF; background: #E8F3FF; color: #165DFF; }
|
|
69
|
+
|
|
70
|
+
.lite-carousel__dots a + a { margin-left: 4px; }
|
|
71
|
+
.lite-carousel__track { margin-bottom: 8px; }
|
|
72
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
count: number;
|
|
4
|
+
label?: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
/** Zero-based slide rendered as current (matches the reference `index`). */
|
|
7
|
+
index?: number;
|
|
8
|
+
/** Caller class merged with the built-in class list. */
|
|
9
|
+
class?: string;
|
|
10
|
+
children?: Snippet<[number]>;
|
|
11
|
+
}
|
|
12
|
+
declare const LiteCarousel: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type LiteCarousel = ReturnType<typeof LiteCarousel>;
|
|
14
|
+
export default LiteCarousel;
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
|
|
46
46
|
<div class="lite-chat-dialog lite-card" style="display:flex;flex-direction:column;height:560px;padding:0;overflow:hidden;max-width:400px;margin:0 auto;">
|
|
47
47
|
<!-- Header -->
|
|
48
|
-
<div style="background:#
|
|
48
|
+
<div style="background:#1D2129;color:#fff;padding:14px 16px;font-weight:600;flex-shrink:0;display:flex;align-items:center;border-top-left-radius:8px;border-top-right-radius:8px;">
|
|
49
49
|
{title}
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
<!-- Message History -->
|
|
53
|
-
<div class="lite-chat-history" style="flex:1;overflow-y:auto;padding:16px;background:#
|
|
53
|
+
<div class="lite-chat-history" style="flex:1;overflow-y:auto;padding:16px;background:#F7F8FA;">
|
|
54
54
|
{#if messages.length === 0}
|
|
55
|
-
<div style="text-align:center;color:#
|
|
55
|
+
<div style="text-align:center;color:#4E5969;margin-top:60px;font-size:14px;">
|
|
56
56
|
How can I help you today?
|
|
57
57
|
</div>
|
|
58
58
|
{/if}
|
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
font-size:14px;
|
|
71
71
|
line-height:1.5;
|
|
72
72
|
{msg.role === 'user'
|
|
73
|
-
? 'background:#
|
|
74
|
-
: 'background:#
|
|
73
|
+
? 'background:#165DFF;color:#fff;border-bottom-right-radius:2px;'
|
|
74
|
+
: 'background:#E5E6EB;color:#1D2129;border-bottom-left-radius:2px;'}"
|
|
75
75
|
>
|
|
76
76
|
<div style="white-space:pre-wrap;word-break:break-word;">{messageText(msg)}</div>
|
|
77
77
|
</div>
|
|
78
|
-
<div style="font-size:11px;color:#
|
|
78
|
+
<div style="font-size:11px;color:#86909C;margin-top:4px;">
|
|
79
79
|
{msg.role === 'user' ? 'You' : 'Assistant'} · {formatDate(msg.createdAt)}
|
|
80
80
|
</div>
|
|
81
81
|
</div>
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
|
|
85
85
|
{#if isLoading}
|
|
86
86
|
<div id="latest-msg" style="display:flex;flex-direction:column;align-items:flex-start;margin-bottom:16px;">
|
|
87
|
-
<div style="background:#
|
|
87
|
+
<div style="background:#E5E6EB;color:#4E5969;padding:10px 14px;border-radius:12px;border-bottom-left-radius:2px;font-size:13px;font-style:italic;">
|
|
88
88
|
Thinking...
|
|
89
89
|
</div>
|
|
90
90
|
</div>
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
</div>
|
|
93
93
|
|
|
94
94
|
<!-- Input Form -->
|
|
95
|
-
<form method="POST" action={actionRoute} style="display:flex;padding:12px;background:#fff;border-top:1px solid #
|
|
95
|
+
<form method="POST" action={actionRoute} style="display:flex;padding:12px;background:#fff;border-top:1px solid #E5E6EB;align-items:stretch;margin:0;flex-shrink:0;">
|
|
96
96
|
<textarea
|
|
97
97
|
name="message"
|
|
98
98
|
class="lite-input"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface CollapseItem {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
content: string;
|
|
7
|
+
open?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
items: CollapseItem[];
|
|
13
|
+
label?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let { items, label = 'Collapsible sections' }: Props = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<div class="lite-collapse" role="group" aria-label={label}>
|
|
20
|
+
{#each items as item (item.id)}
|
|
21
|
+
<section class="lite-collapse__item" data-open={item.open || undefined} data-disabled={item.disabled || undefined}>
|
|
22
|
+
{#if item.disabled}
|
|
23
|
+
<!-- Disabled sections must not navigate: a dead anchor still moves focus and
|
|
24
|
+
changes the URL, so render plain text instead of a link. -->
|
|
25
|
+
<span class="lite-collapse__trigger" aria-disabled="true">
|
|
26
|
+
<span>{item.title}</span>
|
|
27
|
+
{#if item.description}<small>{item.description}</small>{/if}
|
|
28
|
+
</span>
|
|
29
|
+
{:else}
|
|
30
|
+
<a class="lite-collapse__trigger" href={`#${item.id}`}>
|
|
31
|
+
<span>{item.title}</span>
|
|
32
|
+
{#if item.description}<small>{item.description}</small>{/if}
|
|
33
|
+
</a>
|
|
34
|
+
{/if}
|
|
35
|
+
<div class="lite-collapse__body" id={item.id}>{item.content}</div>
|
|
36
|
+
</section>
|
|
37
|
+
{/each}
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<style>
|
|
41
|
+
.lite-collapse { border: 1px solid #E5E6EB; border-radius: 8px; background: #fff; overflow: hidden; }
|
|
42
|
+
.lite-collapse__item + .lite-collapse__item { border-top: 1px solid #E5E6EB; }
|
|
43
|
+
.lite-collapse__trigger { display: block; padding: 12px 16px; color: #1D2129; font-size: 14px; font-weight: 500; text-decoration: none; }
|
|
44
|
+
.lite-collapse__trigger:hover { background: #F7F8FA; text-decoration: none; }
|
|
45
|
+
.lite-collapse__trigger small { margin-left: 8px; color: #86909C; font-size: 12px; font-weight: 400; }
|
|
46
|
+
.lite-collapse__item[data-disabled] .lite-collapse__trigger { color: #C9CDD4; cursor: not-allowed; }
|
|
47
|
+
.lite-collapse__body { display: none; padding: 12px 16px; border-top: 1px solid #F2F3F5; color: #4E5969; font-size: 13px; line-height: 1.6; }
|
|
48
|
+
.lite-collapse__item[data-open] .lite-collapse__body, .lite-collapse__body:target { display: block; }
|
|
49
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface CollapseItem {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
content: string;
|
|
6
|
+
open?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface Props {
|
|
10
|
+
items: CollapseItem[];
|
|
11
|
+
label?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const LiteCollapse: import("svelte").Component<Props, {}, "">;
|
|
14
|
+
type LiteCollapse = ReturnType<typeof LiteCollapse>;
|
|
15
|
+
export default LiteCollapse;
|
|
@@ -4,15 +4,18 @@
|
|
|
4
4
|
interface Props {
|
|
5
5
|
field: FieldDefinition;
|
|
6
6
|
action?: string;
|
|
7
|
+
/** Caller class merged with the built-in class list. */
|
|
8
|
+
class?: string;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
let {
|
|
10
12
|
field,
|
|
11
13
|
action = '',
|
|
14
|
+
class: className = '',
|
|
12
15
|
}: Props = $props();
|
|
13
16
|
</script>
|
|
14
17
|
|
|
15
|
-
<span class="lite-column-header-filter">
|
|
18
|
+
<span class="lite-column-header-filter {className}">
|
|
16
19
|
<a
|
|
17
20
|
href="{action}?filter_field={field.key}"
|
|
18
21
|
class="lite-filter-icon"
|
|
@@ -2,6 +2,8 @@ import type { FieldDefinition } from '@svadmin/core';
|
|
|
2
2
|
interface Props {
|
|
3
3
|
field: FieldDefinition;
|
|
4
4
|
action?: string;
|
|
5
|
+
/** Caller class merged with the built-in class list. */
|
|
6
|
+
class?: string;
|
|
5
7
|
}
|
|
6
8
|
declare const LiteColumnHeaderFilter: import("svelte").Component<Props, {}, "">;
|
|
7
9
|
type LiteColumnHeaderFilter = ReturnType<typeof LiteColumnHeaderFilter>;
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
method?: 'GET' | 'POST' | 'get' | 'post';
|
|
12
12
|
title?: string;
|
|
13
13
|
submitText?: string;
|
|
14
|
+
/** Caller class merged with the built-in class list. */
|
|
15
|
+
class?: string;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
let {
|
|
@@ -19,10 +21,11 @@
|
|
|
19
21
|
method = 'GET',
|
|
20
22
|
title = 'Column Visibility',
|
|
21
23
|
submitText = 'Apply',
|
|
24
|
+
class: className = '',
|
|
22
25
|
}: Props = $props();
|
|
23
26
|
</script>
|
|
24
27
|
|
|
25
|
-
<div class="lite-column-settings lite-form-group">
|
|
28
|
+
<div class="lite-column-settings lite-form-group {className}">
|
|
26
29
|
<div class="lite-column-settings-title">
|
|
27
30
|
<strong>⚙ {title}</strong>
|
|
28
31
|
</div>
|
|
@@ -52,13 +55,13 @@
|
|
|
52
55
|
.lite-column-settings {
|
|
53
56
|
margin-bottom: 12px;
|
|
54
57
|
padding: 8px 12px;
|
|
55
|
-
background: #
|
|
56
|
-
border: 1px solid #
|
|
58
|
+
background: #F7F8FA;
|
|
59
|
+
border: 1px solid #E5E6EB;
|
|
57
60
|
border-radius: 4px;
|
|
58
61
|
}
|
|
59
62
|
.lite-column-settings-title {
|
|
60
63
|
font-size: 12px;
|
|
61
|
-
color: #
|
|
64
|
+
color: #4E5969;
|
|
62
65
|
margin-bottom: 6px;
|
|
63
66
|
}
|
|
64
67
|
.lite-column-options {
|
|
@@ -9,6 +9,8 @@ interface Props {
|
|
|
9
9
|
method?: 'GET' | 'POST' | 'get' | 'post';
|
|
10
10
|
title?: string;
|
|
11
11
|
submitText?: string;
|
|
12
|
+
/** Caller class merged with the built-in class list. */
|
|
13
|
+
class?: string;
|
|
12
14
|
}
|
|
13
15
|
declare const LiteColumnSettings: import("svelte").Component<Props, {}, "">;
|
|
14
16
|
type LiteColumnSettings = ReturnType<typeof LiteColumnSettings>;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { renderRichContent, type MarkdownRenderOptions } from '../rich-content.js';
|
|
3
|
+
|
|
4
|
+
interface CommentItem {
|
|
5
|
+
id: string;
|
|
6
|
+
author: string;
|
|
7
|
+
content: string;
|
|
8
|
+
time?: string;
|
|
9
|
+
avatar?: string;
|
|
10
|
+
replies?: CommentItem[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
comments: CommentItem[];
|
|
15
|
+
emptyText?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
action?: string;
|
|
18
|
+
submitLabel?: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Render comment bodies as Markdown/allowlisted HTML. Defaults to `false` so
|
|
22
|
+
* the default output stays text-only, matching the reference component.
|
|
23
|
+
*/
|
|
24
|
+
richContent?: boolean;
|
|
25
|
+
richContentOptions?: MarkdownRenderOptions;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let {
|
|
29
|
+
comments,
|
|
30
|
+
emptyText = 'No comments yet',
|
|
31
|
+
label = 'Comments',
|
|
32
|
+
action,
|
|
33
|
+
submitLabel = 'Comment',
|
|
34
|
+
name = 'comment',
|
|
35
|
+
richContent = false,
|
|
36
|
+
richContentOptions,
|
|
37
|
+
}: Props = $props();
|
|
38
|
+
|
|
39
|
+
function body(value: string): string {
|
|
40
|
+
return renderRichContent(value, richContentOptions);
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<section class="lite-comments" aria-label={label}>
|
|
45
|
+
{#if comments.length === 0}
|
|
46
|
+
<p class="lite-muted">{emptyText}</p>
|
|
47
|
+
{:else}
|
|
48
|
+
<ol class="lite-comments__list">
|
|
49
|
+
{#each comments as comment (comment.id)}
|
|
50
|
+
<li class="lite-comments__item">
|
|
51
|
+
{#if comment.avatar}<img src={comment.avatar} alt="" loading="lazy" />{:else}<span class="lite-comments__avatar" aria-hidden="true">{comment.author.slice(0, 1)}</span>{/if}
|
|
52
|
+
<div class="lite-comments__body">
|
|
53
|
+
<p class="lite-comments__meta"><strong>{comment.author}</strong>{#if comment.time}<time>{comment.time}</time>{/if}</p>
|
|
54
|
+
{#if richContent}
|
|
55
|
+
<!-- eslint-disable-next-line svelte/no-at-html-tags -- 内容由 renderRichContent 转义或白名单过滤,高亮回调仅允许可信服务端实现。 -->
|
|
56
|
+
<div class="lite-comments__rich">{@html body(comment.content)}</div>
|
|
57
|
+
{:else}
|
|
58
|
+
<p>{comment.content}</p>
|
|
59
|
+
{/if}
|
|
60
|
+
{#if comment.replies?.length}
|
|
61
|
+
<ol class="lite-comments__replies">
|
|
62
|
+
{#each comment.replies as reply (reply.id)}
|
|
63
|
+
<li>
|
|
64
|
+
<strong>{reply.author}</strong>
|
|
65
|
+
{#if richContent}
|
|
66
|
+
<!-- eslint-disable-next-line svelte/no-at-html-tags -- 内容由 renderRichContent 转义或白名单过滤,高亮回调仅允许可信服务端实现。 -->
|
|
67
|
+
<span class="lite-comments__rich">{@html body(reply.content)}</span>
|
|
68
|
+
{:else}
|
|
69
|
+
{reply.content}
|
|
70
|
+
{/if}
|
|
71
|
+
</li>
|
|
72
|
+
{/each}
|
|
73
|
+
</ol>
|
|
74
|
+
{/if}
|
|
75
|
+
</div>
|
|
76
|
+
</li>
|
|
77
|
+
{/each}
|
|
78
|
+
</ol>
|
|
79
|
+
{/if}
|
|
80
|
+
{#if action}
|
|
81
|
+
<form class="lite-comments__form" method="POST" {action}>
|
|
82
|
+
<label class="lite-form-group">
|
|
83
|
+
<span>Add a comment</span>
|
|
84
|
+
<textarea class="lite-input" name={name} rows="3" required></textarea>
|
|
85
|
+
</label>
|
|
86
|
+
<button class="lite-btn lite-btn-primary lite-btn-sm" type="submit">{submitLabel}</button>
|
|
87
|
+
</form>
|
|
88
|
+
{/if}
|
|
89
|
+
</section>
|
|
90
|
+
|
|
91
|
+
<style>
|
|
92
|
+
.lite-comments { display: block; }
|
|
93
|
+
.lite-comments__list, .lite-comments__replies { display: block; margin: 0; padding: 0; list-style: none; }
|
|
94
|
+
.lite-comments__item { display: flex; align-items: flex-start; padding-bottom: 12px; border-bottom: 1px solid #F2F3F5; }
|
|
95
|
+
.lite-comments__avatar, .lite-comments__item > img { display: inline-grid; flex: 0 0 32px; place-items: center; width: 32px; height: 32px; border-radius: 999px; background: #E8F3FF; color: #165DFF; font-size: 13px; font-weight: 600; object-fit: cover; }
|
|
96
|
+
.lite-comments__body { min-width: 0; flex: 1; }
|
|
97
|
+
.lite-comments__body > p { margin: 4px 0 0; color: #4E5969; font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
|
|
98
|
+
.lite-comments__meta { display: flex; flex-wrap: wrap; align-items: baseline; margin: 0; color: #1D2129; font-size: 13px; }
|
|
99
|
+
.lite-comments__meta time { color: #86909C; font-size: 12px; }
|
|
100
|
+
.lite-comments__replies { margin-top: 8px; padding-left: 12px; border-left: 2px solid #F2F3F5; color: #4E5969; font-size: 12px; }
|
|
101
|
+
.lite-comments__form { display: block; justify-items: start; }
|
|
102
|
+
|
|
103
|
+
.lite-comments__item > img, .lite-comments__avatar { margin-right: 10px; }
|
|
104
|
+
.lite-comments__meta > * + * { margin-left: 8px; }
|
|
105
|
+
.lite-comments__form textarea { margin-bottom: 8px; }
|
|
106
|
+
.lite-comments__rich :global(p) { margin: 0 0 6px; }
|
|
107
|
+
.lite-comments__rich :global(p:last-child) { margin-bottom: 0; }
|
|
108
|
+
.lite-comments__rich :global(code) { padding: 1px 4px; border-radius: 3px; background: #F2F3F5; font-family: monospace; font-size: 12px; }
|
|
109
|
+
.lite-comments__rich :global(pre) { margin: 0 0 6px; padding: 8px; overflow-x: auto; border-radius: 4px; background: #F2F3F5; }
|
|
110
|
+
.lite-comments__rich :global(a) { color: #165DFF; }
|
|
111
|
+
.lite-comments__rich :global(ul),
|
|
112
|
+
.lite-comments__rich :global(ol) { margin: 0 0 6px; padding-left: 18px; }
|
|
113
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type MarkdownRenderOptions } from '../rich-content.js';
|
|
2
|
+
interface CommentItem {
|
|
3
|
+
id: string;
|
|
4
|
+
author: string;
|
|
5
|
+
content: string;
|
|
6
|
+
time?: string;
|
|
7
|
+
avatar?: string;
|
|
8
|
+
replies?: CommentItem[];
|
|
9
|
+
}
|
|
10
|
+
interface Props {
|
|
11
|
+
comments: CommentItem[];
|
|
12
|
+
emptyText?: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
action?: string;
|
|
15
|
+
submitLabel?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Render comment bodies as Markdown/allowlisted HTML. Defaults to `false` so
|
|
19
|
+
* the default output stays text-only, matching the reference component.
|
|
20
|
+
*/
|
|
21
|
+
richContent?: boolean;
|
|
22
|
+
richContentOptions?: MarkdownRenderOptions;
|
|
23
|
+
}
|
|
24
|
+
declare const LiteCommentThread: import("svelte").Component<Props, {}, "">;
|
|
25
|
+
type LiteCommentThread = ReturnType<typeof LiteCommentThread>;
|
|
26
|
+
export default LiteCommentThread;
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
aria-describedby={description ? descriptionId : undefined}
|
|
52
52
|
tabindex="-1"
|
|
53
53
|
>
|
|
54
|
-
<div id={titleId} style="font-weight:600;margin-bottom:8px;color:#
|
|
54
|
+
<div id={titleId} style="font-weight:600;margin-bottom:8px;color:#1D2129;">{title}</div>
|
|
55
55
|
{#if description}
|
|
56
|
-
<div id={descriptionId} style="font-size:12px;color:#
|
|
56
|
+
<div id={descriptionId} style="font-size:12px;color:#4E5969;margin-bottom:16px;">{description}</div>
|
|
57
57
|
{/if}
|
|
58
58
|
<form method="POST" {action} class="lite-inline-actions lite-justify-end">
|
|
59
59
|
{#each Object.entries(hiddenInputs) as [key, val] (key)}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
target?: Date | string | number;
|
|
4
|
+
duration?: number;
|
|
5
|
+
title?: string;
|
|
6
|
+
format?: 'full' | 'clock';
|
|
7
|
+
refreshHref?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let { target, duration, title, format = 'full', refreshHref }: Props = $props();
|
|
11
|
+
|
|
12
|
+
function resolveRemaining(): number {
|
|
13
|
+
if (duration !== undefined) return Math.max(0, duration * 1000);
|
|
14
|
+
if (!target) return 0;
|
|
15
|
+
const end = target instanceof Date ? target.getTime() : new Date(target).getTime();
|
|
16
|
+
return Number.isNaN(end) ? 0 : Math.max(0, end - Date.now());
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function formatTime(value: number): string {
|
|
20
|
+
const total = Math.max(0, Math.floor(value / 1000));
|
|
21
|
+
const days = Math.floor(total / 86400);
|
|
22
|
+
const hours = Math.floor((total % 86400) / 3600);
|
|
23
|
+
const minutes = Math.floor((total % 3600) / 60);
|
|
24
|
+
const seconds = total % 60;
|
|
25
|
+
const clock = [hours, minutes, seconds].map((part) => String(part).padStart(2, '0')).join(':');
|
|
26
|
+
return format === 'clock' ? clock : days > 0 ? `${days}d ${clock}` : clock;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const remaining = $derived(resolveRemaining());
|
|
30
|
+
const deadline = $derived(target ? (target instanceof Date ? target.toISOString() : new Date(target).toISOString()) : undefined);
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<div class="lite-countdown" data-finished={remaining <= 0 || undefined}>
|
|
34
|
+
{#if title}<p class="lite-countdown__title">{title}</p>{/if}
|
|
35
|
+
<time class="lite-countdown__value" datetime={deadline}>{formatTime(remaining)}</time>
|
|
36
|
+
{#if deadline}<small>Deadline: {deadline}</small>{/if}
|
|
37
|
+
{#if refreshHref}<a href={refreshHref}>Refresh</a>{/if}
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<style>
|
|
41
|
+
.lite-countdown { display: block; }
|
|
42
|
+
.lite-countdown__title { margin: 0; color: #86909C; font-size: 13px; }
|
|
43
|
+
.lite-countdown__value { color: #1D2129; font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; }
|
|
44
|
+
.lite-countdown[data-finished] .lite-countdown__value { color: #86909C; }
|
|
45
|
+
.lite-countdown small { color: #86909C; font-size: 12px; }
|
|
46
|
+
.lite-countdown a { color: #165DFF; font-size: 12px; }
|
|
47
|
+
|
|
48
|
+
.lite-countdown > * + * { margin-top: 4px; }
|
|
49
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
target?: Date | string | number;
|
|
3
|
+
duration?: number;
|
|
4
|
+
title?: string;
|
|
5
|
+
format?: 'full' | 'clock';
|
|
6
|
+
refreshHref?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const LiteCountdown: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type LiteCountdown = ReturnType<typeof LiteCountdown>;
|
|
10
|
+
export default LiteCountdown;
|