@link-foundation/ui-components 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (402) hide show
  1. package/CONFIGURATIONS.md +74 -0
  2. package/ICONS.md +76 -0
  3. package/LICENSE +24 -0
  4. package/README.md +1499 -2
  5. package/bin/lino-network.mjs +71 -0
  6. package/dist/icons/ATTRIBUTION.md +602 -0
  7. package/dist/icons/NOTICE.lino +1261 -0
  8. package/dist/icons/brand.js +31 -0
  9. package/dist/icons/brand.svg +3 -0
  10. package/dist/icons/licenses/brand/DISCLAIMER.md +51 -0
  11. package/dist/icons/licenses/brand/LICENSE.md +30 -0
  12. package/dist/icons/licenses/lucide/LICENSE +43 -0
  13. package/dist/icons/licenses/material-symbols/LICENSE +202 -0
  14. package/dist/icons/licenses/material-symbols/NOTICE +12 -0
  15. package/dist/icons/licenses/tabler/LICENSE +21 -0
  16. package/dist/icons/lucide.js +681 -0
  17. package/dist/icons/lucide.svg +34 -0
  18. package/dist/icons/material-symbols.js +681 -0
  19. package/dist/icons/material-symbols.svg +34 -0
  20. package/dist/icons/own.js +521 -0
  21. package/dist/icons/own.svg +34 -0
  22. package/dist/icons/tabler.js +681 -0
  23. package/dist/icons/tabler.svg +34 -0
  24. package/dist/network-layout-NOTICE.md +6 -0
  25. package/dist/network-layout-d3-dispatch-LICENSE.txt +13 -0
  26. package/dist/network-layout-d3-force-LICENSE.txt +13 -0
  27. package/dist/network-layout-d3-quadtree-LICENSE.txt +13 -0
  28. package/dist/network-layout-d3-timer-LICENSE.txt +13 -0
  29. package/dist/network-layout-dagre-LICENSE.txt +19 -0
  30. package/dist/network-layout.worker.mjs +2 -0
  31. package/package.json +246 -4
  32. package/src/a11y/announce.js +88 -0
  33. package/src/a11y/bind-machine.js +181 -0
  34. package/src/a11y/focus.js +169 -0
  35. package/src/a11y/index.d.ts +89 -0
  36. package/src/a11y/index.js +19 -0
  37. package/src/a11y/keys.js +182 -0
  38. package/src/a11y/roving.js +167 -0
  39. package/src/a11y/typeahead.js +82 -0
  40. package/src/behavior/actions.js +235 -0
  41. package/src/behavior/diagnostics.js +73 -0
  42. package/src/behavior/dom.d.ts +38 -0
  43. package/src/behavior/dom.js +420 -0
  44. package/src/behavior/index.d.ts +211 -0
  45. package/src/behavior/index.js +29 -0
  46. package/src/behavior/interpret.js +454 -0
  47. package/src/behavior/machines/disclosure.lino +46 -0
  48. package/src/behavior/machines/index.js +91 -0
  49. package/src/behavior/machines/toggle.lino +25 -0
  50. package/src/behavior/parse-machine.js +367 -0
  51. package/src/charts/README.md +78 -0
  52. package/src/charts/activity-layout.js +350 -0
  53. package/src/charts/activity-model.js +130 -0
  54. package/src/charts/activity-validation.js +31 -0
  55. package/src/charts/chart-model.js +667 -0
  56. package/src/charts/chart.js +518 -0
  57. package/src/charts/echarts-adapter.d.ts +23 -0
  58. package/src/charts/echarts-adapter.js +240 -0
  59. package/src/charts/element.js +330 -0
  60. package/src/charts/errors.js +62 -0
  61. package/src/charts/gauge.js +27 -0
  62. package/src/charts/index.d.ts +344 -0
  63. package/src/charts/index.js +59 -0
  64. package/src/charts/layout.js +542 -0
  65. package/src/charts/lino.js +158 -0
  66. package/src/charts/mark-options.js +78 -0
  67. package/src/charts/read.js +101 -0
  68. package/src/charts/renderer-features.js +8 -0
  69. package/src/charts/scales.js +223 -0
  70. package/src/charts/small-model.js +223 -0
  71. package/src/charts/small-svg.js +269 -0
  72. package/src/charts/sparkline.js +27 -0
  73. package/src/charts/stat-tile.js +37 -0
  74. package/src/charts/summary.js +193 -0
  75. package/src/charts/svg-renderer.js +226 -0
  76. package/src/charts/svg.js +69 -0
  77. package/src/charts/tag-cloud.js +129 -0
  78. package/src/charts/tokens.js +171 -0
  79. package/src/charts/tooltip.js +47 -0
  80. package/src/charts/values.js +146 -0
  81. package/src/chat/README.md +142 -0
  82. package/src/chat/actions.js +75 -0
  83. package/src/chat/chat-contract.js +95 -0
  84. package/src/chat/chat-list.js +42 -0
  85. package/src/chat/chat-model.js +125 -0
  86. package/src/chat/chat.css +228 -0
  87. package/src/chat/composer.js +131 -0
  88. package/src/chat/day-separator.js +12 -0
  89. package/src/chat/dom.js +33 -0
  90. package/src/chat/follow.js +49 -0
  91. package/src/chat/index.d.ts +142 -0
  92. package/src/chat/index.js +13 -0
  93. package/src/chat/message-bubble.js +191 -0
  94. package/src/chat/message-stream.js +331 -0
  95. package/src/chat/reasoning-trace.js +70 -0
  96. package/src/chat/selection.js +39 -0
  97. package/src/chat/skins/bubbles.lino +2 -0
  98. package/src/chat/skins/cards.lino +4 -0
  99. package/src/chat/skins/compact.lino +4 -0
  100. package/src/chat/skins/signal.lino +25 -0
  101. package/src/chat/skins/t3.lino +25 -0
  102. package/src/chat/skins/telegram.lino +31 -0
  103. package/src/chat/skins/whatsapp.lino +25 -0
  104. package/src/chat/stream-keys.js +57 -0
  105. package/src/chat/stream-window.js +159 -0
  106. package/src/chat/vocabulary.js +19 -0
  107. package/src/controls/accordion.js +160 -0
  108. package/src/controls/avatar.js +80 -0
  109. package/src/controls/badge.js +48 -0
  110. package/src/controls/button-template.js +32 -0
  111. package/src/controls/button.js +97 -0
  112. package/src/controls/catalog.lino +84 -0
  113. package/src/controls/checkbox.js +112 -0
  114. package/src/controls/chip.js +140 -0
  115. package/src/controls/choices.js +45 -0
  116. package/src/controls/color-field.js +217 -0
  117. package/src/controls/color-popover.js +135 -0
  118. package/src/controls/color-rgb.js +80 -0
  119. package/src/controls/color.js +67 -0
  120. package/src/controls/combobox.js +192 -0
  121. package/src/controls/dom.js +261 -0
  122. package/src/controls/icon-button.js +33 -0
  123. package/src/controls/index.d.ts +163 -0
  124. package/src/controls/index.js +182 -0
  125. package/src/controls/kinds-text.js +358 -0
  126. package/src/controls/kinds.lino +350 -0
  127. package/src/controls/label.js +52 -0
  128. package/src/controls/link.js +101 -0
  129. package/src/controls/listbox.js +144 -0
  130. package/src/controls/machines/button.lino +20 -0
  131. package/src/controls/machines/checkbox.lino +17 -0
  132. package/src/controls/machines/chip.lino +20 -0
  133. package/src/controls/machines/color-field.lino +23 -0
  134. package/src/controls/machines/combobox.lino +82 -0
  135. package/src/controls/machines/icon-button.lino +20 -0
  136. package/src/controls/machines/index.js +586 -0
  137. package/src/controls/machines/number-field.lino +71 -0
  138. package/src/controls/machines/radio-group.lino +17 -0
  139. package/src/controls/machines/select.lino +122 -0
  140. package/src/controls/machines/slider.lino +99 -0
  141. package/src/controls/machines/switch.lino +19 -0
  142. package/src/controls/machines/text-area.lino +26 -0
  143. package/src/controls/machines/text-field.lino +26 -0
  144. package/src/controls/number-field.js +239 -0
  145. package/src/controls/numeric-keys.js +125 -0
  146. package/src/controls/option.js +54 -0
  147. package/src/controls/progress.js +76 -0
  148. package/src/controls/radio-group.js +234 -0
  149. package/src/controls/select.js +229 -0
  150. package/src/controls/slider.js +234 -0
  151. package/src/controls/stories.js +172 -0
  152. package/src/controls/styles.css +1060 -0
  153. package/src/controls/switch.js +95 -0
  154. package/src/controls/text-area.js +39 -0
  155. package/src/controls/text-field.js +131 -0
  156. package/src/controls/vocabulary.js +164 -0
  157. package/src/data/data.css +95 -0
  158. package/src/data/index.d.ts +83 -0
  159. package/src/data/index.js +10 -0
  160. package/src/data/keyboard.js +189 -0
  161. package/src/data/list.js +215 -0
  162. package/src/data/render-data.js +116 -0
  163. package/src/data/selection-dom.js +39 -0
  164. package/src/data/selection-model.js +43 -0
  165. package/src/data/sort-model.js +42 -0
  166. package/src/data/source.js +45 -0
  167. package/src/data/table.js +160 -0
  168. package/src/data/tree-model.js +41 -0
  169. package/src/data/tree.js +55 -0
  170. package/src/data/viewport.js +216 -0
  171. package/src/data/virtual-range.js +92 -0
  172. package/src/data/vocabulary.js +67 -0
  173. package/src/diagrams/diagram-model.js +511 -0
  174. package/src/diagrams/diagram.js +204 -0
  175. package/src/diagrams/index.d.ts +225 -0
  176. package/src/diagrams/index.js +48 -0
  177. package/src/diagrams/layout-dagre.js +164 -0
  178. package/src/diagrams/layout-plugins.js +131 -0
  179. package/src/diagrams/mermaid-export.js +232 -0
  180. package/src/diagrams/mermaid-view.js +229 -0
  181. package/src/diagrams/svg-diagram.js +215 -0
  182. package/src/editor/code-editor.js +206 -0
  183. package/src/editor/documents-model.js +170 -0
  184. package/src/editor/documents-persistence.js +85 -0
  185. package/src/editor/editor-engine.js +22 -0
  186. package/src/editor/editor-ui.js +203 -0
  187. package/src/editor/editor.css +106 -0
  188. package/src/editor/engines/codemirror.js +227 -0
  189. package/src/editor/engines/monaco.js +219 -0
  190. package/src/editor/index.d.ts +111 -0
  191. package/src/editor/index.js +14 -0
  192. package/src/editor/lino-highlight.js +106 -0
  193. package/src/editor/lino-structure.js +85 -0
  194. package/src/editor/validate-lino.js +43 -0
  195. package/src/embed/README.md +161 -0
  196. package/src/embed/controller.js +223 -0
  197. package/src/embed/element.js +141 -0
  198. package/src/embed/index.d.ts +75 -0
  199. package/src/embed/index.js +9 -0
  200. package/src/embed/providers/telegram.d.ts +3 -0
  201. package/src/embed/providers/telegram.js +38 -0
  202. package/src/embed/providers/vk.d.ts +3 -0
  203. package/src/embed/providers/vk.js +42 -0
  204. package/src/embed/providers/x.d.ts +3 -0
  205. package/src/embed/providers/x.js +31 -0
  206. package/src/embed/registry.js +35 -0
  207. package/src/embed/script.js +73 -0
  208. package/src/embed/view.js +122 -0
  209. package/src/icons/adapters/lucide.d.ts +15 -0
  210. package/src/icons/adapters/lucide.js +142 -0
  211. package/src/icons/adapters/material-symbols.d.ts +13 -0
  212. package/src/icons/adapters/material-symbols.js +113 -0
  213. package/src/icons/adapters/shared.d.ts +38 -0
  214. package/src/icons/adapters/shared.js +157 -0
  215. package/src/icons/adapters/simple-icons.d.ts +9 -0
  216. package/src/icons/adapters/simple-icons.js +38 -0
  217. package/src/icons/adapters/tabler.d.ts +9 -0
  218. package/src/icons/adapters/tabler.js +86 -0
  219. package/src/icons/icon-registry.js +215 -0
  220. package/src/icons/icon.js +356 -0
  221. package/src/icons/index.d.ts +123 -0
  222. package/src/icons/index.js +30 -0
  223. package/src/icons/names.js +51 -0
  224. package/src/icons/own-icons.js +521 -0
  225. package/src/icons/presentation.js +55 -0
  226. package/src/icons/svg.js +136 -0
  227. package/src/index.d.ts +14 -0
  228. package/src/index.js +40 -0
  229. package/src/layout/README.md +102 -0
  230. package/src/layout/app-shell.js +150 -0
  231. package/src/layout/catalog.lino +27 -0
  232. package/src/layout/dock-model.js +576 -0
  233. package/src/layout/dock-view.js +312 -0
  234. package/src/layout/dock.js +352 -0
  235. package/src/layout/dom.js +312 -0
  236. package/src/layout/grid.js +192 -0
  237. package/src/layout/index.d.ts +267 -0
  238. package/src/layout/index.js +60 -0
  239. package/src/layout/layer-manager.js +120 -0
  240. package/src/layout/layout.css +760 -0
  241. package/src/layout/menu.js +141 -0
  242. package/src/layout/nav-strip.js +174 -0
  243. package/src/layout/page-links.js +166 -0
  244. package/src/layout/panel.js +26 -0
  245. package/src/layout/pref-switches.js +209 -0
  246. package/src/layout/split-model.js +270 -0
  247. package/src/layout/split.js +430 -0
  248. package/src/layout/stack.js +86 -0
  249. package/src/layout/surfaces.js +119 -0
  250. package/src/layout/tab-group.js +151 -0
  251. package/src/layout/tab-strip.js +277 -0
  252. package/src/layout/vocabulary.js +229 -0
  253. package/src/layout/window-frame.js +222 -0
  254. package/src/layout/window.js +146 -0
  255. package/src/links-view/animator.js +144 -0
  256. package/src/links-view/configuration-classes.js +150 -0
  257. package/src/links-view/configuration-model.js +191 -0
  258. package/src/links-view/configuration-notations.js +230 -0
  259. package/src/links-view/configurations.d.ts +73 -0
  260. package/src/links-view/configurations.js +33 -0
  261. package/src/links-view/create-layout-runner.js +79 -0
  262. package/src/links-view/doublet-curves.js +239 -0
  263. package/src/links-view/doublet-layout.js +148 -0
  264. package/src/links-view/doublet-markers.js +109 -0
  265. package/src/links-view/doublet-options.js +369 -0
  266. package/src/links-view/doublet-svg.js +156 -0
  267. package/src/links-view/doublet.js +230 -0
  268. package/src/links-view/export.js +146 -0
  269. package/src/links-view/geometry.js +409 -0
  270. package/src/links-view/index.d.ts +1029 -0
  271. package/src/links-view/index.js +140 -0
  272. package/src/links-view/labels.js +28 -0
  273. package/src/links-view/layout-worker-entry.mjs +2 -0
  274. package/src/links-view/layout-worker.js +28 -0
  275. package/src/links-view/layouts/circle.js +7 -0
  276. package/src/links-view/layouts/force.js +76 -0
  277. package/src/links-view/layouts/grid.js +7 -0
  278. package/src/links-view/layouts/hex.js +8 -0
  279. package/src/links-view/layouts/index.js +15 -0
  280. package/src/links-view/layouts/layered.js +29 -0
  281. package/src/links-view/layouts/regular.js +27 -0
  282. package/src/links-view/layouts/spiral.js +10 -0
  283. package/src/links-view/link-view.js +494 -0
  284. package/src/links-view/links-gallery.js +306 -0
  285. package/src/links-view/links-network.js +496 -0
  286. package/src/links-view/lino-network-source.js +122 -0
  287. package/src/links-view/lino-network.js +233 -0
  288. package/src/links-view/lino-to-network.js +252 -0
  289. package/src/links-view/markers.js +192 -0
  290. package/src/links-view/model.js +233 -0
  291. package/src/links-view/network-editor/dom.js +36 -0
  292. package/src/links-view/network-editor/editor.js +202 -0
  293. package/src/links-view/network-editor/model.js +163 -0
  294. package/src/links-view/network-editor/options.js +265 -0
  295. package/src/links-view/network-editor/panels.js +423 -0
  296. package/src/links-view/network-editor/presets.js +76 -0
  297. package/src/links-view/network-editor/provider.js +93 -0
  298. package/src/links-view/network-editor/remap.js +45 -0
  299. package/src/links-view/network-editor/schema.js +224 -0
  300. package/src/links-view/network-editor/share.js +232 -0
  301. package/src/links-view/network-editor/styles.js +19 -0
  302. package/src/links-view/network-editor/url-sync.js +131 -0
  303. package/src/links-view/network-interaction.js +228 -0
  304. package/src/links-view/network-model.js +85 -0
  305. package/src/links-view/network-renderer.js +259 -0
  306. package/src/links-view/network-scene.js +245 -0
  307. package/src/links-view/network-source.js +82 -0
  308. package/src/links-view/network-vocabulary.js +18 -0
  309. package/src/links-view/presentation.js +199 -0
  310. package/src/links-view/render-canvas.js +102 -0
  311. package/src/links-view/render-svg.js +118 -0
  312. package/src/links-view/scene.js +233 -0
  313. package/src/links-view/solver-job.js +106 -0
  314. package/src/links-view/tokens.js +114 -0
  315. package/src/links-view/zoom-pan.js +203 -0
  316. package/src/overlays/catalog.lino +89 -0
  317. package/src/overlays/context-menu.js +110 -0
  318. package/src/overlays/dialog.js +117 -0
  319. package/src/overlays/dom.js +168 -0
  320. package/src/overlays/drawer.js +8 -0
  321. package/src/overlays/index.d.ts +80 -0
  322. package/src/overlays/index.js +25 -0
  323. package/src/overlays/kinds.lino +137 -0
  324. package/src/overlays/list-popover.js +129 -0
  325. package/src/overlays/machines/index.js +71 -0
  326. package/src/overlays/machines/surface.lino +11 -0
  327. package/src/overlays/machines/tabs.lino +7 -0
  328. package/src/overlays/machines/toast.lino +16 -0
  329. package/src/overlays/machines/tooltip.lino +29 -0
  330. package/src/overlays/menu.js +240 -0
  331. package/src/overlays/popover.js +194 -0
  332. package/src/overlays/position.js +84 -0
  333. package/src/overlays/radial-geometry.js +38 -0
  334. package/src/overlays/radial-menu.js +50 -0
  335. package/src/overlays/styles.css +155 -0
  336. package/src/overlays/tabs.js +125 -0
  337. package/src/overlays/toast-queue.js +105 -0
  338. package/src/overlays/toast.js +163 -0
  339. package/src/overlays/tooltip.js +110 -0
  340. package/src/overlays/vocabulary.js +3 -0
  341. package/src/settings/conditions.js +44 -0
  342. package/src/settings/control-for.js +62 -0
  343. package/src/settings/field-control.js +201 -0
  344. package/src/settings/index.d.ts +201 -0
  345. package/src/settings/index.js +3 -0
  346. package/src/settings/messages.js +112 -0
  347. package/src/settings/miniature.js +26 -0
  348. package/src/settings/panel-actions.js +234 -0
  349. package/src/settings/panel-model.js +49 -0
  350. package/src/settings/panel-refresh.js +56 -0
  351. package/src/settings/panel-rows.js +200 -0
  352. package/src/settings/preset-cards.js +43 -0
  353. package/src/settings/saved-looks.js +227 -0
  354. package/src/settings/section-layout.js +95 -0
  355. package/src/settings/section-tabs.js +175 -0
  356. package/src/settings/settings-panel.js +192 -0
  357. package/src/settings/settings.css +178 -0
  358. package/stories/accordion.lino +14 -0
  359. package/stories/alert-dialog.lino +4 -0
  360. package/stories/app-bar.lino +10 -0
  361. package/stories/avatar.lino +7 -0
  362. package/stories/badge.lino +12 -0
  363. package/stories/button.lino +17 -0
  364. package/stories/card.lino +10 -0
  365. package/stories/checkbox.lino +14 -0
  366. package/stories/chip.lino +19 -0
  367. package/stories/color-field.lino +9 -0
  368. package/stories/combobox.lino +10 -0
  369. package/stories/container.lino +11 -0
  370. package/stories/context-menu.lino +15 -0
  371. package/stories/dialog.lino +16 -0
  372. package/stories/drawer.lino +12 -0
  373. package/stories/icon-button.lino +13 -0
  374. package/stories/label.lino +7 -0
  375. package/stories/link-cards.lino +9 -0
  376. package/stories/link.lino +9 -0
  377. package/stories/menu-item.lino +6 -0
  378. package/stories/menu-separator.lino +7 -0
  379. package/stories/menu.lino +30 -0
  380. package/stories/nav-strip.lino +11 -0
  381. package/stories/number-field.lino +16 -0
  382. package/stories/option.lino +10 -0
  383. package/stories/paper.lino +11 -0
  384. package/stories/popover.lino +4 -0
  385. package/stories/pref-switches.lino +4 -0
  386. package/stories/progress.lino +14 -0
  387. package/stories/radial-menu.lino +19 -0
  388. package/stories/radio-group.lino +22 -0
  389. package/stories/radio.lino +10 -0
  390. package/stories/section-nav.lino +9 -0
  391. package/stories/select.lino +16 -0
  392. package/stories/slider.lino +14 -0
  393. package/stories/switch.lino +10 -0
  394. package/stories/tab-panel.lino +7 -0
  395. package/stories/tab.lino +7 -0
  396. package/stories/tabs.lino +25 -0
  397. package/stories/text-area.lino +12 -0
  398. package/stories/text-field.lino +23 -0
  399. package/stories/titled-section.lino +7 -0
  400. package/stories/toast.lino +3 -0
  401. package/stories/toaster.lino +2 -0
  402. package/stories/tooltip.lino +3 -0
