rei-kit 2.18.0 → 2.19.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,77 @@
1
+ /**
2
+ * The menu a right-click opens, on whatever it was opened over.
3
+ *
4
+ * ## The keyboard is the whole difficulty
5
+ *
6
+ * A right-click menu is trivial to draw and easy to ship broken, because
7
+ * the thing that breaks is invisible to the person writing it: there is no
8
+ * mouse in it. The platform's own answer is **Shift+F10**, and on keyboards
9
+ * that have one, the **Menu** key — both of which this listens for, on the
10
+ * area itself. A context menu without them is a set of actions that simply
11
+ * do not exist for anyone not holding a mouse, and nothing on screen says
12
+ * so.
13
+ *
14
+ * Opened that way there is no pointer to anchor to, so it opens at the
15
+ * focused element instead of at coordinates nobody chose.
16
+ *
17
+ * ## It is a menu, with everything that promises
18
+ *
19
+ * `role="menu"` is a contract: the arrows move, Home and End go to the
20
+ * ends, Escape closes, and Tab *leaves*. That is `useMenuKeys`, the same
21
+ * one `BaseMenu` uses — a menu hung off a pointer and a menu hung off a
22
+ * button are the same keyboard and two different positions, and only the
23
+ * position is worth writing twice.
24
+ *
25
+ * ## The items are yours
26
+ *
27
+ * The kit draws no actions: they arrive in the slot as
28
+ * `<button role="menuitem">`, because their words, their order and what
29
+ * they do are the app's, and a kit that guessed them would be wrong in
30
+ * every app.
31
+ */
32
+ type __VLS_Props = {
33
+ /** Names the menu for a screen reader. Already translated. */
34
+ label: string;
35
+ /** Leaves the browser's own menu alone — for a text field, or a link. */
36
+ disabled?: boolean | undefined;
37
+ };
38
+ type __VLS_Slots = {
39
+ /**
40
+ * What the menu belongs to: a row, a canvas, a card.
41
+ *
42
+ * `props` carries the ARIA that says a menu is here. Spread it onto the
43
+ * element a reader actually lands on, the same way `BasePopover` hands a
44
+ * trigger its props.
45
+ *
46
+ * That element has to be one whose role takes these attributes — a
47
+ * `button`, or a `row`, `gridcell`, `treeitem`, `tab`. It is not the
48
+ * wrapper, and `tabindex` on a `div` does not make it one: focusable and
49
+ * "has a role that supports `aria-expanded`" are different things, and
50
+ * the second is what a reader is told. Writing them anywhere else puts
51
+ * an attribute on the page that a browser is entitled to ignore, which
52
+ * is worse than leaving them off, because it looks done.
53
+ */
54
+ default: (props: {
55
+ props: {
56
+ 'aria-haspopup'?: 'menu';
57
+ 'aria-expanded'?: boolean;
58
+ 'aria-controls'?: string;
59
+ };
60
+ }) => unknown;
61
+ /** The actions, each a `[role="menuitem"]`. */
62
+ items: (props: {
63
+ close: () => void;
64
+ }) => unknown;
65
+ };
66
+ declare function close(): void;
67
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {
68
+ close: typeof close;
69
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
70
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
71
+ declare const _default: typeof __VLS_export;
72
+ export default _default;
73
+ type __VLS_WithSlots<T, S> = T & {
74
+ new (): {
75
+ $slots: S;
76
+ };
77
+ };
@@ -0,0 +1,68 @@
1
+ type __VLS_Props = {
2
+ /** Names the dialog. Already translated. */
3
+ title: string;
4
+ /** Accessible name of the close button. Already translated. */
5
+ closeLabel: string;
6
+ /** Which edge it comes from. `start` and `end` follow the writing direction. */
7
+ side?: 'start' | 'end' | 'top' | 'bottom' | undefined;
8
+ /**
9
+ * How far it reaches in from that edge — a width on the sides, a height on
10
+ * the top and bottom. Any CSS length.
11
+ */
12
+ size?: string | undefined;
13
+ /** Escape and the scrim close it. Off for something half filled in. */
14
+ dismissible?: boolean | undefined;
15
+ };
16
+ type __VLS_ModelProps = {
17
+ /**
18
+ * A panel that comes in from the edge of a wide screen.
19
+ *
20
+ * ## `BaseDrawer`, `BaseSheet` or `BaseModal`
21
+ *
22
+ * A sheet belongs to a thumb: it arrives from the bottom edge and is pinned
23
+ * to the 430px shell column, so on a desktop it is narrow, and that is
24
+ * correct. A drawer is the wide screen's version — it comes from the side,
25
+ * it is as tall as the window, and it is the shape for the things a site
26
+ * keeps beside the page rather than on top of it: filters, a cart, a
27
+ * navigation menu that outgrew its bar, a record's details.
28
+ *
29
+ * A modal interrupts and wants an answer. A drawer does not ask anything —
30
+ * it is somewhere to work, and the page is still behind it.
31
+ *
32
+ * ## It is still a dialog
33
+ *
34
+ * Coming from the side changes where it is, not what it owes. Focus moves
35
+ * in, Tab cannot leave, Escape closes, the page behind goes inert and stops
36
+ * scrolling, and focus goes back to whatever opened it. All of that is
37
+ * `useDialogShell`, shared with `BaseModal`, because a drawer that
38
+ * reimplemented it would be a second copy to keep correct.
39
+ *
40
+ * ## `side` is logical, not left and right
41
+ *
42
+ * `start` and `end` follow the writing direction, so a drawer that opens
43
+ * from the left in English opens from the right in Arabic without the app
44
+ * asking. `top` and `bottom` are there for a command bar or a filter strip,
45
+ * and they are the same component because the contract is identical.
46
+ */
47
+ modelValue: boolean;
48
+ };
49
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
50
+ declare var __VLS_26: {}, __VLS_28: {};
51
+ type __VLS_Slots = {} & {
52
+ default?: (props: typeof __VLS_26) => any;
53
+ } & {
54
+ actions?: (props: typeof __VLS_28) => any;
55
+ };
56
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
57
+ "update:modelValue": (value: boolean) => any;
58
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
59
+ "onUpdate:modelValue"?: (value: boolean) => any;
60
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
61
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
62
+ declare const _default: typeof __VLS_export;
63
+ export default _default;
64
+ type __VLS_WithSlots<T, S> = T & {
65
+ new (): {
66
+ $slots: S;
67
+ };
68
+ };
@@ -0,0 +1,67 @@
1
+ /**
2
+ * A card that appears beside something when you rest on it.
3
+ *
4
+ * ## `BaseHoverCard` or `BaseTooltip`
5
+ *
6
+ * A tooltip is a sentence naming what a control does, and it is wired with
7
+ * `aria-describedby` — which flattens whatever is inside it to text. That
8
+ * is right for a sentence and wrong for anything else: a card holding a
9
+ * name, an avatar and a link would be read as one run-on string, and the
10
+ * link inside it could not be reached at all.
11
+ *
12
+ * So this is not a described-by bubble. The trigger says a popup is there
13
+ * with `aria-expanded` and `aria-controls`; the card is an ordinary region
14
+ * of the page that happens to be revealed, and everything inside it stays
15
+ * reachable.
16
+ *
17
+ * Reach for the tooltip when the answer is a sentence. Reach for this when
18
+ * the answer is a *thing* — a profile, a preview of what a link leads to, a
19
+ * definition with a source.
20
+ *
21
+ * ## The pointer has to be able to get there
22
+ *
23
+ * A card that vanishes the moment the pointer leaves the trigger is a card
24
+ * whose contents can never be used: the gap between the two is enough to
25
+ * close it. So leaving starts a delay rather than closing, and entering the
26
+ * card cancels it. That delay is the whole reason this is a component
27
+ * instead of two CSS rules.
28
+ *
29
+ * ## It opens without a pointer too
30
+ *
31
+ * Focus opens it, with no delay — waiting makes sense for a pointer sweeping
32
+ * across a page, and no sense for somebody who deliberately tabbed onto it.
33
+ * Escape closes it while leaving focus where it is, so a keyboard is never
34
+ * stuck with a card in the way.
35
+ *
36
+ * A hover card is supplementary by definition: everything in it has to be
37
+ * reachable some other way, because a touch screen has no hover at all.
38
+ */
39
+ type __VLS_Props = {
40
+ /** Names the card for a screen reader. Already translated. */
41
+ label: string;
42
+ /** How long a pointer has to rest before it opens, in ms. */
43
+ openDelay?: number | undefined;
44
+ /** How long it survives the pointer leaving, so the card can be reached. */
45
+ closeDelay?: number | undefined;
46
+ placement?: 'top' | 'bottom' | undefined;
47
+ };
48
+ type __VLS_Slots = {
49
+ /** The thing being rested on. `props` says a popup is here. */
50
+ default: (props: {
51
+ props: {
52
+ 'aria-expanded': boolean;
53
+ 'aria-controls': string | undefined;
54
+ };
55
+ }) => unknown;
56
+ /** What appears: a profile, a preview, a definition. */
57
+ card: () => unknown;
58
+ };
59
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
60
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
61
+ declare const _default: typeof __VLS_export;
62
+ export default _default;
63
+ type __VLS_WithSlots<T, S> = T & {
64
+ new (): {
65
+ $slots: S;
66
+ };
67
+ };
@@ -24,7 +24,22 @@ export type { Crumb } from './BaseBreadcrumb.vue';
24
24
  * scrolls in, interleaved with something else, or built from a source the
25
25
  * accordion cannot know about.
26
26
  */
27
+ /**
28
+ * `BaseContextMenu`, the right-click menu — which is also Shift+F10 and the
29
+ * Menu key, or it is a set of actions a keyboard cannot reach at all.
30
+ */
31
+ export { default as BaseContextMenu } from './BaseContextMenu.vue';
27
32
  export { default as BaseDisclosure } from './BaseDisclosure.vue';
33
+ /**
34
+ * `BaseHoverCard`, for when the answer is a thing rather than a sentence —
35
+ * which is where `aria-describedby`, and so `BaseTooltip`, stops working.
36
+ */
37
+ export { default as BaseHoverCard } from './BaseHoverCard.vue';
38
+ /**
39
+ * `BaseDrawer`, the wide screen's answer to `BaseSheet`: a panel from the
40
+ * edge, for what a site keeps beside the page rather than on top of it.
41
+ */
42
+ export { default as BaseDrawer } from './BaseDrawer.vue';
28
43
  /**
29
44
  * `BaseModal`, beside `BaseSheet` rather than named `Modal` on its own.
30
45
  *