@fibrae/semi-ui-svelte 0.1.1 → 0.3.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/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-content.svelte +4 -4
- package/dist/feedback/feedback.svelte +0 -1
- package/dist/feedback/interface.d.ts +4 -12
- 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 +9 -5
- package/dist/form/field-inner.svelte.d.ts +3 -1
- package/dist/form/field.svelte +9 -2
- package/dist/form/field.svelte.d.ts +6 -2
- package/dist/form/form-auto-complete.svelte +7 -1
- package/dist/form/form-auto-complete.svelte.d.ts +3 -1
- package/dist/form/form-cascader.svelte +7 -1
- package/dist/form/form-cascader.svelte.d.ts +3 -1
- package/dist/form/form-checkbox-group.svelte +7 -1
- package/dist/form/form-checkbox-group.svelte.d.ts +3 -1
- package/dist/form/form-checkbox.svelte +7 -1
- package/dist/form/form-checkbox.svelte.d.ts +3 -1
- package/dist/form/form-date-picker.svelte +7 -1
- package/dist/form/form-date-picker.svelte.d.ts +3 -1
- package/dist/form/form-input-number.svelte +7 -1
- package/dist/form/form-input-number.svelte.d.ts +3 -1
- package/dist/form/form-input.svelte +7 -1
- package/dist/form/form-input.svelte.d.ts +3 -1
- package/dist/form/form-pin-code.svelte +7 -1
- package/dist/form/form-pin-code.svelte.d.ts +3 -1
- package/dist/form/form-radio-group.svelte +7 -1
- package/dist/form/form-radio-group.svelte.d.ts +3 -1
- package/dist/form/form-radio.svelte +7 -1
- package/dist/form/form-radio.svelte.d.ts +3 -1
- package/dist/form/form-rating.svelte +7 -1
- package/dist/form/form-rating.svelte.d.ts +3 -1
- package/dist/form/form-select.svelte +7 -1
- package/dist/form/form-select.svelte.d.ts +3 -1
- package/dist/form/form-slider.svelte +7 -1
- package/dist/form/form-slider.svelte.d.ts +3 -1
- package/dist/form/form-switch.svelte +7 -1
- package/dist/form/form-switch.svelte.d.ts +3 -1
- package/dist/form/form-tag-input.svelte +7 -1
- package/dist/form/form-tag-input.svelte.d.ts +3 -1
- package/dist/form/form-text-area.svelte +7 -1
- package/dist/form/form-text-area.svelte.d.ts +3 -1
- package/dist/form/form-time-picker.svelte +7 -1
- package/dist/form/form-time-picker.svelte.d.ts +3 -1
- package/dist/form/form-transfer.svelte +7 -1
- package/dist/form/form-transfer.svelte.d.ts +3 -1
- package/dist/form/form-tree-select.svelte +7 -1
- package/dist/form/form-tree-select.svelte.d.ts +3 -1
- package/dist/form/form-upload.svelte +7 -1
- package/dist/form/form-upload.svelte.d.ts +3 -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/icon-button/icon-button.svelte +6 -2
- 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/input-group.svelte +8 -2
- 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 +2 -2
- 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 +4 -5
- 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 +2 -2
- 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 +30 -14
- 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 +14 -11
- 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 +2 -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 +3 -3
- 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 +5 -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 +3 -3
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import useDefaultProps from '../_base/use-default-props.js';
|
|
5
5
|
import Button from '../button/button.svelte';
|
|
6
6
|
import { getButtonGroupContext } from '../button/context.js';
|
|
7
|
+
import { getInputGroupInScope } from '../input/context.js';
|
|
7
8
|
import type { IconButtonProps } from './interface.js';
|
|
8
9
|
|
|
9
10
|
const defaults = useDefaultProps('IconButton');
|
|
@@ -25,9 +26,12 @@
|
|
|
25
26
|
|
|
26
27
|
const group = getButtonGroupContext();
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
const inputGroup = getInputGroupInScope();
|
|
30
|
+
|
|
31
|
+
// Resolved here so the inner Button reads the IconButton global key, never its own.
|
|
32
|
+
// The resolved looks are passed down as own values, so the InputGroup must be folded in here too.
|
|
29
33
|
const looks = $derived(
|
|
30
|
-
resolveButtonLooks({ disabled, size, type, theme, colorful }, group, {
|
|
34
|
+
resolveButtonLooks({ disabled, size, type, theme, colorful }, group ?? inputGroup, {
|
|
31
35
|
disabled: defaults('disabled'),
|
|
32
36
|
size: defaults('size'),
|
|
33
37
|
type: defaults('type'),
|
package/dist/image/context.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export interface PreviewContextValue {
|
|
|
3
3
|
readonly srcList: string[];
|
|
4
4
|
readonly lazyLoad: boolean;
|
|
5
5
|
readonly lazyLoadMargin: string;
|
|
6
|
-
/** Opens the group preview at `index` */
|
|
7
6
|
open: (index: number) => void;
|
|
8
7
|
}
|
|
9
8
|
export declare const getPreviewContext: (caller?: string) => PreviewContextValue | undefined, setPreviewContext: (value: PreviewContextValue | undefined) => PreviewContextValue | undefined;
|
package/dist/image/footer.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { Snippet } from 'svelte';
|
|
|
2
2
|
import type { HTMLAttributes, HTMLImgAttributes } from 'svelte/elements';
|
|
3
3
|
import type { RatioType } from '@fibrae/semi-foundation/image/preview-inner-foundation';
|
|
4
4
|
export type { RatioType, RotateDirection, SwitchDirection } from '@fibrae/semi-foundation/image/preview-inner-foundation';
|
|
5
|
-
/** The preview's data and callbacks, shared by a group (`ImagePreview`) and the `preview` object of a single `Image` */
|
|
6
5
|
export interface PreviewOptions {
|
|
7
6
|
/** The images of the preview. A group lists the srcs its `Image` children open at */
|
|
8
7
|
src?: string | string[];
|
|
@@ -14,7 +13,6 @@ export interface PreviewOptions {
|
|
|
14
13
|
previewTitle?: string;
|
|
15
14
|
/** One per entry of `src`; the title of the shown image wins over `previewTitle` */
|
|
16
15
|
titles?: (string | undefined)[];
|
|
17
|
-
/** One per entry of `src`; the alt of the shown preview image */
|
|
18
16
|
alts?: (string | undefined)[];
|
|
19
17
|
maskClosable?: boolean;
|
|
20
18
|
closable?: boolean;
|
|
@@ -55,7 +53,6 @@ export interface PreviewOptions {
|
|
|
55
53
|
onDownload?: (src: string, index: number) => void;
|
|
56
54
|
onDownloadError?: (src: string) => void;
|
|
57
55
|
}
|
|
58
|
-
/** The `preview` object of a single Image: its custom nodes go through Image's snippets */
|
|
59
56
|
export type ImagePreviewProps = PreviewOptions;
|
|
60
57
|
/** The zoom values are percentages, as the footer shows them */
|
|
61
58
|
export interface MenuProps {
|
|
@@ -83,7 +80,6 @@ export interface MenuProps {
|
|
|
83
80
|
onRotateRight: () => void;
|
|
84
81
|
}
|
|
85
82
|
export interface ImagePreviewTitleSnippetProps {
|
|
86
|
-
/** The shown image's title, else `previewTitle` */
|
|
87
83
|
title: string | undefined;
|
|
88
84
|
index: number;
|
|
89
85
|
}
|
|
@@ -92,7 +88,6 @@ export interface ImagePreviewIconSnippetProps {
|
|
|
92
88
|
}
|
|
93
89
|
/** Custom nodes of the preview; on Image they apply to its own preview only, not inside a group */
|
|
94
90
|
export interface PreviewSnippets {
|
|
95
|
-
/** Replaces the title text; the dialog keeps its name */
|
|
96
91
|
title?: Snippet<[ImagePreviewTitleSnippetProps]>;
|
|
97
92
|
previewMenu?: Snippet<[MenuProps]>;
|
|
98
93
|
leftIcon?: Snippet<[ImagePreviewIconSnippetProps]>;
|
|
@@ -109,9 +104,7 @@ export interface PreviewProps extends Omit<HTMLAttributes<HTMLDivElement>, Nativ
|
|
|
109
104
|
visible?: boolean;
|
|
110
105
|
/** Bindable; leave it out for an uncontrolled preview. `bind:currentIndex={get, set}` makes it fully controlled */
|
|
111
106
|
currentIndex?: number;
|
|
112
|
-
/** Whether the images of the group wait for the viewport before they load */
|
|
113
107
|
lazyLoad?: boolean;
|
|
114
|
-
/** Margin around the viewport within which a lazy image of the group starts loading */
|
|
115
108
|
lazyLoadMargin?: string;
|
|
116
109
|
children?: Snippet;
|
|
117
110
|
}
|
|
@@ -125,7 +118,6 @@ export interface ImageProps extends Omit<HTMLImgAttributes, ImgNativeKeys>, Prev
|
|
|
125
118
|
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
126
119
|
/** A string is the src of the image shown when loading fails; a snippet renders instead of it */
|
|
127
120
|
fallback?: string | Snippet;
|
|
128
|
-
/** Shown while the image loads, instead of the skeleton */
|
|
129
121
|
placeholder?: Snippet;
|
|
130
122
|
preview?: boolean | ImagePreviewProps;
|
|
131
123
|
imgStyle?: string;
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
disableDownload: boolean;
|
|
19
19
|
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
20
20
|
initialZoom?: number;
|
|
21
|
-
/** The wheel event that set `zoom`, which the zoom centers on */
|
|
22
21
|
zoomEvent?: WheelEvent;
|
|
23
22
|
onZoom: (zoom: number, reportToUser: boolean) => void;
|
|
24
23
|
onLoad: (src: string) => void;
|
|
@@ -32,8 +31,6 @@
|
|
|
32
31
|
|
|
33
32
|
let container = $state.raw<HTMLDivElement | null>(null);
|
|
34
33
|
let image = $state.raw<HTMLImageElement | null>(null);
|
|
35
|
-
|
|
36
|
-
// What the foundation compares the next props against
|
|
37
34
|
let previous = untrack(() => ({ src, ratio, rotation, zoom }));
|
|
38
35
|
|
|
39
36
|
const { foundation, states } = useFoundation<Foundation, Adapter, PreviewImageBaseProps, PreviewImageBaseState>(
|
|
@@ -10,7 +10,6 @@ interface Props {
|
|
|
10
10
|
disableDownload: boolean;
|
|
11
11
|
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
12
12
|
initialZoom?: number;
|
|
13
|
-
/** The wheel event that set `zoom`, which the zoom centers on */
|
|
14
13
|
zoomEvent?: WheelEvent;
|
|
15
14
|
onZoom: (zoom: number, reportToUser: boolean) => void;
|
|
16
15
|
onLoad: (src: string) => void;
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
// Internal: Image and ImagePreview have already filled the global defaults
|
|
25
25
|
interface Props extends PreviewOptions, PreviewSnippets {
|
|
26
26
|
visible: boolean;
|
|
27
|
-
/** The alt of the previewed image when `alts` has no entry for it, for a single Image */
|
|
28
27
|
alt?: string;
|
|
29
28
|
/** Given by a group, which owns the index: a controlled index changes through it */
|
|
30
29
|
setCurrentIndex?: (index: number) => void;
|
|
@@ -198,7 +197,6 @@
|
|
|
198
197
|
// 0.29 * 100 is 28.999999999999996, which the slider would read out
|
|
199
198
|
const toPercent = (value: number) => Number((value * 100).toFixed(2));
|
|
200
199
|
|
|
201
|
-
// stable reference: the listener added on show is the one removed on hide
|
|
202
200
|
const handleKeyDown = (event: KeyboardEvent) => foundation.handleKeyDown(event);
|
|
203
201
|
|
|
204
202
|
const handlePrev = () => foundation.handleSwitchImage('prev');
|
|
@@ -212,7 +210,6 @@
|
|
|
212
210
|
}
|
|
213
211
|
});
|
|
214
212
|
|
|
215
|
-
// The preview takes the layer, scroll lock and focus once its dialog is in the document
|
|
216
213
|
$effect(() => {
|
|
217
214
|
const element = wrapEl;
|
|
218
215
|
if (!visible || !element) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { PreviewOptions, PreviewSnippets } from './interface.js';
|
|
2
2
|
interface Props extends PreviewOptions, PreviewSnippets {
|
|
3
3
|
visible: boolean;
|
|
4
|
-
/** The alt of the previewed image when `alts` has no entry for it, for a single Image */
|
|
5
4
|
alt?: string;
|
|
6
5
|
/** Given by a group, which owns the index: a controlled index changes through it */
|
|
7
6
|
setCurrentIndex?: (index: number) => void;
|
package/dist/input/context.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { InputSize } from './interface.js';
|
|
2
|
-
/** What an InputGroup hands to the controls inside it; read through the getters so group changes stay reactive */
|
|
3
2
|
export interface InputGroupContextValue {
|
|
4
3
|
/** Undefined when the group sets none, so a control falls back to the global default */
|
|
5
4
|
readonly size?: InputSize;
|
|
@@ -40,8 +40,14 @@
|
|
|
40
40
|
role="group"
|
|
41
41
|
{...rest}
|
|
42
42
|
class={[`${prefixCls}-group`, rest.class, { [`${prefixCls}-${size}`]: size !== undefined && size !== 'default' }]}
|
|
43
|
-
onfocusin={
|
|
44
|
-
|
|
43
|
+
onfocusin={(event) => {
|
|
44
|
+
rest.onfocusin?.(event);
|
|
45
|
+
onFocus?.(event);
|
|
46
|
+
}}
|
|
47
|
+
onfocusout={(event) => {
|
|
48
|
+
rest.onfocusout?.(event);
|
|
49
|
+
onBlur?.(event);
|
|
50
|
+
}}
|
|
45
51
|
>
|
|
46
52
|
{@render children?.()}
|
|
47
53
|
</span>
|
|
@@ -34,7 +34,6 @@ export interface InputProps extends Omit<HTMLInputAttributes, NativeInputKeys> {
|
|
|
34
34
|
/** When enabled, `onChange` fires once after an IME composition ends instead of during it */
|
|
35
35
|
composition?: boolean;
|
|
36
36
|
preventScroll?: boolean;
|
|
37
|
-
/** Focuses the input on mount, with `preventScroll` */
|
|
38
37
|
autofocus?: boolean;
|
|
39
38
|
/** Counted by `getValueLength` when given, otherwise the native attribute */
|
|
40
39
|
maxlength?: number;
|
|
@@ -83,7 +82,6 @@ export interface TextAreaProps extends Omit<HTMLTextareaAttributes, NativeTextAr
|
|
|
83
82
|
showClear?: boolean;
|
|
84
83
|
disabled?: boolean;
|
|
85
84
|
readonly?: boolean;
|
|
86
|
-
/** Focuses the textarea on mount */
|
|
87
85
|
autofocus?: boolean;
|
|
88
86
|
validateStatus?: ValidateStatus;
|
|
89
87
|
composition?: boolean;
|
|
@@ -121,7 +119,6 @@ export interface TextAreaState {
|
|
|
121
119
|
cachedValue?: string;
|
|
122
120
|
isFocus: boolean;
|
|
123
121
|
}
|
|
124
|
-
/** Label props plus the label element's attributes such as id, class and style; nodes go to the `fieldLabel` and `labelExtra` snippets */
|
|
125
122
|
export type InputGroupLabel = Omit<LabelProps, 'children' | 'extra'>;
|
|
126
123
|
/** Undeclared attributes go on the group's `role="group"` element and are not passed to the controls inside */
|
|
127
124
|
export interface InputGroupProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'onfocus' | 'onblur'> {
|
|
@@ -211,7 +211,6 @@
|
|
|
211
211
|
|
|
212
212
|
const handleScroll = (event: Event & { currentTarget: HTMLTextAreaElement }) => {
|
|
213
213
|
const { scrollTop } = event.currentTarget;
|
|
214
|
-
// the user's own listener keeps working next to the line number sync
|
|
215
214
|
(attrs.control.onscroll as ((event: Event) => void) | undefined)?.(event);
|
|
216
215
|
cancelAnimationFrame(scrollFrame);
|
|
217
216
|
scrollFrame = requestAnimationFrame(() => {
|
|
@@ -299,12 +298,10 @@
|
|
|
299
298
|
textarea?.setSelectionRange(start, end, direction);
|
|
300
299
|
}
|
|
301
300
|
|
|
302
|
-
/** The native textarea */
|
|
303
301
|
export function getTextarea() {
|
|
304
302
|
return textarea;
|
|
305
303
|
}
|
|
306
304
|
|
|
307
|
-
/** The root element, the wrapper div */
|
|
308
305
|
export function getNativeElement() {
|
|
309
306
|
return root;
|
|
310
307
|
}
|
|
@@ -234,12 +234,10 @@
|
|
|
234
234
|
input?.setSelectionRange(start, end, direction);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
/** The native input */
|
|
238
237
|
export function getInput() {
|
|
239
238
|
return input?.getInput();
|
|
240
239
|
}
|
|
241
240
|
|
|
242
|
-
/** The root element, the number wrapper div */
|
|
243
241
|
export function getNativeElement() {
|
|
244
242
|
return root;
|
|
245
243
|
}
|
|
@@ -17,7 +17,6 @@ export interface InputNumberProps extends Omit<InputProps, InputOnlyKeys> {
|
|
|
17
17
|
minimumFractionDigits?: number;
|
|
18
18
|
maximumFractionDigits?: number;
|
|
19
19
|
precision?: number;
|
|
20
|
-
/** Shows long numbers in exponent form, and the full number while focused */
|
|
21
20
|
scientificNotation?: boolean | ScientificNotationConfig;
|
|
22
21
|
showCurrencySymbol?: boolean;
|
|
23
22
|
formatter?: (value: number | string) => string;
|
|
@@ -13,7 +13,6 @@ export interface JsonViewerOptions extends Omit<CoreOptions, 'customRenderRule'
|
|
|
13
13
|
customRenderRule?: JsonViewerCustomRenderRule[];
|
|
14
14
|
}
|
|
15
15
|
export interface JsonViewerCustomRenderArgs {
|
|
16
|
-
/** The matched rule */
|
|
17
16
|
item: JsonViewerCustomRenderRule;
|
|
18
17
|
/** Its index in options.customRenderRule */
|
|
19
18
|
index: number;
|
|
@@ -21,7 +20,6 @@ export interface JsonViewerCustomRenderArgs {
|
|
|
21
20
|
content: string;
|
|
22
21
|
}
|
|
23
22
|
export interface JsonViewerSearchButtonArgs {
|
|
24
|
-
/** The default search button, drawn with `{@render defaultButton()}` */
|
|
25
23
|
defaultButton: Snippet;
|
|
26
24
|
showSearchBar: boolean;
|
|
27
25
|
onToggleSearchBar: () => void;
|
|
@@ -38,7 +36,6 @@ export interface JsonViewerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'c
|
|
|
38
36
|
height?: number | string;
|
|
39
37
|
showSearch?: boolean;
|
|
40
38
|
options?: JsonViewerOptions;
|
|
41
|
-
/** Whether to limit the search button drag bounds within the JsonViewer container */
|
|
42
39
|
limitSearchButtonBounds?: boolean;
|
|
43
40
|
onChange?: (value: string) => void;
|
|
44
41
|
/**
|
|
@@ -46,7 +43,6 @@ export interface JsonViewerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'c
|
|
|
46
43
|
* token's text in place, decided once when the token is laid out.
|
|
47
44
|
*/
|
|
48
45
|
customRender?: Snippet<[JsonViewerCustomRenderArgs]>;
|
|
49
|
-
/** Replaces the search button; draws the default one through `defaultButton` */
|
|
50
46
|
searchButton?: Snippet<[JsonViewerSearchButtonArgs]>;
|
|
51
47
|
}
|
|
52
48
|
export interface JsonViewerHandle {
|
|
@@ -36,8 +36,6 @@
|
|
|
36
36
|
// every layout rebuilds the spans, so a fresh id remounts each custom render on its new span
|
|
37
37
|
let customRenderEntries = $state.raw<CustomRenderEntry[]>([]);
|
|
38
38
|
let nextEntryId = 0;
|
|
39
|
-
|
|
40
|
-
// the options the editor was created with
|
|
41
39
|
let appliedOptions: JsonViewerOptions;
|
|
42
40
|
|
|
43
41
|
const prefix = cssClasses.PREFIX;
|
|
@@ -55,7 +53,6 @@
|
|
|
55
53
|
|
|
56
54
|
const sizeStyle = $derived(`width: ${toCssLength(width)}; height: ${toCssLength(height)}`);
|
|
57
55
|
|
|
58
|
-
// untracked, since only a change after creation matters
|
|
59
56
|
appliedOptions = untrack(() => mergedOptions);
|
|
60
57
|
|
|
61
58
|
// $bindable needs destructuring, so the foundation reads the props through getters. The core hands a rule's render
|
|
@@ -3,12 +3,10 @@ import type { ResponsiveMap } from '@fibrae/semi-foundation/grid/constants';
|
|
|
3
3
|
export type { ResponsiveMap };
|
|
4
4
|
export interface LayoutProps extends HTMLAttributes<HTMLElement> {
|
|
5
5
|
prefixCls?: string;
|
|
6
|
-
/** Tag of the root element */
|
|
7
6
|
tagName?: keyof HTMLElementTagNameMap;
|
|
8
7
|
/** Forces the has-sider class, for server rendering where a nested Sider has not registered yet */
|
|
9
8
|
hasSider?: boolean;
|
|
10
9
|
}
|
|
11
|
-
/** Props of Header, Footer and Content */
|
|
12
10
|
export interface LayoutBasicProps extends HTMLAttributes<HTMLElement> {
|
|
13
11
|
prefixCls?: string;
|
|
14
12
|
tagName?: keyof HTMLElementTagNameMap;
|
package/dist/list/interface.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { Snippet } from 'svelte';
|
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
import type { Size } from '@fibrae/semi-foundation/utils/type';
|
|
4
4
|
import type { ColProps, RowProps } from '../grid/interface.js';
|
|
5
|
-
/** Row and Col layout props shared by every item; `class` and `style` land on each item's Col */
|
|
6
5
|
export interface Grid extends Pick<RowProps, 'align' | 'gutter' | 'justify' | 'type'>, Pick<ColProps, 'span' | 'offset' | 'order' | 'push' | 'pull' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | 'class' | 'style'> {
|
|
7
6
|
}
|
|
8
7
|
export interface ListItemSnippetProps<T> {
|
|
@@ -23,7 +22,6 @@ export interface ListProps<T> extends Omit<HTMLAttributes<HTMLDivElement>, 'oncl
|
|
|
23
22
|
split?: boolean;
|
|
24
23
|
onClick?: (event: MouseEvent) => void;
|
|
25
24
|
onRightClick?: (event: MouseEvent) => void;
|
|
26
|
-
/** Renders each entry of `dataSource`, usually a ListItem */
|
|
27
25
|
item?: Snippet<[ListItemSnippetProps<T>]>;
|
|
28
26
|
header?: Snippet;
|
|
29
27
|
footer?: Snippet;
|
|
@@ -8,7 +8,7 @@ export interface LottieAnimation extends AnimationSource {
|
|
|
8
8
|
export interface LottieModule extends ModuleSource {
|
|
9
9
|
}
|
|
10
10
|
export interface LottieProps extends HTMLAttributes<HTMLDivElement> {
|
|
11
|
-
/**
|
|
11
|
+
/** It reloads when its content changes. */
|
|
12
12
|
params: LottieParams;
|
|
13
13
|
width?: string;
|
|
14
14
|
height?: string;
|
|
@@ -4,7 +4,6 @@ export default function codeText(children) {
|
|
|
4
4
|
if (Array.isArray(children))
|
|
5
5
|
return children.map(codeText).join('');
|
|
6
6
|
if (isNode(children)) {
|
|
7
|
-
// rehype plugins such as highlighters split the source into nested elements
|
|
8
7
|
return typeof children.type === 'string' ? codeText(children.props.children) : '';
|
|
9
8
|
}
|
|
10
9
|
return typeof children === 'string' || typeof children === 'number' ? String(children) : '';
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import type { MarkdownRenderElementProps } from '../interface.js';
|
|
7
7
|
import { isPlainText } from './tree.js';
|
|
8
8
|
|
|
9
|
-
// only the class (the fence language) carries meaning
|
|
10
9
|
const { children, node, class: className }: { class?: string } & MarkdownRenderElementProps = $props();
|
|
11
10
|
|
|
12
11
|
const language = $derived(MarkdownRenderFoundation.getCodeLanguage(className));
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { TypographyTitle, type TypographyTitleProps } from '../../typography/index.js';
|
|
4
4
|
import type { MarkdownRenderElementProps } from '../interface.js';
|
|
5
5
|
|
|
6
|
-
// attributes such as rehype-slug ids fall through to the title
|
|
7
6
|
const { children, node: _node, level, class: className, ...rest }: TypographyTitleProps & MarkdownRenderElementProps & { level: NonNullable<TypographyTitleProps['heading']> } = $props();
|
|
8
7
|
</script>
|
|
9
8
|
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
const { children, node, class: className, ...rest }: TypographyParagraphProps & MarkdownRenderElementProps = $props();
|
|
8
8
|
|
|
9
|
-
// a div, since the image component renders one
|
|
10
9
|
const component = $derived(node && containsImage(node.props.children) ? 'div' : undefined);
|
|
11
10
|
</script>
|
|
12
11
|
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import MarkdownChildren from '../markdown-children.svelte';
|
|
6
6
|
import { parseTable } from './tree.js';
|
|
7
7
|
|
|
8
|
-
// the cells come from `node`, so the children snippet is dropped
|
|
9
8
|
const { children: _children, node, ...rest }: TableProps & MarkdownRenderElementProps = $props();
|
|
10
9
|
|
|
11
10
|
const parsed = $derived(parseTable(node?.props.children));
|
|
@@ -2,20 +2,16 @@ import type { ColumnProps } from '../../table/index.js';
|
|
|
2
2
|
import { type MarkdownChild } from '../runtime.js';
|
|
3
3
|
/** The Semi img renders a div, which a p cannot hold. Known limit: only the Semi img is detected, not a replacement. */
|
|
4
4
|
export declare function containsImage(child: MarkdownChild): boolean;
|
|
5
|
-
/** A rehype plugin may split code text into elements, which have no source text to highlight */
|
|
6
5
|
export declare function isPlainText(child: MarkdownChild): boolean;
|
|
7
6
|
/** CodeHighlight's div and pre may not sit inside a pre, so the wrapper of a block the Semi code highlights goes */
|
|
8
7
|
export declare function isHighlightedBlock(child: MarkdownChild): boolean;
|
|
9
|
-
/** The plain text of a subtree, through components too */
|
|
10
8
|
export declare function textOf(child: MarkdownChild): string;
|
|
11
9
|
export interface ParsedTable {
|
|
12
10
|
columns: ColumnProps[];
|
|
13
11
|
dataSource: {
|
|
14
12
|
key: string;
|
|
15
13
|
}[];
|
|
16
|
-
/** Content of each header cell, by column */
|
|
17
14
|
head: MarkdownChild[];
|
|
18
|
-
/** Content of each body cell, by row and column */
|
|
19
15
|
body: MarkdownChild[][];
|
|
20
16
|
}
|
|
21
17
|
export declare function parseTable(content: MarkdownChild): ParsedTable;
|
|
@@ -7,7 +7,6 @@ const childNodes = (child) => (Array.isArray(child) ? child : [child]).filter(is
|
|
|
7
7
|
export function containsImage(child) {
|
|
8
8
|
return childNodes(child).some((node) => node.type === Img || containsImage(node.props.children));
|
|
9
9
|
}
|
|
10
|
-
/** A rehype plugin may split code text into elements, which have no source text to highlight */
|
|
11
10
|
export function isPlainText(child) {
|
|
12
11
|
return Array.isArray(child) ? child.every(isPlainText) : !isNode(child);
|
|
13
12
|
}
|
|
@@ -19,7 +18,6 @@ export function isHighlightedBlock(child) {
|
|
|
19
18
|
const { type, props } = content[0];
|
|
20
19
|
return type === Code && Boolean(MarkdownRenderFoundation.getCodeLanguage(props.class)) && isPlainText(props.children);
|
|
21
20
|
}
|
|
22
|
-
/** The plain text of a subtree, through components too */
|
|
23
21
|
export function textOf(child) {
|
|
24
22
|
if (Array.isArray(child))
|
|
25
23
|
return child.map(textOf).join('');
|
|
@@ -7,7 +7,6 @@ export type MarkdownRenderComponents = Partial<{
|
|
|
7
7
|
}> & Record<string, Component<any> | keyof SvelteHTMLElements | undefined>;
|
|
8
8
|
/** Props a component in `components` receives besides the attributes of its element */
|
|
9
9
|
export interface MarkdownRenderElementProps {
|
|
10
|
-
/** The content, rendered */
|
|
11
10
|
children?: Snippet;
|
|
12
11
|
/**
|
|
13
12
|
* The compiled element. `node.props.children` is the source tree of the content: `codeText(node.props.children)` is
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { omitBy } from 'es-toolkit';
|
|
4
4
|
import { type MarkdownChild, Fragment, isNode, voidTags } from './runtime.js';
|
|
5
5
|
|
|
6
|
-
// The compiled tree is data, so the table component can render the cells it picks out of it with this same component.
|
|
7
6
|
const { content }: { content: MarkdownChild } = $props();
|
|
8
7
|
|
|
9
8
|
// the compiled `children` is a node tree, which would compete with the `children` snippet
|
|
@@ -43,7 +42,6 @@
|
|
|
43
42
|
{/if}
|
|
44
43
|
{:else}
|
|
45
44
|
{@const Element = child.type as Component<any>}
|
|
46
|
-
<!-- `node` is the compiled element: a component reads the source of its children there, which a children snippet hides -->
|
|
47
45
|
{#if child.props.children === undefined}
|
|
48
46
|
<Element {...child.props} node={child} />
|
|
49
47
|
{:else}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const Fragment = Symbol('MarkdownRender.Fragment');
|
|
2
|
-
// Svelte has no JSX runtime, so the compiled source yields a plain node tree that markdown-render.svelte renders.
|
|
3
2
|
function jsx(type, props) {
|
|
4
3
|
// MDX hands a `components.wrapper` its content as the element `<_createMdxContent />`, a plain function that is
|
|
5
4
|
// not a Svelte component; calling it yields the content tree. Known limit: relies on the name @mdx-js/mdx emits.
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
import type { ConfirmProps, ModalNode } from './interface.js';
|
|
8
8
|
import Modal from './modal.svelte';
|
|
9
9
|
|
|
10
|
-
// The options Modal declares itself reach it through `...rest`
|
|
11
10
|
let { type, title, content, icon, closeIcon, header, footer, direction, visible, onOk, onCancel, class: className, ...rest }: ConfirmProps = $props();
|
|
12
11
|
|
|
13
12
|
const config = getConfigContext();
|
|
@@ -17,5 +17,4 @@ export declare function openConfirm({ afterClose, ...others }: ConfirmProps, { c
|
|
|
17
17
|
close: () => void;
|
|
18
18
|
};
|
|
19
19
|
export default function confirm(props: ConfirmProps): ModalHookRef;
|
|
20
|
-
/** The props of `Modal.<type>()`; ConfirmModal adds the type's icon */
|
|
21
20
|
export declare function withType(type: ConfirmProps['type'], props: ModalConfirmProps): ConfirmProps;
|
|
@@ -64,7 +64,6 @@ export default function confirm(props) {
|
|
|
64
64
|
destroyFns.push(close);
|
|
65
65
|
return ref;
|
|
66
66
|
}
|
|
67
|
-
/** The props of `Modal.<type>()`; ConfirmModal adds the type's icon */
|
|
68
67
|
export function withType(type, props) {
|
|
69
68
|
return { type, ...resolveConfirmProps(type, props) };
|
|
70
69
|
}
|
package/dist/modal/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import confirm, { destroyAll, withType } from './confirm.svelte.js';
|
|
|
2
2
|
import ModalBase from './modal.svelte';
|
|
3
3
|
import useModal from './use-modal.js';
|
|
4
4
|
const typed = (type) => (props) => confirm(withType(type, props));
|
|
5
|
-
// Svelte components are functions, so the static methods attach to the component itself
|
|
6
5
|
export const Modal = Object.assign(ModalBase, {
|
|
7
6
|
useModal,
|
|
8
7
|
info: typed('info'),
|
|
@@ -59,7 +59,6 @@ export interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'
|
|
|
59
59
|
onCancel?: (event: MouseEvent | KeyboardEvent) => unknown;
|
|
60
60
|
/** A returned Promise keeps the ok button loading until it settles; closing is the caller's job. */
|
|
61
61
|
onOk?: (event: MouseEvent) => unknown;
|
|
62
|
-
/** Plain text or a snippet. */
|
|
63
62
|
title?: string | Snippet;
|
|
64
63
|
/** A snippet replaces the default header (title, icon, close button); null renders no header. */
|
|
65
64
|
header?: Snippet | null;
|
|
@@ -73,9 +72,7 @@ export interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'
|
|
|
73
72
|
}]>;
|
|
74
73
|
role?: 'dialog' | 'alertdialog';
|
|
75
74
|
}
|
|
76
|
-
/** A text, or a snippet rendered where the option belongs */
|
|
77
75
|
export type ModalNode = string | Snippet;
|
|
78
|
-
/** Options of Modal.confirm/info/success/warning/error and of the useModal methods */
|
|
79
76
|
export interface ModalConfirmProps extends Omit<ModalProps, 'title' | 'visible' | 'header' | 'footer' | 'icon' | 'closeIcon' | 'children'> {
|
|
80
77
|
title?: ModalNode;
|
|
81
78
|
content?: ModalNode;
|
|
@@ -92,9 +89,7 @@ export interface ModalConfirmProps extends Omit<ModalProps, 'title' | 'visible'
|
|
|
92
89
|
visible?: boolean;
|
|
93
90
|
}
|
|
94
91
|
export interface ModalHookRef {
|
|
95
|
-
/** Closes the dialog through its leave animation */
|
|
96
92
|
destroy: () => void;
|
|
97
|
-
/** Merges into the dialog's current options */
|
|
98
93
|
update: (config: ModalConfirmProps) => void;
|
|
99
94
|
}
|
|
100
95
|
export interface ModalHookApi {
|
|
@@ -104,7 +99,6 @@ export interface ModalHookApi {
|
|
|
104
99
|
warning: (config: ModalConfirmProps) => ModalHookRef;
|
|
105
100
|
confirm: (config: ModalConfirmProps) => ModalHookRef;
|
|
106
101
|
}
|
|
107
|
-
/** A confirm's options with its type, as ConfirmModal receives them */
|
|
108
102
|
export interface ConfirmProps extends ModalConfirmProps {
|
|
109
103
|
type: ConfirmType;
|
|
110
104
|
}
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
type Foundation = ModalContentFoundation<FoundationProps, MouseEvent>;
|
|
23
23
|
type Adapter = ModalContentAdapter<FoundationProps, MouseEvent>;
|
|
24
24
|
|
|
25
|
-
// Internal: Modal passes every prop below; the rest are the caller's attributes
|
|
26
25
|
interface Props extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'children'> {
|
|
27
26
|
visible: boolean;
|
|
28
27
|
motion: boolean;
|
|
@@ -146,8 +145,6 @@
|
|
|
146
145
|
const labelledby = $derived(!attrs.control['aria-label'] && !isCustomHeader && hasTitle ? `${idPrefix}-title` : undefined);
|
|
147
146
|
const modalDialog = $derived(isModal({ mask, maskFixed, inBody }));
|
|
148
147
|
const heightSet = $derived(Boolean(height) || /(^|;)\s*height\s*:/.test(userStyle ?? ''));
|
|
149
|
-
|
|
150
|
-
// only set keys, so an unset width does not wipe the caller's style
|
|
151
148
|
const sizeStyle = $derived(isFullScreen ? 'width: 100%; height: 100%; margin: unset' : [width ? `width: ${toCssLength(width)}` : '', height ? `height: ${toCssLength(height)}` : ''].filter(Boolean).join('; '));
|
|
152
149
|
const boxStyle = $derived([userStyle, sizeStyle].filter(Boolean).join(';') || undefined);
|
|
153
150
|
|
|
@@ -203,7 +200,6 @@
|
|
|
203
200
|
{/snippet}
|
|
204
201
|
|
|
205
202
|
{#snippet dialogPart()}
|
|
206
|
-
<!-- tabindex lets the dialog itself take focus -->
|
|
207
203
|
<div
|
|
208
204
|
aria-labelledby={labelledby}
|
|
209
205
|
aria-modal={modalDialog ? 'true' : undefined}
|
package/dist/modal/modal.svelte
CHANGED
|
@@ -2,10 +2,8 @@ import type { Attachment } from 'svelte/attachments';
|
|
|
2
2
|
interface ShowHideOptions {
|
|
3
3
|
visible: () => boolean;
|
|
4
4
|
motion: () => boolean;
|
|
5
|
-
/** Classes the foundation SCSS animates; the keyframes live only there */
|
|
6
5
|
showClass: string;
|
|
7
6
|
hideClass: string;
|
|
8
|
-
/** The leave animation has ended, or a hide needed none */
|
|
9
7
|
onHidden?: () => void;
|
|
10
8
|
}
|
|
11
9
|
/**
|
|
@@ -8,10 +8,8 @@ export default function useShowHide({ visible, motion, showClass, hideClass, onH
|
|
|
8
8
|
let node = $state.raw(null);
|
|
9
9
|
// true from a show until the leave has ended, so the element is laid out the whole time it can be seen
|
|
10
10
|
let displayed = $state(untrack(visible));
|
|
11
|
-
// true while the show or hide class is applied
|
|
12
11
|
let animating = $state(false);
|
|
13
12
|
let first = true;
|
|
14
|
-
// identifies the latest animation check, so a check of a replaced run does nothing
|
|
15
13
|
let runs = 0;
|
|
16
14
|
const finish = () => {
|
|
17
15
|
animating = false;
|
|
@@ -23,7 +21,6 @@ export default function useShowHide({ visible, motion, showClass, hideClass, onH
|
|
|
23
21
|
const attach = (element) => {
|
|
24
22
|
node = element;
|
|
25
23
|
const controller = new AbortController();
|
|
26
|
-
// animation events bubble; a descendant's animation is not this run
|
|
27
24
|
element.addEventListener('animationend', (event) => {
|
|
28
25
|
if (event.target === element && animating) {
|
|
29
26
|
finish();
|
|
@@ -42,7 +39,6 @@ export default function useShowHide({ visible, motion, showClass, hideClass, onH
|
|
|
42
39
|
if (isVisible) {
|
|
43
40
|
displayed = true;
|
|
44
41
|
}
|
|
45
|
-
// a dialog that was never shown has nothing to leave
|
|
46
42
|
animating = withMotion && !(first && !isVisible);
|
|
47
43
|
first = false;
|
|
48
44
|
if (!animating && !isVisible) {
|
|
@@ -3,9 +3,7 @@ import type { ItemKey, Mode, NavClickData, NavOpenChangeData, NavProps, OnSelect
|
|
|
3
3
|
export interface NavContextValue {
|
|
4
4
|
readonly isCollapsed: boolean;
|
|
5
5
|
readonly mode: Mode;
|
|
6
|
-
/** True below a Sub: its title and list, inline or in the popup */
|
|
7
6
|
readonly isInSubNav: boolean;
|
|
8
|
-
/** Nesting depth of the items and Subs rendered at this point, 0 at the top */
|
|
9
7
|
readonly level: number;
|
|
10
8
|
readonly openKeys: ItemKey[];
|
|
11
9
|
readonly openKeysIsControlled: boolean;
|
package/dist/navigation/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import NavHeaderPart from './nav-header.svelte';
|
|
|
3
3
|
import NavItemPart from './nav-item.svelte';
|
|
4
4
|
import NavBase from './nav.svelte';
|
|
5
5
|
import SubNavPart from './sub-nav.svelte';
|
|
6
|
-
// Svelte components are functions, so the parts attach to the component itself
|
|
7
6
|
export const Nav = Object.assign(NavBase, { Sub: SubNavPart, Item: NavItemPart, Header: NavHeaderPart, Footer: NavFooterPart });
|
|
8
7
|
export { default as NavFooter } from './nav-footer.svelte';
|
|
9
8
|
export { default as NavHeader } from './nav-header.svelte';
|