@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
|
@@ -18,10 +18,8 @@ export type FeedbackCheckboxGroupProps = Omit<CheckboxGroupProps, 'value'>;
|
|
|
18
18
|
export type FeedbackRadioSnippetProps = RadioGroupOptionSnippetParams;
|
|
19
19
|
export type FeedbackCheckboxSnippetProps = CheckboxGroupOptionSnippetProps;
|
|
20
20
|
export interface FeedbackContentSnippetProps {
|
|
21
|
-
/** The built-in content; place it with `{@render content()}`. */
|
|
22
21
|
content: Snippet;
|
|
23
22
|
}
|
|
24
|
-
/** The props Feedback declares itself; the rest go to the Modal or SideSheet of the current mode. */
|
|
25
23
|
export interface FeedbackOwnProps {
|
|
26
24
|
mode?: FeedbackMode;
|
|
27
25
|
type?: FeedbackType;
|
|
@@ -40,11 +38,9 @@ export interface FeedbackOwnProps {
|
|
|
40
38
|
/** Cancel button, close button, Escape and (modal) mask click. `visible` becomes false once it returns, or once a returned Promise fulfills. */
|
|
41
39
|
onCancel?: (event: MouseEvent | KeyboardEvent) => unknown;
|
|
42
40
|
onValueChange?: (value: FeedbackValue) => void;
|
|
43
|
-
/** Called once the dialog has closed. */
|
|
44
41
|
afterClose?: () => void;
|
|
45
42
|
/** Popup only. */
|
|
46
43
|
afterVisibleChange?: (visible: boolean) => void;
|
|
47
|
-
/** Content of type="custom". */
|
|
48
44
|
children?: Snippet;
|
|
49
45
|
/** Wraps or replaces the built-in content, whatever the type. */
|
|
50
46
|
content?: Snippet<[FeedbackContentSnippetProps]>;
|
|
@@ -53,7 +49,6 @@ export interface FeedbackOwnProps {
|
|
|
53
49
|
closeIcon?: Snippet;
|
|
54
50
|
/** Modal only. A snippet replaces the default header; null renders no header. */
|
|
55
51
|
header?: Snippet | null;
|
|
56
|
-
/** Modal only. */
|
|
57
52
|
icon?: Snippet;
|
|
58
53
|
/** Modal only. `modal` is the role="dialog" element; place it with `{@render modal()}`. */
|
|
59
54
|
modal?: Snippet<[{
|
|
@@ -64,11 +59,9 @@ export interface FeedbackOwnProps {
|
|
|
64
59
|
checkboxLabel?: Snippet<[FeedbackCheckboxSnippetProps]>;
|
|
65
60
|
checkboxExtra?: Snippet<[FeedbackCheckboxSnippetProps]>;
|
|
66
61
|
}
|
|
67
|
-
/** What a template can pass for `mode="modal"`: the Modal props. */
|
|
68
62
|
export interface FeedbackModalProps extends Omit<FeedbackOwnProps, 'mode'>, Omit<ModalProps, keyof FeedbackOwnProps> {
|
|
69
63
|
mode: 'modal';
|
|
70
64
|
}
|
|
71
|
-
/** What a template can pass for `mode="popup"`: the SideSheet props. */
|
|
72
65
|
export interface FeedbackSideSheetProps extends FeedbackOwnProps, Omit<SideSheetProps, keyof FeedbackOwnProps> {
|
|
73
66
|
mode?: 'popup';
|
|
74
67
|
}
|
|
@@ -77,7 +70,6 @@ export interface FeedbackSideSheetProps extends FeedbackOwnProps, Omit<SideSheet
|
|
|
77
70
|
* TypeScript cannot index once both carry all the HTML attributes.
|
|
78
71
|
*/
|
|
79
72
|
export type FeedbackProps = FeedbackOwnProps & Omit<ModalProps, keyof FeedbackOwnProps> & Omit<SideSheetProps, keyof FeedbackOwnProps>;
|
|
80
|
-
/** Internal props of FeedbackContent */
|
|
81
73
|
export interface FeedbackContentProps extends Pick<FeedbackOwnProps, 'children' | 'radioLabel' | 'radioExtra' | 'checkboxLabel' | 'checkboxExtra'> {
|
|
82
74
|
type: FeedbackType;
|
|
83
75
|
value: FeedbackValue | null;
|
|
@@ -14,13 +14,11 @@
|
|
|
14
14
|
|
|
15
15
|
let { disabled = false, href, rel, target, onclick, children, ...rest }: Props = $props();
|
|
16
16
|
|
|
17
|
-
// the props are typed for the button; the listeners and attributes a link takes are the same ones
|
|
18
17
|
const linkRest = $derived(rest as HTMLAnchorAttributes);
|
|
19
18
|
|
|
20
19
|
// Chrome still delivers a click from a child of a disabled button.
|
|
21
20
|
const handleClick = (event: MouseEvent & { currentTarget: EventTarget & HTMLElement }) => {
|
|
22
21
|
if (!disabled) {
|
|
23
|
-
// the consumer's handler is typed for the button, the link renders the same props
|
|
24
22
|
onclick?.(event as MouseEvent & { currentTarget: EventTarget & HTMLButtonElement });
|
|
25
23
|
}
|
|
26
24
|
};
|
|
@@ -17,7 +17,6 @@ export interface FloatButtonProps extends Omit<HTMLButtonAttributes, 'children'
|
|
|
17
17
|
shape?: FloatButtonShape;
|
|
18
18
|
size?: FloatButtonSize;
|
|
19
19
|
target?: string;
|
|
20
|
-
/** Custom badge count, in place of `badge.count` */
|
|
21
20
|
badgeCount?: Snippet;
|
|
22
21
|
icon?: Snippet;
|
|
23
22
|
}
|
|
@@ -25,7 +24,6 @@ export interface FloatButtonGroupItem extends Pick<FloatButtonProps, 'badge' | '
|
|
|
25
24
|
/** Accessible name, required when the item shows only an icon */
|
|
26
25
|
'aria-label'?: string;
|
|
27
26
|
class?: string;
|
|
28
|
-
/** Text; richer content is the `content` snippet */
|
|
29
27
|
content?: string | number;
|
|
30
28
|
id?: string;
|
|
31
29
|
/** Called before the group's `onClick` */
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
},
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
// an outside update (formApi.setValue, setValues) renews updateKey
|
|
55
54
|
const syncKeys = () => {
|
|
56
55
|
const updateKey = bridge.getArrayField(field)?.updateKey;
|
|
57
56
|
if (updateKey !== cachedUpdateKey) {
|
|
@@ -75,7 +74,6 @@
|
|
|
75
74
|
// a new key at the position: regenerating by position would keep the old keys, so fields keep stale values
|
|
76
75
|
keys = keys.toSpliced(added.index, 0, createId());
|
|
77
76
|
cachedUpdateKey = added.updateKey;
|
|
78
|
-
// the new row's fields take the given row value, as after syncKeys
|
|
79
77
|
shouldUseInitValue = false;
|
|
80
78
|
}
|
|
81
79
|
};
|
package/dist/form/context.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { FieldBridge, FormState } from '@fibrae/semi-foundation/form/interf
|
|
|
2
2
|
import type { FormApi, FormProps } from './interface.js';
|
|
3
3
|
export interface FormContextValue {
|
|
4
4
|
readonly formState: FormState;
|
|
5
|
-
/** The Form props with their defaults resolved, read by the fields while rendering */
|
|
6
5
|
readonly formProps: FormProps;
|
|
7
6
|
formApi: FormApi;
|
|
8
7
|
bridge: FieldBridge;
|
|
@@ -12,7 +11,6 @@ export interface ArrayFieldContextValue {
|
|
|
12
11
|
/** The values the rows read their initial values from until the ArrayField's own mount write is rendered */
|
|
13
12
|
readonly values?: Record<string, any>;
|
|
14
13
|
}
|
|
15
|
-
/** The ids FormInputGroup adds to each field's own aria references */
|
|
16
14
|
export interface FormInputGroupAria {
|
|
17
15
|
labelledby?: string;
|
|
18
16
|
describedby?: string;
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
<IconAlertTriangle class={iconClass} />
|
|
35
35
|
{/if}
|
|
36
36
|
{/if}
|
|
37
|
-
<!-- the span id is the target of aria-errormessage and aria-describedby -->
|
|
38
37
|
{#if error}
|
|
39
38
|
<span id={errorMessageId}>
|
|
40
39
|
{#if errorContent}{@render errorContent({ error })}{:else}{errorText(error)}{/if}
|
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
interface FieldGridProps {
|
|
10
10
|
label?: Snippet;
|
|
11
|
-
/** The main content: the control, its messages and extra text */
|
|
12
11
|
children?: Snippet;
|
|
13
12
|
mainClass?: ClassValue;
|
|
14
13
|
labelAlign?: string;
|
|
15
14
|
labelCol?: ColProps;
|
|
16
15
|
wrapperCol?: ColProps;
|
|
17
16
|
labelPosition?: string;
|
|
18
|
-
/** Wraps the columns in their own Row, for a field whose columns the Form does not set */
|
|
19
17
|
row?: boolean;
|
|
20
18
|
}
|
|
21
19
|
|
|
@@ -3,14 +3,12 @@ import type { ClassValue } from 'svelte/elements';
|
|
|
3
3
|
import type { ColProps } from '../grid/interface.js';
|
|
4
4
|
interface FieldGridProps {
|
|
5
5
|
label?: Snippet;
|
|
6
|
-
/** The main content: the control, its messages and extra text */
|
|
7
6
|
children?: Snippet;
|
|
8
7
|
mainClass?: ClassValue;
|
|
9
8
|
labelAlign?: string;
|
|
10
9
|
labelCol?: ColProps;
|
|
11
10
|
wrapperCol?: ColProps;
|
|
12
11
|
labelPosition?: string;
|
|
13
|
-
/** Wraps the columns in their own Row, for a field whose columns the Form does not set */
|
|
14
12
|
row?: boolean;
|
|
15
13
|
}
|
|
16
14
|
declare const FieldGrid: import("svelte").Component<FieldGridProps, {}, "">;
|
|
@@ -60,7 +60,6 @@
|
|
|
60
60
|
...rest
|
|
61
61
|
}: InnerProps = $props();
|
|
62
62
|
|
|
63
|
-
// rendered only inside a Form, see field.svelte
|
|
64
63
|
const form = getFormContext() as FormContextValue;
|
|
65
64
|
const arrayField = getArrayFieldContext();
|
|
66
65
|
const group = getFormInputGroupContext();
|
|
@@ -98,7 +97,6 @@
|
|
|
98
97
|
const ownLayout = $derived(!group && !pure);
|
|
99
98
|
const shellLabel = $derived(ownLayout && !noLabel && shownLabelPosition !== 'inset');
|
|
100
99
|
|
|
101
|
-
// FormInputGroup adds its ids to the field's own references
|
|
102
100
|
const ownAria = $derived.by((): Record<string, unknown> => {
|
|
103
101
|
if (!group) {
|
|
104
102
|
return rest;
|
package/dist/form/field.svelte
CHANGED
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
warning(!bare && !inForm, '[Semi Form]: Field Component must be use inside the Form, please check your dom declaration');
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
// The wrapped control's instance, for calling its own methods (focus, open ...)
|
|
32
31
|
export function getControl() {
|
|
33
32
|
return bareControl ?? inner?.getControl();
|
|
34
33
|
}
|
package/dist/form/form.svelte
CHANGED
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
const uid = $props.id();
|
|
54
54
|
let formElement = $state<HTMLFormElement>();
|
|
55
55
|
|
|
56
|
-
// The props with their defaults resolved: the foundation reads them through getProps, the fields through the context
|
|
57
56
|
const formProps: FormProps<Values> = {
|
|
58
57
|
get initValues() {
|
|
59
58
|
return initValues;
|
package/dist/form/hooks.d.ts
CHANGED
|
@@ -2,9 +2,8 @@ import type { FieldError, FormApi, FormState } from './interface.js';
|
|
|
2
2
|
type FieldPath = string | (() => string);
|
|
3
3
|
/** The formApi of the enclosing Form; an empty object outside one. Call it during component initialisation. */
|
|
4
4
|
export declare function useFormApi<Values extends Record<string, any> = any>(): FormApi<Values>;
|
|
5
|
-
/**
|
|
5
|
+
/** An empty object outside a Form; call the result in the template to follow the state */
|
|
6
6
|
export declare function useFormState<Values extends Record<string, any> = any>(): () => FormState<Values>;
|
|
7
|
-
/** The formApi methods of one field; a getter path follows its changes */
|
|
8
7
|
export declare function useFieldApi(field: FieldPath): {
|
|
9
8
|
getError: () => any;
|
|
10
9
|
setError: (error: FieldError) => void;
|
package/dist/form/hooks.js
CHANGED
|
@@ -5,12 +5,11 @@ const readPath = (field) => (typeof field === 'function' ? field() : field);
|
|
|
5
5
|
export function useFormApi() {
|
|
6
6
|
return getFormContext()?.formApi ?? {};
|
|
7
7
|
}
|
|
8
|
-
/**
|
|
8
|
+
/** An empty object outside a Form; call the result in the template to follow the state */
|
|
9
9
|
export function useFormState() {
|
|
10
10
|
const form = getFormContext();
|
|
11
11
|
return () => form?.formState ?? {};
|
|
12
12
|
}
|
|
13
|
-
/** The formApi methods of one field; a getter path follows its changes */
|
|
14
13
|
export function useFieldApi(field) {
|
|
15
14
|
const formApi = useFormApi();
|
|
16
15
|
return {
|
package/dist/form/interface.d.ts
CHANGED
|
@@ -16,14 +16,11 @@ export type FieldValidateResult = FieldError;
|
|
|
16
16
|
export interface LabelProps extends Omit<HTMLLabelAttributes, 'children'> {
|
|
17
17
|
/** Content of the label; the `children` snippet takes precedence */
|
|
18
18
|
text?: string | number;
|
|
19
|
-
/** text-align of the label */
|
|
20
19
|
align?: string;
|
|
21
20
|
disabled?: boolean;
|
|
22
21
|
/** Whether to display the required * symbol; hidden while `optional` is true */
|
|
23
22
|
required?: boolean;
|
|
24
|
-
/** Appends the locale's optional text */
|
|
25
23
|
optional?: boolean;
|
|
26
|
-
/** The id of the labeled field, written to the `for` attribute */
|
|
27
24
|
name?: string;
|
|
28
25
|
/** Width of the label; a number is in px */
|
|
29
26
|
width?: number | string;
|
|
@@ -68,7 +65,6 @@ export interface FormProps<Values extends Record<string, any> = any> extends Omi
|
|
|
68
65
|
};
|
|
69
66
|
/** Form-level validation; when set, it replaces the fields' own validation */
|
|
70
67
|
validator?: (values: Values) => FormValidateResult<Values> | Promise<FormValidateResult<Values>>;
|
|
71
|
-
/** The `formApi` returned by `useForm()` */
|
|
72
68
|
form?: FormApi<Values>;
|
|
73
69
|
/** Also written to `x-form-id`; generated when missing */
|
|
74
70
|
id?: string;
|
|
@@ -121,12 +117,10 @@ export interface CommonFieldProps {
|
|
|
121
117
|
id?: string;
|
|
122
118
|
fieldClassName?: string;
|
|
123
119
|
fieldStyle?: string;
|
|
124
|
-
/** Replaces the label text */
|
|
125
120
|
fieldLabel?: Snippet;
|
|
126
121
|
labelExtra?: Snippet;
|
|
127
122
|
/** Shown in the error message's place while the field has no error */
|
|
128
123
|
helpText?: Snippet;
|
|
129
|
-
/** Shown together with the error or the help text */
|
|
130
124
|
extraText?: Snippet;
|
|
131
125
|
/** Renders the error; the default joins the messages with commas */
|
|
132
126
|
error?: Snippet<[{
|
|
@@ -219,7 +213,6 @@ export interface SlotProps extends Omit<HTMLAttributes<HTMLDivElement>, 'childre
|
|
|
219
213
|
noLabel?: boolean;
|
|
220
214
|
error?: FieldError;
|
|
221
215
|
children?: Snippet;
|
|
222
|
-
/** Replaces the label text */
|
|
223
216
|
fieldLabel?: Snippet;
|
|
224
217
|
labelExtra?: Snippet;
|
|
225
218
|
errorContent?: Snippet<[{
|
package/dist/form/utils.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export declare function omitFieldProps(props: Record<string, unknown>): {
|
|
|
4
4
|
};
|
|
5
5
|
/** Deep clone that keeps functions, DOM nodes and errors as they are; the server has no DOM nodes to keep */
|
|
6
6
|
export declare function cloneDeep<T>(value: T): T;
|
|
7
|
-
/** Whether an error has content ErrorMessage renders; a number or a boolean does not */
|
|
8
7
|
export declare function hasErrorContent(error: unknown): boolean;
|
|
9
8
|
export declare function errorText(error: FieldError): string;
|
|
10
9
|
export declare function isLabelConfig<L extends FieldLabel>(label?: string | number | L): label is L;
|
package/dist/form/utils.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { untrack } from 'svelte';
|
|
2
2
|
import { cloneFormValue } from '@fibrae/semi-foundation/form/utils';
|
|
3
|
-
/** The props a field consumes itself; a bare Checkbox or Radio drops them, except id and name */
|
|
4
3
|
const fieldOnlyKeys = new Set([
|
|
5
4
|
'allowEmpty',
|
|
6
5
|
'allowEmptyString',
|
|
@@ -40,7 +39,6 @@ export function omitFieldProps(props) {
|
|
|
40
39
|
export function cloneDeep(value) {
|
|
41
40
|
return cloneFormValue(value, (item) => typeof Node !== 'undefined' && item instanceof Node);
|
|
42
41
|
}
|
|
43
|
-
/** Whether an error has content ErrorMessage renders; a number or a boolean does not */
|
|
44
42
|
export function hasErrorContent(error) {
|
|
45
43
|
if (Array.isArray(error)) {
|
|
46
44
|
return error.some(Boolean);
|
|
@@ -15,6 +15,5 @@ export interface HighlightProps {
|
|
|
15
15
|
/** Camel-case or kebab-case keys; numbers are written as-is, so lengths need a unit string */
|
|
16
16
|
highlightStyle?: HighlightStyle;
|
|
17
17
|
highlightClassName?: string;
|
|
18
|
-
/** Tag of each highlighted chunk */
|
|
19
18
|
component?: string;
|
|
20
19
|
}
|
|
@@ -2,7 +2,6 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
2
2
|
export interface HotKeysProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
/** Keys that must be pressed together: any number of modifiers and exactly one other key */
|
|
4
4
|
hotKeys: KeyboardEvent['key'][];
|
|
5
|
-
/** Shown instead of `hotKeys` */
|
|
6
5
|
content?: string[];
|
|
7
6
|
preventDefault?: boolean;
|
|
8
7
|
/** Element that listens for keydown; defaults to document.body */
|
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;
|
|
@@ -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
|
|