@k2b/ui 0.44.0 → 0.46.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 (206) hide show
  1. package/dist/browser/actions/Dropdown.js +8 -1
  2. package/dist/browser/actions/Dropdown.js.map +1 -1
  3. package/dist/browser/actions/FilterChip.js +11 -5
  4. package/dist/browser/actions/FilterChip.js.map +1 -1
  5. package/dist/browser/actions/Tabs.js +3 -4
  6. package/dist/browser/actions/Tabs.js.map +1 -1
  7. package/dist/browser/actions/ViewTabs.js +225 -93
  8. package/dist/browser/actions/ViewTabs.js.map +1 -1
  9. package/dist/browser/actions/menu-sheet.js +2 -3
  10. package/dist/browser/actions/menu-sheet.js.map +1 -1
  11. package/dist/browser/actions/phone-sheet.js +4 -0
  12. package/dist/browser/actions/phone-sheet.js.map +1 -0
  13. package/dist/browser/content/DataTable.js +47 -51
  14. package/dist/browser/content/DataTable.js.map +1 -1
  15. package/dist/browser/content/FileGrid.js +125 -99
  16. package/dist/browser/content/FileGrid.js.map +1 -1
  17. package/dist/browser/feedback/dialog-core.js +5 -1
  18. package/dist/browser/feedback/dialog-core.js.map +1 -1
  19. package/dist/browser/feedback/dialog-tone.js +26 -0
  20. package/dist/browser/feedback/dialog-tone.js.map +1 -0
  21. package/dist/browser/feedback/index.js.map +1 -1
  22. package/dist/browser/feedback/prompt-confirm.js +223 -0
  23. package/dist/browser/feedback/prompt-confirm.js.map +1 -0
  24. package/dist/browser/feedback/prompts.js +195 -343
  25. package/dist/browser/feedback/prompts.js.map +1 -1
  26. package/dist/browser/inputs/ChoiceList.js +45 -17
  27. package/dist/browser/inputs/ChoiceList.js.map +1 -1
  28. package/dist/browser/inputs/DatePicker.js +1647 -334
  29. package/dist/browser/inputs/DatePicker.js.map +1 -1
  30. package/dist/browser/inputs/TextInput.js +5 -4
  31. package/dist/browser/inputs/TextInput.js.map +1 -1
  32. package/dist/browser/inputs/choice.js +36 -9
  33. package/dist/browser/inputs/choice.js.map +1 -1
  34. package/dist/browser/inputs/date-input-messages.js +128 -0
  35. package/dist/browser/inputs/date-input-messages.js.map +1 -0
  36. package/dist/browser/inputs/date-input-status.js +132 -0
  37. package/dist/browser/inputs/date-input-status.js.map +1 -0
  38. package/dist/browser/inputs/date-input.js +334 -0
  39. package/dist/browser/inputs/date-input.js.map +1 -0
  40. package/dist/browser/inputs/date-sheet.js +49 -0
  41. package/dist/browser/inputs/date-sheet.js.map +1 -0
  42. package/dist/browser/internal/reveal-in-scroller.js +28 -0
  43. package/dist/browser/internal/reveal-in-scroller.js.map +1 -0
  44. package/dist/browser/intl/messages.js +6 -0
  45. package/dist/browser/intl/messages.js.map +1 -1
  46. package/dist/browser/layout/AppWorkspace.js +556 -528
  47. package/dist/browser/layout/AppWorkspace.js.map +1 -1
  48. package/dist/browser/layout/BottomSheet.js +3 -0
  49. package/dist/browser/layout/BottomSheet.js.map +1 -1
  50. package/dist/browser/layout/DetailPanel.js +130 -108
  51. package/dist/browser/layout/DetailPanel.js.map +1 -1
  52. package/dist/browser/layout/DetailSections.js +1019 -0
  53. package/dist/browser/layout/DetailSections.js.map +1 -0
  54. package/dist/browser/layout/DetailsToggle.js +32 -0
  55. package/dist/browser/layout/DetailsToggle.js.map +1 -0
  56. package/dist/browser/layout/Discussion.js +3 -0
  57. package/dist/browser/layout/Discussion.js.map +1 -1
  58. package/dist/browser/layout/MobileShell.js +116 -94
  59. package/dist/browser/layout/MobileShell.js.map +1 -1
  60. package/dist/browser/layout/PageTitle.js +33 -10
  61. package/dist/browser/layout/PageTitle.js.map +1 -1
  62. package/dist/browser/layout/PanelDialog.js +167 -132
  63. package/dist/browser/layout/PanelDialog.js.map +1 -1
  64. package/dist/browser/layout/Settings.js +175 -139
  65. package/dist/browser/layout/Settings.js.map +1 -1
  66. package/dist/browser/layout/SettingsModal.js +2 -4
  67. package/dist/browser/layout/SettingsModal.js.map +1 -1
  68. package/dist/browser/layout/app-workspace-controller.js +12 -0
  69. package/dist/browser/layout/app-workspace-controller.js.map +1 -1
  70. package/dist/browser/layout/detail-sections-messages.js +123 -0
  71. package/dist/browser/layout/detail-sections-messages.js.map +1 -0
  72. package/dist/browser/layout/index.js +2 -0
  73. package/dist/browser/layout/index.js.map +1 -1
  74. package/dist/browser/surfaces/Avatar.js +3 -1
  75. package/dist/browser/surfaces/Avatar.js.map +1 -1
  76. package/dist/browser/surfaces/AvatarStack.js +95 -61
  77. package/dist/browser/surfaces/AvatarStack.js.map +1 -1
  78. package/dist/browser/surfaces/ChangeList.js +77 -0
  79. package/dist/browser/surfaces/ChangeList.js.map +1 -0
  80. package/dist/browser/surfaces/StatusBadge.js +47 -14
  81. package/dist/browser/surfaces/StatusBadge.js.map +1 -1
  82. package/dist/browser/surfaces/index.js +2 -1
  83. package/dist/browser/surfaces/index.js.map +1 -1
  84. package/dist/browser/text-editor/TextEditor.js +26 -8
  85. package/dist/browser/text-editor/TextEditor.js.map +1 -1
  86. package/dist/ssr/actions/Dropdown.js +6 -0
  87. package/dist/ssr/actions/Dropdown.js.map +1 -1
  88. package/dist/ssr/actions/FilterChip.js +1 -1
  89. package/dist/ssr/actions/FilterChip.js.map +1 -1
  90. package/dist/ssr/actions/Tabs.js +3 -4
  91. package/dist/ssr/actions/Tabs.js.map +1 -1
  92. package/dist/ssr/actions/ViewTabs.js +144 -37
  93. package/dist/ssr/actions/ViewTabs.js.map +1 -1
  94. package/dist/ssr/actions/menu-sheet.js +2 -3
  95. package/dist/ssr/actions/menu-sheet.js.map +1 -1
  96. package/dist/ssr/actions/phone-sheet.js +4 -0
  97. package/dist/ssr/actions/phone-sheet.js.map +1 -0
  98. package/dist/ssr/content/DataTable.js +1 -2
  99. package/dist/ssr/content/DataTable.js.map +1 -1
  100. package/dist/ssr/content/FileGrid.js +36 -22
  101. package/dist/ssr/content/FileGrid.js.map +1 -1
  102. package/dist/ssr/feedback/dialog-core.js +5 -1
  103. package/dist/ssr/feedback/dialog-core.js.map +1 -1
  104. package/dist/ssr/feedback/dialog-tone.js +26 -0
  105. package/dist/ssr/feedback/dialog-tone.js.map +1 -0
  106. package/dist/ssr/feedback/index.js.map +1 -1
  107. package/dist/ssr/feedback/prompt-confirm.js +123 -0
  108. package/dist/ssr/feedback/prompt-confirm.js.map +1 -0
  109. package/dist/ssr/feedback/prompts.js +60 -132
  110. package/dist/ssr/feedback/prompts.js.map +1 -1
  111. package/dist/ssr/inputs/ChoiceList.js +29 -9
  112. package/dist/ssr/inputs/ChoiceList.js.map +1 -1
  113. package/dist/ssr/inputs/DatePicker.js +1183 -166
  114. package/dist/ssr/inputs/DatePicker.js.map +1 -1
  115. package/dist/ssr/inputs/TextInput.js +5 -4
  116. package/dist/ssr/inputs/TextInput.js.map +1 -1
  117. package/dist/ssr/inputs/choice.js +36 -9
  118. package/dist/ssr/inputs/choice.js.map +1 -1
  119. package/dist/ssr/inputs/date-input-messages.js +128 -0
  120. package/dist/ssr/inputs/date-input-messages.js.map +1 -0
  121. package/dist/ssr/inputs/date-input-status.js +132 -0
  122. package/dist/ssr/inputs/date-input-status.js.map +1 -0
  123. package/dist/ssr/inputs/date-input.js +334 -0
  124. package/dist/ssr/inputs/date-input.js.map +1 -0
  125. package/dist/ssr/inputs/date-sheet.js +44 -0
  126. package/dist/ssr/inputs/date-sheet.js.map +1 -0
  127. package/dist/ssr/internal/reveal-in-scroller.js +28 -0
  128. package/dist/ssr/internal/reveal-in-scroller.js.map +1 -0
  129. package/dist/ssr/intl/messages.js +6 -0
  130. package/dist/ssr/intl/messages.js.map +1 -1
  131. package/dist/ssr/layout/AppWorkspace.js +71 -50
  132. package/dist/ssr/layout/AppWorkspace.js.map +1 -1
  133. package/dist/ssr/layout/BottomSheet.js +3 -0
  134. package/dist/ssr/layout/BottomSheet.js.map +1 -1
  135. package/dist/ssr/layout/DetailPanel.js +17 -0
  136. package/dist/ssr/layout/DetailPanel.js.map +1 -1
  137. package/dist/ssr/layout/DetailSections.js +762 -0
  138. package/dist/ssr/layout/DetailSections.js.map +1 -0
  139. package/dist/ssr/layout/DetailsToggle.js +29 -0
  140. package/dist/ssr/layout/DetailsToggle.js.map +1 -0
  141. package/dist/ssr/layout/Discussion.js +3 -0
  142. package/dist/ssr/layout/Discussion.js.map +1 -1
  143. package/dist/ssr/layout/MobileShell.js +45 -28
  144. package/dist/ssr/layout/MobileShell.js.map +1 -1
  145. package/dist/ssr/layout/PageTitle.js +29 -6
  146. package/dist/ssr/layout/PageTitle.js.map +1 -1
  147. package/dist/ssr/layout/PanelDialog.js +48 -30
  148. package/dist/ssr/layout/PanelDialog.js.map +1 -1
  149. package/dist/ssr/layout/Settings.js +34 -18
  150. package/dist/ssr/layout/Settings.js.map +1 -1
  151. package/dist/ssr/layout/SettingsModal.js +2 -4
  152. package/dist/ssr/layout/SettingsModal.js.map +1 -1
  153. package/dist/ssr/layout/app-workspace-controller.js +12 -0
  154. package/dist/ssr/layout/app-workspace-controller.js.map +1 -1
  155. package/dist/ssr/layout/detail-sections-messages.js +123 -0
  156. package/dist/ssr/layout/detail-sections-messages.js.map +1 -0
  157. package/dist/ssr/layout/index.js +2 -0
  158. package/dist/ssr/layout/index.js.map +1 -1
  159. package/dist/ssr/surfaces/Avatar.js +3 -1
  160. package/dist/ssr/surfaces/Avatar.js.map +1 -1
  161. package/dist/ssr/surfaces/AvatarStack.js +61 -32
  162. package/dist/ssr/surfaces/AvatarStack.js.map +1 -1
  163. package/dist/ssr/surfaces/ChangeList.js +37 -0
  164. package/dist/ssr/surfaces/ChangeList.js.map +1 -0
  165. package/dist/ssr/surfaces/StatusBadge.js +26 -8
  166. package/dist/ssr/surfaces/StatusBadge.js.map +1 -1
  167. package/dist/ssr/surfaces/index.js +2 -1
  168. package/dist/ssr/surfaces/index.js.map +1 -1
  169. package/dist/ssr/text-editor/TextEditor.js +26 -8
  170. package/dist/ssr/text-editor/TextEditor.js.map +1 -1
  171. package/dist/styles.css +1 -1
  172. package/dist/types/actions/FilterChip.d.ts +4 -0
  173. package/dist/types/actions/ViewTabs.d.ts +11 -1
  174. package/dist/types/actions/menu-sheet.d.ts +1 -3
  175. package/dist/types/actions/phone-sheet.d.ts +3 -0
  176. package/dist/types/content/FileGrid.d.ts +6 -0
  177. package/dist/types/feedback/dialog-tone.d.ts +10 -0
  178. package/dist/types/feedback/index.d.ts +1 -0
  179. package/dist/types/feedback/prompt-confirm.d.ts +19 -0
  180. package/dist/types/feedback/prompts.d.ts +4 -8
  181. package/dist/types/inputs/ChoiceList.d.ts +7 -3
  182. package/dist/types/inputs/DatePicker.d.ts +13 -3
  183. package/dist/types/inputs/TextInput.d.ts +1 -1
  184. package/dist/types/inputs/choice.d.ts +9 -3
  185. package/dist/types/inputs/date-input-messages.d.ts +64 -0
  186. package/dist/types/inputs/date-input-status.d.ts +35 -0
  187. package/dist/types/inputs/date-input.d.ts +90 -0
  188. package/dist/types/inputs/date-sheet.d.ts +14 -0
  189. package/dist/types/internal/reveal-in-scroller.d.ts +6 -0
  190. package/dist/types/intl/messages.d.ts +3 -0
  191. package/dist/types/layout/AppWorkspace.d.ts +14 -0
  192. package/dist/types/layout/BottomSheet.d.ts +3 -0
  193. package/dist/types/layout/DetailPanel.d.ts +9 -0
  194. package/dist/types/layout/DetailSections.d.ts +156 -0
  195. package/dist/types/layout/DetailsToggle.d.ts +13 -0
  196. package/dist/types/layout/PageTitle.d.ts +7 -0
  197. package/dist/types/layout/PanelDialog.d.ts +3 -0
  198. package/dist/types/layout/Settings.d.ts +17 -1
  199. package/dist/types/layout/detail-sections-messages.d.ts +59 -0
  200. package/dist/types/layout/index.d.ts +5 -2
  201. package/dist/types/surfaces/Avatar.d.ts +3 -0
  202. package/dist/types/surfaces/AvatarStack.d.ts +20 -1
  203. package/dist/types/surfaces/ChangeList.d.ts +20 -0
  204. package/dist/types/surfaces/StatusBadge.d.ts +5 -0
  205. package/dist/types/surfaces/index.d.ts +5 -3
  206. package/package.json +3 -3
