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.js CHANGED
@@ -237,7 +237,7 @@ function resolveColor(color, colorMap) {
237
237
  }
238
238
 
239
239
  // src/core/overlay.ts
240
- var DEFAULT_COLOR = "#e5e5e5";
240
+ var DEFAULT_COLOR = "#3b82f6";
241
241
  var DEFAULT_BORDER_STYLE = "solid";
242
242
  var DEFAULT_BORDER_WIDTH = 2;
243
243
  var DEFAULT_LABEL_POSITION = "top-left";
@@ -388,6 +388,23 @@ var Overlay = class {
388
388
  this.element.style.left = `${rect.left}px`;
389
389
  this.element.style.width = `${rect.width}px`;
390
390
  this.element.style.height = `${rect.height}px`;
391
+ this.clampLabel(rect);
392
+ }
393
+ /** Move the label inside the overlay when there is no room outside. */
394
+ clampLabel(rect) {
395
+ if (!this.labelElement || this.labelElement.style.display === "none") return;
396
+ const {
397
+ labelPosition = DEFAULT_LABEL_POSITION
398
+ } = this.options;
399
+ const isTop = labelPosition === "top-left" || labelPosition === "top-right";
400
+ const labelHeight = 20;
401
+ if (isTop && rect.top < labelHeight) {
402
+ this.labelElement.style.top = "4px";
403
+ this.labelElement.style.transform = "";
404
+ } else if (!isTop && window.innerHeight - rect.bottom < labelHeight) {
405
+ this.labelElement.style.bottom = "4px";
406
+ this.labelElement.style.transform = "";
407
+ }
391
408
  }
392
409
  addListeners() {
393
410
  window.addEventListener("resize", this.boundUpdatePosition);
@@ -3202,6 +3219,7 @@ var UidexUI = class {
3202
3219
  this.shadowHost.style.width = "0";
3203
3220
  this.shadowHost.style.height = "0";
3204
3221
  this.shadowHost.style.pointerEvents = "none";
3222
+ this.shadowHost.style.zIndex = "2147483646";
3205
3223
  this.shadowRoot = this.shadowHost.attachShadow({ mode: "open" });
3206
3224
  injectStyles(this.shadowRoot);
3207
3225
  const presentIds = this.scanPresentIds(componentIds);