@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.
Files changed (276) hide show
  1. package/dist/core/builtins.d.ts +3 -0
  2. package/dist/{runtime → core}/builtins.js +1 -1
  3. package/dist/core/controls/command.d.ts +18 -0
  4. package/dist/{controls → core/controls}/command.js +2 -2
  5. package/dist/{controls → core/controls}/events.d.ts +1 -1
  6. package/dist/{controls → core/controls}/events.js +1 -1
  7. package/dist/core/controls/keybinding.d.ts +9 -0
  8. package/dist/{controls → core/controls}/keybinding.js +1 -1
  9. package/dist/core/controls/layout.d.ts +31 -0
  10. package/dist/{controls → core/controls}/layout.js +24 -7
  11. package/dist/core/controls/manifest.d.ts +21 -0
  12. package/dist/{controls → core/controls}/manifest.js +2 -2
  13. package/dist/core/controls/session.d.ts +16 -0
  14. package/dist/{controls → core/controls}/session.js +5 -13
  15. package/dist/{controls → core/controls}/shell.d.ts +2 -2
  16. package/dist/{controls → core/controls}/shell.js +1 -1
  17. package/dist/{controls → core/controls}/storage/layout-local.d.ts +1 -1
  18. package/dist/{controls → core/controls}/storage/session-local.d.ts +1 -1
  19. package/dist/{controls → core/controls}/when.d.ts +2 -2
  20. package/dist/{controls → core/controls}/when.js +1 -1
  21. package/dist/{converters → core/converters}/a2ui-v0.10.d.ts +1 -1
  22. package/dist/core/{component-graph.d.ts → graph/component-graph.d.ts} +1 -1
  23. package/dist/core/{component-graph.js → graph/component-graph.js} +1 -1
  24. package/dist/core/{mount-menu.d.ts → graph/mount-menu.d.ts} +1 -1
  25. package/dist/core/{mount-menu.js → graph/mount-menu.js} +1 -1
  26. package/dist/core/graph/mount-surface.d.ts +15 -0
  27. package/dist/core/{mount-surface.js → graph/mount-surface.js} +23 -4
  28. package/dist/core/{surface-presentation.d.ts → graph/surface-presentation.d.ts} +3 -3
  29. package/dist/{i18n → core/i18n}/i18n-backend.d.ts +1 -1
  30. package/dist/core/index.d.ts +34 -43
  31. package/dist/core/index.js +35 -38
  32. package/dist/core/{component-registry.d.ts → registry/component-registry.d.ts} +2 -2
  33. package/dist/core/{component-registry.js → registry/component-registry.js} +1 -1
  34. package/dist/core/registry/converter-registry.d.ts +2 -0
  35. package/dist/core/{converter-registry.js → registry/converter-registry.js} +1 -1
  36. package/dist/core/resolve/binding-resolver.d.ts +7 -0
  37. package/dist/core/{binding-resolver.js → resolve/binding-resolver.js} +2 -2
  38. package/dist/core/{dynamic-resolver.d.ts → resolve/dynamic-resolver.d.ts} +2 -2
  39. package/dist/core/{dynamic-resolver.js → resolve/dynamic-resolver.js} +1 -1
  40. package/dist/core/{path-resolver.d.ts → resolve/path-resolver.d.ts} +2 -2
  41. package/dist/core/{permissions.d.ts → resolve/permissions.d.ts} +1 -1
  42. package/dist/core/scena.d.ts +1 -1
  43. package/dist/core/scena.js +17 -16
  44. package/dist/core/{backends → store/backends}/modus-backend.d.ts +1 -1
  45. package/dist/core/{backends → store/backends}/storage-backend.d.ts +1 -1
  46. package/dist/core/{backends → store/backends}/yjs-backend.d.ts +1 -1
  47. package/dist/core/{reactive-store.d.ts → store/reactive-store.d.ts} +4 -4
  48. package/dist/core/{reactive-store.js → store/reactive-store.js} +2 -2
  49. package/dist/index.d.ts +8 -0
  50. package/dist/index.js +13 -0
  51. package/dist/porta/Limen.d.ts +1 -0
  52. package/dist/porta/Limen.js +1 -0
  53. package/dist/porta/PortaLock.d.ts +1 -0
  54. package/dist/porta/PortaLock.js +6 -2
  55. package/dist/porta/SigillumGate.d.ts +1 -0
  56. package/dist/porta/SigillumGate.js +1 -0
  57. package/dist/porta/commands.d.ts +1 -1
  58. package/dist/porta/login-form.block.d.ts +1 -1
  59. package/dist/porta/provider.d.ts +1 -1
  60. package/dist/porta/register-blocks.d.ts +2 -2
  61. package/dist/porta/register-blocks.js +4 -7
  62. package/dist/porta/register.d.ts +1 -1
  63. package/dist/porta/sigillum.d.ts +2 -2
  64. package/dist/react/DefaultShell.d.ts +47 -1
  65. package/dist/react/DefaultShell.js +81 -12
  66. package/dist/react/Scena.d.ts +2 -2
  67. package/dist/react/ScenaProvider.d.ts +1 -1
  68. package/dist/react/ShellSplitter.d.ts +1 -1
  69. package/dist/react/SurfaceArea.d.ts +5 -3
  70. package/dist/react/SurfaceArea.js +2 -2
  71. package/dist/react/ViewMount.d.ts +1 -1
  72. package/dist/react/ViewMount.js +4 -4
  73. package/dist/react/hooks/useI18n.d.ts +1 -1
  74. package/dist/react/hooks/useI18n.js +1 -1
  75. package/dist/react/hooks/useLabel.d.ts +1 -1
  76. package/dist/react/hooks/useLabel.js +1 -1
  77. package/dist/react/hooks/useLayout.d.ts +1 -1
  78. package/dist/react/hooks/useMounts.d.ts +1 -1
  79. package/dist/react/hooks/useStore.d.ts +1 -1
  80. package/dist/react/hooks/useStore.js +2 -2
  81. package/dist/react/hooks/useStoreLabel.d.ts +2 -2
  82. package/dist/react/hooks/useStoreLabel.js +1 -1
  83. package/dist/react/hooks/useSurfacePresentation.d.ts +3 -3
  84. package/dist/react/hooks/useSurfacePresentation.js +1 -1
  85. package/dist/react/mount-context.d.ts +1 -1
  86. package/dist/react/useSurfaceResize.d.ts +2 -2
  87. package/dist/runtime/client-handlers.d.ts +1 -1
  88. package/dist/runtime/in-memory-socket.d.ts +2 -2
  89. package/dist/runtime/index.d.ts +3 -3
  90. package/dist/runtime/index.js +2 -2
  91. package/dist/runtime/layout-commands.d.ts +3 -3
  92. package/dist/runtime/layout-commands.js +2 -2
  93. package/dist/runtime/opener-commands.d.ts +5 -5
  94. package/dist/runtime/opener-commands.js +3 -3
  95. package/dist/runtime/surface-bridge.d.ts +5 -5
  96. package/dist/runtime/surface-bridge.js +1 -1
  97. package/dist/{runtime → sdk}/args-schema.d.ts +1 -1
  98. package/dist/{core → sdk}/disposable.d.ts +3 -1
  99. package/dist/{types → sdk}/index.d.ts +1 -0
  100. package/dist/{types → sdk}/index.js +1 -0
  101. package/dist/{types → sdk}/label.d.ts +1 -0
  102. package/dist/{core → sdk}/label.js +0 -1
  103. package/dist/{types → sdk}/layout.d.ts +25 -0
  104. package/dist/{types → sdk}/mount-surface.d.ts +19 -1
  105. package/dist/{types → sdk}/scena.d.ts +2 -1
  106. package/dist/styles/bar.css +8 -4
  107. package/dist/styles/base.css +18 -16
  108. package/dist/styles/controller.d.ts +27 -0
  109. package/dist/styles/controller.js +74 -0
  110. package/dist/styles/form.css +10 -0
  111. package/dist/styles/index.d.ts +2 -0
  112. package/dist/styles/index.js +3 -0
  113. package/dist/styles/surface.css +69 -3
  114. package/dist/styles/themes/tokens.css +1 -1
  115. package/dist/ui/_utils.d.ts +1 -1
  116. package/dist/ui/_utils.js +2 -2
  117. package/dist/ui/campus/CampusMappa.js +1 -1
  118. package/dist/ui/chart/catalog.d.ts +1 -1
  119. package/dist/ui/control/ButtonBar.css +61 -0
  120. package/dist/ui/control/ButtonBar.d.ts +36 -0
  121. package/dist/ui/control/ButtonBar.js +42 -0
  122. package/dist/ui/control/ThemeModeToggle.css +22 -0
  123. package/dist/ui/control/ThemeModeToggle.d.ts +20 -0
  124. package/dist/ui/control/ThemeModeToggle.js +34 -0
  125. package/dist/ui/control/ThemePicker.css +24 -0
  126. package/dist/ui/control/ThemePicker.d.ts +27 -0
  127. package/dist/ui/control/ThemePicker.js +33 -0
  128. package/dist/ui/control/catalog.d.ts +1 -1
  129. package/dist/ui/control/catalog.js +5 -1
  130. package/dist/ui/control/index.d.ts +6 -0
  131. package/dist/ui/control/index.js +3 -0
  132. package/dist/ui/data/Filter.d.ts +1 -1
  133. package/dist/ui/data/Listable.d.ts +3 -2
  134. package/dist/ui/data/Listable.js +4 -2
  135. package/dist/ui/data/Pagination.d.ts +4 -1
  136. package/dist/ui/data/Pagination.js +37 -9
  137. package/dist/ui/data/Tree.d.ts +2 -2
  138. package/dist/ui/data/Tree.js +1 -1
  139. package/dist/ui/data/catalog.d.ts +1 -1
  140. package/dist/ui/display/Alert.css +15 -10
  141. package/dist/ui/display/Badge.css +22 -14
  142. package/dist/ui/display/Badge.d.ts +1 -1
  143. package/dist/ui/display/Badge.js +1 -1
  144. package/dist/ui/display/DetailHeader.css +3 -3
  145. package/dist/ui/display/DetailList.js +3 -2
  146. package/dist/ui/display/DetailNotFound.d.ts +1 -1
  147. package/dist/ui/display/DetailNotFound.js +1 -1
  148. package/dist/ui/display/Progress.d.ts +1 -1
  149. package/dist/ui/display/Progress.js +1 -1
  150. package/dist/ui/display/Spinner.d.ts +1 -1
  151. package/dist/ui/display/Spinner.js +1 -1
  152. package/dist/ui/display/StatusDot.css +46 -0
  153. package/dist/ui/display/StatusDot.d.ts +17 -0
  154. package/dist/ui/display/StatusDot.js +16 -0
  155. package/dist/ui/display/Svg.d.ts +1 -1
  156. package/dist/ui/display/Svg.js +1 -1
  157. package/dist/ui/display/catalog.d.ts +1 -1
  158. package/dist/ui/display/catalog.js +1 -0
  159. package/dist/ui/display/index.d.ts +2 -0
  160. package/dist/ui/display/index.js +1 -0
  161. package/dist/ui/forms/LoginForm.d.ts +1 -0
  162. package/dist/ui/forms/LoginForm.js +1 -0
  163. package/dist/ui/forms/SettingsContainer.d.ts +2 -1
  164. package/dist/ui/forms/SettingsContainer.js +2 -2
  165. package/dist/ui/forms/catalog.d.ts +1 -1
  166. package/dist/ui/index.d.ts +6 -1
  167. package/dist/ui/index.js +3 -1
  168. package/dist/ui/layout/BarLayout.d.ts +1 -1
  169. package/dist/ui/layout/FloatingLayout.d.ts +1 -1
  170. package/dist/ui/layout/InlineLayout.d.ts +1 -1
  171. package/dist/ui/layout/MountTitle.d.ts +2 -2
  172. package/dist/ui/layout/MountTitle.js +2 -2
  173. package/dist/ui/layout/RailLayout.d.ts +1 -1
  174. package/dist/ui/layout/SectionHeader.d.ts +2 -2
  175. package/dist/ui/layout/SectionHeader.js +4 -7
  176. package/dist/ui/layout/SingleLayout.d.ts +1 -1
  177. package/dist/ui/layout/SpatialCard.d.ts +2 -2
  178. package/dist/ui/layout/SpatialLayout.d.ts +1 -1
  179. package/dist/ui/layout/SplitLayout.d.ts +1 -1
  180. package/dist/ui/layout/StackHeader.d.ts +1 -1
  181. package/dist/ui/layout/StackLayout.d.ts +1 -1
  182. package/dist/ui/layout/TabLayout.d.ts +1 -1
  183. package/dist/ui/layout/TabPanelLayout.d.ts +2 -2
  184. package/dist/ui/layout/TabPanelLayout.js +1 -1
  185. package/dist/ui/layout/catalog.d.ts +1 -1
  186. package/dist/ui/layout/register.d.ts +2 -2
  187. package/dist/ui/layout/register.js +1 -1
  188. package/dist/ui/media/catalog.d.ts +1 -1
  189. package/dist/ui/menu/ActionList.d.ts +2 -2
  190. package/dist/ui/menu/ActionList.js +1 -1
  191. package/dist/ui/menu/ContainerMenu.d.ts +2 -2
  192. package/dist/ui/menu/ContextMenu.d.ts +2 -2
  193. package/dist/ui/menu/useChatPicker.d.ts +2 -2
  194. package/dist/ui/navigation/ActivityBarItem.css +81 -0
  195. package/dist/ui/navigation/ActivityBarItem.d.ts +61 -0
  196. package/dist/ui/navigation/ActivityBarItem.js +68 -0
  197. package/dist/ui/navigation/catalog.d.ts +1 -1
  198. package/dist/ui/navigation/catalog.js +1 -0
  199. package/dist/ui/navigation/index.d.ts +2 -0
  200. package/dist/ui/navigation/index.js +1 -0
  201. package/dist/ui/overlay/catalog.d.ts +1 -1
  202. package/dist/ui/register.d.ts +3 -3
  203. package/dist/ui/register.js +1 -1
  204. package/package.json +15 -7
  205. package/dist/controls/command.d.ts +0 -18
  206. package/dist/controls/keybinding.d.ts +0 -9
  207. package/dist/controls/layout.d.ts +0 -16
  208. package/dist/controls/manifest.d.ts +0 -21
  209. package/dist/controls/session.d.ts +0 -16
  210. package/dist/core/binding-resolver.d.ts +0 -7
  211. package/dist/core/converter-registry.d.ts +0 -2
  212. package/dist/core/label.d.ts +0 -2
  213. package/dist/core/mount-surface.d.ts +0 -15
  214. package/dist/runtime/builtins.d.ts +0 -3
  215. package/dist/types/disposable.d.ts +0 -3
  216. package/dist/types/disposable.js +0 -1
  217. package/dist/types/label.js +0 -1
  218. /package/dist/{controls → core/controls}/index.d.ts +0 -0
  219. /package/dist/{controls → core/controls}/index.js +0 -0
  220. /package/dist/{controls → core/controls}/storage/layout-local.js +0 -0
  221. /package/dist/{controls → core/controls}/storage/session-local.js +0 -0
  222. /package/dist/{converters → core/converters}/a2ui-v0.10.js +0 -0
  223. /package/dist/{converters → core/converters}/index.d.ts +0 -0
  224. /package/dist/{converters → core/converters}/index.js +0 -0
  225. /package/dist/core/{surface-presentation.js → graph/surface-presentation.js} +0 -0
  226. /package/dist/{i18n → core/i18n}/i18n-backend.js +0 -0
  227. /package/dist/{i18n → core/i18n}/registry.d.ts +0 -0
  228. /package/dist/{i18n → core/i18n}/registry.js +0 -0
  229. /package/dist/core/{path-resolver.js → resolve/path-resolver.js} +0 -0
  230. /package/dist/core/{permissions.js → resolve/permissions.js} +0 -0
  231. /package/dist/core/{backends → store/backends}/modus-backend.js +0 -0
  232. /package/dist/core/{backends → store/backends}/storage-backend.js +0 -0
  233. /package/dist/core/{backends → store/backends}/yjs-backend.js +0 -0
  234. /package/dist/core/{computed-dsl.d.ts → store/computed-dsl.d.ts} +0 -0
  235. /package/dist/core/{computed-dsl.js → store/computed-dsl.js} +0 -0
  236. /package/dist/{runtime → sdk}/args-schema.js +0 -0
  237. /package/dist/{types → sdk}/binding-resolver.d.ts +0 -0
  238. /package/dist/{types → sdk}/binding-resolver.js +0 -0
  239. /package/dist/{types → sdk}/colors.d.ts +0 -0
  240. /package/dist/{types → sdk}/colors.js +0 -0
  241. /package/dist/{types → sdk}/command.d.ts +0 -0
  242. /package/dist/{types → sdk}/command.js +0 -0
  243. /package/dist/{types → sdk}/component-graph.d.ts +0 -0
  244. /package/dist/{types → sdk}/component-graph.js +0 -0
  245. /package/dist/{types → sdk}/component-registry.d.ts +0 -0
  246. /package/dist/{types → sdk}/component-registry.js +0 -0
  247. /package/dist/{types → sdk}/converter-registry.d.ts +0 -0
  248. /package/dist/{types → sdk}/converter-registry.js +0 -0
  249. /package/dist/{core → sdk}/disposable.js +0 -0
  250. /package/dist/{types → sdk}/events.d.ts +0 -0
  251. /package/dist/{types → sdk}/events.js +0 -0
  252. /package/dist/{types → sdk}/host.d.ts +0 -0
  253. /package/dist/{types → sdk}/host.js +0 -0
  254. /package/dist/{types → sdk}/keybinding.d.ts +0 -0
  255. /package/dist/{types → sdk}/keybinding.js +0 -0
  256. /package/dist/{types → sdk}/layout.js +0 -0
  257. /package/dist/{types → sdk}/manifest.d.ts +0 -0
  258. /package/dist/{types → sdk}/manifest.js +0 -0
  259. /package/dist/{types → sdk}/mount-menu.d.ts +0 -0
  260. /package/dist/{types → sdk}/mount-menu.js +0 -0
  261. /package/dist/{types → sdk}/mount-surface.js +0 -0
  262. /package/dist/{types → sdk}/permissions.d.ts +0 -0
  263. /package/dist/{types → sdk}/permissions.js +0 -0
  264. /package/dist/{types → sdk}/query.d.ts +0 -0
  265. /package/dist/{types → sdk}/query.js +0 -0
  266. /package/dist/{types → sdk}/reactive-store.d.ts +0 -0
  267. /package/dist/{types → sdk}/reactive-store.js +0 -0
  268. /package/dist/{types → sdk}/scena.js +0 -0
  269. /package/dist/{types → sdk}/scope-backend.d.ts +0 -0
  270. /package/dist/{types → sdk}/scope-backend.js +0 -0
  271. /package/dist/{types → sdk}/session.d.ts +0 -0
  272. /package/dist/{types → sdk}/session.js +0 -0
  273. /package/dist/{types → sdk}/shell.d.ts +0 -0
  274. /package/dist/{types → sdk}/shell.js +0 -0
  275. /package/dist/{types → sdk}/when.d.ts +0 -0
  276. /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 '../../types/component-registry.js';
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';
@@ -3,3 +3,4 @@ export { Breadcrumb } from './Breadcrumb.js';
3
3
  export { Tabs } from './Tabs.js';
