@opentabs-dev/browser-extension 0.0.57 → 0.0.59

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.
@@ -61333,6 +61333,12 @@ var setAllToolsEnabled = (plugin, enabled) => sendBgMessage({
61333
61333
  plugin,
61334
61334
  enabled
61335
61335
  });
61336
+ var setToolsEnabled = (plugin, tools, enabled) => sendBgMessage({
61337
+ type: "bg:setToolsEnabled",
61338
+ plugin,
61339
+ tools,
61340
+ enabled
61341
+ });
61336
61342
  var setBrowserToolEnabled = (tool, enabled) => sendBgMessage({
61337
61343
  type: "bg:setBrowserToolEnabled",
61338
61344
  tool,
@@ -71234,6 +71240,8 @@ var PluginIcon = (t0) => {
71234
71240
  className: t4,
71235
71241
  iconSvg,
71236
71242
  iconInactiveSvg,
71243
+ iconDarkSvg,
71244
+ iconDarkInactiveSvg,
71237
71245
  active: t5
71238
71246
  } = t0;
71239
71247
  const tabState = t1 === void 0 ? "closed" : t1;
@@ -71243,7 +71251,10 @@ var PluginIcon = (t0) => {
71243
71251
  const active = t5 === void 0 ? false : t5;
71244
71252
  const isReady = tabState === "ready";
71245
71253
  const hasSvg = !!iconSvg;
71246
- const rawSvg = isReady ? iconSvg : iconInactiveSvg;
71254
+ const isDark = document.documentElement.classList.contains("dark");
71255
+ const activeSvg = isDark && iconDarkSvg ? iconDarkSvg : iconSvg;
71256
+ const inactiveSvg = isDark && iconDarkInactiveSvg ? iconDarkInactiveSvg : iconInactiveSvg;
71257
+ const rawSvg = isReady ? activeSvg : inactiveSvg;
71247
71258
  let t6;
71248
71259
  if ($2[0] !== pluginName || $2[1] !== rawSvg) {
71249
71260
  t6 = tryGetSanitizedSvg(rawSvg, pluginName);
@@ -78309,11 +78320,28 @@ var PluginCard = (t0) => {
78309
78320
  showToggleError(`Failed to toggle ${toolName}`);
78310
78321
  });
78311
78322
  };
78323
+ const handleToggleGroup = (groupTools, checked_0) => {
78324
+ const myVersion_1 = toggleCounter.current = toggleCounter.current + 1;
78325
+ const groupToolNames = new Set(groupTools.map(_temp27));
78326
+ updatePluginTools((prev_2) => {
78327
+ preToggleRef.current = prev_2;
78328
+ return prev_2.map((t_3) => groupToolNames.has(t_3.name) ? {
78329
+ ...t_3,
78330
+ enabled: checked_0
78331
+ } : t_3);
78332
+ });
78333
+ setToolsEnabled(plugin.name, groupTools.map(_temp35), checked_0).catch(() => {
78334
+ if (toggleCounter.current === myVersion_1) {
78335
+ updatePluginTools(() => preToggleRef.current);
78336
+ }
78337
+ showToggleError("Failed to toggle group");
78338
+ });
78339
+ };
78312
78340
  const filterLower = toolFilter?.toLowerCase() ?? "";
78313
- const visibleTools = filterLower ? pluginTools.filter((t_2) => matchesTool(t_2, filterLower)) : pluginTools;
78341
+ const visibleTools = filterLower ? pluginTools.filter((t_5) => matchesTool(t_5, filterLower)) : pluginTools;
78314
78342
  let t4;
78315
78343
  if ($2[5] !== activeTools || $2[6] !== plugin.name) {
78316
- t4 = (t_3) => activeTools.has(`${plugin.name}:${t_3.name}`);
78344
+ t4 = (t_6) => activeTools.has(`${plugin.name}:${t_6.name}`);
78317
78345
  $2[5] = activeTools;
78318
78346
  $2[6] = plugin.name;
78319
78347
  $2[7] = t4;
@@ -78321,45 +78349,72 @@ var PluginCard = (t0) => {
78321
78349
  t4 = $2[7];
78322
78350
  }
78323
78351
  const hasActiveTool = pluginTools.some(t4);
78324
- const t5 = plugin.name;
78325
- let t6;
78352
+ const hasAnyGroup = visibleTools.some(_temp42);
78353
+ const toolGroups = [];
78354
+ if (hasAnyGroup) {
78355
+ const groupMap = /* @__PURE__ */ new Map();
78356
+ for (const tool of visibleTools) {
78357
+ const groupName = tool.group ?? "Other";
78358
+ let bucket = groupMap.get(groupName);
78359
+ if (!bucket) {
78360
+ bucket = [];
78361
+ groupMap.set(groupName, bucket);
78362
+ }
78363
+ bucket.push(tool);
78364
+ }
78365
+ const otherBucket = groupMap.get("Other");
78366
+ groupMap.delete("Other");
78367
+ for (const [name, tools] of groupMap) {
78368
+ toolGroups.push({
78369
+ name,
78370
+ tools
78371
+ });
78372
+ }
78373
+ if (otherBucket) {
78374
+ toolGroups.push({
78375
+ name: "Other",
78376
+ tools: otherBucket
78377
+ });
78378
+ }
78379
+ }
78380
+ let t5;
78326
78381
  if ($2[8] !== plugin.update) {
78327
- t6 = plugin.update && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, {
78382
+ t5 = plugin.update && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, {
78328
78383
  children: [" \xB7 Update: ", plugin.update.latestVersion]
78329
78384
  });
78330
78385
  $2[8] = plugin.update;
78331
- $2[9] = t6;
78386
+ $2[9] = t5;
78332
78387
  } else {
78333
- t6 = $2[9];
78388
+ t5 = $2[9];
78334
78389
  }
78335
- let t7;
78336
- if ($2[10] !== plugin.trustTier || $2[11] !== plugin.version || $2[12] !== t6) {
78337
- t7 = /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(TooltipObject.Content, {
78338
- children: ["v", plugin.version, " \xB7 ", plugin.trustTier, t6]
78390
+ let t6;
78391
+ if ($2[10] !== plugin.trustTier || $2[11] !== plugin.version || $2[12] !== t5) {
78392
+ t6 = /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(TooltipObject.Content, {
78393
+ children: ["v", plugin.version, " \xB7 ", plugin.trustTier, t5]
78339
78394
  });
78340
78395
  $2[10] = plugin.trustTier;
78341
78396
  $2[11] = plugin.version;
78342
- $2[12] = t6;
78343
- $2[13] = t7;
78397
+ $2[12] = t5;
78398
+ $2[13] = t6;
78344
78399
  } else {
78345
- t7 = $2[13];
78400
+ t6 = $2[13];
78346
78401
  }
78347
- let t8;
78402
+ let t7;
78348
78403
  if ($2[14] !== plugin.source) {
78349
- t8 = plugin.source === "local" && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Badge2, {
78404
+ t7 = plugin.source === "local" && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Badge2, {
78350
78405
  variant: "default",
78351
78406
  size: "sm",
78352
78407
  className: "align-middle",
78353
78408
  children: "DEV"
78354
78409
  });
78355
78410
  $2[14] = plugin.source;
78356
- $2[15] = t8;
78411
+ $2[15] = t7;
78357
78412
  } else {
78358
- t8 = $2[15];
78413
+ t7 = $2[15];
78359
78414
  }
78360
- let t9;
78415
+ let t8;
78361
78416
  if ($2[16] !== plugin.sdkVersion) {
78362
- t9 = !plugin.sdkVersion && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(TooltipObject, {
78417
+ t8 = !plugin.sdkVersion && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(TooltipObject, {
78363
78418
  children: [/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TooltipObject.Trigger, {
78364
78419
  asChild: true,
78365
78420
  children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Badge2, {
@@ -78373,109 +78428,129 @@ var PluginCard = (t0) => {
78373
78428
  })]
78374
78429
  });
78375
78430
  $2[16] = plugin.sdkVersion;
78376
- $2[17] = t9;
78431
+ $2[17] = t8;
78377
78432
  } else {
78378
- t9 = $2[17];
78433
+ t8 = $2[17];
78379
78434
  }
78380
- let t10;
78381
- if ($2[18] !== plugin.displayName || $2[19] !== t8 || $2[20] !== t9) {
78382
- t10 = /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", {
78435
+ let t9;
78436
+ if ($2[18] !== plugin.displayName || $2[19] !== t7 || $2[20] !== t8) {
78437
+ t9 = /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", {
78383
78438
  className: "flex min-w-0 flex-1 items-center gap-1.5 truncate font-head text-foreground text-sm",
78384
- children: [plugin.displayName, t8, t9]
78439
+ children: [plugin.displayName, t7, t8]
78385
78440
  });
78386
78441
  $2[18] = plugin.displayName;
78387
- $2[19] = t8;
78388
- $2[20] = t9;
78389
- $2[21] = t10;
78442
+ $2[19] = t7;
78443
+ $2[20] = t8;
78444
+ $2[21] = t9;
78390
78445
  } else {
78391
- t10 = $2[21];
78446
+ t9 = $2[21];
78392
78447
  }
78393
- let t11;
78448
+ let t10;
78394
78449
  if ($2[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
78395
- t11 = /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ChevronDown, {
78450
+ t10 = /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ChevronDown, {
78396
78451
  className: "h-4 w-4 shrink-0 transition-transform duration-200"
78397
78452
  });
78398
- $2[22] = t11;
78453
+ $2[22] = t10;
78399
78454
  } else {
78400
- t11 = $2[22];
78455
+ t10 = $2[22];
78401
78456
  }
78402
- const t12 = onUpdate ?? _temp27;
78403
- const t13 = onRemove ?? _temp35;
78404
- const t14 = updatingPlugin ?? false;
78405
- const t15 = removingPlugin ?? false;
78406
- let t16;
78407
- if ($2[23] !== plugin || $2[24] !== t12 || $2[25] !== t13 || $2[26] !== t14 || $2[27] !== t15) {
78408
- t16 = /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PluginMenu, {
78457
+ const t11 = onUpdate ?? _temp52;
78458
+ const t12 = onRemove ?? _temp62;
78459
+ const t13 = updatingPlugin ?? false;
78460
+ const t14 = removingPlugin ?? false;
78461
+ let t15;
78462
+ if ($2[23] !== plugin || $2[24] !== t11 || $2[25] !== t12 || $2[26] !== t13 || $2[27] !== t14) {
78463
+ t15 = /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PluginMenu, {
78409
78464
  plugin,
78410
- onUpdate: t12,
78411
- onRemove: t13,
78412
- updating: t14,
78413
- removing: t15,
78465
+ onUpdate: t11,
78466
+ onRemove: t12,
78467
+ updating: t13,
78468
+ removing: t14,
78414
78469
  className: "flex shrink-0 items-center px-1"
78415
78470
  });
78416
78471
  $2[23] = plugin;
78417
- $2[24] = t12;
78418
- $2[25] = t13;
78419
- $2[26] = t14;
78420
- $2[27] = t15;
78421
- $2[28] = t16;
78472
+ $2[24] = t11;
78473
+ $2[25] = t12;
78474
+ $2[26] = t13;
78475
+ $2[27] = t14;
78476
+ $2[28] = t15;
78422
78477
  } else {
78423
- t16 = $2[28];
78478
+ t15 = $2[28];
78424
78479
  }
78425
- let t17;
78480
+ let t16;
78426
78481
  if ($2[29] !== toggleError) {
78427
- t17 = toggleError && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AlertComponent, {
78482
+ t16 = toggleError && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AlertComponent, {
78428
78483
  status: "error",
78429
78484
  className: "mx-3 mb-1 px-2 py-1 text-xs",
78430
78485
  children: toggleError
78431
78486
  });
78432
78487
  $2[29] = toggleError;
78433
- $2[30] = t17;
78488
+ $2[30] = t16;
78434
78489
  } else {
78435
- t17 = $2[30];
78490
+ t16 = $2[30];
78436
78491
  }
78437
- let t18;
78492
+ let t17;
78438
78493
  if ($2[31] !== actionError) {
78439
- t18 = actionError && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AlertComponent, {
78494
+ t17 = actionError && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AlertComponent, {
78440
78495
  status: "error",
78441
78496
  className: "mx-3 mb-1 px-2 py-1 text-xs",
78442
78497
  children: actionError
78443
78498
  });
78444
78499
  $2[31] = actionError;
78445
- $2[32] = t18;
78500
+ $2[32] = t17;
78446
78501
  } else {
78447
- t18 = $2[32];
78502
+ t17 = $2[32];
78448
78503
  }
78449
- const t19 = AccordionComponent;
78450
- const t20 = "border-border border-t";
78451
- const t21 = toolFilter && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", {
78504
+ const t18 = AccordionComponent;
78505
+ const t19 = "border-border border-t";
78506
+ const t20 = toolFilter && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", {
78452
78507
  className: "mb-1 px-3 pt-2 text-muted-foreground text-xs",
78453
78508
  children: [visibleTools.length, " of ", pluginTools.length, " tools"]
78454
78509
  });
78455
- const t22 = visibleTools.map((tool) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ToolRow, {
78456
- name: tool.name,
78457
- displayName: tool.displayName,
78458
- description: tool.description,
78459
- icon: tool.icon,
78460
- enabled: tool.enabled,
78461
- active: activeTools.has(`${plugin.name}:${tool.name}`),
78462
- onToggle: () => handleToggleTool(tool.name, tool.enabled)
78463
- }, tool.name));
78464
- let t23;
78465
- if ($2[33] !== t19.Content || $2[34] !== t21 || $2[35] !== t22) {
78466
- t23 = /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(t19.Content, {
78467
- className: t20,
78468
- children: [t21, t22]
78510
+ const t21 = hasAnyGroup ? toolGroups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", {
78511
+ children: [/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", {
78512
+ className: "flex items-center gap-2 border-border border-b bg-muted/20 px-3 py-1",
78513
+ children: [/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", {
78514
+ className: "flex-1 font-head text-muted-foreground text-xs uppercase tracking-wider",
78515
+ children: group.name
78516
+ }), /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Switch2, {
78517
+ checked: group.tools.every(_temp92),
78518
+ onCheckedChange: (checked_1) => handleToggleGroup(group.tools, checked_1),
78519
+ "aria-label": `Toggle all ${group.name} tools`
78520
+ })]
78521
+ }), group.tools.map((tool_0) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ToolRow, {
78522
+ name: tool_0.name,
78523
+ displayName: tool_0.displayName,
78524
+ description: tool_0.description,
78525
+ icon: tool_0.icon,
78526
+ enabled: tool_0.enabled,
78527
+ active: activeTools.has(`${plugin.name}:${tool_0.name}`),
78528
+ onToggle: () => handleToggleTool(tool_0.name, tool_0.enabled)
78529
+ }, tool_0.name))]
78530
+ }, group.name)) : visibleTools.map((tool_1) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ToolRow, {
78531
+ name: tool_1.name,
78532
+ displayName: tool_1.displayName,
78533
+ description: tool_1.description,
78534
+ icon: tool_1.icon,
78535
+ enabled: tool_1.enabled,
78536
+ active: activeTools.has(`${plugin.name}:${tool_1.name}`),
78537
+ onToggle: () => handleToggleTool(tool_1.name, tool_1.enabled)
78538
+ }, tool_1.name));
78539
+ let t22;
78540
+ if ($2[33] !== t18.Content || $2[34] !== t20 || $2[35] !== t21) {
78541
+ t22 = /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(t18.Content, {
78542
+ className: t19,
78543
+ children: [t20, t21]
78469
78544
  });
78470
- $2[33] = t19.Content;
78471
- $2[34] = t21;
78472
- $2[35] = t22;
78473
- $2[36] = t23;
78545
+ $2[33] = t18.Content;
78546
+ $2[34] = t20;
78547
+ $2[35] = t21;
78548
+ $2[36] = t22;
78474
78549
  } else {
78475
- t23 = $2[36];
78550
+ t22 = $2[36];
78476
78551
  }
