@k2b/ui 0.26.0 → 0.27.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/chat/ChatComposer.js +811 -406
- package/dist/browser/chat/ChatComposer.js.map +1 -1
- package/dist/browser/chat/chat-behavior.js +4 -0
- package/dist/browser/chat/chat-behavior.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/command-search.js +170 -0
- package/dist/browser/chat/command-search.js.map +1 -0
- package/dist/browser/chat/composer-document.js +1 -1
- package/dist/browser/chat/composer-document.js.map +1 -1
- package/dist/browser/chat/index.js.map +1 -1
- package/dist/browser/content/CalendarDayView.js +28 -3
- package/dist/browser/content/CalendarDayView.js.map +1 -1
- package/dist/browser/inputs/Combobox.js +4 -2
- package/dist/browser/inputs/Combobox.js.map +1 -1
- package/dist/browser/inputs/SelectChip.js +43 -12
- package/dist/browser/inputs/SelectChip.js.map +1 -1
- package/dist/browser/layout/AppWorkspace.js +708 -515
- package/dist/browser/layout/AppWorkspace.js.map +1 -1
- package/dist/browser/layout/BottomSheet.js +8 -0
- package/dist/browser/layout/BottomSheet.js.map +1 -1
- package/dist/browser/layout/app-workspace-controller.js +155 -23
- package/dist/browser/layout/app-workspace-controller.js.map +1 -1
- package/dist/browser/layout/app-workspace-state.js +5 -1
- package/dist/browser/layout/app-workspace-state.js.map +1 -1
- package/dist/browser/layout/index.js +1 -1
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/ssr/chat/ChatComposer.js +410 -93
- package/dist/ssr/chat/ChatComposer.js.map +1 -1
- package/dist/ssr/chat/chat-behavior.js +4 -0
- package/dist/ssr/chat/chat-behavior.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/command-search.js +170 -0
- package/dist/ssr/chat/command-search.js.map +1 -0
- package/dist/ssr/chat/composer-document.js +1 -1
- package/dist/ssr/chat/composer-document.js.map +1 -1
- package/dist/ssr/chat/index.js.map +1 -1
- package/dist/ssr/content/CalendarDayView.js +28 -3
- package/dist/ssr/content/CalendarDayView.js.map +1 -1
- package/dist/ssr/inputs/Combobox.js +4 -2
- package/dist/ssr/inputs/Combobox.js.map +1 -1
- package/dist/ssr/inputs/SelectChip.js +35 -11
- package/dist/ssr/inputs/SelectChip.js.map +1 -1
- package/dist/ssr/layout/AppWorkspace.js +242 -105
- package/dist/ssr/layout/AppWorkspace.js.map +1 -1
- package/dist/ssr/layout/BottomSheet.js +8 -0
- package/dist/ssr/layout/BottomSheet.js.map +1 -1
- package/dist/ssr/layout/app-workspace-controller.js +155 -23
- package/dist/ssr/layout/app-workspace-controller.js.map +1 -1
- package/dist/ssr/layout/app-workspace-state.js +5 -1
- package/dist/ssr/layout/app-workspace-state.js.map +1 -1
- package/dist/ssr/layout/index.js +1 -1
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/chat/ChatComposer.d.ts +44 -2
- package/dist/types/chat/chat-behavior.d.ts +4 -0
- package/dist/types/chat/chat-messages.d.ts +7 -0
- package/dist/types/chat/command-search.d.ts +39 -0
- package/dist/types/chat/index.d.ts +1 -1
- package/dist/types/inputs/SelectChip.d.ts +4 -0
- package/dist/types/layout/AppWorkspace.d.ts +13 -1
- package/dist/types/layout/BottomSheet.d.ts +8 -0
- package/dist/types/layout/index.d.ts +1 -1
- package/package.json +4 -4
|
@@ -8,56 +8,61 @@ import { ssrStyle as _$ssrStyle } from "solid-js/web";
|
|
|
8
8
|
import { ssrAttribute as _$ssrAttribute } from "solid-js/web";
|
|
9
9
|
import { escape as _$escape } from "solid-js/web";
|
|
10
10
|
var _tmpl$ = ["<button type=\"button\" class=\"k2b-app-workspace__resize\" role=\"separator\"", " style=\"", "\"><span aria-hidden=\"true\"></span></button>"],
|
|
11
|
-
_tmpl$2 = ["<
|
|
12
|
-
_tmpl$3 = ["<
|
|
13
|
-
_tmpl$4 = ["<
|
|
14
|
-
_tmpl$5 = ["<
|
|
15
|
-
_tmpl$6 = ["<
|
|
16
|
-
_tmpl$7 =
|
|
17
|
-
_tmpl$8 = ["<
|
|
18
|
-
_tmpl$9 = ["<
|
|
19
|
-
_tmpl$0 = ["<span aria-hidden=\"true\"
|
|
20
|
-
_tmpl$1 = ["<
|
|
21
|
-
_tmpl$10 = ["<
|
|
22
|
-
_tmpl$11 = ["<
|
|
23
|
-
_tmpl$12 = ["<
|
|
24
|
-
_tmpl$13 = ["<
|
|
25
|
-
_tmpl$14 = ["<
|
|
26
|
-
_tmpl$15 = ["<
|
|
27
|
-
_tmpl$16 = "<
|
|
28
|
-
_tmpl$17 = "<
|
|
29
|
-
_tmpl$18 = ["<
|
|
30
|
-
_tmpl$19 = ["<
|
|
31
|
-
_tmpl$20 = ["<
|
|
32
|
-
_tmpl$21 =
|
|
33
|
-
_tmpl$22 = "<span class=\"k2b-app-workspace__sidebar-status-
|
|
34
|
-
_tmpl$23 = ["<span class=\"k2b-app-workspace__sidebar-
|
|
35
|
-
_tmpl$24 = ["<span class=\"k2b-app-workspace__sidebar-
|
|
36
|
-
_tmpl$25 = ["<span class=\"k2b-
|
|
37
|
-
_tmpl$26 = ["<span class=\"k2b-app-workspace__sidebar-
|
|
38
|
-
_tmpl$27 =
|
|
39
|
-
_tmpl$28 = ["<span class=\"k2b-app-workspace__sidebar-item-
|
|
40
|
-
_tmpl$29 = ["<
|
|
41
|
-
_tmpl$30 = ["<
|
|
42
|
-
_tmpl$31 = ["<
|
|
43
|
-
_tmpl$32 = ["<span class=\"k2b-app-workspace__sidebar-item-copy\"
|
|
44
|
-
_tmpl$33 = ["<span class=\"
|
|
45
|
-
_tmpl$34 = ["<
|
|
46
|
-
_tmpl$35 = ["<
|
|
47
|
-
_tmpl$36 = ["<
|
|
48
|
-
_tmpl$37 = ["<
|
|
49
|
-
_tmpl$38 = ["<
|
|
50
|
-
_tmpl$39 = ["<
|
|
51
|
-
_tmpl$40 = ["<
|
|
52
|
-
_tmpl$41 = "<
|
|
53
|
-
_tmpl$42 = ["<div class=\"k2b-app-
|
|
54
|
-
_tmpl$43 = ["<
|
|
55
|
-
_tmpl$44 = ["<div class=\"
|
|
56
|
-
_tmpl$45 = ["<
|
|
11
|
+
_tmpl$2 = ["<p>", "</p>"],
|
|
12
|
+
_tmpl$3 = ["<div class=\"k2b-app-workspace__level-actions\">", "</div>"],
|
|
13
|
+
_tmpl$4 = ["<header class=\"k2b-app-workspace__level-head\">", "<div class=\"k2b-app-workspace__level-title\"><h2 tabindex=\"-1\">", "</h2>", "</div>", "</header>"],
|
|
14
|
+
_tmpl$5 = ["<div class=\"k2b-app-workspace__main-primary\" data-workspace-main-region=\"main\"", ">", "</div>"],
|
|
15
|
+
_tmpl$6 = ["<section", " class=\"", "\"", " style=\"", "\">", "</section>"],
|
|
16
|
+
_tmpl$7 = "<i class=\"ti ti-chevron-left\" aria-hidden=\"true\"></i>",
|
|
17
|
+
_tmpl$8 = ["<div class=\"k2b-app-workspace__level-body\"", ">", "</div>"],
|
|
18
|
+
_tmpl$9 = ["<style>", "</style>"],
|
|
19
|
+
_tmpl$0 = ["<aside", " class=\"", "\"", "", " style=\"", "\"><button type=\"button\" class=\"k2b-app-workspace__detail-grabber\"", " aria-pressed=\"false\"><span aria-hidden=\"true\"></span></button>", "</aside>"],
|
|
20
|
+
_tmpl$1 = ["<aside", " class=\"", "\"", "", " style=\"", "\">", "</aside>"],
|
|
21
|
+
_tmpl$10 = ["<div class=\"k2b-app-workspace__sidebar-desktop\">", "</div>"],
|
|
22
|
+
_tmpl$11 = ["<aside", " class=\"", "\"", "", ">", "</aside>"],
|
|
23
|
+
_tmpl$12 = ["<script>", "</script>"],
|
|
24
|
+
_tmpl$13 = ["<span aria-hidden=\"true\"><i", "></i></span>"],
|
|
25
|
+
_tmpl$14 = ["<span class=\"k2b-app-workspace__sidebar-section-count\">", "</span>"],
|
|
26
|
+
_tmpl$15 = ["<button type=\"button\" class=\"k2b-app-workspace__sidebar-section-toggle\"", ">", "<i", " aria-hidden=\"true\"></i></button>"],
|
|
27
|
+
_tmpl$16 = ["<div class=\"k2b-app-workspace__sidebar-section-actions\">", "</div>"],
|
|
28
|
+
_tmpl$17 = ["<header class=\"k2b-app-workspace__sidebar-section-header\">", "", "</header>"],
|
|
29
|
+
_tmpl$18 = ["<div", "", " class=\"k2b-app-workspace__sidebar-section-content\">", "</div>"],
|
|
30
|
+
_tmpl$19 = ["<h2>", "</h2>"],
|
|
31
|
+
_tmpl$20 = ["<div class=\"k2b-app-workspace__sidebar-item-actions\"", ">", "</div>"],
|
|
32
|
+
_tmpl$21 = "<span class=\"k2b-app-workspace__sidebar-status-mention\" aria-hidden=\"true\">@</span>",
|
|
33
|
+
_tmpl$22 = "<span class=\"k2b-app-workspace__sidebar-status-muted\" aria-hidden=\"true\"><i class=\"ti ti-bell-off\"></i></span>",
|
|
34
|
+
_tmpl$23 = ["<span class=\"k2b-app-workspace__sidebar-status-count\"", ">", "</span>"],
|
|
35
|
+
_tmpl$24 = ["<span class=\"k2b-app-workspace__sidebar-status-unread\" aria-hidden=\"true\">", "</span>"],
|
|
36
|
+
_tmpl$25 = ["<span class=\"k2b-sr-only\">, ", "</span>"],
|
|
37
|
+
_tmpl$26 = ["<span class=\"k2b-app-workspace__sidebar-status\"", ">", "</span>"],
|
|
38
|
+
_tmpl$27 = "<span class=\"k2b-app-workspace__sidebar-status-dot\"></span>",
|
|
39
|
+
_tmpl$28 = ["<span class=\"k2b-app-workspace__sidebar-item-icon\" aria-hidden=\"true\">", "</span>"],
|
|
40
|
+
_tmpl$29 = ["<span class=\"k2b-app-workspace__sidebar-item-context-meta\">", "</span>"],
|
|
41
|
+
_tmpl$30 = ["<span class=\"k2b-app-workspace__sidebar-item-context\"><span class=\"k2b-app-workspace__sidebar-item-context-label\">", "</span>", "</span>"],
|
|
42
|
+
_tmpl$31 = ["<span class=\"k2b-app-workspace__sidebar-item-description\">", "</span>"],
|
|
43
|
+
_tmpl$32 = ["<span class=\"k2b-app-workspace__sidebar-item-copy\">", "<span class=\"k2b-app-workspace__sidebar-item-label\"", "><span class=\"k2b-app-workspace__sidebar-item-label-text\">", "</span></span>", "</span>"],
|
|
44
|
+
_tmpl$33 = ["<span class=\"k2b-app-workspace__sidebar-item-meta\"", ">", "</span>"],
|
|
45
|
+
_tmpl$34 = ["<i", "></i>"],
|
|
46
|
+
_tmpl$35 = ["<a", " class=\"k2b-app-workspace__sidebar-item-action\"", ">", "</a>"],
|
|
47
|
+
_tmpl$36 = ["<button type=\"button\" class=\"k2b-app-workspace__sidebar-item-action\"", ">", "</button>"],
|
|
48
|
+
_tmpl$37 = ["<span class=\"k2b-app-workspace__sidebar-item-copy\"><span class=\"k2b-app-workspace__sidebar-item-label\"", "><span class=\"k2b-app-workspace__sidebar-item-label-text\">", "</span></span><span class=\"k2b-app-workspace__sidebar-item-description\">", "</span></span>"],
|
|
49
|
+
_tmpl$38 = ["<span class=\"", "\"", ">", "</span>"],
|
|
50
|
+
_tmpl$39 = ["<span class=\"k2b-app-workspace__nav-tree-toggle\" data-k2b-nav-tree-toggle aria-hidden=\"true\"><i class=\"", "\"></i></span>"],
|
|
51
|
+
_tmpl$40 = ["<span class=\"k2b-app-workspace__sidebar-item-label\"", "><span class=\"k2b-app-workspace__sidebar-item-label-text\">", "</span></span>"],
|
|
52
|
+
_tmpl$41 = ["<div class=\"k2b-app-workspace__nav-tree-group\" role=\"group\">", "</div>"],
|
|
53
|
+
_tmpl$42 = ["<div class=\"k2b-app-workspace__nav-tree-node\" role=\"treeitem\"", " style=\"", "\">", "", "</div>"],
|
|
54
|
+
_tmpl$43 = ["<div class=\"", "\" role=\"tree\"", ">", "</div>"],
|
|
55
|
+
_tmpl$44 = ["<div class=\"k2b-app-workspace__sidebar-icon-grid\"", ">", "</div>"],
|
|
56
|
+
_tmpl$45 = ["<i", " aria-hidden=\"true\"></i>"],
|
|
57
|
+
_tmpl$46 = "<i class=\"ti ti-layout-sidebar\" aria-hidden=\"true\"></i>",
|
|
58
|
+
_tmpl$47 = ["<div class=\"k2b-app-workspace__head\"", ">", "", "</div>"],
|
|
59
|
+
_tmpl$48 = ["<h1 class=\"k2b-app-workspace__head-heading\" data-k2b-page-trail-title", ">", "</h1>"],
|
|
60
|
+
_tmpl$49 = ["<div class=\"", "\" data-k2b-app-workspace", " style=\"", "\">", "", "</div>"],
|
|
61
|
+
_tmpl$50 = ["<div class=\"", "\">", "</div>"];
|
|
57
62
|
import { Link } from "@k2b/ssr/nav";
|
|
58
|
-
import { children, createContext, createEffect, createMemo, createSignal, createUniqueId, For, mergeProps, onCleanup, onMount, Show, useContext } from "solid-js";
|
|
63
|
+
import { children, createContext, createEffect, createMemo, createSignal, createUniqueId, For, mergeProps, on, onCleanup, onMount, Show, useContext } from "solid-js";
|
|
59
64
|
import { isServer } from "solid-js/web";
|
|
60
|
-
import { IconButton } from "../actions/Button";
|
|
65
|
+
import { IconButton, IconButtonLink } from "../actions/Button";
|
|
61
66
|
import { APP_WORKSPACE_DETAIL_CLOSE_EVENT, APP_WORKSPACE_DETAIL_STEP_EVENT, APP_WORKSPACE_SIDEBAR_HIDE_EVENT, installAppWorkspaceController } from "./app-workspace-controller";
|
|
62
67
|
import { APP_WORKSPACE_DETAIL_DEFAULT, APP_WORKSPACE_DETAIL_MAX, APP_WORKSPACE_DETAIL_MIN, APP_WORKSPACE_DRAWER_DEFAULT, APP_WORKSPACE_DRAWER_MAX, APP_WORKSPACE_DRAWER_MIN, APP_WORKSPACE_PANE_DEFAULT, APP_WORKSPACE_PANE_MAX, APP_WORKSPACE_PANE_MIN, APP_WORKSPACE_SIDEBAR_COLLAPSED, APP_WORKSPACE_SIDEBAR_DEFAULT, APP_WORKSPACE_SIDEBAR_MAX, APP_WORKSPACE_SIDEBAR_MIN, appWorkspaceLayoutStyle, appWorkspacePanelVariable } from "./app-workspace-state";
|
|
63
68
|
import { PageTitle, usePageTrail } from "./PageTitle";
|
|
@@ -92,7 +97,15 @@ const sidebarItemSlot = value => Boolean(value && typeof value === "object" && "
|
|
|
92
97
|
const navTreeItemSlot = value => Boolean(value && typeof value === "object" && "kind" in value && value.kind === NAV_TREE_ITEM);
|
|
93
98
|
function ResizeHandle(props) {
|
|
94
99
|
const workspaceMessages = useWorkspaceMessages();
|
|
95
|
-
|
|
100
|
+
const workspace = useContext(WorkspaceContext);
|
|
101
|
+
const providerState = useContext(LayoutStateContext);
|
|
102
|
+
const initialSize = () => {
|
|
103
|
+
const state = workspace?.initialLayoutState() ?? providerState;
|
|
104
|
+
const id = props.panelId ?? "primary";
|
|
105
|
+
const size = props.kind === "sidebar" ? state?.sidebarCollapsed ? APP_WORKSPACE_SIDEBAR_COLLAPSED : state?.sidebarWidth : props.kind === "pane" ? state?.paneWidths?.[id] : props.kind === "detail" ? state?.detailWidths?.[id] : state?.drawerHeights?.[id];
|
|
106
|
+
return Math.min(props.maxSize, Math.max(props.minSize, size ?? props.defaultSize));
|
|
107
|
+
};
|
|
108
|
+
return _$ssr(_tmpl$, _$ssrAttribute("aria-label", _$escape(props.label ?? (props.kind === "sidebar" ? workspaceMessages().resizeNavigation : props.kind === "pane" ? workspaceMessages().resizeWorkspacePane : props.kind === "detail" ? workspaceMessages().resizeDetailPanel : workspaceMessages().resizeBottomDrawer), true), false) + _$ssrAttribute("aria-controls", _$escape(props.controls, true), false) + _$ssrAttribute("aria-orientation", props.kind === "drawer" ? "horizontal" : "vertical", false) + _$ssrAttribute("aria-valuemin", _$escape(props.minSize, true), false) + _$ssrAttribute("aria-valuemax", _$escape(props.maxSize, true), false) + _$ssrAttribute("aria-valuenow", _$escape(initialSize(), true), false) + _$ssrAttribute("data-workspace-level-shown", _$escape(props.levelShown, true), false) + _$ssrAttribute("data-app-workspace-resize", _$escape(props.kind, true), false) + _$ssrAttribute("data-workspace-panel-id", _$escape(props.panelId, true), false) + _$ssrAttribute("data-workspace-resize-edge", _$escape(props.edge, true), false) + _$ssrAttribute("data-workspace-resize-shadow", props.shadow ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("data-workspace-default-size", _$escape(props.defaultSize, true), false) + _$ssrAttribute("data-workspace-min-size", _$escape(props.minSize, true), false) + _$ssrAttribute("data-workspace-max-size", _$escape(props.maxSize, true), false), _$ssrStyle(props.style));
|
|
96
109
|
}
|
|
97
110
|
|
|
98
111
|
/**
|
|
@@ -127,10 +140,41 @@ function AppWorkspaceMainPane(props) {
|
|
|
127
140
|
domId: `k2b-workspace-pane-${createUniqueId()}`
|
|
128
141
|
};
|
|
129
142
|
}
|
|
143
|
+
|
|
144
|
+
/** A level's head; `children` is its back step. It mounts and cleans up with its open pane. */
|
|
145
|
+
function LevelHead(props) {
|
|
146
|
+
// Read each slot once: every read of a JSX prop builds it again, and the
|
|
147
|
+
// server and the client would then disagree on hydration keys.
|
|
148
|
+
const description = children(() => props.description);
|
|
149
|
+
const actions = children(() => props.actions);
|
|
150
|
+
return _$ssr(_tmpl$4, _$escape(props.children), _$escape(props.label), _$escape(_$createComponent(Show, {
|
|
151
|
+
get when() {
|
|
152
|
+
return description();
|
|
153
|
+
},
|
|
154
|
+
get children() {
|
|
155
|
+
return _$ssr(_tmpl$2, _$escape(description()));
|
|
156
|
+
}
|
|
157
|
+
})), _$escape(_$createComponent(Show, {
|
|
158
|
+
get when() {
|
|
159
|
+
return actions();
|
|
160
|
+
},
|
|
161
|
+
get children() {
|
|
162
|
+
return _$ssr(_tmpl$3, _$escape(actions()));
|
|
163
|
+
}
|
|
164
|
+
})));
|
|
165
|
+
}
|
|
130
166
|
function AppWorkspaceMain(props) {
|
|
131
167
|
const rootResizable = useContext(ResizeContext);
|
|
168
|
+
const workspaceMessages = useWorkspaceMessages();
|
|
169
|
+
const levelsMode = createMemo(() => props.level !== undefined);
|
|
132
170
|
const resolved = children(() => props.children);
|
|
133
|
-
const values = createMemo(() =>
|
|
171
|
+
const values = createMemo(() => {
|
|
172
|
+
const all = flatten(resolved());
|
|
173
|
+
if (levelsMode() && all.some(value => !mainPaneSlot(value))) {
|
|
174
|
+
throw new Error("AppWorkspace.Main level requires only AppWorkspace.MainPane children.");
|
|
175
|
+
}
|
|
176
|
+
return all;
|
|
177
|
+
});
|
|
134
178
|
const paneIds = createMemo(() => {
|
|
135
179
|
const ids = values().filter(mainPaneSlot).map(slot => slot.props.id);
|
|
136
180
|
assertUniqueStableUiIds(ids, "AppWorkspace.MainPane id");
|
|
@@ -160,7 +204,48 @@ function AppWorkspaceMain(props) {
|
|
|
160
204
|
});
|
|
161
205
|
return result;
|
|
162
206
|
});
|
|
163
|
-
const
|
|
207
|
+
const levels = createMemo(() => {
|
|
208
|
+
const open = values().filter(mainPaneSlot).filter(slot => slot.props.open !== false);
|
|
209
|
+
if (levelsMode()) {
|
|
210
|
+
for (const pane of open.slice(0, -1)) {
|
|
211
|
+
if (!pane.props.href) throw new Error(`AppWorkspace.MainPane "${pane.props.id}" requires href before the last level.`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return open;
|
|
215
|
+
});
|
|
216
|
+
const depth = () => Math.max(1, levels().findIndex(pane => pane.props.id === props.level) + 1);
|
|
217
|
+
const levelClasses = (index, kind) => [1, 2, 3].filter(widthClass => {
|
|
218
|
+
const count = Math.min(widthClass, levels().length);
|
|
219
|
+
const end = Math.max(depth(), count);
|
|
220
|
+
const start = end - count + 1;
|
|
221
|
+
return kind === "first" ? index === start && index > 1 : kind === "last" ? index === end : kind === "handle" ? index >= start && index + 1 <= end : index >= start && index <= end;
|
|
222
|
+
}).join(" ");
|
|
223
|
+
const anchorRegion = createMemo(() => (levelsMode() ? regions().find(candidate => candidate.type === "pane" && candidate.slot === levels().at(-1)) : undefined) ?? regions().find(candidate => candidate.type === "primary") ?? regions().find(candidate => candidate.type === "pane" && candidate.slot.props.open !== false));
|
|
224
|
+
// A level change can hide the control that made it: the back step, or a row
|
|
225
|
+
// of a list that a phone no longer shows. Focus then moves to the title of
|
|
226
|
+
// the selected level, so keyboard and screen reader users keep their place.
|
|
227
|
+
// The back step to the first level unmounts, and focus has left with it by
|
|
228
|
+
// the time the level changes, so pressing it is remembered.
|
|
229
|
+
let mainElement;
|
|
230
|
+
let backStepFocused = false;
|
|
231
|
+
const navigateBack = event => {
|
|
232
|
+
backStepFocused = Boolean(mainElement?.contains(document.activeElement));
|
|
233
|
+
return props.onLevelNavigate?.(event);
|
|
234
|
+
};
|
|
235
|
+
createEffect(on(() => levelsMode() ? depth() : 0, current => {
|
|
236
|
+
const pressedBack = backStepFocused;
|
|
237
|
+
backStepFocused = false;
|
|
238
|
+
const focused = document.activeElement;
|
|
239
|
+
if (!current || !mainElement) return;
|
|
240
|
+
const lost = pressedBack && (!focused || focused === document.body);
|
|
241
|
+
const hidden = focused instanceof HTMLElement && mainElement.contains(focused) && focused.getClientRects().length === 0;
|
|
242
|
+
if (!lost && !hidden) return;
|
|
243
|
+
mainElement.querySelector(`:scope > [data-workspace-level="${current}"] > .k2b-app-workspace__level-head h2`)?.focus({
|
|
244
|
+
preventScroll: true
|
|
245
|
+
});
|
|
246
|
+
}, {
|
|
247
|
+
defer: true
|
|
248
|
+
}));
|
|
164
249
|
// Presence of a MainPane slot — not of an *open* one — decides the split
|
|
165
250
|
// layout. Deriving it from `regions()` made a workspace whose panes are all
|
|
166
251
|
// closed fall back to `resolved()`, which renders the raw slot objects.
|
|
@@ -169,8 +254,14 @@ function AppWorkspaceMain(props) {
|
|
|
169
254
|
get ["class"]() {
|
|
170
255
|
return `k2b-app-workspace__main ${hasPanes() ? "has-panes" : ""} ${props.class ?? ""}`;
|
|
171
256
|
},
|
|
257
|
+
get ["data-workspace-levels"]() {
|
|
258
|
+
return levelsMode() ? "" : undefined;
|
|
259
|
+
},
|
|
260
|
+
get ["data-workspace-level-count"]() {
|
|
261
|
+
return levelsMode() ? levels().length : undefined;
|
|
262
|
+
},
|
|
172
263
|
get ["data-mobile-pane"]() {
|
|
173
|
-
return props.mobilePane;
|
|
264
|
+
return levelsMode() ? undefined : props.mobilePane;
|
|
174
265
|
},
|
|
175
266
|
get ["data-width"]() {
|
|
176
267
|
return props.width === "content" ? "content" : undefined;
|
|
@@ -202,9 +293,11 @@ function AppWorkspaceMain(props) {
|
|
|
202
293
|
return props.mobilePane ?? (anchor?.type === "pane" ? anchor.slot.props.id : "main");
|
|
203
294
|
};
|
|
204
295
|
if (region.type === "primary") {
|
|
205
|
-
return _$ssr(_tmpl$
|
|
296
|
+
return _$ssr(_tmpl$5, _$ssrAttribute("data-workspace-mobile-active", activeMobilePane() === "main" ? "true" : "false", false), _$escape(region.children));
|
|
206
297
|
}
|
|
207
298
|
const pane = region.slot;
|
|
299
|
+
const levelIndex = () => levels().indexOf(pane) + 1;
|
|
300
|
+
const levelAttr = kind => levelsMode() ? levelClasses(levelIndex(), kind) : undefined;
|
|
208
301
|
const panelId = assertStableUiId(pane.props.id, "AppWorkspace.MainPane id");
|
|
209
302
|
const variable = appWorkspacePanelVariable("pane", panelId);
|
|
210
303
|
const isAnchor = () => region === anchorRegion();
|
|
@@ -212,9 +305,12 @@ function AppWorkspaceMain(props) {
|
|
|
212
305
|
const defaultSize = () => pane.props.defaultSize ?? APP_WORKSPACE_PANE_DEFAULT;
|
|
213
306
|
const minSize = () => pane.props.minSize ?? APP_WORKSPACE_PANE_MIN;
|
|
214
307
|
const maxSize = () => Math.max(minSize(), pane.props.maxSize ?? APP_WORKSPACE_PANE_MAX);
|
|
215
|
-
const before = () => region.index < (anchorRegion()?.index ?? 0);
|
|
308
|
+
const before = () => levelsMode() || region.index < (anchorRegion()?.index ?? 0);
|
|
216
309
|
const handle = () => _$createComponent(ResizeHandle, {
|
|
217
310
|
kind: "pane",
|
|
311
|
+
get levelShown() {
|
|
312
|
+
return levelAttr("handle");
|
|
313
|
+
},
|
|
218
314
|
get edge() {
|
|
219
315
|
return before() ? "end" : "start";
|
|
220
316
|
},
|
|
@@ -250,10 +346,50 @@ function AppWorkspaceMain(props) {
|
|
|
250
346
|
get children() {
|
|
251
347
|
return handle();
|
|
252
348
|
}
|
|
253
|
-
}), _$ssr(_tmpl$
|
|
254
|
-
|
|
349
|
+
}), _$ssr(_tmpl$6, _$ssrAttribute("id", _$escape(pane.domId, true), false), `k2b-app-workspace__main-pane ${isAnchor() ? "is-primary" : ""} ${_$escape(pane.props.class ?? "", true)}`, _$ssrAttribute("aria-label", _$escape(pane.props.label, true), false) + _$ssrAttribute("data-workspace-level", levelsMode() ? _$escape(levelIndex(), true) : _$escape(undefined, true), false) + _$ssrAttribute("data-workspace-level-shown", _$escape(levelAttr("shown"), true), false) + _$ssrAttribute("data-workspace-level-first", _$escape(levelAttr("first"), true), false) + _$ssrAttribute("data-workspace-level-last", _$escape(levelAttr("last"), true), false) + _$ssrAttribute("data-workspace-main-region", _$escape(pane.props.id, true), false) + _$ssrAttribute("data-workspace-mobile-active", (levelsMode() ? levelClasses(levelIndex(), "shown").split(" ").includes("1") : activeMobilePane() === pane.props.id) ? "true" : "false", false) + _$ssrAttribute("data-workspace-panel-id", _$escape(panelId, true), false) + _$ssrAttribute("data-workspace-resizable", resizable() ? "true" : "false", false) + _$ssrAttribute("data-surface", pane.props.surface === "navigation" ? "navigation" : _$escape(undefined, true), false) + _$ssrAttribute("data-scroll", !levelsMode() && pane.props.scroll === false ? "false" : _$escape(undefined, true), false) + _$ssrAttribute("data-scroll-fade-mode", !levelsMode() && pane.props.scroll !== false && pane.props.scrollFade !== false ? "both" : _$escape(undefined, true), false), _$ssrStyle(isAnchor() ? undefined : {
|
|
350
|
+
// A stored width keeps to this pane's limits before the controller attaches.
|
|
351
|
+
"--k2b-workspace-panel-size": `clamp(${minSize()}px, var(${variable}, ${defaultSize()}px), ${maxSize()}px)`,
|
|
255
352
|
"--k2b-workspace-panel-min": `${minSize()}px`
|
|
256
|
-
}), _$escape(
|
|
353
|
+
}), levelsMode() ? _$escape([_$createComponent(LevelHead, {
|
|
354
|
+
get label() {
|
|
355
|
+
return pane.props.label;
|
|
356
|
+
},
|
|
357
|
+
get description() {
|
|
358
|
+
return pane.props.description;
|
|
359
|
+
},
|
|
360
|
+
get actions() {
|
|
361
|
+
return pane.props.actions;
|
|
362
|
+
},
|
|
363
|
+
get children() {
|
|
364
|
+
return _$createComponent(Show, {
|
|
365
|
+
get when() {
|
|
366
|
+
return _$memo(() => levelIndex() > 1)() && depth() > 1;
|
|
367
|
+
},
|
|
368
|
+
get children() {
|
|
369
|
+
return _$createComponent(IconButtonLink, {
|
|
370
|
+
"class": "k2b-app-workspace__level-back",
|
|
371
|
+
get href() {
|
|
372
|
+
return levels()[depth() - 2]?.props.href;
|
|
373
|
+
},
|
|
374
|
+
get label() {
|
|
375
|
+
return workspaceMessages().backTo({
|
|
376
|
+
page: levels()[levelIndex() - 2]?.props.label ?? ""
|
|
377
|
+
});
|
|
378
|
+
},
|
|
379
|
+
get navigation() {
|
|
380
|
+
return props.onLevelNavigate ? "enhanced" : "document";
|
|
381
|
+
},
|
|
382
|
+
get onNavigate() {
|
|
383
|
+
return props.onLevelNavigate ? navigateBack : undefined;
|
|
384
|
+
},
|
|
385
|
+
get children() {
|
|
386
|
+
return _$ssr(_tmpl$7);
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}), _$ssr(_tmpl$8, _$ssrAttribute("data-scroll", pane.props.scroll === false ? "false" : _$escape(undefined, true), false) + _$ssrAttribute("data-scroll-fade-mode", pane.props.scroll !== false && pane.props.scrollFade !== false ? "both" : _$escape(undefined, true), false), _$escape(pane.props.children))]) : _$escape(pane.props.children)), _$createComponent(Show, {
|
|
257
393
|
get when() {
|
|
258
394
|
return _$memo(() => !!resizable())() && before();
|
|
259
395
|
},
|
|
@@ -316,7 +452,7 @@ function AppWorkspaceDetail(props) {
|
|
|
316
452
|
aside?.removeEventListener(APP_WORKSPACE_DETAIL_STEP_EVENT, step);
|
|
317
453
|
});
|
|
318
454
|
});
|
|
319
|
-
return [_$ssr(_tmpl$
|
|
455
|
+
return [_$ssr(_tmpl$9, workspaceRule()), _$createComponent(Show, {
|
|
320
456
|
get when() {
|
|
321
457
|
return resizable();
|
|
322
458
|
},
|
|
@@ -344,7 +480,7 @@ function AppWorkspaceDetail(props) {
|
|
|
344
480
|
}
|
|
345
481
|
});
|
|
346
482
|
}
|
|
347
|
-
}), _$ssr(_tmpl$
|
|
483
|
+
}), _$ssr(_tmpl$0, _$ssrAttribute("id", _$escape(domId(), true), false), `k2b-app-workspace__detail ${_$escape(props.class ?? "", true)}`, _$ssrAttribute("data-width", _$escape(props.width ?? "md", true), false) + _$ssrAttribute("data-workspace-detail-phone", props.phone === "page" ? "page" : _$escape(undefined, true), false) + _$ssrAttribute("data-workspace-panel-id", _$escape(panelId(), true), false) + _$ssrAttribute("data-workspace-resizable", resizable() ? "true" : "false", false) + _$ssrAttribute("data-workspace-detail-closable", props.onClose ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("data-workspace-detail-steppable", props.onStep ? "true" : _$escape(undefined, true), false), _$ssrAttribute("hidden", !props.open, true), _$ssrStyle({
|
|
348
484
|
...sizeStyle(),
|
|
349
485
|
"view-transition-name": props.viewTransitionName
|
|
350
486
|
}), _$ssrAttribute("aria-label", _$escape(workspaceMessages().detailFullHeight, true), false), _$escape(props.children))];
|
|
@@ -395,7 +531,7 @@ function AppWorkspaceBottomDrawer(props) {
|
|
|
395
531
|
}
|
|
396
532
|
});
|
|
397
533
|
}
|
|
398
|
-
}), _$ssr(_tmpl$
|
|
534
|
+
}), _$ssr(_tmpl$1, _$ssrAttribute("id", _$escape(domId(), true), false), `k2b-app-workspace__drawer ${_$escape(props.class ?? "", true)}`, _$ssrAttribute("data-height", _$escape(props.height ?? "md", true), false) + _$ssrAttribute("data-workspace-panel-id", _$escape(panelId(), true), false) + _$ssrAttribute("data-workspace-resizable", resizable() ? "true" : "false", false), _$ssrAttribute("hidden", !props.open, true), _$ssrStyleProperty("--k2b-workspace-panel-size:", `var(${_$escape(variable(), true)}, ${_$escape(defaultHeight(), true)}px)`) + _$ssrStyleProperty(";view-transition-name:", _$escape(props.viewTransitionName, true)), _$escape(props.children))];
|
|
399
535
|
}
|
|
400
536
|
function AppWorkspaceSidebar(props) {
|
|
401
537
|
const rootResizable = useContext(ResizeContext);
|
|
@@ -419,12 +555,12 @@ function AppWorkspaceSidebar(props) {
|
|
|
419
555
|
aside?.addEventListener(APP_WORKSPACE_SIDEBAR_HIDE_EVENT, requestHide);
|
|
420
556
|
onCleanup(() => aside?.removeEventListener(APP_WORKSPACE_SIDEBAR_HIDE_EVENT, requestHide));
|
|
421
557
|
});
|
|
422
|
-
return [_$ssr(_tmpl$
|
|
558
|
+
return [_$ssr(_tmpl$11, _$ssrAttribute("id", _$escape(domId(), true), false), `k2b-app-workspace__sidebar ${_$escape(props.class ?? "", true)}`, _$ssrAttribute("aria-label", _$escape(props.label, true), false), _$ssrAttribute("hidden", props.hidden || undefined, true) + _$ssrAttribute("data-mobile", props.mobile === "stacked" ? "stacked" : _$escape(undefined, true), false) + _$ssrAttribute("data-workspace-resizable", resizable() ? "true" : "false", false) + _$ssrAttribute("data-workspace-collapsible", props.collapsible ? "true" : "false", false) + _$ssrAttribute("data-workspace-hideable", props.onHiddenChange ? "true" : _$escape(undefined, true), false), _$escape(_$createComponent(Show, {
|
|
423
559
|
get when() {
|
|
424
560
|
return !props.hidden;
|
|
425
561
|
},
|
|
426
562
|
get children() {
|
|
427
|
-
return _$ssr(_tmpl$
|
|
563
|
+
return _$ssr(_tmpl$10, _$escape(desktop()?.children));
|
|
428
564
|
}
|
|
429
565
|
}))), _$createComponent(Show, {
|
|
430
566
|
get when() {
|
|
@@ -477,7 +613,7 @@ const AppWorkspaceSidebarBody = props => {
|
|
|
477
613
|
get ["data-scroll-fade-mode"]() {
|
|
478
614
|
return props.scrollFade !== false ? "both" : undefined;
|
|
479
615
|
}
|
|
480
|
-
}, () => scrollAttrs(props.scrollPreserveKey), () => modeAttrs(props.sidebarMode)), _$escape(props.children), false), _$ssr(_tmpl$
|
|
616
|
+
}, () => scrollAttrs(props.scrollPreserveKey), () => modeAttrs(props.sidebarMode)), _$escape(props.children), false), _$ssr(_tmpl$12, SIDEBAR_SCROLL_MEMORY_SCRIPT)];
|
|
481
617
|
};
|
|
482
618
|
const AppWorkspaceSidebarFooter = props => _$ssrElement("footer", _$mergeProps({
|
|
483
619
|
get ["class"]() {
|
|
@@ -493,14 +629,14 @@ const AppWorkspaceSidebarSection = props => {
|
|
|
493
629
|
return props.icon;
|
|
494
630
|
},
|
|
495
631
|
get children() {
|
|
496
|
-
return _$ssr(_tmpl$
|
|
632
|
+
return _$ssr(_tmpl$13, _$ssrAttribute("class", _$escape(iconClass(props.icon), true), false));
|
|
497
633
|
}
|
|
498
634
|
}), props.title, _$createComponent(Show, {
|
|
499
635
|
get when() {
|
|
500
636
|
return props.count !== undefined;
|
|
501
637
|
},
|
|
502
638
|
get children() {
|
|
503
|
-
return _$ssr(_tmpl$
|
|
639
|
+
return _$ssr(_tmpl$14, _$escape(props.count));
|
|
504
640
|
}
|
|
505
641
|
})];
|
|
506
642
|
return _$ssrElement("section", _$mergeProps({
|
|
@@ -515,7 +651,7 @@ const AppWorkspaceSidebarSection = props => {
|
|
|
515
651
|
return props.title || props.actions;
|
|
516
652
|
},
|
|
517
653
|
get children() {
|
|
518
|
-
return _$ssr(_tmpl$
|
|
654
|
+
return _$ssr(_tmpl$17, _$escape(_$createComponent(Show, {
|
|
519
655
|
get when() {
|
|
520
656
|
return props.collapsible;
|
|
521
657
|
},
|
|
@@ -525,23 +661,23 @@ const AppWorkspaceSidebarSection = props => {
|
|
|
525
661
|
return props.title;
|
|
526
662
|
},
|
|
527
663
|
get children() {
|
|
528
|
-
return _$ssr(_tmpl$
|
|
664
|
+
return _$ssr(_tmpl$19, _$escape(title()));
|
|
529
665
|
}
|
|
530
666
|
});
|
|
531
667
|
},
|
|
532
668
|
get children() {
|
|
533
|
-
return _$ssr(_tmpl$
|
|
669
|
+
return _$ssr(_tmpl$15, _$ssrAttribute("aria-expanded", _$escape(open(), true), false) + _$ssrAttribute("aria-controls", _$escape(id, true), false), _$escape(title()), _$ssrAttribute("class", open() ? "ti ti-chevron-down" : "ti ti-chevron-right", false));
|
|
534
670
|
}
|
|
535
671
|
})), _$escape(_$createComponent(Show, {
|
|
536
672
|
get when() {
|
|
537
673
|
return props.actions;
|
|
538
674
|
},
|
|
539
675
|
get children() {
|
|
540
|
-
return _$ssr(_tmpl$
|
|
676
|
+
return _$ssr(_tmpl$16, _$escape(props.actions));
|
|
541
677
|
}
|
|
542
678
|
})));
|
|
543
679
|
}
|
|
544
|
-
})), _$ssr(_tmpl$
|
|
680
|
+
})), _$ssr(_tmpl$18, _$ssrAttribute("id", _$escape(id, true), false), _$ssrAttribute("hidden", !open(), true), _$escape(props.children))], false);
|
|
545
681
|
};
|
|
546
682
|
const AppWorkspaceSidebarItemIcon = props => mergeProps({
|
|
547
683
|
kind: SIDEBAR_ITEM_ICON
|
|
@@ -555,7 +691,7 @@ const AppWorkspaceSidebarItemMeta = props => mergeProps({
|
|
|
555
691
|
const AppWorkspaceSidebarItemAction = props => mergeProps({
|
|
556
692
|
kind: SIDEBAR_ITEM_ACTION
|
|
557
693
|
}, props);
|
|
558
|
-
const AppWorkspaceSidebarItemActions = props => _$ssr(_tmpl$
|
|
694
|
+
const AppWorkspaceSidebarItemActions = props => _$ssr(_tmpl$20, _$ssrAttribute("data-visibility", props.visibility === "hover" ? "hover" : _$escape(undefined, true), false), _$escape(props.children));
|
|
559
695
|
const AppWorkspaceSidebarItemStatus = props => {
|
|
560
696
|
const workspaceMessages = useWorkspaceMessages();
|
|
561
697
|
const waiting = () => props.waiting && Number.isFinite(props.waiting.count) ? Math.max(0, Math.floor(props.waiting.count)) : null;
|
|
@@ -571,7 +707,7 @@ const AppWorkspaceSidebarItemStatus = props => {
|
|
|
571
707
|
// The element itself stays when there is nothing to show: empty, it takes no
|
|
572
708
|
// space, and it still keeps the row's label on one line, so the first count
|
|
573
709
|
// never re-wraps the label and moves the rows below.
|
|
574
|
-
return _$ssr(_tmpl$
|
|
710
|
+
return _$ssr(_tmpl$26, _$ssrAttribute("data-unread", waiting() !== null ? _$escape(undefined, true) : count() ? "count" : dot() ? "dot" : _$escape(undefined, true), false) + _$ssrAttribute("data-waiting", waiting() === null ? _$escape(undefined, true) : waiting() ? "count" : "zero", false), _$escape(_$createComponent(Show, {
|
|
575
711
|
get when() {
|
|
576
712
|
return description();
|
|
577
713
|
},
|
|
@@ -581,16 +717,16 @@ const AppWorkspaceSidebarItemStatus = props => {
|
|
|
581
717
|
return props.mention;
|
|
582
718
|
},
|
|
583
719
|
get children() {
|
|
584
|
-
return _$ssr(_tmpl$
|
|
720
|
+
return _$ssr(_tmpl$21);
|
|
585
721
|
}
|
|
586
722
|
}), _$createComponent(Show, {
|
|
587
723
|
get when() {
|
|
588
724
|
return props.muted;
|
|
589
725
|
},
|
|
590
726
|
get children() {
|
|
591
|
-
return _$ssr(_tmpl$
|
|
727
|
+
return _$ssr(_tmpl$22);
|
|
592
728
|
}
|
|
593
|
-
}), _$ssr(_tmpl$
|
|
729
|
+
}), _$ssr(_tmpl$24, _$escape(_$createComponent(Show, {
|
|
594
730
|
get when() {
|
|
595
731
|
return count() || waiting() === 0;
|
|
596
732
|
},
|
|
@@ -600,14 +736,14 @@ const AppWorkspaceSidebarItemStatus = props => {
|
|
|
600
736
|
return dot();
|
|
601
737
|
},
|
|
602
738
|
get children() {
|
|
603
|
-
return _$ssr(_tmpl$
|
|
739
|
+
return _$ssr(_tmpl$27);
|
|
604
740
|
}
|
|
605
741
|
});
|
|
606
742
|
},
|
|
607
743
|
get children() {
|
|
608
|
-
return _$ssr(_tmpl$
|
|
744
|
+
return _$ssr(_tmpl$23, _$ssrAttribute("data-mention", props.mention ? "true" : _$escape(undefined, true), false), count() > 99 ? "99+" : _$escape(count()));
|
|
609
745
|
}
|
|
610
|
-
}))), _$ssr(_tmpl$
|
|
746
|
+
}))), _$ssr(_tmpl$25, _$escape(description()))];
|
|
611
747
|
}
|
|
612
748
|
})));
|
|
613
749
|
};
|
|
@@ -747,19 +883,19 @@ function AppWorkspaceSidebarItem(props) {
|
|
|
747
883
|
return iconContent() || icon();
|
|
748
884
|
},
|
|
749
885
|
get children() {
|
|
750
|
-
return _$ssr(_tmpl$
|
|
886
|
+
return _$ssr(_tmpl$28, _$escape(iconContent() ?? _$ssr(_tmpl$34, _$ssrAttribute("class", _$escape(iconClass(icon()), true), false))));
|
|
751
887
|
}
|
|
752
|
-
}), _$ssr(_tmpl$
|
|
888
|
+
}), _$ssr(_tmpl$32, _$escape(_$createComponent(Show, {
|
|
753
889
|
get when() {
|
|
754
890
|
return props.context || props.contextMeta;
|
|
755
891
|
},
|
|
756
892
|
get children() {
|
|
757
|
-
return _$ssr(_tmpl$
|
|
893
|
+
return _$ssr(_tmpl$30, _$escape(props.context), _$escape(_$createComponent(Show, {
|
|
758
894
|
get when() {
|
|
759
895
|
return props.contextMeta;
|
|
760
896
|
},
|
|
761
897
|
get children() {
|
|
762
|
-
return _$ssr(_tmpl$
|
|
898
|
+
return _$ssr(_tmpl$29, _$escape(props.contextMeta));
|
|
763
899
|
}
|
|
764
900
|
})));
|
|
765
901
|
}
|
|
@@ -768,14 +904,14 @@ function AppWorkspaceSidebarItem(props) {
|
|
|
768
904
|
return props.description;
|
|
769
905
|
},
|
|
770
906
|
get children() {
|
|
771
|
-
return _$ssr(_tmpl$
|
|
907
|
+
return _$ssr(_tmpl$31, _$escape(props.description));
|
|
772
908
|
}
|
|
773
909
|
}))), _$createComponent(Show, {
|
|
774
910
|
get when() {
|
|
775
911
|
return hasMeta();
|
|
776
912
|
},
|
|
777
913
|
get children() {
|
|
778
|
-
return _$ssr(_tmpl$
|
|
914
|
+
return _$ssr(_tmpl$33, _$ssrAttribute("id", props.preview?.trigger === "row" ? _$escape(metaId, true) : _$escape(undefined, true), false) + _$ssrAttribute("data-visibility", metaVisibility() === "hover" ? "hover" : _$escape(undefined, true), false), _$escape(meta()));
|
|
779
915
|
}
|
|
780
916
|
})];
|
|
781
917
|
const singleAction = () => {
|
|
@@ -790,7 +926,7 @@ function AppWorkspaceSidebarItem(props) {
|
|
|
790
926
|
actionSlot()?.onSelect?.(event);
|
|
791
927
|
props.onActionClick?.(event);
|
|
792
928
|
};
|
|
793
|
-
const content = () => actionSlot()?.children ?? _$ssr(_tmpl$
|
|
929
|
+
const content = () => actionSlot()?.children ?? _$ssr(_tmpl$34, _$ssrAttribute("class", _$escape(iconClass(actionSlot()?.icon ?? props.actionIcon, "ti-dots"), true), false));
|
|
794
930
|
return _$createComponent(Show, {
|
|
795
931
|
get when() {
|
|
796
932
|
return Boolean(actionSlot() || props.actionIcon);
|
|
@@ -801,10 +937,10 @@ function AppWorkspaceSidebarItem(props) {
|
|
|
801
937
|
return _$memo(() => !!actionSlot()?.href)() && !actionSlot()?.disabled;
|
|
802
938
|
},
|
|
803
939
|
get fallback() {
|
|
804
|
-
return _$ssr(_tmpl$
|
|
940
|
+
return _$ssr(_tmpl$36, _$ssrAttribute("disabled", actionSlot()?.disabled, true) + _$ssrAttribute("data-visibility", actionSlot()?.visibility === "hover" ? "hover" : _$escape(undefined, true), false) + _$ssrAttribute("aria-label", _$escape(label(), true), false), _$escape(content()));
|
|
805
941
|
},
|
|
806
942
|
get children() {
|
|
807
|
-
return _$ssr(_tmpl$
|
|
943
|
+
return _$ssr(_tmpl$35, _$ssrAttribute("href", _$escape(actionSlot()?.href, true), false), _$ssrAttribute("data-visibility", actionSlot()?.visibility === "hover" ? "hover" : _$escape(undefined, true), false) + _$ssrAttribute("aria-label", _$escape(label(), true), false), _$escape(content()));
|
|
808
944
|
}
|
|
809
945
|
});
|
|
810
946
|
}
|
|
@@ -1110,31 +1246,31 @@ const AppWorkspaceNavTree = props => {
|
|
|
1110
1246
|
get ["data-k2b-nav-tree-toggle"]() {
|
|
1111
1247
|
return usesIconDisclosure() ? "" : undefined;
|
|
1112
1248
|
}
|
|
1113
|
-
}, () => iconAccessibility(item.iconLabel)), _$ssr(_tmpl$
|
|
1249
|
+
}, () => iconAccessibility(item.iconLabel)), _$ssr(_tmpl$34, _$ssrAttribute("class", _$escape(iconClass(rowIcon()), true), false)), false);
|
|
1114
1250
|
}
|
|
1115
1251
|
}), _$createComponent(Show, {
|
|
1116
1252
|
get when() {
|
|
1117
1253
|
return item.description !== undefined;
|
|
1118
1254
|
},
|
|
1119
1255
|
get fallback() {
|
|
1120
|
-
return _$ssr(_tmpl$
|
|
1256
|
+
return _$ssr(_tmpl$40, _$ssrAttribute("data-label", typeof item.label === "string" ? _$escape(item.label, true) : _$escape(undefined, true), false), _$escape(item.label));
|
|
1121
1257
|
},
|
|
1122
1258
|
get children() {
|
|
1123
|
-
return _$ssr(_tmpl$
|
|
1259
|
+
return _$ssr(_tmpl$37, _$ssrAttribute("data-label", typeof item.label === "string" ? _$escape(item.label, true) : _$escape(undefined, true), false), _$escape(item.label), _$escape(item.description));
|
|
1124
1260
|
}
|
|
1125
1261
|
}), _$createComponent(Show, {
|
|
1126
1262
|
get when() {
|
|
1127
1263
|
return item.meta !== undefined;
|
|
1128
1264
|
},
|
|
1129
1265
|
get children() {
|
|
1130
|
-
return _$ssr(_tmpl$
|
|
1266
|
+
return _$ssr(_tmpl$38, `k2b-app-workspace__sidebar-item-meta ${hasChildren() ? "" : "k2b-app-workspace__nav-tree-leaf-meta"}`, _$ssrAttribute("data-visibility", item.metaVisibility === "hover" ? "hover" : _$escape(undefined, true), false), _$escape(item.meta));
|
|
1131
1267
|
}
|
|
1132
1268
|
}), _$createComponent(Show, {
|
|
1133
1269
|
get when() {
|
|
1134
1270
|
return _$memo(() => !!hasChildren())() && !usesIconDisclosure();
|
|
1135
1271
|
},
|
|
1136
1272
|
get children() {
|
|
1137
|
-
return _$ssr(_tmpl$
|
|
1273
|
+
return _$ssr(_tmpl$39, `ti ${isExpanded(item.id) ? "ti-chevron-down" : "ti-chevron-right"}`);
|
|
1138
1274
|
}
|
|
1139
1275
|
})];
|
|
1140
1276
|
const row = () => _$createComponent(AppWorkspaceSidebarRow, {
|
|
@@ -1241,12 +1377,12 @@ const AppWorkspaceNavTree = props => {
|
|
|
1241
1377
|
endDrag();
|
|
1242
1378
|
requestMove(target.move, false);
|
|
1243
1379
|
};
|
|
1244
|
-
return _$ssr(_tmpl$
|
|
1380
|
+
return _$ssr(_tmpl$42, _$ssrAttribute("aria-level", _$escape(depth, true) + 1, false) + _$ssrAttribute("aria-setsize", _$escape(siblings().length, true), false) + _$ssrAttribute("aria-posinset", _$escape(place(), true) + 1, false) + _$ssrAttribute("aria-selected", _$escape(selected(), true), false) + _$ssrAttribute("aria-expanded", hasChildren() ? _$escape(isExpanded(item.id), true) : _$escape(undefined, true), false) + _$ssrAttribute("aria-disabled", item.disabled ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("tabindex", item.disabled ? -1 : tabStopId() === item.id ? 0 : -1, false) + _$ssrAttribute("draggable", movable() ? _$escape(true, true) : _$escape(undefined, true), false) + _$ssrAttribute("data-k2b-nav-tree-id", _$escape(item.id, true), false) + _$ssrAttribute("data-k2b-nav-tree-parent-id", _$escape(parentId, true), false) + _$ssrAttribute("data-k2b-nav-tree-dragging", dragged()?.id === item.id ? "" : _$escape(undefined, true), false) + _$ssrAttribute("data-k2b-nav-tree-drop", dropTarget()?.id === item.id ? _$escape(dropTarget().side, true) : _$escape(undefined, true), false), _$ssrStyleProperty("--k2b-nav-tree-depth:", _$escape(String(props.indented === false ? 0 : depth), true)), _$escape(row()), _$escape(_$createComponent(Show, {
|
|
1245
1381
|
get when() {
|
|
1246
1382
|
return _$memo(() => !!hasChildren())() && isExpanded(item.id);
|
|
1247
1383
|
},
|
|
1248
1384
|
get children() {
|
|
1249
|
-
return _$ssr(_tmpl$
|
|
1385
|
+
return _$ssr(_tmpl$41, _$escape(renderItems(nested, depth + 1, item.id)));
|
|
1250
1386
|
}
|
|
1251
1387
|
})));
|
|
1252
1388
|
}
|
|
@@ -1271,7 +1407,7 @@ const AppWorkspaceNavTree = props => {
|
|
|
1271
1407
|
doc?.removeEventListener("pointermove", forgetDrag, true);
|
|
1272
1408
|
});
|
|
1273
1409
|
});
|
|
1274
|
-
return _$ssr(_tmpl$
|
|
1410
|
+
return _$ssr(_tmpl$43, `k2b-app-workspace__nav-tree ${_$escape(props.class ?? "", true)}`, _$ssrAttribute("aria-label", _$escape(props.ariaLabel, true), false), _$escape(renderItems(roots, 0)));
|
|
1275
1411
|
};
|
|
1276
1412
|
AppWorkspaceNavTree.Item = AppWorkspaceNavTreeItem;
|
|
1277
1413
|
const AppWorkspaceSidebarIconGrid = props => _$ssrElement("section", _$mergeProps({
|
|
@@ -1282,10 +1418,10 @@ const AppWorkspaceSidebarIconGrid = props => _$ssrElement("section", _$mergeProp
|
|
|
1282
1418
|
get when() {
|
|
1283
1419
|
return props.title;
|
|
1284
1420
|
},
|
|
1285
|
-
children: title => _$ssr(_tmpl$
|
|
1286
|
-
})), _$ssr(_tmpl$
|
|
1421
|
+
children: title => _$ssr(_tmpl$19, _$escape(title()))
|
|
1422
|
+
})), _$ssr(_tmpl$44, _$ssrAttribute("data-columns", _$escape(props.columns ?? 2, true), false), _$escape(props.children))], false);
|
|
1287
1423
|
const AppWorkspaceSidebarIconAction = props => {
|
|
1288
|
-
const content = _$ssr(_tmpl$
|
|
1424
|
+
const content = _$ssr(_tmpl$45, _$ssrAttribute("class", _$escape(iconClass(props.icon), true), false));
|
|
1289
1425
|
const attrs = () => ({
|
|
1290
1426
|
class: `k2b-app-workspace__sidebar-icon-action ${props.active ? "is-active" : ""}`,
|
|
1291
1427
|
title: props.label,
|
|
@@ -1343,7 +1479,7 @@ function AppWorkspaceHead(props) {
|
|
|
1343
1479
|
const messages = useWorkspaceMessages();
|
|
1344
1480
|
// A nested workspace is part of a page that already shows its title.
|
|
1345
1481
|
const trail = props.nested ? () => undefined : usePageTrail();
|
|
1346
|
-
return _$ssr(_tmpl$
|
|
1482
|
+
return _$ssr(_tmpl$47, _$ssrAttribute("data-trail", trail()?.ancestors.length ? "up" : trail() ? "title" : _$escape(undefined, true), false), _$escape(_$createComponent(IconButton, {
|
|
1347
1483
|
"class": "k2b-app-workspace__head-toggle",
|
|
1348
1484
|
get label() {
|
|
1349
1485
|
return messages().showNavigation;
|
|
@@ -1354,7 +1490,7 @@ function AppWorkspaceHead(props) {
|
|
|
1354
1490
|
"aria-expanded": "false",
|
|
1355
1491
|
"data-app-workspace-sidebar-toggle": "",
|
|
1356
1492
|
get children() {
|
|
1357
|
-
return _$ssr(_tmpl$
|
|
1493
|
+
return _$ssr(_tmpl$46);
|
|
1358
1494
|
}
|
|
1359
1495
|
})), _$escape(_$createComponent(Show, {
|
|
1360
1496
|
get when() {
|
|
@@ -1366,7 +1502,7 @@ function AppWorkspaceHead(props) {
|
|
|
1366
1502
|
},
|
|
1367
1503
|
as: "p",
|
|
1368
1504
|
fallback: true
|
|
1369
|
-
}), _$ssr(_tmpl$
|
|
1505
|
+
}), _$ssr(_tmpl$48, _$ssrAttribute("data-k2b-server", isServer ? "" : _$escape(undefined, true), false), _$escape(current().title))]
|
|
1370
1506
|
})));
|
|
1371
1507
|
}
|
|
1372
1508
|
const AppWorkspace = props => {
|
|
@@ -1374,11 +1510,12 @@ const AppWorkspace = props => {
|
|
|
1374
1510
|
const serverLayoutState = useContext(LayoutStateContext);
|
|
1375
1511
|
const nested = Boolean(useContext(WorkspaceContext));
|
|
1376
1512
|
const [sidebarId, setSidebarId] = createSignal(`k2b-workspace-sidebar-${createUniqueId()}`);
|
|
1513
|
+
const initialLayoutState = () => props.layoutState?.() ?? serverLayoutState;
|
|
1377
1514
|
const workspace = {
|
|
1378
1515
|
sidebarId: sidebarId(),
|
|
1379
|
-
setSidebarId
|
|
1516
|
+
setSidebarId,
|
|
1517
|
+
initialLayoutState
|
|
1380
1518
|
};
|
|
1381
|
-
const initialLayoutState = () => props.layoutState?.() ?? serverLayoutState;
|
|
1382
1519
|
|
|
1383
1520
|
// The resize handles are inert markup until the controller is attached, so
|
|
1384
1521
|
// the workspace attaches it itself and scopes it to this root. `onMount`
|
|
@@ -1401,7 +1538,7 @@ const AppWorkspace = props => {
|
|
|
1401
1538
|
return _$createComponent(WorkspaceContext.Provider, {
|
|
1402
1539
|
value: workspace,
|
|
1403
1540
|
get children() {
|
|
1404
|
-
return _$ssr(_tmpl$
|
|
1541
|
+
return _$ssr(_tmpl$49, `k2b-app-workspace ${_$escape(props.class ?? "", true)}`, _$ssrAttribute("data-mobile-surface", _$escape(props.mobileSurface, true), false) + _$ssrAttribute("data-flat", props.flat ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("data-sidebar-collapsed", initialLayoutState()?.sidebarCollapsed === undefined ? _$escape(undefined, true) : _$escape(String(initialLayoutState()?.sidebarCollapsed), true), false) + _$ssrAttribute("data-workspace-resizable", props.resizable === false ? "false" : "true", false), _$ssrStyle(appWorkspaceLayoutStyle(initialLayoutState())), _$escape(_$createComponent(AppWorkspaceHead, {
|
|
1405
1542
|
sidebarId: sidebarId,
|
|
1406
1543
|
nested: nested
|
|
1407
1544
|
})), _$escape(props.children));
|
|
@@ -1418,7 +1555,7 @@ AppWorkspace.LayoutStateProvider = props => _$createComponent(LayoutStateContext
|
|
|
1418
1555
|
return props.children;
|
|
1419
1556
|
}
|
|
1420
1557
|
});
|
|
1421
|
-
AppWorkspace.Content = props => _$ssr(_tmpl$
|
|
1558
|
+
AppWorkspace.Content = props => _$ssr(_tmpl$50, `k2b-app-workspace__content ${_$escape(props.class ?? "", true)}`, _$escape(props.children));
|
|
1422
1559
|
AppWorkspace.Main = AppWorkspaceMain;
|
|
1423
1560
|
AppWorkspace.MainPane = AppWorkspaceMainPane;
|
|
1424
1561
|
AppWorkspace.Detail = AppWorkspaceDetail;
|