@esportsplus/ui 0.67.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.
@@ -100,7 +100,7 @@ function tab(context, live, surface, attributes) {
100
100
  void context.state.close(surface.id);
101
101
  }
102
102
  });
103
- template_u1.delegate(root_0hnf69ac, 'click', () => context.state.activate(surface.id));
103
+ template_u1.delegate(root_0hnf69ac, 'click', () => context.state.activate(surface.id, false));
104
104
  template_u1.delegate(root_0hnf69ac, 'contextmenu', (e) => context.menu(e, group.id, surface.id));
105
105
  template_u1.delegate(root_0hnf69ac, 'keydown', (e) => {
106
106
  if (e.key === 'Delete') {
@@ -109,7 +109,7 @@ function tab(context, live, surface, attributes) {
109
109
  }
110
110
  else if (e.key === 'Enter' || e.key === ' ') {
111
111
  e.preventDefault();
112
- context.state.activate(surface.id);
112
+ context.state.activate(surface.id, false);
113
113
  }
114
114
  });
115
115
  template_u1.delegate(root_0hnf69ac, 'mousedown', (e) => {
@@ -217,7 +217,7 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
217
217
  n++;
218
218
  }
219
219
  }
220
- state.open({ id, kind }, group);
220
+ state.open({ id, kind }, group, group === undefined);
221
221
  },
222
222
  addable: Object.entries(catalog).filter(([, entry]) => entry.addable !== false),
223
223
  adding: (group) => added.active && subject.group === group,
@@ -73,7 +73,7 @@ declare function findSurfaceGroup(node: Node | null, id: string): Group | null;
73
73
  declare function fixed(group: Group): boolean;
74
74
  declare function stationary(root: Node | null, placement: Placement): boolean;
