@keepkit/ui 0.28.8 → 0.28.9
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 +150 -208
- package/dist/index.d.ts +21 -5
- package/dist/index.js +704 -444
- package/dist/index.js.map +1 -1
- package/dist/styles/base.css +17 -9
- package/dist/styles/collection.css +153 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -115,6 +115,9 @@ var DE_LABELS = {
|
|
|
115
115
|
saveWithNote: "Mit Notiz speichern",
|
|
116
116
|
editSavedItem: "Gespeichertes Element bearbeiten",
|
|
117
117
|
unsavedChanges: "Nicht gespeicherte \xC4nderungen",
|
|
118
|
+
done: "Fertig",
|
|
119
|
+
moreActions: "Mehr",
|
|
120
|
+
moveSelected: "Auswahl verschieben",
|
|
118
121
|
save: "Speichern",
|
|
119
122
|
saved: "Gespeichert",
|
|
120
123
|
remove: "Entfernen",
|
|
@@ -242,6 +245,9 @@ var EN_LABELS = {
|
|
|
242
245
|
saveWithNote: "Save with note",
|
|
243
246
|
editSavedItem: "Edit saved item",
|
|
244
247
|
unsavedChanges: "Unsaved changes",
|
|
248
|
+
done: "Done",
|
|
249
|
+
moreActions: "More",
|
|
250
|
+
moveSelected: "Move selected items",
|
|
245
251
|
save: "Save",
|
|
246
252
|
saved: "Saved",
|
|
247
253
|
remove: "Remove",
|
|
@@ -369,6 +375,9 @@ var ES_LABELS = {
|
|
|
369
375
|
saveWithNote: "Guardar con nota",
|
|
370
376
|
editSavedItem: "Editar elemento guardado",
|
|
371
377
|
unsavedChanges: "Cambios sin guardar",
|
|
378
|
+
done: "Listo",
|
|
379
|
+
moreActions: "M\xE1s",
|
|
380
|
+
moveSelected: "Mover selecci\xF3n",
|
|
372
381
|
save: "Guardar",
|
|
373
382
|
saved: "Guardado",
|
|
374
383
|
remove: "Eliminar",
|
|
@@ -496,6 +505,9 @@ var FIL_LABELS = {
|
|
|
496
505
|
saveWithNote: "I-save na may tala",
|
|
497
506
|
editSavedItem: "I-edit ang naka-save na item",
|
|
498
507
|
unsavedChanges: "Mga hindi pa nai-save na pagbabago",
|
|
508
|
+
done: "Tapos",
|
|
509
|
+
moreActions: "Higit pa",
|
|
510
|
+
moveSelected: "Ilipat ang napili",
|
|
499
511
|
save: "I-save",
|
|
500
512
|
saved: "Nai-save",
|
|
501
513
|
remove: "Alisin",
|
|
@@ -623,6 +635,9 @@ var FR_LABELS = {
|
|
|
623
635
|
saveWithNote: "Enregistrer avec une note",
|
|
624
636
|
editSavedItem: "Modifier l\u2019\xE9l\xE9ment enregistr\xE9",
|
|
625
637
|
unsavedChanges: "Modifications non enregistr\xE9es",
|
|
638
|
+
done: "Termin\xE9",
|
|
639
|
+
moreActions: "Plus",
|
|
640
|
+
moveSelected: "D\xE9placer la s\xE9lection",
|
|
626
641
|
save: "Enregistrer",
|
|
627
642
|
saved: "Enregistr\xE9",
|
|
628
643
|
remove: "Supprimer",
|
|
@@ -750,6 +765,9 @@ var ID_LABELS = {
|
|
|
750
765
|
saveWithNote: "Simpan dengan catatan",
|
|
751
766
|
editSavedItem: "Edit item tersimpan",
|
|
752
767
|
unsavedChanges: "Perubahan belum disimpan",
|
|
768
|
+
done: "Selesai",
|
|
769
|
+
moreActions: "Lainnya",
|
|
770
|
+
moveSelected: "Pindahkan pilihan",
|
|
753
771
|
save: "Simpan",
|
|
754
772
|
saved: "Tersimpan",
|
|
755
773
|
remove: "Hapus",
|
|
@@ -877,6 +895,9 @@ var IT_LABELS = {
|
|
|
877
895
|
saveWithNote: "Salva con nota",
|
|
878
896
|
editSavedItem: "Modifica elemento salvato",
|
|
879
897
|
unsavedChanges: "Modifiche non salvate",
|
|
898
|
+
done: "Fine",
|
|
899
|
+
moreActions: "Altro",
|
|
900
|
+
moveSelected: "Sposta selezione",
|
|
880
901
|
save: "Salva",
|
|
881
902
|
saved: "Salvato",
|
|
882
903
|
remove: "Rimuovi",
|
|
@@ -1004,6 +1025,9 @@ var JA_LABELS = {
|
|
|
1004
1025
|
saveWithNote: "\u30E1\u30E2\u4ED8\u304D\u3067\u4FDD\u5B58",
|
|
1005
1026
|
editSavedItem: "\u4FDD\u5B58\u3057\u305F\u30A2\u30A4\u30C6\u30E0\u3092\u7DE8\u96C6",
|
|
1006
1027
|
unsavedChanges: "\u672A\u4FDD\u5B58\u306E\u5909\u66F4\u304C\u3042\u308A\u307E\u3059",
|
|
1028
|
+
done: "\u5B8C\u4E86",
|
|
1029
|
+
moreActions: "\u305D\u306E\u4ED6",
|
|
1030
|
+
moveSelected: "\u9078\u629E\u3057\u305F\u9805\u76EE\u3092\u79FB\u52D5",
|
|
1007
1031
|
save: "\u4FDD\u5B58",
|
|
1008
1032
|
saved: "\u4FDD\u5B58\u6E08\u307F",
|
|
1009
1033
|
remove: "\u524A\u9664",
|
|
@@ -1131,6 +1155,9 @@ var KO_LABELS = {
|
|
|
1131
1155
|
saveWithNote: "\uBA54\uBAA8\uC640 \uD568\uAED8 \uC800\uC7A5",
|
|
1132
1156
|
editSavedItem: "\uC800\uC7A5\uB41C \uD56D\uBAA9 \uD3B8\uC9D1",
|
|
1133
1157
|
unsavedChanges: "\uC800\uC7A5\uB418\uC9C0 \uC54A\uC740 \uBCC0\uACBD \uC0AC\uD56D",
|
|
1158
|
+
done: "\uC644\uB8CC",
|
|
1159
|
+
moreActions: "\uB354 \uBCF4\uAE30",
|
|
1160
|
+
moveSelected: "\uC120\uD0DD \uD56D\uBAA9 \uC774\uB3D9",
|
|
1134
1161
|
save: "\uC800\uC7A5",
|
|
1135
1162
|
saved: "\uC800\uC7A5\uB428",
|
|
1136
1163
|
remove: "\uC0AD\uC81C",
|
|
@@ -1258,6 +1285,9 @@ var MS_LABELS = {
|
|
|
1258
1285
|
saveWithNote: "Simpan dengan nota",
|
|
1259
1286
|
editSavedItem: "Edit item yang disimpan",
|
|
1260
1287
|
unsavedChanges: "Perubahan belum disimpan",
|
|
1288
|
+
done: "Selesai",
|
|
1289
|
+
moreActions: "Lagi",
|
|
1290
|
+
moveSelected: "Pindahkan pilihan",
|
|
1261
1291
|
save: "Simpan",
|
|
1262
1292
|
saved: "Disimpan",
|
|
1263
1293
|
remove: "Buang",
|
|
@@ -1385,6 +1415,9 @@ var PT_BR_LABELS = {
|
|
|
1385
1415
|
saveWithNote: "Salvar com nota",
|
|
1386
1416
|
editSavedItem: "Editar item salvo",
|
|
1387
1417
|
unsavedChanges: "Altera\xE7\xF5es n\xE3o salvas",
|
|
1418
|
+
done: "Conclu\xEDdo",
|
|
1419
|
+
moreActions: "Mais",
|
|
1420
|
+
moveSelected: "Mover selecionados",
|
|
1388
1421
|
save: "Salvar",
|
|
1389
1422
|
saved: "Salvo",
|
|
1390
1423
|
remove: "Remover",
|
|
@@ -1512,6 +1545,9 @@ var RU_LABELS = {
|
|
|
1512
1545
|
saveWithNote: "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0441 \u0437\u0430\u043C\u0435\u0442\u043A\u043E\u0439",
|
|
1513
1546
|
editSavedItem: "\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u043E\u0445\u0440\u0430\u043D\u0451\u043D\u043D\u044B\u0439 \u044D\u043B\u0435\u043C\u0435\u043D\u0442",
|
|
1514
1547
|
unsavedChanges: "\u041D\u0435\u0441\u043E\u0445\u0440\u0430\u043D\u0451\u043D\u043D\u044B\u0435 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F",
|
|
1548
|
+
done: "\u0413\u043E\u0442\u043E\u0432\u043E",
|
|
1549
|
+
moreActions: "\u0415\u0449\u0451",
|
|
1550
|
+
moveSelected: "\u041F\u0435\u0440\u0435\u043C\u0435\u0441\u0442\u0438\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u043E\u0435",
|
|
1515
1551
|
save: "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C",
|
|
1516
1552
|
saved: "\u0421\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u043E",
|
|
1517
1553
|
remove: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C",
|
|
@@ -1639,6 +1675,9 @@ var TH_LABELS = {
|
|
|
1639
1675
|
saveWithNote: "\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01\u0E1E\u0E23\u0E49\u0E2D\u0E21\u0E42\u0E19\u0E49\u0E15",
|
|
1640
1676
|
editSavedItem: "\u0E41\u0E01\u0E49\u0E44\u0E02\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E17\u0E35\u0E48\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01\u0E44\u0E27\u0E49",
|
|
1641
1677
|
unsavedChanges: "\u0E21\u0E35\u0E01\u0E32\u0E23\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E41\u0E1B\u0E25\u0E07\u0E17\u0E35\u0E48\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01",
|
|
1678
|
+
done: "\u0E40\u0E2A\u0E23\u0E47\u0E08\u0E2A\u0E34\u0E49\u0E19",
|
|
1679
|
+
moreActions: "\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E15\u0E34\u0E21",
|
|
1680
|
+
moveSelected: "\u0E22\u0E49\u0E32\u0E22\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E17\u0E35\u0E48\u0E40\u0E25\u0E37\u0E2D\u0E01",
|
|
1642
1681
|
save: "\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01",
|
|
1643
1682
|
saved: "\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01\u0E41\u0E25\u0E49\u0E27",
|
|
1644
1683
|
remove: "\u0E25\u0E1A",
|
|
@@ -1766,6 +1805,9 @@ var VI_LABELS = {
|
|
|
1766
1805
|
saveWithNote: "L\u01B0u k\xE8m ghi ch\xFA",
|
|
1767
1806
|
editSavedItem: "Ch\u1EC9nh s\u1EEDa m\u1EE5c \u0111\xE3 l\u01B0u",
|
|
1768
1807
|
unsavedChanges: "Thay \u0111\u1ED5i ch\u01B0a \u0111\u01B0\u1EE3c l\u01B0u",
|
|
1808
|
+
done: "Xong",
|
|
1809
|
+
moreActions: "Th\xEAm",
|
|
1810
|
+
moveSelected: "Di chuy\u1EC3n m\u1EE5c \u0111\xE3 ch\u1ECDn",
|
|
1769
1811
|
save: "L\u01B0u",
|
|
1770
1812
|
saved: "\u0110\xE3 l\u01B0u",
|
|
1771
1813
|
remove: "X\xF3a",
|
|
@@ -1893,6 +1935,9 @@ var ZH_HANS_LABELS = {
|
|
|
1893
1935
|
saveWithNote: "\u4FDD\u5B58\u5E76\u6DFB\u52A0\u5907\u6CE8",
|
|
1894
1936
|
editSavedItem: "\u7F16\u8F91\u5DF2\u4FDD\u5B58\u9879\u76EE",
|
|
1895
1937
|
unsavedChanges: "\u6709\u672A\u4FDD\u5B58\u7684\u66F4\u6539",
|
|
1938
|
+
done: "\u5B8C\u6210",
|
|
1939
|
+
moreActions: "\u66F4\u591A",
|
|
1940
|
+
moveSelected: "\u79FB\u52A8\u6240\u9009\u9879\u76EE",
|
|
1896
1941
|
save: "\u4FDD\u5B58",
|
|
1897
1942
|
saved: "\u5DF2\u4FDD\u5B58",
|
|
1898
1943
|
remove: "\u5220\u9664",
|
|
@@ -2020,6 +2065,9 @@ var ZH_HANT_LABELS = {
|
|
|
2020
2065
|
saveWithNote: "\u5132\u5B58\u4E26\u52A0\u5099\u8A3B",
|
|
2021
2066
|
editSavedItem: "\u7DE8\u8F2F\u5DF2\u5132\u5B58\u9805\u76EE",
|
|
2022
2067
|
unsavedChanges: "\u6709\u672A\u5132\u5B58\u7684\u8B8A\u66F4",
|
|
2068
|
+
done: "\u5B8C\u6210",
|
|
2069
|
+
moreActions: "\u66F4\u591A",
|
|
2070
|
+
moveSelected: "\u79FB\u52D5\u6240\u9078\u9805\u76EE",
|
|
2023
2071
|
save: "\u5132\u5B58",
|
|
2024
2072
|
saved: "\u5DF2\u5132\u5B58",
|
|
2025
2073
|
remove: "\u522A\u9664",
|
|
@@ -2653,7 +2701,7 @@ function isQuotaError(error) {
|
|
|
2653
2701
|
|
|
2654
2702
|
// src/features/actions/hooks/useKeepBulkActions.ts
|
|
2655
2703
|
import { useKeepCollections, useKeepList } from "@keepkit/core/react";
|
|
2656
|
-
import { useState as useState2 } from "react";
|
|
2704
|
+
import { useRef as useRef3, useState as useState2 } from "react";
|
|
2657
2705
|
function isAllSelected(items, selectedIds) {
|
|
2658
2706
|
if (items.length === 0) return false;
|
|
2659
2707
|
const selected = new Set(selectedIds);
|
|
@@ -2688,6 +2736,9 @@ function useKeepBulkActions(options) {
|
|
|
2688
2736
|
const [uncontrolledSelectedIds, setUncontrolledSelectedIds] = useState2(defaultSelectedIds);
|
|
2689
2737
|
const selectedIds = controlledSelectedIds ?? uncontrolledSelectedIds;
|
|
2690
2738
|
const selected = new Set(selectedIds);
|
|
2739
|
+
const pendingRef = useRef3(false);
|
|
2740
|
+
const [pending, setPending] = useState2(false);
|
|
2741
|
+
const [error, setError] = useState2(null);
|
|
2691
2742
|
const [tagsInput, setTagsInput] = useState2("");
|
|
2692
2743
|
const [collectionId, setCollectionId] = useState2("");
|
|
2693
2744
|
const setSelectionScope = (scope) => {
|
|
@@ -2701,39 +2752,35 @@ function useKeepBulkActions(options) {
|
|
|
2701
2752
|
const toggle = (id) => setSelectedIds(selected.has(id) ? selectedIds.filter((current) => current !== id) : [...selectedIds, id]);
|
|
2702
2753
|
const allSelected = isAllSelected(targetItems, selectedIds);
|
|
2703
2754
|
const toggleAll = () => setSelectedIds(toggleSelectAll(targetItems, selectedIds));
|
|
2704
|
-
const
|
|
2705
|
-
|
|
2755
|
+
const run = async (operation) => {
|
|
2756
|
+
if (pendingRef.current || list.isMutating || selectedIds.length === 0) return;
|
|
2757
|
+
pendingRef.current = true;
|
|
2758
|
+
setPending(true);
|
|
2759
|
+
setError(null);
|
|
2760
|
+
try {
|
|
2761
|
+
await operation([...selectedIds]);
|
|
2762
|
+
setSelectedIds([]);
|
|
2763
|
+
} catch (cause) {
|
|
2764
|
+
setError(cause);
|
|
2765
|
+
throw cause;
|
|
2766
|
+
} finally {
|
|
2767
|
+
pendingRef.current = false;
|
|
2768
|
+
setPending(false);
|
|
2769
|
+
}
|
|
2770
|
+
};
|
|
2771
|
+
const remove = () => run(async (ids) => {
|
|
2706
2772
|
await list.removeBatchWithUndo(ids);
|
|
2707
2773
|
onCompleted?.("remove", ids);
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
const updateTags = async () => {
|
|
2711
|
-
const ids = [...selectedIds];
|
|
2774
|
+
});
|
|
2775
|
+
const updateTags = () => run(async (ids) => {
|
|
2712
2776
|
await list.updateTagsBatch(ids, normalizeUiTags(tagsInput.split(",")));
|
|
2713
2777
|
onCompleted?.("tags", ids);
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
const
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
};
|
|
2721
|
-
const archive = async () => {
|
|
2722
|
-
await list.archiveBatch([...selectedIds]);
|
|
2723
|
-
setSelectedIds([]);
|
|
2724
|
-
};
|
|
2725
|
-
const unarchive = async () => {
|
|
2726
|
-
await list.unarchiveBatch([...selectedIds]);
|
|
2727
|
-
setSelectedIds([]);
|
|
2728
|
-
};
|
|
2729
|
-
const pin = async () => {
|
|
2730
|
-
await list.pinBatch([...selectedIds]);
|
|
2731
|
-
setSelectedIds([]);
|
|
2732
|
-
};
|
|
2733
|
-
const unpin = async () => {
|
|
2734
|
-
await list.unpinBatch([...selectedIds]);
|
|
2735
|
-
setSelectedIds([]);
|
|
2736
|
-
};
|
|
2778
|
+
});
|
|
2779
|
+
const moveToCollection = () => run((ids) => list.moveToCollectionBatch(ids, collectionId || void 0));
|
|
2780
|
+
const archive = () => run((ids) => list.archiveBatch(ids));
|
|
2781
|
+
const unarchive = () => run((ids) => list.unarchiveBatch(ids));
|
|
2782
|
+
const pin = () => run((ids) => list.pinBatch(ids));
|
|
2783
|
+
const unpin = () => run((ids) => list.unpinBatch(ids));
|
|
2737
2784
|
const state = {
|
|
2738
2785
|
items: targetItems,
|
|
2739
2786
|
selectedIds,
|
|
@@ -2755,7 +2802,8 @@ function useKeepBulkActions(options) {
|
|
|
2755
2802
|
unarchive,
|
|
2756
2803
|
pin,
|
|
2757
2804
|
unpin,
|
|
2758
|
-
isMutating: list.isMutating,
|
|
2805
|
+
isMutating: pending || list.isMutating,
|
|
2806
|
+
error,
|
|
2759
2807
|
selectionScope,
|
|
2760
2808
|
setSelectionScope
|
|
2761
2809
|
};
|
|
@@ -2840,6 +2888,7 @@ function KeepBulkActions({
|
|
|
2840
2888
|
const showTagsLabel = useUiLabelVisibility("tagsToApply");
|
|
2841
2889
|
const showDeleteLabel = useUiLabelVisibility("deleteSelected");
|
|
2842
2890
|
const showApplyTagsLabel = useUiLabelVisibility("applyTags");
|
|
2891
|
+
const errorLabel = useUiLabel("error");
|
|
2843
2892
|
const body = render ? render(state) : typeof children === "function" ? children(state) : children ?? /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
2844
2893
|
/* @__PURE__ */ jsxs3("fieldset", { "aria-label": showSelectItemsLabel ? void 0 : labels.selectItems, children: [
|
|
2845
2894
|
showSelectItemsLabel ? /* @__PURE__ */ jsx5("legend", { children: labels.selectItems }) : null,
|
|
@@ -2893,7 +2942,7 @@ function KeepBulkActions({
|
|
|
2893
2942
|
type: "button",
|
|
2894
2943
|
"data-keep-action": "delete-selected",
|
|
2895
2944
|
"aria-label": showDeleteLabel ? void 0 : labels.deleteSelected,
|
|
2896
|
-
onClick: () => void state.remove(),
|
|
2945
|
+
onClick: () => void state.remove().catch(() => void 0),
|
|
2897
2946
|
disabled: state.selectedIds.length === 0 || state.isMutating,
|
|
2898
2947
|
children: showDeleteLabel ? labels.deleteSelected : null
|
|
2899
2948
|
}
|
|
@@ -2916,7 +2965,7 @@ function KeepBulkActions({
|
|
|
2916
2965
|
type: "button",
|
|
2917
2966
|
"data-keep-action": "apply-tags",
|
|
2918
2967
|
"aria-label": showApplyTagsLabel ? void 0 : labels.applyTags,
|
|
2919
|
-
onClick: () => void state.updateTags(),
|
|
2968
|
+
onClick: () => void state.updateTags().catch(() => void 0),
|
|
2920
2969
|
disabled: state.selectedIds.length === 0 || state.isMutating,
|
|
2921
2970
|
children: showApplyTagsLabel ? labels.applyTags : null
|
|
2922
2971
|
}
|
|
@@ -2932,7 +2981,7 @@ function KeepBulkActions({
|
|
|
2932
2981
|
"button",
|
|
2933
2982
|
{
|
|
2934
2983
|
type: "button",
|
|
2935
|
-
onClick: () => void state.moveToCollection(),
|
|
2984
|
+
onClick: () => void state.moveToCollection().catch(() => void 0),
|
|
2936
2985
|
disabled: !state.selectedCount || state.isMutating,
|
|
2937
2986
|
children: "Move selected items"
|
|
2938
2987
|
}
|
|
@@ -2941,7 +2990,7 @@ function KeepBulkActions({
|
|
|
2941
2990
|
"button",
|
|
2942
2991
|
{
|
|
2943
2992
|
type: "button",
|
|
2944
|
-
onClick: () => void state.archive(),
|
|
2993
|
+
onClick: () => void state.archive().catch(() => void 0),
|
|
2945
2994
|
disabled: !state.selectedCount || state.isMutating,
|
|
2946
2995
|
children: "Archive selected items"
|
|
2947
2996
|
}
|
|
@@ -2950,23 +2999,31 @@ function KeepBulkActions({
|
|
|
2950
2999
|
"button",
|
|
2951
3000
|
{
|
|
2952
3001
|
type: "button",
|
|
2953
|
-
onClick: () => void state.unarchive(),
|
|
3002
|
+
onClick: () => void state.unarchive().catch(() => void 0),
|
|
2954
3003
|
disabled: !state.selectedCount || state.isMutating,
|
|
2955
3004
|
children: "Unarchive selected items"
|
|
2956
3005
|
}
|
|
2957
3006
|
),
|
|
2958
|
-
/* @__PURE__ */ jsx5("button", { type: "button", onClick: () => void state.pin(), disabled: !state.selectedCount || state.isMutating, children: "Pin selected items" }),
|
|
2959
3007
|
/* @__PURE__ */ jsx5(
|
|
2960
3008
|
"button",
|
|
2961
3009
|
{
|
|
2962
3010
|
type: "button",
|
|
2963
|
-
onClick: () => void state.
|
|
3011
|
+
onClick: () => void state.pin().catch(() => void 0),
|
|
3012
|
+
disabled: !state.selectedCount || state.isMutating,
|
|
3013
|
+
children: "Pin selected items"
|
|
3014
|
+
}
|
|
3015
|
+
),
|
|
3016
|
+
/* @__PURE__ */ jsx5(
|
|
3017
|
+
"button",
|
|
3018
|
+
{
|
|
3019
|
+
type: "button",
|
|
3020
|
+
onClick: () => void state.unpin().catch(() => void 0),
|
|
2964
3021
|
disabled: !state.selectedCount || state.isMutating,
|
|
2965
3022
|
children: "Unpin selected items"
|
|
2966
3023
|
}
|
|
2967
3024
|
)
|
|
2968
3025
|
] });
|
|
2969
|
-
return /* @__PURE__ */
|
|
3026
|
+
return /* @__PURE__ */ jsxs3(
|
|
2970
3027
|
"section",
|
|
2971
3028
|
{
|
|
2972
3029
|
...props,
|
|
@@ -2974,7 +3031,10 @@ function KeepBulkActions({
|
|
|
2974
3031
|
"aria-busy": state.isMutating || props["aria-busy"],
|
|
2975
3032
|
"data-state": state.selectedIds.length > 0 ? "selected" : "idle",
|
|
2976
3033
|
"data-loading": isLoading || state.isMutating ? "true" : void 0,
|
|
2977
|
-
children:
|
|
3034
|
+
children: [
|
|
3035
|
+
body,
|
|
3036
|
+
state.error ? /* @__PURE__ */ jsx5("p", { role: "alert", children: getErrorMessage(state.error, errorLabel) }) : null
|
|
3037
|
+
]
|
|
2978
3038
|
}
|
|
2979
3039
|
);
|
|
2980
3040
|
}
|
|
@@ -2983,7 +3043,7 @@ function KeepBulkActions({
|
|
|
2983
3043
|
import {
|
|
2984
3044
|
KeepButton as CoreKeepButton
|
|
2985
3045
|
} from "@keepkit/core/react";
|
|
2986
|
-
import { createElement, useEffect as useEffect2, useRef as
|
|
3046
|
+
import { createElement, useEffect as useEffect2, useRef as useRef4 } from "react";
|
|
2987
3047
|
|
|
2988
3048
|
// src/features/actions/hooks/useKeepButton.ts
|
|
2989
3049
|
import { useKeepItem as useKeepItem2 } from "@keepkit/core/react";
|
|
@@ -3023,7 +3083,7 @@ function KeepButton({
|
|
|
3023
3083
|
const showSavedLabel = useUiLabelVisibility("saved");
|
|
3024
3084
|
const showLoadingLabel = useUiLabelVisibility("loading");
|
|
3025
3085
|
const showErrorLabel = useUiLabelVisibility("error");
|
|
3026
|
-
const pendingToggle =
|
|
3086
|
+
const pendingToggle = useRef4(null);
|
|
3027
3087
|
useEffect2(() => {
|
|
3028
3088
|
const pending = pendingToggle.current;
|
|
3029
3089
|
if (!pending || view.buttonState.isMutating || pending.wasSaved === view.buttonState.isSaved) return;
|
|
@@ -3098,7 +3158,7 @@ import {
|
|
|
3098
3158
|
useCallback as useCallback3,
|
|
3099
3159
|
useEffect as useEffect4,
|
|
3100
3160
|
useId,
|
|
3101
|
-
useRef as
|
|
3161
|
+
useRef as useRef6,
|
|
3102
3162
|
useState as useState4
|
|
3103
3163
|
} from "react";
|
|
3104
3164
|
|
|
@@ -3107,7 +3167,7 @@ import { useKeepCollections as useKeepCollections2, useKeepItem as useKeepItem3
|
|
|
3107
3167
|
import {
|
|
3108
3168
|
useCallback as useCallback2,
|
|
3109
3169
|
useEffect as useEffect3,
|
|
3110
|
-
useRef as
|
|
3170
|
+
useRef as useRef5,
|
|
3111
3171
|
useState as useState3
|
|
3112
3172
|
} from "react";
|
|
3113
3173
|
import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
@@ -3121,14 +3181,14 @@ function useKeepQuickEditor(item, options = {}) {
|
|
|
3121
3181
|
const [collectionId, setCollectionId] = useState3(baseline.collectionId);
|
|
3122
3182
|
const [saveStatus, setSaveStatus] = useState3("idle");
|
|
3123
3183
|
const [saveError, setSaveError] = useState3(null);
|
|
3124
|
-
const baselineRef =
|
|
3184
|
+
const baselineRef = useRef5({
|
|
3125
3185
|
note: baseline.note ?? "",
|
|
3126
3186
|
tags: baseline.tags ?? [],
|
|
3127
3187
|
collectionId: baseline.collectionId
|
|
3128
3188
|
});
|
|
3129
|
-
const draftRef =
|
|
3130
|
-
const flushRequestedRef =
|
|
3131
|
-
const flushPromiseRef =
|
|
3189
|
+
const draftRef = useRef5({ note, tags, collectionId });
|
|
3190
|
+
const flushRequestedRef = useRef5(false);
|
|
3191
|
+
const flushPromiseRef = useRef5(null);
|
|
3132
3192
|
draftRef.current = { note, tags, collectionId };
|
|
3133
3193
|
useEffect3(() => {
|
|
3134
3194
|
if (draftRef.current.note === baselineRef.current.note && sameTags(draftRef.current.tags, baselineRef.current.tags) && draftRef.current.collectionId === baselineRef.current.collectionId) {
|
|
@@ -3188,10 +3248,10 @@ function useKeepQuickEditor(item, options = {}) {
|
|
|
3188
3248
|
return promise;
|
|
3189
3249
|
}, [baseline, moveToCollection, onSaveError, onSaved, updateNote, updateTags]);
|
|
3190
3250
|
useEffect3(() => {
|
|
3191
|
-
if (!isDirty || debounceMs <= 0) return;
|
|
3251
|
+
if (!isDirty || debounceMs <= 0 || saveStatus === "error") return;
|
|
3192
3252
|
const timer = window.setTimeout(() => void flush().catch(() => void 0), debounceMs);
|
|
3193
3253
|
return () => window.clearTimeout(timer);
|
|
3194
|
-
}, [debounceMs, flush, isDirty]);
|
|
3254
|
+
}, [debounceMs, flush, isDirty, saveStatus]);
|
|
3195
3255
|
return {
|
|
3196
3256
|
state: {
|
|
3197
3257
|
item,
|
|
@@ -3245,12 +3305,13 @@ function KeepQuickEditorView({
|
|
|
3245
3305
|
features,
|
|
3246
3306
|
children,
|
|
3247
3307
|
onClose,
|
|
3308
|
+
closeLabel: customCloseLabel,
|
|
3248
3309
|
focusScopeRef,
|
|
3249
3310
|
...props
|
|
3250
3311
|
}) {
|
|
3251
3312
|
const enabled = { ...DEFAULT_FEATURES, ...features };
|
|
3252
3313
|
const collections = useKeepCollections2({ targetType: state.item.targetType, orderBy: "name" });
|
|
3253
|
-
const rootRef =
|
|
3314
|
+
const rootRef = useRef5(null);
|
|
3254
3315
|
const noteLabel = useUiLabel("note");
|
|
3255
3316
|
const showNoteLabel = useUiLabelVisibility("note");
|
|
3256
3317
|
const tagsLabel = useUiLabel("tags");
|
|
@@ -3260,7 +3321,8 @@ function KeepQuickEditorView({
|
|
|
3260
3321
|
const uncategorizedLabel = useUiLabel("uncategorized");
|
|
3261
3322
|
const saveLabel = useUiLabel("saveWithNote");
|
|
3262
3323
|
const showSaveLabel = useUiLabelVisibility("saveWithNote");
|
|
3263
|
-
const
|
|
3324
|
+
const defaultCloseLabel = useUiLabel("close");
|
|
3325
|
+
const closeLabel = customCloseLabel ?? defaultCloseLabel;
|
|
3264
3326
|
const showCloseLabel = useUiLabelVisibility("close");
|
|
3265
3327
|
const unsavedChangesLabel = useUiLabel("unsavedChanges");
|
|
3266
3328
|
const savingLabel = useUiLabel("saving");
|
|
@@ -3274,14 +3336,24 @@ function KeepQuickEditorView({
|
|
|
3274
3336
|
useEffect3(() => {
|
|
3275
3337
|
if (!sameTags(parseTags(tagsInput), state.tags)) setTagsInput(formatTags(state.tags));
|
|
3276
3338
|
}, [state.tags, tagsInput]);
|
|
3339
|
+
const [closeFailed, setCloseFailed] = useState3(false);
|
|
3340
|
+
useEffect3(() => {
|
|
3341
|
+
if (!closeFailed || state.saveStatus !== "error") return;
|
|
3342
|
+
rootRef.current?.querySelector('[role="alert"]')?.focus();
|
|
3343
|
+
setCloseFailed(false);
|
|
3344
|
+
}, [closeFailed, state.saveStatus]);
|
|
3345
|
+
const close = () => {
|
|
3346
|
+
void state.flush().then(() => onClose?.()).catch(() => setCloseFailed(true));
|
|
3347
|
+
};
|
|
3277
3348
|
const onKeyDown = (event) => {
|
|
3278
3349
|
props.onKeyDown?.(event);
|
|
3279
3350
|
if (event.defaultPrevented) return;
|
|
3280
3351
|
if (event.key === "Escape") {
|
|
3281
3352
|
event.preventDefault();
|
|
3282
|
-
|
|
3353
|
+
if (onClose) close();
|
|
3354
|
+
else void state.flush().catch(() => void 0);
|
|
3283
3355
|
}
|
|
3284
|
-
if (event.key === "Tab") trapFocus(event, focusScopeRef
|
|
3356
|
+
if (event.key === "Tab" && focusScopeRef?.current) trapFocus(event, focusScopeRef.current);
|
|
3285
3357
|
};
|
|
3286
3358
|
const statusMessage = state.saveStatus === "dirty" ? unsavedChangesLabel : state.saveStatus === "saving" ? savingLabel : state.saveStatus === "saved" ? savedLabel : state.saveStatus === "error" ? getErrorMessage(state.error, errorLabel) : null;
|
|
3287
3359
|
const body = typeof children === "function" ? children(state) : children ?? /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
@@ -3321,7 +3393,7 @@ function KeepQuickEditorView({
|
|
|
3321
3393
|
onChange: (event) => state.setCollectionId(event.currentTarget.value || void 0),
|
|
3322
3394
|
children: [
|
|
3323
3395
|
/* @__PURE__ */ jsx7("option", { value: "", children: uncategorizedLabel }),
|
|
3324
|
-
(collectionIds ?? collections.map((collection) => collection.id)).map((id) => /* @__PURE__ */ jsx7("option", { value: id, children: collectionLabels?.[id] ?? id }, id))
|
|
3396
|
+
(collectionIds ?? collections.map((collection) => collection.id)).map((id) => /* @__PURE__ */ jsx7("option", { value: id, children: collectionLabels?.[id] ?? collections.find((collection) => collection.id === id)?.name ?? id }, id))
|
|
3325
3397
|
]
|
|
3326
3398
|
}
|
|
3327
3399
|
)
|
|
@@ -3337,7 +3409,7 @@ function KeepQuickEditorView({
|
|
|
3337
3409
|
children: statusMessage
|
|
3338
3410
|
}
|
|
3339
3411
|
) : null,
|
|
3340
|
-
showSaveButton ? /* @__PURE__ */ jsx7(
|
|
3412
|
+
showSaveButton || state.saveStatus === "error" ? /* @__PURE__ */ jsx7(
|
|
3341
3413
|
"button",
|
|
3342
3414
|
{
|
|
3343
3415
|
type: "submit",
|
|
@@ -3351,7 +3423,7 @@ function KeepQuickEditorView({
|
|
|
3351
3423
|
"button",
|
|
3352
3424
|
{
|
|
3353
3425
|
type: "button",
|
|
3354
|
-
onClick:
|
|
3426
|
+
onClick: close,
|
|
3355
3427
|
disabled: state.isSaving,
|
|
3356
3428
|
"data-keep-action": "close-quick-edit",
|
|
3357
3429
|
"aria-label": showCloseLabel ? void 0 : closeLabel,
|
|
@@ -3419,10 +3491,10 @@ function KeepSavePopover({
|
|
|
3419
3491
|
const state = useKeepItem4(item);
|
|
3420
3492
|
const [internalOpen, setInternalOpen] = useState4(defaultOpen);
|
|
3421
3493
|
const isOpen = controlledOpen ?? internalOpen;
|
|
3422
|
-
const triggerRef =
|
|
3423
|
-
const wasOpenRef =
|
|
3424
|
-
const previousSaved =
|
|
3425
|
-
const observedHydration =
|
|
3494
|
+
const triggerRef = useRef6(null);
|
|
3495
|
+
const wasOpenRef = useRef6(isOpen);
|
|
3496
|
+
const previousSaved = useRef6(state.isSaved);
|
|
3497
|
+
const observedHydration = useRef6(!state.isLoading);
|
|
3426
3498
|
const panelId = useId();
|
|
3427
3499
|
const titleId = `${panelId}-title`;
|
|
3428
3500
|
const editSavedItemLabel = useUiLabel("editSavedItem");
|
|
@@ -3492,8 +3564,8 @@ function KeepSavePopoverPanel({
|
|
|
3492
3564
|
}) {
|
|
3493
3565
|
const { debounceMs, onSaved, onSaveError, ...editorViewProps } = editorProps ?? {};
|
|
3494
3566
|
const { state } = useKeepQuickEditor(item, { debounceMs, onSaved, onSaveError });
|
|
3495
|
-
const panelRef =
|
|
3496
|
-
const closingRef =
|
|
3567
|
+
const panelRef = useRef6(null);
|
|
3568
|
+
const closingRef = useRef6(null);
|
|
3497
3569
|
const closeLabel = useUiLabel("close");
|
|
3498
3570
|
const requestClose = useCallback3(() => {
|
|
3499
3571
|
if (closingRef.current) return closingRef.current;
|
|
@@ -3629,12 +3701,12 @@ function KeepUndo({ children, label, ...props }) {
|
|
|
3629
3701
|
|
|
3630
3702
|
// src/features/collection/KeepCollection.tsx
|
|
3631
3703
|
import { KeepErrorBoundary as KeepErrorBoundary2 } from "@keepkit/core/react";
|
|
3632
|
-
import { useEffect as
|
|
3704
|
+
import { useEffect as useEffect12, useId as useId4, useRef as useRef11, useState as useState18 } from "react";
|
|
3633
3705
|
|
|
3634
3706
|
// src/features/query/KeepActiveFiltersSummary.tsx
|
|
3635
3707
|
import {
|
|
3636
3708
|
isValidElement as isValidElement2,
|
|
3637
|
-
useRef as
|
|
3709
|
+
useRef as useRef7
|
|
3638
3710
|
} from "react";
|
|
3639
3711
|
import { Fragment as Fragment6, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3640
3712
|
function KeepActiveFiltersSummary({
|
|
@@ -3705,7 +3777,7 @@ function KeepActiveFiltersSummary({
|
|
|
3705
3777
|
all: useUiLabel("archiveScopeAll")
|
|
3706
3778
|
};
|
|
3707
3779
|
const resolvedArchiveScopeLabel = providedArchiveScopeLabel ?? (archiveScope === void 0 ? void 0 : archiveLabels[archiveScope]);
|
|
3708
|
-
const chipRefs =
|
|
3780
|
+
const chipRefs = useRef7([]);
|
|
3709
3781
|
const collectionIndex = Number(Boolean(search)) + tags.length;
|
|
3710
3782
|
const organizationIndex = collectionIndex + Number(Boolean(collection));
|
|
3711
3783
|
const activityIndex = organizationIndex + organizationFilters.length;
|
|
@@ -4894,8 +4966,8 @@ function KeepCollectionCreate({
|
|
|
4894
4966
|
const trimmed = name.trim();
|
|
4895
4967
|
if (!trimmed) return;
|
|
4896
4968
|
const normalizedId = trimmed.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
4897
|
-
|
|
4898
|
-
const exists = collections.some((c) => c.id ===
|
|
4969
|
+
const collectionId = normalizedId || `collection-${crypto.randomUUID()}`;
|
|
4970
|
+
const exists = collections.some((c) => c.id === collectionId || c.name.toLowerCase() === trimmed.toLowerCase());
|
|
4899
4971
|
if (exists) {
|
|
4900
4972
|
const message = `Collection "${trimmed}" already exists.`;
|
|
4901
4973
|
setError(message);
|
|
@@ -4905,9 +4977,9 @@ function KeepCollectionCreate({
|
|
|
4905
4977
|
setError(null);
|
|
4906
4978
|
setIsSubmitting(true);
|
|
4907
4979
|
try {
|
|
4908
|
-
await createCollection(
|
|
4980
|
+
await createCollection(collectionId, trimmed);
|
|
4909
4981
|
setName("");
|
|
4910
|
-
onCreated?.(
|
|
4982
|
+
onCreated?.(collectionId);
|
|
4911
4983
|
} catch (cause) {
|
|
4912
4984
|
const message = getErrorMessage(cause, "Failed to create collection.");
|
|
4913
4985
|
setError(message);
|
|
@@ -4960,20 +5032,134 @@ function KeepCollectionCreate({
|
|
|
4960
5032
|
);
|
|
4961
5033
|
}
|
|
4962
5034
|
|
|
5035
|
+
// src/features/collection/KeepInlineSelection.tsx
|
|
5036
|
+
import { useEffect as useEffect9, useRef as useRef8, useState as useState14 } from "react";
|
|
5037
|
+
import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5038
|
+
function KeepInlineSelection({
|
|
5039
|
+
query,
|
|
5040
|
+
children
|
|
5041
|
+
}) {
|
|
5042
|
+
const [selecting, setSelecting] = useState14(false);
|
|
5043
|
+
const [selectedIds, setSelectedIds] = useState14([]);
|
|
5044
|
+
const previousQuery = useRef8(query);
|
|
5045
|
+
useEffect9(() => {
|
|
5046
|
+
if (previousQuery.current === query) return;
|
|
5047
|
+
previousQuery.current = query;
|
|
5048
|
+
setSelectedIds([]);
|
|
5049
|
+
}, [query]);
|
|
5050
|
+
const { state } = useKeepBulkActions({
|
|
5051
|
+
query,
|
|
5052
|
+
controlledSelectedIds: selectedIds,
|
|
5053
|
+
defaultSelectedIds: [],
|
|
5054
|
+
onSelectedIdsChange: setSelectedIds,
|
|
5055
|
+
onCompleted: void 0,
|
|
5056
|
+
controlledScope: "page",
|
|
5057
|
+
onSelectionScopeChange: void 0
|
|
5058
|
+
});
|
|
5059
|
+
const selectLabel = useUiLabel("selectItems");
|
|
5060
|
+
const doneLabel = useUiLabel("done");
|
|
5061
|
+
const pageLabel = useUiLabel("currentPage");
|
|
5062
|
+
const countLabel = useUiLabel("selectedCount");
|
|
5063
|
+
const collectionLabel = useUiLabel("collection");
|
|
5064
|
+
const uncategorizedLabel = useUiLabel("uncategorized");
|
|
5065
|
+
const moveLabel = useUiLabel("moveSelected");
|
|
5066
|
+
const archiveLabel = useUiLabel("archive");
|
|
5067
|
+
const unarchiveLabel = useUiLabel("unarchive");
|
|
5068
|
+
const pinLabel = useUiLabel("pin");
|
|
5069
|
+
const unpinLabel = useUiLabel("unpin");
|
|
5070
|
+
const tagsLabel = useUiLabel("tagsToApply");
|
|
5071
|
+
const applyTagsLabel = useUiLabel("applyTags");
|
|
5072
|
+
const removeLabel = useUiLabel("deleteSelected");
|
|
5073
|
+
const moreLabel = useUiLabel("moreActions");
|
|
5074
|
+
const errorLabel = useUiLabel("error");
|
|
5075
|
+
const run = (operation) => void operation().catch(() => void 0);
|
|
5076
|
+
const archivedOnly = query.archiveScope === "archived" || query.archived === true;
|
|
5077
|
+
return /* @__PURE__ */ jsxs15(Fragment8, { children: [
|
|
5078
|
+
/* @__PURE__ */ jsxs15("fieldset", { "data-keepkit": "inline-selection", "aria-label": selectLabel, "aria-busy": state.isMutating, children: [
|
|
5079
|
+
/* @__PURE__ */ jsx17(
|
|
5080
|
+
"button",
|
|
5081
|
+
{
|
|
5082
|
+
type: "button",
|
|
5083
|
+
"aria-pressed": selecting,
|
|
5084
|
+
disabled: state.isMutating || !selecting && state.items.length === 0,
|
|
5085
|
+
onClick: () => {
|
|
5086
|
+
setSelecting(!selecting);
|
|
5087
|
+
setSelectedIds([]);
|
|
5088
|
+
},
|
|
5089
|
+
children: selecting ? doneLabel : selectLabel
|
|
5090
|
+
}
|
|
5091
|
+
),
|
|
5092
|
+
selecting ? /* @__PURE__ */ jsxs15(Fragment8, { children: [
|
|
5093
|
+
/* @__PURE__ */ jsxs15("label", { children: [
|
|
5094
|
+
/* @__PURE__ */ jsx17(
|
|
5095
|
+
"input",
|
|
5096
|
+
{
|
|
5097
|
+
type: "checkbox",
|
|
5098
|
+
checked: state.allSelected,
|
|
5099
|
+
onChange: state.toggleAll,
|
|
5100
|
+
disabled: state.isMutating || !state.items.length
|
|
5101
|
+
}
|
|
5102
|
+
),
|
|
5103
|
+
pageLabel
|
|
5104
|
+
] }),
|
|
5105
|
+
/* @__PURE__ */ jsxs15("span", { role: "status", children: [
|
|
5106
|
+
state.selectedCount,
|
|
5107
|
+
" ",
|
|
5108
|
+
countLabel
|
|
5109
|
+
] })
|
|
5110
|
+
] }) : null,
|
|
5111
|
+
selecting && state.selectedCount > 0 ? /* @__PURE__ */ jsxs15("fieldset", { disabled: state.isMutating, children: [
|
|
5112
|
+
/* @__PURE__ */ jsxs15("legend", { children: [
|
|
5113
|
+
state.selectedCount,
|
|
5114
|
+
" ",
|
|
5115
|
+
countLabel
|
|
5116
|
+
] }),
|
|
5117
|
+
/* @__PURE__ */ jsxs15("label", { children: [
|
|
5118
|
+
collectionLabel,
|
|
5119
|
+
/* @__PURE__ */ jsxs15("select", { value: state.collectionId, onChange: (event) => state.setCollectionId(event.currentTarget.value), children: [
|
|
5120
|
+
/* @__PURE__ */ jsx17("option", { value: "", children: uncategorizedLabel }),
|
|
5121
|
+
state.collections.map((collection) => /* @__PURE__ */ jsx17("option", { value: collection.id, children: collection.name }, collection.id))
|
|
5122
|
+
] })
|
|
5123
|
+
] }),
|
|
5124
|
+
/* @__PURE__ */ jsx17("button", { type: "button", onClick: () => run(state.moveToCollection), children: moveLabel }),
|
|
5125
|
+
/* @__PURE__ */ jsx17("button", { type: "button", onClick: () => run(archivedOnly ? state.unarchive : state.archive), children: archivedOnly ? unarchiveLabel : archiveLabel }),
|
|
5126
|
+
/* @__PURE__ */ jsxs15("details", { children: [
|
|
5127
|
+
/* @__PURE__ */ jsx17("summary", { children: moreLabel }),
|
|
5128
|
+
/* @__PURE__ */ jsxs15("div", { children: [
|
|
5129
|
+
/* @__PURE__ */ jsxs15("label", { children: [
|
|
5130
|
+
tagsLabel,
|
|
5131
|
+
/* @__PURE__ */ jsx17("input", { value: state.tagsInput, onChange: (event) => state.setTagsInput(event.currentTarget.value) })
|
|
5132
|
+
] }),
|
|
5133
|
+
/* @__PURE__ */ jsx17("button", { type: "button", onClick: () => run(state.updateTags), children: applyTagsLabel }),
|
|
5134
|
+
/* @__PURE__ */ jsx17("button", { type: "button", onClick: () => run(state.pin), children: pinLabel }),
|
|
5135
|
+
/* @__PURE__ */ jsx17("button", { type: "button", onClick: () => run(state.unpin), children: unpinLabel }),
|
|
5136
|
+
/* @__PURE__ */ jsx17("button", { type: "button", onClick: () => run(state.remove), children: removeLabel })
|
|
5137
|
+
] })
|
|
5138
|
+
] })
|
|
5139
|
+
] }) : null,
|
|
5140
|
+
selecting && state.error ? /* @__PURE__ */ jsx17("p", { role: "alert", children: getErrorMessage(state.error, errorLabel) }) : null
|
|
5141
|
+
] }),
|
|
5142
|
+
children(
|
|
5143
|
+
selecting ? { selectedIds, onSelectedIdsChange: setSelectedIds, disabled: state.isMutating } : void 0
|
|
5144
|
+
)
|
|
5145
|
+
] });
|
|
5146
|
+
}
|
|
5147
|
+
|
|
4963
5148
|
// src/features/collection/KeepList.tsx
|
|
4964
5149
|
import { KeepErrorBoundary } from "@keepkit/core/react";
|
|
4965
5150
|
import { isValidElement as isValidElement6 } from "react";
|
|
4966
5151
|
|
|
4967
5152
|
// src/features/item/KeepItemCard.tsx
|
|
5153
|
+
import { useKeepCollections as useKeepCollections5 } from "@keepkit/core/react";
|
|
4968
5154
|
import {
|
|
4969
5155
|
createContext as createContext3,
|
|
4970
5156
|
createElement as createElement2,
|
|
4971
5157
|
isValidElement as isValidElement4,
|
|
4972
5158
|
useContext as useContext3,
|
|
4973
|
-
useEffect as
|
|
5159
|
+
useEffect as useEffect10,
|
|
4974
5160
|
useId as useId3,
|
|
4975
|
-
useRef as
|
|
4976
|
-
useState as
|
|
5161
|
+
useRef as useRef9,
|
|
5162
|
+
useState as useState16
|
|
4977
5163
|
} from "react";
|
|
4978
5164
|
|
|
4979
5165
|
// src/features/item/hooks/useKeepItemStatusBadge.ts
|
|
@@ -5016,10 +5202,10 @@ function getDisplayStatus(status) {
|
|
|
5016
5202
|
}
|
|
5017
5203
|
|
|
5018
5204
|
// src/features/item/KeepItemStatusBadge.tsx
|
|
5019
|
-
import { Fragment as
|
|
5205
|
+
import { Fragment as Fragment9, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5020
5206
|
function KeepItemStatusBadge({ status = "available", label, className, ...props }) {
|
|
5021
5207
|
const view = useKeepItemStatusBadge(status);
|
|
5022
|
-
return /* @__PURE__ */
|
|
5208
|
+
return /* @__PURE__ */ jsxs16(
|
|
5023
5209
|
"span",
|
|
5024
5210
|
{
|
|
5025
5211
|
...props,
|
|
@@ -5030,14 +5216,14 @@ function KeepItemStatusBadge({ status = "available", label, className, ...props
|
|
|
5030
5216
|
"data-status": status,
|
|
5031
5217
|
"data-item-status": view.resolvedStatus,
|
|
5032
5218
|
children: [
|
|
5033
|
-
/* @__PURE__ */
|
|
5034
|
-
/* @__PURE__ */
|
|
5219
|
+
/* @__PURE__ */ jsx18(StatusIcon, { name: view.icon }),
|
|
5220
|
+
/* @__PURE__ */ jsx18("span", { "data-status-label": "true", children: label ?? view.statusLabel })
|
|
5035
5221
|
]
|
|
5036
5222
|
}
|
|
5037
5223
|
);
|
|
5038
5224
|
}
|
|
5039
5225
|
function StatusIcon({ name }) {
|
|
5040
|
-
return /* @__PURE__ */
|
|
5226
|
+
return /* @__PURE__ */ jsxs16(
|
|
5041
5227
|
"svg",
|
|
5042
5228
|
{
|
|
5043
5229
|
"data-status-icon": name,
|
|
@@ -5052,18 +5238,18 @@ function StatusIcon({ name }) {
|
|
|
5052
5238
|
"aria-hidden": "true",
|
|
5053
5239
|
focusable: "false",
|
|
5054
5240
|
children: [
|
|
5055
|
-
name === "check" ? /* @__PURE__ */
|
|
5056
|
-
name === "clock" ? /* @__PURE__ */
|
|
5057
|
-
/* @__PURE__ */
|
|
5058
|
-
/* @__PURE__ */
|
|
5241
|
+
name === "check" ? /* @__PURE__ */ jsx18("path", { d: "m5 12 4 4L19 6" }) : null,
|
|
5242
|
+
name === "clock" ? /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
5243
|
+
/* @__PURE__ */ jsx18("circle", { cx: "12", cy: "12", r: "8" }),
|
|
5244
|
+
/* @__PURE__ */ jsx18("path", { d: "M12 7v5l3 2" })
|
|
5059
5245
|
] }) : null,
|
|
5060
|
-
name === "ban" ? /* @__PURE__ */
|
|
5061
|
-
/* @__PURE__ */
|
|
5062
|
-
/* @__PURE__ */
|
|
5246
|
+
name === "ban" ? /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
5247
|
+
/* @__PURE__ */ jsx18("circle", { cx: "12", cy: "12", r: "8" }),
|
|
5248
|
+
/* @__PURE__ */ jsx18("path", { d: "m6.5 6.5 11 11" })
|
|
5063
5249
|
] }) : null,
|
|
5064
|
-
name === "lock" ? /* @__PURE__ */
|
|
5065
|
-
/* @__PURE__ */
|
|
5066
|
-
/* @__PURE__ */
|
|
5250
|
+
name === "lock" ? /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
5251
|
+
/* @__PURE__ */ jsx18("rect", { x: "5", y: "10", width: "14", height: "10", rx: "2" }),
|
|
5252
|
+
/* @__PURE__ */ jsx18("path", { d: "M8 10V7a4 4 0 0 1 8 0v3" })
|
|
5067
5253
|
] }) : null
|
|
5068
5254
|
]
|
|
5069
5255
|
}
|
|
@@ -5072,15 +5258,15 @@ function StatusIcon({ name }) {
|
|
|
5072
5258
|
|
|
5073
5259
|
// src/features/status/hooks/useKeepStaleNotice.ts
|
|
5074
5260
|
import { useKeepContext as useKeepContext5 } from "@keepkit/core/react";
|
|
5075
|
-
import { useState as
|
|
5261
|
+
import { useState as useState15 } from "react";
|
|
5076
5262
|
function useKeepStaleNotice({ item, onRetry, onRemoved }) {
|
|
5077
5263
|
const context = useKeepContext5();
|
|
5078
5264
|
const emitFeedback = useKeepUiFeedback();
|
|
5079
5265
|
const removedMessage = useUiLabel("removedMessage");
|
|
5080
5266
|
const restoredMessage = useUiLabel("restoredMessage");
|
|
5081
5267
|
const undoLabel = useUiLabel("undo");
|
|
5082
|
-
const [isRetrying, setIsRetrying] =
|
|
5083
|
-
const [error, setError] =
|
|
5268
|
+
const [isRetrying, setIsRetrying] = useState15(false);
|
|
5269
|
+
const [error, setError] = useState15(null);
|
|
5084
5270
|
async function retry() {
|
|
5085
5271
|
setError(null);
|
|
5086
5272
|
setIsRetrying(true);
|
|
@@ -5160,7 +5346,7 @@ function useKeepPruneStale({ statuses, onPruned }) {
|
|
|
5160
5346
|
}
|
|
5161
5347
|
|
|
5162
5348
|
// src/features/status/KeepStaleNotice.tsx
|
|
5163
|
-
import { jsx as
|
|
5349
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5164
5350
|
function KeepStaleNotice({
|
|
5165
5351
|
item,
|
|
5166
5352
|
onRetry,
|
|
@@ -5174,11 +5360,11 @@ function KeepStaleNotice({
|
|
|
5174
5360
|
const view = useKeepStaleNotice({ item, onRetry, onRemoved });
|
|
5175
5361
|
const showRetryLabel = useUiLabelVisibility("retry");
|
|
5176
5362
|
const showRemoveLabel = useUiLabelVisibility("removeFromList");
|
|
5177
|
-
return /* @__PURE__ */
|
|
5178
|
-
/* @__PURE__ */
|
|
5179
|
-
children ?? (item.statusReason ? /* @__PURE__ */
|
|
5180
|
-
/* @__PURE__ */
|
|
5181
|
-
/* @__PURE__ */
|
|
5363
|
+
return /* @__PURE__ */ jsxs17("aside", { ...props, className, "data-keepkit": "stale-notice", "data-state": view.error ? "error" : "stale", children: [
|
|
5364
|
+
/* @__PURE__ */ jsx19(KeepItemStatusBadge, { status: view.status }),
|
|
5365
|
+
children ?? (item.statusReason ? /* @__PURE__ */ jsx19("p", { children: item.statusReason }) : null),
|
|
5366
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
5367
|
+
/* @__PURE__ */ jsx19(
|
|
5182
5368
|
"button",
|
|
5183
5369
|
{
|
|
5184
5370
|
type: "button",
|
|
@@ -5189,7 +5375,7 @@ function KeepStaleNotice({
|
|
|
5189
5375
|
children: showRetryLabel ? retryLabel ?? view.labels.retry : null
|
|
5190
5376
|
}
|
|
5191
5377
|
),
|
|
5192
|
-
/* @__PURE__ */
|
|
5378
|
+
/* @__PURE__ */ jsx19(
|
|
5193
5379
|
"button",
|
|
5194
5380
|
{
|
|
5195
5381
|
type: "button",
|
|
@@ -5201,7 +5387,7 @@ function KeepStaleNotice({
|
|
|
5201
5387
|
}
|
|
5202
5388
|
)
|
|
5203
5389
|
] }),
|
|
5204
|
-
view.error ? /* @__PURE__ */
|
|
5390
|
+
view.error ? /* @__PURE__ */ jsx19("p", { role: "alert", children: getErrorMessage(view.error, view.labels.error) }) : null
|
|
5205
5391
|
] });
|
|
5206
5392
|
}
|
|
5207
5393
|
function KeepPruneStaleButton({
|
|
@@ -5214,7 +5400,7 @@ function KeepPruneStaleButton({
|
|
|
5214
5400
|
}) {
|
|
5215
5401
|
const view = useKeepPruneStale({ statuses, onPruned });
|
|
5216
5402
|
const showLabel = useUiLabelVisibility("pruneStale");
|
|
5217
|
-
return /* @__PURE__ */
|
|
5403
|
+
return /* @__PURE__ */ jsx19(
|
|
5218
5404
|
"button",
|
|
5219
5405
|
{
|
|
5220
5406
|
...props,
|
|
@@ -5328,7 +5514,7 @@ function getDisplayStatus2(status) {
|
|
|
5328
5514
|
}
|
|
5329
5515
|
|
|
5330
5516
|
// src/features/item/KeepItemCard.tsx
|
|
5331
|
-
import { Fragment as
|
|
5517
|
+
import { Fragment as Fragment10, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5332
5518
|
var KeepItemCardContext = createContext3(null);
|
|
5333
5519
|
function useKeepItemCardCompound(part) {
|
|
5334
5520
|
const context = useContext3(KeepItemCardContext);
|
|
@@ -5343,11 +5529,12 @@ function KeepItemCardRoot({
|
|
|
5343
5529
|
imageComponent: ImageComponent,
|
|
5344
5530
|
renderImage,
|
|
5345
5531
|
renderTags,
|
|
5532
|
+
presentation = "default",
|
|
5346
5533
|
showTags = true,
|
|
5347
|
-
showNote =
|
|
5534
|
+
showNote = presentation === "reading",
|
|
5348
5535
|
showSavedAt = true,
|
|
5349
|
-
showActivity =
|
|
5350
|
-
activityKind = "inactive",
|
|
5536
|
+
showActivity = presentation === "reading",
|
|
5537
|
+
activityKind = presentation === "reading" ? "opened" : "inactive",
|
|
5351
5538
|
collectionLabels,
|
|
5352
5539
|
imageAlt,
|
|
5353
5540
|
render,
|
|
@@ -5356,10 +5543,10 @@ function KeepItemCardRoot({
|
|
|
5356
5543
|
onRemoveError,
|
|
5357
5544
|
onRemoved,
|
|
5358
5545
|
onRetry,
|
|
5359
|
-
showSaveButton =
|
|
5546
|
+
showSaveButton = presentation !== "reading",
|
|
5360
5547
|
showPinButton = false,
|
|
5361
5548
|
showArchiveButton = false,
|
|
5362
|
-
showEditButton =
|
|
5549
|
+
showEditButton = presentation === "reading",
|
|
5363
5550
|
onEdit,
|
|
5364
5551
|
editSlot,
|
|
5365
5552
|
editFeatures,
|
|
@@ -5388,18 +5575,25 @@ function KeepItemCardRoot({
|
|
|
5388
5575
|
onRemoveError,
|
|
5389
5576
|
onRemoved
|
|
5390
5577
|
});
|
|
5578
|
+
const collections = useKeepCollections5();
|
|
5579
|
+
const doneLabel = useUiLabel("done");
|
|
5580
|
+
const moreLabel = useUiLabel("moreActions");
|
|
5391
5581
|
const contextQuery = useKeepSearchQuery();
|
|
5392
5582
|
const searchQuery = highlightQuery ?? contextQuery;
|
|
5393
5583
|
const contentChildren = asChild && isValidElement4(children) ? void 0 : children;
|
|
5394
|
-
const [isEditOpen, setEditOpen] =
|
|
5395
|
-
const editTriggerRef =
|
|
5584
|
+
const [isEditOpen, setEditOpen] = useState16(false);
|
|
5585
|
+
const editTriggerRef = useRef9(null);
|
|
5586
|
+
const editPanelRef = useRef9(null);
|
|
5587
|
+
const wasEditOpen = useRef9(false);
|
|
5396
5588
|
const editPanelId = useId3();
|
|
5397
5589
|
const editLabel = useUiLabel("editSavedItem");
|
|
5398
5590
|
const showEditLabel = useUiLabelVisibility("editSavedItem");
|
|
5399
5591
|
const showSavedAtLabel = useUiLabelVisibility("saved");
|
|
5400
5592
|
const closeEdit = () => setEditOpen(false);
|
|
5401
|
-
|
|
5402
|
-
if (
|
|
5593
|
+
useEffect10(() => {
|
|
5594
|
+
if (isEditOpen) editPanelRef.current?.querySelector("textarea, input, select")?.focus();
|
|
5595
|
+
if (wasEditOpen.current && !isEditOpen) editTriggerRef.current?.focus();
|
|
5596
|
+
wasEditOpen.current = isEditOpen;
|
|
5403
5597
|
}, [isEditOpen]);
|
|
5404
5598
|
function renderLink(content) {
|
|
5405
5599
|
if (!view.href || !view.isAvailable) return content;
|
|
@@ -5413,17 +5607,17 @@ function KeepItemCardRoot({
|
|
|
5413
5607
|
},
|
|
5414
5608
|
children: content
|
|
5415
5609
|
};
|
|
5416
|
-
return LinkComponent ? /* @__PURE__ */
|
|
5610
|
+
return LinkComponent ? /* @__PURE__ */ jsx20(LinkComponent, { ...linkProps }) : /* @__PURE__ */ jsx20("a", { ...linkProps });
|
|
5417
5611
|
}
|
|
5418
5612
|
function renderTitle(content) {
|
|
5419
5613
|
if (linkTarget !== "title") return content;
|
|
5420
5614
|
if (view.isAvailable) return renderLink(content);
|
|
5421
|
-
return view.href ? /* @__PURE__ */
|
|
5615
|
+
return view.href ? /* @__PURE__ */ jsx20("span", { "aria-disabled": "true", "data-link-disabled": "true", children: content }) : content;
|
|
5422
5616
|
}
|
|
5423
5617
|
const resolvedImageProps = view.imageProps ? { ...view.imageProps, alt: imageAlt ?? view.imageProps.alt } : void 0;
|
|
5424
5618
|
const imageSource = resolvedImageProps?.src;
|
|
5425
|
-
const [imageStatus, setImageStatus] =
|
|
5426
|
-
|
|
5619
|
+
const [imageStatus, setImageStatus] = useState16(imageSource ? "loading" : "error");
|
|
5620
|
+
useEffect10(() => {
|
|
5427
5621
|
setImageStatus(imageSource ? "loading" : "error");
|
|
5428
5622
|
}, [imageSource]);
|
|
5429
5623
|
let image = null;
|
|
@@ -5441,21 +5635,30 @@ function KeepItemCardRoot({
|
|
|
5441
5635
|
setImageStatus("error");
|
|
5442
5636
|
}
|
|
5443
5637
|
};
|
|
5444
|
-
image = renderImage?.(imagePropsWithHandlers, item) ?? (ImageComponent ? /* @__PURE__ */
|
|
5638
|
+
image = renderImage?.(imagePropsWithHandlers, item) ?? (ImageComponent ? /* @__PURE__ */ jsx20(ImageComponent, { ...imagePropsWithHandlers }) : /* @__PURE__ */ jsx20("img", { ...imagePropsWithHandlers, alt: imagePropsWithHandlers.alt }));
|
|
5445
5639
|
}
|
|
5446
5640
|
const tags = showTags ? item.tags ?? [] : [];
|
|
5447
5641
|
const renderedTags = showTags && tags.length > 0 ? renderTags?.(tags, item) ?? null : null;
|
|
5448
|
-
const meta = showSavedAt ? /* @__PURE__ */
|
|
5449
|
-
showSavedAtLabel ? /* @__PURE__ */
|
|
5642
|
+
const meta = showSavedAt ? /* @__PURE__ */ jsxs18("div", { "data-card-meta": true, children: [
|
|
5643
|
+
showSavedAtLabel ? /* @__PURE__ */ jsxs18("span", { children: [
|
|
5450
5644
|
view.labels.savedAt,
|
|
5451
5645
|
":"
|
|
5452
5646
|
] }) : null,
|
|
5453
5647
|
showSavedAtLabel ? " " : null,
|
|
5454
|
-
/* @__PURE__ */
|
|
5648
|
+
/* @__PURE__ */ jsx20("time", { dateTime: new Date(item.savedAt).toISOString(), children: formatSavedAt(item.savedAt) })
|
|
5455
5649
|
] }) : null;
|
|
5456
|
-
const error = view.itemState.error ? /* @__PURE__ */
|
|
5457
|
-
const actions = view.statusLabel ? /* @__PURE__ */
|
|
5458
|
-
showEditButton ? isEditOpen ? /* @__PURE__ */
|
|
5650
|
+
const error = view.itemState.error && !isEditOpen ? /* @__PURE__ */ jsx20("p", { role: "alert", children: getErrorMessage(view.itemState.error, view.labels.error) }) : null;
|
|
5651
|
+
const actions = view.statusLabel ? /* @__PURE__ */ jsx20(KeepStaleNotice, { item, onRetry, onRemoved }) : /* @__PURE__ */ jsxs18(Fragment10, { children: [
|
|
5652
|
+
showEditButton ? isEditOpen ? /* @__PURE__ */ jsx20("div", { ref: editPanelRef, id: editPanelId, role: "dialog", "aria-label": editLabel, "data-keepkit": "item-edit-dialog", children: editSlot ? editSlot(item, closeEdit) : /* @__PURE__ */ jsx20(
|
|
5653
|
+
KeepQuickEditor,
|
|
5654
|
+
{
|
|
5655
|
+
item: view.itemState.item ?? item,
|
|
5656
|
+
onClose: closeEdit,
|
|
5657
|
+
features: editFeatures,
|
|
5658
|
+
collectionLabels,
|
|
5659
|
+
...presentation === "reading" ? { showSaveButton: false, closeLabel: doneLabel } : {}
|
|
5660
|
+
}
|
|
5661
|
+
) }) : /* @__PURE__ */ jsx20(
|
|
5459
5662
|
"button",
|
|
5460
5663
|
{
|
|
5461
5664
|
ref: editTriggerRef,
|
|
@@ -5472,31 +5675,41 @@ function KeepItemCardRoot({
|
|
|
5472
5675
|
children: showEditLabel ? editLabel : null
|
|
5473
5676
|
}
|
|
5474
5677
|
) : null,
|
|
5475
|
-
isEditOpen ? null : /* @__PURE__ */
|
|
5476
|
-
showSaveButton ? /* @__PURE__ */
|
|
5477
|
-
showPinButton ? /* @__PURE__ */
|
|
5478
|
-
|
|
5479
|
-
|
|
5678
|
+
isEditOpen ? null : /* @__PURE__ */ jsxs18(Fragment10, { children: [
|
|
5679
|
+
showSaveButton ? /* @__PURE__ */ jsx20(KeepItemCardSave, {}) : null,
|
|
5680
|
+
showPinButton ? /* @__PURE__ */ jsx20(KeepItemCardPin, {}) : null,
|
|
5681
|
+
presentation === "reading" ? /* @__PURE__ */ jsxs18("details", { "data-keep-card-part": "more-actions", children: [
|
|
5682
|
+
/* @__PURE__ */ jsx20("summary", { children: moreLabel }),
|
|
5683
|
+
/* @__PURE__ */ jsxs18("div", { children: [
|
|
5684
|
+
showArchiveButton ? /* @__PURE__ */ jsx20(KeepItemCardArchive, {}) : null,
|
|
5685
|
+
/* @__PURE__ */ jsx20(KeepItemCardRemove, {})
|
|
5686
|
+
] })
|
|
5687
|
+
] }) : /* @__PURE__ */ jsxs18(Fragment10, { children: [
|
|
5688
|
+
showArchiveButton ? /* @__PURE__ */ jsx20(KeepItemCardArchive, {}) : null,
|
|
5689
|
+
/* @__PURE__ */ jsx20(KeepItemCardRemove, {})
|
|
5690
|
+
] })
|
|
5480
5691
|
] }),
|
|
5481
|
-
isEditOpen && (showPinButton || showArchiveButton) ? /* @__PURE__ */
|
|
5482
|
-
showPinButton ? /* @__PURE__ */
|
|
5483
|
-
showArchiveButton ? /* @__PURE__ */
|
|
5692
|
+
isEditOpen && presentation !== "reading" && (showPinButton || showArchiveButton) ? /* @__PURE__ */ jsxs18("div", { "data-keep-card-part": "actions-secondary", children: [
|
|
5693
|
+
showPinButton ? /* @__PURE__ */ jsx20(KeepItemCardPin, {}) : null,
|
|
5694
|
+
showArchiveButton ? /* @__PURE__ */ jsx20(KeepItemCardArchive, {}) : null
|
|
5484
5695
|
] }) : null
|
|
5485
5696
|
] });
|
|
5486
5697
|
const compoundValue = {
|
|
5487
5698
|
item,
|
|
5488
|
-
collectionLabel: item.collectionId ? collectionLabels?.[item.collectionId] ?? item.collectionId : void 0,
|
|
5699
|
+
collectionLabel: item.collectionId ? collectionLabels?.[item.collectionId] ?? collections.find((collection) => collection.id === item.collectionId)?.name ?? item.collectionId : void 0,
|
|
5489
5700
|
resolvedTitle: view.resolvedTitle,
|
|
5490
5701
|
renderTitle,
|
|
5491
5702
|
image: imageStatus === "error" ? null : image,
|
|
5492
5703
|
imageStatus,
|
|
5493
5704
|
fallbackLabel: String(view.resolvedTitle),
|
|
5494
5705
|
note: showNote ? item.note : void 0,
|
|
5495
|
-
activity: showActivity ? /* @__PURE__ */
|
|
5706
|
+
activity: showActivity ? /* @__PURE__ */ jsx20(KeepLastActivity, { item, kind: activityKind }) : null,
|
|
5496
5707
|
tags,
|
|
5497
5708
|
tagsLabel: view.labels.tags,
|
|
5498
5709
|
renderedTags,
|
|
5499
5710
|
meta,
|
|
5711
|
+
source: getSource(view.href),
|
|
5712
|
+
reading: presentation === "reading",
|
|
5500
5713
|
error,
|
|
5501
5714
|
actions,
|
|
5502
5715
|
saveButtonLabels,
|
|
@@ -5504,12 +5717,12 @@ function KeepItemCardRoot({
|
|
|
5504
5717
|
remove: view.remove,
|
|
5505
5718
|
isMutating: view.itemState.isMutating,
|
|
5506
5719
|
saveAriaLabel: `${view.labels.remove} ${String(view.resolvedTitle)}`,
|
|
5507
|
-
renderText: (content) => /* @__PURE__ */
|
|
5720
|
+
renderText: (content) => /* @__PURE__ */ jsx20(KeepHighlight, { query: searchQuery, children: content })
|
|
5508
5721
|
};
|
|
5509
|
-
const defaultBody = /* @__PURE__ */
|
|
5510
|
-
/* @__PURE__ */
|
|
5511
|
-
/* @__PURE__ */
|
|
5512
|
-
/* @__PURE__ */
|
|
5722
|
+
const defaultBody = /* @__PURE__ */ jsxs18(Fragment10, { children: [
|
|
5723
|
+
presentation !== "reading" || resolvedImageProps?.src ? /* @__PURE__ */ jsx20(KeepItemCardMedia, {}) : null,
|
|
5724
|
+
/* @__PURE__ */ jsx20(KeepItemCardContent, {}),
|
|
5725
|
+
/* @__PURE__ */ jsx20(KeepItemCardActions, {})
|
|
5513
5726
|
] });
|
|
5514
5727
|
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? defaultBody;
|
|
5515
5728
|
const linkedBody = linkTarget === "card" && view.isAvailable ? renderLink(body) : body;
|
|
@@ -5525,26 +5738,35 @@ function KeepItemCardRoot({
|
|
|
5525
5738
|
"data-state": view.itemState.error ? "error" : view.itemState.isSaved ? "saved" : "unsaved",
|
|
5526
5739
|
"data-status": item.status ?? "available",
|
|
5527
5740
|
"data-item-status": view.displayStatus,
|
|
5741
|
+
"data-presentation": presentation !== "default" ? presentation : void 0,
|
|
5742
|
+
"data-has-image": presentation === "reading" && resolvedImageProps?.src ? "true" : void 0,
|
|
5743
|
+
"data-editing": isEditOpen ? "true" : void 0,
|
|
5528
5744
|
"data-card-variant": cardVariant !== "outlined" ? cardVariant : void 0,
|
|
5529
5745
|
"data-loading": view.itemState.isMutating ? "true" : void 0
|
|
5530
5746
|
},
|
|
5531
5747
|
linkedBody,
|
|
5532
5748
|
"KeepItemCard"
|
|
5533
5749
|
);
|
|
5534
|
-
return /* @__PURE__ */
|
|
5750
|
+
return /* @__PURE__ */ jsx20(KeepItemCardContext.Provider, { value: compoundValue, children: root });
|
|
5535
5751
|
}
|
|
5536
5752
|
function KeepItemCardMedia({ children, fallback, ...props }) {
|
|
5537
5753
|
const context = useKeepItemCardCompound("Media");
|
|
5538
|
-
return /* @__PURE__ */
|
|
5754
|
+
return /* @__PURE__ */ jsx20("div", { ...props, "data-keep-card-part": "media", "data-media-status": context.imageStatus, "data-aspect-ratio": "1/1", children: children ?? context.image ?? /* @__PURE__ */ jsx20("span", { role: "img", "aria-label": context.fallbackLabel, "data-keep-card-fallback": "true", children: fallback ?? /* @__PURE__ */ jsx20(KeepMediaPlaceholderIcon, {}) }) });
|
|
5539
5755
|
}
|
|
5540
5756
|
function KeepItemCardContent({ children, ...props }) {
|
|
5541
5757
|
const context = useKeepItemCardCompound("Content");
|
|
5542
|
-
return /* @__PURE__ */
|
|
5543
|
-
/* @__PURE__ */
|
|
5544
|
-
|
|
5545
|
-
context.
|
|
5546
|
-
context.
|
|
5547
|
-
|
|
5758
|
+
return /* @__PURE__ */ jsx20("div", { ...props, "data-keep-card-part": "content", children: children === void 0 ? /* @__PURE__ */ jsxs18(Fragment10, { children: [
|
|
5759
|
+
context.reading && context.source ? /* @__PURE__ */ jsx20("span", { "data-keep-card-part": "source", children: context.source }) : null,
|
|
5760
|
+
/* @__PURE__ */ jsx20(KeepItemCardTitle, {}),
|
|
5761
|
+
context.reading ? /* @__PURE__ */ jsx20(KeepItemCardCollectionBadge, {}) : null,
|
|
5762
|
+
context.reading ? null : context.meta,
|
|
5763
|
+
context.reading ? null : context.activity,
|
|
5764
|
+
context.note ? /* @__PURE__ */ jsx20("p", { "data-keep-card-part": "memo-preview", "data-line-clamp": "2", children: context.note }) : null,
|
|
5765
|
+
/* @__PURE__ */ jsx20(KeepItemCardTags, {}),
|
|
5766
|
+
context.reading ? /* @__PURE__ */ jsxs18("div", { "data-keep-card-part": "reading-metadata", children: [
|
|
5767
|
+
context.meta,
|
|
5768
|
+
context.activity
|
|
5769
|
+
] }) : null,
|
|
5548
5770
|
context.error
|
|
5549
5771
|
] }) : context.renderText(children) });
|
|
5550
5772
|
}
|
|
@@ -5557,8 +5779,8 @@ function KeepItemCardTitle({ as = "h3", children, ...props }) {
|
|
|
5557
5779
|
);
|
|
5558
5780
|
}
|
|
5559
5781
|
function KeepMediaPlaceholderIcon() {
|
|
5560
|
-
return /* @__PURE__ */
|
|
5561
|
-
/* @__PURE__ */
|
|
5782
|
+
return /* @__PURE__ */ jsxs18("svg", { "data-media-fallback-icon": "true", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
|
|
5783
|
+
/* @__PURE__ */ jsx20(
|
|
5562
5784
|
"path",
|
|
5563
5785
|
{
|
|
5564
5786
|
d: "M4 5.5A1.5 1.5 0 0 1 5.5 4h13A1.5 1.5 0 0 1 20 5.5v13a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 4 18.5v-13Z",
|
|
@@ -5566,19 +5788,19 @@ function KeepMediaPlaceholderIcon() {
|
|
|
5566
5788
|
stroke: "currentColor"
|
|
5567
5789
|
}
|
|
5568
5790
|
),
|
|
5569
|
-
/* @__PURE__ */
|
|
5570
|
-
/* @__PURE__ */
|
|
5791
|
+
/* @__PURE__ */ jsx20("circle", { cx: "9", cy: "9", r: "1.5", fill: "currentColor" }),
|
|
5792
|
+
/* @__PURE__ */ jsx20("path", { d: "m5.5 18 4.5-4.5 3 3 2-2L19 18", fill: "none", stroke: "currentColor" })
|
|
5571
5793
|
] });
|
|
5572
5794
|
}
|
|
5573
5795
|
function KeepItemCardTags({ children, ...props }) {
|
|
5574
5796
|
const context = useKeepItemCardCompound("Tags");
|
|
5575
5797
|
if (children === void 0 && context.renderedTags) return context.renderedTags;
|
|
5576
5798
|
if (children === void 0 && context.tags.length === 0) return null;
|
|
5577
|
-
return /* @__PURE__ */
|
|
5799
|
+
return /* @__PURE__ */ jsx20("ul", { ...props, "aria-label": props["aria-label"] ?? context.tagsLabel, "data-keep-card-part": "tags", children: children ?? context.tags.map((tag) => /* @__PURE__ */ jsx20("li", { children: tag }, tag)) });
|
|
5578
5800
|
}
|
|
5579
5801
|
function KeepItemCardActions({ children, ...props }) {
|
|
5580
5802
|
const context = useKeepItemCardCompound("Actions");
|
|
5581
|
-
return /* @__PURE__ */
|
|
5803
|
+
return /* @__PURE__ */ jsx20("div", { ...props, "data-keep-card-part": "actions", children: children ?? context.actions });
|
|
5582
5804
|
}
|
|
5583
5805
|
function KeepLastActivity({
|
|
5584
5806
|
item,
|
|
@@ -5590,15 +5812,15 @@ function KeepLastActivity({
|
|
|
5590
5812
|
const neverOpenedLabel = useUiLabel("activityNeverOpened");
|
|
5591
5813
|
const inactiveSuffix = useUiLabel("activityInactiveSuffix");
|
|
5592
5814
|
if (item.lastOpenedAt === void 0) {
|
|
5593
|
-
return /* @__PURE__ */
|
|
5815
|
+
return /* @__PURE__ */ jsx20("span", { ...props, "data-keep-card-part": "activity", children: neverOpenedLabel });
|
|
5594
5816
|
}
|
|
5595
5817
|
const age = Math.max(0, Date.now() - item.lastOpenedAt);
|
|
5596
5818
|
const label = kind === "opened" ? `${openedLabel} ${formatRelativeAge(age, locale)}` : `${formatInactiveAge(age, locale)}${isCjkLocale2(locale) ? "" : " "}${inactiveSuffix}`;
|
|
5597
|
-
return /* @__PURE__ */
|
|
5819
|
+
return /* @__PURE__ */ jsx20("span", { ...props, "data-keep-card-part": "activity", children: /* @__PURE__ */ jsx20("time", { dateTime: new Date(item.lastOpenedAt).toISOString(), children: label }) });
|
|
5598
5820
|
}
|
|
5599
5821
|
function KeepItemCardSave({ labels, getAriaLabel, ...props }) {
|
|
5600
5822
|
const context = useKeepItemCardCompound("Save");
|
|
5601
|
-
return /* @__PURE__ */
|
|
5823
|
+
return /* @__PURE__ */ jsx20(
|
|
5602
5824
|
KeepButton,
|
|
5603
5825
|
{
|
|
5604
5826
|
...props,
|
|
@@ -5611,7 +5833,7 @@ function KeepItemCardSave({ labels, getAriaLabel, ...props }) {
|
|
|
5611
5833
|
}
|
|
5612
5834
|
function KeepItemCardRemove({ children, disabled, onClick, ...props }) {
|
|
5613
5835
|
const context = useKeepItemCardCompound("Remove");
|
|
5614
|
-
return /* @__PURE__ */
|
|
5836
|
+
return /* @__PURE__ */ jsx20(
|
|
5615
5837
|
"button",
|
|
5616
5838
|
{
|
|
5617
5839
|
...props,
|
|
@@ -5628,19 +5850,19 @@ function KeepItemCardRemove({ children, disabled, onClick, ...props }) {
|
|
|
5628
5850
|
}
|
|
5629
5851
|
function KeepItemCardPin({ children, ...props }) {
|
|
5630
5852
|
const context = useKeepItemCardCompound("Pin");
|
|
5631
|
-
return /* @__PURE__ */
|
|
5853
|
+
return /* @__PURE__ */ jsx20(KeepPinButton, { ...props, item: context.item, children });
|
|
5632
5854
|
}
|
|
5633
5855
|
function KeepItemCardArchive({
|
|
5634
5856
|
children,
|
|
5635
5857
|
...props
|
|
5636
5858
|
}) {
|
|
5637
5859
|
const context = useKeepItemCardCompound("Archive");
|
|
5638
|
-
return /* @__PURE__ */
|
|
5860
|
+
return /* @__PURE__ */ jsx20(KeepArchiveButton, { ...props, item: context.item, children });
|
|
5639
5861
|
}
|
|
5640
5862
|
function KeepItemCardCollectionBadge({ children, ...props }) {
|
|
5641
5863
|
const context = useKeepItemCardCompound("CollectionBadge");
|
|
5642
5864
|
if (!context.item.collectionId) return null;
|
|
5643
|
-
return /* @__PURE__ */
|
|
5865
|
+
return /* @__PURE__ */ jsx20("span", { ...props, "data-keep-card-part": "collection-badge", children: children ?? context.collectionLabel });
|
|
5644
5866
|
}
|
|
5645
5867
|
var KeepItemCard = Object.assign(KeepItemCardRoot, {
|
|
5646
5868
|
Media: KeepItemCardMedia,
|
|
@@ -5655,12 +5877,12 @@ var KeepItemCard = Object.assign(KeepItemCardRoot, {
|
|
|
5655
5877
|
CollectionBadge: KeepItemCardCollectionBadge
|
|
5656
5878
|
});
|
|
5657
5879
|
function KeepItemCardSkeleton({ layout = "list", ...props }) {
|
|
5658
|
-
return /* @__PURE__ */
|
|
5659
|
-
/* @__PURE__ */
|
|
5660
|
-
/* @__PURE__ */
|
|
5661
|
-
/* @__PURE__ */
|
|
5662
|
-
/* @__PURE__ */
|
|
5663
|
-
/* @__PURE__ */
|
|
5880
|
+
return /* @__PURE__ */ jsxs18("article", { ...props, "aria-hidden": "true", "data-keepkit": "card-skeleton", "data-layout": layout, "data-state": "loading", children: [
|
|
5881
|
+
/* @__PURE__ */ jsx20("span", { "data-skeleton-part": "media" }),
|
|
5882
|
+
/* @__PURE__ */ jsx20("span", { "data-skeleton-part": "title" }),
|
|
5883
|
+
/* @__PURE__ */ jsx20("span", { "data-skeleton-part": "meta" }),
|
|
5884
|
+
/* @__PURE__ */ jsx20("span", { "data-skeleton-part": "tag" }),
|
|
5885
|
+
/* @__PURE__ */ jsx20("span", { "data-skeleton-part": "tag" })
|
|
5664
5886
|
] });
|
|
5665
5887
|
}
|
|
5666
5888
|
function formatSavedAt(timestamp) {
|
|
@@ -5684,10 +5906,19 @@ function formatInactiveAge(milliseconds, locale) {
|
|
|
5684
5906
|
function isCjkLocale2(locale) {
|
|
5685
5907
|
return /^(?:ja|ko|zh)/i.test(locale ?? "");
|
|
5686
5908
|
}
|
|
5909
|
+
function getSource(href) {
|
|
5910
|
+
if (!href) return void 0;
|
|
5911
|
+
try {
|
|
5912
|
+
const url = new URL(href);
|
|
5913
|
+
return url.protocol === "http:" || url.protocol === "https:" ? url.hostname.replace(/^www\./, "") : void 0;
|
|
5914
|
+
} catch {
|
|
5915
|
+
return void 0;
|
|
5916
|
+
}
|
|
5917
|
+
}
|
|
5687
5918
|
|
|
5688
5919
|
// src/features/status/KeepEmptyState.tsx
|
|
5689
5920
|
import { isValidElement as isValidElement5 } from "react";
|
|
5690
|
-
import { Fragment as
|
|
5921
|
+
import { Fragment as Fragment11, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5691
5922
|
function KeepEmptyState({
|
|
5692
5923
|
title,
|
|
5693
5924
|
description,
|
|
@@ -5706,10 +5937,10 @@ function KeepEmptyState({
|
|
|
5706
5937
|
);
|
|
5707
5938
|
const clearLabel = useUiLabel("clearFilters");
|
|
5708
5939
|
const contentChildren = asChild && isValidElement5(children) ? void 0 : children;
|
|
5709
|
-
const body = contentChildren ?? /* @__PURE__ */
|
|
5710
|
-
/* @__PURE__ */
|
|
5711
|
-
description ?? /* @__PURE__ */
|
|
5712
|
-
action ?? (resolvedVariant === "empty-filtered" && onClearFilters ? /* @__PURE__ */
|
|
5940
|
+
const body = contentChildren ?? /* @__PURE__ */ jsxs19(Fragment11, { children: [
|
|
5941
|
+
/* @__PURE__ */ jsx21("h2", { children: title ?? defaultTitle }),
|
|
5942
|
+
description ?? /* @__PURE__ */ jsx21("p", { children: defaultDescription }),
|
|
5943
|
+
action ?? (resolvedVariant === "empty-filtered" && onClearFilters ? /* @__PURE__ */ jsx21("button", { type: "button", "data-keep-action": "clear-filters", onClick: onClearFilters, children: clearLabel }) : null)
|
|
5713
5944
|
] });
|
|
5714
5945
|
return renderRoot(
|
|
5715
5946
|
asChild,
|
|
@@ -5735,9 +5966,9 @@ function useKeepListView(query) {
|
|
|
5735
5966
|
}
|
|
5736
5967
|
|
|
5737
5968
|
// src/features/collection/hooks/useRovingTabIndex.ts
|
|
5738
|
-
import { useCallback as useCallback7, useEffect as
|
|
5969
|
+
import { useCallback as useCallback7, useEffect as useEffect11, useRef as useRef10 } from "react";
|
|
5739
5970
|
function useRovingTabIndex() {
|
|
5740
|
-
const ref =
|
|
5971
|
+
const ref = useRef10(null);
|
|
5741
5972
|
const getItems = useCallback7(() => {
|
|
5742
5973
|
const root = ref.current;
|
|
5743
5974
|
if (!root) return [];
|
|
@@ -5755,7 +5986,7 @@ function useRovingTabIndex() {
|
|
|
5755
5986
|
item.tabIndex = index === activeIndex ? 0 : -1;
|
|
5756
5987
|
});
|
|
5757
5988
|
}, [getItems]);
|
|
5758
|
-
|
|
5989
|
+
useEffect11(() => {
|
|
5759
5990
|
const root = ref.current;
|
|
5760
5991
|
if (!root) return;
|
|
5761
5992
|
syncTabIndices();
|
|
@@ -5800,8 +6031,8 @@ function useRovingTabIndex() {
|
|
|
5800
6031
|
}
|
|
5801
6032
|
|
|
5802
6033
|
// src/features/collection/KeepReorderableList.tsx
|
|
5803
|
-
import { useState as
|
|
5804
|
-
import { jsx as
|
|
6034
|
+
import { useState as useState17 } from "react";
|
|
6035
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
5805
6036
|
function KeepReorderableList({
|
|
5806
6037
|
items,
|
|
5807
6038
|
onReorder,
|
|
@@ -5809,8 +6040,8 @@ function KeepReorderableList({
|
|
|
5809
6040
|
itemLabel = (_item, index) => `Move item ${index + 1}`,
|
|
5810
6041
|
...props
|
|
5811
6042
|
}) {
|
|
5812
|
-
const [draggedId, setDraggedId] =
|
|
5813
|
-
const [dropTargetIndex, setDropTargetIndex] =
|
|
6043
|
+
const [draggedId, setDraggedId] = useState17(null);
|
|
6044
|
+
const [dropTargetIndex, setDropTargetIndex] = useState17(null);
|
|
5814
6045
|
const ids = items.map((item) => item.id);
|
|
5815
6046
|
function commit(nextIds) {
|
|
5816
6047
|
void onReorder(nextIds);
|
|
@@ -5835,7 +6066,7 @@ function KeepReorderableList({
|
|
|
5835
6066
|
if (next[index] === id) return;
|
|
5836
6067
|
commit(next);
|
|
5837
6068
|
}
|
|
5838
|
-
return /* @__PURE__ */
|
|
6069
|
+
return /* @__PURE__ */ jsx22("ul", { ...props, "data-keepkit": "reorderable-list", children: items.map((item, index) => {
|
|
5839
6070
|
const moveUp = () => move(index, index - 1);
|
|
5840
6071
|
const moveDown = () => move(index, index + 1);
|
|
5841
6072
|
const onHandleKeyDown = (event) => {
|
|
@@ -5879,7 +6110,7 @@ function KeepReorderableList({
|
|
|
5879
6110
|
onKeyDown: onHandleKeyDown
|
|
5880
6111
|
}
|
|
5881
6112
|
};
|
|
5882
|
-
return /* @__PURE__ */
|
|
6113
|
+
return /* @__PURE__ */ jsx22(
|
|
5883
6114
|
"li",
|
|
5884
6115
|
{
|
|
5885
6116
|
"data-reorder-index": index,
|
|
@@ -5911,17 +6142,18 @@ function KeepReorderableList({
|
|
|
5911
6142
|
}
|
|
5912
6143
|
|
|
5913
6144
|
// src/features/collection/KeepList.tsx
|
|
5914
|
-
import { Fragment as
|
|
6145
|
+
import { Fragment as Fragment12, jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5915
6146
|
function KeepList(props) {
|
|
5916
6147
|
const { fallback, onBoundaryError, boundaryResetKey, ...listProps } = props;
|
|
5917
|
-
const content = /* @__PURE__ */
|
|
6148
|
+
const content = /* @__PURE__ */ jsx23(KeepListContent, { ...listProps });
|
|
5918
6149
|
if (fallback === void 0 && onBoundaryError === void 0) return content;
|
|
5919
|
-
return /* @__PURE__ */
|
|
6150
|
+
return /* @__PURE__ */ jsx23(KeepErrorBoundary, { fallback, onError: onBoundaryError, resetKey: boundaryResetKey, children: content });
|
|
5920
6151
|
}
|
|
5921
6152
|
function KeepListContent({
|
|
5922
6153
|
query,
|
|
5923
6154
|
children,
|
|
5924
6155
|
renderItem,
|
|
6156
|
+
selection,
|
|
5925
6157
|
loading,
|
|
5926
6158
|
renderLoading,
|
|
5927
6159
|
loadingCount = 6,
|
|
@@ -5944,6 +6176,7 @@ function KeepListContent({
|
|
|
5944
6176
|
const body = getListBody(state, {
|
|
5945
6177
|
children,
|
|
5946
6178
|
renderItem,
|
|
6179
|
+
selection,
|
|
5947
6180
|
loading: renderLoading !== void 0 ? renderLoading : loading,
|
|
5948
6181
|
loadingCount,
|
|
5949
6182
|
loadingLabel: view.labels.loading,
|
|
@@ -5981,7 +6214,7 @@ function KeepListContent({
|
|
|
5981
6214
|
if (!event.defaultPrevented) roving.onFocusCapture(event);
|
|
5982
6215
|
}
|
|
5983
6216
|
},
|
|
5984
|
-
/* @__PURE__ */
|
|
6217
|
+
/* @__PURE__ */ jsx23(KeepSearchQueryProvider, { query: query?.search?.query, children: body }),
|
|
5985
6218
|
"KeepList"
|
|
5986
6219
|
);
|
|
5987
6220
|
}
|
|
@@ -5996,17 +6229,17 @@ function getListBody(state, options) {
|
|
|
5996
6229
|
if (state.isLoading && !state.isHydrated) {
|
|
5997
6230
|
if (options.loading !== void 0) return resolveContent(options.loading, state);
|
|
5998
6231
|
const count = Number.isFinite(options.loadingCount) ? Math.max(0, Math.floor(options.loadingCount)) : 6;
|
|
5999
|
-
return /* @__PURE__ */
|
|
6000
|
-
/* @__PURE__ */
|
|
6001
|
-
/* @__PURE__ */
|
|
6232
|
+
return /* @__PURE__ */ jsxs20(Fragment12, { children: [
|
|
6233
|
+
/* @__PURE__ */ jsx23("span", { role: "status", "data-keepkit": "loading-label", children: options.loadingLabel }),
|
|
6234
|
+
/* @__PURE__ */ jsx23("ul", { "data-keepkit": "skeleton-list", "data-layout": options.layout, children: Array.from({ length: count }, (_, index) => (
|
|
6002
6235
|
// biome-ignore lint/suspicious/noArrayIndexKey: Static loading placeholders never reorder.
|
|
6003
|
-
/* @__PURE__ */
|
|
6236
|
+
/* @__PURE__ */ jsx23("li", { children: /* @__PURE__ */ jsx23(KeepItemCardSkeleton, { layout: options.layout }) }, index)
|
|
6004
6237
|
)) })
|
|
6005
6238
|
] });
|
|
6006
6239
|
}
|
|
6007
6240
|
if (state.isHydrated && state.items.length === 0) {
|
|
6008
6241
|
if (options.empty !== void 0) return resolveContent(options.empty, state);
|
|
6009
|
-
return /* @__PURE__ */
|
|
6242
|
+
return /* @__PURE__ */ jsx23(
|
|
6010
6243
|
KeepEmptyState,
|
|
6011
6244
|
{
|
|
6012
6245
|
variant: options.allItemCount > 0 && hasActiveQueryFilters(options.query) ? "empty-filtered" : "empty-storage",
|
|
@@ -6017,7 +6250,7 @@ function getListBody(state, options) {
|
|
|
6017
6250
|
if (typeof options.children === "function") return options.children(state);
|
|
6018
6251
|
if (options.children !== void 0 && !isValidElement6(options.children)) return options.children;
|
|
6019
6252
|
if (options.reorderable) {
|
|
6020
|
-
return /* @__PURE__ */
|
|
6253
|
+
return /* @__PURE__ */ jsx23(
|
|
6021
6254
|
KeepReorderableList,
|
|
6022
6255
|
{
|
|
6023
6256
|
items: state.items,
|
|
@@ -6025,16 +6258,22 @@ function getListBody(state, options) {
|
|
|
6025
6258
|
await options.reorder(orderedIds);
|
|
6026
6259
|
await options.onReorder?.(orderedIds);
|
|
6027
6260
|
},
|
|
6028
|
-
renderItem: (item, reorderState) => /* @__PURE__ */
|
|
6029
|
-
/* @__PURE__ */
|
|
6030
|
-
options.renderItem ? options.renderItem(item, state) : /* @__PURE__ */
|
|
6261
|
+
renderItem: (item, reorderState) => /* @__PURE__ */ jsxs20(Fragment12, { children: [
|
|
6262
|
+
/* @__PURE__ */ jsx23("button", { type: "button", ...reorderState.dragHandleProps, children: "\u2195" }),
|
|
6263
|
+
options.renderItem ? options.renderItem(item, state, getItemSelection(item.id, options.selection)) : /* @__PURE__ */ jsxs20(Fragment12, { children: [
|
|
6264
|
+
options.selection ? /* @__PURE__ */ jsx23(KeepItemCheckbox, { item, ...getItemSelection(item.id, options.selection) }) : null,
|
|
6265
|
+
/* @__PURE__ */ jsx23(KeepItemCard, { item, ...options.itemCardProps })
|
|
6266
|
+
] })
|
|
6031
6267
|
] }),
|
|
6032
6268
|
"data-layout": options.layout
|
|
6033
6269
|
}
|
|
6034
6270
|
);
|
|
6035
6271
|
}
|
|
6036
|
-
return /* @__PURE__ */
|
|
6037
|
-
(item) => options.renderItem ? options.renderItem(item, state) : /* @__PURE__ */
|
|
6272
|
+
return /* @__PURE__ */ jsx23("ul", { "data-layout": options.layout, children: state.items.map(
|
|
6273
|
+
(item) => options.renderItem ? options.renderItem(item, state, getItemSelection(item.id, options.selection)) : /* @__PURE__ */ jsxs20("li", { "data-selectable": options.selection ? "true" : void 0, children: [
|
|
6274
|
+
options.selection ? /* @__PURE__ */ jsx23(KeepItemCheckbox, { item, ...getItemSelection(item.id, options.selection) }) : null,
|
|
6275
|
+
/* @__PURE__ */ jsx23(KeepItemCard, { item, ...options.itemCardProps })
|
|
6276
|
+
] }, item.id)
|
|
6038
6277
|
) });
|
|
6039
6278
|
}
|
|
6040
6279
|
function hasActiveQueryFilters(query) {
|
|
@@ -6043,17 +6282,30 @@ function hasActiveQueryFilters(query) {
|
|
|
6043
6282
|
query.search?.query?.trim() || query.tags?.some((tag) => tag.trim()) || query.targetType || query.savedBetween || query.archiveScope !== void 0 && query.archiveScope !== "active" || query.collectionId || query.activity || query.filter
|
|
6044
6283
|
);
|
|
6045
6284
|
}
|
|
6285
|
+
function getItemSelection(id, selection) {
|
|
6286
|
+
if (!selection) return void 0;
|
|
6287
|
+
return {
|
|
6288
|
+
checked: selection.selectedIds.includes(id),
|
|
6289
|
+
disabled: selection.disabled,
|
|
6290
|
+
onCheckedChange: (checked) => {
|
|
6291
|
+
if (selection.disabled) return;
|
|
6292
|
+
const ids = selection.selectedIds.filter((selectedId) => selectedId !== id);
|
|
6293
|
+
selection.onSelectedIdsChange(checked ? [...ids, id] : ids);
|
|
6294
|
+
}
|
|
6295
|
+
};
|
|
6296
|
+
}
|
|
6046
6297
|
|
|
6047
6298
|
// src/features/collection/KeepCollection.tsx
|
|
6048
|
-
import { Fragment as
|
|
6299
|
+
import { Fragment as Fragment13, jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6300
|
+
var EMPTY_QUERY = {};
|
|
6049
6301
|
function KeepCollection(props) {
|
|
6050
6302
|
const { fallback, onBoundaryError, boundaryResetKey, ...collectionProps } = props;
|
|
6051
|
-
const content = /* @__PURE__ */
|
|
6303
|
+
const content = /* @__PURE__ */ jsx24(KeepCollectionContent, { ...collectionProps });
|
|
6052
6304
|
if (fallback === void 0 && onBoundaryError === void 0) return content;
|
|
6053
|
-
return /* @__PURE__ */
|
|
6305
|
+
return /* @__PURE__ */ jsx24(KeepErrorBoundary2, { fallback, onError: onBoundaryError, resetKey: boundaryResetKey, children: content });
|
|
6054
6306
|
}
|
|
6055
6307
|
function KeepCollectionContent({
|
|
6056
|
-
query =
|
|
6308
|
+
query = EMPTY_QUERY,
|
|
6057
6309
|
pageSize = 20,
|
|
6058
6310
|
layout = "list",
|
|
6059
6311
|
toolbarVariant = "plain",
|
|
@@ -6065,6 +6317,7 @@ function KeepCollectionContent({
|
|
|
6065
6317
|
reorderable = false,
|
|
6066
6318
|
onReorder,
|
|
6067
6319
|
features,
|
|
6320
|
+
bulkActionsVariant = "separate",
|
|
6068
6321
|
slots,
|
|
6069
6322
|
collectionLabels,
|
|
6070
6323
|
creatable = false,
|
|
@@ -6082,14 +6335,14 @@ function KeepCollectionContent({
|
|
|
6082
6335
|
...rootProps
|
|
6083
6336
|
}) {
|
|
6084
6337
|
const view = useKeepCollection({ query, pageSize, urlSync, urlAdapter, features, archiveScope });
|
|
6085
|
-
const revealRequestId =
|
|
6086
|
-
|
|
6338
|
+
const revealRequestId = useRef11(void 0);
|
|
6339
|
+
useEffect12(() => {
|
|
6087
6340
|
if (!revealRequest || revealRequestId.current === revealRequest.requestId) return;
|
|
6088
6341
|
revealRequestId.current = revealRequest.requestId;
|
|
6089
6342
|
const status = view.reveal(revealRequest.itemId);
|
|
6090
6343
|
onRevealResult?.({ ...revealRequest, status });
|
|
6091
6344
|
}, [onRevealResult, revealRequest, view.reveal]);
|
|
6092
|
-
const [reorderUndoIds, setReorderUndoIds] =
|
|
6345
|
+
const [reorderUndoIds, setReorderUndoIds] = useState18(null);
|
|
6093
6346
|
const reorderUndoLabel = useUiLabel("undoReorder");
|
|
6094
6347
|
const handleReorder = async (orderedIds) => {
|
|
6095
6348
|
const previousIds = view.list.items.map((item) => item.id);
|
|
@@ -6102,7 +6355,7 @@ function KeepCollectionContent({
|
|
|
6102
6355
|
setReorderUndoIds(previousIds);
|
|
6103
6356
|
await onReorder?.(orderedItems);
|
|
6104
6357
|
};
|
|
6105
|
-
|
|
6358
|
+
useEffect12(() => {
|
|
6106
6359
|
if (!reorderUndoIds) return;
|
|
6107
6360
|
const timer = window.setTimeout(() => setReorderUndoIds(null), 5e3);
|
|
6108
6361
|
return () => window.clearTimeout(timer);
|
|
@@ -6115,23 +6368,24 @@ function KeepCollectionContent({
|
|
|
6115
6368
|
};
|
|
6116
6369
|
const resolvedItemCardProps = {
|
|
6117
6370
|
...itemCardProps,
|
|
6371
|
+
collectionLabels: itemCardProps?.collectionLabels ?? collectionLabels,
|
|
6118
6372
|
showTags: itemCardProps?.showTags ?? view.enabled.tags,
|
|
6119
6373
|
showPinButton: itemCardProps?.showPinButton ?? view.enabled.pin,
|
|
6120
6374
|
showArchiveButton: itemCardProps?.showArchiveButton ?? view.enabled.archive,
|
|
6121
|
-
showEditButton: itemCardProps?.showEditButton ?? view.enabled.note,
|
|
6122
|
-
showNote: itemCardProps?.showNote ?? view.enabled.note
|
|
6375
|
+
showEditButton: itemCardProps?.showEditButton ?? features?.note ?? (itemCardProps?.presentation === "reading" || view.enabled.note),
|
|
6376
|
+
showNote: itemCardProps?.showNote ?? features?.note ?? (itemCardProps?.presentation === "reading" || view.enabled.note)
|
|
6123
6377
|
};
|
|
6124
6378
|
const toolbarId = useId4();
|
|
6125
6379
|
const structuredToolbar = toolbarLayout === "grouped" || toolbarVariant === "panel" || creatable || slots?.toolbarStart !== void 0 || slots?.toolbarEnd !== void 0;
|
|
6126
6380
|
const hasQueryControls = view.enabled.search || view.enabled.sort;
|
|
6127
6381
|
const hasFilterControls = view.enabled.tagFilter || view.enabled.collectionFilter || archiveScope !== void 0;
|
|
6128
|
-
const queryControls = hasQueryControls ? /* @__PURE__ */
|
|
6129
|
-
view.enabled.search ? /* @__PURE__ */
|
|
6130
|
-
view.enabled.sort ? /* @__PURE__ */
|
|
6382
|
+
const queryControls = hasQueryControls ? /* @__PURE__ */ jsxs21(Fragment13, { children: [
|
|
6383
|
+
view.enabled.search ? /* @__PURE__ */ jsx24(KeepSearchInput, { value: view.searchValue, onValueChange: view.setSearchValue }) : null,
|
|
6384
|
+
view.enabled.sort ? /* @__PURE__ */ jsx24(KeepSortSelect, { value: view.sortValue, onValueChange: view.setSortValue }) : null
|
|
6131
6385
|
] }) : null;
|
|
6132
|
-
const filterControls = hasFilterControls ? /* @__PURE__ */
|
|
6133
|
-
view.enabled.tagFilter ? /* @__PURE__ */
|
|
6134
|
-
view.enabled.collectionFilter ? /* @__PURE__ */
|
|
6386
|
+
const filterControls = hasFilterControls ? /* @__PURE__ */ jsxs21(Fragment13, { children: [
|
|
6387
|
+
view.enabled.tagFilter ? /* @__PURE__ */ jsx24(KeepTagFilter, { query, value: view.activeTags[0], onValueChange: view.setTag }) : null,
|
|
6388
|
+
view.enabled.collectionFilter ? /* @__PURE__ */ jsx24(
|
|
6135
6389
|
KeepCollectionFilter,
|
|
6136
6390
|
{
|
|
6137
6391
|
value: view.activeCollection,
|
|
@@ -6139,7 +6393,7 @@ function KeepCollectionContent({
|
|
|
6139
6393
|
collectionLabels
|
|
6140
6394
|
}
|
|
6141
6395
|
) : null,
|
|
6142
|
-
archiveScope !== void 0 ? /* @__PURE__ */
|
|
6396
|
+
archiveScope !== void 0 ? /* @__PURE__ */ jsx24(
|
|
6143
6397
|
KeepArchiveScopeSelect,
|
|
6144
6398
|
{
|
|
6145
6399
|
value: view.archiveScope,
|
|
@@ -6157,13 +6411,13 @@ function KeepCollectionContent({
|
|
|
6157
6411
|
const uncategorizedLabel = useUiLabel("uncategorized");
|
|
6158
6412
|
const activeCollectionLabel = view.activeCollection === "__uncategorized__" ? uncategorizedLabel : view.activeCollection === void 0 ? void 0 : collectionLabels?.[view.activeCollection] ?? view.activeCollection;
|
|
6159
6413
|
const toolbarStartContent = slots?.toolbarStart === void 0 ? null : resolveContent(slots.toolbarStart, view.list);
|
|
6160
|
-
const creatableContent = creatable ? /* @__PURE__ */
|
|
6414
|
+
const creatableContent = creatable ? /* @__PURE__ */ jsx24(KeepCollectionCreate, {}) : null;
|
|
6161
6415
|
const toolbarEndContent = creatableContent ?? (slots?.toolbarEnd === void 0 ? null : resolveContent(slots.toolbarEnd, view.list));
|
|
6162
6416
|
const hasToolbarContent = hasQueryControls || hasFilterControls || hasRenderableContent(toolbarStartContent) || hasRenderableContent(toolbarEndContent);
|
|
6163
6417
|
const renderToolbarGroup = (group, content, label) => {
|
|
6164
6418
|
if (!hasRenderableContent(content)) return null;
|
|
6165
6419
|
const labelId = `${toolbarId}-${group}`;
|
|
6166
|
-
return /* @__PURE__ */
|
|
6420
|
+
return /* @__PURE__ */ jsxs21(
|
|
6167
6421
|
"fieldset",
|
|
6168
6422
|
{
|
|
6169
6423
|
"data-keepkit": "collection-toolbar-group",
|
|
@@ -6171,22 +6425,51 @@ function KeepCollectionContent({
|
|
|
6171
6425
|
role: "group",
|
|
6172
6426
|
"aria-labelledby": labelId,
|
|
6173
6427
|
children: [
|
|
6174
|
-
/* @__PURE__ */
|
|
6175
|
-
/* @__PURE__ */
|
|
6428
|
+
/* @__PURE__ */ jsx24("legend", { id: labelId, "data-keepkit": "collection-toolbar-label", children: label }),
|
|
6429
|
+
/* @__PURE__ */ jsx24("div", { "data-keepkit": "collection-toolbar-content", children: content })
|
|
6176
6430
|
]
|
|
6177
6431
|
}
|
|
6178
6432
|
);
|
|
6179
6433
|
};
|
|
6180
|
-
const toolbar = !structuredToolbar ? /* @__PURE__ */
|
|
6434
|
+
const toolbar = !structuredToolbar ? /* @__PURE__ */ jsxs21("div", { children: [
|
|
6181
6435
|
queryControls,
|
|
6182
6436
|
filterControls
|
|
6183
|
-
] }) : !hasToolbarContent ? null : /* @__PURE__ */
|
|
6437
|
+
] }) : !hasToolbarContent ? null : /* @__PURE__ */ jsxs21("div", { "data-keepkit": "collection-toolbar", "data-variant": toolbarVariant, "data-layout": toolbarLayout, children: [
|
|
6184
6438
|
renderToolbarGroup("toolbarStart", toolbarStartContent, toolbarStartLabel),
|
|
6185
6439
|
renderToolbarGroup("query", queryControls, toolbarQueryLabel),
|
|
6186
6440
|
renderToolbarGroup("filters", filterControls, toolbarFiltersLabel),
|
|
6187
6441
|
renderToolbarGroup("toolbarEnd", toolbarEndContent, toolbarEndLabel)
|
|
6188
6442
|
] });
|
|
6189
|
-
|
|
6443
|
+
const renderList = (selection) => /* @__PURE__ */ jsxs21(Fragment13, { children: [
|
|
6444
|
+
/* @__PURE__ */ jsx24(
|
|
6445
|
+
KeepList,
|
|
6446
|
+
{
|
|
6447
|
+
query: view.resolvedQuery,
|
|
6448
|
+
selection,
|
|
6449
|
+
renderItem,
|
|
6450
|
+
itemCardProps: resolvedItemCardProps,
|
|
6451
|
+
layout,
|
|
6452
|
+
loading,
|
|
6453
|
+
renderLoading,
|
|
6454
|
+
loadingCount,
|
|
6455
|
+
onClearFilters: view.clearFilters,
|
|
6456
|
+
reorderable,
|
|
6457
|
+
onReorder: reorderable ? handleReorder : void 0,
|
|
6458
|
+
empty: view.list.totalCount === 0 && view.allState.totalCount > 0 ? void 0 : empty,
|
|
6459
|
+
error
|
|
6460
|
+
}
|
|
6461
|
+
),
|
|
6462
|
+
view.enabled.pagination ? /* @__PURE__ */ jsx24(
|
|
6463
|
+
KeepPagination,
|
|
6464
|
+
{
|
|
6465
|
+
totalCount: view.list.totalCount,
|
|
6466
|
+
pageSize: view.resolvedPageSize,
|
|
6467
|
+
page: view.list.page,
|
|
6468
|
+
onPageChange: view.setPage
|
|
6469
|
+
}
|
|
6470
|
+
) : null
|
|
6471
|
+
] });
|
|
6472
|
+
return /* @__PURE__ */ jsxs21(
|
|
6190
6473
|
"section",
|
|
6191
6474
|
{
|
|
6192
6475
|
...rootProps,
|
|
@@ -6200,11 +6483,11 @@ function KeepCollectionContent({
|
|
|
6200
6483
|
"data-loading": view.list.isLoading || view.list.isMutating ? "true" : void 0,
|
|
6201
6484
|
children: [
|
|
6202
6485
|
toolbar,
|
|
6203
|
-
view.enabled.savedViews ? /* @__PURE__ */
|
|
6204
|
-
/* @__PURE__ */
|
|
6205
|
-
/* @__PURE__ */
|
|
6486
|
+
view.enabled.savedViews ? /* @__PURE__ */ jsxs21("div", { "data-keepkit": "saved-view-controls", children: [
|
|
6487
|
+
/* @__PURE__ */ jsx24(KeepSavedViews, { onApply: view.applyQuery }),
|
|
6488
|
+
/* @__PURE__ */ jsx24(KeepSaveViewButton, { query: view.resolvedQuery })
|
|
6206
6489
|
] }) : null,
|
|
6207
|
-
activeFilters === void 0 ? /* @__PURE__ */
|
|
6490
|
+
activeFilters === void 0 ? /* @__PURE__ */ jsx24(
|
|
6208
6491
|
KeepActiveFiltersSummary,
|
|
6209
6492
|
{
|
|
6210
6493
|
search: view.searchValue,
|
|
@@ -6231,34 +6514,11 @@ function KeepCollectionContent({
|
|
|
6231
6514
|
canReset: view.canReset
|
|
6232
6515
|
}
|
|
6233
6516
|
) : resolveContent(activeFilters, view.list),
|
|
6234
|
-
/* @__PURE__ */
|
|
6235
|
-
|
|
6236
|
-
{
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
itemCardProps: resolvedItemCardProps,
|
|
6240
|
-
layout,
|
|
6241
|
-
loading,
|
|
6242
|
-
renderLoading,
|
|
6243
|
-
loadingCount,
|
|
6244
|
-
onClearFilters: view.clearFilters,
|
|
6245
|
-
reorderable,
|
|
6246
|
-
onReorder: reorderable ? handleReorder : void 0,
|
|
6247
|
-
empty: view.list.totalCount === 0 && view.allState.totalCount > 0 ? void 0 : empty,
|
|
6248
|
-
error
|
|
6249
|
-
}
|
|
6250
|
-
),
|
|
6251
|
-
view.enabled.pagination ? /* @__PURE__ */ jsx23(
|
|
6252
|
-
KeepPagination,
|
|
6253
|
-
{
|
|
6254
|
-
totalCount: view.list.totalCount,
|
|
6255
|
-
pageSize: view.resolvedPageSize,
|
|
6256
|
-
page: view.list.page,
|
|
6257
|
-
onPageChange: view.setPage
|
|
6258
|
-
}
|
|
6259
|
-
) : null,
|
|
6260
|
-
view.enabled.bulkActions ? /* @__PURE__ */ jsx23(KeepBulkActions, { query: view.resolvedQuery }) : null,
|
|
6261
|
-
reorderable && reorderUndoIds ? /* @__PURE__ */ jsx23("div", { "data-keepkit": "reorder-feedback", role: "status", "aria-live": "polite", children: /* @__PURE__ */ jsx23("button", { type: "button", "data-keep-action": "undo-reorder", onClick: () => void undoReorder(), children: reorderUndoLabel }) }) : null
|
|
6517
|
+
view.enabled.bulkActions && bulkActionsVariant === "inline" ? /* @__PURE__ */ jsx24(KeepInlineSelection, { query: view.resolvedQuery, children: renderList }) : /* @__PURE__ */ jsxs21(Fragment13, { children: [
|
|
6518
|
+
renderList(),
|
|
6519
|
+
view.enabled.bulkActions ? /* @__PURE__ */ jsx24(KeepBulkActions, { query: view.resolvedQuery }) : null
|
|
6520
|
+
] }),
|
|
6521
|
+
reorderable && reorderUndoIds ? /* @__PURE__ */ jsx24("div", { "data-keepkit": "reorder-feedback", role: "status", "aria-live": "polite", children: /* @__PURE__ */ jsx24("button", { type: "button", "data-keep-action": "undo-reorder", onClick: () => void undoReorder(), children: reorderUndoLabel }) }) : null
|
|
6262
6522
|
]
|
|
6263
6523
|
}
|
|
6264
6524
|
);
|
|
@@ -6274,8 +6534,8 @@ function getCollectionState(list) {
|
|
|
6274
6534
|
import { useId as useId5 } from "react";
|
|
6275
6535
|
|
|
6276
6536
|
// src/features/collection/hooks/useKeepCollectionManager.ts
|
|
6277
|
-
import { useKeepCollections as
|
|
6278
|
-
import { useCallback as useCallback8, useState as
|
|
6537
|
+
import { useKeepCollections as useKeepCollections6, useKeepContext as useKeepContext6 } from "@keepkit/core/react";
|
|
6538
|
+
import { useCallback as useCallback8, useState as useState19 } from "react";
|
|
6279
6539
|
function useKeepCollectionManager({
|
|
6280
6540
|
onError,
|
|
6281
6541
|
onRenamed,
|
|
@@ -6289,12 +6549,12 @@ function useKeepCollectionManager({
|
|
|
6289
6549
|
removeCollection,
|
|
6290
6550
|
moveToCollection
|
|
6291
6551
|
} = useKeepContext6();
|
|
6292
|
-
const collections =
|
|
6293
|
-
const [editingId, setEditingId] =
|
|
6294
|
-
const [editingName, setEditingName] =
|
|
6295
|
-
const [pendingDeleteId, setPendingDeleteId] =
|
|
6296
|
-
const [error, setError] =
|
|
6297
|
-
const [isMutating, setIsMutating] =
|
|
6552
|
+
const collections = useKeepCollections6({ orderBy: "name" });
|
|
6553
|
+
const [editingId, setEditingId] = useState19(null);
|
|
6554
|
+
const [editingName, setEditingName] = useState19("");
|
|
6555
|
+
const [pendingDeleteId, setPendingDeleteId] = useState19(null);
|
|
6556
|
+
const [error, setError] = useState19(null);
|
|
6557
|
+
const [isMutating, setIsMutating] = useState19(false);
|
|
6298
6558
|
const reportError = useCallback8(
|
|
6299
6559
|
(cause, fallback) => {
|
|
6300
6560
|
const message = cause instanceof Error ? cause.message : fallback;
|
|
@@ -6403,7 +6663,7 @@ function useKeepCollectionManager({
|
|
|
6403
6663
|
}
|
|
6404
6664
|
|
|
6405
6665
|
// src/features/collection/KeepCollectionManager.tsx
|
|
6406
|
-
import { Fragment as
|
|
6666
|
+
import { Fragment as Fragment14, jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6407
6667
|
function KeepCollectionManager({
|
|
6408
6668
|
allowCreate = true,
|
|
6409
6669
|
allowRename = true,
|
|
@@ -6431,7 +6691,7 @@ function KeepCollectionManager({
|
|
|
6431
6691
|
const itemLabel = useUiLabel("collectionItem");
|
|
6432
6692
|
const itemsLabel = useUiLabel("collectionItems");
|
|
6433
6693
|
const defaultTitle = useUiLabel("manageCollections");
|
|
6434
|
-
return /* @__PURE__ */
|
|
6694
|
+
return /* @__PURE__ */ jsxs22(
|
|
6435
6695
|
"section",
|
|
6436
6696
|
{
|
|
6437
6697
|
...rootProps,
|
|
@@ -6441,17 +6701,17 @@ function KeepCollectionManager({
|
|
|
6441
6701
|
"data-loading": manager.isMutating ? "true" : void 0,
|
|
6442
6702
|
"aria-labelledby": rootProps["aria-labelledby"] ?? headingId,
|
|
6443
6703
|
children: [
|
|
6444
|
-
/* @__PURE__ */
|
|
6445
|
-
/* @__PURE__ */
|
|
6446
|
-
hasRenderableContent(description) ? /* @__PURE__ */
|
|
6704
|
+
/* @__PURE__ */ jsxs22("header", { "data-keepkit": "collection-manager-heading", children: [
|
|
6705
|
+
/* @__PURE__ */ jsx25("h2", { id: headingId, children: title ?? defaultTitle }),
|
|
6706
|
+
hasRenderableContent(description) ? /* @__PURE__ */ jsx25("p", { children: description }) : null
|
|
6447
6707
|
] }),
|
|
6448
|
-
allowCreate ? /* @__PURE__ */
|
|
6449
|
-
manager.error ? /* @__PURE__ */
|
|
6450
|
-
manager.collections.length > 0 ? /* @__PURE__ */
|
|
6708
|
+
allowCreate ? /* @__PURE__ */ jsx25(KeepCollectionCreate, { onCreated, onError }) : null,
|
|
6709
|
+
manager.error ? /* @__PURE__ */ jsx25("p", { "data-keepkit": "collection-manager-error", role: "alert", children: manager.error }) : null,
|
|
6710
|
+
manager.collections.length > 0 ? /* @__PURE__ */ jsx25("ul", { "data-keepkit": "collection-manager-list", children: manager.collections.map((collection) => {
|
|
6451
6711
|
const name = collectionLabels?.[collection.id] ?? collection.name;
|
|
6452
6712
|
const isEditing = manager.editingId === collection.id;
|
|
6453
6713
|
const isPendingDelete = manager.pendingDeleteId === collection.id;
|
|
6454
|
-
return /* @__PURE__ */
|
|
6714
|
+
return /* @__PURE__ */ jsx25("li", { "data-keepkit": "collection-manager-item", children: isEditing && allowRename ? /* @__PURE__ */ jsxs22(
|
|
6455
6715
|
"form",
|
|
6456
6716
|
{
|
|
6457
6717
|
"data-keepkit": "collection-manager-rename",
|
|
@@ -6460,12 +6720,12 @@ function KeepCollectionManager({
|
|
|
6460
6720
|
void manager.rename(collection.id);
|
|
6461
6721
|
},
|
|
6462
6722
|
children: [
|
|
6463
|
-
/* @__PURE__ */
|
|
6723
|
+
/* @__PURE__ */ jsxs22("label", { htmlFor: `${headingId}-rename-${collection.id}`, children: [
|
|
6464
6724
|
renameLabel,
|
|
6465
6725
|
": ",
|
|
6466
6726
|
name
|
|
6467
6727
|
] }),
|
|
6468
|
-
/* @__PURE__ */
|
|
6728
|
+
/* @__PURE__ */ jsx25(
|
|
6469
6729
|
"input",
|
|
6470
6730
|
{
|
|
6471
6731
|
id: `${headingId}-rename-${collection.id}`,
|
|
@@ -6475,7 +6735,7 @@ function KeepCollectionManager({
|
|
|
6475
6735
|
"data-keep-action": "rename-collection-input"
|
|
6476
6736
|
}
|
|
6477
6737
|
),
|
|
6478
|
-
/* @__PURE__ */
|
|
6738
|
+
/* @__PURE__ */ jsx25(
|
|
6479
6739
|
"button",
|
|
6480
6740
|
{
|
|
6481
6741
|
type: "submit",
|
|
@@ -6484,7 +6744,7 @@ function KeepCollectionManager({
|
|
|
6484
6744
|
children: renameSubmitLabel
|
|
6485
6745
|
}
|
|
6486
6746
|
),
|
|
6487
|
-
/* @__PURE__ */
|
|
6747
|
+
/* @__PURE__ */ jsx25(
|
|
6488
6748
|
"button",
|
|
6489
6749
|
{
|
|
6490
6750
|
type: "button",
|
|
@@ -6496,18 +6756,18 @@ function KeepCollectionManager({
|
|
|
6496
6756
|
)
|
|
6497
6757
|
]
|
|
6498
6758
|
}
|
|
6499
|
-
) : /* @__PURE__ */
|
|
6500
|
-
/* @__PURE__ */
|
|
6501
|
-
/* @__PURE__ */
|
|
6502
|
-
showCounts ? /* @__PURE__ */
|
|
6759
|
+
) : /* @__PURE__ */ jsxs22(Fragment14, { children: [
|
|
6760
|
+
/* @__PURE__ */ jsxs22("div", { "data-keepkit": "collection-manager-summary", children: [
|
|
6761
|
+
/* @__PURE__ */ jsx25("span", { "data-keepkit": "collection-manager-name", children: name }),
|
|
6762
|
+
showCounts ? /* @__PURE__ */ jsxs22("span", { "data-keepkit": "collection-manager-count", children: [
|
|
6503
6763
|
collection.count,
|
|
6504
6764
|
" ",
|
|
6505
6765
|
collection.count === 1 ? itemLabel : itemsLabel
|
|
6506
6766
|
] }) : null
|
|
6507
6767
|
] }),
|
|
6508
|
-
isPendingDelete && allowDelete ? /* @__PURE__ */
|
|
6509
|
-
/* @__PURE__ */
|
|
6510
|
-
/* @__PURE__ */
|
|
6768
|
+
isPendingDelete && allowDelete ? /* @__PURE__ */ jsxs22("fieldset", { "data-keepkit": "collection-manager-delete-confirmation", children: [
|
|
6769
|
+
/* @__PURE__ */ jsx25("legend", { children: deleteConfirmLabel }),
|
|
6770
|
+
/* @__PURE__ */ jsx25(
|
|
6511
6771
|
"button",
|
|
6512
6772
|
{
|
|
6513
6773
|
type: "button",
|
|
@@ -6517,7 +6777,7 @@ function KeepCollectionManager({
|
|
|
6517
6777
|
children: deleteSubmitLabel
|
|
6518
6778
|
}
|
|
6519
6779
|
),
|
|
6520
|
-
/* @__PURE__ */
|
|
6780
|
+
/* @__PURE__ */ jsx25(
|
|
6521
6781
|
"button",
|
|
6522
6782
|
{
|
|
6523
6783
|
type: "button",
|
|
@@ -6527,8 +6787,8 @@ function KeepCollectionManager({
|
|
|
6527
6787
|
children: cancelLabel
|
|
6528
6788
|
}
|
|
6529
6789
|
)
|
|
6530
|
-
] }) : /* @__PURE__ */
|
|
6531
|
-
allowRename ? /* @__PURE__ */
|
|
6790
|
+
] }) : /* @__PURE__ */ jsxs22("div", { "data-keepkit": "collection-manager-actions", children: [
|
|
6791
|
+
allowRename ? /* @__PURE__ */ jsx25(
|
|
6532
6792
|
"button",
|
|
6533
6793
|
{
|
|
6534
6794
|
type: "button",
|
|
@@ -6539,7 +6799,7 @@ function KeepCollectionManager({
|
|
|
6539
6799
|
children: renameLabel
|
|
6540
6800
|
}
|
|
6541
6801
|
) : null,
|
|
6542
|
-
allowDelete ? /* @__PURE__ */
|
|
6802
|
+
allowDelete ? /* @__PURE__ */ jsx25(
|
|
6543
6803
|
"button",
|
|
6544
6804
|
{
|
|
6545
6805
|
type: "button",
|
|
@@ -6552,7 +6812,7 @@ function KeepCollectionManager({
|
|
|
6552
6812
|
) : null
|
|
6553
6813
|
] })
|
|
6554
6814
|
] }) }, collection.id);
|
|
6555
|
-
}) }) : hasRenderableContent(empty) ? /* @__PURE__ */
|
|
6815
|
+
}) }) : hasRenderableContent(empty) ? /* @__PURE__ */ jsx25("div", { "data-keepkit": "collection-manager-empty", children: empty }) : null
|
|
6556
6816
|
]
|
|
6557
6817
|
}
|
|
6558
6818
|
);
|
|
@@ -6560,10 +6820,10 @@ function KeepCollectionManager({
|
|
|
6560
6820
|
|
|
6561
6821
|
// src/features/collection/KeepInbox.tsx
|
|
6562
6822
|
import { createInboxQuery } from "@keepkit/core/core";
|
|
6563
|
-
import { jsx as
|
|
6823
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
6564
6824
|
function KeepInbox({ query, ...props }) {
|
|
6565
6825
|
const inboxQuery = createInboxQuery({ organization: query?.organization });
|
|
6566
|
-
return /* @__PURE__ */
|
|
6826
|
+
return /* @__PURE__ */ jsx26(
|
|
6567
6827
|
KeepCollection,
|
|
6568
6828
|
{
|
|
6569
6829
|
...props,
|
|
@@ -6574,12 +6834,12 @@ function KeepInbox({ query, ...props }) {
|
|
|
6574
6834
|
}
|
|
6575
6835
|
|
|
6576
6836
|
// src/features/collection/KeepLayout.tsx
|
|
6577
|
-
import { jsx as
|
|
6837
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
6578
6838
|
function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...props }) {
|
|
6579
6839
|
const roving = useRovingTabIndex();
|
|
6580
6840
|
return (
|
|
6581
6841
|
// biome-ignore lint/a11y/noStaticElementInteractions: The group manages keyboard focus for descendant cards.
|
|
6582
|
-
/* @__PURE__ */
|
|
6842
|
+
/* @__PURE__ */ jsx27(
|
|
6583
6843
|
"div",
|
|
6584
6844
|
{
|
|
6585
6845
|
...props,
|
|
@@ -6606,7 +6866,7 @@ function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...p
|
|
|
6606
6866
|
import { isValidElement as isValidElement7 } from "react";
|
|
6607
6867
|
|
|
6608
6868
|
// src/features/navigation/KeepShortcutHint.tsx
|
|
6609
|
-
import { jsx as
|
|
6869
|
+
import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6610
6870
|
function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
6611
6871
|
const keys = typeof shortcut === "string" ? shortcut.split("+") : [...shortcut];
|
|
6612
6872
|
const occurrences = /* @__PURE__ */ new Map();
|
|
@@ -6615,23 +6875,23 @@ function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
|
6615
6875
|
occurrences.set(key, occurrence + 1);
|
|
6616
6876
|
return { id: `${key}-${occurrence}`, value: key };
|
|
6617
6877
|
});
|
|
6618
|
-
return /* @__PURE__ */
|
|
6619
|
-
index > 0 ? /* @__PURE__ */
|
|
6620
|
-
/* @__PURE__ */
|
|
6878
|
+
return /* @__PURE__ */ jsx28("span", { ...props, "data-keepkit": "shortcut-hint", "aria-hidden": props["aria-hidden"] ?? true, children: keyedKeys.map((key, index) => /* @__PURE__ */ jsxs23("span", { children: [
|
|
6879
|
+
index > 0 ? /* @__PURE__ */ jsx28("span", { "data-shortcut-separator": "true", children: separator }) : null,
|
|
6880
|
+
/* @__PURE__ */ jsx28("kbd", { children: key.value.trim() })
|
|
6621
6881
|
] }, key.id)) });
|
|
6622
6882
|
}
|
|
6623
6883
|
|
|
6624
6884
|
// src/features/editor/hooks/useKeepNoteEditor.ts
|
|
6625
6885
|
import { useKeepItem as useKeepItem6 } from "@keepkit/core/react";
|
|
6626
|
-
import { useCallback as useCallback9, useEffect as
|
|
6886
|
+
import { useCallback as useCallback9, useEffect as useEffect13, useRef as useRef12, useState as useState20 } from "react";
|
|
6627
6887
|
function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
6628
6888
|
const itemState = useKeepItem6(item);
|
|
6629
6889
|
const { error, isMutating, item: savedItem, updateNote } = itemState;
|
|
6630
|
-
const [note, setNote] =
|
|
6890
|
+
const [note, setNote] = useState20(item.note ?? "");
|
|
6631
6891
|
const baselineNote = savedItem?.note ?? item.note ?? "";
|
|
6632
6892
|
const isDirty = note !== baselineNote;
|
|
6633
|
-
const lastSavedNoteRef =
|
|
6634
|
-
|
|
6893
|
+
const lastSavedNoteRef = useRef12(void 0);
|
|
6894
|
+
useEffect13(() => setNote(baselineNote), [baselineNote]);
|
|
6635
6895
|
const save = useCallback9(async () => {
|
|
6636
6896
|
const nextNote = note.trim() || void 0;
|
|
6637
6897
|
try {
|
|
@@ -6643,7 +6903,7 @@ function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
|
6643
6903
|
throw cause;
|
|
6644
6904
|
}
|
|
6645
6905
|
}, [note, onSaveError, onSaved, updateNote]);
|
|
6646
|
-
|
|
6906
|
+
useEffect13(() => {
|
|
6647
6907
|
if (!isDirty || debounceMs <= 0 || lastSavedNoteRef.current === note) return;
|
|
6648
6908
|
const timer = window.setTimeout(() => void save().catch(() => void 0), debounceMs);
|
|
6649
6909
|
return () => window.clearTimeout(timer);
|
|
@@ -6678,7 +6938,7 @@ function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
|
6678
6938
|
}
|
|
6679
6939
|
|
|
6680
6940
|
// src/features/editor/KeepNoteEditor.tsx
|
|
6681
|
-
import { Fragment as
|
|
6941
|
+
import { Fragment as Fragment15, jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6682
6942
|
function KeepNoteEditor({
|
|
6683
6943
|
item,
|
|
6684
6944
|
label,
|
|
@@ -6701,10 +6961,10 @@ function KeepNoteEditor({
|
|
|
6701
6961
|
const saveAccessibleLabel = useUiLabel("saveNote");
|
|
6702
6962
|
const { error, isDirty, isSaving, note, setNote } = view.state;
|
|
6703
6963
|
const contentChildren = asChild && isValidElement7(children) ? void 0 : children;
|
|
6704
|
-
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */
|
|
6705
|
-
/* @__PURE__ */
|
|
6964
|
+
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */ jsxs24(Fragment15, { children: [
|
|
6965
|
+
/* @__PURE__ */ jsxs24("label", { children: [
|
|
6706
6966
|
showNoteLabel ? label ?? view.labels.note : null,
|
|
6707
|
-
/* @__PURE__ */
|
|
6967
|
+
/* @__PURE__ */ jsx29(
|
|
6708
6968
|
"textarea",
|
|
6709
6969
|
{
|
|
6710
6970
|
"data-keep-action": "edit-note",
|
|
@@ -6717,7 +6977,7 @@ function KeepNoteEditor({
|
|
|
6717
6977
|
}
|
|
6718
6978
|
)
|
|
6719
6979
|
] }),
|
|
6720
|
-
/* @__PURE__ */
|
|
6980
|
+
/* @__PURE__ */ jsxs24(
|
|
6721
6981
|
"button",
|
|
6722
6982
|
{
|
|
6723
6983
|
type: "submit",
|
|
@@ -6727,13 +6987,13 @@ function KeepNoteEditor({
|
|
|
6727
6987
|
"aria-label": showSaveLabel ? void 0 : saveAccessibleLabel,
|
|
6728
6988
|
children: [
|
|
6729
6989
|
showSaveLabel ? saveLabel ?? view.labels.save : null,
|
|
6730
|
-
showShortcutHint ? /* @__PURE__ */
|
|
6990
|
+
showShortcutHint ? /* @__PURE__ */ jsx29(KeepShortcutHint, { shortcut: "Ctrl+Enter" }) : null
|
|
6731
6991
|
]
|
|
6732
6992
|
}
|
|
6733
6993
|
)
|
|
6734
6994
|
] });
|
|
6735
6995
|
if (!asChild) {
|
|
6736
|
-
return /* @__PURE__ */
|
|
6996
|
+
return /* @__PURE__ */ jsxs24(
|
|
6737
6997
|
"form",
|
|
6738
6998
|
{
|
|
6739
6999
|
...formProps,
|
|
@@ -6746,7 +7006,7 @@ function KeepNoteEditor({
|
|
|
6746
7006
|
"data-disabled": isSaving ? "true" : void 0,
|
|
6747
7007
|
children: [
|
|
6748
7008
|
body,
|
|
6749
|
-
error ? /* @__PURE__ */
|
|
7009
|
+
error ? /* @__PURE__ */ jsx29("p", { role: "alert", children: getErrorMessage(error, view.labels.error) }) : null
|
|
6750
7010
|
]
|
|
6751
7011
|
}
|
|
6752
7012
|
);
|
|
@@ -6771,12 +7031,12 @@ function KeepNoteEditor({
|
|
|
6771
7031
|
|
|
6772
7032
|
// src/features/editor/hooks/useKeepTagEditor.ts
|
|
6773
7033
|
import { useKeepItem as useKeepItem7 } from "@keepkit/core/react";
|
|
6774
|
-
import { useCallback as useCallback10, useEffect as
|
|
7034
|
+
import { useCallback as useCallback10, useEffect as useEffect14, useState as useState21 } from "react";
|
|
6775
7035
|
function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
6776
7036
|
const itemState = useKeepItem7(item);
|
|
6777
|
-
const [tags, setTags] =
|
|
6778
|
-
const [input, setInput] =
|
|
6779
|
-
|
|
7037
|
+
const [tags, setTags] = useState21(item.tags ?? []);
|
|
7038
|
+
const [input, setInput] = useState21("");
|
|
7039
|
+
useEffect14(() => setTags(itemState.item?.tags ?? item.tags ?? []), [item.tags, itemState.item?.tags]);
|
|
6780
7040
|
const save = useCallback10(async () => {
|
|
6781
7041
|
const nextTags = normalizeUiTags(tags);
|
|
6782
7042
|
try {
|
|
@@ -6823,7 +7083,7 @@ function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
|
6823
7083
|
}
|
|
6824
7084
|
|
|
6825
7085
|
// src/features/editor/KeepTagEditor.tsx
|
|
6826
|
-
import { Fragment as
|
|
7086
|
+
import { Fragment as Fragment16, jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6827
7087
|
function KeepTagEditor({
|
|
6828
7088
|
item,
|
|
6829
7089
|
availableTags = [],
|
|
@@ -6838,10 +7098,10 @@ function KeepTagEditor({
|
|
|
6838
7098
|
const showRemoveLabel = useUiLabelVisibility("remove");
|
|
6839
7099
|
const showApplyLabel = useUiLabelVisibility("applyTags");
|
|
6840
7100
|
const { isSaving, tags } = view.state;
|
|
6841
|
-
const body = render ? render(view.state) : /* @__PURE__ */
|
|
6842
|
-
/* @__PURE__ */
|
|
7101
|
+
const body = render ? render(view.state) : /* @__PURE__ */ jsxs25(Fragment16, { children: [
|
|
7102
|
+
/* @__PURE__ */ jsxs25("label", { children: [
|
|
6843
7103
|
showTagsLabel ? view.labels.tags : null,
|
|
6844
|
-
/* @__PURE__ */
|
|
7104
|
+
/* @__PURE__ */ jsx30(
|
|
6845
7105
|
"input",
|
|
6846
7106
|
{
|
|
6847
7107
|
"data-keep-action": "edit-tags",
|
|
@@ -6853,10 +7113,10 @@ function KeepTagEditor({
|
|
|
6853
7113
|
}
|
|
6854
7114
|
)
|
|
6855
7115
|
] }),
|
|
6856
|
-
availableTags.length > 0 ? /* @__PURE__ */
|
|
6857
|
-
/* @__PURE__ */
|
|
7116
|
+
availableTags.length > 0 ? /* @__PURE__ */ jsx30("datalist", { id: `keep-tags-${item.id}`, children: availableTags.map((tag) => /* @__PURE__ */ jsx30("option", { value: tag }, tag)) }) : null,
|
|
7117
|
+
/* @__PURE__ */ jsx30("ul", { "aria-label": view.labels.tags, children: tags.map((tag) => /* @__PURE__ */ jsxs25("li", { children: [
|
|
6858
7118
|
tag,
|
|
6859
|
-
/* @__PURE__ */
|
|
7119
|
+
/* @__PURE__ */ jsx30(
|
|
6860
7120
|
"button",
|
|
6861
7121
|
{
|
|
6862
7122
|
type: "button",
|
|
@@ -6867,7 +7127,7 @@ function KeepTagEditor({
|
|
|
6867
7127
|
}
|
|
6868
7128
|
)
|
|
6869
7129
|
] }, tag)) }),
|
|
6870
|
-
/* @__PURE__ */
|
|
7130
|
+
/* @__PURE__ */ jsx30(
|
|
6871
7131
|
"button",
|
|
6872
7132
|
{
|
|
6873
7133
|
type: "submit",
|
|
@@ -6879,7 +7139,7 @@ function KeepTagEditor({
|
|
|
6879
7139
|
}
|
|
6880
7140
|
)
|
|
6881
7141
|
] });
|
|
6882
|
-
return /* @__PURE__ */
|
|
7142
|
+
return /* @__PURE__ */ jsxs25(
|
|
6883
7143
|
"form",
|
|
6884
7144
|
{
|
|
6885
7145
|
...props,
|
|
@@ -6891,7 +7151,7 @@ function KeepTagEditor({
|
|
|
6891
7151
|
"data-disabled": isSaving ? "true" : void 0,
|
|
6892
7152
|
children: [
|
|
6893
7153
|
body,
|
|
6894
|
-
view.error ? /* @__PURE__ */
|
|
7154
|
+
view.error ? /* @__PURE__ */ jsx30("p", { role: "alert", children: getErrorMessage(view.error, view.labels.error) }) : null
|
|
6895
7155
|
]
|
|
6896
7156
|
}
|
|
6897
7157
|
);
|
|
@@ -6919,7 +7179,7 @@ function useKeepToastFeedback(showToast) {
|
|
|
6919
7179
|
|
|
6920
7180
|
// src/features/navigation/KeepFloatingTour.tsx
|
|
6921
7181
|
import { useKeepList as useKeepList6 } from "@keepkit/core/react";
|
|
6922
|
-
import { useEffect as
|
|
7182
|
+
import { useEffect as useEffect17, useMemo as useMemo7, useRef as useRef13, useState as useState23 } from "react";
|
|
6923
7183
|
import { createPortal } from "react-dom";
|
|
6924
7184
|
|
|
6925
7185
|
// src/foundation/theme.tsx
|
|
@@ -6928,7 +7188,7 @@ import {
|
|
|
6928
7188
|
isValidElement as isValidElement8,
|
|
6929
7189
|
useContext as useContext4
|
|
6930
7190
|
} from "react";
|
|
6931
|
-
import { jsx as
|
|
7191
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
6932
7192
|
var keepThemeNames = [
|
|
6933
7193
|
"default",
|
|
6934
7194
|
"ocean",
|
|
@@ -6990,8 +7250,8 @@ function KeepThemeProvider({
|
|
|
6990
7250
|
if (!isValidElement8(children))
|
|
6991
7251
|
throw new Error("KeepThemeProvider with asChild requires a single React element child.");
|
|
6992
7252
|
return createSlot(children, rootProps);
|
|
6993
|
-
})() : /* @__PURE__ */
|
|
6994
|
-
return /* @__PURE__ */
|
|
7253
|
+
})() : /* @__PURE__ */ jsx31("div", { ...rootProps, children });
|
|
7254
|
+
return /* @__PURE__ */ jsx31(
|
|
6995
7255
|
KeepThemeContext.Provider,
|
|
6996
7256
|
{
|
|
6997
7257
|
value: { theme, mode, density, radius, accentColor, highContrast, reducedMotion, variables, style },
|
|
@@ -7005,7 +7265,7 @@ import { useKeepNavigator } from "@keepkit/core/react";
|
|
|
7005
7265
|
import { useId as useId6 } from "react";
|
|
7006
7266
|
|
|
7007
7267
|
// src/features/navigation/hooks/useKeepTourShortcuts.ts
|
|
7008
|
-
import { useEffect as
|
|
7268
|
+
import { useEffect as useEffect15 } from "react";
|
|
7009
7269
|
function useKeepTourShortcuts({
|
|
7010
7270
|
onNext,
|
|
7011
7271
|
onPrev,
|
|
@@ -7016,7 +7276,7 @@ function useKeepTourShortcuts({
|
|
|
7016
7276
|
prevKeys = ["k", "["],
|
|
7017
7277
|
onError
|
|
7018
7278
|
}) {
|
|
7019
|
-
|
|
7279
|
+
useEffect15(() => {
|
|
7020
7280
|
if (!enabled) return;
|
|
7021
7281
|
const handleKeyDown = (event) => {
|
|
7022
7282
|
if (!allowInEditable && isEditableTarget(event.target)) return;
|
|
@@ -7037,7 +7297,7 @@ function isEditableTarget(target) {
|
|
|
7037
7297
|
}
|
|
7038
7298
|
|
|
7039
7299
|
// src/features/navigation/KeepTourBar.tsx
|
|
7040
|
-
import { Fragment as
|
|
7300
|
+
import { Fragment as Fragment17, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
7041
7301
|
function KeepTourBar({
|
|
7042
7302
|
navigation: providedNavigation,
|
|
7043
7303
|
currentId,
|
|
@@ -7107,9 +7367,9 @@ function KeepTourBar({
|
|
|
7107
7367
|
return resolvedPrev();
|
|
7108
7368
|
}
|
|
7109
7369
|
});
|
|
7110
|
-
const body = /* @__PURE__ */
|
|
7111
|
-
showProgress ? /* @__PURE__ */
|
|
7112
|
-
/* @__PURE__ */
|
|
7370
|
+
const body = /* @__PURE__ */ jsxs26(Fragment17, { children: [
|
|
7371
|
+
showProgress ? /* @__PURE__ */ jsx32("span", { "data-keepkit": "tour-progress", "aria-live": "polite", children: progress ?? `${navigation.currentPosition ?? 0} / ${navigation.items.length}` }) : null,
|
|
7372
|
+
/* @__PURE__ */ jsx32(
|
|
7113
7373
|
TourAction,
|
|
7114
7374
|
{
|
|
7115
7375
|
href: resolvedPrevHref,
|
|
@@ -7117,7 +7377,7 @@ function KeepTourBar({
|
|
|
7117
7377
|
onClick: resolvedPrevHref ? notifyPrevNavigation : resolvedPrev,
|
|
7118
7378
|
"data-keep-action": "tour-prev",
|
|
7119
7379
|
shortcut: showShortcutHint ? shortcutOptions?.prevKeys?.[0] ?? "K" : void 0,
|
|
7120
|
-
preview: navigation.prevItem ? /* @__PURE__ */
|
|
7380
|
+
preview: navigation.prevItem ? /* @__PURE__ */ jsxs26(Fragment17, { children: [
|
|
7121
7381
|
previousLabel,
|
|
7122
7382
|
": ",
|
|
7123
7383
|
getItemTitle(navigation.prevItem)
|
|
@@ -7125,7 +7385,7 @@ function KeepTourBar({
|
|
|
7125
7385
|
children: previousLabel
|
|
7126
7386
|
}
|
|
7127
7387
|
),
|
|
7128
|
-
/* @__PURE__ */
|
|
7388
|
+
/* @__PURE__ */ jsx32(
|
|
7129
7389
|
TourAction,
|
|
7130
7390
|
{
|
|
7131
7391
|
href: resolvedNextHref,
|
|
@@ -7133,7 +7393,7 @@ function KeepTourBar({
|
|
|
7133
7393
|
onClick: resolvedNextHref ? notifyNextNavigation : resolvedNext,
|
|
7134
7394
|
"data-keep-action": "tour-next",
|
|
7135
7395
|
shortcut: showShortcutHint ? shortcutOptions?.nextKeys?.[0] ?? "J" : void 0,
|
|
7136
|
-
preview: navigation.nextItem ? /* @__PURE__ */
|
|
7396
|
+
preview: navigation.nextItem ? /* @__PURE__ */ jsxs26(Fragment17, { children: [
|
|
7137
7397
|
nextItemLabel,
|
|
7138
7398
|
": ",
|
|
7139
7399
|
getItemTitle(navigation.nextItem)
|
|
@@ -7141,7 +7401,7 @@ function KeepTourBar({
|
|
|
7141
7401
|
children: nextItemLabel
|
|
7142
7402
|
}
|
|
7143
7403
|
),
|
|
7144
|
-
resolvedBackHref || onBack ? /* @__PURE__ */
|
|
7404
|
+
resolvedBackHref || onBack ? /* @__PURE__ */ jsx32(TourAction, { href: resolvedBackHref, onClick: onBack, "data-keep-action": "tour-back", children: listLabel }) : null
|
|
7145
7405
|
] });
|
|
7146
7406
|
return renderRoot(
|
|
7147
7407
|
asChild,
|
|
@@ -7153,13 +7413,13 @@ function KeepTourBar({
|
|
|
7153
7413
|
}
|
|
7154
7414
|
function TourAction({ href, disabled = false, onClick, children, preview, shortcut, ...props }) {
|
|
7155
7415
|
const previewId = useId6();
|
|
7156
|
-
const content = /* @__PURE__ */
|
|
7157
|
-
/* @__PURE__ */
|
|
7158
|
-
shortcut ? /* @__PURE__ */
|
|
7159
|
-
preview ? /* @__PURE__ */
|
|
7416
|
+
const content = /* @__PURE__ */ jsxs26(Fragment17, { children: [
|
|
7417
|
+
/* @__PURE__ */ jsx32("span", { "data-tour-label": "true", children }),
|
|
7418
|
+
shortcut ? /* @__PURE__ */ jsx32(KeepShortcutHint, { shortcut }) : null,
|
|
7419
|
+
preview ? /* @__PURE__ */ jsx32("small", { id: previewId, "data-tour-preview": "true", children: preview }) : null
|
|
7160
7420
|
] });
|
|
7161
7421
|
if (href && !disabled) {
|
|
7162
|
-
return /* @__PURE__ */
|
|
7422
|
+
return /* @__PURE__ */ jsx32(
|
|
7163
7423
|
"a",
|
|
7164
7424
|
{
|
|
7165
7425
|
...props,
|
|
@@ -7171,7 +7431,7 @@ function TourAction({ href, disabled = false, onClick, children, preview, shortc
|
|
|
7171
7431
|
}
|
|
7172
7432
|
);
|
|
7173
7433
|
}
|
|
7174
|
-
return /* @__PURE__ */
|
|
7434
|
+
return /* @__PURE__ */ jsx32(
|
|
7175
7435
|
"button",
|
|
7176
7436
|
{
|
|
7177
7437
|
...props,
|
|
@@ -7192,8 +7452,8 @@ function navigateTo(item, href) {
|
|
|
7192
7452
|
|
|
7193
7453
|
// src/features/navigation/tour-context.tsx
|
|
7194
7454
|
import { useKeepList as useKeepList5 } from "@keepkit/core/react";
|
|
7195
|
-
import { createContext as createContext5, useCallback as useCallback12, useContext as useContext5, useEffect as
|
|
7196
|
-
import { jsx as
|
|
7455
|
+
import { createContext as createContext5, useCallback as useCallback12, useContext as useContext5, useEffect as useEffect16, useMemo as useMemo6, useState as useState22 } from "react";
|
|
7456
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
7197
7457
|
var SESSION_VERSION = 1;
|
|
7198
7458
|
var KeepTourContext = createContext5(null);
|
|
7199
7459
|
function KeepTourProvider({
|
|
@@ -7204,10 +7464,10 @@ function KeepTourProvider({
|
|
|
7204
7464
|
onNavigate
|
|
7205
7465
|
}) {
|
|
7206
7466
|
const list = useKeepList5();
|
|
7207
|
-
const [tour, setTour] =
|
|
7467
|
+
const [tour, setTour] = useState22(
|
|
7208
7468
|
null
|
|
7209
7469
|
);
|
|
7210
|
-
const [persistenceStatus, setPersistenceStatus] =
|
|
7470
|
+
const [persistenceStatus, setPersistenceStatus] = useState22("persistent");
|
|
7211
7471
|
const itemsById = useMemo6(() => new Map(list.items.map((item) => [item.id, item])), [list.items]);
|
|
7212
7472
|
const readStorage = useCallback12(() => {
|
|
7213
7473
|
try {
|
|
@@ -7243,7 +7503,7 @@ function KeepTourProvider({
|
|
|
7243
7503
|
},
|
|
7244
7504
|
[sessionKey]
|
|
7245
7505
|
);
|
|
7246
|
-
|
|
7506
|
+
useEffect16(() => {
|
|
7247
7507
|
if (!list.isHydrated || list.error || tour) return;
|
|
7248
7508
|
const stored = typeof window === "undefined" ? null : readStorage();
|
|
7249
7509
|
if (!stored) return;
|
|
@@ -7255,7 +7515,7 @@ function KeepTourProvider({
|
|
|
7255
7515
|
const currentId = ids.includes(stored.currentId) ? stored.currentId : ids[0];
|
|
7256
7516
|
setTour({ itemIds: ids, currentId, collapsed: stored.collapsed });
|
|
7257
7517
|
}, [itemsById, list.error, list.isHydrated, readStorage, tour, writeStorage]);
|
|
7258
|
-
|
|
7518
|
+
useEffect16(() => {
|
|
7259
7519
|
if (!tour || list.isLoading || list.error) return;
|
|
7260
7520
|
const ids = tour.itemIds.filter((id) => itemsById.has(id));
|
|
7261
7521
|
if (!ids.length) {
|
|
@@ -7330,23 +7590,23 @@ function KeepTourProvider({
|
|
|
7330
7590
|
}),
|
|
7331
7591
|
[end, getBackHref, getItemHref, move, onNavigate, persistenceStatus, setCurrentId, start, tour]
|
|
7332
7592
|
);
|
|
7333
|
-
|
|
7593
|
+
useEffect16(() => {
|
|
7334
7594
|
if (!tour) return;
|
|
7335
7595
|
if (tour.currentId) writeStorage(tour);
|
|
7336
7596
|
}, [tour, writeStorage]);
|
|
7337
|
-
return /* @__PURE__ */
|
|
7597
|
+
return /* @__PURE__ */ jsx33(KeepTourContext.Provider, { value, children });
|
|
7338
7598
|
}
|
|
7339
7599
|
function useKeepTour(options = {}) {
|
|
7340
7600
|
const context = useContext5(KeepTourContext);
|
|
7341
7601
|
if (!context) throw new Error("useKeepTour must be used within KeepTourProvider.");
|
|
7342
|
-
|
|
7602
|
+
useEffect16(() => {
|
|
7343
7603
|
if (options.currentId && context.active) context.setCurrentId(options.currentId);
|
|
7344
7604
|
}, [context, options.currentId]);
|
|
7345
7605
|
return context;
|
|
7346
7606
|
}
|
|
7347
7607
|
|
|
7348
7608
|
// src/features/navigation/KeepFloatingTour.tsx
|
|
7349
|
-
import { Fragment as
|
|
7609
|
+
import { Fragment as Fragment18, jsx as jsx34, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7350
7610
|
function KeepFloatingTour({
|
|
7351
7611
|
currentId,
|
|
7352
7612
|
getItemHref,
|
|
@@ -7364,15 +7624,15 @@ function KeepFloatingTour({
|
|
|
7364
7624
|
const tour = useKeepTour({ currentId });
|
|
7365
7625
|
const { items } = useKeepList6();
|
|
7366
7626
|
const theme = useKeepTheme();
|
|
7367
|
-
const [mounted, setMounted] =
|
|
7627
|
+
const [mounted, setMounted] = useState23(false);
|
|
7368
7628
|
const { labels } = useKeepUiLabels();
|
|
7369
7629
|
const collapseLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u6298\u308A\u305F\u305F\u3080" : "Collapse tour";
|
|
7370
7630
|
const expandLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u5C55\u958B" : "Expand tour";
|
|
7371
7631
|
const endLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u7D42\u4E86" : "End tour";
|
|
7372
|
-
const expandRef =
|
|
7373
|
-
const collapseRef =
|
|
7374
|
-
|
|
7375
|
-
|
|
7632
|
+
const expandRef = useRef13(null);
|
|
7633
|
+
const collapseRef = useRef13(null);
|
|
7634
|
+
useEffect17(() => setMounted(true), []);
|
|
7635
|
+
useEffect17(() => {
|
|
7376
7636
|
if (!mounted || !tour.active) return;
|
|
7377
7637
|
const button = tour.collapsed ? expandRef.current : collapseRef.current;
|
|
7378
7638
|
if (button) button.focus();
|
|
@@ -7408,7 +7668,7 @@ function KeepFloatingTour({
|
|
|
7408
7668
|
"--keep-tour-z-index": zIndex,
|
|
7409
7669
|
...style
|
|
7410
7670
|
};
|
|
7411
|
-
const content = tour.collapsed ? /* @__PURE__ */
|
|
7671
|
+
const content = tour.collapsed ? /* @__PURE__ */ jsxs27(
|
|
7412
7672
|
"button",
|
|
7413
7673
|
{
|
|
7414
7674
|
ref: expandRef,
|
|
@@ -7423,8 +7683,8 @@ function KeepFloatingTour({
|
|
|
7423
7683
|
tour.itemIds.length
|
|
7424
7684
|
]
|
|
7425
7685
|
}
|
|
7426
|
-
) : /* @__PURE__ */
|
|
7427
|
-
/* @__PURE__ */
|
|
7686
|
+
) : /* @__PURE__ */ jsxs27(Fragment18, { children: [
|
|
7687
|
+
/* @__PURE__ */ jsx34(
|
|
7428
7688
|
KeepTourBar,
|
|
7429
7689
|
{
|
|
7430
7690
|
className: "keep-floating-tour__bar",
|
|
@@ -7441,7 +7701,7 @@ function KeepFloatingTour({
|
|
|
7441
7701
|
showShortcutHint
|
|
7442
7702
|
}
|
|
7443
7703
|
),
|
|
7444
|
-
/* @__PURE__ */
|
|
7704
|
+
/* @__PURE__ */ jsx34(
|
|
7445
7705
|
"button",
|
|
7446
7706
|
{
|
|
7447
7707
|
ref: collapseRef,
|
|
@@ -7453,7 +7713,7 @@ function KeepFloatingTour({
|
|
|
7453
7713
|
children: "\u2212"
|
|
7454
7714
|
}
|
|
7455
7715
|
),
|
|
7456
|
-
/* @__PURE__ */
|
|
7716
|
+
/* @__PURE__ */ jsx34(
|
|
7457
7717
|
"button",
|
|
7458
7718
|
{
|
|
7459
7719
|
type: "button",
|
|
@@ -7466,7 +7726,7 @@ function KeepFloatingTour({
|
|
|
7466
7726
|
)
|
|
7467
7727
|
] });
|
|
7468
7728
|
return createPortal(
|
|
7469
|
-
/* @__PURE__ */
|
|
7729
|
+
/* @__PURE__ */ jsx34(KeepThemeProvider, { ...theme, children: /* @__PURE__ */ jsx34(
|
|
7470
7730
|
"aside",
|
|
7471
7731
|
{
|
|
7472
7732
|
className: ["keep-floating-tour", `keep-floating-tour--${position}`, className].filter(Boolean).join(" "),
|
|
@@ -7485,7 +7745,7 @@ function KeepFloatingTour({
|
|
|
7485
7745
|
// src/features/rediscovery/KeepRediscovery.tsx
|
|
7486
7746
|
import { createRediscoveryQuery } from "@keepkit/core/core";
|
|
7487
7747
|
import { useId as useId7, useMemo as useMemo8 } from "react";
|
|
7488
|
-
import { jsx as
|
|
7748
|
+
import { jsx as jsx35, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7489
7749
|
function KeepRediscovery({
|
|
7490
7750
|
strategy,
|
|
7491
7751
|
inactiveForMs,
|
|
@@ -7500,7 +7760,7 @@ function KeepRediscovery({
|
|
|
7500
7760
|
}),
|
|
7501
7761
|
[inactiveForMs, limit, strategy]
|
|
7502
7762
|
);
|
|
7503
|
-
return /* @__PURE__ */
|
|
7763
|
+
return /* @__PURE__ */ jsx35(
|
|
7504
7764
|
KeepList,
|
|
7505
7765
|
{
|
|
7506
7766
|
...props,
|
|
@@ -7526,12 +7786,12 @@ function KeepRediscoveryPanel({
|
|
|
7526
7786
|
const inactiveLabel = useUiLabel("activityInactiveFor");
|
|
7527
7787
|
const openedLabel = useUiLabel("activityOpened");
|
|
7528
7788
|
const strategyLabel = strategy === "never-opened" ? neverOpenedLabel : strategy === "forgotten" ? inactiveLabel : openedLabel;
|
|
7529
|
-
return /* @__PURE__ */
|
|
7530
|
-
/* @__PURE__ */
|
|
7531
|
-
/* @__PURE__ */
|
|
7532
|
-
/* @__PURE__ */
|
|
7789
|
+
return /* @__PURE__ */ jsxs28("section", { className, "data-keepkit": "rediscovery-panel", "aria-labelledby": headingId, children: [
|
|
7790
|
+
/* @__PURE__ */ jsxs28("header", { children: [
|
|
7791
|
+
/* @__PURE__ */ jsx35("h2", { id: headingId, children: title ?? strategyLabel }),
|
|
7792
|
+
/* @__PURE__ */ jsx35("p", { children: description ?? strategyLabel })
|
|
7533
7793
|
] }),
|
|
7534
|
-
/* @__PURE__ */
|
|
7794
|
+
/* @__PURE__ */ jsx35(KeepRediscovery, { ...rediscoveryProps, strategy })
|
|
7535
7795
|
] });
|
|
7536
7796
|
}
|
|
7537
7797
|
|
|
@@ -7540,7 +7800,7 @@ import { isValidElement as isValidElement9 } from "react";
|
|
|
7540
7800
|
|
|
7541
7801
|
// src/features/status/hooks/useStatusViews.ts
|
|
7542
7802
|
import { useKeepContext as useKeepContext7 } from "@keepkit/core/react";
|
|
7543
|
-
import { useEffect as
|
|
7803
|
+
import { useEffect as useEffect18, useRef as useRef14, useState as useState24 } from "react";
|
|
7544
7804
|
function useKeepStatus(status) {
|
|
7545
7805
|
const context = useKeepContext7();
|
|
7546
7806
|
const resolvedStatus = status ?? getDerivedStatus(context);
|
|
@@ -7557,9 +7817,9 @@ function useKeepAnnouncements(messages) {
|
|
|
7557
7817
|
const savedMessage = useUiLabel("savedMessage", messages?.save);
|
|
7558
7818
|
const removedMessage = useUiLabel("removedMessage", messages?.remove);
|
|
7559
7819
|
const noteSavedMessage = useUiLabel("noteSavedMessage", messages?.note);
|
|
7560
|
-
const [message, setMessage] =
|
|
7561
|
-
const lastChangeRef =
|
|
7562
|
-
|
|
7820
|
+
const [message, setMessage] = useState24("");
|
|
7821
|
+
const lastChangeRef = useRef14(void 0);
|
|
7822
|
+
useEffect18(() => {
|
|
7563
7823
|
const change = context.lastChange;
|
|
7564
7824
|
if (!change || change === lastChangeRef.current) return;
|
|
7565
7825
|
lastChangeRef.current = change;
|
|
@@ -7587,7 +7847,7 @@ function getStatusLabelKey3(status) {
|
|
|
7587
7847
|
}
|
|
7588
7848
|
|
|
7589
7849
|
// src/features/status/status.tsx
|
|
7590
|
-
import { jsx as
|
|
7850
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
7591
7851
|
function KeepStatus({
|
|
7592
7852
|
status,
|
|
7593
7853
|
labels,
|
|
@@ -7619,7 +7879,7 @@ function KeepStatus({
|
|
|
7619
7879
|
}
|
|
7620
7880
|
function KeepAnnouncements({ messages, ...props }) {
|
|
7621
7881
|
const message = useKeepAnnouncements(messages);
|
|
7622
|
-
return /* @__PURE__ */
|
|
7882
|
+
return /* @__PURE__ */ jsx36(
|
|
7623
7883
|
"div",
|
|
7624
7884
|
{
|
|
7625
7885
|
...props,
|
|
@@ -7636,14 +7896,14 @@ var KeepAnnouncer = KeepAnnouncements;
|
|
|
7636
7896
|
|
|
7637
7897
|
// src/features/sync/hooks/useKeepSyncFeedback.ts
|
|
7638
7898
|
import { useKeepContext as useKeepContext8 } from "@keepkit/core/react";
|
|
7639
|
-
import { useEffect as
|
|
7899
|
+
import { useEffect as useEffect19, useRef as useRef15 } from "react";
|
|
7640
7900
|
function useKeepSyncFeedback() {
|
|
7641
7901
|
const { syncState } = useKeepContext8();
|
|
7642
7902
|
const emitFeedback = useKeepUiFeedback();
|
|
7643
7903
|
const completedMessage = useUiLabel("syncSynced");
|
|
7644
7904
|
const failedMessage = useUiLabel("syncFailedMessage");
|
|
7645
|
-
const previousStatus =
|
|
7646
|
-
|
|
7905
|
+
const previousStatus = useRef15("idle");
|
|
7906
|
+
useEffect19(() => {
|
|
7647
7907
|
const previous = previousStatus.current;
|
|
7648
7908
|
previousStatus.current = syncState.status;
|
|
7649
7909
|
if (syncState.status === "error" && previous !== "error") {
|
|
@@ -7664,16 +7924,16 @@ function KeepSyncFeedbackObserver() {
|
|
|
7664
7924
|
|
|
7665
7925
|
// src/features/sync/hooks/useKeepSyncRecoveryDialog.ts
|
|
7666
7926
|
import { useKeepContext as useKeepContext9 } from "@keepkit/core/react";
|
|
7667
|
-
import { useEffect as
|
|
7927
|
+
import { useEffect as useEffect20, useState as useState25 } from "react";
|
|
7668
7928
|
function useKeepSyncRecoveryDialog(options) {
|
|
7669
7929
|
const { open, onOpenChange, conflicts, onManualMerge } = options;
|
|
7670
7930
|
const context = useKeepContext9();
|
|
7671
7931
|
const conflictList = conflicts ?? context.syncState.conflicts ?? [];
|
|
7672
7932
|
const hasRecovery = conflictList.length > 0 || context.syncState.status === "error" || Boolean(context.error);
|
|
7673
|
-
const [dismissed, setDismissed] =
|
|
7674
|
-
const [busyId, setBusyId] =
|
|
7675
|
-
const [error, setError] =
|
|
7676
|
-
|
|
7933
|
+
const [dismissed, setDismissed] = useState25(false);
|
|
7934
|
+
const [busyId, setBusyId] = useState25();
|
|
7935
|
+
const [error, setError] = useState25();
|
|
7936
|
+
useEffect20(() => {
|
|
7677
7937
|
if (hasRecovery) setDismissed(false);
|
|
7678
7938
|
}, [hasRecovery]);
|
|
7679
7939
|
return {
|
|
@@ -7718,7 +7978,7 @@ function useKeepSyncRecoveryDialog(options) {
|
|
|
7718
7978
|
}
|
|
7719
7979
|
|
|
7720
7980
|
// src/features/sync/KeepSyncRecoveryDialog.tsx
|
|
7721
|
-
import { jsx as
|
|
7981
|
+
import { jsx as jsx37, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7722
7982
|
function KeepSyncRecoveryDialog({
|
|
7723
7983
|
open,
|
|
7724
7984
|
onOpenChange,
|
|
@@ -7733,7 +7993,7 @@ function KeepSyncRecoveryDialog({
|
|
|
7733
7993
|
}) {
|
|
7734
7994
|
const view = useKeepSyncRecoveryDialog({ open, onOpenChange, conflicts, onManualMerge });
|
|
7735
7995
|
if (!view.isOpen) return null;
|
|
7736
|
-
return /* @__PURE__ */
|
|
7996
|
+
return /* @__PURE__ */ jsxs29(
|
|
7737
7997
|
"section",
|
|
7738
7998
|
{
|
|
7739
7999
|
...props,
|
|
@@ -7747,17 +8007,17 @@ function KeepSyncRecoveryDialog({
|
|
|
7747
8007
|
"data-state": view.conflictList.length > 0 ? "conflict" : "error",
|
|
7748
8008
|
"data-loading": view.busyId !== void 0 ? "true" : void 0,
|
|
7749
8009
|
children: [
|
|
7750
|
-
/* @__PURE__ */
|
|
7751
|
-
/* @__PURE__ */
|
|
7752
|
-
/* @__PURE__ */
|
|
8010
|
+
/* @__PURE__ */ jsxs29("header", { children: [
|
|
8011
|
+
/* @__PURE__ */ jsx37("h2", { id: "keepkit-sync-recovery-title", children: title ?? view.labels.title }),
|
|
8012
|
+
/* @__PURE__ */ jsx37("button", { type: "button", "data-keep-action": "close-dialog", onClick: view.close, "aria-label": view.labels.close, children: view.labels.close })
|
|
7753
8013
|
] }),
|
|
7754
8014
|
children,
|
|
7755
|
-
view.conflictList.length > 0 ? /* @__PURE__ */
|
|
7756
|
-
/* @__PURE__ */
|
|
7757
|
-
view.conflictList.map((conflict) => /* @__PURE__ */
|
|
7758
|
-
/* @__PURE__ */
|
|
7759
|
-
/* @__PURE__ */
|
|
7760
|
-
/* @__PURE__ */
|
|
8015
|
+
view.conflictList.length > 0 ? /* @__PURE__ */ jsxs29("div", { children: [
|
|
8016
|
+
/* @__PURE__ */ jsx37("p", { children: view.labels.conflict }),
|
|
8017
|
+
view.conflictList.map((conflict) => /* @__PURE__ */ jsxs29("article", { "data-conflict-id": conflict.id, children: [
|
|
8018
|
+
/* @__PURE__ */ jsx37("h3", { children: getMetaTitle(conflict.operation.item?.meta) ?? conflict.id }),
|
|
8019
|
+
/* @__PURE__ */ jsxs29("div", { "data-conflict-preview": true, children: [
|
|
8020
|
+
/* @__PURE__ */ jsx37(
|
|
7761
8021
|
ConflictPreview,
|
|
7762
8022
|
{
|
|
7763
8023
|
item: conflict.operation.item,
|
|
@@ -7767,7 +8027,7 @@ function KeepSyncRecoveryDialog({
|
|
|
7767
8027
|
side: "local"
|
|
7768
8028
|
}
|
|
7769
8029
|
),
|
|
7770
|
-
/* @__PURE__ */
|
|
8030
|
+
/* @__PURE__ */ jsx37(
|
|
7771
8031
|
ConflictPreview,
|
|
7772
8032
|
{
|
|
7773
8033
|
item: conflict.remote,
|
|
@@ -7778,8 +8038,8 @@ function KeepSyncRecoveryDialog({
|
|
|
7778
8038
|
}
|
|
7779
8039
|
)
|
|
7780
8040
|
] }),
|
|
7781
|
-
/* @__PURE__ */
|
|
7782
|
-
/* @__PURE__ */
|
|
8041
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
8042
|
+
/* @__PURE__ */ jsx37(
|
|
7783
8043
|
"button",
|
|
7784
8044
|
{
|
|
7785
8045
|
type: "button",
|
|
@@ -7789,7 +8049,7 @@ function KeepSyncRecoveryDialog({
|
|
|
7789
8049
|
children: view.labels.keepLocal
|
|
7790
8050
|
}
|
|
7791
8051
|
),
|
|
7792
|
-
/* @__PURE__ */
|
|
8052
|
+
/* @__PURE__ */ jsx37(
|
|
7793
8053
|
"button",
|
|
7794
8054
|
{
|
|
7795
8055
|
type: "button",
|
|
@@ -7799,7 +8059,7 @@ function KeepSyncRecoveryDialog({
|
|
|
7799
8059
|
children: view.labels.useServer
|
|
7800
8060
|
}
|
|
7801
8061
|
),
|
|
7802
|
-
/* @__PURE__ */
|
|
8062
|
+
/* @__PURE__ */ jsx37(
|
|
7803
8063
|
"button",
|
|
7804
8064
|
{
|
|
7805
8065
|
type: "button",
|
|
@@ -7812,12 +8072,12 @@ function KeepSyncRecoveryDialog({
|
|
|
7812
8072
|
] })
|
|
7813
8073
|
] }, conflict.id))
|
|
7814
8074
|
] }) : null,
|
|
7815
|
-
view.showBackupRecovery ? /* @__PURE__ */
|
|
7816
|
-
/* @__PURE__ */
|
|
7817
|
-
/* @__PURE__ */
|
|
7818
|
-
backup ?? (showBackupControls ? /* @__PURE__ */
|
|
8075
|
+
view.showBackupRecovery ? /* @__PURE__ */ jsxs29("section", { "data-recovery": "backup", children: [
|
|
8076
|
+
/* @__PURE__ */ jsx37("h3", { children: view.labels.backupRecovery }),
|
|
8077
|
+
/* @__PURE__ */ jsx37("p", { children: view.labels.backupRecoveryDescription }),
|
|
8078
|
+
backup ?? (showBackupControls ? /* @__PURE__ */ jsx37(KeepBackup, {}) : null)
|
|
7819
8079
|
] }) : null,
|
|
7820
|
-
view.error ? /* @__PURE__ */
|
|
8080
|
+
view.error ? /* @__PURE__ */ jsx37("p", { id: "keepkit-sync-recovery-error", role: "alert", "aria-live": "assertive", children: getErrorMessage(view.error, view.labels.error) }) : null
|
|
7821
8081
|
]
|
|
7822
8082
|
}
|
|
7823
8083
|
);
|
|
@@ -7829,16 +8089,16 @@ function ConflictPreview({
|
|
|
7829
8089
|
noteLabel,
|
|
7830
8090
|
side
|
|
7831
8091
|
}) {
|
|
7832
|
-
return /* @__PURE__ */
|
|
7833
|
-
/* @__PURE__ */
|
|
7834
|
-
/* @__PURE__ */
|
|
7835
|
-
/* @__PURE__ */
|
|
7836
|
-
/* @__PURE__ */
|
|
7837
|
-
/* @__PURE__ */
|
|
8092
|
+
return /* @__PURE__ */ jsxs29("article", { "data-conflict-version": side, "aria-label": heading, children: [
|
|
8093
|
+
/* @__PURE__ */ jsx37("h4", { children: heading }),
|
|
8094
|
+
/* @__PURE__ */ jsxs29("dl", { children: [
|
|
8095
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
8096
|
+
/* @__PURE__ */ jsx37("dt", { children: updatedAtLabel }),
|
|
8097
|
+
/* @__PURE__ */ jsx37("dd", { children: item ? /* @__PURE__ */ jsx37("time", { dateTime: new Date(item.updatedAt).toISOString(), children: formatConflictDate(item.updatedAt) }) : "\u2014" })
|
|
7838
8098
|
] }),
|
|
7839
|
-
/* @__PURE__ */
|
|
7840
|
-
/* @__PURE__ */
|
|
7841
|
-
/* @__PURE__ */
|
|
8099
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
8100
|
+
/* @__PURE__ */ jsx37("dt", { children: noteLabel }),
|
|
8101
|
+
/* @__PURE__ */ jsx37("dd", { children: item?.note || "\u2014" })
|
|
7842
8102
|
] })
|
|
7843
8103
|
] })
|
|
7844
8104
|
] });
|
|
@@ -7880,7 +8140,7 @@ function useKeepSyncStatusBanner({ onRetry, children }) {
|
|
|
7880
8140
|
}
|
|
7881
8141
|
|
|
7882
8142
|
// src/features/sync/KeepSyncStatusBanner.tsx
|
|
7883
|
-
import { jsx as
|
|
8143
|
+
import { jsx as jsx38, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
7884
8144
|
function KeepSyncStatusBanner({
|
|
7885
8145
|
onRetry,
|
|
7886
8146
|
onResolveConflicts,
|
|
@@ -7892,7 +8152,7 @@ function KeepSyncStatusBanner({
|
|
|
7892
8152
|
const showRetryLabel = useUiLabelVisibility("retrySync");
|
|
7893
8153
|
const showResolveLabel = useUiLabelVisibility("resolveSync");
|
|
7894
8154
|
if (view.status === "idle" && !view.hasConflicts) return null;
|
|
7895
|
-
return /* @__PURE__ */
|
|
8155
|
+
return /* @__PURE__ */ jsxs30(
|
|
7896
8156
|
"aside",
|
|
7897
8157
|
{
|
|
7898
8158
|
...props,
|
|
@@ -7902,8 +8162,8 @@ function KeepSyncStatusBanner({
|
|
|
7902
8162
|
"data-keepkit": "sync-status",
|
|
7903
8163
|
"data-state": view.status,
|
|
7904
8164
|
children: [
|
|
7905
|
-
/* @__PURE__ */
|
|
7906
|
-
view.showRetry ? /* @__PURE__ */
|
|
8165
|
+
/* @__PURE__ */ jsx38("p", { children: view.message }),
|
|
8166
|
+
view.showRetry ? /* @__PURE__ */ jsx38(
|
|
7907
8167
|
"button",
|
|
7908
8168
|
{
|
|
7909
8169
|
type: "button",
|
|
@@ -7914,7 +8174,7 @@ function KeepSyncStatusBanner({
|
|
|
7914
8174
|
children: showRetryLabel ? view.retryLabel : null
|
|
7915
8175
|
}
|
|
7916
8176
|
) : null,
|
|
7917
|
-
view.hasConflicts ? /* @__PURE__ */
|
|
8177
|
+
view.hasConflicts ? /* @__PURE__ */ jsx38(
|
|
7918
8178
|
"button",
|
|
7919
8179
|
{
|
|
7920
8180
|
type: "button",
|
|
@@ -7934,7 +8194,7 @@ function KeepSyncStatusBanner({
|
|
|
7934
8194
|
import { createInboxQuery as createInboxQuery2 } from "@keepkit/core/core";
|
|
7935
8195
|
|
|
7936
8196
|
// src/features/workspace/hooks/useKeepWorkspace.ts
|
|
7937
|
-
import { useCallback as useCallback13, useState as
|
|
8197
|
+
import { useCallback as useCallback13, useState as useState26 } from "react";
|
|
7938
8198
|
var PRESET_MODULES = {
|
|
7939
8199
|
basic: {
|
|
7940
8200
|
syncStatus: false,
|
|
@@ -7986,7 +8246,7 @@ function useKeepWorkspace({
|
|
|
7986
8246
|
onRecoveryOpenChange,
|
|
7987
8247
|
onResolveConflicts
|
|
7988
8248
|
}) {
|
|
7989
|
-
const [internalRecoveryOpen, setInternalRecoveryOpen] =
|
|
8249
|
+
const [internalRecoveryOpen, setInternalRecoveryOpen] = useState26(false);
|
|
7990
8250
|
const resolvedModules = { ...PRESET_MODULES[preset], ...modules };
|
|
7991
8251
|
const setRecoveryOpen = useCallback13(
|
|
7992
8252
|
(open) => {
|
|
@@ -8010,7 +8270,7 @@ function useKeepWorkspace({
|
|
|
8010
8270
|
}
|
|
8011
8271
|
|
|
8012
8272
|
// src/features/workspace/KeepWorkspace.tsx
|
|
8013
|
-
import { jsx as
|
|
8273
|
+
import { jsx as jsx39, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
8014
8274
|
function KeepWorkspace({
|
|
8015
8275
|
preset = "standard",
|
|
8016
8276
|
modules,
|
|
@@ -8058,27 +8318,27 @@ function KeepWorkspace({
|
|
|
8058
8318
|
if (!structuredRegions) return content;
|
|
8059
8319
|
if (!hasRenderableContent(content)) return null;
|
|
8060
8320
|
const resolvedSurface = typeof surface === "string" ? surface : surface[name] ?? "plain";
|
|
8061
|
-
return /* @__PURE__ */
|
|
8321
|
+
return /* @__PURE__ */ jsx39("div", { "data-keepkit": "workspace-region", "data-region": name, "data-surface": resolvedSurface, children: content });
|
|
8062
8322
|
};
|
|
8063
8323
|
const before = resolveOptionalSlot(slots?.before, state);
|
|
8064
8324
|
const syncStatus = view.modules.syncStatus ? resolveSlot(
|
|
8065
8325
|
slots?.syncStatus,
|
|
8066
|
-
/* @__PURE__ */
|
|
8326
|
+
/* @__PURE__ */ jsx39(KeepSyncStatusBanner, { ...syncStatusProps, onResolveConflicts: view.openRecovery }),
|
|
8067
8327
|
state
|
|
8068
8328
|
) : null;
|
|
8069
|
-
const collection = resolveSlot(slots?.collection, /* @__PURE__ */
|
|
8329
|
+
const collection = resolveSlot(slots?.collection, /* @__PURE__ */ jsx39(KeepCollection, { ...resolvedCollectionProps }), state);
|
|
8070
8330
|
const actions = view.modules.backup || view.modules.stalePrune ? resolveSlot(
|
|
8071
8331
|
slots?.actions,
|
|
8072
|
-
/* @__PURE__ */
|
|
8073
|
-
view.modules.stalePrune ? /* @__PURE__ */
|
|
8074
|
-
view.modules.backup ? /* @__PURE__ */
|
|
8332
|
+
/* @__PURE__ */ jsxs31("div", { "data-keepkit": "workspace-actions", children: [
|
|
8333
|
+
view.modules.stalePrune ? /* @__PURE__ */ jsx39(KeepPruneStaleButton, { ...stalePruneProps }) : null,
|
|
8334
|
+
view.modules.backup ? /* @__PURE__ */ jsx39(KeepBackup, { ...backupProps }) : null
|
|
8075
8335
|
] }),
|
|
8076
8336
|
state
|
|
8077
8337
|
) : null;
|
|
8078
|
-
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */
|
|
8338
|
+
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */ jsx39(KeepUndo, { ...undoProps }), state) : null;
|
|
8079
8339
|
const recovery = view.modules.recovery ? resolveSlot(
|
|
8080
8340
|
slots?.recovery,
|
|
8081
|
-
/* @__PURE__ */
|
|
8341
|
+
/* @__PURE__ */ jsx39(
|
|
8082
8342
|
KeepSyncRecoveryDialog,
|
|
8083
8343
|
{
|
|
8084
8344
|
...recoveryProps,
|
|
@@ -8090,7 +8350,7 @@ function KeepWorkspace({
|
|
|
8090
8350
|
) : null;
|
|
8091
8351
|
const additionalContent = resolveOptionalSlot(children, state);
|
|
8092
8352
|
const after = resolveOptionalSlot(slots?.after, state);
|
|
8093
|
-
return /* @__PURE__ */
|
|
8353
|
+
return /* @__PURE__ */ jsxs31(
|
|
8094
8354
|
"section",
|
|
8095
8355
|
{
|
|
8096
8356
|
...props,
|
|
@@ -8126,7 +8386,7 @@ import { createAuthenticatedSyncKit } from "@keepkit/core/core";
|
|
|
8126
8386
|
import {
|
|
8127
8387
|
KeepErrorBoundary as KeepErrorBoundary3,
|
|
8128
8388
|
KeepProvider,
|
|
8129
|
-
useKeepCollections as
|
|
8389
|
+
useKeepCollections as useKeepCollections7,
|
|
8130
8390
|
useKeepContext as useKeepContext11,
|
|
8131
8391
|
useKeepItem as useKeepItem8,
|
|
8132
8392
|
useKeepList as useKeepList7,
|
|
@@ -8144,7 +8404,7 @@ import {
|
|
|
8144
8404
|
LocalStorageSyncQueueAdapter,
|
|
8145
8405
|
SyncStorageAdapter
|
|
8146
8406
|
} from "@keepkit/core/storage";
|
|
8147
|
-
import { jsx as
|
|
8407
|
+
import { jsx as jsx40, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
8148
8408
|
function KeepKitProvider({
|
|
8149
8409
|
labels,
|
|
8150
8410
|
labelOptions,
|
|
@@ -8166,7 +8426,7 @@ function KeepKitProvider({
|
|
|
8166
8426
|
children,
|
|
8167
8427
|
...providerProps
|
|
8168
8428
|
}) {
|
|
8169
|
-
return /* @__PURE__ */
|
|
8429
|
+
return /* @__PURE__ */ jsx40(
|
|
8170
8430
|
KeepUiProvider,
|
|
8171
8431
|
{
|
|
8172
8432
|
labels,
|
|
@@ -8174,7 +8434,7 @@ function KeepKitProvider({
|
|
|
8174
8434
|
locale,
|
|
8175
8435
|
labelResolver,
|
|
8176
8436
|
onFeedback,
|
|
8177
|
-
children: /* @__PURE__ */
|
|
8437
|
+
children: /* @__PURE__ */ jsx40(
|
|
8178
8438
|
KeepThemeProvider,
|
|
8179
8439
|
{
|
|
8180
8440
|
theme,
|
|
@@ -8188,10 +8448,10 @@ function KeepKitProvider({
|
|
|
8188
8448
|
className: themeClassName,
|
|
8189
8449
|
style: themeStyle,
|
|
8190
8450
|
asChild: themeAsChild,
|
|
8191
|
-
children: /* @__PURE__ */
|
|
8192
|
-
/* @__PURE__ */
|
|
8193
|
-
/* @__PURE__ */
|
|
8194
|
-
/* @__PURE__ */
|
|
8451
|
+
children: /* @__PURE__ */ jsxs32(CoreKeepProvider, { ...providerProps, children: [
|
|
8452
|
+
/* @__PURE__ */ jsx40(KeepSyncFeedbackObserver, {}),
|
|
8453
|
+
/* @__PURE__ */ jsx40(KeepTourProvider, { ...tour, children }),
|
|
8454
|
+
/* @__PURE__ */ jsx40(KeepAnnouncements, {})
|
|
8195
8455
|
] })
|
|
8196
8456
|
}
|
|
8197
8457
|
)
|
|
@@ -8222,7 +8482,7 @@ function createKeepKit(options = {}) {
|
|
|
8222
8482
|
} = options;
|
|
8223
8483
|
const coreKit = createCoreKeepKit(coreOptions);
|
|
8224
8484
|
return {
|
|
8225
|
-
Provider: (props) => /* @__PURE__ */
|
|
8485
|
+
Provider: (props) => /* @__PURE__ */ jsx40(
|
|
8226
8486
|
KeepKitProvider,
|
|
8227
8487
|
{
|
|
8228
8488
|
...coreOptions,
|
|
@@ -8245,9 +8505,9 @@ function createKeepKit(options = {}) {
|
|
|
8245
8505
|
...props
|
|
8246
8506
|
}
|
|
8247
8507
|
),
|
|
8248
|
-
Button: (props) => /* @__PURE__ */
|
|
8249
|
-
Backup: (props) => /* @__PURE__ */
|
|
8250
|
-
Collection: (props) => /* @__PURE__ */
|
|
8508
|
+
Button: (props) => /* @__PURE__ */ jsx40(KeepButton, { ...props }),
|
|
8509
|
+
Backup: (props) => /* @__PURE__ */ jsx40(KeepBackup, { ...props }),
|
|
8510
|
+
Collection: (props) => /* @__PURE__ */ jsx40(
|
|
8251
8511
|
KeepCollection,
|
|
8252
8512
|
{
|
|
8253
8513
|
...props,
|
|
@@ -8258,10 +8518,10 @@ function createKeepKit(options = {}) {
|
|
|
8258
8518
|
}
|
|
8259
8519
|
}
|
|
8260
8520
|
),
|
|
8261
|
-
Inbox: (props) => /* @__PURE__ */
|
|
8262
|
-
SavedViews: (props) => /* @__PURE__ */
|
|
8263
|
-
CollectionManager: (props) => /* @__PURE__ */
|
|
8264
|
-
Workspace: (props) => /* @__PURE__ */
|
|
8521
|
+
Inbox: (props) => /* @__PURE__ */ jsx40(KeepInbox, { ...props }),
|
|
8522
|
+
SavedViews: (props) => /* @__PURE__ */ jsx40(KeepSavedViews, { ...props }),
|
|
8523
|
+
CollectionManager: (props) => /* @__PURE__ */ jsx40(KeepCollectionManager, { ...props }),
|
|
8524
|
+
Workspace: (props) => /* @__PURE__ */ jsx40(
|
|
8265
8525
|
KeepWorkspace,
|
|
8266
8526
|
{
|
|
8267
8527
|
...props,
|
|
@@ -8283,8 +8543,8 @@ function createKeepKit(options = {}) {
|
|
|
8283
8543
|
useCollections: (collectionsOptions) => coreKit.useCollections(collectionsOptions),
|
|
8284
8544
|
useNavigator: (navigatorOptions) => coreKit.useNavigator(navigatorOptions),
|
|
8285
8545
|
useShortcut: (shortcutOptions) => coreKit.useShortcut(shortcutOptions),
|
|
8286
|
-
FloatingTour: (props) => /* @__PURE__ */
|
|
8287
|
-
TourProvider: (props) => /* @__PURE__ */
|
|
8546
|
+
FloatingTour: (props) => /* @__PURE__ */ jsx40(KeepFloatingTour, { ...props }),
|
|
8547
|
+
TourProvider: (props) => /* @__PURE__ */ jsx40(KeepTourProvider, { ...props }),
|
|
8288
8548
|
useTour: (tourOptions) => useKeepTour(tourOptions)
|
|
8289
8549
|
};
|
|
8290
8550
|
}
|
|
@@ -8363,7 +8623,7 @@ export {
|
|
|
8363
8623
|
keepThemeNames,
|
|
8364
8624
|
mergeProps,
|
|
8365
8625
|
toggleSelectAll,
|
|
8366
|
-
|
|
8626
|
+
useKeepCollections7 as useKeepCollections,
|
|
8367
8627
|
useKeepContext11 as useKeepContext,
|
|
8368
8628
|
useKeepItem8 as useKeepItem,
|
|
8369
8629
|
useKeepList7 as useKeepList,
|