@threadlabs/looma 0.31.1 → 0.31.3

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.
@@ -364,7 +364,7 @@ export function createViewportSurface(surface, options = {}) {
364
364
  // Suppress newly introduced UA borders without overriding authored theme-dependent chrome.
365
365
  for (const side of absentBorders) surface.style[`border${side}Width`] = "0";
366
366
  } else {
367
- Object.assign(surface.style, { padding: "0", border: "0", background: "transparent" });
367
+ Object.assign(surface.style, { padding: "0", border: "0", background: "transparent", overflow: "visible" });
368
368
  }
369
369
  }
370
370
  const hideSurface = () => {
@@ -0,0 +1,7 @@
1
+ /** Resolve the inherited pointer-intent delay; CSS time values and millisecond numbers are accepted. */
2
+ export function tooltipShowDelay(element, fallback = 500) {
3
+ if (!element) return fallback;
4
+ const value = element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue("--ui-tooltip-show-delay").trim();
5
+ const match = /^([0-9]+(?:\.[0-9]+)?)(ms|s)?$/.exec(value);
6
+ return match ? Number(match[1]) * (match[2] === "s" ? 1000 : 1) : fallback;
7
+ }
@@ -73,6 +73,7 @@
73
73
  }
74
74
 
75
75
  :host([floating]) {
76
+ box-sizing: border-box;
76
77
  position: relative;
77
78
  top: auto;
78
79
  width: max-content;
@@ -1,5 +1,7 @@
1
1
  <template component="ui-popover" module="./ui-popover.js">
2
2
  <defs>
3
+ <prop name="bare" type="boolean" default="false"
4
+ >Delegates the surface to its content, with no padding, border, background, shadow, or overflow clipping.</prop>
3
5
  <prop name="size" type="keyword" values="content, sm, md, lg" default="content"
4
6
  >Optional size preset. content keeps the existing intrinsic sizing; the other sizes constrain the surface for compact, medium, or large content.</prop>
5
7
  <prop name="open" type="boolean" default="false">Whether the popover is open initially or when set externally.</prop>
@@ -93,6 +95,15 @@
93
95
  box-shadow: var(--_ui-popover-shadow, var(--ui-overlay-shadow, var(--ui-elevation-overlay, var(--ui-shadow-lg))));
94
96
  }
95
97
 
98
+ /* A toolbar or card can supply its own surface, including an unclipped shadow. */
99
+ :host([bare]) .surface {
100
+ overflow: visible;
101
+ padding: 0;
102
+ border: 0;
103
+ background: transparent;
104
+ box-shadow: none;
105
+ }
106
+
96
107
  :host(:not(:state(internalOpen))) {
97
108
  display: none;
98
109
  }
@@ -1,3 +1,4 @@
1
+ import { tooltipShowDelay } from "../shared/tooltip.js";
1
2
  import { closeOverlay, createAnchoredSurface, createIdResolver, onOverlayOpen, openOverlay } from "../shared/overlay.js";
2
3
 
3
4
  const warmTooltips = new WeakMap();
@@ -61,7 +62,7 @@ export function connect(host) {
61
62
  showTimer = setTimeout(() => {
62
63
  showTimer = null;
63
64
  setOpen(true, "pointer");
64
- }, warm.active > 0 || warm.until > Date.now() ? 0 : Math.max(0, Number(host.props.showDelay.value ?? 500)));
65
+ }, warm.active > 0 || warm.until > Date.now() ? 0 : Math.max(0, host.props.showDelay.inputValue != null ? Number(host.props.showDelay.value) : tooltipShowDelay(element)));
65
66
  };
66
67
  const onLeave = () => {
67
68
  clearShow();
@@ -134,6 +135,8 @@ export function connect(host) {
134
135
  if (how === "hover") {
135
136
  trigger.addEventListener("pointerenter", onEnter);
136
137
  trigger.addEventListener("pointerleave", onLeave);
138
+ // Editor decorations can acquire their tooltip after the pointer has already entered.
139
+ if (trigger.matches(":hover")) onEnter({ pointerType: "mouse" });
137
140
  }
138
141
  trigger.addEventListener("focusin", onFocusin);
139
142
  trigger.addEventListener("focusout", onFocusout);