@agimon-ai/po-native 0.0.1-alpha.45 → 0.0.1-alpha.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/po-native",
3
- "version": "0.0.1-alpha.45",
3
+ "version": "0.0.1-alpha.46",
4
4
  "description": "Po for iOS and Android",
5
5
  "homepage": "https://agimon.ai",
6
6
  "bugs": {
@@ -29,17 +29,17 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@agimon-ai/po-core": "0.0.0-alpha.165",
33
- "@agimon-ai/po-expo-signing": "0.0.1-alpha.45",
34
- "@agimon-ai/po-identity": "0.0.2-alpha.112",
35
- "@agimon-ai/po-native-components": "0.0.0-alpha.165",
36
- "@agimon-ai/po-native-dashboard": "0.0.0-alpha.37",
37
- "@agimon-ai/po-template-advanced": "0.0.0-alpha.165",
38
- "@agimon-ai/po-template-elegant": "0.0.0-alpha.165",
39
- "@agimon-ai/po-voice": "0.0.0-alpha.165",
40
- "@agimon-ai/po-web-components": "0.0.0-alpha.165",
41
- "@agimon-ai/po-web-dashboard": "0.0.0-alpha.165",
42
- "@agimon-ai/po-web-security": "0.0.0-alpha.165",
32
+ "@agimon-ai/po-core": "0.0.0-alpha.166",
33
+ "@agimon-ai/po-expo-signing": "0.0.1-alpha.46",
34
+ "@agimon-ai/po-identity": "0.0.2-alpha.113",
35
+ "@agimon-ai/po-native-components": "0.0.0-alpha.166",
36
+ "@agimon-ai/po-native-dashboard": "0.0.0-alpha.38",
37
+ "@agimon-ai/po-template-advanced": "0.0.0-alpha.166",
38
+ "@agimon-ai/po-template-elegant": "0.0.0-alpha.166",
39
+ "@agimon-ai/po-voice": "0.0.0-alpha.166",
40
+ "@agimon-ai/po-web-components": "0.0.0-alpha.166",
41
+ "@agimon-ai/po-web-dashboard": "0.0.0-alpha.166",
42
+ "@agimon-ai/po-web-security": "0.0.0-alpha.166",
43
43
  "@better-auth/expo": "1.7.12",
44
44
  "@config-plugins/react-native-webrtc": "15.0.2",
45
45
  "@earendil-works/chord": "1.5.1",
@@ -0,0 +1,386 @@
1
+ /*
2
+ * Design target for authoring on the phone, matching the cockpit's "Authoring design": the canvas takes
3
+ * the whole screen instead of sharing it with the composer. "Ask Po" in the canvas tool bar opens the
4
+ * conversation as a sheet at a medium detent, so the canvas stays in view above it. The footer keeps a
5
+ * one-line field for commenting on the file without marking it; Review & send joins it once there are marks.
6
+ * Mockup only: nothing here is wired, and runtime code never imports it.
7
+ */
8
+ import {
9
+ AnnotationSurface,
10
+ BoxIcon,
11
+ Button,
12
+ ChevronRightIcon,
13
+ CloseIcon,
14
+ EditIcon,
15
+ fontOf,
16
+ HandIcon,
17
+ type IconProps,
18
+ ImageIcon,
19
+ KebabIcon,
20
+ MessageIcon,
21
+ PinIcon,
22
+ RedoIcon,
23
+ UndoIcon,
24
+ } from '@agimon-ai/po-native-components';
25
+ import { Composer, type TimelineEntry, TimelineItem } from '@agimon-ai/po-native-dashboard';
26
+ import type { ComponentType } from 'react';
27
+ import { Pressable, ScrollView, Text, View } from 'react-native';
28
+ import { StyleSheet } from 'react-native-unistyles';
29
+
30
+ import { type DesignScheme, PhoneFrame } from './designFrame';
31
+
32
+ const FILE = 'landing-hero.png';
33
+
34
+ const MARKS = [
35
+ { id: 'm1', x: 0.5, y: 0.2, label: '1', description: 'Shorten the headline to one line.' },
36
+ { id: 'm2', x: 0.2, y: 0.46, label: '2', description: 'Make the button say "Start free".' },
37
+ ];
38
+
39
+ const USER: TimelineEntry = { id: 'u1', role: 'user', text: 'Tighten the hero. Marks 1 and 2 have the detail.' };
40
+
41
+ /** A settled run: the tool call folds into the settled line, so the reply fits above the composer. */
42
+ const DONE: readonly TimelineEntry[] = [
43
+ USER,
44
+ {
45
+ id: 'a1',
46
+ role: 'assistant',
47
+ text: 'Done. The headline is one line and the button says "Start free". The original is unchanged.',
48
+ author: { name: 'Ponytail', initials: 'PO' },
49
+ },
50
+ { id: 's1', role: 'settled', text: '', tools: 1 },
51
+ ];
52
+
53
+ const RUNNING: readonly TimelineEntry[] = [
54
+ USER,
55
+ { id: 't1', role: 'tools', text: '', calls: [{ id: 'c1', role: 'tool', text: '', toolName: 'edit' }] },
56
+ ];
57
+
58
+ /** The authoring header as po-author draws it on the phone: back, the file, and what is marked. */
59
+ function Header({ marked }: { marked: boolean }) {
60
+ return (
61
+ <View style={styles.header}>
62
+ <View style={styles.back}>
63
+ <View style={styles.flip}>
64
+ <ChevronRightIcon size={20} color="hi" accessibilityLabel="Back" />
65
+ </View>
66
+ </View>
67
+ <View style={styles.headerText}>
68
+ <Text style={styles.title} numberOfLines={1}>
69
+ {FILE}
70
+ </Text>
71
+ <Text style={styles.subtitle} numberOfLines={1}>
72
+ {marked ? 'Image · 2 marks, not sent' : 'Image · no marks'}
73
+ </Text>
74
+ </View>
75
+ </View>
76
+ );
77
+ }
78
+
79
+ /** A stand-in page for the image, drawn in theme colours, with the person's marks on it. */
80
+ function Canvas({ marked }: { marked: boolean }) {
81
+ return (
82
+ <View style={styles.canvas}>
83
+ <AnnotationSurface accessibilityLabel={FILE} marks={marked ? MARKS : []} style={styles.surface}>
84
+ <View style={styles.page}>
85
+ <View style={styles.pageTop}>
86
+ <View style={styles.logo} />
87
+ <View style={styles.nav} />
88
+ </View>
89
+ <View style={styles.headline} />
90
+ <View style={[styles.headline, styles.headlineShort]} />
91
+ <View style={styles.copy} />
92
+ <View style={[styles.copy, styles.copyShort]} />
93
+ <View style={styles.cta} />
94
+ <View style={styles.hero}>
95
+ <View style={styles.heroMark} />
96
+ </View>
97
+ </View>
98
+ </AnnotationSurface>
99
+ </View>
100
+ );
101
+ }
102
+
103
+ function Slot({
104
+ label,
105
+ Icon,
106
+ selected = false,
107
+ dim = false,
108
+ }: {
109
+ label: string;
110
+ Icon: ComponentType<IconProps>;
111
+ selected?: boolean;
112
+ dim?: boolean;
113
+ }) {
114
+ return (
115
+ <Button
116
+ size="card"
117
+ variant="ghost"
118
+ style={[styles.tool, selected && styles.selected]}
119
+ accessibilityLabel={label === 'Ask Po' ? 'Open the conversation' : `${label} tool`}
120
+ accessibilityState={{ selected, disabled: dim }}
121
+ disabled={dim}
122
+ >
123
+ <Icon size={22} color={selected ? 'green' : undefined} />
124
+ <Text style={[styles.toolLabel, selected && styles.toolLabelSelected]} numberOfLines={1}>
125
+ {label}
126
+ </Text>
127
+ </Button>
128
+ );
129
+ }
130
+
131
+ /** po-author's canvas bar, with "Ask Po" after a divider at the thumb's end. */
132
+ function Toolkit() {
133
+ return (
134
+ <View style={styles.bar}>
135
+ <Slot label="Move" Icon={HandIcon} selected />
136
+ <Slot label="Pin" Icon={PinIcon} />
137
+ <Slot label="Box" Icon={BoxIcon} />
138
+ <Slot label="Draw" Icon={EditIcon} />
139
+ <View style={styles.divider} />
140
+ <Slot label="Undo" Icon={UndoIcon} dim />
141
+ <Slot label="Redo" Icon={RedoIcon} dim />
142
+ <Slot label="More" Icon={KebabIcon} />
143
+ <View style={styles.divider} />
144
+ <Slot label="Ask Po" Icon={MessageIcon} />
145
+ </View>
146
+ );
147
+ }
148
+
149
+ /**
150
+ * Comment without marking: the field opens the conversation with the keyboard up and the file attached.
151
+ * Review & send appears only once there are marks to explain.
152
+ */
153
+ function Footer({ marked }: { marked: boolean }) {
154
+ return (
155
+ <View style={styles.footer}>
156
+ <Pressable
157
+ accessibilityRole="button"
158
+ accessibilityLabel={`Ask Po about ${FILE}`}
159
+ accessibilityHint="Opens the conversation with this file attached"
160
+ style={styles.field}
161
+ >
162
+ <Text style={styles.placeholder} numberOfLines={1}>
163
+ Ask Po about this image
164
+ </Text>
165
+ </Pressable>
166
+ {marked ? (
167
+ <Button variant="primary" size="md">
168
+ Review & send
169
+ </Button>
170
+ ) : null}
171
+ </View>
172
+ );
173
+ }
174
+
175
+ /** The conversation at a medium detent; the canvas above stays undimmed and live. */
176
+ function ConversationSheet({ running }: { running: boolean }) {
177
+ return (
178
+ <View style={styles.sheet}>
179
+ <View style={styles.grabber} />
180
+ <View style={styles.sheetHead}>
181
+ <Text style={styles.sheetTitle}>Conversation</Text>
182
+ <Button variant="ghost" size="icon-md" accessibilityLabel="Close the conversation">
183
+ <CloseIcon size={16} color="dim" />
184
+ </Button>
185
+ </View>
186
+ <ScrollView style={styles.flex} contentContainerStyle={styles.transcript}>
187
+ {(running ? RUNNING : DONE).map((entry) => (
188
+ <TimelineItem key={entry.id} entry={entry} />
189
+ ))}
190
+ </ScrollView>
191
+ <View style={styles.dock}>
192
+ {/* Says what the message carries, since the composer no longer sits on the file it is about. */}
193
+ <View style={styles.about}>
194
+ <ImageIcon size={14} color="dim" />
195
+ <Text style={styles.aboutText} numberOfLines={1}>
196
+ About {FILE}
197
+ </Text>
198
+ </View>
199
+ <Composer
200
+ quiet
201
+ onSend={() => undefined}
202
+ initialText={running ? 'Also try a darker button' : ''}
203
+ running={running}
204
+ onAbort={() => undefined}
205
+ />
206
+ </View>
207
+ </View>
208
+ );
209
+ }
210
+
211
+ function Authoring({
212
+ scheme,
213
+ marked = true,
214
+ sheet = false,
215
+ running = false,
216
+ }: {
217
+ scheme?: DesignScheme;
218
+ marked?: boolean;
219
+ sheet?: boolean;
220
+ running?: boolean;
221
+ }) {
222
+ return (
223
+ <PhoneFrame scheme={scheme}>
224
+ <View style={styles.screen}>
225
+ <Header marked={marked} />
226
+ <Canvas marked={marked} />
227
+ <View style={styles.tools}>
228
+ <Toolkit />
229
+ <Footer marked={marked} />
230
+ </View>
231
+ {sheet ? <ConversationSheet running={running} /> : null}
232
+ </View>
233
+ </PhoneFrame>
234
+ );
235
+ }
236
+
237
+ export const meta = {
238
+ title: 'Native/Design/Authoring',
239
+ component: Authoring,
240
+ tags: ['style-system', 'mockup', 'native'],
241
+ };
242
+
243
+ export default meta;
244
+ /** Two marks: the comment field and Review & send share the footer. */
245
+ export const Playground = { render: () => <Authoring scheme="dark" /> };
246
+ export const Light = { render: () => <Authoring scheme="light" /> };
247
+ /** No marks: the comment field alone, for asking Po to fix the file directly. */
248
+ export const NoMarks = { render: () => <Authoring marked={false} scheme="dark" /> };
249
+ export const NoMarksLight = { render: () => <Authoring marked={false} scheme="light" /> };
250
+ /** Opened from either entry: the conversation below, the marked canvas still in view. */
251
+ export const Sheet = { render: () => <Authoring sheet scheme="dark" /> };
252
+ export const SheetLight = { render: () => <Authoring sheet scheme="light" /> };
253
+ /** Po editing while the sheet is up; the composer steers or stops. */
254
+ export const SheetRunning = { render: () => <Authoring sheet running scheme="dark" /> };
255
+
256
+ const styles = StyleSheet.create((theme) => {
257
+ const sans = fontOf(theme.fontFamily.sans);
258
+ const text = (size: 'xs' | 'sm' | 'base' | 'lg', color: string) => ({
259
+ fontFamily: sans,
260
+ fontSize: theme.fontSize[size],
261
+ lineHeight: theme.lineHeight[size],
262
+ color,
263
+ });
264
+ return {
265
+ flex: { flex: 1 },
266
+ screen: { flex: 1, backgroundColor: theme.colors.bg },
267
+ header: {
268
+ flexDirection: 'row',
269
+ alignItems: 'center',
270
+ gap: theme.spacing(2),
271
+ paddingHorizontal: theme.spacing(3),
272
+ paddingTop: theme.spacing(3),
273
+ paddingBottom: theme.spacing(2),
274
+ borderBottomWidth: StyleSheet.hairlineWidth,
275
+ borderBottomColor: theme.colors['border-soft'],
276
+ },
277
+ back: { width: 44, height: 44, alignItems: 'center', justifyContent: 'center' },
278
+ flip: { transform: [{ rotate: '180deg' }] },
279
+ headerText: { flex: 1, gap: 2 },
280
+ title: { ...text('base', theme.colors.hi), fontWeight: theme.fontWeight.semibold },
281
+ subtitle: text('sm', theme.colors.dim),
282
+ canvas: {
283
+ flex: 1,
284
+ margin: theme.spacing(2),
285
+ borderRadius: theme.borderRadius.lg,
286
+ backgroundColor: theme.colors.deep,
287
+ alignItems: 'center',
288
+ justifyContent: 'center',
289
+ overflow: 'hidden',
290
+ },
291
+ surface: { alignSelf: 'stretch' },
292
+ page: {
293
+ gap: theme.spacing(3),
294
+ padding: theme.spacing(5),
295
+ backgroundColor: theme.colors.panel,
296
+ },
297
+ pageTop: { flexDirection: 'row', justifyContent: 'space-between', marginBottom: theme.spacing(4) },
298
+ logo: { width: 72, height: 12, borderRadius: 3, backgroundColor: theme.colors.green },
299
+ nav: { width: 88, height: 8, borderRadius: 3, backgroundColor: theme.colors.border },
300
+ headline: { width: '92%', height: 24, borderRadius: 3, backgroundColor: theme.colors.hi },
301
+ headlineShort: { width: '64%' },
302
+ copy: { width: '96%', height: 8, borderRadius: 3, backgroundColor: theme.colors.dim },
303
+ copyShort: { width: '78%' },
304
+ cta: { width: 112, height: 32, borderRadius: 16, marginTop: theme.spacing(2), backgroundColor: theme.colors.green },
305
+ hero: {
306
+ height: 150,
307
+ marginTop: theme.spacing(4),
308
+ borderRadius: theme.borderRadius.lg,
309
+ alignItems: 'center',
310
+ justifyContent: 'center',
311
+ backgroundColor: theme.colors['tint-green'],
312
+ },
313
+ heroMark: { width: 72, height: 72, borderRadius: 36, backgroundColor: theme.colors['edge-green'] },
314
+ tools: { gap: theme.spacing(2), paddingHorizontal: theme.spacing(2), paddingBottom: theme.spacing(6) },
315
+ bar: {
316
+ flexDirection: 'row',
317
+ alignItems: 'center',
318
+ padding: theme.spacing(1),
319
+ borderWidth: 1,
320
+ borderColor: theme.colors.border,
321
+ borderRadius: theme.borderRadius.lg,
322
+ backgroundColor: theme.colors.panel,
323
+ },
324
+ tool: {
325
+ flex: 1,
326
+ minWidth: 44,
327
+ alignItems: 'center',
328
+ justifyContent: 'center',
329
+ paddingHorizontal: 0,
330
+ paddingVertical: theme.spacing(1.5),
331
+ },
332
+ selected: { backgroundColor: theme.colors['tint-green'] },
333
+ toolLabel: text('xs', theme.colors.dim),
334
+ toolLabelSelected: { color: theme.colors.green, fontWeight: theme.fontWeight.semibold },
335
+ divider: { width: 1, alignSelf: 'stretch', marginVertical: theme.spacing(2), backgroundColor: theme.colors.border },
336
+ footer: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(2) },
337
+ // Outlined like the composer it opens, so it reads as a place to type rather than a button.
338
+ field: {
339
+ flex: 1,
340
+ height: 44,
341
+ justifyContent: 'center',
342
+ paddingHorizontal: theme.spacing(4),
343
+ borderRadius: 22,
344
+ borderWidth: 1,
345
+ borderColor: theme.colors.border,
346
+ },
347
+ placeholder: text('base', theme.colors.dim),
348
+ sheet: {
349
+ position: 'absolute',
350
+ left: 0,
351
+ right: 0,
352
+ bottom: 0,
353
+ height: '58%',
354
+ borderTopLeftRadius: 28,
355
+ borderTopRightRadius: 28,
356
+ borderTopWidth: 1,
357
+ borderLeftWidth: 1,
358
+ borderRightWidth: 1,
359
+ borderColor: theme.colors['border-soft'],
360
+ // The page surface, not the rail: this is the conversation itself, and its bubbles are drawn on rail.
361
+ backgroundColor: theme.colors.bg,
362
+ overflow: 'hidden',
363
+ },
364
+ grabber: {
365
+ alignSelf: 'center',
366
+ width: 36,
367
+ height: 5,
368
+ borderRadius: 3,
369
+ marginTop: theme.spacing(2),
370
+ backgroundColor: theme.colors.border,
371
+ },
372
+ sheetHead: {
373
+ flexDirection: 'row',
374
+ alignItems: 'center',
375
+ paddingLeft: theme.spacing(5),
376
+ paddingRight: theme.spacing(2),
377
+ borderBottomWidth: StyleSheet.hairlineWidth,
378
+ borderBottomColor: theme.colors['border-soft'],
379
+ },
380
+ sheetTitle: { ...text('lg', theme.colors.hi), fontWeight: theme.fontWeight.semibold, flex: 1 },
381
+ transcript: { gap: theme.spacing(3), padding: theme.spacing(4) },
382
+ dock: { gap: theme.spacing(1.5), paddingHorizontal: theme.spacing(3), paddingBottom: theme.spacing(8) },
383
+ about: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(1.5), paddingHorizontal: theme.spacing(2) },
384
+ aboutText: { ...text('sm', theme.colors.dim), flex: 1 },
385
+ };
386
+ });