@esportsplus/ui 0.66.0 → 0.67.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/build/components/button/scss/index.scss +1 -1
- package/build/components/card/scss/index.scss +1 -1
- package/build/components/checkbox/scss/index.scss +1 -1
- package/build/components/color-picker/scss/index.scss +1 -1
- package/build/components/command/scss/index.scss +1 -1
- package/build/components/group/scss/index.scss +1 -1
- package/build/components/highlight/scss/index.scss +1 -1
- package/build/components/image/scss/index.scss +1 -1
- package/build/components/inline-edit/scss/index.scss +1 -1
- package/build/components/overlay/scss/index.scss +1 -1
- package/build/components/pagination/scss/index.scss +1 -1
- package/build/components/range/scss/index.scss +1 -1
- package/build/components/search/scss/index.scss +1 -1
- package/build/components/select/scss/index.scss +1 -1
- package/build/components/shell/group.js +2 -2
- package/build/components/shell/index.d.ts +2 -2
- package/build/components/shell/index.js +109 -74
- package/build/components/shell/model.d.ts +11 -4
- package/build/components/shell/model.js +39 -10
- package/build/components/shell/scss/index.scss +1 -1
- package/build/components/sortable/index.d.ts +2 -1
- package/build/components/sortable/index.js +3 -2
- package/build/components/sortable/scss/index.scss +1 -1
- package/build/components/theme/scss/index.scss +1 -1
- package/build/components/toast/scss/index.scss +1 -1
- package/build/components/toolbar/scss/index.scss +1 -1
- package/build/components/tooltip/scss/index.scss +1 -1
- package/build/components/uptime/scss/index.scss +1 -1
- package/package.json +1 -1
- package/src/components/shell/group.ts +2 -2
- package/src/components/shell/index.ts +34 -12
- package/src/components/shell/model.ts +76 -14
- package/src/components/sortable/index.ts +7 -2
- package/src/tokens/scss/color.scss +2 -2
|
@@ -2,7 +2,7 @@ import * as template_u1 from '@esportsplus/template';
|
|
|
2
2
|
import { type Attributes, type Renderable } from '@esportsplus/template';
|
|
3
3
|
import type { Options as Scrollbar } from '../../modifiers/scrollbar/index.js';
|
|
4
4
|
import { type Catalog, type Kind } from './group.js';
|
|
5
|
-
import state, { type Layout, type Node, type Placement, type Saved, type Store, type Surface } from './model.js';
|
|
5
|
+
import state, { type Layout, type Node, type Placement, type Saved, type Sharing, type Store, type Surface } from './model.js';
|
|
6
6
|
import { type Edge, type Options } from './sidebar.js';
|
|
7
7
|
import './scss/index.scss';
|
|
8
8
|
type A = Attributes & {
|
|
@@ -22,4 +22,4 @@ declare const layout: typeof shell & {
|
|
|
22
22
|
state: typeof state;
|
|
23
23
|
};
|
|
24
24
|
export default layout;
|
|
25
|
-
export type { Catalog, Kind, Layout, Node, Placement, Saved, Store, Surface };
|
|
25
|
+
export type { Catalog, Kind, Layout, Node, Placement, Saved, Sharing, Store, Surface };
|
|
@@ -13,16 +13,16 @@ import { frame, grip, resizer, sidebar, toggle } from './sidebar.js';
|
|
|
13
13
|
import subtree from './subtree.js';
|
|
14
14
|
import './scss/index.scss';
|
|
15
15
|
const template_1dhwcf35 = template_u1.template(`<!--$--><!--$-->`);
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
16
|
+
const template_1dhwcf39 = template_u1.template(`<div aria-hidden='true' data-placement='bottom'>`, true);
|
|
17
|
+
const template_1dhwcf3b = template_u1.template(`<div aria-hidden='true' data-placement='left'>`, true);
|
|
18
|
+
const template_1dhwcf3d = template_u1.template(`<div aria-hidden='true' data-placement='right'>`, true);
|
|
19
|
+
const template_1dhwcf3f = template_u1.template(`<div aria-hidden='true'>`, true);
|
|
20
|
+
const template_1dhwcf3h = template_u1.template(`<div>`, true);
|
|
21
|
+
const template_1dhwcf3k = template_u1.template(`<div></div><!--$-->`);
|
|
22
|
+
const template_1dhwcf3o = template_u1.template(`<div class='shell-frame'><!--$--><div class='shell-center'><div class='shell-main'></div></div></div><!--$-->`);
|
|
23
|
+
const template_1dhwcf3v = template_u1.template(`<!--$--><!--$--><!--$--><!--$-->`);
|
|
24
|
+
const template_1dhwcf311 = template_u1.template(`<!--$--><div>`);
|
|
25
|
+
const template_1dhwcf315 = template_u1.template(`<div><div></div><!--$--><!--$-->`, true);
|
|
26
26
|
class ReactiveObject_1dhwcf30 extends reactivity_u0.ReactiveObject {
|
|
27
27
|
#active = this[reactivity_u0.SIGNAL](false);
|
|
28
28
|
constructor() {
|
|
@@ -157,12 +157,14 @@ function structure(node) {
|
|
|
157
157
|
}
|
|
158
158
|
return [node.id, node.direction, node.children.map(structure)];
|
|
159
159
|
}
|
|
160
|
-
function target(workspace, x, y) {
|
|
160
|
+
function target(workspace, x, y, allowed) {
|
|
161
161
|
let elements = document.elementsFromPoint(x, y).filter((element) => element.closest('.shell') === workspace), dock = elements.find((element) => element.matches('.shell-dock-target')), section = elements.find((element) => element.matches('.shell-group'));
|
|
162
162
|
if (dock) {
|
|
163
163
|
return dock;
|
|
164
164
|
}
|
|
165
|
-
if (!section ||
|
|
165
|
+
if (!section ||
|
|
166
|
+
!allowed(section.dataset.group ?? '') ||
|
|
167
|
+
y <= (section.querySelector(':scope > .shell-header')?.getBoundingClientRect().bottom ?? -Infinity)) {
|
|
166
168
|
return null;
|
|
167
169
|
}
|
|
168
170
|
let { height, left, top, width } = section.getBoundingClientRect(), across = width <= 0 ? 0.5 : (x - left) / width, down = height <= 0 ? 0.5 : (y - top) / height, side = [['left', across], ['right', 1 - across], ['top', down], ['bottom', 1 - down]]
|
|
@@ -174,7 +176,7 @@ function under(workspace, x, y) {
|
|
|
174
176
|
return found?.dataset.group;
|
|
175
177
|
}
|
|
176
178
|
const shell = component(function ({ catalog, empty, icons = false, narrow: breakpoint = NARROW, sidebars: options = {}, state, tabs = {}, ...attributes }) {
|
|
177
|
-
let adding, added = new ReactiveObject_1dhwcf30(), apple = mac(), carrying = signal(
|
|
179
|
+
let adding, added = new ReactiveObject_1dhwcf30(), apple = mac(), carrying = signal(null), controller, frames = { left: frame(), right: frame() }, hosts = new Map(), landing = null, parking, picks = signal([]), regions = {}, size = new ReactiveObject_1dhwcf31(), slots = new Map(), strips = new WeakMap(), subject = new ReactiveObject_1dhwcf32(), switching, unobserve, workspace;
|
|
178
180
|
let narrow = () => size.width > 0 && size.width <= breakpoint;
|
|
179
181
|
let edges = {
|
|
180
182
|
frames,
|
|
@@ -195,6 +197,10 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
|
|
|
195
197
|
state.split(surface.id, group, direction, side);
|
|
196
198
|
}
|
|
197
199
|
}
|
|
200
|
+
function shares(surface, group) {
|
|
201
|
+
let found = findGroup(state.layout.root, group);
|
|
202
|
+
return found !== null && state.shares(surface.id, found.placement);
|
|
203
|
+
}
|
|
198
204
|
function holds(group, kind) {
|
|
199
205
|
return !catalog[kind]?.multiple && !!findGroup(state.layout.root, group)?.surfaces.some((surface) => surface.kind === kind);
|
|
200
206
|
}
|
|
@@ -211,7 +217,7 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
|
|
|
211
217
|
n++;
|
|
212
218
|
}
|
|
213
219
|
}
|
|
214
|
-
state.open({ id, kind }, group);
|
|
220
|
+
state.open({ id, kind }, group, group === undefined);
|
|
215
221
|
},
|
|
216
222
|
addable: Object.entries(catalog).filter(([, entry]) => entry.addable !== false),
|
|
217
223
|
adding: (group) => added.active && subject.group === group,
|
|
@@ -250,31 +256,32 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
|
|
|
250
256
|
picked: (group) => read(picks).includes(group),
|
|
251
257
|
scrollbar: { hidden: true, ...tabs.scrollbar, horizontal: true },
|
|
252
258
|
slot: (surface) => {
|
|
253
|
-
let
|
|
254
|
-
template_u1.onconnect(
|
|
259
|
+
let root_1dhwcf3g = template_1dhwcf3h();
|
|
260
|
+
template_u1.onconnect(root_1dhwcf3g, (element) => {
|
|
255
261
|
slots.set(surface, element);
|
|
256
262
|
attach(surface, element);
|
|
257
263
|
});
|
|
258
|
-
template_u1.ondisconnect(
|
|
264
|
+
template_u1.ondisconnect(root_1dhwcf3g, () => {
|
|
259
265
|
if (slots.get(surface)?.isConnected === false) {
|
|
260
266
|
slots.delete(surface);
|
|
261
267
|
}
|
|
262
268
|
});
|
|
263
|
-
template_u1.setClass(
|
|
264
|
-
return
|
|
269
|
+
template_u1.setClass(root_1dhwcf3g, ["shell-slot"]);
|
|
270
|
+
return root_1dhwcf3g;
|
|
265
271
|
},
|
|
266
272
|
sorting(strip, group) {
|
|
267
273
|
strips.set(strip, group);
|
|
268
274
|
return {
|
|
275
|
+
accepts: (surface) => shares(surface, strips.get(strip) ?? ''),
|
|
269
276
|
disabled: (surface) => surface.sortable === false,
|
|
270
277
|
group: edges.id,
|
|
271
278
|
onland: () => {
|
|
272
279
|
let land = landing;
|
|
273
280
|
landing = null;
|
|
274
|
-
write(carrying,
|
|
281
|
+
write(carrying, null);
|
|
275
282
|
land?.();
|
|
276
283
|
},
|
|
277
|
-
onlift: () => write(carrying,
|
|
284
|
+
onlift: (surface) => write(carrying, surface),
|
|
278
285
|
onsort: (surface, _, to, __, target) => {
|
|
279
286
|
let group = strips.get(target);
|
|
280
287
|
landing = group ? () => state.move(surface.id, group, to) : null;
|
|
@@ -288,7 +295,7 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
|
|
|
288
295
|
}
|
|
289
296
|
};
|
|
290
297
|
},
|
|
291
|
-
over: (
|
|
298
|
+
over: (surface, x, y) => workspace ? target(workspace, x, y, (group) => shares(surface, group)) : null
|
|
292
299
|
}
|
|
293
300
|
};
|
|
294
301
|
},
|
|
@@ -435,16 +442,16 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
|
|
|
435
442
|
return current.sizes;
|
|
436
443
|
}
|
|
437
444
|
{
|
|
438
|
-
let
|
|
439
|
-
template_u1.slot(
|
|
440
|
-
let
|
|
441
|
-
template_u1.slot(
|
|
442
|
-
template_u1.slot(
|
|
445
|
+
let root_1dhwcf3i = template_1dhwcf3h();
|
|
446
|
+
template_u1.slot(root_1dhwcf3i, current.children.map((child, index) => {
|
|
447
|
+
let root_1dhwcf3j = template_1dhwcf3k(), element_1dhwcf3l = root_1dhwcf3j.firstChild, element_1dhwcf3m = element_1dhwcf3l.nextSibling;
|
|
448
|
+
template_u1.slot(element_1dhwcf3l, node(child), 1);
|
|
449
|
+
template_u1.slot(element_1dhwcf3m, index < current.children.length - 1 && separator(axis, () => {
|
|
443
450
|
let from = sizes(), length = box.length;
|
|
444
451
|
return (delta) => state.resize(current.id, resized(from, index, delta, length, MIN_FRACTION), current.children.map((child) => child.id));
|
|
445
452
|
}));
|
|
446
|
-
template_u1.setClass(
|
|
447
|
-
template_u1.setStyle(
|
|
453
|
+
template_u1.setClass(element_1dhwcf3l, ["shell-pane", () => state.layout.main !== null && contains(child, state.layout.main) && 'shell-pane--current']);
|
|
454
|
+
template_u1.setStyle(element_1dhwcf3l, ["", () => {
|
|
448
455
|
let maximized = state.layout.maximized;
|
|
449
456
|
if (maximized === null || !contains(current, maximized)) {
|
|
450
457
|
return `--flex: 0 0 ${(sizes()[index] ?? 0) * 100}%;`;
|
|
@@ -453,16 +460,16 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
|
|
|
453
460
|
? `--flex: 0 0 calc(100% - ${(current.children.length - 1) * COLLAPSED}px);`
|
|
454
461
|
: `--flex: 0 0 ${COLLAPSED}px;`;
|
|
455
462
|
}]);
|
|
456
|
-
return
|
|
463
|
+
return root_1dhwcf3j;
|
|
457
464
|
}), 1);
|
|
458
|
-
template_u1.onconnect(
|
|
465
|
+
template_u1.onconnect(root_1dhwcf3i, (element) => {
|
|
459
466
|
unobserve = observe(element, ([entry]) => {
|
|
460
467
|
box.length = axis === 'x' ? entry.contentRect.width : entry.contentRect.height;
|
|
461
468
|
});
|
|
462
469
|
});
|
|
463
|
-
template_u1.ondisconnect(
|
|
464
|
-
template_u1.setClass(
|
|
465
|
-
return
|
|
470
|
+
template_u1.ondisconnect(root_1dhwcf3i, () => unobserve?.());
|
|
471
|
+
template_u1.setClass(root_1dhwcf3i, ["shell-split", "shell-split--" + (current.direction)]);
|
|
472
|
+
return root_1dhwcf3i;
|
|
466
473
|
}
|
|
467
474
|
}
|
|
468
475
|
function switcher(main) {
|
|
@@ -507,39 +514,67 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
|
|
|
507
514
|
function targets() {
|
|
508
515
|
return ['bottom', 'left', 'right']
|
|
509
516
|
.filter((placement) => placement === 'bottom' || !stationary(state.layout.root, placement))
|
|
510
|
-
.map((placement) => (placement === "bottom" ?
|
|
511
|
-
let
|
|
512
|
-
template_u1.setProperty(
|
|
513
|
-
|
|
514
|
-
|
|
517
|
+
.map((placement) => (placement === "bottom" ? (() => {
|
|
518
|
+
let root_1dhwcf38 = template_1dhwcf39();
|
|
519
|
+
template_u1.setProperty(root_1dhwcf38, 'hidden', () => {
|
|
520
|
+
let surface = read(carrying);
|
|
521
|
+
return surface !== null && !state.shares(surface.id, placement);
|
|
522
|
+
});
|
|
523
|
+
template_u1.setClass(root_1dhwcf38, ["shell-dock-target shell-dock-target--bottom"]);
|
|
524
|
+
return root_1dhwcf38;
|
|
525
|
+
})() : placement === "left" ? (() => {
|
|
526
|
+
let root_1dhwcf3a = template_1dhwcf3b();
|
|
527
|
+
template_u1.setProperty(root_1dhwcf3a, 'hidden', () => {
|
|
528
|
+
let surface = read(carrying);
|
|
529
|
+
return surface !== null && !state.shares(surface.id, placement);
|
|
530
|
+
});
|
|
531
|
+
template_u1.setClass(root_1dhwcf3a, ["shell-dock-target shell-dock-target--left"]);
|
|
532
|
+
return root_1dhwcf3a;
|
|
533
|
+
})() : placement === "right" ? (() => {
|
|
534
|
+
let root_1dhwcf3c = template_1dhwcf3d();
|
|
535
|
+
template_u1.setProperty(root_1dhwcf3c, 'hidden', () => {
|
|
536
|
+
let surface = read(carrying);
|
|
537
|
+
return surface !== null && !state.shares(surface.id, placement);
|
|
538
|
+
});
|
|
539
|
+
template_u1.setClass(root_1dhwcf3c, ["shell-dock-target shell-dock-target--right"]);
|
|
540
|
+
return root_1dhwcf3c;
|
|
541
|
+
})() : (() => {
|
|
542
|
+
let root_1dhwcf3e = template_1dhwcf3f();
|
|
543
|
+
template_u1.setProperty(root_1dhwcf3e, 'data-placement', placement);
|
|
544
|
+
template_u1.setProperty(root_1dhwcf3e, 'hidden', () => {
|
|
545
|
+
let surface = read(carrying);
|
|
546
|
+
return surface !== null && !state.shares(surface.id, placement);
|
|
547
|
+
});
|
|
548
|
+
template_u1.setClass(root_1dhwcf3e, ["shell-dock-target", "shell-dock-target--" + (placement)]);
|
|
549
|
+
return root_1dhwcf3e;
|
|
515
550
|
})()));
|
|
516
551
|
}
|
|
517
552
|
function tree() {
|
|
518
553
|
let trees = shown(state.layout);
|
|
519
554
|
{
|
|
520
|
-
let
|
|
521
|
-
template_u1.slot(
|
|
522
|
-
let
|
|
523
|
-
template_u1.slot(
|
|
524
|
-
template_u1.slot(
|
|
525
|
-
template_u1.slot(
|
|
526
|
-
template_u1.slot(
|
|
527
|
-
return
|
|
555
|
+
let root_1dhwcf3n = template_1dhwcf3o(), element_1dhwcf3p = root_1dhwcf3n.firstChild, element_1dhwcf3q = element_1dhwcf3p.firstChild, element_1dhwcf3r = element_1dhwcf3p.firstElementChild.firstElementChild, element_1dhwcf3s = element_1dhwcf3p.firstElementChild, element_1dhwcf3t = element_1dhwcf3p.nextSibling;
|
|
556
|
+
template_u1.slot(element_1dhwcf3q, ['left', 'right'].map((edge) => (trees[edge] || options[edge]) && (() => {
|
|
557
|
+
let root_1dhwcf3u = template_1dhwcf3v(), element_1dhwcf3w = root_1dhwcf3u.firstChild, element_1dhwcf3x = element_1dhwcf3w.nextSibling, element_1dhwcf3y = element_1dhwcf3x.nextSibling, element_1dhwcf3z = element_1dhwcf3y.nextSibling;
|
|
558
|
+
template_u1.slot(element_1dhwcf3w, sidebar(edges, edge, region(edge)));
|
|
559
|
+
template_u1.slot(element_1dhwcf3x, grip(edges, edge));
|
|
560
|
+
template_u1.slot(element_1dhwcf3y, options[edge]?.resizable && resizer(edges, edge));
|
|
561
|
+
template_u1.slot(element_1dhwcf3z, toggle(edges, edge));
|
|
562
|
+
return root_1dhwcf3u;
|
|
528
563
|
})()));
|
|
529
|
-
template_u1.slot(
|
|
530
|
-
template_u1.slot(
|
|
531
|
-
let
|
|
532
|
-
template_u1.slot(
|
|
564
|
+
template_u1.slot(element_1dhwcf3r, region('main'), 1);
|
|
565
|
+
template_u1.slot(element_1dhwcf3s, trees.bottom && (() => {
|
|
566
|
+
let root_1dhwcf310 = template_1dhwcf311(), element_1dhwcf312 = root_1dhwcf310.firstChild, element_1dhwcf313 = element_1dhwcf312.nextSibling;
|
|
567
|
+
template_u1.slot(element_1dhwcf312, separator('y', () => {
|
|
533
568
|
let share = bounded(state.layout.bottom.size), length = size.height;
|
|
534
569
|
return (delta) => state.resizeDock('bottom', resized([1 - share, share], 0, delta, length, MIN_FRACTION)[1]);
|
|
535
570
|
}, { hidden: () => state.layout.bottom.maximized }));
|
|
536
|
-
template_u1.slot(
|
|
537
|
-
template_u1.setClass(
|
|
538
|
-
template_u1.setStyle(
|
|
539
|
-
return
|
|
571
|
+
template_u1.slot(element_1dhwcf313, region('bottom'), 1);
|
|
572
|
+
template_u1.setClass(element_1dhwcf313, ["shell-dock", () => state.layout.bottom.maximized && 'shell-dock--maximized']);
|
|
573
|
+
template_u1.setStyle(element_1dhwcf313, ["", () => `--flex: 0 0 ${bounded(state.layout.bottom.size) * 100}%;`]);
|
|
574
|
+
return root_1dhwcf310;
|
|
540
575
|
})(), 1);
|
|
541
|
-
template_u1.slot(
|
|
542
|
-
return
|
|
576
|
+
template_u1.slot(element_1dhwcf3t, targets());
|
|
577
|
+
return root_1dhwcf3n;
|
|
543
578
|
}
|
|
544
579
|
}
|
|
545
580
|
let kind = () => findSurface(state.layout.root, subject.surface)?.kind ?? '', own = () => !!catalog[kind()]?.menu, items = [
|
|
@@ -576,8 +611,8 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
|
|
|
576
611
|
}
|
|
577
612
|
});
|
|
578
613
|
{
|
|
579
|
-
let
|
|
580
|
-
template_u1.slot(
|
|
614
|
+
let root_1dhwcf314 = template_1dhwcf315(), element_1dhwcf316 = root_1dhwcf314.firstElementChild, element_1dhwcf317 = root_1dhwcf314.firstChild.nextSibling, element_1dhwcf318 = element_1dhwcf317.nextSibling;
|
|
615
|
+
template_u1.slot(element_1dhwcf317, subtree(() => {
|
|
581
616
|
let layout = state.layout, trees = shown(layout), key = JSON.stringify([layout.bottom.open, layout.zoom.at(-1)?.groups ?? null, ...Object.values(trees).map((tree) => tree !== null)]), changed = key !== last;
|
|
582
617
|
if (changed) {
|
|
583
618
|
park();
|
|
@@ -586,7 +621,7 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
|
|
|
586
621
|
last = key;
|
|
587
622
|
return key;
|
|
588
623
|
}, tree, { class: 'shell-tree' }));
|
|
589
|
-
template_u1.slot(
|
|
624
|
+
template_u1.slot(element_1dhwcf318, tooltip.context({
|
|
590
625
|
class: 'shell-menu',
|
|
591
626
|
controller: (value) => {
|
|
592
627
|
adding = value;
|
|
@@ -600,7 +635,7 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
|
|
|
600
635
|
state: added,
|
|
601
636
|
[tooltip.context.panel]: { 'aria-label': 'Add panel' }
|
|
602
637
|
}, ''));
|
|
603
|
-
template_u1.slot(
|
|
638
|
+
template_u1.slot(root_1dhwcf314, tooltip.context({
|
|
604
639
|
class: 'shell-menu',
|
|
605
640
|
controller: (value) => {
|
|
606
641
|
controller = value;
|
|
@@ -608,28 +643,28 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
|
|
|
608
643
|
items,
|
|
609
644
|
[tooltip.context.panel]: { 'aria-label': 'Tab actions' }
|
|
610
645
|
}, ''), 1);
|
|
611
|
-
template_u1.onconnect(
|
|
646
|
+
template_u1.onconnect(element_1dhwcf316, (element) => {
|
|
612
647
|
parking = element;
|
|
613
648
|
});
|
|
614
|
-
template_u1.setClass(
|
|
615
|
-
let
|
|
616
|
-
template_u1.setProperties(
|
|
617
|
-
template_u1.onconnect(
|
|
649
|
+
template_u1.setClass(element_1dhwcf316, ["shell-parking"]);
|
|
650
|
+
let attributes_1dhwcf319 = attributes;
|
|
651
|
+
template_u1.setProperties(root_1dhwcf314, attributes_1dhwcf319, true);
|
|
652
|
+
template_u1.onconnect(root_1dhwcf314, (element) => {
|
|
618
653
|
workspace = element;
|
|
619
654
|
unobserve = observe(element, ([entry]) => {
|
|
620
655
|
size.height = entry.contentRect.height;
|
|
621
656
|
size.width = entry.contentRect.width;
|
|
622
657
|
});
|
|
623
658
|
});
|
|
624
|
-
template_u1.ondisconnect(
|
|
625
|
-
template_u1.onwindow(
|
|
626
|
-
template_u1.onwindow(
|
|
659
|
+
template_u1.ondisconnect(root_1dhwcf314, () => unobserve?.());
|
|
660
|
+
template_u1.onwindow(root_1dhwcf314, 'blur', () => write(picks, []));
|
|
661
|
+
template_u1.onwindow(root_1dhwcf314, 'keydown', (e) => {
|
|
627
662
|
if (e.key === 'Escape' && read(picks).length) {
|
|
628
663
|
e.preventDefault();
|
|
629
664
|
write(picks, []);
|
|
630
665
|
}
|
|
631
666
|
});
|
|
632
|
-
template_u1.onwindow(
|
|
667
|
+
template_u1.onwindow(root_1dhwcf314, 'keyup', (e) => {
|
|
633
668
|
let chosen = read(picks);
|
|
634
669
|
if (e.key !== (apple ? 'Meta' : 'Control') || chosen.length === 0) {
|
|
635
670
|
return;
|
|
@@ -637,14 +672,14 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
|
|
|
637
672
|
write(picks, []);
|
|
638
673
|
state.zoom(chosen);
|
|
639
674
|
});
|
|
640
|
-
template_u1.setClass(
|
|
641
|
-
() =>
|
|
675
|
+
template_u1.setClass(root_1dhwcf314, ["shell", attributes_1dhwcf319?.class, [
|
|
676
|
+
() => !signal.selector(carrying, null) && 'shell--dragging',
|
|
642
677
|
() => narrow() && 'shell--narrow',
|
|
643
678
|
() => (frames.left.dragging || frames.right.dragging) && 'shell--sliding',
|
|
644
679
|
() => open('left') && 'shell--left-open',
|
|
645
680
|
() => open('right') && 'shell--right-open'
|
|
646
681
|
]]);
|
|
647
|
-
template_u1.setStyle(
|
|
682
|
+
template_u1.setStyle(root_1dhwcf314, ["", attributes_1dhwcf319?.style, () => {
|
|
648
683
|
let { left, right } = state.layout;
|
|
649
684
|
return {
|
|
650
685
|
'--left': frames.left.space,
|
|
@@ -653,7 +688,7 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
|
|
|
653
688
|
'--right-size': right.size === null ? undefined : `${right.size}px`
|
|
654
689
|
};
|
|
655
690
|
}]);
|
|
656
|
-
return
|
|
691
|
+
return root_1dhwcf314;
|
|
657
692
|
}
|
|
658
693
|
});
|
|
659
694
|
const layout = Object.assign(shell, { state });
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
type Area = 'left' | 'main' | 'right';
|
|
1
2
|
type Direction = 'column' | 'row';
|
|
2
3
|
type Dock = {
|
|
3
4
|
open: boolean;
|
|
@@ -28,12 +29,17 @@ type Options = {
|
|
|
28
29
|
closing?: (surfaces: Surface[]) => boolean | Promise<boolean>;
|
|
29
30
|
open?: Partial<Record<Placement, boolean>>;
|
|
30
31
|
root?: Node | null;
|
|
32
|
+
sharing?: Sharing;
|
|
31
33
|
store?: Store;
|
|
32
34
|
};
|
|
33
35
|
type Placement = 'bottom' | 'left' | 'right';
|
|
34
36
|
type Saved = {
|
|
35
37
|
root: Node | null;
|
|
36
38
|
};
|
|
39
|
+
type Sharing = {
|
|
40
|
+
main?: 'all' | 'none';
|
|
41
|
+
sidebar?: 'all' | 'none' | 'sidebars';
|
|
42
|
+
};
|
|
37
43
|
type Side = 'after' | 'before';
|
|
38
44
|
type Split = {
|
|
39
45
|
children: Node[];
|
|
@@ -66,8 +72,8 @@ declare function findSplit(node: Node | null, id: string): Split | null;
|
|
|
66
72
|
declare function findSurfaceGroup(node: Node | null, id: string): Group | null;
|
|
67
73
|
declare function fixed(group: Group): boolean;
|
|
68
74
|
declare function stationary(root: Node | null, placement: Placement): boolean;
|
|
69
|
-
declare const state: ({ closing, open, root, store }?: Options) => {
|
|
70
|
-
activate(surface: string): void;
|
|
75
|
+
declare const state: ({ closing, open, root, sharing, store }?: Options) => {
|
|
76
|
+
activate(surface: string, reveal?: boolean): void;
|
|
71
77
|
back(): boolean;
|
|
72
78
|
close(surface: string): Promise<boolean>;
|
|
73
79
|
closeAll(): Promise<boolean>;
|
|
@@ -80,10 +86,11 @@ declare const state: ({ closing, open, root, store }?: Options) => {
|
|
|
80
86
|
load(root: Node | null): void;
|
|
81
87
|
maximize(group: string): void;
|
|
82
88
|
move(surface: string, group: string, index?: number): void;
|
|
83
|
-
open(surface: Surface, group?: string): void;
|
|
89
|
+
open(surface: Surface, group?: string, reveal?: boolean): void;
|
|
84
90
|
replace(previous: string, surface: Surface): void;
|
|
85
91
|
resize(split: string, sizes: number[], shown?: string[]): void;
|
|
86
92
|
resizeDock(placement: Placement, size: number): void;
|
|
93
|
+
shares(surface: string, placement?: Placement): boolean;
|
|
87
94
|
split(surface: string, group: string, direction: Direction, side: Side): void;
|
|
88
95
|
toggle(placement: Placement, open?: boolean): void;
|
|
89
96
|
unzoom: () => void;
|
|
@@ -91,4 +98,4 @@ declare const state: ({ closing, open, root, store }?: Options) => {
|
|
|
91
98
|
};
|
|
92
99
|
export default state;
|
|
93
100
|
export { allGroups, bounded, contains, docked, findGroup, findSplit, findSurfaceGroup, fixed, MIN_FRACTION, stationary };
|
|
94
|
-
export type { Direction, Dock, Group, Layout, Node, Placement, Saved, Side, Split, Store, Surface, Zoom };
|
|
101
|
+
export type { Area, Direction, Dock, Group, Layout, Node, Placement, Saved, Sharing, Side, Split, Store, Surface, Zoom };
|
|
@@ -11,6 +11,9 @@ function allGroups(node) {
|
|
|
11
11
|
}
|
|
12
12
|
return node.children.flatMap(allGroups);
|
|
13
13
|
}
|
|
14
|
+
function area(placement) {
|
|
15
|
+
return placement === 'left' || placement === 'right' ? placement : 'main';
|
|
16
|
+
}
|
|
14
17
|
function bounded(size) {
|
|
15
18
|
return Math.min(1 - MIN_FRACTION, Math.max(MIN_FRACTION, size));
|
|
16
19
|
}
|
|
@@ -205,7 +208,7 @@ function zoomed(previous, next) {
|
|
|
205
208
|
}))
|
|
206
209
|
.filter((level) => level.groups.length > 0);
|
|
207
210
|
}
|
|
208
|
-
const state = ({ closing, open = {}, root = null, store } = {}) => {
|
|
211
|
+
const state = ({ closing, open = {}, root = null, sharing = {}, store } = {}) => {
|
|
209
212
|
let counter = 1, touched = false, layout = signal(normalizeLayout({
|
|
210
213
|
active: null,
|
|
211
214
|
bottom: { maximized: false, open: open.bottom ?? true, size: BOTTOM_SIZE },
|
|
@@ -230,6 +233,13 @@ const state = ({ closing, open = {}, root = null, store } = {}) => {
|
|
|
230
233
|
counter = Math.max(counter, Number(/-(\d+)$/.exec(group.id)?.[1] ?? 0) + 1);
|
|
231
234
|
}
|
|
232
235
|
}
|
|
236
|
+
function allows(from, to) {
|
|
237
|
+
if (from === 'main') {
|
|
238
|
+
return (sharing.main ?? 'all') === 'all';
|
|
239
|
+
}
|
|
240
|
+
let policy = sharing.sidebar ?? 'all';
|
|
241
|
+
return policy === 'all' || (policy === 'sidebars' && to !== 'main');
|
|
242
|
+
}
|
|
233
243
|
function guarded(change) {
|
|
234
244
|
let surfaces = removed(read(layout).root, change(read(layout)).root), allowed = surfaces.length && closing ? closing(surfaces) : true;
|
|
235
245
|
if (typeof allowed === 'boolean') {
|
|
@@ -248,6 +258,10 @@ const state = ({ closing, open = {}, root = null, store } = {}) => {
|
|
|
248
258
|
function id(prefix) {
|
|
249
259
|
return `${prefix}-${counter++}`;
|
|
250
260
|
}
|
|
261
|
+
function shared(from, to) {
|
|
262
|
+
let a = area(from.placement), b = area(to);
|
|
263
|
+
return a === b || (allows(a, b) && allows(b, a));
|
|
264
|
+
}
|
|
251
265
|
function structural(change) {
|
|
252
266
|
touched = true;
|
|
253
267
|
update((current) => change({ ...current, bottom: { ...current.bottom, maximized: false }, maximized: null }));
|
|
@@ -278,14 +292,14 @@ const state = ({ closing, open = {}, root = null, store } = {}) => {
|
|
|
278
292
|
return placement ? { ...current, [placement]: { ...current[placement], open: true } } : current;
|
|
279
293
|
}
|
|
280
294
|
return {
|
|
281
|
-
activate(surface) {
|
|
295
|
+
activate(surface, reveal = true) {
|
|
282
296
|
update((current) => {
|
|
283
297
|
let group = findSurfaceGroup(current.root, surface);
|
|
284
298
|
if (!group) {
|
|
285
299
|
return current;
|
|
286
300
|
}
|
|
287
301
|
return {
|
|
288
|
-
...visible(group, current),
|
|
302
|
+
...(reveal ? visible(group, current) : current),
|
|
289
303
|
active: group.id,
|
|
290
304
|
root: updateGroup(current.root, group.id, (entry) => ({ ...entry, active: surface }))
|
|
291
305
|
};
|
|
@@ -345,6 +359,9 @@ const state = ({ closing, open = {}, root = null, store } = {}) => {
|
|
|
345
359
|
dock(surface, placement = 'bottom') {
|
|
346
360
|
structural((current) => {
|
|
347
361
|
let source = findSurfaceGroup(current.root, surface), item = source?.surfaces.find((entry) => entry.id === surface);
|
|
362
|
+
if (source && !shared(source, placement)) {
|
|
363
|
+
return current;
|
|
364
|
+
}
|
|
348
365
|
if (source && fixed(source)) {
|
|
349
366
|
return source.placement === placement || allGroups(current.root).some((entry) => docked(entry, placement))
|
|
350
367
|
? current
|
|
@@ -415,12 +432,15 @@ const state = ({ closing, open = {}, root = null, store } = {}) => {
|
|
|
415
432
|
move(surface, group, index) {
|
|
416
433
|
structural((current) => {
|
|
417
434
|
let source = findSurfaceGroup(current.root, surface), target = findGroup(current.root, group), item = source?.surfaces.find((entry) => entry.id === surface);
|
|
418
|
-
if (!source ||
|
|
435
|
+
if (!source ||
|
|
436
|
+
!target ||
|
|
437
|
+
!item ||
|
|
438
|
+
(source.id !== target.id && (item.sortable === false || fixed(target) || !shared(source, target.placement)))) {
|
|
419
439
|
return current;
|
|
420
440
|
}
|
|
421
441
|
let root = source.id === target.id ? current.root : take(current.root, source, surface);
|
|
422
442
|
return {
|
|
423
|
-
...visible(target, current),
|
|
443
|
+
...(source.placement === target.placement ? current : visible(target, current)),
|
|
424
444
|
active: target.id,
|
|
425
445
|
root: updateGroup(root, target.id, (entry) => {
|
|
426
446
|
let surfaces = entry.surfaces.filter((other) => other.id !== surface);
|
|
@@ -430,12 +450,12 @@ const state = ({ closing, open = {}, root = null, store } = {}) => {
|
|
|
430
450
|
};
|
|
431
451
|
});
|
|
432
452
|
},
|
|
433
|
-
open(surface, group) {
|
|
453
|
+
open(surface, group, reveal = true) {
|
|
434
454
|
structural((current) => {
|
|
435
455
|
let existing = findSurfaceGroup(current.root, surface.id), target = group ? findGroup(current.root, group) : null;
|
|
436
|
-
if (existing && (!target || existing.id === target.id)) {
|
|
456
|
+
if (existing && (!target || existing.id === target.id || !shared(existing, target.placement))) {
|
|
437
457
|
return {
|
|
438
|
-
...visible(existing, current),
|
|
458
|
+
...(reveal ? visible(existing, current) : current),
|
|
439
459
|
active: existing.id,
|
|
440
460
|
root: updateGroup(current.root, existing.id, (entry) => ({ ...entry, active: surface.id }))
|
|
441
461
|
};
|
|
@@ -454,7 +474,7 @@ const state = ({ closing, open = {}, root = null, store } = {}) => {
|
|
|
454
474
|
}
|
|
455
475
|
let root = existing ? take(current.root, existing, surface.id) : current.root;
|
|
456
476
|
return {
|
|
457
|
-
...visible(target, current),
|
|
477
|
+
...(reveal ? visible(target, current) : current),
|
|
458
478
|
active: target.id,
|
|
459
479
|
root: updateGroup(root, target.id, (entry) => ({ ...entry, active: surface.id, surfaces: [...entry.surfaces, surface] }))
|
|
460
480
|
};
|
|
@@ -466,7 +486,11 @@ const state = ({ closing, open = {}, root = null, store } = {}) => {
|
|
|
466
486
|
if (!target) {
|
|
467
487
|
return current;
|
|
468
488
|
}
|
|
469
|
-
let existing = findSurfaceGroup(current.root, surface.id)
|
|
489
|
+
let existing = findSurfaceGroup(current.root, surface.id);
|
|
490
|
+
if (existing && existing.id !== target.id && !shared(existing, target.placement)) {
|
|
491
|
+
return current;
|
|
492
|
+
}
|
|
493
|
+
let root = existing ? take(current.root, existing, surface.id) : current.root;
|
|
470
494
|
return {
|
|
471
495
|
...current,
|
|
472
496
|
root: updateGroup(root, target.id, (entry) => ({
|
|
@@ -504,6 +528,10 @@ const state = ({ closing, open = {}, root = null, store } = {}) => {
|
|
|
504
528
|
resizeDock(placement, size) {
|
|
505
529
|
update((current) => ({ ...current, [placement]: { ...current[placement], size } }));
|
|
506
530
|
},
|
|
531
|
+
shares(surface, placement) {
|
|
532
|
+
let source = findSurfaceGroup(read(layout).root, surface);
|
|
533
|
+
return source !== null && shared(source, placement);
|
|
534
|
+
},
|
|
507
535
|
split(surface, group, direction, side) {
|
|
508
536
|
structural((current) => {
|
|
509
537
|
let source = findSurfaceGroup(current.root, surface), target = findGroup(current.root, group), item = source?.surfaces.find((entry) => entry.id === surface);
|
|
@@ -511,6 +539,7 @@ const state = ({ closing, open = {}, root = null, store } = {}) => {
|
|
|
511
539
|
!item ||
|
|
512
540
|
!target ||
|
|
513
541
|
item.sortable === false ||
|
|
542
|
+
!shared(source, target.placement) ||
|
|
514
543
|
(source.id === group && source.surfaces.length === 1) ||
|
|
515
544
|
(target.placement !== undefined && stationary(current.root, target.placement))) {
|
|
516
545
|
return current;
|