@k2b/ui 0.56.0 → 0.57.0

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.
Files changed (40) hide show
  1. package/dist/browser/actions/SplitButton.js +5 -7
  2. package/dist/browser/actions/SplitButton.js.map +1 -1
  3. package/dist/browser/actions/ViewTabs.js +6 -5
  4. package/dist/browser/actions/ViewTabs.js.map +1 -1
  5. package/dist/browser/intl/messages.js +1 -1
  6. package/dist/browser/intl/messages.js.map +1 -1
  7. package/dist/browser/layout/FloatingWindow.js +416 -122
  8. package/dist/browser/layout/FloatingWindow.js.map +1 -1
  9. package/dist/browser/layout/PersonPopover.js +406 -0
  10. package/dist/browser/layout/PersonPopover.js.map +1 -0
  11. package/dist/browser/layout/floating-window-geometry.js +58 -2
  12. package/dist/browser/layout/floating-window-geometry.js.map +1 -1
  13. package/dist/browser/layout/floating-window-messages.js +12 -0
  14. package/dist/browser/layout/floating-window-messages.js.map +1 -1
  15. package/dist/browser/layout/index.js +1 -0
  16. package/dist/browser/layout/index.js.map +1 -1
  17. package/dist/ssr/actions/SplitButton.js +5 -7
  18. package/dist/ssr/actions/SplitButton.js.map +1 -1
  19. package/dist/ssr/actions/ViewTabs.js +6 -5
  20. package/dist/ssr/actions/ViewTabs.js.map +1 -1
  21. package/dist/ssr/intl/messages.js +1 -1
  22. package/dist/ssr/intl/messages.js.map +1 -1
  23. package/dist/ssr/layout/FloatingWindow.js +286 -73
  24. package/dist/ssr/layout/FloatingWindow.js.map +1 -1
  25. package/dist/ssr/layout/PersonPopover.js +248 -0
  26. package/dist/ssr/layout/PersonPopover.js.map +1 -0
  27. package/dist/ssr/layout/floating-window-geometry.js +58 -2
  28. package/dist/ssr/layout/floating-window-geometry.js.map +1 -1
  29. package/dist/ssr/layout/floating-window-messages.js +12 -0
  30. package/dist/ssr/layout/floating-window-messages.js.map +1 -1
  31. package/dist/ssr/layout/index.js +1 -0
  32. package/dist/ssr/layout/index.js.map +1 -1
  33. package/dist/styles.css +1 -1
  34. package/dist/types/actions/SplitButton.d.ts +2 -0
  35. package/dist/types/layout/FloatingWindow.d.ts +29 -1
  36. package/dist/types/layout/PersonPopover.d.ts +70 -0
  37. package/dist/types/layout/floating-window-geometry.d.ts +20 -3
  38. package/dist/types/layout/floating-window-messages.d.ts +6 -0
  39. package/dist/types/layout/index.d.ts +3 -2
  40. package/package.json +1 -1
@@ -1,24 +1,33 @@
1
1
  import { mergeProps as _$mergeProps } from "solid-js/web";
2
- import { memo as _$memo } from "solid-js/web";
3
- import { ssrStyleProperty as _$ssrStyleProperty } from "solid-js/web";
4
- import { ssr as _$ssr } from "solid-js/web";
5
- import { createComponent as _$createComponent } from "solid-js/web";
6
- import { ssrStyle as _$ssrStyle } from "solid-js/web";
7
2
  import { ssrAttribute as _$ssrAttribute } from "solid-js/web";
3
+ import { createComponent as _$createComponent } from "solid-js/web";
4
+ import { ssr as _$ssr } from "solid-js/web";
8
5
  import { escape as _$escape } from "solid-js/web";
