@k8slens/drop-down-menu-contracts 1.0.0 → 2.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k8slens/drop-down-menu-contracts",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "lens": {
5
5
  "env": "renderer",
6
6
  "layer": "technical",
@@ -1,77 +0,0 @@
1
- import type { Discriminable, Orderable, MaybeComputedShowable, MaybeComputedEnableable, Identifiable } from "@k8slens/composable-responsibilities";
2
- import type { MaybeAsyncVoidFunction, MaybePromise } from "@k8slens/public-utilities";
3
- import type React from "react";
4
- /**
5
- * A label given as plain text.
6
- */
7
- export type TextLabelable = {
8
- readonly labelText: string;
9
- readonly Label?: undefined;
10
- readonly labelProps?: undefined;
11
- };
12
- /**
13
- * When the label component requires props, providing them is mandatory; when all of its props are
14
- * optional, so is providing them.
15
- */
16
- export type LabelPropsFor<P extends object> = {} extends P ? {
17
- readonly labelProps?: P;
18
- } : {
19
- readonly labelProps: P;
20
- };
21
- /**
22
- * A label given as a component type the menu renders where and when the label is shown. The
23
- * component must be defined at module scope; any data it needs arrives as props through
24
- * `labelProps`. Capturing data in a closure instead would create a new component reference on
25
- * every invocation and break React reconciliation.
26
- */
27
- export type ComponentLabelable<P extends object = any> = {
28
- readonly labelText?: undefined;
29
- readonly Label: React.ComponentType<P>;
30
- } & LabelPropsFor<P>;
31
- /**
32
- * Exactly one of `labelText` and `Label` must be provided.
33
- */
34
- export type ReactLabelable<P extends object = any> = TextLabelable | ComponentLabelable<P>;
35
- /**
36
- * A clickable menu item. Visibility (`isVisible`/`isHidden`) and enablement (`isEnabled`) may be
37
- * given as computeds, in which case the menu reacts to their changes while open.
38
- */
39
- export type ActionMenuItem<P extends object = any> = Discriminable<"action"> & Identifiable & Orderable & ReactLabelable<P> & MaybeComputedShowable & MaybeComputedEnableable & {
40
- /**
41
- * This function will be called when the user clicks on this menu item
42
- */
43
- readonly onClick: MaybePromise<MaybeAsyncVoidFunction>;
44
- readonly parentId: string | undefined;
45
- };
46
- /**
47
- * A menu item that reveals nested items on hover.
48
- */
49
- export type SubMenuItem<P extends object = any> = Discriminable<"sub-menu"> & Identifiable & Orderable & ReactLabelable<P> & MaybeComputedShowable & MaybeComputedEnableable & {
50
- readonly parentId: string | undefined;
51
- readonly onClick?: MaybePromise<MaybeAsyncVoidFunction>;
52
- };
53
- /**
54
- * An item that renders itself entirely — the element it lives in included. The menu puts the
55
- * component in its list and stays out of the way, so the item decides its own markup, whether it
56
- * anchors anything, and whether it takes part in keyboard navigation.
57
- *
58
- * The component must be defined at module scope; capturing data in a closure would create a new
59
- * component reference on every invocation and break React reconciliation.
60
- */
61
- export interface ComponentMenuItem extends Discriminable<"component">, Identifiable, Orderable, MaybeComputedShowable {
62
- readonly Component: React.ComponentType;
63
- readonly parentId: string | undefined;
64
- }
65
- /**
66
- * A group of items that should have separators before the first item (if applicable) and after the last item (if applicable)
67
- */
68
- export interface GroupOfMenuItems extends Discriminable<"group">, MaybeComputedShowable, Identifiable, Orderable {
69
- readonly parentId: string | undefined;
70
- }
71
- /**
72
- * The authoring model of a menu item: a clickable action, a sub-menu, or a group. Items reference
73
- * each other by `id`/`parentId`; siblings are ordered by `orderNumber`, and separators appear
74
- * between adjacent groups.
75
- */
76
- export type MenuItem = ActionMenuItem | SubMenuItem | ComponentMenuItem | GroupOfMenuItems;
77
- //# sourceMappingURL=context-menu-items.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context-menu-items.d.ts","sourceRoot":"","sources":["../../src/context-menu-items.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,qBAAqB,EACrB,uBAAuB,EACvB,YAAY,EACb,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,KAA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a,CAAC,UAAU,CAAC,GACzE,YAAY,GACZ,SAAS,GACT,cAAc,CAAC,CAAC,CAAC,GACjB,qBAAqB,GACrB,uBAAuB,GAAG;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC,sBAAsB,CAAC,CAAC;CACzD,CAAC;AAEJ;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa,CAAC,WAAW,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,qBAAqB;IACnH,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,aAAa,CAAC,OAAO,CAAC,EAAE,qBAAqB,EAAE,YAAY,EAAE,SAAS;IAC9G,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAED;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,cAAc,GAAG,WAAW,GAAG,iBAAiB,GAAG,gBAAgB,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Told by an item when it is activated, so the menu it belongs to — and the menus it was opened
3
- * from — can close. Items themselves know nothing of menus.
4
- */
5
- export declare const menuItemActivatedContext: import("react").Context<VoidFunction | undefined>;
6
- //# sourceMappingURL=menu-item-activated-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"menu-item-activated-context.d.ts","sourceRoot":"","sources":["../../src/menu-item-activated-context.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,wBAAwB,mDAAqD,CAAC"}