@celljs/ta-web 4.35.0 → 4.36.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 (173) hide show
  1. package/esm/browser/assistant/assistant-thread.js +2 -2
  2. package/esm/browser/assistant/mic-capture.d.ts +34 -0
  3. package/esm/browser/assistant/mic-capture.js +87 -0
  4. package/esm/browser/assistant/realtime-voice.d.ts +2 -2
  5. package/esm/browser/assistant/realtime-voice.js +6 -15
  6. package/esm/browser/components/board.d.ts +2 -2
  7. package/esm/browser/components/board.js +2 -2
  8. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  9. package/esm/browser/components/composer-box-hooks.d.ts +12 -0
  10. package/esm/browser/components/composer-box-hooks.js +12 -0
  11. package/esm/browser/components/composer-box-protocol.d.ts +12 -1
  12. package/esm/browser/components/composer-box.js +14 -11
  13. package/esm/browser/components/composer.js +69 -3
  14. package/esm/browser/components/extension-settings.d.ts +7 -0
  15. package/esm/browser/components/extension-settings.js +32 -0
  16. package/esm/browser/components/host-view.d.ts +1 -1
  17. package/esm/browser/components/message-list.js +3 -3
  18. package/esm/browser/components/message-steps.js +3 -3
  19. package/esm/browser/components/phone-shell.d.ts +2 -2
  20. package/esm/browser/components/request-error.d.ts +9 -0
  21. package/esm/browser/components/request-error.js +21 -0
  22. package/esm/browser/components/settings-more.js +7 -24
  23. package/esm/browser/components/storage-settings.d.ts +17 -0
  24. package/esm/browser/components/storage-settings.js +145 -0
  25. package/esm/browser/extension/web-api-contributions.d.ts +6 -7
  26. package/esm/browser/extension/web-api-spec.js +2 -0
  27. package/esm/browser/extension/web-api-targets.d.ts +11 -0
  28. package/esm/browser/extension/web-api-targets.js +2 -0
  29. package/esm/browser/extension/web-extension-api.d.ts +5 -1
  30. package/esm/browser/extension/web-extension-context.d.ts +3 -2
  31. package/esm/browser/extension/web-extension-context.js +11 -15
  32. package/esm/browser/extension/web-extension-run.d.ts +2 -0
  33. package/esm/browser/extension/web-extension-run.js +12 -0
  34. package/esm/browser/extension/web-extensions-running.d.ts +2 -0
  35. package/esm/browser/extension/web-extensions-running.js +5 -0
  36. package/esm/browser/extension/web-extensions.js +1 -0
  37. package/esm/browser/game/game-control.d.ts +6 -0
  38. package/esm/browser/game/game-control.js +28 -0
  39. package/esm/browser/game/game-host.d.ts +9 -2
  40. package/esm/browser/game/game-host.js +5 -1
  41. package/esm/browser/game/game-protocol.d.ts +8 -0
  42. package/esm/browser/game/game-runner.d.ts +7 -1
  43. package/esm/browser/game/game-runner.js +24 -2
  44. package/esm/browser/game/game-target.d.ts +22 -0
  45. package/esm/browser/game/game-target.js +84 -0
  46. package/esm/browser/game/game-util.d.ts +2 -0
  47. package/esm/browser/game/game-util.js +2 -0
  48. package/esm/browser/game/game-view.d.ts +5 -2
  49. package/esm/browser/game/game-view.js +4 -4
  50. package/esm/browser/game/game3d-protocol.d.ts +3 -1
  51. package/esm/browser/game/game3d-runner.d.ts +6 -1
  52. package/esm/browser/game/game3d-runner.js +26 -2
  53. package/esm/browser/i18n/en/chat.d.ts +4 -0
  54. package/esm/browser/i18n/en/chat.js +4 -0
  55. package/esm/browser/i18n/en/settings.d.ts +15 -0
  56. package/esm/browser/i18n/en/settings.js +15 -0
  57. package/esm/browser/i18n/ja/chat.js +4 -0
  58. package/esm/browser/i18n/ja/settings.js +15 -0
  59. package/esm/browser/i18n/locales.d.ts +20 -1
  60. package/esm/browser/i18n/messages.d.ts +19 -0
  61. package/esm/browser/i18n/zh/chat.js +4 -0
  62. package/esm/browser/i18n/zh/settings.js +15 -0
  63. package/esm/browser/i18n/zh-tw/chat.js +4 -0
  64. package/esm/browser/i18n/zh-tw/settings.js +15 -0
  65. package/esm/browser/index.d.ts +2 -0
  66. package/esm/browser/index.js +2 -0
  67. package/esm/browser/sandbox/remote/remote-copy.d.ts +1 -0
  68. package/esm/browser/sandbox/remote/remote-copy.js +16 -0
  69. package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
  70. package/esm/browser/settings/agent-settings.js +5 -1
  71. package/esm/browser/style/pages.d.ts +1 -1
  72. package/esm/browser/style/pages.js +2 -0
  73. package/esm/browser/style/surfaces.d.ts +1 -1
  74. package/esm/browser/style/surfaces.js +2 -3
  75. package/esm/browser/targets/targets-protocol.d.ts +54 -0
  76. package/esm/browser/targets/targets-protocol.js +34 -0
  77. package/esm/browser/targets/targets.d.ts +13 -0
  78. package/esm/browser/targets/targets.js +64 -0
  79. package/esm/browser/util/composer.d.ts +4 -2
  80. package/esm/browser/util/composer.js +7 -1
  81. package/esm/browser/util/message.d.ts +6 -0
  82. package/esm/browser/util/message.js +21 -0
  83. package/esm/browser/util/process.d.ts +1 -0
  84. package/esm/browser/util/process.js +6 -1
  85. package/esm/browser/util/progress.d.ts +2 -1
  86. package/esm/browser/util/progress.js +2 -11
  87. package/lib/browser/assistant/assistant-thread.js +2 -2
  88. package/lib/browser/assistant/mic-capture.d.ts +35 -0
  89. package/lib/browser/assistant/mic-capture.js +91 -0
  90. package/lib/browser/assistant/realtime-voice.d.ts +2 -2
  91. package/lib/browser/assistant/realtime-voice.js +6 -15
  92. package/lib/browser/components/board.d.ts +2 -2
  93. package/lib/browser/components/board.js +2 -2
  94. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  95. package/lib/browser/components/composer-box-hooks.d.ts +12 -0
  96. package/lib/browser/components/composer-box-hooks.js +13 -0
  97. package/lib/browser/components/composer-box-protocol.d.ts +12 -1
  98. package/lib/browser/components/composer-box.js +13 -10
  99. package/lib/browser/components/composer.js +69 -3
  100. package/lib/browser/components/extension-settings.d.ts +8 -0
  101. package/lib/browser/components/extension-settings.js +69 -0
  102. package/lib/browser/components/host-view.d.ts +1 -1
  103. package/lib/browser/components/message-list.js +3 -3
  104. package/lib/browser/components/message-steps.js +3 -3
  105. package/lib/browser/components/phone-shell.d.ts +2 -2
  106. package/lib/browser/components/request-error.d.ts +10 -0
  107. package/lib/browser/components/request-error.js +57 -0
  108. package/lib/browser/components/settings-more.js +6 -23
  109. package/lib/browser/components/storage-settings.d.ts +18 -0
  110. package/lib/browser/components/storage-settings.js +182 -0
  111. package/lib/browser/extension/web-api-contributions.d.ts +6 -7
  112. package/lib/browser/extension/web-api-spec.js +2 -0
  113. package/lib/browser/extension/web-api-targets.d.ts +12 -0
  114. package/lib/browser/extension/web-api-targets.js +3 -0
  115. package/lib/browser/extension/web-extension-api.d.ts +5 -1
  116. package/lib/browser/extension/web-extension-context.d.ts +3 -2
  117. package/lib/browser/extension/web-extension-context.js +11 -15
  118. package/lib/browser/extension/web-extension-run.d.ts +2 -0
  119. package/lib/browser/extension/web-extension-run.js +12 -0
  120. package/lib/browser/extension/web-extensions-running.d.ts +2 -0
  121. package/lib/browser/extension/web-extensions-running.js +5 -0
  122. package/lib/browser/extension/web-extensions.js +1 -0
  123. package/lib/browser/game/game-control.d.ts +6 -0
  124. package/lib/browser/game/game-control.js +28 -0
  125. package/lib/browser/game/game-host.d.ts +9 -2
  126. package/lib/browser/game/game-host.js +5 -1
  127. package/lib/browser/game/game-protocol.d.ts +8 -0
  128. package/lib/browser/game/game-runner.d.ts +7 -1
  129. package/lib/browser/game/game-runner.js +24 -2
  130. package/lib/browser/game/game-target.d.ts +23 -0
  131. package/lib/browser/game/game-target.js +87 -0
  132. package/lib/browser/game/game-util.d.ts +2 -0
  133. package/lib/browser/game/game-util.js +2 -0
  134. package/lib/browser/game/game-view.d.ts +5 -2
  135. package/lib/browser/game/game-view.js +4 -4
  136. package/lib/browser/game/game3d-protocol.d.ts +3 -1
  137. package/lib/browser/game/game3d-runner.d.ts +6 -1
  138. package/lib/browser/game/game3d-runner.js +26 -2
  139. package/lib/browser/i18n/en/chat.d.ts +4 -0
  140. package/lib/browser/i18n/en/chat.js +4 -0
  141. package/lib/browser/i18n/en/settings.d.ts +15 -0
  142. package/lib/browser/i18n/en/settings.js +15 -0
  143. package/lib/browser/i18n/ja/chat.js +4 -0
  144. package/lib/browser/i18n/ja/settings.js +15 -0
  145. package/lib/browser/i18n/locales.d.ts +20 -1
  146. package/lib/browser/i18n/messages.d.ts +19 -0
  147. package/lib/browser/i18n/zh/chat.js +4 -0
  148. package/lib/browser/i18n/zh/settings.js +15 -0
  149. package/lib/browser/i18n/zh-tw/chat.js +4 -0
  150. package/lib/browser/i18n/zh-tw/settings.js +15 -0
  151. package/lib/browser/index.d.ts +2 -0
  152. package/lib/browser/index.js +2 -0
  153. package/lib/browser/sandbox/remote/remote-copy.d.ts +1 -0
  154. package/lib/browser/sandbox/remote/remote-copy.js +16 -0
  155. package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
  156. package/lib/browser/settings/agent-settings.js +5 -1
  157. package/lib/browser/style/pages.d.ts +1 -1
  158. package/lib/browser/style/pages.js +2 -0
  159. package/lib/browser/style/surfaces.d.ts +1 -1
  160. package/lib/browser/style/surfaces.js +2 -3
  161. package/lib/browser/targets/targets-protocol.d.ts +55 -0
  162. package/lib/browser/targets/targets-protocol.js +37 -0
  163. package/lib/browser/targets/targets.d.ts +14 -0
  164. package/lib/browser/targets/targets.js +67 -0
  165. package/lib/browser/util/composer.d.ts +4 -2
  166. package/lib/browser/util/composer.js +7 -1
  167. package/lib/browser/util/message.d.ts +6 -0
  168. package/lib/browser/util/message.js +21 -0
  169. package/lib/browser/util/process.d.ts +1 -0
  170. package/lib/browser/util/process.js +6 -1
  171. package/lib/browser/util/progress.d.ts +2 -1
  172. package/lib/browser/util/progress.js +2 -11
  173. package/package.json +7 -7
