@fibrae/semi-ui-svelte 0.2.0 → 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.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 +3 -3
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createContext as createSvelteContext } from 'svelte';
|
|
2
2
|
export function createContext(name, { optional = false, defaultValue } = {}) {
|
|
3
3
|
const [get, set, has] = createSvelteContext();
|
|
4
|
-
// `caller` names the child in the error, e.g. getCollapseContext('Collapse.Panel')
|
|
5
4
|
const getContext = (caller = 'This component') => {
|
|
6
5
|
if (has()) {
|
|
7
6
|
return get();
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** The longest `animation-duration` + `animation-delay` pair on `node`, in ms */
|
|
2
1
|
function animationTime(node) {
|
|
3
2
|
const style = getComputedStyle(node);
|
|
4
3
|
const seconds = (value) => value.split(',').map((item) => (item.trim().endsWith('ms') ? parseFloat(item) / 1000 : parseFloat(item)) || 0);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
/** A generic div cannot carry a name, so a labelled one becomes a group */
|
|
2
2
|
export declare function isLabelled(attrs: Record<string, unknown>): boolean;
|
|
3
|
-
/** An explicit role wins; otherwise a labelled wrapper is a group */
|
|
4
3
|
export declare function groupRole(attrs: Record<string, unknown>): string | undefined;
|
package/dist/_base/group-role.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
export function isLabelled(attrs) {
|
|
3
3
|
return Boolean(attrs['aria-label'] || attrs['aria-labelledby']);
|
|
4
4
|
}
|
|
5
|
-
/** An explicit role wins; otherwise a labelled wrapper is a group */
|
|
6
5
|
export function groupRole(attrs) {
|
|
7
6
|
return attrs.role ?? (isLabelled(attrs) ? 'group' : undefined);
|
|
8
7
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Attachment } from 'svelte/attachments';
|
|
2
2
|
export type SlotKind = 'text' | 'icon' | 'node';
|
|
3
3
|
export declare function getSlotKind(container: Element): SlotKind | undefined;
|
|
4
|
-
/** Reports the slot kind of the element's content after mount and whenever its child nodes change */
|
|
5
4
|
export declare function trackSlotKind(report: (kind?: SlotKind) => void): Attachment<Element>;
|
package/dist/_base/slot-kind.js
CHANGED
|
@@ -17,7 +17,6 @@ export function getSlotKind(container) {
|
|
|
17
17
|
// nodeType rather than instanceof: the slot may sit in another document, whose Element differs from this realm's
|
|
18
18
|
return node.classList?.contains(`${BASE_CLASS_PREFIX}-icon`) ? 'icon' : 'node';
|
|
19
19
|
}
|
|
20
|
-
/** Reports the slot kind of the element's content after mount and whenever its child nodes change */
|
|
21
20
|
export function trackSlotKind(report) {
|
|
22
21
|
return (container) => {
|
|
23
22
|
const update = () => report(getSlotKind(container));
|
package/dist/_base/teleport.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { Attachment } from 'svelte/attachments';
|
|
2
2
|
/**
|
|
3
|
-
* Moves the element into `target` once it mounts and removes it on teardown.
|
|
4
|
-
*
|
|
5
3
|
* Svelte removes a block's DOM by walking `nextSibling` from its first to its last node, so the moved element must be
|
|
6
4
|
* the only node of its block (`{#if open}<div {@attach teleport(target)}>...</div>{/if}`): as a block's sole node it is
|
|
7
5
|
* still removed wherever it sits, while as an edge of a longer range the walk would continue into the target's
|
package/dist/_base/teleport.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Moves the element into `target` once it mounts and removes it on teardown.
|
|
3
|
-
*
|
|
4
2
|
* Svelte removes a block's DOM by walking `nextSibling` from its first to its last node, so the moved element must be
|
|
5
3
|
* the only node of its block (`{#if open}<div {@attach teleport(target)}>...</div>{/if}`): as a block's sole node it is
|
|
6
4
|
* still removed wherever it sits, while as an edge of a longer range the walk would continue into the target's
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Each getter is read on every press, so targets may mount later. `nested`: more nodes that count as inside, the
|
|
3
|
+
* popups `useNestedPopups` collects.
|
|
4
4
|
*/
|
|
5
5
|
export default function useClickOutside(targets: (() => Node | null | undefined)[], onOutside: (event: MouseEvent) => void, enabled?: () => boolean, nested?: () => readonly (Node | null | undefined)[]): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { on } from 'svelte/events';
|
|
2
2
|
import { isEventInside } from '@fibrae/semi-foundation/utils/dom';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Each getter is read on every press, so targets may mount later. `nested`: more nodes that count as inside, the
|
|
5
|
+
* popups `useNestedPopups` collects.
|
|
6
6
|
*/
|
|
7
7
|
export default function useClickOutside(targets, onOutside, enabled = () => true, nested) {
|
|
8
8
|
$effect(() => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { onMount, untrack } from 'svelte';
|
|
2
2
|
import { SvelteMap } from 'svelte/reactivity';
|
|
3
|
-
/** A counter readers subscribe to; `bump` re-runs them even when the written value is equal */
|
|
4
3
|
class Version {
|
|
5
4
|
value = $state(0);
|
|
6
5
|
bump() {
|
|
@@ -8,10 +7,8 @@ class Version {
|
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* re-render on every `setState` and a foundation may write back a Set it mutated in place; a `$state` proxy would
|
|
14
|
-
* skip an equal write and wrap the Set.
|
|
10
|
+
* Every write notifies, equal value or not, because React and Vue re-render on every `setState` and a foundation may
|
|
11
|
+
* write back a Set it mutated in place; a `$state` proxy would skip an equal write and wrap the Set.
|
|
15
12
|
*/
|
|
16
13
|
function createStateMirror(initial) {
|
|
17
14
|
// replaced on every write, never mutated: an object the foundation got from getStates() keeps its values
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
itemSize: number | ((index: number) => number);
|
|
18
18
|
/** Key of a row; the index when absent */
|
|
19
19
|
itemKey?: (index: number) => PropertyKey;
|
|
20
|
-
/** Rows rendered beyond each edge of the viewport */
|
|
21
20
|
overscan?: number;
|
|
22
21
|
/** Attributes of the element that holds the rows */
|
|
23
22
|
innerAttrs?: HTMLAttributes<HTMLElement>;
|
|
@@ -32,8 +31,8 @@
|
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
* Attributes land on the scroll container; lists whose rows take no focus pass `tabindex={-1}` so Chrome does not
|
|
35
|
+
* make the container a second tab stop.
|
|
37
36
|
*/
|
|
38
37
|
let { height, width = '100%', itemCount, itemSize, itemKey, overscan = 2, innerAttrs, innerTag = 'div', wrapperAttrs, after, children, ...rest }: VirtualListProps = $props();
|
|
39
38
|
|
|
@@ -10,7 +10,6 @@ interface VirtualListProps extends Omit<HTMLAttributes<HTMLDivElement>, 'childre
|
|
|
10
10
|
itemSize: number | ((index: number) => number);
|
|
11
11
|
/** Key of a row; the index when absent */
|
|
12
12
|
itemKey?: (index: number) => PropertyKey;
|
|
13
|
-
/** Rows rendered beyond each edge of the viewport */
|
|
14
13
|
overscan?: number;
|
|
15
14
|
/** Attributes of the element that holds the rows */
|
|
16
15
|
innerAttrs?: HTMLAttributes<HTMLElement>;
|
|
@@ -25,7 +25,6 @@ export interface SortableProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
25
25
|
/** Builds `${prefix}-sortable-item`, `-over`, `-active` and `${prefix}-sortable-handle` */
|
|
26
26
|
prefix?: string;
|
|
27
27
|
transition?: SortableTransition;
|
|
28
|
-
/** Class of the copy of the item that follows the pointer during a drag */
|
|
29
28
|
dragOverlayClass?: string;
|
|
30
29
|
onSortEnd?: (payload: SortEndPayload) => void;
|
|
31
30
|
/** A drag starts (true) or ends, dropped or canceled (false) */
|
|
@@ -5,7 +5,6 @@ import type { strings } from '@fibrae/semi-foundation/anchor/constants';
|
|
|
5
5
|
import type { ArrayElement } from '@fibrae/semi-foundation/utils/type';
|
|
6
6
|
import type { Position } from '../tooltip/interface.js';
|
|
7
7
|
import type { ShowTooltip } from '../typography/interface.js';
|
|
8
|
-
/** A link is activated by a click or by Enter */
|
|
9
8
|
export type AnchorClickEvent = MouseEvent | KeyboardEvent;
|
|
10
9
|
export interface AnchorLinkItem {
|
|
11
10
|
/** A fragment such as `#intro` is looked up by element id, anything else is a selector; defaults to `#` */
|
|
@@ -13,7 +12,6 @@ export interface AnchorLinkItem {
|
|
|
13
12
|
/** Plain-text title, also the native tooltip without showTooltip; the `title` snippet wins when given */
|
|
14
13
|
title?: string;
|
|
15
14
|
disabled?: boolean;
|
|
16
|
-
/** Nested links */
|
|
17
15
|
children?: AnchorLinkItem[];
|
|
18
16
|
}
|
|
19
17
|
export interface AnchorTitleContext {
|
|
@@ -41,7 +39,6 @@ export interface AnchorProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title
|
|
|
41
39
|
onChange?: (currentLink: string, previousLink: string) => void;
|
|
42
40
|
/** Only when a link is activated, so a click elsewhere on the root does not reach it */
|
|
43
41
|
onClick?: (event: AnchorClickEvent, currentLink: string) => void;
|
|
44
|
-
/** Renders every link's title */
|
|
45
42
|
title?: Snippet<[AnchorTitleContext]>;
|
|
46
43
|
}
|
|
47
44
|
export interface AnchorState {
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
const tooltip = $derived.by(() => {
|
|
21
21
|
const { showTooltip, position } = anchor;
|
|
22
22
|
const config = typeof showTooltip === 'object' ? showTooltip : {};
|
|
23
|
-
// The position can be set through showTooltip; a copy keeps the caller's object as it was
|
|
24
23
|
return { ...config, opts: position ? { ...config.opts, position } : { ...config.opts } };
|
|
25
24
|
});
|
|
26
25
|
|
package/dist/anchor/links.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { AnchorNode } from '@fibrae/semi-foundation/anchor/foundation';
|
|
2
2
|
import type { AnchorLinkItem } from './interface.js';
|
|
3
|
-
/** Depth-first, so the order is the order on the page */
|
|
4
3
|
export declare const hrefsOf: (items: AnchorLinkItem[]) => string[];
|
|
5
4
|
export declare const nodesOf: (items: AnchorLinkItem[]) => AnchorNode[];
|
package/dist/anchor/links.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
/** Depth-first, so the order is the order on the page */
|
|
2
1
|
export const hrefsOf = (items) => items.flatMap((item) => [item.href ?? '#', ...hrefsOf(item.children ?? [])]);
|
|
3
2
|
export const nodesOf = (items) => items.map((item) => ({ href: item.href ?? '#', children: nodesOf(item.children ?? []) }));
|
|
@@ -62,8 +62,6 @@
|
|
|
62
62
|
// the Tooltip text only describes the icon-only button, so the same text is also its name
|
|
63
63
|
const backwardLabel = $derived(texts.backward.replace('${skipDuration}', String(skipDuration)));
|
|
64
64
|
const forwardLabel = $derived(texts.forward.replace('${skipDuration}', String(skipDuration)));
|
|
65
|
-
|
|
66
|
-
// the visible rate alone does not say what the menu sets
|
|
67
65
|
const speedLabel = $derived([texts.playbackRate, states().currentRate.label].join(' '));
|
|
68
66
|
|
|
69
67
|
const changeTrack = (direction: 'next' | 'prev') => {
|
|
@@ -19,8 +19,6 @@
|
|
|
19
19
|
|
|
20
20
|
// $size-audio-player-slider-dot
|
|
21
21
|
const dotSize = 16;
|
|
22
|
-
|
|
23
|
-
// the duration is 0 until the metadata loads
|
|
24
22
|
const percent = $derived(max ? (value / max) * 100 : 0);
|
|
25
23
|
|
|
26
24
|
// the popup is anchored to the slider's center, so only a translate moves it to the pointer; the vertical offset
|
|
@@ -53,7 +51,6 @@
|
|
|
53
51
|
onPointer(event, true);
|
|
54
52
|
};
|
|
55
53
|
|
|
56
|
-
// the preview belongs to the pointer; a keyboard use shows the value
|
|
57
54
|
const clearPreview = () => {
|
|
58
55
|
movingInfo = null;
|
|
59
56
|
};
|
|
@@ -96,7 +96,6 @@
|
|
|
96
96
|
const prefixCls = cssClasses.PREFIX;
|
|
97
97
|
const listId = `${uid}-listbox`;
|
|
98
98
|
|
|
99
|
-
// $bindable needs destructuring, so the foundation reads the props through getters
|
|
100
99
|
const foundationProps: AutoCompleteBaseProps = {
|
|
101
100
|
get data() {
|
|
102
101
|
return data;
|
|
@@ -131,7 +130,6 @@
|
|
|
131
130
|
(base) => ({
|
|
132
131
|
updateFocusIndex: (focusIndex) => base.setState({ focusIndex }),
|
|
133
132
|
updateScrollTop: (index) => {
|
|
134
|
-
// the rows are the listbox's direct children
|
|
135
133
|
const destNode = listbox?.children[index];
|
|
136
134
|
if (listbox && destNode instanceof HTMLElement) {
|
|
137
135
|
centerInScroller(destNode, listbox);
|
|
@@ -143,7 +141,6 @@
|
|
|
143
141
|
updateSelection: (selection) => base.setState({ selection }),
|
|
144
142
|
notifySearch: (inputValue) => onSearch?.(inputValue),
|
|
145
143
|
notifyChange: (next) => {
|
|
146
|
-
// the bindable prop is the source of truth: bound, the write reaches the parent; unbound, it overrides locally
|
|
147
144
|
value = next;
|
|
148
145
|
onChange?.(next);
|
|
149
146
|
},
|
|
@@ -269,7 +266,6 @@
|
|
|
269
266
|
useClickOutside(
|
|
270
267
|
[() => root, () => listbox],
|
|
271
268
|
(event) => {
|
|
272
|
-
// without a rendered list there is nothing to close
|
|
273
269
|
if (listbox) {
|
|
274
270
|
foundation.handleClickOutside(event);
|
|
275
271
|
}
|
|
@@ -286,7 +282,6 @@
|
|
|
286
282
|
input?.blur();
|
|
287
283
|
}
|
|
288
284
|
|
|
289
|
-
/** The root div, which wraps the input or the custom trigger */
|
|
290
285
|
export function getNativeElement() {
|
|
291
286
|
return root;
|
|
292
287
|
}
|
|
@@ -3,15 +3,12 @@ import type { ClassValue, HTMLAttributes, HTMLInputAttributes } from 'svelte/ele
|
|
|
3
3
|
import type { Size } from '@fibrae/semi-foundation/utils/type';
|
|
4
4
|
import type { ValidateStatus } from '../input/index.js';
|
|
5
5
|
import type { Position } from '../tooltip/index.js';
|
|
6
|
-
/** An object item of `data`; markup for its row goes in the `item` snippet */
|
|
7
6
|
export interface AutoCompleteDataItem {
|
|
8
7
|
[key: string]: any;
|
|
9
8
|
value?: string | number;
|
|
10
9
|
label?: string | number;
|
|
11
10
|
disabled?: boolean;
|
|
12
|
-
/** On the item's row */
|
|
13
11
|
class?: ClassValue;
|
|
14
|
-
/** On the item's row */
|
|
15
12
|
style?: string;
|
|
16
13
|
}
|
|
17
14
|
export type AutoCompleteItems = AutoCompleteDataItem | string | number;
|
|
@@ -20,11 +17,9 @@ export type AutoCompleteSelectedItem<T extends AutoCompleteItems> = T extends st
|
|
|
20
17
|
export interface AutoCompleteItemSnippetProps<T extends AutoCompleteItems = AutoCompleteItems> {
|
|
21
18
|
/** The data item as given: a string item stays a string */
|
|
22
19
|
item: T;
|
|
23
|
-
/** Position among the rendered items */
|
|
24
20
|
index: number;
|
|
25
21
|
}
|
|
26
22
|
export interface AutoCompleteTriggerSnippetProps {
|
|
27
|
-
/** The selected item, if any */
|
|
28
23
|
value: AutoCompleteDataItem[];
|
|
29
24
|
inputValue?: string | number;
|
|
30
25
|
placeholder?: string;
|
|
@@ -39,7 +34,6 @@ export interface AutoCompleteTriggerSnippetProps {
|
|
|
39
34
|
onClear: () => void;
|
|
40
35
|
onFocus: (event: FocusEvent) => void;
|
|
41
36
|
onBlur: (event: FocusEvent) => void;
|
|
42
|
-
/** The aria-* attributes given to the AutoComplete, for the custom trigger's focusable element */
|
|
43
37
|
controlAttrs: Record<string, unknown>;
|
|
44
38
|
}
|
|
45
39
|
type NativeKeys = 'children' | 'prefix' | 'placeholder' | 'onchange' | 'onselect' | 'onfocus' | 'onblur';
|
|
@@ -84,11 +78,8 @@ export interface AutoCompleteProps<T extends AutoCompleteItems = AutoCompleteIte
|
|
|
84
78
|
suffix?: Snippet;
|
|
85
79
|
insetLabel?: Snippet;
|
|
86
80
|
clearIcon?: Snippet;
|
|
87
|
-
/** Shown in the list when `data` is empty */
|
|
88
81
|
emptyContent?: Snippet;
|
|
89
|
-
/** Content of an item row; without it the row shows the item's label */
|
|
90
82
|
item?: Snippet<[AutoCompleteItemSnippetProps<T>]>;
|
|
91
|
-
/** Replaces the input */
|
|
92
83
|
trigger?: Snippet<[AutoCompleteTriggerSnippetProps]>;
|
|
93
84
|
}
|
|
94
85
|
export {};
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { getPopupLayerContext } from '../_base/popup-layer.js';
|
|
4
4
|
import { type AvatarGroupMoreValue, setAvatarGroupMoreContext } from './context.js';
|
|
5
5
|
|
|
6
|
-
// setContext covers this component's subtree, so the `more` content gets its own component scope
|
|
7
6
|
let { children, ...value }: Omit<AvatarGroupMoreValue, 'layer'> & { children: Snippet } = $props();
|
|
8
7
|
|
|
9
8
|
const layer = getPopupLayerContext();
|
|
@@ -87,8 +87,6 @@
|
|
|
87
87
|
|
|
88
88
|
const prefix = cssClasses.PREFIX;
|
|
89
89
|
const more = outerMore?.layer === layer ? outerMore : undefined;
|
|
90
|
-
|
|
91
|
-
// An avatar in the `more` content keeps its own size and shape and only falls back to the group's
|
|
92
90
|
const size = $derived(ownSize ?? more?.size ?? defaults('size', 'medium'));
|
|
93
91
|
const shape = $derived(ownShape ?? more?.shape ?? defaults('shape', 'circle'));
|
|
94
92
|
const clickable = $derived(rest.onclick !== undefined);
|
|
@@ -110,7 +108,6 @@
|
|
|
110
108
|
const borderClass = $derived([`${prefix}-additionalBorder`, `${prefix}-additionalBorder-${size}`, `${prefix}-${shape}`]);
|
|
111
109
|
const borderColor = $derived(typeof border === 'object' ? border.color : undefined);
|
|
112
110
|
|
|
113
|
-
// Avatars nested in this one's content are not items of the group
|
|
114
111
|
setAvatarGroupMoreContext(undefined);
|
|
115
112
|
|
|
116
113
|
const handleKeyDown = (event: KeyboardEvent & { currentTarget: HTMLElement }) => {
|
|
@@ -154,7 +151,6 @@
|
|
|
154
151
|
isText = nextIsText;
|
|
155
152
|
text = nextIsText ? next : undefined;
|
|
156
153
|
if (changed) {
|
|
157
|
-
// the scale spans exist after this flush
|
|
158
154
|
void tick().then(foundation.changeScale);
|
|
159
155
|
}
|
|
160
156
|
};
|
package/dist/avatar/context.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export interface AvatarTopSlot {
|
|
|
10
10
|
textColor?: string;
|
|
11
11
|
className?: string;
|
|
12
12
|
style?: string;
|
|
13
|
-
/** Replaces the whole top mark */
|
|
14
13
|
render?: Snippet;
|
|
15
14
|
}
|
|
16
15
|
export interface AvatarBottomSlot {
|
|
@@ -19,7 +18,6 @@ export interface AvatarBottomSlot {
|
|
|
19
18
|
textColor?: string;
|
|
20
19
|
className?: string;
|
|
21
20
|
style?: string;
|
|
22
|
-
/** Replaces the whole bottom mark */
|
|
23
21
|
render?: Snippet;
|
|
24
22
|
}
|
|
25
23
|
export interface AvatarProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children' | 'onmouseenter' | 'onmouseleave'> {
|
|
@@ -58,7 +56,6 @@ export interface AvatarGroupItemContext {
|
|
|
58
56
|
}
|
|
59
57
|
export interface AvatarGroupMoreContext {
|
|
60
58
|
restNumber: number;
|
|
61
|
-
/** The hidden items, in order */
|
|
62
59
|
restAvatars: AvatarGroupItem[];
|
|
63
60
|
}
|
|
64
61
|
export interface AvatarGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
@@ -69,6 +66,5 @@ export interface AvatarGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, '
|
|
|
69
66
|
items?: AvatarGroupItem[];
|
|
70
67
|
/** Content of every avatar, taking precedence over the item's own `children` */
|
|
71
68
|
item?: Snippet<[AvatarGroupItemContext]>;
|
|
72
|
-
/** Replaces the default `+N` avatar */
|
|
73
69
|
more?: Snippet<[AvatarGroupMoreContext]>;
|
|
74
70
|
}
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
|
|
40
40
|
let button = $state<HTMLElement>();
|
|
41
41
|
|
|
42
|
-
// the foundation reads the props through getters, since $props() cannot be handed over as one object
|
|
43
42
|
const { foundation, states } = useFoundation<Foundation, Adapter, BackTopBaseProps, BackTopState>(
|
|
44
43
|
BackTopFoundation,
|
|
45
44
|
{
|
|
@@ -66,7 +65,6 @@
|
|
|
66
65
|
const ariaLabel = $derived(rest['aria-label'] ?? (children ? undefined : locale().locale.backToTop));
|
|
67
66
|
const throttledClick = $derived(throttle((event: ClickEvent) => foundation.onClick(event), duration));
|
|
68
67
|
|
|
69
|
-
// FloatButton hands its rest props, attachments included, to the native button
|
|
70
68
|
const captureButton: Attachment<HTMLElement> = (node) => {
|
|
71
69
|
button = node;
|
|
72
70
|
return () => {
|
|
@@ -5,7 +5,6 @@ export interface BackTopProps extends Omit<FloatButtonProps, 'children' | 'disab
|
|
|
5
5
|
duration?: number;
|
|
6
6
|
/** The scrolled element; defaults to the window. Read on mount and whenever the function itself changes */
|
|
7
7
|
target?: () => Window | HTMLElement | null;
|
|
8
|
-
/** The button shows once the target is scrolled beyond this many pixels */
|
|
9
8
|
visibilityHeight?: number;
|
|
10
9
|
/** Static content of the button, shown in place of the icon; must not contain interactive elements */
|
|
11
10
|
children?: Snippet;
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
</script>
|
|
62
62
|
|
|
63
63
|
{#if states().visible}
|
|
64
|
-
<div {...rest} class={[prefix, `${prefix}-${type}`, rest.class, fullMode ? `${prefix}-full` : `${prefix}-in-container`, { [`${prefix}-bordered`]: !fullMode && bordered }]}
|
|
64
|
+
<div {...rest} class={[prefix, `${prefix}-${type}`, rest.class, fullMode ? `${prefix}-full` : `${prefix}-in-container`, { [`${prefix}-bordered`]: !fullMode && bordered }]}>
|
|
65
65
|
<div class={`${prefix}-content-wrapper`}>
|
|
66
66
|
<div class={`${prefix}-content`}>
|
|
67
67
|
{#if icon !== null}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
export type BannerType = 'info' | 'danger' | 'warning' | 'success';
|
|
4
|
-
export interface BannerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'
|
|
4
|
+
export interface BannerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
5
5
|
bordered?: boolean;
|
|
6
6
|
fullMode?: boolean;
|
|
7
7
|
title?: string | Snippet;
|
|
@@ -9,10 +9,8 @@ export interface BannerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title
|
|
|
9
9
|
/** The close button's click event; the banner hides right after the callback returns */
|
|
10
10
|
onClose?: (event: MouseEvent) => void;
|
|
11
11
|
description?: Snippet;
|
|
12
|
-
/** Replaces the icon of the type; `null` hides the icon */
|
|
13
12
|
icon?: Snippet | null;
|
|
14
13
|
/** Replaces the icon of the close button; `null` removes the button */
|
|
15
14
|
closeIcon?: Snippet | null;
|
|
16
|
-
/** Content below the message, in the `-extra` area */
|
|
17
15
|
children?: Snippet;
|
|
18
16
|
}
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
type Foundation = BreadcrumbItemFoundation<Pick<ItemProps, 'route'>, object, MouseEvent>;
|
|
19
19
|
type Adapter = BreadcrumbItemAdapter<Pick<ItemProps, 'route'>, object, MouseEvent>;
|
|
20
20
|
|
|
21
|
-
// Only the Breadcrumb renders items; `rest` holds the route's data-* attributes
|
|
22
21
|
const { route, index, active, shouldRenderSeparator, ...rest }: ItemProps = $props();
|
|
23
22
|
|
|
24
23
|
const context = getBreadcrumbContext('Breadcrumb item');
|
|
@@ -78,7 +78,6 @@
|
|
|
78
78
|
BreadcrumbFoundation.genRoutes(routes).map((route, index) => ({
|
|
79
79
|
index,
|
|
80
80
|
route: route._origin,
|
|
81
|
-
// Only the Item attributes a route may set stay; other route fields stay off the DOM
|
|
82
81
|
attrs: getDataAttr(route) as Record<`data-${string}`, string>,
|
|
83
82
|
key: String(route._origin.key || `item-${route.name || route.path}-${index}`),
|
|
84
83
|
}))
|
|
@@ -2,7 +2,6 @@ import type { Snippet } from 'svelte';
|
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
import type { IconSize } from '@fibrae/semi-icons-svelte';
|
|
4
4
|
import type { ShowTooltip } from '../typography/interface.js';
|
|
5
|
-
/** A route of the `routes` prop. A custom title is the `item` snippet and the icon is the `icon` snippet */
|
|
6
5
|
export interface BreadcrumbRoute {
|
|
7
6
|
[x: string]: unknown;
|
|
8
7
|
name?: string;
|
|
@@ -20,21 +19,17 @@ export interface BreadcrumbShowTooltip {
|
|
|
20
19
|
opts?: ShowTooltip['opts'];
|
|
21
20
|
}
|
|
22
21
|
export type BreadcrumbMoreType = 'default' | 'popover';
|
|
23
|
-
/** A string route arrives as `{ name }` */
|
|
24
22
|
export type BreadcrumbClick = (route: BreadcrumbRoute, event: MouseEvent) => void;
|
|
25
23
|
export interface BreadcrumbRouteContext {
|
|
26
|
-
/** The route as passed in */
|
|
27
24
|
route: BreadcrumbRoute;
|
|
28
25
|
/** Counts every route, the collapsed ones included */
|
|
29
26
|
index: number;
|
|
30
27
|
}
|
|
31
28
|
export interface BreadcrumbIconContext extends BreadcrumbRouteContext {
|
|
32
|
-
/** Pass both to the icon: `<IconHome {size} class={className} />` */
|
|
33
29
|
size: IconSize;
|
|
34
30
|
class: string;
|
|
35
31
|
}
|
|
36
32
|
export interface BreadcrumbMoreContext {
|
|
37
|
-
/** The collapsed routes, in order */
|
|
38
33
|
restItems: BreadcrumbRouteContext[];
|
|
39
34
|
}
|
|
40
35
|
export interface BreadcrumbProps extends HTMLAttributes<HTMLElement> {
|
|
@@ -44,7 +39,6 @@ export interface BreadcrumbProps extends HTMLAttributes<HTMLElement> {
|
|
|
44
39
|
maxItemCount?: number;
|
|
45
40
|
moreType?: BreadcrumbMoreType;
|
|
46
41
|
routes?: Array<BreadcrumbRoute | string>;
|
|
47
|
-
/** Text, or a snippet rendered after every item */
|
|
48
42
|
separator?: string | Snippet;
|
|
49
43
|
showTooltip?: boolean | BreadcrumbShowTooltip;
|
|
50
44
|
/**
|
|
@@ -55,6 +49,5 @@ export interface BreadcrumbProps extends HTMLAttributes<HTMLElement> {
|
|
|
55
49
|
/** Custom title of every item; rendered inline, without the truncating text */
|
|
56
50
|
item?: Snippet<[BreadcrumbRouteContext]>;
|
|
57
51
|
icon?: Snippet<[BreadcrumbIconContext]>;
|
|
58
|
-
/** Content of the more button in place of the icon */
|
|
59
52
|
more?: Snippet<[BreadcrumbMoreContext]>;
|
|
60
53
|
}
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
...rest
|
|
38
38
|
}: CalendarProps = $props();
|
|
39
39
|
|
|
40
|
-
// One "today" source per Calendar; the views read it.
|
|
41
40
|
const today = useToday();
|
|
42
41
|
|
|
43
42
|
// Without displayValue the first frame shows the current date, so server rendering passes displayValue to make the server and the browser agree
|
|
@@ -36,8 +36,6 @@
|
|
|
36
36
|
const prefixCls = `${cssClasses.PREFIX}-day`;
|
|
37
37
|
const allDayCls = `${cssClasses.PREFIX}-all-day`;
|
|
38
38
|
const parsedEvents = $derived(CalendarFoundation.getParseDailyEvents(events, displayValue));
|
|
39
|
-
|
|
40
|
-
// every view hands the dateGrid snippet the day's midnight, not the caller's time of day
|
|
41
39
|
const dayStart = $derived(startOfDay(displayValue));
|
|
42
40
|
const isWeekend = $derived(markWeekend && checkWeekend(displayValue));
|
|
43
41
|
</script>
|
|
@@ -79,7 +77,6 @@
|
|
|
79
77
|
<div class={`${prefixCls}-scroll-wrapper`} role="rowgroup">
|
|
80
78
|
<div {@attach grid.observe} bind:this={scroll} class={`${prefixCls}-scroll`} role="row">
|
|
81
79
|
<TimeCol class={`${prefixCls}-sticky-left`} {timeDisplay} />
|
|
82
|
-
<!-- a new day, a new showCurrTime or a day that becomes today gets a new column, which decides again whether to show the line -->
|
|
83
80
|
{#key `${dayStart.toDateString()}|${showCurrTime}|${today !== null && isSameDay(dayStart, today)}`}
|
|
84
81
|
<DayCol {dateGrid} displayValue={dayStart} {event} events={parsedEvents.day} {isWeekend} {minEventHeight} onSlotClick={(mouseEvent, value) => onClick?.(mouseEvent, value)} scrollHeight={grid.scrollHeight()} {showCurrTime} />
|
|
85
82
|
{/key}
|
|
@@ -13,7 +13,6 @@ export interface EventObject {
|
|
|
13
13
|
children?: string | number;
|
|
14
14
|
}
|
|
15
15
|
export interface CalendarEventArgs {
|
|
16
|
-
/** The object from `events`, found by its key */
|
|
17
16
|
event: EventObject;
|
|
18
17
|
}
|
|
19
18
|
export interface CalendarDateDisplayArgs {
|
|
@@ -51,19 +50,12 @@ export interface CalendarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'chi
|
|
|
51
50
|
header?: Snippet;
|
|
52
51
|
/** Content of an event, called once per place the event shows. Defaults to the event's `children` text */
|
|
53
52
|
event?: Snippet<[CalendarEventArgs]>;
|
|
54
|
-
/** The date in a week or range column header and in every month cell. Not used by the day view */
|
|
55
53
|
dateDisplay?: Snippet<[CalendarDateDisplayArgs]>;
|
|
56
|
-
/** Extra content in every day column, or in every month cell */
|
|
57
54
|
dateGrid?: Snippet<[CalendarDateGridArgs]>;
|
|
58
|
-
/** The hour labels from 1 to 23 */
|
|
59
55
|
timeDisplay?: Snippet<[CalendarTimeDisplayArgs]>;
|
|
60
56
|
/** Replaces the all-day events of the day, week and range views; renders `li` items */
|
|
61
57
|
allDayEvents?: Snippet<[CalendarAllDayEventsArgs]>;
|
|
62
58
|
}
|
|
63
|
-
/**
|
|
64
|
-
* What every view takes from Calendar, which resolves `mode`, `range` and the defaults: every other attribute goes to
|
|
65
|
-
* the view's root element
|
|
66
|
-
*/
|
|
67
59
|
export interface CalendarViewProps extends Pick<CalendarProps, 'width' | 'height' | 'header' | 'event' | 'dateGrid' | 'onClick'>, Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onclick' | 'onclose'> {
|
|
68
60
|
events: EventObject[];
|
|
69
61
|
markWeekend: boolean;
|
|
@@ -79,7 +79,6 @@
|
|
|
79
79
|
const weekCount = $derived(Object.keys(monthlyData).length);
|
|
80
80
|
const stale = $derived(CalendarFoundation.isOpenCardStale(openCardKey, monthlyData, parsedEvents, itemLimit));
|
|
81
81
|
|
|
82
|
-
// A day's events are a sparse array indexed by row, so the holes are dropped before listing or counting them.
|
|
83
82
|
const weeks = $derived(
|
|
84
83
|
Object.values(monthlyData).map((weekDays, weekInd) => {
|
|
85
84
|
const parsed = parsedEvents[weekInd];
|
|
@@ -103,7 +102,6 @@
|
|
|
103
102
|
|
|
104
103
|
const isOpen = (key: string) => states().showCard[key] ?? false;
|
|
105
104
|
|
|
106
|
-
// rows split the grid height evenly; the last row is measured because it always renders
|
|
107
105
|
const measure = () => {
|
|
108
106
|
const row = grid?.lastElementChild;
|
|
109
107
|
if (row) {
|
|
@@ -113,7 +111,6 @@
|
|
|
113
111
|
|
|
114
112
|
const observe = observeResize(measure);
|
|
115
113
|
|
|
116
|
-
// Registers an element under its day's key for as long as it is mounted
|
|
117
114
|
const track =
|
|
118
115
|
<E extends HTMLElement>(map: Map<string, E>, key: string): Attachment<E> =>
|
|
119
116
|
(element) => {
|
|
@@ -233,7 +230,6 @@
|
|
|
233
230
|
{#each weeks as week, weekInd (weekInd)}
|
|
234
231
|
<div class={`${prefixCls}-weekrow`}>
|
|
235
232
|
<div class={`${prefixCls}-skeleton`} role="row">
|
|
236
|
-
<!-- a collapsed day is the anchor of its "more" card -->
|
|
237
233
|
{#each week.days as day (day.date.valueOf())}
|
|
238
234
|
{#if day.hidden > 0}
|
|
239
235
|
<Popover aria-labelledby={day.titleId} bind:visible={() => isOpen(day.key), () => {}} onEscKeyDown={(keyEvent) => closeCardToMore(keyEvent, day.key)} position="leftTopOver" trigger="custom">
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
|
|
14
14
|
interface Props extends CalendarViewProps, Pick<CalendarProps, 'dateDisplay' | 'timeDisplay' | 'allDayEvents'> {
|
|
15
15
|
range: Date[];
|
|
16
|
-
/** The date whose month names the grid; the first day of the range by default */
|
|
17
16
|
labelDate?: Date;
|
|
18
17
|
minEventHeight?: number;
|
|
19
18
|
showCurrTime: boolean;
|
|
@@ -94,7 +93,6 @@
|
|
|
94
93
|
{#if allDayEvents}
|
|
95
94
|
{@render allDayEvents({ events })}
|
|
96
95
|
{:else}
|
|
97
|
-
<!-- positioned spans always carry leftPos, width and topInd; the foundation type keeps them optional -->
|
|
98
96
|
{#each withKeys(allDayItems, 'allDay') as { id, item } (id)}
|
|
99
97
|
<li class={[`${cssClasses.PREFIX}-event-item`, `${cssClasses.PREFIX}-event-allday`]} style:left={toPercent(item.leftPos ?? 0)} style:top={`${item.topInd ?? 0}em`} style:width={toPercent(item.width ?? 0)}>
|
|
100
98
|
{#if event}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { CalendarProps, CalendarViewProps, WeekStartsOn } from './interface.js';
|
|
2
2
|
interface Props extends CalendarViewProps, Pick<CalendarProps, 'dateDisplay' | 'timeDisplay' | 'allDayEvents'> {
|
|
3
3
|
range: Date[];
|
|
4
|
-
/** The date whose month names the grid; the first day of the range by default */
|
|
5
4
|
labelDate?: Date;
|
|
6
5
|
minEventHeight?: number;
|
|
7
6
|
showCurrTime: boolean;
|