@64mb/freelens-power 2.22.0 → 2.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/renderer.js CHANGED
@@ -6740,6 +6740,14 @@ var GLYPHS = Object.freeze([
6740
6740
  id: "rocket",
6741
6741
  label: "Rocket",
6742
6742
  body: "<g transform=\"translate(32 11.4) scale(1.497435897) translate(-12.25 -2)\" stroke-width=\"1.869863014\"><path d=\"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2zM9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05\"/></g>"
6743
+ }),
6744
+ ...Array.from({ length: 10 }, (_, index) => {
6745
+ const number = String(index + 1).padStart(2, "0");
6746
+ return Object.freeze({
6747
+ id: `number-${number}`,
6748
+ label: number,
6749
+ body: `<text x="32" y="36" text-anchor="middle" font-family="monospace" font-size="28" font-weight="700" fill="currentColor" stroke="none">${number}</text>`
6750
+ });
6743
6751
  })
6744
6752
  ]);
6745
6753
  var COLOR = /^#[\da-f]{6}$/i;
@@ -6787,7 +6795,7 @@ function escapeXml(text) {
6787
6795
  function clusterIconDataUrl(input) {
6788
6796
  const design = normalizeClusterIconDesign(input);
6789
6797
  const glyph = GLYPHS.find((candidate) => candidate.id === design.glyph);
6790
- const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 64 64"><rect x="2" y="2" width="60" height="60" rx="15" fill="#292d38" stroke="${design.outlineColor}" stroke-width="3"/><g fill="none" stroke="${design.iconColor}" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round">${glyph.body}</g><rect x="15" y="46" width="34" height="12" rx="6" fill="${design.labelColor}"/><text x="32" y="55.2" text-anchor="middle" font-family="Helvetica,Arial,sans-serif" font-size="9.5" font-weight="800" fill="#292d38">${escapeXml(design.label)}</text></svg>`;
6798
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 64 64"><rect x="2" y="2" width="60" height="60" rx="15" fill="#292d38" stroke="${design.outlineColor}" stroke-width="3"/><g fill="none" stroke="${design.iconColor}" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round">${glyph.body.replace("currentColor", design.iconColor)}</g><rect x="15" y="46" width="34" height="12" rx="6" fill="${design.labelColor}"/><text x="32" y="55.2" text-anchor="middle" font-family="Helvetica,Arial,sans-serif" font-size="9.5" font-weight="800" fill="#292d38">${escapeXml(design.label)}</text></svg>`;
6791
6799
  return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
6792
6800
  }
6793
6801
  // src/common/store/cluster-icons-store.ts
@@ -16964,7 +16972,12 @@ function ClusterIconsPage() {
16964
16972
  // src/renderer/cluster-icon-settings-menu.tsx
16965
16973
  function startClusterIconSettingsMenu() {
16966
16974
  const prefix = "menu-actions-for-cluster-icon-settings-for-";
16975
+ const store = ClusterIconsStore.getInstanceOrCreate();
16976
+ const clears = /* @__PURE__ */ new Map();
16967
16977
  const owned = /* @__PURE__ */ new Map();
16978
+ const style = document.createElement("style");
16979
+ style.textContent = `[data-testid^="${prefix}"] > .MenuItem[hidden] { display: none !important; }`;
16980
+ document.head.append(style);
16968
16981
  const modal = document.createElement("div");
16969
16982
  document.body.append(modal);
16970
16983
  let stopped = false;
@@ -17005,12 +17018,52 @@ function startClusterIconSettingsMenu() {
17005
17018
  button.remove();
17006
17019
  owned.delete(menu);
17007
17020
  };
17021
+ const restoreClear = (menu, entry) => {
17022
+ entry.native.hidden = false;
17023
+ unmountContainer(entry.action);
17024
+ entry.action.remove();
17025
+ clears.delete(menu);
17026
+ };
17008
17027
  const update = () => {
17028
+ for (const [menu, entry] of clears) {
17029
+ const id = menu.dataset.testid?.slice(43);
17030
+ if (!id || !menu.isConnected || !menu.contains(entry.native) || !Object.hasOwn(store.icons, id)) restoreClear(menu, entry);
17031
+ }
17009
17032
  for (const [menu, button] of owned) if (!menu.isConnected) remove(menu, button);
17010
17033
  for (const menu of document.querySelectorAll(`[data-testid^="${prefix}"]`)) {
17011
- if (owned.has(menu)) continue;
17012
17034
  const id = menu.dataset.testid?.slice(43);
17013
17035
  if (!id || !Renderer$1.Catalog.getClusterById(id)) continue;
17036
+ if (Object.hasOwn(store.icons, id) && !clears.has(menu)) {
17037
+ const native = Array.from(menu.querySelectorAll(":scope > .MenuItem:not([hidden])")).find((item) => Array.from(item.childNodes).filter((node) => node.nodeType === Node.TEXT_NODE).map((node) => node.textContent).join("").trim() === "Clear");
17038
+ if (native) {
17039
+ const action = document.createElement("li");
17040
+ action.className = "MenuItem";
17041
+ action.tabIndex = 0;
17042
+ action.setAttribute("role", "menuitem");
17043
+ action.setAttribute("aria-label", "Clear");
17044
+ action.onclick = () => {
17045
+ if (stopped) return;
17046
+ document.querySelector(`[data-testid="icon-for-${prefix}${CSS.escape(id)}"]`)?.click();
17047
+ ipcRenderer.invoke(CLUSTER_ICONS_CHANNEL, {
17048
+ operation: "clear",
17049
+ id
17050
+ }).catch(() => {
17051
+ if (!stopped) Renderer$1.Component.Notifications.error("Unable to clear the cluster icon. Try again.");
17052
+ });
17053
+ };
17054
+ native.hidden = true;
17055
+ native.after(action);
17056
+ clears.set(menu, {
17057
+ native,
17058
+ action
17059
+ });
17060
+ renderIntoContainer(/* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx$1(Renderer$1.Component.Icon, {
17061
+ material: "clear",
17062
+ size: 18
17063
+ }), " Clear"] }), action);
17064
+ }
17065
+ }
17066
+ if (owned.has(menu)) continue;
17014
17067
  const button = document.createElement("li");
17015
17068
  button.tabIndex = 0;
17016
17069
  button.setAttribute("role", "menuitem");
@@ -17035,7 +17088,7 @@ function startClusterIconSettingsMenu() {
17035
17088
  if (!(target instanceof Element)) return;
17036
17089
  const menu = Array.from(owned.keys()).find((item) => item.contains(target));
17037
17090
  if (!menu) return;
17038
- const items = Array.from(menu.querySelectorAll(":scope > .MenuItem:not(.disabled)"));
17091
+ const items = Array.from(menu.querySelectorAll(":scope > .MenuItem:not(.disabled):not([hidden])"));
17039
17092
  const index = items.findIndex((item) => item === target || item.contains(target));
17040
17093
  if (index < 0) return;
17041
17094
  let next;
@@ -17043,7 +17096,7 @@ function startClusterIconSettingsMenu() {
17043
17096
  else if (event.key === "ArrowUp") next = items[(index - 1 + items.length) % items.length];
17044
17097
  else if (event.key === "Home") next = items[0];
17045
17098
  else if (event.key === "End") next = items.at(-1);
17046
- else if (event.key !== "Enter" && event.key !== " " || items[index] !== owned.get(menu)) return;
17099
+ else if (event.key !== "Enter" && event.key !== " " || items[index] !== owned.get(menu) && items[index] !== clears.get(menu)?.action) return;
17047
17100
  event.preventDefault();
17048
17101
  event.stopImmediatePropagation();
17049
17102
  if (next) next.focus();
@@ -17055,17 +17108,21 @@ function startClusterIconSettingsMenu() {
17055
17108
  childList: true,
17056
17109
  subtree: true
17057
17110
  });
17111
+ const stopIcons = reaction(() => Object.keys(store.icons), update);
17058
17112
  update();
17059
17113
  return () => {
17060
17114
  stopped = true;
17061
17115
  request++;
17062
17116
  observer.disconnect();
17063
17117
  stopCategory();
17118
+ stopIcons();
17119
+ for (const [menu, entry] of clears) restoreClear(menu, entry);
17064
17120
  category?.off("contextMenuOpen", addMenu);
17065
17121
  window.removeEventListener("keydown", onKeyDown, true);
17066
17122
  for (const [menu, button] of owned) remove(menu, button);
17067
17123
  unmountContainer(modal);
17068
17124
  modal.remove();
17125
+ style.remove();
17069
17126
  };
17070
17127
  }
17071
17128
  // src/common/dashboard-views.ts
@@ -21258,7 +21315,7 @@ function startExtensionUpdateNotifications() {
21258
21315
  };
21259
21316
  const started = () => {
21260
21317
  attempt = {
21261
- version: current?.installedVersion ?? "2.22.0",
21318
+ version: current?.installedVersion ?? "2.22.1",
21262
21319
  startedAt: Date.now()
21263
21320
  };
21264
21321
  try {