@h-ai/ui 0.1.0-alpha.29 → 0.1.0-alpha.31
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 +50 -3
- package/dist/components/compounds/Accordion.svelte +6 -3
- package/dist/components/compounds/Accordion.svelte.d.ts +3 -1
- package/dist/components/compounds/ActionSheet.svelte +11 -8
- package/dist/components/compounds/ActionSheet.svelte.d.ts +3 -1
- package/dist/components/compounds/Alert.svelte +6 -4
- package/dist/components/compounds/Alert.svelte.d.ts +3 -2
- package/dist/components/compounds/AppBar.svelte +13 -9
- package/dist/components/compounds/AppBar.svelte.d.ts +3 -1
- package/dist/components/compounds/BottomNav.svelte +13 -10
- package/dist/components/compounds/BottomNav.svelte.d.ts +3 -1
- package/dist/components/compounds/Breadcrumb.svelte +6 -4
- package/dist/components/compounds/Breadcrumb.svelte.d.ts +3 -2
- package/dist/components/compounds/Calendar.svelte +7 -2
- package/dist/components/compounds/Calendar.svelte.d.ts +3 -1
- package/dist/components/compounds/Card.svelte +6 -4
- package/dist/components/compounds/Card.svelte.d.ts +3 -2
- package/dist/components/compounds/Combobox.svelte +6 -2
- package/dist/components/compounds/Combobox.svelte.d.ts +3 -1
- package/dist/components/compounds/Confirm.svelte +9 -7
- package/dist/components/compounds/Confirm.svelte.d.ts +3 -2
- package/dist/components/compounds/DataTable.svelte +6 -2
- package/dist/components/compounds/DataTable.svelte.d.ts +2 -1
- package/dist/components/compounds/DatePicker.svelte +7 -2
- package/dist/components/compounds/DatePicker.svelte.d.ts +3 -1
- package/dist/components/compounds/Drawer.svelte +6 -4
- package/dist/components/compounds/Drawer.svelte.d.ts +3 -2
- package/dist/components/compounds/Dropdown.svelte +6 -4
- package/dist/components/compounds/Dropdown.svelte.d.ts +3 -2
- package/dist/components/compounds/Empty.svelte +6 -4
- package/dist/components/compounds/Empty.svelte.d.ts +3 -2
- package/dist/components/compounds/Form.svelte +11 -9
- package/dist/components/compounds/Form.svelte.d.ts +3 -2
- package/dist/components/compounds/FormField.svelte +6 -4
- package/dist/components/compounds/FormField.svelte.d.ts +3 -2
- package/dist/components/compounds/InfiniteScroll.svelte +10 -7
- package/dist/components/compounds/InfiniteScroll.svelte.d.ts +3 -1
- package/dist/components/compounds/MessageBoxContainer.svelte +6 -1
- package/dist/components/compounds/MessageBoxContainer.svelte.d.ts +3 -17
- package/dist/components/compounds/MessageBoxDialog.svelte +9 -7
- package/dist/components/compounds/MessageBoxDialog.svelte.d.ts +2 -1
- package/dist/components/compounds/MessageContainer.svelte +43 -66
- package/dist/components/compounds/MessageContainer.svelte.d.ts +2 -1
- package/dist/components/compounds/Modal.svelte +29 -43
- package/dist/components/compounds/Modal.svelte.d.ts +3 -2
- package/dist/components/compounds/PageHeader.svelte +6 -2
- package/dist/components/compounds/PageHeader.svelte.d.ts +3 -1
- package/dist/components/compounds/Pagination.svelte +6 -4
- package/dist/components/compounds/Pagination.svelte.d.ts +3 -2
- package/dist/components/compounds/Popover.svelte +10 -8
- package/dist/components/compounds/Popover.svelte.d.ts +3 -2
- package/dist/components/compounds/PullRefresh.svelte +11 -8
- package/dist/components/compounds/PullRefresh.svelte.d.ts +3 -1
- package/dist/components/compounds/Result.svelte +6 -4
- package/dist/components/compounds/Result.svelte.d.ts +3 -2
- package/dist/components/compounds/SafeArea.svelte +6 -3
- package/dist/components/compounds/SafeArea.svelte.d.ts +3 -1
- package/dist/components/compounds/Skeleton.svelte +6 -4
- package/dist/components/compounds/Skeleton.svelte.d.ts +3 -2
- package/dist/components/compounds/Steps.svelte +6 -4
- package/dist/components/compounds/Steps.svelte.d.ts +3 -2
- package/dist/components/compounds/SwipeCell.svelte +6 -3
- package/dist/components/compounds/SwipeCell.svelte.d.ts +3 -1
- package/dist/components/compounds/Tabs.svelte +6 -4
- package/dist/components/compounds/Tabs.svelte.d.ts +3 -2
- package/dist/components/compounds/TagInput.svelte +11 -9
- package/dist/components/compounds/TagInput.svelte.d.ts +3 -2
- package/dist/components/compounds/Timeline.svelte +6 -3
- package/dist/components/compounds/Timeline.svelte.d.ts +3 -1
- package/dist/components/compounds/ToastContainer.svelte +6 -2
- package/dist/components/compounds/ToastContainer.svelte.d.ts +2 -1
- package/dist/components/compounds/Tooltip.svelte +6 -4
- package/dist/components/compounds/Tooltip.svelte.d.ts +3 -2
- package/dist/components/primitives/Avatar.svelte +6 -4
- package/dist/components/primitives/Avatar.svelte.d.ts +3 -2
- package/dist/components/primitives/Badge.svelte +6 -4
- package/dist/components/primitives/Badge.svelte.d.ts +3 -2
- package/dist/components/primitives/BareButton.svelte +15 -12
- package/dist/components/primitives/BareButton.svelte.d.ts +3 -2
- package/dist/components/primitives/BareInput.svelte +37 -34
- package/dist/components/primitives/BareInput.svelte.d.ts +3 -2
- package/dist/components/primitives/Button.svelte +12 -10
- package/dist/components/primitives/Button.svelte.d.ts +3 -2
- package/dist/components/primitives/Checkbox.svelte +6 -4
- package/dist/components/primitives/Checkbox.svelte.d.ts +3 -2
- package/dist/components/primitives/IconButton.svelte +6 -4
- package/dist/components/primitives/IconButton.svelte.d.ts +3 -2
- package/dist/components/primitives/Input.svelte +6 -4
- package/dist/components/primitives/Input.svelte.d.ts +3 -2
- package/dist/components/primitives/Progress.svelte +6 -4
- package/dist/components/primitives/Progress.svelte.d.ts +3 -2
- package/dist/components/primitives/Radio.svelte +6 -4
- package/dist/components/primitives/Radio.svelte.d.ts +2 -2
- package/dist/components/primitives/Range.svelte +6 -3
- package/dist/components/primitives/Range.svelte.d.ts +3 -1
- package/dist/components/primitives/Rating.svelte +6 -3
- package/dist/components/primitives/Rating.svelte.d.ts +3 -1
- package/dist/components/primitives/Select.svelte +255 -48
- package/dist/components/primitives/Select.svelte.d.ts +2 -2
- package/dist/components/primitives/Spinner.svelte +6 -4
- package/dist/components/primitives/Spinner.svelte.d.ts +3 -2
- package/dist/components/primitives/Switch.svelte +6 -4
- package/dist/components/primitives/Switch.svelte.d.ts +3 -2
- package/dist/components/primitives/Tag.svelte +6 -4
- package/dist/components/primitives/Tag.svelte.d.ts +3 -2
- package/dist/components/primitives/Textarea.svelte +34 -19
- package/dist/components/primitives/Textarea.svelte.d.ts +3 -2
- package/dist/components/primitives/ToggleCheckbox.svelte +13 -10
- package/dist/components/primitives/ToggleCheckbox.svelte.d.ts +3 -2
- package/dist/components/primitives/ToggleInput.svelte +13 -10
- package/dist/components/primitives/ToggleInput.svelte.d.ts +3 -2
- package/dist/components/primitives/ToggleRadio.svelte +13 -10
- package/dist/components/primitives/ToggleRadio.svelte.d.ts +3 -2
- package/dist/components/scenes/ai/AiDocumentDownloadMenu.svelte +8 -5
- package/dist/components/scenes/ai/AiDocumentDownloadMenu.svelte.d.ts +3 -1
- package/dist/components/scenes/ai/AiDocumentEditor.svelte +40 -10
- package/dist/components/scenes/ai/AiDocumentEditor.svelte.d.ts +3 -1
- package/dist/components/scenes/ai/MarkdownRenderer.svelte +49 -7
- package/dist/components/scenes/ai/MarkdownRenderer.svelte.d.ts +3 -1
- package/dist/components/scenes/ai/document-parse.d.ts +2 -0
- package/dist/components/scenes/ai/document-parse.js +16 -17
- package/dist/components/scenes/ai/document-types.d.ts +6 -1
- package/dist/components/scenes/ai/markdown-parse.d.ts +2 -0
- package/dist/components/scenes/ai/markdown-parse.js +17 -20
- package/dist/components/scenes/ai/safe-html.d.ts +16 -0
- package/dist/components/scenes/ai/safe-html.js +284 -0
- package/dist/components/scenes/ai/table/AiTableEditor.svelte +6 -3
- package/dist/components/scenes/ai/table/AiTableEditor.svelte.d.ts +3 -1
- package/dist/components/scenes/ai/table/table-types.d.ts +2 -1
- package/dist/components/scenes/app/FeedbackModal.svelte +5 -2
- package/dist/components/scenes/app/FeedbackModal.svelte.d.ts +3 -1
- package/dist/components/scenes/app/LanguageSwitch.svelte +6 -2
- package/dist/components/scenes/app/LanguageSwitch.svelte.d.ts +3 -1
- package/dist/components/scenes/app/SettingsLayout.svelte +6 -3
- package/dist/components/scenes/app/SettingsLayout.svelte.d.ts +2 -1
- package/dist/components/scenes/app/SettingsModal.svelte +6 -3
- package/dist/components/scenes/app/SettingsModal.svelte.d.ts +3 -1
- package/dist/components/scenes/app/ThemeColorPicker.svelte +6 -3
- package/dist/components/scenes/app/ThemeColorPicker.svelte.d.ts +3 -1
- package/dist/components/scenes/app/ThemeSelector.svelte +6 -3
- package/dist/components/scenes/app/ThemeSelector.svelte.d.ts +3 -1
- package/dist/components/scenes/app/ThemeToggle.svelte +6 -2
- package/dist/components/scenes/app/ThemeToggle.svelte.d.ts +3 -1
- package/dist/components/scenes/crud/CrudDeleteConfirm.svelte +16 -11
- package/dist/components/scenes/crud/CrudDeleteConfirm.svelte.d.ts +2 -1
- package/dist/components/scenes/crud/CrudDetailDrawer.svelte +6 -3
- package/dist/components/scenes/crud/CrudDetailDrawer.svelte.d.ts +2 -2
- package/dist/components/scenes/crud/CrudDetailPanel.svelte +6 -3
- package/dist/components/scenes/crud/CrudDetailPanel.svelte.d.ts +2 -2
- package/dist/components/scenes/crud/CrudEditPanel.svelte +6 -3
- package/dist/components/scenes/crud/CrudEditPanel.svelte.d.ts +2 -2
- package/dist/components/scenes/crud/CrudFilterBar.svelte +6 -2
- package/dist/components/scenes/crud/CrudFilterBar.svelte.d.ts +2 -1
- package/dist/components/scenes/crud/CrudPage.svelte +6 -2
- package/dist/components/scenes/crud/CrudPage.svelte.d.ts +2 -1
- package/dist/components/scenes/crud/crud-types.d.ts +2 -2
- package/dist/components/scenes/crypto/EncryptedInput.svelte +6 -3
- package/dist/components/scenes/crypto/EncryptedInput.svelte.d.ts +3 -2
- package/dist/components/scenes/crypto/HashDisplay.svelte +6 -3
- package/dist/components/scenes/crypto/HashDisplay.svelte.d.ts +3 -1
- package/dist/components/scenes/crypto/SignatureDisplay.svelte +6 -3
- package/dist/components/scenes/crypto/SignatureDisplay.svelte.d.ts +3 -1
- package/dist/components/scenes/error/ErrorPage.svelte +6 -3
- package/dist/components/scenes/error/ErrorPage.svelte.d.ts +2 -1
- package/dist/components/scenes/iam/AuthShell.svelte +6 -3
- package/dist/components/scenes/iam/AuthShell.svelte.d.ts +2 -1
- package/dist/components/scenes/iam/ChangePasswordForm.svelte +6 -3
- package/dist/components/scenes/iam/ChangePasswordForm.svelte.d.ts +3 -1
- package/dist/components/scenes/iam/ForgotPasswordForm.svelte +6 -3
- package/dist/components/scenes/iam/ForgotPasswordForm.svelte.d.ts +3 -1
- package/dist/components/scenes/iam/LoginForm.svelte +6 -3
- package/dist/components/scenes/iam/LoginForm.svelte.d.ts +3 -1
- package/dist/components/scenes/iam/PasswordInput.svelte +6 -4
- package/dist/components/scenes/iam/PasswordInput.svelte.d.ts +3 -2
- package/dist/components/scenes/iam/RegisterForm.svelte +6 -4
- package/dist/components/scenes/iam/RegisterForm.svelte.d.ts +3 -1
- package/dist/components/scenes/iam/ResetPasswordForm.svelte +6 -3
- package/dist/components/scenes/iam/ResetPasswordForm.svelte.d.ts +3 -1
- package/dist/components/scenes/iam/UserProfile.svelte +6 -3
- package/dist/components/scenes/iam/UserProfile.svelte.d.ts +3 -1
- package/dist/components/scenes/storage/AvatarUpload.svelte +11 -8
- package/dist/components/scenes/storage/AvatarUpload.svelte.d.ts +3 -1
- package/dist/components/scenes/storage/FileList.svelte +6 -3
- package/dist/components/scenes/storage/FileList.svelte.d.ts +3 -1
- package/dist/components/scenes/storage/FileUpload.svelte +6 -3
- package/dist/components/scenes/storage/FileUpload.svelte.d.ts +3 -1
- package/dist/components/scenes/storage/ImageUpload.svelte +12 -9
- package/dist/components/scenes/storage/ImageUpload.svelte.d.ts +3 -1
- package/dist/components/scenes/types.d.ts +20 -16
- package/dist/styles/global.css +5 -0
- package/dist/types.d.ts +48 -41
- package/dist/utils.d.ts +6 -1
- package/dist/utils.js +16 -1
- package/package.json +2 -2
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
-->
|
|
23
23
|
<script lang='ts'>
|
|
24
24
|
import type { DateValue } from '@internationalized/date'
|
|
25
|
+
import type { DataAttributes } from '../../types.js'
|
|
25
26
|
import { DatePicker as BitsDatePicker } from 'bits-ui'
|
|
27
|
+
import { getDataAttributes } from '../../utils.js'
|
|
26
28
|
|
|
27
29
|
interface Props {
|
|
28
30
|
/** 选中日期(双向绑定) */
|
|
@@ -55,10 +57,13 @@
|
|
|
55
57
|
error,
|
|
56
58
|
class: className = '',
|
|
57
59
|
onchange,
|
|
58
|
-
|
|
60
|
+
...restProps
|
|
61
|
+
}: Props & DataAttributes = $props()
|
|
62
|
+
|
|
63
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
59
64
|
</script>
|
|
60
65
|
|
|
61
|
-
<div class='fieldset w-full {className}'>
|
|
66
|
+
<div {...dataAttributes} class='fieldset w-full {className}'>
|
|
62
67
|
<BitsDatePicker.Root
|
|
63
68
|
bind:value
|
|
64
69
|
{minValue}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DateValue } from '@internationalized/date';
|
|
2
|
+
import type { DataAttributes } from '../../types.js';
|
|
2
3
|
interface Props {
|
|
3
4
|
/** 选中日期(双向绑定) */
|
|
4
5
|
value?: DateValue;
|
|
@@ -19,6 +20,7 @@ interface Props {
|
|
|
19
20
|
/** 日期变更回调 */
|
|
20
21
|
onchange?: (value: DateValue | undefined) => void;
|
|
21
22
|
}
|
|
23
|
+
type $$ComponentProps = Props & DataAttributes;
|
|
22
24
|
/**
|
|
23
25
|
* DatePicker
|
|
24
26
|
* 日期选择器组件,基于 Bits UI headless + DaisyUI 样式。
|
|
@@ -41,6 +43,6 @@ interface Props {
|
|
|
41
43
|
* <DatePicker bind:value={date} />
|
|
42
44
|
* ```
|
|
43
45
|
*/
|
|
44
|
-
declare const DatePicker: import("svelte").Component
|
|
46
|
+
declare const DatePicker: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
45
47
|
type DatePicker = ReturnType<typeof DatePicker>;
|
|
46
48
|
export default DatePicker;
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
=============================================================================
|
|
10
10
|
-->
|
|
11
11
|
<script lang='ts'>
|
|
12
|
-
import type { DrawerProps } from '../../types.js'
|
|
12
|
+
import type { DataAttributes, DrawerProps } from '../../types.js'
|
|
13
13
|
import { uiM } from '../../messages.js'
|
|
14
|
-
import { cn, generateId } from '../../utils.js'
|
|
14
|
+
import { cn, generateId, getDataAttributes } from '../../utils.js'
|
|
15
15
|
import IconButton from '../primitives/IconButton.svelte'
|
|
16
16
|
import ToggleCheckbox from '../primitives/ToggleCheckbox.svelte'
|
|
17
17
|
|
|
@@ -26,8 +26,10 @@
|
|
|
26
26
|
class: className = '',
|
|
27
27
|
onclose,
|
|
28
28
|
children,
|
|
29
|
-
|
|
29
|
+
...restProps
|
|
30
|
+
}: DrawerProps & DataAttributes = $props()
|
|
30
31
|
|
|
32
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
31
33
|
const id = generateId('drawer')
|
|
32
34
|
|
|
33
35
|
const sizeMap = {
|
|
@@ -78,7 +80,7 @@
|
|
|
78
80
|
}
|
|
79
81
|
</script>
|
|
80
82
|
|
|
81
|
-
<div class={drawerClass}>
|
|
83
|
+
<div {...dataAttributes} class={drawerClass}>
|
|
82
84
|
<ToggleCheckbox {id} class='drawer-toggle' bind:checked={open} />
|
|
83
85
|
|
|
84
86
|
<div class={sideClass}>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { DrawerProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, DrawerProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = DrawerProps & DataAttributes;
|
|
3
|
+
declare const Drawer: import("svelte").Component<$$ComponentProps, {}, "open">;
|
|
3
4
|
type Drawer = ReturnType<typeof Drawer>;
|
|
4
5
|
export default Drawer;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
下拉菜单组件,支持 click/hover 触发。
|
|
4
4
|
-->
|
|
5
5
|
<script lang='ts'>
|
|
6
|
-
import type { DropdownProps } from '../../types.js'
|
|
7
|
-
import { cn } from '../../utils.js'
|
|
6
|
+
import type { DataAttributes, DropdownProps } from '../../types.js'
|
|
7
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
8
8
|
import BareButton from '../primitives/BareButton.svelte'
|
|
9
9
|
|
|
10
10
|
const {
|
|
@@ -15,8 +15,10 @@
|
|
|
15
15
|
class: className = '',
|
|
16
16
|
onselect,
|
|
17
17
|
children,
|
|
18
|
-
|
|
18
|
+
...restProps
|
|
19
|
+
}: DropdownProps & DataAttributes = $props()
|
|
19
20
|
|
|
21
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
20
22
|
let isOpen = $state(false)
|
|
21
23
|
|
|
22
24
|
const positionMap = {
|
|
@@ -55,7 +57,7 @@
|
|
|
55
57
|
}
|
|
56
58
|
</script>
|
|
57
59
|
|
|
58
|
-
<div class={dropdownClass}>
|
|
60
|
+
<div {...dataAttributes} class={dropdownClass}>
|
|
59
61
|
<BareButton
|
|
60
62
|
tabindex={0}
|
|
61
63
|
role='button'
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { DropdownProps } from '../../types.js';
|
|
1
|
+
import type { DataAttributes, DropdownProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = DropdownProps & DataAttributes;
|
|
2
3
|
/**
|
|
3
4
|
* Dropdown
|
|
4
5
|
* 下拉菜单组件,支持 click/hover 触发。
|
|
5
6
|
*/
|
|
6
|
-
declare const Dropdown: import("svelte").Component
|
|
7
|
+
declare const Dropdown: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
8
|
type Dropdown = ReturnType<typeof Dropdown>;
|
|
8
9
|
export default Dropdown;
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts'>
|
|
11
|
-
import type { EmptyProps } from '../../types.js'
|
|
11
|
+
import type { DataAttributes, EmptyProps } from '../../types.js'
|
|
12
12
|
import { uiM } from '../../messages.js'
|
|
13
|
-
import { cn } from '../../utils.js'
|
|
13
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
14
14
|
|
|
15
15
|
const {
|
|
16
16
|
title,
|
|
@@ -20,8 +20,10 @@
|
|
|
20
20
|
class: className = '',
|
|
21
21
|
action,
|
|
22
22
|
children,
|
|
23
|
-
|
|
23
|
+
...restProps
|
|
24
|
+
}: EmptyProps & DataAttributes = $props()
|
|
24
25
|
|
|
26
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
25
27
|
const displayTitle = $derived(title ?? uiM('empty_title'))
|
|
26
28
|
|
|
27
29
|
const containerClass = $derived(
|
|
@@ -42,7 +44,7 @@
|
|
|
42
44
|
)
|
|
43
45
|
</script>
|
|
44
46
|
|
|
45
|
-
<div class={containerClass}>
|
|
47
|
+
<div {...dataAttributes} class={containerClass}>
|
|
46
48
|
<!-- 图标区域 -->
|
|
47
49
|
<div class='text-base-content/30 mb-4 {iconSize}'>
|
|
48
50
|
{#if children}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { EmptyProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, EmptyProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = EmptyProps & DataAttributes;
|
|
3
|
+
declare const Empty: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
3
4
|
type Empty = ReturnType<typeof Empty>;
|
|
4
5
|
export default Empty;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts'>
|
|
11
|
-
import type { FormProps } from '../../types.js'
|
|
12
|
-
import { cn } from '../../utils.js'
|
|
11
|
+
import type { DataAttributes, FormProps } from '../../types.js'
|
|
12
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
13
13
|
|
|
14
14
|
const {
|
|
15
15
|
id = '',
|
|
@@ -20,8 +20,10 @@
|
|
|
20
20
|
onreset,
|
|
21
21
|
onerror,
|
|
22
22
|
children,
|
|
23
|
-
|
|
23
|
+
...restProps
|
|
24
|
+
}: FormProps & DataAttributes = $props()
|
|
24
25
|
|
|
26
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
25
27
|
let formElement: HTMLFormElement
|
|
26
28
|
|
|
27
29
|
const formClass = $derived(
|
|
@@ -85,12 +87,12 @@
|
|
|
85
87
|
}
|
|
86
88
|
</script>
|
|
87
89
|
|
|
88
|
-
<form
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
<form {...dataAttributes}
|
|
91
|
+
bind:this={formElement}
|
|
92
|
+
id={id || undefined}
|
|
93
|
+
class={formClass}
|
|
94
|
+
onsubmit={handleSubmit}
|
|
95
|
+
onreset={handleReset}
|
|
94
96
|
>
|
|
95
97
|
{#if children}
|
|
96
98
|
{@render children()}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { FormProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, FormProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = FormProps & DataAttributes;
|
|
3
|
+
declare const Form: import("svelte").Component<$$ComponentProps, {
|
|
3
4
|
reset: () => void;
|
|
4
5
|
getData: () => Record<string, unknown>;
|
|
5
6
|
}, "">;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts'>
|
|
11
|
-
import type { FormFieldProps } from '../../types.js'
|
|
12
|
-
import { cn } from '../../utils.js'
|
|
11
|
+
import type { DataAttributes, FormFieldProps } from '../../types.js'
|
|
12
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
13
13
|
|
|
14
14
|
const {
|
|
15
15
|
label = '',
|
|
@@ -18,8 +18,10 @@
|
|
|
18
18
|
required = false,
|
|
19
19
|
class: className = '',
|
|
20
20
|
children,
|
|
21
|
-
|
|
21
|
+
...restProps
|
|
22
|
+
}: FormFieldProps & DataAttributes = $props()
|
|
22
23
|
|
|
24
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
23
25
|
const fieldClass = $derived(
|
|
24
26
|
cn(
|
|
25
27
|
'fieldset w-full',
|
|
@@ -28,7 +30,7 @@
|
|
|
28
30
|
)
|
|
29
31
|
</script>
|
|
30
32
|
|
|
31
|
-
<div class={fieldClass}>
|
|
33
|
+
<div {...dataAttributes} class={fieldClass}>
|
|
32
34
|
{#if label}
|
|
33
35
|
<legend class='fieldset-legend'>
|
|
34
36
|
{label}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { FormFieldProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, FormFieldProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = FormFieldProps & DataAttributes;
|
|
3
|
+
declare const FormField: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
3
4
|
type FormField = ReturnType<typeof FormField>;
|
|
4
5
|
export default FormField;
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<script lang='ts'>
|
|
12
12
|
import type { Snippet } from 'svelte'
|
|
13
|
-
import {
|
|
13
|
+
import type { DataAttributes } from '../../types.js'
|
|
14
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
14
15
|
|
|
15
16
|
interface Props {
|
|
16
17
|
/** 加载更多回调 */
|
|
@@ -40,8 +41,10 @@
|
|
|
40
41
|
noMoreText = 'No more data',
|
|
41
42
|
class: className,
|
|
42
43
|
children,
|
|
43
|
-
|
|
44
|
+
...restProps
|
|
45
|
+
}: Props & DataAttributes = $props()
|
|
44
46
|
|
|
47
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
45
48
|
let loading = $state(false)
|
|
46
49
|
let containerRef: HTMLDivElement | undefined = $state()
|
|
47
50
|
|
|
@@ -62,11 +65,11 @@
|
|
|
62
65
|
}
|
|
63
66
|
</script>
|
|
64
67
|
|
|
65
|
-
<div
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
<div {...dataAttributes}
|
|
69
|
+
bind:this={containerRef}
|
|
70
|
+
class={cn('overflow-y-auto', className)}
|
|
71
|
+
onscroll={checkAndLoad}
|
|
72
|
+
role='feed'
|
|
70
73
|
>
|
|
71
74
|
{@render children()}
|
|
72
75
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { DataAttributes } from '../../types.js';
|
|
2
3
|
interface Props {
|
|
3
4
|
/** 加载更多回调 */
|
|
4
5
|
onloadmore?: () => Promise<void>;
|
|
@@ -17,6 +18,7 @@ interface Props {
|
|
|
17
18
|
/** 列表内容 */
|
|
18
19
|
children: Snippet;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
type $$ComponentProps = Props & DataAttributes;
|
|
22
|
+
declare const InfiniteScroll: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
21
23
|
type InfiniteScroll = ReturnType<typeof InfiniteScroll>;
|
|
22
24
|
export default InfiniteScroll;
|
|
@@ -9,10 +9,15 @@
|
|
|
9
9
|
=============================================================================
|
|
10
10
|
-->
|
|
11
11
|
<script lang='ts'>
|
|
12
|
+
import type { DataAttributes } from '../../types.js'
|
|
12
13
|
import { messageBox } from '../../messagebox.svelte.js'
|
|
14
|
+
import { getDataAttributes } from '../../utils.js'
|
|
13
15
|
import MessageBoxDialog from './MessageBoxDialog.svelte'
|
|
16
|
+
|
|
17
|
+
const { ...restProps }: DataAttributes = $props()
|
|
18
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
14
19
|
</script>
|
|
15
20
|
|
|
16
21
|
{#each messageBox.items as item (item.id)}
|
|
17
|
-
<MessageBoxDialog {item} />
|
|
22
|
+
<MessageBoxDialog {...dataAttributes} {item} />
|
|
18
23
|
{/each}
|
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const MessageBoxContainer: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
-
[evt: string]: CustomEvent<any>;
|
|
16
|
-
}, {}, {}, string>;
|
|
17
|
-
type MessageBoxContainer = InstanceType<typeof MessageBoxContainer>;
|
|
1
|
+
import type { DataAttributes } from '../../types.js';
|
|
2
|
+
declare const MessageBoxContainer: import("svelte").Component<DataAttributes, {}, "">;
|
|
3
|
+
type MessageBoxContainer = ReturnType<typeof MessageBoxContainer>;
|
|
18
4
|
export default MessageBoxContainer;
|
|
@@ -7,13 +7,15 @@
|
|
|
7
7
|
-->
|
|
8
8
|
<script lang='ts'>
|
|
9
9
|
import type { MessageBoxItem } from '../../messagebox.svelte.js'
|
|
10
|
+
import type { DataAttributes } from '../../types.js'
|
|
10
11
|
import { messageBox } from '../../messagebox.svelte.js'
|
|
11
12
|
import { uiM } from '../../messages.js'
|
|
12
|
-
import { cn } from '../../utils.js'
|
|
13
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
13
14
|
import Button from '../primitives/Button.svelte'
|
|
14
15
|
|
|
15
|
-
const { item }: { item: MessageBoxItem } = $props()
|
|
16
|
+
const { item, ...restProps }: { item: MessageBoxItem } & DataAttributes = $props()
|
|
16
17
|
|
|
18
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
17
19
|
/** 图标类型到 tabler icon 的映射 */
|
|
18
20
|
const iconMap: Record<string, string> = {
|
|
19
21
|
info: 'icon-[tabler--info-circle]',
|
|
@@ -46,11 +48,11 @@
|
|
|
46
48
|
</script>
|
|
47
49
|
|
|
48
50
|
<!-- 使用 hai-messagebox 而非 DaisyUI .modal,避免 ::backdrop 被隐藏 -->
|
|
49
|
-
<dialog
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
<dialog {...dataAttributes}
|
|
52
|
+
bind:this={dialogEl}
|
|
53
|
+
class='hai-messagebox'
|
|
54
|
+
oncancel={e => e.preventDefault()}
|
|
55
|
+
onclick={handleBackdropClick}
|
|
54
56
|
>
|
|
55
57
|
<div class='hai-messagebox__panel'>
|
|
56
58
|
<!-- 标题栏:始终显示,右侧关闭按钮 -->
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { MessageBoxItem } from '../../messagebox.svelte.js';
|
|
2
|
+
import type { DataAttributes } from '../../types.js';
|
|
2
3
|
type $$ComponentProps = {
|
|
3
4
|
item: MessageBoxItem;
|
|
4
|
-
};
|
|
5
|
+
} & DataAttributes;
|
|
5
6
|
declare const MessageBoxDialog: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
7
|
type MessageBoxDialog = ReturnType<typeof MessageBoxDialog>;
|
|
7
8
|
export default MessageBoxDialog;
|
|
@@ -5,17 +5,19 @@
|
|
|
5
5
|
轻量消息提示容器,渲染 message store 中的消息条目。
|
|
6
6
|
视觉风格:顶部居中、带类型图标、自动滑入滑出。
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
- 有打开的 modal dialog 时,寄宿到 dialog 内部(top layer);
|
|
10
|
-
- 否则寄宿到 <body> 以 popover 进入 top layer。
|
|
8
|
+
叠加策略:消息层始终挂载到 `document.body`,使用 fixed overlay + 超高 z-index(高于 Modal 的 `--hai-z-modal`),保证不被任何弹层遮挡;空消息时隐藏容器避免拦截交互。
|
|
11
9
|
=============================================================================
|
|
12
10
|
-->
|
|
13
11
|
<script lang='ts'>
|
|
12
|
+
import type { DataAttributes } from '../../types.js'
|
|
14
13
|
import { onMount } from 'svelte'
|
|
15
14
|
import { message } from '../../message.svelte.js'
|
|
16
|
-
import { cn } from '../../utils.js'
|
|
15
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
17
16
|
import IconButton from '../primitives/IconButton.svelte'
|
|
18
17
|
|
|
18
|
+
const { ...restProps }: DataAttributes = $props()
|
|
19
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
20
|
+
|
|
19
21
|
/** 图标类型到 tabler icon 的映射 */
|
|
20
22
|
const iconMap: Record<string, string> = {
|
|
21
23
|
info: 'icon-[tabler--info-circle]',
|
|
@@ -32,84 +34,61 @@
|
|
|
32
34
|
error: 'text-error',
|
|
33
35
|
}
|
|
34
36
|
|
|
37
|
+
/** 文案颜色映射 */
|
|
38
|
+
const textColorMap: Record<string, string> = {
|
|
39
|
+
info: 'text-info',
|
|
40
|
+
success: 'text-success',
|
|
41
|
+
warning: 'text-warning',
|
|
42
|
+
error: 'text-error',
|
|
43
|
+
}
|
|
44
|
+
|
|
35
45
|
/** 背景/边框映射 */
|
|
36
46
|
const bgMap: Record<string, string> = {
|
|
37
|
-
info: 'border-info/
|
|
38
|
-
success: 'border-success/
|
|
39
|
-
warning: 'border-warning/
|
|
40
|
-
error: 'border-error/
|
|
47
|
+
info: 'border-info/30 bg-info/15',
|
|
48
|
+
success: 'border-success/30 bg-success/15',
|
|
49
|
+
warning: 'border-warning/30 bg-warning/15',
|
|
50
|
+
error: 'border-error/30 bg-error/15',
|
|
41
51
|
}
|
|
42
52
|
|
|
43
53
|
let layerElement: HTMLDivElement | undefined = $state()
|
|
44
|
-
|
|
45
54
|
const hasItems = $derived(message.items.length > 0)
|
|
46
55
|
|
|
47
|
-
/** 找到最顶层处于打开状态的原生 modal dialog。 */
|
|
48
|
-
function findTopModalDialog(): HTMLDialogElement | null {
|
|
49
|
-
if (typeof document === 'undefined')
|
|
50
|
-
return null
|
|
51
|
-
const dialogs = document.querySelectorAll<HTMLDialogElement>('dialog')
|
|
52
|
-
let top: HTMLDialogElement | null = null
|
|
53
|
-
for (const dialog of dialogs) {
|
|
54
|
-
if (dialog.open && typeof dialog.matches === 'function' && dialog.matches(':modal')) {
|
|
55
|
-
top = dialog
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return top
|
|
59
|
-
}
|
|
60
|
-
|
|
61
56
|
function safeShowPopover(el: HTMLElement) {
|
|
62
57
|
try {
|
|
63
|
-
if (typeof el.showPopover === 'function' && el.isConnected && !el.matches(':popover-open'))
|
|
58
|
+
if (typeof el.showPopover === 'function' && el.isConnected && !el.matches(':popover-open'))
|
|
64
59
|
el.showPopover()
|
|
65
|
-
}
|
|
66
60
|
}
|
|
67
|
-
catch {
|
|
61
|
+
catch {
|
|
62
|
+
// 元素未连接或重复调用时忽略。
|
|
63
|
+
}
|
|
68
64
|
}
|
|
69
65
|
|
|
70
66
|
function safeHidePopover(el: HTMLElement) {
|
|
71
67
|
try {
|
|
72
|
-
if (typeof el.hidePopover === 'function' && el.matches(':popover-open'))
|
|
68
|
+
if (typeof el.hidePopover === 'function' && el.matches(':popover-open'))
|
|
73
69
|
el.hidePopover()
|
|
74
|
-
}
|
|
75
70
|
}
|
|
76
|
-
catch {
|
|
71
|
+
catch {
|
|
72
|
+
// 同上,忽略异常。
|
|
73
|
+
}
|
|
77
74
|
}
|
|
78
75
|
|
|
79
|
-
|
|
76
|
+
$effect(() => {
|
|
80
77
|
const el = layerElement
|
|
81
78
|
if (!el)
|
|
82
79
|
return
|
|
83
|
-
|
|
84
|
-
const modal = hasItems ? findTopModalDialog() : null
|
|
85
|
-
|
|
86
|
-
if (modal) {
|
|
87
|
-
safeHidePopover(el)
|
|
88
|
-
if (el.hasAttribute('popover'))
|
|
89
|
-
el.removeAttribute('popover')
|
|
90
|
-
if (el.parentElement !== modal)
|
|
91
|
-
modal.appendChild(el)
|
|
92
|
-
return
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (el.parentElement !== document.body)
|
|
96
|
-
document.body.appendChild(el)
|
|
97
|
-
if (!el.hasAttribute('popover'))
|
|
98
|
-
el.setAttribute('popover', 'manual')
|
|
99
|
-
if (hasItems) {
|
|
80
|
+
if (hasItems)
|
|
100
81
|
safeShowPopover(el)
|
|
101
|
-
|
|
102
|
-
else {
|
|
82
|
+
else
|
|
103
83
|
safeHidePopover(el)
|
|
104
|
-
|
|
105
|
-
}
|
|
84
|
+
})
|
|
106
85
|
|
|
107
86
|
onMount(() => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
87
|
+
const el = layerElement
|
|
88
|
+
if (el && document.body && el.parentElement !== document.body)
|
|
89
|
+
document.body.appendChild(el)
|
|
90
|
+
|
|
111
91
|
return () => {
|
|
112
|
-
observer.disconnect()
|
|
113
92
|
const el = layerElement
|
|
114
93
|
if (el) {
|
|
115
94
|
safeHidePopover(el)
|
|
@@ -117,20 +96,16 @@
|
|
|
117
96
|
}
|
|
118
97
|
}
|
|
119
98
|
})
|
|
120
|
-
|
|
121
|
-
$effect(() => {
|
|
122
|
-
void hasItems
|
|
123
|
-
relocate()
|
|
124
|
-
})
|
|
125
99
|
</script>
|
|
126
100
|
|
|
127
|
-
<div bind:this={layerElement} popover='manual' class='hai-message-layer'>
|
|
101
|
+
<div {...dataAttributes} bind:this={layerElement} popover='manual' class='hai-message-layer'>
|
|
128
102
|
<div class='hai-message-stack'>
|
|
129
103
|
{#each message.items as item (item.id)}
|
|
130
104
|
<div
|
|
131
105
|
class={cn(
|
|
132
106
|
'hai-message-item alert shadow-lg border',
|
|
133
107
|
bgMap[item.type] ?? bgMap.info,
|
|
108
|
+
textColorMap[item.type] ?? textColorMap.info,
|
|
134
109
|
)}
|
|
135
110
|
role='alert'
|
|
136
111
|
>
|
|
@@ -157,22 +132,24 @@
|
|
|
157
132
|
inset: 0;
|
|
158
133
|
width: 100%;
|
|
159
134
|
height: 100%;
|
|
160
|
-
max-width: none;
|
|
161
|
-
max-height: none;
|
|
162
135
|
margin: 0;
|
|
163
136
|
padding: 0;
|
|
164
137
|
border: 0;
|
|
165
138
|
background: transparent;
|
|
166
139
|
overflow: visible;
|
|
167
140
|
pointer-events: none;
|
|
168
|
-
z-index:
|
|
141
|
+
z-index: 2147483647;
|
|
169
142
|
}
|
|
170
143
|
|
|
171
144
|
.hai-message-stack {
|
|
172
145
|
position: absolute;
|
|
173
146
|
top: 1rem;
|
|
174
|
-
left:
|
|
175
|
-
|
|
147
|
+
left: 0;
|
|
148
|
+
right: 0;
|
|
149
|
+
margin-left: auto;
|
|
150
|
+
margin-right: auto;
|
|
151
|
+
width: max-content;
|
|
152
|
+
max-width: 100%;
|
|
176
153
|
display: flex;
|
|
177
154
|
flex-direction: column;
|
|
178
155
|
align-items: center;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import type { DataAttributes } from '../../types.js';
|
|
2
|
+
declare const MessageContainer: import("svelte").Component<DataAttributes, {}, "">;
|
|
2
3
|
type MessageContainer = ReturnType<typeof MessageContainer>;
|
|
3
4
|
export default MessageContainer;
|