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.
package/dist/index.cjs CHANGED
@@ -273,7 +273,7 @@ function resolveColor(color, colorMap) {
273
273
  }
274
274
 
275
275
  // src/core/overlay.ts
276
- var DEFAULT_COLOR = "#e5e5e5";
276
+ var DEFAULT_COLOR = "#3b82f6";
277
277
  var DEFAULT_BORDER_STYLE = "solid";
278
278
  var DEFAULT_BORDER_WIDTH = 2;
279
279
  var DEFAULT_LABEL_POSITION = "top-left";
@@ -424,6 +424,23 @@ var Overlay = class {
424
424
  this.element.style.left = `${rect.left}px`;
425
425
  this.element.style.width = `${rect.width}px`;
426
426
  this.element.style.height = `${rect.height}px`;
427
+ this.clampLabel(rect);
428
+ }
429
+ /** Move the label inside the overlay when there is no room outside. */
430
+ clampLabel(rect) {
431
+ if (!this.labelElement || this.labelElement.style.display === "none") return;
432
+ const {
433
+ labelPosition = DEFAULT_LABEL_POSITION
434
+ } = this.options;
435
+ const isTop = labelPosition === "top-left" || labelPosition === "top-right";
436
+ const labelHeight = 20;
437
+ if (isTop && rect.top < labelHeight) {
438
+ this.labelElement.style.top = "4px";
439
+ this.labelElement.style.transform = "";
440
+ } else if (!isTop && window.innerHeight - rect.bottom < labelHeight) {
441
+ this.labelElement.style.bottom = "4px";
442
+ this.labelElement.style.transform = "";
443
+ }
427
444
  }
428
445
  addListeners() {
429
446
  window.addEventListener("resize", this.boundUpdatePosition);
@@ -3238,6 +3255,7 @@ var UidexUI = class {
3238
3255
  this.shadowHost.style.width = "0";
3239
3256
  this.shadowHost.style.height = "0";
3240
3257
  this.shadowHost.style.pointerEvents = "none";
3258
+ this.shadowHost.style.zIndex = "2147483646";
3241
3259
  this.shadowRoot = this.shadowHost.attachShadow({ mode: "open" });
3242
3260
  injectStyles(this.shadowRoot);
3243
3261
  const presentIds = this.scanPresentIds(componentIds);