@keepkit/ui 0.28.2 → 0.28.4
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 +10 -4
- package/dist/index.d.ts +71 -8
- package/dist/index.js +1051 -423
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -49,9 +49,13 @@ function useKeepUrlSync({
|
|
|
49
49
|
...previousQuery,
|
|
50
50
|
...decoded.search ? { search: decoded.search } : { search: void 0 },
|
|
51
51
|
...decoded.tags ? { tags: decoded.tags } : { tags: void 0 },
|
|
52
|
+
collectionId: decoded.collectionId,
|
|
52
53
|
...decoded.sort ? { sort: decoded.sort } : {},
|
|
53
54
|
...decoded.pagination ? { pagination: { ...previousQuery.pagination, ...decoded.pagination } } : {},
|
|
54
|
-
|
|
55
|
+
activity: decoded.activity,
|
|
56
|
+
organization: decoded.organization,
|
|
57
|
+
pinnedFirst: decoded.pinnedFirst,
|
|
58
|
+
savedBetween: decoded.savedBetween,
|
|
55
59
|
...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 }
|
|
56
60
|
}));
|
|
57
61
|
};
|
|
@@ -124,6 +128,7 @@ var DE_LABELS = {
|
|
|
124
128
|
activeFilters: "Aktive Filter",
|
|
125
129
|
clearFilters: "Filter l\xF6schen",
|
|
126
130
|
clearAllFilters: "Alle Filter l\xF6schen",
|
|
131
|
+
resetFilters: "Auf Anfangsfilter zur\xFCcksetzen",
|
|
127
132
|
removeFilter: "entfernen",
|
|
128
133
|
noFilteredItems: "Keine passenden Elemente gefunden.",
|
|
129
134
|
noFilteredItemsDescription: "Passe die Suche an oder entferne einen Tag-Filter.",
|
|
@@ -200,6 +205,7 @@ var DE_LABELS = {
|
|
|
200
205
|
activityNeverOpened: "Noch nie ge\xF6ffnet",
|
|
201
206
|
activityOpened: "Ge\xF6ffnet",
|
|
202
207
|
activityInactiveFor: "Tage inaktiv",
|
|
208
|
+
activityInactiveSuffix: "inaktiv",
|
|
203
209
|
activityBefore: "Ge\xF6ffnet vor",
|
|
204
210
|
activityAfter: "Ge\xF6ffnet nach",
|
|
205
211
|
undoReorder: "Sortierung r\xFCckg\xE4ngig machen",
|
|
@@ -249,6 +255,7 @@ var EN_LABELS = {
|
|
|
249
255
|
activeFilters: "Active filters",
|
|
250
256
|
clearFilters: "Clear filters",
|
|
251
257
|
clearAllFilters: "Clear all filters",
|
|
258
|
+
resetFilters: "Reset to initial filters",
|
|
252
259
|
removeFilter: "Remove",
|
|
253
260
|
noFilteredItems: "No matching items found.",
|
|
254
261
|
noFilteredItemsDescription: "Try adjusting your search or removing a tag filter.",
|
|
@@ -325,6 +332,7 @@ var EN_LABELS = {
|
|
|
325
332
|
activityNeverOpened: "Never opened",
|
|
326
333
|
activityOpened: "Opened",
|
|
327
334
|
activityInactiveFor: "days inactive",
|
|
335
|
+
activityInactiveSuffix: "inactive",
|
|
328
336
|
activityBefore: "Opened before",
|
|
329
337
|
activityAfter: "Opened after",
|
|
330
338
|
undoReorder: "Undo reorder",
|
|
@@ -374,6 +382,7 @@ var ES_LABELS = {
|
|
|
374
382
|
activeFilters: "Filtros activos",
|
|
375
383
|
clearFilters: "Borrar filtros",
|
|
376
384
|
clearAllFilters: "Borrar todos los filtros",
|
|
385
|
+
resetFilters: "Restablecer filtros iniciales",
|
|
377
386
|
removeFilter: "quitar",
|
|
378
387
|
noFilteredItems: "No se encontraron elementos coincidentes.",
|
|
379
388
|
noFilteredItemsDescription: "Ajusta la b\xFAsqueda o quita un filtro de etiqueta.",
|
|
@@ -450,6 +459,7 @@ var ES_LABELS = {
|
|
|
450
459
|
activityNeverOpened: "Nunca abierto",
|
|
451
460
|
activityOpened: "Abierto",
|
|
452
461
|
activityInactiveFor: "d\xEDas inactivo",
|
|
462
|
+
activityInactiveSuffix: "inactivo",
|
|
453
463
|
activityBefore: "Abierto antes de",
|
|
454
464
|
activityAfter: "Abierto despu\xE9s de",
|
|
455
465
|
undoReorder: "Deshacer ordenaci\xF3n",
|
|
@@ -499,6 +509,7 @@ var FIL_LABELS = {
|
|
|
499
509
|
activeFilters: "Mga aktibong filter",
|
|
500
510
|
clearFilters: "I-clear ang mga filter",
|
|
501
511
|
clearAllFilters: "I-clear ang lahat ng filter",
|
|
512
|
+
resetFilters: "Ibalik sa mga unang filter",
|
|
502
513
|
removeFilter: "alisin",
|
|
503
514
|
noFilteredItems: "Walang nakitang tumutugmang item.",
|
|
504
515
|
noFilteredItemsDescription: "Baguhin ang paghahanap o alisin ang filter ng tag.",
|
|
@@ -575,6 +586,7 @@ var FIL_LABELS = {
|
|
|
575
586
|
activityNeverOpened: "Hindi pa nabubuksan",
|
|
576
587
|
activityOpened: "Nabuksan",
|
|
577
588
|
activityInactiveFor: "araw na hindi aktibo",
|
|
589
|
+
activityInactiveSuffix: "hindi aktibo",
|
|
578
590
|
activityBefore: "Nabuksan bago",
|
|
579
591
|
activityAfter: "Nabuksan pagkatapos",
|
|
580
592
|
undoReorder: "I-undo ang pag-aayos",
|
|
@@ -624,6 +636,7 @@ var FR_LABELS = {
|
|
|
624
636
|
activeFilters: "Filtres actifs",
|
|
625
637
|
clearFilters: "Effacer les filtres",
|
|
626
638
|
clearAllFilters: "Effacer tous les filtres",
|
|
639
|
+
resetFilters: "R\xE9initialiser les filtres initiaux",
|
|
627
640
|
removeFilter: "supprimer",
|
|
628
641
|
noFilteredItems: "Aucun \xE9l\xE9ment correspondant trouv\xE9.",
|
|
629
642
|
noFilteredItemsDescription: "Modifiez votre recherche ou supprimez un filtre de tag.",
|
|
@@ -700,6 +713,7 @@ var FR_LABELS = {
|
|
|
700
713
|
activityNeverOpened: "Jamais ouvert",
|
|
701
714
|
activityOpened: "Ouvert",
|
|
702
715
|
activityInactiveFor: "jours inactif",
|
|
716
|
+
activityInactiveSuffix: "inactif",
|
|
703
717
|
activityBefore: "Ouvert avant",
|
|
704
718
|
activityAfter: "Ouvert apr\xE8s",
|
|
705
719
|
undoReorder: "Annuler le r\xE9ordonnancement",
|
|
@@ -749,6 +763,7 @@ var ID_LABELS = {
|
|
|
749
763
|
activeFilters: "Filter aktif",
|
|
750
764
|
clearFilters: "Hapus filter",
|
|
751
765
|
clearAllFilters: "Hapus semua filter",
|
|
766
|
+
resetFilters: "Atur ulang ke filter awal",
|
|
752
767
|
removeFilter: "hapus",
|
|
753
768
|
noFilteredItems: "Tidak ada item yang cocok.",
|
|
754
769
|
noFilteredItemsDescription: "Ubah pencarian atau hapus filter tag.",
|
|
@@ -825,6 +840,7 @@ var ID_LABELS = {
|
|
|
825
840
|
activityNeverOpened: "Belum pernah dibuka",
|
|
826
841
|
activityOpened: "Sudah dibuka",
|
|
827
842
|
activityInactiveFor: "hari tidak aktif",
|
|
843
|
+
activityInactiveSuffix: "tidak aktif",
|
|
828
844
|
activityBefore: "Dibuka sebelum",
|
|
829
845
|
activityAfter: "Dibuka setelah",
|
|
830
846
|
undoReorder: "Batalkan pengurutan",
|
|
@@ -874,6 +890,7 @@ var IT_LABELS = {
|
|
|
874
890
|
activeFilters: "Filtri attivi",
|
|
875
891
|
clearFilters: "Cancella filtri",
|
|
876
892
|
clearAllFilters: "Cancella tutti i filtri",
|
|
893
|
+
resetFilters: "Ripristina i filtri iniziali",
|
|
877
894
|
removeFilter: "rimuovi",
|
|
878
895
|
noFilteredItems: "Nessun elemento corrispondente trovato.",
|
|
879
896
|
noFilteredItemsDescription: "Modifica la ricerca o rimuovi un filtro tag.",
|
|
@@ -950,6 +967,7 @@ var IT_LABELS = {
|
|
|
950
967
|
activityNeverOpened: "Mai aperto",
|
|
951
968
|
activityOpened: "Aperto",
|
|
952
969
|
activityInactiveFor: "giorni inattivo",
|
|
970
|
+
activityInactiveSuffix: "inattivo",
|
|
953
971
|
activityBefore: "Aperto prima di",
|
|
954
972
|
activityAfter: "Aperto dopo",
|
|
955
973
|
undoReorder: "Annulla riordinamento",
|
|
@@ -999,6 +1017,7 @@ var JA_LABELS = {
|
|
|
999
1017
|
activeFilters: "\u9069\u7528\u4E2D\u306E\u6761\u4EF6",
|
|
1000
1018
|
clearFilters: "\u30D5\u30A3\u30EB\u30BF\u30FC\u3092\u30AF\u30EA\u30A2",
|
|
1001
1019
|
clearAllFilters: "\u3059\u3079\u3066\u306E\u6761\u4EF6\u3092\u30AF\u30EA\u30A2",
|
|
1020
|
+
resetFilters: "\u521D\u671F\u72B6\u614B\u306B\u623B\u3059",
|
|
1002
1021
|
removeFilter: "\u3092\u89E3\u9664",
|
|
1003
1022
|
noFilteredItems: "\u4E00\u81F4\u3059\u308B\u30A2\u30A4\u30C6\u30E0\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F",
|
|
1004
1023
|
noFilteredItemsDescription: "\u691C\u7D22\u8A9E\u3092\u5909\u66F4\u3059\u308B\u304B\u3001\u30BF\u30B0\u306E\u7D5E\u308A\u8FBC\u307F\u3092\u89E3\u9664\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
@@ -1075,6 +1094,7 @@ var JA_LABELS = {
|
|
|
1075
1094
|
activityNeverOpened: "\u672A\u95B2\u89A7",
|
|
1076
1095
|
activityOpened: "\u95B2\u89A7\u6E08\u307F",
|
|
1077
1096
|
activityInactiveFor: "\u65E5\u9593\u672A\u95B2\u89A7",
|
|
1097
|
+
activityInactiveSuffix: "\u672A\u95B2\u89A7",
|
|
1078
1098
|
activityBefore: "\u95B2\u89A7\u65E5\u6642\u304C\u6B21\u3088\u308A\u524D",
|
|
1079
1099
|
activityAfter: "\u95B2\u89A7\u65E5\u6642\u304C\u6B21\u3088\u308A\u5F8C",
|
|
1080
1100
|
undoReorder: "\u4E26\u3073\u66FF\u3048\u3092\u5143\u306B\u623B\u3059",
|
|
@@ -1124,6 +1144,7 @@ var KO_LABELS = {
|
|
|
1124
1144
|
activeFilters: "\uD65C\uC131 \uD544\uD130",
|
|
1125
1145
|
clearFilters: "\uD544\uD130 \uC9C0\uC6B0\uAE30",
|
|
1126
1146
|
clearAllFilters: "\uBAA8\uB4E0 \uD544\uD130 \uC9C0\uC6B0\uAE30",
|
|
1147
|
+
resetFilters: "\uCD08\uAE30 \uD544\uD130\uB85C \uC7AC\uC124\uC815",
|
|
1127
1148
|
removeFilter: "\uC81C\uAC70",
|
|
1128
1149
|
noFilteredItems: "\uC77C\uCE58\uD558\uB294 \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
1129
1150
|
noFilteredItemsDescription: "\uAC80\uC0C9\uC5B4\uB97C \uBC14\uAFB8\uAC70\uB098 \uD0DC\uADF8 \uD544\uD130\uB97C \uC81C\uAC70\uD574 \uBCF4\uC138\uC694.",
|
|
@@ -1200,6 +1221,7 @@ var KO_LABELS = {
|
|
|
1200
1221
|
activityNeverOpened: "\uC5F4\uC9C0 \uC54A\uC74C",
|
|
1201
1222
|
activityOpened: "\uC5F4\uC5C8\uC74C",
|
|
1202
1223
|
activityInactiveFor: "\uC77C \uB3D9\uC548 \uBE44\uD65C\uC131",
|
|
1224
|
+
activityInactiveSuffix: "\uBE44\uD65C\uC131",
|
|
1203
1225
|
activityBefore: "\uB2E4\uC74C \uC774\uC804\uC5D0 \uC5F4\uB9BC",
|
|
1204
1226
|
activityAfter: "\uB2E4\uC74C \uC774\uD6C4\uC5D0 \uC5F4\uB9BC",
|
|
1205
1227
|
undoReorder: "\uC815\uB82C \uC2E4\uD589 \uCDE8\uC18C",
|
|
@@ -1249,6 +1271,7 @@ var MS_LABELS = {
|
|
|
1249
1271
|
activeFilters: "Penapis aktif",
|
|
1250
1272
|
clearFilters: "Kosongkan penapis",
|
|
1251
1273
|
clearAllFilters: "Kosongkan semua penapis",
|
|
1274
|
+
resetFilters: "Tetapkan semula penapis awal",
|
|
1252
1275
|
removeFilter: "alih keluar",
|
|
1253
1276
|
noFilteredItems: "Tiada item yang sepadan ditemui.",
|
|
1254
1277
|
noFilteredItemsDescription: "Laraskan carian atau alih keluar penapis tag.",
|
|
@@ -1325,6 +1348,7 @@ var MS_LABELS = {
|
|
|
1325
1348
|
activityNeverOpened: "Belum pernah dibuka",
|
|
1326
1349
|
activityOpened: "Telah dibuka",
|
|
1327
1350
|
activityInactiveFor: "hari tidak aktif",
|
|
1351
|
+
activityInactiveSuffix: "tidak aktif",
|
|
1328
1352
|
activityBefore: "Dibuka sebelum",
|
|
1329
1353
|
activityAfter: "Dibuka selepas",
|
|
1330
1354
|
undoReorder: "Buat asal susunan",
|
|
@@ -1374,6 +1398,7 @@ var PT_BR_LABELS = {
|
|
|
1374
1398
|
activeFilters: "Filtros ativos",
|
|
1375
1399
|
clearFilters: "Limpar filtros",
|
|
1376
1400
|
clearAllFilters: "Limpar todos os filtros",
|
|
1401
|
+
resetFilters: "Redefinir filtros iniciais",
|
|
1377
1402
|
removeFilter: "remover",
|
|
1378
1403
|
noFilteredItems: "Nenhum item correspondente encontrado.",
|
|
1379
1404
|
noFilteredItemsDescription: "Ajuste sua busca ou remova um filtro de tag.",
|
|
@@ -1450,6 +1475,7 @@ var PT_BR_LABELS = {
|
|
|
1450
1475
|
activityNeverOpened: "Nunca aberto",
|
|
1451
1476
|
activityOpened: "Aberto",
|
|
1452
1477
|
activityInactiveFor: "dias inativo",
|
|
1478
|
+
activityInactiveSuffix: "inativo",
|
|
1453
1479
|
activityBefore: "Aberto antes de",
|
|
1454
1480
|
activityAfter: "Aberto depois de",
|
|
1455
1481
|
undoReorder: "Desfazer reordena\xE7\xE3o",
|
|
@@ -1499,6 +1525,7 @@ var RU_LABELS = {
|
|
|
1499
1525
|
activeFilters: "\u0410\u043A\u0442\u0438\u0432\u043D\u044B\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u044B",
|
|
1500
1526
|
clearFilters: "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440\u044B",
|
|
1501
1527
|
clearAllFilters: "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0432\u0441\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u044B",
|
|
1528
|
+
resetFilters: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u043A \u0438\u0441\u0445\u043E\u0434\u043D\u044B\u043C \u0444\u0438\u043B\u044C\u0442\u0440\u0430\u043C",
|
|
1502
1529
|
removeFilter: "\u0443\u0434\u0430\u043B\u0438\u0442\u044C",
|
|
1503
1530
|
noFilteredItems: "\u041F\u043E\u0434\u0445\u043E\u0434\u044F\u0449\u0438\u0435 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B.",
|
|
1504
1531
|
noFilteredItemsDescription: "\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u0435 \u043F\u043E\u0438\u0441\u043A \u0438\u043B\u0438 \u0443\u0434\u0430\u043B\u0438\u0442\u0435 \u0444\u0438\u043B\u044C\u0442\u0440 \u0442\u0435\u0433\u0430.",
|
|
@@ -1575,6 +1602,7 @@ var RU_LABELS = {
|
|
|
1575
1602
|
activityNeverOpened: "\u041D\u0435 \u043E\u0442\u043A\u0440\u044B\u0432\u0430\u043B\u0441\u044F",
|
|
1576
1603
|
activityOpened: "\u041E\u0442\u043A\u0440\u044B\u0432\u0430\u043B\u0441\u044F",
|
|
1577
1604
|
activityInactiveFor: "\u0434\u043D. \u0431\u0435\u0437 \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u0438",
|
|
1605
|
+
activityInactiveSuffix: "\u0431\u0435\u0437 \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u0438",
|
|
1578
1606
|
activityBefore: "\u041E\u0442\u043A\u0440\u044B\u0442 \u0434\u043E",
|
|
1579
1607
|
activityAfter: "\u041E\u0442\u043A\u0440\u044B\u0442 \u043F\u043E\u0441\u043B\u0435",
|
|
1580
1608
|
undoReorder: "\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0443",
|
|
@@ -1624,6 +1652,7 @@ var TH_LABELS = {
|
|
|
1624
1652
|
activeFilters: "\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07\u0E17\u0E35\u0E48\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19\u0E2D\u0E22\u0E39\u0E48",
|
|
1625
1653
|
clearFilters: "\u0E25\u0E49\u0E32\u0E07\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07",
|
|
1626
1654
|
clearAllFilters: "\u0E25\u0E49\u0E32\u0E07\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",
|
|
1655
|
+
resetFilters: "\u0E23\u0E35\u0E40\u0E0B\u0E47\u0E15\u0E40\u0E1B\u0E47\u0E19\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19",
|
|
1627
1656
|
removeFilter: "\u0E19\u0E33\u0E2D\u0E2D\u0E01",
|
|
1628
1657
|
noFilteredItems: "\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E17\u0E35\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E19",
|
|
1629
1658
|
noFilteredItemsDescription: "\u0E25\u0E2D\u0E07\u0E1B\u0E23\u0E31\u0E1A\u0E01\u0E32\u0E23\u0E04\u0E49\u0E19\u0E2B\u0E32\u0E2B\u0E23\u0E37\u0E2D\u0E19\u0E33\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07\u0E41\u0E17\u0E47\u0E01\u0E2D\u0E2D\u0E01",
|
|
@@ -1700,6 +1729,7 @@ var TH_LABELS = {
|
|
|
1700
1729
|
activityNeverOpened: "\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E40\u0E04\u0E22\u0E40\u0E1B\u0E34\u0E14",
|
|
1701
1730
|
activityOpened: "\u0E40\u0E04\u0E22\u0E40\u0E1B\u0E34\u0E14\u0E41\u0E25\u0E49\u0E27",
|
|
1702
1731
|
activityInactiveFor: "\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E21\u0E35\u0E01\u0E32\u0E23\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19",
|
|
1732
|
+
activityInactiveSuffix: "\u0E44\u0E21\u0E48\u0E21\u0E35\u0E01\u0E32\u0E23\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19",
|
|
1703
1733
|
activityBefore: "\u0E40\u0E1B\u0E34\u0E14\u0E01\u0E48\u0E2D\u0E19",
|
|
1704
1734
|
activityAfter: "\u0E40\u0E1B\u0E34\u0E14\u0E2B\u0E25\u0E31\u0E07",
|
|
1705
1735
|
undoReorder: "\u0E40\u0E25\u0E34\u0E01\u0E17\u0E33\u0E01\u0E32\u0E23\u0E08\u0E31\u0E14\u0E40\u0E23\u0E35\u0E22\u0E07",
|
|
@@ -1749,6 +1779,7 @@ var VI_LABELS = {
|
|
|
1749
1779
|
activeFilters: "B\u1ED9 l\u1ECDc \u0111ang d\xF9ng",
|
|
1750
1780
|
clearFilters: "X\xF3a b\u1ED9 l\u1ECDc",
|
|
1751
1781
|
clearAllFilters: "X\xF3a t\u1EA5t c\u1EA3 b\u1ED9 l\u1ECDc",
|
|
1782
|
+
resetFilters: "\u0110\u1EB7t l\u1EA1i b\u1ED9 l\u1ECDc ban \u0111\u1EA7u",
|
|
1752
1783
|
removeFilter: "x\xF3a",
|
|
1753
1784
|
noFilteredItems: "Kh\xF4ng t\xECm th\u1EA5y m\u1EE5c ph\xF9 h\u1EE3p.",
|
|
1754
1785
|
noFilteredItemsDescription: "H\xE3y \u0111i\u1EC1u ch\u1EC9nh t\xECm ki\u1EBFm ho\u1EB7c x\xF3a b\u1ED9 l\u1ECDc th\u1EBB.",
|
|
@@ -1825,6 +1856,7 @@ var VI_LABELS = {
|
|
|
1825
1856
|
activityNeverOpened: "Ch\u01B0a t\u1EEBng m\u1EDF",
|
|
1826
1857
|
activityOpened: "\u0110\xE3 m\u1EDF",
|
|
1827
1858
|
activityInactiveFor: "ng\xE0y kh\xF4ng ho\u1EA1t \u0111\u1ED9ng",
|
|
1859
|
+
activityInactiveSuffix: "kh\xF4ng ho\u1EA1t \u0111\u1ED9ng",
|
|
1828
1860
|
activityBefore: "\u0110\xE3 m\u1EDF tr\u01B0\u1EDBc",
|
|
1829
1861
|
activityAfter: "\u0110\xE3 m\u1EDF sau",
|
|
1830
1862
|
undoReorder: "Ho\xE0n t\xE1c s\u1EAFp x\u1EBFp",
|
|
@@ -1874,6 +1906,7 @@ var ZH_HANS_LABELS = {
|
|
|
1874
1906
|
activeFilters: "\u5F53\u524D\u7B5B\u9009\u6761\u4EF6",
|
|
1875
1907
|
clearFilters: "\u6E05\u9664\u7B5B\u9009",
|
|
1876
1908
|
clearAllFilters: "\u6E05\u9664\u6240\u6709\u7B5B\u9009\u6761\u4EF6",
|
|
1909
|
+
resetFilters: "\u6062\u590D\u521D\u59CB\u7B5B\u9009",
|
|
1877
1910
|
removeFilter: "\u79FB\u9664",
|
|
1878
1911
|
noFilteredItems: "\u672A\u627E\u5230\u5339\u914D\u9879\u76EE\u3002",
|
|
1879
1912
|
noFilteredItemsDescription: "\u8BF7\u8C03\u6574\u641C\u7D22\u6761\u4EF6\u6216\u79FB\u9664\u6807\u7B7E\u7B5B\u9009\u3002",
|
|
@@ -1950,6 +1983,7 @@ var ZH_HANS_LABELS = {
|
|
|
1950
1983
|
activityNeverOpened: "\u4ECE\u672A\u6253\u5F00",
|
|
1951
1984
|
activityOpened: "\u5DF2\u6253\u5F00",
|
|
1952
1985
|
activityInactiveFor: "\u5929\u672A\u6D3B\u52A8",
|
|
1986
|
+
activityInactiveSuffix: "\u672A\u6D3B\u52A8",
|
|
1953
1987
|
activityBefore: "\u6253\u5F00\u65F6\u95F4\u65E9\u4E8E",
|
|
1954
1988
|
activityAfter: "\u6253\u5F00\u65F6\u95F4\u665A\u4E8E",
|
|
1955
1989
|
undoReorder: "\u64A4\u9500\u6392\u5E8F",
|
|
@@ -1999,6 +2033,7 @@ var ZH_HANT_LABELS = {
|
|
|
1999
2033
|
activeFilters: "\u76EE\u524D\u7BE9\u9078\u689D\u4EF6",
|
|
2000
2034
|
clearFilters: "\u6E05\u9664\u7BE9\u9078",
|
|
2001
2035
|
clearAllFilters: "\u6E05\u9664\u6240\u6709\u7BE9\u9078\u689D\u4EF6",
|
|
2036
|
+
resetFilters: "\u6062\u5FA9\u521D\u59CB\u7BE9\u9078",
|
|
2002
2037
|
removeFilter: "\u79FB\u9664",
|
|
2003
2038
|
noFilteredItems: "\u627E\u4E0D\u5230\u76F8\u7B26\u9805\u76EE\u3002",
|
|
2004
2039
|
noFilteredItemsDescription: "\u8ACB\u8ABF\u6574\u641C\u5C0B\u689D\u4EF6\u6216\u79FB\u9664\u6A19\u7C64\u7BE9\u9078\u3002",
|
|
@@ -2075,6 +2110,7 @@ var ZH_HANT_LABELS = {
|
|
|
2075
2110
|
activityNeverOpened: "\u5F9E\u672A\u958B\u555F",
|
|
2076
2111
|
activityOpened: "\u5DF2\u958B\u555F",
|
|
2077
2112
|
activityInactiveFor: "\u5929\u672A\u6D3B\u52D5",
|
|
2113
|
+
activityInactiveSuffix: "\u672A\u6D3B\u52D5",
|
|
2078
2114
|
activityBefore: "\u958B\u555F\u6642\u9593\u65E9\u65BC",
|
|
2079
2115
|
activityAfter: "\u958B\u555F\u6642\u9593\u665A\u65BC",
|
|
2080
2116
|
undoReorder: "\u5FA9\u539F\u6392\u5E8F",
|
|
@@ -2616,7 +2652,7 @@ function isQuotaError(error) {
|
|
|
2616
2652
|
}
|
|
2617
2653
|
|
|
2618
2654
|
// src/features/actions/hooks/useKeepBulkActions.ts
|
|
2619
|
-
import { useKeepList } from "@keepkit/core/react";
|
|
2655
|
+
import { useKeepCollections, useKeepList } from "@keepkit/core/react";
|
|
2620
2656
|
import { useState as useState2 } from "react";
|
|
2621
2657
|
function isAllSelected(items, selectedIds) {
|
|
2622
2658
|
if (items.length === 0) return false;
|
|
@@ -2645,6 +2681,7 @@ function useKeepBulkActions(options) {
|
|
|
2645
2681
|
const list = useKeepList(query);
|
|
2646
2682
|
const queryList = useKeepList(query ? { ...query, pagination: void 0 } : { pagination: void 0 });
|
|
2647
2683
|
const allList = useKeepList({ pagination: void 0 });
|
|
2684
|
+
const collections = useKeepCollections();
|
|
2648
2685
|
const [uncontrolledScope, setUncontrolledScope] = useState2(controlledScope ?? "page");
|
|
2649
2686
|
const selectionScope = controlledScope ?? uncontrolledScope;
|
|
2650
2687
|
const targetItems = selectionScope === "page" ? list.items : selectionScope === "query" ? queryList.items : allList.items;
|
|
@@ -2652,6 +2689,7 @@ function useKeepBulkActions(options) {
|
|
|
2652
2689
|
const selectedIds = controlledSelectedIds ?? uncontrolledSelectedIds;
|
|
2653
2690
|
const selected = new Set(selectedIds);
|
|
2654
2691
|
const [tagsInput, setTagsInput] = useState2("");
|
|
2692
|
+
const [collectionId, setCollectionId] = useState2("");
|
|
2655
2693
|
const setSelectionScope = (scope) => {
|
|
2656
2694
|
if (controlledScope === void 0) setUncontrolledScope(scope);
|
|
2657
2695
|
onSelectionScopeChange?.(scope);
|
|
@@ -2675,6 +2713,27 @@ function useKeepBulkActions(options) {
|
|
|
2675
2713
|
onCompleted?.("tags", ids);
|
|
2676
2714
|
setSelectedIds([]);
|
|
2677
2715
|
};
|
|
2716
|
+
const moveToCollection = async () => {
|
|
2717
|
+
const ids = [...selectedIds];
|
|
2718
|
+
await list.moveToCollectionBatch(ids, collectionId || void 0);
|
|
2719
|
+
setSelectedIds([]);
|
|
2720
|
+
};
|
|
2721
|
+
const archive = async () => {
|
|
2722
|
+
await list.archiveBatch([...selectedIds]);
|
|
2723
|
+
setSelectedIds([]);
|
|
2724
|
+
};
|
|
2725
|
+
const unarchive = async () => {
|
|
2726
|
+
await list.unarchiveBatch([...selectedIds]);
|
|
2727
|
+
setSelectedIds([]);
|
|
2728
|
+
};
|
|
2729
|
+
const pin = async () => {
|
|
2730
|
+
await list.pinBatch([...selectedIds]);
|
|
2731
|
+
setSelectedIds([]);
|
|
2732
|
+
};
|
|
2733
|
+
const unpin = async () => {
|
|
2734
|
+
await list.unpinBatch([...selectedIds]);
|
|
2735
|
+
setSelectedIds([]);
|
|
2736
|
+
};
|
|
2678
2737
|
const state = {
|
|
2679
2738
|
items: targetItems,
|
|
2680
2739
|
selectedIds,
|
|
@@ -2688,6 +2747,14 @@ function useKeepBulkActions(options) {
|
|
|
2688
2747
|
toggleAll,
|
|
2689
2748
|
remove,
|
|
2690
2749
|
updateTags,
|
|
2750
|
+
collectionId,
|
|
2751
|
+
setCollectionId,
|
|
2752
|
+
collections,
|
|
2753
|
+
moveToCollection,
|
|
2754
|
+
archive,
|
|
2755
|
+
unarchive,
|
|
2756
|
+
pin,
|
|
2757
|
+
unpin,
|
|
2691
2758
|
isMutating: list.isMutating,
|
|
2692
2759
|
selectionScope,
|
|
2693
2760
|
setSelectionScope
|
|
@@ -2853,6 +2920,50 @@ function KeepBulkActions({
|
|
|
2853
2920
|
disabled: state.selectedIds.length === 0 || state.isMutating,
|
|
2854
2921
|
children: showApplyTagsLabel ? labels.applyTags : null
|
|
2855
2922
|
}
|
|
2923
|
+
),
|
|
2924
|
+
/* @__PURE__ */ jsxs3("label", { children: [
|
|
2925
|
+
"Move selected items to collection",
|
|
2926
|
+
/* @__PURE__ */ jsxs3("select", { value: state.collectionId, onChange: (event) => state.setCollectionId(event.currentTarget.value), children: [
|
|
2927
|
+
/* @__PURE__ */ jsx5("option", { value: "", children: "Unassigned" }),
|
|
2928
|
+
state.collections.map((collection) => /* @__PURE__ */ jsx5("option", { value: collection.id, children: collection.name }, collection.id))
|
|
2929
|
+
] })
|
|
2930
|
+
] }),
|
|
2931
|
+
/* @__PURE__ */ jsx5(
|
|
2932
|
+
"button",
|
|
2933
|
+
{
|
|
2934
|
+
type: "button",
|
|
2935
|
+
onClick: () => void state.moveToCollection(),
|
|
2936
|
+
disabled: !state.selectedCount || state.isMutating,
|
|
2937
|
+
children: "Move selected items"
|
|
2938
|
+
}
|
|
2939
|
+
),
|
|
2940
|
+
/* @__PURE__ */ jsx5(
|
|
2941
|
+
"button",
|
|
2942
|
+
{
|
|
2943
|
+
type: "button",
|
|
2944
|
+
onClick: () => void state.archive(),
|
|
2945
|
+
disabled: !state.selectedCount || state.isMutating,
|
|
2946
|
+
children: "Archive selected items"
|
|
2947
|
+
}
|
|
2948
|
+
),
|
|
2949
|
+
/* @__PURE__ */ jsx5(
|
|
2950
|
+
"button",
|
|
2951
|
+
{
|
|
2952
|
+
type: "button",
|
|
2953
|
+
onClick: () => void state.unarchive(),
|
|
2954
|
+
disabled: !state.selectedCount || state.isMutating,
|
|
2955
|
+
children: "Unarchive selected items"
|
|
2956
|
+
}
|
|
2957
|
+
),
|
|
2958
|
+
/* @__PURE__ */ jsx5("button", { type: "button", onClick: () => void state.pin(), disabled: !state.selectedCount || state.isMutating, children: "Pin selected items" }),
|
|
2959
|
+
/* @__PURE__ */ jsx5(
|
|
2960
|
+
"button",
|
|
2961
|
+
{
|
|
2962
|
+
type: "button",
|
|
2963
|
+
onClick: () => void state.unpin(),
|
|
2964
|
+
disabled: !state.selectedCount || state.isMutating,
|
|
2965
|
+
children: "Unpin selected items"
|
|
2966
|
+
}
|
|
2856
2967
|
)
|
|
2857
2968
|
] });
|
|
2858
2969
|
return /* @__PURE__ */ jsx5(
|
|
@@ -2992,7 +3103,7 @@ import {
|
|
|
2992
3103
|
} from "react";
|
|
2993
3104
|
|
|
2994
3105
|
// src/features/editor/KeepQuickEditor.tsx
|
|
2995
|
-
import { useKeepCollections, useKeepItem as useKeepItem3 } from "@keepkit/core/react";
|
|
3106
|
+
import { useKeepCollections as useKeepCollections2, useKeepItem as useKeepItem3 } from "@keepkit/core/react";
|
|
2996
3107
|
import {
|
|
2997
3108
|
useCallback as useCallback2,
|
|
2998
3109
|
useEffect as useEffect3,
|
|
@@ -3138,7 +3249,7 @@ function KeepQuickEditorView({
|
|
|
3138
3249
|
...props
|
|
3139
3250
|
}) {
|
|
3140
3251
|
const enabled = { ...DEFAULT_FEATURES, ...features };
|
|
3141
|
-
const collections =
|
|
3252
|
+
const collections = useKeepCollections2({ targetType: state.item.targetType, orderBy: "name" });
|
|
3142
3253
|
const rootRef = useRef4(null);
|
|
3143
3254
|
const noteLabel = useUiLabel("note");
|
|
3144
3255
|
const showNoteLabel = useUiLabelVisibility("note");
|
|
@@ -3518,7 +3629,7 @@ function KeepUndo({ children, label, ...props }) {
|
|
|
3518
3629
|
|
|
3519
3630
|
// src/features/collection/KeepCollection.tsx
|
|
3520
3631
|
import { KeepErrorBoundary as KeepErrorBoundary2 } from "@keepkit/core/react";
|
|
3521
|
-
import { useEffect as
|
|
3632
|
+
import { useEffect as useEffect11, useId as useId4, useRef as useRef9, useState as useState17 } from "react";
|
|
3522
3633
|
|
|
3523
3634
|
// src/features/query/KeepActiveFiltersSummary.tsx
|
|
3524
3635
|
import {
|
|
@@ -3532,6 +3643,8 @@ function KeepActiveFiltersSummary({
|
|
|
3532
3643
|
tags: providedTags,
|
|
3533
3644
|
collection: providedCollection,
|
|
3534
3645
|
collectionLabel: providedCollectionLabel,
|
|
3646
|
+
organization: providedOrganization,
|
|
3647
|
+
savedBetween: providedSavedBetween,
|
|
3535
3648
|
activity: providedActivity,
|
|
3536
3649
|
activityLabel: providedActivityLabel,
|
|
3537
3650
|
archiveScope: providedArchiveScope,
|
|
@@ -3540,9 +3653,13 @@ function KeepActiveFiltersSummary({
|
|
|
3540
3653
|
onSearchChange,
|
|
3541
3654
|
onTagChange,
|
|
3542
3655
|
onCollectionChange,
|
|
3656
|
+
onOrganizationChange,
|
|
3657
|
+
onSavedBetweenChange,
|
|
3543
3658
|
onActivityChange,
|
|
3544
3659
|
onArchiveScopeChange,
|
|
3545
3660
|
onClear,
|
|
3661
|
+
onReset,
|
|
3662
|
+
canReset = false,
|
|
3546
3663
|
children,
|
|
3547
3664
|
asChild = false,
|
|
3548
3665
|
className,
|
|
@@ -3551,15 +3668,32 @@ function KeepActiveFiltersSummary({
|
|
|
3551
3668
|
const search = (providedSearch ?? query?.search?.query ?? "").trim();
|
|
3552
3669
|
const tags = normalizeUiTags(providedTags ?? query?.tags ?? []);
|
|
3553
3670
|
const collection = providedCollection ?? query?.collectionId;
|
|
3671
|
+
const organization = providedOrganization ?? query?.organization;
|
|
3672
|
+
const savedBetween = providedSavedBetween ?? query?.savedBetween;
|
|
3554
3673
|
const activity = providedActivity ?? query?.activity;
|
|
3555
|
-
const
|
|
3674
|
+
const activityLabels = {
|
|
3675
|
+
neverOpened: useUiLabel("activityNeverOpened"),
|
|
3676
|
+
opened: useUiLabel("activityOpened"),
|
|
3677
|
+
inactiveSuffix: useUiLabel("activityInactiveSuffix"),
|
|
3678
|
+
before: useUiLabel("activityBefore"),
|
|
3679
|
+
after: useUiLabel("activityAfter")
|
|
3680
|
+
};
|
|
3681
|
+
const { locale } = useKeepUiLabels();
|
|
3682
|
+
const formattedActivityFilters = formatActivity(activity, activityLabels, locale);
|
|
3683
|
+
const activityFilters = providedActivityLabel && formattedActivityFilters.length === 1 ? [{ ...formattedActivityFilters[0], label: providedActivityLabel }] : formattedActivityFilters;
|
|
3684
|
+
const hasActivity = activityFilters.length > 0;
|
|
3685
|
+
const organizationFilters = organization ? ["collection", "tags", "note"].flatMap(
|
|
3686
|
+
(field) => organization[field] ? [{ field, value: organization[field] }] : []
|
|
3687
|
+
) : [];
|
|
3688
|
+
const savedBetweenLabel = savedBetween ? savedBetween.map((value) => new Date(value instanceof Date ? value.getTime() : value).toLocaleDateString(locale)).join(" \u2013 ") : void 0;
|
|
3556
3689
|
const archiveScope = providedArchiveScope ?? query?.archiveScope ?? (query?.archived === true ? "archived" : "active");
|
|
3557
3690
|
const hasArchiveScope = archiveScope !== void 0 && archiveScope !== "active";
|
|
3558
|
-
const hasFilters = Boolean(search) || tags.length > 0 || Boolean(collection) || hasActivity || hasArchiveScope;
|
|
3691
|
+
const hasFilters = Boolean(search) || tags.length > 0 || Boolean(collection) || organizationFilters.length > 0 || Boolean(savedBetween) || hasActivity || hasArchiveScope;
|
|
3559
3692
|
const activeFiltersLabel = useUiLabel("activeFilters");
|
|
3560
3693
|
const showActiveFiltersLabel = useUiLabelVisibility("activeFilters");
|
|
3561
3694
|
const clearAllLabel = useUiLabel("clearAllFilters");
|
|
3562
3695
|
const clearLabel = useUiLabel("clearFilters");
|
|
3696
|
+
const resetLabel = useUiLabel("resetFilters");
|
|
3563
3697
|
const removeLabel = useUiLabel("removeFilter");
|
|
3564
3698
|
const uncategorizedLabel = useUiLabel("uncategorized");
|
|
3565
3699
|
const collectionItemLabel = useUiLabel("collectionItem");
|
|
@@ -3570,20 +3704,13 @@ function KeepActiveFiltersSummary({
|
|
|
3570
3704
|
archived: useUiLabel("archiveScopeArchived"),
|
|
3571
3705
|
all: useUiLabel("archiveScopeAll")
|
|
3572
3706
|
};
|
|
3573
|
-
const activityLabels = {
|
|
3574
|
-
neverOpened: useUiLabel("activityNeverOpened"),
|
|
3575
|
-
opened: useUiLabel("activityOpened"),
|
|
3576
|
-
inactiveFor: useUiLabel("activityInactiveFor"),
|
|
3577
|
-
before: useUiLabel("activityBefore"),
|
|
3578
|
-
after: useUiLabel("activityAfter")
|
|
3579
|
-
};
|
|
3580
|
-
const { locale } = useKeepUiLabels();
|
|
3581
|
-
const resolvedActivityLabel = providedActivityLabel ?? formatActivity(activity, activityLabels, locale);
|
|
3582
3707
|
const resolvedArchiveScopeLabel = providedArchiveScopeLabel ?? (archiveScope === void 0 ? void 0 : archiveLabels[archiveScope]);
|
|
3583
3708
|
const chipRefs = useRef6([]);
|
|
3584
3709
|
const collectionIndex = Number(Boolean(search)) + tags.length;
|
|
3585
|
-
const
|
|
3586
|
-
const
|
|
3710
|
+
const organizationIndex = collectionIndex + Number(Boolean(collection));
|
|
3711
|
+
const activityIndex = organizationIndex + organizationFilters.length;
|
|
3712
|
+
const savedBetweenIndex = activityIndex + activityFilters.length;
|
|
3713
|
+
const archiveScopeIndex = savedBetweenIndex + Number(Boolean(savedBetween));
|
|
3587
3714
|
const filterCount = archiveScopeIndex + Number(hasArchiveScope);
|
|
3588
3715
|
function focusChip(index) {
|
|
3589
3716
|
chipRefs.current[index]?.focus();
|
|
@@ -3619,9 +3746,23 @@ function KeepActiveFiltersSummary({
|
|
|
3619
3746
|
focusAfterRemoval(collectionIndex, event.currentTarget);
|
|
3620
3747
|
onCollectionChange?.(void 0);
|
|
3621
3748
|
}
|
|
3622
|
-
function
|
|
3623
|
-
focusAfterRemoval(
|
|
3624
|
-
|
|
3749
|
+
function removeOrganization(field, index, event) {
|
|
3750
|
+
focusAfterRemoval(index, event.currentTarget);
|
|
3751
|
+
if (!organization) return;
|
|
3752
|
+
const next = { ...organization };
|
|
3753
|
+
delete next[field];
|
|
3754
|
+
onOrganizationChange?.(Object.keys(next).length > 0 ? next : void 0);
|
|
3755
|
+
}
|
|
3756
|
+
function removeSavedBetween(event) {
|
|
3757
|
+
focusAfterRemoval(savedBetweenIndex, event.currentTarget);
|
|
3758
|
+
onSavedBetweenChange?.(void 0);
|
|
3759
|
+
}
|
|
3760
|
+
function removeActivityCondition(key, index, event) {
|
|
3761
|
+
focusAfterRemoval(index, event.currentTarget);
|
|
3762
|
+
if (!activity) return;
|
|
3763
|
+
const next = { ...activity };
|
|
3764
|
+
delete next[key];
|
|
3765
|
+
onActivityChange?.(Object.keys(next).length > 0 ? next : void 0);
|
|
3625
3766
|
}
|
|
3626
3767
|
function removeArchiveScope(event) {
|
|
3627
3768
|
focusAfterRemoval(archiveScopeIndex, event.currentTarget);
|
|
@@ -3631,6 +3772,8 @@ function KeepActiveFiltersSummary({
|
|
|
3631
3772
|
search,
|
|
3632
3773
|
tags,
|
|
3633
3774
|
collection,
|
|
3775
|
+
organization,
|
|
3776
|
+
savedBetween,
|
|
3634
3777
|
activity,
|
|
3635
3778
|
archiveScope,
|
|
3636
3779
|
totalCount,
|
|
@@ -3639,11 +3782,19 @@ function KeepActiveFiltersSummary({
|
|
|
3639
3782
|
removeSearch: () => onSearchChange?.(""),
|
|
3640
3783
|
removeTag: (tag) => onTagChange?.(tag),
|
|
3641
3784
|
removeCollection: () => onCollectionChange?.(void 0),
|
|
3785
|
+
removeOrganization: (field) => {
|
|
3786
|
+
if (!organization) return;
|
|
3787
|
+
const next = { ...organization };
|
|
3788
|
+
delete next[field];
|
|
3789
|
+
onOrganizationChange?.(Object.keys(next).length > 0 ? next : void 0);
|
|
3790
|
+
},
|
|
3791
|
+
removeSavedBetween: () => onSavedBetweenChange?.(void 0),
|
|
3642
3792
|
removeActivity: () => onActivityChange?.(void 0),
|
|
3643
|
-
removeArchiveScope: () => onArchiveScopeChange?.("active")
|
|
3793
|
+
removeArchiveScope: () => onArchiveScopeChange?.("active"),
|
|
3794
|
+
reset: () => onReset?.()
|
|
3644
3795
|
};
|
|
3645
3796
|
const contentChildren = asChild && isElement(children) ? void 0 : children;
|
|
3646
|
-
const body = typeof contentChildren === "function" ? contentChildren(state) : contentChildren ?? (hasFilters ? /* @__PURE__ */ jsxs8(Fragment6, { children: [
|
|
3797
|
+
const body = typeof contentChildren === "function" ? contentChildren(state) : contentChildren ?? (hasFilters || canReset ? /* @__PURE__ */ jsxs8(Fragment6, { children: [
|
|
3647
3798
|
showActiveFiltersLabel ? /* @__PURE__ */ jsx10("span", { "data-active-filters-label": "true", children: activeFiltersLabel }) : null,
|
|
3648
3799
|
/* @__PURE__ */ jsxs8("ul", { "data-active-filters-list": "true", children: [
|
|
3649
3800
|
search ? /* @__PURE__ */ jsxs8("li", { "data-filter-kind": "search", children: [
|
|
@@ -3697,19 +3848,60 @@ function KeepActiveFiltersSummary({
|
|
|
3697
3848
|
}
|
|
3698
3849
|
)
|
|
3699
3850
|
] }) : null,
|
|
3700
|
-
|
|
3701
|
-
|
|
3851
|
+
organizationFilters.map(({ field, value }, filterIndex) => {
|
|
3852
|
+
const index = organizationIndex + filterIndex;
|
|
3853
|
+
const label = `${field}: ${value}`;
|
|
3854
|
+
return /* @__PURE__ */ jsxs8("li", { "data-filter-kind": `organization-${field}`, children: [
|
|
3855
|
+
/* @__PURE__ */ jsx10("span", { "data-filter-value": "true", children: label }),
|
|
3856
|
+
/* @__PURE__ */ jsx10(
|
|
3857
|
+
"button",
|
|
3858
|
+
{
|
|
3859
|
+
type: "button",
|
|
3860
|
+
"data-keep-action": "remove-organization-filter",
|
|
3861
|
+
"aria-label": `${label} ${removeLabel}`,
|
|
3862
|
+
ref: (element) => {
|
|
3863
|
+
chipRefs.current[index] = element;
|
|
3864
|
+
},
|
|
3865
|
+
onKeyDown: (event) => handleChipKeyDown(event, index),
|
|
3866
|
+
onClick: (event) => removeOrganization(field, index, event),
|
|
3867
|
+
children: "\xD7"
|
|
3868
|
+
}
|
|
3869
|
+
)
|
|
3870
|
+
] }, `organization-${field}`);
|
|
3871
|
+
}),
|
|
3872
|
+
activityFilters.map((filter, filterIndex) => {
|
|
3873
|
+
const index = activityIndex + filterIndex;
|
|
3874
|
+
return /* @__PURE__ */ jsxs8("li", { "data-filter-kind": `activity-${filter.key}`, children: [
|
|
3875
|
+
/* @__PURE__ */ jsx10("span", { "data-filter-value": "true", children: filter.label }),
|
|
3876
|
+
/* @__PURE__ */ jsx10(
|
|
3877
|
+
"button",
|
|
3878
|
+
{
|
|
3879
|
+
type: "button",
|
|
3880
|
+
"data-keep-action": "remove-activity-filter",
|
|
3881
|
+
"aria-label": `${filter.label} ${removeLabel}`,
|
|
3882
|
+
ref: (element) => {
|
|
3883
|
+
chipRefs.current[index] = element;
|
|
3884
|
+
},
|
|
3885
|
+
onKeyDown: (event) => handleChipKeyDown(event, index),
|
|
3886
|
+
onClick: (event) => removeActivityCondition(filter.key, index, event),
|
|
3887
|
+
children: "\xD7"
|
|
3888
|
+
}
|
|
3889
|
+
)
|
|
3890
|
+
] }, filter.key);
|
|
3891
|
+
}),
|
|
3892
|
+
savedBetweenLabel ? /* @__PURE__ */ jsxs8("li", { "data-filter-kind": "saved-between", children: [
|
|
3893
|
+
/* @__PURE__ */ jsx10("span", { "data-filter-value": "true", children: savedBetweenLabel }),
|
|
3702
3894
|
/* @__PURE__ */ jsx10(
|
|
3703
3895
|
"button",
|
|
3704
3896
|
{
|
|
3705
3897
|
type: "button",
|
|
3706
|
-
"data-keep-action": "remove-
|
|
3707
|
-
"aria-label": `${
|
|
3898
|
+
"data-keep-action": "remove-saved-between-filter",
|
|
3899
|
+
"aria-label": `${savedBetweenLabel} ${removeLabel}`,
|
|
3708
3900
|
ref: (element) => {
|
|
3709
|
-
chipRefs.current[
|
|
3901
|
+
chipRefs.current[savedBetweenIndex] = element;
|
|
3710
3902
|
},
|
|
3711
|
-
onKeyDown: (event) => handleChipKeyDown(event,
|
|
3712
|
-
onClick:
|
|
3903
|
+
onKeyDown: (event) => handleChipKeyDown(event, savedBetweenIndex),
|
|
3904
|
+
onClick: removeSavedBetween,
|
|
3713
3905
|
children: "\xD7"
|
|
3714
3906
|
}
|
|
3715
3907
|
)
|
|
@@ -3737,9 +3929,10 @@ function KeepActiveFiltersSummary({
|
|
|
3737
3929
|
" ",
|
|
3738
3930
|
totalCount === 1 ? collectionItemLabel : collectionItemsLabel
|
|
3739
3931
|
] }) : null,
|
|
3740
|
-
/* @__PURE__ */ jsx10("button", { type: "button", "data-keep-action": "clear-filters", onClick: state.clear, children: clearAllLabel || clearLabel })
|
|
3932
|
+
hasFilters ? /* @__PURE__ */ jsx10("button", { type: "button", "data-keep-action": "clear-filters", onClick: state.clear, children: clearAllLabel || clearLabel }) : null,
|
|
3933
|
+
canReset ? /* @__PURE__ */ jsx10("button", { type: "button", "data-keep-action": "reset-filters", onClick: state.reset, children: resetLabel }) : null
|
|
3741
3934
|
] }) : null);
|
|
3742
|
-
if (!hasFilters && !asChild && contentChildren === void 0) return null;
|
|
3935
|
+
if (!hasFilters && !canReset && !asChild && contentChildren === void 0) return null;
|
|
3743
3936
|
return renderRoot(
|
|
3744
3937
|
asChild,
|
|
3745
3938
|
isElement(children) ? children : void 0,
|
|
@@ -3755,20 +3948,42 @@ function KeepActiveFiltersSummary({
|
|
|
3755
3948
|
);
|
|
3756
3949
|
}
|
|
3757
3950
|
function formatActivity(activity, labels, locale) {
|
|
3758
|
-
if (!activity
|
|
3759
|
-
|
|
3760
|
-
if (activity.opened === "
|
|
3951
|
+
if (!activity) return [];
|
|
3952
|
+
const filters = [];
|
|
3953
|
+
if (activity.opened === "never") filters.push({ key: "opened", label: labels.neverOpened });
|
|
3954
|
+
if (activity.opened === "ever") filters.push({ key: "opened", label: labels.opened });
|
|
3761
3955
|
if (activity.inactiveForMs !== void 0) {
|
|
3762
|
-
|
|
3763
|
-
|
|
3956
|
+
filters.push({
|
|
3957
|
+
key: "inactiveForMs",
|
|
3958
|
+
label: `${formatDuration(activity.inactiveForMs, locale)}${isCjkLocale(locale) ? "" : " "}${labels.inactiveSuffix}`
|
|
3959
|
+
});
|
|
3764
3960
|
}
|
|
3765
3961
|
if (activity.lastOpenedBefore !== void 0) {
|
|
3766
|
-
|
|
3962
|
+
filters.push({
|
|
3963
|
+
key: "lastOpenedBefore",
|
|
3964
|
+
label: `${labels.before} ${new Date(activity.lastOpenedBefore).toLocaleDateString(locale)}`
|
|
3965
|
+
});
|
|
3767
3966
|
}
|
|
3768
3967
|
if (activity.lastOpenedAfter !== void 0) {
|
|
3769
|
-
|
|
3968
|
+
filters.push({
|
|
3969
|
+
key: "lastOpenedAfter",
|
|
3970
|
+
label: `${labels.after} ${new Date(activity.lastOpenedAfter).toLocaleDateString(locale)}`
|
|
3971
|
+
});
|
|
3770
3972
|
}
|
|
3771
|
-
return
|
|
3973
|
+
return filters;
|
|
3974
|
+
}
|
|
3975
|
+
function formatDuration(milliseconds, locale) {
|
|
3976
|
+
const absolute = Math.max(1, Math.round(milliseconds));
|
|
3977
|
+
const hour = 60 * 60 * 1e3;
|
|
3978
|
+
const day = 24 * hour;
|
|
3979
|
+
const unit = absolute < hour ? "minute" : absolute < day ? "hour" : "day";
|
|
3980
|
+
const value = unit === "minute" ? Math.max(1, Math.round(absolute / (60 * 1e3))) : unit === "hour" ? Math.max(1, Math.round(absolute / hour)) : Math.max(1, Math.round(absolute / day));
|
|
3981
|
+
const formatted = new Intl.NumberFormat(locale, { style: "unit", unit, unitDisplay: "long" }).format(value);
|
|
3982
|
+
const compact = isCjkLocale(locale) ? formatted.replace(/\s+/g, "") : formatted;
|
|
3983
|
+
return /^ja/i.test(locale ?? "") && unit === "day" ? compact.replace(/日$/, "\u65E5\u9593") : compact;
|
|
3984
|
+
}
|
|
3985
|
+
function isCjkLocale(locale) {
|
|
3986
|
+
return /^(?:ja|ko|zh)/i.test(locale ?? "");
|
|
3772
3987
|
}
|
|
3773
3988
|
function isElement(value) {
|
|
3774
3989
|
return isValidElement2(value);
|
|
@@ -3833,7 +4048,7 @@ function KeepArchiveScopeSelect({
|
|
|
3833
4048
|
}
|
|
3834
4049
|
|
|
3835
4050
|
// src/features/query/KeepCollectionFilter.tsx
|
|
3836
|
-
import { useKeepCollections as
|
|
4051
|
+
import { useKeepCollections as useKeepCollections3, useKeepContext as useKeepContext3 } from "@keepkit/core/react";
|
|
3837
4052
|
import { useState as useState7 } from "react";
|
|
3838
4053
|
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3839
4054
|
function useCollectionOptions(collectionLabels, collections) {
|
|
@@ -3855,7 +4070,7 @@ function KeepCollectionSelect({
|
|
|
3855
4070
|
const context = useKeepContext3();
|
|
3856
4071
|
const state = useState7(value ?? defaultValue ?? item.collectionId ?? "");
|
|
3857
4072
|
const selected = value ?? state[0];
|
|
3858
|
-
const collections =
|
|
4073
|
+
const collections = useKeepCollections3({ targetType: item.targetType, orderBy: "name" });
|
|
3859
4074
|
const options = useCollectionOptions(collectionLabels, collections);
|
|
3860
4075
|
const defaultUncategorizedLabel = useUiLabel("uncategorized");
|
|
3861
4076
|
const uncategorized = uncategorizedLabel ?? defaultUncategorizedLabel;
|
|
@@ -3892,7 +4107,7 @@ function KeepCollectionFilter({
|
|
|
3892
4107
|
}) {
|
|
3893
4108
|
const [internalValue, setInternalValue] = useState7(value ?? defaultValue ?? "");
|
|
3894
4109
|
const selected = value ?? internalValue;
|
|
3895
|
-
const collections =
|
|
4110
|
+
const collections = useKeepCollections3({ orderBy: "name" });
|
|
3896
4111
|
const options = useCollectionOptions(collectionLabels, collections);
|
|
3897
4112
|
const collectionLabel = useUiLabel("collection");
|
|
3898
4113
|
const showCollectionLabel = useUiLabelVisibility("collection");
|
|
@@ -4031,8 +4246,10 @@ function KeepTagFilter({
|
|
|
4031
4246
|
import { useEffect as useEffect6, useState as useState9 } from "react";
|
|
4032
4247
|
function useKeepSearchInput(options) {
|
|
4033
4248
|
const { controlledValue, defaultValue, debounceMs, onValueChange } = options;
|
|
4034
|
-
const [
|
|
4035
|
-
|
|
4249
|
+
const [value, setValue] = useState9(controlledValue ?? defaultValue);
|
|
4250
|
+
useEffect6(() => {
|
|
4251
|
+
if (controlledValue !== void 0) setValue(controlledValue);
|
|
4252
|
+
}, [controlledValue]);
|
|
4036
4253
|
useEffect6(() => {
|
|
4037
4254
|
if (!onValueChange) return;
|
|
4038
4255
|
if (debounceMs <= 0) {
|
|
@@ -4046,7 +4263,7 @@ function useKeepSearchInput(options) {
|
|
|
4046
4263
|
value,
|
|
4047
4264
|
label: useUiLabel("search"),
|
|
4048
4265
|
change: (event) => {
|
|
4049
|
-
|
|
4266
|
+
setValue(event.currentTarget.value);
|
|
4050
4267
|
}
|
|
4051
4268
|
};
|
|
4052
4269
|
}
|
|
@@ -4215,9 +4432,219 @@ function KeepPagination({
|
|
|
4215
4432
|
] });
|
|
4216
4433
|
}
|
|
4217
4434
|
|
|
4435
|
+
// src/features/saved-views/KeepSavedViews.tsx
|
|
4436
|
+
import { useState as useState11 } from "react";
|
|
4437
|
+
|
|
4438
|
+
// src/features/saved-views/useKeepSavedViews.ts
|
|
4439
|
+
import { LocalStorageKeepSavedViewStorage } from "@keepkit/core/core";
|
|
4440
|
+
import { useCallback as useCallback5, useEffect as useEffect7, useMemo as useMemo4, useState as useState10 } from "react";
|
|
4441
|
+
var changeEvent = "keepkit:saved-views:change";
|
|
4442
|
+
function useKeepSavedViews(storage) {
|
|
4443
|
+
const resolvedStorage = useMemo4(() => storage ?? new LocalStorageKeepSavedViewStorage(), [storage]);
|
|
4444
|
+
const [views, setViews] = useState10([]);
|
|
4445
|
+
const [error, setError] = useState10();
|
|
4446
|
+
const refresh = useCallback5(async () => {
|
|
4447
|
+
try {
|
|
4448
|
+
setViews(sortViews(await resolvedStorage.getAll()));
|
|
4449
|
+
setError(void 0);
|
|
4450
|
+
} catch (cause) {
|
|
4451
|
+
setError(cause);
|
|
4452
|
+
}
|
|
4453
|
+
}, [resolvedStorage]);
|
|
4454
|
+
useEffect7(() => {
|
|
4455
|
+
void refresh();
|
|
4456
|
+
if (typeof window === "undefined") return;
|
|
4457
|
+
window.addEventListener(changeEvent, refresh);
|
|
4458
|
+
return () => window.removeEventListener(changeEvent, refresh);
|
|
4459
|
+
}, [refresh]);
|
|
4460
|
+
const createView = useCallback5(
|
|
4461
|
+
async (name, query) => {
|
|
4462
|
+
const trimmed = name.trim();
|
|
4463
|
+
if (!trimmed) throw new Error("Saved View name is required.");
|
|
4464
|
+
if (query.filter) throw new Error("Saved Views require a serializable query; query.filter cannot be saved.");
|
|
4465
|
+
const now = Date.now();
|
|
4466
|
+
const view = { id: createId(), name: trimmed, query: normalizeQuery(query), createdAt: now, updatedAt: now };
|
|
4467
|
+
try {
|
|
4468
|
+
await resolvedStorage.set(view);
|
|
4469
|
+
notifyChange();
|
|
4470
|
+
return view;
|
|
4471
|
+
} catch (cause) {
|
|
4472
|
+
setError(cause);
|
|
4473
|
+
throw cause;
|
|
4474
|
+
}
|
|
4475
|
+
},
|
|
4476
|
+
[resolvedStorage]
|
|
4477
|
+
);
|
|
4478
|
+
const updateView = useCallback5(
|
|
4479
|
+
async (id, update) => {
|
|
4480
|
+
try {
|
|
4481
|
+
const current = await resolvedStorage.get(id);
|
|
4482
|
+
if (!current) return;
|
|
4483
|
+
const name = update.name?.trim() ?? current.name;
|
|
4484
|
+
if (!name) throw new Error("Saved View name is required.");
|
|
4485
|
+
if (update.query?.filter)
|
|
4486
|
+
throw new Error("Saved Views require a serializable query; query.filter cannot be saved.");
|
|
4487
|
+
const view = {
|
|
4488
|
+
...current,
|
|
4489
|
+
...update,
|
|
4490
|
+
...update.query ? { query: normalizeQuery(update.query) } : {},
|
|
4491
|
+
name,
|
|
4492
|
+
updatedAt: Date.now()
|
|
4493
|
+
};
|
|
4494
|
+
await resolvedStorage.set(view);
|
|
4495
|
+
notifyChange();
|
|
4496
|
+
} catch (cause) {
|
|
4497
|
+
setError(cause);
|
|
4498
|
+
throw cause;
|
|
4499
|
+
}
|
|
4500
|
+
},
|
|
4501
|
+
[resolvedStorage]
|
|
4502
|
+
);
|
|
4503
|
+
const removeView = useCallback5(
|
|
4504
|
+
async (id) => {
|
|
4505
|
+
try {
|
|
4506
|
+
await resolvedStorage.remove(id);
|
|
4507
|
+
notifyChange();
|
|
4508
|
+
} catch (cause) {
|
|
4509
|
+
setError(cause);
|
|
4510
|
+
throw cause;
|
|
4511
|
+
}
|
|
4512
|
+
},
|
|
4513
|
+
[resolvedStorage]
|
|
4514
|
+
);
|
|
4515
|
+
const applyView = useCallback5(
|
|
4516
|
+
async (id) => {
|
|
4517
|
+
try {
|
|
4518
|
+
return (await resolvedStorage.get(id))?.query;
|
|
4519
|
+
} catch (cause) {
|
|
4520
|
+
setError(cause);
|
|
4521
|
+
throw cause;
|
|
4522
|
+
}
|
|
4523
|
+
},
|
|
4524
|
+
[resolvedStorage]
|
|
4525
|
+
);
|
|
4526
|
+
return { views, error, refresh, createView, updateView, removeView, applyView };
|
|
4527
|
+
}
|
|
4528
|
+
function sortViews(views) {
|
|
4529
|
+
return [...views].sort(
|
|
4530
|
+
(a, b) => Number(b.pinned === true) - Number(a.pinned === true) || a.name.localeCompare(b.name)
|
|
4531
|
+
);
|
|
4532
|
+
}
|
|
4533
|
+
function createId() {
|
|
4534
|
+
return typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now()}-${Math.random()}`;
|
|
4535
|
+
}
|
|
4536
|
+
function normalizeQuery(query) {
|
|
4537
|
+
const range = query.savedBetween;
|
|
4538
|
+
const savedBetween = range ? [toTimestamp(range[0]), toTimestamp(range[1])] : void 0;
|
|
4539
|
+
return {
|
|
4540
|
+
...query,
|
|
4541
|
+
...savedBetween ? { savedBetween } : {}
|
|
4542
|
+
};
|
|
4543
|
+
}
|
|
4544
|
+
function toTimestamp(value) {
|
|
4545
|
+
const timestamp = value instanceof Date ? value.getTime() : value;
|
|
4546
|
+
if (!Number.isFinite(timestamp)) throw new Error("Saved View date filters must use valid timestamps.");
|
|
4547
|
+
return timestamp;
|
|
4548
|
+
}
|
|
4549
|
+
function notifyChange() {
|
|
4550
|
+
if (typeof window !== "undefined") window.dispatchEvent(new Event(changeEvent));
|
|
4551
|
+
}
|
|
4552
|
+
|
|
4553
|
+
// src/features/saved-views/KeepSavedViews.tsx
|
|
4554
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4555
|
+
function KeepSavedViews({ storage, onApply }) {
|
|
4556
|
+
const { views, error, updateView, removeView, applyView } = useKeepSavedViews(storage);
|
|
4557
|
+
return /* @__PURE__ */ jsxs13("nav", { "aria-label": "Saved Views", "data-keepkit": "saved-views", children: [
|
|
4558
|
+
/* @__PURE__ */ jsx15("ul", { children: views.map((view) => /* @__PURE__ */ jsxs13("li", { children: [
|
|
4559
|
+
/* @__PURE__ */ jsx15(
|
|
4560
|
+
"button",
|
|
4561
|
+
{
|
|
4562
|
+
type: "button",
|
|
4563
|
+
onClick: () => void applyView(view.id).then((query) => query && onApply?.(query)).catch(() => void 0),
|
|
4564
|
+
children: view.name
|
|
4565
|
+
}
|
|
4566
|
+
),
|
|
4567
|
+
/* @__PURE__ */ jsx15(
|
|
4568
|
+
"button",
|
|
4569
|
+
{
|
|
4570
|
+
type: "button",
|
|
4571
|
+
"aria-label": `${view.pinned ? "Unpin" : "Pin"} ${view.name}`,
|
|
4572
|
+
onClick: () => void updateView(view.id, { pinned: !view.pinned }).catch(() => void 0),
|
|
4573
|
+
children: view.pinned ? "Unpin" : "Pin"
|
|
4574
|
+
}
|
|
4575
|
+
),
|
|
4576
|
+
/* @__PURE__ */ jsxs13("details", { children: [
|
|
4577
|
+
/* @__PURE__ */ jsxs13("summary", { children: [
|
|
4578
|
+
"Rename ",
|
|
4579
|
+
view.name
|
|
4580
|
+
] }),
|
|
4581
|
+
/* @__PURE__ */ jsx15(RenameForm, { name: view.name, onRename: (name) => updateView(view.id, { name }) })
|
|
4582
|
+
] }),
|
|
4583
|
+
/* @__PURE__ */ jsx15(
|
|
4584
|
+
"button",
|
|
4585
|
+
{
|
|
4586
|
+
type: "button",
|
|
4587
|
+
"aria-label": `Delete ${view.name}`,
|
|
4588
|
+
onClick: () => void removeView(view.id).catch(() => void 0),
|
|
4589
|
+
children: "Delete"
|
|
4590
|
+
}
|
|
4591
|
+
)
|
|
4592
|
+
] }, view.id)) }),
|
|
4593
|
+
error ? /* @__PURE__ */ jsx15("p", { role: "alert", children: error instanceof Error ? error.message : "Saved Views could not be loaded." }) : null
|
|
4594
|
+
] });
|
|
4595
|
+
}
|
|
4596
|
+
function KeepSaveViewButton({
|
|
4597
|
+
query,
|
|
4598
|
+
storage
|
|
4599
|
+
}) {
|
|
4600
|
+
const { createView } = useKeepSavedViews(storage);
|
|
4601
|
+
const [name, setName] = useState11("");
|
|
4602
|
+
const [error, setError] = useState11("");
|
|
4603
|
+
return /* @__PURE__ */ jsxs13(
|
|
4604
|
+
"form",
|
|
4605
|
+
{
|
|
4606
|
+
"data-keepkit": "save-view",
|
|
4607
|
+
onSubmit: (event) => {
|
|
4608
|
+
event.preventDefault();
|
|
4609
|
+
void createView(name, query).then(() => {
|
|
4610
|
+
setName("");
|
|
4611
|
+
setError("");
|
|
4612
|
+
}).catch((cause) => setError(cause instanceof Error ? cause.message : "Could not save this view."));
|
|
4613
|
+
},
|
|
4614
|
+
children: [
|
|
4615
|
+
/* @__PURE__ */ jsxs13("label", { children: [
|
|
4616
|
+
"View name",
|
|
4617
|
+
/* @__PURE__ */ jsx15("input", { value: name, onChange: (event) => setName(event.currentTarget.value), required: true })
|
|
4618
|
+
] }),
|
|
4619
|
+
/* @__PURE__ */ jsx15("button", { type: "submit", disabled: !name.trim(), children: "Save View" }),
|
|
4620
|
+
error ? /* @__PURE__ */ jsx15("p", { role: "alert", children: error }) : null
|
|
4621
|
+
]
|
|
4622
|
+
}
|
|
4623
|
+
);
|
|
4624
|
+
}
|
|
4625
|
+
function RenameForm({ name, onRename }) {
|
|
4626
|
+
const [value, setValue] = useState11(name);
|
|
4627
|
+
return /* @__PURE__ */ jsxs13(
|
|
4628
|
+
"form",
|
|
4629
|
+
{
|
|
4630
|
+
onSubmit: (event) => {
|
|
4631
|
+
event.preventDefault();
|
|
4632
|
+
void onRename(value).catch(() => void 0);
|
|
4633
|
+
},
|
|
4634
|
+
children: [
|
|
4635
|
+
/* @__PURE__ */ jsxs13("label", { children: [
|
|
4636
|
+
"New name",
|
|
4637
|
+
/* @__PURE__ */ jsx15("input", { value, onChange: (event) => setValue(event.currentTarget.value), required: true })
|
|
4638
|
+
] }),
|
|
4639
|
+
/* @__PURE__ */ jsx15("button", { type: "submit", children: "Rename" })
|
|
4640
|
+
]
|
|
4641
|
+
}
|
|
4642
|
+
);
|
|
4643
|
+
}
|
|
4644
|
+
|
|
4218
4645
|
// src/features/collection/hooks/useKeepCollection.ts
|
|
4219
4646
|
import { useKeepList as useKeepList3 } from "@keepkit/core/react";
|
|
4220
|
-
import { useCallback as
|
|
4647
|
+
import { useCallback as useCallback6, useEffect as useEffect8, useMemo as useMemo5, useState as useState12 } from "react";
|
|
4221
4648
|
function useKeepCollection({
|
|
4222
4649
|
query,
|
|
4223
4650
|
pageSize,
|
|
@@ -4237,25 +4664,31 @@ function useKeepCollection({
|
|
|
4237
4664
|
pin: false,
|
|
4238
4665
|
archive: false,
|
|
4239
4666
|
note: false,
|
|
4667
|
+
savedViews: false,
|
|
4240
4668
|
...features
|
|
4241
4669
|
};
|
|
4242
|
-
const [searchValue, setSearchValue] =
|
|
4243
|
-
const [
|
|
4244
|
-
const [
|
|
4245
|
-
const [
|
|
4246
|
-
const [
|
|
4247
|
-
const [
|
|
4248
|
-
const [
|
|
4249
|
-
|
|
4250
|
-
);
|
|
4251
|
-
|
|
4670
|
+
const [searchValue, setSearchValue] = useState12(query.search?.query ?? "");
|
|
4671
|
+
const [queryOverride, setQueryOverride] = useState12({});
|
|
4672
|
+
const [sort, setSort] = useState12(query.sort ?? { by: "updatedAt", direction: "desc" });
|
|
4673
|
+
const [activeTags, setActiveTags] = useState12(query.tags ?? []);
|
|
4674
|
+
const [activeCollection, setActiveCollection] = useState12(query.collectionId);
|
|
4675
|
+
const [activeActivity, setActiveActivity] = useState12(query.activity);
|
|
4676
|
+
const [activeOrganization, setActiveOrganization] = useState12(query.organization);
|
|
4677
|
+
const [activeSavedBetween, setActiveSavedBetween] = useState12(query.savedBetween);
|
|
4678
|
+
const [page, setPage] = useState12(query.pagination?.page ?? 1);
|
|
4679
|
+
const initialArchiveScope = archiveScope ?? query.archiveScope ?? scopeFromArchived(query.archived);
|
|
4680
|
+
const [activeArchiveScope, setActiveArchiveScope] = useState12(initialArchiveScope);
|
|
4681
|
+
useEffect8(() => {
|
|
4252
4682
|
if (archiveScope !== void 0) setActiveArchiveScope(archiveScope);
|
|
4253
4683
|
}, [archiveScope]);
|
|
4254
|
-
const resolvedPageSize = query.pagination?.pageSize ?? pageSize;
|
|
4255
|
-
const resolvedQuery =
|
|
4684
|
+
const resolvedPageSize = queryOverride.pagination?.pageSize ?? query.pagination?.pageSize ?? pageSize;
|
|
4685
|
+
const resolvedQuery = useMemo5(
|
|
4256
4686
|
() => ({
|
|
4257
4687
|
...query,
|
|
4688
|
+
...queryOverride,
|
|
4258
4689
|
activity: activeActivity,
|
|
4690
|
+
organization: activeOrganization,
|
|
4691
|
+
savedBetween: activeSavedBetween,
|
|
4259
4692
|
archiveScope: activeArchiveScope,
|
|
4260
4693
|
archived: activeArchiveScope === "active" ? false : activeArchiveScope === "archived" ? true : void 0,
|
|
4261
4694
|
search: enabled.search ? { ...query.search, query: searchValue } : query.search,
|
|
@@ -4268,12 +4701,15 @@ function useKeepCollection({
|
|
|
4268
4701
|
[
|
|
4269
4702
|
activeCollection,
|
|
4270
4703
|
activeActivity,
|
|
4704
|
+
activeOrganization,
|
|
4705
|
+
activeSavedBetween,
|
|
4271
4706
|
activeTags,
|
|
4272
4707
|
enabled.pagination,
|
|
4273
4708
|
enabled.search,
|
|
4274
4709
|
enabled.sort,
|
|
4275
4710
|
page,
|
|
4276
4711
|
query,
|
|
4712
|
+
queryOverride,
|
|
4277
4713
|
resolvedPageSize,
|
|
4278
4714
|
searchValue,
|
|
4279
4715
|
sort,
|
|
@@ -4285,11 +4721,14 @@ function useKeepCollection({
|
|
|
4285
4721
|
query: resolvedQuery,
|
|
4286
4722
|
onQueryChange: (nextOrUpdater) => {
|
|
4287
4723
|
const next = typeof nextOrUpdater === "function" ? nextOrUpdater(resolvedQuery) : nextOrUpdater;
|
|
4724
|
+
setQueryOverride(next);
|
|
4288
4725
|
setSearchValue(next.search?.query ?? "");
|
|
4289
4726
|
setSort(next.sort ?? { by: "updatedAt", direction: "desc" });
|
|
4290
4727
|
setActiveTags(next.tags ?? []);
|
|
4291
4728
|
setActiveCollection(next.collectionId);
|
|
4292
4729
|
setActiveActivity(next.activity);
|
|
4730
|
+
setActiveOrganization(next.organization);
|
|
4731
|
+
setActiveSavedBetween(next.savedBetween);
|
|
4293
4732
|
setActiveArchiveScope(next.archiveScope ?? scopeFromArchived(next.archived));
|
|
4294
4733
|
setPage(next.pagination?.page ?? 1);
|
|
4295
4734
|
},
|
|
@@ -4298,7 +4737,7 @@ function useKeepCollection({
|
|
|
4298
4737
|
});
|
|
4299
4738
|
const list = useKeepList3(resolvedQuery);
|
|
4300
4739
|
const allState = useKeepList3({ archiveScope: "all" });
|
|
4301
|
-
const reveal =
|
|
4740
|
+
const reveal = useCallback6(
|
|
4302
4741
|
(itemId) => {
|
|
4303
4742
|
const target = allState.items.find((item) => item.id === itemId);
|
|
4304
4743
|
if (!target) return "not-found";
|
|
@@ -4350,6 +4789,26 @@ function useKeepCollection({
|
|
|
4350
4789
|
setActiveActivity(value);
|
|
4351
4790
|
setPage(1);
|
|
4352
4791
|
},
|
|
4792
|
+
setOrganization: (value) => {
|
|
4793
|
+
setActiveOrganization(value);
|
|
4794
|
+
setPage(1);
|
|
4795
|
+
},
|
|
4796
|
+
setSavedBetween: (value) => {
|
|
4797
|
+
setActiveSavedBetween(value);
|
|
4798
|
+
setPage(1);
|
|
4799
|
+
},
|
|
4800
|
+
applyQuery: (next) => {
|
|
4801
|
+
setQueryOverride(next);
|
|
4802
|
+
setSearchValue(next.search?.query ?? "");
|
|
4803
|
+
setSort(next.sort ?? { by: "updatedAt", direction: "desc" });
|
|
4804
|
+
setActiveTags(next.tags ?? []);
|
|
4805
|
+
setActiveCollection(next.collectionId);
|
|
4806
|
+
setActiveActivity(next.activity);
|
|
4807
|
+
setActiveOrganization(next.organization);
|
|
4808
|
+
setActiveSavedBetween(next.savedBetween);
|
|
4809
|
+
setActiveArchiveScope(next.archiveScope ?? scopeFromArchived(next.archived));
|
|
4810
|
+
setPage(next.pagination?.page ?? 1);
|
|
4811
|
+
},
|
|
4353
4812
|
setArchiveScope: (value) => {
|
|
4354
4813
|
setActiveArchiveScope(value);
|
|
4355
4814
|
setPage(1);
|
|
@@ -4359,17 +4818,38 @@ function useKeepCollection({
|
|
|
4359
4818
|
setPage(1);
|
|
4360
4819
|
},
|
|
4361
4820
|
clearFilters: () => {
|
|
4821
|
+
setQueryOverride({});
|
|
4822
|
+
setSearchValue("");
|
|
4823
|
+
setActiveTags([]);
|
|
4824
|
+
setActiveCollection(void 0);
|
|
4825
|
+
setActiveActivity(void 0);
|
|
4826
|
+
setActiveOrganization(query.organization);
|
|
4827
|
+
setActiveSavedBetween(void 0);
|
|
4828
|
+
setActiveArchiveScope("active");
|
|
4829
|
+
setPage(1);
|
|
4830
|
+
},
|
|
4831
|
+
resetFilters: () => {
|
|
4832
|
+
setQueryOverride({});
|
|
4362
4833
|
setSearchValue(query.search?.query ?? "");
|
|
4834
|
+
setSort(query.sort ?? { by: "updatedAt", direction: "desc" });
|
|
4363
4835
|
setActiveTags(query.tags ?? []);
|
|
4364
4836
|
setActiveCollection(query.collectionId);
|
|
4365
4837
|
setActiveActivity(query.activity);
|
|
4366
|
-
|
|
4838
|
+
setActiveOrganization(query.organization);
|
|
4839
|
+
setActiveSavedBetween(query.savedBetween);
|
|
4840
|
+
setActiveArchiveScope(initialArchiveScope);
|
|
4367
4841
|
setPage(query.pagination?.page ?? 1);
|
|
4368
4842
|
},
|
|
4843
|
+
canReset: hasInitialFilterState(query, initialArchiveScope),
|
|
4369
4844
|
setPage,
|
|
4370
4845
|
reveal
|
|
4371
4846
|
};
|
|
4372
4847
|
}
|
|
4848
|
+
function hasInitialFilterState(query, archiveScope) {
|
|
4849
|
+
return Boolean(
|
|
4850
|
+
query.search?.query?.trim() || query.tags?.length || query.collectionId || query.activity || query.organization || query.pinnedFirst || query.savedBetween || archiveScope !== "active" || query.pagination?.page !== void 0 && query.pagination.page !== 1 || query.sort && (query.sort.by !== "updatedAt" || query.sort.direction !== "desc")
|
|
4851
|
+
);
|
|
4852
|
+
}
|
|
4373
4853
|
function compareItems(a, b, sort, pinnedFirst) {
|
|
4374
4854
|
if (pinnedFirst && a.pinned !== b.pinned) return a.pinned === true ? -1 : 1;
|
|
4375
4855
|
const aValue = sort.by === "savedAt" ? a.savedAt : sort.by === "updatedAt" ? a.updatedAt : a.lastOpenedAt;
|
|
@@ -4385,9 +4865,9 @@ function scopeFromArchived(archived) {
|
|
|
4385
4865
|
}
|
|
4386
4866
|
|
|
4387
4867
|
// src/features/collection/KeepCollectionCreate.tsx
|
|
4388
|
-
import { useKeepCollections as
|
|
4389
|
-
import { useId as useId2, useState as
|
|
4390
|
-
import { jsx as
|
|
4868
|
+
import { useKeepCollections as useKeepCollections4, useKeepContext as useKeepContext4 } from "@keepkit/core/react";
|
|
4869
|
+
import { useId as useId2, useState as useState13 } from "react";
|
|
4870
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4391
4871
|
function KeepCollectionCreate({
|
|
4392
4872
|
onCreated,
|
|
4393
4873
|
onError,
|
|
@@ -4398,10 +4878,10 @@ function KeepCollectionCreate({
|
|
|
4398
4878
|
...inputProps
|
|
4399
4879
|
}) {
|
|
4400
4880
|
const { createCollection } = useKeepContext4();
|
|
4401
|
-
const collections =
|
|
4402
|
-
const [name, setName] =
|
|
4403
|
-
const [error, setError] =
|
|
4404
|
-
const [isSubmitting, setIsSubmitting] =
|
|
4881
|
+
const collections = useKeepCollections4();
|
|
4882
|
+
const [name, setName] = useState13("");
|
|
4883
|
+
const [error, setError] = useState13(null);
|
|
4884
|
+
const [isSubmitting, setIsSubmitting] = useState13(false);
|
|
4405
4885
|
const autoId = useId2();
|
|
4406
4886
|
const inputId = externalId ?? autoId;
|
|
4407
4887
|
const resolvedLabel = useUiLabel("createCollection");
|
|
@@ -4436,16 +4916,16 @@ function KeepCollectionCreate({
|
|
|
4436
4916
|
setIsSubmitting(false);
|
|
4437
4917
|
}
|
|
4438
4918
|
};
|
|
4439
|
-
return /* @__PURE__ */
|
|
4919
|
+
return /* @__PURE__ */ jsxs14(
|
|
4440
4920
|
"form",
|
|
4441
4921
|
{
|
|
4442
4922
|
"data-keepkit": "collection-create",
|
|
4443
4923
|
"data-state": error ? "error" : isSubmitting ? "submitting" : "idle",
|
|
4444
4924
|
onSubmit: handleSubmit,
|
|
4445
4925
|
children: [
|
|
4446
|
-
showLabel ? /* @__PURE__ */
|
|
4447
|
-
/* @__PURE__ */
|
|
4448
|
-
/* @__PURE__ */
|
|
4926
|
+
showLabel ? /* @__PURE__ */ jsx16("label", { htmlFor: inputId, children: label ?? resolvedLabel }) : null,
|
|
4927
|
+
/* @__PURE__ */ jsxs14("div", { "data-keepkit": "collection-create-row", children: [
|
|
4928
|
+
/* @__PURE__ */ jsx16(
|
|
4449
4929
|
"input",
|
|
4450
4930
|
{
|
|
4451
4931
|
...inputProps,
|
|
@@ -4463,7 +4943,7 @@ function KeepCollectionCreate({
|
|
|
4463
4943
|
"data-keep-action": "collection-name-input"
|
|
4464
4944
|
}
|
|
4465
4945
|
),
|
|
4466
|
-
/* @__PURE__ */
|
|
4946
|
+
/* @__PURE__ */ jsx16(
|
|
4467
4947
|
"button",
|
|
4468
4948
|
{
|
|
4469
4949
|
type: "submit",
|
|
@@ -4474,7 +4954,7 @@ function KeepCollectionCreate({
|
|
|
4474
4954
|
}
|
|
4475
4955
|
)
|
|
4476
4956
|
] }),
|
|
4477
|
-
error ? /* @__PURE__ */
|
|
4957
|
+
error ? /* @__PURE__ */ jsx16("p", { role: "alert", children: error }) : null
|
|
4478
4958
|
]
|
|
4479
4959
|
}
|
|
4480
4960
|
);
|
|
@@ -4490,10 +4970,10 @@ import {
|
|
|
4490
4970
|
createElement as createElement2,
|
|
4491
4971
|
isValidElement as isValidElement4,
|
|
4492
4972
|
useContext as useContext3,
|
|
4493
|
-
useEffect as
|
|
4973
|
+
useEffect as useEffect9,
|
|
4494
4974
|
useId as useId3,
|
|
4495
4975
|
useRef as useRef7,
|
|
4496
|
-
useState as
|
|
4976
|
+
useState as useState15
|
|
4497
4977
|
} from "react";
|
|
4498
4978
|
|
|
4499
4979
|
// src/features/item/hooks/useKeepItemStatusBadge.ts
|
|
@@ -4536,10 +5016,10 @@ function getDisplayStatus(status) {
|
|
|
4536
5016
|
}
|
|
4537
5017
|
|
|
4538
5018
|
// src/features/item/KeepItemStatusBadge.tsx
|
|
4539
|
-
import { Fragment as Fragment8, jsx as
|
|
5019
|
+
import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4540
5020
|
function KeepItemStatusBadge({ status = "available", label, className, ...props }) {
|
|
4541
5021
|
const view = useKeepItemStatusBadge(status);
|
|
4542
|
-
return /* @__PURE__ */
|
|
5022
|
+
return /* @__PURE__ */ jsxs15(
|
|
4543
5023
|
"span",
|
|
4544
5024
|
{
|
|
4545
5025
|
...props,
|
|
@@ -4550,14 +5030,14 @@ function KeepItemStatusBadge({ status = "available", label, className, ...props
|
|
|
4550
5030
|
"data-status": status,
|
|
4551
5031
|
"data-item-status": view.resolvedStatus,
|
|
4552
5032
|
children: [
|
|
4553
|
-
/* @__PURE__ */
|
|
4554
|
-
/* @__PURE__ */
|
|
5033
|
+
/* @__PURE__ */ jsx17(StatusIcon, { name: view.icon }),
|
|
5034
|
+
/* @__PURE__ */ jsx17("span", { "data-status-label": "true", children: label ?? view.statusLabel })
|
|
4555
5035
|
]
|
|
4556
5036
|
}
|
|
4557
5037
|
);
|
|
4558
5038
|
}
|
|
4559
5039
|
function StatusIcon({ name }) {
|
|
4560
|
-
return /* @__PURE__ */
|
|
5040
|
+
return /* @__PURE__ */ jsxs15(
|
|
4561
5041
|
"svg",
|
|
4562
5042
|
{
|
|
4563
5043
|
"data-status-icon": name,
|
|
@@ -4572,18 +5052,18 @@ function StatusIcon({ name }) {
|
|
|
4572
5052
|
"aria-hidden": "true",
|
|
4573
5053
|
focusable: "false",
|
|
4574
5054
|
children: [
|
|
4575
|
-
name === "check" ? /* @__PURE__ */
|
|
4576
|
-
name === "clock" ? /* @__PURE__ */
|
|
4577
|
-
/* @__PURE__ */
|
|
4578
|
-
/* @__PURE__ */
|
|
5055
|
+
name === "check" ? /* @__PURE__ */ jsx17("path", { d: "m5 12 4 4L19 6" }) : null,
|
|
5056
|
+
name === "clock" ? /* @__PURE__ */ jsxs15(Fragment8, { children: [
|
|
5057
|
+
/* @__PURE__ */ jsx17("circle", { cx: "12", cy: "12", r: "8" }),
|
|
5058
|
+
/* @__PURE__ */ jsx17("path", { d: "M12 7v5l3 2" })
|
|
4579
5059
|
] }) : null,
|
|
4580
|
-
name === "ban" ? /* @__PURE__ */
|
|
4581
|
-
/* @__PURE__ */
|
|
4582
|
-
/* @__PURE__ */
|
|
5060
|
+
name === "ban" ? /* @__PURE__ */ jsxs15(Fragment8, { children: [
|
|
5061
|
+
/* @__PURE__ */ jsx17("circle", { cx: "12", cy: "12", r: "8" }),
|
|
5062
|
+
/* @__PURE__ */ jsx17("path", { d: "m6.5 6.5 11 11" })
|
|
4583
5063
|
] }) : null,
|
|
4584
|
-
name === "lock" ? /* @__PURE__ */
|
|
4585
|
-
/* @__PURE__ */
|
|
4586
|
-
/* @__PURE__ */
|
|
5064
|
+
name === "lock" ? /* @__PURE__ */ jsxs15(Fragment8, { children: [
|
|
5065
|
+
/* @__PURE__ */ jsx17("rect", { x: "5", y: "10", width: "14", height: "10", rx: "2" }),
|
|
5066
|
+
/* @__PURE__ */ jsx17("path", { d: "M8 10V7a4 4 0 0 1 8 0v3" })
|
|
4587
5067
|
] }) : null
|
|
4588
5068
|
]
|
|
4589
5069
|
}
|
|
@@ -4592,15 +5072,15 @@ function StatusIcon({ name }) {
|
|
|
4592
5072
|
|
|
4593
5073
|
// src/features/status/hooks/useKeepStaleNotice.ts
|
|
4594
5074
|
import { useKeepContext as useKeepContext5 } from "@keepkit/core/react";
|
|
4595
|
-
import { useState as
|
|
5075
|
+
import { useState as useState14 } from "react";
|
|
4596
5076
|
function useKeepStaleNotice({ item, onRetry, onRemoved }) {
|
|
4597
5077
|
const context = useKeepContext5();
|
|
4598
5078
|
const emitFeedback = useKeepUiFeedback();
|
|
4599
5079
|
const removedMessage = useUiLabel("removedMessage");
|
|
4600
5080
|
const restoredMessage = useUiLabel("restoredMessage");
|
|
4601
5081
|
const undoLabel = useUiLabel("undo");
|
|
4602
|
-
const [isRetrying, setIsRetrying] =
|
|
4603
|
-
const [error, setError] =
|
|
5082
|
+
const [isRetrying, setIsRetrying] = useState14(false);
|
|
5083
|
+
const [error, setError] = useState14(null);
|
|
4604
5084
|
async function retry() {
|
|
4605
5085
|
setError(null);
|
|
4606
5086
|
setIsRetrying(true);
|
|
@@ -4680,7 +5160,7 @@ function useKeepPruneStale({ statuses, onPruned }) {
|
|
|
4680
5160
|
}
|
|
4681
5161
|
|
|
4682
5162
|
// src/features/status/KeepStaleNotice.tsx
|
|
4683
|
-
import { jsx as
|
|
5163
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4684
5164
|
function KeepStaleNotice({
|
|
4685
5165
|
item,
|
|
4686
5166
|
onRetry,
|
|
@@ -4694,11 +5174,11 @@ function KeepStaleNotice({
|
|
|
4694
5174
|
const view = useKeepStaleNotice({ item, onRetry, onRemoved });
|
|
4695
5175
|
const showRetryLabel = useUiLabelVisibility("retry");
|
|
4696
5176
|
const showRemoveLabel = useUiLabelVisibility("removeFromList");
|
|
4697
|
-
return /* @__PURE__ */
|
|
4698
|
-
/* @__PURE__ */
|
|
4699
|
-
children ?? (item.statusReason ? /* @__PURE__ */
|
|
4700
|
-
/* @__PURE__ */
|
|
4701
|
-
/* @__PURE__ */
|
|
5177
|
+
return /* @__PURE__ */ jsxs16("aside", { ...props, className, "data-keepkit": "stale-notice", "data-state": view.error ? "error" : "stale", children: [
|
|
5178
|
+
/* @__PURE__ */ jsx18(KeepItemStatusBadge, { status: view.status }),
|
|
5179
|
+
children ?? (item.statusReason ? /* @__PURE__ */ jsx18("p", { children: item.statusReason }) : null),
|
|
5180
|
+
/* @__PURE__ */ jsxs16("div", { children: [
|
|
5181
|
+
/* @__PURE__ */ jsx18(
|
|
4702
5182
|
"button",
|
|
4703
5183
|
{
|
|
4704
5184
|
type: "button",
|
|
@@ -4709,7 +5189,7 @@ function KeepStaleNotice({
|
|
|
4709
5189
|
children: showRetryLabel ? retryLabel ?? view.labels.retry : null
|
|
4710
5190
|
}
|
|
4711
5191
|
),
|
|
4712
|
-
/* @__PURE__ */
|
|
5192
|
+
/* @__PURE__ */ jsx18(
|
|
4713
5193
|
"button",
|
|
4714
5194
|
{
|
|
4715
5195
|
type: "button",
|
|
@@ -4721,7 +5201,7 @@ function KeepStaleNotice({
|
|
|
4721
5201
|
}
|
|
4722
5202
|
)
|
|
4723
5203
|
] }),
|
|
4724
|
-
view.error ? /* @__PURE__ */
|
|
5204
|
+
view.error ? /* @__PURE__ */ jsx18("p", { role: "alert", children: getErrorMessage(view.error, view.labels.error) }) : null
|
|
4725
5205
|
] });
|
|
4726
5206
|
}
|
|
4727
5207
|
function KeepPruneStaleButton({
|
|
@@ -4734,7 +5214,7 @@ function KeepPruneStaleButton({
|
|
|
4734
5214
|
}) {
|
|
4735
5215
|
const view = useKeepPruneStale({ statuses, onPruned });
|
|
4736
5216
|
const showLabel = useUiLabelVisibility("pruneStale");
|
|
4737
|
-
return /* @__PURE__ */
|
|
5217
|
+
return /* @__PURE__ */ jsx18(
|
|
4738
5218
|
"button",
|
|
4739
5219
|
{
|
|
4740
5220
|
...props,
|
|
@@ -4848,7 +5328,7 @@ function getDisplayStatus2(status) {
|
|
|
4848
5328
|
}
|
|
4849
5329
|
|
|
4850
5330
|
// src/features/item/KeepItemCard.tsx
|
|
4851
|
-
import { Fragment as Fragment9, jsx as
|
|
5331
|
+
import { Fragment as Fragment9, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4852
5332
|
var KeepItemCardContext = createContext3(null);
|
|
4853
5333
|
function useKeepItemCardCompound(part) {
|
|
4854
5334
|
const context = useContext3(KeepItemCardContext);
|
|
@@ -4866,6 +5346,8 @@ function KeepItemCardRoot({
|
|
|
4866
5346
|
showTags = true,
|
|
4867
5347
|
showNote = false,
|
|
4868
5348
|
showSavedAt = true,
|
|
5349
|
+
showActivity = false,
|
|
5350
|
+
activityKind = "inactive",
|
|
4869
5351
|
collectionLabels,
|
|
4870
5352
|
imageAlt,
|
|
4871
5353
|
render,
|
|
@@ -4909,14 +5391,14 @@ function KeepItemCardRoot({
|
|
|
4909
5391
|
const contextQuery = useKeepSearchQuery();
|
|
4910
5392
|
const searchQuery = highlightQuery ?? contextQuery;
|
|
4911
5393
|
const contentChildren = asChild && isValidElement4(children) ? void 0 : children;
|
|
4912
|
-
const [isEditOpen, setEditOpen] =
|
|
5394
|
+
const [isEditOpen, setEditOpen] = useState15(false);
|
|
4913
5395
|
const editTriggerRef = useRef7(null);
|
|
4914
5396
|
const editPanelId = useId3();
|
|
4915
5397
|
const editLabel = useUiLabel("editSavedItem");
|
|
4916
5398
|
const showEditLabel = useUiLabelVisibility("editSavedItem");
|
|
4917
5399
|
const showSavedAtLabel = useUiLabelVisibility("saved");
|
|
4918
5400
|
const closeEdit = () => setEditOpen(false);
|
|
4919
|
-
|
|
5401
|
+
useEffect9(() => {
|
|
4920
5402
|
if (!isEditOpen) editTriggerRef.current?.focus();
|
|
4921
5403
|
}, [isEditOpen]);
|
|
4922
5404
|
function renderLink(content) {
|
|
@@ -4931,17 +5413,17 @@ function KeepItemCardRoot({
|
|
|
4931
5413
|
},
|
|
4932
5414
|
children: content
|
|
4933
5415
|
};
|
|
4934
|
-
return LinkComponent ? /* @__PURE__ */
|
|
5416
|
+
return LinkComponent ? /* @__PURE__ */ jsx19(LinkComponent, { ...linkProps }) : /* @__PURE__ */ jsx19("a", { ...linkProps });
|
|
4935
5417
|
}
|
|
4936
5418
|
function renderTitle(content) {
|
|
4937
5419
|
if (linkTarget !== "title") return content;
|
|
4938
5420
|
if (view.isAvailable) return renderLink(content);
|
|
4939
|
-
return view.href ? /* @__PURE__ */
|
|
5421
|
+
return view.href ? /* @__PURE__ */ jsx19("span", { "aria-disabled": "true", "data-link-disabled": "true", children: content }) : content;
|
|
4940
5422
|
}
|
|
4941
5423
|
const resolvedImageProps = view.imageProps ? { ...view.imageProps, alt: imageAlt ?? view.imageProps.alt } : void 0;
|
|
4942
5424
|
const imageSource = resolvedImageProps?.src;
|
|
4943
|
-
const [imageStatus, setImageStatus] =
|
|
4944
|
-
|
|
5425
|
+
const [imageStatus, setImageStatus] = useState15(imageSource ? "loading" : "error");
|
|
5426
|
+
useEffect9(() => {
|
|
4945
5427
|
setImageStatus(imageSource ? "loading" : "error");
|
|
4946
5428
|
}, [imageSource]);
|
|
4947
5429
|
let image = null;
|
|
@@ -4959,21 +5441,21 @@ function KeepItemCardRoot({
|
|
|
4959
5441
|
setImageStatus("error");
|
|
4960
5442
|
}
|
|
4961
5443
|
};
|
|
4962
|
-
image = renderImage?.(imagePropsWithHandlers, item) ?? (ImageComponent ? /* @__PURE__ */
|
|
5444
|
+
image = renderImage?.(imagePropsWithHandlers, item) ?? (ImageComponent ? /* @__PURE__ */ jsx19(ImageComponent, { ...imagePropsWithHandlers }) : /* @__PURE__ */ jsx19("img", { ...imagePropsWithHandlers, alt: imagePropsWithHandlers.alt }));
|
|
4963
5445
|
}
|
|
4964
5446
|
const tags = showTags ? item.tags ?? [] : [];
|
|
4965
5447
|
const renderedTags = showTags && tags.length > 0 ? renderTags?.(tags, item) ?? null : null;
|
|
4966
|
-
const meta = showSavedAt ? /* @__PURE__ */
|
|
4967
|
-
showSavedAtLabel ? /* @__PURE__ */
|
|
5448
|
+
const meta = showSavedAt ? /* @__PURE__ */ jsxs17("div", { "data-card-meta": true, children: [
|
|
5449
|
+
showSavedAtLabel ? /* @__PURE__ */ jsxs17("span", { children: [
|
|
4968
5450
|
view.labels.savedAt,
|
|
4969
5451
|
":"
|
|
4970
5452
|
] }) : null,
|
|
4971
5453
|
showSavedAtLabel ? " " : null,
|
|
4972
|
-
/* @__PURE__ */
|
|
5454
|
+
/* @__PURE__ */ jsx19("time", { dateTime: new Date(item.savedAt).toISOString(), children: formatSavedAt(item.savedAt) })
|
|
4973
5455
|
] }) : null;
|
|
4974
|
-
const error = view.itemState.error ? /* @__PURE__ */
|
|
4975
|
-
const actions = view.statusLabel ? /* @__PURE__ */
|
|
4976
|
-
showEditButton ? isEditOpen ? /* @__PURE__ */
|
|
5456
|
+
const error = view.itemState.error ? /* @__PURE__ */ jsx19("p", { role: "alert", children: getErrorMessage(view.itemState.error, view.labels.error) }) : null;
|
|
5457
|
+
const actions = view.statusLabel ? /* @__PURE__ */ jsx19(KeepStaleNotice, { item, onRetry, onRemoved }) : /* @__PURE__ */ jsxs17(Fragment9, { children: [
|
|
5458
|
+
showEditButton ? isEditOpen ? /* @__PURE__ */ jsx19("div", { id: editPanelId, role: "dialog", "aria-label": editLabel, "data-keepkit": "item-edit-dialog", children: editSlot ? editSlot(item, closeEdit) : /* @__PURE__ */ jsx19(KeepQuickEditor, { item: view.itemState.item ?? item, onClose: closeEdit, features: editFeatures }) }) : /* @__PURE__ */ jsx19(
|
|
4977
5459
|
"button",
|
|
4978
5460
|
{
|
|
4979
5461
|
ref: editTriggerRef,
|
|
@@ -4990,15 +5472,15 @@ function KeepItemCardRoot({
|
|
|
4990
5472
|
children: showEditLabel ? editLabel : null
|
|
4991
5473
|
}
|
|
4992
5474
|
) : null,
|
|
4993
|
-
isEditOpen ? null : /* @__PURE__ */
|
|
4994
|
-
showSaveButton ? /* @__PURE__ */
|
|
4995
|
-
showPinButton ? /* @__PURE__ */
|
|
4996
|
-
showArchiveButton ? /* @__PURE__ */
|
|
4997
|
-
/* @__PURE__ */
|
|
5475
|
+
isEditOpen ? null : /* @__PURE__ */ jsxs17(Fragment9, { children: [
|
|
5476
|
+
showSaveButton ? /* @__PURE__ */ jsx19(KeepItemCardSave, {}) : null,
|
|
5477
|
+
showPinButton ? /* @__PURE__ */ jsx19(KeepItemCardPin, {}) : null,
|
|
5478
|
+
showArchiveButton ? /* @__PURE__ */ jsx19(KeepItemCardArchive, {}) : null,
|
|
5479
|
+
/* @__PURE__ */ jsx19(KeepItemCardRemove, {})
|
|
4998
5480
|
] }),
|
|
4999
|
-
isEditOpen && (showPinButton || showArchiveButton) ? /* @__PURE__ */
|
|
5000
|
-
showPinButton ? /* @__PURE__ */
|
|
5001
|
-
showArchiveButton ? /* @__PURE__ */
|
|
5481
|
+
isEditOpen && (showPinButton || showArchiveButton) ? /* @__PURE__ */ jsxs17("div", { "data-keep-card-part": "actions-secondary", children: [
|
|
5482
|
+
showPinButton ? /* @__PURE__ */ jsx19(KeepItemCardPin, {}) : null,
|
|
5483
|
+
showArchiveButton ? /* @__PURE__ */ jsx19(KeepItemCardArchive, {}) : null
|
|
5002
5484
|
] }) : null
|
|
5003
5485
|
] });
|
|
5004
5486
|
const compoundValue = {
|
|
@@ -5010,6 +5492,7 @@ function KeepItemCardRoot({
|
|
|
5010
5492
|
imageStatus,
|
|
5011
5493
|
fallbackLabel: String(view.resolvedTitle),
|
|
5012
5494
|
note: showNote ? item.note : void 0,
|
|
5495
|
+
activity: showActivity ? /* @__PURE__ */ jsx19(KeepLastActivity, { item, kind: activityKind }) : null,
|
|
5013
5496
|
tags,
|
|
5014
5497
|
tagsLabel: view.labels.tags,
|
|
5015
5498
|
renderedTags,
|
|
@@ -5021,12 +5504,12 @@ function KeepItemCardRoot({
|
|
|
5021
5504
|
remove: view.remove,
|
|
5022
5505
|
isMutating: view.itemState.isMutating,
|
|
5023
5506
|
saveAriaLabel: `${view.labels.remove} ${String(view.resolvedTitle)}`,
|
|
5024
|
-
renderText: (content) => /* @__PURE__ */
|
|
5507
|
+
renderText: (content) => /* @__PURE__ */ jsx19(KeepHighlight, { query: searchQuery, children: content })
|
|
5025
5508
|
};
|
|
5026
|
-
const defaultBody = /* @__PURE__ */
|
|
5027
|
-
/* @__PURE__ */
|
|
5028
|
-
/* @__PURE__ */
|
|
5029
|
-
/* @__PURE__ */
|
|
5509
|
+
const defaultBody = /* @__PURE__ */ jsxs17(Fragment9, { children: [
|
|
5510
|
+
/* @__PURE__ */ jsx19(KeepItemCardMedia, {}),
|
|
5511
|
+
/* @__PURE__ */ jsx19(KeepItemCardContent, {}),
|
|
5512
|
+
/* @__PURE__ */ jsx19(KeepItemCardActions, {})
|
|
5030
5513
|
] });
|
|
5031
5514
|
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? defaultBody;
|
|
5032
5515
|
const linkedBody = linkTarget === "card" && view.isAvailable ? renderLink(body) : body;
|
|
@@ -5048,19 +5531,20 @@ function KeepItemCardRoot({
|
|
|
5048
5531
|
linkedBody,
|
|
5049
5532
|
"KeepItemCard"
|
|
5050
5533
|
);
|
|
5051
|
-
return /* @__PURE__ */
|
|
5534
|
+
return /* @__PURE__ */ jsx19(KeepItemCardContext.Provider, { value: compoundValue, children: root });
|
|
5052
5535
|
}
|
|
5053
5536
|
function KeepItemCardMedia({ children, fallback, ...props }) {
|
|
5054
5537
|
const context = useKeepItemCardCompound("Media");
|
|
5055
|
-
return /* @__PURE__ */
|
|
5538
|
+
return /* @__PURE__ */ jsx19("div", { ...props, "data-keep-card-part": "media", "data-media-status": context.imageStatus, "data-aspect-ratio": "1/1", children: children ?? context.image ?? /* @__PURE__ */ jsx19("span", { role: "img", "aria-label": context.fallbackLabel, "data-keep-card-fallback": "true", children: fallback ?? /* @__PURE__ */ jsx19(KeepMediaPlaceholderIcon, {}) }) });
|
|
5056
5539
|
}
|
|
5057
5540
|
function KeepItemCardContent({ children, ...props }) {
|
|
5058
5541
|
const context = useKeepItemCardCompound("Content");
|
|
5059
|
-
return /* @__PURE__ */
|
|
5060
|
-
/* @__PURE__ */
|
|
5542
|
+
return /* @__PURE__ */ jsx19("div", { ...props, "data-keep-card-part": "content", children: children === void 0 ? /* @__PURE__ */ jsxs17(Fragment9, { children: [
|
|
5543
|
+
/* @__PURE__ */ jsx19(KeepItemCardTitle, {}),
|
|
5061
5544
|
context.meta,
|
|
5062
|
-
context.
|
|
5063
|
-
/* @__PURE__ */
|
|
5545
|
+
context.activity,
|
|
5546
|
+
context.note ? /* @__PURE__ */ jsx19("p", { "data-keep-card-part": "memo-preview", "data-line-clamp": "2", children: context.note }) : null,
|
|
5547
|
+
/* @__PURE__ */ jsx19(KeepItemCardTags, {}),
|
|
5064
5548
|
context.error
|
|
5065
5549
|
] }) : context.renderText(children) });
|
|
5066
5550
|
}
|
|
@@ -5073,8 +5557,8 @@ function KeepItemCardTitle({ as = "h3", children, ...props }) {
|
|
|
5073
5557
|
);
|
|
5074
5558
|
}
|
|
5075
5559
|
function KeepMediaPlaceholderIcon() {
|
|
5076
|
-
return /* @__PURE__ */
|
|
5077
|
-
/* @__PURE__ */
|
|
5560
|
+
return /* @__PURE__ */ jsxs17("svg", { "data-media-fallback-icon": "true", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
|
|
5561
|
+
/* @__PURE__ */ jsx19(
|
|
5078
5562
|
"path",
|
|
5079
5563
|
{
|
|
5080
5564
|
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",
|
|
@@ -5082,23 +5566,39 @@ function KeepMediaPlaceholderIcon() {
|
|
|
5082
5566
|
stroke: "currentColor"
|
|
5083
5567
|
}
|
|
5084
5568
|
),
|
|
5085
|
-
/* @__PURE__ */
|
|
5086
|
-
/* @__PURE__ */
|
|
5569
|
+
/* @__PURE__ */ jsx19("circle", { cx: "9", cy: "9", r: "1.5", fill: "currentColor" }),
|
|
5570
|
+
/* @__PURE__ */ jsx19("path", { d: "m5.5 18 4.5-4.5 3 3 2-2L19 18", fill: "none", stroke: "currentColor" })
|
|
5087
5571
|
] });
|
|
5088
5572
|
}
|
|
5089
5573
|
function KeepItemCardTags({ children, ...props }) {
|
|
5090
5574
|
const context = useKeepItemCardCompound("Tags");
|
|
5091
5575
|
if (children === void 0 && context.renderedTags) return context.renderedTags;
|
|
5092
5576
|
if (children === void 0 && context.tags.length === 0) return null;
|
|
5093
|
-
return /* @__PURE__ */
|
|
5577
|
+
return /* @__PURE__ */ jsx19("ul", { ...props, "aria-label": props["aria-label"] ?? context.tagsLabel, "data-keep-card-part": "tags", children: children ?? context.tags.map((tag) => /* @__PURE__ */ jsx19("li", { children: tag }, tag)) });
|
|
5094
5578
|
}
|
|
5095
5579
|
function KeepItemCardActions({ children, ...props }) {
|
|
5096
5580
|
const context = useKeepItemCardCompound("Actions");
|
|
5097
|
-
return /* @__PURE__ */
|
|
5581
|
+
return /* @__PURE__ */ jsx19("div", { ...props, "data-keep-card-part": "actions", children: children ?? context.actions });
|
|
5582
|
+
}
|
|
5583
|
+
function KeepLastActivity({
|
|
5584
|
+
item,
|
|
5585
|
+
kind = "inactive",
|
|
5586
|
+
...props
|
|
5587
|
+
}) {
|
|
5588
|
+
const { locale } = useKeepUiLabels();
|
|
5589
|
+
const openedLabel = useUiLabel("activityOpened");
|
|
5590
|
+
const neverOpenedLabel = useUiLabel("activityNeverOpened");
|
|
5591
|
+
const inactiveSuffix = useUiLabel("activityInactiveSuffix");
|
|
5592
|
+
if (item.lastOpenedAt === void 0) {
|
|
5593
|
+
return /* @__PURE__ */ jsx19("span", { ...props, "data-keep-card-part": "activity", children: neverOpenedLabel });
|
|
5594
|
+
}
|
|
5595
|
+
const age = Math.max(0, Date.now() - item.lastOpenedAt);
|
|
5596
|
+
const label = kind === "opened" ? `${openedLabel} ${formatRelativeAge(age, locale)}` : `${formatInactiveAge(age, locale)}${isCjkLocale2(locale) ? "" : " "}${inactiveSuffix}`;
|
|
5597
|
+
return /* @__PURE__ */ jsx19("span", { ...props, "data-keep-card-part": "activity", children: /* @__PURE__ */ jsx19("time", { dateTime: new Date(item.lastOpenedAt).toISOString(), children: label }) });
|
|
5098
5598
|
}
|
|
5099
5599
|
function KeepItemCardSave({ labels, getAriaLabel, ...props }) {
|
|
5100
5600
|
const context = useKeepItemCardCompound("Save");
|
|
5101
|
-
return /* @__PURE__ */
|
|
5601
|
+
return /* @__PURE__ */ jsx19(
|
|
5102
5602
|
KeepButton,
|
|
5103
5603
|
{
|
|
5104
5604
|
...props,
|
|
@@ -5111,7 +5611,7 @@ function KeepItemCardSave({ labels, getAriaLabel, ...props }) {
|
|
|
5111
5611
|
}
|
|
5112
5612
|
function KeepItemCardRemove({ children, disabled, onClick, ...props }) {
|
|
5113
5613
|
const context = useKeepItemCardCompound("Remove");
|
|
5114
|
-
return /* @__PURE__ */
|
|
5614
|
+
return /* @__PURE__ */ jsx19(
|
|
5115
5615
|
"button",
|
|
5116
5616
|
{
|
|
5117
5617
|
...props,
|
|
@@ -5128,19 +5628,19 @@ function KeepItemCardRemove({ children, disabled, onClick, ...props }) {
|
|
|
5128
5628
|
}
|
|
5129
5629
|
function KeepItemCardPin({ children, ...props }) {
|
|
5130
5630
|
const context = useKeepItemCardCompound("Pin");
|
|
5131
|
-
return /* @__PURE__ */
|
|
5631
|
+
return /* @__PURE__ */ jsx19(KeepPinButton, { ...props, item: context.item, children });
|
|
5132
5632
|
}
|
|
5133
5633
|
function KeepItemCardArchive({
|
|
5134
5634
|
children,
|
|
5135
5635
|
...props
|
|
5136
5636
|
}) {
|
|
5137
5637
|
const context = useKeepItemCardCompound("Archive");
|
|
5138
|
-
return /* @__PURE__ */
|
|
5638
|
+
return /* @__PURE__ */ jsx19(KeepArchiveButton, { ...props, item: context.item, children });
|
|
5139
5639
|
}
|
|
5140
5640
|
function KeepItemCardCollectionBadge({ children, ...props }) {
|
|
5141
5641
|
const context = useKeepItemCardCompound("CollectionBadge");
|
|
5142
5642
|
if (!context.item.collectionId) return null;
|
|
5143
|
-
return /* @__PURE__ */
|
|
5643
|
+
return /* @__PURE__ */ jsx19("span", { ...props, "data-keep-card-part": "collection-badge", children: children ?? context.collectionLabel });
|
|
5144
5644
|
}
|
|
5145
5645
|
var KeepItemCard = Object.assign(KeepItemCardRoot, {
|
|
5146
5646
|
Media: KeepItemCardMedia,
|
|
@@ -5155,21 +5655,39 @@ var KeepItemCard = Object.assign(KeepItemCardRoot, {
|
|
|
5155
5655
|
CollectionBadge: KeepItemCardCollectionBadge
|
|
5156
5656
|
});
|
|
5157
5657
|
function KeepItemCardSkeleton({ layout = "list", ...props }) {
|
|
5158
|
-
return /* @__PURE__ */
|
|
5159
|
-
/* @__PURE__ */
|
|
5160
|
-
/* @__PURE__ */
|
|
5161
|
-
/* @__PURE__ */
|
|
5162
|
-
/* @__PURE__ */
|
|
5163
|
-
/* @__PURE__ */
|
|
5658
|
+
return /* @__PURE__ */ jsxs17("article", { ...props, "aria-hidden": "true", "data-keepkit": "card-skeleton", "data-layout": layout, "data-state": "loading", children: [
|
|
5659
|
+
/* @__PURE__ */ jsx19("span", { "data-skeleton-part": "media" }),
|
|
5660
|
+
/* @__PURE__ */ jsx19("span", { "data-skeleton-part": "title" }),
|
|
5661
|
+
/* @__PURE__ */ jsx19("span", { "data-skeleton-part": "meta" }),
|
|
5662
|
+
/* @__PURE__ */ jsx19("span", { "data-skeleton-part": "tag" }),
|
|
5663
|
+
/* @__PURE__ */ jsx19("span", { "data-skeleton-part": "tag" })
|
|
5164
5664
|
] });
|
|
5165
5665
|
}
|
|
5166
5666
|
function formatSavedAt(timestamp) {
|
|
5167
5667
|
return new Date(timestamp).toISOString().slice(0, 10);
|
|
5168
5668
|
}
|
|
5669
|
+
function formatRelativeAge(milliseconds, locale) {
|
|
5670
|
+
const hour = 60 * 60 * 1e3;
|
|
5671
|
+
const day = 24 * hour;
|
|
5672
|
+
const unit = milliseconds < 60 * 1e3 ? "minute" : milliseconds < hour ? "hour" : milliseconds < day ? "day" : "day";
|
|
5673
|
+
const value = unit === "minute" ? Math.floor(milliseconds / (60 * 1e3)) : unit === "hour" ? Math.floor(milliseconds / hour) : Math.floor(milliseconds / day);
|
|
5674
|
+
return new Intl.RelativeTimeFormat(locale, { numeric: "auto" }).format(-value, unit);
|
|
5675
|
+
}
|
|
5676
|
+
function formatInactiveAge(milliseconds, locale) {
|
|
5677
|
+
const hour = 60 * 60 * 1e3;
|
|
5678
|
+
const day = 24 * hour;
|
|
5679
|
+
const unit = milliseconds < hour ? "minute" : milliseconds < day ? "hour" : "day";
|
|
5680
|
+
const value = unit === "minute" ? Math.max(1, Math.round(milliseconds / (60 * 1e3))) : unit === "hour" ? Math.max(1, Math.round(milliseconds / hour)) : Math.max(1, Math.round(milliseconds / day));
|
|
5681
|
+
const formatted = new Intl.NumberFormat(locale, { style: "unit", unit, unitDisplay: "long" }).format(value);
|
|
5682
|
+
return isCjkLocale2(locale) ? formatted.replace(/\s+/g, "") : formatted;
|
|
5683
|
+
}
|
|
5684
|
+
function isCjkLocale2(locale) {
|
|
5685
|
+
return /^(?:ja|ko|zh)/i.test(locale ?? "");
|
|
5686
|
+
}
|
|
5169
5687
|
|
|
5170
5688
|
// src/features/status/KeepEmptyState.tsx
|
|
5171
5689
|
import { isValidElement as isValidElement5 } from "react";
|
|
5172
|
-
import { Fragment as Fragment10, jsx as
|
|
5690
|
+
import { Fragment as Fragment10, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5173
5691
|
function KeepEmptyState({
|
|
5174
5692
|
title,
|
|
5175
5693
|
description,
|
|
@@ -5188,10 +5706,10 @@ function KeepEmptyState({
|
|
|
5188
5706
|
);
|
|
5189
5707
|
const clearLabel = useUiLabel("clearFilters");
|
|
5190
5708
|
const contentChildren = asChild && isValidElement5(children) ? void 0 : children;
|
|
5191
|
-
const body = contentChildren ?? /* @__PURE__ */
|
|
5192
|
-
/* @__PURE__ */
|
|
5193
|
-
description ?? /* @__PURE__ */
|
|
5194
|
-
action ?? (resolvedVariant === "empty-filtered" && onClearFilters ? /* @__PURE__ */
|
|
5709
|
+
const body = contentChildren ?? /* @__PURE__ */ jsxs18(Fragment10, { children: [
|
|
5710
|
+
/* @__PURE__ */ jsx20("h2", { children: title ?? defaultTitle }),
|
|
5711
|
+
description ?? /* @__PURE__ */ jsx20("p", { children: defaultDescription }),
|
|
5712
|
+
action ?? (resolvedVariant === "empty-filtered" && onClearFilters ? /* @__PURE__ */ jsx20("button", { type: "button", "data-keep-action": "clear-filters", onClick: onClearFilters, children: clearLabel }) : null)
|
|
5195
5713
|
] });
|
|
5196
5714
|
return renderRoot(
|
|
5197
5715
|
asChild,
|
|
@@ -5217,17 +5735,17 @@ function useKeepListView(query) {
|
|
|
5217
5735
|
}
|
|
5218
5736
|
|
|
5219
5737
|
// src/features/collection/hooks/useRovingTabIndex.ts
|
|
5220
|
-
import { useCallback as
|
|
5738
|
+
import { useCallback as useCallback7, useEffect as useEffect10, useRef as useRef8 } from "react";
|
|
5221
5739
|
function useRovingTabIndex() {
|
|
5222
5740
|
const ref = useRef8(null);
|
|
5223
|
-
const getItems =
|
|
5741
|
+
const getItems = useCallback7(() => {
|
|
5224
5742
|
const root = ref.current;
|
|
5225
5743
|
if (!root) return [];
|
|
5226
5744
|
return Array.from(root.querySelectorAll('[data-keepkit="card"]')).filter(
|
|
5227
5745
|
(item) => item.getAttribute("aria-hidden") !== "true" && item.getAttribute("data-roving-disabled") !== "true"
|
|
5228
5746
|
);
|
|
5229
5747
|
}, []);
|
|
5230
|
-
const syncTabIndices =
|
|
5748
|
+
const syncTabIndices = useCallback7(() => {
|
|
5231
5749
|
const items = getItems();
|
|
5232
5750
|
if (items.length === 0) return;
|
|
5233
5751
|
const activeElement = document.activeElement;
|
|
@@ -5237,7 +5755,7 @@ function useRovingTabIndex() {
|
|
|
5237
5755
|
item.tabIndex = index === activeIndex ? 0 : -1;
|
|
5238
5756
|
});
|
|
5239
5757
|
}, [getItems]);
|
|
5240
|
-
|
|
5758
|
+
useEffect10(() => {
|
|
5241
5759
|
const root = ref.current;
|
|
5242
5760
|
if (!root) return;
|
|
5243
5761
|
syncTabIndices();
|
|
@@ -5245,7 +5763,7 @@ function useRovingTabIndex() {
|
|
|
5245
5763
|
observer.observe(root, { childList: true, subtree: true });
|
|
5246
5764
|
return () => observer.disconnect();
|
|
5247
5765
|
}, [syncTabIndices]);
|
|
5248
|
-
const onFocusCapture =
|
|
5766
|
+
const onFocusCapture = useCallback7(
|
|
5249
5767
|
(event) => {
|
|
5250
5768
|
if (!(event.target instanceof HTMLElement)) return;
|
|
5251
5769
|
const item = event.target.closest('[data-keepkit="card"]');
|
|
@@ -5256,7 +5774,7 @@ function useRovingTabIndex() {
|
|
|
5256
5774
|
},
|
|
5257
5775
|
[getItems]
|
|
5258
5776
|
);
|
|
5259
|
-
const onKeyDown =
|
|
5777
|
+
const onKeyDown = useCallback7(
|
|
5260
5778
|
(event) => {
|
|
5261
5779
|
if (event.defaultPrevented) return;
|
|
5262
5780
|
const items = getItems();
|
|
@@ -5282,8 +5800,8 @@ function useRovingTabIndex() {
|
|
|
5282
5800
|
}
|
|
5283
5801
|
|
|
5284
5802
|
// src/features/collection/KeepReorderableList.tsx
|
|
5285
|
-
import { useState as
|
|
5286
|
-
import { jsx as
|
|
5803
|
+
import { useState as useState16 } from "react";
|
|
5804
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
5287
5805
|
function KeepReorderableList({
|
|
5288
5806
|
items,
|
|
5289
5807
|
onReorder,
|
|
@@ -5291,8 +5809,8 @@ function KeepReorderableList({
|
|
|
5291
5809
|
itemLabel = (_item, index) => `Move item ${index + 1}`,
|
|
5292
5810
|
...props
|
|
5293
5811
|
}) {
|
|
5294
|
-
const [draggedId, setDraggedId] =
|
|
5295
|
-
const [dropTargetIndex, setDropTargetIndex] =
|
|
5812
|
+
const [draggedId, setDraggedId] = useState16(null);
|
|
5813
|
+
const [dropTargetIndex, setDropTargetIndex] = useState16(null);
|
|
5296
5814
|
const ids = items.map((item) => item.id);
|
|
5297
5815
|
function commit(nextIds) {
|
|
5298
5816
|
void onReorder(nextIds);
|
|
@@ -5317,7 +5835,7 @@ function KeepReorderableList({
|
|
|
5317
5835
|
if (next[index] === id) return;
|
|
5318
5836
|
commit(next);
|
|
5319
5837
|
}
|
|
5320
|
-
return /* @__PURE__ */
|
|
5838
|
+
return /* @__PURE__ */ jsx21("ul", { ...props, "data-keepkit": "reorderable-list", children: items.map((item, index) => {
|
|
5321
5839
|
const moveUp = () => move(index, index - 1);
|
|
5322
5840
|
const moveDown = () => move(index, index + 1);
|
|
5323
5841
|
const onHandleKeyDown = (event) => {
|
|
@@ -5361,7 +5879,7 @@ function KeepReorderableList({
|
|
|
5361
5879
|
onKeyDown: onHandleKeyDown
|
|
5362
5880
|
}
|
|
5363
5881
|
};
|
|
5364
|
-
return /* @__PURE__ */
|
|
5882
|
+
return /* @__PURE__ */ jsx21(
|
|
5365
5883
|
"li",
|
|
5366
5884
|
{
|
|
5367
5885
|
"data-reorder-index": index,
|
|
@@ -5393,12 +5911,12 @@ function KeepReorderableList({
|
|
|
5393
5911
|
}
|
|
5394
5912
|
|
|
5395
5913
|
// src/features/collection/KeepList.tsx
|
|
5396
|
-
import { Fragment as Fragment11, jsx as
|
|
5914
|
+
import { Fragment as Fragment11, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5397
5915
|
function KeepList(props) {
|
|
5398
5916
|
const { fallback, onBoundaryError, boundaryResetKey, ...listProps } = props;
|
|
5399
|
-
const content = /* @__PURE__ */
|
|
5917
|
+
const content = /* @__PURE__ */ jsx22(KeepListContent, { ...listProps });
|
|
5400
5918
|
if (fallback === void 0 && onBoundaryError === void 0) return content;
|
|
5401
|
-
return /* @__PURE__ */
|
|
5919
|
+
return /* @__PURE__ */ jsx22(KeepErrorBoundary, { fallback, onError: onBoundaryError, resetKey: boundaryResetKey, children: content });
|
|
5402
5920
|
}
|
|
5403
5921
|
function KeepListContent({
|
|
5404
5922
|
query,
|
|
@@ -5463,7 +5981,7 @@ function KeepListContent({
|
|
|
5463
5981
|
if (!event.defaultPrevented) roving.onFocusCapture(event);
|
|
5464
5982
|
}
|
|
5465
5983
|
},
|
|
5466
|
-
/* @__PURE__ */
|
|
5984
|
+
/* @__PURE__ */ jsx22(KeepSearchQueryProvider, { query: query?.search?.query, children: body }),
|
|
5467
5985
|
"KeepList"
|
|
5468
5986
|
);
|
|
5469
5987
|
}
|
|
@@ -5478,17 +5996,17 @@ function getListBody(state, options) {
|
|
|
5478
5996
|
if (state.isLoading && !state.isHydrated) {
|
|
5479
5997
|
if (options.loading !== void 0) return resolveContent(options.loading, state);
|
|
5480
5998
|
const count = Number.isFinite(options.loadingCount) ? Math.max(0, Math.floor(options.loadingCount)) : 6;
|
|
5481
|
-
return /* @__PURE__ */
|
|
5482
|
-
/* @__PURE__ */
|
|
5483
|
-
/* @__PURE__ */
|
|
5999
|
+
return /* @__PURE__ */ jsxs19(Fragment11, { children: [
|
|
6000
|
+
/* @__PURE__ */ jsx22("span", { role: "status", "data-keepkit": "loading-label", children: options.loadingLabel }),
|
|
6001
|
+
/* @__PURE__ */ jsx22("ul", { "data-keepkit": "skeleton-list", "data-layout": options.layout, children: Array.from({ length: count }, (_, index) => (
|
|
5484
6002
|
// biome-ignore lint/suspicious/noArrayIndexKey: Static loading placeholders never reorder.
|
|
5485
|
-
/* @__PURE__ */
|
|
6003
|
+
/* @__PURE__ */ jsx22("li", { children: /* @__PURE__ */ jsx22(KeepItemCardSkeleton, { layout: options.layout }) }, index)
|
|
5486
6004
|
)) })
|
|
5487
6005
|
] });
|
|
5488
6006
|
}
|
|
5489
6007
|
if (state.isHydrated && state.items.length === 0) {
|
|
5490
6008
|
if (options.empty !== void 0) return resolveContent(options.empty, state);
|
|
5491
|
-
return /* @__PURE__ */
|
|
6009
|
+
return /* @__PURE__ */ jsx22(
|
|
5492
6010
|
KeepEmptyState,
|
|
5493
6011
|
{
|
|
5494
6012
|
variant: options.allItemCount > 0 && hasActiveQueryFilters(options.query) ? "empty-filtered" : "empty-storage",
|
|
@@ -5499,7 +6017,7 @@ function getListBody(state, options) {
|
|
|
5499
6017
|
if (typeof options.children === "function") return options.children(state);
|
|
5500
6018
|
if (options.children !== void 0 && !isValidElement6(options.children)) return options.children;
|
|
5501
6019
|
if (options.reorderable) {
|
|
5502
|
-
return /* @__PURE__ */
|
|
6020
|
+
return /* @__PURE__ */ jsx22(
|
|
5503
6021
|
KeepReorderableList,
|
|
5504
6022
|
{
|
|
5505
6023
|
items: state.items,
|
|
@@ -5507,16 +6025,16 @@ function getListBody(state, options) {
|
|
|
5507
6025
|
await options.reorder(orderedIds);
|
|
5508
6026
|
await options.onReorder?.(orderedIds);
|
|
5509
6027
|
},
|
|
5510
|
-
renderItem: (item, reorderState) => /* @__PURE__ */
|
|
5511
|
-
/* @__PURE__ */
|
|
5512
|
-
options.renderItem ? options.renderItem(item, state) : /* @__PURE__ */
|
|
6028
|
+
renderItem: (item, reorderState) => /* @__PURE__ */ jsxs19(Fragment11, { children: [
|
|
6029
|
+
/* @__PURE__ */ jsx22("button", { type: "button", ...reorderState.dragHandleProps, children: "\u2195" }),
|
|
6030
|
+
options.renderItem ? options.renderItem(item, state) : /* @__PURE__ */ jsx22(KeepItemCard, { item, ...options.itemCardProps })
|
|
5513
6031
|
] }),
|
|
5514
6032
|
"data-layout": options.layout
|
|
5515
6033
|
}
|
|
5516
6034
|
);
|
|
5517
6035
|
}
|
|
5518
|
-
return /* @__PURE__ */
|
|
5519
|
-
(item) => options.renderItem ? options.renderItem(item, state) : /* @__PURE__ */
|
|
6036
|
+
return /* @__PURE__ */ jsx22("ul", { "data-layout": options.layout, children: state.items.map(
|
|
6037
|
+
(item) => options.renderItem ? options.renderItem(item, state) : /* @__PURE__ */ jsx22("li", { children: /* @__PURE__ */ jsx22(KeepItemCard, { item, ...options.itemCardProps }) }, item.id)
|
|
5520
6038
|
) });
|
|
5521
6039
|
}
|
|
5522
6040
|
function hasActiveQueryFilters(query) {
|
|
@@ -5527,12 +6045,12 @@ function hasActiveQueryFilters(query) {
|
|
|
5527
6045
|
}
|
|
5528
6046
|
|
|
5529
6047
|
// src/features/collection/KeepCollection.tsx
|
|
5530
|
-
import { Fragment as Fragment12, jsx as
|
|
6048
|
+
import { Fragment as Fragment12, jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5531
6049
|
function KeepCollection(props) {
|
|
5532
6050
|
const { fallback, onBoundaryError, boundaryResetKey, ...collectionProps } = props;
|
|
5533
|
-
const content = /* @__PURE__ */
|
|
6051
|
+
const content = /* @__PURE__ */ jsx23(KeepCollectionContent, { ...collectionProps });
|
|
5534
6052
|
if (fallback === void 0 && onBoundaryError === void 0) return content;
|
|
5535
|
-
return /* @__PURE__ */
|
|
6053
|
+
return /* @__PURE__ */ jsx23(KeepErrorBoundary2, { fallback, onError: onBoundaryError, resetKey: boundaryResetKey, children: content });
|
|
5536
6054
|
}
|
|
5537
6055
|
function KeepCollectionContent({
|
|
5538
6056
|
query = {},
|
|
@@ -5565,13 +6083,13 @@ function KeepCollectionContent({
|
|
|
5565
6083
|
}) {
|
|
5566
6084
|
const view = useKeepCollection({ query, pageSize, urlSync, urlAdapter, features, archiveScope });
|
|
5567
6085
|
const revealRequestId = useRef9(void 0);
|
|
5568
|
-
|
|
6086
|
+
useEffect11(() => {
|
|
5569
6087
|
if (!revealRequest || revealRequestId.current === revealRequest.requestId) return;
|
|
5570
6088
|
revealRequestId.current = revealRequest.requestId;
|
|
5571
6089
|
const status = view.reveal(revealRequest.itemId);
|
|
5572
6090
|
onRevealResult?.({ ...revealRequest, status });
|
|
5573
6091
|
}, [onRevealResult, revealRequest, view.reveal]);
|
|
5574
|
-
const [reorderUndoIds, setReorderUndoIds] =
|
|
6092
|
+
const [reorderUndoIds, setReorderUndoIds] = useState17(null);
|
|
5575
6093
|
const reorderUndoLabel = useUiLabel("undoReorder");
|
|
5576
6094
|
const handleReorder = async (orderedIds) => {
|
|
5577
6095
|
const previousIds = view.list.items.map((item) => item.id);
|
|
@@ -5584,7 +6102,7 @@ function KeepCollectionContent({
|
|
|
5584
6102
|
setReorderUndoIds(previousIds);
|
|
5585
6103
|
await onReorder?.(orderedItems);
|
|
5586
6104
|
};
|
|
5587
|
-
|
|
6105
|
+
useEffect11(() => {
|
|
5588
6106
|
if (!reorderUndoIds) return;
|
|
5589
6107
|
const timer = window.setTimeout(() => setReorderUndoIds(null), 5e3);
|
|
5590
6108
|
return () => window.clearTimeout(timer);
|
|
@@ -5607,13 +6125,13 @@ function KeepCollectionContent({
|
|
|
5607
6125
|
const structuredToolbar = toolbarLayout === "grouped" || toolbarVariant === "panel" || creatable || slots?.toolbarStart !== void 0 || slots?.toolbarEnd !== void 0;
|
|
5608
6126
|
const hasQueryControls = view.enabled.search || view.enabled.sort;
|
|
5609
6127
|
const hasFilterControls = view.enabled.tagFilter || view.enabled.collectionFilter || archiveScope !== void 0;
|
|
5610
|
-
const queryControls = hasQueryControls ? /* @__PURE__ */
|
|
5611
|
-
view.enabled.search ? /* @__PURE__ */
|
|
5612
|
-
view.enabled.sort ? /* @__PURE__ */
|
|
6128
|
+
const queryControls = hasQueryControls ? /* @__PURE__ */ jsxs20(Fragment12, { children: [
|
|
6129
|
+
view.enabled.search ? /* @__PURE__ */ jsx23(KeepSearchInput, { value: view.searchValue, onValueChange: view.setSearchValue }) : null,
|
|
6130
|
+
view.enabled.sort ? /* @__PURE__ */ jsx23(KeepSortSelect, { value: view.sortValue, onValueChange: view.setSortValue }) : null
|
|
5613
6131
|
] }) : null;
|
|
5614
|
-
const filterControls = hasFilterControls ? /* @__PURE__ */
|
|
5615
|
-
view.enabled.tagFilter ? /* @__PURE__ */
|
|
5616
|
-
view.enabled.collectionFilter ? /* @__PURE__ */
|
|
6132
|
+
const filterControls = hasFilterControls ? /* @__PURE__ */ jsxs20(Fragment12, { children: [
|
|
6133
|
+
view.enabled.tagFilter ? /* @__PURE__ */ jsx23(KeepTagFilter, { query, value: view.activeTags[0], onValueChange: view.setTag }) : null,
|
|
6134
|
+
view.enabled.collectionFilter ? /* @__PURE__ */ jsx23(
|
|
5617
6135
|
KeepCollectionFilter,
|
|
5618
6136
|
{
|
|
5619
6137
|
value: view.activeCollection,
|
|
@@ -5621,7 +6139,7 @@ function KeepCollectionContent({
|
|
|
5621
6139
|
collectionLabels
|
|
5622
6140
|
}
|
|
5623
6141
|
) : null,
|
|
5624
|
-
archiveScope !== void 0 ? /* @__PURE__ */
|
|
6142
|
+
archiveScope !== void 0 ? /* @__PURE__ */ jsx23(
|
|
5625
6143
|
KeepArchiveScopeSelect,
|
|
5626
6144
|
{
|
|
5627
6145
|
value: view.archiveScope,
|
|
@@ -5639,13 +6157,13 @@ function KeepCollectionContent({
|
|
|
5639
6157
|
const uncategorizedLabel = useUiLabel("uncategorized");
|
|
5640
6158
|
const activeCollectionLabel = view.activeCollection === "__uncategorized__" ? uncategorizedLabel : view.activeCollection === void 0 ? void 0 : collectionLabels?.[view.activeCollection] ?? view.activeCollection;
|
|
5641
6159
|
const toolbarStartContent = slots?.toolbarStart === void 0 ? null : resolveContent(slots.toolbarStart, view.list);
|
|
5642
|
-
const creatableContent = creatable ? /* @__PURE__ */
|
|
6160
|
+
const creatableContent = creatable ? /* @__PURE__ */ jsx23(KeepCollectionCreate, {}) : null;
|
|
5643
6161
|
const toolbarEndContent = creatableContent ?? (slots?.toolbarEnd === void 0 ? null : resolveContent(slots.toolbarEnd, view.list));
|
|
5644
6162
|
const hasToolbarContent = hasQueryControls || hasFilterControls || hasRenderableContent(toolbarStartContent) || hasRenderableContent(toolbarEndContent);
|
|
5645
6163
|
const renderToolbarGroup = (group, content, label) => {
|
|
5646
6164
|
if (!hasRenderableContent(content)) return null;
|
|
5647
6165
|
const labelId = `${toolbarId}-${group}`;
|
|
5648
|
-
return /* @__PURE__ */
|
|
6166
|
+
return /* @__PURE__ */ jsxs20(
|
|
5649
6167
|
"fieldset",
|
|
5650
6168
|
{
|
|
5651
6169
|
"data-keepkit": "collection-toolbar-group",
|
|
@@ -5653,22 +6171,22 @@ function KeepCollectionContent({
|
|
|
5653
6171
|
role: "group",
|
|
5654
6172
|
"aria-labelledby": labelId,
|
|
5655
6173
|
children: [
|
|
5656
|
-
/* @__PURE__ */
|
|
5657
|
-
/* @__PURE__ */
|
|
6174
|
+
/* @__PURE__ */ jsx23("legend", { id: labelId, "data-keepkit": "collection-toolbar-label", children: label }),
|
|
6175
|
+
/* @__PURE__ */ jsx23("div", { "data-keepkit": "collection-toolbar-content", children: content })
|
|
5658
6176
|
]
|
|
5659
6177
|
}
|
|
5660
6178
|
);
|
|
5661
6179
|
};
|
|
5662
|
-
const toolbar = !structuredToolbar ? /* @__PURE__ */
|
|
6180
|
+
const toolbar = !structuredToolbar ? /* @__PURE__ */ jsxs20("div", { children: [
|
|
5663
6181
|
queryControls,
|
|
5664
6182
|
filterControls
|
|
5665
|
-
] }) : !hasToolbarContent ? null : /* @__PURE__ */
|
|
6183
|
+
] }) : !hasToolbarContent ? null : /* @__PURE__ */ jsxs20("div", { "data-keepkit": "collection-toolbar", "data-variant": toolbarVariant, "data-layout": toolbarLayout, children: [
|
|
5666
6184
|
renderToolbarGroup("toolbarStart", toolbarStartContent, toolbarStartLabel),
|
|
5667
6185
|
renderToolbarGroup("query", queryControls, toolbarQueryLabel),
|
|
5668
6186
|
renderToolbarGroup("filters", filterControls, toolbarFiltersLabel),
|
|
5669
6187
|
renderToolbarGroup("toolbarEnd", toolbarEndContent, toolbarEndLabel)
|
|
5670
6188
|
] });
|
|
5671
|
-
return /* @__PURE__ */
|
|
6189
|
+
return /* @__PURE__ */ jsxs20(
|
|
5672
6190
|
"section",
|
|
5673
6191
|
{
|
|
5674
6192
|
...rootProps,
|
|
@@ -5682,28 +6200,38 @@ function KeepCollectionContent({
|
|
|
5682
6200
|
"data-loading": view.list.isLoading || view.list.isMutating ? "true" : void 0,
|
|
5683
6201
|
children: [
|
|
5684
6202
|
toolbar,
|
|
5685
|
-
|
|
6203
|
+
view.enabled.savedViews ? /* @__PURE__ */ jsxs20("div", { "data-keepkit": "saved-view-controls", children: [
|
|
6204
|
+
/* @__PURE__ */ jsx23(KeepSavedViews, { onApply: view.applyQuery }),
|
|
6205
|
+
/* @__PURE__ */ jsx23(KeepSaveViewButton, { query: view.resolvedQuery })
|
|
6206
|
+
] }) : null,
|
|
6207
|
+
activeFilters === void 0 ? /* @__PURE__ */ jsx23(
|
|
5686
6208
|
KeepActiveFiltersSummary,
|
|
5687
6209
|
{
|
|
5688
6210
|
search: view.searchValue,
|
|
5689
6211
|
tags: view.activeTags,
|
|
5690
6212
|
collection: view.activeCollection,
|
|
5691
6213
|
collectionLabel: activeCollectionLabel,
|
|
6214
|
+
organization: view.resolvedQuery.organization,
|
|
6215
|
+
savedBetween: view.resolvedQuery.savedBetween,
|
|
5692
6216
|
activity: view.activity,
|
|
5693
6217
|
archiveScope: view.archiveScope,
|
|
5694
6218
|
totalCount: view.list.totalCount,
|
|
5695
6219
|
onSearchChange: view.setSearchValue,
|
|
5696
6220
|
onTagChange: view.removeTag,
|
|
5697
6221
|
onCollectionChange: view.setCollection,
|
|
6222
|
+
onOrganizationChange: view.setOrganization,
|
|
6223
|
+
onSavedBetweenChange: view.setSavedBetween,
|
|
5698
6224
|
onActivityChange: view.setActivity,
|
|
5699
6225
|
onArchiveScopeChange: (next) => {
|
|
5700
6226
|
view.setArchiveScope(next);
|
|
5701
6227
|
onArchiveScopeChange?.(next);
|
|
5702
6228
|
},
|
|
5703
|
-
onClear: view.clearFilters
|
|
6229
|
+
onClear: view.clearFilters,
|
|
6230
|
+
onReset: view.resetFilters,
|
|
6231
|
+
canReset: view.canReset
|
|
5704
6232
|
}
|
|
5705
6233
|
) : resolveContent(activeFilters, view.list),
|
|
5706
|
-
/* @__PURE__ */
|
|
6234
|
+
/* @__PURE__ */ jsx23(
|
|
5707
6235
|
KeepList,
|
|
5708
6236
|
{
|
|
5709
6237
|
query: view.resolvedQuery,
|
|
@@ -5720,7 +6248,7 @@ function KeepCollectionContent({
|
|
|
5720
6248
|
error
|
|
5721
6249
|
}
|
|
5722
6250
|
),
|
|
5723
|
-
view.enabled.pagination ? /* @__PURE__ */
|
|
6251
|
+
view.enabled.pagination ? /* @__PURE__ */ jsx23(
|
|
5724
6252
|
KeepPagination,
|
|
5725
6253
|
{
|
|
5726
6254
|
totalCount: view.list.totalCount,
|
|
@@ -5729,8 +6257,8 @@ function KeepCollectionContent({
|
|
|
5729
6257
|
onPageChange: view.setPage
|
|
5730
6258
|
}
|
|
5731
6259
|
) : null,
|
|
5732
|
-
view.enabled.bulkActions ? /* @__PURE__ */
|
|
5733
|
-
reorderable && reorderUndoIds ? /* @__PURE__ */
|
|
6260
|
+
view.enabled.bulkActions ? /* @__PURE__ */ jsx23(KeepBulkActions, { query: view.resolvedQuery }) : null,
|
|
6261
|
+
reorderable && reorderUndoIds ? /* @__PURE__ */ jsx23("div", { "data-keepkit": "reorder-feedback", role: "status", "aria-live": "polite", children: /* @__PURE__ */ jsx23("button", { type: "button", "data-keep-action": "undo-reorder", onClick: () => void undoReorder(), children: reorderUndoLabel }) }) : null
|
|
5734
6262
|
]
|
|
5735
6263
|
}
|
|
5736
6264
|
);
|
|
@@ -5746,8 +6274,8 @@ function getCollectionState(list) {
|
|
|
5746
6274
|
import { useId as useId5 } from "react";
|
|
5747
6275
|
|
|
5748
6276
|
// src/features/collection/hooks/useKeepCollectionManager.ts
|
|
5749
|
-
import { useKeepCollections as
|
|
5750
|
-
import { useCallback as
|
|
6277
|
+
import { useKeepCollections as useKeepCollections5, useKeepContext as useKeepContext6 } from "@keepkit/core/react";
|
|
6278
|
+
import { useCallback as useCallback8, useState as useState18 } from "react";
|
|
5751
6279
|
function useKeepCollectionManager({
|
|
5752
6280
|
onError,
|
|
5753
6281
|
onRenamed,
|
|
@@ -5761,13 +6289,13 @@ function useKeepCollectionManager({
|
|
|
5761
6289
|
removeCollection,
|
|
5762
6290
|
moveToCollection
|
|
5763
6291
|
} = useKeepContext6();
|
|
5764
|
-
const collections =
|
|
5765
|
-
const [editingId, setEditingId] =
|
|
5766
|
-
const [editingName, setEditingName] =
|
|
5767
|
-
const [pendingDeleteId, setPendingDeleteId] =
|
|
5768
|
-
const [error, setError] =
|
|
5769
|
-
const [isMutating, setIsMutating] =
|
|
5770
|
-
const reportError =
|
|
6292
|
+
const collections = useKeepCollections5({ orderBy: "name" });
|
|
6293
|
+
const [editingId, setEditingId] = useState18(null);
|
|
6294
|
+
const [editingName, setEditingName] = useState18("");
|
|
6295
|
+
const [pendingDeleteId, setPendingDeleteId] = useState18(null);
|
|
6296
|
+
const [error, setError] = useState18(null);
|
|
6297
|
+
const [isMutating, setIsMutating] = useState18(false);
|
|
6298
|
+
const reportError = useCallback8(
|
|
5771
6299
|
(cause, fallback) => {
|
|
5772
6300
|
const message = cause instanceof Error ? cause.message : fallback;
|
|
5773
6301
|
setError(message);
|
|
@@ -5775,7 +6303,7 @@ function useKeepCollectionManager({
|
|
|
5775
6303
|
},
|
|
5776
6304
|
[onError]
|
|
5777
6305
|
);
|
|
5778
|
-
const runMutation =
|
|
6306
|
+
const runMutation = useCallback8(
|
|
5779
6307
|
async (operation) => {
|
|
5780
6308
|
setError(null);
|
|
5781
6309
|
setIsMutating(true);
|
|
@@ -5789,7 +6317,7 @@ function useKeepCollectionManager({
|
|
|
5789
6317
|
},
|
|
5790
6318
|
[reportError]
|
|
5791
6319
|
);
|
|
5792
|
-
const beginRename =
|
|
6320
|
+
const beginRename = useCallback8(
|
|
5793
6321
|
(id) => {
|
|
5794
6322
|
const collection = collections.find((entry) => entry.id === id);
|
|
5795
6323
|
if (!collection) return;
|
|
@@ -5800,11 +6328,11 @@ function useKeepCollectionManager({
|
|
|
5800
6328
|
},
|
|
5801
6329
|
[collections]
|
|
5802
6330
|
);
|
|
5803
|
-
const cancelRename =
|
|
6331
|
+
const cancelRename = useCallback8(() => {
|
|
5804
6332
|
setEditingId(null);
|
|
5805
6333
|
setEditingName("");
|
|
5806
6334
|
}, []);
|
|
5807
|
-
const rename =
|
|
6335
|
+
const rename = useCallback8(
|
|
5808
6336
|
async (id) => {
|
|
5809
6337
|
const name = editingName.trim();
|
|
5810
6338
|
if (!name) return;
|
|
@@ -5836,13 +6364,13 @@ function useKeepCollectionManager({
|
|
|
5836
6364
|
runMutation
|
|
5837
6365
|
]
|
|
5838
6366
|
);
|
|
5839
|
-
const requestDelete =
|
|
6367
|
+
const requestDelete = useCallback8((id) => {
|
|
5840
6368
|
setError(null);
|
|
5841
6369
|
setEditingId(null);
|
|
5842
6370
|
setPendingDeleteId(id);
|
|
5843
6371
|
}, []);
|
|
5844
|
-
const cancelDelete =
|
|
5845
|
-
const confirmDelete =
|
|
6372
|
+
const cancelDelete = useCallback8(() => setPendingDeleteId(null), []);
|
|
6373
|
+
const confirmDelete = useCallback8(async () => {
|
|
5846
6374
|
if (!pendingDeleteId) return;
|
|
5847
6375
|
const id = pendingDeleteId;
|
|
5848
6376
|
await runMutation(async () => {
|
|
@@ -5875,7 +6403,7 @@ function useKeepCollectionManager({
|
|
|
5875
6403
|
}
|
|
5876
6404
|
|
|
5877
6405
|
// src/features/collection/KeepCollectionManager.tsx
|
|
5878
|
-
import { Fragment as Fragment13, jsx as
|
|
6406
|
+
import { Fragment as Fragment13, jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5879
6407
|
function KeepCollectionManager({
|
|
5880
6408
|
allowCreate = true,
|
|
5881
6409
|
allowRename = true,
|
|
@@ -5903,7 +6431,7 @@ function KeepCollectionManager({
|
|
|
5903
6431
|
const itemLabel = useUiLabel("collectionItem");
|
|
5904
6432
|
const itemsLabel = useUiLabel("collectionItems");
|
|
5905
6433
|
const defaultTitle = useUiLabel("manageCollections");
|
|
5906
|
-
return /* @__PURE__ */
|
|
6434
|
+
return /* @__PURE__ */ jsxs21(
|
|
5907
6435
|
"section",
|
|
5908
6436
|
{
|
|
5909
6437
|
...rootProps,
|
|
@@ -5913,17 +6441,17 @@ function KeepCollectionManager({
|
|
|
5913
6441
|
"data-loading": manager.isMutating ? "true" : void 0,
|
|
5914
6442
|
"aria-labelledby": rootProps["aria-labelledby"] ?? headingId,
|
|
5915
6443
|
children: [
|
|
5916
|
-
/* @__PURE__ */
|
|
5917
|
-
/* @__PURE__ */
|
|
5918
|
-
hasRenderableContent(description) ? /* @__PURE__ */
|
|
6444
|
+
/* @__PURE__ */ jsxs21("header", { "data-keepkit": "collection-manager-heading", children: [
|
|
6445
|
+
/* @__PURE__ */ jsx24("h2", { id: headingId, children: title ?? defaultTitle }),
|
|
6446
|
+
hasRenderableContent(description) ? /* @__PURE__ */ jsx24("p", { children: description }) : null
|
|
5919
6447
|
] }),
|
|
5920
|
-
allowCreate ? /* @__PURE__ */
|
|
5921
|
-
manager.error ? /* @__PURE__ */
|
|
5922
|
-
manager.collections.length > 0 ? /* @__PURE__ */
|
|
6448
|
+
allowCreate ? /* @__PURE__ */ jsx24(KeepCollectionCreate, { onCreated, onError }) : null,
|
|
6449
|
+
manager.error ? /* @__PURE__ */ jsx24("p", { "data-keepkit": "collection-manager-error", role: "alert", children: manager.error }) : null,
|
|
6450
|
+
manager.collections.length > 0 ? /* @__PURE__ */ jsx24("ul", { "data-keepkit": "collection-manager-list", children: manager.collections.map((collection) => {
|
|
5923
6451
|
const name = collectionLabels?.[collection.id] ?? collection.name;
|
|
5924
6452
|
const isEditing = manager.editingId === collection.id;
|
|
5925
6453
|
const isPendingDelete = manager.pendingDeleteId === collection.id;
|
|
5926
|
-
return /* @__PURE__ */
|
|
6454
|
+
return /* @__PURE__ */ jsx24("li", { "data-keepkit": "collection-manager-item", children: isEditing && allowRename ? /* @__PURE__ */ jsxs21(
|
|
5927
6455
|
"form",
|
|
5928
6456
|
{
|
|
5929
6457
|
"data-keepkit": "collection-manager-rename",
|
|
@@ -5932,12 +6460,12 @@ function KeepCollectionManager({
|
|
|
5932
6460
|
void manager.rename(collection.id);
|
|
5933
6461
|
},
|
|
5934
6462
|
children: [
|
|
5935
|
-
/* @__PURE__ */
|
|
6463
|
+
/* @__PURE__ */ jsxs21("label", { htmlFor: `${headingId}-rename-${collection.id}`, children: [
|
|
5936
6464
|
renameLabel,
|
|
5937
6465
|
": ",
|
|
5938
6466
|
name
|
|
5939
6467
|
] }),
|
|
5940
|
-
/* @__PURE__ */
|
|
6468
|
+
/* @__PURE__ */ jsx24(
|
|
5941
6469
|
"input",
|
|
5942
6470
|
{
|
|
5943
6471
|
id: `${headingId}-rename-${collection.id}`,
|
|
@@ -5947,7 +6475,7 @@ function KeepCollectionManager({
|
|
|
5947
6475
|
"data-keep-action": "rename-collection-input"
|
|
5948
6476
|
}
|
|
5949
6477
|
),
|
|
5950
|
-
/* @__PURE__ */
|
|
6478
|
+
/* @__PURE__ */ jsx24(
|
|
5951
6479
|
"button",
|
|
5952
6480
|
{
|
|
5953
6481
|
type: "submit",
|
|
@@ -5956,7 +6484,7 @@ function KeepCollectionManager({
|
|
|
5956
6484
|
children: renameSubmitLabel
|
|
5957
6485
|
}
|
|
5958
6486
|
),
|
|
5959
|
-
/* @__PURE__ */
|
|
6487
|
+
/* @__PURE__ */ jsx24(
|
|
5960
6488
|
"button",
|
|
5961
6489
|
{
|
|
5962
6490
|
type: "button",
|
|
@@ -5968,18 +6496,18 @@ function KeepCollectionManager({
|
|
|
5968
6496
|
)
|
|
5969
6497
|
]
|
|
5970
6498
|
}
|
|
5971
|
-
) : /* @__PURE__ */
|
|
5972
|
-
/* @__PURE__ */
|
|
5973
|
-
/* @__PURE__ */
|
|
5974
|
-
showCounts ? /* @__PURE__ */
|
|
6499
|
+
) : /* @__PURE__ */ jsxs21(Fragment13, { children: [
|
|
6500
|
+
/* @__PURE__ */ jsxs21("div", { "data-keepkit": "collection-manager-summary", children: [
|
|
6501
|
+
/* @__PURE__ */ jsx24("span", { "data-keepkit": "collection-manager-name", children: name }),
|
|
6502
|
+
showCounts ? /* @__PURE__ */ jsxs21("span", { "data-keepkit": "collection-manager-count", children: [
|
|
5975
6503
|
collection.count,
|
|
5976
6504
|
" ",
|
|
5977
6505
|
collection.count === 1 ? itemLabel : itemsLabel
|
|
5978
6506
|
] }) : null
|
|
5979
6507
|
] }),
|
|
5980
|
-
isPendingDelete && allowDelete ? /* @__PURE__ */
|
|
5981
|
-
/* @__PURE__ */
|
|
5982
|
-
/* @__PURE__ */
|
|
6508
|
+
isPendingDelete && allowDelete ? /* @__PURE__ */ jsxs21("fieldset", { "data-keepkit": "collection-manager-delete-confirmation", children: [
|
|
6509
|
+
/* @__PURE__ */ jsx24("legend", { children: deleteConfirmLabel }),
|
|
6510
|
+
/* @__PURE__ */ jsx24(
|
|
5983
6511
|
"button",
|
|
5984
6512
|
{
|
|
5985
6513
|
type: "button",
|
|
@@ -5989,7 +6517,7 @@ function KeepCollectionManager({
|
|
|
5989
6517
|
children: deleteSubmitLabel
|
|
5990
6518
|
}
|
|
5991
6519
|
),
|
|
5992
|
-
/* @__PURE__ */
|
|
6520
|
+
/* @__PURE__ */ jsx24(
|
|
5993
6521
|
"button",
|
|
5994
6522
|
{
|
|
5995
6523
|
type: "button",
|
|
@@ -5999,8 +6527,8 @@ function KeepCollectionManager({
|
|
|
5999
6527
|
children: cancelLabel
|
|
6000
6528
|
}
|
|
6001
6529
|
)
|
|
6002
|
-
] }) : /* @__PURE__ */
|
|
6003
|
-
allowRename ? /* @__PURE__ */
|
|
6530
|
+
] }) : /* @__PURE__ */ jsxs21("div", { "data-keepkit": "collection-manager-actions", children: [
|
|
6531
|
+
allowRename ? /* @__PURE__ */ jsx24(
|
|
6004
6532
|
"button",
|
|
6005
6533
|
{
|
|
6006
6534
|
type: "button",
|
|
@@ -6011,7 +6539,7 @@ function KeepCollectionManager({
|
|
|
6011
6539
|
children: renameLabel
|
|
6012
6540
|
}
|
|
6013
6541
|
) : null,
|
|
6014
|
-
allowDelete ? /* @__PURE__ */
|
|
6542
|
+
allowDelete ? /* @__PURE__ */ jsx24(
|
|
6015
6543
|
"button",
|
|
6016
6544
|
{
|
|
6017
6545
|
type: "button",
|
|
@@ -6024,19 +6552,34 @@ function KeepCollectionManager({
|
|
|
6024
6552
|
) : null
|
|
6025
6553
|
] })
|
|
6026
6554
|
] }) }, collection.id);
|
|
6027
|
-
}) }) : hasRenderableContent(empty) ? /* @__PURE__ */
|
|
6555
|
+
}) }) : hasRenderableContent(empty) ? /* @__PURE__ */ jsx24("div", { "data-keepkit": "collection-manager-empty", children: empty }) : null
|
|
6028
6556
|
]
|
|
6029
6557
|
}
|
|
6030
6558
|
);
|
|
6031
6559
|
}
|
|
6032
6560
|
|
|
6561
|
+
// src/features/collection/KeepInbox.tsx
|
|
6562
|
+
import { createInboxQuery } from "@keepkit/core/core";
|
|
6563
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
6564
|
+
function KeepInbox({ query, ...props }) {
|
|
6565
|
+
const inboxQuery = createInboxQuery({ organization: query?.organization });
|
|
6566
|
+
return /* @__PURE__ */ jsx25(
|
|
6567
|
+
KeepCollection,
|
|
6568
|
+
{
|
|
6569
|
+
...props,
|
|
6570
|
+
query: { ...inboxQuery, ...query, organization: inboxQuery.organization },
|
|
6571
|
+
features: { note: true, archive: true, bulkActions: true, tags: true, ...props.features }
|
|
6572
|
+
}
|
|
6573
|
+
);
|
|
6574
|
+
}
|
|
6575
|
+
|
|
6033
6576
|
// src/features/collection/KeepLayout.tsx
|
|
6034
|
-
import { jsx as
|
|
6577
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
6035
6578
|
function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...props }) {
|
|
6036
6579
|
const roving = useRovingTabIndex();
|
|
6037
6580
|
return (
|
|
6038
6581
|
// biome-ignore lint/a11y/noStaticElementInteractions: The group manages keyboard focus for descendant cards.
|
|
6039
|
-
/* @__PURE__ */
|
|
6582
|
+
/* @__PURE__ */ jsx26(
|
|
6040
6583
|
"div",
|
|
6041
6584
|
{
|
|
6042
6585
|
...props,
|
|
@@ -6063,7 +6606,7 @@ function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...p
|
|
|
6063
6606
|
import { isValidElement as isValidElement7 } from "react";
|
|
6064
6607
|
|
|
6065
6608
|
// src/features/navigation/KeepShortcutHint.tsx
|
|
6066
|
-
import { jsx as
|
|
6609
|
+
import { jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6067
6610
|
function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
6068
6611
|
const keys = typeof shortcut === "string" ? shortcut.split("+") : [...shortcut];
|
|
6069
6612
|
const occurrences = /* @__PURE__ */ new Map();
|
|
@@ -6072,24 +6615,24 @@ function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
|
6072
6615
|
occurrences.set(key, occurrence + 1);
|
|
6073
6616
|
return { id: `${key}-${occurrence}`, value: key };
|
|
6074
6617
|
});
|
|
6075
|
-
return /* @__PURE__ */
|
|
6076
|
-
index > 0 ? /* @__PURE__ */
|
|
6077
|
-
/* @__PURE__ */
|
|
6618
|
+
return /* @__PURE__ */ jsx27("span", { ...props, "data-keepkit": "shortcut-hint", "aria-hidden": props["aria-hidden"] ?? true, children: keyedKeys.map((key, index) => /* @__PURE__ */ jsxs22("span", { children: [
|
|
6619
|
+
index > 0 ? /* @__PURE__ */ jsx27("span", { "data-shortcut-separator": "true", children: separator }) : null,
|
|
6620
|
+
/* @__PURE__ */ jsx27("kbd", { children: key.value.trim() })
|
|
6078
6621
|
] }, key.id)) });
|
|
6079
6622
|
}
|
|
6080
6623
|
|
|
6081
6624
|
// src/features/editor/hooks/useKeepNoteEditor.ts
|
|
6082
6625
|
import { useKeepItem as useKeepItem6 } from "@keepkit/core/react";
|
|
6083
|
-
import { useCallback as
|
|
6626
|
+
import { useCallback as useCallback9, useEffect as useEffect12, useRef as useRef10, useState as useState19 } from "react";
|
|
6084
6627
|
function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
6085
6628
|
const itemState = useKeepItem6(item);
|
|
6086
6629
|
const { error, isMutating, item: savedItem, updateNote } = itemState;
|
|
6087
|
-
const [note, setNote] =
|
|
6630
|
+
const [note, setNote] = useState19(item.note ?? "");
|
|
6088
6631
|
const baselineNote = savedItem?.note ?? item.note ?? "";
|
|
6089
6632
|
const isDirty = note !== baselineNote;
|
|
6090
6633
|
const lastSavedNoteRef = useRef10(void 0);
|
|
6091
|
-
|
|
6092
|
-
const save =
|
|
6634
|
+
useEffect12(() => setNote(baselineNote), [baselineNote]);
|
|
6635
|
+
const save = useCallback9(async () => {
|
|
6093
6636
|
const nextNote = note.trim() || void 0;
|
|
6094
6637
|
try {
|
|
6095
6638
|
await updateNote(nextNote);
|
|
@@ -6100,7 +6643,7 @@ function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
|
6100
6643
|
throw cause;
|
|
6101
6644
|
}
|
|
6102
6645
|
}, [note, onSaveError, onSaved, updateNote]);
|
|
6103
|
-
|
|
6646
|
+
useEffect12(() => {
|
|
6104
6647
|
if (!isDirty || debounceMs <= 0 || lastSavedNoteRef.current === note) return;
|
|
6105
6648
|
const timer = window.setTimeout(() => void save().catch(() => void 0), debounceMs);
|
|
6106
6649
|
return () => window.clearTimeout(timer);
|
|
@@ -6135,7 +6678,7 @@ function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
|
6135
6678
|
}
|
|
6136
6679
|
|
|
6137
6680
|
// src/features/editor/KeepNoteEditor.tsx
|
|
6138
|
-
import { Fragment as Fragment14, jsx as
|
|
6681
|
+
import { Fragment as Fragment14, jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6139
6682
|
function KeepNoteEditor({
|
|
6140
6683
|
item,
|
|
6141
6684
|
label,
|
|
@@ -6158,10 +6701,10 @@ function KeepNoteEditor({
|
|
|
6158
6701
|
const saveAccessibleLabel = useUiLabel("saveNote");
|
|
6159
6702
|
const { error, isDirty, isSaving, note, setNote } = view.state;
|
|
6160
6703
|
const contentChildren = asChild && isValidElement7(children) ? void 0 : children;
|
|
6161
|
-
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */
|
|
6162
|
-
/* @__PURE__ */
|
|
6704
|
+
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */ jsxs23(Fragment14, { children: [
|
|
6705
|
+
/* @__PURE__ */ jsxs23("label", { children: [
|
|
6163
6706
|
showNoteLabel ? label ?? view.labels.note : null,
|
|
6164
|
-
/* @__PURE__ */
|
|
6707
|
+
/* @__PURE__ */ jsx28(
|
|
6165
6708
|
"textarea",
|
|
6166
6709
|
{
|
|
6167
6710
|
"data-keep-action": "edit-note",
|
|
@@ -6174,7 +6717,7 @@ function KeepNoteEditor({
|
|
|
6174
6717
|
}
|
|
6175
6718
|
)
|
|
6176
6719
|
] }),
|
|
6177
|
-
/* @__PURE__ */
|
|
6720
|
+
/* @__PURE__ */ jsxs23(
|
|
6178
6721
|
"button",
|
|
6179
6722
|
{
|
|
6180
6723
|
type: "submit",
|
|
@@ -6184,13 +6727,13 @@ function KeepNoteEditor({
|
|
|
6184
6727
|
"aria-label": showSaveLabel ? void 0 : saveAccessibleLabel,
|
|
6185
6728
|
children: [
|
|
6186
6729
|
showSaveLabel ? saveLabel ?? view.labels.save : null,
|
|
6187
|
-
showShortcutHint ? /* @__PURE__ */
|
|
6730
|
+
showShortcutHint ? /* @__PURE__ */ jsx28(KeepShortcutHint, { shortcut: "Ctrl+Enter" }) : null
|
|
6188
6731
|
]
|
|
6189
6732
|
}
|
|
6190
6733
|
)
|
|
6191
6734
|
] });
|
|
6192
6735
|
if (!asChild) {
|
|
6193
|
-
return /* @__PURE__ */
|
|
6736
|
+
return /* @__PURE__ */ jsxs23(
|
|
6194
6737
|
"form",
|
|
6195
6738
|
{
|
|
6196
6739
|
...formProps,
|
|
@@ -6203,7 +6746,7 @@ function KeepNoteEditor({
|
|
|
6203
6746
|
"data-disabled": isSaving ? "true" : void 0,
|
|
6204
6747
|
children: [
|
|
6205
6748
|
body,
|
|
6206
|
-
error ? /* @__PURE__ */
|
|
6749
|
+
error ? /* @__PURE__ */ jsx28("p", { role: "alert", children: getErrorMessage(error, view.labels.error) }) : null
|
|
6207
6750
|
]
|
|
6208
6751
|
}
|
|
6209
6752
|
);
|
|
@@ -6228,13 +6771,13 @@ function KeepNoteEditor({
|
|
|
6228
6771
|
|
|
6229
6772
|
// src/features/editor/hooks/useKeepTagEditor.ts
|
|
6230
6773
|
import { useKeepItem as useKeepItem7 } from "@keepkit/core/react";
|
|
6231
|
-
import { useCallback as
|
|
6774
|
+
import { useCallback as useCallback10, useEffect as useEffect13, useState as useState20 } from "react";
|
|
6232
6775
|
function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
6233
6776
|
const itemState = useKeepItem7(item);
|
|
6234
|
-
const [tags, setTags] =
|
|
6235
|
-
const [input, setInput] =
|
|
6236
|
-
|
|
6237
|
-
const save =
|
|
6777
|
+
const [tags, setTags] = useState20(item.tags ?? []);
|
|
6778
|
+
const [input, setInput] = useState20("");
|
|
6779
|
+
useEffect13(() => setTags(itemState.item?.tags ?? item.tags ?? []), [item.tags, itemState.item?.tags]);
|
|
6780
|
+
const save = useCallback10(async () => {
|
|
6238
6781
|
const nextTags = normalizeUiTags(tags);
|
|
6239
6782
|
try {
|
|
6240
6783
|
await itemState.updateTags(nextTags);
|
|
@@ -6280,7 +6823,7 @@ function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
|
6280
6823
|
}
|
|
6281
6824
|
|
|
6282
6825
|
// src/features/editor/KeepTagEditor.tsx
|
|
6283
|
-
import { Fragment as Fragment15, jsx as
|
|
6826
|
+
import { Fragment as Fragment15, jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6284
6827
|
function KeepTagEditor({
|
|
6285
6828
|
item,
|
|
6286
6829
|
availableTags = [],
|
|
@@ -6295,10 +6838,10 @@ function KeepTagEditor({
|
|
|
6295
6838
|
const showRemoveLabel = useUiLabelVisibility("remove");
|
|
6296
6839
|
const showApplyLabel = useUiLabelVisibility("applyTags");
|
|
6297
6840
|
const { isSaving, tags } = view.state;
|
|
6298
|
-
const body = render ? render(view.state) : /* @__PURE__ */
|
|
6299
|
-
/* @__PURE__ */
|
|
6841
|
+
const body = render ? render(view.state) : /* @__PURE__ */ jsxs24(Fragment15, { children: [
|
|
6842
|
+
/* @__PURE__ */ jsxs24("label", { children: [
|
|
6300
6843
|
showTagsLabel ? view.labels.tags : null,
|
|
6301
|
-
/* @__PURE__ */
|
|
6844
|
+
/* @__PURE__ */ jsx29(
|
|
6302
6845
|
"input",
|
|
6303
6846
|
{
|
|
6304
6847
|
"data-keep-action": "edit-tags",
|
|
@@ -6310,10 +6853,10 @@ function KeepTagEditor({
|
|
|
6310
6853
|
}
|
|
6311
6854
|
)
|
|
6312
6855
|
] }),
|
|
6313
|
-
availableTags.length > 0 ? /* @__PURE__ */
|
|
6314
|
-
/* @__PURE__ */
|
|
6856
|
+
availableTags.length > 0 ? /* @__PURE__ */ jsx29("datalist", { id: `keep-tags-${item.id}`, children: availableTags.map((tag) => /* @__PURE__ */ jsx29("option", { value: tag }, tag)) }) : null,
|
|
6857
|
+
/* @__PURE__ */ jsx29("ul", { "aria-label": view.labels.tags, children: tags.map((tag) => /* @__PURE__ */ jsxs24("li", { children: [
|
|
6315
6858
|
tag,
|
|
6316
|
-
/* @__PURE__ */
|
|
6859
|
+
/* @__PURE__ */ jsx29(
|
|
6317
6860
|
"button",
|
|
6318
6861
|
{
|
|
6319
6862
|
type: "button",
|
|
@@ -6324,7 +6867,7 @@ function KeepTagEditor({
|
|
|
6324
6867
|
}
|
|
6325
6868
|
)
|
|
6326
6869
|
] }, tag)) }),
|
|
6327
|
-
/* @__PURE__ */
|
|
6870
|
+
/* @__PURE__ */ jsx29(
|
|
6328
6871
|
"button",
|
|
6329
6872
|
{
|
|
6330
6873
|
type: "submit",
|
|
@@ -6336,7 +6879,7 @@ function KeepTagEditor({
|
|
|
6336
6879
|
}
|
|
6337
6880
|
)
|
|
6338
6881
|
] });
|
|
6339
|
-
return /* @__PURE__ */
|
|
6882
|
+
return /* @__PURE__ */ jsxs24(
|
|
6340
6883
|
"form",
|
|
6341
6884
|
{
|
|
6342
6885
|
...props,
|
|
@@ -6348,16 +6891,16 @@ function KeepTagEditor({
|
|
|
6348
6891
|
"data-disabled": isSaving ? "true" : void 0,
|
|
6349
6892
|
children: [
|
|
6350
6893
|
body,
|
|
6351
|
-
view.error ? /* @__PURE__ */
|
|
6894
|
+
view.error ? /* @__PURE__ */ jsx29("p", { role: "alert", children: getErrorMessage(view.error, view.labels.error) }) : null
|
|
6352
6895
|
]
|
|
6353
6896
|
}
|
|
6354
6897
|
);
|
|
6355
6898
|
}
|
|
6356
6899
|
|
|
6357
6900
|
// src/features/feedback/useKeepToastFeedback.ts
|
|
6358
|
-
import { useCallback as
|
|
6901
|
+
import { useCallback as useCallback11 } from "react";
|
|
6359
6902
|
function useKeepToastFeedback(showToast) {
|
|
6360
|
-
return
|
|
6903
|
+
return useCallback11(
|
|
6361
6904
|
(event) => {
|
|
6362
6905
|
if (!("undo" in event)) {
|
|
6363
6906
|
showToast(event.message);
|
|
@@ -6376,7 +6919,7 @@ function useKeepToastFeedback(showToast) {
|
|
|
6376
6919
|
|
|
6377
6920
|
// src/features/navigation/KeepFloatingTour.tsx
|
|
6378
6921
|
import { useKeepList as useKeepList6 } from "@keepkit/core/react";
|
|
6379
|
-
import { useEffect as
|
|
6922
|
+
import { useEffect as useEffect16, useMemo as useMemo7, useRef as useRef11, useState as useState22 } from "react";
|
|
6380
6923
|
import { createPortal } from "react-dom";
|
|
6381
6924
|
|
|
6382
6925
|
// src/foundation/theme.tsx
|
|
@@ -6385,7 +6928,7 @@ import {
|
|
|
6385
6928
|
isValidElement as isValidElement8,
|
|
6386
6929
|
useContext as useContext4
|
|
6387
6930
|
} from "react";
|
|
6388
|
-
import { jsx as
|
|
6931
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
6389
6932
|
var keepThemeNames = [
|
|
6390
6933
|
"default",
|
|
6391
6934
|
"ocean",
|
|
@@ -6447,8 +6990,8 @@ function KeepThemeProvider({
|
|
|
6447
6990
|
if (!isValidElement8(children))
|
|
6448
6991
|
throw new Error("KeepThemeProvider with asChild requires a single React element child.");
|
|
6449
6992
|
return createSlot(children, rootProps);
|
|
6450
|
-
})() : /* @__PURE__ */
|
|
6451
|
-
return /* @__PURE__ */
|
|
6993
|
+
})() : /* @__PURE__ */ jsx30("div", { ...rootProps, children });
|
|
6994
|
+
return /* @__PURE__ */ jsx30(
|
|
6452
6995
|
KeepThemeContext.Provider,
|
|
6453
6996
|
{
|
|
6454
6997
|
value: { theme, mode, density, radius, accentColor, highContrast, reducedMotion, variables, style },
|
|
@@ -6462,7 +7005,7 @@ import { useKeepNavigator } from "@keepkit/core/react";
|
|
|
6462
7005
|
import { useId as useId6 } from "react";
|
|
6463
7006
|
|
|
6464
7007
|
// src/features/navigation/hooks/useKeepTourShortcuts.ts
|
|
6465
|
-
import { useEffect as
|
|
7008
|
+
import { useEffect as useEffect14 } from "react";
|
|
6466
7009
|
function useKeepTourShortcuts({
|
|
6467
7010
|
onNext,
|
|
6468
7011
|
onPrev,
|
|
@@ -6473,7 +7016,7 @@ function useKeepTourShortcuts({
|
|
|
6473
7016
|
prevKeys = ["k", "["],
|
|
6474
7017
|
onError
|
|
6475
7018
|
}) {
|
|
6476
|
-
|
|
7019
|
+
useEffect14(() => {
|
|
6477
7020
|
if (!enabled) return;
|
|
6478
7021
|
const handleKeyDown = (event) => {
|
|
6479
7022
|
if (!allowInEditable && isEditableTarget(event.target)) return;
|
|
@@ -6494,7 +7037,7 @@ function isEditableTarget(target) {
|
|
|
6494
7037
|
}
|
|
6495
7038
|
|
|
6496
7039
|
// src/features/navigation/KeepTourBar.tsx
|
|
6497
|
-
import { Fragment as Fragment16, jsx as
|
|
7040
|
+
import { Fragment as Fragment16, jsx as jsx31, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6498
7041
|
function KeepTourBar({
|
|
6499
7042
|
navigation: providedNavigation,
|
|
6500
7043
|
currentId,
|
|
@@ -6564,9 +7107,9 @@ function KeepTourBar({
|
|
|
6564
7107
|
return resolvedPrev();
|
|
6565
7108
|
}
|
|
6566
7109
|
});
|
|
6567
|
-
const body = /* @__PURE__ */
|
|
6568
|
-
showProgress ? /* @__PURE__ */
|
|
6569
|
-
/* @__PURE__ */
|
|
7110
|
+
const body = /* @__PURE__ */ jsxs25(Fragment16, { children: [
|
|
7111
|
+
showProgress ? /* @__PURE__ */ jsx31("span", { "data-keepkit": "tour-progress", "aria-live": "polite", children: progress ?? `${navigation.currentPosition ?? 0} / ${navigation.items.length}` }) : null,
|
|
7112
|
+
/* @__PURE__ */ jsx31(
|
|
6570
7113
|
TourAction,
|
|
6571
7114
|
{
|
|
6572
7115
|
href: resolvedPrevHref,
|
|
@@ -6574,7 +7117,7 @@ function KeepTourBar({
|
|
|
6574
7117
|
onClick: resolvedPrevHref ? notifyPrevNavigation : resolvedPrev,
|
|
6575
7118
|
"data-keep-action": "tour-prev",
|
|
6576
7119
|
shortcut: showShortcutHint ? shortcutOptions?.prevKeys?.[0] ?? "K" : void 0,
|
|
6577
|
-
preview: navigation.prevItem ? /* @__PURE__ */
|
|
7120
|
+
preview: navigation.prevItem ? /* @__PURE__ */ jsxs25(Fragment16, { children: [
|
|
6578
7121
|
previousLabel,
|
|
6579
7122
|
": ",
|
|
6580
7123
|
getItemTitle(navigation.prevItem)
|
|
@@ -6582,7 +7125,7 @@ function KeepTourBar({
|
|
|
6582
7125
|
children: previousLabel
|
|
6583
7126
|
}
|
|
6584
7127
|
),
|
|
6585
|
-
/* @__PURE__ */
|
|
7128
|
+
/* @__PURE__ */ jsx31(
|
|
6586
7129
|
TourAction,
|
|
6587
7130
|
{
|
|
6588
7131
|
href: resolvedNextHref,
|
|
@@ -6590,7 +7133,7 @@ function KeepTourBar({
|
|
|
6590
7133
|
onClick: resolvedNextHref ? notifyNextNavigation : resolvedNext,
|
|
6591
7134
|
"data-keep-action": "tour-next",
|
|
6592
7135
|
shortcut: showShortcutHint ? shortcutOptions?.nextKeys?.[0] ?? "J" : void 0,
|
|
6593
|
-
preview: navigation.nextItem ? /* @__PURE__ */
|
|
7136
|
+
preview: navigation.nextItem ? /* @__PURE__ */ jsxs25(Fragment16, { children: [
|
|
6594
7137
|
nextItemLabel,
|
|
6595
7138
|
": ",
|
|
6596
7139
|
getItemTitle(navigation.nextItem)
|
|
@@ -6598,7 +7141,7 @@ function KeepTourBar({
|
|
|
6598
7141
|
children: nextItemLabel
|
|
6599
7142
|
}
|
|
6600
7143
|
),
|
|
6601
|
-
resolvedBackHref || onBack ? /* @__PURE__ */
|
|
7144
|
+
resolvedBackHref || onBack ? /* @__PURE__ */ jsx31(TourAction, { href: resolvedBackHref, onClick: onBack, "data-keep-action": "tour-back", children: listLabel }) : null
|
|
6602
7145
|
] });
|
|
6603
7146
|
return renderRoot(
|
|
6604
7147
|
asChild,
|
|
@@ -6610,13 +7153,13 @@ function KeepTourBar({
|
|
|
6610
7153
|
}
|
|
6611
7154
|
function TourAction({ href, disabled = false, onClick, children, preview, shortcut, ...props }) {
|
|
6612
7155
|
const previewId = useId6();
|
|
6613
|
-
const content = /* @__PURE__ */
|
|
6614
|
-
/* @__PURE__ */
|
|
6615
|
-
shortcut ? /* @__PURE__ */
|
|
6616
|
-
preview ? /* @__PURE__ */
|
|
7156
|
+
const content = /* @__PURE__ */ jsxs25(Fragment16, { children: [
|
|
7157
|
+
/* @__PURE__ */ jsx31("span", { "data-tour-label": "true", children }),
|
|
7158
|
+
shortcut ? /* @__PURE__ */ jsx31(KeepShortcutHint, { shortcut }) : null,
|
|
7159
|
+
preview ? /* @__PURE__ */ jsx31("small", { id: previewId, "data-tour-preview": "true", children: preview }) : null
|
|
6617
7160
|
] });
|
|
6618
7161
|
if (href && !disabled) {
|
|
6619
|
-
return /* @__PURE__ */
|
|
7162
|
+
return /* @__PURE__ */ jsx31(
|
|
6620
7163
|
"a",
|
|
6621
7164
|
{
|
|
6622
7165
|
...props,
|
|
@@ -6628,7 +7171,7 @@ function TourAction({ href, disabled = false, onClick, children, preview, shortc
|
|
|
6628
7171
|
}
|
|
6629
7172
|
);
|
|
6630
7173
|
}
|
|
6631
|
-
return /* @__PURE__ */
|
|
7174
|
+
return /* @__PURE__ */ jsx31(
|
|
6632
7175
|
"button",
|
|
6633
7176
|
{
|
|
6634
7177
|
...props,
|
|
@@ -6649,8 +7192,8 @@ function navigateTo(item, href) {
|
|
|
6649
7192
|
|
|
6650
7193
|
// src/features/navigation/tour-context.tsx
|
|
6651
7194
|
import { useKeepList as useKeepList5 } from "@keepkit/core/react";
|
|
6652
|
-
import { createContext as createContext5, useCallback as
|
|
6653
|
-
import { jsx as
|
|
7195
|
+
import { createContext as createContext5, useCallback as useCallback12, useContext as useContext5, useEffect as useEffect15, useMemo as useMemo6, useState as useState21 } from "react";
|
|
7196
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
6654
7197
|
var SESSION_VERSION = 1;
|
|
6655
7198
|
var KeepTourContext = createContext5(null);
|
|
6656
7199
|
function KeepTourProvider({
|
|
@@ -6661,12 +7204,12 @@ function KeepTourProvider({
|
|
|
6661
7204
|
onNavigate
|
|
6662
7205
|
}) {
|
|
6663
7206
|
const list = useKeepList5();
|
|
6664
|
-
const [tour, setTour] =
|
|
7207
|
+
const [tour, setTour] = useState21(
|
|
6665
7208
|
null
|
|
6666
7209
|
);
|
|
6667
|
-
const [persistenceStatus, setPersistenceStatus] =
|
|
6668
|
-
const itemsById =
|
|
6669
|
-
const readStorage =
|
|
7210
|
+
const [persistenceStatus, setPersistenceStatus] = useState21("persistent");
|
|
7211
|
+
const itemsById = useMemo6(() => new Map(list.items.map((item) => [item.id, item])), [list.items]);
|
|
7212
|
+
const readStorage = useCallback12(() => {
|
|
6670
7213
|
try {
|
|
6671
7214
|
const raw = window.sessionStorage.getItem(sessionKey);
|
|
6672
7215
|
if (!raw) return null;
|
|
@@ -6688,7 +7231,7 @@ function KeepTourProvider({
|
|
|
6688
7231
|
return null;
|
|
6689
7232
|
}
|
|
6690
7233
|
}, [sessionKey]);
|
|
6691
|
-
const writeStorage =
|
|
7234
|
+
const writeStorage = useCallback12(
|
|
6692
7235
|
(value2) => {
|
|
6693
7236
|
try {
|
|
6694
7237
|
if (value2) window.sessionStorage.setItem(sessionKey, JSON.stringify({ version: SESSION_VERSION, ...value2 }));
|
|
@@ -6700,7 +7243,7 @@ function KeepTourProvider({
|
|
|
6700
7243
|
},
|
|
6701
7244
|
[sessionKey]
|
|
6702
7245
|
);
|
|
6703
|
-
|
|
7246
|
+
useEffect15(() => {
|
|
6704
7247
|
if (!list.isHydrated || list.error || tour) return;
|
|
6705
7248
|
const stored = typeof window === "undefined" ? null : readStorage();
|
|
6706
7249
|
if (!stored) return;
|
|
@@ -6712,7 +7255,7 @@ function KeepTourProvider({
|
|
|
6712
7255
|
const currentId = ids.includes(stored.currentId) ? stored.currentId : ids[0];
|
|
6713
7256
|
setTour({ itemIds: ids, currentId, collapsed: stored.collapsed });
|
|
6714
7257
|
}, [itemsById, list.error, list.isHydrated, readStorage, tour, writeStorage]);
|
|
6715
|
-
|
|
7258
|
+
useEffect15(() => {
|
|
6716
7259
|
if (!tour || list.isLoading || list.error) return;
|
|
6717
7260
|
const ids = tour.itemIds.filter((id) => itemsById.has(id));
|
|
6718
7261
|
if (!ids.length) {
|
|
@@ -6727,7 +7270,7 @@ function KeepTourProvider({
|
|
|
6727
7270
|
writeStorage(next);
|
|
6728
7271
|
}
|
|
6729
7272
|
}, [itemsById, list.error, list.isLoading, tour, writeStorage]);
|
|
6730
|
-
const start =
|
|
7273
|
+
const start = useCallback12(
|
|
6731
7274
|
(options) => {
|
|
6732
7275
|
const ids = [...options.itemIds];
|
|
6733
7276
|
if (!ids.length || new Set(ids).size !== ids.length || ids.some((id) => !itemsById.has(id))) return false;
|
|
@@ -6740,11 +7283,11 @@ function KeepTourProvider({
|
|
|
6740
7283
|
},
|
|
6741
7284
|
[itemsById, writeStorage]
|
|
6742
7285
|
);
|
|
6743
|
-
const end =
|
|
7286
|
+
const end = useCallback12(() => {
|
|
6744
7287
|
setTour(null);
|
|
6745
7288
|
writeStorage(null);
|
|
6746
7289
|
}, [writeStorage]);
|
|
6747
|
-
const setCurrentId =
|
|
7290
|
+
const setCurrentId = useCallback12(
|
|
6748
7291
|
(id) => {
|
|
6749
7292
|
setTour((current) => {
|
|
6750
7293
|
if (!current?.currentId || current.currentId === id || !current.itemIds.includes(id)) return current;
|
|
@@ -6755,7 +7298,7 @@ function KeepTourProvider({
|
|
|
6755
7298
|
},
|
|
6756
7299
|
[writeStorage]
|
|
6757
7300
|
);
|
|
6758
|
-
const move =
|
|
7301
|
+
const move = useCallback12(
|
|
6759
7302
|
(delta) => {
|
|
6760
7303
|
if (!tour?.currentId) return null;
|
|
6761
7304
|
const currentId = tour.currentId;
|
|
@@ -6767,7 +7310,7 @@ function KeepTourProvider({
|
|
|
6767
7310
|
},
|
|
6768
7311
|
[itemsById, setCurrentId, tour]
|
|
6769
7312
|
);
|
|
6770
|
-
const value =
|
|
7313
|
+
const value = useMemo6(
|
|
6771
7314
|
() => ({
|
|
6772
7315
|
active: tour !== null,
|
|
6773
7316
|
itemIds: tour?.itemIds ?? [],
|
|
@@ -6787,23 +7330,23 @@ function KeepTourProvider({
|
|
|
6787
7330
|
}),
|
|
6788
7331
|
[end, getBackHref, getItemHref, move, onNavigate, persistenceStatus, setCurrentId, start, tour]
|
|
6789
7332
|
);
|
|
6790
|
-
|
|
7333
|
+
useEffect15(() => {
|
|
6791
7334
|
if (!tour) return;
|
|
6792
7335
|
if (tour.currentId) writeStorage(tour);
|
|
6793
7336
|
}, [tour, writeStorage]);
|
|
6794
|
-
return /* @__PURE__ */
|
|
7337
|
+
return /* @__PURE__ */ jsx32(KeepTourContext.Provider, { value, children });
|
|
6795
7338
|
}
|
|
6796
7339
|
function useKeepTour(options = {}) {
|
|
6797
7340
|
const context = useContext5(KeepTourContext);
|
|
6798
7341
|
if (!context) throw new Error("useKeepTour must be used within KeepTourProvider.");
|
|
6799
|
-
|
|
7342
|
+
useEffect15(() => {
|
|
6800
7343
|
if (options.currentId && context.active) context.setCurrentId(options.currentId);
|
|
6801
7344
|
}, [context, options.currentId]);
|
|
6802
7345
|
return context;
|
|
6803
7346
|
}
|
|
6804
7347
|
|
|
6805
7348
|
// src/features/navigation/KeepFloatingTour.tsx
|
|
6806
|
-
import { Fragment as Fragment17, jsx as
|
|
7349
|
+
import { Fragment as Fragment17, jsx as jsx33, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6807
7350
|
function KeepFloatingTour({
|
|
6808
7351
|
currentId,
|
|
6809
7352
|
getItemHref,
|
|
@@ -6821,21 +7364,21 @@ function KeepFloatingTour({
|
|
|
6821
7364
|
const tour = useKeepTour({ currentId });
|
|
6822
7365
|
const { items } = useKeepList6();
|
|
6823
7366
|
const theme = useKeepTheme();
|
|
6824
|
-
const [mounted, setMounted] =
|
|
7367
|
+
const [mounted, setMounted] = useState22(false);
|
|
6825
7368
|
const { labels } = useKeepUiLabels();
|
|
6826
7369
|
const collapseLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u6298\u308A\u305F\u305F\u3080" : "Collapse tour";
|
|
6827
7370
|
const expandLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u5C55\u958B" : "Expand tour";
|
|
6828
7371
|
const endLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u7D42\u4E86" : "End tour";
|
|
6829
7372
|
const expandRef = useRef11(null);
|
|
6830
7373
|
const collapseRef = useRef11(null);
|
|
6831
|
-
|
|
6832
|
-
|
|
7374
|
+
useEffect16(() => setMounted(true), []);
|
|
7375
|
+
useEffect16(() => {
|
|
6833
7376
|
if (!mounted || !tour.active) return;
|
|
6834
7377
|
const button = tour.collapsed ? expandRef.current : collapseRef.current;
|
|
6835
7378
|
if (button) button.focus();
|
|
6836
7379
|
}, [mounted, tour.active, tour.collapsed]);
|
|
6837
7380
|
const activeId = currentId ?? tour.currentId;
|
|
6838
|
-
const navigation =
|
|
7381
|
+
const navigation = useMemo7(() => {
|
|
6839
7382
|
const tourItems = tour.itemIds.map((id) => items.find((item) => item.id === id)).filter((item) => item !== void 0);
|
|
6840
7383
|
const currentIndex = activeId ? tourItems.findIndex((item) => item.id === activeId) : -1;
|
|
6841
7384
|
const currentItem = currentIndex >= 0 ? tourItems[currentIndex] ?? null : null;
|
|
@@ -6865,7 +7408,7 @@ function KeepFloatingTour({
|
|
|
6865
7408
|
"--keep-tour-z-index": zIndex,
|
|
6866
7409
|
...style
|
|
6867
7410
|
};
|
|
6868
|
-
const content = tour.collapsed ? /* @__PURE__ */
|
|
7411
|
+
const content = tour.collapsed ? /* @__PURE__ */ jsxs26(
|
|
6869
7412
|
"button",
|
|
6870
7413
|
{
|
|
6871
7414
|
ref: expandRef,
|
|
@@ -6880,8 +7423,8 @@ function KeepFloatingTour({
|
|
|
6880
7423
|
tour.itemIds.length
|
|
6881
7424
|
]
|
|
6882
7425
|
}
|
|
6883
|
-
) : /* @__PURE__ */
|
|
6884
|
-
/* @__PURE__ */
|
|
7426
|
+
) : /* @__PURE__ */ jsxs26(Fragment17, { children: [
|
|
7427
|
+
/* @__PURE__ */ jsx33(
|
|
6885
7428
|
KeepTourBar,
|
|
6886
7429
|
{
|
|
6887
7430
|
className: "keep-floating-tour__bar",
|
|
@@ -6898,7 +7441,7 @@ function KeepFloatingTour({
|
|
|
6898
7441
|
showShortcutHint
|
|
6899
7442
|
}
|
|
6900
7443
|
),
|
|
6901
|
-
/* @__PURE__ */
|
|
7444
|
+
/* @__PURE__ */ jsx33(
|
|
6902
7445
|
"button",
|
|
6903
7446
|
{
|
|
6904
7447
|
ref: collapseRef,
|
|
@@ -6910,7 +7453,7 @@ function KeepFloatingTour({
|
|
|
6910
7453
|
children: "\u2212"
|
|
6911
7454
|
}
|
|
6912
7455
|
),
|
|
6913
|
-
/* @__PURE__ */
|
|
7456
|
+
/* @__PURE__ */ jsx33(
|
|
6914
7457
|
"button",
|
|
6915
7458
|
{
|
|
6916
7459
|
type: "button",
|
|
@@ -6923,7 +7466,7 @@ function KeepFloatingTour({
|
|
|
6923
7466
|
)
|
|
6924
7467
|
] });
|
|
6925
7468
|
return createPortal(
|
|
6926
|
-
/* @__PURE__ */
|
|
7469
|
+
/* @__PURE__ */ jsx33(KeepThemeProvider, { ...theme, children: /* @__PURE__ */ jsx33(
|
|
6927
7470
|
"aside",
|
|
6928
7471
|
{
|
|
6929
7472
|
className: ["keep-floating-tour", `keep-floating-tour--${position}`, className].filter(Boolean).join(" "),
|
|
@@ -6941,8 +7484,8 @@ function KeepFloatingTour({
|
|
|
6941
7484
|
|
|
6942
7485
|
// src/features/rediscovery/KeepRediscovery.tsx
|
|
6943
7486
|
import { createRediscoveryQuery } from "@keepkit/core/core";
|
|
6944
|
-
import { useMemo as
|
|
6945
|
-
import { jsx as
|
|
7487
|
+
import { useId as useId7, useMemo as useMemo8 } from "react";
|
|
7488
|
+
import { jsx as jsx34, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6946
7489
|
function KeepRediscovery({
|
|
6947
7490
|
strategy,
|
|
6948
7491
|
inactiveForMs,
|
|
@@ -6950,14 +7493,46 @@ function KeepRediscovery({
|
|
|
6950
7493
|
itemCardProps,
|
|
6951
7494
|
...props
|
|
6952
7495
|
}) {
|
|
6953
|
-
const query =
|
|
7496
|
+
const query = useMemo8(
|
|
6954
7497
|
() => ({
|
|
6955
7498
|
...createRediscoveryQuery({ strategy, inactiveForMs }),
|
|
6956
7499
|
pagination: { page: 1, pageSize: Math.max(1, limit) }
|
|
6957
7500
|
}),
|
|
6958
7501
|
[inactiveForMs, limit, strategy]
|
|
6959
7502
|
);
|
|
6960
|
-
return /* @__PURE__ */
|
|
7503
|
+
return /* @__PURE__ */ jsx34(
|
|
7504
|
+
KeepList,
|
|
7505
|
+
{
|
|
7506
|
+
...props,
|
|
7507
|
+
query,
|
|
7508
|
+
itemCardProps: {
|
|
7509
|
+
trackOpen: true,
|
|
7510
|
+
showActivity: true,
|
|
7511
|
+
activityKind: strategy === "recently-opened" ? "opened" : "inactive",
|
|
7512
|
+
...itemCardProps
|
|
7513
|
+
}
|
|
7514
|
+
}
|
|
7515
|
+
);
|
|
7516
|
+
}
|
|
7517
|
+
function KeepRediscoveryPanel({
|
|
7518
|
+
title,
|
|
7519
|
+
description,
|
|
7520
|
+
strategy,
|
|
7521
|
+
...props
|
|
7522
|
+
}) {
|
|
7523
|
+
const headingId = useId7();
|
|
7524
|
+
const { className, ...rediscoveryProps } = props;
|
|
7525
|
+
const neverOpenedLabel = useUiLabel("activityNeverOpened");
|
|
7526
|
+
const inactiveLabel = useUiLabel("activityInactiveFor");
|
|
7527
|
+
const openedLabel = useUiLabel("activityOpened");
|
|
7528
|
+
const strategyLabel = strategy === "never-opened" ? neverOpenedLabel : strategy === "forgotten" ? inactiveLabel : openedLabel;
|
|
7529
|
+
return /* @__PURE__ */ jsxs27("section", { className, "data-keepkit": "rediscovery-panel", "aria-labelledby": headingId, children: [
|
|
7530
|
+
/* @__PURE__ */ jsxs27("header", { children: [
|
|
7531
|
+
/* @__PURE__ */ jsx34("h2", { id: headingId, children: title ?? strategyLabel }),
|
|
7532
|
+
/* @__PURE__ */ jsx34("p", { children: description ?? strategyLabel })
|
|
7533
|
+
] }),
|
|
7534
|
+
/* @__PURE__ */ jsx34(KeepRediscovery, { ...rediscoveryProps, strategy })
|
|
7535
|
+
] });
|
|
6961
7536
|
}
|
|
6962
7537
|
|
|
6963
7538
|
// src/features/status/status.tsx
|
|
@@ -6965,7 +7540,7 @@ import { isValidElement as isValidElement9 } from "react";
|
|
|
6965
7540
|
|
|
6966
7541
|
// src/features/status/hooks/useStatusViews.ts
|
|
6967
7542
|
import { useKeepContext as useKeepContext7 } from "@keepkit/core/react";
|
|
6968
|
-
import { useEffect as
|
|
7543
|
+
import { useEffect as useEffect17, useRef as useRef12, useState as useState23 } from "react";
|
|
6969
7544
|
function useKeepStatus(status) {
|
|
6970
7545
|
const context = useKeepContext7();
|
|
6971
7546
|
const resolvedStatus = status ?? getDerivedStatus(context);
|
|
@@ -6982,9 +7557,9 @@ function useKeepAnnouncements(messages) {
|
|
|
6982
7557
|
const savedMessage = useUiLabel("savedMessage", messages?.save);
|
|
6983
7558
|
const removedMessage = useUiLabel("removedMessage", messages?.remove);
|
|
6984
7559
|
const noteSavedMessage = useUiLabel("noteSavedMessage", messages?.note);
|
|
6985
|
-
const [message, setMessage] =
|
|
7560
|
+
const [message, setMessage] = useState23("");
|
|
6986
7561
|
const lastChangeRef = useRef12(void 0);
|
|
6987
|
-
|
|
7562
|
+
useEffect17(() => {
|
|
6988
7563
|
const change = context.lastChange;
|
|
6989
7564
|
if (!change || change === lastChangeRef.current) return;
|
|
6990
7565
|
lastChangeRef.current = change;
|
|
@@ -7012,7 +7587,7 @@ function getStatusLabelKey3(status) {
|
|
|
7012
7587
|
}
|
|
7013
7588
|
|
|
7014
7589
|
// src/features/status/status.tsx
|
|
7015
|
-
import { jsx as
|
|
7590
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
7016
7591
|
function KeepStatus({
|
|
7017
7592
|
status,
|
|
7018
7593
|
labels,
|
|
@@ -7044,7 +7619,7 @@ function KeepStatus({
|
|
|
7044
7619
|
}
|
|
7045
7620
|
function KeepAnnouncements({ messages, ...props }) {
|
|
7046
7621
|
const message = useKeepAnnouncements(messages);
|
|
7047
|
-
return /* @__PURE__ */
|
|
7622
|
+
return /* @__PURE__ */ jsx35(
|
|
7048
7623
|
"div",
|
|
7049
7624
|
{
|
|
7050
7625
|
...props,
|
|
@@ -7061,14 +7636,14 @@ var KeepAnnouncer = KeepAnnouncements;
|
|
|
7061
7636
|
|
|
7062
7637
|
// src/features/sync/hooks/useKeepSyncFeedback.ts
|
|
7063
7638
|
import { useKeepContext as useKeepContext8 } from "@keepkit/core/react";
|
|
7064
|
-
import { useEffect as
|
|
7639
|
+
import { useEffect as useEffect18, useRef as useRef13 } from "react";
|
|
7065
7640
|
function useKeepSyncFeedback() {
|
|
7066
7641
|
const { syncState } = useKeepContext8();
|
|
7067
7642
|
const emitFeedback = useKeepUiFeedback();
|
|
7068
7643
|
const completedMessage = useUiLabel("syncSynced");
|
|
7069
7644
|
const failedMessage = useUiLabel("syncFailedMessage");
|
|
7070
7645
|
const previousStatus = useRef13("idle");
|
|
7071
|
-
|
|
7646
|
+
useEffect18(() => {
|
|
7072
7647
|
const previous = previousStatus.current;
|
|
7073
7648
|
previousStatus.current = syncState.status;
|
|
7074
7649
|
if (syncState.status === "error" && previous !== "error") {
|
|
@@ -7089,16 +7664,16 @@ function KeepSyncFeedbackObserver() {
|
|
|
7089
7664
|
|
|
7090
7665
|
// src/features/sync/hooks/useKeepSyncRecoveryDialog.ts
|
|
7091
7666
|
import { useKeepContext as useKeepContext9 } from "@keepkit/core/react";
|
|
7092
|
-
import { useEffect as
|
|
7667
|
+
import { useEffect as useEffect19, useState as useState24 } from "react";
|
|
7093
7668
|
function useKeepSyncRecoveryDialog(options) {
|
|
7094
7669
|
const { open, onOpenChange, conflicts, onManualMerge } = options;
|
|
7095
7670
|
const context = useKeepContext9();
|
|
7096
7671
|
const conflictList = conflicts ?? context.syncState.conflicts ?? [];
|
|
7097
7672
|
const hasRecovery = conflictList.length > 0 || context.syncState.status === "error" || Boolean(context.error);
|
|
7098
|
-
const [dismissed, setDismissed] =
|
|
7099
|
-
const [busyId, setBusyId] =
|
|
7100
|
-
const [error, setError] =
|
|
7101
|
-
|
|
7673
|
+
const [dismissed, setDismissed] = useState24(false);
|
|
7674
|
+
const [busyId, setBusyId] = useState24();
|
|
7675
|
+
const [error, setError] = useState24();
|
|
7676
|
+
useEffect19(() => {
|
|
7102
7677
|
if (hasRecovery) setDismissed(false);
|
|
7103
7678
|
}, [hasRecovery]);
|
|
7104
7679
|
return {
|
|
@@ -7143,7 +7718,7 @@ function useKeepSyncRecoveryDialog(options) {
|
|
|
7143
7718
|
}
|
|
7144
7719
|
|
|
7145
7720
|
// src/features/sync/KeepSyncRecoveryDialog.tsx
|
|
7146
|
-
import { jsx as
|
|
7721
|
+
import { jsx as jsx36, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7147
7722
|
function KeepSyncRecoveryDialog({
|
|
7148
7723
|
open,
|
|
7149
7724
|
onOpenChange,
|
|
@@ -7158,7 +7733,7 @@ function KeepSyncRecoveryDialog({
|
|
|
7158
7733
|
}) {
|
|
7159
7734
|
const view = useKeepSyncRecoveryDialog({ open, onOpenChange, conflicts, onManualMerge });
|
|
7160
7735
|
if (!view.isOpen) return null;
|
|
7161
|
-
return /* @__PURE__ */
|
|
7736
|
+
return /* @__PURE__ */ jsxs28(
|
|
7162
7737
|
"section",
|
|
7163
7738
|
{
|
|
7164
7739
|
...props,
|
|
@@ -7172,17 +7747,17 @@ function KeepSyncRecoveryDialog({
|
|
|
7172
7747
|
"data-state": view.conflictList.length > 0 ? "conflict" : "error",
|
|
7173
7748
|
"data-loading": view.busyId !== void 0 ? "true" : void 0,
|
|
7174
7749
|
children: [
|
|
7175
|
-
/* @__PURE__ */
|
|
7176
|
-
/* @__PURE__ */
|
|
7177
|
-
/* @__PURE__ */
|
|
7750
|
+
/* @__PURE__ */ jsxs28("header", { children: [
|
|
7751
|
+
/* @__PURE__ */ jsx36("h2", { id: "keepkit-sync-recovery-title", children: title ?? view.labels.title }),
|
|
7752
|
+
/* @__PURE__ */ jsx36("button", { type: "button", "data-keep-action": "close-dialog", onClick: view.close, "aria-label": view.labels.close, children: view.labels.close })
|
|
7178
7753
|
] }),
|
|
7179
7754
|
children,
|
|
7180
|
-
view.conflictList.length > 0 ? /* @__PURE__ */
|
|
7181
|
-
/* @__PURE__ */
|
|
7182
|
-
view.conflictList.map((conflict) => /* @__PURE__ */
|
|
7183
|
-
/* @__PURE__ */
|
|
7184
|
-
/* @__PURE__ */
|
|
7185
|
-
/* @__PURE__ */
|
|
7755
|
+
view.conflictList.length > 0 ? /* @__PURE__ */ jsxs28("div", { children: [
|
|
7756
|
+
/* @__PURE__ */ jsx36("p", { children: view.labels.conflict }),
|
|
7757
|
+
view.conflictList.map((conflict) => /* @__PURE__ */ jsxs28("article", { "data-conflict-id": conflict.id, children: [
|
|
7758
|
+
/* @__PURE__ */ jsx36("h3", { children: getMetaTitle(conflict.operation.item?.meta) ?? conflict.id }),
|
|
7759
|
+
/* @__PURE__ */ jsxs28("div", { "data-conflict-preview": true, children: [
|
|
7760
|
+
/* @__PURE__ */ jsx36(
|
|
7186
7761
|
ConflictPreview,
|
|
7187
7762
|
{
|
|
7188
7763
|
item: conflict.operation.item,
|
|
@@ -7192,7 +7767,7 @@ function KeepSyncRecoveryDialog({
|
|
|
7192
7767
|
side: "local"
|
|
7193
7768
|
}
|
|
7194
7769
|
),
|
|
7195
|
-
/* @__PURE__ */
|
|
7770
|
+
/* @__PURE__ */ jsx36(
|
|
7196
7771
|
ConflictPreview,
|
|
7197
7772
|
{
|
|
7198
7773
|
item: conflict.remote,
|
|
@@ -7203,8 +7778,8 @@ function KeepSyncRecoveryDialog({
|
|
|
7203
7778
|
}
|
|
7204
7779
|
)
|
|
7205
7780
|
] }),
|
|
7206
|
-
/* @__PURE__ */
|
|
7207
|
-
/* @__PURE__ */
|
|
7781
|
+
/* @__PURE__ */ jsxs28("div", { children: [
|
|
7782
|
+
/* @__PURE__ */ jsx36(
|
|
7208
7783
|
"button",
|
|
7209
7784
|
{
|
|
7210
7785
|
type: "button",
|
|
@@ -7214,7 +7789,7 @@ function KeepSyncRecoveryDialog({
|
|
|
7214
7789
|
children: view.labels.keepLocal
|
|
7215
7790
|
}
|
|
7216
7791
|
),
|
|
7217
|
-
/* @__PURE__ */
|
|
7792
|
+
/* @__PURE__ */ jsx36(
|
|
7218
7793
|
"button",
|
|
7219
7794
|
{
|
|
7220
7795
|
type: "button",
|
|
@@ -7224,7 +7799,7 @@ function KeepSyncRecoveryDialog({
|
|
|
7224
7799
|
children: view.labels.useServer
|
|
7225
7800
|
}
|
|
7226
7801
|
),
|
|
7227
|
-
/* @__PURE__ */
|
|
7802
|
+
/* @__PURE__ */ jsx36(
|
|
7228
7803
|
"button",
|
|
7229
7804
|
{
|
|
7230
7805
|
type: "button",
|
|
@@ -7237,12 +7812,12 @@ function KeepSyncRecoveryDialog({
|
|
|
7237
7812
|
] })
|
|
7238
7813
|
] }, conflict.id))
|
|
7239
7814
|
] }) : null,
|
|
7240
|
-
view.showBackupRecovery ? /* @__PURE__ */
|
|
7241
|
-
/* @__PURE__ */
|
|
7242
|
-
/* @__PURE__ */
|
|
7243
|
-
backup ?? (showBackupControls ? /* @__PURE__ */
|
|
7815
|
+
view.showBackupRecovery ? /* @__PURE__ */ jsxs28("section", { "data-recovery": "backup", children: [
|
|
7816
|
+
/* @__PURE__ */ jsx36("h3", { children: view.labels.backupRecovery }),
|
|
7817
|
+
/* @__PURE__ */ jsx36("p", { children: view.labels.backupRecoveryDescription }),
|
|
7818
|
+
backup ?? (showBackupControls ? /* @__PURE__ */ jsx36(KeepBackup, {}) : null)
|
|
7244
7819
|
] }) : null,
|
|
7245
|
-
view.error ? /* @__PURE__ */
|
|
7820
|
+
view.error ? /* @__PURE__ */ jsx36("p", { id: "keepkit-sync-recovery-error", role: "alert", "aria-live": "assertive", children: getErrorMessage(view.error, view.labels.error) }) : null
|
|
7246
7821
|
]
|
|
7247
7822
|
}
|
|
7248
7823
|
);
|
|
@@ -7254,16 +7829,16 @@ function ConflictPreview({
|
|
|
7254
7829
|
noteLabel,
|
|
7255
7830
|
side
|
|
7256
7831
|
}) {
|
|
7257
|
-
return /* @__PURE__ */
|
|
7258
|
-
/* @__PURE__ */
|
|
7259
|
-
/* @__PURE__ */
|
|
7260
|
-
/* @__PURE__ */
|
|
7261
|
-
/* @__PURE__ */
|
|
7262
|
-
/* @__PURE__ */
|
|
7832
|
+
return /* @__PURE__ */ jsxs28("article", { "data-conflict-version": side, "aria-label": heading, children: [
|
|
7833
|
+
/* @__PURE__ */ jsx36("h4", { children: heading }),
|
|
7834
|
+
/* @__PURE__ */ jsxs28("dl", { children: [
|
|
7835
|
+
/* @__PURE__ */ jsxs28("div", { children: [
|
|
7836
|
+
/* @__PURE__ */ jsx36("dt", { children: updatedAtLabel }),
|
|
7837
|
+
/* @__PURE__ */ jsx36("dd", { children: item ? /* @__PURE__ */ jsx36("time", { dateTime: new Date(item.updatedAt).toISOString(), children: formatConflictDate(item.updatedAt) }) : "\u2014" })
|
|
7263
7838
|
] }),
|
|
7264
|
-
/* @__PURE__ */
|
|
7265
|
-
/* @__PURE__ */
|
|
7266
|
-
/* @__PURE__ */
|
|
7839
|
+
/* @__PURE__ */ jsxs28("div", { children: [
|
|
7840
|
+
/* @__PURE__ */ jsx36("dt", { children: noteLabel }),
|
|
7841
|
+
/* @__PURE__ */ jsx36("dd", { children: item?.note || "\u2014" })
|
|
7267
7842
|
] })
|
|
7268
7843
|
] })
|
|
7269
7844
|
] });
|
|
@@ -7305,7 +7880,7 @@ function useKeepSyncStatusBanner({ onRetry, children }) {
|
|
|
7305
7880
|
}
|
|
7306
7881
|
|
|
7307
7882
|
// src/features/sync/KeepSyncStatusBanner.tsx
|
|
7308
|
-
import { jsx as
|
|
7883
|
+
import { jsx as jsx37, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7309
7884
|
function KeepSyncStatusBanner({
|
|
7310
7885
|
onRetry,
|
|
7311
7886
|
onResolveConflicts,
|
|
@@ -7317,7 +7892,7 @@ function KeepSyncStatusBanner({
|
|
|
7317
7892
|
const showRetryLabel = useUiLabelVisibility("retrySync");
|
|
7318
7893
|
const showResolveLabel = useUiLabelVisibility("resolveSync");
|
|
7319
7894
|
if (view.status === "idle" && !view.hasConflicts) return null;
|
|
7320
|
-
return /* @__PURE__ */
|
|
7895
|
+
return /* @__PURE__ */ jsxs29(
|
|
7321
7896
|
"aside",
|
|
7322
7897
|
{
|
|
7323
7898
|
...props,
|
|
@@ -7327,8 +7902,8 @@ function KeepSyncStatusBanner({
|
|
|
7327
7902
|
"data-keepkit": "sync-status",
|
|
7328
7903
|
"data-state": view.status,
|
|
7329
7904
|
children: [
|
|
7330
|
-
/* @__PURE__ */
|
|
7331
|
-
view.showRetry ? /* @__PURE__ */
|
|
7905
|
+
/* @__PURE__ */ jsx37("p", { children: view.message }),
|
|
7906
|
+
view.showRetry ? /* @__PURE__ */ jsx37(
|
|
7332
7907
|
"button",
|
|
7333
7908
|
{
|
|
7334
7909
|
type: "button",
|
|
@@ -7339,7 +7914,7 @@ function KeepSyncStatusBanner({
|
|
|
7339
7914
|
children: showRetryLabel ? view.retryLabel : null
|
|
7340
7915
|
}
|
|
7341
7916
|
) : null,
|
|
7342
|
-
view.hasConflicts ? /* @__PURE__ */
|
|
7917
|
+
view.hasConflicts ? /* @__PURE__ */ jsx37(
|
|
7343
7918
|
"button",
|
|
7344
7919
|
{
|
|
7345
7920
|
type: "button",
|
|
@@ -7355,13 +7930,48 @@ function KeepSyncStatusBanner({
|
|
|
7355
7930
|
);
|
|
7356
7931
|
}
|
|
7357
7932
|
|
|
7933
|
+
// src/features/workspace/KeepWorkspace.tsx
|
|
7934
|
+
import { createInboxQuery as createInboxQuery2 } from "@keepkit/core/core";
|
|
7935
|
+
|
|
7358
7936
|
// src/features/workspace/hooks/useKeepWorkspace.ts
|
|
7359
|
-
import { useCallback as
|
|
7937
|
+
import { useCallback as useCallback13, useState as useState25 } from "react";
|
|
7360
7938
|
var PRESET_MODULES = {
|
|
7361
|
-
basic: {
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7939
|
+
basic: {
|
|
7940
|
+
syncStatus: false,
|
|
7941
|
+
undo: false,
|
|
7942
|
+
recovery: false,
|
|
7943
|
+
backup: false,
|
|
7944
|
+
stalePrune: false,
|
|
7945
|
+
inbox: false,
|
|
7946
|
+
savedViews: false
|
|
7947
|
+
},
|
|
7948
|
+
standard: {
|
|
7949
|
+
syncStatus: false,
|
|
7950
|
+
undo: true,
|
|
7951
|
+
recovery: false,
|
|
7952
|
+
backup: false,
|
|
7953
|
+
stalePrune: false,
|
|
7954
|
+
inbox: false,
|
|
7955
|
+
savedViews: false
|
|
7956
|
+
},
|
|
7957
|
+
management: {
|
|
7958
|
+
syncStatus: false,
|
|
7959
|
+
undo: true,
|
|
7960
|
+
recovery: false,
|
|
7961
|
+
backup: true,
|
|
7962
|
+
stalePrune: true,
|
|
7963
|
+
inbox: false,
|
|
7964
|
+
savedViews: false
|
|
7965
|
+
},
|
|
7966
|
+
sync: {
|
|
7967
|
+
syncStatus: true,
|
|
7968
|
+
undo: true,
|
|
7969
|
+
recovery: true,
|
|
7970
|
+
backup: false,
|
|
7971
|
+
stalePrune: false,
|
|
7972
|
+
inbox: false,
|
|
7973
|
+
savedViews: false
|
|
7974
|
+
}
|
|
7365
7975
|
};
|
|
7366
7976
|
var PRESET_COLLECTION_FEATURES = {
|
|
7367
7977
|
basic: { search: false, sort: false, pagination: false },
|
|
@@ -7376,16 +7986,16 @@ function useKeepWorkspace({
|
|
|
7376
7986
|
onRecoveryOpenChange,
|
|
7377
7987
|
onResolveConflicts
|
|
7378
7988
|
}) {
|
|
7379
|
-
const [internalRecoveryOpen, setInternalRecoveryOpen] =
|
|
7989
|
+
const [internalRecoveryOpen, setInternalRecoveryOpen] = useState25(false);
|
|
7380
7990
|
const resolvedModules = { ...PRESET_MODULES[preset], ...modules };
|
|
7381
|
-
const setRecoveryOpen =
|
|
7991
|
+
const setRecoveryOpen = useCallback13(
|
|
7382
7992
|
(open) => {
|
|
7383
7993
|
if (recoveryOpen === void 0) setInternalRecoveryOpen(open);
|
|
7384
7994
|
onRecoveryOpenChange?.(open);
|
|
7385
7995
|
},
|
|
7386
7996
|
[onRecoveryOpenChange, recoveryOpen]
|
|
7387
7997
|
);
|
|
7388
|
-
const openRecovery =
|
|
7998
|
+
const openRecovery = useCallback13(() => {
|
|
7389
7999
|
onResolveConflicts?.();
|
|
7390
8000
|
setRecoveryOpen(true);
|
|
7391
8001
|
}, [onResolveConflicts, setRecoveryOpen]);
|
|
@@ -7400,7 +8010,7 @@ function useKeepWorkspace({
|
|
|
7400
8010
|
}
|
|
7401
8011
|
|
|
7402
8012
|
// src/features/workspace/KeepWorkspace.tsx
|
|
7403
|
-
import { jsx as
|
|
8013
|
+
import { jsx as jsx38, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
7404
8014
|
function KeepWorkspace({
|
|
7405
8015
|
preset = "standard",
|
|
7406
8016
|
modules,
|
|
@@ -7432,34 +8042,43 @@ function KeepWorkspace({
|
|
|
7432
8042
|
};
|
|
7433
8043
|
const resolvedCollectionProps = {
|
|
7434
8044
|
...collectionProps,
|
|
7435
|
-
|
|
8045
|
+
query: view.modules.inbox ? {
|
|
8046
|
+
...collectionProps?.query,
|
|
8047
|
+
...createInboxQuery2({ organization: collectionProps?.query?.organization })
|
|
8048
|
+
} : collectionProps?.query,
|
|
8049
|
+
features: {
|
|
8050
|
+
...view.collectionFeatures,
|
|
8051
|
+
...view.modules.inbox ? { bulkActions: true, note: true, archive: true, tags: true } : {},
|
|
8052
|
+
...view.modules.savedViews ? { savedViews: true } : {},
|
|
8053
|
+
...collectionProps?.features
|
|
8054
|
+
}
|
|
7436
8055
|
};
|
|
7437
8056
|
const structuredRegions = surface !== void 0 && surface !== "plain";
|
|
7438
8057
|
const region = (name, content) => {
|
|
7439
8058
|
if (!structuredRegions) return content;
|
|
7440
8059
|
if (!hasRenderableContent(content)) return null;
|
|
7441
8060
|
const resolvedSurface = typeof surface === "string" ? surface : surface[name] ?? "plain";
|
|
7442
|
-
return /* @__PURE__ */
|
|
8061
|
+
return /* @__PURE__ */ jsx38("div", { "data-keepkit": "workspace-region", "data-region": name, "data-surface": resolvedSurface, children: content });
|
|
7443
8062
|
};
|
|
7444
8063
|
const before = resolveOptionalSlot(slots?.before, state);
|
|
7445
8064
|
const syncStatus = view.modules.syncStatus ? resolveSlot(
|
|
7446
8065
|
slots?.syncStatus,
|
|
7447
|
-
/* @__PURE__ */
|
|
8066
|
+
/* @__PURE__ */ jsx38(KeepSyncStatusBanner, { ...syncStatusProps, onResolveConflicts: view.openRecovery }),
|
|
7448
8067
|
state
|
|
7449
8068
|
) : null;
|
|
7450
|
-
const collection = resolveSlot(slots?.collection, /* @__PURE__ */
|
|
8069
|
+
const collection = resolveSlot(slots?.collection, /* @__PURE__ */ jsx38(KeepCollection, { ...resolvedCollectionProps }), state);
|
|
7451
8070
|
const actions = view.modules.backup || view.modules.stalePrune ? resolveSlot(
|
|
7452
8071
|
slots?.actions,
|
|
7453
|
-
/* @__PURE__ */
|
|
7454
|
-
view.modules.stalePrune ? /* @__PURE__ */
|
|
7455
|
-
view.modules.backup ? /* @__PURE__ */
|
|
8072
|
+
/* @__PURE__ */ jsxs30("div", { "data-keepkit": "workspace-actions", children: [
|
|
8073
|
+
view.modules.stalePrune ? /* @__PURE__ */ jsx38(KeepPruneStaleButton, { ...stalePruneProps }) : null,
|
|
8074
|
+
view.modules.backup ? /* @__PURE__ */ jsx38(KeepBackup, { ...backupProps }) : null
|
|
7456
8075
|
] }),
|
|
7457
8076
|
state
|
|
7458
8077
|
) : null;
|
|
7459
|
-
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */
|
|
8078
|
+
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */ jsx38(KeepUndo, { ...undoProps }), state) : null;
|
|
7460
8079
|
const recovery = view.modules.recovery ? resolveSlot(
|
|
7461
8080
|
slots?.recovery,
|
|
7462
|
-
/* @__PURE__ */
|
|
8081
|
+
/* @__PURE__ */ jsx38(
|
|
7463
8082
|
KeepSyncRecoveryDialog,
|
|
7464
8083
|
{
|
|
7465
8084
|
...recoveryProps,
|
|
@@ -7471,7 +8090,7 @@ function KeepWorkspace({
|
|
|
7471
8090
|
) : null;
|
|
7472
8091
|
const additionalContent = resolveOptionalSlot(children, state);
|
|
7473
8092
|
const after = resolveOptionalSlot(slots?.after, state);
|
|
7474
|
-
return /* @__PURE__ */
|
|
8093
|
+
return /* @__PURE__ */ jsxs30(
|
|
7475
8094
|
"section",
|
|
7476
8095
|
{
|
|
7477
8096
|
...props,
|
|
@@ -7507,7 +8126,7 @@ import { createAuthenticatedSyncKit } from "@keepkit/core/core";
|
|
|
7507
8126
|
import {
|
|
7508
8127
|
KeepErrorBoundary as KeepErrorBoundary3,
|
|
7509
8128
|
KeepProvider,
|
|
7510
|
-
useKeepCollections as
|
|
8129
|
+
useKeepCollections as useKeepCollections6,
|
|
7511
8130
|
useKeepContext as useKeepContext11,
|
|
7512
8131
|
useKeepItem as useKeepItem8,
|
|
7513
8132
|
useKeepList as useKeepList7,
|
|
@@ -7525,7 +8144,7 @@ import {
|
|
|
7525
8144
|
LocalStorageSyncQueueAdapter,
|
|
7526
8145
|
SyncStorageAdapter
|
|
7527
8146
|
} from "@keepkit/core/storage";
|
|
7528
|
-
import { jsx as
|
|
8147
|
+
import { jsx as jsx39, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7529
8148
|
function KeepKitProvider({
|
|
7530
8149
|
labels,
|
|
7531
8150
|
labelOptions,
|
|
@@ -7547,7 +8166,7 @@ function KeepKitProvider({
|
|
|
7547
8166
|
children,
|
|
7548
8167
|
...providerProps
|
|
7549
8168
|
}) {
|
|
7550
|
-
return /* @__PURE__ */
|
|
8169
|
+
return /* @__PURE__ */ jsx39(
|
|
7551
8170
|
KeepUiProvider,
|
|
7552
8171
|
{
|
|
7553
8172
|
labels,
|
|
@@ -7555,7 +8174,7 @@ function KeepKitProvider({
|
|
|
7555
8174
|
locale,
|
|
7556
8175
|
labelResolver,
|
|
7557
8176
|
onFeedback,
|
|
7558
|
-
children: /* @__PURE__ */
|
|
8177
|
+
children: /* @__PURE__ */ jsx39(
|
|
7559
8178
|
KeepThemeProvider,
|
|
7560
8179
|
{
|
|
7561
8180
|
theme,
|
|
@@ -7569,10 +8188,10 @@ function KeepKitProvider({
|
|
|
7569
8188
|
className: themeClassName,
|
|
7570
8189
|
style: themeStyle,
|
|
7571
8190
|
asChild: themeAsChild,
|
|
7572
|
-
children: /* @__PURE__ */
|
|
7573
|
-
/* @__PURE__ */
|
|
7574
|
-
/* @__PURE__ */
|
|
7575
|
-
/* @__PURE__ */
|
|
8191
|
+
children: /* @__PURE__ */ jsxs31(CoreKeepProvider, { ...providerProps, children: [
|
|
8192
|
+
/* @__PURE__ */ jsx39(KeepSyncFeedbackObserver, {}),
|
|
8193
|
+
/* @__PURE__ */ jsx39(KeepTourProvider, { ...tour, children }),
|
|
8194
|
+
/* @__PURE__ */ jsx39(KeepAnnouncements, {})
|
|
7576
8195
|
] })
|
|
7577
8196
|
}
|
|
7578
8197
|
)
|
|
@@ -7603,7 +8222,7 @@ function createKeepKit(options = {}) {
|
|
|
7603
8222
|
} = options;
|
|
7604
8223
|
const coreKit = createCoreKeepKit(coreOptions);
|
|
7605
8224
|
return {
|
|
7606
|
-
Provider: (props) => /* @__PURE__ */
|
|
8225
|
+
Provider: (props) => /* @__PURE__ */ jsx39(
|
|
7607
8226
|
KeepKitProvider,
|
|
7608
8227
|
{
|
|
7609
8228
|
...coreOptions,
|
|
@@ -7626,9 +8245,9 @@ function createKeepKit(options = {}) {
|
|
|
7626
8245
|
...props
|
|
7627
8246
|
}
|
|
7628
8247
|
),
|
|
7629
|
-
Button: (props) => /* @__PURE__ */
|
|
7630
|
-
Backup: (props) => /* @__PURE__ */
|
|
7631
|
-
Collection: (props) => /* @__PURE__ */
|
|
8248
|
+
Button: (props) => /* @__PURE__ */ jsx39(KeepButton, { ...props }),
|
|
8249
|
+
Backup: (props) => /* @__PURE__ */ jsx39(KeepBackup, { ...props }),
|
|
8250
|
+
Collection: (props) => /* @__PURE__ */ jsx39(
|
|
7632
8251
|
KeepCollection,
|
|
7633
8252
|
{
|
|
7634
8253
|
...props,
|
|
@@ -7639,8 +8258,10 @@ function createKeepKit(options = {}) {
|
|
|
7639
8258
|
}
|
|
7640
8259
|
}
|
|
7641
8260
|
),
|
|
7642
|
-
|
|
7643
|
-
|
|
8261
|
+
Inbox: (props) => /* @__PURE__ */ jsx39(KeepInbox, { ...props }),
|
|
8262
|
+
SavedViews: (props) => /* @__PURE__ */ jsx39(KeepSavedViews, { ...props }),
|
|
8263
|
+
CollectionManager: (props) => /* @__PURE__ */ jsx39(KeepCollectionManager, { ...props }),
|
|
8264
|
+
Workspace: (props) => /* @__PURE__ */ jsx39(
|
|
7644
8265
|
KeepWorkspace,
|
|
7645
8266
|
{
|
|
7646
8267
|
...props,
|
|
@@ -7657,12 +8278,13 @@ function createKeepKit(options = {}) {
|
|
|
7657
8278
|
useContext: () => coreKit.useContext(),
|
|
7658
8279
|
useItem: (item) => coreKit.useItem(item),
|
|
7659
8280
|
useList: (query) => coreKit.useList(query),
|
|
8281
|
+
useSavedViews: () => useKeepSavedViews(),
|
|
7660
8282
|
useRediscovery: (rediscoveryOptions) => coreKit.useRediscovery(rediscoveryOptions),
|
|
7661
8283
|
useCollections: (collectionsOptions) => coreKit.useCollections(collectionsOptions),
|
|
7662
8284
|
useNavigator: (navigatorOptions) => coreKit.useNavigator(navigatorOptions),
|
|
7663
8285
|
useShortcut: (shortcutOptions) => coreKit.useShortcut(shortcutOptions),
|
|
7664
|
-
FloatingTour: (props) => /* @__PURE__ */
|
|
7665
|
-
TourProvider: (props) => /* @__PURE__ */
|
|
8286
|
+
FloatingTour: (props) => /* @__PURE__ */ jsx39(KeepFloatingTour, { ...props }),
|
|
8287
|
+
TourProvider: (props) => /* @__PURE__ */ jsx39(KeepTourProvider, { ...props }),
|
|
7666
8288
|
useTour: (tourOptions) => useKeepTour(tourOptions)
|
|
7667
8289
|
};
|
|
7668
8290
|
}
|
|
@@ -7687,11 +8309,13 @@ export {
|
|
|
7687
8309
|
KeepErrorBoundary3 as KeepErrorBoundary,
|
|
7688
8310
|
KeepFloatingTour,
|
|
7689
8311
|
KeepHighlight,
|
|
8312
|
+
KeepInbox,
|
|
7690
8313
|
KeepItemCard,
|
|
7691
8314
|
KeepItemCardSkeleton,
|
|
7692
8315
|
KeepItemCheckbox,
|
|
7693
8316
|
KeepItemStatusBadge,
|
|
7694
8317
|
KeepKitProvider,
|
|
8318
|
+
KeepLastActivity,
|
|
7695
8319
|
KeepLayout,
|
|
7696
8320
|
KeepList,
|
|
7697
8321
|
KeepNavigator,
|
|
@@ -7702,8 +8326,11 @@ export {
|
|
|
7702
8326
|
KeepPruneStaleButton,
|
|
7703
8327
|
KeepQuickEditor,
|
|
7704
8328
|
KeepRediscovery,
|
|
8329
|
+
KeepRediscoveryPanel,
|
|
7705
8330
|
KeepReorderableList,
|
|
7706
8331
|
KeepSavePopover,
|
|
8332
|
+
KeepSaveViewButton,
|
|
8333
|
+
KeepSavedViews,
|
|
7707
8334
|
KeepSearchInput,
|
|
7708
8335
|
KeepShortcutHint,
|
|
7709
8336
|
KeepSortSelect,
|
|
@@ -7736,13 +8363,14 @@ export {
|
|
|
7736
8363
|
keepThemeNames,
|
|
7737
8364
|
mergeProps,
|
|
7738
8365
|
toggleSelectAll,
|
|
7739
|
-
|
|
8366
|
+
useKeepCollections6 as useKeepCollections,
|
|
7740
8367
|
useKeepContext11 as useKeepContext,
|
|
7741
8368
|
useKeepItem8 as useKeepItem,
|
|
7742
8369
|
useKeepList7 as useKeepList,
|
|
7743
8370
|
useKeepNavigator2 as useKeepNavigator,
|
|
7744
8371
|
useKeepQuickEditor,
|
|
7745
8372
|
useKeepRediscovery,
|
|
8373
|
+
useKeepSavedViews,
|
|
7746
8374
|
useKeepShortcut,
|
|
7747
8375
|
useKeepToastFeedback,
|
|
7748
8376
|
useKeepTour,
|