@esportsplus/ui 0.65.0 → 0.66.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/README.md +1 -1
- package/build/components/shell/group.d.ts +2 -0
- package/build/components/shell/group.js +1 -1
- package/build/components/shell/index.d.ts +4 -0
- package/build/components/shell/index.js +2 -1
- package/package.json +1 -1
- package/src/components/shell/group.ts +4 -2
- package/src/components/shell/index.ts +5 -1
package/README.md
CHANGED
|
@@ -92,7 +92,7 @@ html`
|
|
|
92
92
|
| `loading` | Border loading indicator |
|
|
93
93
|
| `typewriter` | Animated typing effect; `typewriter.retype` is a headline word that is selected and typed over with a jittered, human rhythm, landing whole words under reduced motion. Both share the caret variables and `--block`/`--hard`/`--underscore` modifiers. `typewriter.rotate` is a rotating word (`state.index`, `state.paused`) whose shared letters glide into place while the others blur out and in; `typewriter-rotate--accent` |
|
|
94
94
|
| `group` | Items in a row that wraps, spaced by `--gap-horizontal` / `--gap-vertical`; `group--column` stacks a `group-label`, a control and a `group-description` / `group-error` / `group-footer` under it, `group--grid` sets the label beside the control (held to `--control-width`) with the description on its own line, `group--row` holds every item on one line without wrapping, `group-header` bolds the label, `group--invalid` reddens the description; `group-item--overlay` items float over a control's start or end (by which side of it they're written on), which `group()` measures and pads the control to clear; attributes under `[group.highlight]` add a `highlight` behind the items; `button--group` items sit joined as a segmented control, medium weight while `--active` | `group.highlight`, `group-item--overlay` |
|
|
95
|
-
| `shell` | The app frame: tabbed groups of surfaces in resizable splits, in a main area between a sidebar on either edge, above a bottom dock. Built from a `catalog` of kinds (`title`, read reactively, `render`, optional `icon`, `description`, `shortcut`, `multiple`, `addable: false` to keep a kind out of `+` and the launcher, `tooltip`, `tab(surface)` returning `attributes` spread on the tab, `badges` after its title and an `icon` in place of the kind's, and `menu(surface)` returning the tab menu's items in place of the layout's own) and a `shell.state()` holding the layout (`root`, `open` for which docks start open, `closing(surfaces)` asked before a close takes surfaces away, which keeps them by returning or resolving `false`, and an optional `store`, any `@esportsplus/web-storage` `Local<{ shell: Saved }>` or object with its async `get` / `set`, which restores the tree once it reads back unless the tree changed first, and saves it after each change); besides its moves and closes the state can `replace(previous, surface)` in place without asking `closing`, `load(root)` a whole tree, and `back()` step back one view as a double click does, returning false once there is nothing left to step out of; `empty` renders what an empty group or main area shows in place of the launcher; `icons: true` shows tabs as their kind's icon alone, closed from their menu, and `sidebars: { left, right }` give each sidebar a `label`, `hover` to peek while the pointer rests on its edge, and `resizable` to drag its inner border; a sidebar named there always shows its toggle, and a sidebar's last group stays when its tabs close, showing the empty state until it is filled or closed. A group's `placement` (`left`, `right`, `bottom`) docks it. Tabs drag to reorder, into another group, onto a group's half to split it, or onto the strip along the left, right or bottom edge to dock there; separators resize, a double-clicked header maximizes, groups clicked with Ctrl (⌘ on Apple platforms) held fill the main area together once it is let go (Esc cancels), or at once when a press with it held sweeps across them and is released; in a layout nested inside a group the innermost layout picks, and a double click on any header steps back one view at a time (out of a maximized group, then each zoom in turn, restoring the group maximized before it) until the layout is back at its own view, where it maximizes again; tabs carry a close menu. `+` and an empty group's launcher open a kind. Each surface renders once and moves between slots, keeping its state until its tab closes. A surface with `sortable: false` stays in its group; alone there, the group is static, showing it without tabs and taking no drops, and a static sidebar swipes closed toward its edge. Sidebars toggle from their top corner (`state.toggle(placement, open?)`), open by clicking or dragging their edge, and, when `resizable`, resize from their inner border between `--sidebar-min-width` and `--sidebar-max-width`, never leaving the main area narrower than `--main-min-width` (`320px`); `--space` is their width until resized, `--toggle-size` / `--toggle-top` / `--toggle-left` / `--toggle-right` place the toggles (by default centred on the group headers' `--header-height`, so they line up with the tabs) and `--slide-duration` / `--slide-timing-function` time the motion. At or below `narrow` (default `1024`) px of the layout's own width, one sidebar opens at a time, pushing the main area aside, and the main area shows one group, switched from its header. A static group docks whole into an empty dock (`state.dock`). Each sidebar, the main area and the bottom dock rebuild only when their own groups change | `shell.state` |
|
|
95
|
+
| `shell` | The app frame: tabbed groups of surfaces in resizable splits, in a main area between a sidebar on either edge, above a bottom dock. Built from a `catalog` of kinds (`title`, read reactively, `render`, optional `icon`, `description`, `shortcut`, `multiple`, `addable: false` to keep a kind out of `+` and the launcher, `tooltip`, `tab(surface)` returning `attributes` spread on the tab, `badges` after its title and an `icon` in place of the kind's, and `menu(surface)` returning the tab menu's items in place of the layout's own) and a `shell.state()` holding the layout (`root`, `open` for which docks start open, `closing(surfaces)` asked before a close takes surfaces away, which keeps them by returning or resolving `false`, and an optional `store`, any `@esportsplus/web-storage` `Local<{ shell: Saved }>` or object with its async `get` / `set`, which restores the tree once it reads back unless the tree changed first, and saves it after each change); besides its moves and closes the state can `replace(previous, surface)` in place without asking `closing`, `load(root)` a whole tree, and `back()` step back one view as a double click does, returning false once there is nothing left to step out of; `empty` renders what an empty group or main area shows in place of the launcher; `icons: true` shows tabs as their kind's icon alone, closed from their menu, and `sidebars: { left, right }` give each sidebar a `label`, `hover` to peek while the pointer rests on its edge, and `resizable` to drag its inner border; a sidebar named there always shows its toggle, and a sidebar's last group stays when its tabs close, showing the empty state until it is filled or closed. `tabs: { scrollbar }` passes scrollbar options to every group's tab strip, over its hidden horizontal bar, such as `fade: true` to shade the edges it scrolls past. A group's `placement` (`left`, `right`, `bottom`) docks it. Tabs drag to reorder, into another group, onto a group's half to split it, or onto the strip along the left, right or bottom edge to dock there; separators resize, a double-clicked header maximizes, groups clicked with Ctrl (⌘ on Apple platforms) held fill the main area together once it is let go (Esc cancels), or at once when a press with it held sweeps across them and is released; in a layout nested inside a group the innermost layout picks, and a double click on any header steps back one view at a time (out of a maximized group, then each zoom in turn, restoring the group maximized before it) until the layout is back at its own view, where it maximizes again; tabs carry a close menu. `+` and an empty group's launcher open a kind. Each surface renders once and moves between slots, keeping its state until its tab closes. A surface with `sortable: false` stays in its group; alone there, the group is static, showing it without tabs and taking no drops, and a static sidebar swipes closed toward its edge. Sidebars toggle from their top corner (`state.toggle(placement, open?)`), open by clicking or dragging their edge, and, when `resizable`, resize from their inner border between `--sidebar-min-width` and `--sidebar-max-width`, never leaving the main area narrower than `--main-min-width` (`320px`); `--space` is their width until resized, `--toggle-size` / `--toggle-top` / `--toggle-left` / `--toggle-right` place the toggles (by default centred on the group headers' `--header-height`, so they line up with the tabs) and `--slide-duration` / `--slide-timing-function` time the motion. At or below `narrow` (default `1024`) px of the layout's own width, one sidebar opens at a time, pushing the main area aside, and the main area shows one group, switched from its header. A static group docks whole into an empty dock (`state.dock`). Each sidebar, the main area and the bottom dock rebuild only when their own groups change | `shell.state` |
|
|
96
96
|
| `highlight` | Layer that glides behind its parent's children on hover and focus and rests on the `--active` one (`target` for nested items, `hover: false` for the active layer only); `border: 'bottom' \| 'left' \| 'right' \| 'top'` adds an edge border to the active layer with both fills kept `--border-inset-horizontal` / `--border-inset-vertical` clear of it, `fill: false` drops the active background, `--glide-tail-duration-active` longer than `--glide-duration-active` stretches it toward the next item, `--inset-horizontal` / `--inset-vertical` pull the fill in from the item; `highlight--rail` on the highlight and `--highlight-rail` with `--highlight-rail-{bottom,left,right,top}` on its container make tabs along a rail at `--rail-width`, the border on the same edge lying over it |
|
|
97
97
|
| `ellipsis` | Animated dots |
|
|
98
98
|
| `icon` | SVG sprite wrapper, `icon(attributes, href)`: the sized box (`--size`, or `--width`/`--height`) colored by `--color`, whose `fill` the `<svg>` inherits, so a stroked icon sets `fill: none` on the box; attributes under `[icon.svg]` go on the `<svg>` itself, `class` included; it turns by `--rotate` (default `0deg`), and the directional sprites (`arrow.svg`, `chevron.svg`), which point right, take `icon--down`, `icon--left` or `icon--up`; `icon--rotate` eases between turns, skipped under reduced motion | `icon.svg` |
|
|
@@ -3,6 +3,7 @@ import * as template_u1 from '@esportsplus/template';
|
|
|
3
3
|
import { type Attributes, type Renderable } from '@esportsplus/template';
|
|
4
4
|
import { type SortableOptions } from '../sortable/index.js';
|
|
5
5
|
import type { Item } from '../tooltip/menu.js';
|
|
6
|
+
import { type Options as ScrollbarOptions } from '../../modifiers/scrollbar/index.js';
|
|
6
7
|
import { type Group, type Layout, type Surface } from './model.js';
|
|
7
8
|
import type state from './model.js';
|
|
8
9
|
type Catalog = Record<string, Kind>;
|
|
@@ -20,6 +21,7 @@ type Context = {
|
|
|
20
21
|
offering: (group: string) => boolean;
|
|
21
22
|
pick: (group: string) => void;
|
|
22
23
|
picked: (group: string) => boolean;
|
|
24
|
+
scrollbar: ScrollbarOptions;
|
|
23
25
|
slot: (surface: string) => Renderable<unknown>;
|
|
24
26
|
sorting: (strip: ReactiveArray<Surface>, group: string) => SortableOptions<Surface>;
|
|
25
27
|
state: ReturnType<typeof state>;
|
|
@@ -274,7 +274,7 @@ const group = (context, live) => {
|
|
|
274
274
|
template_u1.slot(element_0hnf69a1a, icon({ 'aria-hidden': 'true' }, close), 1);
|
|
275
275
|
template_u1.delegate(element_0hnf69a1a, 'click', () => void context.state.closeGroup(group.id));
|
|
276
276
|
template_u1.setClass(element_0hnf69a1a, ["button shell-action"]);
|
|
277
|
-
let attributes_0hnf69a1h = scrollbar(
|
|
277
|
+
let attributes_0hnf69a1h = scrollbar(context.scrollbar);
|
|
278
278
|
template_u1.setProperties(element_0hnf69a15, attributes_0hnf69a1h, true);
|
|
279
279
|
template_u1.setProperties(element_0hnf69a15, list.attributes);
|
|
280
280
|
template_u1.onconnect(element_0hnf69a15, (element) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
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
5
|
import state, { type Layout, type Node, type Placement, type Saved, type Store, type Surface } from './model.js';
|
|
5
6
|
import { type Edge, type Options } from './sidebar.js';
|
|
@@ -12,6 +13,9 @@ 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 & {
|
|
@@ -173,7 +173,7 @@ function under(workspace, x, y) {
|
|
|
173
173
|
let found = document.elementsFromPoint(x, y).find((element) => element.matches('.shell-group') && element.closest('.shell') === workspace);
|
|
174
174
|
return found?.dataset.group;
|
|
175
175
|
}
|
|
176
|
-
const shell = component(function ({ catalog, empty, icons = false, narrow: breakpoint = NARROW, sidebars: options = {}, state, ...attributes }) {
|
|
176
|
+
const shell = component(function ({ catalog, empty, icons = false, narrow: breakpoint = NARROW, sidebars: options = {}, state, tabs = {}, ...attributes }) {
|
|
177
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
178
|
let narrow = () => size.width > 0 && size.width <= breakpoint;
|
|
179
179
|
let edges = {
|
|
@@ -248,6 +248,7 @@ const shell = component(function ({ catalog, empty, icons = false, narrow: break
|
|
|
248
248
|
write(picks, current.includes(group) ? current.filter((id) => id !== group) : [...current, group]);
|
|
249
249
|
},
|
|
250
250
|
picked: (group) => read(picks).includes(group),
|
|
251
|
+
scrollbar: { hidden: true, ...tabs.scrollbar, horizontal: true },
|
|
251
252
|
slot: (surface) => {
|
|
252
253
|
let root_1dhwcf3d = template_1dhwcf3e();
|
|
253
254
|
template_u1.onconnect(root_1dhwcf3d, (element) => {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import highlight from '~/components/highlight';
|
|
|
4
4
|
import icon from '~/components/icon';
|
|
5
5
|
import sortable, { type SortableOptions } from '~/components/sortable';
|
|
6
6
|
import type { Item } from '~/components/tooltip/menu';
|
|
7
|
-
import scrollbar from '~/modifiers/scrollbar';
|
|
7
|
+
import scrollbar, { type Options as ScrollbarOptions } from '~/modifiers/scrollbar';
|
|
8
8
|
import { fixed, type Group, type Layout, type Surface } from './model';
|
|
9
9
|
import type state from './model';
|
|
10
10
|
import subtree from './subtree';
|
|
@@ -42,6 +42,8 @@ type Context = {
|
|
|
42
42
|
// Picks or unpicks the group for the zoom made when the modifier is let go.
|
|
43
43
|
pick: (group: string) => void;
|
|
44
44
|
picked: (group: string) => boolean;
|
|
45
|
+
// Each tab strip's scrollbar.
|
|
46
|
+
scrollbar: ScrollbarOptions;
|
|
45
47
|
// The slot a surface's long-lived host moves into while it shows.
|
|
46
48
|
slot: (surface: string) => Renderable<unknown>;
|
|
47
49
|
// How a group's tab strip sorts, shared by every strip so tabs move between them; 'strip' is the group's tabs.
|
|
@@ -392,7 +394,7 @@ const group = (context: Context, live: Live) => {
|
|
|
392
394
|
aria-label='Tabs'
|
|
393
395
|
class='shell-tabs'
|
|
394
396
|
role='tablist'
|
|
395
|
-
${scrollbar(
|
|
397
|
+
${scrollbar(context.scrollbar)}
|
|
396
398
|
${list.attributes}
|
|
397
399
|
${{
|
|
398
400
|
onconnect: (element: HTMLElement) => {
|
|
@@ -3,6 +3,7 @@ import { component, html, render, type Attributes, type Renderable } from '@espo
|
|
|
3
3
|
import icon from '~/components/icon';
|
|
4
4
|
import tooltip from '~/components/tooltip';
|
|
5
5
|
import type { Controller, Item } from '~/components/tooltip/menu';
|
|
6
|
+
import type { Options as Scrollbar } from '~/modifiers/scrollbar';
|
|
6
7
|
import { mac } from '~/shared/platform';
|
|
7
8
|
import { observe } from '~/shared/resize';
|
|
8
9
|
import { group, launcher, title, type Catalog, type Context, type Kind } from './group';
|
|
@@ -26,6 +27,8 @@ type A = Attributes & {
|
|
|
26
27
|
// Each sidebar's label, whether it peeks while the pointer rests on its edge, and whether it resizes.
|
|
27
28
|
sidebars?: Partial<Record<Edge, Options>>;
|
|
28
29
|
state: ReturnType<typeof state>;
|
|
30
|
+
// Every group's tab strip: 'scrollbar' over the strip's own hidden horizontal bar, such as 'fade' for edge shadows.
|
|
31
|
+
tabs?: { scrollbar?: Scrollbar };
|
|
29
32
|
};
|
|
30
33
|
|
|
31
34
|
type Host = { dispose: VoidFunction; element: HTMLElement };
|
|
@@ -190,7 +193,7 @@ function under(workspace: HTMLElement, x: number, y: number) {
|
|
|
190
193
|
// corner, and a closed sidebar's edge holds a handle to drag it out by. A sidebar holding a single unsortable surface
|
|
191
194
|
// is static: it shows the surface without tabs, takes no drops, and swipes closed toward its edge.
|
|
192
195
|
const shell = component(
|
|
193
|
-
function({ catalog, empty, icons = false, narrow: breakpoint = NARROW, sidebars: options = {}, state, ...attributes }: A) {
|
|
196
|
+
function({ catalog, empty, icons = false, narrow: breakpoint = NARROW, sidebars: options = {}, state, tabs = {}, ...attributes }: A) {
|
|
194
197
|
let adding: Controller | undefined,
|
|
195
198
|
// The add menu shows, opened from 'subject.group''s add button.
|
|
196
199
|
added = reactive({ active: false }),
|
|
@@ -314,6 +317,7 @@ const shell = component(
|
|
|
314
317
|
write(picks, current.includes(group) ? current.filter((id) => id !== group) : [...current, group]);
|
|
315
318
|
},
|
|
316
319
|
picked: (group: string) => read(picks).includes(group),
|
|
320
|
+
scrollbar: { hidden: true, ...tabs.scrollbar, horizontal: true },
|
|
317
321
|
slot: (surface: string) => html`
|
|
318
322
|
<div
|
|
319
323
|
class='shell-slot'
|