75
75
  declare const state: ({ closing, open, root, sharing, store }?: Options) => {
76
- activate(surface: string): void;
76
+ activate(surface: string, reveal?: boolean): void;
77
77
  back(): boolean;
78
78
  close(surface: string): Promise<boolean>;
79
79
  closeAll(): Promise<boolean>;
@@ -86,7 +86,7 @@ declare const state: ({ closing, open, root, sharing, store }?: Options) => {
86
86
  load(root: Node | null): void;
87
87
  maximize(group: string): void;
88
88
  move(surface: string, group: string, index?: number): void;
89
- open(surface: Surface, group?: string): void;
89
+ open(surface: Surface, group?: string, reveal?: boolean): void;
90
90
  replace(previous: string, surface: Surface): void;
91
91
  resize(split: string, sizes: number[], shown?: string[]): void;
92
92
  resizeDock(placement: Placement, size: number): void;
@@ -292,14 +292,14 @@ const state = ({ closing, open = {}, root = null, sharing = {}, store } = {}) =>
292
292
  return placement ? { ...current, [placement]: { ...current[placement], open: true } } : current;
293
293
  }
294
294
  return {
295
- activate(surface) {
295
+ activate(surface, reveal = true) {
296
296
  update((current) => {
297
297
  let group = findSurfaceGroup(current.root, surface);
298
298
  if (!group) {
299
299
  return current;
300
300
  }
301
301
  return {
302
- ...visible(group, current),
302
+ ...(reveal ? visible(group, current) : current),
303
303
  active: group.id,
304
304
  root: updateGroup(current.root, group.id, (entry) => ({ ...entry, active: surface }))
305
305
  };
@@ -440,7 +440,7 @@ const state = ({ closing, open = {}, root = null, sharing = {}, store } = {}) =>
440
440
  }
441
441
  let root = source.id === target.id ? current.root : take(current.root, source, surface);
442
442
  return {
443
- ...visible(target, current),
443
+ ...(source.placement === target.placement ? current : visible(target, current)),
444
444
  active: target.id,
445
445
  root: updateGroup(root, target.id, (entry) => {
446
446
  let surfaces = entry.surfaces.filter((other) => other.id !== surface);
@@ -450,12 +450,12 @@ const state = ({ closing, open = {}, root = null, sharing = {}, store } = {}) =>
450
450
  };
451
451
  });
452
452
  },
453
- open(surface, group) {
453
+ open(surface, group, reveal = true) {
454
454
  structural((current) => {
455
455
  let existing = findSurfaceGroup(current.root, surface.id), target = group ? findGroup(current.root, group) : null;
456
456
  if (existing && (!target || existing.id === target.id || !shared(existing, target.placement))) {
457
457
  return {
458
- ...visible(existing, current),
458
+ ...(reveal ? visible(existing, current) : current),
459
459
  active: existing.id,
460
460
  root: updateGroup(current.root, existing.id, (entry) => ({ ...entry, active: surface.id }))
461
461
  };
@@ -474,7 +474,7 @@ const state = ({ closing, open = {}, root = null, sharing = {}, store } = {}) =>
474
474
  }
475
475
  let root = existing ? take(current.root, existing, surface.id) : current.root;
476
476
  return {
477
- ...visible(target, current),
477
+ ...(reveal ? visible(target, current) : current),
478
478
  active: target.id,
479
479
  root: updateGroup(root, target.id, (entry) => ({ ...entry, active: surface.id, surfaces: [...entry.surfaces, surface] }))
480
480
  };
package/package.json CHANGED
@@ -54,7 +54,7 @@
54
54
  "**/*.scss"
55
55
  ],
56
56
  "type": "module",
57
- "version": "0.67.0",
57
+ "version": "0.67.1",
58
58
  "scripts": {
59
59
  "build": "run-s build:vite build:ts",
60
60
  "build:ts": "tsc",
@@ -137,7 +137,7 @@ function tab(context: Context, live: Live, surface: Surface, attributes: Attribu
137
137
  void context.state.close(surface.id);
138
138
  }
139
139
  },
140
- onclick: () => context.state.activate(surface.id),
140
+ onclick: () => context.state.activate(surface.id, false),
141
141
  oncontextmenu: (e: MouseEvent) => context.menu(e, group.id, surface.id),
142
142
  onkeydown: (e: KeyboardEvent) => {
143
143
  if (e.key === 'Delete') {
@@ -146,7 +146,7 @@ function tab(context: Context, live: Live, surface: Surface, attributes: Attribu
146
146
  }
147
147
  else if (e.key === 'Enter' || e.key === ' ') {
148
148
  e.preventDefault();
149
- context.state.activate(surface.id);
149
+ context.state.activate(surface.id, false);
150
150
  }
151
151
  },
152
152
  // A middle press would start autoscroll before the auxclick closes the tab.
@@ -284,7 +284,8 @@ const shell = component(
284
284
  }
285
285
  }
286
286
 
287
- state.open({ id, kind }, group);
287
+ // Added from a group's own strip or launcher, the group is already on screen.
288
+ state.open({ id, kind }, group, group === undefined);
288
289
  },
289
290
  addable: Object.entries(catalog).filter(([, entry]) => entry.addable !== false),
290
291
  adding: (group: string) => added.active && subject.group === group,
@@ -522,7 +522,9 @@ const state = ({ closing, open = {}, root = null, sharing = {}, store }: Options
522
522
  }
523
523
 
524
524
  return {
525
- activate(surface: string) {
525
+ // Opens the surface's sidebar too, unless 'reveal' is false: a tab pressed in a sidebar is already on screen,
526
+ // peeking or not, so it leaves the sidebar's open setting as the user set it.
527
+ activate(surface: string, reveal = true) {
526
528
  update((current) => {
527
529
  let group = findSurfaceGroup(current.root, surface);
528
530
 
@@ -531,7 +533,7 @@ const state = ({ closing, open = {}, root = null, sharing = {}, store }: Options
531
533
  }
532
534
 
533
535
  return {
534
- ...visible(group, current),
536
+ ...(reveal ? visible(group, current) : current),
535
537
  active: group.id,
536
538
  root: updateGroup(current.root, group.id, (entry) => ({ ...entry, active: surface }))
537
539
  };
@@ -706,7 +708,8 @@ const state = ({ closing, open = {}, root = null, sharing = {}, store }: Options
706
708
  });
707
709
  },
708
710
 
709
- // Into the group at 'index' among its tabs, or at the end; within its own group it reorders.
711
+ // Into the group at 'index' among its tabs, or at the end; within its own group it reorders. Only a move into
712
+ // another dock opens it: one within a dock happens where it already shows, peeking or not.
710
713
  move(surface: string, group: string, index?: number) {
711
714
  structural((current) => {
712
715
  let source = findSurfaceGroup(current.root, surface),
@@ -725,7 +728,7 @@ const state = ({ closing, open = {}, root = null, sharing = {}, store }: Options
725
728
  let root = source.id === target.id ? current.root : take(current.root, source, surface);
726
729
 
727
730
  return {
728
- ...visible(target, current),
731
+ ...(source.placement === target.placement ? current : visible(target, current)),
729
732
  active: target.id,
730
733
  root: updateGroup(root, target.id, (entry) => {
731
734
  let surfaces = entry.surfaces.filter((other) => other.id !== surface);
@@ -740,14 +743,15 @@ const state = ({ closing, open = {}, root = null, sharing = {}, store }: Options
740
743
 
741
744
  // Shows the surface, wherever it already is, or adds it to 'group', the focused group or a new one. A surface
742
745
  // open elsewhere moves into the given group, if its area shares with the group's; otherwise it shows where it is.
743
- open(surface: Surface, group?: string) {
746
+ // Opens the sidebar it lands in, unless 'reveal' is false, as for an add made from a group already on screen.
747
+ open(surface: Surface, group?: string, reveal = true) {
744
748
  structural((current) => {
745
749
  let existing = findSurfaceGroup(current.root, surface.id),
746
750
  target = group ? findGroup(current.root, group) : null;
747
751
 
748
752
  if (existing && (!target || existing.id === target.id || !shared(existing, target.placement))) {
749
753
  return {
750
- ...visible(existing, current),
754
+ ...(reveal ? visible(existing, current) : current),
751
755
  active: existing.id,
752
756
  root: updateGroup(current.root, existing.id, (entry) => ({ ...entry, active: surface.id }))
753
757
  };
@@ -772,7 +776,7 @@ const state = ({ closing, open = {}, root = null, sharing = {}, store }: Options
772
776
  let root = existing ? take(current.root, existing, surface.id) : current.root;
773
777
 
774
778
  return {
775
- ...visible(target, current),
779
+ ...(reveal ? visible(target, current) : current),
776
780
  active: target.id,
777
781
  root: updateGroup(root, target.id, (entry) => ({ ...entry, active: surface.id, surfaces: [...entry.surfaces, surface] }))
778
782
  };