@svadmin/ui 0.73.0 → 0.75.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 +53 -28
- package/dist/app.css +3733 -4119
- package/dist/app.theme.css +3733 -4119
- 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 +24 -15
- 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 +33 -3
- package/dist/components/AutoForm.svelte.d.ts +1 -0
- package/dist/components/AutoTable.svelte +610 -47
- package/dist/components/AutoTable.svelte.d.ts +17 -1
- package/dist/components/BoundRecordDetailDrawer.svelte +9 -0
- package/dist/components/BoundRecordDetailDrawer.svelte.d.ts +2 -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 +114 -27
- package/dist/components/ComboboxField.svelte.d.ts +1 -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 +85 -5
- package/dist/components/DateRangeInput.svelte.d.ts +10 -0
- package/dist/components/DateRangePicker.svelte +10 -0
- package/dist/components/DateRangePicker.svelte.d.ts +6 -0
- package/dist/components/DateTimeInput.svelte +85 -16
- package/dist/components/DateTimeInput.svelte.d.ts +19 -11
- package/dist/components/DateTimePicker.svelte +10 -0
- package/dist/components/DateTimePicker.svelte.d.ts +6 -0
- package/dist/components/DevTools.svelte +34 -26
- package/dist/components/DevframePanel.svelte +123 -0
- package/dist/components/DevframePanel.svelte.d.ts +3 -0
- package/dist/components/ErrorSummary.svelte +52 -0
- package/dist/components/ErrorSummary.svelte.d.ts +14 -0
- package/dist/components/FieldRenderer.svelte +82 -81
- package/dist/components/FileUpload.svelte +214 -52
- package/dist/components/FileUpload.svelte.d.ts +11 -0
- package/dist/components/FilterBuilder.svelte +88 -66
- 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 +339 -17
- package/dist/components/ImportWizard.svelte.d.ts +11 -0
- package/dist/components/JsonSchemaForm.svelte +120 -52
- package/dist/components/JsonSchemaForm.svelte.d.ts +7 -1
- package/dist/components/KanbanBoard.svelte +195 -40
- package/dist/components/KanbanBoard.svelte.d.ts +9 -2
- package/dist/components/Layout.svelte +4 -2
- 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/LazyPage.svelte +3 -3
- package/dist/components/LazyPage.svelte.d.ts +2 -2
- 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/ListPage.svelte +5 -1
- package/dist/components/ListPage.svelte.d.ts +3 -0
- package/dist/components/LoginPage.svelte +1 -1
- 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/PasswordInput.svelte +3 -3
- package/dist/components/PasswordInput.svelte.d.ts +2 -1
- 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/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 +4 -2
- package/dist/components/RecordDetailDrawer.svelte.d.ts +2 -0
- package/dist/components/RelationPicker.svelte +341 -0
- package/dist/components/RelationPicker.svelte.d.ts +26 -0
- package/dist/components/ResourceOperationsPage.svelte +23 -19
- package/dist/components/ResourceOperationsPage.svelte.d.ts +2 -2
- 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/ShowPage.svelte +18 -3
- package/dist/components/ShowPage.svelte.d.ts +3 -0
- package/dist/components/Sidebar.svelte +2 -2
- package/dist/components/Slider.svelte +100 -0
- package/dist/components/Slider.svelte.d.ts +19 -0
- package/dist/components/SpreadsheetView.svelte +1213 -95
- package/dist/components/SpreadsheetView.svelte.d.ts +19 -0
- package/dist/components/TagsInput.svelte +178 -0
- package/dist/components/TagsInput.svelte.d.ts +17 -0
- package/dist/components/TimePicker.svelte +10 -0
- package/dist/components/TimePicker.svelte.d.ts +6 -0
- package/dist/components/TooltipButton.svelte +3 -4
- package/dist/components/TreeSelect.svelte +267 -53
- package/dist/components/TreeSelect.svelte.d.ts +3 -0
- 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/buttons/ExportButton.svelte +56 -12
- package/dist/components/buttons/ExportButton.svelte.d.ts +11 -0
- package/dist/components/content/ContentPageHeader.svelte +1 -1
- package/dist/components/content/ContentPageShell.svelte +1 -1
- package/dist/components/content/MetricBlock.svelte +1 -1
- package/dist/components/content/PageToolbar.svelte +1 -1
- package/dist/components/content/ReferenceNotice.svelte +5 -0
- package/dist/components/content/ReferenceNotice.svelte.d.ts +18 -0
- package/dist/components/content/SectionHeader.svelte +1 -1
- package/dist/components/content/SettingsFieldRow.svelte +1 -1
- package/dist/components/content/SettingsGroup.svelte +1 -1
- package/dist/components/content/StatusBadge.svelte +1 -1
- package/dist/components/content/WorkspaceLayout.svelte +1 -1
- package/dist/components/export-reference.d.ts +2 -0
- package/dist/components/export-reference.js +9 -0
- package/dist/components/fieldComponentMap.js +2 -5
- package/dist/components/fields/DateField.svelte +12 -13
- package/dist/components/fields/MarkdownField.svelte +14 -5
- package/dist/components/fields/date-display.d.ts +6 -0
- package/dist/components/fields/date-display.js +24 -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/saved-list-views.d.ts +74 -1
- package/dist/components/saved-list-views.js +191 -3
- 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 -3
- 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 -5
- package/dist/components/ui/checkbox/checkbox.svelte +5 -1
- package/dist/components/ui/checkbox/checkbox.svelte.d.ts +5 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-trigger.svelte +1 -2
- package/dist/components/ui/input/input.svelte +7 -2
- 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 -2
- package/dist/components.css +33 -2
- package/dist/date-input-policy.d.ts +4 -0
- package/dist/date-input-policy.js +35 -0
- package/dist/design-system-components.d.ts +100 -0
- package/dist/design-system-components.js +101 -0
- package/dist/design-system.js +1 -1
- package/dist/devtools-bridge.d.ts +80 -0
- package/dist/devtools-bridge.js +92 -0
- package/dist/editor-config.svelte.d.ts +4 -2
- package/dist/index.d.ts +37 -2
- package/dist/index.js +23 -2
- package/dist/recipes.d.ts +960 -4
- package/dist/recipes.js +264 -4
- package/dist/tree-table-model.d.ts +24 -0
- package/dist/tree-table-model.js +111 -0
- package/dist/types.d.ts +4 -4
- package/package.json +22 -10
- package/dist/styled-system/css/conditions.js +0 -36
- package/dist/styled-system/css/css.d.ts +0 -22
- package/dist/styled-system/css/css.js +0 -45
- package/dist/styled-system/css/cva.d.ts +0 -6
- package/dist/styled-system/css/cva.js +0 -87
- package/dist/styled-system/css/cx.d.ts +0 -5
- package/dist/styled-system/css/cx.js +0 -15
- package/dist/styled-system/css/index.d.ts +0 -5
- package/dist/styled-system/css/index.js +0 -4
- package/dist/styled-system/css/sva.d.ts +0 -4
- package/dist/styled-system/css/sva.js +0 -46
- package/dist/styled-system/helpers.js +0 -316
- package/dist/styled-system/patterns/aspect-ratio.d.ts +0 -20
- package/dist/styled-system/patterns/aspect-ratio.js +0 -38
- package/dist/styled-system/patterns/bleed.d.ts +0 -21
- package/dist/styled-system/patterns/bleed.js +0 -24
- package/dist/styled-system/patterns/box.d.ts +0 -20
- package/dist/styled-system/patterns/box.js +0 -15
- package/dist/styled-system/patterns/center.d.ts +0 -20
- package/dist/styled-system/patterns/center.js +0 -21
- package/dist/styled-system/patterns/circle.d.ts +0 -20
- package/dist/styled-system/patterns/circle.js +0 -25
- package/dist/styled-system/patterns/container.d.ts +0 -20
- package/dist/styled-system/patterns/container.js +0 -21
- package/dist/styled-system/patterns/cq.d.ts +0 -21
- package/dist/styled-system/patterns/cq.js +0 -21
- package/dist/styled-system/patterns/divider.d.ts +0 -22
- package/dist/styled-system/patterns/divider.js +0 -25
- package/dist/styled-system/patterns/flex.d.ts +0 -26
- package/dist/styled-system/patterns/flex.js +0 -26
- package/dist/styled-system/patterns/float.d.ts +0 -23
- package/dist/styled-system/patterns/float.js +0 -52
- package/dist/styled-system/patterns/grid-item.d.ts +0 -25
- package/dist/styled-system/patterns/grid-item.js +0 -25
- package/dist/styled-system/patterns/grid.d.ts +0 -24
- package/dist/styled-system/patterns/grid.js +0 -27
- package/dist/styled-system/patterns/hstack.d.ts +0 -21
- package/dist/styled-system/patterns/hstack.js +0 -24
- package/dist/styled-system/patterns/index.d.ts +0 -21
- package/dist/styled-system/patterns/index.js +0 -20
- package/dist/styled-system/patterns/link-overlay.d.ts +0 -20
- package/dist/styled-system/patterns/link-overlay.js +0 -24
- package/dist/styled-system/patterns/spacer.d.ts +0 -20
- package/dist/styled-system/patterns/spacer.js +0 -25
- package/dist/styled-system/patterns/square.d.ts +0 -20
- package/dist/styled-system/patterns/square.js +0 -24
- package/dist/styled-system/patterns/stack.d.ts +0 -23
- package/dist/styled-system/patterns/stack.js +0 -24
- package/dist/styled-system/patterns/visually-hidden.d.ts +0 -20
- package/dist/styled-system/patterns/visually-hidden.js +0 -18
- package/dist/styled-system/patterns/vstack.d.ts +0 -21
- package/dist/styled-system/patterns/vstack.js +0 -24
- package/dist/styled-system/patterns/wrap.d.ts +0 -24
- package/dist/styled-system/patterns/wrap.js +0 -25
- package/dist/styled-system/recipes/content-header.d.ts +0 -31
- package/dist/styled-system/recipes/content-header.js +0 -65
- package/dist/styled-system/recipes/content-page.d.ts +0 -34
- package/dist/styled-system/recipes/content-page.js +0 -43
- package/dist/styled-system/recipes/create-recipe.js +0 -82
- package/dist/styled-system/recipes/index.d.ts +0 -17
- package/dist/styled-system/recipes/index.js +0 -16
- package/dist/styled-system/recipes/metric-block.d.ts +0 -34
- package/dist/styled-system/recipes/metric-block.js +0 -76
- package/dist/styled-system/recipes/product-list.d.ts +0 -31
- package/dist/styled-system/recipes/product-list.js +0 -73
- package/dist/styled-system/recipes/product-section.d.ts +0 -31
- package/dist/styled-system/recipes/product-section.js +0 -49
- package/dist/styled-system/recipes/product-settings-row.d.ts +0 -34
- package/dist/styled-system/recipes/product-settings-row.js +0 -58
- package/dist/styled-system/recipes/product-settings.d.ts +0 -31
- package/dist/styled-system/recipes/product-settings.js +0 -57
- package/dist/styled-system/recipes/product-status.d.ts +0 -34
- package/dist/styled-system/recipes/product-status.js +0 -45
- package/dist/styled-system/recipes/product-toolbar.d.ts +0 -31
- package/dist/styled-system/recipes/product-toolbar.js +0 -41
- package/dist/styled-system/recipes/product-workspace.d.ts +0 -34
- package/dist/styled-system/recipes/product-workspace.js +0 -58
- package/dist/styled-system/recipes/surface-metric.d.ts +0 -38
- package/dist/styled-system/recipes/surface-metric.js +0 -63
- package/dist/styled-system/recipes/surface-table.d.ts +0 -34
- package/dist/styled-system/recipes/surface-table.js +0 -62
- package/dist/styled-system/recipes/ui-badge.d.ts +0 -31
- package/dist/styled-system/recipes/ui-badge.js +0 -38
- package/dist/styled-system/recipes/ui-button.d.ts +0 -32
- package/dist/styled-system/recipes/ui-button.js +0 -43
- package/dist/styled-system/recipes/ui-input.d.ts +0 -31
- package/dist/styled-system/recipes/ui-input.js +0 -49
- package/dist/styled-system/recipes/ui-textarea.d.ts +0 -31
- package/dist/styled-system/recipes/ui-textarea.js +0 -24
- package/dist/styled-system/styles.css +0 -1257
- package/dist/styled-system/tokens/index.d.ts +0 -9
- package/dist/styled-system/tokens/index.js +0 -268
- package/dist/styled-system/tokens/tokens.d.ts +0 -36
- package/dist/styled-system/types/composition.d.ts +0 -227
- package/dist/styled-system/types/conditions.d.ts +0 -236
- package/dist/styled-system/types/csstype.d.ts +0 -22570
- package/dist/styled-system/types/index.d.ts +0 -6
- package/dist/styled-system/types/parts.d.ts +0 -8
- package/dist/styled-system/types/pattern.d.ts +0 -78
- package/dist/styled-system/types/prop-type.d.ts +0 -223
- package/dist/styled-system/types/recipe.d.ts +0 -181
- package/dist/styled-system/types/selectors.d.ts +0 -59
- package/dist/styled-system/types/static-css.d.ts +0 -56
- package/dist/styled-system/types/style-props.d.ts +0 -8088
- package/dist/styled-system/types/system-types.d.ts +0 -151
package/dist/recipes.js
CHANGED
|
@@ -1,4 +1,264 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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,24 @@
|
|
|
1
|
+
export type TreeTableId = string | number;
|
|
2
|
+
export interface TreeTableSort {
|
|
3
|
+
key: string;
|
|
4
|
+
direction: 'asc' | 'desc';
|
|
5
|
+
}
|
|
6
|
+
export interface TreeTableNode {
|
|
7
|
+
record: Record<string, unknown>;
|
|
8
|
+
id: TreeTableId;
|
|
9
|
+
parent: TreeTableId | undefined;
|
|
10
|
+
children: TreeTableId[];
|
|
11
|
+
level: number;
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function compareTreeTableValues(left: unknown, right: unknown): number;
|
|
15
|
+
export declare function filterTreeTableData(data: Record<string, unknown>[], search: string, keys: string[], childrenKey: string): Record<string, unknown>[];
|
|
16
|
+
export declare function sortTreeTableData(data: Record<string, unknown>[], sort: TreeTableSort | undefined, childrenKey: string): Record<string, unknown>[];
|
|
17
|
+
export declare function indexTreeTable(data: Record<string, unknown>[], primaryKey: string, childrenKey: string, loadedChildren?: ReadonlyMap<TreeTableId, Record<string, unknown>[]>): {
|
|
18
|
+
valid: boolean;
|
|
19
|
+
nodes: Map<TreeTableId, TreeTableNode>;
|
|
20
|
+
};
|
|
21
|
+
export declare function treeTableSelection(nodes: ReadonlyMap<TreeTableId, TreeTableNode>, selected: ReadonlySet<TreeTableId>): Map<TreeTableId, {
|
|
22
|
+
total: number;
|
|
23
|
+
selected: number;
|
|
24
|
+
}>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export function compareTreeTableValues(left, right) {
|
|
2
|
+
if (left == null && right == null)
|
|
3
|
+
return 0;
|
|
4
|
+
if (left == null)
|
|
5
|
+
return -1;
|
|
6
|
+
if (right == null)
|
|
7
|
+
return 1;
|
|
8
|
+
if (typeof left === 'number' && typeof right === 'number') {
|
|
9
|
+
if (Number.isNaN(left) && Number.isNaN(right))
|
|
10
|
+
return 0;
|
|
11
|
+
if (Number.isNaN(left))
|
|
12
|
+
return -1;
|
|
13
|
+
if (Number.isNaN(right))
|
|
14
|
+
return 1;
|
|
15
|
+
return left - right;
|
|
16
|
+
}
|
|
17
|
+
return treeTableText(left).localeCompare(treeTableText(right), undefined, { numeric: true, sensitivity: 'base' });
|
|
18
|
+
}
|
|
19
|
+
function treeTableText(value) {
|
|
20
|
+
return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean'
|
|
21
|
+
? String(value) : '';
|
|
22
|
+
}
|
|
23
|
+
export function filterTreeTableData(data, search, keys, childrenKey) {
|
|
24
|
+
const needle = search.trim().toLocaleLowerCase();
|
|
25
|
+
if (!needle)
|
|
26
|
+
return data;
|
|
27
|
+
const matches = (record) => keys.some(key => treeTableText(record[key]).toLocaleLowerCase().includes(needle));
|
|
28
|
+
const visit = (record) => {
|
|
29
|
+
if (matches(record))
|
|
30
|
+
return record;
|
|
31
|
+
const children = Array.isArray(record[childrenKey])
|
|
32
|
+
? record[childrenKey].filter((item) => typeof item === 'object' && item !== null && !Array.isArray(item))
|
|
33
|
+
: [];
|
|
34
|
+
const keptChildren = children.map(visit).filter((item) => item !== undefined);
|
|
35
|
+
if (keptChildren.length === 0)
|
|
36
|
+
return undefined;
|
|
37
|
+
return keptChildren.length > 0
|
|
38
|
+
? { ...record, [childrenKey]: keptChildren }
|
|
39
|
+
: record;
|
|
40
|
+
};
|
|
41
|
+
return data.map(visit).filter((item) => item !== undefined);
|
|
42
|
+
}
|
|
43
|
+
export function sortTreeTableData(data, sort, childrenKey) {
|
|
44
|
+
if (!sort)
|
|
45
|
+
return data;
|
|
46
|
+
const direction = sort.direction === 'desc' ? -1 : 1;
|
|
47
|
+
const visit = (records) => records
|
|
48
|
+
.map(record => {
|
|
49
|
+
const children = Array.isArray(record[childrenKey])
|
|
50
|
+
? visit(record[childrenKey].filter((item) => typeof item === 'object' && item !== null && !Array.isArray(item)))
|
|
51
|
+
: undefined;
|
|
52
|
+
return children ? { ...record, [childrenKey]: children } : record;
|
|
53
|
+
})
|
|
54
|
+
.sort((left, right) => direction * compareTreeTableValues(left[sort.key], right[sort.key]));
|
|
55
|
+
return visit(data);
|
|
56
|
+
}
|
|
57
|
+
export function indexTreeTable(data, primaryKey, childrenKey, loadedChildren) {
|
|
58
|
+
const nodes = new Map();
|
|
59
|
+
const invalid = () => ({ valid: false, nodes: new Map() });
|
|
60
|
+
if (!Array.isArray(data) || data.length > 10000)
|
|
61
|
+
return invalid();
|
|
62
|
+
const stack = data.map(record => ({ record, parent: undefined, level: 0 })).reverse();
|
|
63
|
+
while (stack.length) {
|
|
64
|
+
const item = stack.pop();
|
|
65
|
+
if (!item)
|
|
66
|
+
break;
|
|
67
|
+
if (item.level > 64 || nodes.size >= 10000 || typeof item.record !== 'object'
|
|
68
|
+
|| item.record === null || Array.isArray(item.record))
|
|
69
|
+
return invalid();
|
|
70
|
+
const record = item.record;
|
|
71
|
+
const id = record[primaryKey];
|
|
72
|
+
if (typeof id !== 'string' && (typeof id !== 'number' || !Number.isFinite(id)))
|
|
73
|
+
return invalid();
|
|
74
|
+
if (nodes.has(id))
|
|
75
|
+
return invalid();
|
|
76
|
+
const children = loadedChildren?.get(id) ?? record[childrenKey];
|
|
77
|
+
if (children != null && (!Array.isArray(children) || children.length > 10000))
|
|
78
|
+
return invalid();
|
|
79
|
+
const node = {
|
|
80
|
+
id, record, parent: item.parent, children: [], level: item.level,
|
|
81
|
+
disabled: record['disabled'] === true || (item.parent !== undefined && nodes.get(item.parent)?.disabled === true),
|
|
82
|
+
};
|
|
83
|
+
nodes.set(id, node);
|
|
84
|
+
if (item.parent !== undefined)
|
|
85
|
+
nodes.get(item.parent)?.children.push(id);
|
|
86
|
+
if (Array.isArray(children)) {
|
|
87
|
+
if (nodes.size + stack.length + children.length > 10000)
|
|
88
|
+
return invalid();
|
|
89
|
+
for (let index = children.length - 1; index >= 0; index -= 1) {
|
|
90
|
+
stack.push({ record: children[index], parent: id, level: item.level + 1 });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return { valid: true, nodes };
|
|
95
|
+
}
|
|
96
|
+
export function treeTableSelection(nodes, selected) {
|
|
97
|
+
const counts = new Map();
|
|
98
|
+
// 索引按深度优先顺序插入,逆序累计可在线性时间内计算全树半选状态。
|
|
99
|
+
for (const node of [...nodes.values()].reverse()) {
|
|
100
|
+
const count = { total: node.disabled ? 0 : 1, selected: node.disabled ? 0 : selected.has(node.id) ? 1 : 0 };
|
|
101
|
+
for (const id of node.children) {
|
|
102
|
+
const child = counts.get(id);
|
|
103
|
+
if (child) {
|
|
104
|
+
count.total += child.total;
|
|
105
|
+
count.selected += child.selected;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
counts.set(node.id, count);
|
|
109
|
+
}
|
|
110
|
+
return counts;
|
|
111
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -12,18 +12,18 @@ export type AdminProviderBundle = ProviderBundle & {
|
|
|
12
12
|
export type RoleInfo = {
|
|
13
13
|
code: string;
|
|
14
14
|
name: string;
|
|
15
|
-
[key: string]:
|
|
15
|
+
[key: string]: unknown;
|
|
16
16
|
};
|
|
17
17
|
export type ResourceInfo = {
|
|
18
18
|
code: string;
|
|
19
19
|
name: string;
|
|
20
20
|
section?: string;
|
|
21
|
-
[key: string]:
|
|
21
|
+
[key: string]: unknown;
|
|
22
22
|
};
|
|
23
23
|
export type ActionInfo = {
|
|
24
24
|
code: string;
|
|
25
25
|
name: string;
|
|
26
|
-
[key: string]:
|
|
26
|
+
[key: string]: unknown;
|
|
27
27
|
};
|
|
28
28
|
export interface Tenant {
|
|
29
29
|
id: string;
|
|
@@ -38,5 +38,5 @@ export interface GridModule {
|
|
|
38
38
|
x: number;
|
|
39
39
|
y: number;
|
|
40
40
|
title?: string;
|
|
41
|
-
componentProps?:
|
|
41
|
+
componentProps?: Record<string, unknown>;
|
|
42
42
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.75.0",
|
|
4
4
|
"description": "Pre-built admin UI components — AdminApp, AutoTable, AutoForm, Sidebar, Layout",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -58,10 +58,14 @@
|
|
|
58
58
|
"./recipes": {
|
|
59
59
|
"types": "./dist/recipes.d.ts",
|
|
60
60
|
"default": "./dist/recipes.js"
|
|
61
|
+
},
|
|
62
|
+
"./component-registry": {
|
|
63
|
+
"types": "./dist/component-registry.d.ts",
|
|
64
|
+
"default": "./dist/component-registry.js"
|
|
61
65
|
}
|
|
62
66
|
},
|
|
63
67
|
"peerDependencies": {
|
|
64
|
-
"@svadmin/core": "^0.
|
|
68
|
+
"@svadmin/core": "^0.55.0",
|
|
65
69
|
"@tanstack/svelte-query": "^6.1.48",
|
|
66
70
|
"isomorphic-dompurify": "^3.23.0",
|
|
67
71
|
"svelte": "^5.56.10"
|
|
@@ -84,8 +88,10 @@
|
|
|
84
88
|
}
|
|
85
89
|
},
|
|
86
90
|
"dependencies": {
|
|
91
|
+
"@svadmin/devtools-contract": "^0.2.0",
|
|
87
92
|
"@sinclair/typebox": "^0.34.52",
|
|
88
93
|
"@floating-ui/dom": "^1.8.0",
|
|
94
|
+
"esm-env": "^1.2.2",
|
|
89
95
|
"@lucide/svelte": "^1.35.0",
|
|
90
96
|
"@svar-ui/svelte-core": "^2.6.0",
|
|
91
97
|
"@svar-ui/svelte-filemanager": "^2.6.0",
|
|
@@ -93,8 +99,10 @@
|
|
|
93
99
|
"@tanstack/svelte-table": "^9.2.3",
|
|
94
100
|
"@tanstack/table-core": "^9.2.3",
|
|
95
101
|
"bits-ui": "^2.19.0",
|
|
96
|
-
"
|
|
97
|
-
"
|
|
102
|
+
"cn": "^0.2.4",
|
|
103
|
+
"devframe": "1.0.0",
|
|
104
|
+
"tailwind-variants": "^3.3.1",
|
|
105
|
+
"svelte-sonner": "^1.2.1"
|
|
98
106
|
},
|
|
99
107
|
"license": "MIT",
|
|
100
108
|
"author": "zuohuadong",
|
|
@@ -112,22 +120,26 @@
|
|
|
112
120
|
},
|
|
113
121
|
"devDependencies": {
|
|
114
122
|
"@happy-dom/global-registrator": "^20.11.12",
|
|
115
|
-
"@svadmin/ai-elements": "^0.
|
|
123
|
+
"@svadmin/ai-elements": "^0.10.0",
|
|
116
124
|
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
|
125
|
+
"@tailwindcss/cli": "4.3.3",
|
|
117
126
|
"@testing-library/dom": "^10.4.1",
|
|
118
127
|
"@testing-library/svelte": "^5.4.2",
|
|
119
128
|
"@testing-library/user-event": "^14.6.6",
|
|
120
129
|
"happy-dom": "^20.11.12",
|
|
121
130
|
"postcss": "^8.5.26",
|
|
122
131
|
"postcss-selector-parser": "^7.1.1",
|
|
123
|
-
"
|
|
124
|
-
"
|
|
132
|
+
"shadcn-svelte": "^1.7.0",
|
|
133
|
+
"tailwindcss": "4.3.3",
|
|
134
|
+
"vitest": "^4.1.11"
|
|
125
135
|
},
|
|
126
136
|
"scripts": {
|
|
127
137
|
"build": "bun run build:styles && node ../../node_modules/@sveltejs/package/svelte-package.js -i src -o dist && node scripts/build-static-css.mjs && node scripts/postbuild-css.mjs",
|
|
138
|
+
"shadcn": "shadcn-svelte --help",
|
|
139
|
+
"shadcn:add": "shadcn-svelte add --cwd shadcn --no-deps-install",
|
|
128
140
|
"test": "vitest run --config ./vitest.config.ts",
|
|
129
|
-
"test:css": "node --experimental-strip-types --test scripts/static-css.test.mjs scripts/
|
|
130
|
-
"build:styles": "
|
|
131
|
-
"
|
|
141
|
+
"test:css": "node --experimental-strip-types --test scripts/static-css.test.mjs scripts/conditional-css.test.mjs scripts/native-css-entries.test.mjs scripts/tailwind-recipes.test.mjs ../../scripts/no-tailwind-contract.test.mjs",
|
|
142
|
+
"build:styles": "bun run build:tailwind && node ../../scripts/build-native-classnames.mjs ui",
|
|
143
|
+
"build:tailwind": "tailwindcss -i styles/tailwind.css -o src/styles/tailwind.generated.css"
|
|
132
144
|
}
|
|
133
145
|
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { withoutSpace } from '../helpers.js';
|
|
2
|
-
|
|
3
|
-
const conditionsStr = "_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_complete,_incomplete,_dragging,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_grabbed,_underValue,_overValue,_atValue,_default,_optional,_open,_closed,_fullscreen,_loading,_hidden,_current,_currentPage,_currentStep,_today,_unavailable,_rangeStart,_rangeEnd,_now,_topmost,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,_icon,_starting,_noscript,_invertedColors,base"
|
|
4
|
-
const conditions = new Set(conditionsStr.split(','))
|
|
5
|
-
|
|
6
|
-
const conditionRegex = /^@|&|&$/
|
|
7
|
-
|
|
8
|
-
export function isCondition(value){
|
|
9
|
-
return conditions.has(value) || conditionRegex.test(value)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const underscoreRegex = /^_/
|
|
13
|
-
const conditionsSelectorRegex = /&|@/
|
|
14
|
-
|
|
15
|
-
export function finalizeConditions(paths){
|
|
16
|
-
return paths.map((path) => {
|
|
17
|
-
if (conditions.has(path)){
|
|
18
|
-
return path.replace(underscoreRegex, '')
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (conditionsSelectorRegex.test(path)){
|
|
22
|
-
return `[${withoutSpace(path.trim())}]`
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return path
|
|
26
|
-
})}
|
|
27
|
-
|
|
28
|
-
export function sortConditions(paths){
|
|
29
|
-
return paths.sort((a, b) => {
|
|
30
|
-
const aa = isCondition(a)
|
|
31
|
-
const bb = isCondition(b)
|
|
32
|
-
if (aa && !bb) return 1
|
|
33
|
-
if (!aa && bb) return -1
|
|
34
|
-
return 0
|
|
35
|
-
})
|
|
36
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
import type { SystemStyleObject } from '../types/index';
|
|
3
|
-
|
|
4
|
-
type Styles = SystemStyleObject | undefined | null | false
|
|
5
|
-
|
|
6
|
-
interface CssRawFunction {
|
|
7
|
-
(styles: Styles): SystemStyleObject
|
|
8
|
-
(styles: Styles[]): SystemStyleObject
|
|
9
|
-
(...styles: Array<Styles | Styles[]>): SystemStyleObject
|
|
10
|
-
(styles: Styles): SystemStyleObject
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface CssFunction {
|
|
14
|
-
(styles: Styles): string
|
|
15
|
-
(styles: Styles[]): string
|
|
16
|
-
(...styles: Array<Styles | Styles[]>): string
|
|
17
|
-
(styles: Styles): string
|
|
18
|
-
|
|
19
|
-
raw: CssRawFunction
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export declare const css: CssFunction;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { createCss, createMergeCss, hypenateProperty, withoutSpace } from '../helpers.js';
|
|
2
|
-
import { sortConditions, finalizeConditions } from './conditions.js';
|
|
3
|
-
|
|
4
|
-
const utilities = "aspectRatio:asp,boxDecorationBreak:bx-db,zIndex:z,boxSizing:bx-s,objectPosition:obj-p,objectFit:obj-f,overscrollBehavior:ovs-b,overscrollBehaviorX:ovs-bx,overscrollBehaviorY:ovs-by,position:pos/1,top:top,left:left,inset:inset,insetInline:inset-x/insetX,insetBlock:inset-y/insetY,insetBlockEnd:inset-be,insetBlockStart:inset-bs,insetInlineEnd:inset-e/insetEnd/end,insetInlineStart:inset-s/insetStart/start,right:right,bottom:bottom,float:float,visibility:vis,display:d,hideFrom:hide,hideBelow:show,flexBasis:flex-b,flex:flex,flexDirection:flex-d/flexDir,flexGrow:flex-g,flexShrink:flex-sh,gridTemplateColumns:grid-tc,gridTemplateRows:grid-tr,gridColumn:grid-c,gridRow:grid-r,gridColumnStart:grid-cs,gridColumnEnd:grid-ce,gridAutoFlow:grid-af,gridAutoColumns:grid-ac,gridAutoRows:grid-ar,gap:gap,gridGap:grid-g,gridRowGap:grid-rg,gridColumnGap:grid-cg,rowGap:rg,columnGap:cg,justifyContent:jc,alignContent:ac,alignItems:ai,alignSelf:as,padding:p/1,paddingLeft:pl/1,paddingRight:pr/1,paddingTop:pt/1,paddingBottom:pb/1,paddingBlock:py/1/paddingY,paddingBlockEnd:pbe,paddingBlockStart:pbs,paddingInline:px/paddingX/1,paddingInlineEnd:pe/1/paddingEnd,paddingInlineStart:ps/1/paddingStart,marginLeft:ml/1,marginRight:mr/1,marginTop:mt/1,marginBottom:mb/1,margin:m/1,marginBlock:my/1/marginY,marginBlockEnd:mbe,marginBlockStart:mbs,marginInline:mx/1/marginX,marginInlineEnd:me/1/marginEnd,marginInlineStart:ms/1/marginStart,spaceX:sx,spaceY:sy,outlineWidth:ring-w/ringWidth,outlineColor:ring-c/ringColor,outline:ring/1,outlineOffset:ring-o/ringOffset,focusRing:focus-ring,focusVisibleRing:focus-v-ring,focusRingColor:focus-ring-c,focusRingOffset:focus-ring-o,focusRingWidth:focus-ring-w,focusRingStyle:focus-ring-s,divideX:dvd-x,divideY:dvd-y,divideColor:dvd-c,divideStyle:dvd-s,width:w/1,inlineSize:w-is,minWidth:min-w/minW,minInlineSize:min-w-is,maxWidth:max-w/maxW,maxInlineSize:max-w-is,height:h/1,blockSize:h-bs,minHeight:min-h/minH,minBlockSize:min-h-bs,maxHeight:max-h/maxH,maxBlockSize:max-b,boxSize:size,color:c,fontFamily:ff,fontSize:fs,fontSizeAdjust:fs-a,fontPalette:fp,fontKerning:fk,fontFeatureSettings:ff-s,fontWeight:fw,fontSmoothing:fsmt,fontVariant:fv,fontVariantAlternates:fv-alt,fontVariantCaps:fv-caps,fontVariationSettings:fv-s,fontVariantNumeric:fv-num,letterSpacing:ls,lineHeight:lh,textAlign:ta,textDecoration:td,textDecorationColor:td-c,textEmphasisColor:te-c,textDecorationStyle:td-s,textDecorationThickness:td-t,textUnderlineOffset:tu-o,textTransform:tt,textIndent:ti,textShadow:tsh,textShadowColor:tsh-c/textShadowColor,WebkitTextFillColor:wktf-c,textOverflow:tov,verticalAlign:va,wordBreak:wb,textWrap:tw,truncate:trunc,lineClamp:lc,listStyleType:li-t,listStylePosition:li-pos,listStyleImage:li-img,listStyle:li-s,backgroundPosition:bg-p/bgPosition,backgroundPositionX:bg-p-x/bgPositionX,backgroundPositionY:bg-p-y/bgPositionY,backgroundAttachment:bg-a/bgAttachment,backgroundClip:bg-cp/bgClip,background:bg/1,backgroundColor:bg-c/bgColor,backgroundOrigin:bg-o/bgOrigin,backgroundImage:bg-i/bgImage,backgroundRepeat:bg-r/bgRepeat,backgroundBlendMode:bg-bm/bgBlendMode,backgroundSize:bg-s/bgSize,backgroundGradient:bg-grad/bgGradient,backgroundLinear:bg-linear/bgLinear,backgroundRadial:bg-radial/bgRadial,backgroundConic:bg-conic/bgConic,textGradient:txt-grad,gradientFromPosition:grad-from-pos,gradientToPosition:grad-to-pos,gradientFrom:grad-from,gradientTo:grad-to,gradientVia:grad-via,gradientViaPosition:grad-via-pos,borderRadius:bdr/rounded,borderTopLeftRadius:bdr-tl/roundedTopLeft,borderTopRightRadius:bdr-tr/roundedTopRight,borderBottomRightRadius:bdr-br/roundedBottomRight,borderBottomLeftRadius:bdr-bl/roundedBottomLeft,borderTopRadius:bdr-t/roundedTop,borderRightRadius:bdr-r/roundedRight,borderBottomRadius:bdr-b/roundedBottom,borderLeftRadius:bdr-l/roundedLeft,borderStartStartRadius:bdr-ss/roundedStartStart,borderStartEndRadius:bdr-se/roundedStartEnd,borderStartRadius:bdr-s/roundedStart,borderEndStartRadius:bdr-es/roundedEndStart,borderEndEndRadius:bdr-ee/roundedEndEnd,borderEndRadius:bdr-e/roundedEnd,border:bd,borderWidth:bd-w,borderTopWidth:bd-t-w,borderLeftWidth:bd-l-w,borderRightWidth:bd-r-w,borderBottomWidth:bd-b-w,borderBlockStartWidth:bd-bs-w,borderBlockEndWidth:bd-be-w,borderColor:bd-c,borderInline:bd-x/borderX,borderInlineWidth:bd-x-w/borderXWidth,borderInlineColor:bd-x-c/borderXColor,borderBlock:bd-y/borderY,borderBlockWidth:bd-y-w/borderYWidth,borderBlockColor:bd-y-c/borderYColor,borderLeft:bd-l,borderLeftColor:bd-l-c,borderInlineStart:bd-s/borderStart,borderInlineStartWidth:bd-s-w/borderStartWidth,borderInlineStartColor:bd-s-c/borderStartColor,borderRight:bd-r,borderRightColor:bd-r-c,borderInlineEnd:bd-e/borderEnd,borderInlineEndWidth:bd-e-w/borderEndWidth,borderInlineEndColor:bd-e-c/borderEndColor,borderTop:bd-t,borderTopColor:bd-t-c,borderBottom:bd-b,borderBottomColor:bd-b-c,borderBlockEnd:bd-be,borderBlockEndColor:bd-be-c,borderBlockStart:bd-bs,borderBlockStartColor:bd-bs-c,opacity:op,boxShadow:bx-sh/shadow,boxShadowColor:bx-sh-c/shadowColor,mixBlendMode:mix-bm,filter:filter,brightness:brightness,contrast:contrast,grayscale:grayscale,hueRotate:hue-rotate,invert:invert,saturate:saturate,sepia:sepia,dropShadow:drop-shadow,blur:blur,backdropFilter:bkdp,backdropBlur:bkdp-blur,backdropBrightness:bkdp-brightness,backdropContrast:bkdp-contrast,backdropGrayscale:bkdp-grayscale,backdropHueRotate:bkdp-hue-rotate,backdropInvert:bkdp-invert,backdropOpacity:bkdp-opacity,backdropSaturate:bkdp-saturate,backdropSepia:bkdp-sepia,borderCollapse:bd-cl,borderSpacing:bd-sp,borderSpacingX:bd-sx,borderSpacingY:bd-sy,tableLayout:tbl,transitionTimingFunction:trs-tmf,transitionDelay:trs-dly,transitionDuration:trs-dur,transitionProperty:trs-prop,transition:trs,animation:anim,animationName:anim-n,animationTimingFunction:anim-tmf,animationDuration:anim-dur,animationDelay:anim-dly,animationPlayState:anim-ps,animationComposition:anim-comp,animationFillMode:anim-fm,animationDirection:anim-dir,animationIterationCount:anim-ic,animationRange:anim-r,animationState:anim-s,animationRangeStart:anim-rs,animationRangeEnd:anim-re,animationTimeline:anim-tl,transformOrigin:trf-o,transformBox:trf-b,transformStyle:trf-s,transform:trf,rotate:rotate,rotateX:rotate-x,rotateY:rotate-y,rotateZ:rotate-z,scale:scale,scaleX:scale-x,scaleY:scale-y,translate:translate,translateX:translate-x/x,translateY:translate-y/y,translateZ:translate-z/z,accentColor:ac-c,caretColor:ca-c,scrollBehavior:scr-bhv,scrollbar:scr-bar,scrollbarColor:scr-bar-c,scrollbarGutter:scr-bar-g,scrollbarWidth:scr-bar-w,scrollMargin:scr-m,scrollMarginLeft:scr-ml,scrollMarginRight:scr-mr,scrollMarginTop:scr-mt,scrollMarginBottom:scr-mb,scrollMarginBlock:scr-my/scrollMarginY,scrollMarginBlockEnd:scr-mbe,scrollMarginBlockStart:scr-mbt,scrollMarginInline:scr-mx/scrollMarginX,scrollMarginInlineEnd:scr-me,scrollMarginInlineStart:scr-ms,scrollPadding:scr-p,scrollPaddingBlock:scr-py/scrollPaddingY,scrollPaddingBlockStart:scr-pbs,scrollPaddingBlockEnd:scr-pbe,scrollPaddingInline:scr-px/scrollPaddingX,scrollPaddingInlineEnd:scr-pe,scrollPaddingInlineStart:scr-ps,scrollPaddingLeft:scr-pl,scrollPaddingRight:scr-pr,scrollPaddingTop:scr-pt,scrollPaddingBottom:scr-pb,scrollSnapAlign:scr-sa,scrollSnapStop:scrs-s,scrollSnapType:scrs-t,scrollSnapStrictness:scrs-strt,scrollSnapMargin:scrs-m,scrollSnapMarginTop:scrs-mt,scrollSnapMarginBottom:scrs-mb,scrollSnapMarginLeft:scrs-ml,scrollSnapMarginRight:scrs-mr,scrollSnapCoordinate:scrs-c,scrollSnapDestination:scrs-d,scrollSnapPointsX:scrs-px,scrollSnapPointsY:scrs-py,scrollSnapTypeX:scrs-tx,scrollSnapTypeY:scrs-ty,scrollTimeline:scrtl,scrollTimelineAxis:scrtl-a,scrollTimelineName:scrtl-n,touchAction:tch-a,userSelect:us,overflow:ov,overflowWrap:ov-wrap,overflowX:ov-x,overflowY:ov-y,overflowAnchor:ov-a,overflowBlock:ov-b,overflowInline:ov-i,overflowClipBox:ovcp-bx,overflowClipMargin:ovcp-m,overscrollBehaviorBlock:ovs-bb,overscrollBehaviorInline:ovs-bi,fill:fill,stroke:stk,strokeWidth:stk-w,strokeDasharray:stk-dsh,strokeDashoffset:stk-do,strokeLinecap:stk-lc,strokeLinejoin:stk-lj,strokeMiterlimit:stk-ml,strokeOpacity:stk-op,srOnly:sr,debug:debug,appearance:ap,backfaceVisibility:bfv,clipPath:cp-path,hyphens:hy,mask:msk,maskImage:msk-i,maskSize:msk-s,textSizeAdjust:txt-adj,container:cq,containerName:cq-n,containerType:cq-t,cursor:cursor"
|
|
5
|
-
|
|
6
|
-
const classNameByProp = new Map()
|
|
7
|
-
const shorthands = new Map()
|
|
8
|
-
utilities.split(',').forEach((utility) => {
|
|
9
|
-
const [prop, meta] = utility.split(':')
|
|
10
|
-
const [className, ...shorthandList] = meta.split('/')
|
|
11
|
-
classNameByProp.set(prop, className)
|
|
12
|
-
if (shorthandList.length) {
|
|
13
|
-
shorthandList.forEach((shorthand) => {
|
|
14
|
-
shorthands.set(shorthand === '1' ? className : shorthand, prop)
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
const resolveShorthand = (prop) => shorthands.get(prop) || prop
|
|
20
|
-
|
|
21
|
-
const context = {
|
|
22
|
-
|
|
23
|
-
conditions: {
|
|
24
|
-
shift: sortConditions,
|
|
25
|
-
finalize: finalizeConditions,
|
|
26
|
-
breakpoints: { keys: ["base"] }
|
|
27
|
-
},
|
|
28
|
-
utility: {
|
|
29
|
-
prefix: "svadmin",
|
|
30
|
-
transform: (prop, value) => {
|
|
31
|
-
const key = resolveShorthand(prop)
|
|
32
|
-
const propKey = classNameByProp.get(key) || hypenateProperty(key)
|
|
33
|
-
return { className: `${propKey}_${withoutSpace(value)}` }
|
|
34
|
-
},
|
|
35
|
-
hasShorthand: true,
|
|
36
|
-
toHash: (path, hashFn) => hashFn(path.join(":")),
|
|
37
|
-
resolveShorthand: resolveShorthand,
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const cssFn = createCss(context)
|
|
42
|
-
export const css = (...styles) => cssFn(mergeCss(...styles))
|
|
43
|
-
css.raw = (...styles) => mergeCss(...styles)
|
|
44
|
-
|
|
45
|
-
export const { mergeCss, assignCss } = createMergeCss(context)
|