@keepkit/ui 0.27.1 → 0.27.3
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 +4 -2
- package/dist/index.d.ts +28 -2
- package/dist/index.js +598 -152
- package/dist/index.js.map +1 -1
- package/dist/styles/collection.css +113 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -203,7 +203,16 @@ var DE_LABELS = {
|
|
|
203
203
|
toolbarEnd: "Zus\xE4tzliche Aktionen",
|
|
204
204
|
createCollection: "Create collection",
|
|
205
205
|
createCollectionSubmit: "Create",
|
|
206
|
-
collectionName: "Collection name"
|
|
206
|
+
collectionName: "Collection name",
|
|
207
|
+
manageCollections: "Manage collections",
|
|
208
|
+
renameCollection: "Rename",
|
|
209
|
+
renameCollectionSubmit: "Save name",
|
|
210
|
+
deleteCollection: "Delete",
|
|
211
|
+
deleteCollectionConfirm: "Move its items to Uncategorized?",
|
|
212
|
+
deleteCollectionSubmit: "Delete collection",
|
|
213
|
+
cancel: "Cancel",
|
|
214
|
+
collectionItem: "item",
|
|
215
|
+
collectionItems: "items"
|
|
207
216
|
};
|
|
208
217
|
|
|
209
218
|
// src/locales/en.ts
|
|
@@ -314,7 +323,16 @@ var EN_LABELS = {
|
|
|
314
323
|
toolbarEnd: "Additional actions",
|
|
315
324
|
createCollection: "Create collection",
|
|
316
325
|
createCollectionSubmit: "Create",
|
|
317
|
-
collectionName: "Collection name"
|
|
326
|
+
collectionName: "Collection name",
|
|
327
|
+
manageCollections: "Manage collections",
|
|
328
|
+
renameCollection: "Rename",
|
|
329
|
+
renameCollectionSubmit: "Save name",
|
|
330
|
+
deleteCollection: "Delete",
|
|
331
|
+
deleteCollectionConfirm: "Move its items to Uncategorized?",
|
|
332
|
+
deleteCollectionSubmit: "Delete collection",
|
|
333
|
+
cancel: "Cancel",
|
|
334
|
+
collectionItem: "item",
|
|
335
|
+
collectionItems: "items"
|
|
318
336
|
};
|
|
319
337
|
|
|
320
338
|
// src/locales/es.ts
|
|
@@ -425,7 +443,16 @@ var ES_LABELS = {
|
|
|
425
443
|
toolbarEnd: "Acciones adicionales",
|
|
426
444
|
createCollection: "Create collection",
|
|
427
445
|
createCollectionSubmit: "Create",
|
|
428
|
-
collectionName: "Collection name"
|
|
446
|
+
collectionName: "Collection name",
|
|
447
|
+
manageCollections: "Manage collections",
|
|
448
|
+
renameCollection: "Rename",
|
|
449
|
+
renameCollectionSubmit: "Save name",
|
|
450
|
+
deleteCollection: "Delete",
|
|
451
|
+
deleteCollectionConfirm: "Move its items to Uncategorized?",
|
|
452
|
+
deleteCollectionSubmit: "Delete collection",
|
|
453
|
+
cancel: "Cancel",
|
|
454
|
+
collectionItem: "item",
|
|
455
|
+
collectionItems: "items"
|
|
429
456
|
};
|
|
430
457
|
|
|
431
458
|
// src/locales/fil.ts
|
|
@@ -536,7 +563,16 @@ var FIL_LABELS = {
|
|
|
536
563
|
toolbarEnd: "Mga karagdagang aksyon",
|
|
537
564
|
createCollection: "Create collection",
|
|
538
565
|
createCollectionSubmit: "Create",
|
|
539
|
-
collectionName: "Collection name"
|
|
566
|
+
collectionName: "Collection name",
|
|
567
|
+
manageCollections: "Manage collections",
|
|
568
|
+
renameCollection: "Rename",
|
|
569
|
+
renameCollectionSubmit: "Save name",
|
|
570
|
+
deleteCollection: "Delete",
|
|
571
|
+
deleteCollectionConfirm: "Move its items to Uncategorized?",
|
|
572
|
+
deleteCollectionSubmit: "Delete collection",
|
|
573
|
+
cancel: "Cancel",
|
|
574
|
+
collectionItem: "item",
|
|
575
|
+
collectionItems: "items"
|
|
540
576
|
};
|
|
541
577
|
|
|
542
578
|
// src/locales/fr.ts
|
|
@@ -647,7 +683,16 @@ var FR_LABELS = {
|
|
|
647
683
|
toolbarEnd: "Actions suppl\xE9mentaires",
|
|
648
684
|
createCollection: "Create collection",
|
|
649
685
|
createCollectionSubmit: "Create",
|
|
650
|
-
collectionName: "Collection name"
|
|
686
|
+
collectionName: "Collection name",
|
|
687
|
+
manageCollections: "Manage collections",
|
|
688
|
+
renameCollection: "Rename",
|
|
689
|
+
renameCollectionSubmit: "Save name",
|
|
690
|
+
deleteCollection: "Delete",
|
|
691
|
+
deleteCollectionConfirm: "Move its items to Uncategorized?",
|
|
692
|
+
deleteCollectionSubmit: "Delete collection",
|
|
693
|
+
cancel: "Cancel",
|
|
694
|
+
collectionItem: "item",
|
|
695
|
+
collectionItems: "items"
|
|
651
696
|
};
|
|
652
697
|
|
|
653
698
|
// src/locales/id.ts
|
|
@@ -758,7 +803,16 @@ var ID_LABELS = {
|
|
|
758
803
|
toolbarEnd: "Tindakan tambahan",
|
|
759
804
|
createCollection: "Create collection",
|
|
760
805
|
createCollectionSubmit: "Create",
|
|
761
|
-
collectionName: "Collection name"
|
|
806
|
+
collectionName: "Collection name",
|
|
807
|
+
manageCollections: "Manage collections",
|
|
808
|
+
renameCollection: "Rename",
|
|
809
|
+
renameCollectionSubmit: "Save name",
|
|
810
|
+
deleteCollection: "Delete",
|
|
811
|
+
deleteCollectionConfirm: "Move its items to Uncategorized?",
|
|
812
|
+
deleteCollectionSubmit: "Delete collection",
|
|
813
|
+
cancel: "Cancel",
|
|
814
|
+
collectionItem: "item",
|
|
815
|
+
collectionItems: "items"
|
|
762
816
|
};
|
|
763
817
|
|
|
764
818
|
// src/locales/it.ts
|
|
@@ -869,7 +923,16 @@ var IT_LABELS = {
|
|
|
869
923
|
toolbarEnd: "Azioni aggiuntive",
|
|
870
924
|
createCollection: "Create collection",
|
|
871
925
|
createCollectionSubmit: "Create",
|
|
872
|
-
collectionName: "Collection name"
|
|
926
|
+
collectionName: "Collection name",
|
|
927
|
+
manageCollections: "Manage collections",
|
|
928
|
+
renameCollection: "Rename",
|
|
929
|
+
renameCollectionSubmit: "Save name",
|
|
930
|
+
deleteCollection: "Delete",
|
|
931
|
+
deleteCollectionConfirm: "Move its items to Uncategorized?",
|
|
932
|
+
deleteCollectionSubmit: "Delete collection",
|
|
933
|
+
cancel: "Cancel",
|
|
934
|
+
collectionItem: "item",
|
|
935
|
+
collectionItems: "items"
|
|
873
936
|
};
|
|
874
937
|
|
|
875
938
|
// src/locales/ja.ts
|
|
@@ -980,7 +1043,16 @@ var JA_LABELS = {
|
|
|
980
1043
|
toolbarEnd: "\u8FFD\u52A0\u306E\u64CD\u4F5C",
|
|
981
1044
|
createCollection: "\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u4F5C\u6210",
|
|
982
1045
|
createCollectionSubmit: "\u4F5C\u6210",
|
|
983
|
-
collectionName: "\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D"
|
|
1046
|
+
collectionName: "\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D",
|
|
1047
|
+
manageCollections: "\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u7BA1\u7406",
|
|
1048
|
+
renameCollection: "\u540D\u524D\u3092\u5909\u66F4",
|
|
1049
|
+
renameCollectionSubmit: "\u540D\u524D\u3092\u4FDD\u5B58",
|
|
1050
|
+
deleteCollection: "\u524A\u9664",
|
|
1051
|
+
deleteCollectionConfirm: "\u30A2\u30A4\u30C6\u30E0\u3092\u672A\u5206\u985E\u3078\u79FB\u52D5\u3057\u307E\u3059\u304B\uFF1F",
|
|
1052
|
+
deleteCollectionSubmit: "\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u524A\u9664",
|
|
1053
|
+
cancel: "\u30AD\u30E3\u30F3\u30BB\u30EB",
|
|
1054
|
+
collectionItem: "\u4EF6",
|
|
1055
|
+
collectionItems: "\u4EF6"
|
|
984
1056
|
};
|
|
985
1057
|
|
|
986
1058
|
// src/locales/ko.ts
|
|
@@ -1091,7 +1163,16 @@ var KO_LABELS = {
|
|
|
1091
1163
|
toolbarEnd: "\uCD94\uAC00 \uC791\uC5C5",
|
|
1092
1164
|
createCollection: "Create collection",
|
|
1093
1165
|
createCollectionSubmit: "Create",
|
|
1094
|
-
collectionName: "Collection name"
|
|
1166
|
+
collectionName: "Collection name",
|
|
1167
|
+
manageCollections: "Manage collections",
|
|
1168
|
+
renameCollection: "Rename",
|
|
1169
|
+
renameCollectionSubmit: "Save name",
|
|
1170
|
+
deleteCollection: "Delete",
|
|
1171
|
+
deleteCollectionConfirm: "Move its items to Uncategorized?",
|
|
1172
|
+
deleteCollectionSubmit: "Delete collection",
|
|
1173
|
+
cancel: "Cancel",
|
|
1174
|
+
collectionItem: "item",
|
|
1175
|
+
collectionItems: "items"
|
|
1095
1176
|
};
|
|
1096
1177
|
|
|
1097
1178
|
// src/locales/ms.ts
|
|
@@ -1202,7 +1283,16 @@ var MS_LABELS = {
|
|
|
1202
1283
|
toolbarEnd: "Tindakan tambahan",
|
|
1203
1284
|
createCollection: "Create collection",
|
|
1204
1285
|
createCollectionSubmit: "Create",
|
|
1205
|
-
collectionName: "Collection name"
|
|
1286
|
+
collectionName: "Collection name",
|
|
1287
|
+
manageCollections: "Manage collections",
|
|
1288
|
+
renameCollection: "Rename",
|
|
1289
|
+
renameCollectionSubmit: "Save name",
|
|
1290
|
+
deleteCollection: "Delete",
|
|
1291
|
+
deleteCollectionConfirm: "Move its items to Uncategorized?",
|
|
1292
|
+
deleteCollectionSubmit: "Delete collection",
|
|
1293
|
+
cancel: "Cancel",
|
|
1294
|
+
collectionItem: "item",
|
|
1295
|
+
collectionItems: "items"
|
|
1206
1296
|
};
|
|
1207
1297
|
|
|
1208
1298
|
// src/locales/pt-BR.ts
|
|
@@ -1313,7 +1403,16 @@ var PT_BR_LABELS = {
|
|
|
1313
1403
|
toolbarEnd: "A\xE7\xF5es adicionais",
|
|
1314
1404
|
createCollection: "Create collection",
|
|
1315
1405
|
createCollectionSubmit: "Create",
|
|
1316
|
-
collectionName: "Collection name"
|
|
1406
|
+
collectionName: "Collection name",
|
|
1407
|
+
manageCollections: "Manage collections",
|
|
1408
|
+
renameCollection: "Rename",
|
|
1409
|
+
renameCollectionSubmit: "Save name",
|
|
1410
|
+
deleteCollection: "Delete",
|
|
1411
|
+
deleteCollectionConfirm: "Move its items to Uncategorized?",
|
|
1412
|
+
deleteCollectionSubmit: "Delete collection",
|
|
1413
|
+
cancel: "Cancel",
|
|
1414
|
+
collectionItem: "item",
|
|
1415
|
+
collectionItems: "items"
|
|
1317
1416
|
};
|
|
1318
1417
|
|
|
1319
1418
|
// src/locales/ru.ts
|
|
@@ -1424,7 +1523,16 @@ var RU_LABELS = {
|
|
|
1424
1523
|
toolbarEnd: "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F",
|
|
1425
1524
|
createCollection: "Create collection",
|
|
1426
1525
|
createCollectionSubmit: "Create",
|
|
1427
|
-
collectionName: "Collection name"
|
|
1526
|
+
collectionName: "Collection name",
|
|
1527
|
+
manageCollections: "Manage collections",
|
|
1528
|
+
renameCollection: "Rename",
|
|
1529
|
+
renameCollectionSubmit: "Save name",
|
|
1530
|
+
deleteCollection: "Delete",
|
|
1531
|
+
deleteCollectionConfirm: "Move its items to Uncategorized?",
|
|
1532
|
+
deleteCollectionSubmit: "Delete collection",
|
|
1533
|
+
cancel: "Cancel",
|
|
1534
|
+
collectionItem: "item",
|
|
1535
|
+
collectionItems: "items"
|
|
1428
1536
|
};
|
|
1429
1537
|
|
|
1430
1538
|
// src/locales/th.ts
|
|
@@ -1535,7 +1643,16 @@ var TH_LABELS = {
|
|
|
1535
1643
|
toolbarEnd: "\u0E01\u0E32\u0E23\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E15\u0E34\u0E21",
|
|
1536
1644
|
createCollection: "Create collection",
|
|
1537
1645
|
createCollectionSubmit: "Create",
|
|
1538
|
-
collectionName: "Collection name"
|
|
1646
|
+
collectionName: "Collection name",
|
|
1647
|
+
manageCollections: "Manage collections",
|
|
1648
|
+
renameCollection: "Rename",
|
|
1649
|
+
renameCollectionSubmit: "Save name",
|
|
1650
|
+
deleteCollection: "Delete",
|
|
1651
|
+
deleteCollectionConfirm: "Move its items to Uncategorized?",
|
|
1652
|
+
deleteCollectionSubmit: "Delete collection",
|
|
1653
|
+
cancel: "Cancel",
|
|
1654
|
+
collectionItem: "item",
|
|
1655
|
+
collectionItems: "items"
|
|
1539
1656
|
};
|
|
1540
1657
|
|
|
1541
1658
|
// src/locales/vi.ts
|
|
@@ -1646,7 +1763,16 @@ var VI_LABELS = {
|
|
|
1646
1763
|
toolbarEnd: "Thao t\xE1c b\u1ED5 sung",
|
|
1647
1764
|
createCollection: "Create collection",
|
|
1648
1765
|
createCollectionSubmit: "Create",
|
|
1649
|
-
collectionName: "Collection name"
|
|
1766
|
+
collectionName: "Collection name",
|
|
1767
|
+
manageCollections: "Manage collections",
|
|
1768
|
+
renameCollection: "Rename",
|
|
1769
|
+
renameCollectionSubmit: "Save name",
|
|
1770
|
+
deleteCollection: "Delete",
|
|
1771
|
+
deleteCollectionConfirm: "Move its items to Uncategorized?",
|
|
1772
|
+
deleteCollectionSubmit: "Delete collection",
|
|
1773
|
+
cancel: "Cancel",
|
|
1774
|
+
collectionItem: "item",
|
|
1775
|
+
collectionItems: "items"
|
|
1650
1776
|
};
|
|
1651
1777
|
|
|
1652
1778
|
// src/locales/zh-Hans.ts
|
|
@@ -1757,7 +1883,16 @@ var ZH_HANS_LABELS = {
|
|
|
1757
1883
|
toolbarEnd: "\u5176\u4ED6\u64CD\u4F5C",
|
|
1758
1884
|
createCollection: "Create collection",
|
|
1759
1885
|
createCollectionSubmit: "Create",
|
|
1760
|
-
collectionName: "Collection name"
|
|
1886
|
+
collectionName: "Collection name",
|
|
1887
|
+
manageCollections: "Manage collections",
|
|
1888
|
+
renameCollection: "Rename",
|
|
1889
|
+
renameCollectionSubmit: "Save name",
|
|
1890
|
+
deleteCollection: "Delete",
|
|
1891
|
+
deleteCollectionConfirm: "Move its items to Uncategorized?",
|
|
1892
|
+
deleteCollectionSubmit: "Delete collection",
|
|
1893
|
+
cancel: "Cancel",
|
|
1894
|
+
collectionItem: "item",
|
|
1895
|
+
collectionItems: "items"
|
|
1761
1896
|
};
|
|
1762
1897
|
|
|
1763
1898
|
// src/locales/zh-Hant.ts
|
|
@@ -1868,7 +2003,16 @@ var ZH_HANT_LABELS = {
|
|
|
1868
2003
|
toolbarEnd: "\u5176\u4ED6\u64CD\u4F5C",
|
|
1869
2004
|
createCollection: "Create collection",
|
|
1870
2005
|
createCollectionSubmit: "Create",
|
|
1871
|
-
collectionName: "Collection name"
|
|
2006
|
+
collectionName: "Collection name",
|
|
2007
|
+
manageCollections: "Manage collections",
|
|
2008
|
+
renameCollection: "Rename",
|
|
2009
|
+
renameCollectionSubmit: "Save name",
|
|
2010
|
+
deleteCollection: "Delete",
|
|
2011
|
+
deleteCollectionConfirm: "Move its items to Uncategorized?",
|
|
2012
|
+
deleteCollectionSubmit: "Delete collection",
|
|
2013
|
+
cancel: "Cancel",
|
|
2014
|
+
collectionItem: "item",
|
|
2015
|
+
collectionItems: "items"
|
|
1872
2016
|
};
|
|
1873
2017
|
|
|
1874
2018
|
// src/locales/index.ts
|
|
@@ -2930,10 +3074,14 @@ function KeepQuickEditorView({
|
|
|
2930
3074
|
const savingLabel = useUiLabel("saving");
|
|
2931
3075
|
const savedLabel = useUiLabel("saved");
|
|
2932
3076
|
const errorLabel = useUiLabel("error");
|
|
3077
|
+
const [tagsInput, setTagsInput] = useState3(() => formatTags(state.tags));
|
|
2933
3078
|
const submit = (event) => {
|
|
2934
3079
|
event.preventDefault();
|
|
2935
3080
|
void state.flush().catch(() => void 0);
|
|
2936
3081
|
};
|
|
3082
|
+
useEffect3(() => {
|
|
3083
|
+
if (!sameTags(parseTags(tagsInput), state.tags)) setTagsInput(formatTags(state.tags));
|
|
3084
|
+
}, [state.tags, tagsInput]);
|
|
2937
3085
|
const onKeyDown = (event) => {
|
|
2938
3086
|
props.onKeyDown?.(event);
|
|
2939
3087
|
if (event.defaultPrevented) return;
|
|
@@ -2961,11 +3109,13 @@ function KeepQuickEditorView({
|
|
|
2961
3109
|
/* @__PURE__ */ jsx7(
|
|
2962
3110
|
"input",
|
|
2963
3111
|
{
|
|
2964
|
-
value:
|
|
3112
|
+
value: tagsInput,
|
|
2965
3113
|
"aria-label": showTagsLabel ? void 0 : tagsLabel,
|
|
2966
|
-
onChange: (event) =>
|
|
2967
|
-
event.currentTarget.value
|
|
2968
|
-
|
|
3114
|
+
onChange: (event) => {
|
|
3115
|
+
const value = event.currentTarget.value;
|
|
3116
|
+
setTagsInput(value);
|
|
3117
|
+
state.setTags(parseTags(value));
|
|
3118
|
+
}
|
|
2969
3119
|
}
|
|
2970
3120
|
)
|
|
2971
3121
|
] }) : null,
|
|
@@ -3041,6 +3191,12 @@ function getErrorMessage2(error, fallback) {
|
|
|
3041
3191
|
function sameTags(left, right) {
|
|
3042
3192
|
return left.length === right.length && left.every((tag, index) => tag === right[index]);
|
|
3043
3193
|
}
|
|
3194
|
+
function parseTags(value) {
|
|
3195
|
+
return value.split(",").map((tag) => tag.trim()).filter(Boolean);
|
|
3196
|
+
}
|
|
3197
|
+
function formatTags(tags) {
|
|
3198
|
+
return tags.join(", ");
|
|
3199
|
+
}
|
|
3044
3200
|
function trapFocus(event, root) {
|
|
3045
3201
|
if (!root) return;
|
|
3046
3202
|
const elements = [
|
|
@@ -5318,13 +5474,301 @@ function getCollectionState(list) {
|
|
|
5318
5474
|
return "ready";
|
|
5319
5475
|
}
|
|
5320
5476
|
|
|
5477
|
+
// src/features/collection/KeepCollectionManager.tsx
|
|
5478
|
+
import { useId as useId5 } from "react";
|
|
5479
|
+
|
|
5480
|
+
// src/features/collection/hooks/useKeepCollectionManager.ts
|
|
5481
|
+
import { useKeepCollections as useKeepCollections4, useKeepContext as useKeepContext6 } from "@keepkit/core/react";
|
|
5482
|
+
import { useCallback as useCallback6, useState as useState16 } from "react";
|
|
5483
|
+
function useKeepCollectionManager({
|
|
5484
|
+
onError,
|
|
5485
|
+
onRenamed,
|
|
5486
|
+
onDeleted
|
|
5487
|
+
} = {}) {
|
|
5488
|
+
const {
|
|
5489
|
+
items,
|
|
5490
|
+
collections: explicitCollections,
|
|
5491
|
+
createCollection,
|
|
5492
|
+
renameCollection,
|
|
5493
|
+
removeCollection,
|
|
5494
|
+
moveToCollection
|
|
5495
|
+
} = useKeepContext6();
|
|
5496
|
+
const collections = useKeepCollections4({ orderBy: "name" });
|
|
5497
|
+
const [editingId, setEditingId] = useState16(null);
|
|
5498
|
+
const [editingName, setEditingName] = useState16("");
|
|
5499
|
+
const [pendingDeleteId, setPendingDeleteId] = useState16(null);
|
|
5500
|
+
const [error, setError] = useState16(null);
|
|
5501
|
+
const [isMutating, setIsMutating] = useState16(false);
|
|
5502
|
+
const reportError = useCallback6(
|
|
5503
|
+
(cause, fallback) => {
|
|
5504
|
+
const message = cause instanceof Error ? cause.message : fallback;
|
|
5505
|
+
setError(message);
|
|
5506
|
+
onError?.(cause);
|
|
5507
|
+
},
|
|
5508
|
+
[onError]
|
|
5509
|
+
);
|
|
5510
|
+
const runMutation = useCallback6(
|
|
5511
|
+
async (operation) => {
|
|
5512
|
+
setError(null);
|
|
5513
|
+
setIsMutating(true);
|
|
5514
|
+
try {
|
|
5515
|
+
await operation();
|
|
5516
|
+
} catch (cause) {
|
|
5517
|
+
reportError(cause, "Could not update the collection.");
|
|
5518
|
+
} finally {
|
|
5519
|
+
setIsMutating(false);
|
|
5520
|
+
}
|
|
5521
|
+
},
|
|
5522
|
+
[reportError]
|
|
5523
|
+
);
|
|
5524
|
+
const beginRename = useCallback6(
|
|
5525
|
+
(id) => {
|
|
5526
|
+
const collection = collections.find((entry) => entry.id === id);
|
|
5527
|
+
if (!collection) return;
|
|
5528
|
+
setError(null);
|
|
5529
|
+
setPendingDeleteId(null);
|
|
5530
|
+
setEditingId(id);
|
|
5531
|
+
setEditingName(collection.name);
|
|
5532
|
+
},
|
|
5533
|
+
[collections]
|
|
5534
|
+
);
|
|
5535
|
+
const cancelRename = useCallback6(() => {
|
|
5536
|
+
setEditingId(null);
|
|
5537
|
+
setEditingName("");
|
|
5538
|
+
}, []);
|
|
5539
|
+
const rename = useCallback6(
|
|
5540
|
+
async (id) => {
|
|
5541
|
+
const name = editingName.trim();
|
|
5542
|
+
if (!name) return;
|
|
5543
|
+
const duplicate = collections.some(
|
|
5544
|
+
(collection) => collection.id !== id && collection.name.toLowerCase() === name.toLowerCase()
|
|
5545
|
+
);
|
|
5546
|
+
if (duplicate) {
|
|
5547
|
+
setError(`Collection "${name}" already exists.`);
|
|
5548
|
+
return;
|
|
5549
|
+
}
|
|
5550
|
+
await runMutation(async () => {
|
|
5551
|
+
if (explicitCollections[id]) {
|
|
5552
|
+
await renameCollection(id, name);
|
|
5553
|
+
} else {
|
|
5554
|
+
await createCollection(id, name);
|
|
5555
|
+
}
|
|
5556
|
+
cancelRename();
|
|
5557
|
+
await onRenamed?.(id, name);
|
|
5558
|
+
});
|
|
5559
|
+
},
|
|
5560
|
+
[
|
|
5561
|
+
cancelRename,
|
|
5562
|
+
collections,
|
|
5563
|
+
createCollection,
|
|
5564
|
+
editingName,
|
|
5565
|
+
explicitCollections,
|
|
5566
|
+
onRenamed,
|
|
5567
|
+
renameCollection,
|
|
5568
|
+
runMutation
|
|
5569
|
+
]
|
|
5570
|
+
);
|
|
5571
|
+
const requestDelete = useCallback6((id) => {
|
|
5572
|
+
setError(null);
|
|
5573
|
+
setEditingId(null);
|
|
5574
|
+
setPendingDeleteId(id);
|
|
5575
|
+
}, []);
|
|
5576
|
+
const cancelDelete = useCallback6(() => setPendingDeleteId(null), []);
|
|
5577
|
+
const confirmDelete = useCallback6(async () => {
|
|
5578
|
+
if (!pendingDeleteId) return;
|
|
5579
|
+
const id = pendingDeleteId;
|
|
5580
|
+
await runMutation(async () => {
|
|
5581
|
+
if (explicitCollections[id]) {
|
|
5582
|
+
await removeCollection(id);
|
|
5583
|
+
} else {
|
|
5584
|
+
for (const item of items.filter((entry) => entry.collectionId === id)) {
|
|
5585
|
+
await moveToCollection(item.id, void 0);
|
|
5586
|
+
}
|
|
5587
|
+
}
|
|
5588
|
+
setPendingDeleteId(null);
|
|
5589
|
+
await onDeleted?.(id);
|
|
5590
|
+
});
|
|
5591
|
+
}, [explicitCollections, items, moveToCollection, onDeleted, pendingDeleteId, removeCollection, runMutation]);
|
|
5592
|
+
return {
|
|
5593
|
+
collections,
|
|
5594
|
+
editingId,
|
|
5595
|
+
editingName,
|
|
5596
|
+
setEditingName,
|
|
5597
|
+
beginRename,
|
|
5598
|
+
cancelRename,
|
|
5599
|
+
rename,
|
|
5600
|
+
pendingDeleteId,
|
|
5601
|
+
requestDelete,
|
|
5602
|
+
cancelDelete,
|
|
5603
|
+
confirmDelete,
|
|
5604
|
+
error,
|
|
5605
|
+
isMutating
|
|
5606
|
+
};
|
|
5607
|
+
}
|
|
5608
|
+
|
|
5609
|
+
// src/features/collection/KeepCollectionManager.tsx
|
|
5610
|
+
import { Fragment as Fragment13, jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5611
|
+
function KeepCollectionManager({
|
|
5612
|
+
allowCreate = true,
|
|
5613
|
+
allowRename = true,
|
|
5614
|
+
allowDelete = true,
|
|
5615
|
+
showCounts = true,
|
|
5616
|
+
title,
|
|
5617
|
+
description,
|
|
5618
|
+
empty,
|
|
5619
|
+
collectionLabels,
|
|
5620
|
+
onCreated,
|
|
5621
|
+
onRenamed,
|
|
5622
|
+
onDeleted,
|
|
5623
|
+
onError,
|
|
5624
|
+
className,
|
|
5625
|
+
...rootProps
|
|
5626
|
+
}) {
|
|
5627
|
+
const manager = useKeepCollectionManager({ onError, onRenamed, onDeleted });
|
|
5628
|
+
const headingId = useId5();
|
|
5629
|
+
const renameLabel = useUiLabel("renameCollection");
|
|
5630
|
+
const renameSubmitLabel = useUiLabel("renameCollectionSubmit");
|
|
5631
|
+
const deleteLabel = useUiLabel("deleteCollection");
|
|
5632
|
+
const deleteConfirmLabel = useUiLabel("deleteCollectionConfirm");
|
|
5633
|
+
const deleteSubmitLabel = useUiLabel("deleteCollectionSubmit");
|
|
5634
|
+
const cancelLabel = useUiLabel("cancel");
|
|
5635
|
+
const itemLabel = useUiLabel("collectionItem");
|
|
5636
|
+
const itemsLabel = useUiLabel("collectionItems");
|
|
5637
|
+
const defaultTitle = useUiLabel("manageCollections");
|
|
5638
|
+
return /* @__PURE__ */ jsxs20(
|
|
5639
|
+
"section",
|
|
5640
|
+
{
|
|
5641
|
+
...rootProps,
|
|
5642
|
+
className,
|
|
5643
|
+
"data-keepkit": "collection-manager",
|
|
5644
|
+
"data-state": manager.error ? "error" : manager.isMutating ? "mutating" : "idle",
|
|
5645
|
+
"data-loading": manager.isMutating ? "true" : void 0,
|
|
5646
|
+
"aria-labelledby": rootProps["aria-labelledby"] ?? headingId,
|
|
5647
|
+
children: [
|
|
5648
|
+
/* @__PURE__ */ jsxs20("header", { "data-keepkit": "collection-manager-heading", children: [
|
|
5649
|
+
/* @__PURE__ */ jsx23("h2", { id: headingId, children: title ?? defaultTitle }),
|
|
5650
|
+
hasRenderableContent(description) ? /* @__PURE__ */ jsx23("p", { children: description }) : null
|
|
5651
|
+
] }),
|
|
5652
|
+
allowCreate ? /* @__PURE__ */ jsx23(KeepCollectionCreate, { onCreated, onError }) : null,
|
|
5653
|
+
manager.error ? /* @__PURE__ */ jsx23("p", { "data-keepkit": "collection-manager-error", role: "alert", children: manager.error }) : null,
|
|
5654
|
+
manager.collections.length > 0 ? /* @__PURE__ */ jsx23("ul", { "data-keepkit": "collection-manager-list", children: manager.collections.map((collection) => {
|
|
5655
|
+
const name = collectionLabels?.[collection.id] ?? collection.name;
|
|
5656
|
+
const isEditing = manager.editingId === collection.id;
|
|
5657
|
+
const isPendingDelete = manager.pendingDeleteId === collection.id;
|
|
5658
|
+
return /* @__PURE__ */ jsx23("li", { "data-keepkit": "collection-manager-item", children: isEditing && allowRename ? /* @__PURE__ */ jsxs20(
|
|
5659
|
+
"form",
|
|
5660
|
+
{
|
|
5661
|
+
"data-keepkit": "collection-manager-rename",
|
|
5662
|
+
onSubmit: (event) => {
|
|
5663
|
+
event.preventDefault();
|
|
5664
|
+
void manager.rename(collection.id);
|
|
5665
|
+
},
|
|
5666
|
+
children: [
|
|
5667
|
+
/* @__PURE__ */ jsxs20("label", { htmlFor: `${headingId}-rename-${collection.id}`, children: [
|
|
5668
|
+
renameLabel,
|
|
5669
|
+
": ",
|
|
5670
|
+
name
|
|
5671
|
+
] }),
|
|
5672
|
+
/* @__PURE__ */ jsx23(
|
|
5673
|
+
"input",
|
|
5674
|
+
{
|
|
5675
|
+
id: `${headingId}-rename-${collection.id}`,
|
|
5676
|
+
value: manager.editingName,
|
|
5677
|
+
onChange: (event) => manager.setEditingName(event.currentTarget.value),
|
|
5678
|
+
disabled: manager.isMutating,
|
|
5679
|
+
"data-keep-action": "rename-collection-input"
|
|
5680
|
+
}
|
|
5681
|
+
),
|
|
5682
|
+
/* @__PURE__ */ jsx23(
|
|
5683
|
+
"button",
|
|
5684
|
+
{
|
|
5685
|
+
type: "submit",
|
|
5686
|
+
disabled: manager.isMutating || !manager.editingName.trim(),
|
|
5687
|
+
"data-keep-action": "rename-collection",
|
|
5688
|
+
children: renameSubmitLabel
|
|
5689
|
+
}
|
|
5690
|
+
),
|
|
5691
|
+
/* @__PURE__ */ jsx23(
|
|
5692
|
+
"button",
|
|
5693
|
+
{
|
|
5694
|
+
type: "button",
|
|
5695
|
+
onClick: manager.cancelRename,
|
|
5696
|
+
disabled: manager.isMutating,
|
|
5697
|
+
"data-keep-action": "cancel-rename-collection",
|
|
5698
|
+
children: cancelLabel
|
|
5699
|
+
}
|
|
5700
|
+
)
|
|
5701
|
+
]
|
|
5702
|
+
}
|
|
5703
|
+
) : /* @__PURE__ */ jsxs20(Fragment13, { children: [
|
|
5704
|
+
/* @__PURE__ */ jsxs20("div", { "data-keepkit": "collection-manager-summary", children: [
|
|
5705
|
+
/* @__PURE__ */ jsx23("span", { "data-keepkit": "collection-manager-name", children: name }),
|
|
5706
|
+
showCounts ? /* @__PURE__ */ jsxs20("span", { "data-keepkit": "collection-manager-count", children: [
|
|
5707
|
+
collection.count,
|
|
5708
|
+
" ",
|
|
5709
|
+
collection.count === 1 ? itemLabel : itemsLabel
|
|
5710
|
+
] }) : null
|
|
5711
|
+
] }),
|
|
5712
|
+
isPendingDelete && allowDelete ? /* @__PURE__ */ jsxs20("fieldset", { "data-keepkit": "collection-manager-delete-confirmation", children: [
|
|
5713
|
+
/* @__PURE__ */ jsx23("legend", { children: deleteConfirmLabel }),
|
|
5714
|
+
/* @__PURE__ */ jsx23(
|
|
5715
|
+
"button",
|
|
5716
|
+
{
|
|
5717
|
+
type: "button",
|
|
5718
|
+
onClick: () => void manager.confirmDelete(),
|
|
5719
|
+
disabled: manager.isMutating,
|
|
5720
|
+
"data-keep-action": "delete-collection-confirm",
|
|
5721
|
+
children: deleteSubmitLabel
|
|
5722
|
+
}
|
|
5723
|
+
),
|
|
5724
|
+
/* @__PURE__ */ jsx23(
|
|
5725
|
+
"button",
|
|
5726
|
+
{
|
|
5727
|
+
type: "button",
|
|
5728
|
+
onClick: manager.cancelDelete,
|
|
5729
|
+
disabled: manager.isMutating,
|
|
5730
|
+
"data-keep-action": "cancel-delete-collection",
|
|
5731
|
+
children: cancelLabel
|
|
5732
|
+
}
|
|
5733
|
+
)
|
|
5734
|
+
] }) : /* @__PURE__ */ jsxs20("div", { "data-keepkit": "collection-manager-actions", children: [
|
|
5735
|
+
allowRename ? /* @__PURE__ */ jsx23(
|
|
5736
|
+
"button",
|
|
5737
|
+
{
|
|
5738
|
+
type: "button",
|
|
5739
|
+
onClick: () => manager.beginRename(collection.id),
|
|
5740
|
+
disabled: manager.isMutating,
|
|
5741
|
+
"aria-label": `${renameLabel} ${name}`,
|
|
5742
|
+
"data-keep-action": "rename-collection",
|
|
5743
|
+
children: renameLabel
|
|
5744
|
+
}
|
|
5745
|
+
) : null,
|
|
5746
|
+
allowDelete ? /* @__PURE__ */ jsx23(
|
|
5747
|
+
"button",
|
|
5748
|
+
{
|
|
5749
|
+
type: "button",
|
|
5750
|
+
onClick: () => manager.requestDelete(collection.id),
|
|
5751
|
+
disabled: manager.isMutating,
|
|
5752
|
+
"aria-label": `${deleteLabel} ${name}`,
|
|
5753
|
+
"data-keep-action": "delete-collection",
|
|
5754
|
+
children: deleteLabel
|
|
5755
|
+
}
|
|
5756
|
+
) : null
|
|
5757
|
+
] })
|
|
5758
|
+
] }) }, collection.id);
|
|
5759
|
+
}) }) : hasRenderableContent(empty) ? /* @__PURE__ */ jsx23("div", { "data-keepkit": "collection-manager-empty", children: empty }) : null
|
|
5760
|
+
]
|
|
5761
|
+
}
|
|
5762
|
+
);
|
|
5763
|
+
}
|
|
5764
|
+
|
|
5321
5765
|
// src/features/collection/KeepLayout.tsx
|
|
5322
|
-
import { jsx as
|
|
5766
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
5323
5767
|
function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...props }) {
|
|
5324
5768
|
const roving = useRovingTabIndex();
|
|
5325
5769
|
return (
|
|
5326
5770
|
// biome-ignore lint/a11y/noStaticElementInteractions: The group manages keyboard focus for descendant cards.
|
|
5327
|
-
/* @__PURE__ */
|
|
5771
|
+
/* @__PURE__ */ jsx24(
|
|
5328
5772
|
"div",
|
|
5329
5773
|
{
|
|
5330
5774
|
...props,
|
|
@@ -5351,7 +5795,7 @@ function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...p
|
|
|
5351
5795
|
import { isValidElement as isValidElement7 } from "react";
|
|
5352
5796
|
|
|
5353
5797
|
// src/features/navigation/KeepShortcutHint.tsx
|
|
5354
|
-
import { jsx as
|
|
5798
|
+
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5355
5799
|
function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
5356
5800
|
const keys = typeof shortcut === "string" ? shortcut.split("+") : [...shortcut];
|
|
5357
5801
|
const occurrences = /* @__PURE__ */ new Map();
|
|
@@ -5360,24 +5804,24 @@ function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
|
5360
5804
|
occurrences.set(key, occurrence + 1);
|
|
5361
5805
|
return { id: `${key}-${occurrence}`, value: key };
|
|
5362
5806
|
});
|
|
5363
|
-
return /* @__PURE__ */
|
|
5364
|
-
index > 0 ? /* @__PURE__ */
|
|
5365
|
-
/* @__PURE__ */
|
|
5807
|
+
return /* @__PURE__ */ jsx25("span", { ...props, "data-keepkit": "shortcut-hint", "aria-hidden": props["aria-hidden"] ?? true, children: keyedKeys.map((key, index) => /* @__PURE__ */ jsxs21("span", { children: [
|
|
5808
|
+
index > 0 ? /* @__PURE__ */ jsx25("span", { "data-shortcut-separator": "true", children: separator }) : null,
|
|
5809
|
+
/* @__PURE__ */ jsx25("kbd", { children: key.value.trim() })
|
|
5366
5810
|
] }, key.id)) });
|
|
5367
5811
|
}
|
|
5368
5812
|
|
|
5369
5813
|
// src/features/editor/hooks/useKeepNoteEditor.ts
|
|
5370
5814
|
import { useKeepItem as useKeepItem6 } from "@keepkit/core/react";
|
|
5371
|
-
import { useCallback as
|
|
5815
|
+
import { useCallback as useCallback7, useEffect as useEffect11, useRef as useRef9, useState as useState17 } from "react";
|
|
5372
5816
|
function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
5373
5817
|
const itemState = useKeepItem6(item);
|
|
5374
5818
|
const { error, isMutating, item: savedItem, updateNote } = itemState;
|
|
5375
|
-
const [note, setNote] =
|
|
5819
|
+
const [note, setNote] = useState17(item.note ?? "");
|
|
5376
5820
|
const baselineNote = savedItem?.note ?? item.note ?? "";
|
|
5377
5821
|
const isDirty = note !== baselineNote;
|
|
5378
5822
|
const lastSavedNoteRef = useRef9(void 0);
|
|
5379
5823
|
useEffect11(() => setNote(baselineNote), [baselineNote]);
|
|
5380
|
-
const save =
|
|
5824
|
+
const save = useCallback7(async () => {
|
|
5381
5825
|
const nextNote = note.trim() || void 0;
|
|
5382
5826
|
try {
|
|
5383
5827
|
await updateNote(nextNote);
|
|
@@ -5423,7 +5867,7 @@ function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
|
5423
5867
|
}
|
|
5424
5868
|
|
|
5425
5869
|
// src/features/editor/KeepNoteEditor.tsx
|
|
5426
|
-
import { Fragment as
|
|
5870
|
+
import { Fragment as Fragment14, jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5427
5871
|
function KeepNoteEditor({
|
|
5428
5872
|
item,
|
|
5429
5873
|
label,
|
|
@@ -5446,10 +5890,10 @@ function KeepNoteEditor({
|
|
|
5446
5890
|
const saveAccessibleLabel = useUiLabel("saveNote");
|
|
5447
5891
|
const { error, isDirty, isSaving, note, setNote } = view.state;
|
|
5448
5892
|
const contentChildren = asChild && isValidElement7(children) ? void 0 : children;
|
|
5449
|
-
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */
|
|
5450
|
-
/* @__PURE__ */
|
|
5893
|
+
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */ jsxs22(Fragment14, { children: [
|
|
5894
|
+
/* @__PURE__ */ jsxs22("label", { children: [
|
|
5451
5895
|
showNoteLabel ? label ?? view.labels.note : null,
|
|
5452
|
-
/* @__PURE__ */
|
|
5896
|
+
/* @__PURE__ */ jsx26(
|
|
5453
5897
|
"textarea",
|
|
5454
5898
|
{
|
|
5455
5899
|
"data-keep-action": "edit-note",
|
|
@@ -5462,7 +5906,7 @@ function KeepNoteEditor({
|
|
|
5462
5906
|
}
|
|
5463
5907
|
)
|
|
5464
5908
|
] }),
|
|
5465
|
-
/* @__PURE__ */
|
|
5909
|
+
/* @__PURE__ */ jsxs22(
|
|
5466
5910
|
"button",
|
|
5467
5911
|
{
|
|
5468
5912
|
type: "submit",
|
|
@@ -5472,13 +5916,13 @@ function KeepNoteEditor({
|
|
|
5472
5916
|
"aria-label": showSaveLabel ? void 0 : saveAccessibleLabel,
|
|
5473
5917
|
children: [
|
|
5474
5918
|
showSaveLabel ? saveLabel ?? view.labels.save : null,
|
|
5475
|
-
showShortcutHint ? /* @__PURE__ */
|
|
5919
|
+
showShortcutHint ? /* @__PURE__ */ jsx26(KeepShortcutHint, { shortcut: "Ctrl+Enter" }) : null
|
|
5476
5920
|
]
|
|
5477
5921
|
}
|
|
5478
5922
|
)
|
|
5479
5923
|
] });
|
|
5480
5924
|
if (!asChild) {
|
|
5481
|
-
return /* @__PURE__ */
|
|
5925
|
+
return /* @__PURE__ */ jsxs22(
|
|
5482
5926
|
"form",
|
|
5483
5927
|
{
|
|
5484
5928
|
...formProps,
|
|
@@ -5491,7 +5935,7 @@ function KeepNoteEditor({
|
|
|
5491
5935
|
"data-disabled": isSaving ? "true" : void 0,
|
|
5492
5936
|
children: [
|
|
5493
5937
|
body,
|
|
5494
|
-
error ? /* @__PURE__ */
|
|
5938
|
+
error ? /* @__PURE__ */ jsx26("p", { role: "alert", children: getErrorMessage4(error, view.labels.error) }) : null
|
|
5495
5939
|
]
|
|
5496
5940
|
}
|
|
5497
5941
|
);
|
|
@@ -5519,13 +5963,13 @@ function getErrorMessage4(error, fallback) {
|
|
|
5519
5963
|
|
|
5520
5964
|
// src/features/editor/hooks/useKeepTagEditor.ts
|
|
5521
5965
|
import { useKeepItem as useKeepItem7 } from "@keepkit/core/react";
|
|
5522
|
-
import { useCallback as
|
|
5966
|
+
import { useCallback as useCallback8, useEffect as useEffect12, useState as useState18 } from "react";
|
|
5523
5967
|
function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
5524
5968
|
const itemState = useKeepItem7(item);
|
|
5525
|
-
const [tags, setTags] =
|
|
5526
|
-
const [input, setInput] =
|
|
5969
|
+
const [tags, setTags] = useState18(item.tags ?? []);
|
|
5970
|
+
const [input, setInput] = useState18("");
|
|
5527
5971
|
useEffect12(() => setTags(itemState.item?.tags ?? item.tags ?? []), [item.tags, itemState.item?.tags]);
|
|
5528
|
-
const save =
|
|
5972
|
+
const save = useCallback8(async () => {
|
|
5529
5973
|
const nextTags = normalizeUiTags(tags);
|
|
5530
5974
|
try {
|
|
5531
5975
|
await itemState.updateTags(nextTags);
|
|
@@ -5571,7 +6015,7 @@ function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
|
5571
6015
|
}
|
|
5572
6016
|
|
|
5573
6017
|
// src/features/editor/KeepTagEditor.tsx
|
|
5574
|
-
import { Fragment as
|
|
6018
|
+
import { Fragment as Fragment15, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5575
6019
|
function KeepTagEditor({
|
|
5576
6020
|
item,
|
|
5577
6021
|
availableTags = [],
|
|
@@ -5586,10 +6030,10 @@ function KeepTagEditor({
|
|
|
5586
6030
|
const showRemoveLabel = useUiLabelVisibility("remove");
|
|
5587
6031
|
const showApplyLabel = useUiLabelVisibility("applyTags");
|
|
5588
6032
|
const { isSaving, tags } = view.state;
|
|
5589
|
-
const body = render ? render(view.state) : /* @__PURE__ */
|
|
5590
|
-
/* @__PURE__ */
|
|
6033
|
+
const body = render ? render(view.state) : /* @__PURE__ */ jsxs23(Fragment15, { children: [
|
|
6034
|
+
/* @__PURE__ */ jsxs23("label", { children: [
|
|
5591
6035
|
showTagsLabel ? view.labels.tags : null,
|
|
5592
|
-
/* @__PURE__ */
|
|
6036
|
+
/* @__PURE__ */ jsx27(
|
|
5593
6037
|
"input",
|
|
5594
6038
|
{
|
|
5595
6039
|
"data-keep-action": "edit-tags",
|
|
@@ -5601,10 +6045,10 @@ function KeepTagEditor({
|
|
|
5601
6045
|
}
|
|
5602
6046
|
)
|
|
5603
6047
|
] }),
|
|
5604
|
-
availableTags.length > 0 ? /* @__PURE__ */
|
|
5605
|
-
/* @__PURE__ */
|
|
6048
|
+
availableTags.length > 0 ? /* @__PURE__ */ jsx27("datalist", { id: `keep-tags-${item.id}`, children: availableTags.map((tag) => /* @__PURE__ */ jsx27("option", { value: tag }, tag)) }) : null,
|
|
6049
|
+
/* @__PURE__ */ jsx27("ul", { "aria-label": view.labels.tags, children: tags.map((tag) => /* @__PURE__ */ jsxs23("li", { children: [
|
|
5606
6050
|
tag,
|
|
5607
|
-
/* @__PURE__ */
|
|
6051
|
+
/* @__PURE__ */ jsx27(
|
|
5608
6052
|
"button",
|
|
5609
6053
|
{
|
|
5610
6054
|
type: "button",
|
|
@@ -5615,7 +6059,7 @@ function KeepTagEditor({
|
|
|
5615
6059
|
}
|
|
5616
6060
|
)
|
|
5617
6061
|
] }, tag)) }),
|
|
5618
|
-
/* @__PURE__ */
|
|
6062
|
+
/* @__PURE__ */ jsx27(
|
|
5619
6063
|
"button",
|
|
5620
6064
|
{
|
|
5621
6065
|
type: "submit",
|
|
@@ -5627,7 +6071,7 @@ function KeepTagEditor({
|
|
|
5627
6071
|
}
|
|
5628
6072
|
)
|
|
5629
6073
|
] });
|
|
5630
|
-
return /* @__PURE__ */
|
|
6074
|
+
return /* @__PURE__ */ jsxs23(
|
|
5631
6075
|
"form",
|
|
5632
6076
|
{
|
|
5633
6077
|
...props,
|
|
@@ -5639,7 +6083,7 @@ function KeepTagEditor({
|
|
|
5639
6083
|
"data-disabled": isSaving ? "true" : void 0,
|
|
5640
6084
|
children: [
|
|
5641
6085
|
body,
|
|
5642
|
-
view.error ? /* @__PURE__ */
|
|
6086
|
+
view.error ? /* @__PURE__ */ jsx27("p", { role: "alert", children: getErrorMessage5(view.error, view.labels.error) }) : null
|
|
5643
6087
|
]
|
|
5644
6088
|
}
|
|
5645
6089
|
);
|
|
@@ -5649,9 +6093,9 @@ function getErrorMessage5(error, fallback) {
|
|
|
5649
6093
|
}
|
|
5650
6094
|
|
|
5651
6095
|
// src/features/feedback/useKeepToastFeedback.ts
|
|
5652
|
-
import { useCallback as
|
|
6096
|
+
import { useCallback as useCallback9 } from "react";
|
|
5653
6097
|
function useKeepToastFeedback(showToast) {
|
|
5654
|
-
return
|
|
6098
|
+
return useCallback9(
|
|
5655
6099
|
(event) => {
|
|
5656
6100
|
if (!("undo" in event)) {
|
|
5657
6101
|
showToast(event.message);
|
|
@@ -5670,7 +6114,7 @@ function useKeepToastFeedback(showToast) {
|
|
|
5670
6114
|
|
|
5671
6115
|
// src/features/navigation/KeepTourBar.tsx
|
|
5672
6116
|
import { useKeepNavigator } from "@keepkit/core/react";
|
|
5673
|
-
import { useId as
|
|
6117
|
+
import { useId as useId6 } from "react";
|
|
5674
6118
|
|
|
5675
6119
|
// src/features/navigation/hooks/useKeepTourShortcuts.ts
|
|
5676
6120
|
import { useEffect as useEffect13 } from "react";
|
|
@@ -5705,7 +6149,7 @@ function isEditableTarget(target) {
|
|
|
5705
6149
|
}
|
|
5706
6150
|
|
|
5707
6151
|
// src/features/navigation/KeepTourBar.tsx
|
|
5708
|
-
import { Fragment as
|
|
6152
|
+
import { Fragment as Fragment16, jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5709
6153
|
function KeepTourBar({
|
|
5710
6154
|
navigation: providedNavigation,
|
|
5711
6155
|
currentId,
|
|
@@ -5775,9 +6219,9 @@ function KeepTourBar({
|
|
|
5775
6219
|
return resolvedPrev();
|
|
5776
6220
|
}
|
|
5777
6221
|
});
|
|
5778
|
-
const body = /* @__PURE__ */
|
|
5779
|
-
showProgress ? /* @__PURE__ */
|
|
5780
|
-
/* @__PURE__ */
|
|
6222
|
+
const body = /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
6223
|
+
showProgress ? /* @__PURE__ */ jsx28("span", { "data-keepkit": "tour-progress", "aria-live": "polite", children: progress ?? `${navigation.currentPosition ?? 0} / ${navigation.items.length}` }) : null,
|
|
6224
|
+
/* @__PURE__ */ jsx28(
|
|
5781
6225
|
TourAction,
|
|
5782
6226
|
{
|
|
5783
6227
|
href: resolvedPrevHref,
|
|
@@ -5785,7 +6229,7 @@ function KeepTourBar({
|
|
|
5785
6229
|
onClick: resolvedPrevHref ? notifyPrevNavigation : resolvedPrev,
|
|
5786
6230
|
"data-keep-action": "tour-prev",
|
|
5787
6231
|
shortcut: showShortcutHint ? shortcutOptions?.prevKeys?.[0] ?? "K" : void 0,
|
|
5788
|
-
preview: navigation.prevItem ? /* @__PURE__ */
|
|
6232
|
+
preview: navigation.prevItem ? /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
5789
6233
|
previousLabel,
|
|
5790
6234
|
": ",
|
|
5791
6235
|
getItemTitle(navigation.prevItem)
|
|
@@ -5793,7 +6237,7 @@ function KeepTourBar({
|
|
|
5793
6237
|
children: previousLabel
|
|
5794
6238
|
}
|
|
5795
6239
|
),
|
|
5796
|
-
/* @__PURE__ */
|
|
6240
|
+
/* @__PURE__ */ jsx28(
|
|
5797
6241
|
TourAction,
|
|
5798
6242
|
{
|
|
5799
6243
|
href: resolvedNextHref,
|
|
@@ -5801,7 +6245,7 @@ function KeepTourBar({
|
|
|
5801
6245
|
onClick: resolvedNextHref ? notifyNextNavigation : resolvedNext,
|
|
5802
6246
|
"data-keep-action": "tour-next",
|
|
5803
6247
|
shortcut: showShortcutHint ? shortcutOptions?.nextKeys?.[0] ?? "J" : void 0,
|
|
5804
|
-
preview: navigation.nextItem ? /* @__PURE__ */
|
|
6248
|
+
preview: navigation.nextItem ? /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
5805
6249
|
nextItemLabel,
|
|
5806
6250
|
": ",
|
|
5807
6251
|
getItemTitle(navigation.nextItem)
|
|
@@ -5809,7 +6253,7 @@ function KeepTourBar({
|
|
|
5809
6253
|
children: nextItemLabel
|
|
5810
6254
|
}
|
|
5811
6255
|
),
|
|
5812
|
-
resolvedBackHref || onBack ? /* @__PURE__ */
|
|
6256
|
+
resolvedBackHref || onBack ? /* @__PURE__ */ jsx28(TourAction, { href: resolvedBackHref, onClick: onBack, "data-keep-action": "tour-back", children: listLabel }) : null
|
|
5813
6257
|
] });
|
|
5814
6258
|
return renderRoot(
|
|
5815
6259
|
asChild,
|
|
@@ -5820,14 +6264,14 @@ function KeepTourBar({
|
|
|
5820
6264
|
);
|
|
5821
6265
|
}
|
|
5822
6266
|
function TourAction({ href, disabled = false, onClick, children, preview, shortcut, ...props }) {
|
|
5823
|
-
const previewId =
|
|
5824
|
-
const content = /* @__PURE__ */
|
|
5825
|
-
/* @__PURE__ */
|
|
5826
|
-
shortcut ? /* @__PURE__ */
|
|
5827
|
-
preview ? /* @__PURE__ */
|
|
6267
|
+
const previewId = useId6();
|
|
6268
|
+
const content = /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
6269
|
+
/* @__PURE__ */ jsx28("span", { "data-tour-label": "true", children }),
|
|
6270
|
+
shortcut ? /* @__PURE__ */ jsx28(KeepShortcutHint, { shortcut }) : null,
|
|
6271
|
+
preview ? /* @__PURE__ */ jsx28("small", { id: previewId, "data-tour-preview": "true", children: preview }) : null
|
|
5828
6272
|
] });
|
|
5829
6273
|
if (href && !disabled) {
|
|
5830
|
-
return /* @__PURE__ */
|
|
6274
|
+
return /* @__PURE__ */ jsx28(
|
|
5831
6275
|
"a",
|
|
5832
6276
|
{
|
|
5833
6277
|
...props,
|
|
@@ -5839,7 +6283,7 @@ function TourAction({ href, disabled = false, onClick, children, preview, shortc
|
|
|
5839
6283
|
}
|
|
5840
6284
|
);
|
|
5841
6285
|
}
|
|
5842
|
-
return /* @__PURE__ */
|
|
6286
|
+
return /* @__PURE__ */ jsx28(
|
|
5843
6287
|
"button",
|
|
5844
6288
|
{
|
|
5845
6289
|
...props,
|
|
@@ -5862,10 +6306,10 @@ function navigateTo(item, href) {
|
|
|
5862
6306
|
import { isValidElement as isValidElement8 } from "react";
|
|
5863
6307
|
|
|
5864
6308
|
// src/features/status/hooks/useStatusViews.ts
|
|
5865
|
-
import { useKeepContext as
|
|
5866
|
-
import { useEffect as useEffect14, useRef as useRef10, useState as
|
|
6309
|
+
import { useKeepContext as useKeepContext7 } from "@keepkit/core/react";
|
|
6310
|
+
import { useEffect as useEffect14, useRef as useRef10, useState as useState19 } from "react";
|
|
5867
6311
|
function useKeepStatus(status) {
|
|
5868
|
-
const context =
|
|
6312
|
+
const context = useKeepContext7();
|
|
5869
6313
|
const resolvedStatus = status ?? getDerivedStatus(context);
|
|
5870
6314
|
const state = {
|
|
5871
6315
|
status: resolvedStatus,
|
|
@@ -5876,11 +6320,11 @@ function useKeepStatus(status) {
|
|
|
5876
6320
|
return { state, defaultLabel: useUiLabel(getStatusLabelKey3(resolvedStatus)) };
|
|
5877
6321
|
}
|
|
5878
6322
|
function useKeepAnnouncements(messages) {
|
|
5879
|
-
const context =
|
|
6323
|
+
const context = useKeepContext7();
|
|
5880
6324
|
const savedMessage = useUiLabel("savedMessage", messages?.save);
|
|
5881
6325
|
const removedMessage = useUiLabel("removedMessage", messages?.remove);
|
|
5882
6326
|
const noteSavedMessage = useUiLabel("noteSavedMessage", messages?.note);
|
|
5883
|
-
const [message, setMessage] =
|
|
6327
|
+
const [message, setMessage] = useState19("");
|
|
5884
6328
|
const lastChangeRef = useRef10(void 0);
|
|
5885
6329
|
useEffect14(() => {
|
|
5886
6330
|
const change = context.lastChange;
|
|
@@ -5910,7 +6354,7 @@ function getStatusLabelKey3(status) {
|
|
|
5910
6354
|
}
|
|
5911
6355
|
|
|
5912
6356
|
// src/features/status/status.tsx
|
|
5913
|
-
import { jsx as
|
|
6357
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
5914
6358
|
function KeepStatus({
|
|
5915
6359
|
status,
|
|
5916
6360
|
labels,
|
|
@@ -5942,7 +6386,7 @@ function KeepStatus({
|
|
|
5942
6386
|
}
|
|
5943
6387
|
function KeepAnnouncements({ messages, ...props }) {
|
|
5944
6388
|
const message = useKeepAnnouncements(messages);
|
|
5945
|
-
return /* @__PURE__ */
|
|
6389
|
+
return /* @__PURE__ */ jsx29(
|
|
5946
6390
|
"div",
|
|
5947
6391
|
{
|
|
5948
6392
|
...props,
|
|
@@ -5958,10 +6402,10 @@ function KeepAnnouncements({ messages, ...props }) {
|
|
|
5958
6402
|
var KeepAnnouncer = KeepAnnouncements;
|
|
5959
6403
|
|
|
5960
6404
|
// src/features/sync/hooks/useKeepSyncFeedback.ts
|
|
5961
|
-
import { useKeepContext as
|
|
6405
|
+
import { useKeepContext as useKeepContext8 } from "@keepkit/core/react";
|
|
5962
6406
|
import { useEffect as useEffect15, useRef as useRef11 } from "react";
|
|
5963
6407
|
function useKeepSyncFeedback() {
|
|
5964
|
-
const { syncState } =
|
|
6408
|
+
const { syncState } = useKeepContext8();
|
|
5965
6409
|
const emitFeedback = useKeepUiFeedback();
|
|
5966
6410
|
const completedMessage = useUiLabel("syncSynced");
|
|
5967
6411
|
const failedMessage = useUiLabel("syncFailedMessage");
|
|
@@ -5986,16 +6430,16 @@ function KeepSyncFeedbackObserver() {
|
|
|
5986
6430
|
}
|
|
5987
6431
|
|
|
5988
6432
|
// src/features/sync/hooks/useKeepSyncRecoveryDialog.ts
|
|
5989
|
-
import { useKeepContext as
|
|
5990
|
-
import { useEffect as useEffect16, useState as
|
|
6433
|
+
import { useKeepContext as useKeepContext9 } from "@keepkit/core/react";
|
|
6434
|
+
import { useEffect as useEffect16, useState as useState20 } from "react";
|
|
5991
6435
|
function useKeepSyncRecoveryDialog(options) {
|
|
5992
6436
|
const { open, onOpenChange, conflicts, onManualMerge } = options;
|
|
5993
|
-
const context =
|
|
6437
|
+
const context = useKeepContext9();
|
|
5994
6438
|
const conflictList = conflicts ?? context.syncState.conflicts ?? [];
|
|
5995
6439
|
const hasRecovery = conflictList.length > 0 || context.syncState.status === "error" || Boolean(context.error);
|
|
5996
|
-
const [dismissed, setDismissed] =
|
|
5997
|
-
const [busyId, setBusyId] =
|
|
5998
|
-
const [error, setError] =
|
|
6440
|
+
const [dismissed, setDismissed] = useState20(false);
|
|
6441
|
+
const [busyId, setBusyId] = useState20();
|
|
6442
|
+
const [error, setError] = useState20();
|
|
5999
6443
|
useEffect16(() => {
|
|
6000
6444
|
if (hasRecovery) setDismissed(false);
|
|
6001
6445
|
}, [hasRecovery]);
|
|
@@ -6041,7 +6485,7 @@ function useKeepSyncRecoveryDialog(options) {
|
|
|
6041
6485
|
}
|
|
6042
6486
|
|
|
6043
6487
|
// src/features/sync/KeepSyncRecoveryDialog.tsx
|
|
6044
|
-
import { jsx as
|
|
6488
|
+
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6045
6489
|
function KeepSyncRecoveryDialog({
|
|
6046
6490
|
open,
|
|
6047
6491
|
onOpenChange,
|
|
@@ -6056,7 +6500,7 @@ function KeepSyncRecoveryDialog({
|
|
|
6056
6500
|
}) {
|
|
6057
6501
|
const view = useKeepSyncRecoveryDialog({ open, onOpenChange, conflicts, onManualMerge });
|
|
6058
6502
|
if (!view.isOpen) return null;
|
|
6059
|
-
return /* @__PURE__ */
|
|
6503
|
+
return /* @__PURE__ */ jsxs25(
|
|
6060
6504
|
"section",
|
|
6061
6505
|
{
|
|
6062
6506
|
...props,
|
|
@@ -6070,17 +6514,17 @@ function KeepSyncRecoveryDialog({
|
|
|
6070
6514
|
"data-state": view.conflictList.length > 0 ? "conflict" : "error",
|
|
6071
6515
|
"data-loading": view.busyId !== void 0 ? "true" : void 0,
|
|
6072
6516
|
children: [
|
|
6073
|
-
/* @__PURE__ */
|
|
6074
|
-
/* @__PURE__ */
|
|
6075
|
-
/* @__PURE__ */
|
|
6517
|
+
/* @__PURE__ */ jsxs25("header", { children: [
|
|
6518
|
+
/* @__PURE__ */ jsx30("h2", { id: "keepkit-sync-recovery-title", children: title ?? view.labels.title }),
|
|
6519
|
+
/* @__PURE__ */ jsx30("button", { type: "button", "data-keep-action": "close-dialog", onClick: view.close, "aria-label": view.labels.close, children: view.labels.close })
|
|
6076
6520
|
] }),
|
|
6077
6521
|
children,
|
|
6078
|
-
view.conflictList.length > 0 ? /* @__PURE__ */
|
|
6079
|
-
/* @__PURE__ */
|
|
6080
|
-
view.conflictList.map((conflict) => /* @__PURE__ */
|
|
6081
|
-
/* @__PURE__ */
|
|
6082
|
-
/* @__PURE__ */
|
|
6083
|
-
/* @__PURE__ */
|
|
6522
|
+
view.conflictList.length > 0 ? /* @__PURE__ */ jsxs25("div", { children: [
|
|
6523
|
+
/* @__PURE__ */ jsx30("p", { children: view.labels.conflict }),
|
|
6524
|
+
view.conflictList.map((conflict) => /* @__PURE__ */ jsxs25("article", { "data-conflict-id": conflict.id, children: [
|
|
6525
|
+
/* @__PURE__ */ jsx30("h3", { children: getMetaTitle(conflict.operation.item?.meta) ?? conflict.id }),
|
|
6526
|
+
/* @__PURE__ */ jsxs25("div", { "data-conflict-preview": true, children: [
|
|
6527
|
+
/* @__PURE__ */ jsx30(
|
|
6084
6528
|
ConflictPreview,
|
|
6085
6529
|
{
|
|
6086
6530
|
item: conflict.operation.item,
|
|
@@ -6090,7 +6534,7 @@ function KeepSyncRecoveryDialog({
|
|
|
6090
6534
|
side: "local"
|
|
6091
6535
|
}
|
|
6092
6536
|
),
|
|
6093
|
-
/* @__PURE__ */
|
|
6537
|
+
/* @__PURE__ */ jsx30(
|
|
6094
6538
|
ConflictPreview,
|
|
6095
6539
|
{
|
|
6096
6540
|
item: conflict.remote,
|
|
@@ -6101,8 +6545,8 @@ function KeepSyncRecoveryDialog({
|
|
|
6101
6545
|
}
|
|
6102
6546
|
)
|
|
6103
6547
|
] }),
|
|
6104
|
-
/* @__PURE__ */
|
|
6105
|
-
/* @__PURE__ */
|
|
6548
|
+
/* @__PURE__ */ jsxs25("div", { children: [
|
|
6549
|
+
/* @__PURE__ */ jsx30(
|
|
6106
6550
|
"button",
|
|
6107
6551
|
{
|
|
6108
6552
|
type: "button",
|
|
@@ -6112,7 +6556,7 @@ function KeepSyncRecoveryDialog({
|
|
|
6112
6556
|
children: view.labels.keepLocal
|
|
6113
6557
|
}
|
|
6114
6558
|
),
|
|
6115
|
-
/* @__PURE__ */
|
|
6559
|
+
/* @__PURE__ */ jsx30(
|
|
6116
6560
|
"button",
|
|
6117
6561
|
{
|
|
6118
6562
|
type: "button",
|
|
@@ -6122,7 +6566,7 @@ function KeepSyncRecoveryDialog({
|
|
|
6122
6566
|
children: view.labels.useServer
|
|
6123
6567
|
}
|
|
6124
6568
|
),
|
|
6125
|
-
/* @__PURE__ */
|
|
6569
|
+
/* @__PURE__ */ jsx30(
|
|
6126
6570
|
"button",
|
|
6127
6571
|
{
|
|
6128
6572
|
type: "button",
|
|
@@ -6135,12 +6579,12 @@ function KeepSyncRecoveryDialog({
|
|
|
6135
6579
|
] })
|
|
6136
6580
|
] }, conflict.id))
|
|
6137
6581
|
] }) : null,
|
|
6138
|
-
view.showBackupRecovery ? /* @__PURE__ */
|
|
6139
|
-
/* @__PURE__ */
|
|
6140
|
-
/* @__PURE__ */
|
|
6141
|
-
backup ?? (showBackupControls ? /* @__PURE__ */
|
|
6582
|
+
view.showBackupRecovery ? /* @__PURE__ */ jsxs25("section", { "data-recovery": "backup", children: [
|
|
6583
|
+
/* @__PURE__ */ jsx30("h3", { children: view.labels.backupRecovery }),
|
|
6584
|
+
/* @__PURE__ */ jsx30("p", { children: view.labels.backupRecoveryDescription }),
|
|
6585
|
+
backup ?? (showBackupControls ? /* @__PURE__ */ jsx30(KeepBackup, {}) : null)
|
|
6142
6586
|
] }) : null,
|
|
6143
|
-
view.error ? /* @__PURE__ */
|
|
6587
|
+
view.error ? /* @__PURE__ */ jsx30("p", { id: "keepkit-sync-recovery-error", role: "alert", "aria-live": "assertive", children: view.error instanceof Error ? view.error.message : view.labels.error }) : null
|
|
6144
6588
|
]
|
|
6145
6589
|
}
|
|
6146
6590
|
);
|
|
@@ -6152,16 +6596,16 @@ function ConflictPreview({
|
|
|
6152
6596
|
noteLabel,
|
|
6153
6597
|
side
|
|
6154
6598
|
}) {
|
|
6155
|
-
return /* @__PURE__ */
|
|
6156
|
-
/* @__PURE__ */
|
|
6157
|
-
/* @__PURE__ */
|
|
6158
|
-
/* @__PURE__ */
|
|
6159
|
-
/* @__PURE__ */
|
|
6160
|
-
/* @__PURE__ */
|
|
6599
|
+
return /* @__PURE__ */ jsxs25("article", { "data-conflict-version": side, "aria-label": heading, children: [
|
|
6600
|
+
/* @__PURE__ */ jsx30("h4", { children: heading }),
|
|
6601
|
+
/* @__PURE__ */ jsxs25("dl", { children: [
|
|
6602
|
+
/* @__PURE__ */ jsxs25("div", { children: [
|
|
6603
|
+
/* @__PURE__ */ jsx30("dt", { children: updatedAtLabel }),
|
|
6604
|
+
/* @__PURE__ */ jsx30("dd", { children: item ? /* @__PURE__ */ jsx30("time", { dateTime: new Date(item.updatedAt).toISOString(), children: formatConflictDate(item.updatedAt) }) : "\u2014" })
|
|
6161
6605
|
] }),
|
|
6162
|
-
/* @__PURE__ */
|
|
6163
|
-
/* @__PURE__ */
|
|
6164
|
-
/* @__PURE__ */
|
|
6606
|
+
/* @__PURE__ */ jsxs25("div", { children: [
|
|
6607
|
+
/* @__PURE__ */ jsx30("dt", { children: noteLabel }),
|
|
6608
|
+
/* @__PURE__ */ jsx30("dd", { children: item?.note || "\u2014" })
|
|
6165
6609
|
] })
|
|
6166
6610
|
] })
|
|
6167
6611
|
] });
|
|
@@ -6171,9 +6615,9 @@ function formatConflictDate(timestamp) {
|
|
|
6171
6615
|
}
|
|
6172
6616
|
|
|
6173
6617
|
// src/features/sync/hooks/useKeepSyncStatusBanner.ts
|
|
6174
|
-
import { useKeepContext as
|
|
6618
|
+
import { useKeepContext as useKeepContext10 } from "@keepkit/core/react";
|
|
6175
6619
|
function useKeepSyncStatusBanner({ onRetry, children }) {
|
|
6176
|
-
const context =
|
|
6620
|
+
const context = useKeepContext10();
|
|
6177
6621
|
const retryLabel = useUiLabel("retrySync");
|
|
6178
6622
|
const resolveLabel = useUiLabel("resolveSync");
|
|
6179
6623
|
const conflictLabel = useUiLabel("syncConflict");
|
|
@@ -6205,7 +6649,7 @@ function getErrorMessage6(error) {
|
|
|
6205
6649
|
}
|
|
6206
6650
|
|
|
6207
6651
|
// src/features/sync/KeepSyncStatusBanner.tsx
|
|
6208
|
-
import { jsx as
|
|
6652
|
+
import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6209
6653
|
function KeepSyncStatusBanner({
|
|
6210
6654
|
onRetry,
|
|
6211
6655
|
onResolveConflicts,
|
|
@@ -6217,7 +6661,7 @@ function KeepSyncStatusBanner({
|
|
|
6217
6661
|
const showRetryLabel = useUiLabelVisibility("retrySync");
|
|
6218
6662
|
const showResolveLabel = useUiLabelVisibility("resolveSync");
|
|
6219
6663
|
if (view.status === "idle" && !view.hasConflicts) return null;
|
|
6220
|
-
return /* @__PURE__ */
|
|
6664
|
+
return /* @__PURE__ */ jsxs26(
|
|
6221
6665
|
"aside",
|
|
6222
6666
|
{
|
|
6223
6667
|
...props,
|
|
@@ -6227,8 +6671,8 @@ function KeepSyncStatusBanner({
|
|
|
6227
6671
|
"data-keepkit": "sync-status",
|
|
6228
6672
|
"data-state": view.status,
|
|
6229
6673
|
children: [
|
|
6230
|
-
/* @__PURE__ */
|
|
6231
|
-
view.showRetry ? /* @__PURE__ */
|
|
6674
|
+
/* @__PURE__ */ jsx31("p", { children: view.message }),
|
|
6675
|
+
view.showRetry ? /* @__PURE__ */ jsx31(
|
|
6232
6676
|
"button",
|
|
6233
6677
|
{
|
|
6234
6678
|
type: "button",
|
|
@@ -6239,7 +6683,7 @@ function KeepSyncStatusBanner({
|
|
|
6239
6683
|
children: showRetryLabel ? view.retryLabel : null
|
|
6240
6684
|
}
|
|
6241
6685
|
) : null,
|
|
6242
|
-
view.hasConflicts ? /* @__PURE__ */
|
|
6686
|
+
view.hasConflicts ? /* @__PURE__ */ jsx31(
|
|
6243
6687
|
"button",
|
|
6244
6688
|
{
|
|
6245
6689
|
type: "button",
|
|
@@ -6256,7 +6700,7 @@ function KeepSyncStatusBanner({
|
|
|
6256
6700
|
}
|
|
6257
6701
|
|
|
6258
6702
|
// src/features/workspace/hooks/useKeepWorkspace.ts
|
|
6259
|
-
import { useCallback as
|
|
6703
|
+
import { useCallback as useCallback10, useState as useState21 } from "react";
|
|
6260
6704
|
var PRESET_MODULES = {
|
|
6261
6705
|
basic: { syncStatus: false, undo: false, recovery: false, backup: false, stalePrune: false },
|
|
6262
6706
|
standard: { syncStatus: false, undo: true, recovery: false, backup: false, stalePrune: false },
|
|
@@ -6276,16 +6720,16 @@ function useKeepWorkspace({
|
|
|
6276
6720
|
onRecoveryOpenChange,
|
|
6277
6721
|
onResolveConflicts
|
|
6278
6722
|
}) {
|
|
6279
|
-
const [internalRecoveryOpen, setInternalRecoveryOpen] =
|
|
6723
|
+
const [internalRecoveryOpen, setInternalRecoveryOpen] = useState21(false);
|
|
6280
6724
|
const resolvedModules = { ...PRESET_MODULES[preset], ...modules };
|
|
6281
|
-
const setRecoveryOpen =
|
|
6725
|
+
const setRecoveryOpen = useCallback10(
|
|
6282
6726
|
(open) => {
|
|
6283
6727
|
if (recoveryOpen === void 0) setInternalRecoveryOpen(open);
|
|
6284
6728
|
onRecoveryOpenChange?.(open);
|
|
6285
6729
|
},
|
|
6286
6730
|
[onRecoveryOpenChange, recoveryOpen]
|
|
6287
6731
|
);
|
|
6288
|
-
const openRecovery =
|
|
6732
|
+
const openRecovery = useCallback10(() => {
|
|
6289
6733
|
onResolveConflicts?.();
|
|
6290
6734
|
setRecoveryOpen(true);
|
|
6291
6735
|
}, [onResolveConflicts, setRecoveryOpen]);
|
|
@@ -6300,7 +6744,7 @@ function useKeepWorkspace({
|
|
|
6300
6744
|
}
|
|
6301
6745
|
|
|
6302
6746
|
// src/features/workspace/KeepWorkspace.tsx
|
|
6303
|
-
import { jsx as
|
|
6747
|
+
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6304
6748
|
function KeepWorkspace({
|
|
6305
6749
|
preset = "standard",
|
|
6306
6750
|
modules,
|
|
@@ -6339,27 +6783,27 @@ function KeepWorkspace({
|
|
|
6339
6783
|
if (!structuredRegions) return content;
|
|
6340
6784
|
if (!hasRenderableContent(content)) return null;
|
|
6341
6785
|
const resolvedSurface = typeof surface === "string" ? surface : surface[name] ?? "plain";
|
|
6342
|
-
return /* @__PURE__ */
|
|
6786
|
+
return /* @__PURE__ */ jsx32("div", { "data-keepkit": "workspace-region", "data-region": name, "data-surface": resolvedSurface, children: content });
|
|
6343
6787
|
};
|
|
6344
6788
|
const before = resolveOptionalSlot(slots?.before, state);
|
|
6345
6789
|
const syncStatus = view.modules.syncStatus ? resolveSlot(
|
|
6346
6790
|
slots?.syncStatus,
|
|
6347
|
-
/* @__PURE__ */
|
|
6791
|
+
/* @__PURE__ */ jsx32(KeepSyncStatusBanner, { ...syncStatusProps, onResolveConflicts: view.openRecovery }),
|
|
6348
6792
|
state
|
|
6349
6793
|
) : null;
|
|
6350
|
-
const collection = resolveSlot(slots?.collection, /* @__PURE__ */
|
|
6794
|
+
const collection = resolveSlot(slots?.collection, /* @__PURE__ */ jsx32(KeepCollection, { ...resolvedCollectionProps }), state);
|
|
6351
6795
|
const actions = view.modules.backup || view.modules.stalePrune ? resolveSlot(
|
|
6352
6796
|
slots?.actions,
|
|
6353
|
-
/* @__PURE__ */
|
|
6354
|
-
view.modules.stalePrune ? /* @__PURE__ */
|
|
6355
|
-
view.modules.backup ? /* @__PURE__ */
|
|
6797
|
+
/* @__PURE__ */ jsxs27("div", { "data-keepkit": "workspace-actions", children: [
|
|
6798
|
+
view.modules.stalePrune ? /* @__PURE__ */ jsx32(KeepPruneStaleButton, { ...stalePruneProps }) : null,
|
|
6799
|
+
view.modules.backup ? /* @__PURE__ */ jsx32(KeepBackup, { ...backupProps }) : null
|
|
6356
6800
|
] }),
|
|
6357
6801
|
state
|
|
6358
6802
|
) : null;
|
|
6359
|
-
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */
|
|
6803
|
+
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */ jsx32(KeepUndo, { ...undoProps }), state) : null;
|
|
6360
6804
|
const recovery = view.modules.recovery ? resolveSlot(
|
|
6361
6805
|
slots?.recovery,
|
|
6362
|
-
/* @__PURE__ */
|
|
6806
|
+
/* @__PURE__ */ jsx32(
|
|
6363
6807
|
KeepSyncRecoveryDialog,
|
|
6364
6808
|
{
|
|
6365
6809
|
...recoveryProps,
|
|
@@ -6371,7 +6815,7 @@ function KeepWorkspace({
|
|
|
6371
6815
|
) : null;
|
|
6372
6816
|
const additionalContent = resolveOptionalSlot(children, state);
|
|
6373
6817
|
const after = resolveOptionalSlot(slots?.after, state);
|
|
6374
|
-
return /* @__PURE__ */
|
|
6818
|
+
return /* @__PURE__ */ jsxs27(
|
|
6375
6819
|
"section",
|
|
6376
6820
|
{
|
|
6377
6821
|
...props,
|
|
@@ -6404,7 +6848,7 @@ function resolveOptionalSlot(slot, state) {
|
|
|
6404
6848
|
|
|
6405
6849
|
// src/foundation/theme.tsx
|
|
6406
6850
|
import { isValidElement as isValidElement9 } from "react";
|
|
6407
|
-
import { jsx as
|
|
6851
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
6408
6852
|
var keepThemeNames = [
|
|
6409
6853
|
"default",
|
|
6410
6854
|
"ocean",
|
|
@@ -6463,7 +6907,7 @@ function KeepThemeProvider({
|
|
|
6463
6907
|
throw new Error("KeepThemeProvider with asChild requires a single React element child.");
|
|
6464
6908
|
return createSlot(children, rootProps);
|
|
6465
6909
|
}
|
|
6466
|
-
return /* @__PURE__ */
|
|
6910
|
+
return /* @__PURE__ */ jsx33("div", { ...rootProps, children });
|
|
6467
6911
|
}
|
|
6468
6912
|
|
|
6469
6913
|
// src/index.tsx
|
|
@@ -6471,8 +6915,8 @@ import { createAuthenticatedSyncKit } from "@keepkit/core/core";
|
|
|
6471
6915
|
import {
|
|
6472
6916
|
KeepErrorBoundary as KeepErrorBoundary3,
|
|
6473
6917
|
KeepProvider,
|
|
6474
|
-
useKeepCollections as
|
|
6475
|
-
useKeepContext as
|
|
6918
|
+
useKeepCollections as useKeepCollections5,
|
|
6919
|
+
useKeepContext as useKeepContext11,
|
|
6476
6920
|
useKeepItem as useKeepItem8,
|
|
6477
6921
|
useKeepList as useKeepList5,
|
|
6478
6922
|
useKeepNavigator as useKeepNavigator2,
|
|
@@ -6488,7 +6932,7 @@ import {
|
|
|
6488
6932
|
LocalStorageSyncQueueAdapter,
|
|
6489
6933
|
SyncStorageAdapter
|
|
6490
6934
|
} from "@keepkit/core/storage";
|
|
6491
|
-
import { jsx as
|
|
6935
|
+
import { jsx as jsx34, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6492
6936
|
function KeepKitProvider({
|
|
6493
6937
|
labels,
|
|
6494
6938
|
labelOptions,
|
|
@@ -6509,7 +6953,7 @@ function KeepKitProvider({
|
|
|
6509
6953
|
children,
|
|
6510
6954
|
...providerProps
|
|
6511
6955
|
}) {
|
|
6512
|
-
return /* @__PURE__ */
|
|
6956
|
+
return /* @__PURE__ */ jsx34(
|
|
6513
6957
|
KeepUiProvider,
|
|
6514
6958
|
{
|
|
6515
6959
|
labels,
|
|
@@ -6517,7 +6961,7 @@ function KeepKitProvider({
|
|
|
6517
6961
|
locale,
|
|
6518
6962
|
labelResolver,
|
|
6519
6963
|
onFeedback,
|
|
6520
|
-
children: /* @__PURE__ */
|
|
6964
|
+
children: /* @__PURE__ */ jsx34(
|
|
6521
6965
|
KeepThemeProvider,
|
|
6522
6966
|
{
|
|
6523
6967
|
theme,
|
|
@@ -6531,10 +6975,10 @@ function KeepKitProvider({
|
|
|
6531
6975
|
className: themeClassName,
|
|
6532
6976
|
style: themeStyle,
|
|
6533
6977
|
asChild: themeAsChild,
|
|
6534
|
-
children: /* @__PURE__ */
|
|
6535
|
-
/* @__PURE__ */
|
|
6978
|
+
children: /* @__PURE__ */ jsxs28(CoreKeepProvider, { ...providerProps, children: [
|
|
6979
|
+
/* @__PURE__ */ jsx34(KeepSyncFeedbackObserver, {}),
|
|
6536
6980
|
children,
|
|
6537
|
-
/* @__PURE__ */
|
|
6981
|
+
/* @__PURE__ */ jsx34(KeepAnnouncements, {})
|
|
6538
6982
|
] })
|
|
6539
6983
|
}
|
|
6540
6984
|
)
|
|
@@ -6564,7 +7008,7 @@ function createKeepKit(options = {}) {
|
|
|
6564
7008
|
} = options;
|
|
6565
7009
|
const coreKit = createCoreKeepKit(coreOptions);
|
|
6566
7010
|
return {
|
|
6567
|
-
Provider: (props) => /* @__PURE__ */
|
|
7011
|
+
Provider: (props) => /* @__PURE__ */ jsx34(
|
|
6568
7012
|
KeepKitProvider,
|
|
6569
7013
|
{
|
|
6570
7014
|
...coreOptions,
|
|
@@ -6586,9 +7030,9 @@ function createKeepKit(options = {}) {
|
|
|
6586
7030
|
...props
|
|
6587
7031
|
}
|
|
6588
7032
|
),
|
|
6589
|
-
Button: (props) => /* @__PURE__ */
|
|
6590
|
-
Backup: (props) => /* @__PURE__ */
|
|
6591
|
-
Collection: (props) => /* @__PURE__ */
|
|
7033
|
+
Button: (props) => /* @__PURE__ */ jsx34(KeepButton, { ...props }),
|
|
7034
|
+
Backup: (props) => /* @__PURE__ */ jsx34(KeepBackup, { ...props }),
|
|
7035
|
+
Collection: (props) => /* @__PURE__ */ jsx34(
|
|
6592
7036
|
KeepCollection,
|
|
6593
7037
|
{
|
|
6594
7038
|
...props,
|
|
@@ -6599,7 +7043,8 @@ function createKeepKit(options = {}) {
|
|
|
6599
7043
|
}
|
|
6600
7044
|
}
|
|
6601
7045
|
),
|
|
6602
|
-
|
|
7046
|
+
CollectionManager: (props) => /* @__PURE__ */ jsx34(KeepCollectionManager, { ...props }),
|
|
7047
|
+
Workspace: (props) => /* @__PURE__ */ jsx34(
|
|
6603
7048
|
KeepWorkspace,
|
|
6604
7049
|
{
|
|
6605
7050
|
...props,
|
|
@@ -6636,6 +7081,7 @@ export {
|
|
|
6636
7081
|
KeepCollection,
|
|
6637
7082
|
KeepCollectionCreate,
|
|
6638
7083
|
KeepCollectionFilter,
|
|
7084
|
+
KeepCollectionManager,
|
|
6639
7085
|
KeepCollectionSelect,
|
|
6640
7086
|
KeepEmptyState,
|
|
6641
7087
|
KeepErrorBoundary3 as KeepErrorBoundary,
|
|
@@ -6687,8 +7133,8 @@ export {
|
|
|
6687
7133
|
keepThemeNames,
|
|
6688
7134
|
mergeProps,
|
|
6689
7135
|
toggleSelectAll,
|
|
6690
|
-
|
|
6691
|
-
|
|
7136
|
+
useKeepCollections5 as useKeepCollections,
|
|
7137
|
+
useKeepContext11 as useKeepContext,
|
|
6692
7138
|
useKeepItem8 as useKeepItem,
|
|
6693
7139
|
useKeepList5 as useKeepList,
|
|
6694
7140
|
useKeepNavigator2 as useKeepNavigator,
|