@k2b/ui 0.32.0 → 0.33.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.
- package/dist/browser/actions/Dropdown.js +159 -99
- package/dist/browser/actions/Dropdown.js.map +1 -1
- package/dist/browser/actions/FilterChip.js +113 -56
- package/dist/browser/actions/FilterChip.js.map +1 -1
- package/dist/browser/actions/filter-messages.js +26 -2
- package/dist/browser/actions/filter-messages.js.map +1 -1
- package/dist/browser/actions/menu-rows.js +23 -3
- package/dist/browser/actions/menu-rows.js.map +1 -1
- package/dist/browser/actions/menu-sheet.js +2 -7
- package/dist/browser/actions/menu-sheet.js.map +1 -1
- package/dist/browser/chat/ChatComposer.js +480 -403
- package/dist/browser/chat/ChatComposer.js.map +1 -1
- package/dist/browser/chat/chat-messages.js +14 -0
- package/dist/browser/chat/chat-messages.js.map +1 -1
- package/dist/browser/chat/index.js.map +1 -1
- package/dist/browser/content/Calendar.js +39 -29
- package/dist/browser/content/Calendar.js.map +1 -1
- package/dist/browser/content/CalendarDayView.js +159 -165
- package/dist/browser/content/CalendarDayView.js.map +1 -1
- package/dist/browser/content/MessageRow.js +607 -343
- package/dist/browser/content/MessageRow.js.map +1 -1
- package/dist/browser/content/ReactionBar.js +17 -0
- package/dist/browser/content/ReactionBar.js.map +1 -1
- package/dist/browser/content/index.js +1 -1
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/feedback/dialog-core.js +6 -0
- package/dist/browser/feedback/dialog-core.js.map +1 -1
- package/dist/browser/inputs/TextInput.js +4 -1
- package/dist/browser/inputs/TextInput.js.map +1 -1
- package/dist/browser/intl/shortcut-messages.js +4 -0
- package/dist/browser/intl/shortcut-messages.js.map +1 -1
- package/dist/browser/intl/shortcut.js +4 -0
- package/dist/browser/intl/shortcut.js.map +1 -1
- package/dist/browser/layout/AppWorkspace.js +529 -512
- package/dist/browser/layout/AppWorkspace.js.map +1 -1
- package/dist/browser/layout/MobileShell.js +213 -38
- package/dist/browser/layout/MobileShell.js.map +1 -1
- package/dist/browser/layout/index.js +1 -0
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/browser/layout/scroll-fade.js +32 -5
- package/dist/browser/layout/scroll-fade.js.map +1 -1
- package/dist/browser/surfaces/NoticeCard.js +46 -30
- package/dist/browser/surfaces/NoticeCard.js.map +1 -1
- package/dist/browser/surfaces/resource-messages.js +2 -2
- package/dist/browser/surfaces/resource-messages.js.map +1 -1
- package/dist/ssr/actions/Dropdown.js +51 -27
- package/dist/ssr/actions/Dropdown.js.map +1 -1
- package/dist/ssr/actions/FilterChip.js +67 -16
- package/dist/ssr/actions/FilterChip.js.map +1 -1
- package/dist/ssr/actions/filter-messages.js +26 -2
- package/dist/ssr/actions/filter-messages.js.map +1 -1
- package/dist/ssr/actions/menu-rows.js +23 -3
- package/dist/ssr/actions/menu-rows.js.map +1 -1
- package/dist/ssr/actions/menu-sheet.js +2 -7
- package/dist/ssr/actions/menu-sheet.js.map +1 -1
- package/dist/ssr/chat/ChatComposer.js +96 -67
- package/dist/ssr/chat/ChatComposer.js.map +1 -1
- package/dist/ssr/chat/chat-messages.js +14 -0
- package/dist/ssr/chat/chat-messages.js.map +1 -1
- package/dist/ssr/chat/index.js.map +1 -1
- package/dist/ssr/content/Calendar.js +40 -31
- package/dist/ssr/content/Calendar.js.map +1 -1
- package/dist/ssr/content/CalendarDayView.js +40 -48
- package/dist/ssr/content/CalendarDayView.js.map +1 -1
- package/dist/ssr/content/MessageRow.js +264 -91
- package/dist/ssr/content/MessageRow.js.map +1 -1
- package/dist/ssr/content/ReactionBar.js +17 -0
- package/dist/ssr/content/ReactionBar.js.map +1 -1
- package/dist/ssr/content/index.js +1 -1
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/feedback/dialog-core.js +6 -0
- package/dist/ssr/feedback/dialog-core.js.map +1 -1
- package/dist/ssr/inputs/TextInput.js +4 -1
- package/dist/ssr/inputs/TextInput.js.map +1 -1
- package/dist/ssr/intl/shortcut-messages.js +4 -0
- package/dist/ssr/intl/shortcut-messages.js.map +1 -1
- package/dist/ssr/intl/shortcut.js +4 -0
- package/dist/ssr/intl/shortcut.js.map +1 -1
- package/dist/ssr/layout/AppWorkspace.js +134 -122
- package/dist/ssr/layout/AppWorkspace.js.map +1 -1
- package/dist/ssr/layout/MobileShell.js +100 -20
- package/dist/ssr/layout/MobileShell.js.map +1 -1
- package/dist/ssr/layout/index.js +1 -0
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/ssr/layout/scroll-fade.js +32 -5
- package/dist/ssr/layout/scroll-fade.js.map +1 -1
- package/dist/ssr/surfaces/NoticeCard.js +21 -12
- package/dist/ssr/surfaces/NoticeCard.js.map +1 -1
- package/dist/ssr/surfaces/resource-messages.js +2 -2
- package/dist/ssr/surfaces/resource-messages.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/Dropdown.d.ts +14 -0
- package/dist/types/actions/FilterChip.d.ts +11 -0
- package/dist/types/actions/filter-messages.d.ts +12 -0
- package/dist/types/actions/menu-rows.d.ts +7 -2
- package/dist/types/chat/ChatComposer.d.ts +13 -0
- package/dist/types/chat/chat-messages.d.ts +7 -0
- package/dist/types/chat/index.d.ts +1 -1
- package/dist/types/content/Calendar.d.ts +7 -0
- package/dist/types/content/MessageRow.d.ts +64 -2
- package/dist/types/content/index.d.ts +2 -2
- package/dist/types/feedback/dialog-core.d.ts +3 -0
- package/dist/types/intl/shortcut-messages.d.ts +2 -0
- package/dist/types/layout/AppWorkspace.d.ts +2 -0
- package/dist/types/layout/MobileShell.d.ts +52 -5
- package/dist/types/layout/index.d.ts +2 -1
- package/dist/types/layout/scroll-fade.d.ts +5 -0
- package/dist/types/surfaces/NoticeCard.d.ts +3 -0
- package/package.json +2 -2
|
@@ -1,12 +1,23 @@
|
|
|
1
|
+
import { memo as _$memo } from "solid-js/web";
|
|
1
2
|
import { ssr as _$ssr } from "solid-js/web";
|
|
2
3
|
import { createComponent as _$createComponent } from "solid-js/web";
|
|
3
4
|
import { ssrAttribute as _$ssrAttribute } from "solid-js/web";
|
|
4
5
|
import { escape as _$escape } from "solid-js/web";
|
|
5
|
-
var _tmpl$ = ["<div", ">", "<main class=\"k2b-mobile-shell__main\">", "</main>", "</div>"],
|
|
6
|
-
_tmpl$2 = ["<
|
|
7
|
-
_tmpl$3 = ["<
|
|
8
|
-
_tmpl$4 = "<
|
|
9
|
-
|
|
6
|
+
var _tmpl$ = ["<div", ">", "", "<main class=\"k2b-mobile-shell__main\">", "</main>", "</div>"],
|
|
7
|
+
_tmpl$2 = ["<span class=\"k2b-mobile-shell__title-narrow\">", "</span>"],
|
|
8
|
+
_tmpl$3 = ["<span class=\"k2b-mobile-shell__title-wide\">", "</span>"],
|
|
9
|
+
_tmpl$4 = ["<div class=\"k2b-mobile-shell__actions\">", "</div>"],
|
|
10
|
+
_tmpl$5 = ["<header class=\"k2b-mobile-shell__header\">", "<h1 class=\"k2b-mobile-shell__title\">", "</h1>", "</header>"],
|
|
11
|
+
_tmpl$6 = "<i class=\"ti ti-chevron-left\" aria-hidden=\"true\"></i>",
|
|
12
|
+
_tmpl$7 = ["<a", "><i", " aria-hidden=\"true\"></i><span class=\"k2b-truncate-fade\">", "</span>", "</a>"],
|
|
13
|
+
_tmpl$8 = ["<span class=\"k2b-mobile-shell__sidebar-count\">", "</span>"],
|
|
14
|
+
_tmpl$9 = ["<ul>", "</ul>"],
|
|
15
|
+
_tmpl$0 = ["<li>", "</li>"],
|
|
16
|
+
_tmpl$1 = ["<div class=\"k2b-mobile-shell__sidebar-foot\">", "</div>"],
|
|
17
|
+
_tmpl$10 = ["<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>", "</nav>"],
|
|
18
|
+
_tmpl$11 = ["<img", " alt width=\"32\" height=\"32\">"],
|
|
19
|
+
_tmpl$12 = ["<section><h2>", "</h2>", "</section>"];
|
|
20
|
+
import { For, onCleanup, onMount, Show } from "solid-js";
|
|
10
21
|
import { IconButton, IconButtonLink } from "../actions/Button";
|
|
11
22
|
import ScrollArea from "./ScrollArea";
|
|
12
23
|
import { installScrollFades } from "./scroll-fade";
|
|
@@ -147,15 +158,16 @@ const observeLinkTaps = root => {
|
|
|
147
158
|
export function observeMobileShell(root) {
|
|
148
159
|
const main = root.querySelector(":scope > .k2b-mobile-shell__main");
|
|
149
160
|
const body = main?.querySelector(":scope > .k2b-mobile-shell__body");
|
|
150
|
-
if (!main
|
|
161
|
+
if (!main) return () => {};
|
|
151
162
|
const stopLinkTaps = observeLinkTaps(root);
|
|
152
|
-
|
|
163
|
+
// Content with its own scroll areas keeps its own fades; the room a toast takes applies to the whole main area.
|
|
164
|
+
const stopScrollFades = body ? installScrollFades(body) : () => {};
|
|
153
165
|
let frame = 0;
|
|
154
166
|
const measure = () => {
|
|
155
167
|
frame = 0;
|
|
156
168
|
const footer = Math.max(0, root.getBoundingClientRect().bottom - main.getBoundingClientRect().bottom);
|
|
157
169
|
document.body.style.setProperty(FOOTER_HEIGHT, `${footer}px`);
|
|
158
|
-
root.style.setProperty(TOAST_INSET, `${persistentToastInset(body)}px`);
|
|
170
|
+
root.style.setProperty(TOAST_INSET, `${persistentToastInset(body ?? main)}px`);
|
|
159
171
|
};
|
|
160
172
|
const schedule = () => {
|
|
161
173
|
if (!frame) frame = requestAnimationFrame(measure);
|
|
@@ -187,15 +199,25 @@ export function observeMobileShell(root) {
|
|
|
187
199
|
function MobileShellRoot(props) {
|
|
188
200
|
let root;
|
|
189
201
|
onMount(() => onCleanup(observeMobileShell(root)));
|
|
190
|
-
return _$ssr(_tmpl$, _$ssrAttribute("class", props.class ? `k2b-mobile-shell ${_$escape(props.class, true)}` : "k2b-mobile-shell", false), _$escape(props.header), _$escape(_$createComponent(
|
|
191
|
-
|
|
192
|
-
|
|
202
|
+
return _$ssr(_tmpl$, _$ssrAttribute("class", props.class ? `k2b-mobile-shell ${_$escape(props.class, true)}` : "k2b-mobile-shell", false) + _$ssrAttribute("data-k2b-content-heads", props.scroll === false ? "" : _$escape(undefined, true), false), _$escape(props.sidebar), _$escape(props.header), _$escape(_$createComponent(Show, {
|
|
203
|
+
get when() {
|
|
204
|
+
return props.scroll !== false;
|
|
205
|
+
},
|
|
206
|
+
get fallback() {
|
|
193
207
|
return props.children;
|
|
208
|
+
},
|
|
209
|
+
get children() {
|
|
210
|
+
return _$createComponent(ScrollArea, {
|
|
211
|
+
"class": "k2b-mobile-shell__body",
|
|
212
|
+
get children() {
|
|
213
|
+
return props.children;
|
|
214
|
+
}
|
|
215
|
+
});
|
|
194
216
|
}
|
|
195
217
|
})), _$escape(props.footer));
|
|
196
218
|
}
|
|
197
219
|
function MobileShellHeader(props) {
|
|
198
|
-
return _$ssr(_tmpl$
|
|
220
|
+
return _$ssr(_tmpl$5, _$escape(_$createComponent(Show, {
|
|
199
221
|
get when() {
|
|
200
222
|
return props.back;
|
|
201
223
|
},
|
|
@@ -206,18 +228,24 @@ function MobileShellHeader(props) {
|
|
|
206
228
|
get fallback() {
|
|
207
229
|
return _$createComponent(IconButton, {
|
|
208
230
|
"class": "k2b-mobile-shell__back",
|
|
231
|
+
get ["data-with-sidebar"]() {
|
|
232
|
+
return back().withSidebar === false ? "false" : undefined;
|
|
233
|
+
},
|
|
209
234
|
get label() {
|
|
210
235
|
return back().label;
|
|
211
236
|
},
|
|
212
237
|
tooltip: false,
|
|
213
238
|
onClick: () => back().onClick?.(),
|
|
214
239
|
get children() {
|
|
215
|
-
return _$ssr(_tmpl$
|
|
240
|
+
return _$ssr(_tmpl$6);
|
|
216
241
|
}
|
|
217
242
|
});
|
|
218
243
|
},
|
|
219
244
|
children: href => _$createComponent(IconButtonLink, {
|
|
220
245
|
"class": "k2b-mobile-shell__back",
|
|
246
|
+
get ["data-with-sidebar"]() {
|
|
247
|
+
return back().withSidebar === false ? "false" : undefined;
|
|
248
|
+
},
|
|
221
249
|
get href() {
|
|
222
250
|
return href();
|
|
223
251
|
},
|
|
@@ -227,27 +255,79 @@ function MobileShellHeader(props) {
|
|
|
227
255
|
tooltip: false,
|
|
228
256
|
onClick: () => back().onClick?.(),
|
|
229
257
|
get children() {
|
|
230
|
-
return _$ssr(_tmpl$
|
|
258
|
+
return _$ssr(_tmpl$6);
|
|
231
259
|
}
|
|
232
260
|
})
|
|
233
261
|
})
|
|
234
|
-
})), _$escape(
|
|
262
|
+
})), _$escape(_$createComponent(Show, {
|
|
263
|
+
get when() {
|
|
264
|
+
return _$memo(() => props.sidebarTitle !== undefined)() && props.sidebarTitle !== props.title;
|
|
265
|
+
},
|
|
266
|
+
get fallback() {
|
|
267
|
+
return props.title;
|
|
268
|
+
},
|
|
269
|
+
get children() {
|
|
270
|
+
return [_$ssr(_tmpl$2, _$escape(props.title)), _$ssr(_tmpl$3, _$escape(props.sidebarTitle))];
|
|
271
|
+
}
|
|
272
|
+
})), _$escape(_$createComponent(Show, {
|
|
235
273
|
get when() {
|
|
236
274
|
return props.actions;
|
|
237
275
|
},
|
|
238
276
|
get children() {
|
|
239
|
-
return _$ssr(_tmpl$
|
|
277
|
+
return _$ssr(_tmpl$4, _$escape(props.actions));
|
|
278
|
+
}
|
|
279
|
+
})));
|
|
280
|
+
}
|
|
281
|
+
function SidebarLink(props) {
|
|
282
|
+
return _$ssr(_tmpl$7, _$ssrAttribute("href", _$escape(props.item.href, true), false) + _$ssrAttribute("aria-current", props.item.current ? "page" : _$escape(undefined, true), false) + _$ssrAttribute("data-tab", _$escape(props.item.id, true), false) + _$ssrAttribute("data-k2b-title", _$escape(props.item.title ?? props.item.label, true), false), _$ssrAttribute("class", _$escape(props.item.icon, true), false), _$escape(props.item.label), _$escape(_$createComponent(Show, {
|
|
283
|
+
get when() {
|
|
284
|
+
return props.item.count;
|
|
285
|
+
},
|
|
286
|
+
children: count => _$ssr(_tmpl$8, _$escape(count()))
|
|
287
|
+
})));
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* The navigation of a touch app on a wide screen, in `MobileShell`'s `sidebar`: the app's name, then its destinations
|
|
292
|
+
* 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,
|
|
293
|
+
* as on a tab, and the row of a loading page pulses.
|
|
294
|
+
*/
|
|
295
|
+
function MobileShellSidebar(props) {
|
|
296
|
+
const list = items => _$ssr(_tmpl$9, _$escape(_$createComponent(For, {
|
|
297
|
+
each: items,
|
|
298
|
+
children: item => _$ssr(_tmpl$0, _$escape(_$createComponent(SidebarLink, {
|
|
299
|
+
item: item
|
|
300
|
+
})))
|
|
301
|
+
})));
|
|
302
|
+
return _$ssr(_tmpl$10, _$ssrAttribute("aria-label", _$escape(props.label, true), false), _$escape(_$createComponent(Show, {
|
|
303
|
+
get when() {
|
|
304
|
+
return props.logo;
|
|
305
|
+
},
|
|
306
|
+
children: logo => _$ssr(_tmpl$11, _$ssrAttribute("src", _$escape(logo(), true), false))
|
|
307
|
+
})), _$escape(props.title), _$escape(list(props.items)), _$escape(_$createComponent(For, {
|
|
308
|
+
get each() {
|
|
309
|
+
return (props.sections ?? []).filter(section => section.items.length > 0);
|
|
310
|
+
},
|
|
311
|
+
children: section => _$ssr(_tmpl$12, _$escape(section.title), _$escape(list(section.items)))
|
|
312
|
+
})), _$escape(_$createComponent(Show, {
|
|
313
|
+
get when() {
|
|
314
|
+
return props.footer?.length;
|
|
315
|
+
},
|
|
316
|
+
get children() {
|
|
317
|
+
return _$ssr(_tmpl$1, _$escape(list(props.footer ?? [])));
|
|
240
318
|
}
|
|
241
319
|
})));
|
|
242
320
|
}
|
|
243
321
|
|
|
244
322
|
/**
|
|
245
|
-
* The full-screen frame of a phone app: a header, one scroll area, and an optional footer such as a `TabBar`.
|
|
246
|
-
*
|
|
247
|
-
*
|
|
323
|
+
* The full-screen frame of a phone app: a header, one scroll area, and an optional footer such as a `TabBar`. With a
|
|
324
|
+
* `sidebar`, a window of 48rem and wider shows the sidebar at the start edge instead of the footer, and the toast rail
|
|
325
|
+
* stays in the area beside it. While it is mounted, the document itself never scrolls, pinch zoom and rubber-banding
|
|
326
|
+
* are off, and the toast rail sits above the footer. Mount one per page, as the page's layout.
|
|
248
327
|
*/
|
|
249
328
|
export const MobileShell = Object.assign(MobileShellRoot, {
|
|
250
|
-
Header: MobileShellHeader
|
|
329
|
+
Header: MobileShellHeader,
|
|
330
|
+
Sidebar: MobileShellSidebar
|
|
251
331
|
});
|
|
252
332
|
export default MobileShell;
|
|
253
333
|
//# sourceMappingURL=MobileShell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["layout/MobileShell.tsx"],"sourcesContent":["import { type JSX, onCleanup, onMount, Show } from \"solid-js\";\nimport { IconButton, IconButtonLink } from \"../actions/Button\";\nimport ScrollArea from \"./ScrollArea\";\nimport { installScrollFades } from \"./scroll-fade\";\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 /** The page content, inside the shell's only scroll area. */\n children: JSX.Element;\n class?: string;\n};\n\nexport type MobileShellHeaderProps = {\n title: string;\n /** A Back control before the title: a link with `href`, otherwise a button. */\n back?: { href?: string; onClick?: () => void; label: string };\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 || !body) return () => {};\n const stopLinkTaps = observeLinkTaps(root);\n const stopScrollFades = installScrollFades(body);\n let frame = 0;\n const measure = () => {\n frame = 0;\n const footer = Math.max(0, root.getBoundingClientRect().bottom - main.getBoundingClientRect().bottom);\n document.body.style.setProperty(FOOTER_HEIGHT, `${footer}px`);\n root.style.setProperty(TOAST_INSET, `${persistentToastInset(body)}px`);\n };\n const schedule = () => {\n if (!frame) frame = requestAnimationFrame(measure);\n };\n measure();\n // The footer can appear, disappear, or change height; the main area takes whatever it leaves.\n const resize = new ResizeObserver(schedule);\n resize.observe(root);\n resize.observe(main);\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 ref={root} class={props.class ? `k2b-mobile-shell ${props.class}` : \"k2b-mobile-shell\"}>\n {props.header}\n <main class=\"k2b-mobile-shell__main\">\n <ScrollArea class=\"k2b-mobile-shell__body\">{props.children}</ScrollArea>\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 class=\"k2b-mobile-shell__back\" label={back().label} tooltip={false} onClick={() => back().onClick?.()}>\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 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\">{props.title}</h1>\n <Show when={props.actions}>\n <div class=\"k2b-mobile-shell__actions\">{props.actions}</div>\n </Show>\n </header>\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`. While\n * it is mounted, the document itself never scrolls, pinch zoom and rubber-banding are off, and the toast rail sits\n * above the footer. Mount one per page, as the page's layout.\n */\nexport const MobileShell = Object.assign(MobileShellRoot, { Header: MobileShellHeader });\n\nexport default MobileShell;\n"],"mappings":";;;;;;;;AAAA,SAAmB,SAAS,EAAE,OAAO,EAAE,IAAI,QAAQ,UAAU;AAC7D,SAAS,UAAU,EAAE,cAAc,QAAQ,mBAAmB;AAC9D,OAAO,UAAU,MAAM,cAAc;AACrC,SAAS,kBAAkB,QAAQ,eAAe;AAoBlD;AACA,MAAM,aAAa,GAAG,kCAAkC;AACxD;AACA,MAAM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,KAAK;QAAA;QACnB,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC;QAAA;UAAA;QAAA;MAAA;IAIpC;EAEJ,cAEkC,KAAK,CAAC,KAAK,8BAC/C,IAAI;IAAA,IAAC,IAAI;MAAA,OAAE,KAAK,CAAC,OAAO;IAAA;IAAA;MAAA,+BACiB,KAAK,CAAC,OAAO;IAAA;EAAA;AAI7D;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;EAAE,MAAM,EAAE;AAAkB,CAAC,CAAC;AAExF,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/** 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 const measure = () => {\n frame = 0;\n const footer = Math.max(0, root.getBoundingClientRect().bottom - main.getBoundingClientRect().bottom);\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 measure();\n // The footer can appear, disappear, or change height; the main area takes whatever it leaves.\n const resize = new ResizeObserver(schedule);\n resize.observe(root);\n resize.observe(main);\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 /** A count after the label, such as unread messages; 0 shows nothing. */\n count?: number;\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.count}>{(count) => <span class=\"k2b-mobile-shell__sidebar-count\">{count()}</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,G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export { readSettingsError, SettingsField, SettingsGroup, SettingsPage, Settings
|
|
|
25
25
|
export { default as SettingsCollection } from "./SettingsCollection";
|
|
26
26
|
export { default as SettingsModal } from "./SettingsModal";
|
|
27
27
|
export { APP_WORKSPACE_SWITCHER_SEARCH_FROM } from "./SidebarSwitcher";
|
|
28
|
+
export { measureScrollFade } from "./scroll-fade";
|
|
28
29
|
export { default as TabBar } from "./TabBar";
|
|
29
30
|
export { TableOfContents } from "./TableOfContents";
|
|
30
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["layout/index.ts"],"sourcesContent":["export type {\n AppOverviewCardsProps,\n AppOverviewEmptyStateProps,\n AppOverviewPanelProps,\n AppOverviewProps,\n} from \"./AppOverview\";\nexport { default as AppOverview } from \"./AppOverview\";\nexport type {\n AppWorkspaceBottomDrawerHeight,\n AppWorkspaceBottomDrawerProps,\n AppWorkspaceContentProps,\n AppWorkspaceDetailProps,\n AppWorkspaceDetailWidth,\n AppWorkspaceHeadProps,\n AppWorkspaceMainPaneProps,\n AppWorkspaceMainProps,\n AppWorkspaceNavTreeItemProps,\n AppWorkspaceNavTreeMove,\n AppWorkspaceNavTreeProps,\n AppWorkspaceProps,\n AppWorkspaceSidebarAccessoryVisibility,\n AppWorkspaceSidebarBodyProps,\n AppWorkspaceSidebarIconActionProps,\n AppWorkspaceSidebarIconActionTone,\n AppWorkspaceSidebarIconGridProps,\n AppWorkspaceSidebarItemActionProps,\n AppWorkspaceSidebarItemActionsProps,\n AppWorkspaceSidebarItemIconProps,\n AppWorkspaceSidebarItemLabelProps,\n AppWorkspaceSidebarItemMetaProps,\n AppWorkspaceSidebarItemProps,\n AppWorkspaceSidebarItemStatusProps,\n AppWorkspaceSidebarItemTone,\n AppWorkspaceSidebarProps,\n AppWorkspaceSidebarSectionProps,\n AppWorkspaceSidebarVisibility,\n AppWorkspaceWidthShare,\n} from \"./AppWorkspace\";\nexport { appWorkspaceDetailElementId, default as AppWorkspace } from \"./AppWorkspace\";\nexport { watchAppHostWidth } from \"./app-host-width\";\nexport type { AppWorkspaceControllerOptions } from \"./app-workspace-controller\";\nexport { installAppWorkspaceController, parkWorkspaceDetailDrawers } from \"./app-workspace-controller\";\nexport type {\n AppWorkspaceLayoutState,\n AppWorkspaceResizeKind,\n} from \"./app-workspace-state\";\nexport {\n APP_WORKSPACE_DETAIL_DEFAULT,\n APP_WORKSPACE_DETAIL_MAX,\n APP_WORKSPACE_DETAIL_MIN,\n APP_WORKSPACE_DRAWER_DEFAULT,\n APP_WORKSPACE_DRAWER_MAX,\n APP_WORKSPACE_DRAWER_MIN,\n APP_WORKSPACE_MAIN_MIN,\n APP_WORKSPACE_MAIN_MIN_HEIGHT,\n APP_WORKSPACE_PANE_DEFAULT,\n APP_WORKSPACE_PANE_MAX,\n APP_WORKSPACE_PANE_MIN,\n APP_WORKSPACE_SIDEBAR_COLLAPSE_THRESHOLD,\n APP_WORKSPACE_SIDEBAR_COLLAPSED,\n APP_WORKSPACE_SIDEBAR_DEFAULT,\n APP_WORKSPACE_SIDEBAR_MAX,\n APP_WORKSPACE_SIDEBAR_MIN,\n appWorkspaceLayoutStyle,\n appWorkspacePanelVariable,\n appWorkspaceResizeLimits,\n normalizeAppWorkspaceLayoutState,\n parseAppWorkspaceLayoutState,\n resolveAppWorkspaceSidebarWidth,\n safeAppWorkspacePanelId,\n serializeAppWorkspaceLayoutState,\n shouldCollapseAppWorkspaceSidebar,\n} from \"./app-workspace-state\";\nexport { type BottomSheetProps, bottomSheetAdaptiveOptions, bottomSheetOptions, default as BottomSheet } from \"./BottomSheet\";\nexport type { DataPanelProps } from \"./DataPanel\";\nexport { DataPanel } from \"./DataPanel\";\nexport type {\n DetailPanelActionButtonProps,\n DetailPanelActionLinkProps,\n DetailPanelActionProps,\n DetailPanelActionSecondary,\n DetailPanelBodyProps,\n DetailPanelGroupProps,\n DetailPanelHeaderProps,\n DetailPanelProps,\n DetailPanelSectionProps,\n DetailPanelSummaryProps,\n DetailPanelTone,\n} from \"./DetailPanel\";\nexport { default as DetailPanel } from \"./DetailPanel\";\nexport type { DiscussionComposerProps, DiscussionItemProps, DiscussionListProps, DiscussionProps } from \"./Discussion\";\nexport { default as Discussion } from \"./Discussion\";\nexport type {\n FloatingWindowClose,\n FloatingWindowProps,\n OpenFloatingWindowOptions,\n} from \"./FloatingWindow\";\nexport {\n default as FloatingWindow,\n type FloatingWindowRect,\n fitFloatingWindowRect,\n openFloatingWindow,\n} from \"./FloatingWindow\";\nexport type { MobileShellHeaderProps, MobileShellProps } from \"./MobileShell\";\nexport { default as MobileShell, observeMobileShell } from \"./MobileShell\";\nexport { default as Navigation, type NavigationProps } from \"./Navigation\";\nexport {\n createNavigation,\n findNavigationItem,\n type NavigationController,\n type NavigationItem,\n type NavigationOptions,\n type NavigationStatus,\n} from \"./navigation-model\";\nexport type { PageTitleProps, PageTrailLink, PageTrailState } from \"./PageTitle\";\nexport { followPageTrail, PAGE_TRAIL_EVENT, PageTitle, PageTrailProvider, readPageTrail, setPageTrail, usePageTrail } from \"./PageTitle\";\nexport type {\n PanelDialogBodyProps,\n PanelDialogFooterProps,\n PanelDialogHeaderProps,\n PanelDialogProps,\n PanelDialogSectionProps,\n PanelDialogSurface,\n PanelDialogTabOption,\n PanelDialogTabsProps,\n} from \"./PanelDialog\";\nexport {\n confirmDiscardIfDirty,\n default as PanelDialog,\n panelDialogFixedOptions,\n panelDialogFixedPanelClass,\n panelDialogOptions,\n panelDialogPanelClass,\n panelDialogWideOptions,\n panelDialogWidePanelClass,\n panelDialogWorkspaceOptions,\n panelDialogWorkspacePanelClass,\n} from \"./PanelDialog\";\nexport type { PanelHeaderProps } from \"./PanelHeader\";\nexport { PanelHeader } from \"./PanelHeader\";\nexport type { PanesItem, PanesProps } from \"./Panes\";\nexport { default as Panes } from \"./Panes\";\nexport type { PullToRefreshProps, PullToRefreshState } from \"./PullToRefresh\";\nexport { default as PullToRefresh } from \"./PullToRefresh\";\nexport { installPageTitleController } from \"./page-title-controller\";\nexport type {\n AddPanesItemOptions,\n PanesDirection,\n PanesGroup,\n PanesIntent,\n PanesLayout,\n PanesNode,\n PanesPath,\n PanesPathSegment,\n PanesSide,\n PanesSplit,\n} from \"./panes-layout\";\nexport {\n activatePanesItem,\n addPanesItem,\n applyPanesIntent,\n createPanesLayout,\n isPanesItemVisible,\n PANES_LAYOUT_VERSION,\n parsePanesLayout,\n reconcilePanesLayout,\n removePanesItem,\n resizePanesSplit,\n} from \"./panes-layout\";\nexport { default as ResizeSeparator, type ResizeSeparatorProps } from \"./ResizeSeparator\";\nexport { attachResizeSeparator, type ResizeSeparatorOptions } from \"./resize-separator\";\nexport type { ScrollAreaProps } from \"./ScrollArea\";\nexport { default as ScrollArea } from \"./ScrollArea\";\nexport type {\n SettingsFieldControlProps,\n SettingsFieldProps,\n SettingsGroupActionProps,\n SettingsGroupProps,\n SettingsPageProps,\n SettingsPanelFooterProps,\n SettingsSaveBarProps,\n SettingsSectionProps,\n} from \"./Settings\";\nexport {\n readSettingsError,\n SettingsField,\n SettingsGroup,\n SettingsPage,\n SettingsPanelFooter,\n SettingsSaveBar,\n SettingsSection,\n sameSettingValue,\n} from \"./Settings\";\nexport type {\n SettingsCollectionActionProps,\n SettingsCollectionItemActionsProps,\n SettingsCollectionItemProps,\n SettingsCollectionItemReorderProps,\n SettingsCollectionItemStatusProps,\n SettingsCollectionProps,\n} from \"./SettingsCollection\";\nexport { default as SettingsCollection } from \"./SettingsCollection\";\nexport type {\n SettingsModalFooterProps,\n SettingsModalGroupProps,\n SettingsModalProps,\n SettingsModalTabProps,\n SettingsModalTabTone,\n} from \"./SettingsModal\";\nexport { default as SettingsModal } from \"./SettingsModal\";\nexport {\n APP_WORKSPACE_SWITCHER_SEARCH_FROM,\n type AppWorkspaceSidebarSwitcherProps,\n type AppWorkspaceSwitcherAction,\n type AppWorkspaceSwitcherOption,\n} from \"./SidebarSwitcher\";\nexport type { TabBarItem, TabBarProps } from \"./TabBar\";\nexport { default as TabBar } from \"./TabBar\";\nexport type { TableOfContentsItem, TableOfContentsProps } from \"./TableOfContents\";\nexport { TableOfContents } from \"./TableOfContents\";\n"],"mappings":"AAMA,SAAS,OAAO,IAAI,WAAW,QAAQ,eAAe;AAgCtD,SAAS,2BAA2B,EAAE,OAAO,IAAI,YAAY,QAAQ,gBAAgB;AACrF,SAAS,iBAAiB,QAAQ,kBAAkB;AAEpD,SAAS,6BAA6B,EAAE,0BAA0B,QAAQ,4BAA4B;AAKtG,SACE,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,6BAA6B,EAC7B,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,wCAAwC,EACxC,+BAA+B,EAC/B,6BAA6B,EAC7B,yBAAyB,EACzB,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,EACxB,gCAAgC,EAChC,4BAA4B,EAC5B,+BAA+B,EAC/B,uBAAuB,EACvB,gCAAgC,EAChC,iCAAiC,QAC5B,uBAAuB;AAC9B,SAAgC,0BAA0B,EAAE,kBAAkB,EAAE,OAAO,IAAI,WAAW,QAAQ,eAAe;AAE7H,SAAS,SAAS,QAAQ,aAAa;AAcvC,SAAS,OAAO,IAAI,WAAW,QAAQ,eAAe;AAEtD,SAAS,OAAO,IAAI,UAAU,QAAQ,cAAc;AAMpD,SACE,OAAO,IAAI,cAAc,EAEzB,qBAAqB,EACrB,kBAAkB,QACb,kBAAkB;AAEzB,SAAS,OAAO,IAAI,WAAW,EAAE,kBAAkB,QAAQ,eAAe;AAC1E,SAAS,OAAO,IAAI,UAAU,QAA8B,cAAc;AAC1E,SACE,gBAAgB,EAChB,kBAAkB,QAKb,oBAAoB;AAE3B,SAAS,eAAe,EAAE,gBAAgB,EAAE,SAAS,EAAE,iBAAiB,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,QAAQ,aAAa;AAWxI,SACE,qBAAqB,EACrB,OAAO,IAAI,WAAW,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,EAC3B,8BAA8B,QACzB,eAAe;AAEtB,SAAS,WAAW,QAAQ,eAAe;AAE3C,SAAS,OAAO,IAAI,KAAK,QAAQ,SAAS;AAE1C,SAAS,OAAO,IAAI,aAAa,QAAQ,iBAAiB;AAC1D,SAAS,0BAA0B,QAAQ,yBAAyB;AAapE,SACE,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,QACX,gBAAgB;AACvB,SAAS,OAAO,IAAI,eAAe,QAAmC,mBAAmB;AACzF,SAAS,qBAAqB,QAAqC,oBAAoB;AAEvF,SAAS,OAAO,IAAI,UAAU,QAAQ,cAAc;AAWpD,SACE,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,gBAAgB,QACX,YAAY;AASnB,SAAS,OAAO,IAAI,kBAAkB,QAAQ,sBAAsB;AAQpE,SAAS,OAAO,IAAI,aAAa,QAAQ,iBAAiB;AAC1D,SACE,kCAAkC,QAI7B,mBAAmB;
|
|
1
|
+
{"version":3,"names":[],"sources":["layout/index.ts"],"sourcesContent":["export type {\n AppOverviewCardsProps,\n AppOverviewEmptyStateProps,\n AppOverviewPanelProps,\n AppOverviewProps,\n} from \"./AppOverview\";\nexport { default as AppOverview } from \"./AppOverview\";\nexport type {\n AppWorkspaceBottomDrawerHeight,\n AppWorkspaceBottomDrawerProps,\n AppWorkspaceContentProps,\n AppWorkspaceDetailProps,\n AppWorkspaceDetailWidth,\n AppWorkspaceHeadProps,\n AppWorkspaceMainPaneProps,\n AppWorkspaceMainProps,\n AppWorkspaceNavTreeItemProps,\n AppWorkspaceNavTreeMove,\n AppWorkspaceNavTreeProps,\n AppWorkspaceProps,\n AppWorkspaceSidebarAccessoryVisibility,\n AppWorkspaceSidebarBodyProps,\n AppWorkspaceSidebarIconActionProps,\n AppWorkspaceSidebarIconActionTone,\n AppWorkspaceSidebarIconGridProps,\n AppWorkspaceSidebarItemActionProps,\n AppWorkspaceSidebarItemActionsProps,\n AppWorkspaceSidebarItemIconProps,\n AppWorkspaceSidebarItemLabelProps,\n AppWorkspaceSidebarItemMetaProps,\n AppWorkspaceSidebarItemProps,\n AppWorkspaceSidebarItemStatusProps,\n AppWorkspaceSidebarItemTone,\n AppWorkspaceSidebarProps,\n AppWorkspaceSidebarSectionProps,\n AppWorkspaceSidebarVisibility,\n AppWorkspaceWidthShare,\n} from \"./AppWorkspace\";\nexport { appWorkspaceDetailElementId, default as AppWorkspace } from \"./AppWorkspace\";\nexport { watchAppHostWidth } from \"./app-host-width\";\nexport type { AppWorkspaceControllerOptions } from \"./app-workspace-controller\";\nexport { installAppWorkspaceController, parkWorkspaceDetailDrawers } from \"./app-workspace-controller\";\nexport type {\n AppWorkspaceLayoutState,\n AppWorkspaceResizeKind,\n} from \"./app-workspace-state\";\nexport {\n APP_WORKSPACE_DETAIL_DEFAULT,\n APP_WORKSPACE_DETAIL_MAX,\n APP_WORKSPACE_DETAIL_MIN,\n APP_WORKSPACE_DRAWER_DEFAULT,\n APP_WORKSPACE_DRAWER_MAX,\n APP_WORKSPACE_DRAWER_MIN,\n APP_WORKSPACE_MAIN_MIN,\n APP_WORKSPACE_MAIN_MIN_HEIGHT,\n APP_WORKSPACE_PANE_DEFAULT,\n APP_WORKSPACE_PANE_MAX,\n APP_WORKSPACE_PANE_MIN,\n APP_WORKSPACE_SIDEBAR_COLLAPSE_THRESHOLD,\n APP_WORKSPACE_SIDEBAR_COLLAPSED,\n APP_WORKSPACE_SIDEBAR_DEFAULT,\n APP_WORKSPACE_SIDEBAR_MAX,\n APP_WORKSPACE_SIDEBAR_MIN,\n appWorkspaceLayoutStyle,\n appWorkspacePanelVariable,\n appWorkspaceResizeLimits,\n normalizeAppWorkspaceLayoutState,\n parseAppWorkspaceLayoutState,\n resolveAppWorkspaceSidebarWidth,\n safeAppWorkspacePanelId,\n serializeAppWorkspaceLayoutState,\n shouldCollapseAppWorkspaceSidebar,\n} from \"./app-workspace-state\";\nexport { type BottomSheetProps, bottomSheetAdaptiveOptions, bottomSheetOptions, default as BottomSheet } from \"./BottomSheet\";\nexport type { DataPanelProps } from \"./DataPanel\";\nexport { DataPanel } from \"./DataPanel\";\nexport type {\n DetailPanelActionButtonProps,\n DetailPanelActionLinkProps,\n DetailPanelActionProps,\n DetailPanelActionSecondary,\n DetailPanelBodyProps,\n DetailPanelGroupProps,\n DetailPanelHeaderProps,\n DetailPanelProps,\n DetailPanelSectionProps,\n DetailPanelSummaryProps,\n DetailPanelTone,\n} from \"./DetailPanel\";\nexport { default as DetailPanel } from \"./DetailPanel\";\nexport type { DiscussionComposerProps, DiscussionItemProps, DiscussionListProps, DiscussionProps } from \"./Discussion\";\nexport { default as Discussion } from \"./Discussion\";\nexport type {\n FloatingWindowClose,\n FloatingWindowProps,\n OpenFloatingWindowOptions,\n} from \"./FloatingWindow\";\nexport {\n default as FloatingWindow,\n type FloatingWindowRect,\n fitFloatingWindowRect,\n openFloatingWindow,\n} from \"./FloatingWindow\";\nexport type { MobileShellHeaderProps, MobileShellProps, MobileShellSidebarItem, MobileShellSidebarProps } from \"./MobileShell\";\nexport { default as MobileShell, observeMobileShell } from \"./MobileShell\";\nexport { default as Navigation, type NavigationProps } from \"./Navigation\";\nexport {\n createNavigation,\n findNavigationItem,\n type NavigationController,\n type NavigationItem,\n type NavigationOptions,\n type NavigationStatus,\n} from \"./navigation-model\";\nexport type { PageTitleProps, PageTrailLink, PageTrailState } from \"./PageTitle\";\nexport { followPageTrail, PAGE_TRAIL_EVENT, PageTitle, PageTrailProvider, readPageTrail, setPageTrail, usePageTrail } from \"./PageTitle\";\nexport type {\n PanelDialogBodyProps,\n PanelDialogFooterProps,\n PanelDialogHeaderProps,\n PanelDialogProps,\n PanelDialogSectionProps,\n PanelDialogSurface,\n PanelDialogTabOption,\n PanelDialogTabsProps,\n} from \"./PanelDialog\";\nexport {\n confirmDiscardIfDirty,\n default as PanelDialog,\n panelDialogFixedOptions,\n panelDialogFixedPanelClass,\n panelDialogOptions,\n panelDialogPanelClass,\n panelDialogWideOptions,\n panelDialogWidePanelClass,\n panelDialogWorkspaceOptions,\n panelDialogWorkspacePanelClass,\n} from \"./PanelDialog\";\nexport type { PanelHeaderProps } from \"./PanelHeader\";\nexport { PanelHeader } from \"./PanelHeader\";\nexport type { PanesItem, PanesProps } from \"./Panes\";\nexport { default as Panes } from \"./Panes\";\nexport type { PullToRefreshProps, PullToRefreshState } from \"./PullToRefresh\";\nexport { default as PullToRefresh } from \"./PullToRefresh\";\nexport { installPageTitleController } from \"./page-title-controller\";\nexport type {\n AddPanesItemOptions,\n PanesDirection,\n PanesGroup,\n PanesIntent,\n PanesLayout,\n PanesNode,\n PanesPath,\n PanesPathSegment,\n PanesSide,\n PanesSplit,\n} from \"./panes-layout\";\nexport {\n activatePanesItem,\n addPanesItem,\n applyPanesIntent,\n createPanesLayout,\n isPanesItemVisible,\n PANES_LAYOUT_VERSION,\n parsePanesLayout,\n reconcilePanesLayout,\n removePanesItem,\n resizePanesSplit,\n} from \"./panes-layout\";\nexport { default as ResizeSeparator, type ResizeSeparatorProps } from \"./ResizeSeparator\";\nexport { attachResizeSeparator, type ResizeSeparatorOptions } from \"./resize-separator\";\nexport type { ScrollAreaProps } from \"./ScrollArea\";\nexport { default as ScrollArea } from \"./ScrollArea\";\nexport type {\n SettingsFieldControlProps,\n SettingsFieldProps,\n SettingsGroupActionProps,\n SettingsGroupProps,\n SettingsPageProps,\n SettingsPanelFooterProps,\n SettingsSaveBarProps,\n SettingsSectionProps,\n} from \"./Settings\";\nexport {\n readSettingsError,\n SettingsField,\n SettingsGroup,\n SettingsPage,\n SettingsPanelFooter,\n SettingsSaveBar,\n SettingsSection,\n sameSettingValue,\n} from \"./Settings\";\nexport type {\n SettingsCollectionActionProps,\n SettingsCollectionItemActionsProps,\n SettingsCollectionItemProps,\n SettingsCollectionItemReorderProps,\n SettingsCollectionItemStatusProps,\n SettingsCollectionProps,\n} from \"./SettingsCollection\";\nexport { default as SettingsCollection } from \"./SettingsCollection\";\nexport type {\n SettingsModalFooterProps,\n SettingsModalGroupProps,\n SettingsModalProps,\n SettingsModalTabProps,\n SettingsModalTabTone,\n} from \"./SettingsModal\";\nexport { default as SettingsModal } from \"./SettingsModal\";\nexport {\n APP_WORKSPACE_SWITCHER_SEARCH_FROM,\n type AppWorkspaceSidebarSwitcherProps,\n type AppWorkspaceSwitcherAction,\n type AppWorkspaceSwitcherOption,\n} from \"./SidebarSwitcher\";\nexport { measureScrollFade } from \"./scroll-fade\";\nexport type { TabBarItem, TabBarProps } from \"./TabBar\";\nexport { default as TabBar } from \"./TabBar\";\nexport type { TableOfContentsItem, TableOfContentsProps } from \"./TableOfContents\";\nexport { TableOfContents } from \"./TableOfContents\";\n"],"mappings":"AAMA,SAAS,OAAO,IAAI,WAAW,QAAQ,eAAe;AAgCtD,SAAS,2BAA2B,EAAE,OAAO,IAAI,YAAY,QAAQ,gBAAgB;AACrF,SAAS,iBAAiB,QAAQ,kBAAkB;AAEpD,SAAS,6BAA6B,EAAE,0BAA0B,QAAQ,4BAA4B;AAKtG,SACE,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,6BAA6B,EAC7B,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,wCAAwC,EACxC,+BAA+B,EAC/B,6BAA6B,EAC7B,yBAAyB,EACzB,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,EACxB,gCAAgC,EAChC,4BAA4B,EAC5B,+BAA+B,EAC/B,uBAAuB,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aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,gBAAgB,QACX,YAAY;AASnB,SAAS,OAAO,IAAI,kBAAkB,QAAQ,sBAAsB;AAQpE,SAAS,OAAO,IAAI,aAAa,QAAQ,iBAAiB;AAC1D,SACE,kCAAkC,QAI7B,mBAAmB;AAC1B,SAAS,iBAAiB,QAAQ,eAAe;AAEjD,SAAS,OAAO,IAAI,MAAM,QAAQ,UAAU;AAE5C,SAAS,eAAe,QAAQ,mBAAmB","ignoreList":[]}
|
|
@@ -19,21 +19,38 @@ export function scrollFadeEdges(body) {
|
|
|
19
19
|
function observeScrollFade(body) {
|
|
20
20
|
let entry = active.get(body);
|
|
21
21
|
if (!entry) {
|
|
22
|
-
const
|
|
22
|
+
const apply = () => {
|
|
23
23
|
const edges = scrollFadeEdges(body);
|
|
24
24
|
if (edges) {
|
|
25
25
|
if (body.getAttribute("data-scroll-fade") !== edges) body.setAttribute("data-scroll-fade", edges);
|
|
26
26
|
} else if (body.hasAttribute("data-scroll-fade")) body.removeAttribute("data-scroll-fade");
|
|
27
27
|
};
|
|
28
|
+
// Measuring forces layout. Scrolling (the browser sends one scroll event per frame) and changes to the scrollport
|
|
29
|
+
// itself measure at once; changes of its content are measured once per frame. A list that updates many rows at
|
|
30
|
+
// once, such as marking every chat read, otherwise lays the page out again for each row, and a measurement in the
|
|
31
|
+
// middle of a large change can delay the next frame enough to count as a layout shift. A reader that needs the
|
|
32
|
+
// current edges before the frame ends calls `measureScrollFade`.
|
|
33
|
+
let frame = 0;
|
|
34
|
+
const measure = () => {
|
|
35
|
+
if (frame) cancelAnimationFrame(frame);
|
|
36
|
+
frame = 0;
|
|
37
|
+
apply();
|
|
38
|
+
};
|
|
39
|
+
const update = () => {
|
|
40
|
+
if (!frame) frame = requestAnimationFrame(() => {
|
|
41
|
+
frame = 0;
|
|
42
|
+
apply();
|
|
43
|
+
});
|
|
44
|
+
};
|
|
28
45
|
const resize = new ResizeObserver(update);
|
|
29
46
|
const observe = () => {
|
|
30
47
|
resize.disconnect();
|
|
31
48
|
resize.observe(body);
|
|
32
49
|
for (const child of Array.from(body.children)) resize.observe(child);
|
|
33
|
-
|
|
50
|
+
measure();
|
|
34
51
|
};
|
|
35
52
|
const mutations = new MutationObserver(records => {
|
|
36
|
-
if (records.some(record => record.type === "childList" && record.target === body)) observe();else update();
|
|
53
|
+
if (records.some(record => record.type === "childList" && record.target === body)) observe();else if (records.some(record => record.target === body)) apply();else update();
|
|
37
54
|
});
|
|
38
55
|
mutations.observe(body, {
|
|
39
56
|
childList: true,
|
|
@@ -42,16 +59,18 @@ function observeScrollFade(body) {
|
|
|
42
59
|
attributes: true,
|
|
43
60
|
attributeFilter: ["class", "style", "hidden", "open", "data-scroll-fade-mode", "data-scroll-fade-axis", "dir"]
|
|
44
61
|
});
|
|
45
|
-
body.addEventListener("scroll",
|
|
62
|
+
body.addEventListener("scroll", apply, {
|
|
46
63
|
passive: true
|
|
47
64
|
});
|
|
48
65
|
observe();
|
|
49
66
|
entry = {
|
|
50
67
|
users: 0,
|
|
68
|
+
measure,
|
|
51
69
|
stop: () => {
|
|
70
|
+
if (frame) cancelAnimationFrame(frame);
|
|
52
71
|
resize.disconnect();
|
|
53
72
|
mutations.disconnect();
|
|
54
|
-
body.removeEventListener("scroll",
|
|
73
|
+
body.removeEventListener("scroll", apply);
|
|
55
74
|
body.removeAttribute("data-scroll-fade");
|
|
56
75
|
}
|
|
57
76
|
};
|
|
@@ -65,6 +84,14 @@ function observeScrollFade(body) {
|
|
|
65
84
|
}
|
|
66
85
|
};
|
|
67
86
|
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Measures an observed scrollport's fades now instead of at the end of the frame. Call it before reading the fades in
|
|
90
|
+
* the same frame as a change of the scrollport's content, as an editor does when it keeps its cursor clear of them.
|
|
91
|
+
*/
|
|
92
|
+
export function measureScrollFade(element) {
|
|
93
|
+
active.get(element)?.measure();
|
|
94
|
+
}
|
|
68
95
|
export function createScrollFade(element, enabled) {
|
|
69
96
|
createEffect(() => {
|
|
70
97
|
if (!enabled()) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["layout/scroll-fade.ts"],"sourcesContent":["import { createEffect, onCleanup } from \"solid-js\";\n\nconst selector = \"[data-scroll-fade-mode]\";\nconst active = new WeakMap<HTMLElement, { users: number; stop: () => void }>();\n\n/** Self-contained because the sidebar inline script embeds its source. */\nexport function scrollFadeEdges(body: HTMLElement): \"top\" | \"bottom\" | \"both\" | undefined {\n const mode = body.getAttribute(\"data-scroll-fade-mode\");\n const horizontal = body.getAttribute(\"data-scroll-fade-axis\") === \"horizontal\";\n const overflow = horizontal ? body.scrollWidth - body.clientWidth : body.scrollHeight - body.clientHeight;\n // Horizontal RTL scrollLeft starts at zero on the right and becomes negative.\n const rtl = horizontal && getComputedStyle(body).direction === \"rtl\";\n const offset = horizontal ? (rtl ? overflow + body.scrollLeft : body.scrollLeft) : body.scrollTop;\n const top = mode === \"both\" && overflow > 1 && offset > 1;\n const bottom = !!mode && overflow > 1 && overflow - offset > 1;\n return top && bottom ? \"both\" : top ? \"top\" : bottom ? \"bottom\" : undefined;\n}\n\n/** Shared by hydrated components and the workspace's server-rendered scrollports. */\nfunction observeScrollFade(body: HTMLElement) {\n let entry = active.get(body);\n if (!entry) {\n const update = () => {\n const edges = scrollFadeEdges(body);\n if (edges) {\n if (body.getAttribute(\"data-scroll-fade\") !== edges) body.setAttribute(\"data-scroll-fade\", edges);\n } else if (body.hasAttribute(\"data-scroll-fade\")) body.removeAttribute(\"data-scroll-fade\");\n };\n const resize = new ResizeObserver(update);\n const observe = () => {\n resize.disconnect();\n resize.observe(body);\n for (const child of Array.from(body.children)) resize.observe(child);\n update();\n };\n const mutations = new MutationObserver((records) => {\n if (records.some((record) => record.type === \"childList\" && record.target === body)) observe();\n else update();\n });\n mutations.observe(body, {\n childList: true,\n subtree: true,\n characterData: true,\n attributes: true,\n attributeFilter: [\"class\", \"style\", \"hidden\", \"open\", \"data-scroll-fade-mode\", \"data-scroll-fade-axis\", \"dir\"],\n });\n body.addEventListener(\"scroll\", update, { passive: true });\n observe();\n entry = {\n users: 0,\n stop: () => {\n resize.disconnect();\n mutations.disconnect();\n body.removeEventListener(\"scroll\", update);\n body.removeAttribute(\"data-scroll-fade\");\n },\n };\n active.set(body, entry);\n }\n entry.users++;\n return () => {\n if (--entry.users === 0) {\n entry.stop();\n active.delete(body);\n }\n };\n}\n\nexport function createScrollFade(element: () => HTMLElement | undefined, enabled: () => boolean) {\n createEffect(() => {\n if (!enabled()) return;\n const body = element();\n if (body) onCleanup(observeScrollFade(body));\n });\n}\n\n/** Enrich only explicitly marked UI scrollports, including SSR and later navigation. */\nexport function installScrollFades(root: Document | HTMLElement) {\n const owned = new Map<HTMLElement, () => void>();\n const sync = () => {\n const next = new Set(Array.from(root.querySelectorAll<HTMLElement>(selector)));\n if (root instanceof HTMLElement && root.matches(selector)) next.add(root);\n for (const [element, stop] of owned)\n if (!next.has(element)) {\n stop();\n owned.delete(element);\n }\n for (const element of next) if (!owned.has(element)) owned.set(element, observeScrollFade(element));\n };\n const containsPort = (node: Node) => node instanceof Element && (node.matches(selector) || node.querySelector(selector));\n const mutations = new MutationObserver((records) => {\n if (\n records.some(\n (record) =>\n record.type === \"attributes\" ||\n Array.from(record.addedNodes).some(containsPort) ||\n Array.from(record.removedNodes).some(containsPort),\n )\n )\n sync();\n });\n mutations.observe(root, { childList: true, subtree: true, attributes: true, attributeFilter: [\"data-scroll-fade-mode\"] });\n sync();\n return () => {\n mutations.disconnect();\n for (const stop of owned.values()) stop();\n owned.clear();\n };\n}\n"],"mappings":"AAAA,SAAS,YAAY,EAAE,SAAS,QAAQ,UAAU;AAElD,MAAM,QAAQ,GAAG,yBAAyB;AAC1C,MAAM,MAAM,GAAG,IAAI,OAAO,CAAmD,CAAC;;AAE9E;AACA,OAAO,SAAS,eAAe,CAAC,IAAiB,EAAyC;EACxF,MAAM,IAAI,GAA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,CAAC;EACD,MAAM,YAAY,GAAI,IAAU,IAAK,IAAI,YAAY,OAAO,KAAK,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;EACxH,MAAM,SAAS,GAAG,IAAI,gBAAgB,CAAE,OAAO,IAAK;IAClD,IACE,OAAO,CAAC,IAAI,CACT,MAAM,IACL,MAAM,CAAC,IAAI,KAAK,YAAY,IAC5B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,IAChD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,YAAY,CACrD,CAAC,EAED,IAAI,CAAC,CAAC;EACV,CAAC,CAAC;EACF,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE;IAAE,SAAS,EAAE,IAAI;IAAE,OAAO,EAAE,IAAI;IAAE,UAAU,EAAE,IAAI;IAAE,eAAe,EAAE,CAAC,uBAAuB;EAAE,CAAC,CAAC;EACzH,IAAI,CAAC,CAAC;EACN,OAAO,MAAM;IACX,SAAS,CAAC,UAAU,CAAC,CAAC;IACtB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACzC,KAAK,CAAC,KAAK,CAAC,CAAC;EACf,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["layout/scroll-fade.ts"],"sourcesContent":["import { createEffect, onCleanup } from \"solid-js\";\n\nconst selector = \"[data-scroll-fade-mode]\";\nconst active = new WeakMap<HTMLElement, { users: number; measure: () => void; stop: () => void }>();\n\n/** Self-contained because the sidebar inline script embeds its source. */\nexport function scrollFadeEdges(body: HTMLElement): \"top\" | \"bottom\" | \"both\" | undefined {\n const mode = body.getAttribute(\"data-scroll-fade-mode\");\n const horizontal = body.getAttribute(\"data-scroll-fade-axis\") === \"horizontal\";\n const overflow = horizontal ? body.scrollWidth - body.clientWidth : body.scrollHeight - body.clientHeight;\n // Horizontal RTL scrollLeft starts at zero on the right and becomes negative.\n const rtl = horizontal && getComputedStyle(body).direction === \"rtl\";\n const offset = horizontal ? (rtl ? overflow + body.scrollLeft : body.scrollLeft) : body.scrollTop;\n const top = mode === \"both\" && overflow > 1 && offset > 1;\n const bottom = !!mode && overflow > 1 && overflow - offset > 1;\n return top && bottom ? \"both\" : top ? \"top\" : bottom ? \"bottom\" : undefined;\n}\n\n/** Shared by hydrated components and the workspace's server-rendered scrollports. */\nfunction observeScrollFade(body: HTMLElement) {\n let entry = active.get(body);\n if (!entry) {\n const apply = () => {\n const edges = scrollFadeEdges(body);\n if (edges) {\n if (body.getAttribute(\"data-scroll-fade\") !== edges) body.setAttribute(\"data-scroll-fade\", edges);\n } else if (body.hasAttribute(\"data-scroll-fade\")) body.removeAttribute(\"data-scroll-fade\");\n };\n // Measuring forces layout. Scrolling (the browser sends one scroll event per frame) and changes to the scrollport\n // itself measure at once; changes of its content are measured once per frame. A list that updates many rows at\n // once, such as marking every chat read, otherwise lays the page out again for each row, and a measurement in the\n // middle of a large change can delay the next frame enough to count as a layout shift. A reader that needs the\n // current edges before the frame ends calls `measureScrollFade`.\n let frame = 0;\n const measure = () => {\n if (frame) cancelAnimationFrame(frame);\n frame = 0;\n apply();\n };\n const update = () => {\n if (!frame)\n frame = requestAnimationFrame(() => {\n frame = 0;\n apply();\n });\n };\n const resize = new ResizeObserver(update);\n const observe = () => {\n resize.disconnect();\n resize.observe(body);\n for (const child of Array.from(body.children)) resize.observe(child);\n measure();\n };\n const mutations = new MutationObserver((records) => {\n if (records.some((record) => record.type === \"childList\" && record.target === body)) observe();\n else if (records.some((record) => record.target === body)) apply();\n else update();\n });\n mutations.observe(body, {\n childList: true,\n subtree: true,\n characterData: true,\n attributes: true,\n attributeFilter: [\"class\", \"style\", \"hidden\", \"open\", \"data-scroll-fade-mode\", \"data-scroll-fade-axis\", \"dir\"],\n });\n body.addEventListener(\"scroll\", apply, { passive: true });\n observe();\n entry = {\n users: 0,\n measure,\n stop: () => {\n if (frame) cancelAnimationFrame(frame);\n resize.disconnect();\n mutations.disconnect();\n body.removeEventListener(\"scroll\", apply);\n body.removeAttribute(\"data-scroll-fade\");\n },\n };\n active.set(body, entry);\n }\n entry.users++;\n return () => {\n if (--entry.users === 0) {\n entry.stop();\n active.delete(body);\n }\n };\n}\n\n/**\n * Measures an observed scrollport's fades now instead of at the end of the frame. Call it before reading the fades in\n * the same frame as a change of the scrollport's content, as an editor does when it keeps its cursor clear of them.\n */\nexport function measureScrollFade(element: HTMLElement) {\n active.get(element)?.measure();\n}\n\nexport function createScrollFade(element: () => HTMLElement | undefined, enabled: () => boolean) {\n createEffect(() => {\n if (!enabled()) return;\n const body = element();\n if (body) onCleanup(observeScrollFade(body));\n });\n}\n\n/** Enrich only explicitly marked UI scrollports, including SSR and later navigation. */\nexport function installScrollFades(root: Document | HTMLElement) {\n const owned = new Map<HTMLElement, () => void>();\n const sync = () => {\n const next = new Set(Array.from(root.querySelectorAll<HTMLElement>(selector)));\n if (root instanceof HTMLElement && root.matches(selector)) next.add(root);\n for (const [element, stop] of owned)\n if (!next.has(element)) {\n stop();\n owned.delete(element);\n }\n for (const element of next) if (!owned.has(element)) owned.set(element, observeScrollFade(element));\n };\n const containsPort = (node: Node) => node instanceof Element && (node.matches(selector) || node.querySelector(selector));\n const mutations = new MutationObserver((records) => {\n if (\n records.some(\n (record) =>\n record.type === \"attributes\" ||\n Array.from(record.addedNodes).some(containsPort) ||\n Array.from(record.removedNodes).some(containsPort),\n )\n )\n sync();\n });\n mutations.observe(root, { childList: true, subtree: true, attributes: true, attributeFilter: [\"data-scroll-fade-mode\"] });\n sync();\n return () => {\n mutations.disconnect();\n for (const stop of owned.values()) stop();\n owned.clear();\n };\n}\n"],"mappings":"AAAA,SAAS,YAAY,EAAE,SAAS,QAAQ,UAAU;AAElD,MAAM,QAAQ,GAAG,yBAAyB;AAC1C,MAA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D,CAAC,EAED,IAAI,CAAC,CAAC;EACV,CAAC,CAAC;EACF,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE;IAAE,SAAS,EAAE,IAAI;IAAE,OAAO,EAAE,IAAI;IAAE,UAAU,EAAE,IAAI;IAAE,eAAe,EAAE,CAAC,uBAAuB;EAAE,CAAC,CAAC;EACzH,IAAI,CAAC,CAAC;EACN,OAAO,MAAM;IACX,SAAS,CAAC,UAAU,CAAC,CAAC;IACtB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACzC,KAAK,CAAC,KAAK,CAAC,CAAC;EACf,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { ssrElement as _$ssrElement } from "solid-js/web";
|
|
2
2
|
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
3
3
|
import { ssr as _$ssr } from "solid-js/web";
|
|
4
|
-
import { createComponent as _$createComponent } from "solid-js/web";
|
|
5
4
|
import { ssrAttribute as _$ssrAttribute } from "solid-js/web";
|
|
6
5
|
import { escape as _$escape } from "solid-js/web";
|
|
6
|
+
import { createComponent as _$createComponent } from "solid-js/web";
|
|
7
7
|
var _tmpl$ = ["<div class=\"", "\">", "</div>"],
|
|
8
8
|
_tmpl$2 = ["<div", ">", "", "", "</div>"],
|
|
9
|
-
_tmpl$3 = ["<
|
|
10
|
-
_tmpl$4 = ["<
|
|
11
|
-
_tmpl$5 = ["<
|
|
12
|
-
_tmpl$6 = ["<
|
|
9
|
+
_tmpl$3 = ["<i class=\"", "\" aria-hidden=\"true\"></i>"],
|
|
10
|
+
_tmpl$4 = ["<div", "><p", ">", "</p>", "</div>"],
|
|
11
|
+
_tmpl$5 = ["<span", ">", "</span>"],
|
|
12
|
+
_tmpl$6 = ["<p", ">", "</p>"],
|
|
13
|
+
_tmpl$7 = ["<div class=\"", "\"", ">", "</div>"];
|
|
13
14
|
import { children, For, Show, splitProps } from "solid-js";
|
|
14
15
|
export const NOTICE_CARD_CLASSES = {
|
|
15
16
|
root: "k2b-notice-card",
|
|
17
|
+
icon: "k2b-notice-card__icon",
|
|
16
18
|
content: "k2b-notice-card__content",
|
|
17
19
|
head: "k2b-notice-card__head",
|
|
18
20
|
title: "k2b-notice-card__title",
|
|
@@ -21,7 +23,7 @@ export const NOTICE_CARD_CLASSES = {
|
|
|
21
23
|
body: "k2b-notice-card__body"
|
|
22
24
|
};
|
|
23
25
|
function NoticeCardComponent(props) {
|
|
24
|
-
const [local, articleProps] = splitProps(props, ["tone", "title", "detail", "meta", "children", "class", "bodyClass"]);
|
|
26
|
+
const [local, articleProps] = splitProps(props, ["tone", "icon", "title", "detail", "meta", "children", "class", "bodyClass"]);
|
|
25
27
|
// Children that render nothing, such as a Show whose condition is false, add no body and no gap.
|
|
26
28
|
const body = children(() => local.children);
|
|
27
29
|
const hasBody = () => body.toArray().some(node => node != null && node !== false && node !== "");
|
|
@@ -32,21 +34,28 @@ function NoticeCardComponent(props) {
|
|
|
32
34
|
get ["data-tone"]() {
|
|
33
35
|
return local.tone ?? "neutral";
|
|
34
36
|
}
|
|
35
|
-
}
|
|
37
|
+
}, () => local.icon ? {
|
|
38
|
+
"data-icon": ""
|
|
39
|
+
} : {}), [_$escape(_$createComponent(Show, {
|
|
40
|
+
get when() {
|
|
41
|
+
return local.icon;
|
|
42
|
+
},
|
|
43
|
+
children: icon => _$ssr(_tmpl$3, `${_$escape(icon(), true)} ${_$escape(NOTICE_CARD_CLASSES.icon, true)}`)
|
|
44
|
+
})), _$ssr(_tmpl$2, _$ssrAttribute("class", _$escape(NOTICE_CARD_CLASSES.content, true), false), _$escape(_$createComponent(Show, {
|
|
36
45
|
get when() {
|
|
37
46
|
return local.title;
|
|
38
47
|
},
|
|
39
|
-
children: title => _$ssr(_tmpl$
|
|
48
|
+
children: title => _$ssr(_tmpl$4, _$ssrAttribute("class", _$escape(NOTICE_CARD_CLASSES.head, true), false), _$ssrAttribute("class", _$escape(NOTICE_CARD_CLASSES.title, true), false), _$escape(title()), _$escape(_$createComponent(Show, {
|
|
40
49
|
get when() {
|
|
41
50
|
return local.meta;
|
|
42
51
|
},
|
|
43
|
-
children: meta => _$ssr(_tmpl$
|
|
52
|
+
children: meta => _$ssr(_tmpl$5, _$ssrAttribute("class", _$escape(NOTICE_CARD_CLASSES.meta, true), false), _$escape(meta()))
|
|
44
53
|
})))
|
|
45
54
|
})), _$escape(_$createComponent(Show, {
|
|
46
55
|
get when() {
|
|
47
56
|
return local.detail;
|
|
48
57
|
},
|
|
49
|
-
children: detail => _$ssr(_tmpl$
|
|
58
|
+
children: detail => _$ssr(_tmpl$6, _$ssrAttribute("class", _$escape(NOTICE_CARD_CLASSES.description, true), false), _$escape(detail()))
|
|
50
59
|
})), _$escape(_$createComponent(Show, {
|
|
51
60
|
get when() {
|
|
52
61
|
return hasBody();
|
|
@@ -54,7 +63,7 @@ function NoticeCardComponent(props) {
|
|
|
54
63
|
get children() {
|
|
55
64
|
return _$ssr(_tmpl$, `${_$escape(NOTICE_CARD_CLASSES.body, true)} ${_$escape(local.bodyClass ?? "", true)}`, _$escape(body()));
|
|
56
65
|
}
|
|
57
|
-
}))), false);
|
|
66
|
+
})))], false);
|
|
58
67
|
}
|
|
59
68
|
function NoticeGrid(props) {
|
|
60
69
|
const columns = () => props.items.length <= 1 ? "one" : props.items.length === 2 ? "two" : "three";
|
|
@@ -63,7 +72,7 @@ function NoticeGrid(props) {
|
|
|
63
72
|
return props.items.length > 0;
|
|
64
73
|
},
|
|
65
74
|
get children() {
|
|
66
|
-
return _$ssr(_tmpl$
|
|
75
|
+
return _$ssr(_tmpl$7, `k2b-notice-grid ${_$escape(props.class ?? "", true)}`, _$ssrAttribute("data-columns", _$escape(columns(), true), false), _$escape(_$createComponent(For, {
|
|
67
76
|
get each() {
|
|
68
77
|
return props.items;
|
|
69
78
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["surfaces/NoticeCard.tsx"],"sourcesContent":["import { children, For, type JSX, Show, splitProps } from \"solid-js\";\nimport type { IntentTone } from \"../semantics\";\n\nexport type NoticeTone = Extract<IntentTone, \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\">;\n\ntype NoticeCardContentProps =\n | { title: JSX.Element; detail?: JSX.Element; meta?: JSX.Element; children?: JSX.Element }\n | { title?: never; detail?: never; meta?: never; children: JSX.Element };\n\nexport type NoticeCardProps = Omit<JSX.HTMLAttributes<HTMLElement>, \"children\" | \"class\" | \"title\"> &\n NoticeCardContentProps & {\n tone?: NoticeTone;\n class?: string;\n bodyClass?: string;\n };\n\nexport const NOTICE_CARD_CLASSES = {\n root: \"k2b-notice-card\",\n content: \"k2b-notice-card__content\",\n head: \"k2b-notice-card__head\",\n title: \"k2b-notice-card__title\",\n meta: \"k2b-notice-card__meta\",\n description: \"k2b-notice-card__description\",\n body: \"k2b-notice-card__body\",\n} as const;\n\nfunction NoticeCardComponent(props: NoticeCardProps): JSX.Element {\n const [local, articleProps] = splitProps(props, [\"tone\", \"title\", \"detail\", \"meta\", \"children\", \"class\", \"bodyClass\"]);\n // Children that render nothing, such as a Show whose condition is false, add no body and no gap.\n const body = children(() => local.children);\n const hasBody = () => body.toArray().some((node) => node != null && node !== false && node !== \"\");\n return (\n <article
|
|
1
|
+
{"version":3,"names":[],"sources":["surfaces/NoticeCard.tsx"],"sourcesContent":["import { children, For, type JSX, Show, splitProps } from \"solid-js\";\nimport type { IntentTone } from \"../semantics\";\n\nexport type NoticeTone = Extract<IntentTone, \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\">;\n\ntype NoticeCardContentProps =\n | { title: JSX.Element; detail?: JSX.Element; meta?: JSX.Element; children?: JSX.Element }\n | { title?: never; detail?: never; meta?: never; children: JSX.Element };\n\nexport type NoticeCardProps = Omit<JSX.HTMLAttributes<HTMLElement>, \"children\" | \"class\" | \"title\"> &\n NoticeCardContentProps & {\n tone?: NoticeTone;\n /** A Tabler icon class. Turns the notice into a compact status line whose icon and text take the tone colour. */\n icon?: string;\n class?: string;\n bodyClass?: string;\n };\n\nexport const NOTICE_CARD_CLASSES = {\n root: \"k2b-notice-card\",\n icon: \"k2b-notice-card__icon\",\n content: \"k2b-notice-card__content\",\n head: \"k2b-notice-card__head\",\n title: \"k2b-notice-card__title\",\n meta: \"k2b-notice-card__meta\",\n description: \"k2b-notice-card__description\",\n body: \"k2b-notice-card__body\",\n} as const;\n\nfunction NoticeCardComponent(props: NoticeCardProps): JSX.Element {\n const [local, articleProps] = splitProps(props, [\"tone\", \"icon\", \"title\", \"detail\", \"meta\", \"children\", \"class\", \"bodyClass\"]);\n // Children that render nothing, such as a Show whose condition is false, add no body and no gap.\n const body = children(() => local.children);\n const hasBody = () => body.toArray().some((node) => node != null && node !== false && node !== \"\");\n return (\n <article\n {...articleProps}\n class={`${NOTICE_CARD_CLASSES.root} ${local.class ?? \"\"}`}\n data-tone={local.tone ?? \"neutral\"}\n {...(local.icon ? { \"data-icon\": \"\" } : {})}\n >\n <Show when={local.icon}>{(icon) => <i class={`${icon()} ${NOTICE_CARD_CLASSES.icon}`} aria-hidden=\"true\" />}</Show>\n <div class={NOTICE_CARD_CLASSES.content}>\n <Show when={local.title}>\n {(title) => (\n <div class={NOTICE_CARD_CLASSES.head}>\n <p class={NOTICE_CARD_CLASSES.title}>{title()}</p>\n <Show when={local.meta}>{(meta) => <span class={NOTICE_CARD_CLASSES.meta}>{meta()}</span>}</Show>\n </div>\n )}\n </Show>\n <Show when={local.detail}>{(detail) => <p class={NOTICE_CARD_CLASSES.description}>{detail()}</p>}</Show>\n <Show when={hasBody()}>\n <div class={`${NOTICE_CARD_CLASSES.body} ${local.bodyClass ?? \"\"}`}>{body()}</div>\n </Show>\n </div>\n </article>\n );\n}\n\nexport type NoticeGridProps<T> = {\n items: readonly T[];\n children: (item: T) => JSX.Element;\n class?: string;\n};\n\nfunction NoticeGrid<T>(props: NoticeGridProps<T>): JSX.Element {\n const columns = () => (props.items.length <= 1 ? \"one\" : props.items.length === 2 ? \"two\" : \"three\");\n return (\n <Show when={props.items.length > 0}>\n <div class={`k2b-notice-grid ${props.class ?? \"\"}`} data-columns={columns()}>\n <For each={props.items}>{(item) => props.children(item)}</For>\n </div>\n </Show>\n );\n}\n\nexport const NoticeCard = Object.assign(NoticeCardComponent, { Grid: NoticeGrid });\nexport default NoticeCard;\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,QAAQ,EAAE,GAAG,EAAY,IAAI,EAAE,UAAU,QAAQ,UAAU;AAkBpE,OAAO,MAAM,mBAAmB,GAAG;EACjC,IAAI,EAAE,iBAAiB;EACvB,IAAI,EAAE,uBAAuB;EAC7B,OAAO,EAAE,0BAA0B;EACnC,IAAI,EAAE,uBAAuB;EAC7B,KAAK,EAAE,wBAAwB;EAC/B,IAAI,EAAE,uBAAuB;EAC7B,WAAW,EAAE,8BAA8B;EAC3C,IAAI,EAAE;AACR,CAAU;AAEV,SAAS,mBAAmB,CAAC,KAAsB,EAAe;EAChE,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;EAC9H;EACA,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,KAAK,CAAC,QAAQ,CAAC;EAC3C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAE,IAAI,IAAK,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,EAAE,CAAC;EAClG,4CAEQ,YAAY;IAAA;MAAA,OACT,GAAG,mBAAmB,CAAC,IAAI,IAAI,KAAK,CAAC,KAAK,IAAI,EAAE,EAAE;IAAA;IAAA;MAAA,OAC9C,KAAK,CAAC,IAAI,IAAI,SAAS;IAAA;EAAA,SAC7B,KAAK,CAAC,I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AAK,CAAC,KAAK,IAAI,EAAE,SAAE,0CAAgB,OAAO,CAAC,CAAC,4CACxE,GAAG;QAAA,IAAC,IAAI;UAAA,OAAE,KAAK,CAAC,KAAK;QAAA;QAAA,UAAI,IAAI,IAAK,KAAK,CAAC,QAAQ,CAAC,IAAI;MAAC;IAAA;EAAA;AAI/D;AAEA,OAAO,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE;EAAE,IAAI,EAAE;AAAW,CAAC,CAAC;AAClF,eAAe,UAAU","ignoreList":[]}
|
|
@@ -5,13 +5,13 @@ const resourceMessages = i18n.define({
|
|
|
5
5
|
messages: {
|
|
6
6
|
en: {
|
|
7
7
|
resourceUntitled: "Untitled",
|
|
8
|
-
resourceNoAccess: "
|
|
8
|
+
resourceNoAccess: "Item not available",
|
|
9
9
|
resourceDeleted: "Item deleted",
|
|
10
10
|
resourceUnavailable: "Not available right now"
|
|
11
11
|
},
|
|
12
12
|
de: {
|
|
13
13
|
resourceUntitled: "Ohne Titel",
|
|
14
|
-
resourceNoAccess: "
|
|
14
|
+
resourceNoAccess: "Element nicht verfügbar",
|
|
15
15
|
resourceDeleted: "Element gelöscht",
|
|
16
16
|
resourceUnavailable: "Gerade nicht verfügbar"
|
|
17
17
|
}
|