@principal-ade/panel-layouts 0.1.6 → 0.2.1

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 D = Object.defineProperty;
2
- var F = (n, e, t) => e in n ? D(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var A = (n, e, t) => F(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { EditableConfigurablePanelLayout as Z, ResponsiveConfigurablePanelLayout as G, mapThemeToPanelVars as Q, mapThemeToTabVars as H } from "@principal-ade/panels";
5
- import { useState as R, useRef as C, useEffect as P, useCallback as p } 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
- A(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 _(n) {
31
+ function ie(o) {
31
32
  const {
32
33
  viewKey: e,
33
34
  defaultSizes: t,
34
35
  panelType: a,
35
- adapter: s = new $()
36
- } = n, [l, f] = R(t), [u, v] = R(n.collapsed), w = C(n.collapsed), b = C({}), h = C(null), y = C(null);
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);
37
38
  P(() => {
38
39
  (async () => {
39
- const g = await s.load(e);
40
- g != null && g.sizes && (f(g.sizes), r(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 r = p(
44
- (i) => {
45
- "left" in i && i.left > 0 && (b.current.left = i.left), "middle" in i && i.middle > 0 && (b.current.middle = i.middle), "right" in i && i.right > 0 && (b.current.right = i.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
- ), o = p(
49
- (i) => {
50
- const g = b.current[i];
51
- if (g && g > 0)
52
- return g;
53
- if (i === "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 (i === "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
- ), k = C(t);
60
+ ), i = I(t);
60
61
  P(() => {
61
- ("left" in t && t.left !== k.current.left || "middle" in t && "middle" in k.current && t.middle !== k.current.middle || "right" in t && t.right !== k.current.right) && (f(t), r(t), k.current = t);
62
- }, [t, r]), P(() => {
63
- const i = n.collapsed.left !== w.current.left, g = "right" in n.collapsed && "right" in w.current && n.collapsed.right !== w.current.right;
64
- (i || g) && (v(n.collapsed), w.current = { ...n.collapsed });
65
- }, [n.collapsed.left, n.collapsed.right]);
66
- const T = p(
67
- async (i) => {
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: i });
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
- ), z = p(
79
- (i) => {
80
- const g = { ...i };
81
- let c = !0;
82
- if ("left" in i) {
83
- const d = !!(u != null && u.left), S = i.left;
84
- if (d) {
85
- const W = o("left");
86
- W !== void 0 && W > 0 ? g.left = W : c = !1;
87
- } else S === 0 && (c = !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 i) {
90
- const d = !!(u != null && u.right), S = i.right;
91
- if (d) {
92
- const W = o("right");
93
- W !== void 0 && W > 0 ? g.right = W : c = !1;
94
- } else S === 0 && (c = !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 (f(g), r(g), h.current && (clearTimeout(h.current), h.current = null), !c) {
97
- y.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
- y.current = g, h.current = setTimeout(() => {
101
- const d = y.current;
102
- d && (T(d), y.current = null), h.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
  [
106
- u,
107
- o,
107
+ l,
108
+ c,
108
109
  a,
109
- T,
110
- r
110
+ w,
111
+ p
111
112
  ]
112
113
  );
113
114
  P(() => () => {
114
- if (h.current) {
115
- const i = y.current;
116
- i && (T(i), y.current = null), clearTimeout(h.current), h.current = null;
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
- }, [T]);
119
- const I = p(async () => {
120
- }, []), E = p(async () => {
121
- }, []), L = p(async () => {
122
- }, []), x = p(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: l,
127
- collapsed: u,
128
- handlePanelResize: z,
129
- handleLeftCollapseComplete: I,
127
+ sizes: n,
128
+ collapsed: l,
129
+ handlePanelResize: S,
130
+ handleLeftCollapseComplete: A,
130
131
  handleLeftExpandComplete: E,
131
- handleRightCollapseComplete: L,
132
- handleRightExpandComplete: x
132
+ handleRightCollapseComplete: F,
133
+ handleRightExpandComplete: $
133
134
  } : {
134
135
  type: "two-panel",
135
- sizes: l,
136
- collapsed: u,
137
- handlePanelResize: z,
138
- handleLeftCollapseComplete: I,
136
+ sizes: n,
137
+ collapsed: l,
138
+ handlePanelResize: S,
139
+ handleLeftCollapseComplete: A,
139
140
  handleLeftExpandComplete: E
140
141
  };
141
142
  }
142
- class N {
143
+ class U {
143
144
  constructor() {
144
- A(this, "PRESETS_KEY", "panel-layouts:workspace-presets");
145
- A(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), l = localStorage.getItem(a);
206
- if (l)
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(l);
209
- } catch (f) {
209
+ e[s] = JSON.parse(n);
210
+ } catch (r) {
210
211
  console.error(
211
212
  `Failed to parse repository state for ${s}:`,
212
- f
213
+ r
213
214
  );
214
215
  }
215
216
  }
@@ -220,7 +221,7 @@ class N {
220
221
  }
221
222
  }
222
223
  }
223
- class m {
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 m {
257
258
  createdAt: Date.now(),
258
259
  updatedAt: Date.now(),
259
260
  isBuiltIn: !1
260
- }, l = {
261
+ }, n = {
261
262
  ...t,
262
263
  [a]: s
263
264
  };
264
- return await this.adapter.saveWorkspacePresets(l), 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 m {
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 l = {
276
+ const n = {
276
277
  ...s,
277
278
  ...t,
278
279
  id: e,
@@ -280,11 +281,11 @@ class m {
280
281
  createdAt: s.createdAt,
281
282
  // Preserve creation time
282
283
  updatedAt: Date.now()
283
- }, f = {
284
+ }, r = {
284
285
  ...a,
285
- [e]: l
286
+ [e]: n
286
287
  };
287
- return await this.adapter.saveWorkspacePresets(f), l;
288
+ return await this.adapter.saveWorkspacePresets(r), n;
288
289
  }
289
290
  /**
290
291
  * Delete a workspace layout
@@ -609,242 +610,301 @@ class m {
609
610
  Object.keys(e).length;
610
611
  }
611
612
  }
612
- A(m, "adapter", new N());
613
- function K(n = {}) {
614
- const { repositoryKey: e, autoInitialize: t = !1, defaultWorkspaceId: a } = n, [s, l] = R(
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
- ), [f, u] = R(null), [v, w] = R(null), [b, h] = R(!0), [y, r] = R(null), o = p(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
- h(!0), r(null);
619
- const c = await m.getWorkspaceLayouts();
620
- if (l(c), e) {
621
- let d = await m.getRepositoryState(e);
622
- if (!d && t) {
623
- const S = a || "project-management", W = await m.getWorkspaceLayout(S);
624
- W && (d = {
625
- workspaceId: S,
626
- sizes: W.defaultSizes || {
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,
627
+ sizes: v.defaultSizes || {
627
628
  left: 20,
628
629
  middle: 45,
629
630
  right: 35
630
631
  },
631
- collapsed: W.defaultCollapsed || {
632
+ collapsed: v.defaultCollapsed || {
632
633
  left: !1,
633
634
  right: !1
634
635
  }
635
- }, await m.setRepositoryState(
636
+ }, await R.setRepositoryState(
636
637
  e,
637
- d
638
+ k
638
639
  ));
639
640
  }
640
- if (u(d), d != null && d.workspaceId) {
641
- const S = await m.getWorkspaceLayout(
642
- d.workspaceId
641
+ if (l(k), k != null && k.workspaceId) {
642
+ const d = await R.getWorkspaceLayout(
643
+ k.workspaceId
643
644
  );
644
- w(S);
645
+ h(d);
645
646
  } else
646
- w(null);
647
+ h(null);
647
648
  }
648
- } catch (c) {
649
- r(c), console.error("Failed to load workspace data:", c);
649
+ } catch (x) {
650
+ p(x), console.error("Failed to load workspace data:", x);
650
651
  } finally {
651
- h(!1);
652
+ u(!1);
652
653
  }
653
654
  }, [e, t, a]);
654
655
  P(() => {
655
- o();
656
- }, [o]);
657
- const k = p(
658
- async (c) => await m.getWorkspaceLayout(c),
656
+ c();
657
+ }, [c]);
658
+ const i = m(
659
+ async (x) => await R.getWorkspaceLayout(x),
659
660
  []
660
- ), T = p(
661
- async (c) => {
662
- const d = await m.createWorkspaceLayout(c);
663
- return await o(), d;
661
+ ), w = m(
662
+ async (x) => {
663
+ const k = await R.createWorkspaceLayout(x);
664
+ return await c(), k;
664
665
  },
665
- [o]
666
- ), z = p(
667
- async (c, d) => {
668
- const S = await m.updateWorkspaceLayout(c, d);
669
- return await o(), S;
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
- [o]
672
- ), I = p(
673
- async (c) => {
674
- const d = await m.deleteWorkspaceLayout(c);
675
- return d && await o(), d;
672
+ [c]
673
+ ), A = m(
674
+ async (x) => {
675
+ const k = await R.deleteWorkspaceLayout(x);
676
+ return k && await c(), k;
676
677
  },
677
- [o]
678
- ), E = p(
679
- async (c) => {
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 d = await m.getWorkspaceLayout(c);
685
- if (!d) {
686
- console.error(`Workspace ${c} 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 S = {
690
- workspaceId: c,
691
- sizes: d.defaultSizes || { left: 20, middle: 45, right: 35 },
692
- collapsed: d.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 m.setRepositoryState(e, S), await o();
698
+ await R.setRepositoryState(e, d), await c();
698
699
  },
699
- [e, o]
700
- ), L = p(
701
- async (c) => {
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 m.updateRepositorySizes(e, c), await o();
707
+ await R.updateRepositorySizes(e, x), await c();
707
708
  },
708
- [e, o]
709
- ), x = p(
710
- async (c) => {
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 m.updateRepositoryCollapsed(
716
+ await R.updateRepositoryCollapsed(
716
717
  e,
717
- c
718
- ), await o();
718
+ x
719
+ ), await c();
719
720
  },
720
- [e, o]
721
- ), i = p(async () => {
722
- if (!e || !(f != null && f.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 m.resetRepositoryToWorkspaceDefaults(
727
+ await R.resetRepositoryToWorkspaceDefaults(
727
728
  e,
728
- f.workspaceId
729
- ), await o();
730
- }, [e, f == null ? void 0 : f.workspaceId, o]), g = p(async () => {
731
- await o();
732
- }, [o]);
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: f,
736
- activeWorkspace: v,
736
+ repositoryState: r,
737
+ activeWorkspace: y,
737
738
  loading: b,
738
- error: y,
739
- getWorkspace: k,
740
- createWorkspace: T,
741
- updateWorkspace: z,
742
- deleteWorkspace: I,
739
+ error: f,
740
+ getWorkspace: i,
741
+ createWorkspace: w,
742
+ updateWorkspace: S,
743
+ deleteWorkspace: A,
743
744
  applyWorkspace: E,
744
- updateSizes: L,
745
- updateCollapsed: x,
746
- resetToDefaults: i,
747
- refresh: g
745
+ updateSizes: F,
746
+ updateCollapsed: $,
747
+ resetToDefaults: g,
748
+ refresh: C
748
749
  };
749
750
  }
750
- function j(n = {}) {
751
+ function de(o = {}) {
751
752
  const {
752
753
  initialFocus: e = null,
753
754
  collapsed: t = {},
754
755
  panelType: a = "three-panel",
755
- onFocusChange: s
756
- } = n, [l, f] = R(
756
+ onFocusChange: s,
757
+ events: n,
758
+ getPanelId: r
759
+ } = o, [l, y] = z(
757
760
  e
758
- ), u = p(
759
- (r) => {
760
- f(r), s == null || s(r);
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({
768
+ type: "panel:blur",
769
+ source: "panel-layouts",
770
+ timestamp: Date.now(),
771
+ payload: {
772
+ panelId: A,
773
+ panelSlot: w,
774
+ nextPanelId: r(i)
775
+ }
776
+ });
777
+ }
778
+ const S = r(i);
779
+ S && n.emit({
780
+ type: "panel:focus",
781
+ source: "panel-layouts",
782
+ timestamp: Date.now(),
783
+ payload: {
784
+ panelId: S,
785
+ panelSlot: i,
786
+ source: "keyboard-shortcut"
787
+ }
788
+ });
789
+ }
761
790
  },
762
- [s]
763
- ), v = p(() => {
764
- f(null), s == null || s(null);
765
- }, [s]), w = p(() => {
766
- const r = [];
767
- return t.left || r.push("left"), r.push("middle"), a === "three-panel" && !t.right && r.push("right"), r;
768
- }, [t, a]), b = p(() => {
769
- const r = w();
770
- if (r.length === 0) return;
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({
797
+ type: "panel:blur",
798
+ source: "panel-layouts",
799
+ timestamp: Date.now(),
800
+ payload: {
801
+ panelId: w,
802
+ panelSlot: i
803
+ }
804
+ });
805
+ }
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;
771
812
  if (l === null) {
772
- u(r[0]);
813
+ h(i[0]);
773
814
  return;
774
815
  }
775
- const o = r.indexOf(l);
776
- if (o === -1) {
777
- u(r[0]);
816
+ const w = i.indexOf(l);
817
+ if (w === -1) {
818
+ h(i[0]);
778
819
  return;
779
820
  }
780
- const k = (o + 1) % r.length;
781
- u(r[k]);
782
- }, [l, w, u]), h = p(() => {
783
- const r = w();
784
- if (r.length === 0) return;
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;
785
826
  if (l === null) {
786
- u(r[r.length - 1]);
827
+ h(i[i.length - 1]);
787
828
  return;
788
829
  }
789
- const o = r.indexOf(l);
790
- if (o === -1) {
791
- u(r[r.length - 1]);
830
+ const w = i.indexOf(l);
831
+ if (w === -1) {
832
+ h(i[i.length - 1]);
792
833
  return;
793
834
  }
794
- const k = o === 0 ? r.length - 1 : o - 1;
795
- u(r[k]);
796
- }, [l, w, u]), y = p(
797
- (r) => l === r,
835
+ const S = w === 0 ? i.length - 1 : w - 1;
836
+ h(i[S]);
837
+ }, [l, u, h]), c = m(
838
+ (i) => l === i,
798
839
  [l]
799
840
  );
800
841
  return {
801
842
  focusedPanel: l,
802
- setFocus: u,
803
- clearFocus: v,
804
- focusNext: b,
805
- focusPrevious: h,
806
- isFocused: y
843
+ setFocus: h,
844
+ clearFocus: b,
845
+ focusNext: f,
846
+ focusPrevious: p,
847
+ isFocused: c
807
848
  };
808
849
  }
809
- function q(n) {
850
+ function ue(o) {
810
851
  const {
811
852
  enabled: e = !0,
812
853
  focusedPanel: t,
813
854
  collapsed: a,
814
855
  panelType: s,
815
- setFocus: l,
816
- onExpand: f,
817
- onCollapse: u
818
- } = n, v = C(t), w = C(a), b = C(s);
856
+ setFocus: n,
857
+ onExpand: r,
858
+ onCollapse: l
859
+ } = o, y = I(t), h = I(a), b = I(s);
819
860
  P(() => {
820
- v.current = t;
861
+ y.current = t;
821
862
  }, [t]), P(() => {
822
- w.current = a;
863
+ h.current = a;
823
864
  }, [a]), P(() => {
824
865
  b.current = s;
825
866
  }, [s]);
826
- const h = p(
827
- (y) => {
828
- if (!y.altKey || y.ctrlKey || y.metaKey || y.shiftKey)
867
+ const u = m(
868
+ (f) => {
869
+ if (!f.altKey || f.ctrlKey || f.metaKey || f.shiftKey)
829
870
  return;
830
- const r = y.code, o = v.current, k = w.current, T = b.current;
831
- r === "Digit1" || r === "Numpad1" ? (y.preventDefault(), k.left ? f("left") : o !== "left" ? l("left") : (u("left"), l("middle"))) : r === "Digit2" || r === "Numpad2" ? (y.preventDefault(), l("middle")) : (r === "Digit3" || r === "Numpad3") && T === "three-panel" && (y.preventDefault(), k.right ? f("right") : o !== "right" ? l("right") : (u("right"), l("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")));
832
873
  },
833
- [l, f, u]
874
+ [n, r, l]
834
875
  );
835
876
  P(() => {
836
877
  if (e)
837
- return window.addEventListener("keydown", h), () => {
838
- window.removeEventListener("keydown", h);
878
+ return window.addEventListener("keydown", u), () => {
879
+ window.removeEventListener("keydown", u);
839
880
  };
840
- }, [e, h]);
881
+ }, [e, u]);
882
+ }
883
+ function pe(o, e, t, a) {
884
+ P(() => {
885
+ const s = e.on(
886
+ "panel:focus",
887
+ (r) => {
888
+ r.payload.panelId === o && t();
889
+ }
890
+ );
891
+ let n;
892
+ return a && (n = e.on(
893
+ "panel:blur",
894
+ (r) => {
895
+ r.payload.panelId === o && a();
896
+ }
897
+ )), () => {
898
+ s(), n == null || n();
899
+ };
900
+ }, [o, e, t, a]);
841
901
  }
842
- const X = ({
843
- isFocused: n,
902
+ const fe = ({
903
+ isFocused: o,
844
904
  className: e = "",
845
905
  style: t = {}
846
906
  }) => {
847
- if (!n)
907
+ if (!o)
848
908
  return null;
849
909
  const a = {
850
910
  position: "absolute",
@@ -860,7 +920,7 @@ const X = ({
860
920
  transition: "opacity 0.15s ease-in-out",
861
921
  ...t
862
922
  };
863
- return /* @__PURE__ */ O(
923
+ return /* @__PURE__ */ T(
864
924
  "div",
865
925
  {
866
926
  className: `panel-focus-indicator ${e}`,
@@ -869,19 +929,824 @@ const X = ({
869
929
  "aria-hidden": "true"
870
930
  }
871
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
+ ] });
872
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), 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
+ }
873
1727
  export {
874
- Z as EditableConfigurablePanelLayout,
875
- X as FocusIndicator,
876
- $ as LocalStoragePersistenceAdapter,
877
- N as LocalStorageWorkspaceAdapter,
878
- G as ResponsiveConfigurablePanelLayout,
879
- m as WorkspaceLayoutService,
880
- Q as mapThemeToPanelVars,
881
- H as mapThemeToTabVars,
882
- j as usePanelFocus,
883
- q as usePanelKeyboardShortcuts,
884
- _ as usePanelPersistence,
885
- 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
886
1751
  };
887
1752
  //# sourceMappingURL=index.esm.js.map