@synopackageland/ui 0.20.3 → 0.20.5
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/CHANGELOG.md +35 -0
- package/LICENSES/THIRD_PARTY.md +2 -32
- package/LICENSES/ux-foundation.md +83 -0
- package/LICENSES/ux-grid-baserow.md +35 -0
- package/LICENSES/ux-grid-teable.md +48 -0
- package/README.md +3 -0
- package/dist/components/app/app-layout/AppLayout.vue.d.ts +52 -5
- package/dist/components/app/app-layout/pageTitle.d.ts +24 -0
- package/dist/components/app/app-root/AppRoot.vue.d.ts +9 -0
- package/dist/components/app/app-tab-bar/AppTabBar.vue.d.ts +1 -1
- package/dist/components/app/aside-panel/AsidePanel.vue.d.ts +69 -0
- package/dist/components/app/aside-panel/asidePreference.d.ts +28 -0
- package/dist/components/app/section-tabs/SectionTabs.vue.d.ts +22 -4
- package/dist/components/composite/about-dialog/AboutDialog.vue.d.ts +1 -1
- package/dist/components/composite/adaptive-panel/AdaptivePanel.vue.d.ts +61 -0
- package/dist/components/composite/connection-topology/ConnectionTopology.vue.d.ts +1 -1
- package/dist/components/composite/data-grid/DataGrid.vue.d.ts +19 -1
- package/dist/components/composite/data-grid/labels.d.ts +15 -0
- package/dist/components/composite/data-grid/listLayout.d.ts +26 -0
- package/dist/components/composite/data-table/DataTable.vue.d.ts +33 -7
- package/dist/components/composite/file-picker/FilePicker.vue.d.ts +2 -2
- package/dist/components/composite/form/FormGroup.vue.d.ts +1 -1
- package/dist/components/composite/form/context.d.ts +13 -0
- package/dist/components/composite/form-actions/FormActions.vue.d.ts +6 -2
- package/dist/components/composite/mention-list/MentionList.vue.d.ts +2 -2
- package/dist/components/composite/overflow-toolbar/OverflowToolbar.vue.d.ts +2 -2
- package/dist/components/composite/record-panel/RecordPanel.vue.d.ts +91 -0
- package/dist/components/composite/record-panel/recordPanelWidth.d.ts +54 -0
- package/dist/components/composite/settings-section/SettingsSection.vue.d.ts +1 -1
- package/dist/components/composite/summary-card/SummaryCard.vue.d.ts +1 -1
- package/dist/components/composite/tag-editor/TagEditor.vue.d.ts +4 -4
- package/dist/components/composite/tree-view/TreeView.vue.d.ts +4 -4
- package/dist/components/composite/wizard/Wizard.vue.d.ts +2 -2
- package/dist/components/composite/wizard/WizardDialog.vue.d.ts +4 -4
- package/dist/components/containers/card/Card.vue.d.ts +1 -1
- package/dist/components/containers/card/CardField.vue.d.ts +26 -0
- package/dist/components/containers/card-grid/CardCover.vue.d.ts +16 -0
- package/dist/components/containers/card-grid/CardGrid.vue.d.ts +1 -1
- package/dist/components/containers/card-grid/VirtualCardGrid.vue.d.ts +71 -0
- package/dist/components/containers/expandable-item/ExpandableItem.vue.d.ts +1 -1
- package/dist/components/containers/fieldset/Fieldset.vue.d.ts +1 -1
- package/dist/components/containers/list-detail/ListDetail.vue.d.ts +6 -4
- package/dist/components/containers/split-pane/SplitPane.vue.d.ts +1 -1
- package/dist/components/feedback/notification/Notification.vue.d.ts +1 -1
- package/dist/components/feedback/notification/NotificationProvider.vue.d.ts +1 -1
- package/dist/components/feedback/validation-popup/ValidationPopup.vue.d.ts +1 -1
- package/dist/components/primitives/breadcrumb/Breadcrumb.vue.d.ts +2 -2
- package/dist/components/primitives/color-picker/ColorPicker.vue.d.ts +4 -4
- package/dist/components/primitives/combobox/Combobox.vue.d.ts +4 -4
- package/dist/components/primitives/context-menu/ContextMenu.vue.d.ts +5 -2
- package/dist/components/primitives/context-menu/ContextMenuItems.vue.d.ts +4 -5
- package/dist/components/primitives/dialog/Dialog.vue.d.ts +16 -8
- package/dist/components/primitives/dropdown-menu/DropdownMenu.vue.d.ts +7 -3
- package/dist/components/primitives/dropdown-menu/DropdownMenuItems.vue.d.ts +6 -3
- package/dist/components/primitives/dropdown-menu/DropdownMenuSheet.vue.d.ts +28 -0
- package/dist/components/primitives/input/Input.vue.d.ts +8 -1
- package/dist/components/primitives/input/Textarea.vue.d.ts +1 -1
- package/dist/components/primitives/input-steppers/InputSteppers.vue.d.ts +1 -1
- package/dist/components/primitives/motion/PushTransition.vue.d.ts +38 -0
- package/dist/components/primitives/multiple-select/MultipleSelect.vue.d.ts +4 -4
- package/dist/components/primitives/pagination/Pagination.vue.d.ts +22 -9
- package/dist/components/primitives/pagination/PaginationSheet.vue.d.ts +27 -0
- package/dist/components/primitives/pagination/labels.d.ts +6 -0
- package/dist/components/primitives/popover/Popover.vue.d.ts +11 -3
- package/dist/components/primitives/popover/floating.d.ts +27 -0
- package/dist/components/primitives/popover/overlay.d.ts +36 -0
- package/dist/components/primitives/segment-control/SegmentControl.vue.d.ts +4 -1
- package/dist/components/primitives/segment-control/context.d.ts +3 -0
- package/dist/components/primitives/select/Select.vue.d.ts +4 -0
- package/dist/components/primitives/select/internal/ComboboxField.vue.d.ts +6 -5
- package/dist/components/primitives/select/internal/SelectSheet.vue.d.ts +42 -0
- package/dist/components/primitives/select/internal/types.d.ts +2 -0
- package/dist/components/primitives/sheet/BottomSheet.vue.d.ts +69 -0
- package/dist/components/primitives/sheet/Sheet.vue.d.ts +13 -5
- package/dist/components/primitives/sheet/phone.d.ts +7 -0
- package/dist/components/primitives/skeleton/SectionSkeleton.vue.d.ts +25 -4
- package/dist/components/primitives/skeleton/Skeleton.vue.d.ts +3 -0
- package/dist/components/primitives/superbox-select/SuperboxSelect.vue.d.ts +4 -4
- package/dist/components/primitives/tag/Tag.vue.d.ts +2 -2
- package/dist/components/primitives/toast/ToastProvider.vue.d.ts +0 -2
- package/dist/components/primitives/toast/toast.d.ts +21 -1
- package/dist/components/primitives/tooltip/Tooltip.vue.d.ts +8 -3
- package/dist/components/primitives/tooltip/tooltipStyle.d.ts +11 -1
- package/dist/components/rich-text-editor/RichTextEditor.vue.d.ts +1 -1
- package/dist/composables/backDismiss.d.ts +19 -0
- package/dist/composables/formControl.d.ts +18 -0
- package/dist/composables/phone.d.ts +8 -0
- package/dist/composables/phoneSurface.d.ts +35 -0
- package/dist/composables/softKeyboard.d.ts +26 -4
- package/dist/composables/visualViewport.d.ts +31 -0
- package/dist/dnd/autoScroll.d.ts +57 -0
- package/dist/dnd/dragKit.d.ts +111 -0
- package/dist/dnd/index.d.ts +4 -0
- package/dist/dnd/layout.d.ts +57 -0
- package/dist/dnd/vue.d.ts +16 -0
- package/dist/feedback/StatusSlot.vue.d.ts +24 -0
- package/dist/feedback/showAfter.d.ts +15 -0
- package/dist/feedback/stackMotion.d.ts +13 -0
- package/dist/feedback/timing.d.ts +23 -0
- package/dist/grid/cells/draw.d.ts +57 -0
- package/dist/grid/cells/images.d.ts +5 -0
- package/dist/grid/cells/index.d.ts +7 -0
- package/dist/grid/cells/number.d.ts +5 -0
- package/dist/grid/cells/registry.d.ts +56 -0
- package/dist/grid/cells/renderers.d.ts +8 -0
- package/dist/grid/cells/status.d.ts +6 -0
- package/dist/grid/cells/types.d.ts +200 -0
- package/dist/grid/cells/use.d.ts +7 -0
- package/dist/grid/clipboard/copy.d.ts +17 -0
- package/dist/grid/clipboard/index.d.ts +4 -0
- package/dist/grid/clipboard/proposal.d.ts +35 -0
- package/dist/grid/clipboard/tsv.d.ts +14 -0
- package/dist/grid/clipboard/write.d.ts +21 -0
- package/dist/grid/contracts.d.ts +200 -0
- package/dist/grid/edit/cell-status.d.ts +33 -0
- package/dist/grid/edit/edit-session.d.ts +97 -0
- package/dist/grid/edit/use-grid-edit.d.ts +48 -0
- package/dist/grid/focus/editor-style.d.ts +67 -0
- package/dist/grid/host/GridHost.vue.d.ts +137 -0
- package/dist/grid/host/controller.d.ts +219 -0
- package/dist/grid/host/dom.d.ts +10 -0
- package/dist/grid/index.d.ts +8 -0
- package/dist/grid/range/block.d.ts +30 -0
- package/dist/grid/range/fill.d.ts +27 -0
- package/dist/grid/range/index.d.ts +2 -0
- package/dist/grid/theme.d.ts +61 -0
- package/dist/grid-core/auto-scroll.d.ts +67 -0
- package/dist/grid-core/column-resize.d.ts +43 -0
- package/dist/grid-core/config.d.ts +39 -0
- package/dist/grid-core/coordinate.d.ts +64 -0
- package/dist/grid-core/drag.d.ts +46 -0
- package/dist/grid-core/freeze.d.ts +11 -0
- package/dist/grid-core/index.d.ts +17 -0
- package/dist/grid-core/keyboard.d.ts +34 -0
- package/dist/grid-core/keys.d.ts +38 -0
- package/dist/grid-core/lru.d.ts +10 -0
- package/dist/grid-core/range.d.ts +28 -0
- package/dist/grid-core/region.d.ts +73 -0
- package/dist/grid-core/renderer/base.d.ts +92 -0
- package/dist/grid-core/renderer/layout.d.ts +129 -0
- package/dist/grid-core/selection-controller.d.ts +62 -0
- package/dist/grid-core/selection.d.ts +35 -0
- package/dist/grid-core/theme.d.ts +81 -0
- package/dist/grid-core/types.d.ts +178 -0
- package/dist/grid.js +6272 -0
- package/dist/i18n/text.d.ts +17 -0
- package/dist/index.d.ts +39 -4
- package/dist/index.js +23037 -14390
- package/dist/interaction/editSession.d.ts +49 -0
- package/dist/interaction/focus.d.ts +28 -0
- package/dist/interaction/gesture.d.ts +49 -0
- package/dist/interaction/ime.d.ts +55 -0
- package/dist/interaction/index.d.ts +6 -0
- package/dist/interaction/outside.d.ts +40 -0
- package/dist/interaction/vue.d.ts +21 -0
- package/dist/json-ai-prompt.md +1 -1
- package/dist/json-preview/preview.js +16780 -11595
- package/dist/json.js +10 -10
- package/dist/lib/adaptiveLayout.d.ts +32 -2
- package/dist/lib/deviceViewport.d.ts +2 -1
- package/dist/lib/motion.d.ts +12 -0
- package/dist/reka-runtime.json +15 -12
- package/dist/rich-text.js +1 -1
- package/dist/theme.css +1 -1
- package/dist/themes/dsm7-embedded-reset.css +1 -1
- package/dist/themes/dsm7-embedded-theme.css +1 -1
- package/dist/themes/dsm7-embedded.css +1 -1
- package/dist/themes/dsm7.css +1 -1
- package/dist/virtual/cardHeight.d.ts +39 -0
- package/dist/virtual/galleryColumns.d.ts +11 -0
- package/dist/virtual/layoutMotion.d.ts +30 -0
- package/docs/adaptive-layout.md +148 -25
- package/docs/app-local-modal.md +1 -1
- package/docs/callout.md +22 -1
- package/docs/layout-rules.md +14 -0
- package/docs/list-detail.md +60 -0
- package/docs/mobile-native.md +502 -0
- package/docs/release-checks.md +28 -0
- package/docs/theme-hooks.md +28 -7
- package/docs/ux-foundation.md +133 -0
- package/docs/ux-grid.md +217 -0
- package/package.json +100 -2
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
content: string;
|
|
3
3
|
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
4
|
+
/** The first tooltip's delay in ms; a neighbour opened right after another skips it. */
|
|
4
5
|
delay?: number;
|
|
5
6
|
/** Keeps the trigger from opening a tooltip at all. */
|
|
6
7
|
disabled?: boolean;
|
|
7
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* A touch or pen tap on the trigger toggles the tooltip, and a tap anywhere
|
|
10
|
+
* else closes it (touch has no hover). On by default on a coarse pointer;
|
|
11
|
+
* `false` keeps a tap to the trigger's own action.
|
|
12
|
+
*/
|
|
8
13
|
openOnTap?: boolean;
|
|
9
14
|
};
|
|
10
|
-
declare var
|
|
15
|
+
declare var __VLS_27: {};
|
|
11
16
|
type __VLS_Slots = {} & {
|
|
12
|
-
default?: (props: typeof
|
|
17
|
+
default?: (props: typeof __VLS_27) => any;
|
|
13
18
|
};
|
|
14
19
|
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
15
20
|
disabled: boolean;
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
export declare const TOOLTIP_CONTENT_CLASS = "z-[1450] max-w-
|
|
1
|
+
export declare const TOOLTIP_CONTENT_CLASS = "z-[1450] max-w-[min(18rem,var(--reka-popper-available-width,18rem))] rounded-[var(--ui-radius-sm)] bg-[var(--ui-tooltip-bg)] px-3 py-1.5 text-[12px] leading-4 text-[var(--ui-tooltip-fg)] whitespace-pre-line shadow-[var(--ui-shadow-menu)] [overflow-wrap:anywhere] animate-[ui-fade-in_var(--ui-motion-fast)_var(--ui-motion-ease)]";
|
|
2
|
+
/** Gap between a tooltip and its trigger. */
|
|
3
|
+
export declare const TOOLTIP_OFFSET = 6;
|
|
4
|
+
/** The first tooltip waits this long (interaction-spec §1.1). */
|
|
5
|
+
export declare const TOOLTIP_DELAY = 350;
|
|
6
|
+
/** A tooltip that opens within this long of another closing skips the delay. */
|
|
7
|
+
export declare const TOOLTIP_SKIP_DELAY = 300;
|
|
8
|
+
/** True while a tooltip is open or closed less than TOOLTIP_SKIP_DELAY ago. */
|
|
9
|
+
export declare const tooltipWarm: import('vue').Ref<boolean, boolean>;
|
|
10
|
+
export declare function tooltipOpened(): void;
|
|
11
|
+
export declare function tooltipClosed(): void;
|
|
@@ -68,10 +68,10 @@ declare const __VLS_export: import('vue').DefineComponent<{
|
|
|
68
68
|
variant: "compact" | "full";
|
|
69
69
|
loading: boolean;
|
|
70
70
|
disabled: boolean;
|
|
71
|
+
invalid: boolean;
|
|
71
72
|
id: string;
|
|
72
73
|
modelValue: string;
|
|
73
74
|
placeholder: string;
|
|
74
|
-
invalid: boolean;
|
|
75
75
|
ariaLabel: string;
|
|
76
76
|
headings: boolean;
|
|
77
77
|
files: (id: string) => FileItem | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* The key this layer adds to `history.state`: how many dismissable surfaces
|
|
4
|
+
* were open when the entry was pushed. Other keys (a router's) are copied
|
|
5
|
+
* through unchanged, and the URL never changes.
|
|
6
|
+
*/
|
|
7
|
+
export declare const BACK_DISMISS_STATE_KEY = "__uiBackDismiss";
|
|
8
|
+
export interface BackDismissOptions {
|
|
9
|
+
/** Off: the surface takes no history entry (a desktop popover, a DSM window). Default on. */
|
|
10
|
+
enabled?: MaybeRefOrGetter<boolean>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Lets the browser's Back (the Android back button, the iOS edge swipe) close
|
|
14
|
+
* an open sheet, drawer or pushed page instead of leaving the page. While
|
|
15
|
+
* `open` is true the surface owns one `history.state` entry; Back calls
|
|
16
|
+
* `close`, and closing by code takes the entry back off. Nested surfaces
|
|
17
|
+
* stack: each Back closes the top one only. Call it in a component's setup.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useBackDismiss(open: MaybeRefOrGetter<boolean>, close: () => void, options?: BackDismissOptions): void;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/** The native `type` for an Input `type`: `integer` and `decimal` are text fields with a number keyboard (never `type="number"`). */
|
|
2
|
+
export declare function nativeInputType(type: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* The on-screen keyboard a field of this type opens: its layout
|
|
5
|
+
* (`inputmode`), whether it capitalises and spell-checks, and the label of
|
|
6
|
+
* its Enter key. The caller's own attributes override every one of them.
|
|
7
|
+
*/
|
|
8
|
+
export declare function keyboardHints(type: string): Record<string, string>;
|
|
1
9
|
/** One primary control per FormItem. Layout attrs stay on wrappers; all other
|
|
2
10
|
* attrs belong to the focusable control. Composite controls consume the field
|
|
3
11
|
* so their popup's internal inputs cannot steal its label or reuse its id. */
|
|
@@ -8,6 +16,16 @@ export declare function useFormControl(options: {
|
|
|
8
16
|
ariaLabel?: () => string | undefined;
|
|
9
17
|
ariaLabelledby?: () => string | undefined;
|
|
10
18
|
invalid?: () => boolean | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* A text entry field: its type sets the keyboard hints. With `element`, the
|
|
21
|
+
* field also joins its Form's field order, so its Enter key reads Next, or
|
|
22
|
+
* Done on the last field, and on a touch device Next moves to the next field.
|
|
23
|
+
*/
|
|
24
|
+
keyboard?: {
|
|
25
|
+
type: () => string;
|
|
26
|
+
element?: () => HTMLElement | null | undefined;
|
|
27
|
+
active?: () => boolean;
|
|
28
|
+
};
|
|
11
29
|
}): {
|
|
12
30
|
controlAttrs: () => Record<string, unknown> & {
|
|
13
31
|
id?: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* True on a phone: the enclosing AppRoot is narrow (`presentation` mobile)
|
|
4
|
+
* and the pointer is coarse. It is the same signal as the phone tokens in
|
|
5
|
+
* adaptive.css (docs/mobile-native.md, Signals). Outside an AppRoot, or in a
|
|
6
|
+
* narrow window used with a mouse, it is false.
|
|
7
|
+
*/
|
|
8
|
+
export declare function usePhone(): ComputedRef<boolean>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ComputedRef, MaybeRefOrGetter } from 'vue';
|
|
2
|
+
/** A menu with more actions than this becomes an action sheet on a phone. */
|
|
3
|
+
export declare const PHONE_MENU_MAX_ACTIONS = 5;
|
|
4
|
+
/** What a popup holds; any of these, on a phone, makes it a sheet. */
|
|
5
|
+
export interface PhoneSurfaceContent {
|
|
6
|
+
list?: boolean;
|
|
7
|
+
search?: boolean;
|
|
8
|
+
form?: boolean;
|
|
9
|
+
/** The number of actions on the first level of a menu. */
|
|
10
|
+
actions?: number;
|
|
11
|
+
submenu?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export type PhoneSurface = 'popover' | 'sheet';
|
|
14
|
+
/** Whether this content needs a sheet once the app is phone-width. */
|
|
15
|
+
export declare function needsSheet(content: PhoneSurfaceContent): boolean;
|
|
16
|
+
type MenuEntryShape = {
|
|
17
|
+
key?: unknown;
|
|
18
|
+
type?: string;
|
|
19
|
+
children?: readonly unknown[];
|
|
20
|
+
};
|
|
21
|
+
/** The content of a menu: its first-level actions (separators don't count) and whether any of them opens a submenu. */
|
|
22
|
+
export declare function menuContent(items: readonly MenuEntryShape[]): PhoneSurfaceContent;
|
|
23
|
+
/**
|
|
24
|
+
* `sheet` while the enclosing app is phone-width (640px or narrower, the same
|
|
25
|
+
* signal that turns a Dialog into a BottomSheet) and the content needs one,
|
|
26
|
+
* else `popover`. A touch tablet keeps popovers. Call it in setup.
|
|
27
|
+
*/
|
|
28
|
+
export declare function usePhoneSurface(content: MaybeRefOrGetter<PhoneSurfaceContent>): ComputedRef<PhoneSurface>;
|
|
29
|
+
/**
|
|
30
|
+
* The name a control is known by, to title the sheet it opens: its
|
|
31
|
+
* `aria-label`, else the text of the elements its `aria-labelledby` names
|
|
32
|
+
* (a form label).
|
|
33
|
+
*/
|
|
34
|
+
export declare function accessibleName(element: Element | null | undefined): string;
|
|
35
|
+
export {};
|
|
@@ -1,6 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { raisesKeyboard } from './visualViewport';
|
|
3
|
+
export { raisesKeyboard };
|
|
2
4
|
/**
|
|
3
|
-
* True while
|
|
4
|
-
*
|
|
5
|
+
* True while the on-screen keyboard is open. A focused text field on a touch
|
|
6
|
+
* device is the fast first signal; the visual viewport then confirms it (or
|
|
7
|
+
* not, for a hardware keyboard). A mouse-and-keyboard device never reports one.
|
|
8
|
+
* Without `visualViewport` the focus signal stands alone.
|
|
5
9
|
*/
|
|
6
|
-
export declare function useSoftKeyboard():
|
|
10
|
+
export declare function useSoftKeyboard(): ComputedRef<boolean>;
|
|
11
|
+
/** Focuses an element without letting the browser scroll the page, then shows it inside its own scroller. */
|
|
12
|
+
export declare function focusWithoutScroll(element: HTMLElement | null | undefined): void;
|
|
13
|
+
/** The element's nearest scroll container below the document; the window itself never scrolls. */
|
|
14
|
+
export declare function scrollerOf(element: HTMLElement): HTMLElement | null;
|
|
15
|
+
/**
|
|
16
|
+
* Scrolls the element's own scroller (never the window) just enough to show it
|
|
17
|
+
* above the keyboard and any sticky footer, by the scroller's
|
|
18
|
+
* `scroll-padding-*` (block "nearest"). Returns the scroller it moved, if any.
|
|
19
|
+
*/
|
|
20
|
+
export declare function revealInScroller(element: HTMLElement): HTMLElement | null;
|
|
21
|
+
/**
|
|
22
|
+
* While the keyboard is open, keeps the focused field inside `root` visible in
|
|
23
|
+
* its own scroller: on focus, when the keyboard opens and when it changes
|
|
24
|
+
* height. The scroller gets `data-ui-kb-room` (scroll padding, and on iOS room
|
|
25
|
+
* to scroll the last field above the keyboard) until the keyboard closes. A
|
|
26
|
+
* field inside `[data-ui-keyboard-reveal="off"]` is left to its container.
|
|
27
|
+
*/
|
|
28
|
+
export declare function useFieldReveal(root: Ref<HTMLElement | null>): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* A viewport change smaller than this is browser chrome (the URL bar or a
|
|
4
|
+
* toolbar), not an on-screen keyboard. vaul and the reka Drawer use the same
|
|
5
|
+
* threshold.
|
|
6
|
+
*/
|
|
7
|
+
export declare const KEYBOARD_THRESHOLD = 60;
|
|
8
|
+
export interface VisualViewportState {
|
|
9
|
+
/** The visual viewport's height in CSS px: what is on screen above the keyboard. */
|
|
10
|
+
height: number;
|
|
11
|
+
/** How far the visual viewport is panned down the layout viewport (iOS pans it to show a field). */
|
|
12
|
+
offsetTop: number;
|
|
13
|
+
/**
|
|
14
|
+
* How much of the layout viewport the keyboard covers from the bottom:
|
|
15
|
+
* `innerHeight − height − offsetTop` while a keyboard is open, else 0. It is
|
|
16
|
+
* the iOS keyboard height; on Android with `interactive-widget=resizes-content`
|
|
17
|
+
* the layout viewport itself shrinks, so it stays 0 and the layout is already right.
|
|
18
|
+
*/
|
|
19
|
+
keyboardInset: number;
|
|
20
|
+
/** An on-screen keyboard is open: a text field has focus and the viewport lost ≥60 px to it. */
|
|
21
|
+
keyboard: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function raisesKeyboard(element: Element | null): element is HTMLElement;
|
|
24
|
+
/**
|
|
25
|
+
* The visual viewport and the on-screen keyboard, read once per frame and
|
|
26
|
+
* shared by every caller (one set of listeners per page). Read-only. Without
|
|
27
|
+
* `window.visualViewport` the keyboard is never reported.
|
|
28
|
+
*/
|
|
29
|
+
export declare function useVisualViewport(): Readonly<Ref<VisualViewportState>>;
|
|
30
|
+
/** True when the page can report the visual viewport (and so confirm a keyboard). */
|
|
31
|
+
export declare function hasVisualViewport(): boolean;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* The edge-zone percentage and the linear speed ramp (full speed at and beyond
|
|
4
|
+
* the edge) are ported from Baserow's `v-auto-scroll` directive
|
|
5
|
+
* (web-frontend/modules/core/directives/autoScroll.js:30-99 at 98f727dc2),
|
|
6
|
+
* rewritten as a requestAnimationFrame loop with a minimum zone and both axes.
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) 2019-present Baserow B.V.
|
|
9
|
+
*
|
|
10
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
|
11
|
+
* software and associated documentation files (the "Software"), to deal in the Software
|
|
12
|
+
* without restriction, including without limitation the rights to use, copy, modify,
|
|
13
|
+
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
|
14
|
+
* permit persons to whom the Software is furnished to do so, subject to the following
|
|
15
|
+
* conditions:
|
|
16
|
+
*
|
|
17
|
+
* The above copyright notice and this permission notice shall be included in all copies
|
|
18
|
+
* or substantial portions of the Software.
|
|
19
|
+
*
|
|
20
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
21
|
+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
22
|
+
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
23
|
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
24
|
+
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
|
25
|
+
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
/** Share of the scroll box, per edge, that scrolls (interaction-spec §5.2). */
|
|
28
|
+
export declare const AUTO_SCROLL_ZONE_PERCENT = 15;
|
|
29
|
+
/** The zone never gets narrower than this. */
|
|
30
|
+
export declare const AUTO_SCROLL_MIN_ZONE_PX = 56;
|
|
31
|
+
/** Pixels per frame at the edge and beyond it. */
|
|
32
|
+
export declare const AUTO_SCROLL_MAX_SPEED = 16;
|
|
33
|
+
export interface AutoScrollOptions {
|
|
34
|
+
axis: 'x' | 'y' | 'both';
|
|
35
|
+
/** Zone per edge as a percentage of the box (default 15). */
|
|
36
|
+
padding?: number;
|
|
37
|
+
minZone?: number;
|
|
38
|
+
maxSpeed?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface AutoScroll {
|
|
41
|
+
/** Feed the latest pointer position; starts the loop when it is in a zone. */
|
|
42
|
+
update(x: number, y: number): void;
|
|
43
|
+
stop(): void;
|
|
44
|
+
readonly running: boolean;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Speed for a pointer `offset` px from the box start on an axis `size` long:
|
|
48
|
+
* negative toward the start, positive toward the end, 0 outside both zones.
|
|
49
|
+
* Linear from 0 at the inner zone border to `max` at the edge; a pointer past
|
|
50
|
+
* the edge keeps full speed (Baserow clamps the distance to 0).
|
|
51
|
+
*/
|
|
52
|
+
export declare function edgeSpeed(offset: number, size: number, options?: Pick<AutoScrollOptions, 'padding' | 'minZone' | 'maxSpeed'>): number;
|
|
53
|
+
/**
|
|
54
|
+
* Scrolls `element` while the last pointer position sits in an edge zone. The
|
|
55
|
+
* box is read once per frame inside the loop, never in the pointer handler.
|
|
56
|
+
*/
|
|
57
|
+
export declare function createAutoScroll(element: () => HTMLElement | null | undefined, options: AutoScrollOptions): AutoScroll;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { AutoScrollOptions } from './autoScroll';
|
|
2
|
+
import { Axis, LaneLayout, Rect } from './layout';
|
|
3
|
+
export type DragKey = string | number;
|
|
4
|
+
/** Touch must stay down this long before it lifts (interaction-spec §5.2, §14). */
|
|
5
|
+
export declare const TOUCH_HOLD_MS = 250;
|
|
6
|
+
/** Movement before the hold ends that hands the touch back to native scrolling. */
|
|
7
|
+
export declare const TOUCH_HOLD_TOLERANCE_PX = 6;
|
|
8
|
+
/** After a sibling moves, the target holds still this long (Baserow 100 ms). */
|
|
9
|
+
export declare const SWAP_LOCK_MS = 100;
|
|
10
|
+
export declare const DND_LANE_ATTR = "data-dnd-lane";
|
|
11
|
+
export declare const DND_KEY_ATTR = "data-dnd-key";
|
|
12
|
+
export declare const DND_INDEX_ATTR = "data-dnd-index";
|
|
13
|
+
export declare const DND_STATE_ATTR = "data-dnd-state";
|
|
14
|
+
export declare const DND_GHOST_ATTR = "data-dnd-ghost";
|
|
15
|
+
export interface DragPosition {
|
|
16
|
+
lane: string;
|
|
17
|
+
index: number;
|
|
18
|
+
}
|
|
19
|
+
export interface DragDrop<K extends DragKey = DragKey> {
|
|
20
|
+
key: K;
|
|
21
|
+
from: DragPosition;
|
|
22
|
+
/** `index` is the item's index in the target lane after the move. */
|
|
23
|
+
to: DragPosition;
|
|
24
|
+
}
|
|
25
|
+
export type DragPhase = 'idle' | 'pending' | 'dragging' | 'settling' | 'returning';
|
|
26
|
+
export type DragMode = 'pointer' | 'keyboard';
|
|
27
|
+
export interface DragState<K extends DragKey = DragKey> {
|
|
28
|
+
readonly phase: DragPhase;
|
|
29
|
+
readonly mode: DragMode | null;
|
|
30
|
+
readonly key: K | null;
|
|
31
|
+
readonly from: DragPosition | null;
|
|
32
|
+
readonly to: DragPosition | null;
|
|
33
|
+
/** Bumps on every visible change (target, phase), never on pointer moves. */
|
|
34
|
+
readonly version: number;
|
|
35
|
+
}
|
|
36
|
+
export interface DragLaneOptions<K extends DragKey = DragKey> {
|
|
37
|
+
id: string;
|
|
38
|
+
/** The element item positions are measured from (holds the items, or is their scroll content). */
|
|
39
|
+
element: () => HTMLElement | null | undefined;
|
|
40
|
+
/** The box that scrolls this lane; defaults to `element`. */
|
|
41
|
+
scroller?: () => HTMLElement | null | undefined;
|
|
42
|
+
count: () => number;
|
|
43
|
+
/** Read at lift; default `{ kind: 'measured' }`. Virtual lanes must give a fixed layout. */
|
|
44
|
+
layout?: () => LaneLayout;
|
|
45
|
+
axis?: Axis;
|
|
46
|
+
/** Whether this lane takes the dragged item (a multi-value stack can refuse). */
|
|
47
|
+
accepts?: (key: K, from: DragPosition) => boolean;
|
|
48
|
+
/** Edge auto-scroll along the lane axis; false turns it off. */
|
|
49
|
+
autoScroll?: boolean | Partial<AutoScrollOptions>;
|
|
50
|
+
}
|
|
51
|
+
export interface DragKitOptions<K extends DragKey = DragKey> {
|
|
52
|
+
/** Mouse/pen distance before a press becomes a drag (default 5). */
|
|
53
|
+
threshold?: number;
|
|
54
|
+
holdMs?: number;
|
|
55
|
+
holdTolerance?: number;
|
|
56
|
+
swapLockMs?: number;
|
|
57
|
+
canDrag?: (key: K, from: DragPosition) => boolean;
|
|
58
|
+
/** Build the ghost from the pressed item; default clones it. */
|
|
59
|
+
ghost?: (source: HTMLElement) => HTMLElement;
|
|
60
|
+
/** Where the ghost is appended; default the app root (`[data-ui-app]`) or `body`. */
|
|
61
|
+
ghostParent?: (source: HTMLElement) => HTMLElement;
|
|
62
|
+
/** Outer scroll boxes (the board) that auto-scroll during a drag. */
|
|
63
|
+
scrollers?: ReadonlyArray<{
|
|
64
|
+
element: () => HTMLElement | null | undefined;
|
|
65
|
+
} & AutoScrollOptions>;
|
|
66
|
+
onStart?: (state: DragState<K>) => void;
|
|
67
|
+
/** Called in the release frame, before the settle animation. Apply the move to local data here. */
|
|
68
|
+
onDrop: (drop: DragDrop<K>) => void | PromiseLike<unknown>;
|
|
69
|
+
/** `onDrop`'s promise rejected: put the item back at `drop.from`. The kit animates it home. */
|
|
70
|
+
onRestore?: (drop: DragDrop<K>, error: unknown) => void;
|
|
71
|
+
onCancel?: (state: DragState<K>) => void;
|
|
72
|
+
onChange?: (state: DragState<K>) => void;
|
|
73
|
+
}
|
|
74
|
+
export interface DragItemBinding {
|
|
75
|
+
[DND_KEY_ATTR]: string;
|
|
76
|
+
[DND_INDEX_ATTR]: number;
|
|
77
|
+
[DND_STATE_ATTR]?: 'source' | 'settling';
|
|
78
|
+
style: Record<string, string>;
|
|
79
|
+
}
|
|
80
|
+
export interface DragPlaceholder {
|
|
81
|
+
/** Index in the target lane after the move. */
|
|
82
|
+
index: number;
|
|
83
|
+
/** Content coordinates, the same space the lane's items sit in. */
|
|
84
|
+
rect: Rect;
|
|
85
|
+
style: Record<string, string>;
|
|
86
|
+
}
|
|
87
|
+
export interface DragKit<K extends DragKey = DragKey> {
|
|
88
|
+
readonly state: DragState<K>;
|
|
89
|
+
/** Register a lane; returns its disposer. */
|
|
90
|
+
lane(options: DragLaneOptions<K>): () => void;
|
|
91
|
+
/** Bind on the item (or its handle) `pointerdown`. */
|
|
92
|
+
pointerDown(event: PointerEvent, lane: string, index: number, key: K): void;
|
|
93
|
+
/** Bind on the focusable item `keydown`. Space lifts, arrows move, Space/Enter drop. Returns true when handled. */
|
|
94
|
+
keyDown(event: KeyboardEvent, lane: string, index: number, key: K): boolean;
|
|
95
|
+
/** Attributes and style for item `index` of `lane`. */
|
|
96
|
+
item(lane: string, index: number, key: K): DragItemBinding;
|
|
97
|
+
/** Attributes for the lane element. */
|
|
98
|
+
laneAttrs(lane: string): Record<string, string>;
|
|
99
|
+
/** Where the placeholder of `lane` goes, or null when the drop is not over it. */
|
|
100
|
+
placeholder(lane: string): DragPlaceholder | null;
|
|
101
|
+
isDragging(key: K): boolean;
|
|
102
|
+
/** Fly the item home and end the drag. */
|
|
103
|
+
cancel(): void;
|
|
104
|
+
dispose(): void;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* One drag at a time across any number of lanes. The pointer-following ghost
|
|
108
|
+
* is written straight to the DOM; only the target index and phase are state,
|
|
109
|
+
* so siblings re-render once per target change and animate by transform.
|
|
110
|
+
*/
|
|
111
|
+
export declare function createDragKit<K extends DragKey = DragKey>(options: DragKitOptions<K>): DragKit<K>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AUTO_SCROLL_MAX_SPEED, AUTO_SCROLL_MIN_ZONE_PX, AUTO_SCROLL_ZONE_PERCENT, createAutoScroll, edgeSpeed, type AutoScroll, type AutoScrollOptions, } from './autoScroll';
|
|
2
|
+
export { DND_GHOST_ATTR, DND_INDEX_ATTR, DND_KEY_ATTR, DND_LANE_ATTR, DND_STATE_ATTR, SWAP_LOCK_MS, TOUCH_HOLD_MS, TOUCH_HOLD_TOLERANCE_PX, createDragKit, type DragDrop, type DragItemBinding, type DragKey, type DragKit, type DragKitOptions, type DragLaneOptions, type DragMode, type DragPhase, type DragPlaceholder, type DragPosition, type DragState, } from './dragKit';
|
|
3
|
+
export { gridGeometry, listGeometry, measuredGeometry, type Arrangement, type Axis, type LaneGeometry, type LaneLayout, type Rect, } from './layout';
|
|
4
|
+
export { useDragKit, type UseDragKit } from './vue';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export type Axis = 'x' | 'y';
|
|
2
|
+
export interface Rect {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
export type LaneLayout =
|
|
9
|
+
/** Equal items along the lane axis (virtual lists, grid rows, columns). */
|
|
10
|
+
{
|
|
11
|
+
kind: 'list';
|
|
12
|
+
size: number;
|
|
13
|
+
gap?: number;
|
|
14
|
+
start?: number;
|
|
15
|
+
}
|
|
16
|
+
/** Equal cards wrapped into `columns` (gallery). Reorder rule uses the x axis. */
|
|
17
|
+
| {
|
|
18
|
+
kind: 'grid';
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
columns: number;
|
|
22
|
+
gapX?: number;
|
|
23
|
+
gapY?: number;
|
|
24
|
+
startX?: number;
|
|
25
|
+
startY?: number;
|
|
26
|
+
}
|
|
27
|
+
/** Rendered items measured at lift (`data-dnd-index`); for lanes that render every item. */
|
|
28
|
+
| {
|
|
29
|
+
kind: 'measured';
|
|
30
|
+
};
|
|
31
|
+
export interface Arrangement {
|
|
32
|
+
readonly count: number;
|
|
33
|
+
rect(slot: number): Rect;
|
|
34
|
+
/** The visual slot under a content point, clamped to the slots; -1 when there are none. */
|
|
35
|
+
slotAt(x: number, y: number): number;
|
|
36
|
+
}
|
|
37
|
+
export interface LaneGeometry {
|
|
38
|
+
/** The axis the half-item rule reads. */
|
|
39
|
+
readonly axis: Axis;
|
|
40
|
+
readonly count: number;
|
|
41
|
+
/** Where original item `index` sits before anything moves. */
|
|
42
|
+
origin(index: number): Rect;
|
|
43
|
+
/**
|
|
44
|
+
* The visual slots after original item `skip` leaves the lane (-1: none
|
|
45
|
+
* leaves) and a placeholder the size of `drag` takes slot `insert` (-1: none).
|
|
46
|
+
*/
|
|
47
|
+
arrange(skip: number, insert: number, drag: Rect): Arrangement;
|
|
48
|
+
}
|
|
49
|
+
export declare function listGeometry(axis: Axis, count: number, size: number, gap?: number, start?: number, cross?: number): LaneGeometry;
|
|
50
|
+
export declare function gridGeometry(count: number, layout: Extract<LaneLayout, {
|
|
51
|
+
kind: 'grid';
|
|
52
|
+
}>): LaneGeometry;
|
|
53
|
+
/**
|
|
54
|
+
* Items of varying size along one axis. `origins[i]` is item i's measured rect;
|
|
55
|
+
* `start` places the first slot of an empty lane (its padding).
|
|
56
|
+
*/
|
|
57
|
+
export declare function measuredGeometry(axis: Axis, origins: readonly Rect[], start?: number): LaneGeometry;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { DragItemBinding, DragKey, DragKit, DragKitOptions, DragLaneOptions, DragPlaceholder } from './dragKit';
|
|
3
|
+
export interface UseDragKit<K extends DragKey> {
|
|
4
|
+
kit: DragKit<K>;
|
|
5
|
+
/** Bumps on every visible drag change; pointer moves never touch it. */
|
|
6
|
+
version: Readonly<Ref<number>>;
|
|
7
|
+
/** `kit.item`, tracked by `version` for templates. */
|
|
8
|
+
item(lane: string, index: number, key: K): DragItemBinding;
|
|
9
|
+
/** `kit.placeholder`, tracked by `version` for templates. */
|
|
10
|
+
placeholder(lane: string): DragPlaceholder | null;
|
|
11
|
+
isDragging(key: K): boolean;
|
|
12
|
+
/** Register a lane for as long as the calling scope lives. */
|
|
13
|
+
useLane(options: DragLaneOptions<K>): () => void;
|
|
14
|
+
}
|
|
15
|
+
/** `createDragKit` bound to the effect scope, with one shallowRef bump per change. */
|
|
16
|
+
export declare function useDragKit<K extends DragKey = DragKey>(options: DragKitOptions<K>): UseDragKit<K>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
state?: 'idle' | 'pending' | 'saved' | 'error';
|
|
3
|
+
/** What to say in the current state, from the caller's localized copy. */
|
|
4
|
+
message?: string;
|
|
5
|
+
width?: string;
|
|
6
|
+
height?: string;
|
|
7
|
+
/** Milliseconds before the pending state shows. */
|
|
8
|
+
delay?: number;
|
|
9
|
+
/** The error's action; empty hides it. */
|
|
10
|
+
retryLabel?: string;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
13
|
+
retry: () => any;
|
|
14
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
onRetry?: (() => any) | undefined;
|
|
16
|
+
}>, {
|
|
17
|
+
message: string;
|
|
18
|
+
height: string;
|
|
19
|
+
width: string;
|
|
20
|
+
delay: number;
|
|
21
|
+
state: "idle" | "pending" | "saved" | "error";
|
|
22
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export type ShowAfterOptions = {
|
|
3
|
+
/** Milliseconds `active` must hold before the indicator shows. */
|
|
4
|
+
delay?: number;
|
|
5
|
+
/** Milliseconds a shown indicator stays, from when it appeared, so it does not blink. */
|
|
6
|
+
minVisible?: number;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Whether a pending indicator (skeleton shapes, a spinner, a saving mark)
|
|
10
|
+
* should show: only once `active` has held for `delay` (300 ms by default),
|
|
11
|
+
* and then for at least `minVisible`. Work that ends sooner shows nothing.
|
|
12
|
+
* The box the indicator sits in is reserved by the caller from the start;
|
|
13
|
+
* only its contents wait.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useShowAfter(active: () => boolean, options?: ShowAfterOptions): Readonly<Ref<boolean>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Moves the items of a stack (the toast viewport) to their new places over
|
|
4
|
+
* `--ui-motion-stack` when one arrives, leaves or changes its text, instead
|
|
5
|
+
* of jumping (FLIP).
|
|
6
|
+
*
|
|
7
|
+
* The places are read after each change and kept; a change is seen by a
|
|
8
|
+
* MutationObserver, which runs before the next paint, so each item first
|
|
9
|
+
* paints at its old place and then slides. Only the `translate` property is
|
|
10
|
+
* written, so the items' own enter and exit animations (on `transform`) keep
|
|
11
|
+
* running. With motion off the token reads 0 and nothing animates.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useStackMotion(container: Readonly<Ref<HTMLElement | null | undefined>>, itemSelector: string): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feedback timing (interaction spec §11-12): how long a loading indicator
|
|
3
|
+
* waits before it shows, and how long each kind of toast stays.
|
|
4
|
+
*/
|
|
5
|
+
/** No skeleton, spinner or pending mark for work shorter than this. */
|
|
6
|
+
export declare const PENDING_DELAY_MS = 300;
|
|
7
|
+
/** A toast's tone. */
|
|
8
|
+
export type FeedbackTone = 'info' | 'success' | 'warning' | 'danger';
|
|
9
|
+
/** How long a toast of each tone stays; a danger toast stays until closed. */
|
|
10
|
+
export declare const TOAST_DURATION_MS: Readonly<Record<FeedbackTone, number>>;
|
|
11
|
+
/** A toast with an action (Undo, Open) stays at least this long, so there is time to reach it. */
|
|
12
|
+
export declare const TOAST_ACTION_MIN_MS = 5000;
|
|
13
|
+
/**
|
|
14
|
+
* The time a toast stays open: its own `duration` when given; a pending
|
|
15
|
+
* toast stays until it is updated; otherwise its tone's time, at least
|
|
16
|
+
* TOAST_ACTION_MIN_MS when it has an action.
|
|
17
|
+
*/
|
|
18
|
+
export declare function toastDuration(toast: {
|
|
19
|
+
tone?: FeedbackTone;
|
|
20
|
+
duration?: number;
|
|
21
|
+
pending?: boolean;
|
|
22
|
+
actionLabel?: string;
|
|
23
|
+
}): number;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { drawCheckbox, drawRect } from '../../grid-core/renderer/base';
|
|
2
|
+
import { GridRect } from '../contracts';
|
|
3
|
+
import { GridChipColors } from '../theme';
|
|
4
|
+
import { GridCellPaintArgs } from './types';
|
|
5
|
+
export declare const CHIP_GAP = 4;
|
|
6
|
+
export declare const CHIP_PADDING = 6;
|
|
7
|
+
export declare const CHIP_RADIUS = 4;
|
|
8
|
+
export declare const ICON_GAP = 4;
|
|
9
|
+
export declare const setFont: (ctx: CanvasRenderingContext2D, size: number, family: string, weight?: string) => void;
|
|
10
|
+
/** Width of `text` in the current font, with grid-core's cache. */
|
|
11
|
+
export declare const measure: (ctx: CanvasRenderingContext2D, text: string, fontSize: number) => number;
|
|
12
|
+
/** First grapheme of a name, for avatar initials. */
|
|
13
|
+
export declare const firstGrapheme: (text: string) => string;
|
|
14
|
+
export interface TextOptions {
|
|
15
|
+
color?: string;
|
|
16
|
+
align?: 'left' | 'right';
|
|
17
|
+
/** Left edge, defaults to the cell's padding. */
|
|
18
|
+
x?: number;
|
|
19
|
+
maxWidth?: number;
|
|
20
|
+
fontSize?: number;
|
|
21
|
+
}
|
|
22
|
+
/** One line of cell text, vertically centred, cut with an ellipsis. Returns the drawn width. */
|
|
23
|
+
export declare const drawCellText: (ctx: CanvasRenderingContext2D, args: GridCellPaintArgs, text: string, options?: TextOptions) => number;
|
|
24
|
+
/** A rounded chip with its label, already planned to `width`. */
|
|
25
|
+
export declare const drawChip: (ctx: CanvasRenderingContext2D, args: GridCellPaintArgs, rect: GridRect, label: string, colors: GridChipColors) => void;
|
|
26
|
+
export interface InlinePlan {
|
|
27
|
+
/** Widths of the items that are drawn, in order (the last may be cut). */
|
|
28
|
+
widths: number[];
|
|
29
|
+
/** Items not drawn, shown as a "+N" badge. */
|
|
30
|
+
more: number;
|
|
31
|
+
badgeWidth: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Lays out inline items (chips, avatars, thumbnails) on one line within
|
|
35
|
+
* `available`. Items that do not fit collapse into a "+N" badge; when even the
|
|
36
|
+
* first item does not fit, it is cut to the room left beside the badge.
|
|
37
|
+
*/
|
|
38
|
+
export declare const planInline: (natural: readonly number[], available: number, badgeWidthFor: (count: number) => number, minItem: number) => InlinePlan;
|
|
39
|
+
/** Width of a "+N" badge at the chip font. */
|
|
40
|
+
export declare const badgeWidth: (ctx: CanvasRenderingContext2D, args: GridCellPaintArgs, count: number) => number;
|
|
41
|
+
export declare const drawBadge: (ctx: CanvasRenderingContext2D, args: GridCellPaintArgs, x: number, count: number, width: number) => void;
|
|
42
|
+
/** Five-point star inside a `size` box at (x, y). */
|
|
43
|
+
export declare const drawStar: (ctx: CanvasRenderingContext2D, x: number, y: number, size: number, fill: string) => void;
|
|
44
|
+
/** "Open link" glyph: a box with an arrow leaving its top-right corner. */
|
|
45
|
+
export declare const drawLinkIcon: (ctx: CanvasRenderingContext2D, x: number, y: number, size: number, stroke: string) => void;
|
|
46
|
+
export { drawCheckbox, drawRect };
|
|
47
|
+
/** Keeps the inline rects a draw produced so a later click can hit-test them without a canvas. */
|
|
48
|
+
export declare class RegionCache {
|
|
49
|
+
private readonly cache;
|
|
50
|
+
set(key: string, regions: GridRect[]): void;
|
|
51
|
+
get(key: string): GridRect[] | undefined;
|
|
52
|
+
clear(): void;
|
|
53
|
+
}
|
|
54
|
+
export declare const inside: (point: {
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
}, rect: GridRect) => boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createGridCells, type GridCells, type GridCellsOptions } from './registry';
|
|
2
|
+
export { useGridCells, type UseGridCellsOptions } from './use';
|
|
3
|
+
export { defaultGridCellRenderers, clearGridCellRegions } from './renderers';
|
|
4
|
+
export { formatGridNumber, parseGridNumber } from './number';
|
|
5
|
+
export { drawGridCellStatus } from './status';
|
|
6
|
+
export { createGridImageCache, type GridImageCache } from './images';
|
|
7
|
+
export type * from './types';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GridNumberFormat } from './types';
|
|
2
|
+
/** 12.5 → "12.50"; currency "$1,234.50"; percent 0.125 → "12.50%". Empty for null. */
|
|
3
|
+
export declare const formatGridNumber: (value: number | null | undefined, format?: GridNumberFormat, locale?: string) => string;
|
|
4
|
+
/** Teable's lenient parse: keeps digits, `.`, `+`, `-`; "12.5abc" → 12.5, "50%" → 0.5. Null when nothing parses. */
|
|
5
|
+
export declare const parseGridNumber: (value: string | null | undefined, format?: GridNumberFormat) => number | null;
|