@principal-ade/panel-layouts 0.2.0 → 0.2.2

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/dist/index.esm.js CHANGED
@@ -1,12 +1,13 @@
1
- import './index.css';var x = Object.defineProperty;
2
- var F = (l, e, t) => e in l ? x(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
3
- var z = (l, e, t) => F(l, typeof e != "symbol" ? e + "" : e, t);
4
- import { EditableConfigurablePanelLayout as G, ResponsiveConfigurablePanelLayout as Q, mapThemeToPanelVars as H, mapThemeToTabVars as U } from "@principal-ade/panels";
5
- import { useState as C, useRef as I, useEffect as T, useCallback as f } from "react";
6
- import { jsx as O } from "react/jsx-runtime";
7
- class $ {
1
+ import './index.css';var q = Object.defineProperty;
2
+ var X = (o, e, t) => e in o ? q(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var D = (o, e, t) => X(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { EditableConfigurablePanelLayout as xe, ResponsiveConfigurablePanelLayout as Ce, mapThemeToPanelVars as ve, mapThemeToTabVars as Se } from "@principal-ade/panels";
5
+ import Q, { useState as z, useRef as I, useEffect as P, useCallback as m, forwardRef as Y, useMemo as K } from "react";
6
+ import { jsx as T, jsxs as W, Fragment as G } from "react/jsx-runtime";
7
+ import { useTheme as N } from "@principal-ade/industry-theme";
8
+ class Z {
8
9
  constructor() {
9
- z(this, "storageKey", "panel-layouts");
10
+ D(this, "storageKey", "panel-layouts");
10
11
  }
11
12
  async load(e) {
12
13
  try {
@@ -27,122 +28,122 @@ class $ {
27
28
  }
28
29
  }
29
30
  }
30
- function _(l) {
31
+ function ie(o) {
31
32
  const {
32
33
  viewKey: e,
33
34
  defaultSizes: t,
34
35
  panelType: a,
35
- adapter: s = new $()
36
- } = l, [i, o] = C(t), [c, R] = C(l.collapsed), h = I(l.collapsed), P = I({}), w = I(null), m = I(null);
37
- T(() => {
36
+ adapter: s = new Z()
37
+ } = o, [n, r] = z(t), [l, y] = z(o.collapsed), h = I(o.collapsed), b = I({}), u = I(null), f = I(null);
38
+ P(() => {
38
39
  (async () => {
39
- const g = await s.load(e);
40
- g != null && g.sizes && (o(g.sizes), k(g.sizes));
40
+ const C = await s.load(e);
41
+ C != null && C.sizes && (r(C.sizes), p(C.sizes));
41
42
  })();
42
43
  }, [e]);
43
- const k = f(
44
- (n) => {
45
- "left" in n && n.left > 0 && (P.current.left = n.left), "middle" in n && n.middle > 0 && (P.current.middle = n.middle), "right" in n && n.right > 0 && (P.current.right = n.right);
44
+ const p = m(
45
+ (g) => {
46
+ "left" in g && g.left > 0 && (b.current.left = g.left), "middle" in g && g.middle > 0 && (b.current.middle = g.middle), "right" in g && g.right > 0 && (b.current.right = g.right);
46
47
  },
47
48
  []
48
- ), d = f(
49
- (n) => {
50
- const g = P.current[n];
51
- if (g && g > 0)
52
- return g;
53
- if (n === "left" && "left" in t && t.left > 0)
49
+ ), c = m(
50
+ (g) => {
51
+ const C = b.current[g];
52
+ if (C && C > 0)
53
+ return C;
54
+ if (g === "left" && "left" in t && t.left > 0)
54
55
  return t.left;
55
- if (n === "right" && "right" in t && t.right > 0)
56
+ if (g === "right" && "right" in t && t.right > 0)
56
57
  return t.right;
57
58
  },
58
59
  [t]
59
- ), r = I(t);
60
- T(() => {
61
- ("left" in t && t.left !== r.current.left || "middle" in t && "middle" in r.current && t.middle !== r.current.middle || "right" in t && t.right !== r.current.right) && (o(t), k(t), r.current = t);
62
- }, [t, k]), T(() => {
63
- const n = l.collapsed.left !== h.current.left, g = "right" in l.collapsed && "right" in h.current && l.collapsed.right !== h.current.right;
64
- (n || g) && (R(l.collapsed), h.current = { ...l.collapsed });
65
- }, [l.collapsed.left, l.collapsed.right]);
66
- const y = f(
67
- async (n) => {
60
+ ), i = I(t);
61
+ P(() => {
62
+ ("left" in t && t.left !== i.current.left || "middle" in t && "middle" in i.current && t.middle !== i.current.middle || "right" in t && t.right !== i.current.right) && (r(t), p(t), i.current = t);
63
+ }, [t, p]), P(() => {
64
+ const g = o.collapsed.left !== h.current.left, C = "right" in o.collapsed && "right" in h.current && o.collapsed.right !== h.current.right;
65
+ (g || C) && (y(o.collapsed), h.current = { ...o.collapsed });
66
+ }, [o.collapsed.left, o.collapsed.right]);
67
+ const w = m(
68
+ async (g) => {
68
69
  try {
69
- await s.save(e, { sizes: n });
70
- } catch (g) {
70
+ await s.save(e, { sizes: g });
71
+ } catch (C) {
71
72
  console.error(
72
73
  `Failed to save panel preferences for ${e}:`,
73
- g
74
+ C
74
75
  );
75
76
  }
76
77
  },
77
78
  [e, s]
78
- ), W = f(
79
- (n) => {
80
- const g = { ...n };
81
- let u = !0;
82
- if ("left" in n) {
83
- const p = !!(c != null && c.left), b = n.left;
84
- if (p) {
85
- const v = d("left");
86
- v !== void 0 && v > 0 ? g.left = v : u = !1;
87
- } else b === 0 && (u = !1);
79
+ ), S = m(
80
+ (g) => {
81
+ const C = { ...g };
82
+ let x = !0;
83
+ if ("left" in g) {
84
+ const k = !!(l != null && l.left), d = g.left;
85
+ if (k) {
86
+ const v = c("left");
87
+ v !== void 0 && v > 0 ? C.left = v : x = !1;
88
+ } else d === 0 && (x = !1);
88
89
  }
89
- if (a === "three-panel" && "right" in n) {
90
- const p = !!(c != null && c.right), b = n.right;
91
- if (p) {
92
- const v = d("right");
93
- v !== void 0 && v > 0 ? g.right = v : u = !1;
94
- } else b === 0 && (u = !1);
90
+ if (a === "three-panel" && "right" in g) {
91
+ const k = !!(l != null && l.right), d = g.right;
92
+ if (k) {
93
+ const v = c("right");
94
+ v !== void 0 && v > 0 ? C.right = v : x = !1;
95
+ } else d === 0 && (x = !1);
95
96
  }
96
- if (o(g), k(g), w.current && (clearTimeout(w.current), w.current = null), !u) {
97
- m.current = null;
97
+ if (r(C), p(C), u.current && (clearTimeout(u.current), u.current = null), !x) {
98
+ f.current = null;
98
99
  return;
99
100
  }
100
- m.current = g, w.current = setTimeout(() => {
101
- const p = m.current;
102
- p && (y(p), m.current = null), w.current = null;
101
+ f.current = C, u.current = setTimeout(() => {
102
+ const k = f.current;
103
+ k && (w(k), f.current = null), u.current = null;
103
104
  }, 500);
104
105
  },
105
106
  [
107
+ l,
106
108
  c,
107
- d,
108
109
  a,
109
- y,
110
- k
110
+ w,
111
+ p
111
112
  ]
112
113
  );
113
- T(() => () => {
114
- if (w.current) {
115
- const n = m.current;
116
- n && (y(n), m.current = null), clearTimeout(w.current), w.current = null;
114
+ P(() => () => {
115
+ if (u.current) {
116
+ const g = f.current;
117
+ g && (w(g), f.current = null), clearTimeout(u.current), u.current = null;
117
118
  }
118
- }, [y]);
119
- const A = f(async () => {
120
- }, []), E = f(async () => {
121
- }, []), L = f(async () => {
122
- }, []), D = f(async () => {
119
+ }, [w]);
120
+ const A = m(async () => {
121
+ }, []), E = m(async () => {
122
+ }, []), F = m(async () => {
123
+ }, []), $ = m(async () => {
123
124
  }, []);
124
125
  return a === "three-panel" ? {
125
126
  type: "three-panel",
126
- sizes: i,
127
- collapsed: c,
128
- handlePanelResize: W,
127
+ sizes: n,
128
+ collapsed: l,
129
+ handlePanelResize: S,
129
130
  handleLeftCollapseComplete: A,
130
131
  handleLeftExpandComplete: E,
131
- handleRightCollapseComplete: L,
132
- handleRightExpandComplete: D
132
+ handleRightCollapseComplete: F,
133
+ handleRightExpandComplete: $
133
134
  } : {
134
135
  type: "two-panel",
135
- sizes: i,
136
- collapsed: c,
137
- handlePanelResize: W,
136
+ sizes: n,
137
+ collapsed: l,
138
+ handlePanelResize: S,
138
139
  handleLeftCollapseComplete: A,
139
140
  handleLeftExpandComplete: E
140
141
  };
141
142
  }
142
- class N {
143
+ class U {
143
144
  constructor() {
144
- z(this, "PRESETS_KEY", "panel-layouts:workspace-presets");
145
- z(this, "REPO_STATE_PREFIX", "panel-layouts:repo-state:");
145
+ D(this, "PRESETS_KEY", "panel-layouts:workspace-presets");
146
+ D(this, "REPO_STATE_PREFIX", "panel-layouts:repo-state:");
146
147
  }
147
148
  /**
148
149
  * Load all user-created workspace presets
@@ -202,14 +203,14 @@ class N {
202
203
  for (let t = 0; t < localStorage.length; t++) {
203
204
  const a = localStorage.key(t);
204
205
  if (a && a.startsWith(this.REPO_STATE_PREFIX)) {
205
- const s = a.substring(this.REPO_STATE_PREFIX.length), i = localStorage.getItem(a);
206
- if (i)
206
+ const s = a.substring(this.REPO_STATE_PREFIX.length), n = localStorage.getItem(a);
207
+ if (n)
207
208
  try {
208
- e[s] = JSON.parse(i);
209
- } catch (o) {
209
+ e[s] = JSON.parse(n);
210
+ } catch (r) {
210
211
  console.error(
211
212
  `Failed to parse repository state for ${s}:`,
212
- o
213
+ r
213
214
  );
214
215
  }
215
216
  }
@@ -220,7 +221,7 @@ class N {
220
221
  }
221
222
  }
222
223
  }
223
- class S {
224
+ class R {
224
225
  /**
225
226
  * Configure a custom storage adapter (for Electron IPC or remote storage)
226
227
  */
@@ -257,11 +258,11 @@ class S {
257
258
  createdAt: Date.now(),
258
259
  updatedAt: Date.now(),
259
260
  isBuiltIn: !1
260
- }, i = {
261
+ }, n = {
261
262
  ...t,
262
263
  [a]: s
263
264
  };
264
- return await this.adapter.saveWorkspacePresets(i), s;
265
+ return await this.adapter.saveWorkspacePresets(n), s;
265
266
  }
266
267
  /**
267
268
  * Update an existing workspace layout
@@ -272,7 +273,7 @@ class S {
272
273
  return console.error(`Workspace layout ${e} not found`), null;
273
274
  if (s.isBuiltIn)
274
275
  return console.error(`Cannot update built-in workspace layout ${e}`), null;
275
- const i = {
276
+ const n = {
276
277
  ...s,
277
278
  ...t,
278
279
  id: e,
@@ -280,11 +281,11 @@ class S {
280
281
  createdAt: s.createdAt,
281
282
  // Preserve creation time
282
283
  updatedAt: Date.now()
283
- }, o = {
284
+ }, r = {
284
285
  ...a,
285
- [e]: i
286
+ [e]: n
286
287
  };
287
- return await this.adapter.saveWorkspacePresets(o), i;
288
+ return await this.adapter.saveWorkspacePresets(r), n;
288
289
  }
289
290
  /**
290
291
  * Delete a workspace layout
@@ -609,20 +610,20 @@ class S {
609
610
  Object.keys(e).length;
610
611
  }
611
612
  }
612
- z(S, "adapter", new N());
613
- function K(l = {}) {
614
- const { repositoryKey: e, autoInitialize: t = !1, defaultWorkspaceId: a } = l, [s, i] = C(
613
+ D(R, "adapter", new U());
614
+ function ce(o = {}) {
615
+ const { repositoryKey: e, autoInitialize: t = !1, defaultWorkspaceId: a } = o, [s, n] = z(
615
616
  {}
616
- ), [o, c] = C(null), [R, h] = C(null), [P, w] = C(!0), [m, k] = C(null), d = f(async () => {
617
+ ), [r, l] = z(null), [y, h] = z(null), [b, u] = z(!0), [f, p] = z(null), c = m(async () => {
617
618
  try {
618
- w(!0), k(null);
619
- const u = await S.getWorkspaceLayouts();
620
- if (i(u), e) {
621
- let p = await S.getRepositoryState(e);
622
- if (!p && t) {
623
- const b = a || "project-management", v = await S.getWorkspaceLayout(b);
624
- v && (p = {
625
- workspaceId: b,
619
+ u(!0), p(null);
620
+ const x = await R.getWorkspaceLayouts();
621
+ if (n(x), e) {
622
+ let k = await R.getRepositoryState(e);
623
+ if (!k && t) {
624
+ const d = a || "project-management", v = await R.getWorkspaceLayout(d);
625
+ v && (k = {
626
+ workspaceId: d,
626
627
  sizes: v.defaultSizes || {
627
628
  left: 20,
628
629
  middle: 45,
@@ -632,278 +633,278 @@ function K(l = {}) {
632
633
  left: !1,
633
634
  right: !1
634
635
  }
635
- }, await S.setRepositoryState(
636
+ }, await R.setRepositoryState(
636
637
  e,
637
- p
638
+ k
638
639
  ));
639
640
  }
640
- if (c(p), p != null && p.workspaceId) {
641
- const b = await S.getWorkspaceLayout(
642
- p.workspaceId
641
+ if (l(k), k != null && k.workspaceId) {
642
+ const d = await R.getWorkspaceLayout(
643
+ k.workspaceId
643
644
  );
644
- h(b);
645
+ h(d);
645
646
  } else
646
647
  h(null);
647
648
  }
648
- } catch (u) {
649
- k(u), console.error("Failed to load workspace data:", u);
649
+ } catch (x) {
650
+ p(x), console.error("Failed to load workspace data:", x);
650
651
  } finally {
651
- w(!1);
652
+ u(!1);
652
653
  }
653
654
  }, [e, t, a]);
654
- T(() => {
655
- d();
656
- }, [d]);
657
- const r = f(
658
- async (u) => await S.getWorkspaceLayout(u),
655
+ P(() => {
656
+ c();
657
+ }, [c]);
658
+ const i = m(
659
+ async (x) => await R.getWorkspaceLayout(x),
659
660
  []
660
- ), y = f(
661
- async (u) => {
662
- const p = await S.createWorkspaceLayout(u);
663
- return await d(), p;
661
+ ), w = m(
662
+ async (x) => {
663
+ const k = await R.createWorkspaceLayout(x);
664
+ return await c(), k;
664
665
  },
665
- [d]
666
- ), W = f(
667
- async (u, p) => {
668
- const b = await S.updateWorkspaceLayout(u, p);
669
- return await d(), b;
666
+ [c]
667
+ ), S = m(
668
+ async (x, k) => {
669
+ const d = await R.updateWorkspaceLayout(x, k);
670
+ return await c(), d;
670
671
  },
671
- [d]
672
- ), A = f(
673
- async (u) => {
674
- const p = await S.deleteWorkspaceLayout(u);
675
- return p && await d(), p;
672
+ [c]
673
+ ), A = m(
674
+ async (x) => {
675
+ const k = await R.deleteWorkspaceLayout(x);
676
+ return k && await c(), k;
676
677
  },
677
- [d]
678
- ), E = f(
679
- async (u) => {
678
+ [c]
679
+ ), E = m(
680
+ async (x) => {
680
681
  if (!e) {
681
682
  console.error("Cannot apply workspace without repositoryKey");
682
683
  return;
683
684
  }
684
- const p = await S.getWorkspaceLayout(u);
685
- if (!p) {
686
- console.error(`Workspace ${u} not found`);
685
+ const k = await R.getWorkspaceLayout(x);
686
+ if (!k) {
687
+ console.error(`Workspace ${x} not found`);
687
688
  return;
688
689
  }
689
- const b = {
690
- workspaceId: u,
691
- sizes: p.defaultSizes || { left: 20, middle: 45, right: 35 },
692
- collapsed: p.defaultCollapsed || {
690
+ const d = {
691
+ workspaceId: x,
692
+ sizes: k.defaultSizes || { left: 20, middle: 45, right: 35 },
693
+ collapsed: k.defaultCollapsed || {
693
694
  left: !1,
694
695
  right: !1
695
696
  }
696
697
  };
697
- await S.setRepositoryState(e, b), await d();
698
+ await R.setRepositoryState(e, d), await c();
698
699
  },
699
- [e, d]
700
- ), L = f(
701
- async (u) => {
700
+ [e, c]
701
+ ), F = m(
702
+ async (x) => {
702
703
  if (!e) {
703
704
  console.error("Cannot update sizes without repositoryKey");
704
705
  return;
705
706
  }
706
- await S.updateRepositorySizes(e, u), await d();
707
+ await R.updateRepositorySizes(e, x), await c();
707
708
  },
708
- [e, d]
709
- ), D = f(
710
- async (u) => {
709
+ [e, c]
710
+ ), $ = m(
711
+ async (x) => {
711
712
  if (!e) {
712
713
  console.error("Cannot update collapsed without repositoryKey");
713
714
  return;
714
715
  }
715
- await S.updateRepositoryCollapsed(
716
+ await R.updateRepositoryCollapsed(
716
717
  e,
717
- u
718
- ), await d();
718
+ x
719
+ ), await c();
719
720
  },
720
- [e, d]
721
- ), n = f(async () => {
722
- if (!e || !(o != null && o.workspaceId)) {
721
+ [e, c]
722
+ ), g = m(async () => {
723
+ if (!e || !(r != null && r.workspaceId)) {
723
724
  console.error("Cannot reset without repositoryKey and active workspace");
724
725
  return;
725
726
  }
726
- await S.resetRepositoryToWorkspaceDefaults(
727
+ await R.resetRepositoryToWorkspaceDefaults(
727
728
  e,
728
- o.workspaceId
729
- ), await d();
730
- }, [e, o == null ? void 0 : o.workspaceId, d]), g = f(async () => {
731
- await d();
732
- }, [d]);
729
+ r.workspaceId
730
+ ), await c();
731
+ }, [e, r == null ? void 0 : r.workspaceId, c]), C = m(async () => {
732
+ await c();
733
+ }, [c]);
733
734
  return {
734
735
  workspaces: s,
735
- repositoryState: o,
736
- activeWorkspace: R,
737
- loading: P,
738
- error: m,
739
- getWorkspace: r,
740
- createWorkspace: y,
741
- updateWorkspace: W,
736
+ repositoryState: r,
737
+ activeWorkspace: y,
738
+ loading: b,
739
+ error: f,
740
+ getWorkspace: i,
741
+ createWorkspace: w,
742
+ updateWorkspace: S,
742
743
  deleteWorkspace: A,
743
744
  applyWorkspace: E,
744
- updateSizes: L,
745
- updateCollapsed: D,
746
- resetToDefaults: n,
747
- refresh: g
745
+ updateSizes: F,
746
+ updateCollapsed: $,
747
+ resetToDefaults: g,
748
+ refresh: C
748
749
  };
749
750
  }
750
- function j(l = {}) {
751
+ function de(o = {}) {
751
752
  const {
752
753
  initialFocus: e = null,
753
754
  collapsed: t = {},
754
755
  panelType: a = "three-panel",
755
756
  onFocusChange: s,
756
- events: i,
757
- getPanelId: o
758
- } = l, [c, R] = C(
757
+ events: n,
758
+ getPanelId: r
759
+ } = o, [l, y] = z(
759
760
  e
760
- ), h = f(
761
- (r) => {
762
- const y = c;
763
- if (R(r), s == null || s(r), i && o) {
764
- if (y) {
765
- const A = o(y);
766
- A && i.emit({
761
+ ), h = m(
762
+ (i) => {
763
+ const w = l;
764
+ if (y(i), s == null || s(i), n && r) {
765
+ if (w) {
766
+ const A = r(w);
767
+ A && n.emit({
767
768
  type: "panel:blur",
768
769
  source: "panel-layouts",
769
770
  timestamp: Date.now(),
770
771
  payload: {
771
772
  panelId: A,
772
- panelSlot: y,
773
- nextPanelId: o(r)
773
+ panelSlot: w,
774
+ nextPanelId: r(i)
774
775
  }
775
776
  });
776
777
  }
777
- const W = o(r);
778
- W && i.emit({
778
+ const S = r(i);
779
+ S && n.emit({
779
780
  type: "panel:focus",
780
781
  source: "panel-layouts",
781
782
  timestamp: Date.now(),
782
783
  payload: {
783
- panelId: W,
784
- panelSlot: r,
784
+ panelId: S,
785
+ panelSlot: i,
785
786
  source: "keyboard-shortcut"
786
787
  }
787
788
  });
788
789
  }
789
790
  },
790
- [c, s, i, o]
791
- ), P = f(() => {
792
- const r = c;
793
- if (R(null), s == null || s(null), i && o && r) {
794
- const y = o(r);
795
- y && i.emit({
791
+ [l, s, n, r]
792
+ ), b = m(() => {
793
+ const i = l;
794
+ if (y(null), s == null || s(null), n && r && i) {
795
+ const w = r(i);
796
+ w && n.emit({
796
797
  type: "panel:blur",
797
798
  source: "panel-layouts",
798
799
  timestamp: Date.now(),
799
800
  payload: {
800
- panelId: y,
801
- panelSlot: r
801
+ panelId: w,
802
+ panelSlot: i
802
803
  }
803
804
  });
804
805
  }
805
- }, [c, s, i, o]), w = f(() => {
806
- const r = [];
807
- return t.left || r.push("left"), r.push("middle"), a === "three-panel" && !t.right && r.push("right"), r;
808
- }, [t, a]), m = f(() => {
809
- const r = w();
810
- if (r.length === 0) return;
811
- if (c === null) {
812
- h(r[0]);
806
+ }, [l, s, n, r]), u = m(() => {
807
+ const i = [];
808
+ return t.left || i.push("left"), i.push("middle"), a === "three-panel" && !t.right && i.push("right"), i;
809
+ }, [t, a]), f = m(() => {
810
+ const i = u();
811
+ if (i.length === 0) return;
812
+ if (l === null) {
813
+ h(i[0]);
813
814
  return;
814
815
  }
815
- const y = r.indexOf(c);
816
- if (y === -1) {
817
- h(r[0]);
816
+ const w = i.indexOf(l);
817
+ if (w === -1) {
818
+ h(i[0]);
818
819
  return;
819
820
  }
820
- const W = (y + 1) % r.length;
821
- h(r[W]);
822
- }, [c, w, h]), k = f(() => {
823
- const r = w();
824
- if (r.length === 0) return;
825
- if (c === null) {
826
- h(r[r.length - 1]);
821
+ const S = (w + 1) % i.length;
822
+ h(i[S]);
823
+ }, [l, u, h]), p = m(() => {
824
+ const i = u();
825
+ if (i.length === 0) return;
826
+ if (l === null) {
827
+ h(i[i.length - 1]);
827
828
  return;
828
829
  }
829
- const y = r.indexOf(c);
830
- if (y === -1) {
831
- h(r[r.length - 1]);
830
+ const w = i.indexOf(l);
831
+ if (w === -1) {
832
+ h(i[i.length - 1]);
832
833
  return;
833
834
  }
834
- const W = y === 0 ? r.length - 1 : y - 1;
835
- h(r[W]);
836
- }, [c, w, h]), d = f(
837
- (r) => c === r,
838
- [c]
835
+ const S = w === 0 ? i.length - 1 : w - 1;
836
+ h(i[S]);
837
+ }, [l, u, h]), c = m(
838
+ (i) => l === i,
839
+ [l]
839
840
  );
840
841
  return {
841
- focusedPanel: c,
842
+ focusedPanel: l,
842
843
  setFocus: h,
843
- clearFocus: P,
844
- focusNext: m,
845
- focusPrevious: k,
846
- isFocused: d
844
+ clearFocus: b,
845
+ focusNext: f,
846
+ focusPrevious: p,
847
+ isFocused: c
847
848
  };
848
849
  }
849
- function q(l) {
850
+ function ue(o) {
850
851
  const {
851
852
  enabled: e = !0,
852
853
  focusedPanel: t,
853
854
  collapsed: a,
854
855
  panelType: s,
855
- setFocus: i,
856
- onExpand: o,
857
- onCollapse: c
858
- } = l, R = I(t), h = I(a), P = I(s);
859
- T(() => {
860
- R.current = t;
861
- }, [t]), T(() => {
856
+ setFocus: n,
857
+ onExpand: r,
858
+ onCollapse: l
859
+ } = o, y = I(t), h = I(a), b = I(s);
860
+ P(() => {
861
+ y.current = t;
862
+ }, [t]), P(() => {
862
863
  h.current = a;
863
- }, [a]), T(() => {
864
- P.current = s;
864
+ }, [a]), P(() => {
865
+ b.current = s;
865
866
  }, [s]);
866
- const w = f(
867
- (m) => {
868
- if (!m.altKey || m.ctrlKey || m.metaKey || m.shiftKey)
867
+ const u = m(
868
+ (f) => {
869
+ if (!f.altKey || f.ctrlKey || f.metaKey || f.shiftKey)
869
870
  return;
870
- const k = m.code, d = R.current, r = h.current, y = P.current;
871
- k === "Digit1" || k === "Numpad1" ? (m.preventDefault(), r.left ? o("left") : d !== "left" ? i("left") : (c("left"), i("middle"))) : k === "Digit2" || k === "Numpad2" ? (m.preventDefault(), i("middle")) : (k === "Digit3" || k === "Numpad3") && y === "three-panel" && (m.preventDefault(), r.right ? o("right") : d !== "right" ? i("right") : (c("right"), i("middle")));
871
+ const p = f.code, c = y.current, i = h.current, w = b.current;
872
+ p === "Digit1" || p === "Numpad1" ? (f.preventDefault(), i.left ? r("left") : c !== "left" ? n("left") : (l("left"), n("middle"))) : p === "Digit2" || p === "Numpad2" ? (f.preventDefault(), n("middle")) : (p === "Digit3" || p === "Numpad3") && w === "three-panel" && (f.preventDefault(), i.right ? r("right") : c !== "right" ? n("right") : (l("right"), n("middle")));
872
873
  },
873
- [i, o, c]
874
+ [n, r, l]
874
875
  );
875
- T(() => {
876
+ P(() => {
876
877
  if (e)
877
- return window.addEventListener("keydown", w), () => {
878
- window.removeEventListener("keydown", w);
878
+ return window.addEventListener("keydown", u), () => {
879
+ window.removeEventListener("keydown", u);
879
880
  };
880
- }, [e, w]);
881
+ }, [e, u]);
881
882
  }
882
- function X(l, e, t, a) {
883
- T(() => {
883
+ function pe(o, e, t, a) {
884
+ P(() => {
884
885
  const s = e.on(
885
886
  "panel:focus",
886
- (o) => {
887
- o.payload.panelId === l && t();
887
+ (r) => {
888
+ r.payload.panelId === o && t();
888
889
  }
889
890
  );
890
- let i;
891
- return a && (i = e.on(
891
+ let n;
892
+ return a && (n = e.on(
892
893
  "panel:blur",
893
- (o) => {
894
- o.payload.panelId === l && a();
894
+ (r) => {
895
+ r.payload.panelId === o && a();
895
896
  }
896
897
  )), () => {
897
- s(), i == null || i();
898
+ s(), n == null || n();
898
899
  };
899
- }, [l, e, t, a]);
900
+ }, [o, e, t, a]);
900
901
  }
901
- const M = ({
902
- isFocused: l,
902
+ const fe = ({
903
+ isFocused: o,
903
904
  className: e = "",
904
905
  style: t = {}
905
906
  }) => {
906
- if (!l)
907
+ if (!o)
907
908
  return null;
908
909
  const a = {
909
910
  position: "absolute",
@@ -919,7 +920,7 @@ const M = ({
919
920
  transition: "opacity 0.15s ease-in-out",
920
921
  ...t
921
922
  };
922
- return /* @__PURE__ */ O(
923
+ return /* @__PURE__ */ T(
923
924
  "div",
924
925
  {
925
926
  className: `panel-focus-indicator ${e}`,
@@ -928,20 +929,824 @@ const M = ({
928
929
  "aria-hidden": "true"
929
930
  }
930
931
  );
932
+ }, ee = ({
933
+ value: o,
934
+ onChange: e,
935
+ placeholder: t = "> Type a command...",
936
+ onClose: a,
937
+ onEnter: s
938
+ }) => {
939
+ const { theme: n } = N(), r = I(null);
940
+ P(() => {
941
+ r.current && r.current.focus();
942
+ }, []);
943
+ const l = (y) => {
944
+ switch (y.key) {
945
+ case "Enter":
946
+ y.preventDefault(), s == null || s();
947
+ break;
948
+ case "Escape":
949
+ y.preventDefault(), a();
950
+ break;
951
+ }
952
+ };
953
+ return /* @__PURE__ */ T(
954
+ "div",
955
+ {
956
+ style: {
957
+ padding: "0",
958
+ borderBottom: `1px solid ${n.colors.border}`,
959
+ backgroundColor: n.colors.background
960
+ },
961
+ children: /* @__PURE__ */ T(
962
+ "input",
963
+ {
964
+ ref: r,
965
+ type: "text",
966
+ value: o,
967
+ onChange: (y) => e(y.target.value),
968
+ onKeyDown: l,
969
+ placeholder: t,
970
+ style: {
971
+ width: "100%",
972
+ padding: "16px 20px",
973
+ fontSize: "16px",
974
+ fontFamily: n.fonts.monospace,
975
+ backgroundColor: "transparent",
976
+ border: "none",
977
+ outline: "none",
978
+ color: n.colors.text,
979
+ caretColor: n.colors.primary
980
+ },
981
+ autoComplete: "off",
982
+ autoCorrect: "off",
983
+ autoCapitalize: "off",
984
+ spellCheck: !1
985
+ }
986
+ )
987
+ }
988
+ );
989
+ }, V = Y(
990
+ ({ command: o, isSelected: e, onClick: t, onMouseEnter: a }, s) => {
991
+ const { theme: n } = N(), { label: r, description: l, icon: y, shortcut: h } = o, [b, u] = Q.useState(!1);
992
+ return /* @__PURE__ */ W(
993
+ "div",
994
+ {
995
+ ref: s,
996
+ onClick: t,
997
+ onMouseEnter: () => {
998
+ u(!0), a();
999
+ },
1000
+ onMouseLeave: () => u(!1),
1001
+ style: {
1002
+ padding: "10px 16px",
1003
+ cursor: "pointer",
1004
+ backgroundColor: e || b ? n.colors.backgroundSecondary : "transparent",
1005
+ borderLeft: e || b ? `3px solid ${n.colors.primary}` : "3px solid transparent",
1006
+ transition: "all 0.1s ease",
1007
+ display: "flex",
1008
+ alignItems: "center",
1009
+ gap: "12px"
1010
+ },
1011
+ onMouseDown: (f) => {
1012
+ f.preventDefault();
1013
+ },
1014
+ children: [
1015
+ y && /* @__PURE__ */ T(
1016
+ "div",
1017
+ {
1018
+ style: {
1019
+ flexShrink: 0,
1020
+ width: "20px",
1021
+ height: "20px",
1022
+ display: "flex",
1023
+ alignItems: "center",
1024
+ justifyContent: "center",
1025
+ fontSize: "16px",
1026
+ color: e || b ? n.colors.primary : n.colors.textSecondary
1027
+ },
1028
+ children: y
1029
+ }
1030
+ ),
1031
+ /* @__PURE__ */ W("div", { style: { flex: 1, minWidth: 0 }, children: [
1032
+ /* @__PURE__ */ T(
1033
+ "div",
1034
+ {
1035
+ style: {
1036
+ fontSize: "14px",
1037
+ fontWeight: 500,
1038
+ color: e || b ? n.colors.text : n.colors.textSecondary,
1039
+ marginBottom: l ? "2px" : 0
1040
+ },
1041
+ children: r
1042
+ }
1043
+ ),
1044
+ l && /* @__PURE__ */ T(
1045
+ "div",
1046
+ {
1047
+ style: {
1048
+ fontSize: "12px",
1049
+ color: n.colors.textMuted,
1050
+ overflow: "hidden",
1051
+ textOverflow: "ellipsis",
1052
+ whiteSpace: "nowrap"
1053
+ },
1054
+ children: l
1055
+ }
1056
+ )
1057
+ ] }),
1058
+ h && /* @__PURE__ */ T(
1059
+ "div",
1060
+ {
1061
+ style: {
1062
+ flexShrink: 0,
1063
+ fontSize: "11px",
1064
+ color: n.colors.textMuted,
1065
+ padding: "2px 8px",
1066
+ backgroundColor: n.colors.background,
1067
+ border: `1px solid ${n.colors.border}`,
1068
+ borderRadius: "4px",
1069
+ fontFamily: n.fonts.monospace
1070
+ },
1071
+ children: h
1072
+ }
1073
+ )
1074
+ ]
1075
+ }
1076
+ );
1077
+ }
1078
+ );
1079
+ V.displayName = "CommandItem";
1080
+ const te = ({
1081
+ commands: o,
1082
+ selectedIndex: e,
1083
+ onSelect: t,
1084
+ onHover: a,
1085
+ maxResults: s = 10
1086
+ }) => {
1087
+ const { theme: n } = N(), r = I(null), l = I(null), y = o.slice(0, s);
1088
+ P(() => {
1089
+ if (l.current && r.current) {
1090
+ const u = l.current, f = r.current, p = u.offsetTop, c = p + u.offsetHeight, i = f.scrollTop, w = f.clientHeight;
1091
+ p < i ? f.scrollTop = p - 8 : c > i + w && (f.scrollTop = c - w + 8);
1092
+ }
1093
+ }, [e]);
1094
+ const h = y.reduce((u, f, p) => {
1095
+ const c = f.category || "Other";
1096
+ return u[c] || (u[c] = []), u[c].push({ command: f, index: p }), u;
1097
+ }, {}), b = Object.keys(h).sort((u, f) => u === "Other" ? 1 : f === "Other" ? -1 : u.localeCompare(f));
1098
+ return /* @__PURE__ */ W(
1099
+ "div",
1100
+ {
1101
+ ref: r,
1102
+ style: {
1103
+ overflowY: "auto",
1104
+ maxHeight: "400px",
1105
+ padding: "8px 0"
1106
+ },
1107
+ children: [
1108
+ b.map((u) => /* @__PURE__ */ W("div", { children: [
1109
+ b.length > 1 && /* @__PURE__ */ T(
1110
+ "div",
1111
+ {
1112
+ style: {
1113
+ padding: "8px 16px 4px",
1114
+ fontSize: "11px",
1115
+ fontWeight: 600,
1116
+ textTransform: "uppercase",
1117
+ color: n.colors.textMuted,
1118
+ letterSpacing: "0.5px"
1119
+ },
1120
+ children: u
1121
+ }
1122
+ ),
1123
+ h[u].map(({ command: f, index: p }) => /* @__PURE__ */ T(
1124
+ V,
1125
+ {
1126
+ command: f,
1127
+ isSelected: p === e,
1128
+ onClick: () => t(f),
1129
+ onMouseEnter: () => a(p),
1130
+ ref: p === e ? l : void 0
1131
+ },
1132
+ f.id
1133
+ ))
1134
+ ] }, u)),
1135
+ o.length > s && /* @__PURE__ */ W(
1136
+ "div",
1137
+ {
1138
+ style: {
1139
+ padding: "8px 16px",
1140
+ fontSize: "12px",
1141
+ color: n.colors.textMuted,
1142
+ textAlign: "center",
1143
+ borderTop: `1px solid ${n.colors.border}`
1144
+ },
1145
+ children: [
1146
+ "Showing ",
1147
+ s,
1148
+ " of ",
1149
+ o.length,
1150
+ " results"
1151
+ ]
1152
+ }
1153
+ )
1154
+ ]
1155
+ }
1156
+ );
1157
+ }, me = ({
1158
+ commandPalette: o,
1159
+ config: e
1160
+ }) => {
1161
+ const { theme: t } = N(), a = I(null), {
1162
+ isOpen: s,
1163
+ close: n,
1164
+ query: r,
1165
+ setQuery: l,
1166
+ filteredCommands: y,
1167
+ selectedIndex: h,
1168
+ setSelectedIndex: b,
1169
+ executeSelected: u
1170
+ } = o;
1171
+ if (P(() => {
1172
+ if (!s) return;
1173
+ const c = (w) => {
1174
+ a.current && !a.current.contains(w.target) && n();
1175
+ }, i = setTimeout(() => {
1176
+ document.addEventListener("mousedown", c);
1177
+ }, 100);
1178
+ return () => {
1179
+ clearTimeout(i), document.removeEventListener("mousedown", c);
1180
+ };
1181
+ }, [s, n]), !s)
1182
+ return null;
1183
+ const f = (e == null ? void 0 : e.maxHeight) || "50vh", p = (e == null ? void 0 : e.placeholder) || "> Type a command...";
1184
+ return /* @__PURE__ */ W(G, { children: [
1185
+ /* @__PURE__ */ T(
1186
+ "div",
1187
+ {
1188
+ style: {
1189
+ position: "fixed",
1190
+ inset: 0,
1191
+ backgroundColor: "rgba(0, 0, 0, 0.4)",
1192
+ backdropFilter: "blur(2px)",
1193
+ zIndex: 999
1194
+ },
1195
+ onClick: n
1196
+ }
1197
+ ),
1198
+ /* @__PURE__ */ W(
1199
+ "div",
1200
+ {
1201
+ ref: a,
1202
+ className: e == null ? void 0 : e.className,
1203
+ style: {
1204
+ position: "fixed",
1205
+ bottom: 0,
1206
+ left: 0,
1207
+ right: 0,
1208
+ maxHeight: f,
1209
+ backgroundColor: t.colors.surface,
1210
+ borderTop: `1px solid ${t.colors.border}`,
1211
+ boxShadow: t.shadows[2],
1212
+ zIndex: 1e3,
1213
+ display: "flex",
1214
+ flexDirection: "column-reverse",
1215
+ ...e == null ? void 0 : e.style
1216
+ },
1217
+ children: [
1218
+ /* @__PURE__ */ W("div", { children: [
1219
+ /* @__PURE__ */ T(
1220
+ ee,
1221
+ {
1222
+ value: r,
1223
+ onChange: l,
1224
+ placeholder: p,
1225
+ onClose: n,
1226
+ onEnter: u
1227
+ }
1228
+ ),
1229
+ /* @__PURE__ */ W(
1230
+ "div",
1231
+ {
1232
+ style: {
1233
+ padding: "8px 16px",
1234
+ borderTop: `1px solid ${t.colors.border}`,
1235
+ display: "flex",
1236
+ gap: "16px",
1237
+ fontSize: "12px",
1238
+ color: t.colors.textMuted,
1239
+ backgroundColor: t.colors.background
1240
+ },
1241
+ children: [
1242
+ /* @__PURE__ */ W("span", { children: [
1243
+ /* @__PURE__ */ T("kbd", { style: { padding: "2px 6px", backgroundColor: t.colors.backgroundSecondary, borderRadius: "3px", border: `1px solid ${t.colors.border}` }, children: "Enter" }),
1244
+ " Execute"
1245
+ ] }),
1246
+ /* @__PURE__ */ W("span", { children: [
1247
+ /* @__PURE__ */ T("kbd", { style: { padding: "2px 6px", backgroundColor: t.colors.backgroundSecondary, borderRadius: "3px", border: `1px solid ${t.colors.border}` }, children: "Esc" }),
1248
+ " Close"
1249
+ ] })
1250
+ ]
1251
+ }
1252
+ )
1253
+ ] }),
1254
+ y.length > 0 && /* @__PURE__ */ T(
1255
+ te,
1256
+ {
1257
+ commands: y,
1258
+ selectedIndex: h,
1259
+ onSelect: (c) => {
1260
+ o.executeCommand(c.id);
1261
+ },
1262
+ onHover: b,
1263
+ maxResults: e == null ? void 0 : e.maxResults
1264
+ }
1265
+ ),
1266
+ r && y.length === 0 && /* @__PURE__ */ W(
1267
+ "div",
1268
+ {
1269
+ style: {
1270
+ padding: "24px 16px",
1271
+ color: t.colors.textMuted,
1272
+ textAlign: "center",
1273
+ fontSize: "14px"
1274
+ },
1275
+ children: [
1276
+ 'No commands found for "',
1277
+ r,
1278
+ '"'
1279
+ ]
1280
+ }
1281
+ )
1282
+ ]
1283
+ }
1284
+ )
1285
+ ] });
931
1286
  };
1287
+ class B {
1288
+ constructor() {
1289
+ D(this, "commands", /* @__PURE__ */ new Map());
1290
+ D(this, "listeners", /* @__PURE__ */ new Set());
1291
+ }
1292
+ /**
1293
+ * Register one or more commands
1294
+ * @param commands - Array of commands to register
1295
+ */
1296
+ registerCommands(e) {
1297
+ e.forEach((t) => {
1298
+ this.commands.set(t.id, t);
1299
+ }), this.notifyListeners();
1300
+ }
1301
+ /**
1302
+ * Register a single command
1303
+ * @param command - Command to register
1304
+ */
1305
+ registerCommand(e) {
1306
+ this.commands.set(e.id, e), this.notifyListeners();
1307
+ }
1308
+ /**
1309
+ * Unregister commands by ID
1310
+ * @param commandIds - Array of command IDs to unregister
1311
+ */
1312
+ unregisterCommands(e) {
1313
+ e.forEach((t) => {
1314
+ this.commands.delete(t);
1315
+ }), this.notifyListeners();
1316
+ }
1317
+ /**
1318
+ * Unregister a single command
1319
+ * @param commandId - Command ID to unregister
1320
+ */
1321
+ unregisterCommand(e) {
1322
+ this.commands.delete(e), this.notifyListeners();
1323
+ }
1324
+ /**
1325
+ * Get all registered commands
1326
+ * @param context - Command context for availability checks
1327
+ * @returns Array of available commands
1328
+ */
1329
+ getCommands(e) {
1330
+ const t = Array.from(this.commands.values());
1331
+ return e ? t.filter((a) => a.isAvailable ? a.isAvailable(e) : !0) : t;
1332
+ }
1333
+ /**
1334
+ * Get a command by ID
1335
+ * @param commandId - Command ID
1336
+ * @returns Command if found, undefined otherwise
1337
+ */
1338
+ getCommand(e) {
1339
+ return this.commands.get(e);
1340
+ }
1341
+ /**
1342
+ * Execute a command by ID
1343
+ * @param commandId - Command ID to execute
1344
+ * @param context - Command context
1345
+ */
1346
+ async executeCommand(e, t) {
1347
+ var s, n;
1348
+ const a = this.commands.get(e);
1349
+ if (!a) {
1350
+ console.warn(`Command not found: ${e}`);
1351
+ return;
1352
+ }
1353
+ if (a.isAvailable && !a.isAvailable(t)) {
1354
+ console.warn(`Command not available: ${e}`);
1355
+ return;
1356
+ }
1357
+ try {
1358
+ await a.execute(t), (s = t.events) == null || s.emit({
1359
+ type: "command:executed",
1360
+ source: "command-palette",
1361
+ timestamp: Date.now(),
1362
+ payload: {
1363
+ commandId: a.id,
1364
+ commandLabel: a.label
1365
+ }
1366
+ });
1367
+ } catch (r) {
1368
+ console.error(`Error executing command ${e}:`, r), (n = t.events) == null || n.emit({
1369
+ type: "command:error",
1370
+ source: "command-palette",
1371
+ timestamp: Date.now(),
1372
+ payload: {
1373
+ commandId: a.id,
1374
+ error: r instanceof Error ? r.message : String(r)
1375
+ }
1376
+ });
1377
+ }
1378
+ }
1379
+ /**
1380
+ * Search commands by query
1381
+ * @param query - Search query
1382
+ * @param context - Command context for availability checks
1383
+ * @returns Filtered and sorted commands
1384
+ */
1385
+ searchCommands(e, t) {
1386
+ const a = this.getCommands(t);
1387
+ if (!e.trim())
1388
+ return this.sortCommands(a);
1389
+ const s = e.toLowerCase();
1390
+ return a.map((r) => {
1391
+ var y, h;
1392
+ let l = 0;
1393
+ return r.label.toLowerCase() === s ? l += 1e3 : r.label.toLowerCase().startsWith(s) ? l += 500 : r.label.toLowerCase().includes(s) && (l += 250), (y = r.description) != null && y.toLowerCase().includes(s) && (l += 100), r.keywords && r.keywords.some(
1394
+ (u) => u.toLowerCase().includes(s)
1395
+ ) && (l += 150), (h = r.category) != null && h.toLowerCase().includes(s) && (l += 50), l > 0 && r.priority && (l += r.priority), { command: r, score: l };
1396
+ }).filter((r) => r.score > 0).sort((r, l) => l.score - r.score).map((r) => r.command);
1397
+ }
1398
+ /**
1399
+ * Sort commands by priority and label
1400
+ * @param commands - Commands to sort
1401
+ * @returns Sorted commands
1402
+ */
1403
+ sortCommands(e) {
1404
+ return e.sort((t, a) => {
1405
+ const s = (a.priority || 0) - (t.priority || 0);
1406
+ if (s !== 0)
1407
+ return s;
1408
+ const n = t.category || "", r = a.category || "", l = n.localeCompare(r);
1409
+ return l !== 0 ? l : t.label.localeCompare(a.label);
1410
+ });
1411
+ }
1412
+ /**
1413
+ * Subscribe to registry changes
1414
+ * @param listener - Callback function called when registry changes
1415
+ * @returns Unsubscribe function
1416
+ */
1417
+ subscribe(e) {
1418
+ return this.listeners.add(e), () => {
1419
+ this.listeners.delete(e);
1420
+ };
1421
+ }
1422
+ /**
1423
+ * Clear all commands
1424
+ */
1425
+ clear() {
1426
+ this.commands.clear(), this.notifyListeners();
1427
+ }
1428
+ /**
1429
+ * Get count of registered commands
1430
+ */
1431
+ get size() {
1432
+ return this.commands.size;
1433
+ }
1434
+ /**
1435
+ * Notify all listeners of registry changes
1436
+ */
1437
+ notifyListeners() {
1438
+ this.listeners.forEach((e) => e());
1439
+ }
1440
+ }
1441
+ let O = null;
1442
+ function ye() {
1443
+ return O || (O = new B()), O;
1444
+ }
1445
+ function he() {
1446
+ O = null;
1447
+ }
1448
+ function ge({
1449
+ context: o,
1450
+ commands: e = [],
1451
+ keyboard: t = { key: " ", altKey: !0 },
1452
+ config: a = {},
1453
+ registry: s
1454
+ }) {
1455
+ const [n, r] = z(!1), [l, y] = z(""), [h, b] = z(0), [u, f] = z([]), p = K(
1456
+ () => s || new B(),
1457
+ [s]
1458
+ ), c = K(
1459
+ () => ({
1460
+ ...o,
1461
+ closeCommandPalette: () => r(!1)
1462
+ }),
1463
+ [o]
1464
+ );
1465
+ P(() => {
1466
+ let d = !0;
1467
+ const v = p.subscribe(() => {
1468
+ if (d) {
1469
+ const L = p.getCommands(c);
1470
+ f(L);
1471
+ }
1472
+ });
1473
+ if (e.length > 0)
1474
+ p.registerCommands(e);
1475
+ else {
1476
+ const L = p.getCommands(c);
1477
+ f(L);
1478
+ }
1479
+ return () => {
1480
+ d = !1, v();
1481
+ };
1482
+ }, [p]);
1483
+ const i = K(() => (a.fuzzySearch === !1, p.searchCommands(l, c)), [l, p, c, a.fuzzySearch]);
1484
+ P(() => {
1485
+ b(0);
1486
+ }, [i]);
1487
+ const w = m(() => {
1488
+ var d;
1489
+ r(!0), y(""), b(0), (d = o.events) == null || d.emit({
1490
+ type: "command-palette:opened",
1491
+ source: "command-palette",
1492
+ timestamp: Date.now(),
1493
+ payload: {}
1494
+ });
1495
+ }, [o.events]), S = m(() => {
1496
+ var d;
1497
+ r(!1), y(""), b(0), (d = o.events) == null || d.emit({
1498
+ type: "command-palette:closed",
1499
+ source: "command-palette",
1500
+ timestamp: Date.now(),
1501
+ payload: {}
1502
+ });
1503
+ }, [o.events]), A = m(() => {
1504
+ n ? S() : w();
1505
+ }, [n, w, S]), E = m(
1506
+ async (d) => {
1507
+ await p.executeCommand(d, c), S();
1508
+ },
1509
+ [p, c, S]
1510
+ ), F = m(() => {
1511
+ b((d) => {
1512
+ const v = a.maxResults || i.length, L = Math.min(i.length, v) - 1;
1513
+ return d < L ? d + 1 : 0;
1514
+ });
1515
+ }, [i.length, a.maxResults]), $ = m(() => {
1516
+ b((d) => {
1517
+ const v = a.maxResults || i.length, L = Math.min(i.length, v) - 1;
1518
+ return d > 0 ? d - 1 : L;
1519
+ });
1520
+ }, [i.length, a.maxResults]), g = m(async () => {
1521
+ const d = i[0];
1522
+ d && await E(d.id);
1523
+ }, [i, E]), C = m(
1524
+ (d) => {
1525
+ p.registerCommands(d);
1526
+ },
1527
+ [p]
1528
+ ), x = m(
1529
+ (d) => {
1530
+ p.unregisterCommands(d);
1531
+ },
1532
+ [p]
1533
+ ), k = m(
1534
+ (d) => {
1535
+ const {
1536
+ key: v = " ",
1537
+ altKey: L = !0,
1538
+ ctrlKey: J = !1,
1539
+ metaKey: _ = !1,
1540
+ shiftKey: j = !1
1541
+ } = t, H = d.altKey === L && d.ctrlKey === J && d.metaKey === _ && d.shiftKey === j;
1542
+ if ((v === " " ? d.code === "Space" : d.key === v) && H) {
1543
+ const M = d.target;
1544
+ if (M.tagName === "INPUT" || M.tagName === "TEXTAREA" || M.isContentEditable)
1545
+ return;
1546
+ d.preventDefault(), A();
1547
+ }
1548
+ },
1549
+ [t, A]
1550
+ );
1551
+ return P(() => (window.addEventListener("keydown", k), () => window.removeEventListener("keydown", k)), [k]), {
1552
+ isOpen: n,
1553
+ open: w,
1554
+ close: S,
1555
+ toggle: A,
1556
+ query: l,
1557
+ setQuery: y,
1558
+ filteredCommands: i,
1559
+ executeCommand: E,
1560
+ selectedIndex: h,
1561
+ setSelectedIndex: b,
1562
+ selectNext: F,
1563
+ selectPrevious: $,
1564
+ executeSelected: g,
1565
+ commands: u,
1566
+ registerCommands: C,
1567
+ unregisterCommands: x
1568
+ };
1569
+ }
1570
+ const ae = [
1571
+ {
1572
+ id: "panel.focus.left",
1573
+ label: "Focus Left Panel",
1574
+ description: "Set focus to the left panel",
1575
+ icon: "◀",
1576
+ category: "Panel Navigation",
1577
+ shortcut: "Alt+1",
1578
+ priority: 100,
1579
+ keywords: ["left", "sidebar", "focus", "switch"],
1580
+ execute: (o) => {
1581
+ o.setFocus("left");
1582
+ },
1583
+ isAvailable: (o) => o.focusedPanel !== "left"
1584
+ },
1585
+ {
1586
+ id: "panel.focus.middle",
1587
+ label: "Focus Middle Panel",
1588
+ description: "Set focus to the middle panel",
1589
+ icon: "▣",
1590
+ category: "Panel Navigation",
1591
+ shortcut: "Alt+2",
1592
+ priority: 100,
1593
+ keywords: ["middle", "center", "main", "focus", "switch"],
1594
+ execute: (o) => {
1595
+ o.setFocus("middle");
1596
+ },
1597
+ isAvailable: (o) => o.focusedPanel !== "middle"
1598
+ },
1599
+ {
1600
+ id: "panel.focus.right",
1601
+ label: "Focus Right Panel",
1602
+ description: "Set focus to the right panel",
1603
+ icon: "▶",
1604
+ category: "Panel Navigation",
1605
+ shortcut: "Alt+3",
1606
+ priority: 100,
1607
+ keywords: ["right", "sidebar", "focus", "switch"],
1608
+ execute: (o) => {
1609
+ o.setFocus("right");
1610
+ },
1611
+ isAvailable: (o) => o.focusedPanel !== "right"
1612
+ },
1613
+ {
1614
+ id: "panel.toggle.left",
1615
+ label: "Toggle Left Panel",
1616
+ description: "Expand or collapse the left panel",
1617
+ icon: "◀◀",
1618
+ category: "Panel Control",
1619
+ keywords: ["toggle", "left", "collapse", "expand", "hide", "show"],
1620
+ priority: 80,
1621
+ execute: (o) => {
1622
+ var e;
1623
+ (e = o.events) == null || e.emit({
1624
+ type: "panel:toggle",
1625
+ source: "command-palette",
1626
+ timestamp: Date.now(),
1627
+ payload: { panelId: "left" }
1628
+ });
1629
+ }
1630
+ },
1631
+ {
1632
+ id: "panel.toggle.right",
1633
+ label: "Toggle Right Panel",
1634
+ description: "Expand or collapse the right panel",
1635
+ icon: "▶▶",
1636
+ category: "Panel Control",
1637
+ keywords: ["toggle", "right", "collapse", "expand", "hide", "show"],
1638
+ priority: 80,
1639
+ execute: (o) => {
1640
+ var e;
1641
+ (e = o.events) == null || e.emit({
1642
+ type: "panel:toggle",
1643
+ source: "command-palette",
1644
+ timestamp: Date.now(),
1645
+ payload: { panelId: "right" }
1646
+ });
1647
+ }
1648
+ },
1649
+ {
1650
+ id: "panel.collapse.all",
1651
+ label: "Collapse All Panels",
1652
+ description: "Collapse all side panels to maximize middle panel",
1653
+ icon: "⬌",
1654
+ category: "Panel Control",
1655
+ keywords: ["collapse", "hide", "all", "maximize", "focus mode"],
1656
+ priority: 70,
1657
+ execute: (o) => {
1658
+ var e;
1659
+ (e = o.events) == null || e.emit({
1660
+ type: "panel:collapse-all",
1661
+ source: "command-palette",
1662
+ timestamp: Date.now(),
1663
+ payload: {}
1664
+ });
1665
+ }
1666
+ },
1667
+ {
1668
+ id: "panel.expand.all",
1669
+ label: "Expand All Panels",
1670
+ description: "Expand all side panels to default layout",
1671
+ icon: "⬍",
1672
+ category: "Panel Control",
1673
+ keywords: ["expand", "show", "all", "restore", "default"],
1674
+ priority: 70,
1675
+ execute: (o) => {
1676
+ var e;
1677
+ (e = o.events) == null || e.emit({
1678
+ type: "panel:expand-all",
1679
+ source: "command-palette",
1680
+ timestamp: Date.now(),
1681
+ payload: {}
1682
+ });
1683
+ }
1684
+ },
1685
+ {
1686
+ id: "panel.refresh",
1687
+ label: "Refresh Panel Data",
1688
+ description: "Reload data for the currently focused panel",
1689
+ icon: "↻",
1690
+ category: "Panel Control",
1691
+ keywords: ["refresh", "reload", "update", "sync"],
1692
+ priority: 60,
1693
+ execute: (o) => {
1694
+ var t;
1695
+ const e = o.focusedPanel;
1696
+ e && ((t = o.events) == null || t.emit({
1697
+ type: "panel:refresh",
1698
+ source: "command-palette",
1699
+ timestamp: Date.now(),
1700
+ payload: { panelId: e }
1701
+ }));
1702
+ },
1703
+ isAvailable: (o) => o.focusedPanel !== null
1704
+ },
1705
+ {
1706
+ id: "panel.reset.layout",
1707
+ label: "Reset Panel Layout",
1708
+ description: "Reset panel sizes to default layout",
1709
+ icon: "⟲",
1710
+ category: "Panel Control",
1711
+ keywords: ["reset", "layout", "default", "restore"],
1712
+ priority: 50,
1713
+ execute: (o) => {
1714
+ var e;
1715
+ (e = o.events) == null || e.emit({
1716
+ type: "panel:reset-layout",
1717
+ source: "command-palette",
1718
+ timestamp: Date.now(),
1719
+ payload: {}
1720
+ });
1721
+ }
1722
+ }
1723
+ ];
1724
+ function we() {
1725
+ return ae;
1726
+ }
932
1727
  export {
933
- G as EditableConfigurablePanelLayout,
934
- M as FocusIndicator,
935
- $ as LocalStoragePersistenceAdapter,
936
- N as LocalStorageWorkspaceAdapter,
937
- Q as ResponsiveConfigurablePanelLayout,
938
- S as WorkspaceLayoutService,
939
- H as mapThemeToPanelVars,
940
- U as mapThemeToTabVars,
941
- j as usePanelFocus,
942
- X as usePanelFocusListener,
943
- q as usePanelKeyboardShortcuts,
944
- _ as usePanelPersistence,
945
- K as useWorkspace
1728
+ ee as CommandInput,
1729
+ V as CommandItem,
1730
+ te as CommandList,
1731
+ me as CommandPalette,
1732
+ B as CommandRegistryService,
1733
+ xe as EditableConfigurablePanelLayout,
1734
+ fe as FocusIndicator,
1735
+ Z as LocalStoragePersistenceAdapter,
1736
+ U as LocalStorageWorkspaceAdapter,
1737
+ Ce as ResponsiveConfigurablePanelLayout,
1738
+ R as WorkspaceLayoutService,
1739
+ ye as getGlobalCommandRegistry,
1740
+ we as getPanelCommands,
1741
+ ve as mapThemeToPanelVars,
1742
+ Se as mapThemeToTabVars,
1743
+ ae as panelCommands,
1744
+ he as resetGlobalCommandRegistry,
1745
+ ge as useCommandPalette,
1746
+ de as usePanelFocus,
1747
+ pe as usePanelFocusListener,
1748
+ ue as usePanelKeyboardShortcuts,
1749
+ ie as usePanelPersistence,
1750
+ ce as useWorkspace
946
1751
  };
947
1752
  //# sourceMappingURL=index.esm.js.map