folder-pane 4.0.1-0 → 4.0.1-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.
Files changed (110) hide show
  1. package/dist/_virtual/~icons/lucide/chevron-left.cjs.js +2 -0
  2. package/dist/_virtual/~icons/lucide/chevron-left.cjs.js.map +1 -0
  3. package/dist/_virtual/~icons/lucide/{trash-2.esm.js → chevron-left.esm.js} +4 -4
  4. package/dist/_virtual/~icons/lucide/chevron-left.esm.js.map +1 -0
  5. package/dist/accessCache.cjs.js +2 -0
  6. package/dist/accessCache.cjs.js.map +1 -0
  7. package/dist/accessCache.d.ts +37 -0
  8. package/dist/accessCache.d.ts.map +1 -0
  9. package/dist/accessCache.esm.js +34 -0
  10. package/dist/accessCache.esm.js.map +1 -0
  11. package/dist/components/folder-pane-container/FolderPaneContainer.cjs.js +38 -33
  12. package/dist/components/folder-pane-container/FolderPaneContainer.cjs.js.map +1 -1
  13. package/dist/components/folder-pane-container/FolderPaneContainer.d.ts +27 -5
  14. package/dist/components/folder-pane-container/FolderPaneContainer.d.ts.map +1 -1
  15. package/dist/components/folder-pane-container/FolderPaneContainer.esm.js +305 -189
  16. package/dist/components/folder-pane-container/FolderPaneContainer.esm.js.map +1 -1
  17. package/dist/components/folder-pane-container/FolderPaneContainer.styles.cjs.js +1 -1
  18. package/dist/components/folder-pane-container/FolderPaneContainer.styles.cjs.js.map +1 -1
  19. package/dist/components/folder-pane-container/FolderPaneContainer.styles.esm.js +1 -1
  20. package/dist/components/folder-pane-container/FolderPaneContainer.styles.esm.js.map +1 -1
  21. package/dist/components/folder-pane-content/FolderPaneContent.styles.cjs.js +1 -1
  22. package/dist/components/folder-pane-content/FolderPaneContent.styles.cjs.js.map +1 -1
  23. package/dist/components/folder-pane-content/FolderPaneContent.styles.esm.js +1 -1
  24. package/dist/components/folder-pane-content/FolderPaneContent.styles.esm.js.map +1 -1
  25. package/dist/components/folder-pane-provider/FolderPaneProvider.cjs.js +2 -0
  26. package/dist/components/folder-pane-provider/FolderPaneProvider.cjs.js.map +1 -0
  27. package/dist/components/folder-pane-provider/FolderPaneProvider.d.ts +16 -0
  28. package/dist/components/folder-pane-provider/FolderPaneProvider.d.ts.map +1 -0
  29. package/dist/components/folder-pane-provider/FolderPaneProvider.esm.js +293 -0
  30. package/dist/components/folder-pane-provider/FolderPaneProvider.esm.js.map +1 -0
  31. package/dist/components/folder-pane-provider/FolderPaneProvider.styles.cjs.js +2 -0
  32. package/dist/components/folder-pane-provider/FolderPaneProvider.styles.cjs.js.map +1 -0
  33. package/dist/components/folder-pane-provider/FolderPaneProvider.styles.esm.js +6 -0
  34. package/dist/components/folder-pane-provider/FolderPaneProvider.styles.esm.js.map +1 -0
  35. package/dist/components/folder-pane-provider/index.cjs.js +1 -0
  36. package/dist/components/folder-pane-provider/index.d.ts +2 -0
  37. package/dist/components/folder-pane-provider/index.d.ts.map +1 -0
  38. package/dist/components/folder-pane-provider/index.esm.js +1 -0
  39. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.cjs.js +18 -19
  40. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.cjs.js.map +1 -1
  41. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.d.ts +15 -2
  42. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.d.ts.map +1 -1
  43. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.esm.js +237 -108
  44. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.esm.js.map +1 -1
  45. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.cjs.js +1 -1
  46. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.cjs.js.map +1 -1
  47. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.esm.js +1 -1
  48. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.esm.js.map +1 -1
  49. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.cjs.js +32 -18
  50. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.cjs.js.map +1 -1
  51. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.d.ts +13 -2
  52. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.d.ts.map +1 -1
  53. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.esm.js +191 -84
  54. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.esm.js.map +1 -1
  55. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.cjs.js +1 -1
  56. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.cjs.js.map +1 -1
  57. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.esm.js +1 -1
  58. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.esm.js.map +1 -1
  59. package/dist/components/folder-pane-view/FolderPaneView.cjs.js +91 -28
  60. package/dist/components/folder-pane-view/FolderPaneView.cjs.js.map +1 -1
  61. package/dist/components/folder-pane-view/FolderPaneView.d.ts +36 -3
  62. package/dist/components/folder-pane-view/FolderPaneView.d.ts.map +1 -1
  63. package/dist/components/folder-pane-view/FolderPaneView.esm.js +520 -240
  64. package/dist/components/folder-pane-view/FolderPaneView.esm.js.map +1 -1
  65. package/dist/components/folder-pane-view/resourceLoad.cjs.js +2 -0
  66. package/dist/components/folder-pane-view/resourceLoad.cjs.js.map +1 -0
  67. package/dist/components/folder-pane-view/resourceLoad.d.ts +8 -0
  68. package/dist/components/folder-pane-view/resourceLoad.d.ts.map +1 -0
  69. package/dist/components/folder-pane-view/resourceLoad.esm.js +7 -0
  70. package/dist/components/folder-pane-view/resourceLoad.esm.js.map +1 -0
  71. package/dist/debug.cjs.js +2 -0
  72. package/dist/debug.cjs.js.map +1 -0
  73. package/dist/debug.d.ts +5 -0
  74. package/dist/debug.d.ts.map +1 -0
  75. package/dist/debug.esm.js +10 -0
  76. package/dist/debug.esm.js.map +1 -0
  77. package/dist/folderPane.cjs.js +2 -2
  78. package/dist/folderPane.cjs.js.map +1 -1
  79. package/dist/folderPane.d.ts +13 -0
  80. package/dist/folderPane.d.ts.map +1 -1
  81. package/dist/folderPane.esm.js +24 -13
  82. package/dist/folderPane.esm.js.map +1 -1
  83. package/dist/helpers.cjs.js +1 -1
  84. package/dist/helpers.cjs.js.map +1 -1
  85. package/dist/helpers.d.ts +12 -1
  86. package/dist/helpers.d.ts.map +1 -1
  87. package/dist/helpers.esm.js +34 -14
  88. package/dist/helpers.esm.js.map +1 -1
  89. package/dist/primitives/context.cjs.js +2 -0
  90. package/dist/primitives/context.cjs.js.map +1 -0
  91. package/dist/primitives/context.d.ts +14 -0
  92. package/dist/primitives/context.d.ts.map +1 -0
  93. package/dist/primitives/context.esm.js +6 -0
  94. package/dist/primitives/context.esm.js.map +1 -0
  95. package/dist/requestQueue.cjs.js +2 -0
  96. package/dist/requestQueue.cjs.js.map +1 -0
  97. package/dist/requestQueue.d.ts +38 -0
  98. package/dist/requestQueue.d.ts.map +1 -0
  99. package/dist/requestQueue.esm.js +77 -0
  100. package/dist/requestQueue.esm.js.map +1 -0
  101. package/dist/resourceActionItems.cjs.js +2 -0
  102. package/dist/resourceActionItems.cjs.js.map +1 -0
  103. package/dist/resourceActionItems.d.ts +20 -0
  104. package/dist/resourceActionItems.d.ts.map +1 -0
  105. package/dist/resourceActionItems.esm.js +42 -0
  106. package/dist/resourceActionItems.esm.js.map +1 -0
  107. package/package.json +12 -8
  108. package/dist/_virtual/~icons/lucide/trash-2.cjs.js +0 -2
  109. package/dist/_virtual/~icons/lucide/trash-2.cjs.js.map +0 -1
  110. package/dist/_virtual/~icons/lucide/trash-2.esm.js.map +0 -1
