@punica/editor 1.6.5 → 1.6.7

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.5",
3
+ "version": "1.6.7",
4
4
  "description": "Punica Editor",
5
5
  "private": false,
6
6
  "type": "module",
@@ -430,6 +430,133 @@ 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;
505
+
506
+ /**
507
+ * A capability definition, loosely typed so any surface (extension
508
+ * viewer, llms viewer, ivy-node explorer, capability catalog) can pass
509
+ * its own record shape. Only the fields the detail renderer reads are
510
+ * named; the index signature carries everything else through to the
511
+ * raw-definition block.
512
+ */
513
+ interface CapabilityDefinitionLike {
514
+ id?: string;
515
+ title?: string;
516
+ description?: string;
517
+ version?: string;
518
+ inputs?: { schema?: unknown };
519
+ outputs?: {
520
+ kind?: string;
521
+ resultEvent?: string;
522
+ errorEvent?: string;
523
+ schema?: unknown;
524
+ };
525
+ policy?: { risk?: string; approval?: string };
526
+ tags?: string[];
527
+ sideEffects?: string[];
528
+ [key: string]: unknown;
529
+ }
530
+
531
+ interface CapabilityDetailOptions {
532
+ /** Meta-line "source:" label (extension name / "ivy-node" / "core"). */
533
+ source?: string;
534
+ /**
535
+ * true → a click-to-expand row with a chevron (for lists). Omit or
536
+ * false → the detail body is rendered directly, always visible (for a
537
+ * single-capability tab).
538
+ */
539
+ collapsible?: boolean;
540
+ /** Initial expanded state when `collapsible`. */
541
+ open?: boolean;
542
+ /**
543
+ * Consumer-specific sections appended after Tags and before the raw
544
+ * block (e.g. an instruction class's Execution Defaults / System
545
+ * Prompt).
546
+ */
547
+ extraSections?: HTMLElement[];
548
+ }
549
+
550
+ /**
551
+ * Render one capability's detail in the shared catalog look: bold title
552
+ * + mono id, risk/approval pills, a source·id·version·approval meta
553
+ * line, Inputs/Outputs schema blocks, Tags, and a collapsed
554
+ * "Show raw definition" toggle. CSS is injected once (theme-aware).
555
+ */
556
+ function createCapabilityDetail(
557
+ def: CapabilityDefinitionLike,
558
+ options?: CapabilityDetailOptions
559
+ ): HTMLElement;
433
560
  }
434
561
 
435
562
  namespace Theme {