@sdxc/ui 2026.11.18 → 2026.11.26

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 (234) hide show
  1. package/README.md +133 -1
  2. package/dist/app/index.d.ts +1 -0
  3. package/dist/app/index.js +1 -0
  4. package/dist/app/mixins/command-palette.js +10 -2
  5. package/dist/app/mixins/log-viewer.js +17 -14
  6. package/dist/app/mixins/route-dialog.d.ts +17 -0
  7. package/dist/app/mixins/route-dialog.js +53 -0
  8. package/dist/app/optimistic-toggle.js +6 -0
  9. package/dist/app/route-dialog.d.ts +38 -0
  10. package/dist/app/route-dialog.js +49 -0
  11. package/dist/audio/equalizer.d.ts +24 -0
  12. package/dist/audio/equalizer.js +57 -0
  13. package/dist/audio/index.d.ts +16 -0
  14. package/dist/audio/index.js +16 -0
  15. package/dist/audio/media-tile.d.ts +38 -0
  16. package/dist/audio/media-tile.js +98 -0
  17. package/dist/audio/player-bar.d.ts +108 -0
  18. package/dist/audio/player-bar.js +338 -0
  19. package/dist/audio/queue-list.d.ts +56 -0
  20. package/dist/audio/queue-list.js +102 -0
  21. package/dist/audio/track-list.d.ts +91 -0
  22. package/dist/audio/track-list.js +226 -0
  23. package/dist/audio/utils/media-session.d.ts +44 -0
  24. package/dist/audio/utils/media-session.js +87 -0
  25. package/dist/audio/utils/play-queue.d.ts +98 -0
  26. package/dist/audio/utils/play-queue.js +149 -0
  27. package/dist/audio/utils/track-time.d.ts +28 -0
  28. package/dist/audio/utils/track-time.js +36 -0
  29. package/dist/chat/composer-format.d.ts +35 -0
  30. package/dist/chat/composer-format.js +84 -0
  31. package/dist/chat/index.d.ts +6 -0
  32. package/dist/chat/index.js +6 -0
  33. package/dist/chat/mention-menu.d.ts +43 -0
  34. package/dist/chat/mention-menu.js +70 -0
  35. package/dist/chat/message-group.d.ts +92 -0
  36. package/dist/chat/message-group.js +222 -0
  37. package/dist/chat/mixins/composer-format.d.ts +28 -0
  38. package/dist/chat/mixins/composer-format.js +80 -0
  39. package/dist/chat/mixins/composer-send.d.ts +2 -2
  40. package/dist/chat/mixins/composer-send.js +4 -2
  41. package/dist/chat/mixins/mention-menu.d.ts +41 -0
  42. package/dist/chat/mixins/mention-menu.js +213 -0
  43. package/dist/chat/mixins/reaction-sync.d.ts +47 -0
  44. package/dist/chat/mixins/reaction-sync.js +172 -0
  45. package/dist/chat/reaction-bar.d.ts +70 -0
  46. package/dist/chat/reaction-bar.js +108 -0
  47. package/dist/chat/typing-indicator.d.ts +42 -0
  48. package/dist/chat/typing-indicator.js +68 -0
  49. package/dist/chat/utils/composer-text.d.ts +38 -0
  50. package/dist/chat/utils/composer-text.js +86 -0
  51. package/dist/chat/utils/markdown-format.d.ts +30 -0
  52. package/dist/chat/utils/markdown-format.js +158 -0
  53. package/dist/chat/utils/mention-query.d.ts +55 -0
  54. package/dist/chat/utils/mention-query.js +60 -0
  55. package/dist/commerce/cart-drawer.d.ts +69 -0
  56. package/dist/commerce/cart-drawer.js +163 -0
  57. package/dist/commerce/cart-line.d.ts +32 -0
  58. package/dist/commerce/cart-line.js +43 -0
  59. package/dist/commerce/checkout-layout.d.ts +32 -0
  60. package/dist/commerce/checkout-layout.js +51 -0
  61. package/dist/commerce/facet-filters.d.ts +121 -0
  62. package/dist/commerce/facet-filters.js +318 -0
  63. package/dist/commerce/fulfilment-note.d.ts +28 -0
  64. package/dist/commerce/fulfilment-note.js +26 -0
  65. package/dist/commerce/index.d.ts +27 -0
  66. package/dist/commerce/index.js +27 -0
  67. package/dist/commerce/item-options-dialog.d.ts +67 -0
  68. package/dist/commerce/item-options-dialog.js +150 -0
  69. package/dist/commerce/menu-item-card.d.ts +37 -0
  70. package/dist/commerce/menu-item-card.js +96 -0
  71. package/dist/commerce/option-group.d.ts +62 -0
  72. package/dist/commerce/option-group.js +121 -0
  73. package/dist/commerce/order-summary.d.ts +42 -0
  74. package/dist/commerce/order-summary.js +76 -0
  75. package/dist/commerce/order-tracker.d.ts +80 -0
  76. package/dist/commerce/order-tracker.js +178 -0
  77. package/dist/commerce/price.d.ts +52 -0
  78. package/dist/commerce/price.js +108 -0
  79. package/dist/commerce/product-card.d.ts +53 -0
  80. package/dist/commerce/product-card.js +127 -0
  81. package/dist/commerce/product-gallery.d.ts +70 -0
  82. package/dist/commerce/product-gallery.js +186 -0
  83. package/dist/commerce/promo-code.d.ts +56 -0
  84. package/dist/commerce/promo-code.js +101 -0
  85. package/dist/commerce/quantity-stepper.d.ts +42 -0
  86. package/dist/commerce/quantity-stepper.js +53 -0
  87. package/dist/commerce/question-list.d.ts +53 -0
  88. package/dist/commerce/question-list.js +92 -0
  89. package/dist/commerce/shipping-estimate.d.ts +53 -0
  90. package/dist/commerce/shipping-estimate.js +39 -0
  91. package/dist/commerce/sort-select.d.ts +38 -0
  92. package/dist/commerce/sort-select.js +38 -0
  93. package/dist/commerce/variant-picker.d.ts +75 -0
  94. package/dist/commerce/variant-picker.js +135 -0
  95. package/dist/components/amount.d.ts +46 -0
  96. package/dist/components/amount.js +34 -0
  97. package/dist/components/autocomplete.d.ts +82 -0
  98. package/dist/components/autocomplete.js +114 -0
  99. package/dist/components/carousel.d.ts +31 -1
  100. package/dist/components/carousel.js +66 -3
  101. package/dist/components/index.d.ts +11 -0
  102. package/dist/components/index.js +11 -0
  103. package/dist/components/letterbox.d.ts +47 -0
  104. package/dist/components/letterbox.js +56 -0
  105. package/dist/components/lightbox.d.ts +88 -0
  106. package/dist/components/lightbox.js +224 -0
  107. package/dist/components/media-grid.d.ts +53 -0
  108. package/dist/components/media-grid.js +89 -0
  109. package/dist/components/range-months.d.ts +100 -0
  110. package/dist/components/range-months.js +274 -0
  111. package/dist/components/rating-input.d.ts +33 -0
  112. package/dist/components/rating-input.js +63 -0
  113. package/dist/components/rating.d.ts +38 -0
  114. package/dist/components/rating.js +66 -0
  115. package/dist/components/review-card.d.ts +39 -0
  116. package/dist/components/review-card.js +59 -0
  117. package/dist/components/section-bar.d.ts +57 -0
  118. package/dist/components/section-bar.js +140 -0
  119. package/dist/components/slider.js +7 -0
  120. package/dist/components/step-indicator.d.ts +46 -0
  121. package/dist/components/step-indicator.js +96 -0
  122. package/dist/finance/index.d.ts +10 -0
  123. package/dist/finance/index.js +10 -0
  124. package/dist/finance/ledger.d.ts +60 -0
  125. package/dist/finance/ledger.js +93 -0
  126. package/dist/finance/payment-card.d.ts +49 -0
  127. package/dist/finance/payment-card.js +115 -0
  128. package/dist/map/engine.d.ts +49 -0
  129. package/dist/map/engine.js +591 -0
  130. package/dist/map/index.d.ts +12 -0
  131. package/dist/map/index.js +12 -0
  132. package/dist/map/map-canvas.d.ts +101 -0
  133. package/dist/map/map-canvas.js +275 -0
  134. package/dist/map/map.d.ts +217 -0
  135. package/dist/map/map.js +598 -0
  136. package/dist/map/mixins/map-link.d.ts +30 -0
  137. package/dist/map/mixins/map-link.js +116 -0
  138. package/dist/map/utils/basemap.d.ts +88 -0
  139. package/dist/map/utils/basemap.js +84 -0
  140. package/dist/map/utils/cluster.d.ts +43 -0
  141. package/dist/map/utils/cluster.js +80 -0
  142. package/dist/map/utils/mercator.d.ts +66 -0
  143. package/dist/map/utils/mercator.js +92 -0
  144. package/dist/map/utils/stage.d.ts +24 -0
  145. package/dist/map/utils/stage.js +49 -0
  146. package/dist/mixins/autocomplete.d.ts +28 -0
  147. package/dist/mixins/autocomplete.js +283 -0
  148. package/dist/mixins/carousel-controls.d.ts +14 -3
  149. package/dist/mixins/carousel-controls.js +89 -30
  150. package/dist/mixins/index.d.ts +2 -0
  151. package/dist/mixins/index.js +2 -0
  152. package/dist/mixins/lightbox-controls.d.ts +34 -0
  153. package/dist/mixins/lightbox-controls.js +176 -0
  154. package/dist/schedule/agenda.d.ts +63 -0
  155. package/dist/schedule/agenda.js +221 -0
  156. package/dist/schedule/day-strip.d.ts +50 -0
  157. package/dist/schedule/day-strip.js +136 -0
  158. package/dist/schedule/free-busy.d.ts +96 -0
  159. package/dist/schedule/free-busy.js +285 -0
  160. package/dist/schedule/index.d.ts +15 -0
  161. package/dist/schedule/index.js +15 -0
  162. package/dist/schedule/mixins/day-strip-scroll.d.ts +16 -0
  163. package/dist/schedule/mixins/day-strip-scroll.js +40 -0
  164. package/dist/schedule/mixins/time-grid-drag.d.ts +24 -0
  165. package/dist/schedule/mixins/time-grid-drag.js +532 -0
  166. package/dist/schedule/month-view.d.ts +68 -0
  167. package/dist/schedule/month-view.js +301 -0
  168. package/dist/schedule/time-grid.d.ts +168 -0
  169. package/dist/schedule/time-grid.js +417 -0
  170. package/dist/schedule/utils/time-grid-layout.d.ts +50 -0
  171. package/dist/schedule/utils/time-grid-layout.js +93 -0
  172. package/dist/schedule/year-view.d.ts +46 -0
  173. package/dist/schedule/year-view.js +142 -0
  174. package/dist/styles/index.d.ts +1 -0
  175. package/dist/styles/index.js +1 -0
  176. package/dist/styles/typewriter-text.d.ts +20 -0
  177. package/dist/styles/typewriter-text.js +23 -0
  178. package/dist/test/map.d.ts +18 -0
  179. package/dist/test/map.js +96 -0
  180. package/dist/test/reels.d.ts +30 -0
  181. package/dist/test/reels.js +41 -0
  182. package/dist/test/stories.d.ts +31 -0
  183. package/dist/test/stories.js +66 -0
  184. package/dist/travel/boarding-pass.d.ts +107 -0
  185. package/dist/travel/boarding-pass.js +293 -0
  186. package/dist/travel/car-offer.d.ts +70 -0
  187. package/dist/travel/car-offer.js +127 -0
  188. package/dist/travel/fare-calendar.d.ts +85 -0
  189. package/dist/travel/fare-calendar.js +233 -0
  190. package/dist/travel/fare-options.d.ts +84 -0
  191. package/dist/travel/fare-options.js +142 -0
  192. package/dist/travel/flight-itinerary.d.ts +84 -0
  193. package/dist/travel/flight-itinerary.js +112 -0
  194. package/dist/travel/flight-option.d.ts +58 -0
  195. package/dist/travel/flight-option.js +111 -0
  196. package/dist/travel/flight-segment.d.ts +105 -0
  197. package/dist/travel/flight-segment.js +174 -0
  198. package/dist/travel/index.d.ts +20 -0
  199. package/dist/travel/index.js +20 -0
  200. package/dist/travel/package-savings.d.ts +74 -0
  201. package/dist/travel/package-savings.js +128 -0
  202. package/dist/travel/price-breakdown.d.ts +66 -0
  203. package/dist/travel/price-breakdown.js +102 -0
  204. package/dist/travel/rating-breakdown.d.ts +81 -0
  205. package/dist/travel/rating-breakdown.js +132 -0
  206. package/dist/travel/seat-map.d.ts +108 -0
  207. package/dist/travel/seat-map.js +371 -0
  208. package/dist/travel/trip-timeline.d.ts +84 -0
  209. package/dist/travel/trip-timeline.js +212 -0
  210. package/dist/utils/gamepad-presses.d.ts +21 -0
  211. package/dist/utils/gamepad-presses.js +28 -0
  212. package/dist/utils/index.d.ts +5 -0
  213. package/dist/utils/index.js +5 -0
  214. package/dist/utils/move-focus.d.ts +20 -0
  215. package/dist/utils/move-focus.js +28 -0
  216. package/dist/utils/range-months.d.ts +54 -0
  217. package/dist/utils/range-months.js +98 -0
  218. package/dist/utils/swipe-direction.d.ts +23 -0
  219. package/dist/utils/swipe-direction.js +27 -0
  220. package/dist/utils/typewriter.d.ts +49 -0
  221. package/dist/utils/typewriter.js +171 -0
  222. package/dist/video/index.d.ts +6 -2
  223. package/dist/video/index.js +6 -2
  224. package/dist/video/mixins/reel-feed-sync.d.ts +41 -0
  225. package/dist/video/mixins/reel-feed-sync.js +430 -0
  226. package/dist/video/mixins/story-viewer-sync.d.ts +31 -0
  227. package/dist/video/mixins/story-viewer-sync.js +391 -0
  228. package/dist/video/reel-feed.d.ts +95 -0
  229. package/dist/video/reel-feed.js +124 -0
  230. package/dist/video/story-ring.d.ts +32 -0
  231. package/dist/video/story-ring.js +42 -0
  232. package/dist/video/story-viewer.d.ts +85 -0
  233. package/dist/video/story-viewer.js +250 -0
  234. package/package.json +21 -2