@@ -12,22 +12,35 @@ export default class FolderPaneSidebar extends WebComponent {
12
12
  accessor resources: ResourceMap;
13
13
  accessor expandedContainers: Set<string>;
14
14
  accessor homeExpanded: boolean;
15
- accessor expansionError: string | undefined;
15
+ private accessor activeResourceId;
16
+ private pendingFocusResourceId;
16
17
  private resourceGeneration;
18
+ private focusHomeOnUpdate;
17
19
  private loadResources;
20
+ private getVisibleResources;
21
+ private getVisibleResourceIds;
22
+ private getParentResourceId;
23
+ private getFirstChildResource;
24
+ private getNextVisibleResourceId;
25
+ private getPreviousVisibleResourceId;
26
+ private isTreeFocused;
27
+ private focusResource;
28
+ private setActiveFromFocus;
18
29
  refreshResources(container?: NamedNode): void;
19
30
  private toggleContainer;
31
+ private reportExpansionError;
20
32
  private isSelected;
21
- private isNamed;
22
33
  private getHomeResource;
23
34
  private selectResource;
24
35
  private renderRow;
25
36
  private renderItem;
37
+ private handleKeydown;
26
38
  private renderSpecialIcon;
27
39
  private renderResourceItem;
28
40
  private renderResourceGroup;
29
41
  private renderTree;
30
42
  protected willUpdate(changedProperties: PropertyValues<this>): void;
43
+ protected updated(changedProperties: PropertyValues<this>): void;
31
44
  render(): import('lit-html').TemplateResult<1>;
32
45
  }
33
46
  //# sourceMappingURL=FolderPaneSidebar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FolderPaneSidebar.d.ts","sourceRoot":"","sources":["../../../src/components/folder-pane-sidebar/FolderPaneSidebar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,YAAY,EAAE,MAAM,UAAU,CAAA;AAI7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AAEzC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAClD,OAAO,KAAK,EAAY,WAAW,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,6BAA6B,CAAA;AACpC,OAAO,4BAA4B,CAAA;AACnC,OAAO,sBAAsB,CAAA;AAC7B,OAAO,qBAAqB,CAAA;AAC5B,OAAO,uBAAuB,CAAA;AAC9B,OAAO,EAA4B,KAAK,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAKtF,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,YAAY;IACzD,MAAM,CAAC,MAAM,MAAS;IAGtB,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAA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,CAAC,kBAAkB;IAoB1B,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,UAAU;IAqBlB,SAAS,CAAC,UAAU,CAAE,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC;IAsB7D,SAAS,CAAC,OAAO,CAAE,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC;IAmB1D,MAAM;CAOP"}
