@webx-ui/core 0.5.0 → 0.6.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.
@@ -0,0 +1,105 @@
1
+ import { DialogLayout, DialogProps } from './types';
2
+ type __VLS_Props = DialogProps;
3
+ declare function close(): void;
4
+ /** Back to the declared size, in the middle of the screen, and forgotten. */
5
+ declare function reset(): void;
6
+ type __VLS_PublicProps = {
7
+ 'open'?: boolean;
8
+ } & __VLS_Props;
9
+ declare function __VLS_template(): {
10
+ attrs: Partial<{}>;
11
+ slots: Readonly<{
12
+ /** The control that opens the panel. Exactly one element. */
13
+ trigger?: (props: {
14
+ open: boolean;
15
+ }) => unknown;
16
+ /** The body. */
17
+ default?: (props: {
18
+ close: () => void;
19
+ }) => unknown;
20
+ /** Replaces `title`. */
21
+ title?: () => unknown;
22
+ /** Next to the heading — badges, or actions that belong to the whole panel. */
23
+ extra?: (props: {
24
+ close: () => void;
25
+ }) => unknown;
26
+ /** A column beside the body. Its presence is what splits the body in two. */
27
+ sidebar?: (props: {
28
+ close: () => void;
29
+ }) => unknown;
30
+ /** A row under the body — where the Save and Cancel go. */
31
+ footer?: (props: {
32
+ close: () => void;
33
+ }) => unknown;
34
+ }> & {
35
+ /** The control that opens the panel. Exactly one element. */
36
+ trigger?: (props: {
37
+ open: boolean;
38
+ }) => unknown;
39
+ /** The body. */
40
+ default?: (props: {
41
+ close: () => void;
42
+ }) => unknown;
43
+ /** Replaces `title`. */
44
+ title?: () => unknown;
45
+ /** Next to the heading — badges, or actions that belong to the whole panel. */
46
+ extra?: (props: {
47
+ close: () => void;
48
+ }) => unknown;
49
+ /** A column beside the body. Its presence is what splits the body in two. */
50
+ sidebar?: (props: {
51
+ close: () => void;
52
+ }) => unknown;
53
+ /** A row under the body — where the Save and Cancel go. */
54
+ footer?: (props: {
55
+ close: () => void;
56
+ }) => unknown;
57
+ };
58
+ refs: {
59
+ panel: HTMLDivElement;
60
+ };
61
+ rootEl: any;
62
+ };
63
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
64
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {
65
+ close: typeof close;
66
+ reset: typeof reset;
67
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
68
+ close: () => any;
69
+ open: () => any;
70
+ "update:open": (value: boolean) => any;
71
+ layout: (layout: DialogLayout) => any;
72
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
73
+ onClose?: (() => any) | undefined;
74
+ onOpen?: (() => any) | undefined;
75
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
76
+ onLayout?: ((layout: DialogLayout) => any) | undefined;
77
+ }>, {
78
+ title: string;
79
+ modal: boolean;
80
+ ariaLabel: string;
81
+ closable: boolean;
82
+ closeLabel: string;
83
+ scroll: import('./types').DialogScroll;
84
+ width: number | string;
85
+ height: number | string;
86
+ stickyFooter: boolean;
87
+ minWidth: number;
88
+ minHeight: number;
89
+ sidebarWidth: number | string;
90
+ closeOnOverlay: boolean;
91
+ closeOnEscape: boolean;
92
+ overlay: boolean;
93
+ draggable: boolean;
94
+ resizable: boolean;
95
+ persist: string;
96
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
97
+ panel: HTMLDivElement;
98
+ }, any>;
99
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
100
+ export default _default;
101
+ type __VLS_WithTemplateSlots<T, S> = T & {
102
+ new (): {
103
+ $slots: S;
104
+ };
105
+ };
@@ -0,0 +1,2 @@
1
+ export { default as WxDialog } from './Dialog';
2
+ export type * from './types';
@@ -0,0 +1,60 @@
1
+ /**
2
+ * What scrolls when the content is longer than the screen: the body inside a panel that
3
+ * stops at the edge of the screen, or the whole panel inside the screen itself.
4
+ */
5
+ export type DialogScroll = 'body' | 'panel';
6
+ /** Where the panel was left: pixels, and the offset from the middle of the screen. */
7
+ export interface DialogLayout {
8
+ width?: number;
9
+ height?: number;
10
+ x?: number;
11
+ y?: number;
12
+ }
13
+ export interface DialogProps {
14
+ /** Heading of the panel. The `title` slot replaces it. */
15
+ title?: string;
16
+ /** Width of the panel: a number in pixels, or any CSS length — `520`, `'60%'`. */
17
+ width?: number | string;
18
+ /** Height of the panel. Without it the panel grows with its content, up to the screen. */
19
+ height?: number | string;
20
+ /**
21
+ * Where a long panel scrolls. `body` keeps the panel within the screen and scrolls what
22
+ * is between the heading and the footer. `panel` lets the panel grow past the screen and
23
+ * scrolls the whole of it — the heading goes with it, and dragging and resizing are off.
24
+ */
25
+ scroll?: DialogScroll;
26
+ /** In `scroll="panel"`, keep the footer against the bottom of the screen. */
27
+ stickyFooter?: boolean;
28
+ /** Smallest width a resize may reach, in pixels. */
29
+ minWidth?: number;
30
+ /** Smallest height a resize may reach, in pixels. */
31
+ minHeight?: number;
32
+ /** Width of the `sidebar` column: a number in pixels, or any CSS length. */
33
+ sidebarWidth?: number | string;
34
+ /** Adds a × to the heading. */
35
+ closable?: boolean;
36
+ /** Label of that ×, for screen readers. */
37
+ closeLabel?: string;
38
+ /** A click outside the panel closes it. */
39
+ closeOnOverlay?: boolean;
40
+ /** Escape closes it. */
41
+ closeOnEscape?: boolean;
42
+ /** Dim the page behind the panel. */
43
+ overlay?: boolean;
44
+ /** Block the page behind the panel, trap focus inside it and lock the page's scroll. */
45
+ modal?: boolean;
46
+ /** The panel can be dragged by its heading. */
47
+ draggable?: boolean;
48
+ /** The panel can be resized by the grip in its bottom-right corner. */
49
+ resizable?: boolean;
50
+ /** Remember size and position under this key, in `localStorage`. */
51
+ persist?: string;
52
+ /** Accessible name for the panel when it has no visible heading. */
53
+ ariaLabel?: string;
54
+ }
55
+ export interface DialogEmits {
56
+ open: [];
57
+ close: [];
58
+ /** The panel was dragged or resized. Carries what `persist` would store. */
59
+ layout: [layout: DialogLayout];
60
+ }
@@ -0,0 +1,98 @@
1
+ import { DrawerLayout, DrawerProps } from './types';
2
+ type __VLS_Props = DrawerProps;
3
+ declare function close(): void;
4
+ /** Back to the declared size, and forgotten. */
5
+ declare function reset(): void;
6
+ type __VLS_PublicProps = {
7
+ 'open'?: boolean;
8
+ } & __VLS_Props;
9
+ declare function __VLS_template(): {
10
+ attrs: Partial<{}>;
11
+ slots: Readonly<{
12
+ /** The control that opens the panel. Exactly one element. */
13
+ trigger?: (props: {
14
+ open: boolean;
15
+ }) => unknown;
16
+ /** The body. The one part of the panel that scrolls. */
17
+ default?: (props: {
18
+ close: () => void;
19
+ }) => unknown;
20
+ /** Replaces `title`. */
21
+ title?: () => unknown;
22
+ /** Next to the heading — badges, or actions that belong to the whole panel. */
23
+ extra?: (props: {
24
+ close: () => void;
25
+ }) => unknown;
26
+ /** A column beside the body. Its presence is what splits the body in two. */
27
+ sidebar?: (props: {
28
+ close: () => void;
29
+ }) => unknown;
30
+ /** A row under the body — where the Save and Cancel go. */
31
+ footer?: (props: {
32
+ close: () => void;
33
+ }) => unknown;
34
+ }> & {
35
+ /** The control that opens the panel. Exactly one element. */
36
+ trigger?: (props: {
37
+ open: boolean;
38
+ }) => unknown;
39
+ /** The body. The one part of the panel that scrolls. */
40
+ default?: (props: {
41
+ close: () => void;
42
+ }) => unknown;
43
+ /** Replaces `title`. */
44
+ title?: () => unknown;
45
+ /** Next to the heading — badges, or actions that belong to the whole panel. */
46
+ extra?: (props: {
47
+ close: () => void;
48
+ }) => unknown;
49
+ /** A column beside the body. Its presence is what splits the body in two. */
50
+ sidebar?: (props: {
51
+ close: () => void;
52
+ }) => unknown;
53
+ /** A row under the body — where the Save and Cancel go. */
54
+ footer?: (props: {
55
+ close: () => void;
56
+ }) => unknown;
57
+ };
58
+ refs: {};
59
+ rootEl: any;
60
+ };
61
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
62
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {
63
+ close: typeof close;
64
+ reset: typeof reset;
65
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
66
+ close: () => any;
67
+ open: () => any;
68
+ "update:open": (value: boolean) => any;
69
+ layout: (layout: DrawerLayout) => any;
70
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
71
+ onClose?: (() => any) | undefined;
72
+ onOpen?: (() => any) | undefined;
73
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
74
+ onLayout?: ((layout: DrawerLayout) => any) | undefined;
75
+ }>, {
76
+ size: number | string;
77
+ title: string;
78
+ side: import('./types').DrawerSide;
79
+ modal: boolean;
80
+ ariaLabel: string;
81
+ closable: boolean;
82
+ closeLabel: string;
83
+ sidebarWidth: number | string;
84
+ closeOnOverlay: boolean;
85
+ closeOnEscape: boolean;
86
+ overlay: boolean;
87
+ resizable: boolean;
88
+ persist: string;
89
+ minSize: number;
90
+ resizeLabel: string;
91
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
92
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
93
+ export default _default;
94
+ type __VLS_WithTemplateSlots<T, S> = T & {
95
+ new (): {
96
+ $slots: S;
97
+ };
98
+ };
@@ -0,0 +1,2 @@
1
+ export { default as WxDrawer } from './Drawer';
2
+ export type * from './types';
@@ -0,0 +1,46 @@
1
+ export type DrawerSide = 'right' | 'left' | 'top' | 'bottom';
2
+ /** Where the panel was left: its size along the axis it slides on, in pixels. */
3
+ export interface DrawerLayout {
4
+ size?: number;
5
+ }
6
+ export interface DrawerProps {
7
+ /** Heading of the panel. The `title` slot replaces it. */
8
+ title?: string;
9
+ /** Edge the panel slides in from. */
10
+ side?: DrawerSide;
11
+ /**
12
+ * How far the panel reaches into the screen: its width on the left and right, its
13
+ * height at the top and bottom. A number in pixels, or any CSS length — `380`, `'40%'`.
14
+ */
15
+ size?: number | string;
16
+ /** Smallest size a resize may reach, in pixels. */
17
+ minSize?: number;
18
+ /** Width of the `sidebar` column: a number in pixels, or any CSS length. */
19
+ sidebarWidth?: number | string;
20
+ /** Adds a × to the heading. */
21
+ closable?: boolean;
22
+ /** Label of that ×, for screen readers. */
23
+ closeLabel?: string;
24
+ /** A click outside the panel closes it. */
25
+ closeOnOverlay?: boolean;
26
+ /** Escape closes it. */
27
+ closeOnEscape?: boolean;
28
+ /** Dim the page behind the panel. */
29
+ overlay?: boolean;
30
+ /** Block the page behind the panel, trap focus inside it and lock the page's scroll. */
31
+ modal?: boolean;
32
+ /** The panel can be resized by the edge it faces the page with. */
33
+ resizable?: boolean;
34
+ /** Remember the size under this key, in `localStorage`. */
35
+ persist?: string;
36
+ /** Accessible name for the panel when it has no visible heading. */
37
+ ariaLabel?: string;
38
+ /** Label of the resize handle, for screen readers. */
39
+ resizeLabel?: string;
40
+ }
41
+ export interface DrawerEmits {
42
+ open: [];
43
+ close: [];
44
+ /** The panel was resized. Carries what `persist` would store. */
45
+ layout: [layout: DrawerLayout];
46
+ }
@@ -32,9 +32,9 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
32
32
  readonly: boolean;
33
33
  step: number;
34
34
  precision: number;
35
+ wheel: boolean;
35
36
  controls: boolean;
36
37
  controlsPosition: "sides" | "right";
37
- wheel: boolean;
38
38
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
39
39
  inputRef: HTMLInputElement;
40
40
  }, any>;
