@punica/editor 1.46.0 → 1.47.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": "@punica/editor",
3
- "version": "1.46.0",
3
+ "version": "1.47.0",
4
4
  "description": "Punica Editor",
5
5
  "private": false,
6
6
  "type": "module",
@@ -597,7 +597,7 @@ declare module 'punica' {
597
597
  // One card design for every list-based sidebar/panel view: a status
598
598
  // dot or type icon, a bold title over a muted subtitle, optional
599
599
  // right-aligned meta, and no inline buttons — per-row actions live in
600
- // a right-click context menu (attachContextMenu).
600
+ // a ⋯ menu on the row (`menu:`, or attachRowMenu for a whole list).
601
601
 
602
602
  /**
603
603
  * The one status-glyph vocabulary in the shell: a card dot, a
@@ -647,6 +647,54 @@ declare module 'punica' {
647
647
  data?: Record<string, string>;
648
648
  /** Native hover tooltip. */
649
649
  title?: string;
650
+ /**
651
+ * Per-row actions behind a ⋯ at the row's right edge, shown under
652
+ * the pointer and on keyboard focus. Since 2026-09-29 this is the
653
+ * only door to a row's actions: a right-click opens nothing.
654
+ */
655
+ menu?: RowMenuSpec;
656
+ /**
657
+ * The row's ONE visible button (Install, Download, Pause). A second
658
+ * action goes in `menu`; a destructive one always does.
659
+ */
660
+ action?: RowActionSpec;
661
+ /**
662
+ * The row cannot be clicked: default cursor, no hover step. A row
663
+ * that only has a menu is `static: true` with `menu` set.
664
+ */
665
+ static?: boolean;
666
+ }
667
+
668
+ interface RowMenuSpec {
669
+ /** Rebuilt every time the menu opens, from the row it opens on. */
670
+ buildItems: (row: HTMLElement) => MenuItemSpec[];
671
+ onSelect: (value: string, row: HTMLElement) => void;
672
+ }
673
+
674
+ interface RowActionSpec {
675
+ label: string;
676
+ onClick: (row: HTMLElement) => void;
677
+ disabled?: boolean;
678
+ /** Native title on the button. */
679
+ title?: string;
680
+ }
681
+
682
+ interface PanelHeaderAction {
683
+ /** FontAwesome classes, `fa-light` weight like the reference. */
684
+ icon: string;
685
+ /** Native title; the fleet has no tooltip system and passes it anyway. */
686
+ title: string;
687
+ onClick: () => void;
688
+ disabled?: boolean;
689
+ }
690
+
691
+ interface PanelHeaderOptions {
692
+ /** Drawn uppercase, extra-bold. */
693
+ title: string;
694
+ /** Small `fa-light` icon buttons pushed to the right edge. */
695
+ actions?: PanelHeaderAction[];
696
+ /** Extra attributes on the header element. */
697
+ attrs?: Record<string, string>;
650
698
  }
651
699
 
652
700
  interface GroupHeaderOptions {
@@ -740,10 +788,27 @@ declare module 'punica' {
740
788
  function createEmptyState(options: EmptyStateOptions): HTMLElement;
741
789
 
742
790
  /**
743
- * Wire a right-click context menu on a list container. Items are
744
- * rebuilt per right-click (state-aware) from the row under the cursor
745
- * (resolved via the nearest `[data-node-id]`). Returns a disposer that
746
- * removes the listeners and the menu element.
791
+ * Give every `[data-node-id]` row in a list a ⋯ menu, card or not.
792
+ * The button is injected the first time the pointer or the focus
793
+ * reaches a row; a row built with `createSidebarCard({ menu })` keeps
794
+ * its own. Items are rebuilt per open from that row. Listens to no
795
+ * `contextmenu`. Returns a disposer that removes the buttons.
796
+ */
797
+ function attachRowMenu(options: {
798
+ listEl: HTMLElement;
799
+ buildItems: (row: HTMLElement) => MenuItemSpec[];
800
+ onSelect: (value: string, row: HTMLElement) => void;
801
+ /**
802
+ * `button` (default): a ⋯ on every row. `contextmenu`: the same
803
+ * menu on a right-click at the pointer and no ⋯ — for a tree only
804
+ * (Explorer, tests, a dataset folder); a card list never passes it.
805
+ */
806
+ trigger?: 'button' | 'contextmenu';
807
+ }): () => void;
808
+
809
+ /**
810
+ * @deprecated Since 2026-09-29 this is `attachRowMenu` under its old
811
+ * name: the same items behind a ⋯ on every row, and no right-click.
747
812
  */
748
813
  function attachContextMenu(options: {
749
814
  listEl: HTMLElement;
@@ -752,6 +817,30 @@ declare module 'punica' {
752
817
  onSelect: (value: string, row: HTMLElement) => void;
753
818
  }): () => void;
754
819
 
820
+ /**
821
+ * The standard panel header (docs/panel-anatomy.md): a sticky column
822
+ * with a 12px gutter, a dense gutterless toolbar, an extra-bold
823
+ * uppercase title that grows, small icon actions at the right edge and
824
+ * a flush divider. One element; append it ahead of the body.
825
+ */
826
+ function createPanelHeader(options: PanelHeaderOptions): HTMLElement;
827
+
828
+ /**
829
+ * The scrolling body under the header: `padding: 8px 12px 12px`,
830
+ * `overflow-y: auto`, `flex: 1 1 auto; min-height: 0`. Its 12px sides
831
+ * are the header's, so the title and the first row line up.
832
+ */
833
+ function createPanelBody(options?: {
834
+ attrs?: Record<string, string>;
835
+ children?: HTMLElement[];
836
+ }): HTMLElement;
837
+
838
+ /** A column of rows with the 4px gap between them. */
839
+ function createList(options?: {
840
+ attrs?: Record<string, string>;
841
+ children?: HTMLElement[];
842
+ }): HTMLElement;
843
+
755
844
  /**
756
845
  * A capability definition, loosely typed so any surface (extension
757
846
  * viewer, llms viewer, ivy-node explorer, capability catalog) can pass