@64mb/freelens-power 2.21.5 → 2.21.6
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/main.js +89 -12
- package/dist/main.js.map +1 -1
- package/dist/renderer.js +61 -7
- package/dist/renderer.js.map +1 -1
- package/package.json +1 -1
package/dist/renderer.js
CHANGED
|
@@ -7319,6 +7319,7 @@ var PowerPreferencesStore = class extends Common.Store.ExtensionStore {
|
|
|
7319
7319
|
checkUpdates = true;
|
|
7320
7320
|
nodeBulkActions = true;
|
|
7321
7321
|
hotbarShortcuts = true;
|
|
7322
|
+
hotbarItemShortcuts = true;
|
|
7322
7323
|
constructor() {
|
|
7323
7324
|
super({
|
|
7324
7325
|
configName: "power-preferences",
|
|
@@ -7326,14 +7327,16 @@ var PowerPreferencesStore = class extends Common.Store.ExtensionStore {
|
|
|
7326
7327
|
enabled: true,
|
|
7327
7328
|
checkUpdates: true,
|
|
7328
7329
|
nodeBulkActions: true,
|
|
7329
|
-
hotbarShortcuts: true
|
|
7330
|
+
hotbarShortcuts: true,
|
|
7331
|
+
hotbarItemShortcuts: true
|
|
7330
7332
|
}
|
|
7331
7333
|
});
|
|
7332
7334
|
makeObservable(this, {
|
|
7333
7335
|
enabled: observable,
|
|
7334
7336
|
checkUpdates: observable,
|
|
7335
7337
|
nodeBulkActions: observable,
|
|
7336
|
-
hotbarShortcuts: observable
|
|
7338
|
+
hotbarShortcuts: observable,
|
|
7339
|
+
hotbarItemShortcuts: observable
|
|
7337
7340
|
});
|
|
7338
7341
|
}
|
|
7339
7342
|
fromStore(data) {
|
|
@@ -7341,13 +7344,15 @@ var PowerPreferencesStore = class extends Common.Store.ExtensionStore {
|
|
|
7341
7344
|
this.checkUpdates = data.checkUpdates !== false;
|
|
7342
7345
|
this.nodeBulkActions = data.nodeBulkActions !== false;
|
|
7343
7346
|
this.hotbarShortcuts = data.hotbarShortcuts !== false;
|
|
7347
|
+
this.hotbarItemShortcuts = data.hotbarItemShortcuts !== false;
|
|
7344
7348
|
}
|
|
7345
7349
|
toJSON() {
|
|
7346
7350
|
return {
|
|
7347
7351
|
enabled: this.enabled,
|
|
7348
7352
|
checkUpdates: this.checkUpdates,
|
|
7349
7353
|
nodeBulkActions: this.nodeBulkActions,
|
|
7350
|
-
hotbarShortcuts: this.hotbarShortcuts
|
|
7354
|
+
hotbarShortcuts: this.hotbarShortcuts,
|
|
7355
|
+
hotbarItemShortcuts: this.hotbarItemShortcuts
|
|
7351
7356
|
};
|
|
7352
7357
|
}
|
|
7353
7358
|
};
|
|
@@ -21241,7 +21246,7 @@ function startExtensionUpdateNotifications() {
|
|
|
21241
21246
|
};
|
|
21242
21247
|
const started = () => {
|
|
21243
21248
|
attempt = {
|
|
21244
|
-
version: current?.installedVersion ?? "2.21.
|
|
21249
|
+
version: current?.installedVersion ?? "2.21.6",
|
|
21245
21250
|
startedAt: Date.now()
|
|
21246
21251
|
};
|
|
21247
21252
|
try {
|
|
@@ -26738,9 +26743,11 @@ function startHotbarName() {
|
|
|
26738
26743
|
let count = 0;
|
|
26739
26744
|
let stopped = false;
|
|
26740
26745
|
let refreshing = false;
|
|
26746
|
+
const numbers = /* @__PURE__ */ new Map();
|
|
26741
26747
|
const owned = /* @__PURE__ */ new Map();
|
|
26742
26748
|
const style = document.createElement("style");
|
|
26743
26749
|
style.textContent = `[data-power-hotbar-name]{position:relative;z-index:1;flex-shrink:0;width:100%;min-width:0;padding:6px;box-sizing:border-box;text-align:center;color:var(--settingsColor);font-size:10px;line-height:16px}[data-power-hotbar-name] span{display:block;padding:1px 4px;border:1px solid var(--borderColor);border-radius:4px;background:var(--secondaryBackground);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}`;
|
|
26750
|
+
style.textContent += "[data-power-hotbar-numbered]{position:relative}[data-power-hotbar-number]{position:absolute;right:1px;top:1px;z-index:3;display:grid;place-items:center;min-width:12px;height:12px;padding:0 2px;box-sizing:border-box;border:1px solid var(--borderColor);border-radius:3px;background:var(--mainBackground);color:var(--textColorAccent);font:500 8px/10px system-ui;pointer-events:none}";
|
|
26744
26751
|
document.head.append(style);
|
|
26745
26752
|
const remove = (selector) => {
|
|
26746
26753
|
const entry = owned.get(selector);
|
|
@@ -26750,6 +26757,26 @@ function startHotbarName() {
|
|
|
26750
26757
|
owned.delete(selector);
|
|
26751
26758
|
};
|
|
26752
26759
|
const update = () => {
|
|
26760
|
+
const icons = preferences.hotbarItemShortcuts !== false ? Array.from(document.querySelectorAll(".HotbarMenu [id^=\"hotbarIcon-\"]")).slice(0, 9) : [];
|
|
26761
|
+
for (const [icon, badge] of numbers) {
|
|
26762
|
+
if (icons.includes(icon)) continue;
|
|
26763
|
+
badge.remove();
|
|
26764
|
+
icon.removeAttribute("data-power-hotbar-numbered");
|
|
26765
|
+
numbers.delete(icon);
|
|
26766
|
+
}
|
|
26767
|
+
icons.forEach((icon, index) => {
|
|
26768
|
+
let badge = numbers.get(icon);
|
|
26769
|
+
if (!badge) {
|
|
26770
|
+
badge = document.createElement("span");
|
|
26771
|
+
badge.setAttribute("data-power-hotbar-number", "");
|
|
26772
|
+
badge.setAttribute("aria-hidden", "true");
|
|
26773
|
+
numbers.set(icon, badge);
|
|
26774
|
+
icon.setAttribute("data-power-hotbar-numbered", "");
|
|
26775
|
+
}
|
|
26776
|
+
const label = String(index + 1);
|
|
26777
|
+
if (badge.textContent !== label) badge.textContent = label;
|
|
26778
|
+
if (badge.parentElement !== icon) icon.append(badge);
|
|
26779
|
+
});
|
|
26753
26780
|
const targets = /* @__PURE__ */ new Set();
|
|
26754
26781
|
for (const badge of count > 1 ? document.querySelectorAll(`.HotbarMenu [data-testid^="${prefix}"]`) : []) {
|
|
26755
26782
|
const selector = badge.closest("[class*=\"HotbarSelector\"]");
|
|
@@ -26802,15 +26829,25 @@ function startHotbarName() {
|
|
|
26802
26829
|
});
|
|
26803
26830
|
refreshCount();
|
|
26804
26831
|
const keydown = (event) => {
|
|
26805
|
-
if (preferences.hotbarShortcuts === false) return;
|
|
26806
26832
|
const mac = /Mac|iPhone|iPad/.test(navigator.platform);
|
|
26807
|
-
|
|
26833
|
+
const itemShortcut = !event.metaKey && !event.ctrlKey;
|
|
26834
|
+
if ((itemShortcut ? preferences.hotbarItemShortcuts : preferences.hotbarShortcuts) === false) return;
|
|
26835
|
+
if (event.defaultPrevented || event.repeat || event.isComposing || event.altKey || event.shiftKey || !itemShortcut && (mac ? !event.metaKey || event.ctrlKey : !event.ctrlKey || event.metaKey)) return;
|
|
26808
26836
|
const digit = /^Digit([1-9])$/.exec(event.code);
|
|
26809
26837
|
if (!digit) return;
|
|
26810
26838
|
const editable = "input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"textbox\"], [role=\"combobox\"], .monaco-editor, .xterm, .cm-editor, .CodeMirror";
|
|
26811
|
-
if (!(event.target instanceof HTMLInputElement && event.target.matches("[data-testid^=\"catalog-list-for-\"] > .header .SearchInput input")) && event.composedPath().some((node) => node instanceof Element && node.closest(editable))) return;
|
|
26839
|
+
if (!(!itemShortcut && event.target instanceof HTMLInputElement && event.target.matches("[data-testid^=\"catalog-list-for-\"] > .header .SearchInput input")) && event.composedPath().some((node) => node instanceof Element && node.closest(editable))) return;
|
|
26812
26840
|
if (document.querySelector(".Dialog.modal, [aria-modal=\"true\"], .SettingLayout, [class*=\"command-container-module__CommandContainer--\"]")) return;
|
|
26813
26841
|
const target = Number(digit[1]);
|
|
26842
|
+
if (itemShortcut) {
|
|
26843
|
+
if (document.querySelector(".Menu.portal, .HotbarMenu .isDragging")) return;
|
|
26844
|
+
const icon = document.querySelectorAll(".HotbarMenu [id^=\"hotbarIcon-\"]")[target - 1];
|
|
26845
|
+
if (!icon || icon.matches("[aria-disabled=\"true\"], [disabled], [class*=\"disabled\"]")) return;
|
|
26846
|
+
event.preventDefault();
|
|
26847
|
+
event.stopPropagation();
|
|
26848
|
+
icon.click();
|
|
26849
|
+
return;
|
|
26850
|
+
}
|
|
26814
26851
|
const badge = document.querySelector(".HotbarMenu [data-testid^=\"hotbar-menu-badge-for-\"]");
|
|
26815
26852
|
const current = Number(badge?.textContent?.trim());
|
|
26816
26853
|
const arrows = (badge?.closest("[class*=\"HotbarSelector\"]"))?.querySelectorAll(":scope > .Icon");
|
|
@@ -26821,11 +26858,18 @@ function startHotbarName() {
|
|
|
26821
26858
|
for (let step = 0; step < Math.abs(target - current); step++) arrow.click();
|
|
26822
26859
|
};
|
|
26823
26860
|
document.addEventListener("keydown", keydown);
|
|
26861
|
+
const stopItemPreference = reaction(() => preferences.hotbarItemShortcuts, update, { fireImmediately: true });
|
|
26824
26862
|
const timer = setInterval(() => void refreshCount(), 2e3);
|
|
26825
26863
|
return () => {
|
|
26826
26864
|
stopped = true;
|
|
26827
26865
|
document.removeEventListener("keydown", keydown);
|
|
26828
26866
|
clearInterval(timer);
|
|
26867
|
+
stopItemPreference();
|
|
26868
|
+
for (const [icon, badge] of numbers) {
|
|
26869
|
+
badge.remove();
|
|
26870
|
+
icon.removeAttribute("data-power-hotbar-numbered");
|
|
26871
|
+
}
|
|
26872
|
+
numbers.clear();
|
|
26829
26873
|
observer.disconnect();
|
|
26830
26874
|
for (const selector of owned.keys()) remove(selector);
|
|
26831
26875
|
style.remove();
|
|
@@ -41300,6 +41344,16 @@ var OtherPreferences = observer(() => {
|
|
|
41300
41344
|
className: "power-settings-hint",
|
|
41301
41345
|
children: "Switch panels with Cmd+1-9 on macOS or Ctrl+1-9 on Windows and Linux."
|
|
41302
41346
|
})] }),
|
|
41347
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx$1(Renderer$1.Component.Switch, {
|
|
41348
|
+
checked: preferences.hotbarItemShortcuts,
|
|
41349
|
+
onChange: (value) => {
|
|
41350
|
+
preferences.hotbarItemShortcuts = value;
|
|
41351
|
+
},
|
|
41352
|
+
children: "Hotbar item shortcuts"
|
|
41353
|
+
}), /* @__PURE__ */ jsx$1("div", {
|
|
41354
|
+
className: "power-settings-hint",
|
|
41355
|
+
children: "Show number badges and open hotbar items with 1-9 outside input fields."
|
|
41356
|
+
})] }),
|
|
41303
41357
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx$1(Renderer$1.Component.Switch, {
|
|
41304
41358
|
checked: monitoring.resourceSearchEnabled,
|
|
41305
41359
|
onChange: (value) => {
|