78477
78552
  return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(AccordionComponent.Item, {
78478
- value: t5,
78553
+ value: plugin.name,
78479
78554
  className: removingPlugin ? "pointer-events-none opacity-60 transition-opacity" : void 0,
78480
78555
  children: [/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Header, {
78481
78556
  className: "flex",
@@ -78493,15 +78568,17 @@ var PluginCard = (t0) => {
78493
78568
  size: 32,
78494
78569
  iconSvg: plugin.iconSvg,
78495
78570
  iconInactiveSvg: plugin.iconInactiveSvg,
78571
+ iconDarkSvg: plugin.iconDarkSvg,
78572
+ iconDarkInactiveSvg: plugin.iconDarkInactiveSvg,
78496
78573
  active: hasActiveTool
78497
78574
  })
78498
78575
  })
78499
- }), t7]
78500
- }), t10, t11]
78501
- }), t16, /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", {
78576
+ }), t6]
78577
+ }), t9, t10]
78578
+ }), t15, /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", {
78502
78579
  className: "flex shrink-0 items-center px-3",
78503
- onClick: _temp42,
78504
- onKeyDown: _temp52,
78580
+ onClick: _temp72,
78581
+ onKeyDown: _temp82,
78505
78582
  role: "presentation",
78506
78583
  children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Switch2, {
78507
78584
  checked: allEnabled,
@@ -78509,24 +78586,36 @@ var PluginCard = (t0) => {
78509
78586
  "aria-label": `Toggle all tools for ${plugin.name}`
78510
78587
  })