@@ -1,41 +1,40 @@
1
- import { getResourcesForContainer as e } from "../../helpers.esm.js";
2
- import "../../_virtual/~icons/lucide/folder.esm.js";
3
- import "../../_virtual/~icons/lucide/globe.esm.js";
4
- import t from "./FolderPaneSidebar.styles.esm.js";
1
+ import e from "./FolderPaneSidebar.styles.esm.js";
5
2
  import "../../_virtual/~icons/lucide/chevron-right.esm.js";
6
3
  import "../../_virtual/~icons/lucide/circle-small.esm.js";
7
- import "../../_virtual/~icons/lucide/trash-2.esm.js";
8
- import { WebComponent as n, customElement as r, utils as i } from "solid-ui";
9
- import { html as a, nothing as o } from "lit";
10
- import { property as s, state as c } from "lit/decorators.js";
11
- import { repeat as l } from "lit/directives/repeat.js";
4
+ import "../../_virtual/~icons/lucide/folder.esm.js";
5
+ import { getResourcesForContainer as t } from "../../helpers.esm.js";
6
+ import { error as n } from "../../debug.esm.js";
7
+ import { WebComponent as r, customElement as i, utils as a } from "solid-ui";
8
+ import { html as o, nothing as s } from "lit";
9
+ import { property as c, state as l } from "lit/decorators.js";
10
+ import { repeat as u } from "lit/directives/repeat.js";
12
11
  // src/components/folder-pane-sidebar/FolderPaneSidebar.ts