@@ -0,0 +1,222 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
+ import { fg } from "@sdxc/u/color";
3
+ import { rounded } from "@sdxc/u/effects";
4
+ import { mergeMix, raw } from "@sdxc/u/general";
5
+ import { gap, grid, hstack, inlineFlex, items, relative, vstack } from "@sdxc/u/layout";
6
+ import { media, motionReduce } from "@sdxc/u/responsive";
7
+ import { pb, pi } from "@sdxc/u/size";
8
+ import { when } from "@sdxc/u/state";
9
+ import { fontSize, tabularNums, weight } from "@sdxc/u/typography";
10
+ /**
11
+ * Width of the gutter every line keeps at its start, so a continuation line's text aligns
12
+ * with the first line's text whatever the avatar's size.
13
+ */
14
+ const GUTTER = "var(--ui-message-group-gutter, 2.5rem)";
15
+ /**
16
+ * Renders the run's host. Lines inside share one gutter width, so the text column stays
17
+ * straight from the first line to the last.
18
+ *
19
+ * @example
20
+ * <MessageGroup>
21
+ * <MessageGroup.Item id="m-1">
22
+ * <MessageGroup.Avatar><Avatar size="md">…</Avatar></MessageGroup.Avatar>
23
+ * <MessageGroup.Header><strong>Mira Okafor</strong><time dateTime="…">10:42</time></MessageGroup.Header>
24
+ * <MessageGroup.Content>Shipped the new onboarding.</MessageGroup.Content>
25
+ * </MessageGroup.Item>
26
+ * <MessageGroup.Item id="m-2">
27
+ * <MessageGroup.Time dateTime="…">10:43</MessageGroup.Time>
28
+ * <MessageGroup.Content>Notes are in the doc.</MessageGroup.Content>
29
+ * </MessageGroup.Item>
30
+ * </MessageGroup>
31
+ */
32
+ export function MessageGroup(handle) {
33
+ return () => {
34
+ let { children, mix, ...rest } = handle.props;
35
+ return (_jsx("div", { ...rest, "data-slot": "message-group", mix: mergeMix([vstack({ gap: 0, align: "stretch" }), pb("0.25rem")], mix), children: children }));
36
+ };
37
+ }
38
+ /**
39
+ * Renders one message as a two-column line: the gutter (the avatar on the first line, the
40
+ * hover time on later ones) and the content column under its header. The line tints on hover
41
+ * and keyboard focus, and the action bar shows then; `:target` lines tint the way `current` does.
42
+ */
43
+ MessageGroup.Item = function MessageGroupItem(handle) {
44
+ return () => {
45
+ let { children, mix, mentioned, current, ...rest } = handle.props;
46
+ return (_jsx("article", { ...rest, "data-slot": "message-group-item", "data-mentioned": mentioned ? "" : undefined, "data-current": current ? "" : undefined, mix: mergeMix([
47
+ relative(),
48
+ grid(),
49
+ raw({
50
+ gridTemplateColumns: `${GUTTER} minmax(0, 1fr)`,
51
+ gridTemplateAreas: `"gutter header" "gutter content"`,
52
+ columnGap: "var(--ui-message-group-gap, 0.75rem)",
53
+ rowGap: "0.125rem",
54
+ paddingBlock: "0.25rem",
55
+ paddingInline: "var(--ui-message-group-inline-padding, 1.25rem)",
56
+ scrollMarginBlock: "4rem",
57
+ transition: "background-color 120ms",
58
+ }),
59
+ when('& > [data-slot="message-group-avatar"]', raw({ gridArea: "gutter" })),
60
+ when('& > [data-slot="message-group-time"]', raw({ gridArea: "gutter" })),
61
+ when('& > [data-slot="message-group-header"]', raw({ gridArea: "header" })),
62
+ when('& > [data-slot="message-group-content"]', raw({ gridArea: "content" })),
63
+ when('&:not(:has(> [data-slot="message-group-header"])) > [data-slot="message-group-content"]', raw({ gridRow: "1 / span 2" })),
64
+ when('&:first-child:has(> [data-slot="message-group-avatar"])', raw({ paddingBlockStart: "0.5rem" })),
65
+ when("&:hover, &:focus-within", raw({ backgroundColor: "var(--ui-neutral-bg-tint-hover)" })),
66
+ when("&[data-mentioned]", raw({
67
+ backgroundColor: "var(--ui-warning-bg-tint)",
68
+ boxShadow: "inset 2px 0 0 var(--ui-warning-bg-solid)",
69
+ })),
70
+ when("&[data-current], &:target", raw({
71
+ backgroundColor: "var(--ui-brand-bg-tint)",
72
+ boxShadow: "inset 2px 0 0 var(--ui-brand-bg-solid)",
73
+ })),
74
+ motionReduce(raw({ transition: "none" })),
75
+ ], mix), children: children }));
76
+ };
77
+ };
78
+ /** Renders the first line's avatar at the top of the gutter. */
79
+ MessageGroup.Avatar = function MessageGroupAvatar(handle) {
80
+ return () => {
81
+ let { children, mix, ...rest } = handle.props;
82
+ return (_jsx("div", { ...rest, "data-slot": "message-group-avatar", mix: mergeMix([inlineFlex(), raw({ alignSelf: "start", paddingBlockStart: "0.125rem" })], mix), children: children }));
83
+ };
84
+ };
85
+ /** Renders the first line's name, time and any role chip on one baseline. */
86
+ MessageGroup.Header = function MessageGroupHeader(handle) {
87
+ return () => {
88
+ let { children, mix, ...rest } = handle.props;
89
+ return (_jsx("header", { ...rest, "data-slot": "message-group-header", mix: mergeMix([
90
+ hstack({ gap: 2, align: "baseline" }),
91
+ raw({ flexWrap: "wrap", minInlineSize: "0" }),
92
+ when("& > :first-child", [
93
+ fontSize("sm"),
94
+ weight("bold"),
95
+ fg("neutral.emphasis"),
96
+ raw({ textDecoration: "none" }),
97
+ ]),
98
+ when("& > time", [fontSize("xs"), fg("neutral.muted"), tabularNums()]),
99
+ ], mix), children: children }));
100
+ };
101
+ };
102
+ /**
103
+ * Renders a later line's time in the gutter, hidden until the line is hovered or focused, so
104
+ * a long run reads as one block while every time stays one glance away.
105
+ */
106
+ MessageGroup.Time = function MessageGroupTime(handle) {
107
+ return () => {
108
+ let { children, mix, ...rest } = handle.props;
109
+ return (_jsx("time", { ...rest, "data-slot": "message-group-time", mix: mergeMix([
110
+ fontSize("xs"),
111
+ fg("neutral.muted"),
112
+ tabularNums(),
113
+ raw({
114
+ alignSelf: "start",
115
+ justifySelf: "end",
116
+ lineHeight: "1.5rem",
117
+ fontSize: "0.6875rem",
118
+ whiteSpace: "nowrap",
119
+ opacity: "0",
120
+ }),
121
+ when("[data-slot='message-group-item']:is(:hover, :focus-within) > &", raw({ opacity: "1" })),
122
+ ], mix), children: children }));
123
+ };
124
+ };
125
+ /**
126
+ * Renders the message's body column: its text, files, reactions and thread summary stacked.
127
+ * Long words and links break at the column's edge rather than widening the log.
128
+ */
129
+ MessageGroup.Content = function MessageGroupContent(handle) {
130
+ return () => {
131
+ let { children, mix, ...rest } = handle.props;
132
+ return (_jsx("div", { ...rest, "data-slot": "message-group-content", mix: mergeMix([
133
+ vstack({ gap: "0.375rem", align: "stretch" }),
134
+ raw({
135
+ minInlineSize: "0",
136
+ fontSize: "0.9375rem",
137
+ lineHeight: "1.5rem",
138
+ overflowWrap: "anywhere",
139
+ color: "var(--ui-neutral-fg-emphasis)",
140
+ }),
141
+ ], mix), children: children }));
142
+ };
143
+ };
144
+ /** Renders the quiet mark after a message's text that says it was changed after sending. */
145
+ MessageGroup.Edited = function MessageGroupEdited(handle) {
146
+ return () => {
147
+ let { children, mix, ...rest } = handle.props;
148
+ return (_jsx("span", { ...rest, "data-slot": "message-group-edited", mix: mergeMix([fg("neutral.muted"), raw({ fontSize: "0.75rem", marginInlineStart: "0.25rem" })], mix), children: children }));
149
+ };
150
+ };
151
+ /**
152
+ * Renders the line's action bar, floated over its top-end corner and shown while the line is
153
+ * hovered or holds focus, so keyboard users reach every action by tabbing into the message.
154
+ * On a touch screen the bar shows its last control at all times, so a menu there stays a tap away.
155
+ */
156
+ MessageGroup.Actions = function MessageGroupActions(handle) {
157
+ return () => {
158
+ let { children, mix, ...rest } = handle.props;
159
+ return (_jsx("div", { ...rest, "data-slot": "message-group-actions", mix: mergeMix([
160
+ hstack({ gap: 0, align: "center" }),
161
+ rounded("md"),
162
+ raw({
163
+ position: "absolute",
164
+ insetBlockStart: "-0.875rem",
165
+ insetInlineEnd: "1rem",
166
+ padding: "0.125rem",
167
+ backgroundColor: "var(--ui-bg)",
168
+ border: "1px solid var(--ui-neutral-border)",
169
+ boxShadow: "0 2px 6px -2px oklch(0 0 0 / 0.16)",
170
+ opacity: "0",
171
+ pointerEvents: "none",
172
+ zIndex: "1",
173
+ transition: "opacity 100ms",
174
+ "& > form": { display: "contents" },
175
+ }),
176
+ when("[data-slot='message-group-item']:is(:hover, :focus-within) > &", raw({ opacity: "1", pointerEvents: "auto" })),
177
+ media("(hover: none)", raw({
178
+ opacity: "1",
179
+ pointerEvents: "auto",
180
+ insetBlockStart: "0.125rem",
181
+ insetInlineEnd: "0.5rem",
182
+ border: "none",
183
+ boxShadow: "none",
184
+ backgroundColor: "transparent",
185
+ "& > :not(:last-child)": { display: "none" },
186
+ })),
187
+ motionReduce(raw({ transition: "none" })),
188
+ ], mix), children: children }));
189
+ };
190
+ };
191
+ /**
192
+ * Renders the link under a message that opens its thread: the repliers' faces, the reply
193
+ * count in the accent colour and when the last reply came, boxed on hover.
194
+ */
195
+ MessageGroup.Thread = function MessageGroupThread(handle) {
196
+ return () => {
197
+ let { children, avatars, href, mix, ...rest } = handle.props;
198
+ return (_jsxs("a", { ...rest, href: href, "data-slot": "message-group-thread", mix: mergeMix([
199
+ hstack({ gap: 2, align: "center" }),
200
+ items("center"),
201
+ gap(2),
202
+ rounded("md"),
203
+ pi("0.375rem"),
204
+ pb("0.25rem"),
205
+ fontSize("xs"),
206
+ raw({
207
+ alignSelf: "start",
208
+ marginInlineStart: "-0.375rem",
209
+ maxInlineSize: "100%",
210
+ border: "1px solid transparent",
211
+ color: "var(--ui-neutral-fg-muted)",
212
+ textDecoration: "none",
213
+ "& strong": { color: "var(--ui-brand-fg)", fontWeight: "700" },
214
+ }),
215
+ when("&:hover", raw({
216
+ borderColor: "var(--ui-neutral-border)",
217
+ backgroundColor: "var(--ui-bg)",
218
+ })),
219
+ when("&:focus-visible", raw({ outline: "2px solid var(--ui-brand-ring)", outlineOffset: "1px" })),
220
+ ], mix), children: [avatars === undefined ? null : (_jsx("span", { mix: [inlineFlex(), raw({ "& > * + *": { marginInlineStart: "-0.25rem" } })], children: avatars })), _jsx("span", { mix: [raw({ minInlineSize: "0" })], children: children })] }));
221
+ };
222
+ };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Wires a composer's formatting row: a click on a `[data-format]` button, or that action's
3
+ * shortcut while the field has focus, rewrites the field's selection as Markdown. Why JS:
4
+ * editing the selection and the shortcuts need script. No-JS baseline: the row is hidden.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { MixinFactory } from "remix/component";
10
+ import type { FormatAction } from "../utils/markdown-format.js";
11
+ /** The attribute naming the action each button of the row applies. */
12
+ export declare const FORMAT_ACTION_ATTRIBUTE = "data-format";
13
+ /** The combo bound to each action that has one while the field has focus. */
14
+ export declare const FORMAT_SHORTCUTS: Partial<Record<FormatAction, string>>;
15
+ /** Options for {@link composerFormat}. */
16
+ export interface ComposerFormatOptions {
17
+ /** The actions the row offers, whose shortcuts it binds. */
18
+ actions: readonly FormatAction[];
19
+ /** The `id` of the `<textarea>` to edit; the host form's `Composer.Input` when omitted. */
20
+ target?: string;
21
+ }
22
+ /**
23
+ * Put on the element around a composer's formatting buttons. Each button keeps the field's
24
+ * focus and selection when pressed, and every edit lands on the browser's undo history.
25
+ *
26
+ * @example <span mix={[composerFormat({ actions: ["bold", "italic"] })]}><button data-format="bold">…</button></span>
27
+ */
28
+ export declare const composerFormat: MixinFactory<HTMLElement, [options: ComposerFormatOptions]>;
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Wires a composer's formatting row: a click on a `[data-format]` button, or that action's
3
+ * shortcut while the field has focus, rewrites the field's selection as Markdown. Why JS:
4
+ * editing the selection and the shortcuts need script. No-JS baseline: the row is hidden.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import { createMixin } from "remix/component";
10
+ import { matchesKeyCombo } from "../../utils/key-combo.js";
11
+ import { findComposerInput, rewriteText } from "../utils/composer-text.js";
12
+ import { applyFormat } from "../utils/markdown-format.js";
13
+ /** The attribute naming the action each button of the row applies. */
14
+ export const FORMAT_ACTION_ATTRIBUTE = "data-format";
15
+ /** The combo bound to each action that has one while the field has focus. */
16
+ export const FORMAT_SHORTCUTS = {
17
+ bold: "mod+b",
18
+ italic: "mod+i",
19
+ strike: "mod+shift+x",
20
+ code: "mod+e",
21
+ };
22
+ /**
23
+ * Put on the element around a composer's formatting buttons. Each button keeps the field's
24
+ * focus and selection when pressed, and every edit lands on the browser's undo history.
25
+ *
26
+ * @example <span mix={[composerFormat({ actions: ["bold", "italic"] })]}><button data-format="bold">…</button></span>
27
+ */
28
+ export const composerFormat = createMixin((handle) => {
29
+ let options;
30
+ let host;
31
+ /** The field the row edits, looked up on each use so a changed `target` is honored. */
32
+ function field() {
33
+ return host === undefined ? null : findComposerInput(host, options?.target);
34
+ }
35
+ /** Applies `action` to the field's selection. */
36
+ function format(action) {
37
+ let input = field();
38
+ if (input === null)
39
+ return;
40
+ let next = applyFormat(input.value, input.selectionStart, input.selectionEnd, action);
41
+ rewriteText(input, next.value, next.start, next.end);
42
+ }
43
+ /** The action of the button an event landed in, if any. */
44
+ function actionOf(event) {
45
+ if (!(event.target instanceof Element))
46
+ return undefined;
47
+ let button = event.target.closest(`[${FORMAT_ACTION_ATTRIBUTE}]`);
48
+ let action = button?.getAttribute(FORMAT_ACTION_ATTRIBUTE);
49
+ return options?.actions.find((candidate) => candidate === action);
50
+ }
51
+ handle.addEventListener("insert", ({ node }) => {
52
+ let signal = handle.signal;
53
+ host = node;
54
+ node.addEventListener("pointerdown", (event) => {
55
+ if (actionOf(event) !== undefined)
56
+ event.preventDefault();
57
+ }, { signal });
58
+ node.addEventListener("click", (event) => {
59
+ let action = actionOf(event);
60
+ if (action !== undefined)
61
+ format(action);
62
+ }, { signal });
63
+ node.ownerDocument.addEventListener("keydown", (event) => {
64
+ if (event.defaultPrevented || event.isComposing || event.target !== field())
65
+ return;
66
+ for (let action of options?.actions ?? []) {
67
+ let combo = FORMAT_SHORTCUTS[action];
68
+ if (combo === undefined || !matchesKeyCombo(event, combo))
69
+ continue;
70
+ event.preventDefault();
71
+ format(action);
72
+ return;
73
+ }
74
+ }, { signal });
75
+ });
76
+ return (next) => {
77
+ options = next;
78
+ return handle.element;
79
+ };
80
+ });
@@ -24,8 +24,8 @@ export interface ComposerSendOptions {
24
24
  }
