@esportsplus/ui 0.65.0 → 0.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +2 -2
  2. package/build/components/button/scss/index.scss +1 -1
  3. package/build/components/card/scss/index.scss +1 -1
  4. package/build/components/checkbox/scss/index.scss +1 -1
  5. package/build/components/color-picker/scss/index.scss +1 -1
  6. package/build/components/command/scss/index.scss +1 -1
  7. package/build/components/group/scss/index.scss +1 -1
  8. package/build/components/highlight/scss/index.scss +1 -1
  9. package/build/components/image/scss/index.scss +1 -1
  10. package/build/components/inline-edit/scss/index.scss +1 -1
  11. package/build/components/overlay/scss/index.scss +1 -1
  12. package/build/components/pagination/scss/index.scss +1 -1
  13. package/build/components/range/scss/index.scss +1 -1
  14. package/build/components/search/scss/index.scss +1 -1
  15. package/build/components/select/scss/index.scss +1 -1
  16. package/build/components/shell/group.d.ts +2 -0
  17. package/build/components/shell/group.js +1 -1
  18. package/build/components/shell/index.d.ts +6 -2
  19. package/build/components/shell/index.js +110 -74
  20. package/build/components/shell/model.d.ts +9 -2
  21. package/build/components/shell/model.js +33 -4
  22. package/build/components/shell/scss/index.scss +1 -1
  23. package/build/components/sortable/index.d.ts +2 -1
  24. package/build/components/sortable/index.js +3 -2
  25. package/build/components/sortable/scss/index.scss +1 -1
  26. package/build/components/theme/scss/index.scss +1 -1
  27. package/build/components/toast/scss/index.scss +1 -1
  28. package/build/components/toolbar/scss/index.scss +1 -1
  29. package/build/components/tooltip/scss/index.scss +1 -1
  30. package/build/components/uptime/scss/index.scss +1 -1
  31. package/package.json +1 -1
  32. package/src/components/shell/group.ts +4 -2
  33. package/src/components/shell/index.ts +37 -12
  34. package/src/components/shell/model.ts +65 -7
  35. package/src/components/sortable/index.ts +7 -2
  36. package/src/tokens/scss/color.scss +2 -2
@@ -1,7 +1,8 @@
1
1
  import * as template_u1 from '@esportsplus/template';
2
2
  import { type Attributes, type Renderable } from '@esportsplus/template';
3
+ import type { Options as Scrollbar } from '../../modifiers/scrollbar/index.js';
3
4
  import { type Catalog, type Kind } from './group.js';
4
- 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';
5
6
  import { type Edge, type Options } from './sidebar.js';
6
7
  import './scss/index.scss';
7
8
  type A = Attributes & {
@@ -12,10 +13,13 @@ type A = Attributes & {
12
13
  onconnect?: never;
13
14
  sidebars?: Partial<Record<Edge, Options>>;
14
15
  state: ReturnType<typeof state>;
16
+ tabs?: {
17
+ scrollbar?: Scrollbar;
18
+ };
15
19
  };
16
20
  declare const shell: template_u1.Factory<A, Renderable<any>, Renderable<any>, {}>;
17
21
  declare const layout: typeof shell & {
18
22
  state: typeof state;
19
23
  };
20
24
  export default layout;
21
- 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 template_1dhwcf38 = template_u1.template(`<div aria-hidden='true' class='shell-dock-target shell-dock-target--bottom' data-placement='bottom'>`, true);
17
- const template_1dhwcf39 = template_u1.template(`<div aria-hidden='true' class='shell-dock-target shell-dock-target--left' data-placement='left'>`, true);
18
- const template_1dhwcf3a = template_u1.template(`<div aria-hidden='true' class='shell-dock-target shell-dock-target--right' data-placement='right'>`, true);
19
- const template_1dhwcf3c = template_u1.template(`<div aria-hidden='true'>`, true);
20
- const template_1dhwcf3e = template_u1.template(`<div>`, true);
21
- const template_1dhwcf3h = template_u1.template(`<div></div><!--$-->`);
22
- const template_1dhwcf3l = template_u1.template(`<div class='shell-frame'><!--$--><div class='shell-center'><div class='shell-main'></div></div></div><!--$-->`);
23
- const template_1dhwcf3s = template_u1.template(`<!--$--><!--$--><!--$--><!--$-->`);
24
- const template_1dhwcf3y = template_u1.template(`<!--$--><div>`);
25
- const template_1dhwcf312 = template_u1.template(`<div><div></div><!--$--><!--$-->`, true);
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 || y <= (section.querySelector(':scope > .shell-header')?.getBoundingClientRect().bottom ?? -Infinity)) {
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]]
@@ -173,8 +175,8 @@ function under(workspace, x, y) {
173
175
  let found = document.elementsFromPoint(x, y).find((element) => element.matches('.shell-group') && element.closest('.shell') === workspace);
174
176
  return found?.dataset.group;
175
177
  }
