@agimon-ai/po-native 0.0.1-alpha.76 → 0.0.1-alpha.77

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.
@@ -11,6 +11,7 @@ import {
11
11
  plannedSettingsWrites,
12
12
  settingsKeyOf,
13
13
  settingsLockedReason,
14
+ splitHostId,
14
15
  subscribeWebPluginRegistry,
15
16
  webPluginRegistryForHost,
16
17
  type InstalledSettingsSection,
@@ -45,6 +46,23 @@ import { Group, Row, SectionPage, sentenceCase } from './SettingsScreen';
45
46
  * cleared field removes the key, and one Save writes every edit atomically against the read hash.
46
47
  */
47
48
 
49
+ /** The same owner/id catalog identity as the web host, using only the native locale runtime. */
50
+ export function settingsContributionCopy(
51
+ contribution: {
52
+ pluginId: string;
53
+ id: string;
54
+ label: string;
55
+ detail: string;
56
+ translateCopy?: SettingsSectionContribution['translateCopy'];
57
+ },
58
+ surface: 'settingsSections' | 'settingsPanels',
59
+ ): { label: string; detail: string } {
60
+ if (contribution.translateCopy) return contribution.translateCopy(t);
61
+ const owner = splitHostId(contribution.pluginId)?.localId ?? contribution.pluginId;
62
+ const prefix = `plugin.${owner}.${surface}.${contribution.id}`;
63
+ return { label: t(`${prefix}.label`, contribution.label), detail: t(`${prefix}.detail`, contribution.detail) };
64
+ }
65
+
48
66
  /** Where a field's value came from, as one badge; silence means the default. */
49
67
  export function originOf(
50
68
  view: SettingsValueView | undefined,
@@ -306,7 +324,7 @@ export function ContributedSettingsScreen(props: ContributedSettingsScreenProps)
306
324
  const dirty = section.fields.filter((field) => settingsKeyOf(field) in drafts).length;
307
325
  return (
308
326
  <SectionPage
309
- lede={sentenceCase(section.detail)}
327
+ lede={sentenceCase(section.translateCopy?.(t).detail ?? section.detail)}
310
328
  footer={
311
329
  canSaveSettings({ dirty, scope, repoRoot }) ? (
312
330
  <SaveBar count={dirty} busy={busy} onSave={props.onSave} onDiscard={props.onDiscard} />
@@ -342,9 +360,11 @@ export function ContributedSettingsScreen(props: ContributedSettingsScreenProps)
342
360
  export function useSettingsSections(scope: 'host' | 'workspace', hostId?: string): readonly InstalledSettingsSection[] {
343
361
  const [, setVersion] = useState(0);
344
362
  useEffect(() => subscribeWebPluginRegistry(() => setVersion((value) => value + 1)), []);
345
- return hostId === undefined
346
- ? pluginSettingsSections(scope)
347
- : webPluginRegistryForHost(hostId).pluginSettingsSections(scope);
363
+ const sections =
364
+ hostId === undefined
365
+ ? pluginSettingsSections(scope)
366
+ : webPluginRegistryForHost(hostId).pluginSettingsSections(scope);
367
+ return sections.map((section) => ({ ...section, ...settingsContributionCopy(section, 'settingsSections') }));
348
368
  }
349
369
 
350
370
  type Model = Omit<ContributedSettingsScreenProps, 'section' | 'scope' | 'repoRoot'>;
@@ -3,17 +3,19 @@
3
3
  * the first session with Help mode on. The same five Pos and starters as the web (po-web-dashboard
4
4
  * starterPos), drawn for a phone on ink-wash silk.
5
5
  */
6
- import { t } from '@agimon-ai/po-core/native';
6
+ import { DEFAULT_LOCALE, type LocaleTag, t } from '@agimon-ai/po-core/native';
7
7
  import {
8
8
  Badge,
9
9
  Button,
10
10
  CheckIcon,
11
11
  fontOf,
12
12
  Input,
13
+ GlobeIcon,
13
14
  Label,
14
15
  SendIcon,
15
16
  StepForwardIcon,
16
17
  Spinner,
18
+ Select,
17
19
  Textarea,
18
20
  } from '@agimon-ai/po-native-components';
19
21
  import { START_HERE, type StarterPo, startersFor } from '@agimon-ai/po-web-dashboard/core';
@@ -620,6 +622,41 @@ export function SignInFormStep(props: SignInFormStepProps) {
620
622
  );
621
623
  }
622
624
 
625
+ /**
626
+ * The language switch in the top-right corner of every first-run step. English is always offered
627
+ * beside the packs the person's computers contribute, so before sign-in it may be the only one.
628
+ */
629
+ export function LanguagePicker({
630
+ locales,
631
+ value,
632
+ onChange,
633
+ defaultOpen,
634
+ }: {
635
+ locales: readonly { readonly name: LocaleTag; readonly nativeLabel: string }[];
636
+ value: LocaleTag;
637
+ onChange: (tag: LocaleTag) => void;
638
+ /** Start with the sheet up, as a story shows it. */
639
+ defaultOpen?: boolean | undefined;
640
+ }) {
641
+ const options = [
642
+ { value: DEFAULT_LOCALE, label: 'English' },
643
+ ...locales.map((locale) => ({ value: locale.name, label: locale.nativeLabel })),
644
+ ];
645
+ return (
646
+ <View style={styles.language}>
647
+ <GlobeIcon size={14} color="dim" />
648
+ <Select
649
+ title={t('native.onboarding.language', 'Language')}
650
+ options={options}
651
+ value={value}
652
+ onValueChange={onChange}
653
+ {...(defaultOpen ? { defaultOpen } : {})}
654
+ style={styles.languageTrigger}
655
+ />
656
+ </View>
657
+ );
658
+ }
659
+
623
660
  function SignInMessages({ error, notice }: { error?: string | undefined; notice?: string | undefined }) {
624
661
  if (error)
625
662
  return (
@@ -646,7 +683,8 @@ const styles = StyleSheet.create((theme, rt) => {
646
683
  flexGrow: 1,
647
684
  gap: theme.spacing(5),
648
685
  paddingHorizontal: theme.spacing(4),
649
- paddingTop: theme.spacing(6) + rt.insets.top,
686
+ // Clears the language switch pinned in the top-right corner.
687
+ paddingTop: theme.spacing(15) + rt.insets.top,
650
688
  paddingBottom: theme.spacing(8) + rt.insets.bottom,
651
689
  },
652
690
  header: { gap: theme.spacing(2), alignItems: 'center' },
@@ -783,6 +821,22 @@ const styles = StyleSheet.create((theme, rt) => {
783
821
  helpBadge: { alignSelf: 'center' },
784
822
  welcomeArt: { width: '112%', height: 320, alignSelf: 'center' },
785
823
  back: { alignSelf: 'flex-start' },
824
+ language: {
825
+ position: 'absolute',
826
+ top: theme.spacing(3) + rt.insets.top,
827
+ right: theme.spacing(4),
828
+ zIndex: 1,
829
+ flexDirection: 'row',
830
+ alignItems: 'center',
831
+ gap: theme.spacing(1.5),
832
+ paddingLeft: theme.spacing(3),
833
+ paddingRight: theme.spacing(2.5),
834
+ borderRadius: 999,
835
+ borderWidth: 1,
836
+ borderColor: theme.colors.border,
837
+ backgroundColor: theme.colors.panel,
838
+ },
839
+ languageTrigger: { minHeight: 36 },
786
840
  codeInput: { textAlign: 'center', fontSize: 22, letterSpacing: 8, fontVariant: ['tabular-nums'] },
787
841
  };
788
842
  });
@@ -18,11 +18,15 @@ import {
18
18
  SignInFormStep,
19
19
  SignInWelcomeStep,
20
20
  ConnectProviderStep,
21
+ LanguagePicker,
21
22
  } from './HostedOnboarding';
22
23
 
23
24
  const devPo: StarterPo = STARTER_POS.find((po) => po.id === 'coding') ?? STARTER_POS[0]!;
24
25
  const INTERESTS = 'Shipping my side project, TypeScript, running.';
25
26
  const noop = (): void => undefined;
27
+ /** Packs arrive with the person's computers, so before sign-in English is the only language offered. */
28
+ const NO_PACKS: readonly { name: string; nativeLabel: string }[] = [];
29
+ const LOCALES = [{ name: 'zh-CN', nativeLabel: '简体中文' }];
26
30
 
27
31
  type SignInStep = 'welcome' | 'email' | 'code' | 'team';
28
32
 
@@ -121,8 +125,26 @@ function FirstSession({ po, name, interests }: { po: StarterPo; name: string; in
121
125
  );
122
126
  }
123
127
 
124
- function Phone({ scheme = 'light', children }: { scheme?: DesignScheme; children: ReactNode }) {
125
- return <PhoneFrame scheme={scheme}>{children}</PhoneFrame>;
128
+ function Phone({
129
+ scheme = 'light',
130
+ locales = LOCALES,
131
+ language = true,
132
+ languageOpen,
133
+ children,
134
+ }: {
135
+ scheme?: DesignScheme;
136
+ locales?: readonly { name: string; nativeLabel: string }[];
137
+ /** The first session is the ordinary session screen, so it has no language switch. */
138
+ language?: boolean;
139
+ languageOpen?: boolean;
140
+ children: ReactNode;
141
+ }) {
142
+ return (
143
+ <PhoneFrame scheme={scheme}>
144
+ {children}
145
+ {language ? <LanguagePicker locales={locales} value="en" onChange={noop} defaultOpen={languageOpen} /> : null}
146
+ </PhoneFrame>
147
+ );
126
148
  }
127
149
 
128
150
  export const meta = { title: 'Native/Design/Hosted onboarding', tags: ['style-system', 'mockup', 'native'] };
@@ -131,42 +153,50 @@ export default meta;
131
153
  /** Sign-in on a phone: email or your own server only. */
132
154
  export const SignInWelcome = {
133
155
  render: () => (
134
- <Phone>
156
+ <Phone locales={NO_PACKS}>
135
157
  <SignIn step="welcome" />
136
158
  </Phone>
137
159
  ),
138
160
  };
139
161
  export const SignInEmail = {
140
162
  render: () => (
141
- <Phone>
163
+ <Phone locales={NO_PACKS}>
142
164
  <SignIn step="email" />
143
165
  </Phone>
144
166
  ),
145
167
  };
146
168
  export const SignInCode = {
147
169
  render: () => (
148
- <Phone>
170
+ <Phone locales={NO_PACKS}>
149
171
  <SignIn step="code" />
150
172
  </Phone>
151
173
  ),
152
174
  };
153
175
  export const SignInCodeWrong = {
154
176
  render: () => (
155
- <Phone>
177
+ <Phone locales={NO_PACKS}>
156
178
  <SignIn step="code" error="That code is wrong or expired. Send a new code to try again." />
157
179
  </Phone>
158
180
  ),
159
181
  };
160
182
  export const SignInTeam = {
161
183
  render: () => (
162
- <Phone>
184
+ <Phone locales={NO_PACKS}>
163
185
  <SignIn step="team" />
164
186
  </Phone>
165
187
  ),
166
188
  };
167
189
  export const SignInWelcomeDark = {
168
190
  render: () => (
169
- <Phone scheme="dark">
191
+ <Phone scheme="dark" locales={NO_PACKS}>
192
+ <SignIn step="welcome" />
193
+ </Phone>
194
+ ),
195
+ };
196
+ /** Before sign-in no computer has sent its packs yet, so the sheet offers English alone. */
197
+ export const SignInLanguageMenu = {
198
+ render: () => (
199
+ <Phone locales={NO_PACKS} languageOpen>
170
200
  <SignIn step="welcome" />
171
201
  </Phone>
172
202
  ),
@@ -186,6 +216,14 @@ export const ConnectProviderDark = {
186
216
  </Phone>
187
217
  ),
188
218
  };
219
+ /** Once a computer connects, its packs join English, each named in its own language. */
220
+ export const LanguageMenuOpen = {
221
+ render: () => (
222
+ <Phone languageOpen>
223
+ <ChooseBot />
224
+ </Phone>
225
+ ),
226
+ };
189
227
  /** Step 1 of 2, after Po Cloud sign-in and team. */
190
228
  export const Playground = {
191
229
  render: () => (
@@ -251,14 +289,14 @@ export const AboutYouFailed = {
251
289
  };
252
290
  export const FirstSessionWelcome = {
253
291
  render: () => (
254
- <Phone>
292
+ <Phone language={false}>
255
293
  <FirstSession po={devPo} name="Alex" interests={INTERESTS} />
256
294
  </Phone>
257
295
  ),
258
296
  };
259
297
  export const FirstSessionWithoutName = {
260
298
  render: () => (
261
- <Phone>
299
+ <Phone language={false}>
262
300
  <FirstSession po={devPo} name="" interests="" />
263
301
  </Phone>
264
302
  ),
@@ -279,7 +317,7 @@ export const AboutYouFilledDark = {
279
317
  };
280
318
  export const FirstSessionWelcomeDark = {
281
319
  render: () => (
282
- <Phone scheme="dark">
320
+ <Phone scheme="dark" language={false}>
283
321
  <FirstSession po={devPo} name="Alex" interests={INTERESTS} />
284
322
  </Phone>
285
323
  ),
@@ -238,6 +238,8 @@ function RowState({
238
238
  onTurnOn,
239
239
  }: { plugin: PluginEntry; offline?: boolean } & Pick<PluginCatalogScreenProps, 'onInstall' | 'onTurnOn'>) {
240
240
  const t = useT();
241
+ // A private plugin has no layer to install or put in a preset; the row only opens its screen.
242
+ if (plugin.localPluginId !== undefined) return null;
241
243
  if (plugin.source !== 'po') {
242
244
  const off = plugin.domains !== 'everywhere' && !plugin.domains?.length;
243
245
  return <StatusBadge tone={off ? 'neutral' : 'ok'}>{domainLabel(plugin)}</StatusBadge>;
@@ -38,6 +38,8 @@ export function PluginDetailScreen(props: PluginDetailScreenProps) {
38
38
  const t = useT();
39
39
  const { plugin } = props;
40
40
  const external = plugin.source !== 'po';
41
+ // A local plugin has its settings pages and nothing else: no install, setup, presets or publisher.
42
+ const local = plugin.localPluginId !== undefined;
41
43
  const installed = plugin.install === 'installed';
42
44
  return (
43
45
  <SectionPage>
@@ -56,39 +58,45 @@ export function PluginDetailScreen(props: PluginDetailScreenProps) {
56
58
  : t('native.pluginDetail.codexOrClaude', 'Codex or Claude Code'),
57
59
  publisher: plugin.publisher,
58
60
  })
59
- : t('native.pluginDetail.byPublisher', 'By {publisher} · {category}', {
60
- publisher: plugin.publisher,
61
- category: plugin.category,
62
- })}
61
+ : local
62
+ ? plugin.category
63
+ : t('native.pluginDetail.byPublisher', 'By {publisher} · {category}', {
64
+ publisher: plugin.publisher,
65
+ category: plugin.category,
66
+ })}
63
67
  </Text>
64
68
  </View>
65
69
  </View>
66
70
  <Text style={styles.lede}>{plugin.description}</Text>
67
71
 
68
- <Group
69
- label={
70
- external ? t('native.pluginDetail.whereItLoads', 'Where it loads') : t('native.pluginDetail.status', 'Status')
71
- }
72
- >
73
- {external ? (
74
- <Row
75
- title={domainLabel(plugin)}
76
- description={t(
77
- 'native.pluginDetail.externalDomains',
78
- 'Codex and Claude Code plugins load through domains rather than presets.',
79
- )}
80
- last
81
- >
82
- <Button size="sm" onPress={props.onManageDomains}>
83
- {t('native.pluginDetail.manage', 'Manage')}
84
- </Button>
85
- </Row>
86
- ) : (
87
- <Activation {...props} />
88
- )}
89
- </Group>
72
+ {local ? null : (
73
+ <Group
74
+ label={
75
+ external
76
+ ? t('native.pluginDetail.whereItLoads', 'Where it loads')
77
+ : t('native.pluginDetail.status', 'Status')
78
+ }
79
+ >
80
+ {external ? (
81
+ <Row
82
+ title={domainLabel(plugin)}
83
+ description={t(
84
+ 'native.pluginDetail.externalDomains',
85
+ 'Codex and Claude Code plugins load through domains rather than presets.',
86
+ )}
87
+ last
88
+ >
89
+ <Button size="sm" onPress={props.onManageDomains}>
90
+ {t('native.pluginDetail.manage', 'Manage')}
91
+ </Button>
92
+ </Row>
93
+ ) : (
94
+ <Activation {...props} />
95
+ )}
96
+ </Group>
97
+ )}
90
98
 
91
- {!external && installed && plugin.setup !== 'none' ? (
99
+ {!external && !local && installed && plugin.setup !== 'none' ? (
92
100
  <Group label={t('native.pluginDetail.setup', 'Setup')}>
93
101
  <Setup {...props} />
94
102
  </Group>
@@ -98,7 +106,7 @@ export function PluginDetailScreen(props: PluginDetailScreenProps) {
98
106
  <Group label={t('native.pluginDetail.settings', 'Settings')}>{props.settings}</Group>
99
107
  ) : null}
100
108
 
101
- {external ? null : (
109
+ {external || local ? null : (
102
110
  <Group
103
111
  label={t('native.pluginDetail.inPresets', 'In presets')}
104
112
  hint={
@@ -135,19 +143,21 @@ export function PluginDetailScreen(props: PluginDetailScreenProps) {
135
143
  </Group>
136
144
  )}
137
145
 
138
- <Group label={t('native.pluginDetail.about', 'About')}>
139
- {props.adds.map((line) => (
140
- <Row key={line} title={line} />
141
- ))}
142
- <Row
143
- title={t('native.pluginDetail.publisher', 'Publisher')}
144
- description={plugin.publisher}
145
- last={!props.version}
146
- />
147
- {props.version ? (
148
- <Row title={t('native.pluginDetail.version', 'Version')} description={props.version} last />
149
- ) : null}
150
- </Group>
146
+ {local ? null : (
147
+ <Group label={t('native.pluginDetail.about', 'About')}>
148
+ {props.adds.map((line) => (
149
+ <Row key={line} title={line} />
150
+ ))}
151
+ <Row
152
+ title={t('native.pluginDetail.publisher', 'Publisher')}
153
+ description={plugin.publisher}
154
+ last={!props.version}
155
+ />
156
+ {props.version ? (
157
+ <Row title={t('native.pluginDetail.version', 'Version')} description={props.version} last />
158
+ ) : null}
159
+ </Group>
160
+ )}
151
161
  </SectionPage>
152
162
  );
153
163
  }
@@ -14,6 +14,7 @@ import { PluginDetailScreen, type PluginDetailScreenProps } from './PluginDetail
14
14
  import type { PluginEntry, PluginScope, PresetSummary } from './pluginModel';
15
15
  import { type OnboardingSheetState, PluginOnboardingScreen } from './PluginOnboardingScreen';
16
16
  import { PresetsScreen, type PresetsScreenProps } from './PresetsScreen';
17
+ import { NavRow } from './SettingsScreen';
17
18
 
18
19
  export const meta = { title: 'Native/Design/Plugin marketplace', tags: ['style-system', 'mockup', 'native'] };
19
20
  export default meta;
@@ -313,6 +314,25 @@ export const DetailWorkspaceOverride = {
313
314
  render: () => <Detail plugin={{ ...IMAGE_MAKER, setup: 'ready' }} scope={WORKSPACE} presets={WORKSPACE_PRESETS} />,
314
315
  };
315
316
  export const DetailClaude = { render: () => <Detail plugin={PLUGINS[6]!} adds={['12 skills', '3 hooks']} /> };
317
+ // A local plugin: its settings pages open here; no install, setup, preset or publisher rows.
318
+ export const DetailLocalPlugin = {
319
+ render: () => (
320
+ <Detail
321
+ plugin={{
322
+ ...SCHEDULE,
323
+ id: 'local:notes',
324
+ localPluginId: 'notes',
325
+ name: 'Notes',
326
+ description: 'Keeps your private notes on Studio Mac.',
327
+ category: 'Local plugins',
328
+ publisher: '',
329
+ install: 'installed',
330
+ }}
331
+ settings={<NavRow title="Notes" value="Where your notes are kept" onPress={noop} last />}
332
+ adds={[]}
333
+ />
334
+ ),
335
+ };
316
336
  export const OnboardingNeedsSetup = { render: () => <Onboarding state="needs-setup" /> };
317
337
  export const OnboardingMustFinishFirst = { render: () => <Onboarding state="needs-setup" activation="after-setup" /> };
318
338
  export const OnboardingFinishOnWeb = { render: () => <Onboarding state="unavailable" /> };