@loomweaver/plugin-sdk 0.7.7 → 0.7.9

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.9",
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).
@@ -199,9 +199,8 @@ export interface ContentRouteBase {
199
199
  /** Whether the user may close a tab of this route — carried through from {@link Surface.closable}. */
200
200
  readonly closable?: boolean;
201
201
  /**
202
- * Whether the host insets this surface from its pane edges (default `true`). Declare `false` for a
203
- * surface that owns its own edges a viewer, a canvas, a map, an edge-to-edge table. See
204
- * `SurfaceBase.padded`.
202
+ * Whether the host insets this surface from its pane edges. Absent, the product's own default
203
+ * applies, which is no inset unless the distribution asked for one. See `SurfaceBase.padded`.
205
204
  */
206
205
  readonly padded?: boolean;
207
206
  }
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,9 +46,25 @@ 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).
63
+ *
64
+ * The host never marks such an item as current, not even while the address its command opened is
65
+ * the one on screen: only a {@link workspace} entry is marked, because a command may do anything
66
+ * and the host cannot tell what "being there" would mean for it. An entry meant to read as a
67
+ * place the user is *in* belongs to a workspace, not to a command that navigates.
39
68
  */
40
69
  readonly command?: string;
41
70
  /**
@@ -190,13 +190,18 @@ export interface SurfaceBase {
190
190
  */
191
191
  readonly closable?: boolean;
192
192
  /**
193
- * Whether the host insets this surface from its pane edges. Defaults to `true` comfortable for the
194
- * prose, forms and lists most surfaces are. Declare `false` for a surface that **is** the content and
195
- * owns its own edges: a viewer, a canvas, a map, an edge-to-edge table. It travels with the surface,
196
- * so it holds wherever the user puts it — the URL pane, a split, a sidebar, a pop-out window.
193
+ * Whether the host insets this surface from its pane edges. Leave it out and the product decides:
194
+ * the host insets nothing unless the distribution asked it to, with `padding` on `provideShell`.
197
195
  *
198
- * Only the inset is yours to switch off; how wide it is stays a styling question, so a product that
199
- * wants a different amount everywhere writes plain unlayered CSS rather than asking for a token.
196
+ * Declare it where this surface differs from the product's answer, in either direction. `true` for
197
+ * the prose, forms and lists that read better with air around them; `false` for a surface that
198
+ * **is** the content and owns its own edges — a viewer, a canvas, a map, an edge-to-edge table —
199
+ * in a product that insets everything else. It travels with the surface, so it holds wherever the
200
+ * user puts it: the URL pane, a split, a sidebar, a pop-out window.
201
+ *
202
+ * Only whether there is an inset is yours; how wide it is stays a styling question, so a product
203
+ * that wants a different amount everywhere writes plain unlayered CSS rather than asking for a
204
+ * token.
200
205
  */
201
206
  readonly padded?: boolean;
202
207
  /**
package/src/lib/view.d.ts CHANGED
@@ -84,9 +84,8 @@ export interface View {
84
84
  /** Whether the user may close a tab of this view — carried through from {@link Surface.closable}. */
85
85
  readonly closable?: boolean;
86
86
  /**
87
- * Whether the host insets this surface from its pane edges (default `true`). Declare `false` for a
88
- * surface that owns its own edges a viewer, a canvas, a map, an edge-to-edge table. See
89
- * `SurfaceBase.padded`.
87
+ * Whether the host insets this surface from its pane edges. Absent, the product's own default
88
+ * applies, which is no inset unless the distribution asked for one. See `SurfaceBase.padded`.
90
89
  */
91
90
  readonly padded?: boolean;
92
91
  /** Component the host renders as the view body. */