@punica/editor 1.6.11 → 1.6.13

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": "@punica/editor",
3
- "version": "1.6.11",
3
+ "version": "1.6.13",
4
4
  "description": "Punica Editor",
5
5
  "private": false,
6
6
  "type": "module",
package/types/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  /// <reference path="punica.module.shell.activityBar.d.ts" />
2
+ /// <reference path="punica.module.shell.appBar.d.ts" />
2
3
  /// <reference path="punica.module.shell.keyboardShortcuts.d.ts" />
3
4
  /// <reference path="punica.module.shell.dragDrop.d.ts" />
4
5
  /// <reference path="punica.module.shell.layout.d.ts" />
@@ -0,0 +1,86 @@
1
+ /**
2
+ * App bar type declarations.
3
+ *
4
+ * The app bar is the top strip of the window: branding on the left, the current
5
+ * workspace in the middle, actions on the right. On hosts that hide the native
6
+ * title bar it is also the window's drag handle, so it exists on every profile
7
+ * that lists `shell.appBar` — including the welcome layout, where it is the only
8
+ * way to move the window.
9
+ *
10
+ * Composition is declarative: a profile's `shell.appBar` spec describes the bar,
11
+ * and a shell renders it. Extensions may add their own actions at runtime
12
+ * through `punica.shell.AppBar.manager`, which is the same registry the profile
13
+ * items go through.
14
+ */
15
+
16
+ declare module 'punica' {
17
+ export namespace shell {
18
+ namespace AppBar {
19
+ /** Which end of the bar an item belongs to. */
20
+ type AppBarAlignment = 'left' | 'right';
21
+
22
+ /** What the middle of the bar shows. */
23
+ type AppBarTitleMode = 'workspace' | 'product' | 'none';
24
+
25
+ /** One entry in an item's dropdown menu. */
26
+ interface AppBarMenuItem {
27
+ id: string;
28
+ label: string;
29
+ /** Command (or capability) id executed on select. */
30
+ command: string;
31
+ /** Draw a separator above this entry. */
32
+ separatorBefore?: boolean;
33
+ }
34
+
35
+ /**
36
+ * An action on the bar. `command` fires on click; `menu` opens a dropdown
37
+ * instead. An item may declare both, in which case the menu wins and the
38
+ * command is ignored.
39
+ */
40
+ interface AppBarItem {
41
+ id: string;
42
+ /** Icon markup (e.g. `<i class="fa-solid fa-gear"></i>`). */
43
+ icon?: string;
44
+ /** Optional text next to the icon. */
45
+ label?: string;
46
+ /** Tooltip / accessible name. */
47
+ title?: string;
48
+ alignment?: AppBarAlignment;
49
+ /**
50
+ * `'avatar'` draws a round account button whose glyph is the first
51
+ * letter of `label` (or the icon when there is none); `'action'` (the
52
+ * default) draws a flat icon button.
53
+ */
54
+ kind?: 'action' | 'avatar';
55
+ command?: string;
56
+ menu?: AppBarMenuItem[];
57
+ /**
58
+ * Command id returning a one-line summary rendered as the menu header
59
+ * (e.g. the licence state). Dropped when the command is not registered,
60
+ * which is how a host without the surface stays quiet.
61
+ */
62
+ summaryCommand?: string;
63
+ }
64
+
65
+ /** A profile's app bar composition (see `ProfileShellSpec.appBar`). */
66
+ interface AppBarSpec {
67
+ /** Bar height in px. Defaults to 38. */
68
+ height?: number;
69
+ /** What the centre region shows. Defaults to `'workspace'`. */
70
+ title?: AppBarTitleMode;
71
+ items?: AppBarItem[];
72
+ }
73
+
74
+ interface IAppBarManager {
75
+ /**
76
+ * Add (or replace) an item. Re-adding a known id keeps its original
77
+ * position, so an extension reload never reshuffles the bar.
78
+ */
79
+ addItem(item: AppBarItem): void;
80
+ removeItem(itemId: string): void;
81
+ }
82
+
83
+ const manager: IAppBarManager;
84
+ }
85
+ }
86
+ }
@@ -21,6 +21,7 @@ declare module 'punica' {
21
21
  */
22
22
  type ShellModuleId =
23
23
  | 'shell.activityBar'
24
+ | 'shell.appBar'
24
25
  | 'shell.statusbar'
25
26
  | 'shell.view'
26
27
  | 'shell.views'
@@ -136,6 +137,13 @@ declare module 'punica' {
136
137
  * default minimal layout (single content slot).
137
138
  */
138
139
  layout?: ProfileLayoutSpec;
140
+ /**
141
+ * Optional app bar composition — branding, title mode and the actions
142
+ * on the top strip. Omitted means the profile has no app bar, even when
143
+ * `shell.appBar` is listed in `activeModules`, in which case the shell
144
+ * falls back to the module's own defaults.
145
+ */
146
+ appBar?: shell.AppBar.AppBarSpec;
139
147
  /**
140
148
  * Optional product defaults for the bottom panel. User settings
141
149
  * (Project > Global) override these; when both are unset the substrate
@@ -514,6 +514,15 @@ declare module 'punica' {
514
514
  options?: StatusDotOptions
515
515
  ): HTMLElement;
516
516
 
517
+ /**
518
+ * Humanize a byte count: `6602` → `"6.4 KB"`. Null for absent, zero or
519
+ * negative input so a caller drops the chip instead of printing "0 B".
520
+ *
521
+ * Shared because sizes are read across panels: a dataset listed at
522
+ * "6602" in one list and "6.4 KB" in another reads as two sizes.
523
+ */
524
+ function formatBytes(bytes?: number | null): string | null;
525
+
517
526
  /** Build an uppercase section header with a trailing divider rule. */
518
527
  function createGroupHeader(
519
528
  options: GroupHeaderOptions | string