@webx-ui/core 0.6.0 → 0.7.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/components/Alert/Alert.d.ts +41 -0
- package/dist/components/Alert/index.d.ts +2 -0
- package/dist/components/Alert/types.d.ts +29 -0
- package/dist/components/Aside/Aside.d.ts +25 -0
- package/dist/components/Aside/index.d.ts +2 -0
- package/dist/components/Aside/types.d.ts +14 -0
- package/dist/components/Badge/Badge.d.ts +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +23 -0
- package/dist/components/Breadcrumb/index.d.ts +2 -0
- package/dist/components/Breadcrumb/types.d.ts +13 -0
- package/dist/components/BreadcrumbItem/BreadcrumbItem.d.ts +28 -0
- package/dist/components/BreadcrumbItem/index.d.ts +2 -0
- package/dist/components/BreadcrumbItem/types.d.ts +19 -0
- package/dist/components/Cascader/Cascader.d.ts +1 -1
- package/dist/components/Col/Col.d.ts +27 -0
- package/dist/components/Col/index.d.ts +2 -0
- package/dist/components/Col/types.d.ts +24 -0
- package/dist/components/Container/Container.d.ts +22 -0
- package/dist/components/Container/index.d.ts +2 -0
- package/dist/components/Container/types.d.ts +13 -0
- package/dist/components/Dialog/Dialog.d.ts +1 -1
- package/dist/components/Divider/Divider.d.ts +24 -0
- package/dist/components/Divider/index.d.ts +2 -0
- package/dist/components/Divider/types.d.ts +16 -0
- package/dist/components/Footer/Footer.d.ts +23 -0
- package/dist/components/Footer/index.d.ts +2 -0
- package/dist/components/Footer/types.d.ts +8 -0
- package/dist/components/Header/Header.d.ts +24 -0
- package/dist/components/Header/index.d.ts +2 -0
- package/dist/components/Header/types.d.ts +10 -0
- package/dist/components/Icon/icons.d.ts +1 -0
- package/dist/components/Main/Main.d.ts +22 -0
- package/dist/components/Main/index.d.ts +2 -0
- package/dist/components/Main/types.d.ts +8 -0
- package/dist/components/Menu/Menu.d.ts +39 -0
- package/dist/components/Menu/index.d.ts +2 -0
- package/dist/components/Menu/types.d.ts +26 -0
- package/dist/components/MenuGroup/MenuGroup.d.ts +21 -0
- package/dist/components/MenuGroup/index.d.ts +2 -0
- package/dist/components/MenuGroup/types.d.ts +4 -0
- package/dist/components/MenuItem/MenuItem.d.ts +32 -0
- package/dist/components/MenuItem/index.d.ts +2 -0
- package/dist/components/MenuItem/types.d.ts +23 -0
- package/dist/components/Row/Row.d.ts +25 -0
- package/dist/components/Row/index.d.ts +2 -0
- package/dist/components/Row/types.d.ts +17 -0
- package/dist/components/Scrollbar/Scrollbar.d.ts +39 -0
- package/dist/components/Scrollbar/index.d.ts +2 -0
- package/dist/components/Scrollbar/types.d.ts +30 -0
- package/dist/components/Space/Space.d.ts +27 -0
- package/dist/components/Space/index.d.ts +2 -0
- package/dist/components/Space/types.d.ts +23 -0
- package/dist/components/Submenu/Submenu.d.ts +31 -0
- package/dist/components/Submenu/index.d.ts +2 -0
- package/dist/components/Submenu/types.d.ts +15 -0
- package/dist/components/index.d.ts +17 -0
- package/dist/composables/useBreadcrumb.d.ts +13 -0
- package/dist/composables/useMenu.d.ts +49 -0
- package/dist/composables/useResponsiveShell.d.ts +59 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3821 -2903
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { MenuItemProps } from './types';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: {
|
|
5
|
+
icon?(_: {}): any;
|
|
6
|
+
default?(_: {}): any;
|
|
7
|
+
trailing?(_: {}): any;
|
|
8
|
+
};
|
|
9
|
+
refs: {};
|
|
10
|
+
rootEl: any;
|
|
11
|
+
};
|
|
12
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
13
|
+
declare const __VLS_component: import('vue').DefineComponent<MenuItemProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
14
|
+
click: (event: MouseEvent) => any;
|
|
15
|
+
}, string, import('vue').PublicProps, Readonly<MenuItemProps> & Readonly<{
|
|
16
|
+
onClick?: ((event: MouseEvent) => any) | undefined;
|
|
17
|
+
}>, {
|
|
18
|
+
disabled: boolean;
|
|
19
|
+
as: string | import('vue').Component;
|
|
20
|
+
label: string;
|
|
21
|
+
target: string;
|
|
22
|
+
value: import('..').MenuValue;
|
|
23
|
+
icon: import('..').IconName;
|
|
24
|
+
href: string;
|
|
25
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
26
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
27
|
+
export default _default;
|
|
28
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
29
|
+
new (): {
|
|
30
|
+
$slots: S;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { IconName } from '../Icon/types';
|
|
3
|
+
import { MenuValue } from '../../composables/useMenu';
|
|
4
|
+
export interface MenuItemProps {
|
|
5
|
+
/** What identifies the entry — the value the menu reports as selected. */
|
|
6
|
+
value?: MenuValue;
|
|
7
|
+
/** Icon before the label. The only thing left of the entry on a collapsed rail. */
|
|
8
|
+
icon?: IconName;
|
|
9
|
+
/**
|
|
10
|
+
* The label, when a slot would be overkill. It is also what a collapsed rail shows
|
|
11
|
+
* as the entry's title on hover.
|
|
12
|
+
*/
|
|
13
|
+
label?: string;
|
|
14
|
+
/** Where the entry points. Without it the entry is a button. */
|
|
15
|
+
href?: string;
|
|
16
|
+
target?: string;
|
|
17
|
+
/** Renders through another component — `RouterLink`, say, with `to` in the attrs. */
|
|
18
|
+
as?: string | Component;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface MenuItemEmits {
|
|
22
|
+
click: [event: MouseEvent];
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RowProps } from './types';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: {
|
|
5
|
+
default?(_: {}): any;
|
|
6
|
+
};
|
|
7
|
+
refs: {};
|
|
8
|
+
rootEl: any;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
|
+
declare const __VLS_component: import('vue').DefineComponent<RowProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<RowProps> & Readonly<{}>, {
|
|
12
|
+
as: string | import('vue').Component;
|
|
13
|
+
align: import('./types').RowAlign;
|
|
14
|
+
justify: import('./types').RowJustify;
|
|
15
|
+
gutter: number | string;
|
|
16
|
+
gutterY: number | string;
|
|
17
|
+
wrap: boolean;
|
|
18
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
export type RowJustify = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
|
|
3
|
+
export type RowAlign = 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
4
|
+
export interface RowProps {
|
|
5
|
+
/** Gap between columns: pixels as a number, or any CSS length. */
|
|
6
|
+
gutter?: number | string;
|
|
7
|
+
/** Gap between rows once the columns wrap. Defaults to `gutter`. */
|
|
8
|
+
gutterY?: number | string;
|
|
9
|
+
/** Distribution along the row. */
|
|
10
|
+
justify?: RowJustify;
|
|
11
|
+
/** Alignment across it. */
|
|
12
|
+
align?: RowAlign;
|
|
13
|
+
/** Lets columns wrap onto the next line. */
|
|
14
|
+
wrap?: boolean;
|
|
15
|
+
/** The element to render. */
|
|
16
|
+
as?: string | Component;
|
|
17
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ScrollbarProps, ScrollMotion, ScrollTarget } from './types';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: {
|
|
5
|
+
default?(_: {}): any;
|
|
6
|
+
};
|
|
7
|
+
refs: {
|
|
8
|
+
viewport: HTMLDivElement;
|
|
9
|
+
};
|
|
10
|
+
rootEl: HTMLDivElement;
|
|
11
|
+
};
|
|
12
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
13
|
+
declare const __VLS_component: import('vue').DefineComponent<ScrollbarProps, {
|
|
14
|
+
/** The scrolling element. */
|
|
15
|
+
el: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
|
|
16
|
+
scrollTo: (options: ScrollTarget) => void | undefined;
|
|
17
|
+
scrollToTop: (behavior?: ScrollMotion) => void | undefined;
|
|
18
|
+
scrollToBottom: (behavior?: ScrollMotion) => void | undefined;
|
|
19
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
20
|
+
scroll: (event: Event) => any;
|
|
21
|
+
}, string, import('vue').PublicProps, Readonly<ScrollbarProps> & Readonly<{
|
|
22
|
+
onScroll?: ((event: Event) => any) | undefined;
|
|
23
|
+
}>, {
|
|
24
|
+
size: import('./types').ScrollbarSize;
|
|
25
|
+
always: boolean;
|
|
26
|
+
height: number | string;
|
|
27
|
+
maxHeight: number | string;
|
|
28
|
+
axis: import('./types').ScrollbarAxis;
|
|
29
|
+
chainScroll: boolean;
|
|
30
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
31
|
+
viewport: HTMLDivElement;
|
|
32
|
+
}, HTMLDivElement>;
|
|
33
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
34
|
+
export default _default;
|
|
35
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
36
|
+
new (): {
|
|
37
|
+
$slots: S;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type ScrollbarAxis = 'y' | 'x' | 'both';
|
|
2
|
+
export type ScrollbarSize = 'sm' | 'md';
|
|
3
|
+
export interface ScrollbarProps {
|
|
4
|
+
/** Fixed height: pixels as a number, or any CSS length. */
|
|
5
|
+
height?: number | string;
|
|
6
|
+
/** Height the box grows to before it starts scrolling. */
|
|
7
|
+
maxHeight?: number | string;
|
|
8
|
+
/** Which way the content scrolls. */
|
|
9
|
+
axis?: ScrollbarAxis;
|
|
10
|
+
/** Thickness of the bar. */
|
|
11
|
+
size?: ScrollbarSize;
|
|
12
|
+
/** Keeps the bar visible instead of fading it in on hover. */
|
|
13
|
+
always?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Lets a scroll that reaches the end carry on to the page behind it. Off by
|
|
16
|
+
* default: a panel inside a dialog should not scroll the page under it.
|
|
17
|
+
*/
|
|
18
|
+
chainScroll?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ScrollbarEmits {
|
|
21
|
+
scroll: [event: Event];
|
|
22
|
+
}
|
|
23
|
+
/** How a programmatic scroll moves — the native `ScrollBehavior` values. */
|
|
24
|
+
export type ScrollMotion = 'auto' | 'smooth' | 'instant';
|
|
25
|
+
/** Where to scroll to, in the shape the native `scrollTo` takes. */
|
|
26
|
+
export interface ScrollTarget {
|
|
27
|
+
top?: number;
|
|
28
|
+
left?: number;
|
|
29
|
+
behavior?: ScrollMotion;
|
|
30
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SpaceProps } from './types';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: {
|
|
5
|
+
default?(_: {}): any;
|
|
6
|
+
};
|
|
7
|
+
refs: {};
|
|
8
|
+
rootEl: any;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
|
+
declare const __VLS_component: import('vue').DefineComponent<SpaceProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<SpaceProps> & Readonly<{}>, {
|
|
12
|
+
fill: boolean;
|
|
13
|
+
size: import('./types').SpaceSize | number | string;
|
|
14
|
+
as: string | import('vue').Component;
|
|
15
|
+
align: import('./types').SpaceAlign;
|
|
16
|
+
inline: boolean;
|
|
17
|
+
direction: import('./types').SpaceDirection;
|
|
18
|
+
justify: import('./types').SpaceJustify;
|
|
19
|
+
wrap: boolean;
|
|
20
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
22
|
+
export default _default;
|
|
23
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
export type SpaceDirection = 'horizontal' | 'vertical';
|
|
3
|
+
export type SpaceSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
|
+
export type SpaceAlign = 'start' | 'center' | 'end' | 'baseline' | 'stretch';
|
|
5
|
+
export type SpaceJustify = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
|
|
6
|
+
export interface SpaceProps {
|
|
7
|
+
/** Along the line or down the page. */
|
|
8
|
+
direction?: SpaceDirection;
|
|
9
|
+
/** Gap between children: a keyword from the spacing scale, pixels, or any CSS length. */
|
|
10
|
+
size?: SpaceSize | number | string;
|
|
11
|
+
/** Cross-axis alignment. */
|
|
12
|
+
align?: SpaceAlign;
|
|
13
|
+
/** Main-axis distribution. */
|
|
14
|
+
justify?: SpaceJustify;
|
|
15
|
+
/** Lets a horizontal row wrap onto the next line. */
|
|
16
|
+
wrap?: boolean;
|
|
17
|
+
/** Children stretch to fill the row — equal-width buttons in a toolbar. */
|
|
18
|
+
fill?: boolean;
|
|
19
|
+
/** Renders as `inline-flex`, so the group sits inside a line of text. */
|
|
20
|
+
inline?: boolean;
|
|
21
|
+
/** The element to render. */
|
|
22
|
+
as?: string | Component;
|
|
23
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SubmenuProps } from './types';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: {
|
|
5
|
+
icon?(_: {}): any;
|
|
6
|
+
icon?(_: {}): any;
|
|
7
|
+
title?(_: {}): any;
|
|
8
|
+
title?(_: {}): any;
|
|
9
|
+
default?(_: {}): any;
|
|
10
|
+
default?(_: {}): any;
|
|
11
|
+
};
|
|
12
|
+
refs: {};
|
|
13
|
+
rootEl: HTMLLIElement;
|
|
14
|
+
};
|
|
15
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
16
|
+
declare const __VLS_component: import('vue').DefineComponent<SubmenuProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
17
|
+
toggle: (open: boolean) => any;
|
|
18
|
+
}, string, import('vue').PublicProps, Readonly<SubmenuProps> & Readonly<{
|
|
19
|
+
onToggle?: ((open: boolean) => any) | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
title: string;
|
|
23
|
+
icon: import('..').IconName;
|
|
24
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLLIElement>;
|
|
25
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IconName } from '../Icon/types';
|
|
2
|
+
import { MenuValue } from '../../composables/useMenu';
|
|
3
|
+
export interface SubmenuProps {
|
|
4
|
+
/** What identifies the branch — the key the menu opens and closes it by. */
|
|
5
|
+
value: MenuValue;
|
|
6
|
+
/** Icon before the title. */
|
|
7
|
+
icon?: IconName;
|
|
8
|
+
/** The title, when a slot would be overkill. */
|
|
9
|
+
title?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface SubmenuEmits {
|
|
13
|
+
/** The branch was opened or closed. */
|
|
14
|
+
toggle: [open: boolean];
|
|
15
|
+
}
|
|
@@ -2,26 +2,35 @@ export * from './Accordion';
|
|
|
2
2
|
export * from './AccordionItem';
|
|
3
3
|
export * from './Action';
|
|
4
4
|
export * from './Actions';
|
|
5
|
+
export * from './Alert';
|
|
6
|
+
export * from './Aside';
|
|
5
7
|
export * from './Autocomplete';
|
|
6
8
|
export * from './Badge';
|
|
9
|
+
export * from './Breadcrumb';
|
|
10
|
+
export * from './BreadcrumbItem';
|
|
7
11
|
export * from './Button';
|
|
8
12
|
export * from './ButtonGroup';
|
|
9
13
|
export * from './Card';
|
|
10
14
|
export * from './Cascader';
|
|
11
15
|
export * from './Checkbox';
|
|
12
16
|
export * from './CheckboxGroup';
|
|
17
|
+
export * from './Col';
|
|
13
18
|
export * from './ColorPicker';
|
|
19
|
+
export * from './Container';
|
|
14
20
|
export * from './Countdown';
|
|
15
21
|
export * from './DatePicker';
|
|
16
22
|
export * from './DateRangePicker';
|
|
17
23
|
export * from './DateTimePicker';
|
|
18
24
|
export * from './Dialog';
|
|
25
|
+
export * from './Divider';
|
|
19
26
|
export * from './Drawer';
|
|
20
27
|
export * from './Dropdown';
|
|
21
28
|
export * from './DropdownItem';
|
|
22
29
|
export * from './EntityCard';
|
|
30
|
+
export * from './Footer';
|
|
23
31
|
export * from './Form';
|
|
24
32
|
export * from './FormItem';
|
|
33
|
+
export * from './Header';
|
|
25
34
|
export * from './Heading';
|
|
26
35
|
export * from './Icon';
|
|
27
36
|
export * from './Indicator';
|
|
@@ -29,6 +38,10 @@ export * from './Input';
|
|
|
29
38
|
export * from './InputNumber';
|
|
30
39
|
export * from './Kanban';
|
|
31
40
|
export * from './Link';
|
|
41
|
+
export * from './Main';
|
|
42
|
+
export * from './Menu';
|
|
43
|
+
export * from './MenuGroup';
|
|
44
|
+
export * from './MenuItem';
|
|
32
45
|
export * from './Pagination';
|
|
33
46
|
export * from './Popover';
|
|
34
47
|
export * from './Prose';
|
|
@@ -36,9 +49,13 @@ export * from './Radio';
|
|
|
36
49
|
export * from './RadioGroup';
|
|
37
50
|
export * from './Rate';
|
|
38
51
|
export * from './RichText';
|
|
52
|
+
export * from './Row';
|
|
53
|
+
export * from './Scrollbar';
|
|
39
54
|
export * from './Select';
|
|
40
55
|
export * from './Slider';
|
|
56
|
+
export * from './Space';
|
|
41
57
|
export * from './Statistic';
|
|
58
|
+
export * from './Submenu';
|
|
42
59
|
export * from './Switch';
|
|
43
60
|
export * from './Tab';
|
|
44
61
|
export * from './Table';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComputedRef, InjectionKey } from 'vue';
|
|
2
|
+
import { IconName } from '../components/Icon/types';
|
|
3
|
+
export type BreadcrumbSize = 'sm' | 'md';
|
|
4
|
+
/** What `WxBreadcrumb` hands down to the items inside it. */
|
|
5
|
+
export interface BreadcrumbContext {
|
|
6
|
+
/** The character drawn between items. */
|
|
7
|
+
separator: ComputedRef<string>;
|
|
8
|
+
/** An icon drawn instead of that character. */
|
|
9
|
+
separatorIcon: ComputedRef<IconName | undefined>;
|
|
10
|
+
size: ComputedRef<BreadcrumbSize>;
|
|
11
|
+
}
|
|
12
|
+
export declare const breadcrumbKey: InjectionKey<BreadcrumbContext>;
|
|
13
|
+
export declare function useBreadcrumb(): BreadcrumbContext | null;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ComputedRef, InjectionKey } from 'vue';
|
|
2
|
+
export type MenuMode = 'vertical' | 'horizontal';
|
|
3
|
+
export type MenuSize = 'sm' | 'md';
|
|
4
|
+
/** What identifies an entry: whatever you would put in a route table. */
|
|
5
|
+
export type MenuValue = string | number;
|
|
6
|
+
/** What `WxMenu` hands down to everything inside it. */
|
|
7
|
+
export interface MenuContext {
|
|
8
|
+
mode: ComputedRef<MenuMode>;
|
|
9
|
+
size: ComputedRef<MenuSize>;
|
|
10
|
+
/** The icon rail: labels hidden, submenus opening as flyouts. */
|
|
11
|
+
collapsed: ComputedRef<boolean>;
|
|
12
|
+
/** The entry that is currently selected. */
|
|
13
|
+
active: ComputedRef<MenuValue | undefined>;
|
|
14
|
+
/** The submenus the active entry sits in, outermost first. */
|
|
15
|
+
trail: ComputedRef<MenuValue[]>;
|
|
16
|
+
select: (value: MenuValue, event: MouseEvent) => void;
|
|
17
|
+
isOpen: (value: MenuValue) => boolean;
|
|
18
|
+
setOpen: (value: MenuValue, open: boolean, ancestors: MenuValue[]) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Bumped when every open flyout should close — an entry inside one was chosen.
|
|
21
|
+
* A panel cannot close on any click of its own: the branches inside it are opened
|
|
22
|
+
* by clicking too, and that would shut the panel before they could unfold.
|
|
23
|
+
*/
|
|
24
|
+
closeSignal: ComputedRef<number>;
|
|
25
|
+
closeFlyouts: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* An entry says where it sits so a submenu can tell it holds the active one —
|
|
28
|
+
* the highlight on a collapsed branch, and what `autoExpand` follows.
|
|
29
|
+
*/
|
|
30
|
+
register: (value: MenuValue, ancestors: MenuValue[]) => void;
|
|
31
|
+
unregister: (value: MenuValue) => void;
|
|
32
|
+
}
|
|
33
|
+
/** What a `WxSubmenu` hands down to the entries it holds. */
|
|
34
|
+
export interface SubmenuContext {
|
|
35
|
+
/** The submenus above this one, outermost first, including itself. */
|
|
36
|
+
ancestors: MenuValue[];
|
|
37
|
+
/** How deep the entries below sit — what the indent is counted from. */
|
|
38
|
+
depth: number;
|
|
39
|
+
/**
|
|
40
|
+
* Whether these entries are already inside a flyout panel. A panel is a fresh
|
|
41
|
+
* surface: the depth restarts at its edge, and the branches in it open inline
|
|
42
|
+
* rather than throwing a second panel beside the first.
|
|
43
|
+
*/
|
|
44
|
+
inFlyout: boolean;
|
|
45
|
+
}
|
|
46
|
+
export declare const menuKey: InjectionKey<MenuContext>;
|
|
47
|
+
export declare const submenuKey: InjectionKey<SubmenuContext>;
|
|
48
|
+
export declare function useMenu(): MenuContext | null;
|
|
49
|
+
export declare function useSubmenu(): SubmenuContext;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
/** What shape the navigation takes at the width it has been given. */
|
|
3
|
+
export type ShellLayout = 'sidebar' | 'rail' | 'drawer';
|
|
4
|
+
export interface ResponsiveShellOptions {
|
|
5
|
+
/** Under this width the menu leaves the page for a drawer behind a burger. */
|
|
6
|
+
phone?: number;
|
|
7
|
+
/** Under this width the sidebar starts as an icon rail. */
|
|
8
|
+
tablet?: number;
|
|
9
|
+
/** Whether it starts as a rail on a screen wide enough for the full sidebar. */
|
|
10
|
+
collapsed?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Remembers a sidebar that was closed by hand, under this key in `localStorage`.
|
|
13
|
+
* Only the closing is kept: a sidebar left open goes back to following the width,
|
|
14
|
+
* so a desktop opens it and a tablet still starts with the rail.
|
|
15
|
+
*/
|
|
16
|
+
persist?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ResponsiveShell {
|
|
19
|
+
/** Width of what is being measured, in pixels. `0` until it has been measured. */
|
|
20
|
+
width: Ref<number>;
|
|
21
|
+
layout: ComputedRef<ShellLayout>;
|
|
22
|
+
/** Hand this to `WxAside` and `WxMenu` — true for both the rail and the drawer. */
|
|
23
|
+
collapsed: ComputedRef<boolean>;
|
|
24
|
+
/** Whether there is room for a sidebar at all. False on a phone. */
|
|
25
|
+
showAside: ComputedRef<boolean>;
|
|
26
|
+
drawerOpen: Ref<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* What the one button in the header does: it collapses and expands the sidebar
|
|
29
|
+
* while the sidebar is on the page, and opens the drawer once the menu is gone.
|
|
30
|
+
* The icon follows `layout` — a burger belongs to the drawer alone.
|
|
31
|
+
*/
|
|
32
|
+
toggle: () => void;
|
|
33
|
+
close: () => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The rule on its own, so it can be read — and tested — without a browser.
|
|
37
|
+
*
|
|
38
|
+
* `collapsed` is the answer to "is the sidebar a rail", and `null` leaves it to the
|
|
39
|
+
* width: a rail from the tablet breakpoint down. Only the phone breakpoint is
|
|
40
|
+
* absolute, because a menu that has nowhere to stand has to leave the page.
|
|
41
|
+
*
|
|
42
|
+
* A width of `0` means nothing has been measured yet: on the server, and on the very
|
|
43
|
+
* first render. The widest shape is the right guess there, since it is the one a
|
|
44
|
+
* desktop gets, and the measurement that follows corrects it before paint.
|
|
45
|
+
*/
|
|
46
|
+
export declare function shellLayoutFor(width: number, collapsed: boolean | null, options?: ResponsiveShellOptions): ShellLayout;
|
|
47
|
+
/**
|
|
48
|
+
* Drives the three shapes an admin sidebar takes — full, icon rail, drawer — from
|
|
49
|
+
* the width of the shell rather than from the viewport's. The two are the same
|
|
50
|
+
* thing on a real page, and they are not inside a preview, a split screen or the
|
|
51
|
+
* demo box on this page, which is the case that catches a viewport media query out.
|
|
52
|
+
*
|
|
53
|
+
* ```ts
|
|
54
|
+
* const shell = useResponsiveShell(shellRef)
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* Pass nothing to measure the page itself.
|
|
58
|
+
*/
|
|
59
|
+
export declare function useResponsiveShell(target?: Ref<HTMLElement | null | undefined>, options?: ResponsiveShellOptions): ResponsiveShell;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export * from './components';
|
|
2
2
|
export { WebxUI, type WebxUiOptions } from './plugin';
|
|
3
3
|
export type { ControlSize, ControlStatus, ValidationErrors } from './composables/useFormField';
|
|
4
|
+
export { useResponsiveShell, shellLayoutFor, type ResponsiveShell, type ResponsiveShellOptions, type ShellLayout, } from './composables/useResponsiveShell';
|