13
- var u, d, f, p, m, h, g, _, v, y, b, x, S, C, w, T, E, D, O, k, A, j, M, N, P, F, I, L, R, z, B;
14
- function V(e, t, n) {
15
- H(e, t), t.set(e, n);
12
+ var d, f, p, m, h, g, _, v, y, b, x, S, C, w, T, E, D, O, k, A, j, M, N, P, F, I, L, R, z, B, V;
13
+ function H(e, t, n) {
14
+ U(e, t), t.set(e, n);
16
15
  }
17
- function H(e, t) {
16
+ function U(e, t) {
18
17
  if (t.has(e)) throw TypeError("Cannot initialize the same private elements twice on an object");
19
18
  }
20
- function U(e, t, n) {
21
- return e.set(G(e, t), n), n;
19
+ function W(e, t, n) {
20
+ return e.set(K(e, t), n), n;
22
21
  }
23
- function W(e, t) {
24
- return e.get(G(e, t));
22
+ function G(e, t) {
23
+ return e.get(K(e, t));
25
24
  }
26
- function G(e, t, n) {
25
+ function K(e, t, n) {
27
26
  if (typeof e == "function" ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
28
27
  throw TypeError("Private element is not present on this object");
29
28
  }
30
- function K(e, t, n) {
31
- return (t = J(t)) in e ? Object.defineProperty(e, t, {
29
+ function q(e, t, n) {
30
+ return (t = Y(t)) in e ? Object.defineProperty(e, t, {
32
31
  value: n,
33
32
  enumerable: !0,
34
33
  configurable: !0,
35
34
  writable: !0
36
35
  }) : e[t] = n, e;
37
36
  }
38
- function q(e, t, n, r, i, a) {
37
+ function J(e, t, n, r, i, a) {
39
38
  function o(e, t, n) {
40
39
  return function(r, i) {
41
40
  return n && n(r), e[t].call(r, i);
@@ -58,13 +57,13 @@ function q(e, t, n, r, i, a) {
58
57
  n || Array.isArray(_) || (_ = [_]);
59
58
  var b = {}, x = [], S = i === 3 ? "get" : i === 4 || p ? "set" : "value";
60
59
  d ? (f || p ? b = {
61
- get: X(function() {
60
+ get: Z(function() {
62
61
  return v(this);
63
62
  }, r, "get"),
64
63
  set: function(e) {
65
64
  t[4](this, e);
66
65
  }
67
- } : b[S] = v, f || X(b[S], r, i === 2 ? "" : S)) : f || (b = Object.getOwnPropertyDescriptor(e, r));
66
+ } : b[S] = v, f || Z(b[S], r, i === 2 ? "" : S)) : f || (b = Object.getOwnPropertyDescriptor(e, r));
68
67
  }
69
68
  for (var C = e, w = _.length - 1; w >= 0; w -= n ? 2 : 1) {
70
69
  var T = _[w], E = n ? _[w - 1] : void 0, D = {}, O = {
@@ -124,7 +123,7 @@ function q(e, t, n, r, i, a) {
124
123
  if (arguments.length >= 6) var d = a[Symbol.metadata || Symbol.for("Symbol.metadata")];
125
124
  var f = Object.create(d ?? null), p = function(e, t, n, r) {
126
125
  var i, a, o = [], c = function(t) {
127
- return Z(t) === e;
126
+ return Q(t) === e;
128
127
  }, u = /* @__PURE__ */ new Map();
129
128
  function d(e) {
130
129
  e && o.push(s.bind(null, e));
@@ -138,7 +137,7 @@ function q(e, t, n, r, i, a) {
138
137
  if (!0 === x || x === 3 && m !== 4 || x === 4 && m !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h);
139
138
  u.set(b, !(m > 2) || m);
140
139
  }
141
- l(v ? e : e.prototype, p, _, g ? "#" + h : J(h), m, r, v ? a ||= [] : i ||= [], o, v, g, y, m === 1, v && g ? c : n);
140
+ l(v ? e : e.prototype, p, _, g ? "#" + h : Y(h), m, r, v ? a ||= [] : i ||= [], o, v, g, y, m === 1, v && g ? c : n);
142
141
  }
143
142
  }
144
143
  return d(i), d(a), o;
@@ -151,11 +150,11 @@ function q(e, t, n, r, i, a) {
151
150
  }
152
151
  };
153
152
  }
154
- function J(e) {
155
- var t = Y(e, "string");
153
+ function Y(e) {
154
+ var t = X(e, "string");
156
155
  return typeof t == "symbol" ? t : t + "";
157
156
  }
158
- function Y(e, t) {
157
+ function X(e, t) {
159
158
  if (typeof e != "object" || !e) return e;
160
159
  var n;
161
160
  if (typeof Symbol < "u" && (n = e[Symbol.toPrimitive]) !== void 0) {
@@ -165,7 +164,7 @@ function Y(e, t) {
165
164
  }
166
165
  return (t === "string" ? String : Number)(e);
167
166
  }
168
- function X(e, t, n) {
167
+ function Z(e, t, n) {
169
168
  typeof t == "symbol" && (t = (t = t.description) ? "[" + t + "]" : "");
170
169
  try {
171
170
  Object.defineProperty(e, "name", {
@@ -175,69 +174,130 @@ function X(e, t, n) {
175
174
  } catch {}
176
175
  return e;
177
176
  }
178
- function Z(e) {
177
+ function Q(e) {
179
178
  if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (e === null ? "null" : typeof e));
180
179
  return e;
181
180
  }
182
- function Q(e) {
181
+ function ee(e) {
183
182
  return e;
184
183
  }
185
- S = [r("folder-pane-sidebar")];
184
+ C = [i("folder-pane-sidebar")];
186
185
  var $;
187
- new (z = (f = /*#__PURE__*/ new WeakMap(), p = /*#__PURE__*/ new WeakMap(), m = /*#__PURE__*/ new WeakMap(), h = /*#__PURE__*/ new WeakMap(), g = /*#__PURE__*/ new WeakMap(), _ = /*#__PURE__*/ new WeakMap(), v = /*#__PURE__*/ new WeakMap(), y = /*#__PURE__*/ new WeakMap(), B = (C = s({ attribute: !1 }), T = s({ attribute: !1 }), D = s({ attribute: !1 }), k = s({ attribute: !1 }), j = c(), N = c(), F = c(), L = c(), "store"), d = class extends n {
186
+ new (B = (p = /*#__PURE__*/ new WeakMap(), m = /*#__PURE__*/ new WeakMap(), h = /*#__PURE__*/ new WeakMap(), g = /*#__PURE__*/ new WeakMap(), _ = /*#__PURE__*/ new WeakMap(), v = /*#__PURE__*/ new WeakMap(), y = /*#__PURE__*/ new WeakMap(), b = /*#__PURE__*/ new WeakMap(), V = (w = c({ attribute: !1 }), E = c({ attribute: !1 }), O = c({ attribute: !1 }), A = c({ attribute: !1 }), M = l(), P = l(), I = l(), R = l(), "store"), f = class extends r {
188
187
  constructor(...e) {
189
- super(...e), V(this, f, (b(this), w(this, null))), V(this, p, E(this, void 0)), V(this, m, O(this, null)), V(this, h, A(this, void 0)), V(this, g, M(this, /* @__PURE__ */ new Map())), V(this, _, P(this, /* @__PURE__ */ new Set())), V(this, v, I(this, !0)), V(this, y, R(this, void 0)), K(this, "resourceGeneration", 0);
188
+ super(...e), H(this, p, (x(this), T(this, null))), H(this, m, D(this, void 0)), H(this, h, k(this, null)), H(this, g, j(this, void 0)), H(this, _, N(this, /* @__PURE__ */ new Map())), H(this, v, F(this, /* @__PURE__ */ new Set())), H(this, y, L(this, !0)), H(this, b, z(this, null)), q(this, "pendingFocusResourceId", null), q(this, "resourceGeneration", 0), q(this, "focusHomeOnUpdate", !1);
190
189
  }
191
- get [B]() {
192
- return W(f, this);
190
+ get [V]() {
191
+ return G(p, this);
193
192
  }
194
193
  set store(e) {
195
- U(f, this, e);
194
+ W(p, this, e);
196
195
  }
197
196
  get subject() {
198
- return W(p, this);
197
+ return G(m, this);
199
198
  }
200
199
  set subject(e) {
201
- U(p, this, e);
200
+ W(m, this, e);
202
201
  }
203
202
  get resourceLogic() {
204
- return W(m, this);
203
+ return G(h, this);
205
204
  }
206
205
  set resourceLogic(e) {
207
- U(m, this, e);
206
+ W(h, this, e);
208
207
  }
209
208
  get selectedResource() {
210
- return W(h, this);
209
+ return G(g, this);
211
210
  }
212
211
  set selectedResource(e) {
213
- U(h, this, e);
212
+ W(g, this, e);
214
213
  }
215
214
  get resources() {
216
- return W(g, this);
215
+ return G(_, this);
217
216
  }
218
217
  set resources(e) {
219
- U(g, this, e);
218
+ W(_, this, e);
220
219
  }
221
220
  get expandedContainers() {
222
- return W(_, this);
221
+ return G(v, this);
223
222
  }
224
223
  set expandedContainers(e) {
225
- U(_, this, e);
224
+ W(v, this, e);
226
225
  }
227
226
  get homeExpanded() {
228
- return W(v, this);
227
+ return G(y, this);
229
228
  }
230
229
  set homeExpanded(e) {
231
- U(v, this, e);
230
+ W(y, this, e);
232
231
  }
233
- get expansionError() {
234
- return W(y, this);
232
+ get activeResourceId() {
233
+ return G(b, this);
235
234
  }
236
- set expansionError(e) {
237
- U(y, this, e);
235
+ set activeResourceId(e) {
236
+ W(b, this, e);
238
237
  }
239
238
  loadResources() {
240
- this.resourceGeneration++, !this.store || !this.subject ? (this.resources = /* @__PURE__ */ new Map(), this.expandedContainers = /* @__PURE__ */ new Set()) : this.resources = e(this.subject, this.resourceLogic);
239
+ let e = this.isTreeFocused(), n = new Map(this.getVisibleResources().map((e) => [e.id, e])), r = this.activeResourceId;
240
+ if (this.resourceGeneration++, !this.store || !this.subject) {
241
+ this.resources = /* @__PURE__ */ new Map(), this.expandedContainers = /* @__PURE__ */ new Set(), this.activeResourceId = null;
242
+ return;
243
+ }
244
+ this.resources = t(this.subject, this.resourceLogic);
245
+ let i = this.getVisibleResourceIds();
246
+ if (r && !i.includes(r)) {
247
+ let e = n.get(r), t = null;
248
+ for (; e;) {
249
+ let r = this.getParentResourceId(e);
250
+ if (r && i.includes(r)) {
251
+ t = r;
252
+ break;
253
+ }
254
+ e = r ? n.get(r) : void 0;
255
+ }
256
+ this.activeResourceId = t ?? this.getHomeResource()?.id ?? null;
257
+ }
258
+ e && this.activeResourceId && (this.pendingFocusResourceId = this.activeResourceId);
259
+ }
260
+ getVisibleResources() {
261
+ let e = this.getHomeResource();
262
+ if (!e) return [];
263
+ let n = [e], r = (i) => {
264
+ let a = i.id === e.id ? this.homeExpanded : this.expandedContainers.has(i.id);
265
+ if (!i.isContainer || !a) return;
266
+ let o = i.id === e.id ? [...this.resources.values()] : [...t(i.subject, this.resourceLogic).values()];
267
+ for (let e of o) n.push(e), r(e);
268
+ };
269
+ return r(e), n;
270
+ }
271
+ getVisibleResourceIds() {
272
+ return this.getVisibleResources().map((e) => e.id);
273
+ }
274
+ getParentResourceId(e) {
275
+ return e.parentId ?? this.getHomeResource()?.id ?? null;
276
+ }
277
+ getFirstChildResource(e) {
278
+ return e.isContainer ? (e.id === this.getHomeResource()?.id ? [...this.resources.values()] : [...t(e.subject, this.resourceLogic).values()])[0] ?? null : null;
279
+ }
280
+ getNextVisibleResourceId(e) {
281
+ let t = this.getVisibleResourceIds();
282
+ return t[t.indexOf(e) + 1] ?? null;
283
+ }
284
+ getPreviousVisibleResourceId(e) {
285
+ let t = this.getVisibleResourceIds();
286
+ return t[t.indexOf(e) - 1] ?? null;
287
+ }
288
+ isTreeFocused() {
289
+ let e = this.renderRoot?.querySelector("[role=\"tree\"]"), t = this.renderRoot?.activeElement ?? document.activeElement;
290
+ return !!e && (e.contains(t) || document.activeElement === this);
291
+ }
292
+ async focusResource(e, t = !0, n = !1) {
293
+ if (!e || !n && !this.isTreeFocused()) return;
294
+ this.activeResourceId = e, await this.updateComplete;
295
+ let r = Array.from(this.renderRoot.querySelectorAll("[role=\"treeitem\"]")).find((t) => t.dataset.resourceId === e);
296
+ r?.isConnected ? (n || this.isTreeFocused()) && (this.pendingFocusResourceId = e, r.focus(), this.pendingFocusResourceId = null, t && typeof r.scrollIntoView == "function" && r.scrollIntoView({ block: "nearest" })) : this.pendingFocusResourceId = null;
297
+ }
298
+ setActiveFromFocus(e) {
299
+ let t = e.target.closest("[role=\"treeitem\"]");
300
+ this.pendingFocusResourceId && t?.dataset.resourceId !== this.pendingFocusResourceId || t && this.renderRoot?.activeElement && this.renderRoot.activeElement !== t || t?.dataset.resourceId && (this.activeResourceId = t.dataset.resourceId);
241
301
  }
242
302
  refreshResources(e) {
243
303
  if (this.loadResources(), !e || !this.subject || e.sameTerm(this.subject)) return;
@@ -252,24 +312,43 @@ new (z = (f = /*#__PURE__*/ new WeakMap(), p = /*#__PURE__*/ new WeakMap(), m =
252
312
  }
253
313
  async toggleContainer(e) {
254
314
  if (!e.isContainer) return;
255
- let t = this.resourceGeneration, n = new Set(this.expandedContainers);
256
- if (n.has(e.id)) n.delete(e.id), this.expandedContainers = n;
315
+ let n = this.resourceGeneration, r = this.subject, i = this.store, a = this.resourceLogic, o = this.isTreeFocused(), s = new Set(this.expandedContainers);
316
+ if (s.has(e.id)) {
317
+ s.delete(e.id), this.expandedContainers = s;
318
+ return;
319
+ }
320
+ let c = this.store?.fetcher;
321
+ if (!c) this.reportExpansionError(e);
257
322
  else {
258
323
  try {
259
- await this.store?.fetcher?.load(e.subject);
324
+ await c.load(e.subject);
260
325
  } catch (t) {
261
- console.error("Unable to expand storage container", t), this.expansionError = `Unable to load ${i.label(e.subject)}. Try expanding it again.`;
326
+ if (n !== this.resourceGeneration || this.subject !== r || this.store !== i || this.resourceLogic !== a) return;
327
+ this.reportExpansionError(e, t);
262
328
  return;
263
329
  }
264
- t === this.resourceGeneration && (this.expansionError = void 0, this.expandedContainers = new Set(this.expandedContainers).add(e.id));
330
+ if (n === this.resourceGeneration && this.subject === r && this.store === i && this.resourceLogic === a && this.getVisibleResources().some((t) => t.id === e.id && t.subject.sameTerm(e.subject)) && (this.store && this.subject && (this.resources = t(this.subject, this.resourceLogic)), this.expandedContainers = new Set(this.expandedContainers).add(e.id), o && this.activeResourceId === e.id && this.isTreeFocused())) {
331
+ if (await this.updateComplete, this.activeResourceId !== e.id || !this.isTreeFocused()) return;
332
+ await this.focusResource(e.id, !1, !0);
333
+ }
265
334
  }
266
335
  }
336
+ reportExpansionError(e, t) {
337
+ t && n("Unable to expand storage container", t), this.dispatchEvent(new CustomEvent("folder-pane-resource-error", {
338
+ detail: {
339
+ title: `Unable to load ${a.label(e.subject)}`,
340
+ message: "Try expanding the folder again.",
341
+ retry: () => {
342
+ this.toggleContainer(e);
343
+ }
344
+ },
345
+ bubbles: !0,
346
+ composed: !0
347
+ }));
348
+ }
267
349
  isSelected(e) {
268
350
  return e ? this.selectedResource?.sameTerm(e.subject) ?? !1 : !1;
269
351
  }
270
- isNamed(e, t) {
271
- return i.label(e.subject).toLowerCase() === t;
272
- }
273
352
  getHomeResource() {
274
353
  return this.subject ? {
275
354
  id: this.subject.value,
@@ -285,28 +364,24 @@ new (z = (f = /*#__PURE__*/ new WeakMap(), p = /*#__PURE__*/ new WeakMap(), m =
285
364
  composed: !0
286
365
  }));
287
366
  }
288
- renderRow(e, t, n, r, i, o = !1) {
289
- let s = e.isContainer ? a`
367
+ renderRow(e, t, n, r, i, a = !1) {
368
+ let s = e.isContainer ? o`
290
369
  <button
291
370
  class="resource-expand-button"
292
371
  type="button"
293
372
  tabindex="-1"
294
373
  aria-label=${r ? `Collapse ${t}` : `Expand ${t}`}
295
- @click=${(e) => {
296
- e.preventDefault(), e.stopPropagation(), i();
374
+ @click=${(t) => {
375
+ t.preventDefault(), t.stopPropagation(), this.focusResource(e.id, !1).then(i);
297
376
  }}
298
377
  >
299
378
  <icon-lucide-chevron-right></icon-lucide-chevron-right>
300
379
  </button>
301
- ` : a`<span class="resource-expand-spacer" aria-hidden="true"></span>`;
302
- return a`
380
+ ` : o`<span class="resource-expand-spacer" aria-hidden="true"></span>`;
381
+ return o`
303
382
  <div
304
- class=${o ? "resource-row resource-row-special" : "resource-row"}
305
- tabindex="0"
383
+ class=${a ? "resource-row resource-row-special" : "resource-row"}
306
384
  @click=${() => this.selectResource(e)}
307
- @keydown=${(t) => {
308
- t.key === "Enter" || t.key === " " ? (t.preventDefault(), this.selectResource(e)) : e.isContainer && (t.key === "ArrowRight" || t.key === "ArrowLeft") && t.key === "ArrowRight" !== r && (t.preventDefault(), i());
309
- }}
310
385
  >
311
386
  ${s}
312
387
  ${n}
@@ -314,116 +389,170 @@ new (z = (f = /*#__PURE__*/ new WeakMap(), p = /*#__PURE__*/ new WeakMap(), m =
314
389
  </div>
315
390
  `;
316
391
  }
317
- renderItem(e, t, n, r, i, s, c = !1) {
392
+ renderItem(e, t, n, r, i, a, c = !1) {
318
393
  let l = this.isSelected(e);
319
- return a`
394
+ return o`
320
395
  <li
321
396
  class=${l ? "resource-item selected" : "resource-item"}
322
397
  notSelectable="false"
323
398
  role="treeitem"
399
+ tabindex=${this.activeResourceId === e.id || this.activeResourceId === null && e.id === this.getHomeResource()?.id ? "0" : "-1"}
400
+ data-resource-id=${e.id}
324
401
  aria-label=${t}
325
402
  aria-selected=${String(l)}
326
- aria-expanded=${e.isContainer ? String(r) : o}
403
+ aria-expanded=${e.isContainer ? String(r) : s}
327
404
  data-expanded=${String(r)}
328
405
  about=${e.subject.toNT()}
329
406
  .subject=${e.subject}
407
+ @focusin=${this.setActiveFromFocus}
408
+ @keydown=${(t) => this.handleKeydown(t, e, r, i)}
330
409
  >
331
410
  ${this.renderRow(e, t, n, r, i, c)}
332
- ${r ? s : o}
411
+ ${r ? a : s}
333
412
  </li>
334
413
  `;
335
414
  }
415
+ handleKeydown(e, t, n, r) {
416
+ if (e.target.closest("[role=\"treeitem\"]") !== e.currentTarget || ![
417
+ "ArrowDown",
418
+ "ArrowUp",
419
+ "Home",
420
+ "End",
421
+ "ArrowRight",
422
+ "ArrowLeft",
423
+ "Enter",
424
+ " "
425
+ ].includes(e.key)) return;
426
+ e.stopPropagation();
427
+ let i = e.currentTarget.dataset.resourceId ?? t.id, a = this.getVisibleResources().find((e) => e.id === i);
428
+ a && (t = a, n = t.id === this.getHomeResource()?.id ? this.homeExpanded : this.expandedContainers.has(t.id), r = () => {
429
+ t.id === this.getHomeResource()?.id ? this.homeExpanded = !this.homeExpanded : this.toggleContainer(t);
430
+ }), this.activeResourceId = i;
431
+ let o = (t) => {
432
+ t && (e.preventDefault(), this.activeResourceId = t, this.focusResource(t, !0, !0));
433
+ };
434
+ switch (e.key) {
435
+ case "ArrowDown":
436
+ o(this.getNextVisibleResourceId(t.id));
437
+ break;
438
+ case "ArrowUp":
439
+ o(this.getPreviousVisibleResourceId(t.id));
440
+ break;
441
+ case "Home":
442
+ o(this.getVisibleResourceIds()[0] ?? null);
443
+ break;
444
+ case "End":
445
+ o(this.getVisibleResourceIds().slice(-1)[0] ?? null);
446
+ break;
447
+ case "ArrowRight":
448
+ if (!t.isContainer) break;
449
+ n ? o(this.getFirstChildResource(t)?.id ?? null) : (e.preventDefault(), r());
450
+ break;
451
+ case "ArrowLeft":
452
+ t.isContainer && n ? (e.preventDefault(), this.focusResource(t.id, !1, !0).then(r)) : o(this.getParentResourceId(t));
453
+ break;
454
+ case "Enter":
455
+ case " ": e.preventDefault(), this.selectResource(t);
456
+ }
457
+ }
336
458
  renderSpecialIcon(e) {
337
- return e === "globe" ? a`<icon-lucide-globe></icon-lucide-globe>` : e === "trash" ? a`<icon-lucide-trash-2></icon-lucide-trash-2>` : a`<icon-lucide-folder></icon-lucide-folder>`;
459
+ return o`<icon-lucide-folder></icon-lucide-folder>`;
338
460
  }
339
- renderResourceItem(t, n = i.label(t.subject), r) {
340
- let s = this.expandedContainers.has(t.id), c = t.isContainer && s ? this.renderResourceGroup(e(t.subject, this.resourceLogic)) : o, l = r ? this.renderSpecialIcon(r) : a`<icon-lucide-circle-small></icon-lucide-circle-small>`;
341
- return this.renderItem(t, n, l, s, () => {
342
- this.toggleContainer(t);
461
+ renderResourceItem(e, n = a.label(e.subject), r) {
462
+ let i = this.expandedContainers.has(e.id), c = e.isContainer && i ? this.renderResourceGroup(t(e.subject, this.resourceLogic)) : s, l = r ? this.renderSpecialIcon(r) : o`<icon-lucide-circle-small></icon-lucide-circle-small>`;
463
+ return this.renderItem(e, n, l, i, () => {
464
+ this.toggleContainer(e);
343
465
  }, c, !!r);
344
466
  }
345
467
  renderResourceGroup(e) {
346
468
  let t = Array.isArray(e) ? e : [...e.values()];
347
- return a`
469
+ return t.length === 0 ? s : o`
348
470
  <ul role="group" class="resource-group">
349
- ${l(t, (e) => e.id, (e) => this.renderResourceItem(e))}
471
+ ${u(t, (e) => e.id, (e) => this.renderResourceItem(e))}
350
472
  </ul>
351
473
  `;
352
474
  }
353
475
  renderTree() {
354
476
  let e = this.getHomeResource();
355
- if (!e) return o;
356
- let t = [...this.resources.values()], n = (e) => {
357
- let n = t.findIndex((t) => this.isNamed(t, e));
358
- return n >= 0 ? t.splice(n, 1)[0] : null;
359
- }, r = n("public"), i = n("trash");
360
- return a`
477
+ if (!e) return s;
478
+ let t = [...this.resources.values()];
479
+ return o`
361
480
  <ul role="tree" class="resource-tree" aria-label="Storage resources">
362
481
  ${this.renderItem(e, "Home", this.renderSpecialIcon("folder"), this.homeExpanded, () => {
363
482
  this.homeExpanded = !this.homeExpanded;
364
483
  }, this.renderResourceGroup(t), !0)}
365
- ${r ? this.renderResourceItem(r, "Public", "globe") : o}
366
- ${i ? this.renderResourceItem(i, "Trash", "trash") : o}
367
484
  </ul>
368
485
  `;
369
486
  }
370
487
  willUpdate(e) {
371
- super.willUpdate(e), e.has("subject") && (this.expandedContainers = /* @__PURE__ */ new Set(), this.homeExpanded = !0), (e.has("store") || e.has("subject") || e.has("resourceLogic")) && this.loadResources();
488
+ if (super.willUpdate(e), this.pendingFocusResourceId && !this.isTreeFocused() && (this.pendingFocusResourceId = null), e.has("subject")) {
489
+ let t = this.isTreeFocused();
490
+ this.focusHomeOnUpdate = !!this.subject && (t || e.get("subject") === void 0), this.expandedContainers = /* @__PURE__ */ new Set(), this.homeExpanded = !0, this.activeResourceId = this.subject?.value ?? null;
491
+ }
492
+ (e.has("store") || e.has("subject") || e.has("resourceLogic")) && this.loadResources();
493
+ }
494
+ updated(e) {
495
+ if (super.updated(e), this.focusHomeOnUpdate) {
496
+ let e = this.renderRoot.querySelector("[role=\"treeitem\"]");
497
+ e && (this.focusHomeOnUpdate = !1, e.focus(), this.pendingFocusResourceId = null);
498
+ } else if (this.pendingFocusResourceId) {
499
+ let e = Array.from(this.renderRoot.querySelectorAll("[role=\"treeitem\"]")).find((e) => e.dataset.resourceId === this.pendingFocusResourceId);
500
+ e?.isConnected && e.focus(), this.pendingFocusResourceId = null;
501
+ }
372
502
  }
373
503
  render() {
374
- return a`
504
+ return o`
375
505
  <aside>
376
- ${this.expansionError ? a`<div class="folder-pane-sidebar-error" role="alert">${this.expansionError}</div>` : o}
377
506
  ${this.renderTree()}
378
507
  </aside>
379
508
  `;
380
509
  }
381
- }, {e: [w, E, O, A, M, P, I, R, b], c: [$, x]} = q(d, [
510
+ }, {e: [T, D, k, j, N, F, L, z, x], c: [$, S]} = J(f, [
382
511
  [
383
- C,
512
+ w,
384
513
  1,
385
514
  "store"
386
515
  ],
387
516
  [
388
- T,
517
+ E,
389
518
  1,
390
519
  "subject"
391
520
  ],
392
521
  [
393
- D,
522
+ O,
394
523
  1,
395
524
  "resourceLogic"
396
525
  ],
397
526
  [
398
- k,
527
+ A,
399
528
  1,
400
529
  "selectedResource"
401
530
  ],
402
531
  [
403
- j,
532
+ M,
404
533
  1,
405
534
  "resources"
406
535
  ],
407
536
  [
408
- N,
537
+ P,
409
538
  1,
410
539
  "expandedContainers"
411
540
  ],
412
541
  [
413
- F,
542
+ I,
414
543
  1,
415
544
  "homeExpanded"
416
545
  ],
417
546
  [
418
- L,
547
+ R,
419
548
  1,
420
- "expansionError"
549
+ "activeResourceId"
421
550
  ]
422
- ], S, 0, void 0, n), d), u = class extends Q {
551
+ ], C, 0, void 0, r), f), d = class extends ee {
423
552
  constructor() {
424
- super($), K(this, "styles", t), x();
553
+ super($), q(this, "styles", e), S();
425
554
  }
426
- }, K(u, z, void 0), u)();
555
+ }, q(d, B, void 0), d)();
427
556
  export { $ as default };
428
557
 
429
558
  //# sourceMappingURL=FolderPaneSidebar.esm.js.map