78511
78588
  })]
78512
- }), t17, t18, t23]
78589
+ }), t16, t17, t22]
78513
78590
  });
78514
78591
  };
78515
78592
  function _temp10(t2) {
78516
78593
  return t2.enabled;
78517
78594
  }
78518
- function _temp27() {
78595
+ function _temp27(t_2) {
78596
+ return t_2.name;
78597
+ }
78598
+ function _temp35(t_4) {
78599
+ return t_4.name;
78600
+ }
78601
+ function _temp42(t_7) {
78602
+ return t_7.group;
78519
78603
  }
78520
- function _temp35() {
78604
+ function _temp52() {
78521
78605
  }
78522
- function _temp42(e2) {
78606
+ function _temp62() {
78607
+ }
78608
+ function _temp72(e2) {
78523
78609
  return e2.stopPropagation();
78524
78610
  }
78525
- function _temp52(e_0) {
78611
+ function _temp82(e_0) {
78526
78612
  if (e_0.key === "Enter" || e_0.key === " ") {
78527
78613
  e_0.stopPropagation();
78528
78614
  }
78529
78615
  }
78616
+ function _temp92(t_8) {
78617
+ return t_8.enabled;
78618
+ }
78530
78619
 
78531
78620
  // src/side-panel/components/PluginList.tsx
78532
78621
  var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
@@ -79659,11 +79748,11 @@ var App = () => {
79659
79748
  setConnected(isConnected);
79660
79749
  setDisconnectReason(isConnected ? void 0 : message_0.data.disconnectReason);
79661
79750
  if (isConnected) {
79662
- getFullState().then(applyFullState).catch(_temp62);
79751
+ getFullState().then(applyFullState).catch(_temp63);
79663
79752
  } else {
79664
79753
  setPlugins([]);
79665
79754
  setFailedPlugins([]);
79666
- setBrowserTools(BROWSER_TOOLS_CATALOG.map(_temp72));
79755
+ setBrowserTools(BROWSER_TOOLS_CATALOG.map(_temp73));
79667
79756
  setServerVersion(void 0);
79668
79757
  setActiveTools(/* @__PURE__ */ new Set());
79669
79758
  setPendingConfirmations([]);
@@ -79688,7 +79777,7 @@ var App = () => {
79688
79777
  if (message_0.type === "sp:serverMessage") {
79689
79778
  const data = message_0.data;
79690
79779
  if (data.method === "plugins.changed") {
79691
- getFullState().then(applyFullState).catch(_temp82);
79780
+ getFullState().then(applyFullState).catch(_temp83);
79692
79781
  sendResponse({
79693
79782
  ok: true
79694
79783
  });
@@ -79942,15 +80031,15 @@ function _temp53(p_0) {
79942
80031
  tabState: p_0.tabState
79943
80032
  };
79944
80033
  }
79945
- function _temp62() {
80034
+ function _temp63() {
79946
80035
  }
79947
- function _temp72(t_2) {
80036
+ function _temp73(t_2) {
79948
80037
  return {
79949
80038
  ...t_2,
79950
80039
  enabled: true
79951
80040
  };
79952
80041
  }
79953
- function _temp82() {
80042
+ function _temp83() {
79954
80043
  }
79955
80044
 
79956
80045
  // src/side-panel/components/ErrorBoundary.tsx