@@ -2,11 +2,11 @@ import { KanbanCard, KanbanColumn, KanbanId, KanbanProps, KanbanVia } from './ty
2
2
  declare const _default: <T extends KanbanCard = KanbanCard>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
3
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
4
4
  readonly onAdd?: ((column: KanbanColumn<T>) => any) | undefined;
5
- readonly "onUpdate:collapsed"?: ((value: KanbanId[]) => any) | undefined;
6
5
  readonly onMove?: ((move: import('./types').KanbanMove<T>) => any) | undefined;
6
+ readonly "onUpdate:collapsed"?: ((value: KanbanId[]) => any) | undefined;
7
7
  readonly "onColumn-move"?: ((move: import('./types').KanbanColumnMove<T>) => any) | undefined;
8
8
  readonly "onAdd-column"?: (() => any) | undefined;
9
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onAdd" | "onUpdate:collapsed" | "onMove" | "onColumn-move" | "onAdd-column"> & ({
9
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onAdd" | "onMove" | "onUpdate:collapsed" | "onColumn-move" | "onAdd-column"> & ({
10
10
  collapsed?: KanbanId[];
11
11
  } & KanbanProps<T>) & Partial<{}>> & import('vue').PublicProps;
12
12
  expose(exposed: import('vue').ShallowUnwrapRef<{
@@ -63,8 +63,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
63
63
  ariaLabel: string;
64
64
  closable: boolean;
65
65
  closeLabel: string;
66
- arrow: boolean;
67
66
  width: number | string;
67
+ arrow: boolean;
68
68
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
69
69
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
70
70
  export default _default;
@@ -28,9 +28,9 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
28
28
  status: import('../..').ControlStatus;
29
29
  id: string;
30
30
  readonly: boolean;
31
+ resize: "none" | "vertical" | "both";
31
32
  maxlength: number;
32
33
  showCount: boolean;
33
- resize: "none" | "vertical" | "both";
34
34
  rows: number;
35
35
  autosize: boolean | import('./types').AutosizeOptions;
36
36
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
@@ -15,6 +15,8 @@ export * from './Countdown';
15
15
  export * from './DatePicker';
16
16
  export * from './DateRangePicker';
17
17
  export * from './DateTimePicker';
18
+ export * from './Dialog';
19
+ export * from './Drawer';
18
20
  export * from './Dropdown';
19
21
  export * from './DropdownItem';
20
22
  export * from './EntityCard';
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The pieces `WxDialog` and `WxDrawer` have in common: both take a size in pixels or
3
+ * per cent, both can be dragged to a new one, and both can be told to remember it.
4
+ */
5
+ /** A number is pixels, however it arrives — `width="520"` in a template is a string. */
6
+ export declare function cssLength(value: number | string | undefined): string | undefined;
7
+ /**
8
+ * The pixels behind a size prop, when there are any — `'60%'` has none, and a gesture
9
+ * that starts on such a panel has to measure it instead.
10
+ */
11
+ export declare function pixelLength(value: number | string | undefined): number | undefined;
12
+ export declare function clamp(value: number, min: number, max: number): number;
13
+ export interface PanelMemory<T> {
14
+ read: () => Partial<T> | null;
15
+ write: (value: T) => void;
16
+ clear: () => void;
17
+ }
18
+ /**
19
+ * `localStorage`, with every way it can fail treated the same way: remembering a panel's
20
+ * size is a convenience, and a private window or a full quota only costs the default.
21
+ */
22
+ export declare function usePanelMemory<T>(prefix: string, key: () => string | undefined): PanelMemory<T>;