@gtkx/cli 0.13.1 → 0.13.3

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": "@gtkx/cli",
3
- "version": "0.13.1",
3
+ "version": "0.13.3",
4
4
  "description": "CLI for GTKX - create and develop GTK4 React applications",
5
5
  "keywords": [
6
6
  "gtkx",
@@ -58,19 +58,19 @@
58
58
  "ejs": "^3.1.10",
59
59
  "react-refresh": "^0.18.0",
60
60
  "vite": "^7.3.1",
61
- "@gtkx/ffi": "0.13.1",
62
- "@gtkx/mcp": "0.13.1",
63
- "@gtkx/react": "0.13.1"
61
+ "@gtkx/mcp": "0.13.3",
62
+ "@gtkx/ffi": "0.13.3",
63
+ "@gtkx/react": "0.13.3"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@types/ejs": "^3.1.5",
67
67
  "@types/react-refresh": "^0.14.7",
68
68
  "memfs": "^4.51.1",
69
- "@gtkx/testing": "0.13.1"
69
+ "@gtkx/testing": "0.13.3"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "react": "^19",
73
- "@gtkx/testing": "0.13.1"
73
+ "@gtkx/testing": "0.13.3"
74
74
  },
75
75
  "peerDependenciesMeta": {
76
76
  "@gtkx/testing": {
@@ -549,6 +549,85 @@ const NavigationDemo = () => {
549
549
 
550
550
  ---
551
551
 
552
+ ## Sidebar/Content Split with AdwNavigationSplitView
553
+
554
+ ```tsx
555
+ import * as Gtk from "@gtkx/ffi/gtk";
556
+ import {
557
+ AdwActionRow,
558
+ AdwApplicationWindow,
559
+ AdwHeaderBar,
560
+ AdwNavigationSplitView,
561
+ AdwToolbarView,
562
+ GtkBox,
563
+ GtkImage,
564
+ GtkLabel,
565
+ GtkListBox,
566
+ GtkScrolledWindow,
567
+ quit,
568
+ x,
569
+ } from "@gtkx/react";
570
+ import { useState } from "react";
571
+
572
+ interface Item {
573
+ id: string;
574
+ title: string;
575
+ icon: string;
576
+ }
577
+
578
+ const items: Item[] = [
579
+ { id: "inbox", title: "Inbox", icon: "mail-unread-symbolic" },
580
+ { id: "starred", title: "Starred", icon: "starred-symbolic" },
581
+ { id: "sent", title: "Sent", icon: "mail-send-symbolic" },
582
+ ];
583
+
584
+ const SplitViewDemo = () => {
585
+ const [selected, setSelected] = useState(items[0]);
586
+
587
+ return (
588
+ <AdwApplicationWindow title="Split View Demo" defaultWidth={800} defaultHeight={500} onClose={quit}>
589
+ <AdwNavigationSplitView sidebarWidthFraction={0.33} minSidebarWidth={200} maxSidebarWidth={300}>
590
+ <x.NavigationPage id="sidebar" title="Mail">
591
+ <AdwToolbarView>
592
+ <x.ToolbarTop><AdwHeaderBar /></x.ToolbarTop>
593
+ <GtkScrolledWindow vexpand>
594
+ <GtkListBox
595
+ cssClasses={["navigation-sidebar"]}
596
+ onRowSelected={(_, row) => {
597
+ if (!row) return;
598
+ const item = items[row.getIndex()];
599
+ if (item) setSelected(item);
600
+ }}
601
+ >
602
+ {items.map((item) => (
603
+ <AdwActionRow key={item.id} title={item.title}>
604
+ <x.ActionRowPrefix>
605
+ <GtkImage iconName={item.icon} />
606
+ </x.ActionRowPrefix>
607
+ </AdwActionRow>
608
+ ))}
609
+ </GtkListBox>
610
+ </GtkScrolledWindow>
611
+ </AdwToolbarView>
612
+ </x.NavigationPage>
613
+
614
+ <x.NavigationPage id="content" title={selected?.title ?? ""}>
615
+ <AdwToolbarView>
616
+ <x.ToolbarTop><AdwHeaderBar /></x.ToolbarTop>
617
+ <GtkBox orientation={Gtk.Orientation.VERTICAL} spacing={12} halign={Gtk.Align.CENTER} valign={Gtk.Align.CENTER} vexpand>
618
+ <GtkImage iconName={selected?.icon ?? ""} iconSize={Gtk.IconSize.LARGE} />
619
+ <GtkLabel label={selected?.title ?? ""} cssClasses={["title-2"]} />
620
+ </GtkBox>
621
+ </AdwToolbarView>
622
+ </x.NavigationPage>
623
+ </AdwNavigationSplitView>
624
+ </AdwApplicationWindow>
625
+ );
626
+ };
627
+ ```
628
+
629
+ ---
630
+
552
631
  ## File Browser with TreeListView
553
632
 
554
633
  ```tsx
@@ -512,6 +512,39 @@ const [history, setHistory] = useState(["home"]);
512
512
 
513
513
  **NavigationPage props:** `id` (required), `title`, `canPop`. Control navigation via `history` array.
514
514
 
515
+ ### AdwNavigationSplitView
516
+ Sidebar/content split layout for master-detail interfaces.
517
+
518
+ ```tsx
519
+ const [selected, setSelected] = useState(items[0]);
520
+
521
+ <AdwNavigationSplitView sidebarWidthFraction={0.33} minSidebarWidth={200} maxSidebarWidth={300}>
522
+ <x.NavigationPage id="sidebar" title="Sidebar">
523
+ <AdwToolbarView>
524
+ <x.ToolbarTop><AdwHeaderBar /></x.ToolbarTop>
525
+ <GtkListBox cssClasses={["navigation-sidebar"]} onRowSelected={(_, row) => {
526
+ if (!row) return;
527
+ const item = items[row.getIndex()];
528
+ if (item) setSelected(item);
529
+ }}>
530
+ {items.map((item) => <AdwActionRow key={item.id} title={item.title} />)}
531
+ </GtkListBox>
532
+ </AdwToolbarView>
533
+ </x.NavigationPage>
534
+
535
+ <x.NavigationPage id="content" title={selected?.title ?? ""}>
536
+ <AdwToolbarView>
537
+ <x.ToolbarTop><AdwHeaderBar /></x.ToolbarTop>
538
+ <GtkLabel label={selected?.title ?? ""} />
539
+ </AdwToolbarView>
540
+ </x.NavigationPage>
541
+ </AdwNavigationSplitView>
542
+ ```
543
+
544
+ **Props:** `sidebarWidthFraction`, `minSidebarWidth`, `maxSidebarWidth`, `collapsed`, `showContent`.
545
+ **NavigationPage slots:** Use `id="sidebar"` for left pane, `id="content"` for right pane.
546
+ **Selection:** Use `GtkListBox` with `onRowSelected` (single click) not `onRowActivated` (double click).
547
+
515
548
  ### Other Adwaita Widgets
516
549
 
517
550
  | Widget | Description |