@@ -0,0 +1,21 @@
1
+ import { TaRequestErrorUtil } from '@celljs/ta-protocol';
2
+ import * as React from 'react';
3
+ import { useT } from '../i18n/use-t.js';
4
+ import { Callout } from './callout.js';
5
+ /**
6
+ * A request that failed, said in the user's language: the kind of failure (the network, a rate limit, a busy model)
7
+ * as the line, what the provider said under it; an error of another kind as the provider said it.
8
+ */
9
+ export function RequestError({ error, action }) {
10
+ const t = useT();
11
+ const text = error === null || error === void 0 ? void 0 : error.trim();
12
+ if (!text) {
13
+ return (React.createElement(Callout, { level: "error", action: action }, t('ta.message.failedUnknown')));
14
+ }
15
+ const reason = TaRequestErrorUtil.reason(text);
16
+ if (reason === 'error') {
17
+ return (React.createElement(Callout, { level: "error", action: action }, text));
18
+ }
19
+ return (React.createElement(Callout, { level: "error", action: action, detail: text }, t(`ta.message.failed.${reason}`)));
20
+ }
21
+ //# sourceMappingURL=request-error.js.map
@@ -2,23 +2,23 @@ import { Blocks, Cloud, FolderOpen, Info, Keyboard, Puzzle, RefreshCw, RotateCw,
2
2
  import * as React from 'react';
3
3
  import { useAppRows } from '../apps/app-settings.js';
4
4
  import { useDevice } from '../device/device.js';
5
- import { ExtensionBoundary } from '../extension/extension-view.js';
6
- import { WebLabelUtil } from '../extension/web-extension-protocol.js';
7
5
  import { useNotices, useSettings, useWebExtensions, useWorkbench } from '../hooks.js';
8
6
  import { useLanguage, useT } from '../i18n/use-t.js';
9
7
  import { useAccessRows } from './access-settings.js';
10
8
  import { AccessSettings, useAccess } from './access-view.js';
11
9
  import { BusyMark } from './busy.js';
12
10
  import { EnvironmentSettings, useGateway } from './environment-view.js';
11
+ import { extensionSection } from './extension-settings.js';
13
12
  import { Icon, IconButton } from './icon.js';
14
13
  import { useLaunchRows } from './launch-settings.js';
15
14
  import { RelayServices } from './relay-services.js';
16
15
  import { RemoteHosts } from './remote-hosts.js';
17
16
  import { ServeRestartUtil, useRestartTa } from './serve-restart.js';
18
- import { packageLabel, SETTINGS_GROUPS, SHORTCUTS, usePackages } from './settings-choices.js';
17
+ import { packageLabel, SHORTCUTS, usePackages } from './settings-choices.js';
19
18
  import { EmptyRow, Keys, Row, row, Switch } from './settings-controls.js';
20
19
  import { SettingsFilesRow } from './settings-files.js';
21
20
  import { SignInSetupSettings, useSignInConfig } from './sign-in-setup.js';
21
+ import { useStorageSection } from './storage-settings.js';
22
22
  /**
23
23
  * The sections besides those of the page and of pi's settings, each in its part (SectionEntry.group): the packages,
24
24
  * those built in, those of extensions where they ask, the computers and services Ta reaches, who may come in, the
@@ -70,6 +70,8 @@ export function useMoreSections(onDialog) {
70
70
  const launchRows = useLaunchRows();
71
71
  const accessRows = useAccessRows();
72
72
  const appRows = useAppRows();
73
+ // Those of extensions that are the detail of a store show under it in Storage.
74
+ const storage = useStorageSection(settingsSections.filter(entry => entry.section.storage));
73
75
  /** Why the web extension of a package did not load, if it did not. */
74
76
  const failure = (pkg) => { var _a; return (_a = extensions.find(extension => { var _a; return ((_a = extension.info) === null || _a === void 0 ? void 0 : _a.source) === pkg.source && extension.error; })) === null || _a === void 0 ? void 0 : _a.error; };
75
77
  const reload = async () => {
@@ -124,7 +126,8 @@ export function useMoreSections(onDialog) {
124
126
  }),
125
127
  ],
