uidex 0.2.0 → 0.2.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.
@@ -359,6 +359,8 @@ declare class Overlay {
359
359
  private updateLabel;
360
360
  private applyLabelPosition;
361
361
  private updatePosition;
362
+ /** Move the label inside the overlay when there is no room outside. */
363
+ private clampLabel;
362
364
  private addListeners;
363
365
  private removeListeners;
364
366
  }
@@ -359,6 +359,8 @@ declare class Overlay {
359
359
  private updateLabel;
360
360
  private applyLabelPosition;
361
361
  private updatePosition;
362
+ /** Move the label inside the overlay when there is no room outside. */
363
+ private clampLabel;
362
364
  private addListeners;
363
365
  private removeListeners;
364
366
  }
@@ -277,7 +277,7 @@ var UidexCore = (() => {
277
277
  }
278
278
 
279
279
  // src/core/overlay.ts
280
- var DEFAULT_COLOR = "#e5e5e5";
280
+ var DEFAULT_COLOR = "#3b82f6";
281
281
  var DEFAULT_BORDER_STYLE = "solid";
282
282
  var DEFAULT_BORDER_WIDTH = 2;
283
283
  var DEFAULT_LABEL_POSITION = "top-left";
@@ -428,6 +428,23 @@ var UidexCore = (() => {
428
428
  this.element.style.left = `${rect.left}px`;
429
429
  this.element.style.width = `${rect.width}px`;
430
430
  this.element.style.height = `${rect.height}px`;
431
+ this.clampLabel(rect);
432
+ }
433
+ /** Move the label inside the overlay when there is no room outside. */
434
+ clampLabel(rect) {
435
+ if (!this.labelElement || this.labelElement.style.display === "none") return;
436
+ const {
437
+ labelPosition = DEFAULT_LABEL_POSITION
438
+ } = this.options;
439
+ const isTop = labelPosition === "top-left" || labelPosition === "top-right";
440
+ const labelHeight = 20;
441
+ if (isTop && rect.top < labelHeight) {
442
+ this.labelElement.style.top = "4px";
443
+ this.labelElement.style.transform = "";
444
+ } else if (!isTop && window.innerHeight - rect.bottom < labelHeight) {
445
+ this.labelElement.style.bottom = "4px";
446
+ this.labelElement.style.transform = "";
447
+ }
431
448
  }
432
449
  addListeners() {
433
450
  window.addEventListener("resize", this.boundUpdatePosition);
@@ -3242,6 +3259,7 @@ body.uidex-inspecting * {
3242
3259
  this.shadowHost.style.width = "0";
3243
3260
  this.shadowHost.style.height = "0";
3244
3261
  this.shadowHost.style.pointerEvents = "none";
3262
+ this.shadowHost.style.zIndex = "2147483646";
3245
3263
  this.shadowRoot = this.shadowHost.attachShadow({ mode: "open" });
3246
3264
  injectStyles(this.shadowRoot);
3247
3265
  const presentIds = this.scanPresentIds(componentIds);