@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/main.js CHANGED
@@ -7488,6 +7488,14 @@ var GLYPHS = Object.freeze([
7488
7488
  id: "rocket",
7489
7489
  label: "Rocket",
7490
7490
  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>"
7491
+ }),
7492
+ ...Array.from({ length: 10 }, (_, index) => {
7493
+ const number = String(index + 1).padStart(2, "0");
7494
+ return Object.freeze({
7495
+ id: `number-${number}`,
7496
+ label: number,
7497
+ body: `<text x="32" y="36" text-anchor="middle" font-family="monospace" font-size="28" font-weight="700" fill="currentColor" stroke="none">${number}</text>`
7498
+ });
7491
7499
  })
7492
7500
  ]);
7493
7501
  var COLOR = /^#[\da-f]{6}$/i;
@@ -7524,7 +7532,7 @@ function escapeXml(text) {
7524
7532
  function clusterIconDataUrl(input) {
7525
7533
  const design = normalizeClusterIconDesign(input);
7526
7534
  const glyph = GLYPHS.find((candidate) => candidate.id === design.glyph);
7527
- 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>`;
7535
+ 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>`;
7528
7536
  return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
7529
7537
  }
7530
7538
  function clusterIconDesignFromDataUrl(value) {
@@ -7536,7 +7544,7 @@ function clusterIconDesignFromDataUrl(value) {
7536
7544
  const outlineColor = /<rect x="2"[^>]* stroke="(#[a-f\d]{6})"/i.exec(svg)?.[1];
7537
7545
  const iconColor = /<g\b[^>]*\bstroke="(#[a-f\d]{6})"/i.exec(svg)?.[1];
7538
7546
  const labelColor = /<rect x="15"[^>]* fill="(#[a-f\d]{6})"/i.exec(svg)?.[1];
7539
- const text = /<text\b[^>]*>([^<]*)<\/text>/.exec(svg)?.[1];
7547
+ const text = [...svg.matchAll(/<text\b[^>]*>([^<]*)<\/text>/g)].at(-1)?.[1];
7540
7548
  if (text === void 0 || /\bon[a-z]+\s*=|(?:href|style)\s*=/i.test(svg)) return void 0;
7541
7549
  const label = text.replace(/&(amp|lt|gt|quot|apos);/g, (entity) => ({
7542
7550
  "&amp;": "&",
@@ -10298,11 +10306,19 @@ function createClusterIconsService(host, store) {
10298
10306
  if (!payload || typeof payload !== "object" || Array.isArray(payload)) throw new Error("Invalid icon request");
10299
10307
  const input = payload;
10300
10308
  if (input.operation === "list") return list();
10301
- if (input.operation !== "apply") throw new Error("Invalid icon operation");
10309
+ if (input.operation !== "apply" && input.operation !== "clear") throw new Error("Invalid icon operation");
10302
10310
  if (typeof input.id !== "string" || !input.id || input.id.length > 1024) throw new Error("Invalid cluster identifier");
10303
10311
  const cluster = host.clusters().find((entry) => entry.id === input.id);
10304
10312
  if (!cluster) throw new Error("Cluster is no longer available");
10305
10313
  const id = cluster.id;
10314
+ if (input.operation === "clear") {
10315
+ runInAction(() => {
10316
+ const icons = { ...store.icons };
10317
+ delete icons[id];
10318
+ store.icons = icons;
10319
+ });
10320
+ return list();
10321
+ }
10306
10322
  const design = normalizeClusterIconDesign(input.design);
10307
10323
  runInAction(() => {
10308
10324
  store.icons = {
@@ -11961,7 +11977,7 @@ function startDockIconOverride() {
11961
11977
  };
11962
11978
  }
11963
11979
  // package.json
11964
- var version = "2.22.0";
11980
+ var version = "2.22.1";
11965
11981
  // src/common/extension-updates.ts
11966
11982
  var EXTENSION_UPDATES_CHANNEL = "freelens-power:extension-updates";
11967
11983
  var semver = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/;