9
- var _tmpl$ = ["<section class=\"", "\"", " style=\"", "\" role=\"dialog\" aria-modal=\"false\"", " tabindex=\"-1\"><header>", "<button type=\"button\" data-window-move class=\"k2b-floating-window__title\"", "><span", ">", "</span></button><button type=\"button\" class=\"k2b-icon-button\"", "><i class=\"ti ti-x\" aria-hidden=\"true\"></i></button></header><div class=\"k2b-floating-window__body\">", "</div>", "</section>"],
10
- _tmpl$2 = ["<i", " aria-hidden=\"true\"></i>"],
11
- _tmpl$3 = ["<button type=\"button\" class=\"k2b-floating-window__resize\"", " style=\"", "\"", "></button>"],
12
- _tmpl$4 = ["<div class=\"k2b-floating-window__resize\"", " style=\"", "\" aria-hidden=\"true\"></div>"];
13
- import { createSignal, createUniqueId, onCleanup, onMount, Show } from "solid-js";
6
+ import { ssrStyleProperty as _$ssrStyleProperty } from "solid-js/web";
7
+ import { memo as _$memo } from "solid-js/web";
8
+ var _tmpl$ = ["<div class=\"k2b-floating-window-scrim\" aria-hidden=\"true\" style=\"", "\"></div>"],
9
+ _tmpl$2 = ["<span class=\"k2b-floating-window__status\">", "</span>"],
10
+ _tmpl$3 = ["<div class=\"k2b-floating-window__actions\">", "</div>"],
11
+ _tmpl$4 = "<i class=\"ti ti-minus\" aria-hidden=\"true\"></i>",
12
+ _tmpl$5 = ["<i", " aria-hidden=\"true\"></i>"],
13
+ _tmpl$6 = "<i class=\"ti ti-x\" aria-hidden=\"true\"></i>",
14
+ _tmpl$7 = ["<section class=\"", "\"", " style=\"", "\" role=\"dialog\"", " tabindex=\"-1\"><header>", "<div class=\"k2b-floating-window__heading\"><button type=\"button\" data-window-move class=\"k2b-floating-window__title\"", "><span", ">", "</span></button>", "</div>", "<div class=\"k2b-floating-window__controls\">", "", "</div></header><div class=\"k2b-floating-window__body\">", "</div>", "</section>"],
15
+ _tmpl$8 = ["<button type=\"button\" class=\"k2b-floating-window__resize\"", " style=\"", "\"", "></button>"],
16
+ _tmpl$9 = ["<div class=\"k2b-floating-window__resize\"", " style=\"", "\" aria-hidden=\"true\"></div>"];
17
+ import { createEffect, createMemo, createSignal, createUniqueId, on, onCleanup, onMount, Show, untrack } from "solid-js";
14
18
  import { Portal, render } from "solid-js/web";
19
+ import { IconButton } from "../actions/Button";
15
20
  import { returnFocus, ringOnReturn } from "../internal/focus-return";
16
21
  import { getK2bPortalRoot } from "../internal/portal";
17
22
  import { RenderErrorBoundary } from "../internal/render-error";
18
23
  import { suppressTextSelection } from "../internal/text-selection";
19
- import { FLOATING_WINDOW_VIEWPORT_GAP, fitFloatingWindowRect } from "./floating-window-geometry";
24
+ import { showTruncatedTitle } from "../internal/truncated-title";
25
+ import { FLOATING_WINDOW_BAR, FLOATING_WINDOW_VIEWPORT_GAP, fitFloatingWindowRect, layoutFloatingWindowDock, maximizedFloatingWindowRect } from "./floating-window-geometry";
20
26
  import { useFloatingWindowMessages } from "./floating-window-messages";
21
27
  export { fitFloatingWindowRect } from "./floating-window-geometry";
28
+
29
+ /** `minimized` is a bar at the bottom edge with the content kept alive; `maximized` covers the area above a scrim. */
30
+
22
31
  const MOBILE_BREAKPOINT = 640;
23
32
  const FLOATING_WINDOW_LAYER_BASE = 80;
24
33
  const activeLayers = [];
