@64mb/freelens-power 2.21.4 → 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 +197 -8
- package/dist/main.js.map +1 -1
- package/dist/renderer.js +86 -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
|
};
|
|
@@ -17059,6 +17064,7 @@ var DASHBOARD_VIEWS_LOADING = "freelens-power:dashboard-views:loading";
|
|
|
17059
17064
|
var DASHBOARD_SITE_ICONS = "freelens-power:dashboard-site-icons";
|
|
17060
17065
|
var DASHBOARD_VIEWS_PIN = "freelens-power:dashboard-views:pin";
|
|
17061
17066
|
var DASHBOARD_VIEWS_PINNED = "freelens-power:dashboard-views:pinned";
|
|
17067
|
+
var DASHBOARD_VIEWS_OPEN = "freelens-power:dashboard-views:open";
|
|
17062
17068
|
// src/renderer/dashboard.tsx
|
|
17063
17069
|
var styles$1 = `
|
|
17064
17070
|
.freelens-power-dashboard .power-dashboard-card-pinned .power-dashboard-embed { opacity: .65; }
|
|
@@ -17663,6 +17669,29 @@ var DashboardPage = observer(({ onOpenPreferences }) => {
|
|
|
17663
17669
|
]
|
|
17664
17670
|
});
|
|
17665
17671
|
});
|
|
17672
|
+
// src/renderer/dashboard-links.ts
|
|
17673
|
+
function startDashboardLinks() {
|
|
17674
|
+
let stopped = false;
|
|
17675
|
+
const dispose = Renderer$1.Catalog.catalogEntities.addOnBeforeRun(async (event) => {
|
|
17676
|
+
const entity = event.target;
|
|
17677
|
+
if (entity.apiVersion !== Common.Catalog.WebLink.apiVersion || entity.kind !== Common.Catalog.WebLink.kind || entity.metadata.source !== "freelens-power") return;
|
|
17678
|
+
const card = sanitizeDashboardCards(DashboardPreferencesStore.getInstanceOrCreate().cards).find((item) => item.url === entity.spec.url);
|
|
17679
|
+
if (!card) return;
|
|
17680
|
+
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(card.url));
|
|
17681
|
+
const hash = Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
17682
|
+
if (stopped || entity.getId() !== `freelens-power-dashboard-link-${hash}`) return;
|
|
17683
|
+
event.preventDefault();
|
|
17684
|
+
try {
|
|
17685
|
+
await ipcRenderer.invoke(DASHBOARD_VIEWS_OPEN, { id: card.id });
|
|
17686
|
+
} catch {
|
|
17687
|
+
Common.logger.warn("[Freelens Power] dashboard link could not be opened");
|
|
17688
|
+
}
|
|
17689
|
+
});
|
|
17690
|
+
return () => {
|
|
17691
|
+
stopped = true;
|
|
17692
|
+
dispose();
|
|
17693
|
+
};
|
|
17694
|
+
}
|
|
17666
17695
|
// src/common/hpa-diagnostics.ts
|
|
17667
17696
|
function diagnoseHpa(hpa) {
|
|
17668
17697
|
const min = hpa.spec?.minReplicas ?? 1;
|
|
@@ -21217,7 +21246,7 @@ function startExtensionUpdateNotifications() {
|
|
|
21217
21246
|
};
|
|
21218
21247
|
const started = () => {
|
|
21219
21248
|
attempt = {
|
|
21220
|
-
version: current?.installedVersion ?? "2.21.
|
|
21249
|
+
version: current?.installedVersion ?? "2.21.6",
|
|
21221
21250
|
startedAt: Date.now()
|
|
21222
21251
|
};
|
|
21223
21252
|
try {
|
|
@@ -26714,9 +26743,11 @@ function startHotbarName() {
|
|
|
26714
26743
|
let count = 0;
|
|
26715
26744
|
let stopped = false;
|
|
26716
26745
|
let refreshing = false;
|
|
26746
|
+
const numbers = /* @__PURE__ */ new Map();
|
|
26717
26747
|
const owned = /* @__PURE__ */ new Map();
|
|
26718
26748
|
const style = document.createElement("style");
|
|
26719
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}";
|
|
26720
26751
|
document.head.append(style);
|
|
26721
26752
|
const remove = (selector) => {
|
|
26722
26753
|
const entry = owned.get(selector);
|
|
@@ -26726,6 +26757,26 @@ function startHotbarName() {
|
|
|
26726
26757
|
owned.delete(selector);
|
|
26727
26758
|
};
|
|
26728
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
|
+
});
|
|
26729
26780
|
const targets = /* @__PURE__ */ new Set();
|
|
26730
26781
|
for (const badge of count > 1 ? document.querySelectorAll(`.HotbarMenu [data-testid^="${prefix}"]`) : []) {
|
|
26731
26782
|
const selector = badge.closest("[class*=\"HotbarSelector\"]");
|
|
@@ -26778,15 +26829,25 @@ function startHotbarName() {
|
|
|
26778
26829
|
});
|
|
26779
26830
|
refreshCount();
|
|
26780
26831
|
const keydown = (event) => {
|
|
26781
|
-
if (preferences.hotbarShortcuts === false) return;
|
|
26782
26832
|
const mac = /Mac|iPhone|iPad/.test(navigator.platform);
|
|
26783
|
-
|
|
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;
|
|
26784
26836
|
const digit = /^Digit([1-9])$/.exec(event.code);
|
|
26785
26837
|
if (!digit) return;
|
|
26786
26838
|
const editable = "input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"textbox\"], [role=\"combobox\"], .monaco-editor, .xterm, .cm-editor, .CodeMirror";
|
|
26787
|
-
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;
|
|
26788
26840
|
if (document.querySelector(".Dialog.modal, [aria-modal=\"true\"], .SettingLayout, [class*=\"command-container-module__CommandContainer--\"]")) return;
|
|
26789
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
|
+
}
|
|
26790
26851
|
const badge = document.querySelector(".HotbarMenu [data-testid^=\"hotbar-menu-badge-for-\"]");
|
|
26791
26852
|
const current = Number(badge?.textContent?.trim());
|
|
26792
26853
|
const arrows = (badge?.closest("[class*=\"HotbarSelector\"]"))?.querySelectorAll(":scope > .Icon");
|
|
@@ -26797,11 +26858,18 @@ function startHotbarName() {
|
|
|
26797
26858
|
for (let step = 0; step < Math.abs(target - current); step++) arrow.click();
|
|
26798
26859
|
};
|
|
26799
26860
|
document.addEventListener("keydown", keydown);
|
|
26861
|
+
const stopItemPreference = reaction(() => preferences.hotbarItemShortcuts, update, { fireImmediately: true });
|
|
26800
26862
|
const timer = setInterval(() => void refreshCount(), 2e3);
|
|
26801
26863
|
return () => {
|
|
26802
26864
|
stopped = true;
|
|
26803
26865
|
document.removeEventListener("keydown", keydown);
|
|
26804
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();
|
|
26805
26873
|
observer.disconnect();
|
|
26806
26874
|
for (const selector of owned.keys()) remove(selector);
|
|
26807
26875
|
style.remove();
|
|
@@ -41276,6 +41344,16 @@ var OtherPreferences = observer(() => {
|
|
|
41276
41344
|
className: "power-settings-hint",
|
|
41277
41345
|
children: "Switch panels with Cmd+1-9 on macOS or Ctrl+1-9 on Windows and Linux."
|
|
41278
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
|
+
})] }),
|
|
41279
41357
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx$1(Renderer$1.Component.Switch, {
|
|
41280
41358
|
checked: monitoring.resourceSearchEnabled,
|
|
41281
41359
|
onChange: (value) => {
|
|
@@ -44375,6 +44453,7 @@ var FreelensPowerRenderer = class extends Renderer$1.LensExtension {
|
|
|
44375
44453
|
startClusterIconSettingsMenu,
|
|
44376
44454
|
startCatalogMenuIcons,
|
|
44377
44455
|
startCatalogDisconnect,
|
|
44456
|
+
startDashboardLinks,
|
|
44378
44457
|
startWelcomeOverride,
|
|
44379
44458
|
startAiChat,
|
|
44380
44459
|
startResourceSearch,
|