@@ -1,5 +1,6 @@
1
1
  import { template as _$template } from "solid-js/web";
2
2
  import { memo as _$memo } from "solid-js/web";
3
+ import { setProperty as _$setProperty } from "solid-js/web";
3
4
  import { setAttribute as _$setAttribute } from "solid-js/web";
4
5
  import { className as _$className } from "solid-js/web";
5
6
  import { effect as _$effect } from "solid-js/web";
@@ -9,23 +10,31 @@ import { insert as _$insert } from "solid-js/web";
9
10
  import { createComponent as _$createComponent } from "solid-js/web";
10
11
  import { use as _$use } from "solid-js/web";
11
12
  var _tmpl$ = /*#__PURE__*/_$template(`<div><!$><!/><!$><!/><main class=k2b-mobile-shell__main></main><!$><!/>`),
12
- _tmpl$2 = /*#__PURE__*/_$template(`<span class=k2b-mobile-shell__title-narrow>`),
13
- _tmpl$3 = /*#__PURE__*/_$template(`<span class=k2b-mobile-shell__title-wide>`),
14
- _tmpl$4 = /*#__PURE__*/_$template(`<div class=k2b-mobile-shell__actions>`),
15
- _tmpl$5 = /*#__PURE__*/_$template(`<header class=k2b-mobile-shell__header><!$><!/><h1 class=k2b-mobile-shell__title></h1><!$><!/>`),
16
- _tmpl$6 = /*#__PURE__*/_$template(`<i class="ti ti-chevron-left"aria-hidden=true>`),
17
- _tmpl$7 = /*#__PURE__*/_$template(`<a><i aria-hidden=true></i><span class=k2b-truncate-fade></span><!$><!/>`),
18
- _tmpl$8 = /*#__PURE__*/_$template(`<span class=k2b-mobile-shell__sidebar-count>`),
19
- _tmpl$9 = /*#__PURE__*/_$template(`<ul>`),
20
- _tmpl$0 = /*#__PURE__*/_$template(`<li>`),
21
- _tmpl$1 = /*#__PURE__*/_$template(`<div class=k2b-mobile-shell__sidebar-foot>`),
22
- _tmpl$10 = /*#__PURE__*/_$template(`<nav class=k2b-mobile-shell__sidebar><div class=k2b-mobile-shell__sidebar-head><!$><!/><span class=k2b-truncate-fade></span></div><div class=k2b-mobile-shell__sidebar-body><!$><!/><!$><!/></div><!$><!/>`),
23
- _tmpl$11 = /*#__PURE__*/_$template(`<img alt width=32 height=32>`),
24
- _tmpl$12 = /*#__PURE__*/_$template(`<section><h2></h2><!$><!/>`);
13
+ _tmpl$2 = /*#__PURE__*/_$template(`<style>`),
14
+ _tmpl$3 = /*#__PURE__*/_$template(`<span class=k2b-mobile-shell__title-narrow>`),
15
+ _tmpl$4 = /*#__PURE__*/_$template(`<span class=k2b-mobile-shell__title-wide>`),
16
+ _tmpl$5 = /*#__PURE__*/_$template(`<div class=k2b-mobile-shell__actions>`),
17
+ _tmpl$6 = /*#__PURE__*/_$template(`<header class=k2b-mobile-shell__header><!$><!/><h1 class=k2b-mobile-shell__title></h1><!$><!/>`),
18
+ _tmpl$7 = /*#__PURE__*/_$template(`<i class="ti ti-chevron-left"aria-hidden=true>`),
19
+ _tmpl$8 = /*#__PURE__*/_$template(`<a><i aria-hidden=true></i><span class=k2b-truncate-fade></span><!$><!/>`),
20
+ _tmpl$9 = /*#__PURE__*/_$template(`<span class=k2b-mobile-shell__sidebar-count>`),
21
+ _tmpl$0 = /*#__PURE__*/_$template(`<ul>`),
22
+ _tmpl$1 = /*#__PURE__*/_$template(`<li>`),
23
+ _tmpl$10 = /*#__PURE__*/_$template(`<div class=k2b-mobile-shell__sidebar-foot>`),
24
+ _tmpl$11 = /*#__PURE__*/_$template(`<nav class=k2b-mobile-shell__sidebar><div class=k2b-mobile-shell__sidebar-head><!$><!/><span class=k2b-truncate-fade></span></div><div class=k2b-mobile-shell__sidebar-body><!$><!/><!$><!/></div><!$><!/>`),
25
+ _tmpl$12 = /*#__PURE__*/_$template(`<img alt width=32 height=32>`),
26
+ _tmpl$13 = /*#__PURE__*/_$template(`<section><h2></h2><!$><!/>`);
25
27
  import { For, onCleanup, onMount, Show } from "solid-js";
26
28
  import { IconButton, IconButtonLink } from "../actions/Button";
27
29
  import ScrollArea from "./ScrollArea";
28
30
  import { installScrollFades } from "./scroll-fade";
