@celljs/ta-sync 4.15.2 → 4.17.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 (3) hide show
  1. package/host/index.mjs +1154 -755
  2. package/package.json +4 -4
  3. package/web/index.js +138 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-sync",
3
- "version": "4.15.2",
3
+ "version": "4.17.0",
4
4
  "description": "A pi package for Ta: the user's settings, instructions, skills, extensions and the data extensions declare, the same on each of their computers, through a room of the relay sealed end to end, without an account",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -26,9 +26,9 @@
26
26
  "watch": "tsc -b -w --preserveWatchOutput"
27
27
  },
28
28
  "devDependencies": {
29
- "@celljs/ta-protocol": "4.15.2",
30
- "@celljs/ta-relay": "4.15.2",
31
- "@celljs/ta-web": "4.15.2",
29
+ "@celljs/ta-protocol": "4.17.0",
30
+ "@celljs/ta-relay": "4.17.0",
31
+ "@celljs/ta-web": "4.17.0",
32
32
  "@types/react": "^19.3.0"
33
33
  },
34
34
  "publishConfig": {
package/web/index.js CHANGED
@@ -426,6 +426,16 @@ var en2 = {
426
426
  waitingCompare: "Compare it with the code on the old computer, then allow it there.",
427
427
  compareHint: "Allow only if the new computer shows the same code.",
428
428
  doneFrom: "Moved from {name}",
429
+ missingTitle: "Folders not on this computer",
430
+ missingLead: "{n} conversations work in folders this computer does not have. Point each to where it is here and they carry on there.",
431
+ missingCount: "{n} conversations",
432
+ missingFound: "Likely {path}",
433
+ missingNone: "Not found here",
434
+ missingUse: "Use this",
435
+ missingPick: "Choose…",
436
+ missingUseAll: "Use all found",
437
+ missingMoved: "{n} conversations now work in {dir}",
438
+ missingBusy: "{n} running now: move them once they end",
429
439
  factConversations: "conversations",
430
440
  factItems: "settings and the like",
431
441
  factData: "extensions' data",
@@ -515,6 +525,16 @@ var zh2 = {
515
525
  waitingCompare: "核对旧电脑上显示的数字,一致后在旧电脑上点同意。",
516
526
  compareHint: "新电脑上显示的数字一致时再同意。",
517
527
  doneFrom: "已从 {name} 迁入",
528
+ missingTitle: "这台电脑上找不到的目录",
529
+ missingLead: "有 {n} 个对话的目录在这台电脑上不存在。给每个目录指到这里的位置,对话就在那里接着做。",
530
+ missingCount: "{n} 个对话",
531
+ missingFound: "可能在 {path}",
532
+ missingNone: "这里没找到",
533
+ missingUse: "就用这里",
534
+ missingPick: "选位置…",
535
+ missingUseAll: "全部按找到的改",
536
+ missingMoved: "{n} 个对话已改到 {dir}",
537
+ missingBusy: "{n} 个正在运行,结束后再改",
518
538
  factConversations: "个对话",
519
539
  factItems: "项设置等",
520
540
  factData: "个扩展的数据",
@@ -604,6 +624,16 @@ var zhTw2 = {
604
624
  waitingCompare: "核對舊電腦上顯示的數字,一致後在舊電腦上點同意。",
605
625
  compareHint: "新電腦上顯示的數字一致時再同意。",
606
626
  doneFrom: "已從 {name} 遷入",
627
+ missingTitle: "這台電腦上找不到的目錄",
628
+ missingLead: "有 {n} 個對話的目錄在這台電腦上不存在。把每個目錄指到這裡的位置,對話就在那裡接著做。",
629
+ missingCount: "{n} 個對話",
630
+ missingFound: "可能在 {path}",
631
+ missingNone: "這裡沒找到",
632
+ missingUse: "就用這裡",
633
+ missingPick: "選位置…",
634
+ missingUseAll: "全部按找到的改",
635
+ missingMoved: "{n} 個對話已改到 {dir}",
636
+ missingBusy: "{n} 個正在執行,結束後再改",
607
637
  factConversations: "個對話",
608
638
  factItems: "項設定等",
609
639
  factData: "個擴充功能的資料",
@@ -693,6 +723,16 @@ var ja2 = {
693
723
  waitingCompare: "古いコンピューターに表示される番号を確認し、一致したら古いコンピューターで同意をクリックします。",
694
724
  compareHint: "新しいコンピューターに表示される番号が一致したら同意します。",
695
725
  doneFrom: "{name}から移動しました",
726
+ missingTitle: "このコンピューターにないフォルダー",
727
+ missingLead: "{n} 件の会話のフォルダーがこのコンピューターにありません。それぞれをここでの場所に指定すると、そこで続けられます。",
728
+ missingCount: "{n} 件の会話",
729
+ missingFound: "{path} かもしれません",
730
+ missingNone: "ここには見つかりません",
731
+ missingUse: "ここを使う",
732
+ missingPick: "場所を選ぶ…",
733
+ missingUseAll: "見つかった場所をすべて使う",
734
+ missingMoved: "{n} 件の会話を {dir} に移しました",
735
+ missingBusy: "{n} 件は実行中です。終わってから移してください",
696
736
  factConversations: "件の会話",
697
737
  factItems: "個の設定など",
698
738
  factData: "個の拡張機能のデータ",
@@ -1308,7 +1348,10 @@ function InView({ pi, store, into }) {
1308
1348
  className: "tsy-line"
1309
1349
  }, words.replacedLead, " ", /* @__PURE__ */ React.createElement("span", {
1310
1350
  className: "tsy-path"
1311
- }, report.replaced)), /* @__PURE__ */ React.createElement("div", {
1351
+ }, report.replaced)), report.missing?.length ? /* @__PURE__ */ React.createElement(MissingFolders, {
1352
+ pi,
1353
+ initial: report.missing
1354
+ }) : null, /* @__PURE__ */ React.createElement("div", {
1312
1355
  className: "tsy-actions tsy-end"
1313
1356
  }, report.extensions ? /* @__PURE__ */ React.createElement(Action, {
1314
1357
  pi,
@@ -1325,6 +1368,85 @@ function InView({ pi, store, into }) {
1325
1368
  run: () => store.call("migrateCloseIn")
1326
1369
  })));
1327
1370
  }
1371
+ function MissingFolders({ pi, initial }) {
1372
+ const words = useWords(pi);
1373
+ const [missing, setMissing] = React.useState(initial);
1374
+ const [picking, setPicking] = React.useState();
1375
+ React.useEffect(() => {
1376
+ if (!initial) {
1377
+ pi.callHost("migrateMissing").then(setMissing, () => setMissing([]));
1378
+ }
1379
+ }, [pi, initial]);
1380
+ if (!missing?.length) {
1381
+ return null;
1382
+ }
1383
+ const relocate = async (each, to) => {
1384
+ const result = await pi.callHost("migrateRelocate", each.dir, to);
1385
+ if (result.conversations) {
1386
+ pi.ui.notify(MoveWordsUtil.format(words.missingMoved, { n: result.conversations, dir: to }));
1387
+ }
1388
+ if (result.busy) {
1389
+ pi.ui.notify(MoveWordsUtil.format(words.missingBusy, { n: result.busy }), "warning");
1390
+ } else {
1391
+ setMissing((list) => list?.filter((other) => other.dir !== each.dir));
1392
+ }
1393
+ };
1394
+ const found = missing.filter((each) => each.suggestion);
1395
+ const total = missing.reduce((sum, each) => sum + each.conversations, 0);
1396
+ return /* @__PURE__ */ React.createElement("div", {
1397
+ className: "tsy-missing"
1398
+ }, /* @__PURE__ */ React.createElement("p", {
1399
+ className: "tsy-big"
1400
+ }, words.missingTitle), /* @__PURE__ */ React.createElement("p", {
1401
+ className: "tsy-line"
1402
+ }, MoveWordsUtil.format(words.missingLead, { n: total })), missing.map((each) => /* @__PURE__ */ React.createElement("div", {
1403
+ key: each.dir,
1404
+ className: "tsy-missing-row"
1405
+ }, /* @__PURE__ */ React.createElement("div", {
1406
+ className: "tsy-missing-text"
1407
+ }, /* @__PURE__ */ React.createElement("span", {
1408
+ className: "tsy-missing-name",
1409
+ title: each.dir
1410
+ }, each.dir.split(/[\\/]+/).filter(Boolean).pop() ?? each.dir, /* @__PURE__ */ React.createElement("span", {
1411
+ className: "tsy-missing-count"
1412
+ }, MoveWordsUtil.format(words.missingCount, { n: each.conversations }))), /* @__PURE__ */ React.createElement("span", {
1413
+ className: "tsy-path"
1414
+ }, each.dir), /* @__PURE__ */ React.createElement("span", {
1415
+ className: `tsy-line${each.suggestion ? "" : " tsy-warn"}`
1416
+ }, each.suggestion ? MoveWordsUtil.format(words.missingFound, { path: each.suggestion }) : words.missingNone)), /* @__PURE__ */ React.createElement("div", {
1417
+ className: "tsy-actions"
1418
+ }, /* @__PURE__ */ React.createElement("button", {
1419
+ type: "button",
1420
+ className: "ta-button ta-small",
1421
+ onClick: () => setPicking(each)
1422
+ }, words.missingPick), each.suggestion && /* @__PURE__ */ React.createElement(Action, {
1423
+ pi,
1424
+ primary: true,
1425
+ label: words.missingUse,
1426
+ run: () => relocate(each, each.suggestion)
1427
+ })))), found.length > 1 && /* @__PURE__ */ React.createElement("div", {
1428
+ className: "tsy-actions tsy-end"
1429
+ }, /* @__PURE__ */ React.createElement(Action, {
1430
+ pi,
1431
+ label: words.missingUseAll,
1432
+ run: async () => {
1433
+ for (const each of found) {
1434
+ await relocate(each, each.suggestion);
1435
+ }
1436
+ }
1437
+ })), picking && /* @__PURE__ */ React.createElement(pi.ui.FolderPicker, {
1438
+ initial: picking.suggestion,
1439
+ onPick: async (path) => {
1440
+ try {
1441
+ await relocate(picking, path);
1442
+ setPicking(undefined);
1443
+ } catch (error) {
1444
+ pi.ui.notify(MoveWordsUtil.format(words.failed, { message: message(error) }), "error");
1445
+ }
1446
+ },
1447
+ onClose: () => setPicking(undefined)
1448
+ }));
1449
+ }
1328
1450
  function ReceiveView({ pi, store, status }) {
1329
1451
  const words = useWords(pi);
1330
1452
  const [link, setLink] = React.useState("");
@@ -1552,7 +1674,9 @@ function MovePanel({ pi, store }) {
1552
1674
  pi,
1553
1675
  store,
1554
1676
  chosen
1555
- })));
1677
+ })), /* @__PURE__ */ React.createElement(MissingFolders, {
1678
+ pi
1679
+ }));
1556
1680
  }