25
25
  /**
26
26
  * Put on an element inside a composer's form, around its send and stop buttons. It finds the
27
- * form's `Composer.Input`, and a click on a `[data-slot="composer-stop"]` inside it stops the
28
- * replay.
27
+ * form's `Composer.Input`; a click on a `[data-slot="composer-stop"]` inside it stops the replay,
28
+ * and a key another listener already cancelled (Enter picking a mention) is left to that listener.
29
29
  *
30
30
  * @example <span mix={[composerSend({ stream: "reply-7", onStreamingChange: (on) => … })]}>…</span>
31
31
  */
@@ -36,8 +36,8 @@ function clearAfterSubmit(event, input, signal) {
36
36
  export const COMPOSER_STOP_SLOT = "composer-stop";
37
37
  /**
38
38
  * Put on an element inside a composer's form, around its send and stop buttons. It finds the
39
- * form's `Composer.Input`, and a click on a `[data-slot="composer-stop"]` inside it stops the
40
- * replay.
39
+ * form's `Composer.Input`; a click on a `[data-slot="composer-stop"]` inside it stops the replay,
40
+ * and a key another listener already cancelled (Enter picking a mention) is left to that listener.
41
41
  *
42
42
  * @example <span mix={[composerSend({ stream: "reply-7", onStreamingChange: (on) => … })]}>…</span>
43
43
  */
@@ -91,6 +91,8 @@ export const composerSend = createMixin((handle) => {
91
91
  let form = node.closest("form");
92
92
  let input = form?.querySelector(`[data-slot="${COMPOSER_INPUT_SLOT}"]`);
93
93
  input?.addEventListener("keydown", (event) => {
94
+ if (event.defaultPrevented)
95
+ return;
94
96
  if (event.key === "Escape" && streaming)
95
97
  return stop();
96
98
  if (event.key !== "Enter" || event.shiftKey || event.altKey || event.isComposing)
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Wires a mention list to a composer's field: it follows the caret into an `@handle` being
3
+ * typed, steers the list from the field's keys, writes the picked handle and mirrors the
4
+ * combobox state on the field. Why JS: caret tracking and the keys need script.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { MixinFactory } from "remix/component";
10
+ import type { MentionPerson } from "../utils/mention-query.js";
11
+ /** The attribute each option carries with its position in the list. */
12
+ export declare const MENTION_INDEX_ATTRIBUTE = "data-mention-index";
13
+ /** What the list shows: whether it is open, the query it filters by and the active row. */
14
+ export interface MentionMenuState {
15
+ open: boolean;
16
+ query: string;
17
+ active: number;
18
+ }
19
+ /** Options for {@link mentionMenu}. */
20
+ export interface MentionMenuOptions {
21
+ people: readonly MentionPerson[];
22
+ /** @default "@" */
23
+ trigger?: string;
24
+ /** The `id` of the `<textarea>` to watch; the host form's `Composer.Input` when omitted. */
25
+ target?: string;
26
+ limit: number;
27
+ /** The listbox's `id`, which the field's `aria-controls` names. */
28
+ listId: string;
29
+ /** Told every change, and resolves once the host has rendered it. */
30
+ onChange: (state: MentionMenuState) => Promise<unknown>;
31
+ }
32
+ /** The `id` of a person's option, which the field's `aria-activedescendant` names. */
33
+ export declare function mentionOptionId(listId: string, person: MentionPerson): string;
34
+ /**
35
+ * Put on a `popover="manual"` list inside a composer's form. While open, ArrowUp and ArrowDown
36
+ * move, Enter or Tab write the active person's handle, Escape closes, and those keys are
37
+ * cancelled during capture on the form so the composer's Enter-to-send leaves them alone.
38
+ *
39
+ * @example <div popover="manual" mix={[mentionMenu({ people, limit: 6, listId, onChange })]}>…</div>
40
+ */
41
+ export declare const mentionMenu: MixinFactory<HTMLElement, [options: MentionMenuOptions]>;
@@ -0,0 +1,213 @@
1
+ /**
2
+ * Wires a mention list to a composer's field: it follows the caret into an `@handle` being
3
+ * typed, steers the list from the field's keys, writes the picked handle and mirrors the
4
+ * combobox state on the field. Why JS: caret tracking and the keys need script.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import { createMixin } from "remix/component";
10
+ import { findComposerInput, replaceText } from "../utils/composer-text.js";
11
+ import { mentionMatches, mentionQuery } from "../utils/mention-query.js";
12
+ /** The gap between the composer's edge and the list, in pixels. */
13
+ const MENU_OFFSET = 8;
14
+ /** The widest the list grows, in pixels, however wide the composer is. */
15
+ const MENU_MAX_WIDTH = 320;
16
+ /** A character that continues a handle after the caret, replaced along with the query. */
17
+ const HANDLE_TAIL = /[\p{L}\p{N}_.-]/u;
18
+ /** The attribute each option carries with its position in the list. */
19
+ export const MENTION_INDEX_ATTRIBUTE = "data-mention-index";
20
+ /** The `id` of a person's option, which the field's `aria-activedescendant` names. */
21
+ export function mentionOptionId(listId, person) {
22
+ return `${listId}-${person.id}`;
23
+ }
24
+ /**
25
+ * Sets the open list over the composer's frame, aligned with its start edge, or under it when
26
+ * the space above cannot hold the list and the space below is larger. The list never grows
27
+ * past the side it opens on, so every option stays reachable on a short screen.
28
+ */
29
+ function place(menu, frame) {
30
+ let viewport = menu.ownerDocument.documentElement.clientHeight;
31
+ menu.style.left = `${Math.max(0, frame.left)}px`;
32
+ menu.style.width = `${Math.min(frame.width, MENU_MAX_WIDTH)}px`;
33
+ menu.style.maxHeight = "";
34
+ let height = menu.offsetHeight;
35
+ let above = frame.top - MENU_OFFSET * 2;
36
+ let below = viewport - frame.bottom - MENU_OFFSET * 2;
37
+ let under = height > above && below > above;
38
+ menu.style.maxHeight = `min(16rem, ${Math.max(0, under ? below : above)}px)`;
39
+ menu.style.top = under ? `${frame.bottom + MENU_OFFSET}px` : "auto";
40
+ menu.style.bottom = under ? "auto" : `${viewport - frame.top + MENU_OFFSET}px`;
41
+ }
42
+ /**
43
+ * Put on a `popover="manual"` list inside a composer's form. While open, ArrowUp and ArrowDown
44
+ * move, Enter or Tab write the active person's handle, Escape closes, and those keys are
45
+ * cancelled during capture on the form so the composer's Enter-to-send leaves them alone.
46
+ *
47
+ * @example <div popover="manual" mix={[mentionMenu({ people, limit: 6, listId, onChange })]}>…</div>
48
+ */
49
+ export const mentionMenu = createMixin((handle) => {
50
+ let options;
51
+ let menu;
52
+ let field = null;
53
+ let state = { open: false, query: "", active: 0 };
54
+ let start = -1;
55
+ /** The host's lifetime, taken while it is inserted, so later events can tell it was removed. */
56
+ let lifetime;
57
+ /** The start of a mention Escape dismissed, which stays closed until the caret leaves it. */
58
+ let dismissed = -1;
59
+ /** The people the current query lists. */
60
+ function matches() {
61
+ if (options === undefined)
62
+ return [];
63
+ return mentionMatches(options.people, state.query, options.limit);
64
+ }
65
+ /** Shows or hides the list, places it over the composer and mirrors the state on the field. */
66
+ function reflect() {
67
+ if (menu === undefined || field === null || options === undefined)
68
+ return;
69
+ if (!state.open) {
70
+ if (menu.matches(":popover-open"))
71
+ menu.hidePopover();
72
+ field.setAttribute("aria-expanded", "false");
73
+ field.removeAttribute("aria-controls");
74
+ field.removeAttribute("aria-activedescendant");
75
+ return;
76
+ }
77
+ if (!menu.matches(":popover-open"))
78
+ menu.showPopover();
79
+ place(menu, (field.closest("form") ?? field).getBoundingClientRect());
80
+ field.setAttribute("aria-expanded", "true");
81
+ field.setAttribute("aria-controls", options.listId);
82
+ let current = matches()[state.active];
83
+ if (current === undefined)
84
+ return field.removeAttribute("aria-activedescendant");
85
+ let id = mentionOptionId(options.listId, current);
86
+ field.setAttribute("aria-activedescendant", id);
87
+ menu.ownerDocument.getElementById(id)?.scrollIntoView({ block: "nearest" });
88
+ }
89
+ /** Hands the new state to the host, then reflects it once rendered. */
90
+ async function commit(next) {
91
+ state = next;
92
+ if (lifetime?.aborted !== false || options === undefined)
93
+ return;
94
+ await options.onChange(next);
95
+ reflect();
96
+ }
97
+ /** Closes the list without touching the text. */
98
+ function close() {
99
+ if (state.open)
100
+ void commit({ ...state, open: false });
101
+ }
102
+ /** Reads the mention the caret is in, opening, refiltering or closing the list to match. */
103
+ function sync() {
104
+ if (field === null)
105
+ return;
106
+ let caret = field.selectionStart;
107
+ let found = caret === field.selectionEnd
108
+ ? mentionQuery(field.value, caret, options?.trigger ?? "@")
109
+ : null;
110
+ if (found === null || found.start === dismissed) {
111
+ if (found === null)
112
+ dismissed = -1;
113
+ return close();
114
+ }
115
+ if (state.open && found.query === state.query && found.start === start)
116
+ return;
117
+ let active = found.query === state.query && found.start === start ? state.active : 0;
118
+ start = found.start;
119
+ void commit({ open: true, query: found.query, active });
120
+ }
121
+ /** Writes the person's handle over the mention being typed, followed by a space. */
122
+ function pick(person) {
123
+ if (field === null || !state.open)
124
+ return;
125
+ let end = field.selectionStart;
126
+ while (end < field.value.length && HANDLE_TAIL.test(field.value[end] ?? ""))
127
+ end += 1;
128
+ state = { ...state, open: false };
129
+ replaceText(field, start, end, `${options?.trigger ?? "@"}${person.handle} `);
130
+ void commit(state);
131
+ }
132
+ /** Moves the active option by `step`, wrapping at either end. */
133
+ function move(step) {
134
+ let count = matches().length;
135
+ if (count === 0)
136
+ return;
137
+ void commit({ ...state, active: (state.active + step + count) % count });
138
+ }
139
+ /** Steers the list from the field's keys, cancelling the ones it uses. */
140
+ function onKeydown(event) {
141
+ if (!state.open || event.target !== field || event.isComposing)
142
+ return;
143
+ if (event.altKey || event.ctrlKey || event.metaKey)
144
+ return;
145
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
146
+ event.preventDefault();
147
+ return move(event.key === "ArrowDown" ? 1 : -1);
148
+ }
149
+ if (event.key === "Escape") {
150
+ event.preventDefault();
151
+ dismissed = start;
152
+ return close();
153
+ }
154
+ if ((event.key !== "Enter" && event.key !== "Tab") || event.shiftKey)
155
+ return;
156
+ let person = matches()[state.active];
157
+ if (person === undefined)
158
+ return close();
159
+ event.preventDefault();
160
+ pick(person);
161
+ }
162
+ /** The position of the option an event landed in, or `-1` outside every option. */
163
+ function indexOf(event) {
164
+ if (!(event.target instanceof Element))
165
+ return -1;
166
+ let option = event.target.closest(`[${MENTION_INDEX_ATTRIBUTE}]`);
167
+ return option === null ? -1 : Number(option.getAttribute(MENTION_INDEX_ATTRIBUTE));
168
+ }
169
+ handle.addEventListener("insert", ({ node }) => {
170
+ let signal = handle.signal;
171
+ lifetime = signal;
172
+ menu = node;
173
+ field = findComposerInput(node, options?.target);
174
+ if (field === null)
175
+ return;
176
+ let input = field;
177
+ input.setAttribute("aria-autocomplete", "list");
178
+ input.setAttribute("aria-haspopup", "listbox");
179
+ input.setAttribute("aria-expanded", "false");
180
+ let form = input.closest("form") ?? input;
181
+ form.addEventListener("keydown", onKeydown, { capture: true, signal });
182
+ input.addEventListener("input", sync, { signal });
183
+ input.addEventListener("click", sync, { signal });
184
+ input.addEventListener("keyup", (event) => {
185
+ if (/^(Arrow(Left|Right)|Home|End)$/.test(event.key))
186
+ sync();
187
+ }, { signal });
188
+ input.addEventListener("blur", close, { signal });
189
+ node.addEventListener("pointerdown", (event) => {
190
+ if (indexOf(event) !== -1)
191
+ event.preventDefault();
192
+ }, { signal });
193
+ node.addEventListener("pointermove", (event) => {
194
+ let index = indexOf(event);
195
+ if (index !== -1 && index !== state.active)
196
+ void commit({ ...state, active: index });
197
+ }, { signal });
198
+ node.addEventListener("click", (event) => {
199
+ let person = matches()[indexOf(event)];
200
+ if (person !== undefined)
201
+ pick(person);
202
+ }, { signal });
203
+ signal.addEventListener("abort", () => {
204
+ for (let name of ["aria-autocomplete", "aria-haspopup", "aria-expanded"]) {
205
+ input.removeAttribute(name);
206
+ }
207
+ });
208
+ });
209
+ return (next) => {
210
+ options = next;
211
+ return handle.element;
212
+ };
213
+ });
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Makes every `ReactionBar` on the page answer at once: pressing a chip flips it and its count
3
+ * before the form posts in the background, a `ui:reaction-add` event adds or presses a chip,
4
+ * and a post the server refuses puts the row back. Without it each chip is a plain form.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { ElementProps, MixinFactory } from "remix/component";
10
+ /** DOM event type that asks a `ReactionBar` to add, or press, a reaction. */
11
+ export declare const REACTION_ADD_EVENT: "ui:reaction-add";
12
+ /** What a {@link ReactionAddEvent} asks for. */
13
+ export interface ReactionAddDetail {
14
+ /** The emoji as the chip's form submits it: a character, or a custom's `:shortcode:`. */
15
+ emoji: string;
16
+ /** What the emoji is called, for the chip's accessible name. */
17
+ label: string;
18
+ /** A custom emoji's image. */
19
+ image?: string;
20
+ /** Takes the reader's reaction off when they already reacted with this emoji. */
21
+ toggle?: boolean;
22
+ }
23
+ declare global {
24
+ interface HTMLElementEventMap {
25
+ [REACTION_ADD_EVENT]: ReactionAddEvent;
26
+ }
27
+ }
28
+ /**
29
+ * Dispatched on a `ReactionBar` (or any element inside the message holding one) to add the
30
+ * reader's reaction: an existing chip is pressed, a missing one is cloned from the row's
31
+ * `ReactionBar.Template`, and either posts through its form.
32
+ */
33
+ export declare class ReactionAddEvent extends Event {
34
+ readonly detail: ReactionAddDetail;
35
+ /** @param detail The reaction to add. */
36
+ constructor(detail: ReactionAddDetail);
37
+ }
38
+ /**
39
+ * Put on one element that stays on the page, such as an island's host: from then on every
40
+ * reaction chip under `document` flips at once and posts in the background, and
41
+ * `ui:reaction-add` events add reactions in place. Submits are claimed in the capture phase,
42
+ * before any navigation handler sees them.
43
+ *
44
+ * @returns A mixin with no visible effect on its host.
45
+ * @example <span hidden mix={[reactionSync()]} />
46
+ */
47
+ export declare const reactionSync: MixinFactory<HTMLElement, [], ElementProps>;