@opengeni/react-native 4.4.1 → 4.5.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.
@@ -2065,6 +2065,345 @@ export const iconNodes = {
2065
2065
  },
2066
2066
  ],
2067
2067
  ],
2068
+ monitor: [
2069
+ [
2070
+ "rect",
2071
+ {
2072
+ width: "20",
2073
+ height: "14",
2074
+ x: "2",
2075
+ y: "3",
2076
+ rx: "2",
2077
+ },
2078
+ ],
2079
+ [
2080
+ "line",
2081
+ {
2082
+ x1: "8",
2083
+ x2: "16",
2084
+ y1: "21",
2085
+ y2: "21",
2086
+ },
2087
+ ],
2088
+ [
2089
+ "line",
2090
+ {
2091
+ x1: "12",
2092
+ x2: "12",
2093
+ y1: "17",
2094
+ y2: "21",
2095
+ },
2096
+ ],
2097
+ ],
2098
+ "file-spreadsheet": [
2099
+ [
2100
+ "path",
2101
+ {
2102
+ d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
2103
+ },
2104
+ ],
2105
+ [
2106
+ "path",
2107
+ {
2108
+ d: "M14 2v5a1 1 0 0 0 1 1h5",
2109
+ },
2110
+ ],
2111
+ [
2112
+ "path",
2113
+ {
2114
+ d: "M8 13h2",
2115
+ },
2116
+ ],
2117
+ [
2118
+ "path",
2119
+ {
2120
+ d: "M14 13h2",
2121
+ },
2122
+ ],
2123
+ [
2124
+ "path",
2125
+ {
2126
+ d: "M8 17h2",
2127
+ },
2128
+ ],
2129
+ [
2130
+ "path",
2131
+ {
2132
+ d: "M14 17h2",
2133
+ },
2134
+ ],
2135
+ ],
2136
+ hourglass: [
2137
+ [
2138
+ "path",
2139
+ {
2140
+ d: "M5 22h14",
2141
+ },
2142
+ ],
2143
+ [
2144
+ "path",
2145
+ {
2146
+ d: "M5 2h14",
2147
+ },
2148
+ ],
2149
+ [
2150
+ "path",
2151
+ {
2152
+ d: "M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",
2153
+ },
2154
+ ],
2155
+ [
2156
+ "path",
2157
+ {
2158
+ d: "M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",
2159
+ },
2160
+ ],
2161
+ ],
2162
+ download: [
2163
+ [
2164
+ "path",
2165
+ {
2166
+ d: "M 12 15V3",
2167
+ },
2168
+ ],
2169
+ [
2170
+ "path",
2171
+ {
2172
+ d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",
2173
+ },
2174
+ ],
2175
+ [
2176
+ "path",
2177
+ {
2178
+ d: "m7 10 5 5 5-5",
2179
+ },
2180
+ ],
2181
+ ],
2182
+ clipboard: [
2183
+ [
2184
+ "rect",
2185
+ {
2186
+ width: "8",
2187
+ height: "4",
2188
+ x: "8",
2189
+ y: "2",
2190
+ rx: "1",
2191
+ ry: "1",
2192
+ },
2193
+ ],
2194
+ [
2195
+ "path",
2196
+ {
2197
+ d: "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",
2198
+ },
2199
+ ],
2200
+ ],
2201
+ video: [
2202
+ [
2203
+ "path",
2204
+ {
2205
+ d: "m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",
2206
+ },
2207
+ ],
2208
+ [
2209
+ "rect",
2210
+ {
2211
+ x: "2",
2212
+ y: "6",
2213
+ width: "14",
2214
+ height: "12",
2215
+ rx: "2",
2216
+ },
2217
+ ],
2218
+ ],
2219
+ "circle-dot": [
2220
+ [
2221
+ "circle",
2222
+ {
2223
+ cx: "12",
2224
+ cy: "12",
2225
+ r: "10",
2226
+ },
2227
+ ],
2228
+ [
2229
+ "circle",
2230
+ {
2231
+ cx: "12",
2232
+ cy: "12",
2233
+ r: "1",
2234
+ },
2235
+ ],
2236
+ ],
2237
+ file: [
2238
+ [
2239
+ "path",
2240
+ {
2241
+ d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
2242
+ },
2243
+ ],
2244
+ [
2245
+ "path",
2246
+ {
2247
+ d: "M14 2v5a1 1 0 0 0 1 1h5",
2248
+ },
2249
+ ],
2250
+ ],
2251
+ archive: [
2252
+ [
2253
+ "rect",
2254
+ {
2255
+ width: "20",
2256
+ height: "5",
2257
+ x: "2",
2258
+ y: "3",
2259
+ rx: "1",
2260
+ },
2261
+ ],
2262
+ [
2263
+ "path",
2264
+ {
2265
+ d: "M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",
2266
+ },
2267
+ ],
2268
+ [
2269
+ "path",
2270
+ {
2271
+ d: "M10 12h4",
2272
+ },
2273
+ ],
2274
+ ],
2275
+ "app-window": [
2276
+ [
2277
+ "rect",
2278
+ {
2279
+ x: "2",
2280
+ y: "4",
2281
+ width: "20",
2282
+ height: "16",
2283
+ rx: "2",
2284
+ },
2285
+ ],
2286
+ [
2287
+ "path",
2288
+ {
2289
+ d: "M10 4v4",
2290
+ },
2291
+ ],
2292
+ [
2293
+ "path",
2294
+ {
2295
+ d: "M2 8h20",
2296
+ },
2297
+ ],
2298
+ [
2299
+ "path",
2300
+ {
2301
+ d: "M6 4v4",
2302
+ },
2303
+ ],
2304
+ ],
2305
+ "book-open": [
2306
+ [
2307
+ "path",
2308
+ {
2309
+ d: "M 12 5v16",
2310
+ },
2311
+ ],
2312
+ [
2313
+ "path",
2314
+ {
2315
+ d: "M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",
2316
+ },
2317
+ ],
2318
+ ],
2319
+ hand: [
2320
+ [
2321
+ "path",
2322
+ {
2323
+ d: "M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",
2324
+ },
2325
+ ],
2326
+ [
2327
+ "path",
2328
+ {
2329
+ d: "M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",
2330
+ },
2331
+ ],
2332
+ [
2333
+ "path",
2334
+ {
2335
+ d: "M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",
2336
+ },
2337
+ ],
2338
+ [
2339
+ "path",
2340
+ {
2341
+ d: "M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",
2342
+ },
2343
+ ],
2344
+ ],
2345
+ activity: [
2346
+ [
2347
+ "path",
2348
+ {
2349
+ d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",
2350
+ },
2351
+ ],
2352
+ ],
2353
+ "log-in": [
2354
+ [
2355
+ "path",
2356
+ {
2357
+ d: "m10 17 5-5-5-5",
2358
+ },
2359
+ ],
2360
+ [
2361
+ "path",
2362
+ {
2363
+ d: "M15 12H3",
2364
+ },
2365
+ ],
2366
+ [
2367
+ "path",
2368
+ {
2369
+ d: "M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",
2370
+ },
2371
+ ],
2372
+ ],
2373
+ code: [
2374
+ [
2375
+ "path",
2376
+ {
2377
+ d: "m16 18 6-6-6-6",
2378
+ },
2379
+ ],
2380
+ [
2381
+ "path",
2382
+ {
2383
+ d: "m8 6-6 6 6 6",
2384
+ },
2385
+ ],
2386
+ ],
2387
+ receipt: [
2388
+ [
2389
+ "path",
2390
+ {
2391
+ d: "M 12 17V7",
2392
+ },
2393
+ ],
2394
+ [
2395
+ "path",
2396
+ {
2397
+ d: "M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8",
2398
+ },
2399
+ ],
2400
+ [
2401
+ "path",
2402
+ {
2403
+ d: "M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z",
2404
+ },
2405
+ ],
2406
+ ],
2068
2407
  eye: [
2069
2408
  [
2070
2409
  "path",
@@ -33,3 +33,16 @@ export function isStandaloneLinkGroup(
33
33
  const content = (group.children ?? []).filter((child) => !isBlankNode(child));
34
34
  return content.length === 1 && content[0]!.type === "link";
35
35
  }
36
+
37
+ /**
38
+ * The text group a list item holds when that group is its only content,
39
+ * looking through a lone paragraph (loose lists keep one). A list item whose
40
+ * only content is a host-drawn block link is drawn without its marker.
41
+ */
42
+ export function soleTextGroupOf(item: MarkdownAstNode): MarkdownAstNode | undefined {
43
+ let blocks = (item.children ?? []).filter((child) => !isBlankNode(child));
44
+ if (blocks.length === 1 && blocks[0]!.type === "paragraph") {
45
+ blocks = (blocks[0]!.children ?? []).filter((child) => !isBlankNode(child));
46
+ }
47
+ return blocks.length === 1 && blocks[0]!.type === "textgroup" ? blocks[0] : undefined;
48
+ }
@@ -22,7 +22,7 @@ import {
22
22
  type InteractivePreviewKind,
23
23
  } from "@opengeni/react/native-previews";
24
24
  import { Icon } from "./icon";
25
- import { isStandaloneLinkGroup } from "./markdown-standalone-links";
25
+ import { isStandaloneLinkGroup, soleTextGroupOf } from "./markdown-standalone-links";
26
26
  import { withAlpha as withAlphaColor } from "./primitives";
27
27
  import type { NativeMarkdownRenderer } from "./message-timeline";
28
28
  import {
@@ -474,10 +474,14 @@ function webRules(
474
474
  // Every run of text is selectable, as on the web: a long press selects
475
475
  // words (and, inside a timeline message, offers Add note). A standalone
476
476
  // link the host drew as a block sits in a view instead, since a block
477
- // nested in text does not lay out.
477
+ // nested in text does not lay out. The view spans the message: a paragraph
478
+ // lays its children out in a wrapping row, where a plain view would size
479
+ // to its content.
478
480
  textgroup: (node, children, _parent, styles) =>
479
481
  BLOCK_LINK_GROUPS.has(node) ? (
480
- <View key={node.key}>{children}</View>
482
+ <View key={node.key} style={{ width: "100%" }}>
483
+ {children}
484
+ </View>
481
485
  ) : (
482
486
  <Text key={node.key} selectable style={styles.textgroup}>
483
487
  {children}
@@ -505,6 +509,16 @@ function webRules(
505
509
  },
506
510
  // Web lists use a disc marker in fg-subtle; the library's iOS default is a middle dot.
507
511
  list_item: (node, children, parent, styles, inheritedStyles = {}) => {
512
+ // A host-drawn block link is its own marker: the item drops the bullet or
513
+ // number and its indent, so it lines up with the same card on its own line.
514
+ const group = soleTextGroupOf(node);
515
+ if (group && BLOCK_LINK_GROUPS.has(group)) {
516
+ return (
517
+ <View key={node.key} style={{ marginBottom: 4 }}>
518
+ {children}
519
+ </View>
520
+ );
521
+ }
508
522
  if (parent.some((entry: { type: string }) => entry.type === "bullet_list")) {
509
523
  // A drawn disc: the text bullet glyph renders noticeably smaller than
510
524
  // the browser's list-disc marker at the same line height.
@@ -130,11 +130,20 @@ export interface SessionRowProps {
130
130
  * When set, a long press offers Pin or Unpin, and so does an accessibility action.
131
131
  */
132
132
  onTogglePin?: (() => void) | undefined;
133
+ /** The workspace the chat lives in, when it is not the one on screen (search results). */
134
+ workspaceName?: string | undefined;
133
135
  now?: Date | undefined;
134
136
  }
135
137
 
136
138
  /** One recent-session row, as the web home canvas renders it. */
137
- export function SessionRow({ session, models, onPress, onTogglePin, now }: SessionRowProps) {
139
+ export function SessionRow({
140
+ session,
141
+ models,
142
+ onPress,
143
+ onTogglePin,
144
+ workspaceName,
145
+ now,
146
+ }: SessionRowProps) {
138
147
  const theme = useNativeTimelineTheme();
139
148
  const m = useNativeTimelineMessages();
140
149
  const c = theme.colors;
@@ -145,6 +154,12 @@ export function SessionRow({ session, models, onPress, onTogglePin, now }: Sessi
145
154
  const model = recentSessionModelPresentation(session.model, rows);
146
155
  const repo = sessionRepoLabel(session);
147
156
  const meta = [model.label, repo].filter(Boolean).join(" · ");
157
+ const metaStyle = {
158
+ ...fontStyle(theme, 400),
159
+ fontSize: 11,
160
+ lineHeight: 16,
161
+ color: c["fg-subtle"],
162
+ };
148
163
  const pinned = Boolean(session.pinned);
149
164
  const pinLabel = pinned ? m.unpin : m.pin;
150
165
  const offerPin = () => {
@@ -170,7 +185,9 @@ export function SessionRow({ session, models, onPress, onTogglePin, now }: Sessi
170
185
  return (
171
186
  <Pressable
172
187
  accessibilityRole="button"
173
- accessibilityLabel={pinned ? `${title}, ${m.pinned}` : title}
188
+ accessibilityLabel={[title, pinned ? m.pinned : null, workspaceName ?? null]
189
+ .filter(Boolean)
190
+ .join(", ")}
174
191
  accessibilityActions={onTogglePin ? [{ name: "pin", label: pinLabel }] : undefined}
175
192
  onAccessibilityAction={(event) => {
176
193
  if (event.nativeEvent.actionName === "pin") onTogglePin?.();
@@ -195,21 +212,28 @@ export function SessionRow({ session, models, onPress, onTogglePin, now }: Sessi
195
212
  >
196
213
  {title}
197
214
  </Text>
198
- {meta ? (
215
+ {meta || workspaceName ? (
199
216
  <View style={{ flexDirection: "row", alignItems: "center", gap: 6, marginTop: 2 }}>
200
- <ModelMark model={session.model} size={12} color={c["fg-muted"]} />
201
- <Text
202
- numberOfLines={1}
203
- style={{
204
- ...fontStyle(theme, 400),
205
- fontSize: 11,
206
- lineHeight: 16,
207
- color: c["fg-subtle"],
208
- flexShrink: 1,
209
- }}
210
- >
211
- {meta}
212
- </Text>
217
+ {workspaceName ? (
218
+ <>
219
+ <Icon name="folder" size={11} color={c["fg-muted"]} />
220
+ <Text
221
+ numberOfLines={1}
222
+ style={{ ...metaStyle, color: c["fg-muted"], flexShrink: 2 }}
223
+ >
224
+ {workspaceName}
225
+ </Text>
226
+ {meta ? <Text style={metaStyle}>·</Text> : null}
227
+ </>
228
+ ) : null}
229
+ {meta ? (
230
+ <>
231
+ <ModelMark model={session.model} size={12} color={c["fg-muted"]} />
232
+ <Text numberOfLines={1} style={{ ...metaStyle, flexShrink: 1 }}>
233
+ {meta}
234
+ </Text>
235
+ </>
236
+ ) : null}
213
237
  </View>
214
238
  ) : null}
215
239
  </View>
@@ -260,6 +284,8 @@ export function SessionRowList(props: {
260
284
  onOpen: (sessionId: string) => void;
261
285
  /** Pin or unpin a chat from its row (long press); omitted, rows offer no pin. */
262
286
  onTogglePin?: ((session: Session) => void) | undefined;
287
+ /** Labels rows from another workspace with that workspace's name. */
288
+ workspaceNameOf?: ((session: Session) => string | undefined) | undefined;
263
289
  }) {
264
290
  const theme = useNativeTimelineTheme();
265
291
  return (
@@ -282,6 +308,7 @@ export function SessionRowList(props: {
282
308
  models={props.models}
283
309
  onPress={() => props.onOpen(session.id)}
284
310
  onTogglePin={props.onTogglePin ? () => props.onTogglePin?.(session) : undefined}
311
+ workspaceName={props.workspaceNameOf?.(session)}
285
312
  />
286
313
  </View>
287
314
  ))}