4
4
  export { Toolbar } from './Toolbar.js';
5
5
  export { Link, resolveLinkHref } from './Link.js';
6
+ export { ActivityBarItem } from './ActivityBarItem.js';
@@ -1,2 +1,2 @@
1
- import type { ComponentDefinition } from '../../types/component-registry.js';
1
+ import type { ComponentDefinition } from '../../sdk/component-registry.js';
2
2
  export declare const CATALOG_OVERLAY_MAP: ComponentDefinition[];
@@ -1,6 +1,6 @@
1
- import type { Scena } from '../types/scena.js';
2
- import type { Disposable } from '../types/disposable.js';
3
- import type { ComponentDefinition } from '../types/component-registry.js';
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';
@@ -1,4 +1,4 @@
1
- import { combineDisposables } from '../core/disposable.js';
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.2",
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/core/index.js",
27
- "types": "./dist/types/index.d.ts",
26
+ "main": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
28
28
  "exports": {
29
29
  ".": {
30
- "types": "./dist/core/index.d.ts",
31
- "default": "./dist/core/index.js"
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/types/index.d.ts",
35
- "default": "./dist/types/index.js"
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 {};
@@ -1,2 +0,0 @@
1
- import type { ConverterRegistry } from '../types/converter-registry.js';
2
- export declare function createConverterRegistry(): ConverterRegistry;
@@ -1,2 +0,0 @@
1
- import type { Label, LabelResolveContext } from "../types/label.js";
2
- export declare function resolveLabel(label: Label | undefined, ctx: LabelResolveContext): string;
@@ -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 {};
@@ -1,3 +0,0 @@
1
- import type { Disposable } from '../types/disposable.js';
2
- import type { Scena } from '../types/scena.js';
3
- export declare function registerBuiltinFunctions(scena: Scena): Disposable;
@@ -1,3 +0,0 @@
1
- export interface Disposable {
2
- dispose(): void;
3
- }
@@ -1 +0,0 @@
1
- export {};
@@ -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