31
+ /**
32
+ * On the document element while a shell is the page: `"sidebar"` when it shows its sidebar, otherwise empty. A host
33
+ * that renders the shell on the server writes it into its `<html>` too, so the first paint already has it.
34
+ */
35
+ const SHELL_ATTRIBUTE = "data-k2b-mobile-shell";
36
+ /** On the document element while a shell is mounted and a modal dialog is open. */
37
+ const MODAL_ATTRIBUTE = "data-k2b-mobile-shell-modal";
29
38
  /** Read by the toast rail, which is portalled outside the shell, so it lives on the body. */
30
39
  const FOOTER_HEIGHT = "--k2b-mobile-shell-footer-height";
31
40
  /** How much of the scroll area a persistent toast covers; local to the shell. */
@@ -165,6 +174,11 @@ export function observeMobileShell(root) {
165
174
  const body = main?.querySelector(":scope > .k2b-mobile-shell__body");
166
175
  if (!main) return () => {};
167
176
  const stopLinkTaps = observeLinkTaps(root);
177
+ // The document says that a shell is the page, for the controls and toasts portalled outside it. An attribute, not
178
+ // `html:has(.k2b-mobile-shell)`: a `:has()` on the document restyles the whole page on every change inside it.
179
+ const documentRoot = root.ownerDocument.documentElement;
180
+ const previousShell = documentRoot.getAttribute(SHELL_ATTRIBUTE);
181
+ documentRoot.setAttribute(SHELL_ATTRIBUTE, root.querySelector(":scope > .k2b-mobile-shell__sidebar") ? "sidebar" : "");
168
182
  // Content with its own scroll areas keeps its own fades; the room a toast takes applies to the whole main area.
169
183
  const stopScrollFades = body ? installScrollFades(body) : () => {};
170
184
  let frame = 0;
@@ -186,6 +200,8 @@ export function observeMobileShell(root) {
186
200
  const footer = Math.max(0, rootBottom - main.getBoundingClientRect().bottom, owned);
187
201
  document.body.style.setProperty(FOOTER_HEIGHT, `${footer}px`);
188
202
  root.style.setProperty(TOAST_INSET, `${persistentToastInset(body ?? main)}px`);
203
+ // A modal dialog takes the bottom edge back for its footer; the toast rules read this, not `html:has(dialog:modal)`.
204
+ documentRoot.toggleAttribute(MODAL_ATTRIBUTE, document.querySelector("dialog:modal") !== null);
189
205
  };
190
206
  const schedule = () => {
191
207
  if (!frame) frame = requestAnimationFrame(measure);
@@ -211,6 +227,8 @@ export function observeMobileShell(root) {
211
227
  mutations.disconnect();
212
228
  document.removeEventListener("transitionend", schedule, true);
213
229
  document.body.style.removeProperty(FOOTER_HEIGHT);
230
+ documentRoot.removeAttribute(MODAL_ATTRIBUTE);
231
+ if (previousShell === null) documentRoot.removeAttribute(SHELL_ATTRIBUTE);else documentRoot.setAttribute(SHELL_ATTRIBUTE, previousShell);
214
232
  stopLinkTaps();
215
233
  stopScrollFades();
216
234
  };
@@ -218,7 +236,7 @@ export function observeMobileShell(root) {
218
236
  function MobileShellRoot(props) {
219
237
  let root;
220
238
  onMount(() => onCleanup(observeMobileShell(root)));
221
- return (() => {
239
+ return [(() => {
222
240
  var _el$ = _$getNextElement(_tmpl$),
223
241
  _el$3 = _el$.firstChild,
224
242
  [_el$4, _co$] = _$getNextMarker(_el$3.nextSibling),
@@ -259,17 +277,21 @@ function MobileShellRoot(props) {
259
277
  t: undefined
260
278
  });
261
279
  return _el$;
262
- })();
280
+ })(), (() => {
281
+ var _el$9 = _$getNextElement(_tmpl$2);
282
+ _$setProperty(_el$9, "innerHTML", ":where(html *) { touch-action: pan-x pan-y; }");
283
+ return _el$9;
284
+ })()];
263
285
  }
264
286
  function MobileShellHeader(props) {
265
287
  return (() => {
266
- var _el$9 = _$getNextElement(_tmpl$5),
267
- _el$12 = _el$9.firstChild,
268
- [_el$13, _co$4] = _$getNextMarker(_el$12.nextSibling),
269
- _el$0 = _el$13.nextSibling,
270
- _el$14 = _el$0.nextSibling,
271
- [_el$15, _co$5] = _$getNextMarker(_el$14.nextSibling);
272
- _$insert(_el$9, _$createComponent(Show, {
288
+ var _el$0 = _$getNextElement(_tmpl$6),
289
+ _el$13 = _el$0.firstChild,
290
+ [_el$14, _co$4] = _$getNextMarker(_el$13.nextSibling),
291
+ _el$1 = _el$14.nextSibling,
292
+ _el$15 = _el$1.nextSibling,
293
+ [_el$16, _co$5] = _$getNextMarker(_el$15.nextSibling);
294
+ _$insert(_el$0, _$createComponent(Show, {
273
295
  get when() {
274
296
  return props.back;
275
297
  },
@@ -289,7 +311,7 @@ function MobileShellHeader(props) {
289
311
  tooltip: false,
290
312
  onClick: () => back().onClick?.(),
291
313
  get children() {
292
- return _$getNextElement(_tmpl$6);
314
+ return _$getNextElement(_tmpl$7);
293
315
  }
294
316
  });
295
317
  },
@@ -307,12 +329,12 @@ function MobileShellHeader(props) {
307
329
  tooltip: false,
308
330
  onClick: () => back().onClick?.(),
309
331
  get children() {
310
- return _$getNextElement(_tmpl$6);
332
+ return _$getNextElement(_tmpl$7);
311
333
  }
312
334
  })
313
335
  })
314
- }), _el$13, _co$4);
315
- _$insert(_el$0, _$createComponent(Show, {
336
+ }), _el$14, _co$4);
337
+ _$insert(_el$1, _$createComponent(Show, {
316
338
  get when() {
317
339
  return _$memo(() => props.sidebarTitle !== undefined)() && props.sidebarTitle !== props.title;
318
340
  },
@@ -321,58 +343,58 @@ function MobileShellHeader(props) {
321
343
  },
322
344
  get children() {
323
345
  return [(() => {
324
- var _el$1 = _$getNextElement(_tmpl$2);
325
- _$insert(_el$1, () => props.title);
326
- return _el$1;
327
- })(), (() => {
328
346
  var _el$10 = _$getNextElement(_tmpl$3);
329
- _$insert(_el$10, () => props.sidebarTitle);
347
+ _$insert(_el$10, () => props.title);
330
348
  return _el$10;
349
+ })(), (() => {
350
+ var _el$11 = _$getNextElement(_tmpl$4);
351
+ _$insert(_el$11, () => props.sidebarTitle);
352
+ return _el$11;
331
353
  })()];
332
354
  }
333
355
  }));
334
- _$insert(_el$9, _$createComponent(Show, {
356
+ _$insert(_el$0, _$createComponent(Show, {
335
357
  get when() {
336
358
  return props.actions;
337
359
  },
338
360
  get children() {
339
- var _el$11 = _$getNextElement(_tmpl$4);
340
- _$insert(_el$11, () => props.actions);
341
- return _el$11;
361
+ var _el$12 = _$getNextElement(_tmpl$5);
362
+ _$insert(_el$12, () => props.actions);
363
+ return _el$12;
342
364
  }
343
- }), _el$15, _co$5);
344
- return _el$9;
365
+ }), _el$16, _co$5);
366
+ return _el$0;
345
367
  })();
346
368
  }
