@syware/jlib 0.16.0 → 0.16.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.
@@ -1,3 +1,3 @@
1
1
  // src/atoms/jl-select.css?inline
2
- var jl_select_default = ":host{display:block}.control{padding:0;position:relative}.native{border-radius:inherit;text-overflow:ellipsis;cursor:pointer;appearance:none;padding:0 36px 0 12px}.native:disabled{cursor:not-allowed}:host([placeholder-shown]) .native{color:var(--jl-muted)}option,optgroup{background:var(--jl-surface);color:var(--jl-text)}.chevron{color:var(--jl-muted);pointer-events:none;transition:transform var(--jl-fast) var(--jl-ease);position:absolute;right:12px}.native:open+.chevron{transform:rotate(180deg)}:host([disabled]) .chevron{color:var(--jl-faint)}@media (hover:hover) and (pointer:fine){@supports (appearance:base-select){.control{anchor-name:--frame}.native{appearance:base-select}.native::picker(select){appearance:base-select}.native{-webkit-line-clamp:1;padding-block:calc((var(--height,var(--jl-control-md)) - 2px - 1lh) / 2);overflow-clip-margin:content-box;-webkit-box-orient:vertical;display:-webkit-box;overflow:clip}.native::picker-icon{display:none}.native::picker(select){position-anchor:--frame;position-try-order:normal;box-sizing:border-box;min-inline-size:anchor-size(self-inline);border:1px solid var(--jl-line);border-radius:var(--jl-radius);background:var(--jl-surface);max-block-size:274px;color:var(--jl-text);box-shadow:var(--jl-shadow-lg);animation:jl-float-in var(--jl-fast) var(--jl-ease);margin-block:6px;padding:4px}optgroup{color:var(--jl-muted);font-size:var(--jl-font-xs);text-indent:calc(10px - .5em);padding-block-start:8px;font-weight:600}optgroup>option:first-of-type{margin-block-start:4px}option{box-sizing:border-box;border-radius:var(--jl-radius-xs);min-block-size:34px;font-size:var(--jl-font-md);text-indent:0;cursor:pointer;gap:10px;padding:6px 10px;font-weight:400;line-height:1.35}option:enabled:is(:hover,:focus-visible){background:var(--jl-surface-3);box-shadow:none}option:checked{font-weight:600}option:disabled{color:var(--jl-faint);cursor:not-allowed}option::checkmark{background:var(--jl-accent);content:\"\";order:1;width:14px;height:14px;margin-inline-start:auto;-webkit-mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E\") 50%/contain no-repeat;mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E\") 50%/contain no-repeat}}}";
2
+ var jl_select_default = ":host{display:block}.control{padding:0;position:relative}.native{border-radius:inherit;text-overflow:ellipsis;cursor:pointer;appearance:none;padding:0 36px 0 12px}.native:disabled{cursor:not-allowed}.control:has(.native:open){border-color:var(--jl-accent);box-shadow:var(--jl-focus-ring)}:host([invalid]) .control:has(.native:open){border-color:var(--jl-danger);box-shadow:0 0 0 3px color-mix(in srgb, var(--jl-danger) 25%, transparent)}:host([placeholder-shown]) .native{color:var(--jl-muted)}option,optgroup{background:var(--jl-surface);color:var(--jl-text)}.chevron{color:var(--jl-muted);pointer-events:none;transition:transform var(--jl-fast) var(--jl-ease);position:absolute;right:12px}.native:open+.chevron{transform:rotate(180deg)}:host([disabled]) .chevron{color:var(--jl-faint)}@position-try --jl-fit-below{position-area:self-end span-self-end;min-block-size:calc(50dvh - anchor-size(self-block) / 2 - 12px);max-block-size:calc(100% - 14px)}@position-try --jl-fit-above{position-area:self-start span-self-end;max-block-size:calc(100% - 14px)}@media (hover:hover) and (pointer:fine){@supports (appearance:base-select){.control{anchor-name:--frame}.native{appearance:base-select}.native::picker(select){appearance:base-select}.native{-webkit-line-clamp:1;padding-block:calc((var(--height,var(--jl-control-md)) - 2px - 1lh) / 2);overflow-clip-margin:content-box;-webkit-box-orient:vertical;display:-webkit-box;overflow:clip}.native::picker-icon{display:none}.native::picker(select){position-anchor:--frame;position-try-order:normal;position-try-fallbacks:self-start span-self-end, self-end span-self-start, self-start span-self-start, --jl-fit-below, --jl-fit-above;box-sizing:border-box;min-inline-size:anchor-size(self-inline);border:1px solid var(--jl-line);border-radius:var(--jl-radius);background:var(--jl-surface);max-block-size:274px;color:var(--jl-text);box-shadow:var(--jl-shadow-lg);animation:jl-float-in var(--jl-fast) var(--jl-ease);margin-block:6px;padding:4px}optgroup{color:var(--jl-muted);font-size:var(--jl-font-xs);text-indent:calc(10px - .5em);padding-block-start:8px;font-weight:600}optgroup>option:first-of-type{margin-block-start:4px}option{box-sizing:border-box;border-radius:var(--jl-radius-xs);min-block-size:34px;font-size:var(--jl-font-md);text-indent:0;cursor:pointer;gap:10px;padding:6px 10px;font-weight:400;line-height:1.35}option:enabled:focus{background:var(--jl-surface-3);box-shadow:none}option:checked{font-weight:600}option:disabled{color:var(--jl-faint);cursor:not-allowed}option::checkmark{background:var(--jl-accent);content:\"\";order:1;width:14px;height:14px;margin-inline-start:auto;-webkit-mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E\") 50%/contain no-repeat;mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E\") 50%/contain no-repeat}}}";
3
3
  export { jl_select_default as default };
