@keepkit/ui 0.27.0 → 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 +35 -4
- package/dist/index.js +615 -160
- 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
|
|
@@ -2890,21 +3034,29 @@ function KeepQuickEditor({
|
|
|
2890
3034
|
debounceMs = 300,
|
|
2891
3035
|
onSaved,
|
|
2892
3036
|
onSaveError,
|
|
3037
|
+
features,
|
|
2893
3038
|
...props
|
|
2894
3039
|
}) {
|
|
2895
3040
|
const view = useKeepQuickEditor(item, { debounceMs, onSaved, onSaveError });
|
|
2896
|
-
return /* @__PURE__ */ jsx7(KeepQuickEditorView, { ...props, state: view.state });
|
|
3041
|
+
return /* @__PURE__ */ jsx7(KeepQuickEditorView, { ...props, features, state: view.state });
|
|
2897
3042
|
}
|
|
3043
|
+
var DEFAULT_FEATURES = {
|
|
3044
|
+
note: true,
|
|
3045
|
+
tags: true,
|
|
3046
|
+
collection: true
|
|
3047
|
+
};
|
|
2898
3048
|
function KeepQuickEditorView({
|
|
2899
3049
|
state,
|
|
2900
3050
|
collectionIds,
|
|
2901
3051
|
collectionLabels,
|
|
2902
3052
|
showSaveButton = true,
|
|
3053
|
+
features,
|
|
2903
3054
|
children,
|
|
2904
3055
|
onClose,
|
|
2905
3056
|
focusScopeRef,
|
|
2906
3057
|
...props
|
|
2907
3058
|
}) {
|
|
3059
|
+
const enabled = { ...DEFAULT_FEATURES, ...features };
|
|
2908
3060
|
const collections = useKeepCollections({ targetType: state.item.targetType, orderBy: "name" });
|
|
2909
3061
|
const rootRef = useRef4(null);
|
|
2910
3062
|
const noteLabel = useUiLabel("note");
|
|
@@ -2922,10 +3074,14 @@ function KeepQuickEditorView({
|
|
|
2922
3074
|
const savingLabel = useUiLabel("saving");
|
|
2923
3075
|
const savedLabel = useUiLabel("saved");
|
|
2924
3076
|
const errorLabel = useUiLabel("error");
|
|
3077
|
+
const [tagsInput, setTagsInput] = useState3(() => formatTags(state.tags));
|
|
2925
3078
|
const submit = (event) => {
|
|
2926
3079
|
event.preventDefault();
|
|
2927
3080
|
void state.flush().catch(() => void 0);
|
|
2928
3081
|
};
|
|
3082
|
+
useEffect3(() => {
|
|
3083
|
+
if (!sameTags(parseTags(tagsInput), state.tags)) setTagsInput(formatTags(state.tags));
|
|
3084
|
+
}, [state.tags, tagsInput]);
|
|
2929
3085
|
const onKeyDown = (event) => {
|
|
2930
3086
|
props.onKeyDown?.(event);
|
|
2931
3087
|
if (event.defaultPrevented) return;
|
|
@@ -2937,7 +3093,7 @@ function KeepQuickEditorView({
|
|
|
2937
3093
|
};
|
|
2938
3094
|
const statusMessage = state.saveStatus === "dirty" ? unsavedChangesLabel : state.saveStatus === "saving" ? savingLabel : state.saveStatus === "saved" ? savedLabel : state.saveStatus === "error" ? getErrorMessage2(state.error, errorLabel) : null;
|
|
2939
3095
|
const body = typeof children === "function" ? children(state) : children ?? /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
2940
|
-
/* @__PURE__ */ jsxs5("label", { "data-keep-field": "note", children: [
|
|
3096
|
+
enabled.note ? /* @__PURE__ */ jsxs5("label", { "data-keep-field": "note", children: [
|
|
2941
3097
|
showNoteLabel ? /* @__PURE__ */ jsx7("span", { "data-keep-field-icon": true, children: noteLabel }) : null,
|
|
2942
3098
|
/* @__PURE__ */ jsx7(
|
|
2943
3099
|
"textarea",
|
|
@@ -2947,21 +3103,23 @@ function KeepQuickEditorView({
|
|
|
2947
3103
|
onChange: (event) => state.setNote(event.currentTarget.value)
|
|
2948
3104
|
}
|
|
2949
3105
|
)
|
|
2950
|
-
] }),
|
|
2951
|
-
/* @__PURE__ */ jsxs5("label", { "data-keep-field": "tags", children: [
|
|
3106
|
+
] }) : null,
|
|
3107
|
+
enabled.tags ? /* @__PURE__ */ jsxs5("label", { "data-keep-field": "tags", children: [
|
|
2952
3108
|
showTagsLabel ? /* @__PURE__ */ jsx7("span", { "data-keep-field-icon": true, children: tagsLabel }) : null,
|
|
2953
3109
|
/* @__PURE__ */ jsx7(
|
|
2954
3110
|
"input",
|
|
2955
3111
|
{
|
|
2956
|
-
value:
|
|
3112
|
+
value: tagsInput,
|
|
2957
3113
|
"aria-label": showTagsLabel ? void 0 : tagsLabel,
|
|
2958
|
-
onChange: (event) =>
|
|
2959
|
-
event.currentTarget.value
|
|
2960
|
-
|
|
3114
|
+
onChange: (event) => {
|
|
3115
|
+
const value = event.currentTarget.value;
|
|
3116
|
+
setTagsInput(value);
|
|
3117
|
+
state.setTags(parseTags(value));
|
|
3118
|
+
}
|
|
2961
3119
|
}
|
|
2962
3120
|
)
|
|
2963
|
-
] }),
|
|
2964
|
-
/* @__PURE__ */ jsxs5("label", { "data-keep-field": "collection", children: [
|
|
3121
|
+
] }) : null,
|
|
3122
|
+
enabled.collection ? /* @__PURE__ */ jsxs5("label", { "data-keep-field": "collection", children: [
|
|
2965
3123
|
showCollectionLabel ? /* @__PURE__ */ jsx7("span", { "data-keep-field-icon": true, children: collectionLabel }) : null,
|
|
2966
3124
|
/* @__PURE__ */ jsxs5(
|
|
2967
3125
|
"select",
|
|
@@ -2975,7 +3133,7 @@ function KeepQuickEditorView({
|
|
|
2975
3133
|
]
|
|
2976
3134
|
}
|
|
2977
3135
|
)
|
|
2978
|
-
] }),
|
|
3136
|
+
] }) : null,
|
|
2979
3137
|
statusMessage ? /* @__PURE__ */ jsx7(
|
|
2980
3138
|
"p",
|
|
2981
3139
|
{
|
|
@@ -3033,6 +3191,12 @@ function getErrorMessage2(error, fallback) {
|
|
|
3033
3191
|
function sameTags(left, right) {
|
|
3034
3192
|
return left.length === right.length && left.every((tag, index) => tag === right[index]);
|
|
3035
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
|
+
}
|
|
3036
3200
|
function trapFocus(event, root) {
|
|
3037
3201
|
if (!root) return;
|
|
3038
3202
|
const elements = [
|
|
@@ -4471,6 +4635,7 @@ function KeepItemCardRoot({
|
|
|
4471
4635
|
showEditButton = false,
|
|
4472
4636
|
onEdit,
|
|
4473
4637
|
editSlot,
|
|
4638
|
+
editFeatures,
|
|
4474
4639
|
saveButtonLabels,
|
|
4475
4640
|
asChild = false,
|
|
4476
4641
|
href: hrefOption,
|
|
@@ -4559,7 +4724,7 @@ function KeepItemCardRoot({
|
|
|
4559
4724
|
] }) : null;
|
|
4560
4725
|
const error = view.itemState.error ? /* @__PURE__ */ jsx18("p", { role: "alert", children: getErrorMessage3(view.itemState.error, view.labels.error) }) : null;
|
|
4561
4726
|
const actions = view.statusLabel ? /* @__PURE__ */ jsx18(KeepStaleNotice, { item, onRetry, onRemoved }) : /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
4562
|
-
showEditButton ? isEditOpen ? /* @__PURE__ */ jsx18("div", { id: editPanelId, role: "dialog", "aria-label": editLabel, "data-keepkit": "item-edit-dialog", children: editSlot ? editSlot(item, closeEdit) : /* @__PURE__ */ jsx18(KeepQuickEditor, { item: view.itemState.item ?? item, onClose: closeEdit }) }) : /* @__PURE__ */ jsx18(
|
|
4727
|
+
showEditButton ? isEditOpen ? /* @__PURE__ */ jsx18("div", { id: editPanelId, role: "dialog", "aria-label": editLabel, "data-keepkit": "item-edit-dialog", children: editSlot ? editSlot(item, closeEdit) : /* @__PURE__ */ jsx18(KeepQuickEditor, { item: view.itemState.item ?? item, onClose: closeEdit, features: editFeatures }) }) : /* @__PURE__ */ jsx18(
|
|
4563
4728
|
"button",
|
|
4564
4729
|
{
|
|
4565
4730
|
ref: editTriggerRef,
|
|
@@ -5309,13 +5474,301 @@ function getCollectionState(list) {
|
|
|
5309
5474
|
return "ready";
|
|
5310
5475
|
}
|
|
5311
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
|
+
|
|
5312
5765
|
// src/features/collection/KeepLayout.tsx
|
|
5313
|
-
import { jsx as
|
|
5766
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
5314
5767
|
function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...props }) {
|
|
5315
5768
|
const roving = useRovingTabIndex();
|
|
5316
5769
|
return (
|
|
5317
5770
|
// biome-ignore lint/a11y/noStaticElementInteractions: The group manages keyboard focus for descendant cards.
|
|
5318
|
-
/* @__PURE__ */
|
|
5771
|
+
/* @__PURE__ */ jsx24(
|
|
5319
5772
|
"div",
|
|
5320
5773
|
{
|
|
5321
5774
|
...props,
|
|
@@ -5342,7 +5795,7 @@ function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...p
|
|
|
5342
5795
|
import { isValidElement as isValidElement7 } from "react";
|
|
5343
5796
|
|
|
5344
5797
|
// src/features/navigation/KeepShortcutHint.tsx
|
|
5345
|
-
import { jsx as
|
|
5798
|
+
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5346
5799
|
function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
5347
5800
|
const keys = typeof shortcut === "string" ? shortcut.split("+") : [...shortcut];
|
|
5348
5801
|
const occurrences = /* @__PURE__ */ new Map();
|
|
@@ -5351,24 +5804,24 @@ function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
|
5351
5804
|
occurrences.set(key, occurrence + 1);
|
|
5352
5805
|
return { id: `${key}-${occurrence}`, value: key };
|
|
5353
5806
|
});
|
|
5354
|
-
return /* @__PURE__ */
|
|
5355
|
-
index > 0 ? /* @__PURE__ */
|
|
5356
|
-
/* @__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() })
|
|
5357
5810
|
] }, key.id)) });
|
|
5358
5811
|
}
|
|
5359
5812
|
|
|
5360
5813
|
// src/features/editor/hooks/useKeepNoteEditor.ts
|
|
5361
5814
|
import { useKeepItem as useKeepItem6 } from "@keepkit/core/react";
|
|
5362
|
-
import { useCallback as
|
|
5815
|
+
import { useCallback as useCallback7, useEffect as useEffect11, useRef as useRef9, useState as useState17 } from "react";
|
|
5363
5816
|
function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
5364
5817
|
const itemState = useKeepItem6(item);
|
|
5365
5818
|
const { error, isMutating, item: savedItem, updateNote } = itemState;
|
|
5366
|
-
const [note, setNote] =
|
|
5819
|
+
const [note, setNote] = useState17(item.note ?? "");
|
|
5367
5820
|
const baselineNote = savedItem?.note ?? item.note ?? "";
|
|
5368
5821
|
const isDirty = note !== baselineNote;
|
|
5369
5822
|
const lastSavedNoteRef = useRef9(void 0);
|
|
5370
5823
|
useEffect11(() => setNote(baselineNote), [baselineNote]);
|
|
5371
|
-
const save =
|
|
5824
|
+
const save = useCallback7(async () => {
|
|
5372
5825
|
const nextNote = note.trim() || void 0;
|
|
5373
5826
|
try {
|
|
5374
5827
|
await updateNote(nextNote);
|
|
@@ -5414,7 +5867,7 @@ function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
|
5414
5867
|
}
|
|
5415
5868
|
|
|
5416
5869
|
// src/features/editor/KeepNoteEditor.tsx
|
|
5417
|
-
import { Fragment as
|
|
5870
|
+
import { Fragment as Fragment14, jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5418
5871
|
function KeepNoteEditor({
|
|
5419
5872
|
item,
|
|
5420
5873
|
label,
|
|
@@ -5437,10 +5890,10 @@ function KeepNoteEditor({
|
|
|
5437
5890
|
const saveAccessibleLabel = useUiLabel("saveNote");
|
|
5438
5891
|
const { error, isDirty, isSaving, note, setNote } = view.state;
|
|
5439
5892
|
const contentChildren = asChild && isValidElement7(children) ? void 0 : children;
|
|
5440
|
-
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */
|
|
5441
|
-
/* @__PURE__ */
|
|
5893
|
+
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */ jsxs22(Fragment14, { children: [
|
|
5894
|
+
/* @__PURE__ */ jsxs22("label", { children: [
|
|
5442
5895
|
showNoteLabel ? label ?? view.labels.note : null,
|
|
5443
|
-
/* @__PURE__ */
|
|
5896
|
+
/* @__PURE__ */ jsx26(
|
|
5444
5897
|
"textarea",
|
|
5445
5898
|
{
|
|
5446
5899
|
"data-keep-action": "edit-note",
|
|
@@ -5453,7 +5906,7 @@ function KeepNoteEditor({
|
|
|
5453
5906
|
}
|
|
5454
5907
|
)
|
|
5455
5908
|
] }),
|
|
5456
|
-
/* @__PURE__ */
|
|
5909
|
+
/* @__PURE__ */ jsxs22(
|
|
5457
5910
|
"button",
|
|
5458
5911
|
{
|
|
5459
5912
|
type: "submit",
|
|
@@ -5463,13 +5916,13 @@ function KeepNoteEditor({
|
|
|
5463
5916
|
"aria-label": showSaveLabel ? void 0 : saveAccessibleLabel,
|
|
5464
5917
|
children: [
|
|
5465
5918
|
showSaveLabel ? saveLabel ?? view.labels.save : null,
|
|
5466
|
-
showShortcutHint ? /* @__PURE__ */
|
|
5919
|
+
showShortcutHint ? /* @__PURE__ */ jsx26(KeepShortcutHint, { shortcut: "Ctrl+Enter" }) : null
|
|
5467
5920
|
]
|
|
5468
5921
|
}
|
|
5469
5922
|
)
|
|
5470
5923
|
] });
|
|
5471
5924
|
if (!asChild) {
|
|
5472
|
-
return /* @__PURE__ */
|
|
5925
|
+
return /* @__PURE__ */ jsxs22(
|
|
5473
5926
|
"form",
|
|
5474
5927
|
{
|
|
5475
5928
|
...formProps,
|
|
@@ -5482,7 +5935,7 @@ function KeepNoteEditor({
|
|
|
5482
5935
|
"data-disabled": isSaving ? "true" : void 0,
|
|
5483
5936
|
children: [
|
|
5484
5937
|
body,
|
|
5485
|
-
error ? /* @__PURE__ */
|
|
5938
|
+
error ? /* @__PURE__ */ jsx26("p", { role: "alert", children: getErrorMessage4(error, view.labels.error) }) : null
|
|
5486
5939
|
]
|
|
5487
5940
|
}
|
|
5488
5941
|
);
|
|
@@ -5510,13 +5963,13 @@ function getErrorMessage4(error, fallback) {
|
|
|
5510
5963
|
|
|
5511
5964
|
// src/features/editor/hooks/useKeepTagEditor.ts
|
|
5512
5965
|
import { useKeepItem as useKeepItem7 } from "@keepkit/core/react";
|
|
5513
|
-
import { useCallback as
|
|
5966
|
+
import { useCallback as useCallback8, useEffect as useEffect12, useState as useState18 } from "react";
|
|
5514
5967
|
function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
5515
5968
|
const itemState = useKeepItem7(item);
|
|
5516
|
-
const [tags, setTags] =
|
|
5517
|
-
const [input, setInput] =
|
|
5969
|
+
const [tags, setTags] = useState18(item.tags ?? []);
|
|
5970
|
+
const [input, setInput] = useState18("");
|
|
5518
5971
|
useEffect12(() => setTags(itemState.item?.tags ?? item.tags ?? []), [item.tags, itemState.item?.tags]);
|
|
5519
|
-
const save =
|
|
5972
|
+
const save = useCallback8(async () => {
|
|
5520
5973
|
const nextTags = normalizeUiTags(tags);
|
|
5521
5974
|
try {
|
|
5522
5975
|
await itemState.updateTags(nextTags);
|
|
@@ -5562,7 +6015,7 @@ function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
|
5562
6015
|
}
|
|
5563
6016
|
|
|
5564
6017
|
// src/features/editor/KeepTagEditor.tsx
|
|
5565
|
-
import { Fragment as
|
|
6018
|
+
import { Fragment as Fragment15, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5566
6019
|
function KeepTagEditor({
|
|
5567
6020
|
item,
|
|
5568
6021
|
availableTags = [],
|
|
@@ -5577,10 +6030,10 @@ function KeepTagEditor({
|
|
|
5577
6030
|
const showRemoveLabel = useUiLabelVisibility("remove");
|
|
5578
6031
|
const showApplyLabel = useUiLabelVisibility("applyTags");
|
|
5579
6032
|
const { isSaving, tags } = view.state;
|
|
5580
|
-
const body = render ? render(view.state) : /* @__PURE__ */
|
|
5581
|
-
/* @__PURE__ */
|
|
6033
|
+
const body = render ? render(view.state) : /* @__PURE__ */ jsxs23(Fragment15, { children: [
|
|
6034
|
+
/* @__PURE__ */ jsxs23("label", { children: [
|
|
5582
6035
|
showTagsLabel ? view.labels.tags : null,
|
|
5583
|
-
/* @__PURE__ */
|
|
6036
|
+
/* @__PURE__ */ jsx27(
|
|
5584
6037
|
"input",
|
|
5585
6038
|
{
|
|
5586
6039
|
"data-keep-action": "edit-tags",
|
|
@@ -5592,10 +6045,10 @@ function KeepTagEditor({
|
|
|
5592
6045
|
}
|
|
5593
6046
|
)
|
|
5594
6047
|
] }),
|
|
5595
|
-
availableTags.length > 0 ? /* @__PURE__ */
|
|
5596
|
-
/* @__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: [
|
|
5597
6050
|
tag,
|
|
5598
|
-
/* @__PURE__ */
|
|
6051
|
+
/* @__PURE__ */ jsx27(
|
|
5599
6052
|
"button",
|
|
5600
6053
|
{
|
|
5601
6054
|
type: "button",
|
|
@@ -5606,7 +6059,7 @@ function KeepTagEditor({
|
|
|
5606
6059
|
}
|
|
5607
6060
|
)
|
|
5608
6061
|
] }, tag)) }),
|
|
5609
|
-
/* @__PURE__ */
|
|
6062
|
+
/* @__PURE__ */ jsx27(
|
|
5610
6063
|
"button",
|
|
5611
6064
|
{
|
|
5612
6065
|
type: "submit",
|
|
@@ -5618,7 +6071,7 @@ function KeepTagEditor({
|
|
|
5618
6071
|
}
|
|
5619
6072
|
)
|
|
5620
6073
|
] });
|
|
5621
|
-
return /* @__PURE__ */
|
|
6074
|
+
return /* @__PURE__ */ jsxs23(
|
|
5622
6075
|
"form",
|
|
5623
6076
|
{
|
|
5624
6077
|
...props,
|
|
@@ -5630,7 +6083,7 @@ function KeepTagEditor({
|
|
|
5630
6083
|
"data-disabled": isSaving ? "true" : void 0,
|
|
5631
6084
|
children: [
|
|
5632
6085
|
body,
|
|
5633
|
-
view.error ? /* @__PURE__ */
|
|
6086
|
+
view.error ? /* @__PURE__ */ jsx27("p", { role: "alert", children: getErrorMessage5(view.error, view.labels.error) }) : null
|
|
5634
6087
|
]
|
|
5635
6088
|
}
|
|
5636
6089
|
);
|
|
@@ -5640,9 +6093,9 @@ function getErrorMessage5(error, fallback) {
|
|
|
5640
6093
|
}
|
|
5641
6094
|
|
|
5642
6095
|
// src/features/feedback/useKeepToastFeedback.ts
|
|
5643
|
-
import { useCallback as
|
|
6096
|
+
import { useCallback as useCallback9 } from "react";
|
|
5644
6097
|
function useKeepToastFeedback(showToast) {
|
|
5645
|
-
return
|
|
6098
|
+
return useCallback9(
|
|
5646
6099
|
(event) => {
|
|
5647
6100
|
if (!("undo" in event)) {
|
|
5648
6101
|
showToast(event.message);
|
|
@@ -5661,7 +6114,7 @@ function useKeepToastFeedback(showToast) {
|
|
|
5661
6114
|
|
|
5662
6115
|
// src/features/navigation/KeepTourBar.tsx
|
|
5663
6116
|
import { useKeepNavigator } from "@keepkit/core/react";
|
|
5664
|
-
import { useId as
|
|
6117
|
+
import { useId as useId6 } from "react";
|
|
5665
6118
|
|
|
5666
6119
|
// src/features/navigation/hooks/useKeepTourShortcuts.ts
|
|
5667
6120
|
import { useEffect as useEffect13 } from "react";
|
|
@@ -5696,7 +6149,7 @@ function isEditableTarget(target) {
|
|
|
5696
6149
|
}
|
|
5697
6150
|
|
|
5698
6151
|
// src/features/navigation/KeepTourBar.tsx
|
|
5699
|
-
import { Fragment as
|
|
6152
|
+
import { Fragment as Fragment16, jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5700
6153
|
function KeepTourBar({
|
|
5701
6154
|
navigation: providedNavigation,
|
|
5702
6155
|
currentId,
|
|
@@ -5766,9 +6219,9 @@ function KeepTourBar({
|
|
|
5766
6219
|
return resolvedPrev();
|
|
5767
6220
|
}
|
|
5768
6221
|
});
|
|
5769
|
-
const body = /* @__PURE__ */
|
|
5770
|
-
showProgress ? /* @__PURE__ */
|
|
5771
|
-
/* @__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(
|
|
5772
6225
|
TourAction,
|
|
5773
6226
|
{
|
|
5774
6227
|
href: resolvedPrevHref,
|
|
@@ -5776,7 +6229,7 @@ function KeepTourBar({
|
|
|
5776
6229
|
onClick: resolvedPrevHref ? notifyPrevNavigation : resolvedPrev,
|
|
5777
6230
|
"data-keep-action": "tour-prev",
|
|
5778
6231
|
shortcut: showShortcutHint ? shortcutOptions?.prevKeys?.[0] ?? "K" : void 0,
|
|
5779
|
-
preview: navigation.prevItem ? /* @__PURE__ */
|
|
6232
|
+
preview: navigation.prevItem ? /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
5780
6233
|
previousLabel,
|
|
5781
6234
|
": ",
|
|
5782
6235
|
getItemTitle(navigation.prevItem)
|
|
@@ -5784,7 +6237,7 @@ function KeepTourBar({
|
|
|
5784
6237
|
children: previousLabel
|
|
5785
6238
|
}
|
|
5786
6239
|
),
|
|
5787
|
-
/* @__PURE__ */
|
|
6240
|
+
/* @__PURE__ */ jsx28(
|
|
5788
6241
|
TourAction,
|
|
5789
6242
|
{
|
|
5790
6243
|
href: resolvedNextHref,
|
|
@@ -5792,7 +6245,7 @@ function KeepTourBar({
|
|
|
5792
6245
|
onClick: resolvedNextHref ? notifyNextNavigation : resolvedNext,
|
|
5793
6246
|
"data-keep-action": "tour-next",
|
|
5794
6247
|
shortcut: showShortcutHint ? shortcutOptions?.nextKeys?.[0] ?? "J" : void 0,
|
|
5795
|
-
preview: navigation.nextItem ? /* @__PURE__ */
|
|
6248
|
+
preview: navigation.nextItem ? /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
5796
6249
|
nextItemLabel,
|
|
5797
6250
|
": ",
|
|
5798
6251
|
getItemTitle(navigation.nextItem)
|
|
@@ -5800,7 +6253,7 @@ function KeepTourBar({
|
|
|
5800
6253
|
children: nextItemLabel
|
|
5801
6254
|
}
|
|
5802
6255
|
),
|
|
5803
|
-
resolvedBackHref || onBack ? /* @__PURE__ */
|
|
6256
|
+
resolvedBackHref || onBack ? /* @__PURE__ */ jsx28(TourAction, { href: resolvedBackHref, onClick: onBack, "data-keep-action": "tour-back", children: listLabel }) : null
|
|
5804
6257
|
] });
|
|
5805
6258
|
return renderRoot(
|
|
5806
6259
|
asChild,
|
|
@@ -5811,14 +6264,14 @@ function KeepTourBar({
|
|
|
5811
6264
|
);
|
|
5812
6265
|
}
|
|
5813
6266
|
function TourAction({ href, disabled = false, onClick, children, preview, shortcut, ...props }) {
|
|
5814
|
-
const previewId =
|
|
5815
|
-
const content = /* @__PURE__ */
|
|
5816
|
-
/* @__PURE__ */
|
|
5817
|
-
shortcut ? /* @__PURE__ */
|
|
5818
|
-
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
|
|
5819
6272
|
] });
|
|
5820
6273
|
if (href && !disabled) {
|
|
5821
|
-
return /* @__PURE__ */
|
|
6274
|
+
return /* @__PURE__ */ jsx28(
|
|
5822
6275
|
"a",
|
|
5823
6276
|
{
|
|
5824
6277
|
...props,
|
|
@@ -5830,7 +6283,7 @@ function TourAction({ href, disabled = false, onClick, children, preview, shortc
|
|
|
5830
6283
|
}
|
|
5831
6284
|
);
|
|
5832
6285
|
}
|
|
5833
|
-
return /* @__PURE__ */
|
|
6286
|
+
return /* @__PURE__ */ jsx28(
|
|
5834
6287
|
"button",
|
|
5835
6288
|
{
|
|
5836
6289
|
...props,
|
|
@@ -5853,10 +6306,10 @@ function navigateTo(item, href) {
|
|
|
5853
6306
|
import { isValidElement as isValidElement8 } from "react";
|
|
5854
6307
|
|
|
5855
6308
|
// src/features/status/hooks/useStatusViews.ts
|
|
5856
|
-
import { useKeepContext as
|
|
5857
|
-
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";
|
|
5858
6311
|
function useKeepStatus(status) {
|
|
5859
|
-
const context =
|
|
6312
|
+
const context = useKeepContext7();
|
|
5860
6313
|
const resolvedStatus = status ?? getDerivedStatus(context);
|
|
5861
6314
|
const state = {
|
|
5862
6315
|
status: resolvedStatus,
|
|
@@ -5867,11 +6320,11 @@ function useKeepStatus(status) {
|
|
|
5867
6320
|
return { state, defaultLabel: useUiLabel(getStatusLabelKey3(resolvedStatus)) };
|
|
5868
6321
|
}
|
|
5869
6322
|
function useKeepAnnouncements(messages) {
|
|
5870
|
-
const context =
|
|
6323
|
+
const context = useKeepContext7();
|
|
5871
6324
|
const savedMessage = useUiLabel("savedMessage", messages?.save);
|
|
5872
6325
|
const removedMessage = useUiLabel("removedMessage", messages?.remove);
|
|
5873
6326
|
const noteSavedMessage = useUiLabel("noteSavedMessage", messages?.note);
|
|
5874
|
-
const [message, setMessage] =
|
|
6327
|
+
const [message, setMessage] = useState19("");
|
|
5875
6328
|
const lastChangeRef = useRef10(void 0);
|
|
5876
6329
|
useEffect14(() => {
|
|
5877
6330
|
const change = context.lastChange;
|
|
@@ -5901,7 +6354,7 @@ function getStatusLabelKey3(status) {
|
|
|
5901
6354
|
}
|
|
5902
6355
|
|
|
5903
6356
|
// src/features/status/status.tsx
|
|
5904
|
-
import { jsx as
|
|
6357
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
5905
6358
|
function KeepStatus({
|
|
5906
6359
|
status,
|
|
5907
6360
|
labels,
|
|
@@ -5933,7 +6386,7 @@ function KeepStatus({
|
|
|
5933
6386
|
}
|
|
5934
6387
|
function KeepAnnouncements({ messages, ...props }) {
|
|
5935
6388
|
const message = useKeepAnnouncements(messages);
|
|
5936
|
-
return /* @__PURE__ */
|
|
6389
|
+
return /* @__PURE__ */ jsx29(
|
|
5937
6390
|
"div",
|
|
5938
6391
|
{
|
|
5939
6392
|
...props,
|
|
@@ -5949,10 +6402,10 @@ function KeepAnnouncements({ messages, ...props }) {
|
|
|
5949
6402
|
var KeepAnnouncer = KeepAnnouncements;
|
|
5950
6403
|
|
|
5951
6404
|
// src/features/sync/hooks/useKeepSyncFeedback.ts
|
|
5952
|
-
import { useKeepContext as
|
|
6405
|
+
import { useKeepContext as useKeepContext8 } from "@keepkit/core/react";
|
|
5953
6406
|
import { useEffect as useEffect15, useRef as useRef11 } from "react";
|
|
5954
6407
|
function useKeepSyncFeedback() {
|
|
5955
|
-
const { syncState } =
|
|
6408
|
+
const { syncState } = useKeepContext8();
|
|
5956
6409
|
const emitFeedback = useKeepUiFeedback();
|
|
5957
6410
|
const completedMessage = useUiLabel("syncSynced");
|
|
5958
6411
|
const failedMessage = useUiLabel("syncFailedMessage");
|
|
@@ -5977,16 +6430,16 @@ function KeepSyncFeedbackObserver() {
|
|
|
5977
6430
|
}
|
|
5978
6431
|
|
|
5979
6432
|
// src/features/sync/hooks/useKeepSyncRecoveryDialog.ts
|
|
5980
|
-
import { useKeepContext as
|
|
5981
|
-
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";
|
|
5982
6435
|
function useKeepSyncRecoveryDialog(options) {
|
|
5983
6436
|
const { open, onOpenChange, conflicts, onManualMerge } = options;
|
|
5984
|
-
const context =
|
|
6437
|
+
const context = useKeepContext9();
|
|
5985
6438
|
const conflictList = conflicts ?? context.syncState.conflicts ?? [];
|
|
5986
6439
|
const hasRecovery = conflictList.length > 0 || context.syncState.status === "error" || Boolean(context.error);
|
|
5987
|
-
const [dismissed, setDismissed] =
|
|
5988
|
-
const [busyId, setBusyId] =
|
|
5989
|
-
const [error, setError] =
|
|
6440
|
+
const [dismissed, setDismissed] = useState20(false);
|
|
6441
|
+
const [busyId, setBusyId] = useState20();
|
|
6442
|
+
const [error, setError] = useState20();
|
|
5990
6443
|
useEffect16(() => {
|
|
5991
6444
|
if (hasRecovery) setDismissed(false);
|
|
5992
6445
|
}, [hasRecovery]);
|
|
@@ -6032,7 +6485,7 @@ function useKeepSyncRecoveryDialog(options) {
|
|
|
6032
6485
|
}
|
|
6033
6486
|
|
|
6034
6487
|
// src/features/sync/KeepSyncRecoveryDialog.tsx
|
|
6035
|
-
import { jsx as
|
|
6488
|
+
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6036
6489
|
function KeepSyncRecoveryDialog({
|
|
6037
6490
|
open,
|
|
6038
6491
|
onOpenChange,
|
|
@@ -6047,7 +6500,7 @@ function KeepSyncRecoveryDialog({
|
|
|
6047
6500
|
}) {
|
|
6048
6501
|
const view = useKeepSyncRecoveryDialog({ open, onOpenChange, conflicts, onManualMerge });
|
|
6049
6502
|
if (!view.isOpen) return null;
|
|
6050
|
-
return /* @__PURE__ */
|
|
6503
|
+
return /* @__PURE__ */ jsxs25(
|
|
6051
6504
|
"section",
|
|
6052
6505
|
{
|
|
6053
6506
|
...props,
|
|
@@ -6061,17 +6514,17 @@ function KeepSyncRecoveryDialog({
|
|
|
6061
6514
|
"data-state": view.conflictList.length > 0 ? "conflict" : "error",
|
|
6062
6515
|
"data-loading": view.busyId !== void 0 ? "true" : void 0,
|
|
6063
6516
|
children: [
|
|
6064
|
-
/* @__PURE__ */
|
|
6065
|
-
/* @__PURE__ */
|
|
6066
|
-
/* @__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 })
|
|
6067
6520
|
] }),
|
|
6068
6521
|
children,
|
|
6069
|
-
view.conflictList.length > 0 ? /* @__PURE__ */
|
|
6070
|
-
/* @__PURE__ */
|
|
6071
|
-
view.conflictList.map((conflict) => /* @__PURE__ */
|
|
6072
|
-
/* @__PURE__ */
|
|
6073
|
-
/* @__PURE__ */
|
|
6074
|
-
/* @__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(
|
|
6075
6528
|
ConflictPreview,
|
|
6076
6529
|
{
|
|
6077
6530
|
item: conflict.operation.item,
|
|
@@ -6081,7 +6534,7 @@ function KeepSyncRecoveryDialog({
|
|
|
6081
6534
|
side: "local"
|
|
6082
6535
|
}
|
|
6083
6536
|
),
|
|
6084
|
-
/* @__PURE__ */
|
|
6537
|
+
/* @__PURE__ */ jsx30(
|
|
6085
6538
|
ConflictPreview,
|
|
6086
6539
|
{
|
|
6087
6540
|
item: conflict.remote,
|
|
@@ -6092,8 +6545,8 @@ function KeepSyncRecoveryDialog({
|
|
|
6092
6545
|
}
|
|
6093
6546
|
)
|
|
6094
6547
|
] }),
|
|
6095
|
-
/* @__PURE__ */
|
|
6096
|
-
/* @__PURE__ */
|
|
6548
|
+
/* @__PURE__ */ jsxs25("div", { children: [
|
|
6549
|
+
/* @__PURE__ */ jsx30(
|
|
6097
6550
|
"button",
|
|
6098
6551
|
{
|
|
6099
6552
|
type: "button",
|
|
@@ -6103,7 +6556,7 @@ function KeepSyncRecoveryDialog({
|
|
|
6103
6556
|
children: view.labels.keepLocal
|
|
6104
6557
|
}
|
|
6105
6558
|
),
|
|
6106
|
-
/* @__PURE__ */
|
|
6559
|
+
/* @__PURE__ */ jsx30(
|
|
6107
6560
|
"button",
|
|
6108
6561
|
{
|
|
6109
6562
|
type: "button",
|
|
@@ -6113,7 +6566,7 @@ function KeepSyncRecoveryDialog({
|
|
|
6113
6566
|
children: view.labels.useServer
|
|
6114
6567
|
}
|
|
6115
6568
|
),
|
|
6116
|
-
/* @__PURE__ */
|
|
6569
|
+
/* @__PURE__ */ jsx30(
|
|
6117
6570
|
"button",
|
|
6118
6571
|
{
|
|
6119
6572
|
type: "button",
|
|
@@ -6126,12 +6579,12 @@ function KeepSyncRecoveryDialog({
|
|
|
6126
6579
|
] })
|
|
6127
6580
|
] }, conflict.id))
|
|
6128
6581
|
] }) : null,
|
|
6129
|
-
view.showBackupRecovery ? /* @__PURE__ */
|
|
6130
|
-
/* @__PURE__ */
|
|
6131
|
-
/* @__PURE__ */
|
|
6132
|
-
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)
|
|
6133
6586
|
] }) : null,
|
|
6134
|
-
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
|
|
6135
6588
|
]
|
|
6136
6589
|
}
|
|
6137
6590
|
);
|
|
@@ -6143,16 +6596,16 @@ function ConflictPreview({
|
|
|
6143
6596
|
noteLabel,
|
|
6144
6597
|
side
|
|
6145
6598
|
}) {
|
|
6146
|
-
return /* @__PURE__ */
|
|
6147
|
-
/* @__PURE__ */
|
|
6148
|
-
/* @__PURE__ */
|
|
6149
|
-
/* @__PURE__ */
|
|
6150
|
-
/* @__PURE__ */
|
|
6151
|
-
/* @__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" })
|
|
6152
6605
|
] }),
|
|
6153
|
-
/* @__PURE__ */
|
|
6154
|
-
/* @__PURE__ */
|
|
6155
|
-
/* @__PURE__ */
|
|
6606
|
+
/* @__PURE__ */ jsxs25("div", { children: [
|
|
6607
|
+
/* @__PURE__ */ jsx30("dt", { children: noteLabel }),
|
|
6608
|
+
/* @__PURE__ */ jsx30("dd", { children: item?.note || "\u2014" })
|
|
6156
6609
|
] })
|
|
6157
6610
|
] })
|
|
6158
6611
|
] });
|
|
@@ -6162,9 +6615,9 @@ function formatConflictDate(timestamp) {
|
|
|
6162
6615
|
}
|
|
6163
6616
|
|
|
6164
6617
|
// src/features/sync/hooks/useKeepSyncStatusBanner.ts
|
|
6165
|
-
import { useKeepContext as
|
|
6618
|
+
import { useKeepContext as useKeepContext10 } from "@keepkit/core/react";
|
|
6166
6619
|
function useKeepSyncStatusBanner({ onRetry, children }) {
|
|
6167
|
-
const context =
|
|
6620
|
+
const context = useKeepContext10();
|
|
6168
6621
|
const retryLabel = useUiLabel("retrySync");
|
|
6169
6622
|
const resolveLabel = useUiLabel("resolveSync");
|
|
6170
6623
|
const conflictLabel = useUiLabel("syncConflict");
|
|
@@ -6196,7 +6649,7 @@ function getErrorMessage6(error) {
|
|
|
6196
6649
|
}
|
|
6197
6650
|
|
|
6198
6651
|
// src/features/sync/KeepSyncStatusBanner.tsx
|
|
6199
|
-
import { jsx as
|
|
6652
|
+
import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6200
6653
|
function KeepSyncStatusBanner({
|
|
6201
6654
|
onRetry,
|
|
6202
6655
|
onResolveConflicts,
|
|
@@ -6208,7 +6661,7 @@ function KeepSyncStatusBanner({
|
|
|
6208
6661
|
const showRetryLabel = useUiLabelVisibility("retrySync");
|
|
6209
6662
|
const showResolveLabel = useUiLabelVisibility("resolveSync");
|
|
6210
6663
|
if (view.status === "idle" && !view.hasConflicts) return null;
|
|
6211
|
-
return /* @__PURE__ */
|
|
6664
|
+
return /* @__PURE__ */ jsxs26(
|
|
6212
6665
|
"aside",
|
|
6213
6666
|
{
|
|
6214
6667
|
...props,
|
|
@@ -6218,8 +6671,8 @@ function KeepSyncStatusBanner({
|
|
|
6218
6671
|
"data-keepkit": "sync-status",
|
|
6219
6672
|
"data-state": view.status,
|
|
6220
6673
|
children: [
|
|
6221
|
-
/* @__PURE__ */
|
|
6222
|
-
view.showRetry ? /* @__PURE__ */
|
|
6674
|
+
/* @__PURE__ */ jsx31("p", { children: view.message }),
|
|
6675
|
+
view.showRetry ? /* @__PURE__ */ jsx31(
|
|
6223
6676
|
"button",
|
|
6224
6677
|
{
|
|
6225
6678
|
type: "button",
|
|
@@ -6230,7 +6683,7 @@ function KeepSyncStatusBanner({
|
|
|
6230
6683
|
children: showRetryLabel ? view.retryLabel : null
|
|
6231
6684
|
}
|
|
6232
6685
|
) : null,
|
|
6233
|
-
view.hasConflicts ? /* @__PURE__ */
|
|
6686
|
+
view.hasConflicts ? /* @__PURE__ */ jsx31(
|
|
6234
6687
|
"button",
|
|
6235
6688
|
{
|
|
6236
6689
|
type: "button",
|
|
@@ -6247,7 +6700,7 @@ function KeepSyncStatusBanner({
|
|
|
6247
6700
|
}
|
|
6248
6701
|
|
|
6249
6702
|
// src/features/workspace/hooks/useKeepWorkspace.ts
|
|
6250
|
-
import { useCallback as
|
|
6703
|
+
import { useCallback as useCallback10, useState as useState21 } from "react";
|
|
6251
6704
|
var PRESET_MODULES = {
|
|
6252
6705
|
basic: { syncStatus: false, undo: false, recovery: false, backup: false, stalePrune: false },
|
|
6253
6706
|
standard: { syncStatus: false, undo: true, recovery: false, backup: false, stalePrune: false },
|
|
@@ -6267,16 +6720,16 @@ function useKeepWorkspace({
|
|
|
6267
6720
|
onRecoveryOpenChange,
|
|
6268
6721
|
onResolveConflicts
|
|
6269
6722
|
}) {
|
|
6270
|
-
const [internalRecoveryOpen, setInternalRecoveryOpen] =
|
|
6723
|
+
const [internalRecoveryOpen, setInternalRecoveryOpen] = useState21(false);
|
|
6271
6724
|
const resolvedModules = { ...PRESET_MODULES[preset], ...modules };
|
|
6272
|
-
const setRecoveryOpen =
|
|
6725
|
+
const setRecoveryOpen = useCallback10(
|
|
6273
6726
|
(open) => {
|
|
6274
6727
|
if (recoveryOpen === void 0) setInternalRecoveryOpen(open);
|
|
6275
6728
|
onRecoveryOpenChange?.(open);
|
|
6276
6729
|
},
|
|
6277
6730
|
[onRecoveryOpenChange, recoveryOpen]
|
|
6278
6731
|
);
|
|
6279
|
-
const openRecovery =
|
|
6732
|
+
const openRecovery = useCallback10(() => {
|
|
6280
6733
|
onResolveConflicts?.();
|
|
6281
6734
|
setRecoveryOpen(true);
|
|
6282
6735
|
}, [onResolveConflicts, setRecoveryOpen]);
|
|
@@ -6291,7 +6744,7 @@ function useKeepWorkspace({
|
|
|
6291
6744
|
}
|
|
6292
6745
|
|
|
6293
6746
|
// src/features/workspace/KeepWorkspace.tsx
|
|
6294
|
-
import { jsx as
|
|
6747
|
+
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6295
6748
|
function KeepWorkspace({
|
|
6296
6749
|
preset = "standard",
|
|
6297
6750
|
modules,
|
|
@@ -6330,27 +6783,27 @@ function KeepWorkspace({
|
|
|
6330
6783
|
if (!structuredRegions) return content;
|
|
6331
6784
|
if (!hasRenderableContent(content)) return null;
|
|
6332
6785
|
const resolvedSurface = typeof surface === "string" ? surface : surface[name] ?? "plain";
|
|
6333
|
-
return /* @__PURE__ */
|
|
6786
|
+
return /* @__PURE__ */ jsx32("div", { "data-keepkit": "workspace-region", "data-region": name, "data-surface": resolvedSurface, children: content });
|
|
6334
6787
|
};
|
|
6335
6788
|
const before = resolveOptionalSlot(slots?.before, state);
|
|
6336
6789
|
const syncStatus = view.modules.syncStatus ? resolveSlot(
|
|
6337
6790
|
slots?.syncStatus,
|
|
6338
|
-
/* @__PURE__ */
|
|
6791
|
+
/* @__PURE__ */ jsx32(KeepSyncStatusBanner, { ...syncStatusProps, onResolveConflicts: view.openRecovery }),
|
|
6339
6792
|
state
|
|
6340
6793
|
) : null;
|
|
6341
|
-
const collection = resolveSlot(slots?.collection, /* @__PURE__ */
|
|
6794
|
+
const collection = resolveSlot(slots?.collection, /* @__PURE__ */ jsx32(KeepCollection, { ...resolvedCollectionProps }), state);
|
|
6342
6795
|
const actions = view.modules.backup || view.modules.stalePrune ? resolveSlot(
|
|
6343
6796
|
slots?.actions,
|
|
6344
|
-
/* @__PURE__ */
|
|
6345
|
-
view.modules.stalePrune ? /* @__PURE__ */
|
|
6346
|
-
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
|
|
6347
6800
|
] }),
|
|
6348
6801
|
state
|
|
6349
6802
|
) : null;
|
|
6350
|
-
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */
|
|
6803
|
+
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */ jsx32(KeepUndo, { ...undoProps }), state) : null;
|
|
6351
6804
|
const recovery = view.modules.recovery ? resolveSlot(
|
|
6352
6805
|
slots?.recovery,
|
|
6353
|
-
/* @__PURE__ */
|
|
6806
|
+
/* @__PURE__ */ jsx32(
|
|
6354
6807
|
KeepSyncRecoveryDialog,
|
|
6355
6808
|
{
|
|
6356
6809
|
...recoveryProps,
|
|
@@ -6362,7 +6815,7 @@ function KeepWorkspace({
|
|
|
6362
6815
|
) : null;
|
|
6363
6816
|
const additionalContent = resolveOptionalSlot(children, state);
|
|
6364
6817
|
const after = resolveOptionalSlot(slots?.after, state);
|
|
6365
|
-
return /* @__PURE__ */
|
|
6818
|
+
return /* @__PURE__ */ jsxs27(
|
|
6366
6819
|
"section",
|
|
6367
6820
|
{
|
|
6368
6821
|
...props,
|
|
@@ -6395,7 +6848,7 @@ function resolveOptionalSlot(slot, state) {
|
|
|
6395
6848
|
|
|
6396
6849
|
// src/foundation/theme.tsx
|
|
6397
6850
|
import { isValidElement as isValidElement9 } from "react";
|
|
6398
|
-
import { jsx as
|
|
6851
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
6399
6852
|
var keepThemeNames = [
|
|
6400
6853
|
"default",
|
|
6401
6854
|
"ocean",
|
|
@@ -6454,7 +6907,7 @@ function KeepThemeProvider({
|
|
|
6454
6907
|
throw new Error("KeepThemeProvider with asChild requires a single React element child.");
|
|
6455
6908
|
return createSlot(children, rootProps);
|
|
6456
6909
|
}
|
|
6457
|
-
return /* @__PURE__ */
|
|
6910
|
+
return /* @__PURE__ */ jsx33("div", { ...rootProps, children });
|
|
6458
6911
|
}
|
|
6459
6912
|
|
|
6460
6913
|
// src/index.tsx
|
|
@@ -6462,8 +6915,8 @@ import { createAuthenticatedSyncKit } from "@keepkit/core/core";
|
|
|
6462
6915
|
import {
|
|
6463
6916
|
KeepErrorBoundary as KeepErrorBoundary3,
|
|
6464
6917
|
KeepProvider,
|
|
6465
|
-
useKeepCollections as
|
|
6466
|
-
useKeepContext as
|
|
6918
|
+
useKeepCollections as useKeepCollections5,
|
|
6919
|
+
useKeepContext as useKeepContext11,
|
|
6467
6920
|
useKeepItem as useKeepItem8,
|
|
6468
6921
|
useKeepList as useKeepList5,
|
|
6469
6922
|
useKeepNavigator as useKeepNavigator2,
|
|
@@ -6479,7 +6932,7 @@ import {
|
|
|
6479
6932
|
LocalStorageSyncQueueAdapter,
|
|
6480
6933
|
SyncStorageAdapter
|
|
6481
6934
|
} from "@keepkit/core/storage";
|
|
6482
|
-
import { jsx as
|
|
6935
|
+
import { jsx as jsx34, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6483
6936
|
function KeepKitProvider({
|
|
6484
6937
|
labels,
|
|
6485
6938
|
labelOptions,
|
|
@@ -6500,7 +6953,7 @@ function KeepKitProvider({
|
|
|
6500
6953
|
children,
|
|
6501
6954
|
...providerProps
|
|
6502
6955
|
}) {
|
|
6503
|
-
return /* @__PURE__ */
|
|
6956
|
+
return /* @__PURE__ */ jsx34(
|
|
6504
6957
|
KeepUiProvider,
|
|
6505
6958
|
{
|
|
6506
6959
|
labels,
|
|
@@ -6508,7 +6961,7 @@ function KeepKitProvider({
|
|
|
6508
6961
|
locale,
|
|
6509
6962
|
labelResolver,
|
|
6510
6963
|
onFeedback,
|
|
6511
|
-
children: /* @__PURE__ */
|
|
6964
|
+
children: /* @__PURE__ */ jsx34(
|
|
6512
6965
|
KeepThemeProvider,
|
|
6513
6966
|
{
|
|
6514
6967
|
theme,
|
|
@@ -6522,10 +6975,10 @@ function KeepKitProvider({
|
|
|
6522
6975
|
className: themeClassName,
|
|
6523
6976
|
style: themeStyle,
|
|
6524
6977
|
asChild: themeAsChild,
|
|
6525
|
-
children: /* @__PURE__ */
|
|
6526
|
-
/* @__PURE__ */
|
|
6978
|
+
children: /* @__PURE__ */ jsxs28(CoreKeepProvider, { ...providerProps, children: [
|
|
6979
|
+
/* @__PURE__ */ jsx34(KeepSyncFeedbackObserver, {}),
|
|
6527
6980
|
children,
|
|
6528
|
-
/* @__PURE__ */
|
|
6981
|
+
/* @__PURE__ */ jsx34(KeepAnnouncements, {})
|
|
6529
6982
|
] })
|
|
6530
6983
|
}
|
|
6531
6984
|
)
|
|
@@ -6555,7 +7008,7 @@ function createKeepKit(options = {}) {
|
|
|
6555
7008
|
} = options;
|
|
6556
7009
|
const coreKit = createCoreKeepKit(coreOptions);
|
|
6557
7010
|
return {
|
|
6558
|
-
Provider: (props) => /* @__PURE__ */
|
|
7011
|
+
Provider: (props) => /* @__PURE__ */ jsx34(
|
|
6559
7012
|
KeepKitProvider,
|
|
6560
7013
|
{
|
|
6561
7014
|
...coreOptions,
|
|
@@ -6577,9 +7030,9 @@ function createKeepKit(options = {}) {
|
|
|
6577
7030
|
...props
|
|
6578
7031
|
}
|
|
6579
7032
|
),
|
|
6580
|
-
Button: (props) => /* @__PURE__ */
|
|
6581
|
-
Backup: (props) => /* @__PURE__ */
|
|
6582
|
-
Collection: (props) => /* @__PURE__ */
|
|
7033
|
+
Button: (props) => /* @__PURE__ */ jsx34(KeepButton, { ...props }),
|
|
7034
|
+
Backup: (props) => /* @__PURE__ */ jsx34(KeepBackup, { ...props }),
|
|
7035
|
+
Collection: (props) => /* @__PURE__ */ jsx34(
|
|
6583
7036
|
KeepCollection,
|
|
6584
7037
|
{
|
|
6585
7038
|
...props,
|
|
@@ -6590,7 +7043,8 @@ function createKeepKit(options = {}) {
|
|
|
6590
7043
|
}
|
|
6591
7044
|
}
|
|
6592
7045
|
),
|
|
6593
|
-
|
|
7046
|
+
CollectionManager: (props) => /* @__PURE__ */ jsx34(KeepCollectionManager, { ...props }),
|
|
7047
|
+
Workspace: (props) => /* @__PURE__ */ jsx34(
|
|
6594
7048
|
KeepWorkspace,
|
|
6595
7049
|
{
|
|
6596
7050
|
...props,
|
|
@@ -6627,6 +7081,7 @@ export {
|
|
|
6627
7081
|
KeepCollection,
|
|
6628
7082
|
KeepCollectionCreate,
|
|
6629
7083
|
KeepCollectionFilter,
|
|
7084
|
+
KeepCollectionManager,
|
|
6630
7085
|
KeepCollectionSelect,
|
|
6631
7086
|
KeepEmptyState,
|
|
6632
7087
|
KeepErrorBoundary3 as KeepErrorBoundary,
|
|
@@ -6678,8 +7133,8 @@ export {
|
|
|
6678
7133
|
keepThemeNames,
|
|
6679
7134
|
mergeProps,
|
|
6680
7135
|
toggleSelectAll,
|
|
6681
|
-
|
|
6682
|
-
|
|
7136
|
+
useKeepCollections5 as useKeepCollections,
|
|
7137
|
+
useKeepContext11 as useKeepContext,
|
|
6683
7138
|
useKeepItem8 as useKeepItem,
|
|
6684
7139
|
useKeepList5 as useKeepList,
|
|
6685
7140
|
useKeepNavigator2 as useKeepNavigator,
|