@@ -42,8 +51,13 @@ const bringLayerToFront = owner => {
42
51
  activeLayers.push(owner);
43
52
  syncLayers();
44
53
  };
45
- const isTopLayer = owner => activeLayers.at(-1) === owner;
54
+
55
+ /** Every docked window of the page, in the order the windows opened, so a row never reorders when one restores. */
56
+
57
+ const [dockMembers, setDockMembers] = createSignal([]);
46
58
  const clamp = (value, min, max) => Math.min(Math.max(value, min), Math.max(min, max));
59
+ const sameRect = (a, b) => a === b || !!a && !!b && a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
60
+ const tabbable = 'a[href],button:not(:disabled),input:not(:disabled):not([type="hidden"]),select:not(:disabled),textarea:not(:disabled),[contenteditable="true"],[tabindex]:not([tabindex="-1"])';
47
61
  export default function FloatingWindow(props) {
48
62
  const floatingWindowMessages = useFloatingWindowMessages();
49
63
  const minWidth = () => props.minWidth ?? 360;
@@ -53,25 +67,105 @@ export default function FloatingWindow(props) {
53
67
  const layerOwner = {
54
68
  setLayer
55
69
  };
56
- const [rect, setRect] = createSignal({
57
- x: FLOATING_WINDOW_VIEWPORT_GAP,
58
- y: FLOATING_WINDOW_VIEWPORT_GAP,
59
- width: props.initialWidth ?? 720,
60
- height: props.initialHeight ?? 640
70
+ const [ownState, setOwnState] = createSignal(untrack(() => props.defaultState ?? "normal"));
71
+ const state = () => props.state ?? ownState();
72
+ const [areaElement, setAreaElement] = createSignal();
73
+ const [bounds, setBounds] = createSignal({
74
+ x: 0,
75
+ y: 0,
76
+ width: typeof window === "undefined" ? 1024 : window.innerWidth,
77
+ height: typeof window === "undefined" ? 768 : window.innerHeight,
78
+ radius: "0px"
61
79
  });
80
+ /** The place the person or the application gave the window; unset while it places itself. */
81
+ const [placed, setPlaced] = createSignal();
62
82
  const titleId = `k2b-floating-window-${createUniqueId()}`;
63
83
  let frame;
84
+ let titleButton;
85
+ let maximizeButton;
86
+ let body;
87
+ /** The last focused element of the content, where the focus returns when the window comes back from the bar. */
88
+ let contentFocus;
64
89
  let stopPointerInteraction;
65
- const fit = value => fitFloatingWindowRect(value, minWidth(), minHeight(), {
66
- width: window.innerWidth,
67
- height: window.innerHeight
90
+ const fit = value => fitFloatingWindowRect(value, minWidth(), minHeight(), bounds());
91
+ const ownSize = () => {
92
+ const area = bounds();
93
+ return fit({
94
+ x: area.x,
95
+ y: area.y,
96
+ width: props.initialWidth ?? 720,
97
+ height: props.initialHeight ?? 640
98
+ });
99
+ };
100
+ const docked = () => state() === "minimized" || state() === "normal" && !placed() && !mobile() && props.placement === "dock";
101
+ const dockMember = {
102
+ area: areaElement,
103
+ docked,
104
+ size: () => state() === "minimized" ? FLOATING_WINDOW_BAR : ownSize()
105
+ };
106
+ const dockRect = createMemo(() => {
107
+ if (!docked()) return undefined;
108
+ const row = dockMembers().filter(member => member.area() === areaElement() && member.docked());
109
+ return layoutFloatingWindowDock(row.map(member => member.size()), bounds())[row.indexOf(dockMember)];
68
110
  });
111
+ /** The window's box, or nothing while it is a full-screen sheet on a phone. */
112
+ const frameRect = createMemo(() => {
113
+ if (mobile() && state() !== "minimized") return undefined;
114
+ if (state() === "maximized") return maximizedFloatingWindowRect(bounds());
115
+ const dock = dockRect();
116
+ if (dock) return dock;
117
+ const own = placed();
118
+ if (own) return own;
119
+ const size = ownSize();
120
+ const area = bounds();
121
+ return fit({
122
+ ...size,
123
+ x: area.x + (area.width - size.width) / 2,
124
+ y: area.y + (area.height - size.height) / 2
125
+ });
126
+ }, undefined, {
127
+ equals: sameRect
128
+ });
129
+ const modal = () => state() === "maximized" || mobile() && state() === "normal";
69
130
  const front = () => bringLayerToFront(layerOwner);
70
131
  const stopActivePointerInteraction = () => stopPointerInteraction?.();
71
132
  const close = () => {
72
133
  stopActivePointerInteraction();
73
134
  props.onClose();
74
135
  };
136
+ const commitRect = next => {
137
+ setPlaced(next);
138
+ props.onRectChange?.(next);
139
+ };
140
+ const focusInside = () => {
141
+ const active = document.activeElement;
142
+ return active instanceof HTMLElement && frame?.contains(active) ? active : undefined;
143
+ };
144
+ const changeState = next => {
145
+ const previous = state();
146
+ if (next === previous) return;
147
+ stopActivePointerInteraction();
148
+ const hadFocus = focusInside();
149
+ setOwnState(next);
150
+ props.onStateChange?.(next);
151
+ front();
152
+ // The focus follows the window: onto the bar when it minimizes, back to where it was when the content returns.
153
+ queueMicrotask(() => {
154
+ if (state() !== next) return;
155
+ if (next === "minimized") {
156
+ if (hadFocus || document.activeElement === document.body) titleButton?.focus({
157
+ preventScroll: true
158
+ });
159
+ return;
160
+ }
161
+ const current = focusInside();
162
+ if (current && current !== titleButton) return;
163
+ const target = contentFocus?.isConnected && body?.contains(contentFocus) ? contentFocus : frame;
164
+ target?.focus({
165
+ preventScroll: true
166
+ });
167
+ });
168
+ };
75
169
  const trackPointerInteraction = (start, move) => {
76
170
  stopActivePointerInteraction();
77
171
  const pointerId = start.pointerId;
@@ -90,56 +184,118 @@ export default function FloatingWindow(props) {
90
184
  if (event.pointerId === pointerId) move(event);
91
185
  };
92
186
  const onEnd = event => {
93
- if (event.pointerId === pointerId) stop();
187
+ if (event.pointerId !== pointerId) return;
188
+ stop();
189
+ const current = placed();
190
+ if (current) props.onRectChange?.(current);
94
191
  };
95
192
  stopPointerInteraction = stop;
96
193
  window.addEventListener("pointermove", onMove);
97
194
  window.addEventListener("pointerup", onEnd);
98
195
  window.addEventListener("pointercancel", onEnd);
99
196
  };
197
+ createEffect(on(() => props.rect, rect => {
198
+ if (rect) setPlaced(fit(rect));
199
+ }));
100
200
  onMount(() => {
101
201
  registerLayer(layerOwner);
102
- const viewport = () => {
103
- const compact = window.innerWidth < MOBILE_BREAKPOINT;
104
- setMobile(compact);
105
- if (!compact) setRect(current => fit(current));
202
+ setDockMembers(members => [...members, dockMember]);
203
+ let observer;
204
+ const measure = () => {
205
+ const area = props.area?.() ?? undefined;
206
+ if (area !== areaElement()) {
207
+ observer?.disconnect();
208
+ if (area) observer?.observe(area);
209
+ setAreaElement(area);
210
+ }
211
+ const box = area?.getBoundingClientRect();
212
+ const next = box ? {
213
+ x: box.left,
214
+ y: box.top,
215
+ width: box.width,
216
+ height: box.height,
217
+ radius: getComputedStyle(area).borderRadius
218
+ } : {
219
+ x: 0,
220
+ y: 0,
221
+ width: window.innerWidth,
222
+ height: window.innerHeight,
223
+ radius: "0px"
224
+ };
225
+ const current = bounds();
226
+ if (next.x !== current.x || next.y !== current.y || next.width !== current.width || next.height !== current.height) setBounds(next);
227
+ setMobile(window.innerWidth < MOBILE_BREAKPOINT);
228
+ setPlaced(rect => rect ? fit(rect) : rect);
106
229
  };
107
- setRect(current => fit({
108
- ...current,
109
- x: (window.innerWidth - current.width) / 2,
110
- y: (window.innerHeight - current.height) / 2
111
- }));
112
- viewport();
230
+ observer = typeof ResizeObserver === "function" ? new ResizeObserver(measure) : undefined;
231
+ measure();
232
+ if (!placed() && props.placement !== "dock") {
233
+ const size = ownSize();
234
+ const area = bounds();
235
+ setPlaced(fit({
236
+ ...size,
237
+ x: area.x + (area.width - size.width) / 2,
238
+ y: area.y + (area.height - size.height) / 2
239
+ }));
240
+ }
113
241
  const escape = event => {
114
- if (event.defaultPrevented || event.key !== "Escape" || !isTopLayer(layerOwner)) return;
242
+ if (event.defaultPrevented || event.key !== "Escape" || state() === "minimized") return;
243
+ if (!(event.target instanceof Node && frame?.contains(event.target))) return;
115
244
  event.preventDefault();
116
- close();
245
+ if (state() === "maximized" && !mobile()) changeState("normal");else close();
117
246
  };
118
- window.addEventListener("resize", viewport);
247
+ window.addEventListener("resize", measure);
119
248
  window.addEventListener("keydown", escape);
120
- const focus = requestAnimationFrame(() => frame?.focus());
249
+ // The content may already have placed the focus, such as an editor that opened with the window.
250
+ const focus = requestAnimationFrame(() => {
251
+ if (state() !== "minimized" && !focusInside()) frame?.focus();
252
+ });
121
253
  onCleanup(() => {
122
254
  stopActivePointerInteraction();
255
+ observer?.disconnect();
123
256
  releaseLayer(layerOwner);
257
+ setDockMembers(members => members.filter(member => member !== dockMember));
124
258
  cancelAnimationFrame(focus);
125
- window.removeEventListener("resize", viewport);
259
+ window.removeEventListener("resize", measure);
126
260
  window.removeEventListener("keydown", escape);
127
261
  });
128
262
  });
129
- const moveBy = (deltaX, deltaY) => setRect(current => fit({
130
- ...current,
131
- x: current.x + deltaX,
132
- y: current.y + deltaY
133
- }));
263
+
264
+ /** While the window covers the area, Tab cycles inside it. */
265
+ const trapTab = event => {
266
+ if (event.key !== "Tab" || !modal() || !frame) return;
267
+ const stops = [...frame.querySelectorAll(tabbable)].filter(element => element.getClientRects().length > 0);
268
+ const first = stops[0];
269
+ const last = stops.at(-1);
270
+ if (!first || !last) return;
271
+ const active = document.activeElement;
272
+ if (event.shiftKey && (active === first || active === frame)) {
273
+ last.focus();
274
+ event.preventDefault();
275
+ } else if (!event.shiftKey && active === last) {
276
+ first.focus();
277
+ event.preventDefault();
278
+ }
279
+ };
280
+ const moveBy = (deltaX, deltaY) => {
281
+ const current = frameRect();
282
+ if (current) commitRect(fit({
283
+ ...current,
284
+ x: current.x + deltaX,
285
+ y: current.y + deltaY
286
+ }));
287
+ };
288
+ const movable = () => !mobile() && state() === "normal";
134
289
  const beginMove = event => {
135
- if (mobile() || event.button !== 0 || event.target.closest("button:not([data-window-move])")) return;
136
- const origin = rect();
290
+ if (!movable() || event.button !== 0 || event.target.closest("button:not([data-window-move])")) return;
291
+ const origin = frameRect();
292
+ if (!origin) return;
137
293
  const start = {
138
294
  x: event.clientX,
139
295
  y: event.clientY
140
296
  };
141
297
  front();
142
- const move = next => setRect(fit({
298
+ const move = next => setPlaced(fit({
143
299
  ...origin,
144
300
  x: origin.x + next.clientX - start.x,
145
301
  y: origin.y + next.clientY - start.y
@@ -147,8 +303,10 @@ export default function FloatingWindow(props) {
147
303
  trackPointerInteraction(event, move);
148
304
  event.preventDefault();
149
305
  };
150
- const resizeBy = (edge, deltaX, deltaY) => {
151
- const current = rect();
306
+ const resized = (edge, deltaX, deltaY) => {
307
+ const current = frameRect();
308
+ if (!current) return undefined;
309
+ const area = bounds();
152
310
  let {
153
311
  x,
154
312
  y,
@@ -156,33 +314,34 @@ export default function FloatingWindow(props) {
156
314
  height
157
315
  } = current;
158
316
  if (edge.includes("left")) {
159
- const next = clamp(width - deltaX, minWidth(), window.innerWidth - FLOATING_WINDOW_VIEWPORT_GAP - x);
317
+ const next = clamp(width - deltaX, minWidth(), area.x + area.width - FLOATING_WINDOW_VIEWPORT_GAP - x);
160
318
  x += width - next;
161
319
  width = next;
162
320
  }
163
321
  if (edge.includes("right")) width += deltaX;
164
322
  if (edge.includes("top")) {
165
- const next = clamp(height - deltaY, minHeight(), window.innerHeight - FLOATING_WINDOW_VIEWPORT_GAP - y);
323
+ const next = clamp(height - deltaY, minHeight(), area.y + area.height - FLOATING_WINDOW_VIEWPORT_GAP - y);
166
324
  y += height - next;
167
325
  height = next;
168
326
  }
169
327
  if (edge.includes("bottom")) height += deltaY;
170
- setRect(fit({
328
+ return fit({
171
329
  x,
172
330
  y,
173
331
  width,
174
332
  height
175
- }));
333
+ });
176
334
  };
177
335
  const beginResize = (edge, event) => {
178
- if (mobile() || event.button !== 0) return;
336
+ if (!movable() || event.button !== 0) return;
179
337
  let previous = {
180
338
  x: event.clientX,
181
339
  y: event.clientY
182
340
  };
183
341
  front();
184
342
  const move = next => {
185
- resizeBy(edge, next.clientX - previous.x, next.clientY - previous.y);
343
+ const rect = resized(edge, next.clientX - previous.x, next.clientY - previous.y);
344
+ if (rect) setPlaced(rect);
186
345
  previous = {
187
346
  x: next.clientX,
188
347
  y: next.clientY
@@ -192,6 +351,7 @@ export default function FloatingWindow(props) {
192
351
  event.preventDefault();
193
352
  };
194
353
  const arrows = (event, action) => {
354
+ if (!movable()) return;
195
355
  const step = event.shiftKey ? 24 : 8;
196
356
  const delta = event.key === "ArrowLeft" ? [-step, 0] : event.key === "ArrowRight" ? [step, 0] : event.key === "ArrowUp" ? [0, -step] : event.key === "ArrowDown" ? [0, step] : undefined;
197
357
  if (!delta) return;
@@ -199,36 +359,89 @@ export default function FloatingWindow(props) {
199
359
  event.preventDefault();
200
360
  };
201
361
  const handles = [["left", "ew-resize"], ["right", "ew-resize"], ["top", "ns-resize"], ["bottom", "ns-resize"], ["top-left", "nwse-resize"], ["top-right", "nesw-resize"], ["bottom-left", "nesw-resize"], ["bottom-right", "nwse-resize"]];
202
- const view = _$ssr(_tmpl$, `k2b-floating-window ${_$escape(props.class ?? "", true)}`, _$ssrAttribute("data-mobile", mobile() ? "true" : _$escape(undefined, true), false), _$ssrStyle(mobile() ? {
203
- "--k2b-window-accent": props.accent,
204
- inset: "0.5rem",
205
- width: "auto",
206
- height: "auto",
207
- "z-index": layer()
208
- } : {
209
- "--k2b-window-accent": props.accent,
210
- left: `${rect().x}px`,
211
- top: `${rect().y}px`,
212
- width: `${rect().width}px`,
213
- height: `${rect().height}px`,
214
- "z-index": layer()
215
- }), _$ssrAttribute("aria-labelledby", _$escape(titleId, true), false), _$escape(_$createComponent(Show, {
362
+ const titleLabel = () => state() === "minimized" ? floatingWindowMessages().restoreWindow({
363
+ title: props.title
364
+ }) : movable() ? floatingWindowMessages().moveWindow({
365
+ title: props.title
366
+ }) : props.title;
367
+ const view = [_$createComponent(Show, {
368
+ get when() {
369
+ return _$memo(() => state() === "maximized")() && !mobile();
370
+ },
371
+ get children() {
372
+ return _$ssr(_tmpl$, _$ssrStyleProperty("left:", `${_$escape(bounds().x, true)}px`) + _$ssrStyleProperty(";top:", `${_$escape(bounds().y, true)}px`) + _$ssrStyleProperty(";width:", `${_$escape(bounds().width, true)}px`) + _$ssrStyleProperty(";height:", `${_$escape(bounds().height, true)}px`) + _$ssrStyleProperty(";border-radius:", _$escape(bounds().radius, true)) + _$ssrStyleProperty(";z-index:", _$escape(layer(), true)));
373
+ }
374
+ }), _$ssr(_tmpl$7, `k2b-floating-window ${_$escape(props.class ?? "", true)}`, _$ssrAttribute("data-mobile", mobile() ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("data-state", _$escape(state(), true), false), _$ssrStyleProperty("--k2b-window-accent:", _$escape(props.accent, true)) + _$ssrStyleProperty(";left:", frameRect() ? `${_$escape(frameRect().x, true)}px` : _$escape(undefined, true)) + _$ssrStyleProperty(";top:", frameRect() ? `${_$escape(frameRect().y, true)}px` : _$escape(undefined, true)) + _$ssrStyleProperty(";width:", frameRect() ? `${_$escape(frameRect().width, true)}px` : _$escape(undefined, true)) + _$ssrStyleProperty(";height:", frameRect() ? `${_$escape(frameRect().height, true)}px` : _$escape(undefined, true)) + _$ssrStyleProperty(";z-index:", _$escape(layer(), true)), _$ssrAttribute("aria-modal", modal() ? "true" : "false", false) + _$ssrAttribute("aria-labelledby", _$escape(titleId, true), false), _$escape(_$createComponent(Show, {
216
375
  get when() {
217
376
  return props.icon;
218
377
  },
219
- children: icon => _$ssr(_tmpl$2, _$ssrAttribute("class", _$escape(icon(), true), false))
220
- })), _$ssrAttribute("aria-label", _$escape(floatingWindowMessages().moveWindow({
221
- title: props.title
222
- }), true), false), _$ssrAttribute("id", _$escape(titleId, true), false), _$escape(props.title), _$ssrAttribute("aria-label", _$escape(floatingWindowMessages().closeWindow, true), false), _$escape(props.children), _$escape(_$createComponent(Show, {
378
+ children: icon => _$ssr(_tmpl$5, _$ssrAttribute("class", _$escape(icon(), true), false))
379
+ })), _$ssrAttribute("aria-label", _$escape(titleLabel(), true), false), _$ssrAttribute("id", _$escape(titleId, true), false), _$escape(props.title), _$escape(_$createComponent(Show, {
380
+ get when() {
381
+ return _$memo(() => props.status !== undefined)() && state() !== "minimized";
382
+ },
383
+ get children() {
384
+ return _$ssr(_tmpl$2, _$escape(props.status));
385
+ }
386
+ })), _$escape(_$createComponent(Show, {
387
+ get when() {
388
+ return _$memo(() => props.actions !== undefined)() && state() !== "minimized";
389
+ },
390
+ get children() {
391
+ return _$ssr(_tmpl$3, _$escape(props.actions));
392
+ }
393
+ })), _$escape(_$createComponent(Show, {
223
394
  get when() {
224
395
  return !mobile();
225
396
  },
226
397
  get children() {
227
- return handles.map(([edge, cursor]) => edge === "bottom-right" ? _$ssr(_tmpl$3, _$ssrAttribute("data-edge", _$escape(edge, true), false), _$ssrStyleProperty("cursor:", _$escape(cursor, true)), _$ssrAttribute("aria-label", _$escape(floatingWindowMessages().resizeWindow, true), false)) : // Cloud exposes a single keyboard-resizable corner; the remaining
398
+ return [_$createComponent(Show, {
399
+ get when() {
400
+ return state() !== "minimized";
401
+ },
402
+ get children() {
403
+ return _$createComponent(IconButton, {
404
+ size: "sm",
405
+ get label() {
406
+ return floatingWindowMessages().minimizeWindow;
407
+ },
408
+ onClick: () => changeState("minimized"),
409
+ get children() {
410
+ return _$ssr(_tmpl$4);
411
+ }
412
+ });
413
+ }
414
+ }), _$createComponent(IconButton, {
415
+ size: "sm",
416
+ get label() {
417
+ return _$memo(() => state() === "maximized")() ? floatingWindowMessages().restoreSize : floatingWindowMessages().maximizeWindow;
418
+ },
419
+ onClick: () => changeState(state() === "maximized" ? "normal" : "maximized"),
420
+ get children() {
421
+ return _$ssr(_tmpl$5, _$ssrAttribute("class", state() === "maximized" ? "ti ti-arrows-diagonal-minimize-2" : "ti ti-arrows-diagonal", false));
422
+ }
423
+ })];
424
+ }
425
+ })), _$escape(_$createComponent(IconButton, {
426
+ size: "sm",
427
+ "class": "k2b-floating-window__close",
428
+ get label() {
429
+ return floatingWindowMessages().closeWindow;
430
+ },
431
+ onClick: close,
432
+ get children() {
433
+ return _$ssr(_tmpl$6);
434
+ }
435
+ })), _$escape(props.children), _$escape(_$createComponent(Show, {
436
+ get when() {
437
+ return movable();
438
+ },
439
+ get children() {
440
+ return handles.map(([edge, cursor]) => edge === "bottom-right" ? _$ssr(_tmpl$8, _$ssrAttribute("data-edge", _$escape(edge, true), false), _$ssrStyleProperty("cursor:", _$escape(cursor, true)), _$ssrAttribute("aria-label", _$escape(floatingWindowMessages().resizeWindow, true), false)) : // Cloud exposes a single keyboard-resizable corner; the remaining
228
441
  // edges stay pointer-only so the window adds one tab stop, not eight.
229
- _$ssr(_tmpl$4, _$ssrAttribute("data-edge", _$escape(edge, true), false), _$ssrStyleProperty("cursor:", _$escape(cursor, true))));
442
+ _$ssr(_tmpl$9, _$ssrAttribute("data-edge", _$escape(edge, true), false), _$ssrStyleProperty("cursor:", _$escape(cursor, true))));
230
443
  }
231
- })));
444
+ })))];
232
445
  return _$createComponent(Portal, {
233
446
  get mount() {
234
447
  return typeof document === "undefined" ? undefined : getK2bPortalRoot(props.resolveScope?.());