176
- const shell = component(function ({ catalog, empty, icons = false, narrow: breakpoint = NARROW, sidebars: options = {}, state, ...attributes }) {
177
- let adding, added = new ReactiveObject_1dhwcf30(), apple = mac(), carrying = signal(false), 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
+ const shell = component(function ({ catalog, empty, icons = false, narrow: breakpoint = NARROW, sidebars: options = {}, state, tabs = {}, ...attributes }) {
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
  }
@@ -248,32 +254,34 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
248
254
  write(picks, current.includes(group) ? current.filter((id) => id !== group) : [...current, group]);
249
255
  },
250
256
  picked: (group) => read(picks).includes(group),
257
+ scrollbar: { hidden: true, ...tabs.scrollbar, horizontal: true },
251
258
  slot: (surface) => {
252
- let root_1dhwcf3d = template_1dhwcf3e();
253
- template_u1.onconnect(root_1dhwcf3d, (element) => {
259
+ let root_1dhwcf3g = template_1dhwcf3h();
260
+ template_u1.onconnect(root_1dhwcf3g, (element) => {
254
261
  slots.set(surface, element);
255
262
  attach(surface, element);
256
263
  });
257
- template_u1.ondisconnect(root_1dhwcf3d, () => {
264
+ template_u1.ondisconnect(root_1dhwcf3g, () => {
258
265
  if (slots.get(surface)?.isConnected === false) {
259
266
  slots.delete(surface);
260
267
  }
261
268
  });
262
- template_u1.setClass(root_1dhwcf3d, ["shell-slot"]);
263
- return root_1dhwcf3d;
269
+ template_u1.setClass(root_1dhwcf3g, ["shell-slot"]);
270
+ return root_1dhwcf3g;
264
271
  },
265
272
  sorting(strip, group) {
266
273
  strips.set(strip, group);
267
274
  return {
275
+ accepts: (surface) => shares(surface, strips.get(strip) ?? ''),
268
276
  disabled: (surface) => surface.sortable === false,
269
277
  group: edges.id,
270
278
  onland: () => {
271
279
  let land = landing;
272
280
  landing = null;
273
- write(carrying, false);
281
+ write(carrying, null);
274
282
  land?.();
275
283
  },
276
- onlift: () => write(carrying, true),
284
+ onlift: (surface) => write(carrying, surface),
277
285
  onsort: (surface, _, to, __, target) => {
278
286
  let group = strips.get(target);
279
287
  landing = group ? () => state.move(surface.id, group, to) : null;
@@ -287,7 +295,7 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
287
295
  }
288
296
  };
289
297
  },
290
- over: (_, x, y) => workspace ? target(workspace, x, y) : null
298
+ over: (surface, x, y) => workspace ? target(workspace, x, y, (group) => shares(surface, group)) : null
291
299
  }
292
300
  };
293
301
  },
@@ -434,16 +442,16 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
434
442
  return current.sizes;
435
443
  }
436
444
  {
437
- let root_1dhwcf3f = template_1dhwcf3e();
438
- template_u1.slot(root_1dhwcf3f, current.children.map((child, index) => {
439
- let root_1dhwcf3g = template_1dhwcf3h(), element_1dhwcf3i = root_1dhwcf3g.firstChild, element_1dhwcf3j = element_1dhwcf3i.nextSibling;
440
- template_u1.slot(element_1dhwcf3i, node(child), 1);
441
- template_u1.slot(element_1dhwcf3j, index < current.children.length - 1 && separator(axis, () => {
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, () => {
442
450
  let from = sizes(), length = box.length;
443
451
  return (delta) => state.resize(current.id, resized(from, index, delta, length, MIN_FRACTION), current.children.map((child) => child.id));
444
452
  }));
445
- template_u1.setClass(element_1dhwcf3i, ["shell-pane", () => state.layout.main !== null && contains(child, state.layout.main) && 'shell-pane--current']);
446
- template_u1.setStyle(element_1dhwcf3i, ["", () => {
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, ["", () => {
447
455
  let maximized = state.layout.maximized;
448
456
  if (maximized === null || !contains(current, maximized)) {
449
457
  return `--flex: 0 0 ${(sizes()[index] ?? 0) * 100}%;`;
@@ -452,16 +460,16 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
452
460
  ? `--flex: 0 0 calc(100% - ${(current.children.length - 1) * COLLAPSED}px);`
453
461
  : `--flex: 0 0 ${COLLAPSED}px;`;
454
462
  }]);
455
- return root_1dhwcf3g;
463
+ return root_1dhwcf3j;
456
464
  }), 1);
457
- template_u1.onconnect(root_1dhwcf3f, (element) => {
465
+ template_u1.onconnect(root_1dhwcf3i, (element) => {
458
466
  unobserve = observe(element, ([entry]) => {
459
467
  box.length = axis === 'x' ? entry.contentRect.width : entry.contentRect.height;
460
468
  });
461
469
  });
462
- template_u1.ondisconnect(root_1dhwcf3f, () => unobserve?.());
463
- template_u1.setClass(root_1dhwcf3f, ["shell-split", "shell-split--" + (current.direction)]);
464
- return root_1dhwcf3f;
470
+ template_u1.ondisconnect(root_1dhwcf3i, () => unobserve?.());
471
+ template_u1.setClass(root_1dhwcf3i, ["shell-split", "shell-split--" + (current.direction)]);
472
+ return root_1dhwcf3i;
465
473
  }
466
474
  }
467
475
  function switcher(main) {
@@ -506,39 +514,67 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
506
514
  function targets() {
507
515
  return ['bottom', 'left', 'right']
508
516
  .filter((placement) => placement === 'bottom' || !stationary(state.layout.root, placement))
509
- .map((placement) => (placement === "bottom" ? template_1dhwcf38() : placement === "left" ? template_1dhwcf39() : placement === "right" ? template_1dhwcf3a() : (() => {
510
- let root_1dhwcf3b = template_1dhwcf3c();
511
- template_u1.setProperty(root_1dhwcf3b, 'data-placement', placement);
512
- template_u1.setClass(root_1dhwcf3b, ["shell-dock-target", "shell-dock-target--" + (placement)]);
513
- return root_1dhwcf3b;
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;
514
550
  })()));
515
551
  }
516
552
  function tree() {
517
553
  let trees = shown(state.layout);
518
554
  {
519
- let root_1dhwcf3k = template_1dhwcf3l(), element_1dhwcf3m = root_1dhwcf3k.firstChild, element_1dhwcf3n = element_1dhwcf3m.firstChild, element_1dhwcf3o = element_1dhwcf3m.firstElementChild.firstElementChild, element_1dhwcf3p = element_1dhwcf3m.firstElementChild, element_1dhwcf3q = element_1dhwcf3m.nextSibling;
520
- template_u1.slot(element_1dhwcf3n, ['left', 'right'].map((edge) => (trees[edge] || options[edge]) && (() => {
521
- let root_1dhwcf3r = template_1dhwcf3s(), element_1dhwcf3t = root_1dhwcf3r.firstChild, element_1dhwcf3u = element_1dhwcf3t.nextSibling, element_1dhwcf3v = element_1dhwcf3u.nextSibling, element_1dhwcf3w = element_1dhwcf3v.nextSibling;
522
- template_u1.slot(element_1dhwcf3t, sidebar(edges, edge, region(edge)));
523
- template_u1.slot(element_1dhwcf3u, grip(edges, edge));
524
- template_u1.slot(element_1dhwcf3v, options[edge]?.resizable && resizer(edges, edge));
525
- template_u1.slot(element_1dhwcf3w, toggle(edges, edge));
526
- return root_1dhwcf3r;
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;
527
563
  })()));
528
- template_u1.slot(element_1dhwcf3o, region('main'), 1);
529
- template_u1.slot(element_1dhwcf3p, trees.bottom && (() => {
530
- let root_1dhwcf3x = template_1dhwcf3y(), element_1dhwcf3z = root_1dhwcf3x.firstChild, element_1dhwcf310 = element_1dhwcf3z.nextSibling;
531
- template_u1.slot(element_1dhwcf3z, separator('y', () => {
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', () => {
532
568
  let share = bounded(state.layout.bottom.size), length = size.height;
533
569
  return (delta) => state.resizeDock('bottom', resized([1 - share, share], 0, delta, length, MIN_FRACTION)[1]);
534
570
  }, { hidden: () => state.layout.bottom.maximized }));
535
- template_u1.slot(element_1dhwcf310, region('bottom'), 1);
536
- template_u1.setClass(element_1dhwcf310, ["shell-dock", () => state.layout.bottom.maximized && 'shell-dock--maximized']);
537
- template_u1.setStyle(element_1dhwcf310, ["", () => `--flex: 0 0 ${bounded(state.layout.bottom.size) * 100}%;`]);
538
- return root_1dhwcf3x;
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;
539
575
  })(), 1);
540
- template_u1.slot(element_1dhwcf3q, targets());
541
- return root_1dhwcf3k;
576
+ template_u1.slot(element_1dhwcf3t, targets());
577
+ return root_1dhwcf3n;
542
578
  }
543
579
  }
544
580
  let kind = () => findSurface(state.layout.root, subject.surface)?.kind ?? '', own = () => !!catalog[kind()]?.menu, items = [
@@ -575,8 +611,8 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
575
611
  }
576
612
  });
577
613
  {
578
- let root_1dhwcf311 = template_1dhwcf312(), element_1dhwcf313 = root_1dhwcf311.firstElementChild, element_1dhwcf314 = root_1dhwcf311.firstChild.nextSibling, element_1dhwcf315 = element_1dhwcf314.nextSibling;
579
- template_u1.slot(element_1dhwcf314, subtree(() => {
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(() => {
580
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;
581
617
  if (changed) {
582
618
  park();
@@ -585,7 +621,7 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
585
621
  last = key;
586
622
  return key;
587
623
  }, tree, { class: 'shell-tree' }));
588
- template_u1.slot(element_1dhwcf315, tooltip.context({
624
+ template_u1.slot(element_1dhwcf318, tooltip.context({
589
625
  class: 'shell-menu',
590
626
  controller: (value) => {
591
627
  adding = value;
@@ -599,7 +635,7 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
599
635
  state: added,
600
636
  [tooltip.context.panel]: { 'aria-label': 'Add panel' }
601
637
  }, ''));
602
- template_u1.slot(root_1dhwcf311, tooltip.context({
638
+ template_u1.slot(root_1dhwcf314, tooltip.context({
603
639
  class: 'shell-menu',
604
640
  controller: (value) => {
605
641
  controller = value;
@@ -607,28 +643,28 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
607
643
  items,
608
644
  [tooltip.context.panel]: { 'aria-label': 'Tab actions' }
609
645
  }, ''), 1);
610
- template_u1.onconnect(element_1dhwcf313, (element) => {
646
+ template_u1.onconnect(element_1dhwcf316, (element) => {
611
647
  parking = element;
612
648
  });
613
- template_u1.setClass(element_1dhwcf313, ["shell-parking"]);
614
- let attributes_1dhwcf316 = attributes;
615
- template_u1.setProperties(root_1dhwcf311, attributes_1dhwcf316, true);
616
- template_u1.onconnect(root_1dhwcf311, (element) => {
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) => {
617
653
  workspace = element;
618
654
  unobserve = observe(element, ([entry]) => {
619
655
  size.height = entry.contentRect.height;
620
656
  size.width = entry.contentRect.width;
621
657
  });
622
658
  });
623
- template_u1.ondisconnect(root_1dhwcf311, () => unobserve?.());
624
- template_u1.onwindow(root_1dhwcf311, 'blur', () => write(picks, []));
625
- template_u1.onwindow(root_1dhwcf311, 'keydown', (e) => {
659
+ template_u1.ondisconnect(root_1dhwcf314, () => unobserve?.());
660
+ template_u1.onwindow(root_1dhwcf314, 'blur', () => write(picks, []));
661
+ template_u1.onwindow(root_1dhwcf314, 'keydown', (e) => {
626
662
  if (e.key === 'Escape' && read(picks).length) {
627
663
  e.preventDefault();
628
664
  write(picks, []);
629
665
  }
630
666
  });
631
- template_u1.onwindow(root_1dhwcf311, 'keyup', (e) => {
667
+ template_u1.onwindow(root_1dhwcf314, 'keyup', (e) => {
632
668
  let chosen = read(picks);
633
669
  if (e.key !== (apple ? 'Meta' : 'Control') || chosen.length === 0) {
634
670
  return;
@@ -636,14 +672,14 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
636
672
  write(picks, []);
637
673
  state.zoom(chosen);
638
674
  });
639
- template_u1.setClass(root_1dhwcf311, ["shell", attributes_1dhwcf316?.class, [
640
- () => read(carrying) && 'shell--dragging',
675
+ template_u1.setClass(root_1dhwcf314, ["shell", attributes_1dhwcf319?.class, [
676
+ () => !signal.selector(carrying, null) && 'shell--dragging',
641
677
  () => narrow() && 'shell--narrow',
642
678
  () => (frames.left.dragging || frames.right.dragging) && 'shell--sliding',
643
679
  () => open('left') && 'shell--left-open',
644
680
  () => open('right') && 'shell--right-open'
645
681
  ]]);
646
- template_u1.setStyle(root_1dhwcf311, ["", attributes_1dhwcf316?.style, () => {
682
+ template_u1.setStyle(root_1dhwcf314, ["", attributes_1dhwcf319?.style, () => {
647
683
  let { left, right } = state.layout;
648
684
  return {
649
685
  '--left': frames.left.space,
@@ -652,7 +688,7 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
652
688
  '--right-size': right.size === null ? undefined : `${right.size}px`
653
689
  };
654
690
  }]);
655
- return root_1dhwcf311;
691
+ return root_1dhwcf314;
656
692
  }
657
693
  });
658
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,7 +72,7 @@ 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) => {
75
+ declare const state: ({ closing, open, root, sharing, store }?: Options) => {
70
76
  activate(surface: string): void;
71
77
  back(): boolean;
72
78
  close(surface: string): Promise<boolean>;
@@ -84,6 +90,7 @@ declare const state: ({ closing, open, root, store }?: Options) => {
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 }));
@@ -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,7 +432,10 @@ 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 || !target || !item || (source.id !== target.id && (item.sortable === false || fixed(target)))) {
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);
@@ -433,7 +453,7 @@ const state = ({ closing, open = {}, root = null, store } = {}) => {
433
453
  open(surface, group) {
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
458
  ...visible(existing, current),
439
459
  active: existing.id,
@@ -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), root = existing ? take(current.root, existing, surface.id) : current.root;
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;