@loomweaver/plugin-sdk 0.7.7 → 0.7.8

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": "@loomweaver/plugin-sdk",
3
- "version": "0.7.7",
3
+ "version": "0.7.8",
4
4
  "description": "LoomWeaver plugin contract: the public SDK a weaver depends on — ProductIdentity, Command, PluginContext and the host UI vocabulary.",
5
5
  "keywords": [
6
6
  "loomweaver",
@@ -1,5 +1,6 @@
1
1
  import { Type } from '@angular/core';
2
2
  import { AccessRequirement } from './auth.js';
3
+ import { MenuHeader, MenuTrigger } from './menu.js';
3
4
  /** Bar slots. */
4
5
  export type BarSlot = 'start' | 'center' | 'end';
5
6
  interface BarItemBase {
@@ -34,6 +35,19 @@ export interface BarButtonItem extends BarItemBase {
34
35
  readonly icon?: string;
35
36
  /** Transloco key/literal for a visible text label (optional). */
36
37
  readonly label?: string;
38
+ /**
39
+ * One or two letters the host draws **instead of** {@link icon}, for a button standing for
40
+ * someone or something named rather than for an action. Keep it to two characters.
41
+ */
42
+ readonly initials?: string;
43
+ /**
44
+ * A picture of what this button stands for, as anything an image element accepts. Drawn in place
45
+ * of {@link icon} and {@link initials}, cropped round. The order is picture, then initials, then
46
+ * icon, and the host falls back on its own where the picture is absent or fails to load. Reaching
47
+ * it is yours: the workbench does not fetch it, and another origin has to be allowed by your own
48
+ * content policy.
49
+ */
50
+ readonly image?: string;
37
51
  /** Transloco key/literal for the tooltip; falls back to {@link label}. */
38
52
  readonly tooltip?: string;
39
53
  /**
@@ -42,6 +56,16 @@ export interface BarButtonItem extends BarItemBase {
42
56
  * Contribute items to the slot with `ctx.registerMenuItem({ menu, … })`. Omit for no context menu.
43
57
  */
44
58
  readonly menu?: string;
59
+ /**
60
+ * Which gesture opens {@link menu}. Defaults to `'context'`, so a button that says nothing keeps
61
+ * the right-click it always had. Ignored without {@link menu}.
62
+ */
63
+ readonly menuTrigger?: MenuTrigger;
64
+ /**
65
+ * A heading naming what the menu is about, drawn above its first entry. Only where activation
66
+ * opens the menu, since a right-click already points at this button; ignored otherwise.
67
+ */
68
+ readonly menuHeader?: MenuHeader;
45
69
  /**
46
70
  * Id of a registered {@link Command} this button triggers. Provide this **or** {@link run}; when
47
71
  * set, the host runs that command (so a keybinding/palette can share the same behaviour).
package/src/lib/menu.d.ts CHANGED
@@ -46,3 +46,42 @@ export interface MenuItem {
46
46
  */
47
47
  readonly checkedWhen?: MenuContext;
48
48
  }
49
+ /**
50
+ * Which gesture opens the menu slot a chrome item names: its context menu on right-click (the
51
+ * default), its primary activation — a click, Enter or Space — with the menu anchored to the
52
+ * control the host drew, or both.
53
+ *
54
+ * Activation opens the item's **own** slot alone: the workbench's entries for that item, such as
55
+ * the ones that hide or move it, stay on the right-click, where a curation entry beside "Sign out"
56
+ * would be noise. An item whose activation opens its menu needs no `command` or `run` of its own,
57
+ * and the host draws it all the same.
58
+ */
59
+ export type MenuTrigger = 'context' | 'primary' | 'both';
60
+ /**
61
+ * A heading for a menu, naming the thing it was opened against — an account, a document, a tenant.
62
+ * The host draws it above the first entry of a menu opened by ACTIVATION (see {@link MenuTrigger});
63
+ * a menu opened at the pointer carries none, because what it acts on is under the pointer.
64
+ *
65
+ * It is not an entry: it cannot be focused or activated, and the keyboard passes over it the way it
66
+ * passes over a separator. The menu is announced by what it names, so the name reaches the user
67
+ * exactly once.
68
+ */
69
+ export interface MenuHeader {
70
+ /** The name — Transloco key or literal. */
71
+ readonly title: string;
72
+ /** A second line under the name, for an address, a role or a tenant — key or literal. */
73
+ readonly detail?: string;
74
+ /** Icon name drawn beside the name, resolved by the host icon registry. */
75
+ readonly icon?: string;
76
+ /**
77
+ * A picture of what the menu was opened against, drawn in place of {@link icon} and
78
+ * {@link initials} and cropped round. Same ladder as a launcher entry's: picture, initials, icon,
79
+ * with the host falling back on its own where the picture is absent or fails to load.
80
+ */
81
+ readonly image?: string;
82
+ /**
83
+ * One or two letters the host draws **instead of** {@link icon}, for a name that is the user's
84
+ * rather than yours. Same rule as a launcher entry's: keep it to two characters.
85
+ */
86
+ readonly initials?: string;
87
+ }
@@ -1,4 +1,5 @@
1
1
  import { AccessRequirement } from './auth.js';
2
+ import { MenuHeader, MenuTrigger } from './menu.js';
2
3
  /**
3
4
  * A Rail/Ribbon item: an **independent command** triggered from the far
4
5
  * rail — not a view switcher (switching views is the panel's tab bar). Mirrors
@@ -21,6 +22,18 @@ export interface RailItem {
21
22
  * so hover and the active marker behave exactly as elsewhere.
22
23
  */
23
24
  readonly initials?: string;
25
+ /**
26
+ * A picture of what this entry stands for — a person, a project, a tenant — as anything an image
27
+ * element accepts, an address you serve or a data URL. Drawn in place of {@link icon} and
28
+ * {@link initials}, cropped round.
29
+ *
30
+ * The order is picture, then {@link initials}, then {@link icon}, and the **host** falls back: a
31
+ * picture that is absent or fails to load leaves the entry exactly as it would look without one,
32
+ * so you never have to handle the ordinary case of there being no photograph. Reaching the picture
33
+ * at all is yours: the workbench does not fetch it, and another origin has to be allowed by your
34
+ * own content policy.
35
+ */
36
+ readonly image?: string;
24
37
  /** Transloco key (or literal) for the tooltip/label. */
25
38
  readonly title: string;
26
39
  /** Lower renders first within its anchor group (default 0). */
@@ -33,6 +46,17 @@ export interface RailItem {
33
46
  * Contribute items to the slot with `ctx.registerMenuItem({ menu, … })`. Omit for no context menu.
34
47
  */
35
48
  readonly menu?: string;
49
+ /**
50
+ * Which gesture opens {@link menu}. Defaults to `'context'`, so an item that says nothing keeps
51
+ * the right-click it always had. Ignored without {@link menu}, and on an item that names a
52
+ * {@link workspace}, where activating it is the switch.
53
+ */
54
+ readonly menuTrigger?: MenuTrigger;
55
+ /**
56
+ * A heading naming what the menu is about, drawn above its first entry. Only where activation
57
+ * opens the menu, since a right-click already points at this item; ignored otherwise.
58
+ */
59
+ readonly menuHeader?: MenuHeader;
36
60
  /**
37
61
  * Id of a registered {@link Command} this item triggers. Provide this **or** {@link run}; when
38
62
  * set, the host runs that command (so a keybinding/palette can share the same behaviour).