126
128
  },
127
- ...settingsSections.map(extensionSection),
129
+ ...settingsSections.filter(entry => !entry.section.storage).map(extensionSection),
130
+ ...(storage ? [storage] : []),
128
131
  // Behind a gateway only: where the Ta of this account runs.
129
132
  ...(gateway.info
130
133
  ? [
@@ -240,24 +243,4 @@ export function useMoreSections(onDialog) {
240
243
  ];
241
244
  return more;
242
245
  }
243
- /** A section an extension added (WebExtensionAPI.registerSettings): its rows as Ta's, each control in a boundary of its own. */
244
- function extensionSection({ id, section }) {
245
- var _a, _b;
246
- const title = WebLabelUtil.text(section.title);
247
- return {
248
- id: `extension-${id.replace(/[^\w-]+/g, '-')}`,
249
- title,
250
- icon: (_a = section.icon) !== null && _a !== void 0 ? _a : Puzzle,
251
- group: section.group && SETTINGS_GROUPS.some(group => group.id === section.group) ? section.group : 'extensions',
252
- order: (_b = section.order) !== null && _b !== void 0 ? _b : 100,
253
- rows: section.rows.map(item => {
254
- const label = WebLabelUtil.text(item.label);
255
- const description = item.description === undefined ? undefined : WebLabelUtil.text(item.description);
256
- const Control = item.render;
257
- return row(`${id}/${item.key}`, [label, description, title, item.search === undefined ? undefined : WebLabelUtil.text(item.search)], React.createElement(Row, { label: label, description: description, stacked: item.stacked },
258
- React.createElement(ExtensionBoundary, { name: title, resetKey: Control },
259
- React.createElement(Control, null))));
260
- }),
261
- };
262
- }
263
246
  //# sourceMappingURL=settings-more.js.map
@@ -0,0 +1,17 @@
1
+ import { type TaStorageInfo } from '@celljs/ta-protocol';
2
+ import type { WebSettingsEntry } from '../extension/web-extension-protocol.js';
3
+ import type { SectionEntry } from './settings-parts.js';
4
+ export declare namespace StorageSettingsUtil {
5
+ /** 512 KB, 300 MB, 1.2 GB: as a person reads what a store takes. */
6
+ function size(bytes: number): string;
7
+ /** A limit of megabytes as chosen: 500 MB, 2 GB. */
8
+ function megabytes(mb: number): string;
9
+ /** What all the stores take, those whose usage was read. */
10
+ function total(stores: readonly TaStorageInfo[]): number;
11
+ }
12
+ /**
13
+ * Settings → Storage (docs/design/ta-storage.md): what Ta and its packages keep on this computer, each store with what it
14
+ * takes, the limits it is kept to (days, size) as the user sets them, and clearing it; the rows of extensions that are a
15
+ * detail of a store (WebSettingsSection.storage) under it, those of a store not listed at the end.
16
+ */
17
+ export declare function useStorageSection(details: readonly WebSettingsEntry[]): SectionEntry | undefined;
@@ -0,0 +1,145 @@
1
+ import { TaLanguageUtil, TaStorageUtil } from '@celljs/ta-protocol';
2
+ import { HardDrive, Trash2 } from 'lucide-react';
3
+ import * as React from 'react';
4
+ import { useNotices, useSettingsServer } from '../hooks.js';
5
+ import { useLanguage, useT } from '../i18n/use-t.js';
6
+ import { useBusy } from './busy.js';
7
+ import { extensionRows } from './extension-settings.js';
8
+ import { IconButton } from './icon.js';
9
+ import { Row, row } from './settings-controls.js';
10
+ export var StorageSettingsUtil;
11
+ (function (StorageSettingsUtil) {
12
+ /** 512 KB, 300 MB, 1.2 GB: as a person reads what a store takes. */
13
+ function size(bytes) {
14
+ if (bytes < 1024 * 1024) {
15
+ return `${Math.max(bytes > 0 ? 1 : 0, Math.round(bytes / 1024))} KB`;
16
+ }
17
+ if (bytes < 1024 ** 3) {
18
+ return `${Math.round(bytes / 1024 ** 2)} MB`;
19
+ }
20
+ return `${(bytes / 1024 ** 3).toFixed(bytes < 10 * 1024 ** 3 ? 1 : 0)} GB`;
21
+ }
22
+ StorageSettingsUtil.size = size;
23
+ /** A limit of megabytes as chosen: 500 MB, 2 GB. */
24
+ function megabytes(mb) {
25
+ return mb >= 1024 && mb % 1024 === 0 ? `${mb / 1024} GB` : `${mb} MB`;
26
+ }
27
+ StorageSettingsUtil.megabytes = megabytes;
28
+ /** What all the stores take, those whose usage was read. */
29
+ function total(stores) {
30
+ return stores.reduce((sum, store) => { var _a; return sum + ((_a = store.bytes) !== null && _a !== void 0 ? _a : 0); }, 0);
31
+ }
32
+ StorageSettingsUtil.total = total;
33
+ })(StorageSettingsUtil || (StorageSettingsUtil = {}));
34
+ /** The stores of ta serve (TaSettingsServer.listStorage): undefined while read, null from a Ta service of before. */
35
+ function useStores() {
36
+ const server = useSettingsServer();
37
+ const [, notices] = useNotices();
38
+ const [stores, setStores] = React.useState();
39
+ const read = React.useCallback(() => {
40
+ Promise.resolve()
41
+ .then(() => (server.listStorage ? server.listStorage() : null))
42
+ .then(setStores, () => setStores(null));
43
+ }, [server]);
44
+ React.useEffect(read, [read]);
45
+ const setLimit = async (store, kind, value) => {
46
+ var _a;
47
+ // The default again is no setting of the user's: it follows the default if that changes.
48
+ const next = await ((_a = server.setStorageLimits) === null || _a === void 0 ? void 0 : _a.call(server, store.id, { [kind]: value === store.defaults[kind] ? null : value }));
49
+ if (next) {
50
+ setStores(all => all === null || all === void 0 ? void 0 : all.map(each => (each.id === next.id ? next : each)));
51
+ }
52
+ };
53
+ const clear = async (store) => {
54
+ var _a;
55
+ var _b;
56
+ const freed = (_b = (await ((_a = server.clearStorage) === null || _a === void 0 ? void 0 : _a.call(server, store.id)))) !== null && _b !== void 0 ? _b : 0;
57
+ read();
58
+ return freed;
59
+ };
60
+ return { stores, setLimit, clear, notices };
61
+ }
62
+ /** A limit of a store as a choice of its own words: "Keep 30 days", "Keep all". */
63
+ function LimitSelect({ store, kind, onChange }) {
64
+ var _a;
65
+ const t = useT();
66
+ const [busy, setBusy] = React.useState(false);
67
+ const value = (_a = store.limits[kind]) !== null && _a !== void 0 ? _a : 0;
68
+ const list = TaStorageUtil.choices(kind === 'keepDays' ? store.choices.days : store.choices.mb, value);
69
+ const label = (n) => kind === 'keepDays'
70
+ ? n
71
+ ? t('ta.storage.keep', { days: n })
72
+ : t('ta.storage.keepAll')
73
+ : n
74
+ ? t('ta.storage.max', { size: StorageSettingsUtil.megabytes(n) })
75
+ : t('ta.storage.maxNone');
76
+ return (React.createElement("select", { className: "ta-input ta-select ta-storage-select", "aria-label": t(kind === 'keepDays' ? 'ta.storage.keepLabel' : 'ta.storage.maxLabel'), value: value, disabled: busy, onChange: event => {
77
+ setBusy(true);
78
+ void onChange(Number(event.target.value)).finally(() => setBusy(false));
79
+ } }, list.map(n => (React.createElement("option", { key: n, value: n }, label(n))))));
80
+ }
81
+ /** Clears a store, once the user said so; busy while it runs. */
82
+ function ClearButton({ label, onClear }) {
83
+ const [busy, run] = useBusy();
84
+ return React.createElement(IconButton, { icon: Trash2, label: label, busy: busy, onClick: () => void run(onClear) });
85
+ }
86
+ /**
87
+ * Settings → Storage (docs/design/ta-storage.md): what Ta and its packages keep on this computer, each store with what it
88
+ * takes, the limits it is kept to (days, size) as the user sets them, and clearing it; the rows of extensions that are a
89
+ * detail of a store (WebSettingsSection.storage) under it, those of a store not listed at the end.
90
+ */
91
+ export function useStorageSection(details) {
92
+ const t = useT();
93
+ const language = useLanguage();
94
+ const { stores, setLimit, clear, notices } = useStores();
95
+ if (stores === null && details.length === 0) {
96
+ return undefined;
97
+ }
98
+ const words = (text) => TaLanguageUtil.pick(language, text);
99
+ const failed = (error) => {
100
+ notices.error(error);
101
+ };
102
+ const onClear = async (store) => {
103
+ const name = words(store.title);
104
+ const sure = await notices.confirm({
105
+ title: t('ta.storage.clearConfirm', { name }),
106
+ message: store.hint && words(store.hint),
107
+ confirmLabel: t('ta.storage.clear'),
108
+ danger: true,
109
+ });
110
+ if (!sure) {
111
+ return;
112
+ }
113
+ try {
114
+ notices.notify(t('ta.storage.freed', { size: StorageSettingsUtil.size(await clear(store)) }), { level: 'success' });
115
+ }
116
+ catch (error) {
117
+ failed(error);
118
+ }
119
+ };
120
+ const storeRow = (store) => {
121
+ const title = words(store.title);
122
+ const hint = store.hint && words(store.hint);
123
+ const usage = store.bytes === undefined ? undefined : t('ta.storage.usage', { size: StorageSettingsUtil.size(store.bytes) });
124
+ const kinds = ['keepDays', 'maxMB'].filter(kind => store.defaults[kind] !== undefined);
125
+ return row(`storage:${store.id}`, [title, hint, t('ta.storage.title')], React.createElement(Row, { label: title, description: [usage, hint].filter(Boolean).join(' · ') },
126
+ kinds.map(kind => (React.createElement(LimitSelect, { key: kind, store: store, kind: kind, onChange: value => setLimit(store, kind, value).catch(failed) }))),
127
+ store.clearable && React.createElement(ClearButton, { label: t('ta.storage.clear'), onClear: () => onClear(store) })));
128
+ };
129
+ const listed = new Set((stores !== null && stores !== void 0 ? stores : []).map(store => store.id));
130
+ const rows = stores
131
+ ? [
132
+ row('storage', [t('ta.storage.title'), t('ta.storage.hint'), 'storage', 'disk'], React.createElement(Row, { label: t('ta.storage.total', { size: StorageSettingsUtil.size(StorageSettingsUtil.total(stores)) }), description: t('ta.storage.hint') })),
133
+ ...stores.flatMap(store => [storeRow(store), ...details.filter(entry => entry.section.storage === store.id).flatMap(extensionRows)]),
134
+ ]
135
+ : [];
136
+ return {
137
+ id: 'storage',
138
+ title: t('ta.storage.title'),
139
+ icon: HardDrive,
140
+ // Last of General but for the keys and About.
141
+ order: 800,
142
+ rows: [...rows, ...(stores === undefined ? [] : details.filter(entry => { var _a; return !listed.has((_a = entry.section.storage) !== null && _a !== void 0 ? _a : ''); }).flatMap(extensionRows))],
143
+ };
144
+ }
145
+ //# sourceMappingURL=storage-settings.js.map
@@ -35,11 +35,13 @@ export interface WebSettingsSection {
35
35
  /** Smaller first among those of extensions in its group, then as registered; default 100 (negative: before Ta's). */
36
36
  order?: number;
37
37
  rows: WebSettingRow[];
38
+ /** A store of Settings → Storage (TaStorageInfo.id): its rows show under it there; older Ta apps list it as a section. */
39
+ storage?: string;
38
40
  /**
39
41
  * Models without signing in to a service (coding agents to install): the first page, which asks to sign in, shows the
40
42
  * section as a card beside accounts and API keys, `hint` under its title naming examples as theirs do
41
- * (`CodeBuddy · Codex`); picked, its rows are there, and the page goes on by itself once Ta has models.
42
- * Newer than some Ta apps, which do not show it there.
43
+ * (`CodeBuddy · Codex`); picked, its rows are there, and the page goes on by itself once Ta has models. Newer than
44
+ * some Ta apps, which do not show it there.
43
45
  */
44
46
  signIn?: {
45
47
  hint: WebLabel;
@@ -148,16 +150,13 @@ export interface WebView {
148
150
  * chats. `panel`: a tool of the workbench beside the conversation, as the explorer or the terminal
149
151
  * of an IDE: its `+` and its empty state list it, and it opens as one of its tabs. `launcher`: a
150
152
  * section of what a phone pulls down over its first tab (a button of the rail elsewhere), as Recent and
151
- * Mine. `board`: a card of the board a phone brings out with a swipe to the left over its first tab (a
153
+ * Mine. `board`: a card of the board a phone brings in from the left with a swipe to the right over its first tab (a
152
154
  * button of the rail elsewhere), which the user takes off, puts back and orders (ta-launcher.md).
153
155
  */
154
156
  location?: WebViewLocation;
155
157
  /** Smaller first among those of its location; default 100. */
156
158
  order?: number;
157
- /**
158
- * A page: its … where a list shows it (the sidebar view that leads to it), in sections set apart by
159
- * a line; read each time the menu opens, so it can say what holds now.
160
- */
159
+ /** A page: its … where a list shows it (the sidebar view that leads to it), in sections set apart by a line; read as it opens. */
161
160
  menu?(): WebMenuItem[][];
162
161
  /**
163
162
  * Its top bar, in place of the title: for a sidebar view, the row above it (a search, a button
@@ -57,6 +57,7 @@ export const WEB_UI_SPEC = {
57
57
  doubleInChats: value(B),
58
58
  useDevice: peek(B),
59
59
  showView: call(B),
60
+ openSettings: fire(B),
60
61
  showChats: fire(B),
61
62
  custom: hold(B, ['C']),
62
63
  openEditor: fire(B, [EDITOR]),
@@ -190,6 +191,7 @@ export const WEB_API_SPEC = {
190
191
  files: page,
191
192
  remote: page,
192
193
  screenShare: page,
194
+ targets: page,
193
195
  onScreenShareEvent: page,
194
196
  settings: page,
195
197
  rooms: page,
@@ -0,0 +1,11 @@
1
+ /** Part of the web extension API (web-extension-api.ts, which exports it all): what a program may work on the page. */
2
+ import type { WebTargets } from '../targets/targets-protocol.js';
3
+ export type { TargetEvent, TargetSpec, WebTargets } from '../targets/targets-protocol.js';
4
+ export interface WebTargetsAPI {
5
+ /**
6
+ * What a program may work on its own clock (docs/design/ta-reflex.md): register a canvas, an editor, anything that
7
+ * says what is on it (`observe`) and takes actions (`act`), while it is there; the games of `ui.Game` and
8
+ * `ui.Game3D` are registered by the page. Newer than some Ta apps: `pi.targets?.…`.
9
+ */
10
+ readonly targets?: WebTargets;
11
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=web-api-targets.js.map
@@ -14,6 +14,7 @@ import type { WebHomeUI, WebPartnersAPI, WebPartnersUI } from './web-api-home.js
14
14
  import type { WebFileRef, WebMenus } from './web-api-menus.js';
15
15
  import type { WebServices } from './web-api-services.js';
16
16
  import type { WebPackageStorage } from './web-api-storage.js';
17
+ import type { WebTargetsAPI } from './web-api-targets.js';
17
18
  import type { WebTerminal, WebTerminalOptions } from './web-api-terminal.js';
18
19
  import type { WebPageInfo } from './web-pages.js';
19
20
  export type { Mood } from '../avatar/dino-avatar.js';
@@ -30,13 +31,14 @@ export type * from './web-api-home.js';
30
31
  export type * from './web-api-menus.js';
31
32
  export type * from './web-api-services.js';
32
33
  export type * from './web-api-storage.js';
34
+ export type * from './web-api-targets.js';
33
35
  export type * from './web-api-terminal.js';
34
36
  export type { WebPageInfo, WebPageState } from './web-pages.js';
35
37
  /**
36
38
  * What a web extension gets: the web client's side of pi's extension API, its names where they mean the same. A web
37
39
  * extension is one ES module without imports, the `web` part of a pi package (TaWebExtensionInfo): a {@link WebExtensionFactory}.
38
40
  */
39
- export interface WebExtensionAPI extends WebServices, WebPartnersAPI, WebMenus, WebCallsAPI, WebChatTagsAPI {
41
+ export interface WebExtensionAPI extends WebServices, WebPartnersAPI, WebMenus, WebCallsAPI, WebChatTagsAPI, WebTargetsAPI {
40
42
  /** The React of the page: an extension brings no React of its own. */
41
43
  readonly React: typeof React;
42
44
  readonly ui: WebExtensionUI;
@@ -316,6 +318,8 @@ export interface WebExtensionUI extends WebHomeUI, WebPartnersUI, WebEditorsUI,
316
318
  * The name of an extension alone opens its first page. Resolves whether there was such a view.
317
319
  */
318
320
  showView(id: string): Promise<boolean>;
321
+ /** Opens the settings at a section of Ta's (`storage`, `navigation`) or none. Newer than some Ta apps: `pi.ui.openSettings?.(…)`. */
322
+ openSettings?(section?: string): void;
319
323
  /**
320
324
  * Shows the list of chats (on a phone its tab); with `busy`, only the conversations of the user's own going on
321
325
  * (those that wait for them, answer now, or said something unseen), until the user clears it; on a phone these are
@@ -7,6 +7,7 @@ import type { TaSessionNotices } from '../notices/session-notices.js';
7
7
  import { type TaScreen } from '../screen/screen-protocol.js';
8
8
  import type { TaSettings } from '../settings/settings-protocol.js';
9
9
  import type { TaState } from '../state/state-protocol.js';
10
+ import { type TaTargets } from '../targets/targets-protocol.js';
10
11
  import type { TaWorkbench } from '../workbench-protocol.js';
11
12
  import type { WebCodeRendererProps } from './web-api-contributions.js';
12
13
  import type { WebEditorTabs } from './web-editor-tabs.js';
@@ -29,6 +30,8 @@ export interface WebExtensionContextHost {
29
30
  readonly persisted: TaState;
30
31
  /** The parts of the screen and where the shell is (docs/design/ta-app-use.md 3). */
31
32
  readonly screen: TaScreen;
33
+ /** What programs may work on the page (docs/design/ta-reflex.md 4). */
34
+ readonly targets: TaTargets;
32
35
  /** What the extensions registered changed: the page shows it. */
33
36
  publish(): void;
34
37
  /** Runs what the extension gave, its failure logged rather than thrown. */
@@ -50,8 +53,6 @@ export declare class WebExtensionContext {
50
53
  static marked(server: TaServer, mark: (text: string) => string): TaServer;
51
54
  /** A renderer of code whose `send` (a choice tapped in it) says it came from the extension. */
52
55
  static replying(Renderer: React.ComponentType<WebCodeRendererProps>, mark: (text: string) => string): React.ComponentType<WebCodeRendererProps>;
53
- /** A path of a file of a package, relative to it and inside it (`./models/rex.glb`, `models\rex.glb`: `models/rex.glb`). */
54
- static packagePath(path: string): string;
55
56
  /** Monaco and the games in the theme and language of the settings, the same component for every extension. */
56
57
  protected readonly codeEditor: (props: CodeEditorProps) => React.FunctionComponentElement<CodeEditorProps & {
57
58
  settings: TaSettings;
@@ -44,6 +44,7 @@ import { Game3DView, GameView } from '../game/game-view.js';
44
44
  import { message as messageOf } from '../i18n/messages.js';
45
45
  import { translator } from '../i18n/use-t.js';
46
46
  import { ScreenUtil } from '../screen/screen-protocol.js';
47
+ import { TargetsUtil } from '../targets/targets-protocol.js';
47
48
  import { DefaultWebTerminal } from '../terminal/web-terminal.js';
48
49
  import { DesktopUtil } from '../util/desktop.js';
49
50
  import { FileDragUtil } from '../util/file-drag.js';
@@ -108,24 +109,13 @@ export class WebExtensionContext {
108
109
  return React.createElement(Renderer, { ...props, send: marked });
109
110
  };
110
111
  }
111
- /** A path of a file of a package, relative to it and inside it (`./models/rex.glb`, `models\rex.glb`: `models/rex.glb`). */
112
- static packagePath(path) {
113
- const parts = path
114
- .replace(/\\/g, '/')
115
- .split('/')
116
- .filter(part => part !== '' && part !== '.');
117
- if (/^([a-z]:)?[\\/]/i.test(path) || parts.length === 0 || parts.includes('..')) {
118
- throw new Error(`Not a file inside the package: ${path}`);
119
- }
120
- return parts.join('/');
121
- }
122
112
  /** The games of an extension, which Ta calls by its package's title on the screen unless they are given one. */
123
113
  gamesOf(run) {
124
- const { settings, screen } = this.host;
114
+ const { settings, screen, targets } = this.host;
125
115
  const title = () => (run.loaded.info ? WebPagesUtil.title(run.loaded.info, settings.state.language) : run.loaded.name);
126
116
  return {
127
- Game: (props) => { var _a; return React.createElement(GameView, { ...props, title: (_a = props.title) !== null && _a !== void 0 ? _a : title(), settings, screen }); },
128
- Game3D: (props) => { var _a; return React.createElement(Game3DView, { ...props, title: (_a = props.title) !== null && _a !== void 0 ? _a : title(), settings, screen }); },
117
+ Game: (props) => { var _a; return React.createElement(GameView, { ...props, title: (_a = props.title) !== null && _a !== void 0 ? _a : title(), settings, screen, targets }); },
118
+ Game3D: (props) => { var _a; return React.createElement(Game3DView, { ...props, title: (_a = props.title) !== null && _a !== void 0 ? _a : title(), settings, screen, targets }); },
129
119
  };
130
120
  }
131
121
  /** The message box of an extension: its drafts under its name, apart from those of the others. */
@@ -178,7 +168,7 @@ export class WebExtensionContext {
178
168
  if (!root) {
179
169
  throw new Error(`The web extension ${run.loaded.name} has no files of its own here.`);
180
170
  }
181
- return files.loadable(await workbench.workspace.fileUrl(WebExtensionContext.packagePath(path), root));
171
+ return files.loadable(await workbench.workspace.fileUrl(WebExtensionRunUtil.packagePath(path), root));
182
172
  }),
183
173
  get remote() {
184
174
  return workbench.remote;
@@ -186,6 +176,7 @@ export class WebExtensionContext {
186
176
  get screenShare() {
187
177
  return workbench.screenShare;
188
178
  },
179
+ targets: TargetsUtil.forExtension(host.targets, () => run.stopped, subscribe => WebExtensionRunUtil.track(run, subscribe)),
189
180
  onScreenShareEvent: listener => hear(workbench.onScreenShareEvent.bind(workbench), listener),
190
181
  get settings() {
191
182
  return workbench.settings;
@@ -343,6 +334,11 @@ export class WebExtensionContext {
343
334
  },
344
335
  useDevice,
345
336
  showView: id => (run.stopped ? Promise.resolve(false) : host.extensions.showView(id)),
337
+ openSettings: section => {
338
+ if (!run.stopped) {
339
+ host.extensions.openSettings(section);
340
+ }
341
+ },
346
342
  showChats: options => {
347
343
  if (!run.stopped) {
348
344
  host.extensions.showChats(!!(options === null || options === void 0 ? void 0 : options.busy));
@@ -58,6 +58,8 @@ export declare namespace WebExtensionRunUtil {
58
58
  function create(loaded: LoadedWebExtension, hash?: string): WebExtensionRun;
59
59
  /** Stops what it registered and subscribed to; it registers nothing more. */
60
60
  function clear(run: WebExtensionRun): void;
61
+ /** A path of a file of a package, relative to it and inside it (`./models/rex.glb`, `models\rex.glb`: `models/rex.glb`). */
62
+ function packagePath(path: string): string;
61
63
  /** Subscribes for the extension: undone when it stops, or by the function returned. */
62
64
  function track(run: WebExtensionRun, subscribe: () => () => void): () => void;
63
65
  /**
@@ -59,6 +59,18 @@ export var WebExtensionRunUtil;
59
59
  }
60
60
  }
61
61
  WebExtensionRunUtil.clear = clear;
62
+ /** A path of a file of a package, relative to it and inside it (`./models/rex.glb`, `models\rex.glb`: `models/rex.glb`). */
63
+ function packagePath(path) {
64
+ const parts = path
65
+ .replace(/\\/g, '/')
66
+ .split('/')
67
+ .filter(part => part !== '' && part !== '.');
68
+ if (/^([a-z]:)?[\\/]/i.test(path) || parts.length === 0 || parts.includes('..')) {
69
+ throw new Error(`Not a file inside the package: ${path}`);
70
+ }
71
+ return parts.join('/');
72
+ }
73
+ WebExtensionRunUtil.packagePath = packagePath;
62
74
  /** Subscribes for the extension: undone when it stops, or by the function returned. */
63
75
  function track(run, subscribe) {
64
76
  if (run.stopped) {
@@ -6,6 +6,7 @@ import { TaSessionNotices } from '../notices/session-notices.js';
6
6
  import { TaScreen } from '../screen/screen-protocol.js';
7
7
  import { TaSettings } from '../settings/settings-protocol.js';
8
8
  import { TaState } from '../state/state-protocol.js';
9
+ import { TaTargets } from '../targets/targets-protocol.js';
9
10
  import { TaWorkbench } from '../workbench-protocol.js';
10
11
  import { WebEditorTabs } from './web-editor-tabs.js';
11
12
  import type { WebExtensionFactory } from './web-extension-api.js';
@@ -33,6 +34,7 @@ export declare abstract class WebExtensionsRunning {
33
34
  protected readonly persisted: TaState;
34
35
  protected readonly sessionNotices: TaSessionNotices;
35
36
  protected readonly screen: TaScreen;
37
+ protected readonly targets: TaTargets;
36
38
  readonly builtins: BuiltinWebExtension[];
37
39
  readonly tasks: WebTaskBoard;
38
40
  readonly home: WebHomeBoard;
@@ -19,6 +19,7 @@ import { WebSandbox } from '../sandbox/web-sandbox.js';
19
19
  import { TaScreen } from '../screen/screen-protocol.js';
20
20
  import { TaSettings } from '../settings/settings-protocol.js';
21
21
  import { TaState } from '../state/state-protocol.js';
22
+ import { TaTargets } from '../targets/targets-protocol.js';
22
23
  import { TaWorkbench } from '../workbench-protocol.js';
23
24
  import { WebAccessUtil } from './web-access.js';
24
25
  import { WebEditorTabs } from './web-editor-tabs.js';
@@ -434,6 +435,10 @@ __decorate([
434
435
  Autowired(TaScreen),
435
436
  __metadata("design:type", Object)
436
437
  ], WebExtensionsRunning.prototype, "screen", void 0);
438
+ __decorate([
439
+ Autowired(TaTargets),
440
+ __metadata("design:type", Object)
441
+ ], WebExtensionsRunning.prototype, "targets", void 0);
437
442
  __decorate([
438
443
  Autowired(BuiltinWebExtension),
439
444
  Optional(),
@@ -259,6 +259,7 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl extends WebExtensionsRunning
259
259
  sessionNotices: this.sessionNotices,
260
260
  persisted: this.persisted,
261
261
  screen: this.screen,
262
+ targets: this.targets,
262
263
  };
263
264
  }
264
265
  };
@@ -93,6 +93,12 @@ export declare class GameControl {
93
93
  press(at: GamePoint, ms: number): Promise<void>;
94
94
  /** Presses a key for `ms`, on the game's element. */
95
95
  key(key: GameKey, ms?: number): Promise<void>;
96
+ /** Half a tap, the pointer pressed (`down`) or let go there: for a program that times its own presses. */
97
+ pointerPress(at: GamePoint, down: boolean): void;
98
+ /** The pointer moved by `dx`, `dy` CSS pixels where it is, as a locked pointer turns a view (`movementX`, `movementY`). */
99
+ nudge(dx: number, dy: number): void;
100
+ /** Half a key press, down or up, on the game's element. */
101
+ keyPress(key: GameKey, down: boolean): void;
96
102
  /** Where Ta's pointer is on the canvas, once it was there. */
97
103
  get at(): GamePoint | undefined;
98
104
  /**
@@ -185,6 +185,34 @@ export class GameControl {
185
185
  this.keyEvent('keyup', key);
186
186
  }
187
187
  }
188
+ /** Half a tap, the pointer pressed (`down`) or let go there: for a program that times its own presses. */
189
+ pointerPress(at, down) {
190
+ if (down) {
191
+ this.down(at);
192
+ }
193
+ else {
194
+ this.up(at, true);
195
+ }
196
+ }
197
+ /** The pointer moved by `dx`, `dy` CSS pixels where it is, as a locked pointer turns a view (`movementX`, `movementY`). */
198
+ nudge(dx, dy) {
199
+ var _a, _b;
200
+ const at = (_a = this.last) !== null && _a !== void 0 ? _a : { x: 0.5, y: 0.5 };
201
+ const canvas = this.canvas();
202
+ const view = this.view();
203
+ const init = { ...this.init(canvas, at, 0), movementX: dx, movementY: dy };
204
+ canvas.dispatchEvent(new ((_b = view.PointerEvent) !== null && _b !== void 0 ? _b : view.MouseEvent)('pointermove', {
205
+ ...init,
206
+ pointerId: GameControlUtil.POINTER_ID,
207
+ pointerType: 'mouse',
208
+ isPrimary: true,
209
+ }));
210
+ canvas.dispatchEvent(new view.MouseEvent('mousemove', init));
211
+ }
212
+ /** Half a key press, down or up, on the game's element. */
213
+ keyPress(key, down) {
214
+ this.keyEvent(down ? 'keydown' : 'keyup', key);
215
+ }
188
216
  /** Where Ta's pointer is on the canvas, once it was there. */
189
217
  get at() {
190
218
  return this.last;
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { type TaScreen } from '../screen/screen-protocol.js';
3
3
  import type { TaSettings } from '../settings/settings-protocol.js';
4
- import type { GamePage, GameState } from './game-protocol.js';
4
+ import type { TaTargets } from '../targets/targets-protocol.js';
5
+ import type { GameObservation, GamePage, GameState } from './game-protocol.js';
5
6
  /** What GameHost drives of a game of either engine (GameRunner, Game3DRunner). */
6
7
  export interface GameHostRunner {
7
8
  setPage(page: GamePage): void;
@@ -12,6 +13,10 @@ export interface GameHostRunner {
12
13
  readonly sleeping?: boolean;
13
14
  /** What the game says of its round (GameState). */
14
15
  state?(): GameState | undefined;
16
+ /** What is in it now, for a program that plays it (GameObservation). */
17
+ observe?(): GameObservation | undefined;
18
+ /** Waits for a slow player, and goes on. */
19
+ setPaused?(paused: boolean): void;
15
20
  dispose(): void;
16
21
  }
17
22
  /** Starts the game in `element` once its engine is loaded; `fail` for what goes wrong after it started. */
@@ -23,6 +28,8 @@ export interface GameHostProps {
23
28
  title?: string;
24
29
  /** The screen it is a part of, for Ta to see and play it; none on a page Ta does not work (a shared page). */
25
30
  screen?: TaScreen;
31
+ /** The targets of the page, for a program to play it frame by frame (docs/design/ta-reflex.md); none where none plays. */
32
+ targets?: TaTargets;
26
33
  className?: string;
27
34
  style?: React.CSSProperties;
28
35
  }
@@ -36,4 +43,4 @@ export interface GameHostProps {
36
43
  * It is a part of the screen (`game`, GameControl): Ta sees how it stands and taps, moves, presses keys and holds on it
37
44
  * for the user, by events on its canvas that no gesture of the shell starts from.
38
45
  */
39
- export declare function GameHost({ settings: store, start, title, screen, className, style }: GameHostProps): React.JSX.Element;
46
+ export declare function GameHost({ settings: store, start, title, screen, targets, className, style }: GameHostProps): React.JSX.Element;
@@ -6,6 +6,7 @@ import { OwnGestures } from '../device/own-gestures.js';
6
6
  import { useT } from '../i18n/use-t.js';
7
7
  import { ScreenUtil } from '../screen/screen-protocol.js';
8
8
  import { GameControl, GameControlUtil } from './game-control.js';
9
+ import { GameTarget } from './game-target.js';
9
10
  import { GameUtil } from './game-util.js';
10
11
  /**
11
12
  * The element of a game of a web extension (`ui.Game`, `ui.Game3D`): it fills its parent, starts the game
@@ -17,7 +18,7 @@ import { GameUtil } from './game-util.js';
17
18
  * It is a part of the screen (`game`, GameControl): Ta sees how it stands and taps, moves, presses keys and holds on it
18
19
  * for the user, by events on its canvas that no gesture of the shell starts from.
19
20
  */
20
- export function GameHost({ settings: store, start, title, screen, className, style }) {
21
+ export function GameHost({ settings: store, start, title, screen, targets, className, style }) {
21
22
  var _a;
22
23
  const t = useT();
23
24
  const settings = React.useSyncExternalStore(listener => store.subscribe(listener), () => store.state);
@@ -40,6 +41,9 @@ export function GameHost({ settings: store, start, title, screen, className, sty
40
41
  (_a = partId.current) !== null && _a !== void 0 ? _a : (partId.current = GameControlUtil.partId());
41
42
  part.current = GameControl.spec(partId.current, title || t('ta.game.label'), { point: t('ta.game.point'), move: t('ta.game.move'), key: t('ta.game.key'), hold: t('ta.game.hold') }, () => { var _a, _b, _c; return ({ started: !!runner.current, sleeping: (_a = runner.current) === null || _a === void 0 ? void 0 : _a.sleeping, error: errorOf.current, state: (_c = (_b = runner.current) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.call(_b) }); }, () => control.current);
42
43
  React.useEffect(() => screen === null || screen === void 0 ? void 0 : screen.register(() => part.current), [screen]);
44
+ const named = React.useRef(title);
45
+ named.current = title || t('ta.game.label');
46
+ React.useEffect(() => targets === null || targets === void 0 ? void 0 : targets.register(GameTarget.spec(partId.current, () => named.current, () => runner.current, () => control.current)), [targets]);
43
47
  React.useEffect(() => {
44
48
  const element = host.current;
45
49
  if (!element) {