@inspecto-dev/core 0.3.3 → 0.3.5

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.
@@ -966,7 +966,9 @@ var overlayMenuStyles = `
966
966
  border: 1px solid var(--inspecto-border-subtle);
967
967
  border-radius: var(--inspecto-radius-lg);
968
968
  padding: 10px;
969
- min-width: 304px;
969
+ width: 304px;
970
+ max-width: calc(100vw - 16px);
971
+ box-sizing: border-box;
970
972
  box-shadow: var(--inspecto-shadow-floating);
971
973
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
972
974
  color: var(--inspecto-text-primary);
@@ -3372,6 +3374,107 @@ function indentBlock(text) {
3372
3374
  return text.split("\n").map((line) => ` ${line}`).join("\n");
3373
3375
  }
3374
3376
 
3377
+ // src/menu-helpers.ts
3378
+ function formatSourceAnchor(location) {
3379
+ const fileName = location.file.split("/").pop() || location.file;
3380
+ return `${fileName}:${location.line}:${location.column}`;
3381
+ }
3382
+ function formatRuntimeErrorCount2(count) {
3383
+ if (count > 99) return "99+";
3384
+ return String(count);
3385
+ }
3386
+ function createMenuSection() {
3387
+ const section = document.createElement("div");
3388
+ section.className = menuSectionClass;
3389
+ return section;
3390
+ }
3391
+ function createAskInput(placeholder) {
3392
+ const inputWrapper = document.createElement("div");
3393
+ inputWrapper.className = menuInputWrapperClass;
3394
+ const input = document.createElement("input");
3395
+ input.className = menuInputClass;
3396
+ input.type = "text";
3397
+ input.placeholder = placeholder != null ? placeholder : "Add a custom ask or extra instruction...";
3398
+ input.setAttribute("aria-label", "Custom ask");
3399
+ const sendIcon = document.createElement("div");
3400
+ sendIcon.className = menuInputIconClass;
3401
+ sendIcon.innerHTML = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>`;
3402
+ sendIcon.style.cursor = "pointer";
3403
+ inputWrapper.appendChild(input);
3404
+ inputWrapper.appendChild(sendIcon);
3405
+ return { input, inputWrapper, sendIcon };
3406
+ }
3407
+ function showError(menu, message, errorCode) {
3408
+ var _a2;
3409
+ (_a2 = menu.querySelector(`.${errorMsgClass}`)) == null ? void 0 : _a2.remove();
3410
+ const errEl = document.createElement("div");
3411
+ errEl.className = errorMsgClass;
3412
+ errEl.textContent = errorCode === "FILE_NOT_FOUND" ? "Source file not found. Is the server running?" : `Error: ${message}`;
3413
+ menu.appendChild(errEl);
3414
+ }
3415
+ function isFixIntent(intent) {
3416
+ return intent.aiIntent === "fix";
3417
+ }
3418
+ function isFixUiIntent(intent) {
3419
+ return intent.id === "fix-ui";
3420
+ }
3421
+ function createRuntimeContextUi(runtimeContext, options) {
3422
+ var _a2;
3423
+ if (!runtimeContext) return null;
3424
+ const summary = formatRuntimeContextSummary(runtimeContext);
3425
+ if (!summary) return null;
3426
+ const container = document.createElement("div");
3427
+ container.style.display = "flex";
3428
+ container.style.flexDirection = "column";
3429
+ container.style.gap = "4px";
3430
+ const summaryEl = document.createElement("div");
3431
+ summaryEl.className = menuContextSummaryClass;
3432
+ summaryEl.textContent = summary;
3433
+ container.appendChild(summaryEl);
3434
+ if (((_a2 = options.runtimeContext) == null ? void 0 : _a2.preview) !== true || runtimeContext.records.length === 0) {
3435
+ return container;
3436
+ }
3437
+ const toggle = document.createElement("button");
3438
+ toggle.type = "button";
3439
+ toggle.className = menuContextToggleClass;
3440
+ toggle.textContent = "Show preview";
3441
+ const preview = document.createElement("div");
3442
+ preview.className = menuContextPreviewClass;
3443
+ preview.hidden = true;
3444
+ preview.textContent = formatRuntimeContextPreview(runtimeContext.records);
3445
+ toggle.addEventListener("click", (event) => {
3446
+ event.preventDefault();
3447
+ event.stopPropagation();
3448
+ preview.hidden = !preview.hidden;
3449
+ toggle.textContent = preview.hidden ? "Show preview" : "Hide preview";
3450
+ });
3451
+ container.append(toggle, preview);
3452
+ return container;
3453
+ }
3454
+ function formatRuntimeContextSummary(runtimeContext) {
3455
+ const parts = [];
3456
+ const { runtimeErrorCount, failedRequestCount } = runtimeContext.summary;
3457
+ if (runtimeErrorCount > 0) {
3458
+ parts.push(
3459
+ `${runtimeErrorCount} ${runtimeErrorCount === 1 ? "runtime error" : "runtime errors"}`
3460
+ );
3461
+ }
3462
+ if (failedRequestCount > 0) {
3463
+ parts.push(
3464
+ `${failedRequestCount} ${failedRequestCount === 1 ? "failed request" : "failed requests"}`
3465
+ );
3466
+ }
3467
+ return parts.join(" \u2022 ");
3468
+ }
3469
+ function formatRuntimeContextPreview(records) {
3470
+ return records.slice(0, 3).map((record) => {
3471
+ var _a2, _b, _c, _d, _e, _f;
3472
+ const details = record.kind === "failed-request" ? `${(_b = (_a2 = record.request) == null ? void 0 : _a2.method) != null ? _b : "GET"} ${(_f = (_e = (_c = record.request) == null ? void 0 : _c.pathname) != null ? _e : (_d = record.request) == null ? void 0 : _d.url) != null ? _f : ""}`.trim() : `${record.occurrenceCount}x`;
3473
+ return `[${record.kind}] ${record.message}
3474
+ ${details}`;
3475
+ }).join("\n\n");
3476
+ }
3477
+
3375
3478
  // src/menu-actions.ts