347
369
  function SidebarLink(props) {
348
370
  return (() => {
349
- var _el$18 = _$getNextElement(_tmpl$7),
350
- _el$19 = _el$18.firstChild,
351
- _el$20 = _el$19.nextSibling,
371
+ var _el$19 = _$getNextElement(_tmpl$8),
372
+ _el$20 = _el$19.firstChild,
352
373
  _el$21 = _el$20.nextSibling,
353
- [_el$22, _co$6] = _$getNextMarker(_el$21.nextSibling);
354
- _$insert(_el$20, () => props.item.label);
355
- _$insert(_el$18, _$createComponent(Show, {
374
+ _el$22 = _el$21.nextSibling,
375
+ [_el$23, _co$6] = _$getNextMarker(_el$22.nextSibling);
376
+ _$insert(_el$21, () => props.item.label);
377
+ _$insert(_el$19, _$createComponent(Show, {
356
378
  get when() {
357
379
  return props.item.badge ?? props.item.count;
358
380
  },
359
381
  children: mark => (() => {
360
- var _el$23 = _$getNextElement(_tmpl$8);
361
- _$insert(_el$23, mark);
362
- return _el$23;
382
+ var _el$24 = _$getNextElement(_tmpl$9);
383
+ _$insert(_el$24, mark);
384
+ return _el$24;
363
385
  })()
364
- }), _el$22, _co$6);
386
+ }), _el$23, _co$6);
365
387
  _$effect(_p$ => {
366
388
  var _v$3 = props.item.href,
367
389
  _v$4 = props.item.current ? "page" : undefined,
368
390
  _v$5 = props.item.id,
369
391
  _v$6 = props.item.title ?? props.item.label,
370
392
  _v$7 = props.item.icon;
371
- _v$3 !== _p$.e && _$setAttribute(_el$18, "href", _p$.e = _v$3);
372
- _v$4 !== _p$.t && _$setAttribute(_el$18, "aria-current", _p$.t = _v$4);
373
- _v$5 !== _p$.a && _$setAttribute(_el$18, "data-tab", _p$.a = _v$5);
374
- _v$6 !== _p$.o && _$setAttribute(_el$18, "data-k2b-title", _p$.o = _v$6);
375
- _v$7 !== _p$.i && _$className(_el$19, _p$.i = _v$7);
393
+ _v$3 !== _p$.e && _$setAttribute(_el$19, "href", _p$.e = _v$3);
394
+ _v$4 !== _p$.t && _$setAttribute(_el$19, "aria-current", _p$.t = _v$4);
395
+ _v$5 !== _p$.a && _$setAttribute(_el$19, "data-tab", _p$.a = _v$5);
396
+ _v$6 !== _p$.o && _$setAttribute(_el$19, "data-k2b-title", _p$.o = _v$6);
397
+ _v$7 !== _p$.i && _$className(_el$20, _p$.i = _v$7);
376
398
  return _p$;
377
399
  }, {
378
400
  e: undefined,
@@ -381,7 +403,7 @@ function SidebarLink(props) {
381
403
  o: undefined,
382
404
  i: undefined
383
405
  });
384
- return _el$18;
406
+ return _el$19;
385
407
  })();
386
408
  }
387
409
 
@@ -392,70 +414,70 @@ function SidebarLink(props) {
392
414
  */
393
415
  function MobileShellSidebar(props) {
394
416
  const list = items => (() => {
395
- var _el$24 = _$getNextElement(_tmpl$9);
396
- _$insert(_el$24, _$createComponent(For, {
417
+ var _el$25 = _$getNextElement(_tmpl$0);
418
+ _$insert(_el$25, _$createComponent(For, {
397
419
  each: items,
398
420
  children: item => (() => {
399
- var _el$25 = _$getNextElement(_tmpl$0);
400
- _$insert(_el$25, _$createComponent(SidebarLink, {
421
+ var _el$26 = _$getNextElement(_tmpl$1);
422
+ _$insert(_el$26, _$createComponent(SidebarLink, {
401
423
  item: item
402
424
  }));
403
- return _el$25;
425
+ return _el$26;
404
426
  })()
405
427
  }));
406
- return _el$24;
428
+ return _el$25;
407
429
  })();
408
430
  return (() => {
409
- var _el$26 = _$getNextElement(_tmpl$10),
410
- _el$27 = _el$26.firstChild,
411
- _el$29 = _el$27.firstChild,
412
- [_el$30, _co$7] = _$getNextMarker(_el$29.nextSibling),
413
- _el$28 = _el$30.nextSibling,
414
- _el$31 = _el$27.nextSibling,
415
- _el$32 = _el$31.firstChild,
416
- [_el$33, _co$8] = _$getNextMarker(_el$32.nextSibling),
417
- _el$34 = _el$33.nextSibling,
418
- [_el$35, _co$9] = _$getNextMarker(_el$34.nextSibling),
419
- _el$37 = _el$31.nextSibling,
420
- [_el$38, _co$0] = _$getNextMarker(_el$37.nextSibling);
421
- _$insert(_el$27, _$createComponent(Show, {
431
+ var _el$27 = _$getNextElement(_tmpl$11),
432
+ _el$28 = _el$27.firstChild,
433
+ _el$30 = _el$28.firstChild,
434
+ [_el$31, _co$7] = _$getNextMarker(_el$30.nextSibling),
435
+ _el$29 = _el$31.nextSibling,
436
+ _el$32 = _el$28.nextSibling,
437
+ _el$33 = _el$32.firstChild,
438
+ [_el$34, _co$8] = _$getNextMarker(_el$33.nextSibling),
439
+ _el$35 = _el$34.nextSibling,
440
+ [_el$36, _co$9] = _$getNextMarker(_el$35.nextSibling),
441
+ _el$38 = _el$32.nextSibling,
442
+ [_el$39, _co$0] = _$getNextMarker(_el$38.nextSibling);
443
+ _$insert(_el$28, _$createComponent(Show, {
422
444
  get when() {
423
445
  return props.logo;
424
446
  },
425
447
  children: logo => (() => {
426
- var _el$39 = _$getNextElement(_tmpl$11);
427
- _$effect(() => _$setAttribute(_el$39, "src", logo()));
428
- return _el$39;
448
+ var _el$40 = _$getNextElement(_tmpl$12);
449
+ _$effect(() => _$setAttribute(_el$40, "src", logo()));
450
+ return _el$40;
429
451
  })()
430
- }), _el$30, _co$7);
431
- _$insert(_el$28, () => props.title);
432
- _$insert(_el$31, () => list(props.items), _el$33, _co$8);
433
- _$insert(_el$31, _$createComponent(For, {
452
+ }), _el$31, _co$7);
453
+ _$insert(_el$29, () => props.title);
454
+ _$insert(_el$32, () => list(props.items), _el$34, _co$8);
455
+ _$insert(_el$32, _$createComponent(For, {
434
456
  get each() {
435
457
  return (props.sections ?? []).filter(section => section.items.length > 0);
436
458
  },
437
459
  children: section => (() => {
438
- var _el$40 = _$getNextElement(_tmpl$12),
439
- _el$41 = _el$40.firstChild,
440
- _el$42 = _el$41.nextSibling,
441
- [_el$43, _co$1] = _$getNextMarker(_el$42.nextSibling);
442
- _$insert(_el$41, () => section.title);
443
- _$insert(_el$40, () => list(section.items), _el$43, _co$1);
444
- return _el$40;
460
+ var _el$41 = _$getNextElement(_tmpl$13),
461
+ _el$42 = _el$41.firstChild,
462
+ _el$43 = _el$42.nextSibling,
463
+ [_el$44, _co$1] = _$getNextMarker(_el$43.nextSibling);
464
+ _$insert(_el$42, () => section.title);
465
+ _$insert(_el$41, () => list(section.items), _el$44, _co$1);
466
+ return _el$41;
445
467
  })()
446
- }), _el$35, _co$9);
447
- _$insert(_el$26, _$createComponent(Show, {
468
+ }), _el$36, _co$9);
469
+ _$insert(_el$27, _$createComponent(Show, {
448
470
  get when() {
449
471
  return props.footer?.length;
450
472
  },
451
473
  get children() {
452
- var _el$36 = _$getNextElement(_tmpl$1);
453
- _$insert(_el$36, () => list(props.footer ?? []));
454
- return _el$36;
474
+ var _el$37 = _$getNextElement(_tmpl$10);
475
+ _$insert(_el$37, () => list(props.footer ?? []));
476
+ return _el$37;
455
477
  }
456
- }), _el$38, _co$0);
457
- _$effect(() => _$setAttribute(_el$26, "aria-label", props.label));
458
- return _el$26;
478
+ }), _el$39, _co$0);
479
+ _$effect(() => _$setAttribute(_el$27, "aria-label", props.label));
480
+ return _el$27;
459
481
  })();
460
482
  }
461
483
 
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["layout/MobileShell.tsx"],"sourcesContent":["import { For, type JSX, onCleanup, onMount, Show } from \"solid-js\";\nimport { IconButton, IconButtonLink } from \"../actions/Button\";\nimport ScrollArea from \"./ScrollArea\";\nimport { installScrollFades } from \"./scroll-fade\";\nimport type { TabBarItem } from \"./TabBar\";\n\nexport type MobileShellProps = {\n /** Usually `MobileShell.Header`; it sits above the scroll area and pads the top safe area. */\n header?: JSX.Element;\n /** Usually a `TabBar`; it sits below the scroll area and pads the bottom safe area itself. */\n footer?: JSX.Element;\n /**\n * Usually `MobileShell.Sidebar` with the footer's destinations and more. From 48rem of window width it stands at\n * the start edge and the footer goes; below, it is not shown. The server renders both, so CSS alone decides.\n */\n sidebar?: JSX.Element;\n /** The page content, inside the shell's only scroll area. */\n children: JSX.Element;\n /**\n * `false` for content that brings its own heads and scroll areas, such as `AppWorkspace.Main` levels: it fills the\n * main area without the shell's scroll area, and the header shows only as the frame of the next page while a tapped\n * tab's page loads.\n */\n scroll?: boolean;\n class?: string;\n};\n\nexport type MobileShellHeaderProps = {\n title: string;\n /** The title while the shell shows its sidebar, which already names the app; `title` by default. */\n sidebarTitle?: string;\n /**\n * A Back control before the title: a link with `href`, otherwise a button. `withSidebar: false` hides it while the\n * shell shows its sidebar, for a way back to a destination the sidebar lists.\n */\n back?: { href?: string; onClick?: () => void; label: string; withSidebar?: boolean };\n /** Controls after the title, such as a menu. */\n actions?: JSX.Element;\n};\n\n/** Read by the toast rail, which is portalled outside the shell, so it lives on the body. */\nconst FOOTER_HEIGHT = \"--k2b-mobile-shell-footer-height\";\n/** How much of the scroll area a persistent toast covers; local to the shell. */\nconst TOAST_INSET = \"--k2b-mobile-shell-toast-inset\";\n\n/**\n * The visible part of the toast rail when it holds a toast without a timer (`duration: 0`, running progress, or a\n * custom slot), so the last row of the scroll area can still scroll above it. A rail that sits elsewhere, such as\n * above a dialog, covers nothing.\n */\nconst persistentToastInset = (body: HTMLElement): number => {\n if (document.querySelector(\"dialog:modal\")) return 0;\n const cards = [...document.querySelectorAll<HTMLElement>(\"[data-k2b-toast-container] [data-k2b-toast]:not([data-closing])\")];\n if (!cards.some((card) => card.dataset.persistent === \"true\")) return 0;\n const area = body.getBoundingClientRect();\n const top = Math.min(...cards.map((card) => card.getBoundingClientRect().top));\n return Math.max(0, Math.min(area.height, area.bottom - top));\n};\n\n/** Marks the link whose page is loading; the tab bar shows it as selected. */\nconst PENDING = \"data-k2b-pending\";\n/** On a link: the title of the page it opens. Such a link switches the shell to that page's frame at the first touch. */\nconst PAGE_TITLE = \"data-k2b-title\";\n/** On the root while the shell shows the frame of the page that is loading. */\nconst SWITCHING = \"data-k2b-switching\";\n/** On the header title while the shell switches: the loading page's title, which the title shows instead. */\nconst NEXT_TITLE = \"data-k2b-next-title\";\n\n/** The link a click or press follows as a page load of this origin, or null when it does something else. */\nconst pageLink = (root: HTMLElement, event: MouseEvent): HTMLAnchorElement | null => {\n if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return null;\n const link = event.target instanceof Element ? event.target.closest<HTMLAnchorElement>(\"a[href]\") : null;\n if (!link || !root.contains(link) || link.hasAttribute(\"download\") || (link.target && link.target !== \"_self\")) return null;\n const url = new URL(link.href);\n if (url.origin !== location.origin) return null;\n // A jump inside the page loads nothing.\n if (url.hash && url.pathname === location.pathname && url.search === location.search) return null;\n return link;\n};\n\n/**\n * Taps on the shell's links. iOS shows `:active` only while the page listens to touches, so a tap gets its pressed\n * state at once. A link's page keeps loading while the old page stays visible; a second tap on it would cancel that\n * load and start it over, so it is ignored. A link that names its page's title, such as a tab, shows that page's\n * frame at the first touch instead of at the end of the tap: its title and an empty content area, until the page\n * arrives. Returns the cleanup.\n */\nconst observeLinkTaps = (root: HTMLElement): (() => void) => {\n /** The link marked as the next page. */\n let pending: string | undefined;\n /** Whether its page is loading; a pressed tab waits for its click. */\n let loading = false;\n const clear = () => {\n pending = undefined;\n loading = false;\n for (const link of root.querySelectorAll(`[${PENDING}]`)) link.removeAttribute(PENDING);\n root.removeAttribute(SWITCHING);\n root.querySelector(\".k2b-mobile-shell__title\")?.removeAttribute(NEXT_TITLE);\n };\n const mark = (link: HTMLAnchorElement) => {\n clear();\n pending = link.href;\n link.setAttribute(PENDING, \"\");\n const title = link.getAttribute(PAGE_TITLE);\n const heading = root.querySelector(\".k2b-mobile-shell__title\");\n if (title === null || !heading) return;\n heading.setAttribute(NEXT_TITLE, title);\n root.setAttribute(SWITCHING, \"\");\n };\n const touch = () => {};\n // A press on a tab shows its page's frame while the finger is still down. The page itself loads with the click\n // that ends the tap, as for any link: only the end of a touch counts as the person's action, and a load that\n // started before it could let the browser's Back skip this page.\n const press = (event: PointerEvent) => {\n if (!event.isPrimary) return;\n const link = pageLink(root, event);\n if (!link?.hasAttribute(PAGE_TITLE) || (link.href === pending && loading)) return;\n mark(link);\n };\n // A press that the browser takes over, such as one that turns into a scroll, ends without a click and takes its\n // frame back.\n const cancel = (event: PointerEvent) => {\n if (event.isPrimary && !loading) clear();\n };\n // On the window, so it runs after every handler of the click, including delegated ones that prevent it.\n const click = (event: MouseEvent) => {\n const link = pageLink(root, event);\n if (link && link.href === pending && loading) {\n event.preventDefault();\n return;\n }\n // Any other tap ends the wait, also for a link that answered with a download instead of a page.\n clear();\n if (!link) return;\n mark(link);\n loading = true;\n };\n // iOS sends no click for a tap on content without an action, so the end of a tap anywhere else ends the wait as\n // well. A touch that scrolls ends without a pointerup and keeps a load's wait.\n const release = (event: PointerEvent) => {\n if (pending === undefined) return;\n const link = event.target instanceof Element ? event.target.closest<HTMLAnchorElement>(\"a[href]\") : null;\n if (link?.href !== pending) clear();\n };\n // A page restored from the back/forward cache shows the state it was left in.\n const show = (event: PageTransitionEvent) => {\n if (event.persisted) clear();\n };\n document.addEventListener(\"touchstart\", touch, { passive: true });\n window.addEventListener(\"pointerdown\", press);\n window.addEventListener(\"pointercancel\", cancel);\n window.addEventListener(\"pointerup\", release);\n window.addEventListener(\"click\", click);\n window.addEventListener(\"pageshow\", show);\n return () => {\n document.removeEventListener(\"touchstart\", touch);\n window.removeEventListener(\"pointerdown\", press);\n window.removeEventListener(\"pointercancel\", cancel);\n window.removeEventListener(\"pointerup\", release);\n window.removeEventListener(\"click\", click);\n window.removeEventListener(\"pageshow\", show);\n clear();\n };\n};\n\n/**\n * Keeps a mounted shell working: the footer height on the body, which the portalled toast rail reads, the room a\n * persistent toast takes from the scroll area, the scroll area's edge fade, and immediate feedback for link taps.\n * The fade is the only cue at the footer's edge, which has no rule. `MobileShell` calls it itself;\n * a page that renders the shell on the server without hydrating it calls it once in the browser. Returns the\n * cleanup.\n */\nexport function observeMobileShell(root: HTMLElement): () => void {\n const main = root.querySelector<HTMLElement>(\":scope > .k2b-mobile-shell__main\");\n const body = main?.querySelector<HTMLElement>(\":scope > .k2b-mobile-shell__body\");\n if (!main) return () => {};\n const stopLinkTaps = observeLinkTaps(root);\n // Content with its own scroll areas keeps its own fades; the room a toast takes applies to the whole main area.\n const stopScrollFades = body ? installScrollFades(body) : () => {};\n let frame = 0;\n let owner: HTMLElement | null = null;\n let resize: ResizeObserver | undefined;\n const watchOwner = () => {\n const next = root.querySelector<HTMLElement>(\"[data-k2b-shell-bottom]\");\n if (next === owner) return;\n if (owner) resize?.unobserve(owner);\n owner = next;\n if (owner) resize?.observe(owner);\n };\n const measure = () => {\n frame = 0;\n watchOwner();\n const rootBottom = root.getBoundingClientRect().bottom;\n // Content that owns the bottom edge, such as a chat's composer, counts as the footer, so toasts stay above it.\n const owned = owner?.getClientRects().length ? rootBottom - owner.getBoundingClientRect().top : 0;\n const footer = Math.max(0, rootBottom - main.getBoundingClientRect().bottom, owned);\n document.body.style.setProperty(FOOTER_HEIGHT, `${footer}px`);\n root.style.setProperty(TOAST_INSET, `${persistentToastInset(body ?? main)}px`);\n };\n const schedule = () => {\n if (!frame) frame = requestAnimationFrame(measure);\n };\n // The footer can appear, disappear, or change height; the main area takes whatever it leaves. Content that owns the\n // bottom edge, such as a composer, grows and shrinks on its own.\n resize = new ResizeObserver(schedule);\n resize.observe(root);\n resize.observe(main);\n measure();\n // Toasts arrive and leave anywhere in the document, and their slots grow and collapse in a transition.\n const mutations = new MutationObserver(schedule);\n mutations.observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: [\"data-state\", \"data-closing\", \"data-persistent\", \"open\"],\n });\n document.addEventListener(\"transitionend\", schedule, true);\n return () => {\n if (frame) cancelAnimationFrame(frame);\n resize.disconnect();\n mutations.disconnect();\n document.removeEventListener(\"transitionend\", schedule, true);\n document.body.style.removeProperty(FOOTER_HEIGHT);\n stopLinkTaps();\n stopScrollFades();\n };\n}\n\nfunction MobileShellRoot(props: MobileShellProps): JSX.Element {\n let root!: HTMLDivElement;\n\n onMount(() => onCleanup(observeMobileShell(root)));\n\n return (\n <div\n ref={root}\n class={props.class ? `k2b-mobile-shell ${props.class}` : \"k2b-mobile-shell\"}\n data-k2b-content-heads={props.scroll === false ? \"\" : undefined}\n >\n {props.sidebar}\n {props.header}\n <main class=\"k2b-mobile-shell__main\">\n <Show when={props.scroll !== false} fallback={props.children}>\n <ScrollArea class=\"k2b-mobile-shell__body\">{props.children}</ScrollArea>\n </Show>\n </main>\n {props.footer}\n </div>\n );\n}\n\nfunction MobileShellHeader(props: MobileShellHeaderProps): JSX.Element {\n return (\n <header class=\"k2b-mobile-shell__header\">\n <Show when={props.back}>\n {(back) => (\n <Show\n when={back().href}\n fallback={\n <IconButton\n class=\"k2b-mobile-shell__back\"\n data-with-sidebar={back().withSidebar === false ? \"false\" : undefined}\n label={back().label}\n tooltip={false}\n onClick={() => back().onClick?.()}\n >\n <i class=\"ti ti-chevron-left\" aria-hidden=\"true\" />\n </IconButton>\n }\n >\n {(href) => (\n <IconButtonLink\n class=\"k2b-mobile-shell__back\"\n data-with-sidebar={back().withSidebar === false ? \"false\" : undefined}\n href={href()}\n label={back().label}\n tooltip={false}\n onClick={() => back().onClick?.()}\n >\n <i class=\"ti ti-chevron-left\" aria-hidden=\"true\" />\n </IconButtonLink>\n )}\n </Show>\n )}\n </Show>\n <h1 class=\"k2b-mobile-shell__title\">\n <Show when={props.sidebarTitle !== undefined && props.sidebarTitle !== props.title} fallback={props.title}>\n <span class=\"k2b-mobile-shell__title-narrow\">{props.title}</span>\n <span class=\"k2b-mobile-shell__title-wide\">{props.sidebarTitle}</span>\n </Show>\n </h1>\n <Show when={props.actions}>\n <div class=\"k2b-mobile-shell__actions\">{props.actions}</div>\n </Show>\n </header>\n );\n}\n\nexport type MobileShellSidebarItem = TabBarItem & {\n /**\n * A quiet count after the label, such as open tasks: a number (0 shows nothing) or an element that renders one. The\n * item's `badge`, which calls for attention, takes its place.\n */\n count?: number | JSX.Element;\n};\n\nexport type MobileShellSidebarProps = {\n /** Accessible name of the navigation landmark; usually the tab bar's. */\n label: string;\n /** The app's name in the sidebar's head. */\n title: string;\n /** Address of the app's logo before the name; decorative, the name says it. */\n logo?: string;\n /** Destinations at the top, such as Start. */\n items: readonly MobileShellSidebarItem[];\n /** Named groups below them, such as the apps; a group without items is left out. */\n sections?: readonly { title: string; items: readonly MobileShellSidebarItem[] }[];\n /** Destinations at the bottom edge, such as Settings. */\n footer?: readonly MobileShellSidebarItem[];\n};\n\nfunction SidebarLink(props: { item: MobileShellSidebarItem }): JSX.Element {\n return (\n <a\n href={props.item.href}\n aria-current={props.item.current ? \"page\" : undefined}\n data-tab={props.item.id}\n data-k2b-title={props.item.title ?? props.item.label}\n >\n <i class={props.item.icon} aria-hidden=\"true\" />\n <span class=\"k2b-truncate-fade\">{props.item.label}</span>\n <Show when={props.item.badge ?? props.item.count}>{(mark) => <span class=\"k2b-mobile-shell__sidebar-count\">{mark()}</span>}</Show>\n </a>\n );\n}\n\n/**\n * The navigation of a touch app on a wide screen, in `MobileShell`'s `sidebar`: the app's name, then its destinations\n * as 44 px rows with icon and label, the open one in the action colour. A press shows the item's page frame at once,\n * as on a tab, and the row of a loading page pulses.\n */\nfunction MobileShellSidebar(props: MobileShellSidebarProps): JSX.Element {\n const list = (items: readonly MobileShellSidebarItem[]) => (\n <ul>\n <For each={items}>\n {(item) => (\n <li>\n <SidebarLink item={item} />\n </li>\n )}\n </For>\n </ul>\n );\n return (\n <nav class=\"k2b-mobile-shell__sidebar\" aria-label={props.label}>\n <div class=\"k2b-mobile-shell__sidebar-head\">\n <Show when={props.logo}>{(logo) => <img src={logo()} alt=\"\" width=\"32\" height=\"32\" />}</Show>\n <span class=\"k2b-truncate-fade\">{props.title}</span>\n </div>\n <div class=\"k2b-mobile-shell__sidebar-body\">\n {list(props.items)}\n <For each={(props.sections ?? []).filter((section) => section.items.length > 0)}>\n {(section) => (\n <section>\n <h2>{section.title}</h2>\n {list(section.items)}\n </section>\n )}\n </For>\n </div>\n <Show when={props.footer?.length}>\n <div class=\"k2b-mobile-shell__sidebar-foot\">{list(props.footer ?? [])}</div>\n </Show>\n </nav>\n );\n}\n\n/**\n * The full-screen frame of a phone app: a header, one scroll area, and an optional footer such as a `TabBar`. With a\n * `sidebar`, a window of 48rem and wider shows the sidebar at the start edge instead of the footer, and the toast rail\n * stays in the area beside it. While it is mounted, the document itself never scrolls, pinch zoom and rubber-banding\n * are off, and the toast rail sits above the footer. Mount one per page, as the page's layout.\n */\nexport const MobileShell = Object.assign(MobileShellRoot, { Header: MobileShellHeader, Sidebar: MobileShellSidebar });\n\nexport default MobileShell;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,GAAG,EAAY,SAAS,EAAE,OAAO,EAAE,IAAI,QAAQ,UAAU;AAClE,SAAS,UAAU,EAAE,cAAc,QAAQ,mBAAmB;AAC9D,OAAO,UAAU,MAAM,cAAc;AACrC,SAAS,kBAAkB,QAAQ,eAAe;AAqClD;AACA,MAAM,aAAa,GAAG,kCAAkC;AACxD;AACA,MAAM,WAAW,GAAG,gCAAgC;;AAEpD;AACA;AACA;AACA;AACA;AACA,MAAM,oBAAoB,GAAI,IAAiB,IAAa;EAC1D,IAAI,QAAQ,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;EACpD,MAAM,KAAK,GAAG,CAAC,GAAG,QAAQ,CAAC,gBAAgB,CAAc,iEAAiE,CAAC,CAAC;EAC5H,IAAI,CAAC,KAAK,CAAC,IAAI,CAAE,IAAI,IAAK,IAAI,CAAC,OAAO,CAAC,UAAU,KAAK,MAAM,CAAC,EAAE,OAAO,CAAC;EACvE,MAAM,IAAI,GAAG,IAAI,CAAC,qBAAqB,CAAC,CAAC;EACzC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAE,IAAI,IAAK,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;EAC9E,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;AAC9D,CAAC;;AAED;AACA,MAAM,OAAO,GAAG,kBAAkB;AAClC;AACA,MAAM,UAAU,GAAG,gBAAgB;AACnC;AACA,MAAM,SAAS,GAAG,oBAAoB;AACtC;AACA,MAAM,UA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;QAAA,uBACjB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QAAA;MAAA;IAEvB;IAAA,mCAGJ,IAAI;MAAA,IAAC,IAAI;QAAA,OAAE,KAAK,CAAC,MAAM,EAAE,MAAM;MAAA;MAAA;QAAA;QAAA,uBACe,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC;QAAA;MAAA;IAAA;IAAA,oDAjBtB,KAAK,CAAC,KAAK;IAAA;EAAA;AAqBlE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;EAAE,MAAM,EAAE,iBAAiB;EAAE,OAAO,EAAE;AAAmB,CAAC,CAAC;AAErH,eAAe,WAAW","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["layout/MobileShell.tsx"],"sourcesContent":["import { For, type JSX, onCleanup, onMount, Show } from \"solid-js\";\nimport { IconButton, IconButtonLink } from \"../actions/Button\";\nimport ScrollArea from \"./ScrollArea\";\nimport { installScrollFades } from \"./scroll-fade\";\nimport type { TabBarItem } from \"./TabBar\";\n\nexport type MobileShellProps = {\n /** Usually `MobileShell.Header`; it sits above the scroll area and pads the top safe area. */\n header?: JSX.Element;\n /** Usually a `TabBar`; it sits below the scroll area and pads the bottom safe area itself. */\n footer?: JSX.Element;\n /**\n * Usually `MobileShell.Sidebar` with the footer's destinations and more. From 48rem of window width it stands at\n * the start edge and the footer goes; below, it is not shown. The server renders both, so CSS alone decides.\n */\n sidebar?: JSX.Element;\n /** The page content, inside the shell's only scroll area. */\n children: JSX.Element;\n /**\n * `false` for content that brings its own heads and scroll areas, such as `AppWorkspace.Main` levels: it fills the\n * main area without the shell's scroll area, and the header shows only as the frame of the next page while a tapped\n * tab's page loads.\n */\n scroll?: boolean;\n class?: string;\n};\n\nexport type MobileShellHeaderProps = {\n title: string;\n /** The title while the shell shows its sidebar, which already names the app; `title` by default. */\n sidebarTitle?: string;\n /**\n * A Back control before the title: a link with `href`, otherwise a button. `withSidebar: false` hides it while the\n * shell shows its sidebar, for a way back to a destination the sidebar lists.\n */\n back?: { href?: string; onClick?: () => void; label: string; withSidebar?: boolean };\n /** Controls after the title, such as a menu. */\n actions?: JSX.Element;\n};\n\n/**\n * On the document element while a shell is the page: `\"sidebar\"` when it shows its sidebar, otherwise empty. A host\n * that renders the shell on the server writes it into its `<html>` too, so the first paint already has it.\n */\nconst SHELL_ATTRIBUTE = \"data-k2b-mobile-shell\";\n/** On the document element while a shell is mounted and a modal dialog is open. */\nconst MODAL_ATTRIBUTE = \"data-k2b-mobile-shell-modal\";\n/** Read by the toast rail, which is portalled outside the shell, so it lives on the body. */\nconst FOOTER_HEIGHT = \"--k2b-mobile-shell-footer-height\";\n/** How much of the scroll area a persistent toast covers; local to the shell. */\nconst TOAST_INSET = \"--k2b-mobile-shell-toast-inset\";\n\n/**\n * The visible part of the toast rail when it holds a toast without a timer (`duration: 0`, running progress, or a\n * custom slot), so the last row of the scroll area can still scroll above it. A rail that sits elsewhere, such as\n * above a dialog, covers nothing.\n */\nconst persistentToastInset = (body: HTMLElement): number => {\n if (document.querySelector(\"dialog:modal\")) return 0;\n const cards = [...document.querySelectorAll<HTMLElement>(\"[data-k2b-toast-container] [data-k2b-toast]:not([data-closing])\")];\n if (!cards.some((card) => card.dataset.persistent === \"true\")) return 0;\n const area = body.getBoundingClientRect();\n const top = Math.min(...cards.map((card) => card.getBoundingClientRect().top));\n return Math.max(0, Math.min(area.height, area.bottom - top));\n};\n\n/** Marks the link whose page is loading; the tab bar shows it as selected. */\nconst PENDING = \"data-k2b-pending\";\n/** On a link: the title of the page it opens. Such a link switches the shell to that page's frame at the first touch. */\nconst PAGE_TITLE = \"data-k2b-title\";\n/** On the root while the shell shows the frame of the page that is loading. */\nconst SWITCHING = \"data-k2b-switching\";\n/** On the header title while the shell switches: the loading page's title, which the title shows instead. */\nconst NEXT_TITLE = \"data-k2b-next-title\";\n\n/** The link a click or press follows as a page load of this origin, or null when it does something else. */\nconst pageLink = (root: HTMLElement, event: MouseEvent): HTMLAnchorElement | null => {\n if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return null;\n const link = event.target instanceof Element ? event.target.closest<HTMLAnchorElement>(\"a[href]\") : null;\n if (!link || !root.contains(link) || link.hasAttribute(\"download\") || (link.target && link.target !== \"_self\")) return null;\n const url = new URL(link.href);\n if (url.origin !== location.origin) return null;\n // A jump inside the page loads nothing.\n if (url.hash && url.pathname === location.pathname && url.search === location.search) return null;\n return link;\n};\n\n/**\n * Taps on the shell's links. iOS shows `:active` only while the page listens to touches, so a tap gets its pressed\n * state at once. A link's page keeps loading while the old page stays visible; a second tap on it would cancel that\n * load and start it over, so it is ignored. A link that names its page's title, such as a tab, shows that page's\n * frame at the first touch instead of at the end of the tap: its title and an empty content area, until the page\n * arrives. Returns the cleanup.\n */\nconst observeLinkTaps = (root: HTMLElement): (() => void) => {\n /** The link marked as the next page. */\n let pending: string | undefined;\n /** Whether its page is loading; a pressed tab waits for its click. */\n let loading = false;\n const clear = () => {\n pending = undefined;\n loading = false;\n for (const link of root.querySelectorAll(`[${PENDING}]`)) link.removeAttribute(PENDING);\n root.removeAttribute(SWITCHING);\n root.querySelector(\".k2b-mobile-shell__title\")?.removeAttribute(NEXT_TITLE);\n };\n const mark = (link: HTMLAnchorElement) => {\n clear();\n pending = link.href;\n link.setAttribute(PENDING, \"\");\n const title = link.getAttribute(PAGE_TITLE);\n const heading = root.querySelector(\".k2b-mobile-shell__title\");\n if (title === null || !heading) return;\n heading.setAttribute(NEXT_TITLE, title);\n root.setAttribute(SWITCHING, \"\");\n };\n const touch = () => {};\n // A press on a tab shows its page's frame while the finger is still down. The page itself loads with the click\n // that ends the tap, as for any link: only the end of a touch counts as the person's action, and a load that\n // started before it could let the browser's Back skip this page.\n const press = (event: PointerEvent) => {\n if (!event.isPrimary) return;\n const link = pageLink(root, event);\n if (!link?.hasAttribute(PAGE_TITLE) || (link.href === pending && loading)) return;\n mark(link);\n };\n // A press that the browser takes over, such as one that turns into a scroll, ends without a click and takes its\n // frame back.\n const cancel = (event: PointerEvent) => {\n if (event.isPrimary && !loading) clear();\n };\n // On the window, so it runs after every handler of the click, including delegated ones that prevent it.\n const click = (event: MouseEvent) => {\n const link = pageLink(root, event);\n if (link && link.href === pending && loading) {\n event.preventDefault();\n return;\n }\n // Any other tap ends the wait, also for a link that answered with a download instead of a page.\n clear();\n if (!link) return;\n mark(link);\n loading = true;\n };\n // iOS sends no click for a tap on content without an action, so the end of a tap anywhere else ends the wait as\n // well. A touch that scrolls ends without a pointerup and keeps a load's wait.\n const release = (event: PointerEvent) => {\n if (pending === undefined) return;\n const link = event.target instanceof Element ? event.target.closest<HTMLAnchorElement>(\"a[href]\") : null;\n if (link?.href !== pending) clear();\n };\n // A page restored from the back/forward cache shows the state it was left in.\n const show = (event: PageTransitionEvent) => {\n if (event.persisted) clear();\n };\n document.addEventListener(\"touchstart\", touch, { passive: true });\n window.addEventListener(\"pointerdown\", press);\n window.addEventListener(\"pointercancel\", cancel);\n window.addEventListener(\"pointerup\", release);\n window.addEventListener(\"click\", click);\n window.addEventListener(\"pageshow\", show);\n return () => {\n document.removeEventListener(\"touchstart\", touch);\n window.removeEventListener(\"pointerdown\", press);\n window.removeEventListener(\"pointercancel\", cancel);\n window.removeEventListener(\"pointerup\", release);\n window.removeEventListener(\"click\", click);\n window.removeEventListener(\"pageshow\", show);\n clear();\n };\n};\n\n/**\n * Keeps a mounted shell working: the footer height on the body, which the portalled toast rail reads, the room a\n * persistent toast takes from the scroll area, the scroll area's edge fade, and immediate feedback for link taps.\n * The fade is the only cue at the footer's edge, which has no rule. `MobileShell` calls it itself;\n * a page that renders the shell on the server without hydrating it calls it once in the browser. Returns the\n * cleanup.\n */\nexport function observeMobileShell(root: HTMLElement): () => void {\n const main = root.querySelector<HTMLElement>(\":scope > .k2b-mobile-shell__main\");\n const body = main?.querySelector<HTMLElement>(\":scope > .k2b-mobile-shell__body\");\n if (!main) return () => {};\n const stopLinkTaps = observeLinkTaps(root);\n // The document says that a shell is the page, for the controls and toasts portalled outside it. An attribute, not\n // `html:has(.k2b-mobile-shell)`: a `:has()` on the document restyles the whole page on every change inside it.\n const documentRoot = root.ownerDocument.documentElement;\n const previousShell = documentRoot.getAttribute(SHELL_ATTRIBUTE);\n documentRoot.setAttribute(SHELL_ATTRIBUTE, root.querySelector(\":scope > .k2b-mobile-shell__sidebar\") ? \"sidebar\" : \"\");\n // Content with its own scroll areas keeps its own fades; the room a toast takes applies to the whole main area.\n const stopScrollFades = body ? installScrollFades(body) : () => {};\n let frame = 0;\n let owner: HTMLElement | null = null;\n let resize: ResizeObserver | undefined;\n const watchOwner = () => {\n const next = root.querySelector<HTMLElement>(\"[data-k2b-shell-bottom]\");\n if (next === owner) return;\n if (owner) resize?.unobserve(owner);\n owner = next;\n if (owner) resize?.observe(owner);\n };\n const measure = () => {\n frame = 0;\n watchOwner();\n const rootBottom = root.getBoundingClientRect().bottom;\n // Content that owns the bottom edge, such as a chat's composer, counts as the footer, so toasts stay above it.\n const owned = owner?.getClientRects().length ? rootBottom - owner.getBoundingClientRect().top : 0;\n const footer = Math.max(0, rootBottom - main.getBoundingClientRect().bottom, owned);\n document.body.style.setProperty(FOOTER_HEIGHT, `${footer}px`);\n root.style.setProperty(TOAST_INSET, `${persistentToastInset(body ?? main)}px`);\n // A modal dialog takes the bottom edge back for its footer; the toast rules read this, not `html:has(dialog:modal)`.\n documentRoot.toggleAttribute(MODAL_ATTRIBUTE, document.querySelector(\"dialog:modal\") !== null);\n };\n const schedule = () => {\n if (!frame) frame = requestAnimationFrame(measure);\n };\n // The footer can appear, disappear, or change height; the main area takes whatever it leaves. Content that owns the\n // bottom edge, such as a composer, grows and shrinks on its own.\n resize = new ResizeObserver(schedule);\n resize.observe(root);\n resize.observe(main);\n measure();\n // Toasts arrive and leave anywhere in the document, and their slots grow and collapse in a transition.\n const mutations = new MutationObserver(schedule);\n mutations.observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: [\"data-state\", \"data-closing\", \"data-persistent\", \"open\"],\n });\n document.addEventListener(\"transitionend\", schedule, true);\n return () => {\n if (frame) cancelAnimationFrame(frame);\n resize.disconnect();\n mutations.disconnect();\n document.removeEventListener(\"transitionend\", schedule, true);\n document.body.style.removeProperty(FOOTER_HEIGHT);\n documentRoot.removeAttribute(MODAL_ATTRIBUTE);\n if (previousShell === null) documentRoot.removeAttribute(SHELL_ATTRIBUTE);\n else documentRoot.setAttribute(SHELL_ATTRIBUTE, previousShell);\n stopLinkTaps();\n stopScrollFades();\n };\n}\n\nfunction MobileShellRoot(props: MobileShellProps): JSX.Element {\n let root!: HTMLDivElement;\n\n onMount(() => onCleanup(observeMobileShell(root)));\n return (\n <>\n <div\n ref={root}\n class={props.class ? `k2b-mobile-shell ${props.class}` : \"k2b-mobile-shell\"}\n data-k2b-content-heads={props.scroll === false ? \"\" : undefined}\n >\n {props.sidebar}\n {props.header}\n <main class=\"k2b-mobile-shell__main\">\n <Show when={props.scroll !== false} fallback={props.children}>\n <ScrollArea class=\"k2b-mobile-shell__body\">{props.children}</ScrollArea>\n </Show>\n </main>\n {props.footer}\n </div>\n {/* No pinch zoom on the whole page, portalled dialogs and menus included, also before hydration. iOS ignores\n `user-scalable=no`; it honours touch-action. It lives here, not behind `html:has(.k2b-mobile-shell) *`, which\n would restyle the document on every `:has()` change. Zero specificity, so a component's own touch-action,\n such as a drag handle's `none`, still wins. */}\n <style innerHTML=\":where(html *) { touch-action: pan-x pan-y; }\" />\n </>\n );\n}\n\nfunction MobileShellHeader(props: MobileShellHeaderProps): JSX.Element {\n return (\n <header class=\"k2b-mobile-shell__header\">\n <Show when={props.back}>\n {(back) => (\n <Show\n when={back().href}\n fallback={\n <IconButton\n class=\"k2b-mobile-shell__back\"\n data-with-sidebar={back().withSidebar === false ? \"false\" : undefined}\n label={back().label}\n tooltip={false}\n onClick={() => back().onClick?.()}\n >\n <i class=\"ti ti-chevron-left\" aria-hidden=\"true\" />\n </IconButton>\n }\n >\n {(href) => (\n <IconButtonLink\n class=\"k2b-mobile-shell__back\"\n data-with-sidebar={back().withSidebar === false ? \"false\" : undefined}\n href={href()}\n label={back().label}\n tooltip={false}\n onClick={() => back().onClick?.()}\n >\n <i class=\"ti ti-chevron-left\" aria-hidden=\"true\" />\n </IconButtonLink>\n )}\n </Show>\n )}\n </Show>\n <h1 class=\"k2b-mobile-shell__title\">\n <Show when={props.sidebarTitle !== undefined && props.sidebarTitle !== props.title} fallback={props.title}>\n <span class=\"k2b-mobile-shell__title-narrow\">{props.title}</span>\n <span class=\"k2b-mobile-shell__title-wide\">{props.sidebarTitle}</span>\n </Show>\n </h1>\n <Show when={props.actions}>\n <div class=\"k2b-mobile-shell__actions\">{props.actions}</div>\n </Show>\n </header>\n );\n}\n\nexport type MobileShellSidebarItem = TabBarItem & {\n /**\n * A quiet count after the label, such as open tasks: a number (0 shows nothing) or an element that renders one. The\n * item's `badge`, which calls for attention, takes its place.\n */\n count?: number | JSX.Element;\n};\n\nexport type MobileShellSidebarProps = {\n /** Accessible name of the navigation landmark; usually the tab bar's. */\n label: string;\n /** The app's name in the sidebar's head. */\n title: string;\n /** Address of the app's logo before the name; decorative, the name says it. */\n logo?: string;\n /** Destinations at the top, such as Start. */\n items: readonly MobileShellSidebarItem[];\n /** Named groups below them, such as the apps; a group without items is left out. */\n sections?: readonly { title: string; items: readonly MobileShellSidebarItem[] }[];\n /** Destinations at the bottom edge, such as Settings. */\n footer?: readonly MobileShellSidebarItem[];\n};\n\nfunction SidebarLink(props: { item: MobileShellSidebarItem }): JSX.Element {\n return (\n <a\n href={props.item.href}\n aria-current={props.item.current ? \"page\" : undefined}\n data-tab={props.item.id}\n data-k2b-title={props.item.title ?? props.item.label}\n >\n <i class={props.item.icon} aria-hidden=\"true\" />\n <span class=\"k2b-truncate-fade\">{props.item.label}</span>\n <Show when={props.item.badge ?? props.item.count}>{(mark) => <span class=\"k2b-mobile-shell__sidebar-count\">{mark()}</span>}</Show>\n </a>\n );\n}\n\n/**\n * The navigation of a touch app on a wide screen, in `MobileShell`'s `sidebar`: the app's name, then its destinations\n * as 44 px rows with icon and label, the open one in the action colour. A press shows the item's page frame at once,\n * as on a tab, and the row of a loading page pulses.\n */\nfunction MobileShellSidebar(props: MobileShellSidebarProps): JSX.Element {\n const list = (items: readonly MobileShellSidebarItem[]) => (\n <ul>\n <For each={items}>\n {(item) => (\n <li>\n <SidebarLink item={item} />\n </li>\n )}\n </For>\n </ul>\n );\n return (\n <nav class=\"k2b-mobile-shell__sidebar\" aria-label={props.label}>\n <div class=\"k2b-mobile-shell__sidebar-head\">\n <Show when={props.logo}>{(logo) => <img src={logo()} alt=\"\" width=\"32\" height=\"32\" />}</Show>\n <span class=\"k2b-truncate-fade\">{props.title}</span>\n </div>\n <div class=\"k2b-mobile-shell__sidebar-body\">\n {list(props.items)}\n <For each={(props.sections ?? []).filter((section) => section.items.length > 0)}>\n {(section) => (\n <section>\n <h2>{section.title}</h2>\n {list(section.items)}\n </section>\n )}\n </For>\n </div>\n <Show when={props.footer?.length}>\n <div class=\"k2b-mobile-shell__sidebar-foot\">{list(props.footer ?? [])}</div>\n </Show>\n </nav>\n );\n}\n\n/**\n * The full-screen frame of a phone app: a header, one scroll area, and an optional footer such as a `TabBar`. With a\n * `sidebar`, a window of 48rem and wider shows the sidebar at the start edge instead of the footer, and the toast rail\n * stays in the area beside it. While it is mounted, the document itself never scrolls, pinch zoom and rubber-banding\n * are off, and the toast rail sits above the footer. Mount one per page, as the page's layout.\n */\nexport const MobileShell = Object.assign(MobileShellRoot, { Header: MobileShellHeader, Sidebar: MobileShellSidebar });\n\nexport default MobileShell;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,GAAG,EAAY,SAAS,EAAE,OAAO,EAAE,IAAI,QAAQ,UAAU;AAClE,SAAS,UAAU,EAAE,cAAc,QAAQ,mBAAmB;AAC9D,OAAO,UAAU,MAAM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,CAAC,CAAC;QAAA;MAAA;IAAkC;IAAA,uBACpD,KAAK,CAAC,KAAK;IAAA,uBAG3C,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IAAA,mCACjB,GAAG;MAAA,IAAC,IAAI;QAAA,OAAE,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,EAAE,MAAM,CAAE,OAAO,IAAK,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;MAAA;MAAA,UAC3E,OAAO;QAAA;UAAA;UAAA;UAAA;QAAA,uBAEA,OAAO,CAAC,KAAK;QAAA,uBACjB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QAAA;MAAA;IAEvB;IAAA,mCAGJ,IAAI;MAAA,IAAC,IAAI;QAAA,OAAE,KAAK,CAAC,MAAM,EAAE,MAAM;MAAA;MAAA;QAAA;QAAA,uBACe,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC;QAAA;MAAA;IAAA;IAAA,oDAjBtB,KAAK,CAAC,KAAK;IAAA;EAAA;AAqBlE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;EAAE,MAAM,EAAE,iBAAiB;EAAE,OAAO,EAAE;AAAmB,CAAC,CAAC;AAErH,eAAe,WAAW","ignoreList":[]}
@@ -73,27 +73,42 @@ export const setPageTrail = trail => {
73
73
  window.dispatchEvent(new Event(PAGE_TRAIL_EVENT));
74
74
  };
75
75
  const PageTrailContext = createContext();
76
+ const OwnTitleContext = createContext();
77
+ /** The element around a page whose `data-k2b-own-title` says that the page shows its own `PageTitle`. */
78
+ const OWN_TITLE_HOST = "data-k2b-title-host";
79
+ const syncOwnTitle = host => host.toggleAttribute("data-k2b-own-title", host.querySelector(".k2b-page-title:not([data-fallback])") !== null);
76
80
 
77
81
  /**
78
82
  * Gives a host's page trail to everything below it. During server rendering
79
83
  * the context carries it; the provider also publishes it into the document,
80
84
  * where browser-rendered parts such as islands read it. Below a provider that
81
85
  * renders in the browser, its `trail` prop is the source: update the prop.
86
+ *
87
+ * `onOwnTitle` runs on the server for each `PageTitle` below that is not a
88
+ * fallback. The host then sets `data-k2b-own-title` on an element around the
89
+ * page, inside the `k2b-ui` root, so the chrome's fallback titles step back.
90
+ * With `data-k2b-title-host` on that element, titles that mount or leave in
91
+ * the browser keep the attribute current.
82
92
  */
83
93
  export function PageTrailProvider(props) {
84
94
  return _$createComponent(PageTrailContext.Provider, {
85
95
  value: () => props.trail,
86
96
  get children() {
87
- return [_$createComponent(Show, {
88
- get when() {
89
- return props.trail;
90
- },
91
- children: trail => (() => {
92
- var _el$ = _$getNextElement(_tmpl$);
93
- _$effect(() => _$setProperty(_el$, "innerHTML", serializeTrail(trail())));
94
- return _el$;
95
- })()
96
- }), _$memo(() => props.children)];
97
+ return _$createComponent(OwnTitleContext.Provider, {
98
+ value: () => props.onOwnTitle?.(),
99
+ get children() {
100
+ return [_$createComponent(Show, {
101
+ get when() {
102
+ return props.trail;
103
+ },
104
+ children: trail => (() => {
105
+ var _el$ = _$getNextElement(_tmpl$);
106
+ _$effect(() => _$setProperty(_el$, "innerHTML", serializeTrail(trail())));
107
+ return _el$;
108
+ })()
109
+ }), _$memo(() => props.children)];
110
+ }
111
+ });
97
112
  }
98
113
  });
99
114
  }
@@ -121,6 +136,7 @@ export function PageTitle(props) {
121
136
  const messages = useWorkspaceMessages();
122
137
  // A title rendered on the server from the host's trail follows the host's later trails (see `followPageTrail`).
123
138
  const host = isServer ? useContext(PageTrailContext) : undefined;
139
+ if (isServer && !props.fallback) useContext(OwnTitleContext)?.();
124
140
  const menuId = `k2b-page-title-menu-${createUniqueId()}`;
125
141
  const ancestors = () => props.trail.ancestors;
126
142
  const parent = () => ancestors().at(-1);
@@ -128,6 +144,13 @@ export function PageTitle(props) {
128
144
  // A host may control every title in the document at once; a title outside
129
145
  // one still collapses its path.
130
146
  onMount(() => {
147
+ // A title that the page shows after loading, such as one a client-side step brings, marks its host as well.
148
+ // Without a host that marks its page, the `k2b-ui` root stands for it.
149
+ const titleHost = props.fallback ? null : root?.closest(`[${OWN_TITLE_HOST}]`) ?? root?.closest(".k2b-ui");
150
+ if (titleHost) {
151
+ syncOwnTitle(titleHost);
152
+ onCleanup(() => queueMicrotask(() => syncOwnTitle(titleHost)));
153
+ }
131
154
  if (!root || root.closest(`[${PAGE_TITLE_CONTROLLER_ATTRIBUTE}]`)) return;
132
155
  onCleanup(installPageTitleController(root));
133
156
  });