folder-pane 4.0.1-1 → 4.1.0

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