@fibrae/semi-ui-svelte 0.2.0 → 0.3.1
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/LICENSE +0 -62
- package/README.md +40 -38
- package/README.zh-CN.md +91 -0
- package/dist/_base/create-context.js +0 -1
- package/dist/_base/css-animation.js +0 -1
- package/dist/_base/group-role.d.ts +0 -1
- package/dist/_base/group-role.js +0 -1
- package/dist/_base/slot-kind.d.ts +0 -1
- package/dist/_base/slot-kind.js +0 -1
- package/dist/_base/teleport.d.ts +0 -2
- package/dist/_base/teleport.js +0 -2
- package/dist/_base/use-click-outside.svelte.d.ts +2 -2
- package/dist/_base/use-click-outside.svelte.js +2 -2
- package/dist/_base/use-foundation.svelte.js +2 -5
- package/dist/_base/virtual-list.svelte +2 -3
- package/dist/_base/virtual-list.svelte.d.ts +0 -1
- package/dist/_sortable/interface.d.ts +0 -1
- package/dist/anchor/interface.d.ts +0 -3
- package/dist/anchor/link-item.svelte +0 -1
- package/dist/anchor/links.d.ts +0 -1
- package/dist/anchor/links.js +0 -1
- package/dist/audio-player/audio-player.svelte +0 -2
- package/dist/audio-player/audio-slider.svelte +0 -3
- package/dist/auto-complete/auto-complete.svelte +0 -5
- package/dist/auto-complete/interface.d.ts +0 -9
- package/dist/avatar/avatar-group-more.svelte +0 -1
- package/dist/avatar/avatar.svelte +0 -4
- package/dist/avatar/context.d.ts +0 -1
- package/dist/avatar/interface.d.ts +0 -4
- package/dist/backtop/backtop.svelte +0 -2
- package/dist/backtop/interface.d.ts +0 -1
- package/dist/badge/interface.d.ts +0 -1
- package/dist/banner/banner.svelte +1 -1
- package/dist/banner/interface.d.ts +1 -3
- package/dist/breadcrumb/breadcrumb-item.svelte +0 -1
- package/dist/breadcrumb/breadcrumb.svelte +0 -1
- package/dist/breadcrumb/interface.d.ts +0 -7
- package/dist/calendar/calendar.svelte +0 -1
- package/dist/calendar/day-calendar.svelte +0 -3
- package/dist/calendar/interface.d.ts +0 -8
- package/dist/calendar/month-calendar.svelte +0 -4
- package/dist/calendar/time-grid.svelte +0 -2
- package/dist/calendar/time-grid.svelte.d.ts +0 -1
- package/dist/calendar/use-today.svelte.d.ts +0 -1
- package/dist/calendar/use-today.svelte.js +0 -1
- package/dist/card/index.js +0 -1
- package/dist/card/interface.d.ts +0 -3
- package/dist/carousel/carousel.svelte +0 -4
- package/dist/carousel/interface.d.ts +0 -3
- package/dist/cascader/cascader.svelte +0 -6
- package/dist/cascader/interface.d.ts +0 -19
- package/dist/cascader/item.svelte +0 -4
- package/dist/cascader/item.svelte.d.ts +0 -4
- package/dist/checkbox/checkbox-group.svelte +0 -3
- package/dist/checkbox/checkbox.svelte +0 -4
- package/dist/checkbox/index.js +0 -1
- package/dist/checkbox/interface.d.ts +0 -1
- package/dist/code-highlight/interface.d.ts +0 -1
- package/dist/collapse/collapse.svelte +0 -2
- package/dist/collapse/index.js +0 -1
- package/dist/collapse/interface.d.ts +0 -2
- package/dist/collapse/panel.svelte +0 -1
- package/dist/collapsible/collapsible.svelte +0 -2
- package/dist/color-picker/alpha-slider.svelte +0 -1
- package/dist/color-picker/color-choose-area.svelte +0 -1
- package/dist/color-picker/color-slider.svelte +0 -1
- package/dist/color-picker/data-part.svelte +0 -1
- package/dist/cropper/cropper.svelte +0 -1
- package/dist/cropper/interface.d.ts +0 -6
- package/dist/date-picker/date-input.svelte +0 -4
- package/dist/date-picker/date-picker.svelte +0 -7
- package/dist/date-picker/inset-input.svelte +0 -1
- package/dist/date-picker/interface.d.ts +0 -7
- package/dist/date-picker/internal.d.ts +0 -7
- package/dist/date-picker/month.svelte +0 -1
- package/dist/date-picker/months-grid.svelte +0 -6
- package/dist/date-picker/navigation.svelte +0 -1
- package/dist/descriptions/interface.d.ts +0 -1
- package/dist/divider/divider.svelte +0 -1
- package/dist/divider/interface.d.ts +0 -4
- package/dist/drag-move/drag-move.js +0 -1
- package/dist/drag-move/interface.d.ts +0 -3
- package/dist/dropdown/context.d.ts +0 -6
- package/dist/dropdown/context.js +0 -1
- package/dist/dropdown/dropdown-item.svelte +0 -1
- package/dist/dropdown/dropdown.svelte +0 -7
- package/dist/dropdown/interface.d.ts +0 -4
- package/dist/empty/empty.svelte +0 -1
- package/dist/empty/interface.d.ts +0 -3
- package/dist/feedback/feedback.svelte +0 -1
- package/dist/feedback/interface.d.ts +0 -8
- package/dist/float-button/float-button-action.svelte +0 -2
- package/dist/float-button/interface.d.ts +0 -2
- package/dist/form/array-field.svelte +0 -2
- package/dist/form/context.d.ts +0 -2
- package/dist/form/error-message.svelte +0 -1
- package/dist/form/field-grid.svelte +0 -2
- package/dist/form/field-grid.svelte.d.ts +0 -2
- package/dist/form/field-inner.svelte +0 -2
- package/dist/form/field.svelte +0 -1
- package/dist/form/form.svelte +0 -1
- package/dist/form/hooks.d.ts +1 -2
- package/dist/form/hooks.js +1 -2
- package/dist/form/interface.d.ts +0 -7
- package/dist/form/utils.d.ts +0 -1
- package/dist/form/utils.js +0 -2
- package/dist/highlight/interface.d.ts +0 -1
- package/dist/hot-keys/interface.d.ts +0 -1
- package/dist/image/context.d.ts +0 -1
- package/dist/image/footer.d.ts +0 -1
- package/dist/image/interface.d.ts +0 -8
- package/dist/image/preview-image.svelte +0 -3
- package/dist/image/preview-image.svelte.d.ts +0 -1
- package/dist/image/preview-inner.svelte +0 -3
- package/dist/image/preview-inner.svelte.d.ts +0 -1
- package/dist/input/context.d.ts +0 -1
- package/dist/input/interface.d.ts +0 -3
- package/dist/input/textarea.svelte +0 -3
- package/dist/input-number/input-number.svelte +0 -2
- package/dist/input-number/interface.d.ts +0 -1
- package/dist/json-viewer/interface.d.ts +0 -4
- package/dist/json-viewer/json-viewer.svelte +0 -3
- package/dist/layout/interface.d.ts +0 -2
- package/dist/list/interface.d.ts +0 -2
- package/dist/lottie/interface.d.ts +1 -1
- package/dist/markdown-render/code-text.js +0 -1
- package/dist/markdown-render/components/code.svelte +0 -1
- package/dist/markdown-render/components/heading.svelte +0 -1
- package/dist/markdown-render/components/p.svelte +0 -1
- package/dist/markdown-render/components/table.svelte +0 -1
- package/dist/markdown-render/components/tree.d.ts +0 -4
- package/dist/markdown-render/components/tree.js +0 -2
- package/dist/markdown-render/interface.d.ts +0 -1
- package/dist/markdown-render/markdown-children.svelte +0 -2
- package/dist/markdown-render/markdown-render.svelte +0 -1
- package/dist/markdown-render/runtime.js +0 -1
- package/dist/modal/confirm-modal.svelte +0 -1
- package/dist/modal/confirm.svelte.d.ts +0 -1
- package/dist/modal/confirm.svelte.js +0 -1
- package/dist/modal/index.js +0 -1
- package/dist/modal/interface.d.ts +0 -6
- package/dist/modal/modal-content.svelte +0 -4
- package/dist/modal/modal.svelte +0 -1
- package/dist/modal/use-show-hide.svelte.d.ts +0 -2
- package/dist/modal/use-show-hide.svelte.js +0 -4
- package/dist/navigation/context.d.ts +0 -2
- package/dist/navigation/index.js +0 -1
- package/dist/navigation/interface.d.ts +1 -17
- package/dist/navigation/item-shell.svelte +0 -4
- package/dist/navigation/item-shell.svelte.d.ts +0 -3
- package/dist/navigation/nav-footer.svelte +0 -2
- package/dist/navigation/nav-items.svelte +0 -1
- package/dist/navigation/nav.svelte +0 -1
- package/dist/navigation/sub-nav.svelte +0 -5
- package/dist/navigation/wrapper-outlet.svelte +0 -1
- package/dist/notification/context.d.ts +0 -3
- package/dist/notification/interface.d.ts +0 -5
- package/dist/notification/notice-list.svelte +0 -2
- package/dist/notification/notice-list.svelte.d.ts +0 -1
- package/dist/notification/notice.svelte +0 -2
- package/dist/notification/notification-list.svelte +0 -1
- package/dist/notification/static-api.js +0 -1
- package/dist/overflow-list/interface.d.ts +0 -2
- package/dist/overflow-list/overflow-list.svelte +0 -2
- package/dist/pagination/interface.d.ts +0 -1
- package/dist/pagination/pagination.svelte +0 -2
- package/dist/pagination/step-button.svelte +0 -3
- package/dist/pagination/step-button.svelte.d.ts +0 -1
- package/dist/pincode/interface.d.ts +0 -1
- package/dist/pincode/pincode.svelte +0 -3
- package/dist/popconfirm/interface.d.ts +0 -1
- package/dist/popconfirm/popconfirm.svelte +0 -2
- package/dist/popover/interface.d.ts +0 -1
- package/dist/popover/popover.svelte +0 -1
- package/dist/radio/index.js +0 -1
- package/dist/radio/radio-group.svelte +0 -1
- package/dist/radio/radio.svelte +0 -1
- package/dist/rating/interface.d.ts +0 -2
- package/dist/rating/item.svelte +0 -1
- package/dist/rating/rating.svelte +0 -7
- package/dist/resizable/interface.d.ts +0 -2
- package/dist/resizable/resizable.svelte +0 -1
- package/dist/resizable/resize-group.svelte +0 -1
- package/dist/resizable/resize-handler.svelte +0 -1
- package/dist/resize-observer/observe-resize.d.ts +1 -5
- package/dist/resize-observer/observe-resize.js +1 -5
- package/dist/scroll-list/index.js +0 -1
- package/dist/scroll-list/interface.d.ts +0 -2
- package/dist/scroll-list/scroll-item.svelte +0 -2
- package/dist/select/interface.d.ts +0 -14
- package/dist/select/option.svelte +0 -5
- package/dist/select/option.svelte.d.ts +0 -5
- package/dist/select/select.svelte +0 -14
- package/dist/side-sheet/interface.d.ts +0 -1
- package/dist/side-sheet/side-sheet.svelte +0 -9
- package/dist/skeleton/index.js +0 -1
- package/dist/skeleton/interface.d.ts +0 -2
- package/dist/skeleton/skeleton-item.svelte +0 -1
- package/dist/slider/interface.d.ts +0 -5
- package/dist/slider/slider.svelte +0 -7
- package/dist/space/interface.d.ts +0 -1
- package/dist/space/space.svelte +0 -1
- package/dist/steps/context.d.ts +0 -1
- package/dist/steps/interface.d.ts +0 -2
- package/dist/steps/step.svelte +0 -3
- package/dist/switch/switch.svelte +0 -2
- package/dist/table/body/base-row.svelte +0 -4
- package/dist/table/body/base-row.svelte.d.ts +0 -4
- package/dist/table/body/body.svelte +0 -7
- package/dist/table/body/body.svelte.d.ts +0 -5
- package/dist/table/body/expanded-row.svelte +0 -1
- package/dist/table/body/expanded-row.svelte.d.ts +0 -1
- package/dist/table/body/section-row.svelte +0 -2
- package/dist/table/body/section-row.svelte.d.ts +0 -2
- package/dist/table/column-filter-menu.svelte +0 -3
- package/dist/table/column-filter-menu.svelte.d.ts +0 -3
- package/dist/table/column-filter.svelte +0 -2
- package/dist/table/column-filter.svelte.d.ts +0 -2
- package/dist/table/column-selection.svelte +1 -2
- package/dist/table/column-selection.svelte.d.ts +0 -1
- package/dist/table/column-sorter.svelte +1 -6
- package/dist/table/column-sorter.svelte.d.ts +1 -6
- package/dist/table/context.d.ts +0 -10
- package/dist/table/context.js +0 -1
- package/dist/table/custom-expand-icon.svelte +0 -2
- package/dist/table/custom-expand-icon.svelte.d.ts +0 -2
- package/dist/table/head-table.svelte +0 -1
- package/dist/table/head-table.svelte.d.ts +0 -1
- package/dist/table/interface.d.ts +2 -21
- package/dist/table/table-cell.svelte +0 -7
- package/dist/table/table-cell.svelte.d.ts +0 -7
- package/dist/table/table-header-row.svelte +0 -2
- package/dist/table/table-header-row.svelte.d.ts +0 -2
- package/dist/table/table-pagination.svelte +0 -2
- package/dist/table/table-pagination.svelte.d.ts +0 -2
- package/dist/table/table.svelte +0 -5
- package/dist/table/utils.d.ts +1 -13
- package/dist/table/utils.js +1 -11
- package/dist/tabs/index.js +0 -1
- package/dist/tabs/interface.d.ts +0 -13
- package/dist/tabs/tab-bar.svelte +0 -3
- package/dist/tabs/tab-bar.svelte.d.ts +0 -1
- package/dist/tabs/tab-pane.svelte +0 -2
- package/dist/tabs/tabs.svelte +0 -1
- package/dist/tag-input/interface.d.ts +0 -5
- package/dist/tag-input/tag-input.svelte +0 -3
- package/dist/tag-input/tag-item.svelte +0 -1
- package/dist/tag-input/tag-item.svelte.d.ts +0 -1
- package/dist/time-picker/combobox.svelte +0 -1
- package/dist/time-picker/interface.d.ts +0 -9
- package/dist/time-picker/time-picker.svelte +0 -2
- package/dist/timeline/interface.d.ts +0 -4
- package/dist/timeline/timeline.svelte +0 -1
- package/dist/toast/context.d.ts +0 -2
- package/dist/toast/interface.d.ts +0 -2
- package/dist/toast/static-api.js +0 -1
- package/dist/toast/toast.svelte +0 -1
- package/dist/toast/use-toast.js +0 -1
- package/dist/tooltip/context.d.ts +0 -2
- package/dist/tooltip/interface.d.ts +0 -2
- package/dist/tooltip/tooltip.svelte +0 -5
- package/dist/transfer/interface.d.ts +1 -8
- package/dist/transfer/transfer-selected-item.svelte +0 -1
- package/dist/transfer/transfer-selected-item.svelte.d.ts +0 -1
- package/dist/transfer/transfer.svelte +0 -1
- package/dist/tree/auto-sizer.svelte +0 -1
- package/dist/tree/context.d.ts +0 -1
- package/dist/tree/interface.d.ts +0 -9
- package/dist/tree/node-collapsible.svelte +0 -1
- package/dist/tree/node-list.svelte +0 -4
- package/dist/tree/tree-node.svelte +0 -1
- package/dist/tree/tree.svelte +0 -3
- package/dist/tree/use-tree-keyboard.svelte.d.ts +1 -8
- package/dist/tree/use-tree-keyboard.svelte.js +1 -6
- package/dist/tree-select/interface.d.ts +0 -11
- package/dist/tree-select/tree-select.svelte +0 -2
- package/dist/typography/base.svelte +0 -2
- package/dist/typography/index.js +0 -1
- package/dist/typography/interface.d.ts +0 -1
- package/dist/typography/internal.d.ts +0 -2
- package/dist/upload/file-card.svelte +0 -1
- package/dist/upload/index.js +0 -1
- package/dist/upload/interface.d.ts +0 -4
- package/dist/upload/upload.svelte +0 -1
- package/dist/user-guide/interface.d.ts +0 -1
- package/dist/user-guide/user-guide.svelte +0 -1
- package/dist/video-player/video-progress.svelte +0 -2
- package/package.json +4 -4
package/LICENSE
CHANGED
|
@@ -20,65 +20,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
20
20
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
21
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
SOFTWARE.
|
|
23
|
-
|
|
24
|
-
The code implementation of the external library is referenced by DouyinFe are:
|
|
25
|
-
|
|
26
|
-
- animate.css
|
|
27
|
-
|
|
28
|
-
The MIT License (MIT)
|
|
29
|
-
|
|
30
|
-
Copyright (c) 2020 Daniel Eden
|
|
31
|
-
|
|
32
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
33
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
34
|
-
in the Software without restriction, including without limitation the rights
|
|
35
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
36
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
37
|
-
furnished to do so, subject to the following conditions:
|
|
38
|
-
|
|
39
|
-
The above copyright notice and this permission notice shall be included in all
|
|
40
|
-
copies or substantial portions of the Software.
|
|
41
|
-
|
|
42
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
43
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
44
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
45
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
46
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
47
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
48
|
-
SOFTWARE.
|
|
49
|
-
|
|
50
|
-
- Ant Design
|
|
51
|
-
MIT LICENSE
|
|
52
|
-
|
|
53
|
-
Copyright (c) 2015-present Ant UED, https://xtech.antfin.com/
|
|
54
|
-
|
|
55
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
56
|
-
a copy of this software and associated documentation files (the
|
|
57
|
-
"Software"), to deal in the Software without restriction, including
|
|
58
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
59
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
60
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
61
|
-
the following conditions:
|
|
62
|
-
|
|
63
|
-
The above copyright notice and this permission notice shall be
|
|
64
|
-
included in all copies or substantial portions of the Software.
|
|
65
|
-
|
|
66
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
67
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
68
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
69
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
70
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
71
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
72
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
73
|
-
|
|
74
|
-
- rc-tree
|
|
75
|
-
|
|
76
|
-
MIT LICENSE
|
|
77
|
-
|
|
78
|
-
Copyright (c) 2015-present Alipay.com, https://www.alipay.com/
|
|
79
|
-
|
|
80
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
81
|
-
|
|
82
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
83
|
-
|
|
84
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
# @fibrae/semi-ui-svelte
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[简体中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The Svelte component library of Semi Design Next, for Svelte 5.57+ applications. It is a community fork of [Semi Design](https://github.com/DouyinFE/semi-design), unaffiliated with ByteDance and the Semi Design team, and shares the logic and styles of one foundation with the UI packages of other frameworks.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
6
8
|
|
|
7
9
|
```sh
|
|
8
10
|
pnpm add svelte @fibrae/semi-ui-svelte @fibrae/semi-icons-svelte
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Peer dependency: `svelte` ^5.57.0. For browser, module format, Node.js and build plugin requirements, see the [requirements in Getting Started](../../website/content/start/getting-started/index.en-US.mdx#requirements).
|
|
12
14
|
|
|
13
|
-
##
|
|
15
|
+
## Usage
|
|
14
16
|
|
|
15
17
|
```svelte
|
|
16
18
|
<script lang="ts">
|
|
@@ -20,36 +22,36 @@ peer 依赖:`svelte` ^5.57.0。浏览器、模块格式、Node.js 与构建插
|
|
|
20
22
|
</script>
|
|
21
23
|
|
|
22
24
|
<Button theme="solid" type="primary">Hello Semi</Button>
|
|
23
|
-
<Switch bind:checked aria-label="
|
|
25
|
+
<Switch bind:checked aria-label="Switch" />
|
|
24
26
|
```
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
Styles and theme tokens load with the components. You do not need to import base styles or reset.css.
|
|
27
29
|
|
|
28
|
-
###
|
|
30
|
+
### Entry points
|
|
29
31
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
| `@fibrae/semi-ui-svelte`
|
|
33
|
-
| `@fibrae/semi-ui-svelte
|
|
34
|
-
| `@fibrae/semi-ui-svelte/hooks`
|
|
35
|
-
| `@fibrae/semi-ui-svelte/tokens`
|
|
36
|
-
| `@fibrae/semi-ui-svelte/styles.css`
|
|
37
|
-
| `@fibrae/semi-ui-svelte/tailwind.css`
|
|
38
|
-
| `@fibrae/semi-ui-svelte/locale/source
|
|
32
|
+
| Entry | Description |
|
|
33
|
+
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
34
|
+
| `@fibrae/semi-ui-svelte` | All components and types, `ConfigProvider`, `LocaleProvider`, `LocaleConsumer`, `useLocale` and `semiGlobal` |
|
|
35
|
+
| `@fibrae/semi-ui-svelte/<directory>/index` | Deep file paths that map one-to-one to the directories under `src/`; component files are `<directory>/<name>.svelte` |
|
|
36
|
+
| `@fibrae/semi-ui-svelte/hooks` | `useLocale`, `useClickOutside`, `useCopied` and the attachment `observeResize` |
|
|
37
|
+
| `@fibrae/semi-ui-svelte/tokens` | Theme tokens and base rules. Import it first in the application entry so tokens still load with the entry when the first component is lazy-loaded |
|
|
38
|
+
| `@fibrae/semi-ui-svelte/styles.css` | The full stylesheet, for loading all component styles at once |
|
|
39
|
+
| `@fibrae/semi-ui-svelte/tailwind.css` | The Tailwind v4 `@theme inline` mapping |
|
|
40
|
+
| `@fibrae/semi-ui-svelte/locale/source/<locale>` | Built-in locale packs, re-exporting `@fibrae/semi-foundation/locale/source/<locale>` |
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
The package ships `.svelte` source and `.d.ts` files, not compiled output. `exports` carries the `svelte` condition, and `@sveltejs/vite-plugin-svelte` (built into SvelteKit) compiles for the application's target (DOM or server). Tools that neither honor the `svelte` condition nor compile `.svelte` cannot use this package.
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
To use the full `styles.css`, turn on `omitCss` in `@fibrae/semi-vite-plugin`; otherwise the style imports inside the components are bundled a second time. The full stylesheet already includes tokens, and under `omitCss` the `tokens` entry is removed along with the component styles.
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
When using `@fibrae/semi-ai-svelte` with the full stylesheet, import `@fibrae/semi-ai-svelte/styles.css` after `styles.css`.
|
|
45
47
|
|
|
46
|
-
###
|
|
48
|
+
### Customizing styles
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
Override `--semi-*` CSS variables to change global colors, radii, font sizes and spacing. Semi's styles sit in `@layer semi`, so unlayered CSS rules in your application always win. There are no theme packages and no compile-time Sass overrides. The published `.scss` contains `semi:` addresses and must go through a build plugin (such as `@fibrae/semi-vite-plugin`) or `@fibrae/semi-scss-compile`.
|
|
49
51
|
|
|
50
|
-
###
|
|
52
|
+
### Internationalization
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
The default locale is `zh_CN`. Pass a locale pack with `LocaleProvider`. Call `useLocale(componentName)` during component initialization. It returns a function, read as `locale().locale.xxx`, that updates when the locale changes:
|
|
53
55
|
|
|
54
56
|
```svelte
|
|
55
57
|
<script lang="ts">
|
|
@@ -62,28 +64,28 @@ peer 依赖:`svelte` ^5.57.0。浏览器、模块格式、Node.js 与构建插
|
|
|
62
64
|
</LocaleProvider>
|
|
63
65
|
```
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
For the structure of a locale pack, see [@fibrae/semi-foundation](../semi-foundation/README.md#locale-packs).
|
|
66
68
|
|
|
67
|
-
###
|
|
69
|
+
### Server rendering
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
Components output server HTML with `render` from `svelte/server` and in SvelteKit, and the browser hydrates with `hydrate`. Keep in mind:
|
|
70
72
|
|
|
71
|
-
-
|
|
72
|
-
- `onMount`
|
|
73
|
-
- `semiGlobal.config`
|
|
73
|
+
- Ids inside components come from `$props.id()`, so the server and browser agree.
|
|
74
|
+
- `onMount` and `$effect` do not run on the server, and state that depends on them (such as measured sizes) appears after hydration.
|
|
75
|
+
- Set `semiGlobal.config` only at application startup. The server and browser use the same config.
|
|
74
76
|
|
|
75
|
-
###
|
|
77
|
+
### Documentation
|
|
76
78
|
|
|
77
|
-
|
|
79
|
+
Component docs are in [website/content](../../website/content). To get started, read [Getting Started](../../website/content/start/getting-started/index.en-US.mdx).
|
|
78
80
|
|
|
79
|
-
##
|
|
81
|
+
## Related packages
|
|
80
82
|
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
83
|
+
- Depends on `@fibrae/semi-foundation` (logic and styles) and `@fibrae/semi-icons-svelte`.
|
|
84
|
+
- Used by `@fibrae/semi-ai-svelte` and the docs site `website`.
|
|
85
|
+
- The UI package of each framework (`semi-ui-<framework>`) shares the same foundation.
|
|
84
86
|
|
|
85
|
-
##
|
|
87
|
+
## Development
|
|
86
88
|
|
|
87
|
-
`pnpm --filter @fibrae/semi-ui-svelte build`
|
|
89
|
+
`pnpm --filter @fibrae/semi-ui-svelte build` runs `scripts/svelte-package.ts`: `svelte-package` outputs `src` to `dist` (`.svelte` files as they are, `.ts` compiled to `.js` and `.d.ts`). The script changes style imports to the foundation's `.css`, removes `__tests__`, and writes the full `styles.css`, `tailwind.css` and the re-exports under `locale/source/`.
|
|
88
90
|
|
|
89
|
-
|
|
91
|
+
For general commands, see [CONTRIBUTING.md](../../CONTRIBUTING.md#常用命令) at the repository root. For how to write components, see [components](../../.agents/references/svelte/components.md). For changes relative to upstream, see [release-notes](../../docs/release-notes.md).
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# @fibrae/semi-ui-svelte
|
|
2
|
+
|
|
3
|
+
[English](README.md)
|
|
4
|
+
|
|
5
|
+
Semi Design Next 的 Svelte 组件库,面向 Svelte 5.57+ 应用。它是上游 [Semi Design](https://github.com/DouyinFE/semi-design) 的社区 fork,与字节跳动及 Semi Design 官方团队无关,与各框架的 UI 包共用同一份 foundation 的逻辑和样式。
|
|
6
|
+
|
|
7
|
+
## 安装
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add svelte @fibrae/semi-ui-svelte @fibrae/semi-icons-svelte
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
peer 依赖:`svelte` ^5.57.0。浏览器、模块格式、Node.js 与构建插件的版本要求见[快速开始的环境要求](../../website/content/start/getting-started/index.zh-CN.mdx#环境要求)。
|
|
14
|
+
|
|
15
|
+
## 使用
|
|
16
|
+
|
|
17
|
+
```svelte
|
|
18
|
+
<script lang="ts">
|
|
19
|
+
import { Button, Switch } from '@fibrae/semi-ui-svelte';
|
|
20
|
+
|
|
21
|
+
let checked = $state(false);
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<Button theme="solid" type="primary">Hello Semi</Button>
|
|
25
|
+
<Switch bind:checked aria-label="开关" />
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
样式与主题 token 随组件一起加载,不需要手动引入基础样式,也不需要 reset.css。
|
|
29
|
+
|
|
30
|
+
### 入口
|
|
31
|
+
|
|
32
|
+
| 入口 | 说明 |
|
|
33
|
+
| --------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
34
|
+
| `@fibrae/semi-ui-svelte` | 全部组件、类型、`ConfigProvider`、`LocaleProvider`、`LocaleConsumer`、`useLocale`、`semiGlobal` |
|
|
35
|
+
| `@fibrae/semi-ui-svelte/<目录>/index` | 逐文件深路径,与 `src/` 下的目录一一对应;组件文件是 `<目录>/<名>.svelte` |
|
|
36
|
+
| `@fibrae/semi-ui-svelte/hooks` | `useLocale`、`useClickOutside`、`useCopied`,以及 attachment `observeResize` |
|
|
37
|
+
| `@fibrae/semi-ui-svelte/tokens` | 主题 token 与 base 规则,在应用入口文件最先导入,首个组件懒加载时 token 仍随入口加载 |
|
|
38
|
+
| `@fibrae/semi-ui-svelte/styles.css` | 整包样式,需要一次性加载全部组件样式时使用 |
|
|
39
|
+
| `@fibrae/semi-ui-svelte/tailwind.css` | Tailwind v4 的 `@theme inline` 映射 |
|
|
40
|
+
| `@fibrae/semi-ui-svelte/locale/source/<语言>` | 内置语言包,重导出 `@fibrae/semi-foundation/locale/source/<语言>` |
|
|
41
|
+
|
|
42
|
+
包里发布的是 `.svelte` 源码与 `.d.ts`,不是编译产物:`exports` 带 `svelte` 条件,由 `@sveltejs/vite-plugin-svelte`(SvelteKit 已内置)按应用的目标(DOM 或服务端)编译。不认 `svelte` 条件、也不编译 `.svelte` 的工具无法使用本包。
|
|
43
|
+
|
|
44
|
+
使用整包 `styles.css` 时,需要开启 `@fibrae/semi-vite-plugin` 的 `omitCss`,否则组件自带的样式导入会被再打包一份。整包样式已含 token,`omitCss` 下 `tokens` 入口和组件样式一起被移除。
|
|
45
|
+
|
|
46
|
+
与 `@fibrae/semi-ai-svelte` 同用并加载整包样式时,在 `styles.css` 之后引入 `@fibrae/semi-ai-svelte/styles.css`。
|
|
47
|
+
|
|
48
|
+
### 样式定制
|
|
49
|
+
|
|
50
|
+
覆写 `--semi-*` CSS 变量即可改变全局颜色、圆角、字号和间距;Semi 的样式位于 `@layer semi`,应用中不分层的 CSS 规则总是优先。没有主题包,也没有编译期的 Sass 覆写。发布的 `.scss` 含有 `semi:` 地址,需要通过构建插件(`@fibrae/semi-vite-plugin` 等)或 `@fibrae/semi-scss-compile` 使用。
|
|
51
|
+
|
|
52
|
+
### 多语言
|
|
53
|
+
|
|
54
|
+
默认语言为 `zh_CN`。用 `LocaleProvider` 传入语言包;`useLocale(组件名)` 在组件初始化时调用,返回一个函数,读作 `locale().locale.xxx`,语言切换后随之更新:
|
|
55
|
+
|
|
56
|
+
```svelte
|
|
57
|
+
<script lang="ts">
|
|
58
|
+
import { LocaleProvider } from '@fibrae/semi-ui-svelte';
|
|
59
|
+
import en_GB from '@fibrae/semi-ui-svelte/locale/source/en_GB';
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<LocaleProvider locale={en_GB}>
|
|
63
|
+
<App />
|
|
64
|
+
</LocaleProvider>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
语言包的结构见 [@fibrae/semi-foundation](../semi-foundation/README.zh-CN.md#语言包)。
|
|
68
|
+
|
|
69
|
+
### 服务端渲染
|
|
70
|
+
|
|
71
|
+
组件可在 `svelte/server` 的 `render` 与 SvelteKit 中输出服务端 HTML,浏览器用 `hydrate` 注水。注意:
|
|
72
|
+
|
|
73
|
+
- 组件内的 id 来自 `$props.id()`,服务端与浏览器一致。
|
|
74
|
+
- `onMount` 与 `$effect` 不在服务端执行,依赖它们的状态(如测量尺寸)在注水后才出现。
|
|
75
|
+
- `semiGlobal.config` 只在应用启动时设置,服务端与浏览器使用同一份配置。
|
|
76
|
+
|
|
77
|
+
### 文档
|
|
78
|
+
|
|
79
|
+
组件文档在 [website/content](../../website/content),入门见 [快速开始](../../website/content/start/getting-started/index.zh-CN.mdx)。
|
|
80
|
+
|
|
81
|
+
## 与其他包的关系
|
|
82
|
+
|
|
83
|
+
- 依赖 `@fibrae/semi-foundation`(逻辑与样式)、`@fibrae/semi-icons-svelte`。
|
|
84
|
+
- 被 `@fibrae/semi-ai-svelte` 和文档站 `website` 使用。
|
|
85
|
+
- 各框架的 UI 包(`semi-ui-<框架>`)共用同一份 foundation。
|
|
86
|
+
|
|
87
|
+
## 开发
|
|
88
|
+
|
|
89
|
+
`pnpm --filter @fibrae/semi-ui-svelte build` 执行 `scripts/svelte-package.ts`:用 `svelte-package` 把 `src` 输出到 `dist`(`.svelte` 原样、`.ts` 编译为 `.js` 与 `.d.ts`),把样式导入改为 foundation 的 `.css`,去掉 `__tests__`,并写出整包 `styles.css`、`tailwind.css` 与 `locale/source/` 的重导出。
|
|
90
|
+
|
|
91
|
+
通用命令见根目录 [CONTRIBUTING.md](../../CONTRIBUTING.md#常用命令)。组件写法见 [components](../../.agents/references/svelte/components.md),相对上游的变化见 [release-notes](../../docs/release-notes.md)。
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createContext as createSvelteContext } from 'svelte';
|
|
2
2
|
export function createContext(name, { optional = false, defaultValue } = {}) {
|
|
3
3
|
const [get, set, has] = createSvelteContext();
|
|
4
|
-
// `caller` names the child in the error, e.g. getCollapseContext('Collapse.Panel')
|
|
5
4
|
const getContext = (caller = 'This component') => {
|
|
6
5
|
if (has()) {
|
|
7
6
|
return get();
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** The longest `animation-duration` + `animation-delay` pair on `node`, in ms */
|
|
2
1
|
function animationTime(node) {
|
|
3
2
|
const style = getComputedStyle(node);
|
|
4
3
|
const seconds = (value) => value.split(',').map((item) => (item.trim().endsWith('ms') ? parseFloat(item) / 1000 : parseFloat(item)) || 0);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
/** A generic div cannot carry a name, so a labelled one becomes a group */
|
|
2
2
|
export declare function isLabelled(attrs: Record<string, unknown>): boolean;
|
|
3
|
-
/** An explicit role wins; otherwise a labelled wrapper is a group */
|
|
4
3
|
export declare function groupRole(attrs: Record<string, unknown>): string | undefined;
|
package/dist/_base/group-role.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
export function isLabelled(attrs) {
|
|
3
3
|
return Boolean(attrs['aria-label'] || attrs['aria-labelledby']);
|
|
4
4
|
}
|
|
5
|
-
/** An explicit role wins; otherwise a labelled wrapper is a group */
|
|
6
5
|
export function groupRole(attrs) {
|
|
7
6
|
return attrs.role ?? (isLabelled(attrs) ? 'group' : undefined);
|
|
8
7
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Attachment } from 'svelte/attachments';
|
|
2
2
|
export type SlotKind = 'text' | 'icon' | 'node';
|
|
3
3
|
export declare function getSlotKind(container: Element): SlotKind | undefined;
|
|
4
|
-
/** Reports the slot kind of the element's content after mount and whenever its child nodes change */
|
|
5
4
|
export declare function trackSlotKind(report: (kind?: SlotKind) => void): Attachment<Element>;
|
package/dist/_base/slot-kind.js
CHANGED
|
@@ -17,7 +17,6 @@ export function getSlotKind(container) {
|
|
|
17
17
|
// nodeType rather than instanceof: the slot may sit in another document, whose Element differs from this realm's
|
|
18
18
|
return node.classList?.contains(`${BASE_CLASS_PREFIX}-icon`) ? 'icon' : 'node';
|
|
19
19
|
}
|
|
20
|
-
/** Reports the slot kind of the element's content after mount and whenever its child nodes change */
|
|
21
20
|
export function trackSlotKind(report) {
|
|
22
21
|
return (container) => {
|
|
23
22
|
const update = () => report(getSlotKind(container));
|
package/dist/_base/teleport.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { Attachment } from 'svelte/attachments';
|
|
2
2
|
/**
|
|
3
|
-
* Moves the element into `target` once it mounts and removes it on teardown.
|
|
4
|
-
*
|
|
5
3
|
* Svelte removes a block's DOM by walking `nextSibling` from its first to its last node, so the moved element must be
|
|
6
4
|
* the only node of its block (`{#if open}<div {@attach teleport(target)}>...</div>{/if}`): as a block's sole node it is
|
|
7
5
|
* still removed wherever it sits, while as an edge of a longer range the walk would continue into the target's
|
package/dist/_base/teleport.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Moves the element into `target` once it mounts and removes it on teardown.
|
|
3
|
-
*
|
|
4
2
|
* Svelte removes a block's DOM by walking `nextSibling` from its first to its last node, so the moved element must be
|
|
5
3
|
* the only node of its block (`{#if open}<div {@attach teleport(target)}>...</div>{/if}`): as a block's sole node it is
|
|
6
4
|
* still removed wherever it sits, while as an edge of a longer range the walk would continue into the target's
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Each getter is read on every press, so targets may mount later. `nested`: more nodes that count as inside, the
|
|
3
|
+
* popups `useNestedPopups` collects.
|
|
4
4
|
*/
|
|
5
5
|
export default function useClickOutside(targets: (() => Node | null | undefined)[], onOutside: (event: MouseEvent) => void, enabled?: () => boolean, nested?: () => readonly (Node | null | undefined)[]): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { on } from 'svelte/events';
|
|
2
2
|
import { isEventInside } from '@fibrae/semi-foundation/utils/dom';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Each getter is read on every press, so targets may mount later. `nested`: more nodes that count as inside, the
|
|
5
|
+
* popups `useNestedPopups` collects.
|
|
6
6
|
*/
|
|
7
7
|
export default function useClickOutside(targets, onOutside, enabled = () => true, nested) {
|
|
8
8
|
$effect(() => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { onMount, untrack } from 'svelte';
|
|
2
2
|
import { SvelteMap } from 'svelte/reactivity';
|
|
3
|
-
/** A counter readers subscribe to; `bump` re-runs them even when the written value is equal */
|
|
4
3
|
class Version {
|
|
5
4
|
value = $state(0);
|
|
6
5
|
bump() {
|
|
@@ -8,10 +7,8 @@ class Version {
|
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* re-render on every `setState` and a foundation may write back a Set it mutated in place; a `$state` proxy would
|
|
14
|
-
* skip an equal write and wrap the Set.
|
|
10
|
+
* Every write notifies, equal value or not, because React and Vue re-render on every `setState` and a foundation may
|
|
11
|
+
* write back a Set it mutated in place; a `$state` proxy would skip an equal write and wrap the Set.
|
|
15
12
|
*/
|
|
16
13
|
function createStateMirror(initial) {
|
|
17
14
|
// replaced on every write, never mutated: an object the foundation got from getStates() keeps its values
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
itemSize: number | ((index: number) => number);
|
|
18
18
|
/** Key of a row; the index when absent */
|
|
19
19
|
itemKey?: (index: number) => PropertyKey;
|
|
20
|
-
/** Rows rendered beyond each edge of the viewport */
|
|
21
20
|
overscan?: number;
|
|
22
21
|
/** Attributes of the element that holds the rows */
|
|
23
22
|
innerAttrs?: HTMLAttributes<HTMLElement>;
|
|
@@ -32,8 +31,8 @@
|
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
* Attributes land on the scroll container; lists whose rows take no focus pass `tabindex={-1}` so Chrome does not
|
|
35
|
+
* make the container a second tab stop.
|
|
37
36
|
*/
|
|
38
37
|
let { height, width = '100%', itemCount, itemSize, itemKey, overscan = 2, innerAttrs, innerTag = 'div', wrapperAttrs, after, children, ...rest }: VirtualListProps = $props();
|
|
39
38
|
|
|
@@ -10,7 +10,6 @@ interface VirtualListProps extends Omit<HTMLAttributes<HTMLDivElement>, 'childre
|
|
|
10
10
|
itemSize: number | ((index: number) => number);
|
|
11
11
|
/** Key of a row; the index when absent */
|
|
12
12
|
itemKey?: (index: number) => PropertyKey;
|
|
13
|
-
/** Rows rendered beyond each edge of the viewport */
|
|
14
13
|
overscan?: number;
|
|
15
14
|
/** Attributes of the element that holds the rows */
|
|
16
15
|
innerAttrs?: HTMLAttributes<HTMLElement>;
|
|
@@ -25,7 +25,6 @@ export interface SortableProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
25
25
|
/** Builds `${prefix}-sortable-item`, `-over`, `-active` and `${prefix}-sortable-handle` */
|
|
26
26
|
prefix?: string;
|
|
27
27
|
transition?: SortableTransition;
|
|
28
|
-
/** Class of the copy of the item that follows the pointer during a drag */
|
|
29
28
|
dragOverlayClass?: string;
|
|
30
29
|
onSortEnd?: (payload: SortEndPayload) => void;
|
|
31
30
|
/** A drag starts (true) or ends, dropped or canceled (false) */
|
|
@@ -5,7 +5,6 @@ import type { strings } from '@fibrae/semi-foundation/anchor/constants';
|
|
|
5
5
|
import type { ArrayElement } from '@fibrae/semi-foundation/utils/type';
|
|
6
6
|
import type { Position } from '../tooltip/interface.js';
|
|
7
7
|
import type { ShowTooltip } from '../typography/interface.js';
|
|
8
|
-
/** A link is activated by a click or by Enter */
|
|
9
8
|
export type AnchorClickEvent = MouseEvent | KeyboardEvent;
|
|
10
9
|
export interface AnchorLinkItem {
|
|
11
10
|
/** A fragment such as `#intro` is looked up by element id, anything else is a selector; defaults to `#` */
|
|
@@ -13,7 +12,6 @@ export interface AnchorLinkItem {
|
|
|
13
12
|
/** Plain-text title, also the native tooltip without showTooltip; the `title` snippet wins when given */
|
|
14
13
|
title?: string;
|
|
15
14
|
disabled?: boolean;
|
|
16
|
-
/** Nested links */
|
|
17
15
|
children?: AnchorLinkItem[];
|
|
18
16
|
}
|
|
19
17
|
export interface AnchorTitleContext {
|
|
@@ -41,7 +39,6 @@ export interface AnchorProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title
|
|
|
41
39
|
onChange?: (currentLink: string, previousLink: string) => void;
|
|
42
40
|
/** Only when a link is activated, so a click elsewhere on the root does not reach it */
|
|
43
41
|
onClick?: (event: AnchorClickEvent, currentLink: string) => void;
|
|
44
|
-
/** Renders every link's title */
|
|
45
42
|
title?: Snippet<[AnchorTitleContext]>;
|
|
46
43
|
}
|
|
47
44
|
export interface AnchorState {
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
const tooltip = $derived.by(() => {
|
|
21
21
|
const { showTooltip, position } = anchor;
|
|
22
22
|
const config = typeof showTooltip === 'object' ? showTooltip : {};
|
|
23
|
-
// The position can be set through showTooltip; a copy keeps the caller's object as it was
|
|
24
23
|
return { ...config, opts: position ? { ...config.opts, position } : { ...config.opts } };
|
|
25
24
|
});
|
|
26
25
|
|
package/dist/anchor/links.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { AnchorNode } from '@fibrae/semi-foundation/anchor/foundation';
|
|
2
2
|
import type { AnchorLinkItem } from './interface.js';
|
|
3
|
-
/** Depth-first, so the order is the order on the page */
|
|
4
3
|
export declare const hrefsOf: (items: AnchorLinkItem[]) => string[];
|
|
5
4
|
export declare const nodesOf: (items: AnchorLinkItem[]) => AnchorNode[];
|
package/dist/anchor/links.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
/** Depth-first, so the order is the order on the page */
|
|
2
1
|
export const hrefsOf = (items) => items.flatMap((item) => [item.href ?? '#', ...hrefsOf(item.children ?? [])]);
|
|
3
2
|
export const nodesOf = (items) => items.map((item) => ({ href: item.href ?? '#', children: nodesOf(item.children ?? []) }));
|
|
@@ -62,8 +62,6 @@
|
|
|
62
62
|
// the Tooltip text only describes the icon-only button, so the same text is also its name
|
|
63
63
|
const backwardLabel = $derived(texts.backward.replace('${skipDuration}', String(skipDuration)));
|
|
64
64
|
const forwardLabel = $derived(texts.forward.replace('${skipDuration}', String(skipDuration)));
|
|
65
|
-
|
|
66
|
-
// the visible rate alone does not say what the menu sets
|
|
67
65
|
const speedLabel = $derived([texts.playbackRate, states().currentRate.label].join(' '));
|
|
68
66
|
|
|
69
67
|
const changeTrack = (direction: 'next' | 'prev') => {
|
|
@@ -19,8 +19,6 @@
|
|
|
19
19
|
|
|
20
20
|
// $size-audio-player-slider-dot
|
|
21
21
|
const dotSize = 16;
|
|
22
|
-
|
|
23
|
-
// the duration is 0 until the metadata loads
|
|
24
22
|
const percent = $derived(max ? (value / max) * 100 : 0);
|
|
25
23
|
|
|
26
24
|
// the popup is anchored to the slider's center, so only a translate moves it to the pointer; the vertical offset
|
|
@@ -53,7 +51,6 @@
|
|
|
53
51
|
onPointer(event, true);
|
|
54
52
|
};
|
|
55
53
|
|
|
56
|
-
// the preview belongs to the pointer; a keyboard use shows the value
|
|
57
54
|
const clearPreview = () => {
|
|
58
55
|
movingInfo = null;
|
|
59
56
|
};
|
|
@@ -96,7 +96,6 @@
|
|
|
96
96
|
const prefixCls = cssClasses.PREFIX;
|
|
97
97
|
const listId = `${uid}-listbox`;
|
|
98
98
|
|
|
99
|
-
// $bindable needs destructuring, so the foundation reads the props through getters
|
|
100
99
|
const foundationProps: AutoCompleteBaseProps = {
|
|
101
100
|
get data() {
|
|
102
101
|
return data;
|
|
@@ -131,7 +130,6 @@
|
|
|
131
130
|
(base) => ({
|
|
132
131
|
updateFocusIndex: (focusIndex) => base.setState({ focusIndex }),
|
|
133
132
|
updateScrollTop: (index) => {
|
|
134
|
-
// the rows are the listbox's direct children
|
|
135
133
|
const destNode = listbox?.children[index];
|
|
136
134
|
if (listbox && destNode instanceof HTMLElement) {
|
|
137
135
|
centerInScroller(destNode, listbox);
|
|
@@ -143,7 +141,6 @@
|
|
|
143
141
|
updateSelection: (selection) => base.setState({ selection }),
|
|
144
142
|
notifySearch: (inputValue) => onSearch?.(inputValue),
|
|
145
143
|
notifyChange: (next) => {
|
|
146
|
-
// the bindable prop is the source of truth: bound, the write reaches the parent; unbound, it overrides locally
|
|
147
144
|
value = next;
|
|
148
145
|
onChange?.(next);
|
|
149
146
|
},
|
|
@@ -269,7 +266,6 @@
|
|
|
269
266
|
useClickOutside(
|
|
270
267
|
[() => root, () => listbox],
|
|
271
268
|
(event) => {
|
|
272
|
-
// without a rendered list there is nothing to close
|
|
273
269
|
if (listbox) {
|
|
274
270
|
foundation.handleClickOutside(event);
|
|
275
271
|
}
|
|
@@ -286,7 +282,6 @@
|
|
|
286
282
|
input?.blur();
|
|
287
283
|
}
|
|
288
284
|
|
|
289
|
-
/** The root div, which wraps the input or the custom trigger */
|
|
290
285
|
export function getNativeElement() {
|
|
291
286
|
return root;
|
|
292
287
|
}
|
|
@@ -3,15 +3,12 @@ import type { ClassValue, HTMLAttributes, HTMLInputAttributes } from 'svelte/ele
|
|
|
3
3
|
import type { Size } from '@fibrae/semi-foundation/utils/type';
|
|
4
4
|
import type { ValidateStatus } from '../input/index.js';
|
|
5
5
|
import type { Position } from '../tooltip/index.js';
|
|
6
|
-
/** An object item of `data`; markup for its row goes in the `item` snippet */
|
|
7
6
|
export interface AutoCompleteDataItem {
|
|
8
7
|
[key: string]: any;
|
|
9
8
|
value?: string | number;
|
|
10
9
|
label?: string | number;
|
|
11
10
|
disabled?: boolean;
|
|
12
|
-
/** On the item's row */
|
|
13
11
|
class?: ClassValue;
|
|
14
|
-
/** On the item's row */
|
|
15
12
|
style?: string;
|
|
16
13
|
}
|
|
17
14
|
export type AutoCompleteItems = AutoCompleteDataItem | string | number;
|
|
@@ -20,11 +17,9 @@ export type AutoCompleteSelectedItem<T extends AutoCompleteItems> = T extends st
|
|
|
20
17
|
export interface AutoCompleteItemSnippetProps<T extends AutoCompleteItems = AutoCompleteItems> {
|
|
21
18
|
/** The data item as given: a string item stays a string */
|
|
22
19
|
item: T;
|
|
23
|
-
/** Position among the rendered items */
|
|
24
20
|
index: number;
|
|
25
21
|
}
|
|
26
22
|
export interface AutoCompleteTriggerSnippetProps {
|
|
27
|
-
/** The selected item, if any */
|
|
28
23
|
value: AutoCompleteDataItem[];
|
|
29
24
|
inputValue?: string | number;
|
|
30
25
|
placeholder?: string;
|
|
@@ -39,7 +34,6 @@ export interface AutoCompleteTriggerSnippetProps {
|
|
|
39
34
|
onClear: () => void;
|
|
40
35
|
onFocus: (event: FocusEvent) => void;
|
|
41
36
|
onBlur: (event: FocusEvent) => void;
|
|
42
|
-
/** The aria-* attributes given to the AutoComplete, for the custom trigger's focusable element */
|
|
43
37
|
controlAttrs: Record<string, unknown>;
|
|
44
38
|
}
|
|
45
39
|
type NativeKeys = 'children' | 'prefix' | 'placeholder' | 'onchange' | 'onselect' | 'onfocus' | 'onblur';
|
|
@@ -84,11 +78,8 @@ export interface AutoCompleteProps<T extends AutoCompleteItems = AutoCompleteIte
|
|
|
84
78
|
suffix?: Snippet;
|
|
85
79
|
insetLabel?: Snippet;
|
|
86
80
|
clearIcon?: Snippet;
|
|
87
|
-
/** Shown in the list when `data` is empty */
|
|
88
81
|
emptyContent?: Snippet;
|
|
89
|
-
/** Content of an item row; without it the row shows the item's label */
|
|
90
82
|
item?: Snippet<[AutoCompleteItemSnippetProps<T>]>;
|
|
91
|
-
/** Replaces the input */
|
|
92
83
|
trigger?: Snippet<[AutoCompleteTriggerSnippetProps]>;
|
|
93
84
|
}
|
|
94
85
|
export {};
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { getPopupLayerContext } from '../_base/popup-layer.js';
|
|
4
4
|
import { type AvatarGroupMoreValue, setAvatarGroupMoreContext } from './context.js';
|
|
5
5
|
|
|
6
|
-
// setContext covers this component's subtree, so the `more` content gets its own component scope
|
|
7
6
|
let { children, ...value }: Omit<AvatarGroupMoreValue, 'layer'> & { children: Snippet } = $props();
|
|
8
7
|
|
|
9
8
|
const layer = getPopupLayerContext();
|