@svadmin/ui 0.72.0 → 0.74.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 +62 -22
- package/THIRD_PARTY_NOTICES.md +52 -0
- package/dist/app.css +8488 -6297
- package/dist/app.theme.css +8514 -6374
- package/dist/class-properties.generated.d.ts +1 -0
- package/dist/class-properties.generated.js +2 -0
- package/dist/classnames.d.ts +8 -0
- package/dist/classnames.js +26 -0
- package/dist/component-registry.d.ts +14977 -0
- package/dist/component-registry.js +216 -0
- package/dist/components/AboutSettings.svelte +7 -1
- package/dist/components/AboutSettings.svelte.d.ts +4 -1
- package/dist/components/ActivityFeed.svelte +9 -3
- package/dist/components/ActivityFeed.svelte.d.ts +3 -0
- package/dist/components/AdminApp.svelte +19 -10
- package/dist/components/AdminApp.svelte.d.ts +6 -0
- package/dist/components/ApiSettings.svelte +41 -5
- package/dist/components/ApprovalCenter.svelte +283 -0
- package/dist/components/ApprovalCenter.svelte.d.ts +10 -0
- package/dist/components/AuditLogViewer.svelte +3 -1
- package/dist/components/AutoForm.svelte +53 -9
- package/dist/components/AutoForm.svelte.d.ts +3 -0
- package/dist/components/AutoTable.svelte +846 -43
- package/dist/components/AutoTable.svelte.d.ts +22 -1
- package/dist/components/BoundRecordDetailDrawer.svelte +17 -2
- package/dist/components/BoundRecordDetailDrawer.svelte.d.ts +4 -0
- package/dist/components/Breadcrumbs.svelte +11 -1
- package/dist/components/CancelTaskButton.svelte +12 -42
- package/dist/components/ColorPicker.svelte +73 -0
- package/dist/components/ColorPicker.svelte.d.ts +15 -0
- package/dist/components/ComboboxField.svelte +143 -34
- package/dist/components/ComboboxField.svelte.d.ts +4 -2
- package/dist/components/CreatePage.svelte +4 -0
- package/dist/components/CreatePage.svelte.d.ts +2 -0
- package/dist/components/DashboardView.svelte +99 -0
- package/dist/components/DashboardView.svelte.d.ts +14 -0
- package/dist/components/DatePicker.svelte +10 -0
- package/dist/components/DatePicker.svelte.d.ts +6 -0
- package/dist/components/DateRangeInput.svelte +155 -0
- package/dist/components/DateRangeInput.svelte.d.ts +35 -0
- package/dist/components/DateRangePicker.svelte +10 -0
- package/dist/components/DateRangePicker.svelte.d.ts +6 -0
- package/dist/components/DateTimeInput.svelte +134 -0
- package/dist/components/DateTimeInput.svelte.d.ts +27 -0
- package/dist/components/DateTimePicker.svelte +10 -0
- package/dist/components/DateTimePicker.svelte.d.ts +6 -0
- package/dist/components/DevTools.svelte +36 -28
- package/dist/components/DevframePanel.svelte +123 -0
- package/dist/components/DevframePanel.svelte.d.ts +3 -0
- package/dist/components/EditPage.svelte +4 -0
- package/dist/components/EditPage.svelte.d.ts +2 -0
- package/dist/components/ErrorSummary.svelte +52 -0
- package/dist/components/ErrorSummary.svelte.d.ts +14 -0
- package/dist/components/FieldRenderer.svelte +172 -99
- package/dist/components/FileUpload.svelte +412 -0
- package/dist/components/FileUpload.svelte.d.ts +43 -0
- package/dist/components/FilterBuilder.svelte +244 -265
- package/dist/components/FilterBuilder.svelte.d.ts +3 -0
- package/dist/components/FilterCollectionInput.svelte +80 -0
- package/dist/components/FilterCollectionInput.svelte.d.ts +10 -0
- package/dist/components/GanttChart.svelte +66 -14
- package/dist/components/GanttChart.svelte.d.ts +6 -0
- package/dist/components/Header.svelte +18 -2
- package/dist/components/ImportWizard.svelte +509 -100
- package/dist/components/ImportWizard.svelte.d.ts +11 -0
- package/dist/components/JsonSchemaForm.svelte +322 -98
- package/dist/components/JsonSchemaForm.svelte.d.ts +18 -1
- package/dist/components/KanbanBoard.svelte +195 -40
- package/dist/components/KanbanBoard.svelte.d.ts +9 -2
- package/dist/components/Layout.svelte +4 -3
- package/dist/components/LazyAutoForm.svelte +28 -0
- package/dist/components/LazyAutoForm.svelte.d.ts +8 -0
- package/dist/components/LazyAutoTable.svelte +28 -0
- package/dist/components/LazyAutoTable.svelte.d.ts +8 -0
- package/dist/components/LazySettingsPage.svelte +28 -0
- package/dist/components/LazySettingsPage.svelte.d.ts +8 -0
- package/dist/components/LazyShowPage.svelte +28 -0
- package/dist/components/LazyShowPage.svelte.d.ts +8 -0
- package/dist/components/LazyTaskQueueDrawer.svelte.d.ts +1 -1
- package/dist/components/ListPage.svelte +9 -1
- package/dist/components/ListPage.svelte.d.ts +5 -0
- package/dist/components/LoginPage.svelte +2 -2
- package/dist/components/MoneyInput.svelte +25 -0
- package/dist/components/MoneyInput.svelte.d.ts +20 -0
- package/dist/components/MultiTabKeepAlive.svelte +11 -6
- package/dist/components/NotificationsSettings.svelte +69 -2
- package/dist/components/NotificationsSettings.svelte.d.ts +25 -1
- package/dist/components/NumberInput.svelte +25 -0
- package/dist/components/NumberInput.svelte.d.ts +19 -0
- package/dist/components/NumericInput.svelte +110 -0
- package/dist/components/NumericInput.svelte.d.ts +23 -0
- package/dist/components/PercentInput.svelte +25 -0
- package/dist/components/PercentInput.svelte.d.ts +20 -0
- package/dist/components/PermissionMatrix.svelte +20 -1
- package/dist/components/PivotExportButton.svelte +157 -0
- package/dist/components/PivotExportButton.svelte.d.ts +16 -0
- package/dist/components/PivotTable.svelte +229 -74
- package/dist/components/PivotTable.svelte.d.ts +19 -2
- package/dist/components/QuickEditDrawer.svelte +4 -1
- package/dist/components/QuickEditDrawer.svelte.d.ts +2 -0
- package/dist/components/RadioGroup.svelte +121 -0
- package/dist/components/RadioGroup.svelte.d.ts +43 -0
- package/dist/components/RangeSlider.svelte +127 -0
- package/dist/components/RangeSlider.svelte.d.ts +22 -0
- package/dist/components/Rate.svelte +121 -0
- package/dist/components/Rate.svelte.d.ts +16 -0
- package/dist/components/RecordDetailDrawer.svelte +6 -2
- package/dist/components/RecordDetailDrawer.svelte.d.ts +4 -0
- package/dist/components/RelationPicker.svelte +341 -0
- package/dist/components/RelationPicker.svelte.d.ts +26 -0
- package/dist/components/ResourceOperationsPage.svelte +25 -19
- package/dist/components/ResourceOperationsPage.svelte.d.ts +5 -1
- package/dist/components/RetryTaskButton.svelte +12 -42
- package/dist/components/SecuritySettings.svelte +29 -5
- package/dist/components/SegmentedControl.svelte +145 -0
- package/dist/components/SegmentedControl.svelte.d.ts +38 -0
- package/dist/components/SettingsPage.svelte +3 -1
- package/dist/components/SettingsPage.svelte.d.ts +1 -0
- package/dist/components/ShowInferencer.svelte +4 -2
- package/dist/components/ShowInferencer.svelte.d.ts +2 -0
- package/dist/components/ShowPage.svelte +25 -6
- package/dist/components/ShowPage.svelte.d.ts +5 -0
- package/dist/components/Sidebar.svelte +5 -5
- package/dist/components/Slider.svelte +100 -0
- package/dist/components/Slider.svelte.d.ts +19 -0
- package/dist/components/SpreadsheetView.svelte +1037 -124
- package/dist/components/SpreadsheetView.svelte.d.ts +19 -0
- package/dist/components/StepsForm.svelte +5 -5
- package/dist/components/SvarAutoTable.svelte +39 -0
- package/dist/components/SvarAutoTable.svelte.d.ts +13 -0
- package/dist/components/SvarDataGrid.svelte +362 -0
- package/dist/components/SvarDataGrid.svelte.d.ts +57 -0
- package/dist/components/SvarGridCell.svelte +10 -0
- package/dist/components/SvarGridCell.svelte.d.ts +7 -0
- package/dist/components/SvarResourceRead.svelte +50 -0
- package/dist/components/SvarResourceRead.svelte.d.ts +23 -0
- package/dist/components/SvarResourceTable.svelte +63 -0
- package/dist/components/SvarResourceTable.svelte.d.ts +42 -0
- package/dist/components/SvarResourceTableView.svelte +364 -0
- package/dist/components/SvarResourceTableView.svelte.d.ts +4 -0
- package/dist/components/TagsInput.svelte +178 -0
- package/dist/components/TagsInput.svelte.d.ts +17 -0
- package/dist/components/TaskQueueDrawer.svelte +72 -16
- package/dist/components/TimePicker.svelte +10 -0
- package/dist/components/TimePicker.svelte.d.ts +6 -0
- package/dist/components/TreeSelect.svelte +440 -46
- package/dist/components/TreeSelect.svelte.d.ts +6 -1
- package/dist/components/TreeTable.svelte +484 -82
- package/dist/components/TreeTable.svelte.d.ts +24 -1
- package/dist/components/TwoFactorAuthPage.svelte +85 -48
- package/dist/components/TwoFactorAuthPage.svelte.d.ts +12 -1
- package/dist/components/VirtualTable.svelte +116 -20
- package/dist/components/VirtualTable.svelte.d.ts +5 -0
- package/dist/components/account/CompanyProfilePage.svelte +74 -38
- package/dist/components/account/GetStartedPage.svelte +2 -1
- package/dist/components/account/ImportMembersPage.svelte +22 -167
- package/dist/components/account/ImportMembersPage.svelte.d.ts +4 -1
- package/dist/components/account/MemberDirectory.svelte +156 -0
- package/dist/components/account/MemberDirectory.svelte.d.ts +19 -0
- package/dist/components/account/MembersStarterPage.svelte +9 -55
- package/dist/components/account/MembersStarterPage.svelte.d.ts +5 -1
- package/dist/components/account/SecurityLogPage.svelte +4 -1
- package/dist/components/account/SettingsPlainPage.svelte +7 -38
- package/dist/components/account/SettingsPlainPage.svelte.d.ts +4 -1
- package/dist/components/account/SettingsSidebarPage.svelte +7 -20
- package/dist/components/account/TeamMembersPage.svelte +4 -20
- package/dist/components/account/TeamMembersPage.svelte.d.ts +5 -1
- package/dist/components/account/UserProfilePage.svelte +3 -25
- package/dist/components/account/UserProfilePage.svelte.d.ts +17 -2
- package/dist/components/auto-table-grid.d.ts +26 -0
- package/dist/components/auto-table-grid.js +1 -0
- package/dist/components/buttons/ExportButton.svelte +56 -12
- package/dist/components/buttons/ExportButton.svelte.d.ts +11 -0
- package/dist/components/content/ContentPageHeader.svelte +12 -9
- package/dist/components/content/ContentPageShell.svelte +6 -9
- package/dist/components/content/FileBrowser.svelte +35 -0
- package/dist/components/content/FileBrowser.svelte.d.ts +14 -0
- package/dist/components/content/MetricBlock.svelte +10 -13
- package/dist/components/content/NetworkTable.svelte +3 -3
- package/dist/components/content/NetworkTable.svelte.d.ts +1 -0
- package/dist/components/content/PageToolbar.svelte +6 -10
- package/dist/components/content/ReferenceNotice.svelte +5 -0
- package/dist/components/content/ReferenceNotice.svelte.d.ts +18 -0
- package/dist/components/content/SectionHeader.svelte +8 -13
- package/dist/components/content/SettingsFieldRow.svelte +9 -23
- package/dist/components/content/SettingsGroup.svelte +11 -27
- package/dist/components/content/StatusBadge.svelte +3 -8
- package/dist/components/content/WorkspaceLayout.svelte +8 -12
- package/dist/components/enterprise/filter-tree.d.ts +48 -0
- package/dist/components/enterprise/filter-tree.js +224 -0
- package/dist/components/enterprise/json-schema-form.d.ts +39 -0
- package/dist/components/enterprise/json-schema-form.js +195 -0
- package/dist/components/enterprise/recursive-schema-form.d.ts +30 -0
- package/dist/components/enterprise/recursive-schema-form.js +196 -0
- package/dist/components/enterprise/spreadsheet-formula.d.ts +12 -0
- package/dist/components/enterprise/spreadsheet-formula.js +245 -0
- package/dist/components/export-reference.d.ts +2 -0
- package/dist/components/export-reference.js +9 -0
- package/dist/components/fieldComponentMap.js +2 -0
- package/dist/components/fields/DateField.svelte +12 -12
- package/dist/components/fields/date-display.d.ts +6 -0
- package/dist/components/fields/date-display.js +24 -0
- package/dist/components/fields/date-field-value.d.ts +2 -0
- package/dist/components/fields/date-field-value.js +13 -0
- package/dist/components/json-schema-form-state.d.ts +37 -0
- package/dist/components/json-schema-form-state.js +168 -0
- package/dist/components/network/TeamCrewTablePage.svelte +6 -1
- package/dist/components/network/UserCardsNFTPage.svelte +2 -0
- package/dist/components/profile/PublicProfilePage.svelte +2 -0
- package/dist/components/record-detail.svelte.d.ts +3 -0
- package/dist/components/record-detail.svelte.js +10 -4
- package/dist/components/saved-list-views.d.ts +74 -1
- package/dist/components/saved-list-views.js +191 -3
- package/dist/components/svar-grid-cells.d.ts +14 -0
- package/dist/components/svar-grid-cells.js +2 -0
- package/dist/components/svar-grid-contract.d.ts +80 -0
- package/dist/components/svar-grid-contract.js +159 -0
- package/dist/components/svar-grid-interactions.d.ts +54 -0
- package/dist/components/svar-grid-interactions.js +174 -0
- package/dist/components/svar-grid-loading.d.ts +40 -0
- package/dist/components/svar-grid-loading.js +180 -0
- package/dist/components/svar-grid-operations.d.ts +37 -0
- package/dist/components/svar-grid-operations.js +186 -0
- package/dist/components/svar-grid-panes.d.ts +34 -0
- package/dist/components/svar-grid-panes.js +66 -0
- package/dist/components/svar-grid-resource-loading.d.ts +18 -0
- package/dist/components/svar-grid-resource-loading.js +68 -0
- package/dist/components/svar-grid-resource-session.svelte.d.ts +29 -0
- package/dist/components/svar-grid-resource-session.svelte.js +61 -0
- package/dist/components/table-contract.d.ts +12 -1
- package/dist/components/task-action.svelte.d.ts +13 -0
- package/dist/components/task-action.svelte.js +73 -0
- package/dist/components/ui/DesignSystemShowcase.svelte +164 -0
- package/dist/components/ui/DesignSystemShowcase.svelte.d.ts +3 -0
- package/dist/components/ui/badge/badge-variants.d.ts +3 -2
- package/dist/components/ui/badge/badge-variants.js +2 -1
- package/dist/components/ui/badge/badge.svelte +3 -0
- package/dist/components/ui/badge/badge.svelte.d.ts +1 -0
- package/dist/components/ui/button/button-variants.d.ts +5 -4
- package/dist/components/ui/button/button-variants.js +7 -2
- package/dist/components/ui/checkbox/checkbox.svelte +5 -1
- package/dist/components/ui/checkbox/checkbox.svelte.d.ts +5 -1
- package/dist/components/ui/input/input.svelte +8 -6
- package/dist/components/ui/input/input.svelte.d.ts +4 -1
- package/dist/components/ui/select/select.svelte +4 -1
- package/dist/components/ui/select/select.svelte.d.ts +2 -1
- package/dist/components/ui/textarea/textarea.svelte +2 -1
- package/dist/components.css +3110 -0
- package/dist/date-input-policy.d.ts +4 -0
- package/dist/date-input-policy.js +35 -0
- package/dist/design-contract.d.ts +13 -0
- package/dist/design-contract.js +11 -0
- package/dist/design-system-components.d.ts +100 -0
- package/dist/design-system-components.js +101 -0
- package/dist/design-system.d.ts +15 -0
- package/dist/design-system.js +7 -0
- package/dist/devtools-bridge.d.ts +80 -0
- package/dist/devtools-bridge.js +92 -0
- package/dist/index.d.ts +50 -1
- package/dist/index.js +32 -2
- package/dist/page-chrome.css +12 -49
- package/dist/recipes.d.ts +960 -0
- package/dist/recipes.js +264 -0
- package/dist/rendering/index.d.ts +87 -0
- package/dist/rendering/index.js +117 -0
- package/dist/styles/aliases.css +49 -0
- package/dist/styles/compatibility.epilogue.css +384 -0
- package/dist/styles/compatibility.prelude.css +5513 -0
- package/dist/styles/conditional-states.css +28 -0
- package/dist/styles/conditional-utilities.css +22 -0
- package/dist/tree-table-model.d.ts +24 -0
- package/dist/tree-table-model.js +111 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +40 -10
- package/styles-compatibility.json +12 -0
package/dist/recipes.js
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
function resolveSlots(slots) {
|
|
3
|
+
// tv 的 synthetic base 不是组件 anatomy;公开 API 仅返回实际 slot 字符串。
|
|
4
|
+
return Object.fromEntries(Object.entries(slots).filter(([key]) => key !== "base")
|
|
5
|
+
.map(([key, value]) => [key, value()]));
|
|
6
|
+
}
|
|
7
|
+
const semantic = {
|
|
8
|
+
page: "mx-auto w-full",
|
|
9
|
+
muted: "text-muted-foreground",
|
|
10
|
+
body: "text-foreground text-sm leading-6",
|
|
11
|
+
group: "flex min-w-0 flex-wrap items-center gap-2",
|
|
12
|
+
};
|
|
13
|
+
const buttonRecipeStyles = tv({
|
|
14
|
+
base: "svadmin-button",
|
|
15
|
+
variants: {
|
|
16
|
+
variant: {
|
|
17
|
+
default: "svadmin-button--default",
|
|
18
|
+
outline: "svadmin-button--outline",
|
|
19
|
+
secondary: "svadmin-button--secondary",
|
|
20
|
+
ghost: "svadmin-button--ghost",
|
|
21
|
+
destructive: "svadmin-button--destructive",
|
|
22
|
+
link: "svadmin-button--link",
|
|
23
|
+
},
|
|
24
|
+
size: {
|
|
25
|
+
default: "svadmin-button-size--default",
|
|
26
|
+
xs: "svadmin-button-size--xs",
|
|
27
|
+
sm: "svadmin-button-size--sm",
|
|
28
|
+
lg: "svadmin-button-size--lg",
|
|
29
|
+
icon: "svadmin-button-size--icon",
|
|
30
|
+
"icon-xs": "svadmin-button-size--icon-xs",
|
|
31
|
+
"icon-sm": "svadmin-button-size--icon-sm",
|
|
32
|
+
"icon-lg": "svadmin-button-size--icon-lg",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
const badgeRecipeStyles = tv({
|
|
37
|
+
base: "svadmin-badge",
|
|
38
|
+
variants: {
|
|
39
|
+
variant: {
|
|
40
|
+
default: "svadmin-badge--default",
|
|
41
|
+
secondary: "svadmin-badge--secondary",
|
|
42
|
+
destructive: "svadmin-badge--destructive",
|
|
43
|
+
subtle: "svadmin-badge--subtle",
|
|
44
|
+
"subtle-success": "svadmin-badge--subtle-success",
|
|
45
|
+
"subtle-warning": "svadmin-badge--subtle-warning",
|
|
46
|
+
"subtle-destructive": "svadmin-badge--subtle-destructive",
|
|
47
|
+
"subtle-pill": "svadmin-badge--subtle-pill",
|
|
48
|
+
outline: "svadmin-badge--outline",
|
|
49
|
+
ghost: "svadmin-badge--ghost",
|
|
50
|
+
link: "svadmin-badge--link",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
const buttonRecipeDefaults = { variant: "default", size: "default" };
|
|
55
|
+
const badgeRecipeDefaults = { variant: "default" };
|
|
56
|
+
const textareaRecipeStyles = tv({ base: "svadmin-textarea" });
|
|
57
|
+
const contentPageRecipeStyles = tv({
|
|
58
|
+
slots: { root: `${semantic.page} svadmin-content-page space-y-6` },
|
|
59
|
+
variants: {
|
|
60
|
+
width: {
|
|
61
|
+
narrow: { root: "max-w-3xl" },
|
|
62
|
+
default: { root: "max-w-[74rem]" },
|
|
63
|
+
wide: { root: "max-w-[92rem]" },
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
defaultVariants: { width: "default" },
|
|
67
|
+
});
|
|
68
|
+
const contentHeaderRecipeStyles = tv({
|
|
69
|
+
slots: {
|
|
70
|
+
root: "svadmin-content-header space-y-3",
|
|
71
|
+
breadcrumbs: `${semantic.group} text-xs text-muted-foreground`,
|
|
72
|
+
currentCrumb: "text-foreground",
|
|
73
|
+
row: "flex flex-col gap-6 sm:flex-row sm:items-start sm:justify-between",
|
|
74
|
+
heading: "min-w-0 space-y-1",
|
|
75
|
+
eyebrow: "text-xs font-medium text-muted-foreground",
|
|
76
|
+
title: "text-xl font-semibold leading-tight text-foreground",
|
|
77
|
+
description: "max-w-2xl text-sm leading-6 text-muted-foreground",
|
|
78
|
+
actions: "flex shrink-0 flex-wrap items-center gap-2",
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
const metricBlockRecipeStyles = tv({
|
|
82
|
+
slots: {
|
|
83
|
+
root: "svadmin-metric-block min-w-0 rounded-lg border border-border bg-card p-4 shadow-sm",
|
|
84
|
+
header: "flex items-start justify-between gap-3",
|
|
85
|
+
label: "text-sm text-muted-foreground",
|
|
86
|
+
icon: "text-muted-foreground",
|
|
87
|
+
skeleton: "mt-3 h-8 w-24",
|
|
88
|
+
value: "mt-2 overflow-hidden text-ellipsis whitespace-nowrap text-2xl font-semibold tabular-nums text-foreground",
|
|
89
|
+
meta: "mt-2 flex flex-wrap gap-2 text-xs",
|
|
90
|
+
trend: "font-medium tabular-nums",
|
|
91
|
+
detail: "text-muted-foreground",
|
|
92
|
+
},
|
|
93
|
+
variants: {
|
|
94
|
+
trendTone: {
|
|
95
|
+
positive: { trend: "text-success" },
|
|
96
|
+
negative: { trend: "text-destructive" },
|
|
97
|
+
warning: { trend: "text-warning-foreground" },
|
|
98
|
+
neutral: { trend: "text-muted-foreground" },
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
defaultVariants: { trendTone: "neutral" },
|
|
102
|
+
});
|
|
103
|
+
const productSectionRecipeStyles = tv({
|
|
104
|
+
slots: {
|
|
105
|
+
root: "flex flex-wrap items-start justify-between gap-3",
|
|
106
|
+
heading: "min-w-0 flex-[1_1_16rem]",
|
|
107
|
+
title: "m-0 text-base font-semibold text-foreground [overflow-wrap:anywhere]",
|
|
108
|
+
description: "mt-1 max-w-[65ch] text-[0.8125rem] leading-6 text-muted-foreground",
|
|
109
|
+
actions: "flex shrink-0 flex-wrap items-center gap-2",
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
const productToolbarRecipeStyles = tv({
|
|
113
|
+
slots: {
|
|
114
|
+
root: "flex flex-wrap items-center justify-between gap-3 border-b border-border py-3",
|
|
115
|
+
leading: "flex min-w-0 flex-[1_1_16rem] flex-wrap items-center gap-2",
|
|
116
|
+
trailing: "ms-auto flex min-w-0 flex-wrap items-center gap-2",
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
const productWorkspaceRecipeStyles = tv({
|
|
120
|
+
slots: {
|
|
121
|
+
root: "flex min-w-0 flex-col gap-6",
|
|
122
|
+
summary: "min-w-0",
|
|
123
|
+
columns: "grid min-w-0 grid-cols-1 items-start gap-8 lg:grid-cols-[minmax(0,1fr)_minmax(0,var(--workspace-secondary-width,22rem))]",
|
|
124
|
+
primary: "min-w-0 lg:order-1",
|
|
125
|
+
secondary: "flex min-w-0 flex-col gap-6 lg:order-2",
|
|
126
|
+
},
|
|
127
|
+
variants: { hasSecondary: { true: {}, false: { columns: "lg:grid-cols-1" } } },
|
|
128
|
+
defaultVariants: { hasSecondary: false },
|
|
129
|
+
});
|
|
130
|
+
const productSettingsRecipeStyles = tv({
|
|
131
|
+
slots: {
|
|
132
|
+
root: `${semantic.body} min-w-0`,
|
|
133
|
+
header: "flex flex-wrap items-start justify-between gap-3 border-b border-border py-4",
|
|
134
|
+
heading: "min-w-0 flex-[1_1_16rem]",
|
|
135
|
+
title: "m-0 text-base font-semibold text-foreground [overflow-wrap:anywhere]",
|
|
136
|
+
description: "mt-1 max-w-[65ch] text-[0.8125rem] leading-6 text-muted-foreground",
|
|
137
|
+
actions: "flex shrink-0 flex-wrap items-center gap-2",
|
|
138
|
+
body: "min-w-0 py-1",
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
const productSettingsRowRecipeStyles = tv({
|
|
142
|
+
slots: {
|
|
143
|
+
root: "grid min-w-0 grid-cols-1 items-start gap-3 py-5 md:grid-cols-2 md:gap-x-6",
|
|
144
|
+
heading: "min-w-0",
|
|
145
|
+
label: "m-0 font-medium text-foreground [overflow-wrap:anywhere]",
|
|
146
|
+
description: "mt-1 max-w-[52ch] text-[0.8125rem] leading-6 text-muted-foreground [overflow-wrap:anywhere]",
|
|
147
|
+
control: "min-w-0 max-w-full",
|
|
148
|
+
},
|
|
149
|
+
variants: { separated: { true: { root: "border-t border-border" }, false: {} } },
|
|
150
|
+
defaultVariants: { separated: false },
|
|
151
|
+
});
|
|
152
|
+
const productStatusRecipeStyles = tv({
|
|
153
|
+
slots: { root: "svadmin-product-status" },
|
|
154
|
+
variants: {
|
|
155
|
+
status: {
|
|
156
|
+
success: { root: "[--svadmin-status-color:var(--success)]" },
|
|
157
|
+
warning: { root: "[--svadmin-status-color:var(--warning)]" },
|
|
158
|
+
danger: { root: "[--svadmin-status-color:var(--destructive)]" },
|
|
159
|
+
info: { root: "[--svadmin-status-color:var(--info)]" },
|
|
160
|
+
neutral: { root: "[--svadmin-status-color:var(--muted-foreground)]" },
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
defaultVariants: { status: "neutral" },
|
|
164
|
+
});
|
|
165
|
+
const surfaceMetricRecipeStyles = tv({
|
|
166
|
+
slots: {
|
|
167
|
+
root: "surface-metric__root min-w-0",
|
|
168
|
+
card: "surface-metric__card border-s-[3px] border-solid",
|
|
169
|
+
description: "surface-metric__description text-muted-foreground",
|
|
170
|
+
state: "surface-metric__state [--svadmin-metric-state-border-width:3px]",
|
|
171
|
+
},
|
|
172
|
+
variants: {
|
|
173
|
+
tone: {
|
|
174
|
+
neutral: { card: "border-s-border", state: "[--svadmin-metric-state-accent:var(--border)]" },
|
|
175
|
+
success: { card: "border-s-success", state: "[--svadmin-metric-state-accent:var(--success)]" },
|
|
176
|
+
warning: { card: "border-s-warning", state: "[--svadmin-metric-state-accent:var(--warning)]" },
|
|
177
|
+
danger: { card: "border-s-destructive", state: "[--svadmin-metric-state-accent:var(--destructive)]" },
|
|
178
|
+
info: { card: "border-s-info", state: "[--svadmin-metric-state-accent:var(--info)]" },
|
|
179
|
+
},
|
|
180
|
+
density: {
|
|
181
|
+
compact: { card: "p-3", state: "[--svadmin-metric-state-padding:0.75rem] [--svadmin-metric-state-height:4.5rem]" },
|
|
182
|
+
comfortable: { card: "p-5", state: "[--svadmin-metric-state-padding:1.25rem] [--svadmin-metric-state-height:6rem]" },
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
defaultVariants: { tone: "neutral", density: "comfortable" },
|
|
186
|
+
});
|
|
187
|
+
const surfaceTableRecipeStyles = tv({
|
|
188
|
+
slots: {
|
|
189
|
+
root: "surface-table__root min-w-0",
|
|
190
|
+
header: "surface-table__header",
|
|
191
|
+
content: "surface-table__content",
|
|
192
|
+
head: "surface-table__head",
|
|
193
|
+
cell: "surface-table__cell",
|
|
194
|
+
state: "surface-table__state text-muted-foreground",
|
|
195
|
+
},
|
|
196
|
+
variants: {
|
|
197
|
+
density: {
|
|
198
|
+
compact: { header: "px-3", content: "px-3", head: "[&[data-slot=table-head]]:py-1 [&[data-slot=table-head]]:text-xs", cell: "[&[data-slot=table-cell]]:py-1 [&[data-slot=table-cell]]:text-xs", state: "[--svadmin-table-state-height:6rem]" },
|
|
199
|
+
comfortable: { header: "px-4", content: "px-4", head: "[&[data-slot=table-head]]:py-2 [&[data-slot=table-head]]:text-sm", cell: "[&[data-slot=table-cell]]:py-2 [&[data-slot=table-cell]]:text-sm", state: "[--svadmin-table-state-height:8rem]" },
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
defaultVariants: { density: "comfortable" },
|
|
203
|
+
});
|
|
204
|
+
// undefined 使用公开默认值;null 显式禁用该变体,不能交给 tv 再补默认值。
|
|
205
|
+
export const buttonRecipe = ({ variant = buttonRecipeDefaults.variant, size = buttonRecipeDefaults.size, ...props } = {}) => ({
|
|
206
|
+
root: buttonRecipeStyles({
|
|
207
|
+
...props,
|
|
208
|
+
...(variant === null ? {} : { variant }),
|
|
209
|
+
...(size === null ? {} : { size }),
|
|
210
|
+
}),
|
|
211
|
+
});
|
|
212
|
+
export const badgeRecipe = ({ variant = badgeRecipeDefaults.variant, ...props } = {}) => ({
|
|
213
|
+
root: badgeRecipeStyles({ ...props, ...(variant === null ? {} : { variant }) }),
|
|
214
|
+
});
|
|
215
|
+
export const textareaRecipe = (props = {}) => ({ root: textareaRecipeStyles(props) });
|
|
216
|
+
export const contentPageRecipe = (props = {}) => resolveSlots(contentPageRecipeStyles(props));
|
|
217
|
+
export const contentHeaderRecipe = (props = {}) => resolveSlots(contentHeaderRecipeStyles(props));
|
|
218
|
+
export const metricBlockRecipe = (props = {}) => resolveSlots(metricBlockRecipeStyles(props));
|
|
219
|
+
export const productSectionRecipe = (props = {}) => resolveSlots(productSectionRecipeStyles(props));
|
|
220
|
+
export const productToolbarRecipe = (props = {}) => resolveSlots(productToolbarRecipeStyles(props));
|
|
221
|
+
export const productWorkspaceRecipe = (props = {}) => resolveSlots(productWorkspaceRecipeStyles(props));
|
|
222
|
+
export const productSettingsRecipe = (props = {}) => resolveSlots(productSettingsRecipeStyles(props));
|
|
223
|
+
export const productSettingsRowRecipe = (props = {}) => resolveSlots(productSettingsRowRecipeStyles(props));
|
|
224
|
+
export const productStatusRecipe = (props = {}) => resolveSlots(productStatusRecipeStyles(props));
|
|
225
|
+
export const surfaceMetricRecipe = (props = {}) => resolveSlots(surfaceMetricRecipeStyles(props));
|
|
226
|
+
export const surfaceTableRecipe = (props = {}) => resolveSlots(surfaceTableRecipeStyles(props));
|
|
227
|
+
export const allRecipes = {
|
|
228
|
+
buttonRecipe,
|
|
229
|
+
badgeRecipe,
|
|
230
|
+
textareaRecipe,
|
|
231
|
+
contentPageRecipe,
|
|
232
|
+
contentHeaderRecipe,
|
|
233
|
+
metricBlockRecipe,
|
|
234
|
+
productSectionRecipe,
|
|
235
|
+
productToolbarRecipe,
|
|
236
|
+
productWorkspaceRecipe,
|
|
237
|
+
productSettingsRecipe,
|
|
238
|
+
productSettingsRowRecipe,
|
|
239
|
+
productStatusRecipe,
|
|
240
|
+
surfaceMetricRecipe,
|
|
241
|
+
surfaceTableRecipe,
|
|
242
|
+
};
|
|
243
|
+
// 元数据从相同的 variant 定义派生,避免提示词中的枚举与实际实现分叉。
|
|
244
|
+
const recipeStyles = {
|
|
245
|
+
buttonRecipe: buttonRecipeStyles, badgeRecipe: badgeRecipeStyles, textareaRecipe: textareaRecipeStyles,
|
|
246
|
+
contentPageRecipe: contentPageRecipeStyles, contentHeaderRecipe: contentHeaderRecipeStyles,
|
|
247
|
+
metricBlockRecipe: metricBlockRecipeStyles, productSectionRecipe: productSectionRecipeStyles,
|
|
248
|
+
productToolbarRecipe: productToolbarRecipeStyles, productWorkspaceRecipe: productWorkspaceRecipeStyles,
|
|
249
|
+
productSettingsRecipe: productSettingsRecipeStyles, productSettingsRowRecipe: productSettingsRowRecipeStyles,
|
|
250
|
+
productStatusRecipe: productStatusRecipeStyles, surfaceMetricRecipe: surfaceMetricRecipeStyles,
|
|
251
|
+
surfaceTableRecipe: surfaceTableRecipeStyles,
|
|
252
|
+
};
|
|
253
|
+
export function describeRecipe(name) {
|
|
254
|
+
const styles = recipeStyles[name];
|
|
255
|
+
const slots = Object.keys(styles.slots ?? {}).filter(slot => slot !== "base");
|
|
256
|
+
return {
|
|
257
|
+
slots: slots.length > 0 ? slots : ["root"],
|
|
258
|
+
variants: Object.fromEntries(Object.entries(styles.variants ?? {}).map(([key, values]) => [key, Object.keys(values)])),
|
|
259
|
+
defaults: {
|
|
260
|
+
...(name === "buttonRecipe" ? buttonRecipeDefaults
|
|
261
|
+
: name === "badgeRecipe" ? badgeRecipeDefaults : styles.defaultVariants),
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Component, Snippet } from 'svelte';
|
|
2
|
+
import type { BaseRecord, FieldDefinition } from '@svadmin/core';
|
|
3
|
+
import { type ContractFormAction, type ContractFormDraft, type ContractFormValues, type ContractId, type ContractRecord, type ContractSchemas, type ResourceContract } from '@svadmin/core/resource-contract';
|
|
4
|
+
export type RecordField<S extends ContractSchemas> = Extract<keyof ContractRecord<S>, string>;
|
|
5
|
+
export type FormField<S extends ContractSchemas, A extends ContractFormAction> = Extract<keyof ContractFormValues<S, A>, string>;
|
|
6
|
+
/** 与 AutoTable 的现有 snippet 参数兼容;未经校验的数据保持 unknown。 */
|
|
7
|
+
export interface CellInput {
|
|
8
|
+
value: unknown;
|
|
9
|
+
record: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
export interface FieldInput {
|
|
12
|
+
field: FieldDefinition;
|
|
13
|
+
value: unknown;
|
|
14
|
+
onchange: (value: unknown) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface CellContext<S extends ContractSchemas, K extends RecordField<S>> {
|
|
17
|
+
key: K;
|
|
18
|
+
record: ContractRecord<S>;
|
|
19
|
+
value: ContractRecord<S>[K];
|
|
20
|
+
}
|
|
21
|
+
export type FieldState<T> = {
|
|
22
|
+
valid: true;
|
|
23
|
+
value: T;
|
|
24
|
+
} | {
|
|
25
|
+
valid: false;
|
|
26
|
+
};
|
|
27
|
+
export interface FieldContext<S extends ContractSchemas, A extends ContractFormAction, K extends FormField<S, A>> {
|
|
28
|
+
field: FieldDefinition & {
|
|
29
|
+
key: K;
|
|
30
|
+
};
|
|
31
|
+
state: FieldState<ContractFormValues<S, A>[K]>;
|
|
32
|
+
readonly: boolean;
|
|
33
|
+
/** 只接收符合当前操作契约的值,运行时也会重新校验。 */
|
|
34
|
+
onchange: (value: ContractFormValues<S, A>[K]) => void;
|
|
35
|
+
/** 草稿可以暂时不满足业务约束,但必须是可快照的普通数据。 */
|
|
36
|
+
onDraftChange: (value: unknown) => void;
|
|
37
|
+
}
|
|
38
|
+
export type CellSnippets<S extends ContractSchemas> = Partial<Record<RecordField<S>, Snippet<[CellInput]>>>;
|
|
39
|
+
export interface RowContext<S extends ContractSchemas> {
|
|
40
|
+
record: ContractRecord<S>;
|
|
41
|
+
id: ContractId<S>;
|
|
42
|
+
}
|
|
43
|
+
/** 动态路由只擦除资源类型,不把未知记录或草稿假定为业务类型。 */
|
|
44
|
+
export interface ResourceRendering {
|
|
45
|
+
readonly resource: ResourceContract;
|
|
46
|
+
record(value: unknown): BaseRecord;
|
|
47
|
+
records(value: unknown): BaseRecord[];
|
|
48
|
+
draft(action: ContractFormAction, value: unknown): Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
/** 同名但不同实例的契约也不可混用;宿主配置必须绑定实际查询契约。 */
|
|
51
|
+
export declare function bindResourceRendering(rendering: ResourceRendering | undefined, resource: ResourceContract): ResourceRendering | undefined;
|
|
52
|
+
/** 业务记录/草稿边界;无需自定义 snippet 时,不把完整渲染工具链加入首屏。 */
|
|
53
|
+
export declare function createResourceRendering<S extends ContractSchemas>(resource: ResourceContract<S>): Readonly<{
|
|
54
|
+
resource: ResourceContract<S>;
|
|
55
|
+
record: (value: unknown) => ContractRecord<S>;
|
|
56
|
+
records: (value: unknown) => ContractRecord<S>[];
|
|
57
|
+
draft: <A extends ContractFormAction>(action: A, value: unknown) => ContractFormDraft<S, A>;
|
|
58
|
+
}>;
|
|
59
|
+
/** 原生 Svelte 渲染适配器:不执行生成代码,不发请求,也不改变组件生命周期。 */
|
|
60
|
+
export declare function createResourceRenderers<S extends ContractSchemas>(resource: ResourceContract<S>): Readonly<{
|
|
61
|
+
resource: ResourceContract<S>;
|
|
62
|
+
record: (value: unknown) => ContractRecord<S>;
|
|
63
|
+
records: (value: unknown) => ContractRecord<S>[];
|
|
64
|
+
draft: <A extends ContractFormAction>(action: A, value: unknown) => Partial<Record<Extract<keyof ContractFormValues<S, A>, string>, unknown>>;
|
|
65
|
+
cell: <K extends RecordField<S>>(key: K, input: CellInput) => CellContext<S, K>;
|
|
66
|
+
row: (input: {
|
|
67
|
+
record: Record<string, unknown>;
|
|
68
|
+
id: string | number;
|
|
69
|
+
}) => RowContext<S>;
|
|
70
|
+
summary: (input: {
|
|
71
|
+
data: readonly unknown[];
|
|
72
|
+
total: number;
|
|
73
|
+
visibleColumnsCount: number;
|
|
74
|
+
}) => {
|
|
75
|
+
data: ContractRecord<S>[];
|
|
76
|
+
total: number;
|
|
77
|
+
visibleColumnsCount: number;
|
|
78
|
+
};
|
|
79
|
+
columns: <const C extends CellSnippets<S>>(snippets: C & Record<Exclude<keyof C, RecordField<S>>, never>) => C;
|
|
80
|
+
field: <A extends ContractFormAction, K extends FormField<S, A>>(action: A, key: K, input: FieldInput) => FieldContext<S, A, K>;
|
|
81
|
+
}>;
|
|
82
|
+
/** 在普通 .ts 配置中保留组件与属性的类型关联;使用原生 <view.component {...view.props} />。 */
|
|
83
|
+
export interface ComponentView<P extends Record<string, unknown>> {
|
|
84
|
+
component: Component<P>;
|
|
85
|
+
props: P;
|
|
86
|
+
}
|
|
87
|
+
export declare function componentView<P extends Record<string, unknown>>(component: Component<P>, props: NoInfer<P>): ComponentView<P>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { snapshotPlainData } from '@svadmin/core/schema';
|
|
2
|
+
import { contractFormInvalidFields, contractKey, getContractFormFields, parseContractId, parseContractRecord, snapshotContractFormDraft, } from '@svadmin/core/resource-contract';
|
|
3
|
+
/** 同名但不同实例的契约也不可混用;宿主配置必须绑定实际查询契约。 */
|
|
4
|
+
export function bindResourceRendering(rendering, resource) {
|
|
5
|
+
if (rendering && rendering.resource !== resource) {
|
|
6
|
+
throw new TypeError('Renderer resource contract mismatch');
|
|
7
|
+
}
|
|
8
|
+
return rendering;
|
|
9
|
+
}
|
|
10
|
+
function assertAction(action) {
|
|
11
|
+
if (!['create', 'edit', 'clone', 'show'].includes(action)) {
|
|
12
|
+
throw new TypeError('Invalid renderer form action');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function fieldState(resource, action, key, value) {
|
|
16
|
+
try {
|
|
17
|
+
const draft = snapshotContractFormDraft(resource, action, { [key]: value });
|
|
18
|
+
const invalid = contractFormInvalidFields(resource, action, draft);
|
|
19
|
+
if (invalid.includes(key) || invalid.includes('_root'))
|
|
20
|
+
return { valid: false };
|
|
21
|
+
return { valid: true, value: Object.hasOwn(draft, key) ? draft[key] : undefined };
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return { valid: false };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** 业务记录/草稿边界;无需自定义 snippet 时,不把完整渲染工具链加入首屏。 */
|
|
28
|
+
export function createResourceRendering(resource) {
|
|
29
|
+
contractKey(resource);
|
|
30
|
+
function record(value) {
|
|
31
|
+
return parseContractRecord(resource, value);
|
|
32
|
+
}
|
|
33
|
+
function records(value) {
|
|
34
|
+
const snapshot = snapshotPlainData(value);
|
|
35
|
+
if (!Array.isArray(snapshot))
|
|
36
|
+
throw new TypeError('Renderer records must be an array');
|
|
37
|
+
return snapshot.map(record);
|
|
38
|
+
}
|
|
39
|
+
function draft(action, value) {
|
|
40
|
+
assertAction(action);
|
|
41
|
+
return snapshotContractFormDraft(resource, action, value);
|
|
42
|
+
}
|
|
43
|
+
return Object.freeze({ resource, record, records, draft });
|
|
44
|
+
}
|
|
45
|
+
/** 原生 Svelte 渲染适配器:不执行生成代码,不发请求,也不改变组件生命周期。 */
|
|
46
|
+
export function createResourceRenderers(resource) {
|
|
47
|
+
const boundary = createResourceRendering(resource);
|
|
48
|
+
const { record, records, draft } = boundary;
|
|
49
|
+
const recordFields = new Set(getContractFormFields(resource, 'show'));
|
|
50
|
+
function cell(key, input) {
|
|
51
|
+
if (!recordFields.has(key))
|
|
52
|
+
throw new TypeError('Unknown renderer record field');
|
|
53
|
+
const checked = record(input.record);
|
|
54
|
+
// value 从已校验记录读取,不相信调用方传入的脱离记录的 value。
|
|
55
|
+
return { key, record: checked, value: checked[key] };
|
|
56
|
+
}
|
|
57
|
+
function row(input) {
|
|
58
|
+
const checked = record(input.record);
|
|
59
|
+
const id = parseContractId(resource, input.id);
|
|
60
|
+
if (!Object.is(id, checked['id']))
|
|
61
|
+
throw new TypeError('Renderer row identity mismatch');
|
|
62
|
+
return { record: checked, id };
|
|
63
|
+
}
|
|
64
|
+
function summary(input) {
|
|
65
|
+
if (!Array.isArray(input.data) || !Number.isSafeInteger(input.total) || input.total < 0
|
|
66
|
+
|| !Number.isSafeInteger(input.visibleColumnsCount) || input.visibleColumnsCount < 0) {
|
|
67
|
+
throw new TypeError('Invalid renderer summary');
|
|
68
|
+
}
|
|
69
|
+
return { data: input.data.map(record), total: input.total, visibleColumnsCount: input.visibleColumnsCount };
|
|
70
|
+
}
|
|
71
|
+
function columns(snippets) {
|
|
72
|
+
if (!snippets || ![Object.prototype, null].includes(Object.getPrototypeOf(snippets))
|
|
73
|
+
|| Object.getOwnPropertySymbols(snippets).length) {
|
|
74
|
+
throw new TypeError('Invalid renderer column map');
|
|
75
|
+
}
|
|
76
|
+
for (const [key, property] of Object.entries(Object.getOwnPropertyDescriptors(snippets))) {
|
|
77
|
+
if (!recordFields.has(key) || !property.enumerable || !('value' in property)
|
|
78
|
+
|| typeof property.value !== 'function')
|
|
79
|
+
throw new TypeError('Invalid renderer column');
|
|
80
|
+
}
|
|
81
|
+
// 不冻结调用方对象,也不保留可被后来添加属性的原始映射。
|
|
82
|
+
return { ...snippets };
|
|
83
|
+
}
|
|
84
|
+
function field(action, key, input) {
|
|
85
|
+
assertAction(action);
|
|
86
|
+
if (!getContractFormFields(resource, action).includes(key) || input.field.key !== key) {
|
|
87
|
+
throw new TypeError('Renderer form field mismatch');
|
|
88
|
+
}
|
|
89
|
+
const change = input.onchange;
|
|
90
|
+
const readonly = action === 'show';
|
|
91
|
+
function assertWritable() {
|
|
92
|
+
if (readonly)
|
|
93
|
+
throw new TypeError('Cannot update a read-only renderer');
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
field: { ...input.field, key },
|
|
97
|
+
state: fieldState(resource, action, key, input.value),
|
|
98
|
+
readonly,
|
|
99
|
+
onchange(value) {
|
|
100
|
+
assertWritable();
|
|
101
|
+
const checked = fieldState(resource, action, key, value);
|
|
102
|
+
if (!checked.valid)
|
|
103
|
+
throw new TypeError('Invalid renderer field value');
|
|
104
|
+
change(checked.value);
|
|
105
|
+
},
|
|
106
|
+
onDraftChange(value) {
|
|
107
|
+
assertWritable();
|
|
108
|
+
const draft = snapshotContractFormDraft(resource, action, { [key]: value });
|
|
109
|
+
change(Object.hasOwn(draft, key) ? draft[key] : undefined);
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return Object.freeze({ resource, record, records, draft, cell, row, summary, columns, field });
|
|
114
|
+
}
|
|
115
|
+
export function componentView(component, props) {
|
|
116
|
+
return { component, props };
|
|
117
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
:root,
|
|
2
|
+
.svadmin-theme{
|
|
3
|
+
--color-background: var(--background);
|
|
4
|
+
--color-foreground: var(--foreground);
|
|
5
|
+
--color-card: var(--card);
|
|
6
|
+
--color-card-foreground: var(--card-foreground);
|
|
7
|
+
--color-popover: var(--popover);
|
|
8
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
9
|
+
--color-primary: var(--primary);
|
|
10
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
11
|
+
--color-secondary: var(--secondary);
|
|
12
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
13
|
+
--color-muted: var(--muted);
|
|
14
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
15
|
+
--color-accent: var(--accent);
|
|
16
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
17
|
+
--color-destructive: var(--destructive);
|
|
18
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
19
|
+
--color-border: var(--border);
|
|
20
|
+
--color-input: var(--input);
|
|
21
|
+
--color-ring: var(--ring);
|
|
22
|
+
--color-chart-1: var(--chart-1);
|
|
23
|
+
--color-chart-2: var(--chart-2);
|
|
24
|
+
--color-chart-3: var(--chart-3);
|
|
25
|
+
--color-chart-4: var(--chart-4);
|
|
26
|
+
--color-chart-5: var(--chart-5);
|
|
27
|
+
--color-sidebar: var(--sidebar);
|
|
28
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
29
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
30
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
31
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
32
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
33
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
34
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
35
|
+
--color-success: var(--success);
|
|
36
|
+
--color-success-foreground: var(--success-foreground);
|
|
37
|
+
--color-warning: var(--warning);
|
|
38
|
+
--color-warning-foreground: var(--warning-foreground);
|
|
39
|
+
--color-info: var(--info);
|
|
40
|
+
--color-info-foreground: var(--info-foreground);
|
|
41
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
42
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
43
|
+
--radius-lg: var(--radius);
|
|
44
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
45
|
+
--shadow-control: var(--svadmin-shadow-control);
|
|
46
|
+
--shadow-surface: var(--svadmin-shadow-surface);
|
|
47
|
+
--shadow-surface-hover: var(--svadmin-shadow-surface-hover);
|
|
48
|
+
--shadow-overlay: var(--svadmin-shadow-overlay);
|
|
49
|
+
}
|