@@ -59,6 +59,12 @@ export declare class JlSelect<Value extends string = string> extends JlFormContr
59
59
  templateCss(): string;
60
60
  onConnect(): void;
61
61
  onDisconnect(): void;
62
+ /**
63
+ * In a list the page draws (customizable select), the pointer takes the focus to the option under it, as in the
64
+ * combobox and the platform's own lists: one row is lit, the one Enter takes and the arrows go on from. The browser
65
+ * leaves the focus where the keys put it, and a row lit on hover as well made two.
66
+ */
67
+ private focusOptionAt;
62
68
  /** Draws the page's options again when one came, left or changed. The select's own attributes are its inputs. */
63
69
  private onLightChange;
64
70
  protected resetValue(): void;
@@ -102,6 +102,7 @@ var JlSelect = class extends JlFormControl {
102
102
  this.value.set(value);
103
103
  this.events.emit("change", value);
104
104
  });
105
+ this.on(native, "pointermove", (event) => this.focusOptionAt(event));
105
106
  this.renderOptions();
106
107
  this._lightWatch.observe(this, {
107
108
  attributes: true,
@@ -113,6 +114,15 @@ var JlSelect = class extends JlFormControl {
113
114
  onDisconnect() {
114
115
  this._lightWatch.disconnect();
115
116
  }
117
+ /**
118
+ * In a list the page draws (customizable select), the pointer takes the focus to the option under it, as in the
119
+ * combobox and the platform's own lists: one row is lit, the one Enter takes and the arrows go on from. The browser
120
+ * leaves the focus where the keys put it, and a row lit on hover as well made two.
121
+ */
122
+ focusOptionAt(event) {
123
+ const option = event.target instanceof Element ? event.target.closest("option") : null;
124
+ if (option !== null && !option.disabled && !option.matches(":focus")) option.focus({ preventScroll: true });
125
+ }
116
126
  /** Draws the page's options again when one came, left or changed. The select's own attributes are its inputs. */
117
127
  onLightChange(records) {
118
128
  if (records.every((record) => record.target === this && record.type === "attributes")) return;
@@ -2,10 +2,12 @@ import type { Placement, Point, Rect, Size } from '../types/floating.types';
2
2
  export declare const PLACEMENTS: readonly Placement[];
3
3
  /**
4
4
  * Where to put a floating element next to its anchor, in window coordinates: on the asked side when it fits,
5
- * otherwise on the opposite side if that leaves more of it visible; then kept inside the window.
5
+ * otherwise on the opposite side if that leaves more of it visible; then kept inside the window. `room` is the
6
+ * height it can take there without leaving the window.
6
7
  */
7
8
  export declare function computePosition(anchor: Rect, floating: Size, viewport: Size, placement: Placement, gap?: number): Point & {
8
9
  placement: Placement;
10
+ room: number;
9
11
  };
10
12
  /**
11
13
  * Puts a fixed-position element next to its anchor, and gives what it measured: the anchor's rect, the element's
@@ -24,5 +26,11 @@ export declare function positionFloating(anchor: Element, floating: HTMLElement,
24
26
  export declare function placeAtPoint(point: Point, floating: HTMLElement): void;
25
27
  /** Puts a fixed-position element next to its anchor; returns the placement it got after flipping. */
26
28
  export declare function placeFloating(anchor: Element, floating: HTMLElement, placement: Placement, gap?: number): Placement;
29
+ /**
30
+ * Calls `update` whenever the anchor may have moved in the window, until the signal aborts: the window resized, the
31
+ * page scrolled, or one of the elements the anchor is drawn in did. An element's `scroll` event does not bubble, and
32
+ * one in a shadow root (an app shell's main area) never leaves it: the window does not hear it, its element does.
33
+ */
34
+ export declare function whenAnchorMoves(anchor: Element, update: () => void, signal: AbortSignal): void;
27
35
  /** Keeps a floating element by its anchor while the page scrolls or resizes, until the signal aborts. */
28
36
  export declare function followAnchor(anchor: Element, floating: HTMLElement, placement: Placement, signal: AbortSignal, gap?: number): void;
@@ -71,9 +71,21 @@ function overflowOn(point, floating, viewport, side) {
71
71
  return Math.max(0, overflows[side]);
72
72
  }
73
73
  var clamp = (value, min, max) => Math.min(Math.max(value, min), Math.max(min, max));
74
+ /** The height a floating element can take on a side of its anchor without leaving the window. */
75
+ function roomOn(anchor, viewport, side, gap) {
76
+ const besideRoom = viewport.height - 16;
77
+ const rooms = {
78
+ bottom: viewport.height - VIEWPORT_MARGIN - (anchor.top + anchor.height + gap),
79
+ left: besideRoom,
80
+ right: besideRoom,
81
+ top: anchor.top - gap - VIEWPORT_MARGIN
82
+ };
83
+ return Math.max(0, Math.floor(rooms[side]));
84
+ }
74
85
  /**
75
86
  * Where to put a floating element next to its anchor, in window coordinates: on the asked side when it fits,
76
- * otherwise on the opposite side if that leaves more of it visible; then kept inside the window.
87
+ * otherwise on the opposite side if that leaves more of it visible; then kept inside the window. `room` is the
88
+ * height it can take there without leaving the window.
77
89
  */
78
90
  function computePosition(anchor, floating, viewport, placement, gap = DEFAULT_GAP) {
79
91
  const { side, align } = splitPlacement(placement);
@@ -89,6 +101,7 @@ function computePosition(anchor, floating, viewport, placement, gap = DEFAULT_GA
89
101
  return {
90
102
  left: isVertical(finalSide) ? clamp(point.left, VIEWPORT_MARGIN, maxLeft) : point.left,
91
103
  placement: joinPlacement(finalSide, align),
104
+ room: roomOn(anchor, viewport, finalSide, gap),
92
105
  top: isVertical(finalSide) ? point.top : clamp(point.top, VIEWPORT_MARGIN, maxTop)
93
106
  };
94
107
  }
@@ -104,7 +117,12 @@ function positionFloating(anchor, floating, placement, gap) {
104
117
  ...positionBy(rect, floating, placement, gap)
105
118
  };
106
119
  }
107
- /** Puts a fixed-position element next to a rectangle of the window, and gives where it went. */
120
+ /** The room on its side, told to the floating element: a panel that may be taller caps its height with it, and scrolls. */
121
+ var ROOM = "--room";
122
+ /**
123
+ * Puts a fixed-position element next to a rectangle of the window, and gives where it went. It tells the element
124
+ * the room it has there (`--room`); one whose height follows it is placed again by its new height, on the side it got.
125
+ */
108
126
  function positionBy(rect, floating, placement, gap) {
109
127
  const viewport = {
110
128
  height: window.innerHeight,
@@ -114,7 +132,16 @@ function positionBy(rect, floating, placement, gap) {
114
132
  height: floating.offsetHeight,
115
133
  width: floating.offsetWidth
116
134
  };
117
- const result = computePosition(rect, size, viewport, placement, gap);
135
+ let result = computePosition(rect, size, viewport, placement, gap);
136
+ const room = `${result.room}px`;
137
+ if (floating.style.getPropertyValue(ROOM) !== room) {
138
+ floating.style.setProperty(ROOM, room);
139
+ const height = floating.offsetHeight;
140
+ if (height !== size.height) {
141
+ size.height = height;
142
+ result = computePosition(rect, size, viewport, result.placement, gap);
143
+ }
144
+ }
118
145
  const left = Math.round(result.left);
119
146
  const top = Math.round(result.top);
120
147
  floating.style.left = `${left}px`;
@@ -136,30 +163,59 @@ var NO_GAP = 0;
136
163
  * left corner there, above the point when there is no room under it, and kept inside the window.
137
164
  */
138
165
  function placeAtPoint(point, floating) {
166
+ forgetRoom(floating);
139
167
  positionBy({
140
168
  ...point,
141
169
  height: 0,
142
170
  width: 0
143
171
  }, floating, AT_POINT, NO_GAP);
144
172
  }
173
+ /**
174
+ * Lets an element that opens again take its whole height before it is measured: capped by the room of its last
175
+ * opening, it would look as if it fitted on a side with less room than the other.
176
+ */
177
+ function forgetRoom(floating) {
178
+ floating.style.removeProperty(ROOM);
179
+ }
145
180
  /** Puts a fixed-position element next to its anchor; returns the placement it got after flipping. */
146
181
  function placeFloating(anchor, floating, placement, gap) {
147
182
  return positionFloating(anchor, floating, placement, gap).placement;
148
183
  }
184
+ /**
185
+ * The elements a node is drawn in, up to the root element: a slotted element's parent is its slot, a shadow root's
186
+ * is its host.
187
+ */
188
+ function flatAncestors(node) {
189
+ const ancestors = [];
190
+ let current = node;
191
+ while (current !== null) {
192
+ const parent = (current instanceof Element ? current.assignedSlot : null) ?? current.parentNode;
193
+ current = parent instanceof ShadowRoot ? parent.host : parent;
194
+ if (current instanceof Element) ancestors.push(current);
195
+ }
196
+ return ancestors;
197
+ }
198
+ /**
199
+ * Calls `update` whenever the anchor may have moved in the window, until the signal aborts: the window resized, the
200
+ * page scrolled, or one of the elements the anchor is drawn in did. An element's `scroll` event does not bubble, and
201
+ * one in a shadow root (an app shell's main area) never leaves it: the window does not hear it, its element does.
202
+ */
203
+ function whenAnchorMoves(anchor, update, signal) {
204
+ const options = {
205
+ passive: true,
206
+ signal
207
+ };
208
+ window.addEventListener("scroll", update, options);
209
+ window.addEventListener("resize", update, options);
210
+ for (const ancestor of flatAncestors(anchor)) ancestor.addEventListener("scroll", update, options);
211
+ }
149
212
  /** Keeps a floating element by its anchor while the page scrolls or resizes, until the signal aborts. */
150
213
  function followAnchor(anchor, floating, placement, signal, gap) {
151
214
  const update = () => {
152
215
  placeFloating(anchor, floating, placement, gap);
153
216
  };
154
- window.addEventListener("scroll", update, {
155
- capture: true,
156
- passive: true,
157
- signal
158
- });
159
- window.addEventListener("resize", update, {
160
- passive: true,
161
- signal
162
- });
217
+ whenAnchorMoves(anchor, update, signal);
218
+ forgetRoom(floating);
163
219
  update();
164
220
  }
165
- export { PLACEMENTS, computePosition, followAnchor, placeAtPoint, placeFloating, positionFloating };
221
+ export { PLACEMENTS, computePosition, followAnchor, placeAtPoint, placeFloating, positionFloating, whenAnchorMoves };
@@ -1,3 +1,3 @@
1
1
  // src/molecules/jl-combobox.css?inline
2
- var jl_combobox_default = ":host{min-width:0;display:block}.toggle jl-icon{transition:transform var(--jl-fast) var(--jl-ease)}:host([open]) .toggle jl-icon{transform:rotate(180deg)}.toggle:disabled{cursor:not-allowed}.popup{padding:4px}.listbox{max-height:264px;margin:0;padding:0;list-style:none;position:relative;overflow-y:auto}.option{border-radius:var(--jl-radius-xs);min-height:34px;color:var(--jl-text);font-size:var(--jl-font-md);cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:10px;padding:6px 10px;line-height:1.35;display:flex}.option[aria-selected=true]{background:var(--jl-surface-3)}.option-label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.option.chosen .option-label{font-weight:600}.option[aria-disabled=true]{color:var(--jl-faint);cursor:not-allowed}.text{flex:1;gap:1px;min-width:0;display:grid}.description{color:var(--jl-muted);font-size:var(--jl-font-xs)}.check{color:var(--jl-accent);visibility:hidden}.option.chosen .check{visibility:visible}mark{color:var(--jl-accent);background:0 0;font-weight:700}.empty{color:var(--jl-muted);font-size:var(--jl-font-sm);padding:8px 10px}";
2
+ var jl_combobox_default = ":host{min-width:0;display:block}.toggle jl-icon{transition:transform var(--jl-fast) var(--jl-ease)}:host([open]) .toggle jl-icon{transform:rotate(180deg)}.toggle:disabled{cursor:not-allowed}.popup{padding:4px}.listbox{max-height:min(264px, var(--room,100dvh) - 10px);margin:0;padding:0;list-style:none;position:relative;overflow-y:auto}.option{border-radius:var(--jl-radius-xs);min-height:34px;color:var(--jl-text);font-size:var(--jl-font-md);cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:10px;padding:6px 10px;line-height:1.35;display:flex}.option[aria-selected=true]{background:var(--jl-surface-3)}.option-label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.option.chosen .option-label{font-weight:600}.option[aria-disabled=true]{color:var(--jl-faint);cursor:not-allowed}.text{flex:1;gap:1px;min-width:0;display:grid}.description{color:var(--jl-muted);font-size:var(--jl-font-xs)}.check{color:var(--jl-accent);visibility:hidden}.option.chosen .check{visibility:visible}mark{color:var(--jl-accent);background:0 0;font-weight:700}.empty{color:var(--jl-muted);font-size:var(--jl-font-sm);padding:8px 10px}";
3
3
  export { jl_combobox_default as default };
@@ -1,3 +1,3 @@
1
1
  // src/molecules/jl-date-picker.css?inline
2
- var jl_date_picker_default = ":host{min-width:0;display:block}.open:disabled{cursor:not-allowed}:host([open]) .open{background:var(--jl-surface-3);color:var(--jl-text)}.popup{padding:0}.calendar::part(base){border:none}";
2
+ var jl_date_picker_default = ":host{min-width:0;display:block}.open:disabled{cursor:not-allowed}:host([open]) .open{background:var(--jl-surface-3);color:var(--jl-text)}.popup{max-height:var(--room,none);padding:0;overflow-y:auto}.calendar::part(base){border:none}";
3
3
  export { jl_date_picker_default as default };
@@ -1,3 +1,3 @@
1
1
  // src/molecules/jl-menu.css?inline
2
- var jl_menu_default = ":host{vertical-align:middle;display:inline-flex}.menu{min-width:200px;max-width:min(320px,100vw - 16px);max-height:min(420px,100dvh - 16px);padding:4px;overflow-y:auto}.menu:focus-visible{box-shadow:var(--jl-shadow-lg), var(--jl-focus-ring)}.item{border-radius:var(--jl-radius-xs);min-height:32px;color:var(--jl-text);font-size:var(--jl-font-md);cursor:pointer;-webkit-user-select:none;user-select:none;align-items:flex-start;gap:10px;padding:6px 10px;line-height:20px;display:flex}.item:focus,.item:focus-visible{box-shadow:none;background:var(--jl-surface-3);outline:none}.icon{color:var(--jl-muted);flex:none;margin-top:2px}.text{flex:1;min-width:0;display:grid}.label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.description{color:var(--jl-muted);font-size:var(--jl-font-xs);line-height:1.4}.shortcut{color:var(--jl-muted);font-size:var(--jl-font-xs);letter-spacing:.02em;flex:none;margin-left:12px}.item[data-danger]{color:var(--jl-danger)}.item[data-danger] .icon{color:inherit}.item[data-danger]:focus{background:var(--jl-danger-soft)}.item[aria-disabled]{color:var(--jl-faint);cursor:not-allowed}.item[aria-disabled] .icon,.item[aria-disabled] .description{color:inherit}.heading{color:var(--jl-muted);letter-spacing:.06em;text-transform:uppercase;padding:8px 10px 4px;font-size:11px;font-weight:650}.divider{background:var(--jl-line);border:none;height:1px;margin:4px -4px}";
2
+ var jl_menu_default = ":host{vertical-align:middle;display:inline-flex}.menu{min-width:200px;max-width:min(320px,100vw - 16px);max-height:min(420px, var(--room,calc(100dvh - 16px)));padding:4px;overflow-y:auto}.menu:focus-visible{box-shadow:var(--jl-shadow-lg), var(--jl-focus-ring)}.item{border-radius:var(--jl-radius-xs);min-height:32px;color:var(--jl-text);font-size:var(--jl-font-md);cursor:pointer;-webkit-user-select:none;user-select:none;align-items:flex-start;gap:10px;padding:6px 10px;line-height:20px;display:flex}.item:focus,.item:focus-visible{box-shadow:none;background:var(--jl-surface-3);outline:none}.icon{color:var(--jl-muted);flex:none;margin-top:2px}.text{flex:1;min-width:0;display:grid}.label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.description{color:var(--jl-muted);font-size:var(--jl-font-xs);line-height:1.4}.shortcut{color:var(--jl-muted);font-size:var(--jl-font-xs);letter-spacing:.02em;flex:none;margin-left:12px}.item[data-danger]{color:var(--jl-danger)}.item[data-danger] .icon{color:inherit}.item[data-danger]:focus{background:var(--jl-danger-soft)}.item[aria-disabled]{color:var(--jl-faint);cursor:not-allowed}.item[aria-disabled] .icon,.item[aria-disabled] .description{color:inherit}.heading{color:var(--jl-muted);letter-spacing:.06em;text-transform:uppercase;padding:8px 10px 4px;font-size:11px;font-weight:650}.divider{background:var(--jl-line);border:none;height:1px;margin:4px -4px}";
3
3
  export { jl_menu_default as default };
@@ -1,3 +1,3 @@
1
1
  // src/molecules/jl-popover.css?inline
2
- var jl_popover_default = ":host{vertical-align:middle;display:inline-flex}.panel{width:max-content;min-width:200px;max-width:min(360px,100vw - 16px);font-size:var(--jl-font-md);padding:14px 16px;line-height:1.5}.panel:focus-visible{box-shadow:var(--jl-shadow-lg), var(--jl-focus-ring)}header{margin-bottom:10px}h2{font-size:var(--jl-font-md);font-weight:700;line-height:1.4}";
2
+ var jl_popover_default = ":host{vertical-align:middle;display:inline-flex}.panel{width:max-content;min-width:200px;max-width:min(360px,100vw - 16px);max-height:var(--room,calc(100dvh - 16px));font-size:var(--jl-font-md);padding:14px 16px;line-height:1.5;overflow-y:auto}.panel:focus-visible{box-shadow:var(--jl-shadow-lg), var(--jl-focus-ring)}header{margin-bottom:10px}h2{font-size:var(--jl-font-md);font-weight:700;line-height:1.4}";
3
3
  export { jl_popover_default as default };
@@ -1,3 +1,3 @@
1
1
  // src/molecules/jl-tag-input.css?inline
2
- var jl_tag_input_default = ":host{--chip-height:calc(var(--height,var(--jl-control-md)) - 12px);min-width:0;display:block}.control{cursor:text;flex-wrap:wrap;gap:4px;padding:4px 6px}.tags{margin:0;padding:0;list-style:none;display:contents}.tag{max-width:100%;height:var(--chip-height);border:1px solid var(--jl-line);border-radius:var(--jl-radius-xs);background:var(--jl-surface-2);color:var(--jl-text);font-size:var(--jl-font-sm);cursor:default;align-items:center;gap:2px;padding:0 3px 0 8px;line-height:1;display:inline-flex}:host([size=sm]) .tag{font-size:var(--jl-font-xs);padding-left:6px}.tag.flash{animation:flash .6s var(--jl-ease)}.tag-text{text-overflow:ellipsis;white-space:nowrap;line-height:1.4;overflow:hidden}.tag-remove{width:18px;height:18px;color:var(--jl-faint);cursor:pointer;background:0 0;border:none;border-radius:4px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.tag-remove:hover,.tag-remove:focus-visible{background:var(--jl-surface-3);color:var(--jl-text)}.native{height:calc(var(--height,var(--jl-control-md)) - 10px);flex:1 0 80px;padding-left:6px}:host(:disabled) .tag{color:var(--jl-muted);padding-right:8px}:host(:disabled) .tag-remove{display:none}.popup{min-width:180px;padding:4px}.listbox{max-height:240px;margin:0;padding:0;list-style:none;position:relative;overflow-y:auto}.option{border-radius:var(--jl-radius-xs);color:var(--jl-text);font-size:var(--jl-font-md);white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none;padding:6px 10px;line-height:1.4}.option[aria-selected=true],.option:hover{background:var(--jl-surface-3)}mark{color:var(--jl-accent);background:0 0;font-weight:700}@keyframes flash{30%{border-color:var(--jl-accent-line);background:var(--jl-accent-soft);color:var(--jl-accent-strong)}}";
2
+ var jl_tag_input_default = ":host{--chip-height:calc(var(--height,var(--jl-control-md)) - 12px);min-width:0;display:block}.control{cursor:text;flex-wrap:wrap;gap:4px;padding:4px 6px}.tags{margin:0;padding:0;list-style:none;display:contents}.tag{max-width:100%;height:var(--chip-height);border:1px solid var(--jl-line);border-radius:var(--jl-radius-xs);background:var(--jl-surface-2);color:var(--jl-text);font-size:var(--jl-font-sm);cursor:default;align-items:center;gap:2px;padding:0 3px 0 8px;line-height:1;display:inline-flex}:host([size=sm]) .tag{font-size:var(--jl-font-xs);padding-left:6px}.tag.flash{animation:flash .6s var(--jl-ease)}.tag-text{text-overflow:ellipsis;white-space:nowrap;line-height:1.4;overflow:hidden}.tag-remove{width:18px;height:18px;color:var(--jl-faint);cursor:pointer;background:0 0;border:none;border-radius:4px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.tag-remove:hover,.tag-remove:focus-visible{background:var(--jl-surface-3);color:var(--jl-text)}.native{height:calc(var(--height,var(--jl-control-md)) - 10px);flex:1 0 80px;padding-left:6px}:host(:disabled) .tag{color:var(--jl-muted);padding-right:8px}:host(:disabled) .tag-remove{display:none}.popup{min-width:180px;padding:4px}.listbox{max-height:min(240px, var(--room,100dvh) - 10px);margin:0;padding:0;list-style:none;position:relative;overflow-y:auto}.option{border-radius:var(--jl-radius-xs);color:var(--jl-text);font-size:var(--jl-font-md);white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none;padding:6px 10px;line-height:1.4}.option[aria-selected=true],.option:hover{background:var(--jl-surface-3)}mark{color:var(--jl-accent);background:0 0;font-weight:700}@keyframes flash{30%{border-color:var(--jl-accent-line);background:var(--jl-accent-soft);color:var(--jl-accent-strong)}}";
3
3
  export { jl_tag_input_default as default };
@@ -1,7 +1,7 @@
1
1
  import { BASE_STYLES, FLOATING_STYLES } from "../styles/shared.js";
2
2
  import { JlElement } from "../base/jl-element.js";
3
3
  import { clampedNumber, oneOf } from "../lib/attributes.js";
4
- import { PLACEMENTS, positionFloating } from "../lib/floating.js";
4
+ import { PLACEMENTS, positionFloating, whenAnchorMoves } from "../lib/floating.js";
5
5
  import { accessibleTarget, deepActiveElement } from "../lib/trigger.js";
6
6
  import { arrowOffset } from "../lib/arrow.js";
7
7
  import jl_tooltip_default from "./jl-tooltip.css.js";
@@ -242,15 +242,7 @@ var JlTooltip = class extends JlElement {
242
242
  this._refs.bubble.showPopover();
243
243
  const following = new AbortController();
244
244
  this._state.following = following;
245
- window.addEventListener("scroll", () => this.place(), {
246
- capture: true,
247
- passive: true,
248
- signal: following.signal
249
- });
250
- window.addEventListener("resize", () => this.place(), {
251
- passive: true,
252
- signal: following.signal
253
- });
245
+ whenAnchorMoves(this.trigger(), () => this.place(), following.signal);
254
246
  document.addEventListener("pointerdown", (event) => {
255
247
  if (!event.composedPath().includes(this)) this.close();
256
248
  }, { signal: following.signal });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syware/jlib",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "A tree-shakeable component library on Jadis and native Web Components, organised in atomic design",
5
5
  "keywords": [
6
6
  "web-components",