1557
1681
  function MoveAskDialog({ pi, store, close }) {
1558
1682
  const words = useWords(pi);
@@ -2210,6 +2334,13 @@ var STYLE = `
2210
2334
  .tsy-dot.tsy-on { background: var(--ta-green); }
2211
2335
  .tsy-line { margin: 0; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); line-height: calc(18px * var(--ta-font-scale)); overflow-wrap: anywhere; }
2212
2336
  .tsy-line.tsy-warn { color: var(--ta-yellow); }
2337
+ .tsy-missing { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--ta-border); }
2338
+ .tsy-missing-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--ta-raised); }
2339
+ .tsy-missing-text { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
2340
+ .tsy-missing-name { display: flex; align-items: baseline; gap: 8px; color: var(--ta-text); font-size: calc(14px * var(--ta-font-scale)); font-weight: 500; }
2341
+ .tsy-missing-count { color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); font-weight: 400; font-variant-numeric: tabular-nums; }
2342
+ .tsy-missing-row .tsy-actions { flex: none; }
2343
+ @media (max-width: 520px) { .tsy-missing-row { flex-direction: column; align-items: stretch; } .tsy-missing-row .tsy-actions { justify-content: flex-end; } }
2213
2344
  .tsy-link { padding: 2px 4px; border: 0; border-radius: 6px; background: none; color: var(--ta-link); font: inherit; font-size: calc(12px * var(--ta-font-scale)); cursor: pointer; }
2214
2345
  .tsy-link:hover { background: var(--ta-hover); }
2215
2346
  .tsy-link.tsy-danger { color: var(--ta-red); }
@@ -2223,7 +2354,7 @@ var STYLE = `
2223
2354
  .tsy-field { width: 100%; box-sizing: border-box; height: 36px; padding: 0 10px; border: 1px solid var(--ta-border-field); border-radius: 8px; background: transparent; color: var(--ta-text); font: inherit; font-size: calc(13px * var(--ta-font-scale)); }
2224
2355
  [data-touch] .tsy-field { font-size: max(16px, calc(13px * var(--ta-font-scale))); }
2225
2356
  .tsy-error { margin: 0; color: var(--ta-red); font-size: calc(12px * var(--ta-font-scale)); }
2226
- .tsy-page { padding: 24px 20px 40px; max-width: 640px; margin: 0 auto; width: 100%; box-sizing: border-box; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; }
2357
+ .tsy-page { padding: 24px 20px 40px; max-width: var(--ta-page-width); margin: 0 auto; width: 100%; box-sizing: border-box; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; }
2227
2358
  .tsy-page h2 { margin: 0; font-size: calc(15px * var(--ta-font-scale)); font-weight: 600; color: var(--ta-text); }
2228
2359
  .tsy-what { display: flex; flex-direction: column; border: 1px solid var(--ta-border-muted); border-radius: 12px; }
2229
2360
  .tsy-what-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
@@ -2295,6 +2426,7 @@ function settings(pi, store) {
2295
2426
  return {
2296
2427
  title: () => words().title,
2297
2428
  icon: pi.ui.icons.RefreshCw,
2429
+ group: "devices",
2298
2430
  rows: [
2299
2431
  {
2300
2432
  key: "devices",
@@ -2347,6 +2479,7 @@ function activate(pi) {
2347
2479
  pi.registerSettings({
2348
2480
  title: () => MoveWordsUtil.of(pi.ui.language).title,
2349
2481
  icon: pi.ui.icons.FolderInput,
2482
+ group: "devices",
2350
2483
  rows: [
2351
2484
  {
2352
2485
  key: "move",
@@ -2363,7 +2496,7 @@ function activate(pi) {
2363
2496
  pi.registerView("move", {
2364
2497
  title: () => MoveWordsUtil.of(pi.ui.language).title,
2365
2498
  icon: pi.ui.icons.FolderInput,
2366
- discover: true,
2499
+ navigation: false,
2367
2500
  render: () => /* @__PURE__ */ React.createElement("div", {
2368
2501
  className: "tsy-page"
2369
2502
  }, /* @__PURE__ */ React.createElement(MovePanel, {
@@ -2392,7 +2525,7 @@ function activate(pi) {
2392
2525
  pi.registerView("devices", {
2393
2526
  title: () => SyncWords.of(pi.ui.language).title,
2394
2527
  icon: pi.ui.icons.RefreshCw,
2395
- discover: true,
2528
+ navigation: false,
2396
2529
  render: () => /* @__PURE__ */ React.createElement(SyncPage, {
2397
2530
  pi,
2398
2531
  store