@punica/editor 1.6.5 → 1.6.6
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
|
@@ -430,6 +430,78 @@ declare module 'punica' {
|
|
|
430
430
|
function createLink(text: string, options: LinkOptions): HTMLElement;
|
|
431
431
|
|
|
432
432
|
function createToolbar(options?: ToolbarOptions): HTMLElement;
|
|
433
|
+
|
|
434
|
+
// ── Sidebar card standard ──────────────────────────────────────
|
|
435
|
+
// One card design for every list-based sidebar/panel view: a status
|
|
436
|
+
// dot or type icon, a bold title over a muted subtitle, optional
|
|
437
|
+
// right-aligned meta, and no inline buttons — per-row actions live in
|
|
438
|
+
// a right-click context menu (attachContextMenu).
|
|
439
|
+
|
|
440
|
+
interface SidebarCardOptions {
|
|
441
|
+
/** Stable row id → data-node-id; the context-menu row resolver key. */
|
|
442
|
+
id: string;
|
|
443
|
+
/** Bold title (rendered as a plain div so card CSS controls size). */
|
|
444
|
+
name: string;
|
|
445
|
+
/** Muted subtitle under the title. */
|
|
446
|
+
sub?: string;
|
|
447
|
+
/** Status dot variant; takes precedence over `icon`. */
|
|
448
|
+
dot?:
|
|
449
|
+
| 'running'
|
|
450
|
+
| 'paused'
|
|
451
|
+
| 'stopped'
|
|
452
|
+
| 'idle'
|
|
453
|
+
| 'error'
|
|
454
|
+
| 'success'
|
|
455
|
+
| 'warning';
|
|
456
|
+
/** FontAwesome icon class for the left glyph when there is no dot. */
|
|
457
|
+
icon?: string;
|
|
458
|
+
/** Optional right-aligned monospace meta (ports, size, …). */
|
|
459
|
+
meta?: string;
|
|
460
|
+
/** Dims the row (e.g. stopped/disabled). */
|
|
461
|
+
inactive?: boolean;
|
|
462
|
+
/** Marks the row selected. */
|
|
463
|
+
selected?: boolean;
|
|
464
|
+
/** Extra data-* attributes (e.g. kind, state) read by buildItems. */
|
|
465
|
+
data?: Record<string, string>;
|
|
466
|
+
/** Native hover tooltip. */
|
|
467
|
+
title?: string;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
interface GroupHeaderOptions {
|
|
471
|
+
label: string;
|
|
472
|
+
/** Appended after a middot, e.g. "0/1 running". */
|
|
473
|
+
count?: string;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
interface MenuItemSpec {
|
|
477
|
+
label: string;
|
|
478
|
+
value: string;
|
|
479
|
+
/** Raw HTML for the item icon (typically a FontAwesome <i>). */
|
|
480
|
+
icon?: string;
|
|
481
|
+
/** Insert a separator before this item. */
|
|
482
|
+
separatorBefore?: boolean;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/** Build one standard sidebar/panel list card. */
|
|
486
|
+
function createSidebarCard(options: SidebarCardOptions): HTMLElement;
|
|
487
|
+
|
|
488
|
+
/** Build an uppercase section header with a trailing divider rule. */
|
|
489
|
+
function createGroupHeader(
|
|
490
|
+
options: GroupHeaderOptions | string
|
|
491
|
+
): HTMLElement;
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Wire a right-click context menu on a list container. Items are
|
|
495
|
+
* rebuilt per right-click (state-aware) from the row under the cursor
|
|
496
|
+
* (resolved via the nearest `[data-node-id]`). Returns a disposer that
|
|
497
|
+
* removes the listeners and the menu element.
|
|
498
|
+
*/
|
|
499
|
+
function attachContextMenu(options: {
|
|
500
|
+
listEl: HTMLElement;
|
|
501
|
+
menuId: string;
|
|
502
|
+
buildItems: (row: HTMLElement) => MenuItemSpec[];
|
|
503
|
+
onSelect: (value: string, row: HTMLElement) => void;
|
|
504
|
+
}): () => void;
|
|
433
505
|
}
|
|
434
506
|
|
|
435
507
|
namespace Theme {
|