@@ -0,0 +1,228 @@
1
+ .ui-chat-shell {
2
+ position: relative;
3
+ background: linear-gradient(
4
+ 135deg,
5
+ var(--chat-bg, Canvas),
6
+ var(--chat-bg-second, var(--chat-bg, Canvas)),
7
+ var(--chat-bg-third, var(--chat-bg, Canvas)),
8
+ var(--chat-bg-fourth, var(--chat-bg, Canvas))
9
+ );
10
+ color: var(--chat-text, CanvasText);
11
+ font:
12
+ 1rem/1.45 system-ui,
13
+ sans-serif;
14
+ color-scheme: light dark;
15
+ isolation: isolate;
16
+ }
17
+ .ui-chat-shell *,
18
+ .ui-chat-menu {
19
+ box-sizing: border-box;
20
+ }
21
+ .ui-chat-shell ::selection {
22
+ background: var(--chat-selection-bg, #164e63);
23
+ color: var(--chat-selection-text, #fff);
24
+ }
25
+ ui-message-stream {
26
+ display: flex;
27
+ flex-direction: column;
28
+ height: 100%;
29
+ min-height: 0;
30
+ }
31
+ .ui-chat-scroll {
32
+ flex: 1;
33
+ min-height: 0;
34
+ overflow: auto;
35
+ overflow-anchor: none;
36
+ padding-bottom: var(--composer-space, 0px);
37
+ }
38
+ .ui-chat-body {
39
+ position: relative;
40
+ max-width: var(--chat-column, 44rem);
41
+ margin: auto;
42
+ }
43
+ .ui-chat-body > .ui-data-row {
44
+ width: 100%;
45
+ padding: 6px 18px;
46
+ }
47
+ .ui-chat-bubble {
48
+ position: relative;
49
+ width: fit-content;
50
+ max-width: calc(var(--chat-style-width, 0.88) * 100%);
51
+ border-radius: var(--chat-style-radius, var(--chat-bubble-radius, 14px));
52
+ border-end-start-radius: var(--chat-bubble-tail, 14px);
53
+ padding: var(--chat-style-padding, var(--chat-bubble-padding-block, 10px))
54
+ var(--chat-style-padding, var(--chat-bubble-padding-inline, 10px));
55
+ background: var(--chat-bubble-in, Canvas);
56
+ color: var(--chat-bubble-in-text, CanvasText);
57
+ border: 1px solid var(--chat-edge, transparent);
58
+ }
59
+ .ui-chat-bubble.outgoing {
60
+ margin-inline-start: auto;
61
+ background: var(--chat-bubble-out, Canvas);
62
+ color: var(--chat-bubble-out-text, CanvasText);
63
+ }
64
+ .ui-chat-bubble.service {
65
+ margin: auto;
66
+ text-align: center;
67
+ background: var(--chat-sidebar, Canvas);
68
+ color: var(--chat-text, CanvasText);
69
+ }
70
+ .ui-chat-text {
71
+ white-space: pre-wrap;
72
+ overflow-wrap: anywhere;
73
+ }
74
+ .ui-chat-sender {
75
+ display: block;
76
+ font-size: 0.85em;
77
+ }
78
+ .ui-chat-delivery {
79
+ display: inline-block;
80
+ padding-inline: 6px;
81
+ font-size: 0.8em;
82
+ }
83
+ .ui-chat-bubble[data-status='failed'] {
84
+ border: 2px solid #bc1739;
85
+ }
86
+ .ui-chat-day,
87
+ .ui-chat-unread {
88
+ text-align: center;
89
+ margin: 6px 0 12px;
90
+ color: var(--chat-text, CanvasText);
91
+ background: var(--chat-sidebar, Canvas);
92
+ border-radius: 8px;
93
+ padding: 3px 8px;
94
+ }
95
+ .ui-chat-unread {
96
+ border-block: 2px solid var(--chat-selection-bg, #164e63);
97
+ }
98
+ .ui-chat-selected > .ui-chat-bubble,
99
+ .ui-chat-highlighted > .ui-chat-bubble {
100
+ outline: 3px solid var(--chat-selection-bg, #164e63);
101
+ outline-offset: 2px;
102
+ }
103
+ .ui-chat-step {
104
+ margin: 8px 0;
105
+ }
106
+ .ui-chat-step > details {
107
+ margin-inline-start: 18px;
108
+ }
109
+ .ui-chat-step summary {
110
+ cursor: pointer;
111
+ }
112
+ .ui-chat-shell button,
113
+ .ui-chat-menu {
114
+ font: inherit;
115
+ background: var(--chat-sidebar, Canvas);
116
+ color: var(--chat-text, CanvasText);
117
+ border: 1px solid currentColor;
118
+ border-radius: 8px;
119
+ padding: 6px 10px;
120
+ }
121
+ .ui-chat-shell a {
122
+ color: inherit;
123
+ text-decoration: underline;
124
+ }
125
+ .ui-chat-attachment,
126
+ .ui-chat-reply {
127
+ display: block;
128
+ margin-block: 8px;
129
+ }
130
+ .ui-chat-toolbar {
131
+ display: flex;
132
+ flex-wrap: wrap;
133
+ gap: 8px;
134
+ padding: 8px;
135
+ background: var(--chat-sidebar, Canvas);
136
+ }
137
+ .ui-chat-status {
138
+ position: absolute;
139
+ top: 50px;
140
+ inset-inline-end: 12px;
141
+ background: var(--chat-sidebar, Canvas);
142
+ }
143
+ ui-composer {
144
+ position: absolute;
145
+ bottom: 0;
146
+ inset-inline: 16px;
147
+ max-width: 44rem;
148
+ margin: auto;
149
+ display: flex;
150
+ align-items: end;
151
+ gap: 10px;
152
+ background: var(--chat-sidebar, Canvas);
153
+ color: var(--chat-text, CanvasText);
154
+ border: 1px solid currentColor;
155
+ border-radius: 18px;
156
+ padding: 12px;
157
+ }
158
+ ui-composer ui-text-area {
159
+ color: inherit;
160
+ flex: 1;
161
+ min-width: 0;
162
+ }
163
+ ui-composer [data-part='label'] {
164
+ color: inherit;
165
+ display: block;
166
+ font-size: 0.8em;
167
+ }
168
+ .ui-chat-shell ui-composer textarea {
169
+ box-sizing: border-box;
170
+ display: block;
171
+ width: 100%;
172
+ min-height: 36px;
173
+ max-height: min(70dvh, 30rem);
174
+ resize: none;
175
+ overflow-y: auto;
176
+ font: inherit;
177
+ line-height: 24px;
178
+ padding: 4px 8px;
179
+ color: var(--chat-text, CanvasText);
180
+ background: var(--chat-sidebar, Canvas);
181
+ border: 1px solid currentColor;
182
+ border-radius: 8px;
183
+ }
184
+ .ui-chat-composer-slots:empty {
185
+ display: none;
186
+ }
187
+ .ui-chat-menu {
188
+ min-width: 10rem;
189
+ padding: 6px;
190
+ }
191
+ .ui-chat-menu [role='menuitem'] {
192
+ display: flex;
193
+ gap: 8px;
194
+ padding: 8px;
195
+ cursor: pointer;
196
+ }
197
+ .ui-chat-menu [role='menuitem']:focus {
198
+ background: var(--chat-selection-bg, #164e63);
199
+ color: var(--chat-selection-text, #fff);
200
+ }
201
+ .ui-chat-shell :focus-visible {
202
+ outline: 3px solid var(--chat-selection-bg, #164e63);
203
+ outline-offset: 2px;
204
+ }
205
+ @media (prefers-reduced-motion: no-preference) {
206
+ .ui-chat-highlighted > .ui-chat-bubble {
207
+ transition: outline-offset 0.15s;
208
+ }
209
+ }
210
+ @media (forced-colors: active) {
211
+ .ui-chat-selected > .ui-chat-bubble,
212
+ .ui-chat-highlighted > .ui-chat-bubble {
213
+ outline-color: Highlight;
214
+ }
215
+ }
216
+
217
+ .ui-chat-body > .ui-data-row {
218
+ background: transparent;
219
+ }
220
+
221
+ .ui-chat-run-continued .ui-chat-sender {
222
+ display: none;
223
+ }
224
+
225
+ .ui-chat-shell ui-chat-list .ui-data-row {
226
+ background: var(--chat-sidebar, Canvas);
227
+ color: var(--chat-text, CanvasText);
228
+ }
@@ -0,0 +1,131 @@
1
+ import { mountControls } from '../controls/index.js';
2
+ import { formatLinks } from '@link-foundation/ui-core';
3
+ import {
4
+ atomOf,
5
+ chatOptions,
6
+ chatRecords,
7
+ emit,
8
+ make,
9
+ registerChatKind,
10
+ uid,
11
+ } from './dom.js';
12
+
13
+ registerChatKind('composer', (node, initial, ctx) => {
14
+ const options = chatOptions(ctx);
15
+ const win = ctx.document.defaultView;
16
+ const prefix = uid('chat-compose');
17
+ const mounted = mountControls(
18
+ node,
19
+ formatLinks([
20
+ {
21
+ id: `${prefix}-input`,
22
+ values: [
23
+ 'text-area',
24
+ ['label', options.labels?.message ?? 'Message'],
25
+ ['rows', '1'],
26
+ ],
27
+ },
28
+ {
29
+ id: `${prefix}-send`,
30
+ values: ['button', ['label', options.labels?.send ?? 'Send']],
31
+ },
32
+ ])
33
+ );
34
+ const input = node.querySelector('textarea');
35
+ const send = node.querySelector('button');
36
+ const slots = make(ctx.document, 'div', { class: 'ui-chat-composer-slots' });
37
+ node.prepend(slots);
38
+ for (const name of ['before', 'attachments', 'after']) {
39
+ const slot = options.slots?.[name]?.({
40
+ document: ctx.document,
41
+ composer: node,
42
+ });
43
+ if (slot) {
44
+ const wrapper = make(ctx.document, 'div', { 'data-slot': name });
45
+ wrapper.append(slot);
46
+ slots.append(wrapper);
47
+ }
48
+ }
49
+ let frame = null;
50
+ let el = initial;
51
+ const spaceScope = () => options.spaceTarget ?? node.parentElement;
52
+ let previousSpace;
53
+ let measuredScope;
54
+ const measure = () => {
55
+ if (frame !== null) {
56
+ return;
57
+ }
58
+ frame = win.requestAnimationFrame(() => {
59
+ frame = null;
60
+ const scope = spaceScope();
61
+ if (!measuredScope) {
62
+ measuredScope = scope;
63
+ previousSpace = scope?.style.getPropertyValue('--composer-space');
64
+ }
65
+ scope?.style.setProperty(
66
+ '--composer-space',
67
+ `${Math.ceil(node.getBoundingClientRect().height)}px`
68
+ );
69
+ });
70
+ };
71
+ const grow = () => {
72
+ input.style.height = 'auto';
73
+ input.style.height = `${input.scrollHeight + input.offsetHeight - input.clientHeight}px`;
74
+ measure();
75
+ };
76
+ const submit = () => {
77
+ if (!input.value.trim() || input.disabled) {
78
+ return;
79
+ }
80
+ emit(node, 'ui-chat-send', { chat: atomOf(el, 'chat'), text: input.value });
81
+ input.value = '';
82
+ grow();
83
+ };
84
+ const keydown = (event) => {
85
+ if (event.key === 'Enter' && !event.shiftKey && !event.isComposing) {
86
+ event.preventDefault();
87
+ submit();
88
+ }
89
+ };
90
+ input.addEventListener('input', grow);
91
+ input.addEventListener('keydown', keydown);
92
+ send.addEventListener('click', submit);
93
+ const observer = new win.ResizeObserver(measure);
94
+ observer.observe(node);
95
+ const refresh = () => {
96
+ const chat =
97
+ chatRecords(ctx).find((r) => r.id === atomOf(el, 'chat')) ?? {};
98
+ const attachments = slots.querySelector('[data-slot=attachments]');
99
+ if (attachments) {
100
+ attachments.hidden = !(chat['max-attachments'] > 0);
101
+ }
102
+ slots.dataset.maxAttachments = String(chat['max-attachments'] ?? 0);
103
+ input.disabled = atomOf(el, 'disabled') === 'true';
104
+ send.disabled = input.disabled;
105
+ measure();
106
+ };
107
+ const unsubscribe = options.data?.subscribe?.(refresh);
108
+ return {
109
+ update(next) {
110
+ el = next;
111
+ refresh();
112
+ },
113
+ disconnect() {
114
+ unsubscribe?.();
115
+ observer.disconnect();
116
+ if (frame !== null) {
117
+ win.cancelAnimationFrame(frame);
118
+ }
119
+ input.removeEventListener('input', grow);
120
+ input.removeEventListener('keydown', keydown);
121
+ send.removeEventListener('click', submit);
122
+ const scope = measuredScope;
123
+ if (previousSpace) {
124
+ scope?.style.setProperty('--composer-space', previousSpace);
125
+ } else {
126
+ scope?.style.removeProperty('--composer-space');
127
+ }
128
+ mounted.destroy();
129
+ },
130
+ };
131
+ });
@@ -0,0 +1,12 @@
1
+ import { dayLabel } from './chat-model.js';
2
+ import { atomOf, chatOptions, registerChatKind } from './dom.js';
3
+
4
+ export function drawDay(node, iso, options) {
5
+ node.className = 'ui-chat-day';
6
+ node.setAttribute('role', 'separator');
7
+ node.textContent = dayLabel(iso, options);
8
+ node.setAttribute('aria-label', node.textContent);
9
+ }
10
+ registerChatKind('day-separator', (node, _el, ctx) => ({
11
+ update: (el) => drawDay(node, atomOf(el, 'time'), chatOptions(ctx)),
12
+ }));
@@ -0,0 +1,33 @@
1
+ import { defineKind } from '@link-foundation/ui-dom';
2
+ import { atomOf, controllerOf, dropController, isLive } from '../layout/dom.js';
3
+ export { atomOf, make, emit, uid } from '../layout/dom.js';
4
+
5
+ /** Shared lifecycle; each mount supplies its own chat data and slots. */
6
+ export function registerChatKind(kind, create) {
7
+ defineKind(kind, {
8
+ tag: `ui-${kind}`,
9
+ childrenSlot: null,
10
+ create: (_el, ctx) => ctx.document.createElement(`ui-${kind}`),
11
+ update(node, el, _changed, ctx) {
12
+ if (isLive(ctx)) {
13
+ controllerOf(node, () => create(node, el, ctx)).update?.(el);
14
+ } else {
15
+ node.textContent = atomOf(el, 'label') ?? kind;
16
+ }
17
+ },
18
+ destroy: dropController,
19
+ });
20
+ }
21
+
22
+ /** All related records are supplied as a snapshot or observable snapshot. */
23
+ export function chatRecords(ctx) {
24
+ const data = ctx.options.chat?.data ?? [];
25
+ return typeof data.get === 'function' ? data.get() : data;
26
+ }
27
+ export const chatOptions = (ctx) => ctx.options.chat ?? {};
28
+ export const recordOf = (el, ctx) =>
29
+ chatRecords(ctx).find((r) => r.id === atomOf(el, 'record'));
30
+ export const chatOf = (message, ctx) =>
31
+ chatRecords(ctx).find((r) => r.id === message?.chat) ?? {};
32
+ export const capability = (chat, message, name) =>
33
+ (message?.[name] ?? chat?.[name]) === true;
@@ -0,0 +1,49 @@
1
+ /** Bottom following and keyed prepend anchoring reuse the data range model. */
2
+ import { anchorScrollTop } from '../data/virtual-range.js';
3
+ export { anchorScrollTop };
4
+ export const firstUnread = (messages) =>
5
+ messages.find((m) => m.unread && !m.outgoing)?.id ?? null;
6
+
7
+ /** Geometry-only follower: called after viewport measurements, never in RO. */
8
+ export function createFollow(root, { threshold = 2 } = {}) {
9
+ let following = true;
10
+ const atBottom = () =>
11
+ root.scrollHeight - root.clientHeight - root.scrollTop <= threshold;
12
+ const scroll = () => {
13
+ following = atBottom();
14
+ };
15
+ const leave = (event) => {
16
+ if (
17
+ event.deltaY < 0 ||
18
+ ['ArrowUp', 'PageUp', 'Home'].includes(event.key) ||
19
+ event.type === 'touchstart'
20
+ ) {
21
+ following = false;
22
+ }
23
+ };
24
+ root.addEventListener('scroll', scroll, { passive: true });
25
+ for (const type of ['wheel', 'keydown', 'touchstart']) {
26
+ root.addEventListener(type, leave, { passive: true });
27
+ }
28
+ return {
29
+ state: () => ({ following }),
30
+ pause() {
31
+ following = false;
32
+ },
33
+ toBottom() {
34
+ following = true;
35
+ root.scrollTop = root.scrollHeight;
36
+ },
37
+ refresh() {
38
+ if (following) {
39
+ root.scrollTop = root.scrollHeight;
40
+ }
41
+ },
42
+ disconnect() {
43
+ root.removeEventListener('scroll', scroll);
44
+ for (const type of ['wheel', 'keydown', 'touchstart']) {
45
+ root.removeEventListener(type, leave);
46
+ }
47
+ },
48
+ };
49
+ }
@@ -0,0 +1,142 @@
1
+ /** All records are flat. References are IDs; adapters own transport semantics. */
2
+ export type ChatKind =
3
+ | 'chat'
4
+ | 'message'
5
+ | 'participant'
6
+ | 'attachment'
7
+ | 'reaction'
8
+ | 'step';
9
+ export interface ChatRecord {
10
+ id: string;
11
+ kind: ChatKind;
12
+ [field: string]: string | number | boolean | undefined;
13
+ }
14
+ export interface Message extends ChatRecord {
15
+ kind: 'message';
16
+ chat?: string;
17
+ sender?: string;
18
+ time?: string;
19
+ text?: string;
20
+ outgoing?: boolean;
21
+ unread?: boolean;
22
+ status?: string;
23
+ }
24
+ export interface Chat extends ChatRecord {
25
+ kind: 'chat';
26
+ title?: string;
27
+ unread?: number;
28
+ 'can-edit'?: boolean;
29
+ 'can-react'?: boolean;
30
+ 'can-reply'?: boolean;
31
+ 'max-attachments'?: number;
32
+ }
33
+ export function parseChatData(links: string | unknown[]): ChatRecord[];
34
+ export function chatDataToLino(data: ChatRecord[]): string;
35
+ export interface StreamState {
36
+ messages: Message[];
37
+ hasOlder: boolean;
38
+ hasNewer: boolean;
39
+ highlighted: string | null;
40
+ loading: boolean;
41
+ error: Error | null;
42
+ }
43
+ export interface StreamSource {
44
+ load(query: {
45
+ before?: string;
46
+ after?: string;
47
+ around?: string;
48
+ limit: number;
49
+ signal: AbortSignal;
50
+ }): Promise<{ messages: Message[]; hasOlder: boolean; hasNewer: boolean }>;
51
+ }
52
+ export interface StreamWindow {
53
+ loadOlder(): Promise<void>;
54
+ loadNewer(): Promise<void>;
55
+ jumpTo(id: string): Promise<void>;
56
+ state(): StreamState;
57
+ subscribe(fn: (state: StreamState) => void): () => void;
58
+ disconnect(): void;
59
+ readonly prefetch: number;
60
+ }
61
+ export function createStreamWindow(
62
+ source: StreamSource,
63
+ options?: { pageSize?: number; prefetch?: number; ceiling?: number }
64
+ ): StreamWindow;
65
+ export interface ChatDateOptions {
66
+ clock: () => number;
67
+ locale?: string;
68
+ timeZone?: string;
69
+ labels?: Record<string, string>;
70
+ }
71
+ export const CHAT_FILTERS: readonly string[];
72
+ export const DAY_GROUPS: readonly string[];
73
+ export const CHAT_KINDS: readonly string[];
74
+ export function chatVocabulary(): ReturnType<
75
+ typeof import('@link-foundation/ui-core').defaultVocabulary
76
+ >;
77
+ export function dayGroup(iso: string, options: ChatDateOptions): string;
78
+ export function dayLabel(iso: string, options: ChatDateOptions): string;
79
+ export function deliveryStatus(message: Message): string | null;
80
+ export function unreadCount(messages: Message[], chat?: Partial<Chat>): number;
81
+ export function messageRuns(
82
+ messages: Message[],
83
+ options?: { gap?: number; timeZone?: string }
84
+ ): { sender: string; messages: Message[] }[];
85
+ export function summarizeChats(
86
+ data: ChatRecord[],
87
+ options?: { filter?: string }
88
+ ): (Chat & { last: Message | null })[];
89
+ export function sortChats<T extends { pinned?: number; last?: Message | null }>(
90
+ chats: T[],
91
+ order?: 'latest' | 'oldest'
92
+ ): T[];
93
+ export interface ChatSelection {
94
+ state(): {
95
+ selected: Set<string>;
96
+ target: string | null;
97
+ anchor: string | null;
98
+ };
99
+ target(id: string | null): void;
100
+ select(
101
+ id: string,
102
+ options?: { toggle?: boolean; range?: boolean; keys?: string[] }
103
+ ): void;
104
+ clear(): void;
105
+ }
106
+ export function createChatSelection(): ChatSelection;
107
+ export function firstUnread(messages: Message[]): string | null;
108
+ export function createFollow(
109
+ root: HTMLElement,
110
+ options?: { threshold?: number }
111
+ ): {
112
+ state(): { following: boolean };
113
+ pause(): void;
114
+ toBottom(): void;
115
+ refresh(): void;
116
+ disconnect(): void;
117
+ };
118
+ /** Pass as `chat` in ui-dom mount options. Sources remain owned by the host. */
119
+ export interface ChatOptions extends ChatDateOptions {
120
+ data:
121
+ | ChatRecord[]
122
+ | { get(): ChatRecord[]; subscribe?(fn: () => void): () => void };
123
+ windows?: Record<string, StreamWindow>;
124
+ spaceTarget?: HTMLElement;
125
+ slots?: {
126
+ message?: (
127
+ message: Message,
128
+ context: { document: Document }
129
+ ) => Node | string;
130
+ before?: (context: { document: Document; composer: HTMLElement }) => Node;
131
+ attachments?: (context: {
132
+ document: Document;
133
+ composer: HTMLElement;
134
+ }) => Node;
135
+ after?: (context: { document: Document; composer: HTMLElement }) => Node;
136
+ };
137
+ }
138
+
139
+ export function calendarDay(
140
+ iso: string | number,
141
+ timeZone?: string
142
+ ): number | null;
@@ -0,0 +1,13 @@
1
+ /** Provider-neutral chat data, pure models and registered ui-dom kinds. */
2
+ export * from './chat-contract.js';
3
+ export * from './chat-model.js';
4
+ export * from './stream-window.js';
5
+ export { createFollow, firstUnread } from './follow.js';
6
+ export * from './selection.js';
7
+ export * from './vocabulary.js';
8
+ import './chat-list.js';
9
+ import './message-stream.js';
10
+ import './message-bubble.js';
11
+ import './day-separator.js';
12
+ import './composer.js';
13
+ import './reasoning-trace.js';