@svadmin/ui 0.70.0 → 0.73.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 +40 -25
- package/THIRD_PARTY_NOTICES.md +52 -0
- package/dist/actions.js +1 -1
- package/dist/app.css +7804 -5188
- package/dist/app.theme.css +7738 -5173
- 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.svelte.d.ts +33 -19
- package/dist/component-registry.svelte.js +6 -4
- package/dist/components/AdminApp.svelte +55 -53
- package/dist/components/AdminApp.svelte.d.ts +2 -2
- package/dist/components/ApiSettings.svelte +19 -1
- package/dist/components/AuditLogDrawer.svelte +14 -3
- package/dist/components/AutoForm.svelte +162 -50
- package/dist/components/AutoForm.svelte.d.ts +4 -0
- package/dist/components/AutoTable.svelte +599 -259
- package/dist/components/AutoTable.svelte.d.ts +6 -0
- package/dist/components/BoundRecordDetailDrawer.svelte +172 -0
- package/dist/components/BoundRecordDetailDrawer.svelte.d.ts +11 -0
- package/dist/components/Breadcrumbs.svelte +7 -4
- package/dist/components/CancelTaskButton.svelte +9 -5
- package/dist/components/ColumnHeaderFilter.svelte +4 -3
- package/dist/components/ColumnSettings.svelte +1 -0
- package/dist/components/ComboboxField.svelte +118 -36
- package/dist/components/ComboboxField.svelte.d.ts +5 -4
- package/dist/components/CreatePage.svelte +7 -1
- package/dist/components/CreatePage.svelte.d.ts +2 -0
- package/dist/components/DateRangeInput.svelte +75 -0
- package/dist/components/DateRangeInput.svelte.d.ts +25 -0
- package/dist/components/DateTimeInput.svelte +65 -0
- package/dist/components/DateTimeInput.svelte.d.ts +19 -0
- package/dist/components/DetailDrawer.svelte +4 -0
- package/dist/components/DetailDrawer.svelte.d.ts +1 -0
- package/dist/components/DevTools.svelte +8 -21
- package/dist/components/DraggableGrid.svelte +1 -0
- package/dist/components/DraggableHeader.svelte +5 -9
- package/dist/components/DraggableHeader.svelte.d.ts +43 -18
- package/dist/components/DraggableRowTable.svelte +2 -2
- package/dist/components/DynamicFormList.svelte +17 -17
- package/dist/components/DynamicFormList.svelte.d.ts +2 -1
- package/dist/components/EditPage.svelte +7 -1
- package/dist/components/EditPage.svelte.d.ts +2 -0
- package/dist/components/EditableTable.svelte +4 -0
- package/dist/components/ErrorPage.svelte +3 -1
- package/dist/components/FieldDisplay.svelte +14 -0
- package/dist/components/FieldDisplay.svelte.d.ts +7 -0
- package/dist/components/FieldRenderer.svelte +96 -20
- package/dist/components/FileUpload.svelte +250 -0
- package/dist/components/FileUpload.svelte.d.ts +32 -0
- package/dist/components/FilterBuilder.svelte +236 -268
- package/dist/components/FilterBuilder.svelte.d.ts +3 -0
- package/dist/components/FilterDropdown.svelte.d.ts +1 -1
- package/dist/components/Header.svelte +5 -6
- package/dist/components/ImportWizard.svelte +182 -94
- package/dist/components/InfiniteList.svelte +22 -8
- package/dist/components/InfiniteList.svelte.d.ts +5 -3
- package/dist/components/InlineEdit.svelte +114 -44
- package/dist/components/JsonSchemaForm.svelte +256 -95
- package/dist/components/JsonSchemaForm.svelte.d.ts +12 -1
- package/dist/components/Layout.svelte +20 -17
- package/dist/components/LazyTaskQueueDrawer.svelte +26 -0
- package/dist/components/LazyTaskQueueDrawer.svelte.d.ts +8 -0
- package/dist/components/ListPage.svelte +11 -6
- package/dist/components/ListPage.svelte.d.ts +2 -0
- package/dist/components/LoginPage.svelte +1 -1
- package/dist/components/MasterDetailView.svelte +3 -3
- package/dist/components/MediaLibraryModal.svelte +5 -2
- package/dist/components/MentionsInput.svelte +4 -3
- package/dist/components/MoneyInput.svelte +25 -0
- package/dist/components/MoneyInput.svelte.d.ts +20 -0
- package/dist/components/NavigateToResource.svelte +3 -2
- 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 +4 -3
- package/dist/components/ProfilePage.svelte +2 -2
- package/dist/components/QuickEditDrawer.svelte +42 -0
- package/dist/components/QuickEditDrawer.svelte.d.ts +10 -0
- package/dist/components/RecordDetailDrawer.svelte +16 -108
- package/dist/components/RecordDetailDrawer.svelte.d.ts +2 -0
- package/dist/components/RecordRowActions.svelte +41 -0
- package/dist/components/RecordRowActions.svelte.d.ts +14 -0
- package/dist/components/ResourceAccessGuard.svelte +7 -5
- package/dist/components/ResourceOperationsPage.svelte +25 -19
- package/dist/components/ResourceOperationsPage.svelte.d.ts +5 -1
- package/dist/components/RetryTaskButton.svelte +9 -5
- package/dist/components/RowActions.svelte +5 -3
- package/dist/components/SensitiveDataMask.svelte +3 -3
- package/dist/components/SettingsPage.svelte +1 -1
- package/dist/components/ShowInferencer.svelte +4 -2
- package/dist/components/ShowInferencer.svelte.d.ts +2 -0
- package/dist/components/ShowPage.svelte +49 -39
- package/dist/components/ShowPage.svelte.d.ts +2 -0
- package/dist/components/Sidebar.svelte +15 -13
- package/dist/components/SplitPaneLayout.svelte +4 -2
- package/dist/components/SpreadsheetView.svelte +81 -286
- package/dist/components/StepsForm.svelte +166 -49
- package/dist/components/StepsForm.svelte.d.ts +1 -0
- 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/TaskDetails.svelte +20 -7
- package/dist/components/TaskList.svelte +19 -7
- package/dist/components/TaskQueueDrawer.svelte +92 -37
- package/dist/components/Toast.svelte +4 -2
- package/dist/components/TooltipButton.svelte +1 -1
- package/dist/components/TreeSelect.svelte +212 -30
- package/dist/components/TreeSelect.svelte.d.ts +3 -1
- package/dist/components/ValidatedField.svelte +27 -0
- package/dist/components/ValidatedField.svelte.d.ts +35 -0
- package/dist/components/account/ImportMembersPage.svelte +2 -2
- package/dist/components/account/SecurityLogPage.svelte +3 -1
- package/dist/components/account/SettingsEnterprisePage.svelte +7 -5
- package/dist/components/account/TeamMembersPage.svelte +1 -1
- package/dist/components/auto-table-grid.d.ts +26 -0
- package/dist/components/auto-table-grid.js +1 -0
- package/dist/components/buttons/CloneButton.svelte +6 -4
- package/dist/components/buttons/DeleteButton.svelte +95 -29
- package/dist/components/buttons/DeleteButton.svelte.d.ts +2 -0
- package/dist/components/buttons/EditButton.svelte +6 -4
- package/dist/components/buttons/ExportButton.svelte +22 -4
- package/dist/components/buttons/ImportButton.svelte +83 -38
- package/dist/components/buttons/ImportButton.svelte.d.ts +6 -10
- package/dist/components/buttons/RefreshButton.svelte +48 -8
- package/dist/components/buttons/ShowButton.svelte +6 -4
- package/dist/components/content/ApiKeyList.svelte +3 -1
- package/dist/components/content/ContentPageHeader.svelte +12 -9
- package/dist/components/content/ContentPageShell.svelte +8 -9
- package/dist/components/content/FileBrowser.svelte +35 -0
- package/dist/components/content/FileBrowser.svelte.d.ts +14 -0
- package/dist/components/content/FileList.svelte +3 -1
- package/dist/components/content/MemberList.svelte +3 -1
- package/dist/components/content/MetricBlock.svelte +10 -13
- package/dist/components/content/NetworkTable.svelte +6 -4
- package/dist/components/content/NetworkTable.svelte.d.ts +1 -0
- package/dist/components/content/PageToolbar.svelte +6 -10
- package/dist/components/content/SectionHeader.svelte +8 -13
- package/dist/components/content/SecurityEventTable.svelte +3 -1
- 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/StatusTabs.svelte +2 -2
- 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/fieldComponentMap.d.ts +18 -13
- package/dist/components/fieldComponentMap.js +100 -47
- package/dist/components/fields/AvatarField.svelte +1 -1
- package/dist/components/fields/ChoiceField.svelte +16 -0
- package/dist/components/fields/ChoiceField.svelte.d.ts +10 -0
- package/dist/components/fields/CodeField.svelte +11 -12
- package/dist/components/fields/CodeField.svelte.d.ts +1 -1
- package/dist/components/fields/DateField.svelte +4 -3
- package/dist/components/fields/DateRangeField.svelte +2 -4
- package/dist/components/fields/ImageField.svelte +3 -1
- package/dist/components/fields/ImagesField.svelte +23 -0
- package/dist/components/fields/ImagesField.svelte.d.ts +6 -0
- package/dist/components/fields/JsonField.svelte +19 -13
- package/dist/components/fields/PasswordField.svelte +5 -0
- package/dist/components/fields/PasswordField.svelte.d.ts +6 -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/fields/json-value.d.ts +11 -0
- package/dist/components/fields/json-value.js +28 -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/profile/ActivityTimeline.svelte +2 -2
- package/dist/components/record-detail.svelte.d.ts +19 -0
- package/dist/components/record-detail.svelte.js +34 -0
- package/dist/components/saved-list-views.js +29 -29
- 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 +13 -0
- package/dist/components/table-contract.js +42 -0
- package/dist/components/task-utils.js +4 -2
- package/dist/components/ui/alert/alert-variants.d.ts +2 -3
- package/dist/components/ui/alert/alert-variants.js +1 -2
- package/dist/components/ui/alert/alert.svelte +4 -5
- package/dist/components/ui/alert/alert.svelte.d.ts +3 -8
- package/dist/components/ui/alert/index.js +0 -2
- package/dist/components/ui/avatar/avatar-variants.d.ts +2 -3
- package/dist/components/ui/avatar/avatar-variants.js +1 -2
- package/dist/components/ui/avatar/avatar.svelte +5 -6
- package/dist/components/ui/avatar/avatar.svelte.d.ts +3 -8
- package/dist/components/ui/badge/badge-variants.d.ts +2 -3
- package/dist/components/ui/badge/badge-variants.js +3 -2
- package/dist/components/ui/badge/badge.svelte +4 -5
- package/dist/components/ui/badge/badge.svelte.d.ts +3 -8
- package/dist/components/ui/badge/index.js +0 -2
- package/dist/components/ui/button/button-variants.d.ts +2 -3
- package/dist/components/ui/button/button-variants.js +5 -3
- package/dist/components/ui/button/button.svelte +100 -44
- package/dist/components/ui/button/button.svelte.d.ts +8 -12
- package/dist/components/ui/button/index.js +0 -2
- package/dist/components/ui/command/command-dialog.svelte +3 -1
- package/dist/components/ui/command/command-dialog.svelte.d.ts +1 -1
- package/dist/components/ui/command/command-group.svelte +4 -2
- package/dist/components/ui/command/command-item.svelte +4 -2
- package/dist/components/ui/command/command-separator.svelte +3 -1
- package/dist/components/ui/command/index.d.ts +5 -5
- package/dist/components/ui/input/input.svelte +41 -24
- package/dist/components/ui/input/input.svelte.d.ts +5 -4
- package/dist/components/ui/sheet/sheet.svelte +9 -3
- package/dist/components/ui/sheet/sheet.svelte.d.ts +1 -0
- package/dist/components/ui/textarea/textarea.svelte +2 -1
- package/dist/components/ui/tooltip/tooltip.svelte +4 -2
- package/dist/components.css +3079 -0
- package/dist/design-contract.d.ts +13 -0
- package/dist/design-contract.js +11 -0
- package/dist/design-system.d.ts +15 -0
- package/dist/design-system.js +7 -0
- package/dist/index.d.ts +15 -1
- package/dist/index.js +9 -0
- package/dist/inline-value.d.ts +5 -0
- package/dist/inline-value.js +24 -0
- package/dist/numeric-input.d.ts +2 -0
- package/dist/numeric-input.js +9 -0
- package/dist/page-chrome.css +12 -49
- package/dist/recipes.d.ts +4 -0
- package/dist/recipes.js +4 -0
- package/dist/rendering/index.d.ts +87 -0
- package/dist/rendering/index.js +117 -0
- package/dist/styled-system/css/conditions.js +36 -0
- package/dist/styled-system/css/css.d.ts +22 -0
- package/dist/styled-system/css/css.js +45 -0
- package/dist/styled-system/css/cva.d.ts +6 -0
- package/dist/styled-system/css/cva.js +87 -0
- package/dist/styled-system/css/cx.d.ts +5 -0
- package/dist/styled-system/css/cx.js +15 -0
- package/dist/styled-system/css/index.d.ts +5 -0
- package/dist/styled-system/css/index.js +4 -0
- package/dist/styled-system/css/sva.d.ts +4 -0
- package/dist/styled-system/css/sva.js +46 -0
- package/dist/styled-system/helpers.js +316 -0
- package/dist/styled-system/patterns/aspect-ratio.d.ts +20 -0
- package/dist/styled-system/patterns/aspect-ratio.js +38 -0
- package/dist/styled-system/patterns/bleed.d.ts +21 -0
- package/dist/styled-system/patterns/bleed.js +24 -0
- package/dist/styled-system/patterns/box.d.ts +20 -0
- package/dist/styled-system/patterns/box.js +15 -0
- package/dist/styled-system/patterns/center.d.ts +20 -0
- package/dist/styled-system/patterns/center.js +21 -0
- package/dist/styled-system/patterns/circle.d.ts +20 -0
- package/dist/styled-system/patterns/circle.js +25 -0
- package/dist/styled-system/patterns/container.d.ts +20 -0
- package/dist/styled-system/patterns/container.js +21 -0
- package/dist/styled-system/patterns/cq.d.ts +21 -0
- package/dist/styled-system/patterns/cq.js +21 -0
- package/dist/styled-system/patterns/divider.d.ts +22 -0
- package/dist/styled-system/patterns/divider.js +25 -0
- package/dist/styled-system/patterns/flex.d.ts +26 -0
- package/dist/styled-system/patterns/flex.js +26 -0
- package/dist/styled-system/patterns/float.d.ts +23 -0
- package/dist/styled-system/patterns/float.js +52 -0
- package/dist/styled-system/patterns/grid-item.d.ts +25 -0
- package/dist/styled-system/patterns/grid-item.js +25 -0
- package/dist/styled-system/patterns/grid.d.ts +24 -0
- package/dist/styled-system/patterns/grid.js +27 -0
- package/dist/styled-system/patterns/hstack.d.ts +21 -0
- package/dist/styled-system/patterns/hstack.js +24 -0
- package/dist/styled-system/patterns/index.d.ts +21 -0
- package/dist/styled-system/patterns/index.js +20 -0
- package/dist/styled-system/patterns/link-overlay.d.ts +20 -0
- package/dist/styled-system/patterns/link-overlay.js +24 -0
- package/dist/styled-system/patterns/spacer.d.ts +20 -0
- package/dist/styled-system/patterns/spacer.js +25 -0
- package/dist/styled-system/patterns/square.d.ts +20 -0
- package/dist/styled-system/patterns/square.js +24 -0
- package/dist/styled-system/patterns/stack.d.ts +23 -0
- package/dist/styled-system/patterns/stack.js +24 -0
- package/dist/styled-system/patterns/visually-hidden.d.ts +20 -0
- package/dist/styled-system/patterns/visually-hidden.js +18 -0
- package/dist/styled-system/patterns/vstack.d.ts +21 -0
- package/dist/styled-system/patterns/vstack.js +24 -0
- package/dist/styled-system/patterns/wrap.d.ts +24 -0
- package/dist/styled-system/patterns/wrap.js +25 -0
- package/dist/styled-system/recipes/content-header.d.ts +31 -0
- package/dist/styled-system/recipes/content-header.js +65 -0
- package/dist/styled-system/recipes/content-page.d.ts +34 -0
- package/dist/styled-system/recipes/content-page.js +43 -0
- package/dist/styled-system/recipes/create-recipe.js +82 -0
- package/dist/styled-system/recipes/index.d.ts +17 -0
- package/dist/styled-system/recipes/index.js +16 -0
- package/dist/styled-system/recipes/metric-block.d.ts +34 -0
- package/dist/styled-system/recipes/metric-block.js +76 -0
- package/dist/styled-system/recipes/product-list.d.ts +31 -0
- package/dist/styled-system/recipes/product-list.js +73 -0
- package/dist/styled-system/recipes/product-section.d.ts +31 -0
- package/dist/styled-system/recipes/product-section.js +49 -0
- package/dist/styled-system/recipes/product-settings-row.d.ts +34 -0
- package/dist/styled-system/recipes/product-settings-row.js +58 -0
- package/dist/styled-system/recipes/product-settings.d.ts +31 -0
- package/dist/styled-system/recipes/product-settings.js +57 -0
- package/dist/styled-system/recipes/product-status.d.ts +34 -0
- package/dist/styled-system/recipes/product-status.js +45 -0
- package/dist/styled-system/recipes/product-toolbar.d.ts +31 -0
- package/dist/styled-system/recipes/product-toolbar.js +41 -0
- package/dist/styled-system/recipes/product-workspace.d.ts +34 -0
- package/dist/styled-system/recipes/product-workspace.js +58 -0
- package/dist/styled-system/recipes/surface-metric.d.ts +38 -0
- package/dist/styled-system/recipes/surface-metric.js +63 -0
- package/dist/styled-system/recipes/surface-table.d.ts +34 -0
- package/dist/styled-system/recipes/surface-table.js +62 -0
- package/dist/styled-system/recipes/ui-badge.d.ts +31 -0
- package/dist/styled-system/recipes/ui-badge.js +38 -0
- package/dist/styled-system/recipes/ui-button.d.ts +32 -0
- package/dist/styled-system/recipes/ui-button.js +43 -0
- package/dist/styled-system/recipes/ui-input.d.ts +31 -0
- package/dist/styled-system/recipes/ui-input.js +49 -0
- package/dist/styled-system/recipes/ui-textarea.d.ts +31 -0
- package/dist/styled-system/recipes/ui-textarea.js +24 -0
- package/dist/styled-system/styles.css +1257 -0
- package/dist/styled-system/tokens/index.d.ts +9 -0
- package/dist/styled-system/tokens/index.js +268 -0
- package/dist/styled-system/tokens/tokens.d.ts +36 -0
- package/dist/styled-system/types/composition.d.ts +227 -0
- package/dist/styled-system/types/conditions.d.ts +236 -0
- package/dist/styled-system/types/csstype.d.ts +22570 -0
- package/dist/styled-system/types/index.d.ts +6 -0
- package/dist/styled-system/types/parts.d.ts +8 -0
- package/dist/styled-system/types/pattern.d.ts +78 -0
- package/dist/styled-system/types/prop-type.d.ts +223 -0
- package/dist/styled-system/types/recipe.d.ts +181 -0
- package/dist/styled-system/types/selectors.d.ts +59 -0
- package/dist/styled-system/types/static-css.d.ts +56 -0
- package/dist/styled-system/types/style-props.d.ts +8088 -0
- package/dist/styled-system/types/system-types.d.ts +151 -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/styles/recipes.css +1262 -0
- package/dist/types.d.ts +3 -3
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +38 -14
- package/styles-compatibility.json +12 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Component } from 'svelte';
|
|
2
|
+
import type { SvarInteractiveApi, SvarInteractiveEngineProps } from './svar-grid-interactions.js';
|
|
3
|
+
export interface SvarManagedApi extends SvarInteractiveApi {
|
|
4
|
+
exec(action: string, params?: Record<string, unknown>): Promise<unknown>;
|
|
5
|
+
getState(): {
|
|
6
|
+
selectedRows?: unknown;
|
|
7
|
+
scrollTop?: number;
|
|
8
|
+
flatData?: Record<string, unknown>[];
|
|
9
|
+
focusCell?: {
|
|
10
|
+
row?: string | number;
|
|
11
|
+
column?: string | number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export interface SvarManagedEngineProps extends Omit<SvarInteractiveEngineProps, 'init' | 'columns'> {
|
|
16
|
+
columns: (SvarInteractiveEngineProps['columns'][number] & {
|
|
17
|
+
hidden?: boolean;
|
|
18
|
+
cell?: Component<{
|
|
19
|
+
row: unknown;
|
|
20
|
+
column: unknown;
|
|
21
|
+
}>;
|
|
22
|
+
})[];
|
|
23
|
+
dynamic?: {
|
|
24
|
+
rowCount?: number;
|
|
25
|
+
};
|
|
26
|
+
init?: (api: SvarManagedApi) => void;
|
|
27
|
+
}
|
|
28
|
+
/** 两个公开 Grid 实例组成固定右侧面板,不读取或改写上游 Community 功能开关。 */
|
|
29
|
+
export declare function createSvarPanePair(current: () => boolean): {
|
|
30
|
+
attach: (side: 0 | 1, api: SvarManagedApi) => void;
|
|
31
|
+
focus: (side: 0 | 1, row: string | number, column: string) => void;
|
|
32
|
+
get: (side: 0 | 1) => SvarManagedApi | undefined;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
function own(event, key) {
|
|
2
|
+
return event && typeof event === 'object' ? Object.getOwnPropertyDescriptor(event, key)?.value : undefined;
|
|
3
|
+
}
|
|
4
|
+
function mirroredEvent(action, event) {
|
|
5
|
+
if (action === 'scroll-to') {
|
|
6
|
+
const top = own(event, 'top');
|
|
7
|
+
return typeof top === 'number' && Number.isFinite(top) && top >= 0 ? { top } : undefined;
|
|
8
|
+
}
|
|
9
|
+
if (action === 'open-row' || action === 'close-row') {
|
|
10
|
+
const id = own(event, 'id');
|
|
11
|
+
return typeof id === 'string' ? { id, nested: own(event, 'nested') === true } : undefined;
|
|
12
|
+
}
|
|
13
|
+
const key = own(event, 'key');
|
|
14
|
+
if (typeof key !== 'string')
|
|
15
|
+
return undefined;
|
|
16
|
+
if (action === 'sort-rows') {
|
|
17
|
+
// 上游首次排序可能省略 order,其公开语义为升序。
|
|
18
|
+
const order = own(event, 'order') ?? 'asc';
|
|
19
|
+
if (order !== 'asc' && order !== 'desc')
|
|
20
|
+
return undefined;
|
|
21
|
+
return { key, order, add: own(event, 'add') === true };
|
|
22
|
+
}
|
|
23
|
+
const value = own(event, 'value');
|
|
24
|
+
return typeof value === 'string' || value == null ? { key, value: value ?? '' } : undefined;
|
|
25
|
+
}
|
|
26
|
+
/** 两个公开 Grid 实例组成固定右侧面板,不读取或改写上游 Community 功能开关。 */
|
|
27
|
+
export function createSvarPanePair(current) {
|
|
28
|
+
const panes = new Map();
|
|
29
|
+
let disposed = false;
|
|
30
|
+
let synchronizing = 0;
|
|
31
|
+
function attach(side, api) {
|
|
32
|
+
panes.set(side, api);
|
|
33
|
+
for (const action of ['scroll-to', 'sort-rows', 'filter-rows', 'open-row', 'close-row']) {
|
|
34
|
+
api.on(action, event => {
|
|
35
|
+
const peer = panes.get(side === 0 ? 1 : 0);
|
|
36
|
+
if (disposed || synchronizing || panes.get(side) !== api || !peer || !current())
|
|
37
|
+
return;
|
|
38
|
+
const next = mirroredEvent(action, event);
|
|
39
|
+
if (!next)
|
|
40
|
+
return;
|
|
41
|
+
if (action === 'scroll-to' && peer.getState().scrollTop === next['top'])
|
|
42
|
+
return;
|
|
43
|
+
synchronizing++;
|
|
44
|
+
try {
|
|
45
|
+
void Promise.resolve(peer.exec(action, next)).catch(() => { }).finally(() => { synchronizing--; });
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
synchronizing--;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (side === 1) {
|
|
53
|
+
const top = panes.get(0)?.getState().scrollTop;
|
|
54
|
+
if (typeof top === 'number' && top > 0)
|
|
55
|
+
void api.exec('scroll-to', { top }).catch(() => { });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function focus(side, row, column) {
|
|
59
|
+
if (disposed || !current())
|
|
60
|
+
return;
|
|
61
|
+
const api = panes.get(side);
|
|
62
|
+
if (api)
|
|
63
|
+
void api.exec('focus-cell', { row, column, eventSource: 'svadmin-pinned-navigation' }).catch(() => { });
|
|
64
|
+
}
|
|
65
|
+
return { attach, focus, get: (side) => panes.get(side), dispose() { disposed = true; panes.clear(); } };
|
|
66
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type SvarRange, type SvarWindowPage } from './svar-grid-loading.js';
|
|
2
|
+
export interface SvarLazyTree {
|
|
3
|
+
/** Resource field containing the parent record ID. */
|
|
4
|
+
readonly parentField: string;
|
|
5
|
+
readonly rootValue?: string | number | null;
|
|
6
|
+
readonly hasChildrenKey?: string;
|
|
7
|
+
/** A branch is rejected rather than silently truncated above this bound. Default: 10,000. */
|
|
8
|
+
readonly maxChildren?: number;
|
|
9
|
+
}
|
|
10
|
+
export type SvarResourcePageReader = (pagination: {
|
|
11
|
+
current: number;
|
|
12
|
+
pageSize: number;
|
|
13
|
+
}) => Promise<SvarWindowPage>;
|
|
14
|
+
/** Translate a zero-based exclusive grid window to the existing one-based Provider pagination. */
|
|
15
|
+
export declare function loadSvarResourceWindow(range: SvarRange, pageSize: number, read: SvarResourcePageReader, signal: AbortSignal, primaryKey?: string): Promise<SvarWindowPage>;
|
|
16
|
+
/** Load all children in bounded pages. Partial branches must never masquerade as complete trees. */
|
|
17
|
+
export declare function loadSvarResourceChildren(pageSize: number, maxChildren: number, read: SvarResourcePageReader, signal: AbortSignal, primaryKey?: string, childrenKey?: string): Promise<readonly Record<string, unknown>[]>;
|
|
18
|
+
export declare function appendSvarResourcePage(rows: readonly Record<string, unknown>[], page: SvarWindowPage, expectedTotal: number, primaryKey?: string): readonly Record<string, unknown>[];
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { snapshotSvarRecords, snapshotSvarWindow, SvarLoadCancelled } from './svar-grid-loading.js';
|
|
2
|
+
function checkSignal(signal) {
|
|
3
|
+
if (signal.aborted)
|
|
4
|
+
throw new SvarLoadCancelled();
|
|
5
|
+
}
|
|
6
|
+
function checkPageSize(pageSize) {
|
|
7
|
+
if (!Number.isSafeInteger(pageSize) || pageSize < 1 || pageSize > 1000)
|
|
8
|
+
throw new Error('Invalid resource page size');
|
|
9
|
+
}
|
|
10
|
+
function checkPage(page, start, size, primaryKey) {
|
|
11
|
+
return snapshotSvarWindow(page, { start, end: start + size }, primaryKey);
|
|
12
|
+
}
|
|
13
|
+
/** Translate a zero-based exclusive grid window to the existing one-based Provider pagination. */
|
|
14
|
+
export async function loadSvarResourceWindow(range, pageSize, read, signal, primaryKey = 'id') {
|
|
15
|
+
checkPageSize(pageSize);
|
|
16
|
+
checkSignal(signal);
|
|
17
|
+
if (!Number.isSafeInteger(range.start) || !Number.isSafeInteger(range.end) || range.start < 0
|
|
18
|
+
|| range.end < range.start || range.end > 10_000_000 || range.end - range.start > 2048)
|
|
19
|
+
throw new Error('Invalid resource window');
|
|
20
|
+
const first = Math.floor(range.start / pageSize);
|
|
21
|
+
const last = Math.max(first, Math.ceil(range.end / pageSize) - 1);
|
|
22
|
+
let total;
|
|
23
|
+
const rows = [];
|
|
24
|
+
for (let pageIndex = first; pageIndex <= last; pageIndex++) {
|
|
25
|
+
checkSignal(signal);
|
|
26
|
+
const page = checkPage(await read({ current: pageIndex + 1, pageSize }), pageIndex * pageSize, pageSize, primaryKey);
|
|
27
|
+
checkSignal(signal);
|
|
28
|
+
if (total !== undefined && total !== page.total)
|
|
29
|
+
throw new Error('Resource changed during window loading; refresh');
|
|
30
|
+
total = page.total;
|
|
31
|
+
rows.push(...page.data);
|
|
32
|
+
if ((pageIndex + 1) * pageSize >= total)
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
const data = rows.slice(range.start - first * pageSize, range.end - first * pageSize);
|
|
36
|
+
return snapshotSvarWindow({ data, total: total ?? 0 }, range, primaryKey);
|
|
37
|
+
}
|
|
38
|
+
/** Load all children in bounded pages. Partial branches must never masquerade as complete trees. */
|
|
39
|
+
export async function loadSvarResourceChildren(pageSize, maxChildren, read, signal, primaryKey = 'id', childrenKey = 'children') {
|
|
40
|
+
checkPageSize(pageSize);
|
|
41
|
+
checkSignal(signal);
|
|
42
|
+
if (!Number.isSafeInteger(maxChildren) || maxChildren < 1 || maxChildren > 100_000)
|
|
43
|
+
throw new Error('Invalid child limit');
|
|
44
|
+
let total;
|
|
45
|
+
const rows = [];
|
|
46
|
+
for (let pageIndex = 0;; pageIndex++) {
|
|
47
|
+
checkSignal(signal);
|
|
48
|
+
const page = checkPage(await read({ current: pageIndex + 1, pageSize }), pageIndex * pageSize, pageSize, primaryKey);
|
|
49
|
+
checkSignal(signal);
|
|
50
|
+
if (page.total > maxChildren)
|
|
51
|
+
throw new Error('Branch exceeds the configured child limit');
|
|
52
|
+
if (total !== undefined && total !== page.total)
|
|
53
|
+
throw new Error('Branch changed during loading; retry');
|
|
54
|
+
total = page.total;
|
|
55
|
+
rows.push(...page.data);
|
|
56
|
+
if (rows.length >= total)
|
|
57
|
+
return snapshotSvarRecords(rows, primaryKey, childrenKey);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export function appendSvarResourcePage(rows, page, expectedTotal, primaryKey = 'id') {
|
|
61
|
+
if (!Number.isSafeInteger(expectedTotal) || expectedTotal < 0 || expectedTotal > 10_000_000)
|
|
62
|
+
throw new Error('Invalid expected total');
|
|
63
|
+
if (page.total !== expectedTotal)
|
|
64
|
+
throw new Error('Resource changed during infinite loading; refresh');
|
|
65
|
+
if (rows.length + page.data.length > expectedTotal || (!page.data.length && rows.length < expectedTotal))
|
|
66
|
+
throw new Error('Invalid next resource page');
|
|
67
|
+
return snapshotSvarRecords([...rows, ...page.data], primaryKey);
|
|
68
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SvelteMap } from 'svelte/reactivity';
|
|
2
|
+
import type { Filter, Sort } from '@svadmin/core';
|
|
3
|
+
import type { SvarResourceReadRequest } from './SvarResourceRead.svelte';
|
|
4
|
+
import { type SvarWindowPage } from './svar-grid-loading.js';
|
|
5
|
+
import type { SvarRecordId } from './svar-grid-operations.js';
|
|
6
|
+
/** Query workers remain descendants of the host AdminContext and QueryClientProvider. */
|
|
7
|
+
export declare function createSvarResourceReads<Scope extends object>(options: {
|
|
8
|
+
scope: () => Scope;
|
|
9
|
+
current: (scope: Scope) => boolean;
|
|
10
|
+
authorize: (scope: Scope, parentId?: SvarRecordId) => Promise<boolean>;
|
|
11
|
+
resourceName: () => string;
|
|
12
|
+
dataScopeKey: () => string | number;
|
|
13
|
+
primaryKey: () => string;
|
|
14
|
+
childrenKey: () => string | undefined;
|
|
15
|
+
}): {
|
|
16
|
+
requests: SvelteMap<number, SvarResourceReadRequest>;
|
|
17
|
+
read: (input: {
|
|
18
|
+
scope: Scope;
|
|
19
|
+
signal: AbortSignal;
|
|
20
|
+
pagination: {
|
|
21
|
+
current: number;
|
|
22
|
+
pageSize: number;
|
|
23
|
+
};
|
|
24
|
+
filters: Filter[];
|
|
25
|
+
sorters: Sort[];
|
|
26
|
+
parentId?: SvarRecordId;
|
|
27
|
+
}) => Promise<SvarWindowPage>;
|
|
28
|
+
cancelAll: () => void;
|
|
29
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { onDestroy, untrack } from 'svelte';
|
|
2
|
+
import { SvelteMap } from 'svelte/reactivity';
|
|
3
|
+
import { SvarLoadCancelled } from './svar-grid-loading.js';
|
|
4
|
+
/** Query workers remain descendants of the host AdminContext and QueryClientProvider. */
|
|
5
|
+
export function createSvarResourceReads(options) {
|
|
6
|
+
const requests = new SvelteMap();
|
|
7
|
+
const pending = new Map();
|
|
8
|
+
let sequence = 0;
|
|
9
|
+
let alive = true;
|
|
10
|
+
function cancelAll() { for (const entry of [...pending.values()])
|
|
11
|
+
entry.cancel(); }
|
|
12
|
+
onDestroy(() => { alive = false; cancelAll(); });
|
|
13
|
+
$effect.pre(() => {
|
|
14
|
+
const scope = options.scope();
|
|
15
|
+
const available = options.current(scope);
|
|
16
|
+
untrack(() => {
|
|
17
|
+
for (const entry of [...pending.values()])
|
|
18
|
+
if (!available || entry.scope !== scope)
|
|
19
|
+
entry.cancel();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
async function read(input) {
|
|
23
|
+
const { scope, signal } = input;
|
|
24
|
+
const current = () => alive && !signal.aborted && options.current(scope);
|
|
25
|
+
if (!current())
|
|
26
|
+
throw new SvarLoadCancelled();
|
|
27
|
+
if (!await options.authorize(scope, input.parentId))
|
|
28
|
+
throw new Error('Resource read access denied');
|
|
29
|
+
if (!current())
|
|
30
|
+
throw new SvarLoadCancelled();
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
const id = ++sequence;
|
|
33
|
+
let settled = false;
|
|
34
|
+
const finish = (callback) => {
|
|
35
|
+
if (settled)
|
|
36
|
+
return;
|
|
37
|
+
settled = true;
|
|
38
|
+
signal.removeEventListener('abort', abort);
|
|
39
|
+
pending.delete(id);
|
|
40
|
+
requests.delete(id);
|
|
41
|
+
callback();
|
|
42
|
+
};
|
|
43
|
+
const abort = () => finish(() => reject(new SvarLoadCancelled()));
|
|
44
|
+
pending.set(id, { scope, cancel: abort });
|
|
45
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
46
|
+
if (!current()) {
|
|
47
|
+
abort();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const childrenKey = options.childrenKey();
|
|
51
|
+
requests.set(id, {
|
|
52
|
+
resourceName: options.resourceName(), dataScopeKey: options.dataScopeKey(), primaryKey: options.primaryKey(),
|
|
53
|
+
...(childrenKey === undefined ? {} : { childrenKey }),
|
|
54
|
+
pagination: { ...input.pagination }, filters: input.filters, sorters: input.sorters,
|
|
55
|
+
resolve(page) { finish(() => current() ? resolve(page) : reject(new SvarLoadCancelled())); },
|
|
56
|
+
reject(error) { finish(() => reject(current() ? error : new SvarLoadCancelled())); },
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return { requests, read, cancelAll };
|
|
61
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BaseRecord } from '@svadmin/core';
|
|
2
|
+
export type TableRecord = BaseRecord & {
|
|
3
|
+
id: string | number;
|
|
4
|
+
};
|
|
5
|
+
/** The list hook validates business fields; this adapter proves table identity and detaches UI reads. */
|
|
6
|
+
export declare function copyTableRecord(value: unknown): TableRecord;
|
|
7
|
+
export declare function tableRowKey(id: string | number): string;
|
|
8
|
+
export declare function checkedTableRows(rows: readonly unknown[]): TableRecord[];
|
|
9
|
+
/** Keep distinct display columns and neutralize spreadsheet expressions at this export boundary. */
|
|
10
|
+
export declare function tableExportRows(rows: readonly TableRecord[], fields: readonly {
|
|
11
|
+
key: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}[]): Record<string, unknown>[];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
import { checkExact, decodeBaseRecord, snapshotPlainData, rejectProviderResponse } from '@svadmin/core/schema';
|
|
3
|
+
const recordShape = Type.Intersect([
|
|
4
|
+
Type.Record(Type.String(), Type.Unknown()),
|
|
5
|
+
Type.Object({ id: Type.Union([Type.String(), Type.Number()]) }),
|
|
6
|
+
]);
|
|
7
|
+
/** The list hook validates business fields; this adapter proves table identity and detaches UI reads. */
|
|
8
|
+
export function copyTableRecord(value) {
|
|
9
|
+
const record = decodeBaseRecord(snapshotPlainData(value));
|
|
10
|
+
if (!checkExact(recordShape, record))
|
|
11
|
+
return rejectProviderResponse();
|
|
12
|
+
return record;
|
|
13
|
+
}
|
|
14
|
+
export function tableRowKey(id) {
|
|
15
|
+
return JSON.stringify([typeof id, id]);
|
|
16
|
+
}
|
|
17
|
+
export function checkedTableRows(rows) {
|
|
18
|
+
const records = rows.map(copyTableRecord);
|
|
19
|
+
const keys = new Set(records.map(record => tableRowKey(record.id)));
|
|
20
|
+
if (keys.size !== records.length)
|
|
21
|
+
return rejectProviderResponse();
|
|
22
|
+
return records;
|
|
23
|
+
}
|
|
24
|
+
/** Keep distinct display columns and neutralize spreadsheet expressions at this export boundary. */
|
|
25
|
+
export function tableExportRows(rows, fields) {
|
|
26
|
+
const protect = (value) => typeof value === 'string' && (/^[\t\r\n]/.test(value) || /^\s*[=+@-]/.test(value))
|
|
27
|
+
? `'${value}` : value;
|
|
28
|
+
const used = new Set();
|
|
29
|
+
const columns = fields.map(field => {
|
|
30
|
+
const base = String(protect(field.label));
|
|
31
|
+
let label = base;
|
|
32
|
+
let suffix = 1;
|
|
33
|
+
while (used.has(label))
|
|
34
|
+
label = `${base} (${suffix++})`;
|
|
35
|
+
used.add(label);
|
|
36
|
+
return { key: field.key, label };
|
|
37
|
+
});
|
|
38
|
+
return rows.map(row => {
|
|
39
|
+
const record = copyTableRecord(row);
|
|
40
|
+
return Object.fromEntries(columns.map(column => [column.label, protect(record[column.key] ?? null)]));
|
|
41
|
+
});
|
|
42
|
+
}
|
|
@@ -20,8 +20,10 @@ const STATUS_ALIASES = {
|
|
|
20
20
|
aborted: 'cancelled',
|
|
21
21
|
};
|
|
22
22
|
export function normalizeTaskStatus(status) {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
if (typeof status !== 'string')
|
|
24
|
+
return 'unknown';
|
|
25
|
+
const value = status.trim().toLowerCase();
|
|
26
|
+
return Object.hasOwn(STATUS_ALIASES, value) ? STATUS_ALIASES[value] ?? 'unknown' : 'unknown';
|
|
25
27
|
}
|
|
26
28
|
export function isTaskActive(task) {
|
|
27
29
|
const lifecycle = normalizeTaskStatus(task.status);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export type AlertVariant = "default" | "destructive" | "warning" | "success";
|
|
2
2
|
export declare const alertVariants: ({ variant, class: className, className: extraClassName, }?: {
|
|
3
3
|
variant?: AlertVariant | null;
|
|
4
|
-
class?:
|
|
5
|
-
className?:
|
|
4
|
+
class?: string;
|
|
5
|
+
className?: string;
|
|
6
6
|
}) => string;
|
|
7
|
-
import { clsx } from "cn/engine";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export const alertVariants = ({ variant = "default", class: className = "", className: extraClassName = "", } = {}) =>
|
|
2
|
-
import { clsx } from "cn/engine";
|
|
1
|
+
export const alertVariants = ({ variant = "default", class: className = "", className: extraClassName = "", } = {}) => ["svadmin-alert", variant && `svadmin-alert--${variant}`, className, extraClassName].filter(Boolean).join(" ");
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import { cn, type WithElementRef } from "../../../utils.js";
|
|
3
3
|
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
-
import { alertVariants as
|
|
4
|
+
import { alertVariants as resolveAlertVariants, type AlertVariant as AlertVariantValue } from "./alert-variants.js";
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
export type AlertVariant = Variant;
|
|
6
|
+
export { alertVariants, type AlertVariant } from "./alert-variants.js";
|
|
8
7
|
</script>
|
|
9
8
|
|
|
10
9
|
<script lang="ts">
|
|
11
10
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
12
|
-
variant?:
|
|
11
|
+
variant?: AlertVariantValue;
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
let {
|
|
@@ -26,7 +25,7 @@
|
|
|
26
25
|
data-slot="alert"
|
|
27
26
|
role="alert"
|
|
28
27
|
data-variant={variant}
|
|
29
|
-
class={cn(
|
|
28
|
+
class={cn(resolveAlertVariants({ variant }), className)}
|
|
30
29
|
{...restProps}
|
|
31
30
|
>
|
|
32
31
|
{@render children?.()}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { type WithElementRef } from "../../../utils.js";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
-
import { type AlertVariant as
|
|
4
|
-
export
|
|
5
|
-
variant?: Variant | null;
|
|
6
|
-
class?: Parameters<(...inputs: import("cn").ClassValue[]) => string>[number];
|
|
7
|
-
className?: Parameters<(...inputs: import("cn").ClassValue[]) => string>[number];
|
|
8
|
-
}) => string;
|
|
9
|
-
export type AlertVariant = Variant;
|
|
3
|
+
import { type AlertVariant as AlertVariantValue } from "./alert-variants.js";
|
|
4
|
+
export { alertVariants, type AlertVariant } from "./alert-variants.js";
|
|
10
5
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
11
|
-
variant?:
|
|
6
|
+
variant?: AlertVariantValue;
|
|
12
7
|
};
|
|
13
8
|
declare const Alert: import("svelte").Component<Props, {}, "ref">;
|
|
14
9
|
type Alert = ReturnType<typeof Alert>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export type AvatarSize = "default" | "sm" | "lg" | "xl";
|
|
2
2
|
export declare const avatarVariants: ({ size, class: className, className: extraClassName, }?: {
|
|
3
3
|
size?: AvatarSize | null;
|
|
4
|
-
class?:
|
|
5
|
-
className?:
|
|
4
|
+
class?: string;
|
|
5
|
+
className?: string;
|
|
6
6
|
}) => string;
|
|
7
|
-
import { clsx } from "cn/engine";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export const avatarVariants = ({ size = "default", class: className = "", className: extraClassName = "", } = {}) =>
|
|
2
|
-
import { clsx } from "cn/engine";
|
|
1
|
+
export const avatarVariants = ({ size = "default", class: className = "", className: extraClassName = "", } = {}) => ["svadmin-avatar", size && `svadmin-avatar-size--${size}`, className, extraClassName].filter(Boolean).join(" ");
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import { avatarVariants as
|
|
2
|
+
import { avatarVariants as resolveAvatarVariants, type AvatarSize as AvatarSizeValue } from "./avatar-variants.js";
|
|
3
3
|
|
|
4
|
-
export
|
|
5
|
-
export type AvatarSize = Size;
|
|
4
|
+
export { avatarVariants, type AvatarSize } from "./avatar-variants.js";
|
|
6
5
|
</script>
|
|
7
6
|
|
|
8
7
|
<script lang="ts">
|
|
@@ -10,7 +9,7 @@
|
|
|
10
9
|
import type { HTMLImgAttributes } from "svelte/elements";
|
|
11
10
|
|
|
12
11
|
type Props = WithElementRef<HTMLImgAttributes, HTMLImageElement> & {
|
|
13
|
-
size?:
|
|
12
|
+
size?: AvatarSizeValue;
|
|
14
13
|
fallback?: string;
|
|
15
14
|
};
|
|
16
15
|
|
|
@@ -28,7 +27,7 @@
|
|
|
28
27
|
</script>
|
|
29
28
|
|
|
30
29
|
{#if src && !imgError}
|
|
31
|
-
<span data-size={size} class={cn(
|
|
30
|
+
<span data-size={size} class={cn(resolveAvatarVariants({ size }), className)}>
|
|
32
31
|
<img
|
|
33
32
|
bind:this={ref}
|
|
34
33
|
data-slot="avatar"
|
|
@@ -44,7 +43,7 @@
|
|
|
44
43
|
data-slot="avatar-fallback"
|
|
45
44
|
data-size={size}
|
|
46
45
|
class={cn(
|
|
47
|
-
|
|
46
|
+
resolveAvatarVariants({ size }),
|
|
48
47
|
"svadmin-avatar-fallback",
|
|
49
48
|
className
|
|
50
49
|
)}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { type AvatarSize as
|
|
2
|
-
export
|
|
3
|
-
size?: Size | null;
|
|
4
|
-
class?: Parameters<(...inputs: import("cn").ClassValue[]) => string>[number];
|
|
5
|
-
className?: Parameters<(...inputs: import("cn").ClassValue[]) => string>[number];
|
|
6
|
-
}) => string;
|
|
7
|
-
export type AvatarSize = Size;
|
|
1
|
+
import { type AvatarSize as AvatarSizeValue } from "./avatar-variants.js";
|
|
2
|
+
export { avatarVariants, type AvatarSize } from "./avatar-variants.js";
|
|
8
3
|
import { type WithElementRef } from "../../../utils.js";
|
|
9
4
|
import type { HTMLImgAttributes } from "svelte/elements";
|
|
10
5
|
type Props = WithElementRef<HTMLImgAttributes, HTMLImageElement> & {
|
|
11
|
-
size?:
|
|
6
|
+
size?: AvatarSizeValue;
|
|
12
7
|
fallback?: string;
|
|
13
8
|
};
|
|
14
9
|
declare const Avatar: import("svelte").Component<Props, {}, "ref">;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export type BadgeVariant = "default" | "secondary" | "destructive" | "subtle" | "subtle-success" | "subtle-warning" | "subtle-destructive" | "subtle-pill" | "outline" | "ghost" | "link";
|
|
2
2
|
export declare const badgeVariants: ({ variant, class: className, className: extraClassName, }?: {
|
|
3
3
|
variant?: BadgeVariant | null;
|
|
4
|
-
class?:
|
|
5
|
-
className?:
|
|
4
|
+
class?: string;
|
|
5
|
+
className?: string;
|
|
6
6
|
}) => string;
|
|
7
|
-
import { clsx } from "cn/engine";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { uiBadge } from '../../../styled-system/recipes/index.js';
|
|
2
|
+
export const badgeVariants = ({ variant = "default", class: className = "", className: extraClassName = "", } = {}) => ["svadmin-badge", variant && `svadmin-badge--${variant}`,
|
|
3
|
+
uiBadge(variant ? { variant } : {}), className, extraClassName].filter(Boolean).join(" ");
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import { badgeVariants as
|
|
2
|
+
import { badgeVariants as resolveBadgeVariants, type BadgeVariant as BadgeVariantValue } from "./badge-variants.js";
|
|
3
3
|
|
|
4
|
-
export
|
|
5
|
-
export type BadgeVariant = Variant;
|
|
4
|
+
export { badgeVariants, type BadgeVariant } from "./badge-variants.js";
|
|
6
5
|
</script>
|
|
7
6
|
|
|
8
7
|
<script lang="ts">
|
|
@@ -17,7 +16,7 @@
|
|
|
17
16
|
children,
|
|
18
17
|
...restProps
|
|
19
18
|
}: WithElementRef<HTMLAnchorAttributes> & {
|
|
20
|
-
variant?:
|
|
19
|
+
variant?: BadgeVariantValue;
|
|
21
20
|
} = $props();
|
|
22
21
|
</script>
|
|
23
22
|
|
|
@@ -27,7 +26,7 @@
|
|
|
27
26
|
data-slot="badge"
|
|
28
27
|
data-variant={variant}
|
|
29
28
|
{href}
|
|
30
|
-
class={cn(
|
|
29
|
+
class={cn(resolveBadgeVariants({ variant }), className)}
|
|
31
30
|
{...restProps}
|
|
32
31
|
>
|
|
33
32
|
{@render children?.()}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { type BadgeVariant as
|
|
2
|
-
export
|
|
3
|
-
variant?: Variant | null;
|
|
4
|
-
class?: Parameters<(...inputs: import("cn").ClassValue[]) => string>[number];
|
|
5
|
-
className?: Parameters<(...inputs: import("cn").ClassValue[]) => string>[number];
|
|
6
|
-
}) => string;
|
|
7
|
-
export type BadgeVariant = Variant;
|
|
1
|
+
import { type BadgeVariant as BadgeVariantValue } from "./badge-variants.js";
|
|
2
|
+
export { badgeVariants, type BadgeVariant } from "./badge-variants.js";
|
|
8
3
|
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
9
4
|
import { type WithElementRef } from "../../../utils.js";
|
|
10
5
|
type $$ComponentProps = WithElementRef<HTMLAnchorAttributes> & {
|
|
11
|
-
variant?:
|
|
6
|
+
variant?: BadgeVariantValue;
|
|
12
7
|
};
|
|
13
8
|
declare const Badge: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
14
9
|
type Badge = ReturnType<typeof Badge>;
|
|
@@ -3,7 +3,6 @@ export type ButtonSize = "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "
|
|
|
3
3
|
export declare const buttonVariants: ({ variant, size, class: className, className: extraClassName, }?: {
|
|
4
4
|
variant?: ButtonVariant | null;
|
|
5
5
|
size?: ButtonSize | null;
|
|
6
|
-
class?:
|
|
7
|
-
className?:
|
|
6
|
+
class?: string;
|
|
7
|
+
className?: string;
|
|
8
8
|
}) => string;
|
|
9
|
-
import { clsx } from "cn/engine";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { uiButton } from '../../../styled-system/recipes/index.js';
|
|
2
|
+
// 保留公开 helper、语义标记和 null 行为;样式由预生成 Panda recipe 提供。
|
|
3
|
+
export const buttonVariants = ({ variant = "default", size = "default", class: className = "", className: extraClassName = "", } = {}) => ["svadmin-button", variant && `svadmin-button--${variant}`, size && `svadmin-button-size--${size}`,
|
|
4
|
+
uiButton({ ...(variant ? { variant } : {}), ...(size ? { size } : {}) }),
|
|
5
|
+
className, extraClassName].filter(Boolean).join(" ");
|