@keepkit/ui 0.24.0 → 0.25.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.
- package/README.md +8 -8
- package/dist/index.d.ts +34 -7
- package/dist/index.js +711 -436
- package/dist/index.js.map +1 -1
- package/dist/styles/collection.css +18 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -50,7 +50,8 @@ function useKeepUrlSync({
|
|
|
50
50
|
...decoded.search ? { search: decoded.search } : { search: void 0 },
|
|
51
51
|
...decoded.tags ? { tags: decoded.tags } : { tags: void 0 },
|
|
52
52
|
...decoded.sort ? { sort: decoded.sort } : {},
|
|
53
|
-
...decoded.pagination ? { pagination: { ...previousQuery.pagination, ...decoded.pagination } } : {}
|
|
53
|
+
...decoded.pagination ? { pagination: { ...previousQuery.pagination, ...decoded.pagination } } : {},
|
|
54
|
+
...decoded.archiveScope !== void 0 ? { archived: decoded.archived, archiveScope: decoded.archiveScope } : decoded.archived !== void 0 ? { archived: decoded.archived, archiveScope: void 0 } : { archived: void 0, archiveScope: void 0 }
|
|
54
55
|
}));
|
|
55
56
|
};
|
|
56
57
|
read();
|
|
@@ -190,7 +191,12 @@ var DE_LABELS = {
|
|
|
190
191
|
backupRecoveryDescription: "Wenn lokale Synchronisierungsdaten besch\xE4digt sind, stellen Sie ein g\xFCltiges JSON-Backup wieder her.",
|
|
191
192
|
syncPending: "\xC4nderungen warten auf die Synchronisierung.",
|
|
192
193
|
syncSynced: "Alle \xC4nderungen sind synchronisiert.",
|
|
193
|
-
syncConflict: "Einige \xC4nderungen ben\xF6tigen eine Konfliktl\xF6sung."
|
|
194
|
+
syncConflict: "Einige \xC4nderungen ben\xF6tigen eine Konfliktl\xF6sung.",
|
|
195
|
+
archiveScope: "Archivbereich",
|
|
196
|
+
archiveScopeActive: "Aktiv",
|
|
197
|
+
archiveScopeArchived: "Archiviert",
|
|
198
|
+
archiveScopeAll: "Alle Elemente",
|
|
199
|
+
undoReorder: "Sortierung r\xFCckg\xE4ngig machen"
|
|
194
200
|
};
|
|
195
201
|
|
|
196
202
|
// src/locales/en.ts
|
|
@@ -289,7 +295,12 @@ var EN_LABELS = {
|
|
|
289
295
|
backupRecoveryDescription: "If local sync data is damaged, restore a known-good JSON backup.",
|
|
290
296
|
syncPending: "Changes are waiting to sync.",
|
|
291
297
|
syncSynced: "All changes are synced.",
|
|
292
|
-
syncConflict: "Some changes need conflict resolution."
|
|
298
|
+
syncConflict: "Some changes need conflict resolution.",
|
|
299
|
+
archiveScope: "Archive scope",
|
|
300
|
+
archiveScopeActive: "Active",
|
|
301
|
+
archiveScopeArchived: "Archived",
|
|
302
|
+
archiveScopeAll: "All items",
|
|
303
|
+
undoReorder: "Undo reorder"
|
|
293
304
|
};
|
|
294
305
|
|
|
295
306
|
// src/locales/es.ts
|
|
@@ -388,7 +399,12 @@ var ES_LABELS = {
|
|
|
388
399
|
backupRecoveryDescription: "Si los datos locales est\xE1n da\xF1ados, restaura una copia JSON v\xE1lida.",
|
|
389
400
|
syncPending: "Hay cambios pendientes de sincronizaci\xF3n.",
|
|
390
401
|
syncSynced: "Todos los cambios est\xE1n sincronizados.",
|
|
391
|
-
syncConflict: "Algunos cambios necesitan resolver un conflicto."
|
|
402
|
+
syncConflict: "Algunos cambios necesitan resolver un conflicto.",
|
|
403
|
+
archiveScope: "\xC1mbito del archivo",
|
|
404
|
+
archiveScopeActive: "Activos",
|
|
405
|
+
archiveScopeArchived: "Archivados",
|
|
406
|
+
archiveScopeAll: "Todos los elementos",
|
|
407
|
+
undoReorder: "Deshacer ordenaci\xF3n"
|
|
392
408
|
};
|
|
393
409
|
|
|
394
410
|
// src/locales/fil.ts
|
|
@@ -487,7 +503,12 @@ var FIL_LABELS = {
|
|
|
487
503
|
backupRecoveryDescription: "Kung sira ang lokal na sync data, mag-restore ng gumaganang JSON backup.",
|
|
488
504
|
syncPending: "May mga pagbabagong naghihintay ng sync.",
|
|
489
505
|
syncSynced: "Naka-sync na ang lahat ng pagbabago.",
|
|
490
|
-
syncConflict: "May mga pagbabagong kailangang ayusin ang conflict."
|
|
506
|
+
syncConflict: "May mga pagbabagong kailangang ayusin ang conflict.",
|
|
507
|
+
archiveScope: "Saklaw ng archive",
|
|
508
|
+
archiveScopeActive: "Aktibo",
|
|
509
|
+
archiveScopeArchived: "Naka-archive",
|
|
510
|
+
archiveScopeAll: "Lahat ng item",
|
|
511
|
+
undoReorder: "I-undo ang pag-aayos"
|
|
491
512
|
};
|
|
492
513
|
|
|
493
514
|
// src/locales/fr.ts
|
|
@@ -586,7 +607,12 @@ var FR_LABELS = {
|
|
|
586
607
|
backupRecoveryDescription: "Si les donn\xE9es locales sont endommag\xE9es, restaurez une sauvegarde JSON valide.",
|
|
587
608
|
syncPending: "Des modifications attendent la synchronisation.",
|
|
588
609
|
syncSynced: "Toutes les modifications sont synchronis\xE9es.",
|
|
589
|
-
syncConflict: "Certaines modifications n\xE9cessitent une r\xE9solution de conflit."
|
|
610
|
+
syncConflict: "Certaines modifications n\xE9cessitent une r\xE9solution de conflit.",
|
|
611
|
+
archiveScope: "P\xE9rim\xE8tre des archives",
|
|
612
|
+
archiveScopeActive: "Actifs",
|
|
613
|
+
archiveScopeArchived: "Archiv\xE9s",
|
|
614
|
+
archiveScopeAll: "Tous les \xE9l\xE9ments",
|
|
615
|
+
undoReorder: "Annuler le r\xE9ordonnancement"
|
|
590
616
|
};
|
|
591
617
|
|
|
592
618
|
// src/locales/id.ts
|
|
@@ -685,7 +711,12 @@ var ID_LABELS = {
|
|
|
685
711
|
backupRecoveryDescription: "Jika data sinkronisasi lokal rusak, pulihkan cadangan JSON yang valid.",
|
|
686
712
|
syncPending: "Ada perubahan yang menunggu sinkronisasi.",
|
|
687
713
|
syncSynced: "Semua perubahan telah disinkronkan.",
|
|
688
|
-
syncConflict: "Beberapa perubahan memerlukan penyelesaian konflik."
|
|
714
|
+
syncConflict: "Beberapa perubahan memerlukan penyelesaian konflik.",
|
|
715
|
+
archiveScope: "Cakupan arsip",
|
|
716
|
+
archiveScopeActive: "Aktif",
|
|
717
|
+
archiveScopeArchived: "Diarsipkan",
|
|
718
|
+
archiveScopeAll: "Semua item",
|
|
719
|
+
undoReorder: "Batalkan pengurutan"
|
|
689
720
|
};
|
|
690
721
|
|
|
691
722
|
// src/locales/it.ts
|
|
@@ -784,7 +815,12 @@ var IT_LABELS = {
|
|
|
784
815
|
backupRecoveryDescription: "Se i dati locali sono danneggiati, ripristina un backup JSON valido.",
|
|
785
816
|
syncPending: "Ci sono modifiche in attesa di sincronizzazione.",
|
|
786
817
|
syncSynced: "Tutte le modifiche sono sincronizzate.",
|
|
787
|
-
syncConflict: "Alcune modifiche richiedono la risoluzione di un conflitto."
|
|
818
|
+
syncConflict: "Alcune modifiche richiedono la risoluzione di un conflitto.",
|
|
819
|
+
archiveScope: "Ambito archivio",
|
|
820
|
+
archiveScopeActive: "Attivi",
|
|
821
|
+
archiveScopeArchived: "Archiviati",
|
|
822
|
+
archiveScopeAll: "Tutti gli elementi",
|
|
823
|
+
undoReorder: "Annulla riordinamento"
|
|
788
824
|
};
|
|
789
825
|
|
|
790
826
|
// src/locales/ja.ts
|
|
@@ -883,7 +919,12 @@ var JA_LABELS = {
|
|
|
883
919
|
backupRecoveryDescription: "\u30ED\u30FC\u30AB\u30EB\u306E\u540C\u671F\u30C7\u30FC\u30BF\u304C\u7834\u640D\u3057\u305F\u5834\u5408\u306F\u3001\u6B63\u5E38\u306AJSON\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u304B\u3089\u5FA9\u5143\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
884
920
|
syncPending: "\u540C\u671F\u5F85\u3061\u306E\u5909\u66F4\u304C\u3042\u308A\u307E\u3059\u3002",
|
|
885
921
|
syncSynced: "\u3059\u3079\u3066\u306E\u5909\u66F4\u3092\u540C\u671F\u3057\u307E\u3057\u305F\u3002",
|
|
886
|
-
syncConflict: "\u7AF6\u5408\u3057\u3066\u3044\u308B\u5909\u66F4\u304C\u3042\u308A\u307E\u3059\u3002\u89E3\u6C7A\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
|
|
922
|
+
syncConflict: "\u7AF6\u5408\u3057\u3066\u3044\u308B\u5909\u66F4\u304C\u3042\u308A\u307E\u3059\u3002\u89E3\u6C7A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
923
|
+
archiveScope: "\u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u7BC4\u56F2",
|
|
924
|
+
archiveScopeActive: "\u4FDD\u5B58\u4E2D",
|
|
925
|
+
archiveScopeArchived: "\u30A2\u30FC\u30AB\u30A4\u30D6\u6E08\u307F",
|
|
926
|
+
archiveScopeAll: "\u3059\u3079\u3066",
|
|
927
|
+
undoReorder: "\u4E26\u3073\u66FF\u3048\u3092\u5143\u306B\u623B\u3059"
|
|
887
928
|
};
|
|
888
929
|
|
|
889
930
|
// src/locales/ko.ts
|
|
@@ -982,7 +1023,12 @@ var KO_LABELS = {
|
|
|
982
1023
|
backupRecoveryDescription: "\uB85C\uCEEC \uB3D9\uAE30\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB41C \uACBD\uC6B0 \uC815\uC0C1\uC801\uC778 JSON \uBC31\uC5C5\uC744 \uBCF5\uC6D0\uD558\uC138\uC694.",
|
|
983
1024
|
syncPending: "\uB3D9\uAE30\uD654 \uB300\uAE30 \uC911\uC778 \uBCC0\uACBD \uC0AC\uD56D\uC774 \uC788\uC2B5\uB2C8\uB2E4.",
|
|
984
1025
|
syncSynced: "\uBAA8\uB4E0 \uBCC0\uACBD \uC0AC\uD56D\uC774 \uB3D9\uAE30\uD654\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",
|
|
985
|
-
syncConflict: "\uCDA9\uB3CC\uC744 \uD574\uACB0\uD574\uC57C \uD558\uB294 \uBCC0\uACBD \uC0AC\uD56D\uC774 \uC788\uC2B5\uB2C8\uB2E4."
|
|
1026
|
+
syncConflict: "\uCDA9\uB3CC\uC744 \uD574\uACB0\uD574\uC57C \uD558\uB294 \uBCC0\uACBD \uC0AC\uD56D\uC774 \uC788\uC2B5\uB2C8\uB2E4.",
|
|
1027
|
+
archiveScope: "\uBCF4\uAD00 \uBC94\uC704",
|
|
1028
|
+
archiveScopeActive: "\uD65C\uC131",
|
|
1029
|
+
archiveScopeArchived: "\uBCF4\uAD00\uB428",
|
|
1030
|
+
archiveScopeAll: "\uBAA8\uB4E0 \uD56D\uBAA9",
|
|
1031
|
+
undoReorder: "\uC815\uB82C \uC2E4\uD589 \uCDE8\uC18C"
|
|
986
1032
|
};
|
|
987
1033
|
|
|
988
1034
|
// src/locales/ms.ts
|
|
@@ -1081,7 +1127,12 @@ var MS_LABELS = {
|
|
|
1081
1127
|
backupRecoveryDescription: "Jika data penyegerakan setempat rosak, pulihkan sandaran JSON yang sah.",
|
|
1082
1128
|
syncPending: "Terdapat perubahan yang menunggu penyegerakan.",
|
|
1083
1129
|
syncSynced: "Semua perubahan telah disegerakkan.",
|
|
1084
|
-
syncConflict: "Sesetengah perubahan memerlukan penyelesaian konflik."
|
|
1130
|
+
syncConflict: "Sesetengah perubahan memerlukan penyelesaian konflik.",
|
|
1131
|
+
archiveScope: "Skop arkib",
|
|
1132
|
+
archiveScopeActive: "Aktif",
|
|
1133
|
+
archiveScopeArchived: "Diarkibkan",
|
|
1134
|
+
archiveScopeAll: "Semua item",
|
|
1135
|
+
undoReorder: "Buat asal susunan"
|
|
1085
1136
|
};
|
|
1086
1137
|
|
|
1087
1138
|
// src/locales/pt-BR.ts
|
|
@@ -1180,7 +1231,12 @@ var PT_BR_LABELS = {
|
|
|
1180
1231
|
backupRecoveryDescription: "Se os dados locais estiverem corrompidos, restaure um backup JSON v\xE1lido.",
|
|
1181
1232
|
syncPending: "H\xE1 altera\xE7\xF5es aguardando sincroniza\xE7\xE3o.",
|
|
1182
1233
|
syncSynced: "Todas as altera\xE7\xF5es foram sincronizadas.",
|
|
1183
|
-
syncConflict: "Algumas altera\xE7\xF5es precisam de resolu\xE7\xE3o de conflito."
|
|
1234
|
+
syncConflict: "Algumas altera\xE7\xF5es precisam de resolu\xE7\xE3o de conflito.",
|
|
1235
|
+
archiveScope: "Escopo do arquivo",
|
|
1236
|
+
archiveScopeActive: "Ativos",
|
|
1237
|
+
archiveScopeArchived: "Arquivados",
|
|
1238
|
+
archiveScopeAll: "Todos os itens",
|
|
1239
|
+
undoReorder: "Desfazer reordena\xE7\xE3o"
|
|
1184
1240
|
};
|
|
1185
1241
|
|
|
1186
1242
|
// src/locales/ru.ts
|
|
@@ -1279,7 +1335,12 @@ var RU_LABELS = {
|
|
|
1279
1335
|
backupRecoveryDescription: "\u0415\u0441\u043B\u0438 \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435 \u0441\u0438\u043D\u0445\u0440\u043E\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u043F\u043E\u0432\u0440\u0435\u0436\u0434\u0435\u043D\u044B, \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0435 \u0440\u0430\u0431\u043E\u0447\u0443\u044E JSON-\u043A\u043E\u043F\u0438\u044E.",
|
|
1280
1336
|
syncPending: "\u0415\u0441\u0442\u044C \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F, \u043E\u0436\u0438\u0434\u0430\u044E\u0449\u0438\u0435 \u0441\u0438\u043D\u0445\u0440\u043E\u043D\u0438\u0437\u0430\u0446\u0438\u0438.",
|
|
1281
1337
|
syncSynced: "\u0412\u0441\u0435 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u0441\u0438\u043D\u0445\u0440\u043E\u043D\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u043D\u044B.",
|
|
1282
|
-
syncConflict: "\u041D\u0435\u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u0442\u0440\u0435\u0431\u0443\u044E\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u044F \u043A\u043E\u043D\u0444\u043B\u0438\u043A\u0442\u0430."
|
|
1338
|
+
syncConflict: "\u041D\u0435\u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u0442\u0440\u0435\u0431\u0443\u044E\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u044F \u043A\u043E\u043D\u0444\u043B\u0438\u043A\u0442\u0430.",
|
|
1339
|
+
archiveScope: "\u041E\u0431\u043B\u0430\u0441\u0442\u044C \u0430\u0440\u0445\u0438\u0432\u0430",
|
|
1340
|
+
archiveScopeActive: "\u0410\u043A\u0442\u0438\u0432\u043D\u044B\u0435",
|
|
1341
|
+
archiveScopeArchived: "\u0412 \u0430\u0440\u0445\u0438\u0432\u0435",
|
|
1342
|
+
archiveScopeAll: "\u0412\u0441\u0435 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",
|
|
1343
|
+
undoReorder: "\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0443"
|
|
1283
1344
|
};
|
|
1284
1345
|
|
|
1285
1346
|
// src/locales/th.ts
|
|
@@ -1378,7 +1439,12 @@ var TH_LABELS = {
|
|
|
1378
1439
|
backupRecoveryDescription: "\u0E2B\u0E32\u0E01\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E0B\u0E34\u0E07\u0E04\u0E4C\u0E43\u0E19\u0E40\u0E04\u0E23\u0E37\u0E48\u0E2D\u0E07\u0E40\u0E2A\u0E35\u0E22\u0E2B\u0E32\u0E22 \u0E43\u0E2B\u0E49\u0E01\u0E39\u0E49\u0E04\u0E37\u0E19\u0E08\u0E32\u0E01\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E2A\u0E33\u0E23\u0E2D\u0E07 JSON \u0E17\u0E35\u0E48\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19\u0E44\u0E14\u0E49",
|
|
1379
1440
|
syncPending: "\u0E21\u0E35\u0E01\u0E32\u0E23\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E41\u0E1B\u0E25\u0E07\u0E17\u0E35\u0E48\u0E23\u0E2D\u0E01\u0E32\u0E23\u0E0B\u0E34\u0E07\u0E04\u0E4C",
|
|
1380
1441
|
syncSynced: "\u0E0B\u0E34\u0E07\u0E04\u0E4C\u0E01\u0E32\u0E23\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E41\u0E1B\u0E25\u0E07\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14\u0E41\u0E25\u0E49\u0E27",
|
|
1381
|
-
syncConflict: "\u0E21\u0E35\u0E01\u0E32\u0E23\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E41\u0E1B\u0E25\u0E07\u0E17\u0E35\u0E48\u0E15\u0E49\u0E2D\u0E07\u0E41\u0E01\u0E49\u0E44\u0E02\u0E02\u0E49\u0E2D\u0E02\u0E31\u0E14\u0E41\u0E22\u0E49\u0E07"
|
|
1442
|
+
syncConflict: "\u0E21\u0E35\u0E01\u0E32\u0E23\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E41\u0E1B\u0E25\u0E07\u0E17\u0E35\u0E48\u0E15\u0E49\u0E2D\u0E07\u0E41\u0E01\u0E49\u0E44\u0E02\u0E02\u0E49\u0E2D\u0E02\u0E31\u0E14\u0E41\u0E22\u0E49\u0E07",
|
|
1443
|
+
archiveScope: "\u0E02\u0E2D\u0E1A\u0E40\u0E02\u0E15\u0E01\u0E32\u0E23\u0E40\u0E01\u0E47\u0E1A\u0E16\u0E32\u0E27\u0E23",
|
|
1444
|
+
archiveScopeActive: "\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19\u0E2D\u0E22\u0E39\u0E48",
|
|
1445
|
+
archiveScopeArchived: "\u0E40\u0E01\u0E47\u0E1A\u0E16\u0E32\u0E27\u0E23\u0E41\u0E25\u0E49\u0E27",
|
|
1446
|
+
archiveScopeAll: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",
|
|
1447
|
+
undoReorder: "\u0E40\u0E25\u0E34\u0E01\u0E17\u0E33\u0E01\u0E32\u0E23\u0E08\u0E31\u0E14\u0E40\u0E23\u0E35\u0E22\u0E07"
|
|
1382
1448
|
};
|
|
1383
1449
|
|
|
1384
1450
|
// src/locales/vi.ts
|
|
@@ -1477,7 +1543,12 @@ var VI_LABELS = {
|
|
|
1477
1543
|
backupRecoveryDescription: "N\u1EBFu d\u1EEF li\u1EC7u \u0111\u1ED3ng b\u1ED9 c\u1EE5c b\u1ED9 b\u1ECB h\u1ECFng, h\xE3y kh\xF4i ph\u1EE5c b\u1EA3n sao l\u01B0u JSON h\u1EE3p l\u1EC7.",
|
|
1478
1544
|
syncPending: "C\xF3 thay \u0111\u1ED5i \u0111ang ch\u1EDD \u0111\u1ED3ng b\u1ED9.",
|
|
1479
1545
|
syncSynced: "T\u1EA5t c\u1EA3 thay \u0111\u1ED5i \u0111\xE3 \u0111\u01B0\u1EE3c \u0111\u1ED3ng b\u1ED9.",
|
|
1480
|
-
syncConflict: "M\u1ED9t s\u1ED1 thay \u0111\u1ED5i c\u1EA7n gi\u1EA3i quy\u1EBFt xung \u0111\u1ED9t."
|
|
1546
|
+
syncConflict: "M\u1ED9t s\u1ED1 thay \u0111\u1ED5i c\u1EA7n gi\u1EA3i quy\u1EBFt xung \u0111\u1ED9t.",
|
|
1547
|
+
archiveScope: "Ph\u1EA1m vi l\u01B0u tr\u1EEF",
|
|
1548
|
+
archiveScopeActive: "\u0110ang ho\u1EA1t \u0111\u1ED9ng",
|
|
1549
|
+
archiveScopeArchived: "\u0110\xE3 l\u01B0u tr\u1EEF",
|
|
1550
|
+
archiveScopeAll: "T\u1EA5t c\u1EA3 m\u1EE5c",
|
|
1551
|
+
undoReorder: "Ho\xE0n t\xE1c s\u1EAFp x\u1EBFp"
|
|
1481
1552
|
};
|
|
1482
1553
|
|
|
1483
1554
|
// src/locales/zh-Hans.ts
|
|
@@ -1576,7 +1647,12 @@ var ZH_HANS_LABELS = {
|
|
|
1576
1647
|
backupRecoveryDescription: "\u5982\u679C\u672C\u5730\u540C\u6B65\u6570\u636E\u635F\u574F\uFF0C\u8BF7\u6062\u590D\u53EF\u7528\u7684 JSON \u5907\u4EFD\u3002",
|
|
1577
1648
|
syncPending: "\u6709\u66F4\u6539\u7B49\u5F85\u540C\u6B65\u3002",
|
|
1578
1649
|
syncSynced: "\u6240\u6709\u66F4\u6539\u5747\u5DF2\u540C\u6B65\u3002",
|
|
1579
|
-
syncConflict: "\u6709\u4E9B\u66F4\u6539\u9700\u8981\u89E3\u51B3\u51B2\u7A81\u3002"
|
|
1650
|
+
syncConflict: "\u6709\u4E9B\u66F4\u6539\u9700\u8981\u89E3\u51B3\u51B2\u7A81\u3002",
|
|
1651
|
+
archiveScope: "\u5F52\u6863\u8303\u56F4",
|
|
1652
|
+
archiveScopeActive: "\u4FDD\u5B58\u4E2D",
|
|
1653
|
+
archiveScopeArchived: "\u5DF2\u5F52\u6863",
|
|
1654
|
+
archiveScopeAll: "\u5168\u90E8\u9879\u76EE",
|
|
1655
|
+
undoReorder: "\u64A4\u9500\u6392\u5E8F"
|
|
1580
1656
|
};
|
|
1581
1657
|
|
|
1582
1658
|
// src/locales/zh-Hant.ts
|
|
@@ -1675,7 +1751,12 @@ var ZH_HANT_LABELS = {
|
|
|
1675
1751
|
backupRecoveryDescription: "\u5982\u679C\u672C\u6A5F\u540C\u6B65\u8CC7\u6599\u640D\u6BC0\uFF0C\u8ACB\u9084\u539F\u53EF\u7528\u7684 JSON \u5099\u4EFD\u3002",
|
|
1676
1752
|
syncPending: "\u6709\u8B8A\u66F4\u7B49\u5F85\u540C\u6B65\u3002",
|
|
1677
1753
|
syncSynced: "\u6240\u6709\u8B8A\u66F4\u90FD\u5DF2\u540C\u6B65\u3002",
|
|
1678
|
-
syncConflict: "\u6709\u4E9B\u8B8A\u66F4\u9700\u8981\u89E3\u6C7A\u885D\u7A81\u3002"
|
|
1754
|
+
syncConflict: "\u6709\u4E9B\u8B8A\u66F4\u9700\u8981\u89E3\u6C7A\u885D\u7A81\u3002",
|
|
1755
|
+
archiveScope: "\u5C01\u5B58\u7BC4\u570D",
|
|
1756
|
+
archiveScopeActive: "\u4FDD\u5B58\u4E2D",
|
|
1757
|
+
archiveScopeArchived: "\u5DF2\u5C01\u5B58",
|
|
1758
|
+
archiveScopeAll: "\u6240\u6709\u9805\u76EE",
|
|
1759
|
+
undoReorder: "\u5FA9\u539F\u6392\u5E8F"
|
|
1679
1760
|
};
|
|
1680
1761
|
|
|
1681
1762
|
// src/locales/index.ts
|
|
@@ -2505,7 +2586,7 @@ import {
|
|
|
2505
2586
|
} from "react";
|
|
2506
2587
|
|
|
2507
2588
|
// src/features/editor/KeepQuickEditor.tsx
|
|
2508
|
-
import {
|
|
2589
|
+
import { useKeepCollections, useKeepItem as useKeepItem3 } from "@keepkit/core/react";
|
|
2509
2590
|
import {
|
|
2510
2591
|
useCallback as useCallback2,
|
|
2511
2592
|
useEffect as useEffect3,
|
|
@@ -2643,7 +2724,7 @@ function KeepQuickEditorView({
|
|
|
2643
2724
|
focusScopeRef,
|
|
2644
2725
|
...props
|
|
2645
2726
|
}) {
|
|
2646
|
-
const
|
|
2727
|
+
const collections = useKeepCollections({ targetType: state.item.targetType, orderBy: "name" });
|
|
2647
2728
|
const rootRef = useRef4(null);
|
|
2648
2729
|
const noteLabel = useUiLabel("note");
|
|
2649
2730
|
const tagsLabel = useUiLabel("tags");
|
|
@@ -2695,11 +2776,7 @@ function KeepQuickEditorView({
|
|
|
2695
2776
|
onChange: (event) => state.setCollectionId(event.currentTarget.value || void 0),
|
|
2696
2777
|
children: [
|
|
2697
2778
|
/* @__PURE__ */ jsx7("option", { value: "", children: uncategorizedLabel }),
|
|
2698
|
-
(collectionIds ?? [
|
|
2699
|
-
...new Set(
|
|
2700
|
-
context.items.map((entry) => entry.collectionId).filter((id) => Boolean(id))
|
|
2701
|
-
)
|
|
2702
|
-
].sort()).map((id) => /* @__PURE__ */ jsx7("option", { value: id, children: collectionLabels?.[id] ?? id }, id))
|
|
2779
|
+
(collectionIds ?? collections.map((collection) => collection.id)).map((id) => /* @__PURE__ */ jsx7("option", { value: id, children: collectionLabels?.[id] ?? id }, id))
|
|
2703
2780
|
]
|
|
2704
2781
|
}
|
|
2705
2782
|
)
|
|
@@ -2921,10 +2998,10 @@ function KeepSavePopoverPanel({
|
|
|
2921
2998
|
}
|
|
2922
2999
|
|
|
2923
3000
|
// src/features/actions/hooks/useKeepUndo.ts
|
|
2924
|
-
import { useKeepContext as
|
|
3001
|
+
import { useKeepContext as useKeepContext2 } from "@keepkit/core/react";
|
|
2925
3002
|
import { useEffect as useEffect5, useState as useState5 } from "react";
|
|
2926
3003
|
function useKeepUndo() {
|
|
2927
|
-
const context =
|
|
3004
|
+
const context = useKeepContext2();
|
|
2928
3005
|
const emitFeedback = useKeepUiFeedback();
|
|
2929
3006
|
const restoredMessage = useUiLabel("restoredMessage");
|
|
2930
3007
|
const { canUndo, startedAt, expiresAt } = context.undo;
|
|
@@ -2984,6 +3061,7 @@ function KeepUndo({ children, label, ...props }) {
|
|
|
2984
3061
|
|
|
2985
3062
|
// src/features/collection/KeepCollection.tsx
|
|
2986
3063
|
import { KeepErrorBoundary as KeepErrorBoundary2 } from "@keepkit/core/react";
|
|
3064
|
+
import { useEffect as useEffect10, useState as useState14 } from "react";
|
|
2987
3065
|
|
|
2988
3066
|
// src/features/query/KeepActiveFiltersSummary.tsx
|
|
2989
3067
|
import {
|
|
@@ -3130,16 +3208,56 @@ function focusFilterFallback(scope) {
|
|
|
3130
3208
|
}
|
|
3131
3209
|
}
|
|
3132
3210
|
|
|
3133
|
-
// src/features/query/
|
|
3134
|
-
import {
|
|
3135
|
-
import { useMemo as useMemo3, useState as useState6 } from "react";
|
|
3211
|
+
// src/features/query/KeepArchiveScopeSelect.tsx
|
|
3212
|
+
import { useState as useState6 } from "react";
|
|
3136
3213
|
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3137
|
-
function
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3214
|
+
function KeepArchiveScopeSelect({
|
|
3215
|
+
value: controlledValue,
|
|
3216
|
+
defaultValue = "active",
|
|
3217
|
+
onValueChange,
|
|
3218
|
+
"aria-label": ariaLabel,
|
|
3219
|
+
...props
|
|
3220
|
+
}) {
|
|
3221
|
+
const [internalValue, setInternalValue] = useState6(controlledValue ?? defaultValue);
|
|
3222
|
+
const value = controlledValue ?? internalValue;
|
|
3223
|
+
const label = useUiLabel("archiveScope");
|
|
3224
|
+
const activeLabel = useUiLabel("archiveScopeActive");
|
|
3225
|
+
const archivedLabel = useUiLabel("archiveScopeArchived");
|
|
3226
|
+
const allLabel = useUiLabel("archiveScopeAll");
|
|
3227
|
+
const handleChange = (next) => {
|
|
3228
|
+
if (next !== "active" && next !== "archived" && next !== "all") return;
|
|
3229
|
+
if (controlledValue === void 0) setInternalValue(next);
|
|
3230
|
+
onValueChange?.(next);
|
|
3231
|
+
};
|
|
3232
|
+
return /* @__PURE__ */ jsxs9("label", { "data-keepkit": "archive-scope", children: [
|
|
3233
|
+
/* @__PURE__ */ jsx11("span", { children: label }),
|
|
3234
|
+
/* @__PURE__ */ jsxs9(
|
|
3235
|
+
"select",
|
|
3236
|
+
{
|
|
3237
|
+
...props,
|
|
3238
|
+
value,
|
|
3239
|
+
"aria-label": ariaLabel ?? label,
|
|
3240
|
+
"data-keep-action": "archive-scope",
|
|
3241
|
+
onChange: (event) => handleChange(event.currentTarget.value),
|
|
3242
|
+
children: [
|
|
3243
|
+
/* @__PURE__ */ jsx11("option", { value: "active", children: activeLabel }),
|
|
3244
|
+
/* @__PURE__ */ jsx11("option", { value: "archived", children: archivedLabel }),
|
|
3245
|
+
/* @__PURE__ */ jsx11("option", { value: "all", children: allLabel })
|
|
3246
|
+
]
|
|
3247
|
+
}
|
|
3248
|
+
)
|
|
3249
|
+
] });
|
|
3250
|
+
}
|
|
3251
|
+
|
|
3252
|
+
// src/features/query/KeepCollectionFilter.tsx
|
|
3253
|
+
import { useKeepCollections as useKeepCollections2, useKeepContext as useKeepContext3 } from "@keepkit/core/react";
|
|
3254
|
+
import { useState as useState7 } from "react";
|
|
3255
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3256
|
+
function useCollectionOptions(collectionLabels, collections) {
|
|
3257
|
+
return collections.map((collection) => ({
|
|
3258
|
+
id: collection.id,
|
|
3259
|
+
label: collectionLabels?.[collection.id] ?? collection.name
|
|
3260
|
+
}));
|
|
3143
3261
|
}
|
|
3144
3262
|
function KeepCollectionSelect({
|
|
3145
3263
|
item,
|
|
@@ -3151,10 +3269,11 @@ function KeepCollectionSelect({
|
|
|
3151
3269
|
uncategorizedLabel,
|
|
3152
3270
|
...props
|
|
3153
3271
|
}) {
|
|
3154
|
-
const context =
|
|
3155
|
-
const state =
|
|
3272
|
+
const context = useKeepContext3();
|
|
3273
|
+
const state = useState7(value ?? defaultValue ?? item.collectionId ?? "");
|
|
3156
3274
|
const selected = value ?? state[0];
|
|
3157
|
-
const
|
|
3275
|
+
const collections = useKeepCollections2({ targetType: item.targetType, orderBy: "name" });
|
|
3276
|
+
const options = useCollectionOptions(collectionLabels, collections);
|
|
3158
3277
|
const defaultUncategorizedLabel = useUiLabel("uncategorized");
|
|
3159
3278
|
const uncategorized = uncategorizedLabel ?? defaultUncategorizedLabel;
|
|
3160
3279
|
const handleChange = (next) => {
|
|
@@ -3164,7 +3283,7 @@ function KeepCollectionSelect({
|
|
|
3164
3283
|
onChange?.(resolved);
|
|
3165
3284
|
void context.moveToCollection(item.id, resolved);
|
|
3166
3285
|
};
|
|
3167
|
-
return /* @__PURE__ */
|
|
3286
|
+
return /* @__PURE__ */ jsxs10(
|
|
3168
3287
|
"select",
|
|
3169
3288
|
{
|
|
3170
3289
|
...props,
|
|
@@ -3172,8 +3291,8 @@ function KeepCollectionSelect({
|
|
|
3172
3291
|
onChange: (event) => handleChange(event.currentTarget.value),
|
|
3173
3292
|
"data-keep-action": "move-collection",
|
|
3174
3293
|
children: [
|
|
3175
|
-
/* @__PURE__ */
|
|
3176
|
-
options.map((option) => /* @__PURE__ */
|
|
3294
|
+
/* @__PURE__ */ jsx12("option", { value: "", children: uncategorized }),
|
|
3295
|
+
options.map((option) => /* @__PURE__ */ jsx12("option", { value: option.id, children: option.label }, option.id))
|
|
3177
3296
|
]
|
|
3178
3297
|
}
|
|
3179
3298
|
);
|
|
@@ -3188,10 +3307,10 @@ function KeepCollectionFilter({
|
|
|
3188
3307
|
uncategorizedLabel,
|
|
3189
3308
|
...props
|
|
3190
3309
|
}) {
|
|
3191
|
-
const
|
|
3192
|
-
const [internalValue, setInternalValue] = useState6(value ?? defaultValue ?? "");
|
|
3310
|
+
const [internalValue, setInternalValue] = useState7(value ?? defaultValue ?? "");
|
|
3193
3311
|
const selected = value ?? internalValue;
|
|
3194
|
-
const
|
|
3312
|
+
const collections = useKeepCollections2({ orderBy: "name" });
|
|
3313
|
+
const options = useCollectionOptions(collectionLabels, collections);
|
|
3195
3314
|
const collectionLabel = useUiLabel("collection");
|
|
3196
3315
|
const defaultAllLabel = useUiLabel("allCollections");
|
|
3197
3316
|
const defaultUncategorizedLabel = useUiLabel("uncategorized");
|
|
@@ -3203,9 +3322,9 @@ function KeepCollectionFilter({
|
|
|
3203
3322
|
onValueChange?.(resolved);
|
|
3204
3323
|
onChange?.(resolved);
|
|
3205
3324
|
};
|
|
3206
|
-
return /* @__PURE__ */
|
|
3207
|
-
/* @__PURE__ */
|
|
3208
|
-
/* @__PURE__ */
|
|
3325
|
+
return /* @__PURE__ */ jsxs10("label", { "data-keepkit": "collection-filter", children: [
|
|
3326
|
+
/* @__PURE__ */ jsx12("span", { children: collectionLabel }),
|
|
3327
|
+
/* @__PURE__ */ jsxs10(
|
|
3209
3328
|
"select",
|
|
3210
3329
|
{
|
|
3211
3330
|
...props,
|
|
@@ -3213,9 +3332,9 @@ function KeepCollectionFilter({
|
|
|
3213
3332
|
onChange: (event) => handleChange(event.currentTarget.value),
|
|
3214
3333
|
"data-keep-action": "filter-collection",
|
|
3215
3334
|
children: [
|
|
3216
|
-
/* @__PURE__ */
|
|
3217
|
-
/* @__PURE__ */
|
|
3218
|
-
options.map((option) => /* @__PURE__ */
|
|
3335
|
+
/* @__PURE__ */ jsx12("option", { value: "", children: all }),
|
|
3336
|
+
/* @__PURE__ */ jsx12("option", { value: "__uncategorized__", children: uncategorized }),
|
|
3337
|
+
options.map((option) => /* @__PURE__ */ jsx12("option", { value: option.id, children: option.label }, option.id))
|
|
3219
3338
|
]
|
|
3220
3339
|
}
|
|
3221
3340
|
)
|
|
@@ -3227,10 +3346,10 @@ import { isValidElement as isValidElement3 } from "react";
|
|
|
3227
3346
|
|
|
3228
3347
|
// src/features/query/hooks/useKeepTagFilter.ts
|
|
3229
3348
|
import { useKeepList as useKeepList2 } from "@keepkit/core/react";
|
|
3230
|
-
import { useCallback as useCallback4, useMemo as
|
|
3349
|
+
import { useCallback as useCallback4, useMemo as useMemo3, useState as useState8 } from "react";
|
|
3231
3350
|
function useKeepTagFilter(options) {
|
|
3232
3351
|
const { query, controlledValue, defaultValue, onChange, onValueChange } = options;
|
|
3233
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
3352
|
+
const [uncontrolledValue, setUncontrolledValue] = useState8(defaultValue);
|
|
3234
3353
|
const resolvedValue = controlledValue ?? uncontrolledValue;
|
|
3235
3354
|
const list = useKeepList2({
|
|
3236
3355
|
...query,
|
|
@@ -3244,7 +3363,7 @@ function useKeepTagFilter(options) {
|
|
|
3244
3363
|
},
|
|
3245
3364
|
[controlledValue, onChange, onValueChange]
|
|
3246
3365
|
);
|
|
3247
|
-
const state =
|
|
3366
|
+
const state = useMemo3(
|
|
3248
3367
|
() => ({ tags: list.tags, tagCounts: list.tagCounts, value: resolvedValue, select }),
|
|
3249
3368
|
[list.tagCounts, list.tags, resolvedValue, select]
|
|
3250
3369
|
);
|
|
@@ -3256,7 +3375,7 @@ function useKeepTagFilter(options) {
|
|
|
3256
3375
|
}
|
|
3257
3376
|
|
|
3258
3377
|
// src/features/query/KeepTagFilter.tsx
|
|
3259
|
-
import { jsx as
|
|
3378
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3260
3379
|
function KeepTagFilter({
|
|
3261
3380
|
query,
|
|
3262
3381
|
value: controlledValue,
|
|
@@ -3274,9 +3393,9 @@ function KeepTagFilter({
|
|
|
3274
3393
|
}) {
|
|
3275
3394
|
const view = useKeepTagFilter({ query, controlledValue, defaultValue, onChange, onValueChange });
|
|
3276
3395
|
const contentChildren = asChild && isValidElement3(children) ? void 0 : children;
|
|
3277
|
-
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */
|
|
3278
|
-
/* @__PURE__ */
|
|
3279
|
-
/* @__PURE__ */
|
|
3396
|
+
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */ jsxs11("fieldset", { children: [
|
|
3397
|
+
/* @__PURE__ */ jsx13("legend", { children: ariaLabel ?? view.labels.aria }),
|
|
3398
|
+
/* @__PURE__ */ jsx13(
|
|
3280
3399
|
"button",
|
|
3281
3400
|
{
|
|
3282
3401
|
type: "button",
|
|
@@ -3286,7 +3405,7 @@ function KeepTagFilter({
|
|
|
3286
3405
|
children: allLabel ?? view.labels.all
|
|
3287
3406
|
}
|
|
3288
3407
|
),
|
|
3289
|
-
view.state.tags.map((tag) => /* @__PURE__ */
|
|
3408
|
+
view.state.tags.map((tag) => /* @__PURE__ */ jsxs11(
|
|
3290
3409
|
"button",
|
|
3291
3410
|
{
|
|
3292
3411
|
type: "button",
|
|
@@ -3295,7 +3414,7 @@ function KeepTagFilter({
|
|
|
3295
3414
|
onClick: () => view.state.select(tag),
|
|
3296
3415
|
children: [
|
|
3297
3416
|
renderTag ? renderTag(tag, view.state.tagCounts[tag] ?? 0, view.state.value === tag) : tag,
|
|
3298
|
-
/* @__PURE__ */
|
|
3417
|
+
/* @__PURE__ */ jsxs11("span", { children: [
|
|
3299
3418
|
" (",
|
|
3300
3419
|
view.state.tagCounts[tag] ?? 0,
|
|
3301
3420
|
")"
|
|
@@ -3321,10 +3440,10 @@ function KeepTagFilter({
|
|
|
3321
3440
|
}
|
|
3322
3441
|
|
|
3323
3442
|
// src/features/query/hooks/useQueryControls.ts
|
|
3324
|
-
import { useEffect as useEffect6, useState as
|
|
3443
|
+
import { useEffect as useEffect6, useState as useState9 } from "react";
|
|
3325
3444
|
function useKeepSearchInput(options) {
|
|
3326
3445
|
const { controlledValue, defaultValue, debounceMs, onValueChange } = options;
|
|
3327
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
3446
|
+
const [uncontrolledValue, setUncontrolledValue] = useState9(defaultValue);
|
|
3328
3447
|
const value = controlledValue ?? uncontrolledValue;
|
|
3329
3448
|
useEffect6(() => {
|
|
3330
3449
|
if (!onValueChange) return;
|
|
@@ -3345,7 +3464,7 @@ function useKeepSearchInput(options) {
|
|
|
3345
3464
|
}
|
|
3346
3465
|
function useKeepSortSelect(options) {
|
|
3347
3466
|
const { controlledValue, defaultValue, onValueChange } = options;
|
|
3348
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
3467
|
+
const [uncontrolledValue, setUncontrolledValue] = useState9(defaultValue);
|
|
3349
3468
|
const value = controlledValue ?? uncontrolledValue;
|
|
3350
3469
|
return {
|
|
3351
3470
|
value,
|
|
@@ -3393,7 +3512,7 @@ function getVisiblePages(currentPage, pageCount, maxPageButtons) {
|
|
|
3393
3512
|
}
|
|
3394
3513
|
|
|
3395
3514
|
// src/features/query/query-controls.tsx
|
|
3396
|
-
import { Fragment as Fragment6, jsx as
|
|
3515
|
+
import { Fragment as Fragment6, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3397
3516
|
function KeepSearchInput({
|
|
3398
3517
|
value: controlledValue,
|
|
3399
3518
|
defaultValue = "",
|
|
@@ -3404,7 +3523,7 @@ function KeepSearchInput({
|
|
|
3404
3523
|
...props
|
|
3405
3524
|
}) {
|
|
3406
3525
|
const view = useKeepSearchInput({ controlledValue, defaultValue, debounceMs, onValueChange });
|
|
3407
|
-
return /* @__PURE__ */
|
|
3526
|
+
return /* @__PURE__ */ jsx14(
|
|
3408
3527
|
"input",
|
|
3409
3528
|
{
|
|
3410
3529
|
...props,
|
|
@@ -3429,13 +3548,13 @@ function KeepSortSelect({
|
|
|
3429
3548
|
...props
|
|
3430
3549
|
}) {
|
|
3431
3550
|
const view = useKeepSortSelect({ controlledValue, defaultValue, onValueChange });
|
|
3432
|
-
const options = children ?? /* @__PURE__ */
|
|
3433
|
-
/* @__PURE__ */
|
|
3434
|
-
/* @__PURE__ */
|
|
3435
|
-
/* @__PURE__ */
|
|
3436
|
-
/* @__PURE__ */
|
|
3551
|
+
const options = children ?? /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
3552
|
+
/* @__PURE__ */ jsx14("option", { value: "updatedAt:desc", children: view.labels.updatedNewest }),
|
|
3553
|
+
/* @__PURE__ */ jsx14("option", { value: "updatedAt:asc", children: view.labels.updatedOldest }),
|
|
3554
|
+
/* @__PURE__ */ jsx14("option", { value: "savedAt:desc", children: view.labels.savedNewest }),
|
|
3555
|
+
/* @__PURE__ */ jsx14("option", { value: "savedAt:asc", children: view.labels.savedOldest })
|
|
3437
3556
|
] });
|
|
3438
|
-
return /* @__PURE__ */
|
|
3557
|
+
return /* @__PURE__ */ jsx14(
|
|
3439
3558
|
"select",
|
|
3440
3559
|
{
|
|
3441
3560
|
...props,
|
|
@@ -3467,9 +3586,9 @@ function KeepPagination({
|
|
|
3467
3586
|
"data-state": view.pageCount > 1 ? "active" : "idle"
|
|
3468
3587
|
};
|
|
3469
3588
|
if (render)
|
|
3470
|
-
return /* @__PURE__ */
|
|
3471
|
-
return /* @__PURE__ */
|
|
3472
|
-
/* @__PURE__ */
|
|
3589
|
+
return /* @__PURE__ */ jsx14("nav", { ...navProps, children: render({ page: view.currentPage, pageCount: view.pageCount, goToPage: view.goToPage }) });
|
|
3590
|
+
return /* @__PURE__ */ jsxs12("nav", { ...navProps, children: [
|
|
3591
|
+
/* @__PURE__ */ jsx14(
|
|
3473
3592
|
"button",
|
|
3474
3593
|
{
|
|
3475
3594
|
type: "button",
|
|
@@ -3479,7 +3598,7 @@ function KeepPagination({
|
|
|
3479
3598
|
children: view.labels.previous
|
|
3480
3599
|
}
|
|
3481
3600
|
),
|
|
3482
|
-
view.visiblePages.map((nextPage) => /* @__PURE__ */
|
|
3601
|
+
view.visiblePages.map((nextPage) => /* @__PURE__ */ jsx14(
|
|
3483
3602
|
"button",
|
|
3484
3603
|
{
|
|
3485
3604
|
type: "button",
|
|
@@ -3491,7 +3610,7 @@ function KeepPagination({
|
|
|
3491
3610
|
},
|
|
3492
3611
|
nextPage
|
|
3493
3612
|
)),
|
|
3494
|
-
/* @__PURE__ */
|
|
3613
|
+
/* @__PURE__ */ jsx14(
|
|
3495
3614
|
"button",
|
|
3496
3615
|
{
|
|
3497
3616
|
type: "button",
|
|
@@ -3506,13 +3625,14 @@ function KeepPagination({
|
|
|
3506
3625
|
|
|
3507
3626
|
// src/features/collection/hooks/useKeepCollection.ts
|
|
3508
3627
|
import { useKeepList as useKeepList3 } from "@keepkit/core/react";
|
|
3509
|
-
import { useMemo as
|
|
3628
|
+
import { useEffect as useEffect7, useMemo as useMemo4, useState as useState10 } from "react";
|
|
3510
3629
|
function useKeepCollection({
|
|
3511
3630
|
query,
|
|
3512
3631
|
pageSize,
|
|
3513
3632
|
urlSync,
|
|
3514
3633
|
urlAdapter,
|
|
3515
|
-
features
|
|
3634
|
+
features,
|
|
3635
|
+
archiveScope
|
|
3516
3636
|
}) {
|
|
3517
3637
|
const enabled = {
|
|
3518
3638
|
search: true,
|
|
@@ -3526,15 +3646,23 @@ function useKeepCollection({
|
|
|
3526
3646
|
archive: false,
|
|
3527
3647
|
...features
|
|
3528
3648
|
};
|
|
3529
|
-
const [searchValue, setSearchValue] =
|
|
3530
|
-
const [sort, setSort] =
|
|
3531
|
-
const [activeTags, setActiveTags] =
|
|
3532
|
-
const [activeCollection, setActiveCollection] =
|
|
3533
|
-
const [page, setPage] =
|
|
3649
|
+
const [searchValue, setSearchValue] = useState10(query.search?.query ?? "");
|
|
3650
|
+
const [sort, setSort] = useState10(query.sort ?? { by: "updatedAt", direction: "desc" });
|
|
3651
|
+
const [activeTags, setActiveTags] = useState10(query.tags ?? []);
|
|
3652
|
+
const [activeCollection, setActiveCollection] = useState10(query.collectionId);
|
|
3653
|
+
const [page, setPage] = useState10(query.pagination?.page ?? 1);
|
|
3654
|
+
const [activeArchiveScope, setActiveArchiveScope] = useState10(
|
|
3655
|
+
archiveScope ?? query.archiveScope ?? scopeFromArchived(query.archived)
|
|
3656
|
+
);
|
|
3657
|
+
useEffect7(() => {
|
|
3658
|
+
if (archiveScope !== void 0) setActiveArchiveScope(archiveScope);
|
|
3659
|
+
}, [archiveScope]);
|
|
3534
3660
|
const resolvedPageSize = query.pagination?.pageSize ?? pageSize;
|
|
3535
|
-
const resolvedQuery =
|
|
3661
|
+
const resolvedQuery = useMemo4(
|
|
3536
3662
|
() => ({
|
|
3537
3663
|
...query,
|
|
3664
|
+
archiveScope: activeArchiveScope,
|
|
3665
|
+
archived: activeArchiveScope === "active" ? false : activeArchiveScope === "archived" ? true : void 0,
|
|
3538
3666
|
search: enabled.search ? { ...query.search, query: searchValue } : query.search,
|
|
3539
3667
|
sort: enabled.sort ? sort : query.sort,
|
|
3540
3668
|
tags: activeTags.length > 0 ? activeTags : void 0,
|
|
@@ -3552,7 +3680,8 @@ function useKeepCollection({
|
|
|
3552
3680
|
query,
|
|
3553
3681
|
resolvedPageSize,
|
|
3554
3682
|
searchValue,
|
|
3555
|
-
sort
|
|
3683
|
+
sort,
|
|
3684
|
+
activeArchiveScope
|
|
3556
3685
|
]
|
|
3557
3686
|
);
|
|
3558
3687
|
useKeepUrlSync({
|
|
@@ -3564,19 +3693,21 @@ function useKeepCollection({
|
|
|
3564
3693
|
setSort(next.sort ?? { by: "updatedAt", direction: "desc" });
|
|
3565
3694
|
setActiveTags(next.tags ?? []);
|
|
3566
3695
|
setActiveCollection(next.collectionId);
|
|
3696
|
+
setActiveArchiveScope(next.archiveScope ?? scopeFromArchived(next.archived));
|
|
3567
3697
|
setPage(next.pagination?.page ?? 1);
|
|
3568
3698
|
},
|
|
3569
3699
|
options: typeof urlSync === "object" ? urlSync : {},
|
|
3570
3700
|
adapter: urlAdapter
|
|
3571
3701
|
});
|
|
3572
3702
|
const list = useKeepList3(resolvedQuery);
|
|
3573
|
-
const allState = useKeepList3({});
|
|
3703
|
+
const allState = useKeepList3({ archiveScope: "all" });
|
|
3574
3704
|
return {
|
|
3575
3705
|
enabled,
|
|
3576
3706
|
searchValue,
|
|
3577
3707
|
sortValue: sortToValue(sort),
|
|
3578
3708
|
activeTags,
|
|
3579
3709
|
activeCollection,
|
|
3710
|
+
archiveScope: activeArchiveScope,
|
|
3580
3711
|
resolvedPageSize,
|
|
3581
3712
|
resolvedQuery,
|
|
3582
3713
|
list,
|
|
@@ -3597,6 +3728,10 @@ function useKeepCollection({
|
|
|
3597
3728
|
setActiveCollection(value);
|
|
3598
3729
|
setPage(1);
|
|
3599
3730
|
},
|
|
3731
|
+
setArchiveScope: (value) => {
|
|
3732
|
+
setActiveArchiveScope(value);
|
|
3733
|
+
setPage(1);
|
|
3734
|
+
},
|
|
3600
3735
|
removeTag: (tagToRemove) => {
|
|
3601
3736
|
setActiveTags((current) => current.filter((tag) => tag !== tagToRemove));
|
|
3602
3737
|
setPage(1);
|
|
@@ -3610,6 +3745,9 @@ function useKeepCollection({
|
|
|
3610
3745
|
setPage
|
|
3611
3746
|
};
|
|
3612
3747
|
}
|
|
3748
|
+
function scopeFromArchived(archived) {
|
|
3749
|
+
return archived === true ? "archived" : "active";
|
|
3750
|
+
}
|
|
3613
3751
|
|
|
3614
3752
|
// src/features/collection/KeepList.tsx
|
|
3615
3753
|
import { KeepErrorBoundary } from "@keepkit/core/react";
|
|
@@ -3621,8 +3759,10 @@ import {
|
|
|
3621
3759
|
createElement as createElement2,
|
|
3622
3760
|
isValidElement as isValidElement4,
|
|
3623
3761
|
useContext as useContext3,
|
|
3624
|
-
useEffect as
|
|
3625
|
-
|
|
3762
|
+
useEffect as useEffect8,
|
|
3763
|
+
useId as useId2,
|
|
3764
|
+
useRef as useRef7,
|
|
3765
|
+
useState as useState12
|
|
3626
3766
|
} from "react";
|
|
3627
3767
|
|
|
3628
3768
|
// src/features/item/hooks/useKeepItemStatusBadge.ts
|
|
@@ -3665,10 +3805,10 @@ function getDisplayStatus(status) {
|
|
|
3665
3805
|
}
|
|
3666
3806
|
|
|
3667
3807
|
// src/features/item/KeepItemStatusBadge.tsx
|
|
3668
|
-
import { Fragment as Fragment7, jsx as
|
|
3808
|
+
import { Fragment as Fragment7, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3669
3809
|
function KeepItemStatusBadge({ status = "available", label, className, ...props }) {
|
|
3670
3810
|
const view = useKeepItemStatusBadge(status);
|
|
3671
|
-
return /* @__PURE__ */
|
|
3811
|
+
return /* @__PURE__ */ jsxs13(
|
|
3672
3812
|
"span",
|
|
3673
3813
|
{
|
|
3674
3814
|
...props,
|
|
@@ -3679,14 +3819,14 @@ function KeepItemStatusBadge({ status = "available", label, className, ...props
|
|
|
3679
3819
|
"data-status": status,
|
|
3680
3820
|
"data-item-status": view.resolvedStatus,
|
|
3681
3821
|
children: [
|
|
3682
|
-
/* @__PURE__ */
|
|
3683
|
-
/* @__PURE__ */
|
|
3822
|
+
/* @__PURE__ */ jsx15(StatusIcon, { name: view.icon }),
|
|
3823
|
+
/* @__PURE__ */ jsx15("span", { "data-status-label": "true", children: label ?? view.statusLabel })
|
|
3684
3824
|
]
|
|
3685
3825
|
}
|
|
3686
3826
|
);
|
|
3687
3827
|
}
|
|
3688
3828
|
function StatusIcon({ name }) {
|
|
3689
|
-
return /* @__PURE__ */
|
|
3829
|
+
return /* @__PURE__ */ jsxs13(
|
|
3690
3830
|
"svg",
|
|
3691
3831
|
{
|
|
3692
3832
|
"data-status-icon": name,
|
|
@@ -3701,18 +3841,18 @@ function StatusIcon({ name }) {
|
|
|
3701
3841
|
"aria-hidden": "true",
|
|
3702
3842
|
focusable: "false",
|
|
3703
3843
|
children: [
|
|
3704
|
-
name === "check" ? /* @__PURE__ */
|
|
3705
|
-
name === "clock" ? /* @__PURE__ */
|
|
3706
|
-
/* @__PURE__ */
|
|
3707
|
-
/* @__PURE__ */
|
|
3844
|
+
name === "check" ? /* @__PURE__ */ jsx15("path", { d: "m5 12 4 4L19 6" }) : null,
|
|
3845
|
+
name === "clock" ? /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
3846
|
+
/* @__PURE__ */ jsx15("circle", { cx: "12", cy: "12", r: "8" }),
|
|
3847
|
+
/* @__PURE__ */ jsx15("path", { d: "M12 7v5l3 2" })
|
|
3708
3848
|
] }) : null,
|
|
3709
|
-
name === "ban" ? /* @__PURE__ */
|
|
3710
|
-
/* @__PURE__ */
|
|
3711
|
-
/* @__PURE__ */
|
|
3849
|
+
name === "ban" ? /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
3850
|
+
/* @__PURE__ */ jsx15("circle", { cx: "12", cy: "12", r: "8" }),
|
|
3851
|
+
/* @__PURE__ */ jsx15("path", { d: "m6.5 6.5 11 11" })
|
|
3712
3852
|
] }) : null,
|
|
3713
|
-
name === "lock" ? /* @__PURE__ */
|
|
3714
|
-
/* @__PURE__ */
|
|
3715
|
-
/* @__PURE__ */
|
|
3853
|
+
name === "lock" ? /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
3854
|
+
/* @__PURE__ */ jsx15("rect", { x: "5", y: "10", width: "14", height: "10", rx: "2" }),
|
|
3855
|
+
/* @__PURE__ */ jsx15("path", { d: "M8 10V7a4 4 0 0 1 8 0v3" })
|
|
3716
3856
|
] }) : null
|
|
3717
3857
|
]
|
|
3718
3858
|
}
|
|
@@ -3720,16 +3860,16 @@ function StatusIcon({ name }) {
|
|
|
3720
3860
|
}
|
|
3721
3861
|
|
|
3722
3862
|
// src/features/status/hooks/useKeepStaleNotice.ts
|
|
3723
|
-
import { useKeepContext as
|
|
3724
|
-
import { useState as
|
|
3863
|
+
import { useKeepContext as useKeepContext4 } from "@keepkit/core/react";
|
|
3864
|
+
import { useState as useState11 } from "react";
|
|
3725
3865
|
function useKeepStaleNotice({ item, onRetry, onRemoved }) {
|
|
3726
|
-
const context =
|
|
3866
|
+
const context = useKeepContext4();
|
|
3727
3867
|
const emitFeedback = useKeepUiFeedback();
|
|
3728
3868
|
const removedMessage = useUiLabel("removedMessage");
|
|
3729
3869
|
const restoredMessage = useUiLabel("restoredMessage");
|
|
3730
3870
|
const undoLabel = useUiLabel("undo");
|
|
3731
|
-
const [isRetrying, setIsRetrying] =
|
|
3732
|
-
const [error, setError] =
|
|
3871
|
+
const [isRetrying, setIsRetrying] = useState11(false);
|
|
3872
|
+
const [error, setError] = useState11(null);
|
|
3733
3873
|
async function retry() {
|
|
3734
3874
|
setError(null);
|
|
3735
3875
|
setIsRetrying(true);
|
|
@@ -3775,7 +3915,7 @@ function useKeepStaleNotice({ item, onRetry, onRemoved }) {
|
|
|
3775
3915
|
};
|
|
3776
3916
|
}
|
|
3777
3917
|
function useKeepPruneStale({ statuses, onPruned }) {
|
|
3778
|
-
const context =
|
|
3918
|
+
const context = useKeepContext4();
|
|
3779
3919
|
const emitFeedback = useKeepUiFeedback();
|
|
3780
3920
|
const staleItems = context.items.filter((item) => item.status && statuses.includes(item.status));
|
|
3781
3921
|
const staleIds = staleItems.map((item) => item.id);
|
|
@@ -3809,7 +3949,7 @@ function useKeepPruneStale({ statuses, onPruned }) {
|
|
|
3809
3949
|
}
|
|
3810
3950
|
|
|
3811
3951
|
// src/features/status/KeepStaleNotice.tsx
|
|
3812
|
-
import { jsx as
|
|
3952
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3813
3953
|
function KeepStaleNotice({
|
|
3814
3954
|
item,
|
|
3815
3955
|
onRetry,
|
|
@@ -3821,11 +3961,11 @@ function KeepStaleNotice({
|
|
|
3821
3961
|
...props
|
|
3822
3962
|
}) {
|
|
3823
3963
|
const view = useKeepStaleNotice({ item, onRetry, onRemoved });
|
|
3824
|
-
return /* @__PURE__ */
|
|
3825
|
-
/* @__PURE__ */
|
|
3826
|
-
children ?? (item.statusReason ? /* @__PURE__ */
|
|
3827
|
-
/* @__PURE__ */
|
|
3828
|
-
/* @__PURE__ */
|
|
3964
|
+
return /* @__PURE__ */ jsxs14("aside", { ...props, className, "data-keepkit": "stale-notice", "data-state": view.error ? "error" : "stale", children: [
|
|
3965
|
+
/* @__PURE__ */ jsx16(KeepItemStatusBadge, { status: view.status }),
|
|
3966
|
+
children ?? (item.statusReason ? /* @__PURE__ */ jsx16("p", { children: item.statusReason }) : null),
|
|
3967
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
3968
|
+
/* @__PURE__ */ jsx16(
|
|
3829
3969
|
"button",
|
|
3830
3970
|
{
|
|
3831
3971
|
type: "button",
|
|
@@ -3835,7 +3975,7 @@ function KeepStaleNotice({
|
|
|
3835
3975
|
children: retryLabel ?? view.labels.retry
|
|
3836
3976
|
}
|
|
3837
3977
|
),
|
|
3838
|
-
/* @__PURE__ */
|
|
3978
|
+
/* @__PURE__ */ jsx16(
|
|
3839
3979
|
"button",
|
|
3840
3980
|
{
|
|
3841
3981
|
type: "button",
|
|
@@ -3846,7 +3986,7 @@ function KeepStaleNotice({
|
|
|
3846
3986
|
}
|
|
3847
3987
|
)
|
|
3848
3988
|
] }),
|
|
3849
|
-
view.error ? /* @__PURE__ */
|
|
3989
|
+
view.error ? /* @__PURE__ */ jsx16("p", { role: "alert", children: view.error instanceof Error ? view.error.message : view.labels.error }) : null
|
|
3850
3990
|
] });
|
|
3851
3991
|
}
|
|
3852
3992
|
function KeepPruneStaleButton({
|
|
@@ -3858,7 +3998,7 @@ function KeepPruneStaleButton({
|
|
|
3858
3998
|
...props
|
|
3859
3999
|
}) {
|
|
3860
4000
|
const view = useKeepPruneStale({ statuses, onPruned });
|
|
3861
|
-
return /* @__PURE__ */
|
|
4001
|
+
return /* @__PURE__ */ jsx16(
|
|
3862
4002
|
"button",
|
|
3863
4003
|
{
|
|
3864
4004
|
...props,
|
|
@@ -3971,7 +4111,7 @@ function getDisplayStatus2(status) {
|
|
|
3971
4111
|
}
|
|
3972
4112
|
|
|
3973
4113
|
// src/features/item/KeepItemCard.tsx
|
|
3974
|
-
import { Fragment as Fragment8, jsx as
|
|
4114
|
+
import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3975
4115
|
var KeepItemCardContext = createContext3(null);
|
|
3976
4116
|
function useKeepItemCardCompound(part) {
|
|
3977
4117
|
const context = useContext3(KeepItemCardContext);
|
|
@@ -3999,6 +4139,9 @@ function KeepItemCardRoot({
|
|
|
3999
4139
|
showSaveButton = true,
|
|
4000
4140
|
showPinButton = false,
|
|
4001
4141
|
showArchiveButton = false,
|
|
4142
|
+
showEditButton = false,
|
|
4143
|
+
onEdit,
|
|
4144
|
+
editSlot,
|
|
4002
4145
|
saveButtonLabels,
|
|
4003
4146
|
asChild = false,
|
|
4004
4147
|
href: hrefOption,
|
|
@@ -4025,6 +4168,14 @@ function KeepItemCardRoot({
|
|
|
4025
4168
|
const contextQuery = useKeepSearchQuery();
|
|
4026
4169
|
const searchQuery = highlightQuery ?? contextQuery;
|
|
4027
4170
|
const contentChildren = asChild && isValidElement4(children) ? void 0 : children;
|
|
4171
|
+
const [isEditOpen, setEditOpen] = useState12(false);
|
|
4172
|
+
const editTriggerRef = useRef7(null);
|
|
4173
|
+
const editPanelId = useId2();
|
|
4174
|
+
const editLabel = useUiLabel("editSavedItem");
|
|
4175
|
+
const closeEdit = () => setEditOpen(false);
|
|
4176
|
+
useEffect8(() => {
|
|
4177
|
+
if (!isEditOpen) editTriggerRef.current?.focus();
|
|
4178
|
+
}, [isEditOpen]);
|
|
4028
4179
|
function renderLink(content) {
|
|
4029
4180
|
if (!view.href || !view.isAvailable) return content;
|
|
4030
4181
|
const linkProps = {
|
|
@@ -4034,17 +4185,17 @@ function KeepItemCardRoot({
|
|
|
4034
4185
|
onClick: (event) => onOpen?.(item, event),
|
|
4035
4186
|
children: content
|
|
4036
4187
|
};
|
|
4037
|
-
return LinkComponent ? /* @__PURE__ */
|
|
4188
|
+
return LinkComponent ? /* @__PURE__ */ jsx17(LinkComponent, { ...linkProps }) : /* @__PURE__ */ jsx17("a", { ...linkProps });
|
|
4038
4189
|
}
|
|
4039
4190
|
function renderTitle(content) {
|
|
4040
4191
|
if (linkTarget !== "title") return content;
|
|
4041
4192
|
if (view.isAvailable) return renderLink(content);
|
|
4042
|
-
return view.href ? /* @__PURE__ */
|
|
4193
|
+
return view.href ? /* @__PURE__ */ jsx17("span", { "aria-disabled": "true", "data-link-disabled": "true", children: content }) : content;
|
|
4043
4194
|
}
|
|
4044
4195
|
const resolvedImageProps = view.imageProps ? { ...view.imageProps, alt: imageAlt ?? view.imageProps.alt } : void 0;
|
|
4045
4196
|
const imageSource = resolvedImageProps?.src;
|
|
4046
|
-
const [imageStatus, setImageStatus] =
|
|
4047
|
-
|
|
4197
|
+
const [imageStatus, setImageStatus] = useState12(imageSource ? "loading" : "error");
|
|
4198
|
+
useEffect8(() => {
|
|
4048
4199
|
setImageStatus(imageSource ? "loading" : "error");
|
|
4049
4200
|
}, [imageSource]);
|
|
4050
4201
|
let image = null;
|
|
@@ -4062,24 +4213,44 @@ function KeepItemCardRoot({
|
|
|
4062
4213
|
setImageStatus("error");
|
|
4063
4214
|
}
|
|
4064
4215
|
};
|
|
4065
|
-
image = renderImage?.(imagePropsWithHandlers, item) ?? (ImageComponent ? /* @__PURE__ */
|
|
4216
|
+
image = renderImage?.(imagePropsWithHandlers, item) ?? (ImageComponent ? /* @__PURE__ */ jsx17(ImageComponent, { ...imagePropsWithHandlers }) : /* @__PURE__ */ jsx17("img", { ...imagePropsWithHandlers, alt: imagePropsWithHandlers.alt }));
|
|
4066
4217
|
}
|
|
4067
4218
|
const tags = showTags ? item.tags ?? [] : [];
|
|
4068
4219
|
const renderedTags = showTags && tags.length > 0 ? renderTags?.(tags, item) ?? null : null;
|
|
4069
|
-
const meta = showSavedAt ? /* @__PURE__ */
|
|
4070
|
-
/* @__PURE__ */
|
|
4220
|
+
const meta = showSavedAt ? /* @__PURE__ */ jsxs15("div", { "data-card-meta": true, children: [
|
|
4221
|
+
/* @__PURE__ */ jsxs15("span", { children: [
|
|
4071
4222
|
view.labels.savedAt,
|
|
4072
4223
|
":"
|
|
4073
4224
|
] }),
|
|
4074
4225
|
" ",
|
|
4075
|
-
/* @__PURE__ */
|
|
4226
|
+
/* @__PURE__ */ jsx17("time", { dateTime: new Date(item.savedAt).toISOString(), children: formatSavedAt(item.savedAt) })
|
|
4076
4227
|
] }) : null;
|
|
4077
|
-
const error = view.itemState.error ? /* @__PURE__ */
|
|
4078
|
-
const actions = view.statusLabel ? /* @__PURE__ */
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4228
|
+
const error = view.itemState.error ? /* @__PURE__ */ jsx17("p", { role: "alert", children: getErrorMessage3(view.itemState.error, view.labels.error) }) : null;
|
|
4229
|
+
const actions = view.statusLabel ? /* @__PURE__ */ jsx17(KeepStaleNotice, { item, onRetry, onRemoved }) : /* @__PURE__ */ jsxs15(Fragment8, { children: [
|
|
4230
|
+
showEditButton ? /* @__PURE__ */ jsxs15(Fragment8, { children: [
|
|
4231
|
+
/* @__PURE__ */ jsx17(
|
|
4232
|
+
"button",
|
|
4233
|
+
{
|
|
4234
|
+
ref: editTriggerRef,
|
|
4235
|
+
type: "button",
|
|
4236
|
+
"data-keep-action": "edit",
|
|
4237
|
+
"aria-label": editLabel,
|
|
4238
|
+
"aria-haspopup": "dialog",
|
|
4239
|
+
"aria-expanded": isEditOpen,
|
|
4240
|
+
"aria-controls": editPanelId,
|
|
4241
|
+
onClick: () => {
|
|
4242
|
+
onEdit?.(item);
|
|
4243
|
+
setEditOpen(true);
|
|
4244
|
+
},
|
|
4245
|
+
children: editLabel
|
|
4246
|
+
}
|
|
4247
|
+
),
|
|
4248
|
+
isEditOpen ? /* @__PURE__ */ jsx17("div", { id: editPanelId, role: "dialog", "aria-label": editLabel, "data-keepkit": "item-edit-dialog", children: editSlot ? editSlot(item, closeEdit) : /* @__PURE__ */ jsx17(KeepQuickEditor, { item: view.itemState.item ?? item, onClose: closeEdit }) }) : null
|
|
4249
|
+
] }) : null,
|
|
4250
|
+
showSaveButton ? /* @__PURE__ */ jsx17(KeepItemCardSave, {}) : null,
|
|
4251
|
+
showPinButton ? /* @__PURE__ */ jsx17(KeepItemCardPin, {}) : null,
|
|
4252
|
+
showArchiveButton ? /* @__PURE__ */ jsx17(KeepItemCardArchive, {}) : null,
|
|
4253
|
+
/* @__PURE__ */ jsx17(KeepItemCardRemove, {})
|
|
4083
4254
|
] });
|
|
4084
4255
|
const compoundValue = {
|
|
4085
4256
|
item,
|
|
@@ -4100,12 +4271,12 @@ function KeepItemCardRoot({
|
|
|
4100
4271
|
remove: view.remove,
|
|
4101
4272
|
isMutating: view.itemState.isMutating,
|
|
4102
4273
|
saveAriaLabel: `${view.labels.remove} ${String(view.resolvedTitle)}`,
|
|
4103
|
-
renderText: (content) => /* @__PURE__ */
|
|
4274
|
+
renderText: (content) => /* @__PURE__ */ jsx17(KeepHighlight, { query: searchQuery, children: content })
|
|
4104
4275
|
};
|
|
4105
|
-
const defaultBody = /* @__PURE__ */
|
|
4106
|
-
/* @__PURE__ */
|
|
4107
|
-
/* @__PURE__ */
|
|
4108
|
-
/* @__PURE__ */
|
|
4276
|
+
const defaultBody = /* @__PURE__ */ jsxs15(Fragment8, { children: [
|
|
4277
|
+
/* @__PURE__ */ jsx17(KeepItemCardMedia, {}),
|
|
4278
|
+
/* @__PURE__ */ jsx17(KeepItemCardContent, {}),
|
|
4279
|
+
/* @__PURE__ */ jsx17(KeepItemCardActions, {})
|
|
4109
4280
|
] });
|
|
4110
4281
|
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? defaultBody;
|
|
4111
4282
|
const linkedBody = linkTarget === "card" && view.isAvailable ? renderLink(body) : body;
|
|
@@ -4126,18 +4297,18 @@ function KeepItemCardRoot({
|
|
|
4126
4297
|
linkedBody,
|
|
4127
4298
|
"KeepItemCard"
|
|
4128
4299
|
);
|
|
4129
|
-
return /* @__PURE__ */
|
|
4300
|
+
return /* @__PURE__ */ jsx17(KeepItemCardContext.Provider, { value: compoundValue, children: root });
|
|
4130
4301
|
}
|
|
4131
4302
|
function KeepItemCardMedia({ children, fallback, ...props }) {
|
|
4132
4303
|
const context = useKeepItemCardCompound("Media");
|
|
4133
|
-
return /* @__PURE__ */
|
|
4304
|
+
return /* @__PURE__ */ jsx17("div", { ...props, "data-keep-card-part": "media", "data-media-status": context.imageStatus, "data-aspect-ratio": "1/1", children: children ?? context.image ?? /* @__PURE__ */ jsx17("span", { role: "img", "aria-label": context.fallbackLabel, "data-keep-card-fallback": "true", children: fallback ?? /* @__PURE__ */ jsx17(KeepMediaPlaceholderIcon, {}) }) });
|
|
4134
4305
|
}
|
|
4135
4306
|
function KeepItemCardContent({ children, ...props }) {
|
|
4136
4307
|
const context = useKeepItemCardCompound("Content");
|
|
4137
|
-
return /* @__PURE__ */
|
|
4138
|
-
/* @__PURE__ */
|
|
4308
|
+
return /* @__PURE__ */ jsx17("div", { ...props, "data-keep-card-part": "content", children: children === void 0 ? /* @__PURE__ */ jsxs15(Fragment8, { children: [
|
|
4309
|
+
/* @__PURE__ */ jsx17(KeepItemCardTitle, {}),
|
|
4139
4310
|
context.meta,
|
|
4140
|
-
/* @__PURE__ */
|
|
4311
|
+
/* @__PURE__ */ jsx17(KeepItemCardTags, {}),
|
|
4141
4312
|
context.error
|
|
4142
4313
|
] }) : context.renderText(children) });
|
|
4143
4314
|
}
|
|
@@ -4150,8 +4321,8 @@ function KeepItemCardTitle({ as = "h3", children, ...props }) {
|
|
|
4150
4321
|
);
|
|
4151
4322
|
}
|
|
4152
4323
|
function KeepMediaPlaceholderIcon() {
|
|
4153
|
-
return /* @__PURE__ */
|
|
4154
|
-
/* @__PURE__ */
|
|
4324
|
+
return /* @__PURE__ */ jsxs15("svg", { "data-media-fallback-icon": "true", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
|
|
4325
|
+
/* @__PURE__ */ jsx17(
|
|
4155
4326
|
"path",
|
|
4156
4327
|
{
|
|
4157
4328
|
d: "M4 5.5A1.5 1.5 0 0 1 5.5 4h13A1.5 1.5 0 0 1 20 5.5v13a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 4 18.5v-13Z",
|
|
@@ -4159,23 +4330,23 @@ function KeepMediaPlaceholderIcon() {
|
|
|
4159
4330
|
stroke: "currentColor"
|
|
4160
4331
|
}
|
|
4161
4332
|
),
|
|
4162
|
-
/* @__PURE__ */
|
|
4163
|
-
/* @__PURE__ */
|
|
4333
|
+
/* @__PURE__ */ jsx17("circle", { cx: "9", cy: "9", r: "1.5", fill: "currentColor" }),
|
|
4334
|
+
/* @__PURE__ */ jsx17("path", { d: "m5.5 18 4.5-4.5 3 3 2-2L19 18", fill: "none", stroke: "currentColor" })
|
|
4164
4335
|
] });
|
|
4165
4336
|
}
|
|
4166
4337
|
function KeepItemCardTags({ children, ...props }) {
|
|
4167
4338
|
const context = useKeepItemCardCompound("Tags");
|
|
4168
4339
|
if (children === void 0 && context.renderedTags) return context.renderedTags;
|
|
4169
4340
|
if (children === void 0 && context.tags.length === 0) return null;
|
|
4170
|
-
return /* @__PURE__ */
|
|
4341
|
+
return /* @__PURE__ */ jsx17("ul", { ...props, "aria-label": props["aria-label"] ?? context.tagsLabel, "data-keep-card-part": "tags", children: children ?? context.tags.map((tag) => /* @__PURE__ */ jsx17("li", { children: tag }, tag)) });
|
|
4171
4342
|
}
|
|
4172
4343
|
function KeepItemCardActions({ children, ...props }) {
|
|
4173
4344
|
const context = useKeepItemCardCompound("Actions");
|
|
4174
|
-
return /* @__PURE__ */
|
|
4345
|
+
return /* @__PURE__ */ jsx17("div", { ...props, "data-keep-card-part": "actions", children: children ?? context.actions });
|
|
4175
4346
|
}
|
|
4176
4347
|
function KeepItemCardSave({ labels, getAriaLabel, ...props }) {
|
|
4177
4348
|
const context = useKeepItemCardCompound("Save");
|
|
4178
|
-
return /* @__PURE__ */
|
|
4349
|
+
return /* @__PURE__ */ jsx17(
|
|
4179
4350
|
KeepButton,
|
|
4180
4351
|
{
|
|
4181
4352
|
...props,
|
|
@@ -4188,7 +4359,7 @@ function KeepItemCardSave({ labels, getAriaLabel, ...props }) {
|
|
|
4188
4359
|
}
|
|
4189
4360
|
function KeepItemCardRemove({ children, disabled, onClick, ...props }) {
|
|
4190
4361
|
const context = useKeepItemCardCompound("Remove");
|
|
4191
|
-
return /* @__PURE__ */
|
|
4362
|
+
return /* @__PURE__ */ jsx17(
|
|
4192
4363
|
"button",
|
|
4193
4364
|
{
|
|
4194
4365
|
...props,
|
|
@@ -4205,19 +4376,19 @@ function KeepItemCardRemove({ children, disabled, onClick, ...props }) {
|
|
|
4205
4376
|
}
|
|
4206
4377
|
function KeepItemCardPin({ children, ...props }) {
|
|
4207
4378
|
const context = useKeepItemCardCompound("Pin");
|
|
4208
|
-
return /* @__PURE__ */
|
|
4379
|
+
return /* @__PURE__ */ jsx17(KeepPinButton, { ...props, item: context.item, children });
|
|
4209
4380
|
}
|
|
4210
4381
|
function KeepItemCardArchive({
|
|
4211
4382
|
children,
|
|
4212
4383
|
...props
|
|
4213
4384
|
}) {
|
|
4214
4385
|
const context = useKeepItemCardCompound("Archive");
|
|
4215
|
-
return /* @__PURE__ */
|
|
4386
|
+
return /* @__PURE__ */ jsx17(KeepArchiveButton, { ...props, item: context.item, children });
|
|
4216
4387
|
}
|
|
4217
4388
|
function KeepItemCardCollectionBadge({ children, ...props }) {
|
|
4218
4389
|
const context = useKeepItemCardCompound("CollectionBadge");
|
|
4219
4390
|
if (!context.item.collectionId) return null;
|
|
4220
|
-
return /* @__PURE__ */
|
|
4391
|
+
return /* @__PURE__ */ jsx17("span", { ...props, "data-keep-card-part": "collection-badge", children: children ?? context.collectionLabel });
|
|
4221
4392
|
}
|
|
4222
4393
|
var KeepItemCard = Object.assign(KeepItemCardRoot, {
|
|
4223
4394
|
Media: KeepItemCardMedia,
|
|
@@ -4232,12 +4403,12 @@ var KeepItemCard = Object.assign(KeepItemCardRoot, {
|
|
|
4232
4403
|
CollectionBadge: KeepItemCardCollectionBadge
|
|
4233
4404
|
});
|
|
4234
4405
|
function KeepItemCardSkeleton({ layout = "list", ...props }) {
|
|
4235
|
-
return /* @__PURE__ */
|
|
4236
|
-
/* @__PURE__ */
|
|
4237
|
-
/* @__PURE__ */
|
|
4238
|
-
/* @__PURE__ */
|
|
4239
|
-
/* @__PURE__ */
|
|
4240
|
-
/* @__PURE__ */
|
|
4406
|
+
return /* @__PURE__ */ jsxs15("article", { ...props, "aria-hidden": "true", "data-keepkit": "card-skeleton", "data-layout": layout, "data-state": "loading", children: [
|
|
4407
|
+
/* @__PURE__ */ jsx17("span", { "data-skeleton-part": "media" }),
|
|
4408
|
+
/* @__PURE__ */ jsx17("span", { "data-skeleton-part": "title" }),
|
|
4409
|
+
/* @__PURE__ */ jsx17("span", { "data-skeleton-part": "meta" }),
|
|
4410
|
+
/* @__PURE__ */ jsx17("span", { "data-skeleton-part": "tag" }),
|
|
4411
|
+
/* @__PURE__ */ jsx17("span", { "data-skeleton-part": "tag" })
|
|
4241
4412
|
] });
|
|
4242
4413
|
}
|
|
4243
4414
|
function formatSavedAt(timestamp) {
|
|
@@ -4249,7 +4420,7 @@ function getErrorMessage3(error, fallback) {
|
|
|
4249
4420
|
|
|
4250
4421
|
// src/features/status/KeepEmptyState.tsx
|
|
4251
4422
|
import { isValidElement as isValidElement5 } from "react";
|
|
4252
|
-
import { Fragment as Fragment9, jsx as
|
|
4423
|
+
import { Fragment as Fragment9, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4253
4424
|
function KeepEmptyState({
|
|
4254
4425
|
title,
|
|
4255
4426
|
description,
|
|
@@ -4268,10 +4439,10 @@ function KeepEmptyState({
|
|
|
4268
4439
|
);
|
|
4269
4440
|
const clearLabel = useUiLabel("clearFilters");
|
|
4270
4441
|
const contentChildren = asChild && isValidElement5(children) ? void 0 : children;
|
|
4271
|
-
const body = contentChildren ?? /* @__PURE__ */
|
|
4272
|
-
/* @__PURE__ */
|
|
4273
|
-
description ?? /* @__PURE__ */
|
|
4274
|
-
action ?? (resolvedVariant === "empty-filtered" && onClearFilters ? /* @__PURE__ */
|
|
4442
|
+
const body = contentChildren ?? /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
4443
|
+
/* @__PURE__ */ jsx18("h2", { children: title ?? defaultTitle }),
|
|
4444
|
+
description ?? /* @__PURE__ */ jsx18("p", { children: defaultDescription }),
|
|
4445
|
+
action ?? (resolvedVariant === "empty-filtered" && onClearFilters ? /* @__PURE__ */ jsx18("button", { type: "button", "data-keep-action": "clear-filters", onClick: onClearFilters, children: clearLabel }) : null)
|
|
4275
4446
|
] });
|
|
4276
4447
|
return renderRoot(
|
|
4277
4448
|
asChild,
|
|
@@ -4297,9 +4468,9 @@ function useKeepListView(query) {
|
|
|
4297
4468
|
}
|
|
4298
4469
|
|
|
4299
4470
|
// src/features/collection/hooks/useRovingTabIndex.ts
|
|
4300
|
-
import { useCallback as useCallback5, useEffect as
|
|
4471
|
+
import { useCallback as useCallback5, useEffect as useEffect9, useRef as useRef8 } from "react";
|
|
4301
4472
|
function useRovingTabIndex() {
|
|
4302
|
-
const ref =
|
|
4473
|
+
const ref = useRef8(null);
|
|
4303
4474
|
const getItems = useCallback5(() => {
|
|
4304
4475
|
const root = ref.current;
|
|
4305
4476
|
if (!root) return [];
|
|
@@ -4317,7 +4488,7 @@ function useRovingTabIndex() {
|
|
|
4317
4488
|
item.tabIndex = index === activeIndex ? 0 : -1;
|
|
4318
4489
|
});
|
|
4319
4490
|
}, [getItems]);
|
|
4320
|
-
|
|
4491
|
+
useEffect9(() => {
|
|
4321
4492
|
const root = ref.current;
|
|
4322
4493
|
if (!root) return;
|
|
4323
4494
|
syncTabIndices();
|
|
@@ -4361,13 +4532,124 @@ function useRovingTabIndex() {
|
|
|
4361
4532
|
return { ref, onKeyDown, onFocusCapture };
|
|
4362
4533
|
}
|
|
4363
4534
|
|
|
4535
|
+
// src/features/collection/KeepReorderableList.tsx
|
|
4536
|
+
import { useState as useState13 } from "react";
|
|
4537
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
4538
|
+
function KeepReorderableList({
|
|
4539
|
+
items,
|
|
4540
|
+
onReorder,
|
|
4541
|
+
renderItem,
|
|
4542
|
+
itemLabel = (_item, index) => `Move item ${index + 1}`,
|
|
4543
|
+
...props
|
|
4544
|
+
}) {
|
|
4545
|
+
const [draggedId, setDraggedId] = useState13(null);
|
|
4546
|
+
const [dropTargetIndex, setDropTargetIndex] = useState13(null);
|
|
4547
|
+
const ids = items.map((item) => item.id);
|
|
4548
|
+
function commit(nextIds) {
|
|
4549
|
+
void onReorder(nextIds);
|
|
4550
|
+
}
|
|
4551
|
+
function move(index, targetIndex) {
|
|
4552
|
+
if (targetIndex < 0 || targetIndex >= ids.length || targetIndex === index) return;
|
|
4553
|
+
const next = [...ids];
|
|
4554
|
+
const [id] = next.splice(index, 1);
|
|
4555
|
+
if (id === void 0) return;
|
|
4556
|
+
next.splice(targetIndex, 0, id);
|
|
4557
|
+
commit(next);
|
|
4558
|
+
}
|
|
4559
|
+
function moveToInsertion(index, insertionIndex) {
|
|
4560
|
+
const next = [...ids];
|
|
4561
|
+
const [id] = next.splice(index, 1);
|
|
4562
|
+
if (id === void 0) return;
|
|
4563
|
+
const targetIndex = Math.min(
|
|
4564
|
+
Math.max(0, insertionIndex > index ? insertionIndex - 1 : insertionIndex),
|
|
4565
|
+
next.length
|
|
4566
|
+
);
|
|
4567
|
+
next.splice(targetIndex, 0, id);
|
|
4568
|
+
if (next[index] === id) return;
|
|
4569
|
+
commit(next);
|
|
4570
|
+
}
|
|
4571
|
+
return /* @__PURE__ */ jsx19("ul", { ...props, "data-keepkit": "reorderable-list", children: items.map((item, index) => {
|
|
4572
|
+
const moveUp = () => move(index, index - 1);
|
|
4573
|
+
const moveDown = () => move(index, index + 1);
|
|
4574
|
+
const onHandleKeyDown = (event) => {
|
|
4575
|
+
if (event.key === " ") {
|
|
4576
|
+
event.preventDefault();
|
|
4577
|
+
if (draggedId === item.id) {
|
|
4578
|
+
setDraggedId(null);
|
|
4579
|
+
setDropTargetIndex(null);
|
|
4580
|
+
} else {
|
|
4581
|
+
setDraggedId(item.id);
|
|
4582
|
+
setDropTargetIndex(index);
|
|
4583
|
+
}
|
|
4584
|
+
} else if (event.key === "ArrowUp") {
|
|
4585
|
+
event.preventDefault();
|
|
4586
|
+
moveUp();
|
|
4587
|
+
} else if (event.key === "ArrowDown") {
|
|
4588
|
+
event.preventDefault();
|
|
4589
|
+
moveDown();
|
|
4590
|
+
}
|
|
4591
|
+
};
|
|
4592
|
+
const state = {
|
|
4593
|
+
index,
|
|
4594
|
+
isDragging: draggedId === item.id,
|
|
4595
|
+
moveUp,
|
|
4596
|
+
moveDown,
|
|
4597
|
+
dragHandleProps: {
|
|
4598
|
+
role: "button",
|
|
4599
|
+
tabIndex: 0,
|
|
4600
|
+
draggable: true,
|
|
4601
|
+
"data-drag-handle": "true",
|
|
4602
|
+
"aria-label": itemLabel(item, index),
|
|
4603
|
+
"aria-grabbed": draggedId === item.id,
|
|
4604
|
+
onDragStart: () => {
|
|
4605
|
+
setDraggedId(item.id);
|
|
4606
|
+
setDropTargetIndex(index);
|
|
4607
|
+
},
|
|
4608
|
+
onDragEnd: () => {
|
|
4609
|
+
setDraggedId(null);
|
|
4610
|
+
setDropTargetIndex(null);
|
|
4611
|
+
},
|
|
4612
|
+
onKeyDown: onHandleKeyDown
|
|
4613
|
+
}
|
|
4614
|
+
};
|
|
4615
|
+
return /* @__PURE__ */ jsx19(
|
|
4616
|
+
"li",
|
|
4617
|
+
{
|
|
4618
|
+
"data-reorder-index": index,
|
|
4619
|
+
"data-dragging": draggedId === item.id ? "true" : void 0,
|
|
4620
|
+
"data-drop-target": draggedId && draggedId !== item.id ? dropTargetIndex === index ? "before" : dropTargetIndex === index + 1 ? "after" : void 0 : void 0,
|
|
4621
|
+
onDragOver: (event) => {
|
|
4622
|
+
if (!draggedId || draggedId === item.id) return;
|
|
4623
|
+
event.preventDefault();
|
|
4624
|
+
const bounds = event.currentTarget.getBoundingClientRect();
|
|
4625
|
+
const insertionIndex = event.clientY > bounds.top + bounds.height / 2 ? index + 1 : index;
|
|
4626
|
+
setDropTargetIndex(insertionIndex);
|
|
4627
|
+
},
|
|
4628
|
+
onDragLeave: (event) => {
|
|
4629
|
+
if (event.currentTarget === event.target) setDropTargetIndex(null);
|
|
4630
|
+
},
|
|
4631
|
+
onDrop: (event) => {
|
|
4632
|
+
event.preventDefault();
|
|
4633
|
+
if (!draggedId || draggedId === item.id) return;
|
|
4634
|
+
const sourceIndex = ids.indexOf(draggedId);
|
|
4635
|
+
setDraggedId(null);
|
|
4636
|
+
setDropTargetIndex(null);
|
|
4637
|
+
moveToInsertion(sourceIndex, dropTargetIndex ?? index);
|
|
4638
|
+
},
|
|
4639
|
+
children: renderItem(item, state)
|
|
4640
|
+
},
|
|
4641
|
+
item.id
|
|
4642
|
+
);
|
|
4643
|
+
}) });
|
|
4644
|
+
}
|
|
4645
|
+
|
|
4364
4646
|
// src/features/collection/KeepList.tsx
|
|
4365
|
-
import { Fragment as Fragment10, jsx as
|
|
4647
|
+
import { Fragment as Fragment10, jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4366
4648
|
function KeepList(props) {
|
|
4367
4649
|
const { fallback, onBoundaryError, boundaryResetKey, ...listProps } = props;
|
|
4368
|
-
const content = /* @__PURE__ */
|
|
4650
|
+
const content = /* @__PURE__ */ jsx20(KeepListContent, { ...listProps });
|
|
4369
4651
|
if (fallback === void 0 && onBoundaryError === void 0) return content;
|
|
4370
|
-
return /* @__PURE__ */
|
|
4652
|
+
return /* @__PURE__ */ jsx20(KeepErrorBoundary, { fallback, onError: onBoundaryError, resetKey: boundaryResetKey, children: content });
|
|
4371
4653
|
}
|
|
4372
4654
|
function KeepListContent({
|
|
4373
4655
|
query,
|
|
@@ -4381,6 +4663,8 @@ function KeepListContent({
|
|
|
4381
4663
|
onClearFilters,
|
|
4382
4664
|
itemCardProps,
|
|
4383
4665
|
layout = "list",
|
|
4666
|
+
reorderable = false,
|
|
4667
|
+
onReorder,
|
|
4384
4668
|
asChild = false,
|
|
4385
4669
|
onKeyDown,
|
|
4386
4670
|
onFocusCapture,
|
|
@@ -4402,7 +4686,10 @@ function KeepListContent({
|
|
|
4402
4686
|
allItemCount: view.allState.totalCount,
|
|
4403
4687
|
query,
|
|
4404
4688
|
itemCardProps,
|
|
4405
|
-
layout
|
|
4689
|
+
layout,
|
|
4690
|
+
reorderable,
|
|
4691
|
+
onReorder,
|
|
4692
|
+
reorder: state.reorder
|
|
4406
4693
|
});
|
|
4407
4694
|
return renderRoot(
|
|
4408
4695
|
asChild,
|
|
@@ -4427,7 +4714,7 @@ function KeepListContent({
|
|
|
4427
4714
|
if (!event.defaultPrevented) roving.onFocusCapture(event);
|
|
4428
4715
|
}
|
|
4429
4716
|
},
|
|
4430
|
-
/* @__PURE__ */
|
|
4717
|
+
/* @__PURE__ */ jsx20(KeepSearchQueryProvider, { query: query?.search?.query, children: body }),
|
|
4431
4718
|
"KeepList"
|
|
4432
4719
|
);
|
|
4433
4720
|
}
|
|
@@ -4442,17 +4729,17 @@ function getListBody(state, options) {
|
|
|
4442
4729
|
if (state.isLoading && !state.isHydrated) {
|
|
4443
4730
|
if (options.loading !== void 0) return resolveContent(options.loading, state);
|
|
4444
4731
|
const count = Number.isFinite(options.loadingCount) ? Math.max(0, Math.floor(options.loadingCount)) : 6;
|
|
4445
|
-
return /* @__PURE__ */
|
|
4446
|
-
/* @__PURE__ */
|
|
4447
|
-
/* @__PURE__ */
|
|
4732
|
+
return /* @__PURE__ */ jsxs17(Fragment10, { children: [
|
|
4733
|
+
/* @__PURE__ */ jsx20("span", { role: "status", "data-keepkit": "loading-label", children: options.loadingLabel }),
|
|
4734
|
+
/* @__PURE__ */ jsx20("ul", { "data-keepkit": "skeleton-list", "data-layout": options.layout, children: Array.from({ length: count }, (_, index) => (
|
|
4448
4735
|
// biome-ignore lint/suspicious/noArrayIndexKey: Static loading placeholders never reorder.
|
|
4449
|
-
/* @__PURE__ */
|
|
4736
|
+
/* @__PURE__ */ jsx20("li", { children: /* @__PURE__ */ jsx20(KeepItemCardSkeleton, { layout: options.layout }) }, index)
|
|
4450
4737
|
)) })
|
|
4451
4738
|
] });
|
|
4452
4739
|
}
|
|
4453
4740
|
if (state.isHydrated && state.items.length === 0) {
|
|
4454
4741
|
if (options.empty !== void 0) return resolveContent(options.empty, state);
|
|
4455
|
-
return /* @__PURE__ */
|
|
4742
|
+
return /* @__PURE__ */ jsx20(
|
|
4456
4743
|
KeepEmptyState,
|
|
4457
4744
|
{
|
|
4458
4745
|
variant: options.allItemCount > 0 && hasActiveQueryFilters(options.query) ? "empty-filtered" : "empty-storage",
|
|
@@ -4462,24 +4749,41 @@ function getListBody(state, options) {
|
|
|
4462
4749
|
}
|
|
4463
4750
|
if (typeof options.children === "function") return options.children(state);
|
|
4464
4751
|
if (options.children !== void 0 && !isValidElement6(options.children)) return options.children;
|
|
4465
|
-
|
|
4466
|
-
|
|
4752
|
+
if (options.reorderable) {
|
|
4753
|
+
return /* @__PURE__ */ jsx20(
|
|
4754
|
+
KeepReorderableList,
|
|
4755
|
+
{
|
|
4756
|
+
items: state.items,
|
|
4757
|
+
onReorder: async (orderedIds) => {
|
|
4758
|
+
await options.reorder(orderedIds);
|
|
4759
|
+
await options.onReorder?.(orderedIds);
|
|
4760
|
+
},
|
|
4761
|
+
renderItem: (item, reorderState) => /* @__PURE__ */ jsxs17(Fragment10, { children: [
|
|
4762
|
+
/* @__PURE__ */ jsx20("button", { type: "button", ...reorderState.dragHandleProps, children: "\u2195" }),
|
|
4763
|
+
options.renderItem ? options.renderItem(item, state) : /* @__PURE__ */ jsx20(KeepItemCard, { item, ...options.itemCardProps })
|
|
4764
|
+
] }),
|
|
4765
|
+
"data-layout": options.layout
|
|
4766
|
+
}
|
|
4767
|
+
);
|
|
4768
|
+
}
|
|
4769
|
+
return /* @__PURE__ */ jsx20("ul", { "data-layout": options.layout, children: state.items.map(
|
|
4770
|
+
(item) => options.renderItem ? options.renderItem(item, state) : /* @__PURE__ */ jsx20("li", { children: /* @__PURE__ */ jsx20(KeepItemCard, { item, ...options.itemCardProps }) }, item.id)
|
|
4467
4771
|
) });
|
|
4468
4772
|
}
|
|
4469
4773
|
function hasActiveQueryFilters(query) {
|
|
4470
4774
|
if (!query) return false;
|
|
4471
4775
|
return Boolean(
|
|
4472
|
-
query.search?.query?.trim() || query.tags?.some((tag) => tag.trim()) || query.targetType || query.savedBetween || query.
|
|
4776
|
+
query.search?.query?.trim() || query.tags?.some((tag) => tag.trim()) || query.targetType || query.savedBetween || query.archiveScope !== void 0 && query.archiveScope !== "active" || query.collectionId || query.filter
|
|
4473
4777
|
);
|
|
4474
4778
|
}
|
|
4475
4779
|
|
|
4476
4780
|
// src/features/collection/KeepCollection.tsx
|
|
4477
|
-
import { jsx as
|
|
4781
|
+
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4478
4782
|
function KeepCollection(props) {
|
|
4479
4783
|
const { fallback, onBoundaryError, boundaryResetKey, ...collectionProps } = props;
|
|
4480
|
-
const content = /* @__PURE__ */
|
|
4784
|
+
const content = /* @__PURE__ */ jsx21(KeepCollectionContent, { ...collectionProps });
|
|
4481
4785
|
if (fallback === void 0 && onBoundaryError === void 0) return content;
|
|
4482
|
-
return /* @__PURE__ */
|
|
4786
|
+
return /* @__PURE__ */ jsx21(KeepErrorBoundary2, { fallback, onError: onBoundaryError, resetKey: boundaryResetKey, children: content });
|
|
4483
4787
|
}
|
|
4484
4788
|
function KeepCollectionContent({
|
|
4485
4789
|
query = {},
|
|
@@ -4487,6 +4791,10 @@ function KeepCollectionContent({
|
|
|
4487
4791
|
layout = "list",
|
|
4488
4792
|
urlSync = false,
|
|
4489
4793
|
urlAdapter,
|
|
4794
|
+
archiveScope,
|
|
4795
|
+
onArchiveScopeChange,
|
|
4796
|
+
reorderable = false,
|
|
4797
|
+
onReorder,
|
|
4490
4798
|
features,
|
|
4491
4799
|
collectionLabels,
|
|
4492
4800
|
renderItem,
|
|
@@ -4500,14 +4808,38 @@ function KeepCollectionContent({
|
|
|
4500
4808
|
className,
|
|
4501
4809
|
...rootProps
|
|
4502
4810
|
}) {
|
|
4503
|
-
const view = useKeepCollection({ query, pageSize, urlSync, urlAdapter, features });
|
|
4811
|
+
const view = useKeepCollection({ query, pageSize, urlSync, urlAdapter, features, archiveScope });
|
|
4812
|
+
const [reorderUndoIds, setReorderUndoIds] = useState14(null);
|
|
4813
|
+
const reorderUndoLabel = useUiLabel("undoReorder");
|
|
4814
|
+
const handleReorder = async (orderedIds) => {
|
|
4815
|
+
const previousIds = view.list.items.map((item) => item.id);
|
|
4816
|
+
await view.list.reorder(orderedIds);
|
|
4817
|
+
const itemsById = new Map(view.list.items.map((item) => [item.id, item]));
|
|
4818
|
+
const orderedItems = orderedIds.flatMap((id) => {
|
|
4819
|
+
const item = itemsById.get(id);
|
|
4820
|
+
return item ? [item] : [];
|
|
4821
|
+
});
|
|
4822
|
+
setReorderUndoIds(previousIds);
|
|
4823
|
+
await onReorder?.(orderedItems);
|
|
4824
|
+
};
|
|
4825
|
+
useEffect10(() => {
|
|
4826
|
+
if (!reorderUndoIds) return;
|
|
4827
|
+
const timer = window.setTimeout(() => setReorderUndoIds(null), 5e3);
|
|
4828
|
+
return () => window.clearTimeout(timer);
|
|
4829
|
+
}, [reorderUndoIds]);
|
|
4830
|
+
const undoReorder = async () => {
|
|
4831
|
+
if (!reorderUndoIds) return;
|
|
4832
|
+
const previous = reorderUndoIds;
|
|
4833
|
+
setReorderUndoIds(null);
|
|
4834
|
+
await view.list.reorder(previous);
|
|
4835
|
+
};
|
|
4504
4836
|
const resolvedItemCardProps = {
|
|
4505
4837
|
...itemCardProps,
|
|
4506
4838
|
showTags: itemCardProps?.showTags ?? view.enabled.tags,
|
|
4507
4839
|
showPinButton: itemCardProps?.showPinButton ?? view.enabled.pin,
|
|
4508
4840
|
showArchiveButton: itemCardProps?.showArchiveButton ?? view.enabled.archive
|
|
4509
4841
|
};
|
|
4510
|
-
return /* @__PURE__ */
|
|
4842
|
+
return /* @__PURE__ */ jsxs18(
|
|
4511
4843
|
"section",
|
|
4512
4844
|
{
|
|
4513
4845
|
...rootProps,
|
|
@@ -4518,20 +4850,30 @@ function KeepCollectionContent({
|
|
|
4518
4850
|
"data-state": getCollectionState(view.list),
|
|
4519
4851
|
"data-loading": view.list.isLoading || view.list.isMutating ? "true" : void 0,
|
|
4520
4852
|
children: [
|
|
4521
|
-
/* @__PURE__ */
|
|
4522
|
-
view.enabled.search ? /* @__PURE__ */
|
|
4523
|
-
view.enabled.sort ? /* @__PURE__ */
|
|
4524
|
-
view.enabled.tagFilter ? /* @__PURE__ */
|
|
4525
|
-
view.enabled.collectionFilter ? /* @__PURE__ */
|
|
4853
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
4854
|
+
view.enabled.search ? /* @__PURE__ */ jsx21(KeepSearchInput, { value: view.searchValue, onValueChange: view.setSearchValue }) : null,
|
|
4855
|
+
view.enabled.sort ? /* @__PURE__ */ jsx21(KeepSortSelect, { value: view.sortValue, onValueChange: view.setSortValue }) : null,
|
|
4856
|
+
view.enabled.tagFilter ? /* @__PURE__ */ jsx21(KeepTagFilter, { query, value: view.activeTags[0], onValueChange: view.setTag }) : null,
|
|
4857
|
+
view.enabled.collectionFilter ? /* @__PURE__ */ jsx21(
|
|
4526
4858
|
KeepCollectionFilter,
|
|
4527
4859
|
{
|
|
4528
4860
|
value: view.activeCollection,
|
|
4529
4861
|
onValueChange: view.setCollection,
|
|
4530
4862
|
collectionLabels
|
|
4531
4863
|
}
|
|
4864
|
+
) : null,
|
|
4865
|
+
archiveScope !== void 0 ? /* @__PURE__ */ jsx21(
|
|
4866
|
+
KeepArchiveScopeSelect,
|
|
4867
|
+
{
|
|
4868
|
+
value: view.archiveScope,
|
|
4869
|
+
onValueChange: (next) => {
|
|
4870
|
+
view.setArchiveScope(next);
|
|
4871
|
+
onArchiveScopeChange?.(next);
|
|
4872
|
+
}
|
|
4873
|
+
}
|
|
4532
4874
|
) : null
|
|
4533
4875
|
] }),
|
|
4534
|
-
activeFilters === void 0 ? /* @__PURE__ */
|
|
4876
|
+
activeFilters === void 0 ? /* @__PURE__ */ jsx21(
|
|
4535
4877
|
KeepActiveFiltersSummary,
|
|
4536
4878
|
{
|
|
4537
4879
|
search: view.searchValue,
|
|
@@ -4541,7 +4883,7 @@ function KeepCollectionContent({
|
|
|
4541
4883
|
onClear: view.clearFilters
|
|
4542
4884
|
}
|
|
4543
4885
|
) : resolveContent(activeFilters, view.list),
|
|
4544
|
-
/* @__PURE__ */
|
|
4886
|
+
/* @__PURE__ */ jsx21(
|
|
4545
4887
|
KeepList,
|
|
4546
4888
|
{
|
|
4547
4889
|
query: view.resolvedQuery,
|
|
@@ -4552,11 +4894,13 @@ function KeepCollectionContent({
|
|
|
4552
4894
|
renderLoading,
|
|
4553
4895
|
loadingCount,
|
|
4554
4896
|
onClearFilters: view.clearFilters,
|
|
4897
|
+
reorderable,
|
|
4898
|
+
onReorder: reorderable ? handleReorder : void 0,
|
|
4555
4899
|
empty: view.list.totalCount === 0 && view.allState.totalCount > 0 ? void 0 : empty,
|
|
4556
4900
|
error
|
|
4557
4901
|
}
|
|
4558
4902
|
),
|
|
4559
|
-
view.enabled.pagination ? /* @__PURE__ */
|
|
4903
|
+
view.enabled.pagination ? /* @__PURE__ */ jsx21(
|
|
4560
4904
|
KeepPagination,
|
|
4561
4905
|
{
|
|
4562
4906
|
totalCount: view.list.totalCount,
|
|
@@ -4565,7 +4909,8 @@ function KeepCollectionContent({
|
|
|
4565
4909
|
onPageChange: view.setPage
|
|
4566
4910
|
}
|
|
4567
4911
|
) : null,
|
|
4568
|
-
view.enabled.bulkActions ? /* @__PURE__ */
|
|
4912
|
+
view.enabled.bulkActions ? /* @__PURE__ */ jsx21(KeepBulkActions, { query: view.resolvedQuery }) : null,
|
|
4913
|
+
reorderable && reorderUndoIds ? /* @__PURE__ */ jsx21("div", { "data-keepkit": "reorder-feedback", role: "status", "aria-live": "polite", children: /* @__PURE__ */ jsx21("button", { type: "button", "data-keep-action": "undo-reorder", onClick: () => void undoReorder(), children: reorderUndoLabel }) }) : null
|
|
4569
4914
|
]
|
|
4570
4915
|
}
|
|
4571
4916
|
);
|
|
@@ -4578,12 +4923,12 @@ function getCollectionState(list) {
|
|
|
4578
4923
|
}
|
|
4579
4924
|
|
|
4580
4925
|
// src/features/collection/KeepLayout.tsx
|
|
4581
|
-
import { jsx as
|
|
4926
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
4582
4927
|
function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...props }) {
|
|
4583
4928
|
const roving = useRovingTabIndex();
|
|
4584
4929
|
return (
|
|
4585
4930
|
// biome-ignore lint/a11y/noStaticElementInteractions: The group manages keyboard focus for descendant cards.
|
|
4586
|
-
/* @__PURE__ */
|
|
4931
|
+
/* @__PURE__ */ jsx22(
|
|
4587
4932
|
"div",
|
|
4588
4933
|
{
|
|
4589
4934
|
...props,
|
|
@@ -4606,113 +4951,11 @@ function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...p
|
|
|
4606
4951
|
);
|
|
4607
4952
|
}
|
|
4608
4953
|
|
|
4609
|
-
// src/features/collection/KeepReorderableList.tsx
|
|
4610
|
-
import { useState as useState12 } from "react";
|
|
4611
|
-
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
4612
|
-
function KeepReorderableList({
|
|
4613
|
-
items,
|
|
4614
|
-
onReorder,
|
|
4615
|
-
renderItem,
|
|
4616
|
-
itemLabel = (_item, index) => `Move item ${index + 1}`,
|
|
4617
|
-
...props
|
|
4618
|
-
}) {
|
|
4619
|
-
const [draggedId, setDraggedId] = useState12(null);
|
|
4620
|
-
const [dropTargetIndex, setDropTargetIndex] = useState12(null);
|
|
4621
|
-
const ids = items.map((item) => item.id);
|
|
4622
|
-
function commit(nextIds) {
|
|
4623
|
-
void onReorder(nextIds);
|
|
4624
|
-
}
|
|
4625
|
-
function move(index, targetIndex) {
|
|
4626
|
-
if (targetIndex < 0 || targetIndex >= ids.length || targetIndex === index) return;
|
|
4627
|
-
const next = [...ids];
|
|
4628
|
-
const [id] = next.splice(index, 1);
|
|
4629
|
-
if (id === void 0) return;
|
|
4630
|
-
next.splice(targetIndex, 0, id);
|
|
4631
|
-
commit(next);
|
|
4632
|
-
}
|
|
4633
|
-
function moveToInsertion(index, insertionIndex) {
|
|
4634
|
-
const next = [...ids];
|
|
4635
|
-
const [id] = next.splice(index, 1);
|
|
4636
|
-
if (id === void 0) return;
|
|
4637
|
-
const targetIndex = Math.min(
|
|
4638
|
-
Math.max(0, insertionIndex > index ? insertionIndex - 1 : insertionIndex),
|
|
4639
|
-
next.length
|
|
4640
|
-
);
|
|
4641
|
-
next.splice(targetIndex, 0, id);
|
|
4642
|
-
if (next[index] === id) return;
|
|
4643
|
-
commit(next);
|
|
4644
|
-
}
|
|
4645
|
-
return /* @__PURE__ */ jsx21("ul", { ...props, "data-keepkit": "reorderable-list", children: items.map((item, index) => {
|
|
4646
|
-
const moveUp = () => move(index, index - 1);
|
|
4647
|
-
const moveDown = () => move(index, index + 1);
|
|
4648
|
-
const onHandleKeyDown = (event) => {
|
|
4649
|
-
if (event.key === "ArrowUp") {
|
|
4650
|
-
event.preventDefault();
|
|
4651
|
-
moveUp();
|
|
4652
|
-
} else if (event.key === "ArrowDown") {
|
|
4653
|
-
event.preventDefault();
|
|
4654
|
-
moveDown();
|
|
4655
|
-
}
|
|
4656
|
-
};
|
|
4657
|
-
const state = {
|
|
4658
|
-
index,
|
|
4659
|
-
isDragging: draggedId === item.id,
|
|
4660
|
-
moveUp,
|
|
4661
|
-
moveDown,
|
|
4662
|
-
dragHandleProps: {
|
|
4663
|
-
role: "button",
|
|
4664
|
-
tabIndex: 0,
|
|
4665
|
-
draggable: true,
|
|
4666
|
-
"data-drag-handle": "true",
|
|
4667
|
-
"aria-label": itemLabel(item, index),
|
|
4668
|
-
"aria-grabbed": draggedId === item.id,
|
|
4669
|
-
onDragStart: () => {
|
|
4670
|
-
setDraggedId(item.id);
|
|
4671
|
-
setDropTargetIndex(index);
|
|
4672
|
-
},
|
|
4673
|
-
onDragEnd: () => {
|
|
4674
|
-
setDraggedId(null);
|
|
4675
|
-
setDropTargetIndex(null);
|
|
4676
|
-
},
|
|
4677
|
-
onKeyDown: onHandleKeyDown
|
|
4678
|
-
}
|
|
4679
|
-
};
|
|
4680
|
-
return /* @__PURE__ */ jsx21(
|
|
4681
|
-
"li",
|
|
4682
|
-
{
|
|
4683
|
-
"data-reorder-index": index,
|
|
4684
|
-
"data-dragging": draggedId === item.id ? "true" : void 0,
|
|
4685
|
-
"data-drop-target": draggedId && draggedId !== item.id ? dropTargetIndex === index ? "before" : dropTargetIndex === index + 1 ? "after" : void 0 : void 0,
|
|
4686
|
-
onDragOver: (event) => {
|
|
4687
|
-
if (!draggedId || draggedId === item.id) return;
|
|
4688
|
-
event.preventDefault();
|
|
4689
|
-
const bounds = event.currentTarget.getBoundingClientRect();
|
|
4690
|
-
const insertionIndex = event.clientY > bounds.top + bounds.height / 2 ? index + 1 : index;
|
|
4691
|
-
setDropTargetIndex(insertionIndex);
|
|
4692
|
-
},
|
|
4693
|
-
onDragLeave: (event) => {
|
|
4694
|
-
if (event.currentTarget === event.target) setDropTargetIndex(null);
|
|
4695
|
-
},
|
|
4696
|
-
onDrop: (event) => {
|
|
4697
|
-
event.preventDefault();
|
|
4698
|
-
if (!draggedId || draggedId === item.id) return;
|
|
4699
|
-
const sourceIndex = ids.indexOf(draggedId);
|
|
4700
|
-
setDraggedId(null);
|
|
4701
|
-
setDropTargetIndex(null);
|
|
4702
|
-
moveToInsertion(sourceIndex, dropTargetIndex ?? index);
|
|
4703
|
-
},
|
|
4704
|
-
children: renderItem(item, state)
|
|
4705
|
-
},
|
|
4706
|
-
item.id
|
|
4707
|
-
);
|
|
4708
|
-
}) });
|
|
4709
|
-
}
|
|
4710
|
-
|
|
4711
4954
|
// src/features/editor/KeepNoteEditor.tsx
|
|
4712
4955
|
import { isValidElement as isValidElement7 } from "react";
|
|
4713
4956
|
|
|
4714
4957
|
// src/features/navigation/KeepShortcutHint.tsx
|
|
4715
|
-
import { jsx as
|
|
4958
|
+
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4716
4959
|
function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
4717
4960
|
const keys = typeof shortcut === "string" ? shortcut.split("+") : [...shortcut];
|
|
4718
4961
|
const occurrences = /* @__PURE__ */ new Map();
|
|
@@ -4721,23 +4964,23 @@ function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
|
4721
4964
|
occurrences.set(key, occurrence + 1);
|
|
4722
4965
|
return { id: `${key}-${occurrence}`, value: key };
|
|
4723
4966
|
});
|
|
4724
|
-
return /* @__PURE__ */
|
|
4725
|
-
index > 0 ? /* @__PURE__ */
|
|
4726
|
-
/* @__PURE__ */
|
|
4967
|
+
return /* @__PURE__ */ jsx23("span", { ...props, "data-keepkit": "shortcut-hint", "aria-hidden": props["aria-hidden"] ?? true, children: keyedKeys.map((key, index) => /* @__PURE__ */ jsxs19("span", { children: [
|
|
4968
|
+
index > 0 ? /* @__PURE__ */ jsx23("span", { "data-shortcut-separator": "true", children: separator }) : null,
|
|
4969
|
+
/* @__PURE__ */ jsx23("kbd", { children: key.value.trim() })
|
|
4727
4970
|
] }, key.id)) });
|
|
4728
4971
|
}
|
|
4729
4972
|
|
|
4730
4973
|
// src/features/editor/hooks/useKeepNoteEditor.ts
|
|
4731
4974
|
import { useKeepItem as useKeepItem6 } from "@keepkit/core/react";
|
|
4732
|
-
import { useCallback as useCallback6, useEffect as
|
|
4975
|
+
import { useCallback as useCallback6, useEffect as useEffect11, useRef as useRef9, useState as useState15 } from "react";
|
|
4733
4976
|
function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
4734
4977
|
const itemState = useKeepItem6(item);
|
|
4735
4978
|
const { error, isMutating, item: savedItem, updateNote } = itemState;
|
|
4736
|
-
const [note, setNote] =
|
|
4979
|
+
const [note, setNote] = useState15(item.note ?? "");
|
|
4737
4980
|
const baselineNote = savedItem?.note ?? item.note ?? "";
|
|
4738
4981
|
const isDirty = note !== baselineNote;
|
|
4739
|
-
const lastSavedNoteRef =
|
|
4740
|
-
|
|
4982
|
+
const lastSavedNoteRef = useRef9(void 0);
|
|
4983
|
+
useEffect11(() => setNote(baselineNote), [baselineNote]);
|
|
4741
4984
|
const save = useCallback6(async () => {
|
|
4742
4985
|
const nextNote = note.trim() || void 0;
|
|
4743
4986
|
try {
|
|
@@ -4749,7 +4992,7 @@ function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
|
4749
4992
|
throw cause;
|
|
4750
4993
|
}
|
|
4751
4994
|
}, [note, onSaveError, onSaved, updateNote]);
|
|
4752
|
-
|
|
4995
|
+
useEffect11(() => {
|
|
4753
4996
|
if (!isDirty || debounceMs <= 0 || lastSavedNoteRef.current === note) return;
|
|
4754
4997
|
const timer = window.setTimeout(() => void save().catch(() => void 0), debounceMs);
|
|
4755
4998
|
return () => window.clearTimeout(timer);
|
|
@@ -4784,7 +5027,7 @@ function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
|
4784
5027
|
}
|
|
4785
5028
|
|
|
4786
5029
|
// src/features/editor/KeepNoteEditor.tsx
|
|
4787
|
-
import { Fragment as Fragment11, jsx as
|
|
5030
|
+
import { Fragment as Fragment11, jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4788
5031
|
function KeepNoteEditor({
|
|
4789
5032
|
item,
|
|
4790
5033
|
label,
|
|
@@ -4803,10 +5046,10 @@ function KeepNoteEditor({
|
|
|
4803
5046
|
const view = useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError });
|
|
4804
5047
|
const { error, isDirty, isSaving, note, setNote } = view.state;
|
|
4805
5048
|
const contentChildren = asChild && isValidElement7(children) ? void 0 : children;
|
|
4806
|
-
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */
|
|
4807
|
-
/* @__PURE__ */
|
|
5049
|
+
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */ jsxs20(Fragment11, { children: [
|
|
5050
|
+
/* @__PURE__ */ jsxs20("label", { children: [
|
|
4808
5051
|
label ?? view.labels.note,
|
|
4809
|
-
/* @__PURE__ */
|
|
5052
|
+
/* @__PURE__ */ jsx24(
|
|
4810
5053
|
"textarea",
|
|
4811
5054
|
{
|
|
4812
5055
|
"data-keep-action": "edit-note",
|
|
@@ -4818,13 +5061,13 @@ function KeepNoteEditor({
|
|
|
4818
5061
|
}
|
|
4819
5062
|
)
|
|
4820
5063
|
] }),
|
|
4821
|
-
/* @__PURE__ */
|
|
5064
|
+
/* @__PURE__ */ jsxs20("button", { type: "submit", "data-keep-action": "save-note", disabled: isSaving, "aria-busy": isSaving, children: [
|
|
4822
5065
|
saveLabel ?? view.labels.save,
|
|
4823
|
-
showShortcutHint ? /* @__PURE__ */
|
|
5066
|
+
showShortcutHint ? /* @__PURE__ */ jsx24(KeepShortcutHint, { shortcut: "Ctrl+Enter" }) : null
|
|
4824
5067
|
] })
|
|
4825
5068
|
] });
|
|
4826
5069
|
if (!asChild) {
|
|
4827
|
-
return /* @__PURE__ */
|
|
5070
|
+
return /* @__PURE__ */ jsxs20(
|
|
4828
5071
|
"form",
|
|
4829
5072
|
{
|
|
4830
5073
|
...formProps,
|
|
@@ -4837,7 +5080,7 @@ function KeepNoteEditor({
|
|
|
4837
5080
|
"data-disabled": isSaving ? "true" : void 0,
|
|
4838
5081
|
children: [
|
|
4839
5082
|
body,
|
|
4840
|
-
error ? /* @__PURE__ */
|
|
5083
|
+
error ? /* @__PURE__ */ jsx24("p", { role: "alert", children: getErrorMessage4(error, view.labels.error) }) : null
|
|
4841
5084
|
]
|
|
4842
5085
|
}
|
|
4843
5086
|
);
|
|
@@ -4865,12 +5108,12 @@ function getErrorMessage4(error, fallback) {
|
|
|
4865
5108
|
|
|
4866
5109
|
// src/features/editor/hooks/useKeepTagEditor.ts
|
|
4867
5110
|
import { useKeepItem as useKeepItem7 } from "@keepkit/core/react";
|
|
4868
|
-
import { useCallback as useCallback7, useEffect as
|
|
5111
|
+
import { useCallback as useCallback7, useEffect as useEffect12, useState as useState16 } from "react";
|
|
4869
5112
|
function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
4870
5113
|
const itemState = useKeepItem7(item);
|
|
4871
|
-
const [tags, setTags] =
|
|
4872
|
-
const [input, setInput] =
|
|
4873
|
-
|
|
5114
|
+
const [tags, setTags] = useState16(item.tags ?? []);
|
|
5115
|
+
const [input, setInput] = useState16("");
|
|
5116
|
+
useEffect12(() => setTags(itemState.item?.tags ?? item.tags ?? []), [item.tags, itemState.item?.tags]);
|
|
4874
5117
|
const save = useCallback7(async () => {
|
|
4875
5118
|
const nextTags = normalizeUiTags(tags);
|
|
4876
5119
|
try {
|
|
@@ -4917,7 +5160,7 @@ function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
|
4917
5160
|
}
|
|
4918
5161
|
|
|
4919
5162
|
// src/features/editor/KeepTagEditor.tsx
|
|
4920
|
-
import { Fragment as Fragment12, jsx as
|
|
5163
|
+
import { Fragment as Fragment12, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4921
5164
|
function KeepTagEditor({
|
|
4922
5165
|
item,
|
|
4923
5166
|
availableTags = [],
|
|
@@ -4928,10 +5171,10 @@ function KeepTagEditor({
|
|
|
4928
5171
|
}) {
|
|
4929
5172
|
const view = useKeepTagEditor({ item, onSaved, onSaveError });
|
|
4930
5173
|
const { isSaving, tags } = view.state;
|
|
4931
|
-
const body = render ? render(view.state) : /* @__PURE__ */
|
|
4932
|
-
/* @__PURE__ */
|
|
5174
|
+
const body = render ? render(view.state) : /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
5175
|
+
/* @__PURE__ */ jsxs21("label", { children: [
|
|
4933
5176
|
view.labels.tags,
|
|
4934
|
-
/* @__PURE__ */
|
|
5177
|
+
/* @__PURE__ */ jsx25(
|
|
4935
5178
|
"input",
|
|
4936
5179
|
{
|
|
4937
5180
|
"data-keep-action": "edit-tags",
|
|
@@ -4942,14 +5185,14 @@ function KeepTagEditor({
|
|
|
4942
5185
|
}
|
|
4943
5186
|
)
|
|
4944
5187
|
] }),
|
|
4945
|
-
availableTags.length > 0 ? /* @__PURE__ */
|
|
4946
|
-
/* @__PURE__ */
|
|
5188
|
+
availableTags.length > 0 ? /* @__PURE__ */ jsx25("datalist", { id: `keep-tags-${item.id}`, children: availableTags.map((tag) => /* @__PURE__ */ jsx25("option", { value: tag }, tag)) }) : null,
|
|
5189
|
+
/* @__PURE__ */ jsx25("ul", { "aria-label": view.labels.tags, children: tags.map((tag) => /* @__PURE__ */ jsxs21("li", { children: [
|
|
4947
5190
|
tag,
|
|
4948
|
-
/* @__PURE__ */
|
|
5191
|
+
/* @__PURE__ */ jsx25("button", { type: "button", "data-keep-action": "remove-tag", onClick: () => view.removeTag(tag), children: view.labels.remove })
|
|
4949
5192
|
] }, tag)) }),
|
|
4950
|
-
/* @__PURE__ */
|
|
5193
|
+
/* @__PURE__ */ jsx25("button", { type: "submit", "data-keep-action": "apply-tags", disabled: isSaving, "aria-busy": isSaving, children: view.labels.apply })
|
|
4951
5194
|
] });
|
|
4952
|
-
return /* @__PURE__ */
|
|
5195
|
+
return /* @__PURE__ */ jsxs21(
|
|
4953
5196
|
"form",
|
|
4954
5197
|
{
|
|
4955
5198
|
...props,
|
|
@@ -4961,7 +5204,7 @@ function KeepTagEditor({
|
|
|
4961
5204
|
"data-disabled": isSaving ? "true" : void 0,
|
|
4962
5205
|
children: [
|
|
4963
5206
|
body,
|
|
4964
|
-
view.error ? /* @__PURE__ */
|
|
5207
|
+
view.error ? /* @__PURE__ */ jsx25("p", { role: "alert", children: getErrorMessage5(view.error, view.labels.error) }) : null
|
|
4965
5208
|
]
|
|
4966
5209
|
}
|
|
4967
5210
|
);
|
|
@@ -4992,10 +5235,10 @@ function useKeepToastFeedback(showToast) {
|
|
|
4992
5235
|
|
|
4993
5236
|
// src/features/navigation/KeepTourBar.tsx
|
|
4994
5237
|
import { useKeepNavigator } from "@keepkit/core/react";
|
|
4995
|
-
import { useId as
|
|
5238
|
+
import { useId as useId3 } from "react";
|
|
4996
5239
|
|
|
4997
5240
|
// src/features/navigation/hooks/useKeepTourShortcuts.ts
|
|
4998
|
-
import { useEffect as
|
|
5241
|
+
import { useEffect as useEffect13 } from "react";
|
|
4999
5242
|
function useKeepTourShortcuts({
|
|
5000
5243
|
onNext,
|
|
5001
5244
|
onPrev,
|
|
@@ -5006,7 +5249,7 @@ function useKeepTourShortcuts({
|
|
|
5006
5249
|
prevKeys = ["k", "["],
|
|
5007
5250
|
onError
|
|
5008
5251
|
}) {
|
|
5009
|
-
|
|
5252
|
+
useEffect13(() => {
|
|
5010
5253
|
if (!enabled) return;
|
|
5011
5254
|
const handleKeyDown = (event) => {
|
|
5012
5255
|
if (!allowInEditable && isEditableTarget(event.target)) return;
|
|
@@ -5027,7 +5270,7 @@ function isEditableTarget(target) {
|
|
|
5027
5270
|
}
|
|
5028
5271
|
|
|
5029
5272
|
// src/features/navigation/KeepTourBar.tsx
|
|
5030
|
-
import { Fragment as Fragment13, jsx as
|
|
5273
|
+
import { Fragment as Fragment13, jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5031
5274
|
function KeepTourBar({
|
|
5032
5275
|
navigation: providedNavigation,
|
|
5033
5276
|
currentId,
|
|
@@ -5036,6 +5279,9 @@ function KeepTourBar({
|
|
|
5036
5279
|
prevHref,
|
|
5037
5280
|
nextHref,
|
|
5038
5281
|
backHref,
|
|
5282
|
+
getItemHref,
|
|
5283
|
+
getBackHref,
|
|
5284
|
+
onNavigate,
|
|
5039
5285
|
onPrev,
|
|
5040
5286
|
onNext,
|
|
5041
5287
|
onBack,
|
|
@@ -5057,8 +5303,33 @@ function KeepTourBar({
|
|
|
5057
5303
|
const nextItemLabel = useUiLabel("nextPage", nextLabel);
|
|
5058
5304
|
const listLabel = useUiLabel("allItems", backLabel);
|
|
5059
5305
|
const { labels } = useKeepUiLabels();
|
|
5060
|
-
const
|
|
5061
|
-
const
|
|
5306
|
+
const resolvedPrevHref = prevHref ?? (navigation.prevItem ? getItemHref?.(navigation.prevItem) : void 0);
|
|
5307
|
+
const resolvedNextHref = nextHref ?? (navigation.nextItem ? getItemHref?.(navigation.nextItem) : void 0);
|
|
5308
|
+
const resolvedBackHref = backHref ?? getBackHref?.();
|
|
5309
|
+
const navigateByKeyboard = (direction) => {
|
|
5310
|
+
const item = direction === "prev" ? navigation.goToPrev() : navigation.goToNext();
|
|
5311
|
+
if (!item) return;
|
|
5312
|
+
onNavigate?.(direction, item);
|
|
5313
|
+
const handler = direction === "prev" ? onPrev : onNext;
|
|
5314
|
+
if (handler) return handler();
|
|
5315
|
+
navigateTo(item, direction === "prev" ? resolvedPrevHref : resolvedNextHref);
|
|
5316
|
+
};
|
|
5317
|
+
const resolvedPrev = () => navigateByKeyboard("prev");
|
|
5318
|
+
const resolvedNext = () => navigateByKeyboard("next");
|
|
5319
|
+
const notifyPrevNavigation = () => {
|
|
5320
|
+
const item = navigation.prevItem;
|
|
5321
|
+
if (!item) return;
|
|
5322
|
+
navigation.goToPrev();
|
|
5323
|
+
onNavigate?.("prev", item);
|
|
5324
|
+
void onPrev?.();
|
|
5325
|
+
};
|
|
5326
|
+
const notifyNextNavigation = () => {
|
|
5327
|
+
const item = navigation.nextItem;
|
|
5328
|
+
if (!item) return;
|
|
5329
|
+
navigation.goToNext();
|
|
5330
|
+
onNavigate?.("next", item);
|
|
5331
|
+
void onNext?.();
|
|
5332
|
+
};
|
|
5062
5333
|
useKeepTourShortcuts({
|
|
5063
5334
|
...shortcutOptions,
|
|
5064
5335
|
enabled: keyboardShortcuts && (shortcutOptions?.enabled ?? true),
|
|
@@ -5069,17 +5340,17 @@ function KeepTourBar({
|
|
|
5069
5340
|
return resolvedPrev();
|
|
5070
5341
|
}
|
|
5071
5342
|
});
|
|
5072
|
-
const body = /* @__PURE__ */
|
|
5073
|
-
showProgress ? /* @__PURE__ */
|
|
5074
|
-
/* @__PURE__ */
|
|
5343
|
+
const body = /* @__PURE__ */ jsxs22(Fragment13, { children: [
|
|
5344
|
+
showProgress ? /* @__PURE__ */ jsx26("span", { "data-keepkit": "tour-progress", "aria-live": "polite", children: progress ?? `${navigation.currentPosition ?? 0} / ${navigation.items.length}` }) : null,
|
|
5345
|
+
/* @__PURE__ */ jsx26(
|
|
5075
5346
|
TourAction,
|
|
5076
5347
|
{
|
|
5077
|
-
href:
|
|
5348
|
+
href: resolvedPrevHref,
|
|
5078
5349
|
disabled: !navigation.hasPrev,
|
|
5079
|
-
onClick:
|
|
5350
|
+
onClick: resolvedPrevHref ? notifyPrevNavigation : resolvedPrev,
|
|
5080
5351
|
"data-keep-action": "tour-prev",
|
|
5081
5352
|
shortcut: showShortcutHint ? shortcutOptions?.prevKeys?.[0] ?? "K" : void 0,
|
|
5082
|
-
preview: navigation.prevItem ? /* @__PURE__ */
|
|
5353
|
+
preview: navigation.prevItem ? /* @__PURE__ */ jsxs22(Fragment13, { children: [
|
|
5083
5354
|
previousLabel,
|
|
5084
5355
|
": ",
|
|
5085
5356
|
getItemTitle(navigation.prevItem)
|
|
@@ -5087,15 +5358,15 @@ function KeepTourBar({
|
|
|
5087
5358
|
children: previousLabel
|
|
5088
5359
|
}
|
|
5089
5360
|
),
|
|
5090
|
-
/* @__PURE__ */
|
|
5361
|
+
/* @__PURE__ */ jsx26(
|
|
5091
5362
|
TourAction,
|
|
5092
5363
|
{
|
|
5093
|
-
href:
|
|
5364
|
+
href: resolvedNextHref,
|
|
5094
5365
|
disabled: !navigation.hasNext,
|
|
5095
|
-
onClick:
|
|
5366
|
+
onClick: resolvedNextHref ? notifyNextNavigation : resolvedNext,
|
|
5096
5367
|
"data-keep-action": "tour-next",
|
|
5097
5368
|
shortcut: showShortcutHint ? shortcutOptions?.nextKeys?.[0] ?? "J" : void 0,
|
|
5098
|
-
preview: navigation.nextItem ? /* @__PURE__ */
|
|
5369
|
+
preview: navigation.nextItem ? /* @__PURE__ */ jsxs22(Fragment13, { children: [
|
|
5099
5370
|
nextItemLabel,
|
|
5100
5371
|
": ",
|
|
5101
5372
|
getItemTitle(navigation.nextItem)
|
|
@@ -5103,7 +5374,7 @@ function KeepTourBar({
|
|
|
5103
5374
|
children: nextItemLabel
|
|
5104
5375
|
}
|
|
5105
5376
|
),
|
|
5106
|
-
|
|
5377
|
+
resolvedBackHref || onBack ? /* @__PURE__ */ jsx26(TourAction, { href: resolvedBackHref, onClick: onBack, "data-keep-action": "tour-back", children: listLabel }) : null
|
|
5107
5378
|
] });
|
|
5108
5379
|
return renderRoot(
|
|
5109
5380
|
asChild,
|
|
@@ -5114,14 +5385,14 @@ function KeepTourBar({
|
|
|
5114
5385
|
);
|
|
5115
5386
|
}
|
|
5116
5387
|
function TourAction({ href, disabled = false, onClick, children, preview, shortcut, ...props }) {
|
|
5117
|
-
const previewId =
|
|
5118
|
-
const content = /* @__PURE__ */
|
|
5119
|
-
/* @__PURE__ */
|
|
5120
|
-
shortcut ? /* @__PURE__ */
|
|
5121
|
-
preview ? /* @__PURE__ */
|
|
5388
|
+
const previewId = useId3();
|
|
5389
|
+
const content = /* @__PURE__ */ jsxs22(Fragment13, { children: [
|
|
5390
|
+
/* @__PURE__ */ jsx26("span", { "data-tour-label": "true", children }),
|
|
5391
|
+
shortcut ? /* @__PURE__ */ jsx26(KeepShortcutHint, { shortcut }) : null,
|
|
5392
|
+
preview ? /* @__PURE__ */ jsx26("small", { id: previewId, "data-tour-preview": "true", children: preview }) : null
|
|
5122
5393
|
] });
|
|
5123
5394
|
if (href && !disabled) {
|
|
5124
|
-
return /* @__PURE__ */
|
|
5395
|
+
return /* @__PURE__ */ jsx26(
|
|
5125
5396
|
"a",
|
|
5126
5397
|
{
|
|
5127
5398
|
...props,
|
|
@@ -5133,7 +5404,7 @@ function TourAction({ href, disabled = false, onClick, children, preview, shortc
|
|
|
5133
5404
|
}
|
|
5134
5405
|
);
|
|
5135
5406
|
}
|
|
5136
|
-
return /* @__PURE__ */
|
|
5407
|
+
return /* @__PURE__ */ jsx26(
|
|
5137
5408
|
"button",
|
|
5138
5409
|
{
|
|
5139
5410
|
...props,
|
|
@@ -5156,10 +5427,10 @@ function navigateTo(item, href) {
|
|
|
5156
5427
|
import { isValidElement as isValidElement8 } from "react";
|
|
5157
5428
|
|
|
5158
5429
|
// src/features/status/hooks/useStatusViews.ts
|
|
5159
|
-
import { useKeepContext as
|
|
5160
|
-
import { useEffect as
|
|
5430
|
+
import { useKeepContext as useKeepContext5 } from "@keepkit/core/react";
|
|
5431
|
+
import { useEffect as useEffect14, useRef as useRef10, useState as useState17 } from "react";
|
|
5161
5432
|
function useKeepStatus(status) {
|
|
5162
|
-
const context =
|
|
5433
|
+
const context = useKeepContext5();
|
|
5163
5434
|
const resolvedStatus = status ?? getDerivedStatus(context);
|
|
5164
5435
|
const state = {
|
|
5165
5436
|
status: resolvedStatus,
|
|
@@ -5170,13 +5441,13 @@ function useKeepStatus(status) {
|
|
|
5170
5441
|
return { state, defaultLabel: useUiLabel(getStatusLabelKey3(resolvedStatus)) };
|
|
5171
5442
|
}
|
|
5172
5443
|
function useKeepAnnouncements(messages) {
|
|
5173
|
-
const context =
|
|
5444
|
+
const context = useKeepContext5();
|
|
5174
5445
|
const savedMessage = useUiLabel("savedMessage", messages?.save);
|
|
5175
5446
|
const removedMessage = useUiLabel("removedMessage", messages?.remove);
|
|
5176
5447
|
const noteSavedMessage = useUiLabel("noteSavedMessage", messages?.note);
|
|
5177
|
-
const [message, setMessage] =
|
|
5178
|
-
const lastChangeRef =
|
|
5179
|
-
|
|
5448
|
+
const [message, setMessage] = useState17("");
|
|
5449
|
+
const lastChangeRef = useRef10(void 0);
|
|
5450
|
+
useEffect14(() => {
|
|
5180
5451
|
const change = context.lastChange;
|
|
5181
5452
|
if (!change || change === lastChangeRef.current) return;
|
|
5182
5453
|
lastChangeRef.current = change;
|
|
@@ -5204,7 +5475,7 @@ function getStatusLabelKey3(status) {
|
|
|
5204
5475
|
}
|
|
5205
5476
|
|
|
5206
5477
|
// src/features/status/status.tsx
|
|
5207
|
-
import { jsx as
|
|
5478
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
5208
5479
|
function KeepStatus({
|
|
5209
5480
|
status,
|
|
5210
5481
|
labels,
|
|
@@ -5236,7 +5507,7 @@ function KeepStatus({
|
|
|
5236
5507
|
}
|
|
5237
5508
|
function KeepAnnouncements({ messages, ...props }) {
|
|
5238
5509
|
const message = useKeepAnnouncements(messages);
|
|
5239
|
-
return /* @__PURE__ */
|
|
5510
|
+
return /* @__PURE__ */ jsx27(
|
|
5240
5511
|
"div",
|
|
5241
5512
|
{
|
|
5242
5513
|
...props,
|
|
@@ -5252,15 +5523,15 @@ function KeepAnnouncements({ messages, ...props }) {
|
|
|
5252
5523
|
var KeepAnnouncer = KeepAnnouncements;
|
|
5253
5524
|
|
|
5254
5525
|
// src/features/sync/hooks/useKeepSyncFeedback.ts
|
|
5255
|
-
import { useKeepContext as
|
|
5256
|
-
import { useEffect as
|
|
5526
|
+
import { useKeepContext as useKeepContext6 } from "@keepkit/core/react";
|
|
5527
|
+
import { useEffect as useEffect15, useRef as useRef11 } from "react";
|
|
5257
5528
|
function useKeepSyncFeedback() {
|
|
5258
|
-
const { syncState } =
|
|
5529
|
+
const { syncState } = useKeepContext6();
|
|
5259
5530
|
const emitFeedback = useKeepUiFeedback();
|
|
5260
5531
|
const completedMessage = useUiLabel("syncSynced");
|
|
5261
5532
|
const failedMessage = useUiLabel("syncFailedMessage");
|
|
5262
|
-
const previousStatus =
|
|
5263
|
-
|
|
5533
|
+
const previousStatus = useRef11("idle");
|
|
5534
|
+
useEffect15(() => {
|
|
5264
5535
|
const previous = previousStatus.current;
|
|
5265
5536
|
previousStatus.current = syncState.status;
|
|
5266
5537
|
if (syncState.status === "error" && previous !== "error") {
|
|
@@ -5280,17 +5551,17 @@ function KeepSyncFeedbackObserver() {
|
|
|
5280
5551
|
}
|
|
5281
5552
|
|
|
5282
5553
|
// src/features/sync/hooks/useKeepSyncRecoveryDialog.ts
|
|
5283
|
-
import { useKeepContext as
|
|
5284
|
-
import { useEffect as
|
|
5554
|
+
import { useKeepContext as useKeepContext7 } from "@keepkit/core/react";
|
|
5555
|
+
import { useEffect as useEffect16, useState as useState18 } from "react";
|
|
5285
5556
|
function useKeepSyncRecoveryDialog(options) {
|
|
5286
5557
|
const { open, onOpenChange, conflicts, onManualMerge } = options;
|
|
5287
|
-
const context =
|
|
5558
|
+
const context = useKeepContext7();
|
|
5288
5559
|
const conflictList = conflicts ?? context.syncState.conflicts ?? [];
|
|
5289
5560
|
const hasRecovery = conflictList.length > 0 || context.syncState.status === "error" || Boolean(context.error);
|
|
5290
|
-
const [dismissed, setDismissed] =
|
|
5291
|
-
const [busyId, setBusyId] =
|
|
5292
|
-
const [error, setError] =
|
|
5293
|
-
|
|
5561
|
+
const [dismissed, setDismissed] = useState18(false);
|
|
5562
|
+
const [busyId, setBusyId] = useState18();
|
|
5563
|
+
const [error, setError] = useState18();
|
|
5564
|
+
useEffect16(() => {
|
|
5294
5565
|
if (hasRecovery) setDismissed(false);
|
|
5295
5566
|
}, [hasRecovery]);
|
|
5296
5567
|
return {
|
|
@@ -5335,7 +5606,7 @@ function useKeepSyncRecoveryDialog(options) {
|
|
|
5335
5606
|
}
|
|
5336
5607
|
|
|
5337
5608
|
// src/features/sync/KeepSyncRecoveryDialog.tsx
|
|
5338
|
-
import { jsx as
|
|
5609
|
+
import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5339
5610
|
function KeepSyncRecoveryDialog({
|
|
5340
5611
|
open,
|
|
5341
5612
|
onOpenChange,
|
|
@@ -5350,7 +5621,7 @@ function KeepSyncRecoveryDialog({
|
|
|
5350
5621
|
}) {
|
|
5351
5622
|
const view = useKeepSyncRecoveryDialog({ open, onOpenChange, conflicts, onManualMerge });
|
|
5352
5623
|
if (!view.isOpen) return null;
|
|
5353
|
-
return /* @__PURE__ */
|
|
5624
|
+
return /* @__PURE__ */ jsxs23(
|
|
5354
5625
|
"section",
|
|
5355
5626
|
{
|
|
5356
5627
|
...props,
|
|
@@ -5364,17 +5635,17 @@ function KeepSyncRecoveryDialog({
|
|
|
5364
5635
|
"data-state": view.conflictList.length > 0 ? "conflict" : "error",
|
|
5365
5636
|
"data-loading": view.busyId !== void 0 ? "true" : void 0,
|
|
5366
5637
|
children: [
|
|
5367
|
-
/* @__PURE__ */
|
|
5368
|
-
/* @__PURE__ */
|
|
5369
|
-
/* @__PURE__ */
|
|
5638
|
+
/* @__PURE__ */ jsxs23("header", { children: [
|
|
5639
|
+
/* @__PURE__ */ jsx28("h2", { id: "keepkit-sync-recovery-title", children: title ?? view.labels.title }),
|
|
5640
|
+
/* @__PURE__ */ jsx28("button", { type: "button", "data-keep-action": "close-dialog", onClick: view.close, "aria-label": view.labels.close, children: view.labels.close })
|
|
5370
5641
|
] }),
|
|
5371
5642
|
children,
|
|
5372
|
-
view.conflictList.length > 0 ? /* @__PURE__ */
|
|
5373
|
-
/* @__PURE__ */
|
|
5374
|
-
view.conflictList.map((conflict) => /* @__PURE__ */
|
|
5375
|
-
/* @__PURE__ */
|
|
5376
|
-
/* @__PURE__ */
|
|
5377
|
-
/* @__PURE__ */
|
|
5643
|
+
view.conflictList.length > 0 ? /* @__PURE__ */ jsxs23("div", { children: [
|
|
5644
|
+
/* @__PURE__ */ jsx28("p", { children: view.labels.conflict }),
|
|
5645
|
+
view.conflictList.map((conflict) => /* @__PURE__ */ jsxs23("article", { "data-conflict-id": conflict.id, children: [
|
|
5646
|
+
/* @__PURE__ */ jsx28("h3", { children: getMetaTitle(conflict.operation.item?.meta) ?? conflict.id }),
|
|
5647
|
+
/* @__PURE__ */ jsxs23("div", { "data-conflict-preview": true, children: [
|
|
5648
|
+
/* @__PURE__ */ jsx28(
|
|
5378
5649
|
ConflictPreview,
|
|
5379
5650
|
{
|
|
5380
5651
|
item: conflict.operation.item,
|
|
@@ -5384,7 +5655,7 @@ function KeepSyncRecoveryDialog({
|
|
|
5384
5655
|
side: "local"
|
|
5385
5656
|
}
|
|
5386
5657
|
),
|
|
5387
|
-
/* @__PURE__ */
|
|
5658
|
+
/* @__PURE__ */ jsx28(
|
|
5388
5659
|
ConflictPreview,
|
|
5389
5660
|
{
|
|
5390
5661
|
item: conflict.remote,
|
|
@@ -5395,8 +5666,8 @@ function KeepSyncRecoveryDialog({
|
|
|
5395
5666
|
}
|
|
5396
5667
|
)
|
|
5397
5668
|
] }),
|
|
5398
|
-
/* @__PURE__ */
|
|
5399
|
-
/* @__PURE__ */
|
|
5669
|
+
/* @__PURE__ */ jsxs23("div", { children: [
|
|
5670
|
+
/* @__PURE__ */ jsx28(
|
|
5400
5671
|
"button",
|
|
5401
5672
|
{
|
|
5402
5673
|
type: "button",
|
|
@@ -5406,7 +5677,7 @@ function KeepSyncRecoveryDialog({
|
|
|
5406
5677
|
children: view.labels.keepLocal
|
|
5407
5678
|
}
|
|
5408
5679
|
),
|
|
5409
|
-
/* @__PURE__ */
|
|
5680
|
+
/* @__PURE__ */ jsx28(
|
|
5410
5681
|
"button",
|
|
5411
5682
|
{
|
|
5412
5683
|
type: "button",
|
|
@@ -5416,7 +5687,7 @@ function KeepSyncRecoveryDialog({
|
|
|
5416
5687
|
children: view.labels.useServer
|
|
5417
5688
|
}
|
|
5418
5689
|
),
|
|
5419
|
-
/* @__PURE__ */
|
|
5690
|
+
/* @__PURE__ */ jsx28(
|
|
5420
5691
|
"button",
|
|
5421
5692
|
{
|
|
5422
5693
|
type: "button",
|
|
@@ -5429,12 +5700,12 @@ function KeepSyncRecoveryDialog({
|
|
|
5429
5700
|
] })
|
|
5430
5701
|
] }, conflict.id))
|
|
5431
5702
|
] }) : null,
|
|
5432
|
-
view.showBackupRecovery ? /* @__PURE__ */
|
|
5433
|
-
/* @__PURE__ */
|
|
5434
|
-
/* @__PURE__ */
|
|
5435
|
-
backup ?? (showBackupControls ? /* @__PURE__ */
|
|
5703
|
+
view.showBackupRecovery ? /* @__PURE__ */ jsxs23("section", { "data-recovery": "backup", children: [
|
|
5704
|
+
/* @__PURE__ */ jsx28("h3", { children: view.labels.backupRecovery }),
|
|
5705
|
+
/* @__PURE__ */ jsx28("p", { children: view.labels.backupRecoveryDescription }),
|
|
5706
|
+
backup ?? (showBackupControls ? /* @__PURE__ */ jsx28(KeepBackup, {}) : null)
|
|
5436
5707
|
] }) : null,
|
|
5437
|
-
view.error ? /* @__PURE__ */
|
|
5708
|
+
view.error ? /* @__PURE__ */ jsx28("p", { id: "keepkit-sync-recovery-error", role: "alert", "aria-live": "assertive", children: view.error instanceof Error ? view.error.message : view.labels.error }) : null
|
|
5438
5709
|
]
|
|
5439
5710
|
}
|
|
5440
5711
|
);
|
|
@@ -5446,16 +5717,16 @@ function ConflictPreview({
|
|
|
5446
5717
|
noteLabel,
|
|
5447
5718
|
side
|
|
5448
5719
|
}) {
|
|
5449
|
-
return /* @__PURE__ */
|
|
5450
|
-
/* @__PURE__ */
|
|
5451
|
-
/* @__PURE__ */
|
|
5452
|
-
/* @__PURE__ */
|
|
5453
|
-
/* @__PURE__ */
|
|
5454
|
-
/* @__PURE__ */
|
|
5720
|
+
return /* @__PURE__ */ jsxs23("article", { "data-conflict-version": side, "aria-label": heading, children: [
|
|
5721
|
+
/* @__PURE__ */ jsx28("h4", { children: heading }),
|
|
5722
|
+
/* @__PURE__ */ jsxs23("dl", { children: [
|
|
5723
|
+
/* @__PURE__ */ jsxs23("div", { children: [
|
|
5724
|
+
/* @__PURE__ */ jsx28("dt", { children: updatedAtLabel }),
|
|
5725
|
+
/* @__PURE__ */ jsx28("dd", { children: item ? /* @__PURE__ */ jsx28("time", { dateTime: new Date(item.updatedAt).toISOString(), children: formatConflictDate(item.updatedAt) }) : "\u2014" })
|
|
5455
5726
|
] }),
|
|
5456
|
-
/* @__PURE__ */
|
|
5457
|
-
/* @__PURE__ */
|
|
5458
|
-
/* @__PURE__ */
|
|
5727
|
+
/* @__PURE__ */ jsxs23("div", { children: [
|
|
5728
|
+
/* @__PURE__ */ jsx28("dt", { children: noteLabel }),
|
|
5729
|
+
/* @__PURE__ */ jsx28("dd", { children: item?.note || "\u2014" })
|
|
5459
5730
|
] })
|
|
5460
5731
|
] })
|
|
5461
5732
|
] });
|
|
@@ -5465,9 +5736,9 @@ function formatConflictDate(timestamp) {
|
|
|
5465
5736
|
}
|
|
5466
5737
|
|
|
5467
5738
|
// src/features/sync/hooks/useKeepSyncStatusBanner.ts
|
|
5468
|
-
import { useKeepContext as
|
|
5739
|
+
import { useKeepContext as useKeepContext8 } from "@keepkit/core/react";
|
|
5469
5740
|
function useKeepSyncStatusBanner({ onRetry, children }) {
|
|
5470
|
-
const context =
|
|
5741
|
+
const context = useKeepContext8();
|
|
5471
5742
|
const retryLabel = useUiLabel("retrySync");
|
|
5472
5743
|
const resolveLabel = useUiLabel("resolveSync");
|
|
5473
5744
|
const conflictLabel = useUiLabel("syncConflict");
|
|
@@ -5499,7 +5770,7 @@ function getErrorMessage6(error) {
|
|
|
5499
5770
|
}
|
|
5500
5771
|
|
|
5501
5772
|
// src/features/sync/KeepSyncStatusBanner.tsx
|
|
5502
|
-
import { jsx as
|
|
5773
|
+
import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5503
5774
|
function KeepSyncStatusBanner({
|
|
5504
5775
|
onRetry,
|
|
5505
5776
|
onResolveConflicts,
|
|
@@ -5509,7 +5780,7 @@ function KeepSyncStatusBanner({
|
|
|
5509
5780
|
}) {
|
|
5510
5781
|
const view = useKeepSyncStatusBanner({ onRetry, children });
|
|
5511
5782
|
if (view.status === "idle" && !view.hasConflicts) return null;
|
|
5512
|
-
return /* @__PURE__ */
|
|
5783
|
+
return /* @__PURE__ */ jsxs24(
|
|
5513
5784
|
"aside",
|
|
5514
5785
|
{
|
|
5515
5786
|
...props,
|
|
@@ -5519,8 +5790,8 @@ function KeepSyncStatusBanner({
|
|
|
5519
5790
|
"data-keepkit": "sync-status",
|
|
5520
5791
|
"data-state": view.status,
|
|
5521
5792
|
children: [
|
|
5522
|
-
/* @__PURE__ */
|
|
5523
|
-
view.showRetry ? /* @__PURE__ */
|
|
5793
|
+
/* @__PURE__ */ jsx29("p", { children: view.message }),
|
|
5794
|
+
view.showRetry ? /* @__PURE__ */ jsx29(
|
|
5524
5795
|
"button",
|
|
5525
5796
|
{
|
|
5526
5797
|
type: "button",
|
|
@@ -5530,7 +5801,7 @@ function KeepSyncStatusBanner({
|
|
|
5530
5801
|
children: view.retryLabel
|
|
5531
5802
|
}
|
|
5532
5803
|
) : null,
|
|
5533
|
-
view.hasConflicts ? /* @__PURE__ */
|
|
5804
|
+
view.hasConflicts ? /* @__PURE__ */ jsx29(
|
|
5534
5805
|
"button",
|
|
5535
5806
|
{
|
|
5536
5807
|
type: "button",
|
|
@@ -5546,7 +5817,7 @@ function KeepSyncStatusBanner({
|
|
|
5546
5817
|
}
|
|
5547
5818
|
|
|
5548
5819
|
// src/features/workspace/hooks/useKeepWorkspace.ts
|
|
5549
|
-
import { useCallback as useCallback9, useState as
|
|
5820
|
+
import { useCallback as useCallback9, useState as useState19 } from "react";
|
|
5550
5821
|
var PRESET_MODULES = {
|
|
5551
5822
|
basic: { syncStatus: false, undo: false, recovery: false, backup: false, stalePrune: false },
|
|
5552
5823
|
standard: { syncStatus: false, undo: true, recovery: false, backup: false, stalePrune: false },
|
|
@@ -5566,7 +5837,7 @@ function useKeepWorkspace({
|
|
|
5566
5837
|
onRecoveryOpenChange,
|
|
5567
5838
|
onResolveConflicts
|
|
5568
5839
|
}) {
|
|
5569
|
-
const [internalRecoveryOpen, setInternalRecoveryOpen] =
|
|
5840
|
+
const [internalRecoveryOpen, setInternalRecoveryOpen] = useState19(false);
|
|
5570
5841
|
const resolvedModules = { ...PRESET_MODULES[preset], ...modules };
|
|
5571
5842
|
const setRecoveryOpen = useCallback9(
|
|
5572
5843
|
(open) => {
|
|
@@ -5590,7 +5861,7 @@ function useKeepWorkspace({
|
|
|
5590
5861
|
}
|
|
5591
5862
|
|
|
5592
5863
|
// src/features/workspace/KeepWorkspace.tsx
|
|
5593
|
-
import { jsx as
|
|
5864
|
+
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5594
5865
|
function KeepWorkspace({
|
|
5595
5866
|
preset = "standard",
|
|
5596
5867
|
modules,
|
|
@@ -5622,26 +5893,26 @@ function KeepWorkspace({
|
|
|
5622
5893
|
...collectionProps,
|
|
5623
5894
|
features: { ...view.collectionFeatures, ...collectionProps?.features }
|
|
5624
5895
|
};
|
|
5625
|
-
return /* @__PURE__ */
|
|
5896
|
+
return /* @__PURE__ */ jsxs25("section", { ...props, className, "data-keepkit": "workspace", "data-preset": preset, children: [
|
|
5626
5897
|
resolveOptionalSlot(slots?.before, state),
|
|
5627
5898
|
view.modules.syncStatus ? resolveSlot(
|
|
5628
5899
|
slots?.syncStatus,
|
|
5629
|
-
/* @__PURE__ */
|
|
5900
|
+
/* @__PURE__ */ jsx30(KeepSyncStatusBanner, { ...syncStatusProps, onResolveConflicts: view.openRecovery }),
|
|
5630
5901
|
state
|
|
5631
5902
|
) : null,
|
|
5632
|
-
resolveSlot(slots?.collection, /* @__PURE__ */
|
|
5903
|
+
resolveSlot(slots?.collection, /* @__PURE__ */ jsx30(KeepCollection, { ...resolvedCollectionProps }), state),
|
|
5633
5904
|
view.modules.backup || view.modules.stalePrune ? resolveSlot(
|
|
5634
5905
|
slots?.actions,
|
|
5635
|
-
/* @__PURE__ */
|
|
5636
|
-
view.modules.stalePrune ? /* @__PURE__ */
|
|
5637
|
-
view.modules.backup ? /* @__PURE__ */
|
|
5906
|
+
/* @__PURE__ */ jsxs25("div", { "data-keepkit": "workspace-actions", children: [
|
|
5907
|
+
view.modules.stalePrune ? /* @__PURE__ */ jsx30(KeepPruneStaleButton, { ...stalePruneProps }) : null,
|
|
5908
|
+
view.modules.backup ? /* @__PURE__ */ jsx30(KeepBackup, { ...backupProps }) : null
|
|
5638
5909
|
] }),
|
|
5639
5910
|
state
|
|
5640
5911
|
) : null,
|
|
5641
|
-
view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */
|
|
5912
|
+
view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */ jsx30(KeepUndo, { ...undoProps }), state) : null,
|
|
5642
5913
|
view.modules.recovery ? resolveSlot(
|
|
5643
5914
|
slots?.recovery,
|
|
5644
|
-
/* @__PURE__ */
|
|
5915
|
+
/* @__PURE__ */ jsx30(
|
|
5645
5916
|
KeepSyncRecoveryDialog,
|
|
5646
5917
|
{
|
|
5647
5918
|
...recoveryProps,
|
|
@@ -5666,7 +5937,7 @@ function resolveOptionalSlot(slot, state) {
|
|
|
5666
5937
|
|
|
5667
5938
|
// src/foundation/theme.tsx
|
|
5668
5939
|
import { isValidElement as isValidElement9 } from "react";
|
|
5669
|
-
import { jsx as
|
|
5940
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
5670
5941
|
var keepThemeNames = [
|
|
5671
5942
|
"default",
|
|
5672
5943
|
"ocean",
|
|
@@ -5725,7 +5996,7 @@ function KeepThemeProvider({
|
|
|
5725
5996
|
throw new Error("KeepThemeProvider with asChild requires a single React element child.");
|
|
5726
5997
|
return createSlot(children, rootProps);
|
|
5727
5998
|
}
|
|
5728
|
-
return /* @__PURE__ */
|
|
5999
|
+
return /* @__PURE__ */ jsx31("div", { ...rootProps, children });
|
|
5729
6000
|
}
|
|
5730
6001
|
|
|
5731
6002
|
// src/index.tsx
|
|
@@ -5733,7 +6004,8 @@ import { createAuthenticatedSyncKit } from "@keepkit/core/core";
|
|
|
5733
6004
|
import {
|
|
5734
6005
|
KeepErrorBoundary as KeepErrorBoundary3,
|
|
5735
6006
|
KeepProvider,
|
|
5736
|
-
|
|
6007
|
+
useKeepCollections as useKeepCollections3,
|
|
6008
|
+
useKeepContext as useKeepContext9,
|
|
5737
6009
|
useKeepItem as useKeepItem8,
|
|
5738
6010
|
useKeepList as useKeepList5,
|
|
5739
6011
|
useKeepNavigator as useKeepNavigator2,
|
|
@@ -5749,7 +6021,7 @@ import {
|
|
|
5749
6021
|
LocalStorageSyncQueueAdapter,
|
|
5750
6022
|
SyncStorageAdapter
|
|
5751
6023
|
} from "@keepkit/core/storage";
|
|
5752
|
-
import { jsx as
|
|
6024
|
+
import { jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5753
6025
|
function KeepKitProvider({
|
|
5754
6026
|
labels,
|
|
5755
6027
|
locale,
|
|
@@ -5769,7 +6041,7 @@ function KeepKitProvider({
|
|
|
5769
6041
|
children,
|
|
5770
6042
|
...providerProps
|
|
5771
6043
|
}) {
|
|
5772
|
-
return /* @__PURE__ */
|
|
6044
|
+
return /* @__PURE__ */ jsx32(KeepUiProvider, { labels, locale, labelResolver, onFeedback, children: /* @__PURE__ */ jsx32(
|
|
5773
6045
|
KeepThemeProvider,
|
|
5774
6046
|
{
|
|
5775
6047
|
theme,
|
|
@@ -5783,10 +6055,10 @@ function KeepKitProvider({
|
|
|
5783
6055
|
className: themeClassName,
|
|
5784
6056
|
style: themeStyle,
|
|
5785
6057
|
asChild: themeAsChild,
|
|
5786
|
-
children: /* @__PURE__ */
|
|
5787
|
-
/* @__PURE__ */
|
|
6058
|
+
children: /* @__PURE__ */ jsxs26(CoreKeepProvider, { ...providerProps, children: [
|
|
6059
|
+
/* @__PURE__ */ jsx32(KeepSyncFeedbackObserver, {}),
|
|
5788
6060
|
children,
|
|
5789
|
-
/* @__PURE__ */
|
|
6061
|
+
/* @__PURE__ */ jsx32(KeepAnnouncements, {})
|
|
5790
6062
|
] })
|
|
5791
6063
|
}
|
|
5792
6064
|
) });
|
|
@@ -5813,7 +6085,7 @@ function createKeepKit(options = {}) {
|
|
|
5813
6085
|
} = options;
|
|
5814
6086
|
const coreKit = createCoreKeepKit(coreOptions);
|
|
5815
6087
|
return {
|
|
5816
|
-
Provider: (props) => /* @__PURE__ */
|
|
6088
|
+
Provider: (props) => /* @__PURE__ */ jsx32(
|
|
5817
6089
|
KeepKitProvider,
|
|
5818
6090
|
{
|
|
5819
6091
|
...coreOptions,
|
|
@@ -5834,9 +6106,9 @@ function createKeepKit(options = {}) {
|
|
|
5834
6106
|
...props
|
|
5835
6107
|
}
|
|
5836
6108
|
),
|
|
5837
|
-
Button: (props) => /* @__PURE__ */
|
|
5838
|
-
Backup: (props) => /* @__PURE__ */
|
|
5839
|
-
Collection: (props) => /* @__PURE__ */
|
|
6109
|
+
Button: (props) => /* @__PURE__ */ jsx32(KeepButton, { ...props }),
|
|
6110
|
+
Backup: (props) => /* @__PURE__ */ jsx32(KeepBackup, { ...props }),
|
|
6111
|
+
Collection: (props) => /* @__PURE__ */ jsx32(
|
|
5840
6112
|
KeepCollection,
|
|
5841
6113
|
{
|
|
5842
6114
|
...props,
|
|
@@ -5847,7 +6119,7 @@ function createKeepKit(options = {}) {
|
|
|
5847
6119
|
}
|
|
5848
6120
|
}
|
|
5849
6121
|
),
|
|
5850
|
-
Workspace: (props) => /* @__PURE__ */
|
|
6122
|
+
Workspace: (props) => /* @__PURE__ */ jsx32(
|
|
5851
6123
|
KeepWorkspace,
|
|
5852
6124
|
{
|
|
5853
6125
|
...props,
|
|
@@ -5864,6 +6136,7 @@ function createKeepKit(options = {}) {
|
|
|
5864
6136
|
useContext: () => coreKit.useContext(),
|
|
5865
6137
|
useItem: (item) => coreKit.useItem(item),
|
|
5866
6138
|
useList: (query) => coreKit.useList(query),
|
|
6139
|
+
useCollections: (collectionsOptions) => coreKit.useCollections(collectionsOptions),
|
|
5867
6140
|
useNavigator: (navigatorOptions) => coreKit.useNavigator(navigatorOptions),
|
|
5868
6141
|
useShortcut: (shortcutOptions) => coreKit.useShortcut(shortcutOptions)
|
|
5869
6142
|
};
|
|
@@ -5876,6 +6149,7 @@ export {
|
|
|
5876
6149
|
KeepAnnouncements,
|
|
5877
6150
|
KeepAnnouncer,
|
|
5878
6151
|
KeepArchiveButton,
|
|
6152
|
+
KeepArchiveScopeSelect,
|
|
5879
6153
|
KeepBackup,
|
|
5880
6154
|
KeepBulkActions,
|
|
5881
6155
|
KeepButton,
|
|
@@ -5932,7 +6206,8 @@ export {
|
|
|
5932
6206
|
keepThemeNames,
|
|
5933
6207
|
mergeProps,
|
|
5934
6208
|
toggleSelectAll,
|
|
5935
|
-
|
|
6209
|
+
useKeepCollections3 as useKeepCollections,
|
|
6210
|
+
useKeepContext9 as useKeepContext,
|
|
5936
6211
|
useKeepItem8 as useKeepItem,
|
|
5937
6212
|
useKeepList5 as useKeepList,
|
|
5938
6213
|
useKeepNavigator2 as useKeepNavigator,
|