3376
3479
  function createIntentActionButtons(input) {
3377
3480
  return input.intents.map((intent) => {
@@ -3397,7 +3500,9 @@ function createIntentActionButtons(input) {
3397
3500
  }
3398
3501
  const requestRuntimeContext = input.resolveRuntimeContext(intent);
3399
3502
  const requestScreenshotContext = yield input.resolveScreenshotContext();
3400
- const requestCssContextPrompt = input.resolveCssContextPrompt();
3503
+ const requestCssContextPrompt = input.resolveCssContextPrompt(
3504
+ isFixUiIntent(intent) ? intent : void 0
3505
+ );
3401
3506
  const prompt = appendCssContextToPrompt(
3402
3507
  appendScreenshotContextToPrompt(
3403
3508
  buildPromptForIntent(intent, input.location, snippetResult, requestRuntimeContext),
@@ -3468,7 +3573,11 @@ function buildCustomInspectPrompt(input) {
3468
3573
  const prompt = appendCssContextToPrompt(
3469
3574
  appendScreenshotContextToPrompt(
3470
3575
  appendRuntimeContextToPrompt(
3471
- buildPrompt(CUSTOM_PROMPT_TEMPLATE(input.ask.trim()), input.location, snippetResult),
3576
+ buildPrompt(
3577
+ buildCustomInspectPromptTemplate(input.ask.trim(), input.location, input.targetLabel),
3578
+ input.location,
3579
+ snippetResult
3580
+ ),
3472
3581
  (_b = (_a2 = input.runtimeContext) == null ? void 0 : _a2.records) != null ? _b : []
3473
3582
  ),
3474
3583
  (_c = input.screenshotContext) != null ? _c : null
@@ -3481,103 +3590,18 @@ function buildCustomInspectPrompt(input) {
3481
3590
  };
3482
3591
  });
3483
3592
  }
3484
-
3485
- // src/menu-helpers.ts
3486
- function formatSourceAnchor(location) {
3487
- const fileName = location.file.split("/").pop() || location.file;
3488
- return `${fileName}:${location.line}:${location.column}`;
3489
- }
3490
- function formatRuntimeErrorCount2(count) {
3491
- if (count > 99) return "99+";
3492
- return String(count);
3493
- }
3494
- function createMenuSection() {
3495
- const section = document.createElement("div");
3496
- section.className = menuSectionClass;
3497
- return section;
3498
- }
3499
- function createAskInput(placeholder) {
3500
- const inputWrapper = document.createElement("div");
3501
- inputWrapper.className = menuInputWrapperClass;
3502
- const input = document.createElement("input");
3503
- input.className = menuInputClass;
3504
- input.type = "text";
3505
- input.placeholder = placeholder != null ? placeholder : "Add a custom ask or extra instruction...";
3506
- input.setAttribute("aria-label", "Custom ask");
3507
- const sendIcon = document.createElement("div");
3508
- sendIcon.className = menuInputIconClass;
3509
- sendIcon.innerHTML = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>`;
3510
- sendIcon.style.cursor = "pointer";
3511
- inputWrapper.appendChild(input);
3512
- inputWrapper.appendChild(sendIcon);
3513
- return { input, inputWrapper, sendIcon };
3514
- }
3515
- function showError(menu, message, errorCode) {
3516
- var _a2;
3517
- (_a2 = menu.querySelector(`.${errorMsgClass}`)) == null ? void 0 : _a2.remove();
3518
- const errEl = document.createElement("div");
3519
- errEl.className = errorMsgClass;
3520
- errEl.textContent = errorCode === "FILE_NOT_FOUND" ? "Source file not found. Is the server running?" : `Error: ${message}`;
3521
- menu.appendChild(errEl);
3522
- }
3523
- function isFixIntent(intent) {
3524
- return intent.aiIntent === "fix";
3525
- }
3526
- function createRuntimeContextUi(runtimeContext, options) {
3527
- var _a2;
3528
- if (!runtimeContext) return null;
3529
- const summary = formatRuntimeContextSummary(runtimeContext);
3530
- if (!summary) return null;
3531
- const container = document.createElement("div");
3532
- container.style.display = "flex";
3533
- container.style.flexDirection = "column";
3534
- container.style.gap = "4px";
3535
- const summaryEl = document.createElement("div");
3536
- summaryEl.className = menuContextSummaryClass;
3537
- summaryEl.textContent = summary;
3538
- container.appendChild(summaryEl);
3539
- if (((_a2 = options.runtimeContext) == null ? void 0 : _a2.preview) !== true || runtimeContext.records.length === 0) {
3540
- return container;
3541
- }
3542
- const toggle = document.createElement("button");
3543
- toggle.type = "button";
3544
- toggle.className = menuContextToggleClass;
3545
- toggle.textContent = "Show preview";
3546
- const preview = document.createElement("div");
3547
- preview.className = menuContextPreviewClass;
3548
- preview.hidden = true;
3549
- preview.textContent = formatRuntimeContextPreview(runtimeContext.records);
3550
- toggle.addEventListener("click", (event) => {
3551
- event.preventDefault();
3552
- event.stopPropagation();
3553
- preview.hidden = !preview.hidden;
3554
- toggle.textContent = preview.hidden ? "Show preview" : "Hide preview";
3555
- });
3556
- container.append(toggle, preview);
3557
- return container;
3558
- }
3559
- function formatRuntimeContextSummary(runtimeContext) {
3560
- const parts = [];
3561
- const { runtimeErrorCount, failedRequestCount } = runtimeContext.summary;
3562
- if (runtimeErrorCount > 0) {
3563
- parts.push(
3564
- `${runtimeErrorCount} ${runtimeErrorCount === 1 ? "runtime error" : "runtime errors"}`
3565
- );
3593
+ function buildCustomInspectPromptTemplate(ask, location, targetLabel) {
3594
+ const sections = [CUSTOM_PROMPT_TEMPLATE(ask)];
3595
+ if (targetLabel == null ? void 0 : targetLabel.trim()) {
3596
+ sections.push(`Selected component:
3597
+ - ${targetLabel.trim()}`);
3566
3598
  }
3567
- if (failedRequestCount > 0) {
3568
- parts.push(
3569
- `${failedRequestCount} ${failedRequestCount === 1 ? "failed request" : "failed requests"}`
3570
- );
3571
- }
3572
- return parts.join(" \u2022 ");
3573
- }
3574
- function formatRuntimeContextPreview(records) {
3575
- return records.slice(0, 3).map((record) => {
3576
- var _a2, _b, _c, _d, _e, _f;
3577
- const details = record.kind === "failed-request" ? `${(_b = (_a2 = record.request) == null ? void 0 : _a2.method) != null ? _b : "GET"} ${(_f = (_e = (_c = record.request) == null ? void 0 : _c.pathname) != null ? _e : (_d = record.request) == null ? void 0 : _d.url) != null ? _f : ""}`.trim() : `${record.occurrenceCount}x`;
3578
- return `[${record.kind}] ${record.message}
3579
- ${details}`;
3580
- }).join("\n\n");
3599
+ sections.push(
3600
+ `Source location:
3601
+ - file: ${location.file}
3602
+ - location: ${location.line}:${location.column}`
3603
+ );
3604
+ return sections.join("\n\n");
3581
3605
  }
3582
3606
 
3583
3607
  // src/menu-header.ts
@@ -3589,7 +3613,14 @@ function createMenuHeaderDom(input) {
3589
3613
  headerCopy.style.display = "flex";
3590
3614
  headerCopy.style.flexDirection = "column";
3591
3615
  headerCopy.style.gap = "2px";
3616
+ headerCopy.style.minWidth = "0";
3617
+ headerCopy.style.flex = "1 1 auto";
3592
3618
  const title = document.createElement("strong");
3619
+ title.style.display = "block";
3620
+ title.style.minWidth = "0";
3621
+ title.style.whiteSpace = "nowrap";
3622
+ title.style.overflow = "hidden";
3623
+ title.style.textOverflow = "ellipsis";
3593
3624
  title.textContent = ((_a2 = input.targetLabel) == null ? void 0 : _a2.trim()) || input.location.file.split("/").pop() || input.location.file;
3594
3625
  const meta = document.createElement("div");
3595
3626
  meta.className = menuMetaClass;
@@ -3685,8 +3716,21 @@ function applyIconToggleButtonState(button, enabled, enabledTitle, disabledTitle
3685
3716
  button.style.boxShadow = "none";
3686
3717
  }
3687
3718
 
3719
+ // src/menu-position.ts
3720
+ var DEFAULT_EDGE_MARGIN = 8;
3721
+ function resolveMenuPosition(input) {
3722
+ var _a2;
3723
+ const edgeMargin = (_a2 = input.edgeMargin) != null ? _a2 : DEFAULT_EDGE_MARGIN;
3724
+ const safeWidth = input.viewport.width > 0 ? input.viewport.width : input.menuRect.width + edgeMargin * 2;
3725
+ const safeHeight = input.viewport.height > 0 ? input.viewport.height : input.menuRect.height + edgeMargin * 2;
3726
+ const maxLeft = Math.max(safeWidth - input.menuRect.width - edgeMargin, edgeMargin);
3727
+ const left = Math.max(edgeMargin, Math.min(input.clickX, maxLeft));
3728
+ const maxTop = Math.max(safeHeight - input.menuRect.height - edgeMargin, edgeMargin);
3729
+ const top = Math.max(edgeMargin, Math.min(input.clickY + edgeMargin, maxTop));
3730
+ return { left, top };
3731
+ }
3732
+
3688
3733
  // src/menu.ts
3689
- var MENU_WIDTH = 280;
3690
3734
  function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose, deps = {}) {
3691
3735
  var _a2, _b, _c;
3692
3736
  const maxSnippetLines = (_a2 = options.maxSnippetLines) != null ? _a2 : 100;
@@ -3700,6 +3744,10 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
3700
3744
  const canAttachCssContext2 = typeof deps.captureCssContextPrompt === "function";
3701
3745
  const menu = document.createElement("div");
3702
3746
  menu.className = menuClass;
3747
+ menu.style.width = "304px";
3748
+ menu.style.maxWidth = "calc(100vw - 16px)";
3749
+ menu.style.boxSizing = "border-box";
3750
+ menu.style.pointerEvents = "auto";
3703
3751
  const {
3704
3752
  header,
3705
3753
  headerActions,
@@ -3786,20 +3834,23 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
3786
3834
  menu.appendChild(askAiSection);
3787
3835
  const actionsSection = createMenuSection();
3788
3836
  menu.appendChild(actionsSection);
3789
- const viewportWidth = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
3790
- const safeWidth = viewportWidth > 0 ? viewportWidth : MENU_WIDTH;
3791
- menu.style.left = `${Math.min(clickX, Math.max(safeWidth - MENU_WIDTH, 0))}px`;
3837
+ menu.style.left = `${clickX}px`;
3792
3838
  menu.style.visibility = "hidden";
3793
3839
  menu.style.display = "block";
3794
3840
  shadowRoot.appendChild(menu);
3795
3841
  const updatePosition = () => {
3796
3842
  const rect = menu.getBoundingClientRect();
3797
- const viewportHeight = Math.max(
3798
- document.documentElement.clientHeight || 0,
3799
- window.innerHeight || 0
3800
- );
3801
- const safeHeight = viewportHeight > 0 ? viewportHeight : rect.height + 16;
3802
- menu.style.top = `${Math.min(clickY + 8, Math.max(safeHeight - rect.height - 8, 0))}px`;
3843
+ const { left: nextLeft, top: nextTop } = resolveMenuPosition({
3844
+ clickX,
3845
+ clickY,
3846
+ menuRect: { width: rect.width, height: rect.height },
3847
+ viewport: {
3848
+ width: document.documentElement.clientWidth || window.innerWidth || 0,
3849
+ height: document.documentElement.clientHeight || window.innerHeight || 0
3850
+ }
3851
+ });
3852
+ menu.style.left = `${nextLeft}px`;
3853
+ menu.style.top = `${nextTop}px`;
3803
3854
  };
3804
3855
  updatePosition();
3805
3856
  menu.style.visibility = "visible";
@@ -3902,9 +3953,10 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
3902
3953
  return null;
3903
3954
  }
3904
3955
  });
3905
- const resolveCssContextPrompt = () => {
3956
+ const resolveCssContextPrompt = (intent) => {
3906
3957
  var _a3, _b2;
3907
- if (!cssContextEnabled) return null;
3958
+ const shouldAttachCssContext = cssContextEnabled || Boolean(intent && isFixUiIntent(intent));
3959
+ if (!shouldAttachCssContext) return null;
3908
3960
  try {
3909
3961
  return (_b2 = (_a3 = deps.captureCssContextPrompt) == null ? void 0 : _a3.call(deps)) != null ? _b2 : null;
3910
3962
  } catch (e) {
@@ -3919,15 +3971,16 @@ function showIntentMenu(shadowRoot, location, clickX, clickY, options, onClose,
3919
3971
  const requestRuntimeContext = resolveRuntimeContext();
3920
3972
  const requestScreenshotContext = yield resolveScreenshotContext();
3921
3973
  const requestCssContextPrompt = resolveCssContextPrompt();
3922
- const built = yield buildCustomInspectPrompt({
3974
+ const built = yield buildCustomInspectPrompt(__spreadProps(__spreadValues({
3923
3975
  location,
3924
- ask: input.value.trim(),
3976
+ ask: input.value.trim()
3977
+ }, deps.targetLabel ? { targetLabel: deps.targetLabel } : {}), {
3925
3978
  includeSnippet,
3926
3979
  maxSnippetLines,
3927
3980
  runtimeContext: requestRuntimeContext,
3928
3981
  screenshotContext: requestScreenshotContext,
3929
3982
  cssContextPrompt: requestCssContextPrompt
3930
- });
3983
+ }));
3931
3984
  yield openAndSendInspectPrompt({
3932
3985
  location,
3933
3986
  promptText: built.prompt,
@@ -4618,6 +4671,10 @@ function handleMouseMove(ctx, event) {
4618
4671
  state.lastPointerX = event.clientX;
4619
4672
  state.lastPointerY = event.clientY;
4620
4673
  state.updateLauncherEye();
4674
+ if (state.cleanupMenu !== null) {
4675
+ state.overlay.hide();
4676
+ return;
4677
+ }
4621
4678
  const isActive = state.isInspectorActive(event);
4622
4679
  if (!isActive) {
4623
4680
  state.overlay.hide();
@@ -4639,8 +4696,8 @@ function handleMouseMove(ctx, event) {
4639
4696
  event.stopPropagation();
4640
4697
  }
4641
4698
  function handleTrigger(ctx, event) {
4642
- var _a2;
4643
4699
  const state = asInteractionContext(ctx);
4700
+ if (state.cleanupMenu !== null) return;
4644
4701
  if (!state.isInspectorActive(event)) return;
4645
4702
  const target = findInspectable(event.target);
4646
4703
  if (!target) return;
@@ -4659,11 +4716,12 @@ function handleTrigger(ctx, event) {
4659
4716
  return;
4660
4717
  }
4661
4718
  if (state.shouldQuickJumpOnTrigger(event)) {
4662
- (_a2 = state.cleanupMenu) == null ? void 0 : _a2.call(state);
4719
+ state.overlay.hide();
4663
4720
  state.cleanupMenu = null;
4664
4721
  void openFile(loc);
4665
4722
  return;
4666
4723
  }
4724
+ state.overlay.hide();
4667
4725
  state.openInspectMenu(loc, event.clientX, event.clientY, target);
4668
4726
  }
4669
4727
  function handleKeyDown(ctx, event) {
@@ -4691,6 +4749,7 @@ function openInspectMenu(ctx, loc, clientX, clientY, targetElement) {
4691
4749
  var _a2, _b;
4692
4750
  const state = asInteractionContext(ctx);
4693
4751
  (_a2 = state.cleanupMenu) == null ? void 0 : _a2.call(state);
4752
+ state.style.pointerEvents = "auto";
4694
4753
  state.cleanupMenu = showIntentMenu(
4695
4754
  state.shadowRootEl,
4696
4755
  loc,
@@ -4698,6 +4757,7 @@ function openInspectMenu(ctx, loc, clientX, clientY, targetElement) {
4698
4757
  clientY,
4699
4758
  state.options,
4700
4759
  () => {
4760
+ state.style.pointerEvents = "none";
4701
4761
  state.cleanupMenu = null;
4702
4762
  },
4703
4763
  {
@@ -5198,11 +5258,14 @@ function createAnnotateSidebarRenderers({
5198
5258
  titleEl.style.letterSpacing = "0.04em";
5199
5259
  titleEl.textContent = title;
5200
5260
  const contentEl = document.createElement("div");
5261
+ contentEl.style.minWidth = "0";
5262
+ contentEl.style.whiteSpace = "normal";
5263
+ contentEl.style.overflowWrap = "anywhere";
5264
+ contentEl.style.wordBreak = "break-word";
5201
5265
  if (typeof content === "string") {
5202
5266
  contentEl.style.fontSize = "13px";
5203
5267
  contentEl.style.color = "rgba(255, 255, 255, 0.9)";
5204
5268
  contentEl.style.lineHeight = "1.4";
5205
- contentEl.style.wordBreak = "break-word";
5206
5269
  if (title === "NOTE" && !chip.note.trim()) {
5207
5270
  contentEl.style.fontStyle = "italic";
5208
5271
  contentEl.style.color = "rgba(255, 255, 255, 0.4)";
@@ -5215,9 +5278,13 @@ function createAnnotateSidebarRenderers({
5215
5278
  return section;
5216
5279
  };
5217
5280
  const elementValue = document.createElement("div");
5281
+ elementValue.style.minWidth = "0";
5218
5282
  elementValue.style.fontFamily = "monospace";
5219
5283
  elementValue.style.fontSize = "13px";
5220
5284
  elementValue.style.color = "#9cdcfe";
5285
+ elementValue.style.whiteSpace = "normal";
5286
+ elementValue.style.overflowWrap = "anywhere";
5287
+ elementValue.style.wordBreak = "break-word";
5221
5288
  elementValue.textContent = chip.label;
5222
5289
  activeTooltip.appendChild(createSection("ELEMENT", elementValue));
5223
5290
  activeTooltip.appendChild(createSection("NOTE", chip.note.trim() || "No note provided"));
@@ -5252,9 +5319,12 @@ function createAnnotateSidebarRenderers({
5252
5319
  chipElement.className = annotateSidebarChipClass;
5253
5320
  chipElement.contentEditable = "false";
5254
5321
  chipElement.style.margin = "0 4px";
5322
+ chipElement.style.boxSizing = "border-box";
5255
5323
  chipElement.style.display = "inline-flex";
5256
5324
  chipElement.style.alignItems = "center";
5257
5325
  chipElement.style.gap = "5px";
5326
+ chipElement.style.minWidth = "0";
5327
+ chipElement.style.maxWidth = "calc(100% - 8px)";
5258
5328
  chipElement.style.verticalAlign = "middle";
5259
5329
  chipElement.tabIndex = 0;
5260
5330
  chipElement.setAttribute("role", "button");
@@ -5262,6 +5332,11 @@ function createAnnotateSidebarRenderers({
5262
5332
  chipElement.dataset.state = chip.state;
5263
5333
  const label = document.createElement("span");
5264
5334
  label.dataset.annotateChipLabel = "true";
5335
+ label.style.flex = "1 1 auto";
5336
+ label.style.minWidth = "0";
5337
+ label.style.overflow = "hidden";
5338
+ label.style.textOverflow = "ellipsis";
5339
+ label.style.whiteSpace = "nowrap";
5265
5340
  label.textContent = chip.label;
5266
5341
  const actionSlot = document.createElement("span");
5267
5342
  actionSlot.style.position = "relative";
@@ -5696,6 +5771,7 @@ function teardownListeners(_ctx, handlers) {
5696
5771
  // src/overlay.ts
5697
5772
  var GAP = 8;
5698
5773
  var EDGE_MARGIN = 4;
5774
+ var MAX_CLASS_SUMMARY_LENGTH = 96;
5699
5775
  function createOverlay(shadowRoot) {
5700
5776
  const overlay = document.createElement("div");
5701
5777
  overlay.className = overlayClass;
@@ -5734,7 +5810,7 @@ function createOverlay(shadowRoot) {
5734
5810
  tagSpan.textContent = tagName;
5735
5811
  idSpan.textContent = el.id ? `#${el.id}` : "";
5736
5812
  const classes = Array.from(el.classList).map((c) => `.${c}`).join("");
5737
- classSpan.textContent = classes;
5813
+ classSpan.textContent = summarizeClasses(classes);
5738
5814
  dimSpan.textContent = `${Math.round(rect.width)} \xD7 ${Math.round(rect.height)}`;
5739
5815
  sourceSpan.textContent = sourceLabel;
5740
5816
  tooltip.style.visibility = "hidden";
@@ -5774,6 +5850,10 @@ function createOverlay(shadowRoot) {
5774
5850
  }
5775
5851
  return { show, hide };
5776
5852
  }
5853
+ function summarizeClasses(classes) {
5854
+ if (classes.length <= MAX_CLASS_SUMMARY_LENGTH) return classes;
5855
+ return `${classes.slice(0, MAX_CLASS_SUMMARY_LENGTH - 3)}...`;
5856
+ }
5777
5857
 
5778
5858
  // src/component-lifecycle.ts
5779
5859
  function asLifecycleContext(ctx) {
@@ -5799,6 +5879,11 @@ function resetAnnotateState(state) {
5799
5879
  }
5800
5880
  function connect(ctx, createAnnotateOverlay2) {
5801
5881
  const state = asLifecycleContext(ctx);
5882
+ const host = state;
5883
+ host.style.position = "fixed";
5884
+ host.style.inset = "0";
5885
+ host.style.pointerEvents = "none";
5886
+ host.style.zIndex = "2147483646";
5802
5887
  state.shadowRootEl = state.attachShadow({ mode: "open" });
5803
5888
  const style = document.createElement("style");
5804
5889
  style.textContent = inspectorStyles;
@@ -6310,10 +6395,10 @@ var InspectoElement = class extends BaseElement {
6310
6395
  });
6311
6396
  }
6312
6397
  };
6313
- if (typeof customElements !== "undefined") {
6398
+ if (typeof customElements !== "undefined" && !customElements.get("inspecto-overlay")) {
6314
6399
  customElements.define("inspecto-overlay", InspectoElement);
6315
6400
  }
6316
6401
  export {
6317
6402
  InspectoElement
6318
6403
  };
6319
- //# sourceMappingURL=component-D75QZTRY.js.map
6404
+ //# sourceMappingURL=component-RQ76TEPZ.js.map