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.
@@ -232,7 +232,7 @@ function resolveColor(color, colorMap) {
232
232
  }
233
233
 
234
234
  // src/core/overlay.ts
235
- var DEFAULT_COLOR = "#e5e5e5";
235
+ var DEFAULT_COLOR = "#3b82f6";
236
236
  var DEFAULT_BORDER_STYLE = "solid";
237
237
  var DEFAULT_BORDER_WIDTH = 2;
238
238
  var DEFAULT_LABEL_POSITION = "top-left";
@@ -383,6 +383,23 @@ var Overlay = class {
383
383
  this.element.style.left = `${rect.left}px`;
384
384
  this.element.style.width = `${rect.width}px`;
385
385
  this.element.style.height = `${rect.height}px`;
386
+ this.clampLabel(rect);
387
+ }
388
+ /** Move the label inside the overlay when there is no room outside. */
389
+ clampLabel(rect) {
390
+ if (!this.labelElement || this.labelElement.style.display === "none") return;
391
+ const {
392
+ labelPosition = DEFAULT_LABEL_POSITION
393
+ } = this.options;
394
+ const isTop = labelPosition === "top-left" || labelPosition === "top-right";
395
+ const labelHeight = 20;
396
+ if (isTop && rect.top < labelHeight) {
397
+ this.labelElement.style.top = "4px";
398
+ this.labelElement.style.transform = "";
399
+ } else if (!isTop && window.innerHeight - rect.bottom < labelHeight) {
400
+ this.labelElement.style.bottom = "4px";
401
+ this.labelElement.style.transform = "";
402
+ }
386
403
  }
387
404
  addListeners() {
388
405
  window.addEventListener("resize", this.boundUpdatePosition);
@@ -3197,6 +3214,7 @@ var UidexUI = class {
3197
3214
  this.shadowHost.style.width = "0";
3198
3215
  this.shadowHost.style.height = "0";
3199
3216
  this.shadowHost.style.pointerEvents = "none";
3217
+ this.shadowHost.style.zIndex = "2147483646";
3200
3218
  this.shadowRoot = this.shadowHost.attachShadow({ mode: "open" });
3201
3219
  injectStyles(this.shadowRoot);
3202
3220
  const presentIds = this.scanPresentIds(componentIds);