@softov/scena 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/builtins.d.ts +3 -0
- package/dist/{runtime → core}/builtins.js +1 -1
- package/dist/core/controls/command.d.ts +18 -0
- package/dist/{controls → core/controls}/command.js +2 -2
- package/dist/{controls → core/controls}/events.d.ts +1 -1
- package/dist/{controls → core/controls}/events.js +1 -1
- package/dist/core/controls/keybinding.d.ts +9 -0
- package/dist/{controls → core/controls}/keybinding.js +1 -1
- package/dist/core/controls/layout.d.ts +31 -0
- package/dist/{controls → core/controls}/layout.js +24 -7
- package/dist/core/controls/manifest.d.ts +21 -0
- package/dist/{controls → core/controls}/manifest.js +2 -2
- package/dist/core/controls/session.d.ts +16 -0
- package/dist/{controls → core/controls}/session.js +5 -13
- package/dist/{controls → core/controls}/shell.d.ts +2 -2
- package/dist/{controls → core/controls}/shell.js +1 -1
- package/dist/{controls → core/controls}/storage/layout-local.d.ts +1 -1
- package/dist/{controls → core/controls}/storage/session-local.d.ts +1 -1
- package/dist/{controls → core/controls}/when.d.ts +2 -2
- package/dist/{controls → core/controls}/when.js +1 -1
- package/dist/{converters → core/converters}/a2ui-v0.10.d.ts +1 -1
- package/dist/core/{component-graph.d.ts → graph/component-graph.d.ts} +1 -1
- package/dist/core/{component-graph.js → graph/component-graph.js} +1 -1
- package/dist/core/{mount-menu.d.ts → graph/mount-menu.d.ts} +1 -1
- package/dist/core/{mount-menu.js → graph/mount-menu.js} +1 -1
- package/dist/core/graph/mount-surface.d.ts +15 -0
- package/dist/core/{mount-surface.js → graph/mount-surface.js} +23 -4
- package/dist/core/{surface-presentation.d.ts → graph/surface-presentation.d.ts} +3 -3
- package/dist/{i18n → core/i18n}/i18n-backend.d.ts +1 -1
- package/dist/core/index.d.ts +34 -43
- package/dist/core/index.js +35 -38
- package/dist/core/{component-registry.d.ts → registry/component-registry.d.ts} +2 -2
- package/dist/core/{component-registry.js → registry/component-registry.js} +1 -1
- package/dist/core/registry/converter-registry.d.ts +2 -0
- package/dist/core/{converter-registry.js → registry/converter-registry.js} +1 -1
- package/dist/core/resolve/binding-resolver.d.ts +7 -0
- package/dist/core/{binding-resolver.js → resolve/binding-resolver.js} +2 -2
- package/dist/core/{dynamic-resolver.d.ts → resolve/dynamic-resolver.d.ts} +2 -2
- package/dist/core/{dynamic-resolver.js → resolve/dynamic-resolver.js} +1 -1
- package/dist/core/{path-resolver.d.ts → resolve/path-resolver.d.ts} +2 -2
- package/dist/core/{permissions.d.ts → resolve/permissions.d.ts} +1 -1
- package/dist/core/scena.d.ts +1 -1
- package/dist/core/scena.js +17 -16
- package/dist/core/{backends → store/backends}/modus-backend.d.ts +1 -1
- package/dist/core/{backends → store/backends}/storage-backend.d.ts +1 -1
- package/dist/core/{backends → store/backends}/yjs-backend.d.ts +1 -1
- package/dist/core/{reactive-store.d.ts → store/reactive-store.d.ts} +4 -4
- package/dist/core/{reactive-store.js → store/reactive-store.js} +2 -2
- package/dist/index.d.ts +8 -0
- package/dist/index.js +13 -0
- package/dist/porta/Limen.d.ts +1 -0
- package/dist/porta/Limen.js +1 -0
- package/dist/porta/PortaLock.d.ts +1 -0
- package/dist/porta/PortaLock.js +6 -2
- package/dist/porta/SigillumGate.d.ts +1 -0
- package/dist/porta/SigillumGate.js +1 -0
- package/dist/porta/commands.d.ts +1 -1
- package/dist/porta/login-form.block.d.ts +1 -1
- package/dist/porta/provider.d.ts +1 -1
- package/dist/porta/register-blocks.d.ts +2 -2
- package/dist/porta/register-blocks.js +4 -7
- package/dist/porta/register.d.ts +1 -1
- package/dist/porta/sigillum.d.ts +2 -2
- package/dist/react/DefaultShell.d.ts +47 -1
- package/dist/react/DefaultShell.js +81 -12
- package/dist/react/Scena.d.ts +2 -2
- package/dist/react/ScenaProvider.d.ts +1 -1
- package/dist/react/ShellSplitter.d.ts +1 -1
- package/dist/react/SurfaceArea.d.ts +5 -3
- package/dist/react/SurfaceArea.js +2 -2
- package/dist/react/ViewMount.d.ts +1 -1
- package/dist/react/ViewMount.js +4 -4
- package/dist/react/hooks/useI18n.d.ts +1 -1
- package/dist/react/hooks/useI18n.js +1 -1
- package/dist/react/hooks/useLabel.d.ts +1 -1
- package/dist/react/hooks/useLabel.js +1 -1
- package/dist/react/hooks/useLayout.d.ts +1 -1
- package/dist/react/hooks/useMounts.d.ts +1 -1
- package/dist/react/hooks/useStore.d.ts +1 -1
- package/dist/react/hooks/useStore.js +2 -2
- package/dist/react/hooks/useStoreLabel.d.ts +2 -2
- package/dist/react/hooks/useStoreLabel.js +1 -1
- package/dist/react/hooks/useSurfacePresentation.d.ts +3 -3
- package/dist/react/hooks/useSurfacePresentation.js +1 -1
- package/dist/react/mount-context.d.ts +1 -1
- package/dist/react/useSurfaceResize.d.ts +2 -2
- package/dist/runtime/client-handlers.d.ts +1 -1
- package/dist/runtime/in-memory-socket.d.ts +2 -2
- package/dist/runtime/index.d.ts +3 -3
- package/dist/runtime/index.js +2 -2
- package/dist/runtime/layout-commands.d.ts +3 -3
- package/dist/runtime/layout-commands.js +2 -2
- package/dist/runtime/opener-commands.d.ts +5 -5
- package/dist/runtime/opener-commands.js +3 -3
- package/dist/runtime/surface-bridge.d.ts +5 -5
- package/dist/runtime/surface-bridge.js +1 -1
- package/dist/{runtime → sdk}/args-schema.d.ts +1 -1
- package/dist/{core → sdk}/disposable.d.ts +3 -1
- package/dist/{types → sdk}/index.d.ts +1 -0
- package/dist/{types → sdk}/index.js +1 -0
- package/dist/{types → sdk}/label.d.ts +1 -0
- package/dist/{core → sdk}/label.js +0 -1
- package/dist/{types → sdk}/layout.d.ts +25 -0
- package/dist/{types → sdk}/mount-surface.d.ts +19 -1
- package/dist/{types → sdk}/scena.d.ts +2 -1
- package/dist/styles/bar.css +8 -4
- package/dist/styles/base.css +18 -16
- package/dist/styles/controller.d.ts +27 -0
- package/dist/styles/controller.js +74 -0
- package/dist/styles/form.css +10 -0
- package/dist/styles/index.d.ts +2 -0
- package/dist/styles/index.js +3 -0
- package/dist/styles/surface.css +69 -3
- package/dist/styles/themes/tokens.css +1 -1
- package/dist/ui/_utils.d.ts +1 -1
- package/dist/ui/_utils.js +2 -2
- package/dist/ui/campus/CampusMappa.js +1 -1
- package/dist/ui/chart/catalog.d.ts +1 -1
- package/dist/ui/control/ButtonBar.css +61 -0
- package/dist/ui/control/ButtonBar.d.ts +36 -0
- package/dist/ui/control/ButtonBar.js +42 -0
- package/dist/ui/control/ThemeModeToggle.css +22 -0
- package/dist/ui/control/ThemeModeToggle.d.ts +20 -0
- package/dist/ui/control/ThemeModeToggle.js +34 -0
- package/dist/ui/control/ThemePicker.css +24 -0
- package/dist/ui/control/ThemePicker.d.ts +27 -0
- package/dist/ui/control/ThemePicker.js +33 -0
- package/dist/ui/control/catalog.d.ts +1 -1
- package/dist/ui/control/catalog.js +5 -1
- package/dist/ui/control/index.d.ts +6 -0
- package/dist/ui/control/index.js +3 -0
- package/dist/ui/data/Filter.d.ts +1 -1
- package/dist/ui/data/Listable.d.ts +3 -2
- package/dist/ui/data/Listable.js +4 -2
- package/dist/ui/data/Pagination.d.ts +4 -1
- package/dist/ui/data/Pagination.js +37 -9
- package/dist/ui/data/Tree.d.ts +2 -2
- package/dist/ui/data/Tree.js +1 -1
- package/dist/ui/data/catalog.d.ts +1 -1
- package/dist/ui/display/Alert.css +15 -10
- package/dist/ui/display/Badge.css +22 -14
- package/dist/ui/display/Badge.d.ts +1 -1
- package/dist/ui/display/Badge.js +1 -1
- package/dist/ui/display/DetailHeader.css +3 -3
- package/dist/ui/display/DetailList.js +3 -2
- package/dist/ui/display/DetailNotFound.d.ts +1 -1
- package/dist/ui/display/DetailNotFound.js +1 -1
- package/dist/ui/display/Progress.d.ts +1 -1
- package/dist/ui/display/Progress.js +1 -1
- package/dist/ui/display/Spinner.d.ts +1 -1
- package/dist/ui/display/Spinner.js +1 -1
- package/dist/ui/display/StatusDot.css +46 -0
- package/dist/ui/display/StatusDot.d.ts +17 -0
- package/dist/ui/display/StatusDot.js +16 -0
- package/dist/ui/display/Svg.d.ts +1 -1
- package/dist/ui/display/Svg.js +1 -1
- package/dist/ui/display/catalog.d.ts +1 -1
- package/dist/ui/display/catalog.js +1 -0
- package/dist/ui/display/index.d.ts +2 -0
- package/dist/ui/display/index.js +1 -0
- package/dist/ui/forms/LoginForm.d.ts +1 -0
- package/dist/ui/forms/LoginForm.js +1 -0
- package/dist/ui/forms/SettingsContainer.d.ts +2 -1
- package/dist/ui/forms/SettingsContainer.js +2 -2
- package/dist/ui/forms/catalog.d.ts +1 -1
- package/dist/ui/index.d.ts +6 -1
- package/dist/ui/index.js +3 -1
- package/dist/ui/layout/BarLayout.d.ts +1 -1
- package/dist/ui/layout/FloatingLayout.d.ts +1 -1
- package/dist/ui/layout/InlineLayout.d.ts +1 -1
- package/dist/ui/layout/MountTitle.d.ts +2 -2
- package/dist/ui/layout/MountTitle.js +2 -2
- package/dist/ui/layout/RailLayout.d.ts +1 -1
- package/dist/ui/layout/SectionHeader.d.ts +2 -2
- package/dist/ui/layout/SectionHeader.js +4 -7
- package/dist/ui/layout/SingleLayout.d.ts +1 -1
- package/dist/ui/layout/SpatialCard.d.ts +2 -2
- package/dist/ui/layout/SpatialLayout.d.ts +1 -1
- package/dist/ui/layout/SplitLayout.d.ts +1 -1
- package/dist/ui/layout/StackHeader.d.ts +1 -1
- package/dist/ui/layout/StackLayout.d.ts +1 -1
- package/dist/ui/layout/TabLayout.d.ts +1 -1
- package/dist/ui/layout/TabPanelLayout.d.ts +2 -2
- package/dist/ui/layout/TabPanelLayout.js +1 -1
- package/dist/ui/layout/catalog.d.ts +1 -1
- package/dist/ui/layout/register.d.ts +2 -2
- package/dist/ui/layout/register.js +1 -1
- package/dist/ui/media/catalog.d.ts +1 -1
- package/dist/ui/menu/ActionList.d.ts +2 -2
- package/dist/ui/menu/ActionList.js +1 -1
- package/dist/ui/menu/ContainerMenu.d.ts +2 -2
- package/dist/ui/menu/ContextMenu.d.ts +2 -2
- package/dist/ui/menu/useChatPicker.d.ts +2 -2
- package/dist/ui/navigation/ActivityBarItem.css +81 -0
- package/dist/ui/navigation/ActivityBarItem.d.ts +61 -0
- package/dist/ui/navigation/ActivityBarItem.js +68 -0
- package/dist/ui/navigation/catalog.d.ts +1 -1
- package/dist/ui/navigation/catalog.js +1 -0
- package/dist/ui/navigation/index.d.ts +2 -0
- package/dist/ui/navigation/index.js +1 -0
- package/dist/ui/overlay/catalog.d.ts +1 -1
- package/dist/ui/register.d.ts +3 -3
- package/dist/ui/register.js +1 -1
- package/package.json +15 -7
- package/dist/controls/command.d.ts +0 -18
- package/dist/controls/keybinding.d.ts +0 -9
- package/dist/controls/layout.d.ts +0 -16
- package/dist/controls/manifest.d.ts +0 -21
- package/dist/controls/session.d.ts +0 -16
- package/dist/core/binding-resolver.d.ts +0 -7
- package/dist/core/converter-registry.d.ts +0 -2
- package/dist/core/label.d.ts +0 -2
- package/dist/core/mount-surface.d.ts +0 -15
- package/dist/runtime/builtins.d.ts +0 -3
- package/dist/types/disposable.d.ts +0 -3
- package/dist/types/disposable.js +0 -1
- package/dist/types/label.js +0 -1
- /package/dist/{controls → core/controls}/index.d.ts +0 -0
- /package/dist/{controls → core/controls}/index.js +0 -0
- /package/dist/{controls → core/controls}/storage/layout-local.js +0 -0
- /package/dist/{controls → core/controls}/storage/session-local.js +0 -0
- /package/dist/{converters → core/converters}/a2ui-v0.10.js +0 -0
- /package/dist/{converters → core/converters}/index.d.ts +0 -0
- /package/dist/{converters → core/converters}/index.js +0 -0
- /package/dist/core/{surface-presentation.js → graph/surface-presentation.js} +0 -0
- /package/dist/{i18n → core/i18n}/i18n-backend.js +0 -0
- /package/dist/{i18n → core/i18n}/registry.d.ts +0 -0
- /package/dist/{i18n → core/i18n}/registry.js +0 -0
- /package/dist/core/{path-resolver.js → resolve/path-resolver.js} +0 -0
- /package/dist/core/{permissions.js → resolve/permissions.js} +0 -0
- /package/dist/core/{backends → store/backends}/modus-backend.js +0 -0
- /package/dist/core/{backends → store/backends}/storage-backend.js +0 -0
- /package/dist/core/{backends → store/backends}/yjs-backend.js +0 -0
- /package/dist/core/{computed-dsl.d.ts → store/computed-dsl.d.ts} +0 -0
- /package/dist/core/{computed-dsl.js → store/computed-dsl.js} +0 -0
- /package/dist/{runtime → sdk}/args-schema.js +0 -0
- /package/dist/{types → sdk}/binding-resolver.d.ts +0 -0
- /package/dist/{types → sdk}/binding-resolver.js +0 -0
- /package/dist/{types → sdk}/colors.d.ts +0 -0
- /package/dist/{types → sdk}/colors.js +0 -0
- /package/dist/{types → sdk}/command.d.ts +0 -0
- /package/dist/{types → sdk}/command.js +0 -0
- /package/dist/{types → sdk}/component-graph.d.ts +0 -0
- /package/dist/{types → sdk}/component-graph.js +0 -0
- /package/dist/{types → sdk}/component-registry.d.ts +0 -0
- /package/dist/{types → sdk}/component-registry.js +0 -0
- /package/dist/{types → sdk}/converter-registry.d.ts +0 -0
- /package/dist/{types → sdk}/converter-registry.js +0 -0
- /package/dist/{core → sdk}/disposable.js +0 -0
- /package/dist/{types → sdk}/events.d.ts +0 -0
- /package/dist/{types → sdk}/events.js +0 -0
- /package/dist/{types → sdk}/host.d.ts +0 -0
- /package/dist/{types → sdk}/host.js +0 -0
- /package/dist/{types → sdk}/keybinding.d.ts +0 -0
- /package/dist/{types → sdk}/keybinding.js +0 -0
- /package/dist/{types → sdk}/layout.js +0 -0
- /package/dist/{types → sdk}/manifest.d.ts +0 -0
- /package/dist/{types → sdk}/manifest.js +0 -0
- /package/dist/{types → sdk}/mount-menu.d.ts +0 -0
- /package/dist/{types → sdk}/mount-menu.js +0 -0
- /package/dist/{types → sdk}/mount-surface.js +0 -0
- /package/dist/{types → sdk}/permissions.d.ts +0 -0
- /package/dist/{types → sdk}/permissions.js +0 -0
- /package/dist/{types → sdk}/query.d.ts +0 -0
- /package/dist/{types → sdk}/query.js +0 -0
- /package/dist/{types → sdk}/reactive-store.d.ts +0 -0
- /package/dist/{types → sdk}/reactive-store.js +0 -0
- /package/dist/{types → sdk}/scena.js +0 -0
- /package/dist/{types → sdk}/scope-backend.d.ts +0 -0
- /package/dist/{types → sdk}/scope-backend.js +0 -0
- /package/dist/{types → sdk}/session.d.ts +0 -0
- /package/dist/{types → sdk}/session.js +0 -0
- /package/dist/{types → sdk}/shell.d.ts +0 -0
- /package/dist/{types → sdk}/shell.js +0 -0
- /package/dist/{types → sdk}/when.d.ts +0 -0
- /package/dist/{types → sdk}/when.js +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
.oo-activity-item {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
flex: 0 0 auto;
|
|
7
|
+
width: var(--oo-activity-item-size, 44px);
|
|
8
|
+
height: var(--oo-activity-item-size, 44px);
|
|
9
|
+
padding: 0;
|
|
10
|
+
border: none;
|
|
11
|
+
/* The active marker is a border that is always present and usually
|
|
12
|
+
* transparent, so nothing shifts by 2px when it appears. */
|
|
13
|
+
border-inline-start: 2px solid transparent;
|
|
14
|
+
border-radius: 0;
|
|
15
|
+
background: var(--oo-activitybar-bg, transparent);
|
|
16
|
+
color: var(--oo-activitybar-fg);
|
|
17
|
+
font: inherit;
|
|
18
|
+
font-size: var(--oo-activity-item-icon-size, 18px);
|
|
19
|
+
line-height: 1;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
user-select: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.oo-activity-item:hover {
|
|
25
|
+
color: var(--oo-activitybar-fg-hover);
|
|
26
|
+
background: var(--oo-activitybar-bg-hover);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.oo-activity-item:focus-visible {
|
|
30
|
+
outline: 2px solid var(--oo-color-accent);
|
|
31
|
+
outline-offset: -2px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.oo-activity-item[data-active='true'] {
|
|
35
|
+
color: var(--oo-activitybar-fg-active);
|
|
36
|
+
background: var(--oo-activitybar-bg-active);
|
|
37
|
+
border-inline-start-color: var(--oo-color-accent);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* The rail layout stacks these; `bottom` pushes an entry to the far end. */
|
|
41
|
+
.oo-activity-item[data-pos='bottom'] {
|
|
42
|
+
margin-block-start: auto;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.oo-activity-item__badge {
|
|
46
|
+
position: absolute;
|
|
47
|
+
inset-inline-end: 3px;
|
|
48
|
+
inset-block-end: 3px;
|
|
49
|
+
min-width: 15px;
|
|
50
|
+
padding: 0 3px;
|
|
51
|
+
border-radius: var(--oo-radius-full);
|
|
52
|
+
font-size: 10px;
|
|
53
|
+
line-height: 15px;
|
|
54
|
+
text-align: center;
|
|
55
|
+
/* So a count that ticks 9 → 10 → 11 does not shuffle the digits sideways. */
|
|
56
|
+
font-variant-numeric: tabular-nums;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Background and the ink that stays readable on it, paired rather than one
|
|
60
|
+
* colour with a fixed foreground: the accent is a pale tint in most dark
|
|
61
|
+
* themes and wants dark text, while the status colours are saturated
|
|
62
|
+
* mid-tones in both modes and want light text. */
|
|
63
|
+
.oo-activity-item__badge {
|
|
64
|
+
background: var(--oo-color-accent);
|
|
65
|
+
color: var(--oo-color-canvas);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.oo-activity-item__badge[data-tone='info'] { background: var(--oo-color-info); color: var(--oo-color-inverse); }
|
|
69
|
+
.oo-activity-item__badge[data-tone='danger'] { background: var(--oo-color-danger); color: var(--oo-color-inverse); }
|
|
70
|
+
.oo-activity-item__badge[data-tone='warning'] { background: var(--oo-color-warning); color: var(--oo-color-inverse); }
|
|
71
|
+
.oo-activity-item__badge[data-tone='success'] { background: var(--oo-color-success); color: var(--oo-color-inverse); }
|
|
72
|
+
.oo-activity-item__badge[data-tone='muted'] { background: var(--oo-color-muted); color: var(--oo-color-inverse); }
|
|
73
|
+
|
|
74
|
+
/* The second count goes in the opposite corner, so the two never overlap and
|
|
75
|
+
* neither has to move when the other appears. A ring in the rail's own colour
|
|
76
|
+
* keeps it legible where it crosses the icon. */
|
|
77
|
+
.oo-activity-item__badge--second {
|
|
78
|
+
inset-block-end: auto;
|
|
79
|
+
inset-block-start: 3px;
|
|
80
|
+
box-shadow: 0 0 0 2px var(--oo-activitybar-bg, var(--oo-color-canvas));
|
|
81
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import type { BindingPath } from '../../sdk/component-graph.js';
|
|
3
|
+
import './ActivityBarItem.css';
|
|
4
|
+
/**
|
|
5
|
+
* What a badge means, which is not always "there are things".
|
|
6
|
+
*
|
|
7
|
+
* A count of items waiting and a count of hosts that fell over are not the same
|
|
8
|
+
* news, and one accent colour said they were. The tone is a second channel
|
|
9
|
+
* beside the number, never the only one: the count is always written, and
|
|
10
|
+
* `badgeLabel` says what it counts.
|
|
11
|
+
*/
|
|
12
|
+
export type ActivityBadgeTone = 'accent' | 'info' | 'danger' | 'warning' | 'success' | 'muted';
|
|
13
|
+
export interface ActivityBarItemProps {
|
|
14
|
+
icon?: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
section?: string;
|
|
17
|
+
sectionPath?: BindingPath;
|
|
18
|
+
pos?: 'top' | 'bottom';
|
|
19
|
+
badge?: string | number;
|
|
20
|
+
badgeTone?: ActivityBadgeTone;
|
|
21
|
+
badgeLabel?: string;
|
|
22
|
+
/**
|
|
23
|
+
* A second count, in the opposite corner.
|
|
24
|
+
*
|
|
25
|
+
* Two badges only where a section really answers two questions somebody acts
|
|
26
|
+
* on differently — a list of live agent sessions is the case: how many are
|
|
27
|
+
* working right now, and how many finished without anybody reading them. One
|
|
28
|
+
* is activity, the other is a backlog, and collapsing them into a sum would
|
|
29
|
+
* name neither.
|
|
30
|
+
*
|
|
31
|
+
* Kept to two. A third would be a chart on a 44-pixel icon.
|
|
32
|
+
*/
|
|
33
|
+
secondBadge?: string | number;
|
|
34
|
+
secondBadgeTone?: ActivityBadgeTone;
|
|
35
|
+
secondBadgeLabel?: string;
|
|
36
|
+
command?: string;
|
|
37
|
+
args?: Record<string, unknown>;
|
|
38
|
+
onClick?: () => void;
|
|
39
|
+
className?: string;
|
|
40
|
+
style?: CSSProperties;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* An entry in the activity bar.
|
|
44
|
+
*
|
|
45
|
+
* Every app on scena has written this, and it is the same component each time:
|
|
46
|
+
* an icon, an optional count, and an active state derived from which sidebar
|
|
47
|
+
* section is showing. What differed between the copies was only which of those
|
|
48
|
+
* each app had needed so far.
|
|
49
|
+
*
|
|
50
|
+
* Active state is read from layout state rather than passed in, because the
|
|
51
|
+
* caller is a `surfaces.mount` in a resource module that has no idea what else
|
|
52
|
+
* is mounted. Reading it here is what lets a rail of independently-registered
|
|
53
|
+
* entries agree on which one is current.
|
|
54
|
+
*
|
|
55
|
+
* With no `onClick`, clicking runs `command` if given and activates `section`
|
|
56
|
+
* via the `sidebar.activate` command. That command is not part of scena — an
|
|
57
|
+
* app registers it, because what "activate" means (which surface, whether it
|
|
58
|
+
* also reveals) is an app's decision.
|
|
59
|
+
*/
|
|
60
|
+
export declare function ActivityBarItem({ icon, label, section, sectionPath, pos, badge, badgeTone, badgeLabel, secondBadge, secondBadgeTone, secondBadgeLabel, command, args, onClick, className, style, }: ActivityBarItemProps): ReactNode;
|
|
61
|
+
export default ActivityBarItem;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useScena } from '../../react/ScenaProvider.js';
|
|
3
|
+
import { useStore } from '../../react/hooks/useStore.js';
|
|
4
|
+
import './ActivityBarItem.css';
|
|
5
|
+
const DEFAULT_SECTION_PATH = '$/layout/surfaces/sidebar:left/section';
|
|
6
|
+
// 0 is a real count and should not draw a badge; undefined and '' should not
|
|
7
|
+
// either. Anything else, including a non-numeric string, should. A rail of
|
|
8
|
+
// zeroes is a rail of noise, and an absent badge is the clearest way to say
|
|
9
|
+
// there is nothing waiting.
|
|
10
|
+
function shown(value) {
|
|
11
|
+
return value !== undefined && value !== '' && Number(value) !== 0;
|
|
12
|
+
}
|
|
13
|
+
// Three digits do not fit a 15px pill beside a 44px icon, and the difference
|
|
14
|
+
// between 120 and 400 is not what the rail is for — either way the answer is
|
|
15
|
+
// "more than you are going to read here".
|
|
16
|
+
function clamp(value) {
|
|
17
|
+
return typeof value === 'number' && value > 99 ? '99+' : value;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* An entry in the activity bar.
|
|
21
|
+
*
|
|
22
|
+
* Every app on scena has written this, and it is the same component each time:
|
|
23
|
+
* an icon, an optional count, and an active state derived from which sidebar
|
|
24
|
+
* section is showing. What differed between the copies was only which of those
|
|
25
|
+
* each app had needed so far.
|
|
26
|
+
*
|
|
27
|
+
* Active state is read from layout state rather than passed in, because the
|
|
28
|
+
* caller is a `surfaces.mount` in a resource module that has no idea what else
|
|
29
|
+
* is mounted. Reading it here is what lets a rail of independently-registered
|
|
30
|
+
* entries agree on which one is current.
|
|
31
|
+
*
|
|
32
|
+
* With no `onClick`, clicking runs `command` if given and activates `section`
|
|
33
|
+
* via the `sidebar.activate` command. That command is not part of scena — an
|
|
34
|
+
* app registers it, because what "activate" means (which surface, whether it
|
|
35
|
+
* also reveals) is an app's decision.
|
|
36
|
+
*/
|
|
37
|
+
export function ActivityBarItem({ icon, label, section, sectionPath = DEFAULT_SECTION_PATH, pos, badge, badgeTone = 'accent', badgeLabel, secondBadge, secondBadgeTone = 'accent', secondBadgeLabel, command, args, onClick, className, style, }) {
|
|
38
|
+
const scena = useScena();
|
|
39
|
+
const activeSection = useStore(sectionPath);
|
|
40
|
+
const active = section !== undefined && activeSection === section;
|
|
41
|
+
const hasBadge = shown(badge);
|
|
42
|
+
const hasSecondBadge = shown(secondBadge);
|
|
43
|
+
// Built as a sentence rather than a pair of numbers: "Live sessions: 2
|
|
44
|
+
// running, 5 unread" is the whole state of the section in one line, and it is
|
|
45
|
+
// the only place the two badges are told apart without colour.
|
|
46
|
+
const counts = [
|
|
47
|
+
...(hasBadge ? [badgeLabel ? `${badge} ${badgeLabel}` : `${badge}`] : []),
|
|
48
|
+
...(hasSecondBadge
|
|
49
|
+
? [secondBadgeLabel ? `${secondBadge} ${secondBadgeLabel}` : `${secondBadge}`]
|
|
50
|
+
: []),
|
|
51
|
+
];
|
|
52
|
+
const name = label ?? section ?? '';
|
|
53
|
+
const described = counts.length === 0 ? label : `${name}: ${counts.join(', ')}`;
|
|
54
|
+
function handleClick() {
|
|
55
|
+
if (onClick) {
|
|
56
|
+
onClick();
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (command)
|
|
60
|
+
void scena.commands.execute(command, args);
|
|
61
|
+
// `section` last: it is this item's identity, and a stray args.section
|
|
62
|
+
// silently activating a different one would be very hard to see.
|
|
63
|
+
if (section)
|
|
64
|
+
void scena.commands.execute('sidebar.activate', { ...args, section });
|
|
65
|
+
}
|
|
66
|
+
return (_jsxs("button", { type: "button", className: ['oo-activity-item', className].filter(Boolean).join(' '), style: style, "data-active": active, "data-pos": pos, title: described, "aria-label": described, "aria-current": active ? 'true' : undefined, onClick: handleClick, children: [_jsx("span", { className: "oo-activity-item__icon", "aria-hidden": "true", children: icon ?? '·' }), hasBadge ? (_jsx("span", { className: "oo-activity-item__badge", "data-tone": badgeTone, "aria-hidden": "true", children: clamp(badge) })) : null, hasSecondBadge ? (_jsx("span", { className: "oo-activity-item__badge oo-activity-item__badge--second", "data-tone": secondBadgeTone, "aria-hidden": "true", children: clamp(secondBadge) })) : null] }));
|
|
67
|
+
}
|
|
68
|
+
export default ActivityBarItem;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ComponentDefinition } from '../../
|
|
1
|
+
import type { ComponentDefinition } from '../../sdk/component-registry.js';
|
|
2
2
|
export declare const CATALOG_NAVIGATION_MAP: ComponentDefinition[];
|
|
@@ -2,4 +2,5 @@
|
|
|
2
2
|
export const CATALOG_NAVIGATION_MAP = [
|
|
3
3
|
{ component: 'Tabs', category: 'page', renderer: { kind: 'react', load: () => import('./Tabs.js').then((m) => ({ default: m.Tabs })) } },
|
|
4
4
|
{ component: 'Link', category: 'inline', renderer: { kind: 'react', load: () => import('./Link.js').then((m) => ({ default: m.Link })) } },
|
|
5
|
+
{ component: 'ActivityBarItem', category: 'inline', renderer: { kind: 'react', load: () => import('./ActivityBarItem.js').then((m) => ({ default: m.ActivityBarItem })) } },
|
|
5
6
|
];
|
|
@@ -6,3 +6,5 @@ export { Toolbar } from './Toolbar.js';
|
|
|
6
6
|
export type { ToolbarProps } from './Toolbar.js';
|
|
7
7
|
export { Link, resolveLinkHref } from './Link.js';
|
|
8
8
|
export type { LinkProps, LinkKind } from './Link.js';
|
|
9
|
+
export { ActivityBarItem } from './ActivityBarItem.js';
|
|
10
|
+
export type { ActivityBarItemProps, ActivityBadgeTone } from './ActivityBarItem.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ComponentDefinition } from '../../
|
|
1
|
+
import type { ComponentDefinition } from '../../sdk/component-registry.js';
|
|
2
2
|
export declare const CATALOG_OVERLAY_MAP: ComponentDefinition[];
|
package/dist/ui/register.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Scena } from '../
|
|
2
|
-
import type { Disposable } from '../
|
|
3
|
-
import type { ComponentDefinition } from '../
|
|
1
|
+
import type { Scena } from '../sdk/scena.js';
|
|
2
|
+
import type { Disposable } from '../sdk/disposable.js';
|
|
3
|
+
import type { ComponentDefinition } from '../sdk/component-registry.js';
|
|
4
4
|
export declare function registerCatalog(defs: ComponentDefinition[], scena: Scena): Disposable;
|
|
5
5
|
export declare function registerBuiltins(scena: Scena): Disposable;
|
|
6
6
|
export { registerBuiltinLayouts } from './layout/register.js';
|
package/dist/ui/register.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { combineDisposables } from '../
|
|
1
|
+
import { combineDisposables } from '../sdk/disposable.js';
|
|
2
2
|
import { CATALOG_LAYOUT_MAP } from './layout/catalog.js';
|
|
3
3
|
import { CATALOG_DISPLAY_MAP } from './display/catalog.js';
|
|
4
4
|
import { CATALOG_DATA_MAP } from './data/catalog.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softov/scena",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Graph-mounted reactive UI runtime (contracts + runtime)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Luiz Fernando Softov <lfs@softov.dev>",
|
|
@@ -23,16 +23,24 @@
|
|
|
23
23
|
"sideEffects": [
|
|
24
24
|
"**/*.css"
|
|
25
25
|
],
|
|
26
|
-
"main": "./dist/
|
|
27
|
-
"types": "./dist/
|
|
26
|
+
"main": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
28
|
"exports": {
|
|
29
29
|
".": {
|
|
30
|
-
"types": "./dist/
|
|
31
|
-
"default": "./dist/
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"default": "./dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./sdk": {
|
|
34
|
+
"types": "./dist/sdk/index.d.ts",
|
|
35
|
+
"default": "./dist/sdk/index.js"
|
|
32
36
|
},
|
|
33
37
|
"./types": {
|
|
34
|
-
"types": "./dist/
|
|
35
|
-
"default": "./dist/
|
|
38
|
+
"types": "./dist/sdk/index.d.ts",
|
|
39
|
+
"default": "./dist/sdk/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./core": {
|
|
42
|
+
"types": "./dist/core/index.d.ts",
|
|
43
|
+
"default": "./dist/core/index.js"
|
|
36
44
|
},
|
|
37
45
|
"./react": {
|
|
38
46
|
"types": "./dist/react/index.d.ts",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { EventBus } from '../types/events.js';
|
|
2
|
-
import type { ReactiveStore, SocketBridge } from '../types/reactive-store.js';
|
|
3
|
-
import type { MountSurfaceRegistry } from '../types/mount-surface.js';
|
|
4
|
-
import type { CommandRegistry } from '../types/command.js';
|
|
5
|
-
import type { WhenEngine } from '../types/when.js';
|
|
6
|
-
import type { Scena } from '../types/scena.js';
|
|
7
|
-
import type { KeybindingRegistry } from '../types/keybinding.js';
|
|
8
|
-
interface Deps {
|
|
9
|
-
events: EventBus;
|
|
10
|
-
store: ReactiveStore;
|
|
11
|
-
surfaces: MountSurfaceRegistry;
|
|
12
|
-
when: WhenEngine;
|
|
13
|
-
socket?: SocketBridge;
|
|
14
|
-
keybindings: KeybindingRegistry;
|
|
15
|
-
getScena: () => Scena;
|
|
16
|
-
}
|
|
17
|
-
export declare function createCommandRegistry(deps: Deps): CommandRegistry;
|
|
18
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { EventBus } from '../types/events.js';
|
|
2
|
-
import type { KeybindingRegistry } from '../types/keybinding.js';
|
|
3
|
-
import type { WhenEngine } from '../types/when.js';
|
|
4
|
-
interface Deps {
|
|
5
|
-
events: EventBus;
|
|
6
|
-
when: WhenEngine;
|
|
7
|
-
}
|
|
8
|
-
export declare function createKeybindingRegistry(deps: Deps): KeybindingRegistry;
|
|
9
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { EventBus } from '../types/events.js';
|
|
2
|
-
import type { ReactiveStore } from '../types/reactive-store.js';
|
|
3
|
-
import type { LayoutAPI, LayoutRegistry, LayoutStorage, ScenaLayout } from '../types/layout.js';
|
|
4
|
-
interface LayoutDeps {
|
|
5
|
-
events: EventBus;
|
|
6
|
-
store: ReactiveStore;
|
|
7
|
-
initial?: ScenaLayout;
|
|
8
|
-
storage?: LayoutStorage;
|
|
9
|
-
}
|
|
10
|
-
export declare function createLayoutAPI(deps: LayoutDeps): LayoutAPI & {
|
|
11
|
-
setStorage(s: LayoutStorage | null): void;
|
|
12
|
-
};
|
|
13
|
-
export declare function createLayoutRegistry(deps: {
|
|
14
|
-
events: EventBus;
|
|
15
|
-
}): LayoutRegistry;
|
|
16
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { EventBus } from '../types/events.js';
|
|
2
|
-
import type { ReactiveStore } from '../types/reactive-store.js';
|
|
3
|
-
import type { ComponentRegistry } from '../types/component-registry.js';
|
|
4
|
-
import type { CommandRegistry } from '../types/command.js';
|
|
5
|
-
import type { KeybindingRegistry } from '../types/keybinding.js';
|
|
6
|
-
import type { MountSurfaceRegistry } from '../types/mount-surface.js';
|
|
7
|
-
import type { ConverterRegistry } from '../types/converter-registry.js';
|
|
8
|
-
import type { PermissionEngine } from '../types/permissions.js';
|
|
9
|
-
import type { ManifestAPI } from '../types/manifest.js';
|
|
10
|
-
interface Deps {
|
|
11
|
-
events: EventBus;
|
|
12
|
-
store: ReactiveStore;
|
|
13
|
-
components: ComponentRegistry;
|
|
14
|
-
commands: CommandRegistry;
|
|
15
|
-
keybindings: KeybindingRegistry;
|
|
16
|
-
surfaces: MountSurfaceRegistry;
|
|
17
|
-
converters: ConverterRegistry;
|
|
18
|
-
permissions: PermissionEngine;
|
|
19
|
-
}
|
|
20
|
-
export declare function createManifestAPI(deps: Deps): ManifestAPI;
|
|
21
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { EventBus } from '../types/events.js';
|
|
2
|
-
import type { ReactiveStore } from '../types/reactive-store.js';
|
|
3
|
-
import type { MountSurfaceRegistry } from '../types/mount-surface.js';
|
|
4
|
-
import type { SessionAPI, SessionStorage } from '../types/session.js';
|
|
5
|
-
import type { ComponentRegistry } from '../types/component-registry.js';
|
|
6
|
-
interface Deps {
|
|
7
|
-
events: EventBus;
|
|
8
|
-
store: ReactiveStore;
|
|
9
|
-
surfaces: MountSurfaceRegistry;
|
|
10
|
-
components: ComponentRegistry;
|
|
11
|
-
storage?: SessionStorage;
|
|
12
|
-
}
|
|
13
|
-
export declare function createSessionAPI(deps: Deps): SessionAPI & {
|
|
14
|
-
setStorage(s: SessionStorage | null): void;
|
|
15
|
-
};
|
|
16
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { BindingResolver } from '../types/binding-resolver.js';
|
|
2
|
-
import type { ReactiveStore } from '../types/reactive-store.js';
|
|
3
|
-
interface Deps {
|
|
4
|
-
store: ReactiveStore;
|
|
5
|
-
}
|
|
6
|
-
export declare function createBindingResolver(deps: Deps): BindingResolver;
|
|
7
|
-
export {};
|
package/dist/core/label.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { EventBus } from '../types/events.js';
|
|
2
|
-
import type { MountSurfaceRegistry } from '../types/mount-surface.js';
|
|
3
|
-
import type { ComponentRegistry } from '../types/component-registry.js';
|
|
4
|
-
import type { WhenEngine } from '../types/when.js';
|
|
5
|
-
import type { BindingResolver } from '../types/binding-resolver.js';
|
|
6
|
-
import type { ReactiveStore } from '../types/reactive-store.js';
|
|
7
|
-
interface Deps {
|
|
8
|
-
events: EventBus;
|
|
9
|
-
when: WhenEngine;
|
|
10
|
-
bindings: BindingResolver;
|
|
11
|
-
store: ReactiveStore;
|
|
12
|
-
components: ComponentRegistry;
|
|
13
|
-
}
|
|
14
|
-
export declare function createMountSurfaceRegistry(deps: Deps): MountSurfaceRegistry;
|
|
15
|
-
export {};
|
package/dist/types/disposable.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/label.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|