@keepkit/ui 0.28.16 → 0.28.17
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 +31 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +1025 -866
- package/dist/index.js.map +1 -1
- package/dist/styles/base.css +13 -0
- package/dist/styles/collection.css +1 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3152,6 +3152,10 @@ function KeepPinButton({
|
|
|
3152
3152
|
);
|
|
3153
3153
|
}
|
|
3154
3154
|
|
|
3155
|
+
// src/features/actions/KeepArchiveUndo.tsx
|
|
3156
|
+
import { useKeepContext } from "@keepkit/core/react";
|
|
3157
|
+
import { useEffect as useEffect2, useState } from "react";
|
|
3158
|
+
|
|
3155
3159
|
// src/foundation/shared.tsx
|
|
3156
3160
|
import {
|
|
3157
3161
|
cloneElement,
|
|
@@ -3317,14 +3321,80 @@ function renderRoot(asChild, child, props, body, componentName) {
|
|
|
3317
3321
|
}
|
|
3318
3322
|
return /* @__PURE__ */ jsx2("div", { ...props, children: body });
|
|
3319
3323
|
}
|
|
3324
|
+
var UndoUnavailableError = class extends Error {
|
|
3325
|
+
};
|
|
3326
|
+
function copyQueryValue(value) {
|
|
3327
|
+
if (value instanceof Date) return new Date(value.getTime());
|
|
3328
|
+
if (Array.isArray(value)) return value.map(copyQueryValue);
|
|
3329
|
+
if (value && typeof value === "object") {
|
|
3330
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, copyQueryValue(entry)]));
|
|
3331
|
+
}
|
|
3332
|
+
return value;
|
|
3333
|
+
}
|
|
3334
|
+
function equalQueryValue(left, right) {
|
|
3335
|
+
if (Object.is(left, right)) return true;
|
|
3336
|
+
if (left instanceof Date || right instanceof Date) {
|
|
3337
|
+
return left instanceof Date && right instanceof Date && Object.is(left.getTime(), right.getTime());
|
|
3338
|
+
}
|
|
3339
|
+
if (!left || !right || typeof left !== "object" || typeof right !== "object") return false;
|
|
3340
|
+
const leftEntries = Object.entries(left);
|
|
3341
|
+
const rightEntries = Object.entries(right);
|
|
3342
|
+
return leftEntries.length === rightEntries.length && leftEntries.every(
|
|
3343
|
+
([key, value]) => Object.getOwnPropertyDescriptor(right, key) !== void 0 && equalQueryValue(value, Reflect.get(right, key))
|
|
3344
|
+
);
|
|
3345
|
+
}
|
|
3346
|
+
|
|
3347
|
+
// src/features/actions/KeepArchiveUndo.tsx
|
|
3348
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
3349
|
+
function KeepArchiveUndo() {
|
|
3350
|
+
const { items, lastChange, unarchiveItem, isMutating, isHydrated } = useKeepContext();
|
|
3351
|
+
const [pending, setPending] = useState();
|
|
3352
|
+
const [error, setError] = useState();
|
|
3353
|
+
const archivedLabel = useUiLabel("archived");
|
|
3354
|
+
const undoLabel = useUiLabel("undo");
|
|
3355
|
+
const errorLabel = useUiLabel("error");
|
|
3356
|
+
useEffect2(() => {
|
|
3357
|
+
if (!lastChange) {
|
|
3358
|
+
setPending(void 0);
|
|
3359
|
+
setError(void 0);
|
|
3360
|
+
return;
|
|
3361
|
+
}
|
|
3362
|
+
if (lastChange.action !== "archive" || lastChange.phase !== "local") return;
|
|
3363
|
+
setPending(lastChange.item?.archived && lastChange.id ? { id: lastChange.id, restore: unarchiveItem } : void 0);
|
|
3364
|
+
setError(void 0);
|
|
3365
|
+
}, [lastChange]);
|
|
3366
|
+
const item = isHydrated && lastChange && pending?.restore === unarchiveItem ? items.find((entry) => entry.id === pending.id && entry.archived) : void 0;
|
|
3367
|
+
if (!item) return null;
|
|
3368
|
+
async function undo(id) {
|
|
3369
|
+
setError(void 0);
|
|
3370
|
+
try {
|
|
3371
|
+
await unarchiveItem(id);
|
|
3372
|
+
} catch (cause) {
|
|
3373
|
+
setError(cause);
|
|
3374
|
+
}
|
|
3375
|
+
}
|
|
3376
|
+
return /* @__PURE__ */ jsxs2("div", { "data-keepkit": "archive-undo", children: [
|
|
3377
|
+
/* @__PURE__ */ jsxs2("div", { role: "status", children: [
|
|
3378
|
+
/* @__PURE__ */ jsx3("span", { children: archivedLabel }),
|
|
3379
|
+
" \u2014 ",
|
|
3380
|
+
getMetaTitle(item.meta) ?? item.id,
|
|
3381
|
+
" ",
|
|
3382
|
+
/* @__PURE__ */ jsx3("button", { type: "button", disabled: isMutating, onClick: () => void undo(item.id), children: undoLabel })
|
|
3383
|
+
] }),
|
|
3384
|
+
error ? /* @__PURE__ */ jsx3("p", { role: "alert", children: getErrorMessage(error, errorLabel) }) : null
|
|
3385
|
+
] });
|
|
3386
|
+
}
|
|
3387
|
+
|
|
3388
|
+
// src/features/actions/KeepBackup.tsx
|
|
3389
|
+
import { useEffect as useEffect3, useId, useRef as useRef3 } from "react";
|
|
3320
3390
|
|
|
3321
3391
|
// src/features/actions/hooks/useKeepBackup.ts
|
|
3322
3392
|
import {
|
|
3323
3393
|
formatItemsAsMarkdown,
|
|
3324
3394
|
inspectKeepBackup
|
|
3325
3395
|
} from "@keepkit/core/core";
|
|
3326
|
-
import { useKeepCollections, useKeepContext } from "@keepkit/core/react";
|
|
3327
|
-
import { useRef as useRef2, useState } from "react";
|
|
3396
|
+
import { useKeepCollections, useKeepContext as useKeepContext2 } from "@keepkit/core/react";
|
|
3397
|
+
import { useRef as useRef2, useState as useState2 } from "react";
|
|
3328
3398
|
function useKeepBackup({
|
|
3329
3399
|
filename,
|
|
3330
3400
|
markdownFilename = "keepkit-links.md",
|
|
@@ -3333,13 +3403,13 @@ function useKeepBackup({
|
|
|
3333
3403
|
onExportMarkdown,
|
|
3334
3404
|
onImported
|
|
3335
3405
|
}) {
|
|
3336
|
-
const context =
|
|
3406
|
+
const context = useKeepContext2();
|
|
3337
3407
|
const collections = useKeepCollections();
|
|
3338
3408
|
const inputRef = useRef2(null);
|
|
3339
|
-
const [mode, setModeState] =
|
|
3340
|
-
const [result, setResult] =
|
|
3341
|
-
const [error, setError] =
|
|
3342
|
-
const [replaceConfirmation, setReplaceConfirmation] =
|
|
3409
|
+
const [mode, setModeState] = useState2("merge");
|
|
3410
|
+
const [result, setResult] = useState2();
|
|
3411
|
+
const [error, setError] = useState2();
|
|
3412
|
+
const [replaceConfirmation, setReplaceConfirmation] = useState2(null);
|
|
3343
3413
|
function setMode(nextMode) {
|
|
3344
3414
|
setModeState(nextMode);
|
|
3345
3415
|
if (nextMode !== "replace") setReplaceConfirmation(null);
|
|
@@ -3453,7 +3523,7 @@ function useKeepBackup({
|
|
|
3453
3523
|
}
|
|
3454
3524
|
|
|
3455
3525
|
// src/features/actions/KeepBackup.tsx
|
|
3456
|
-
import { jsx as
|
|
3526
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
3457
3527
|
function KeepBackup({
|
|
3458
3528
|
filename = "keepkit-backup.json",
|
|
3459
3529
|
markdownFilename = "keepkit-links.md",
|
|
@@ -3476,7 +3546,19 @@ function KeepBackup({
|
|
|
3476
3546
|
const showExportMarkdownLabel = useUiLabelVisibility("exportMarkdown");
|
|
3477
3547
|
const showImportModeLabel = useUiLabelVisibility("importMode");
|
|
3478
3548
|
const showImportLabel = useUiLabelVisibility("importData");
|
|
3479
|
-
|
|
3549
|
+
const replaceDescriptionId = useId();
|
|
3550
|
+
const importButton = useRef3(null);
|
|
3551
|
+
const confirmButton = useRef3(null);
|
|
3552
|
+
const wasOpen = useRef3(false);
|
|
3553
|
+
const wasMutating = useRef3(false);
|
|
3554
|
+
const isOpen = view.replaceConfirmation !== null;
|
|
3555
|
+
useEffect3(() => {
|
|
3556
|
+
if (isOpen && (!wasOpen.current || wasMutating.current && !view.isMutating)) confirmButton.current?.focus();
|
|
3557
|
+
if (!isOpen && wasOpen.current && importButton.current?.isConnected) importButton.current.focus();
|
|
3558
|
+
wasOpen.current = isOpen;
|
|
3559
|
+
wasMutating.current = view.isMutating;
|
|
3560
|
+
}, [isOpen, view.isMutating]);
|
|
3561
|
+
return /* @__PURE__ */ jsxs3(
|
|
3480
3562
|
"section",
|
|
3481
3563
|
{
|
|
3482
3564
|
...props,
|
|
@@ -3484,7 +3566,7 @@ function KeepBackup({
|
|
|
3484
3566
|
"data-state": view.error ? "error" : view.replaceConfirmation ? "confirming" : view.result ? "complete" : "idle",
|
|
3485
3567
|
"data-loading": view.isMutating ? "true" : void 0,
|
|
3486
3568
|
children: [
|
|
3487
|
-
/* @__PURE__ */
|
|
3569
|
+
/* @__PURE__ */ jsx4(
|
|
3488
3570
|
"button",
|
|
3489
3571
|
{
|
|
3490
3572
|
type: "button",
|
|
@@ -3495,7 +3577,7 @@ function KeepBackup({
|
|
|
3495
3577
|
children: showExportLabel ? view.labels.export : null
|
|
3496
3578
|
}
|
|
3497
3579
|
),
|
|
3498
|
-
allowMarkdownExport ? /* @__PURE__ */
|
|
3580
|
+
allowMarkdownExport ? /* @__PURE__ */ jsx4(
|
|
3499
3581
|
"button",
|
|
3500
3582
|
{
|
|
3501
3583
|
type: "button",
|
|
@@ -3506,25 +3588,28 @@ function KeepBackup({
|
|
|
3506
3588
|
children: showExportMarkdownLabel ? view.labels.exportMarkdown : null
|
|
3507
3589
|
}
|
|
3508
3590
|
) : null,
|
|
3509
|
-
/* @__PURE__ */
|
|
3591
|
+
/* @__PURE__ */ jsxs3("label", { children: [
|
|
3510
3592
|
showImportModeLabel ? view.labels.importMode : null,
|
|
3511
|
-
/* @__PURE__ */
|
|
3593
|
+
/* @__PURE__ */ jsxs3(
|
|
3512
3594
|
"select",
|
|
3513
3595
|
{
|
|
3514
3596
|
"data-keep-action": "select-import-mode",
|
|
3515
3597
|
value: view.mode,
|
|
3516
3598
|
"aria-label": showImportModeLabel ? void 0 : view.labels.importMode,
|
|
3599
|
+
"aria-describedby": view.mode === "replace" ? replaceDescriptionId : void 0,
|
|
3517
3600
|
onChange: (event) => view.setMode(event.currentTarget.value),
|
|
3518
3601
|
children: [
|
|
3519
|
-
/* @__PURE__ */
|
|
3520
|
-
/* @__PURE__ */
|
|
3602
|
+
/* @__PURE__ */ jsx4("option", { value: "merge", children: view.labels.merge }),
|
|
3603
|
+
/* @__PURE__ */ jsx4("option", { value: "replace", children: view.labels.replace })
|
|
3521
3604
|
]
|
|
3522
3605
|
}
|
|
3523
3606
|
)
|
|
3524
3607
|
] }),
|
|
3525
|
-
/* @__PURE__ */
|
|
3608
|
+
view.mode === "replace" ? /* @__PURE__ */ jsx4("p", { id: replaceDescriptionId, children: view.labels.confirmReplaceDescription }) : null,
|
|
3609
|
+
/* @__PURE__ */ jsx4(
|
|
3526
3610
|
"button",
|
|
3527
3611
|
{
|
|
3612
|
+
ref: importButton,
|
|
3528
3613
|
type: "button",
|
|
3529
3614
|
"data-keep-action": "import-backup",
|
|
3530
3615
|
onClick: view.openFilePicker,
|
|
@@ -3533,7 +3618,7 @@ function KeepBackup({
|
|
|
3533
3618
|
children: showImportLabel ? view.labels.import : null
|
|
3534
3619
|
}
|
|
3535
3620
|
),
|
|
3536
|
-
/* @__PURE__ */
|
|
3621
|
+
/* @__PURE__ */ jsx4(
|
|
3537
3622
|
"input",
|
|
3538
3623
|
{
|
|
3539
3624
|
ref: view.inputRef,
|
|
@@ -3544,7 +3629,7 @@ function KeepBackup({
|
|
|
3544
3629
|
onChange: (event) => void view.importBackup(event)
|
|
3545
3630
|
}
|
|
3546
3631
|
),
|
|
3547
|
-
view.replaceConfirmation ? /* @__PURE__ */
|
|
3632
|
+
view.replaceConfirmation ? /* @__PURE__ */ jsxs3(
|
|
3548
3633
|
"div",
|
|
3549
3634
|
{
|
|
3550
3635
|
role: "dialog",
|
|
@@ -3558,7 +3643,7 @@ function KeepBackup({
|
|
|
3558
3643
|
view.cancelReplace();
|
|
3559
3644
|
},
|
|
3560
3645
|
children: [
|
|
3561
|
-
/* @__PURE__ */
|
|
3646
|
+
/* @__PURE__ */ jsxs3("p", { children: [
|
|
3562
3647
|
view.replaceConfirmation.summary.itemCount,
|
|
3563
3648
|
" ",
|
|
3564
3649
|
view.replaceConfirmation.summary.itemCount === 1 ? view.labels.item : view.labels.items,
|
|
@@ -3566,9 +3651,10 @@ function KeepBackup({
|
|
|
3566
3651
|
" ",
|
|
3567
3652
|
view.labels.confirmReplaceDescription
|
|
3568
3653
|
] }),
|
|
3569
|
-
/* @__PURE__ */
|
|
3654
|
+
/* @__PURE__ */ jsx4(
|
|
3570
3655
|
"button",
|
|
3571
3656
|
{
|
|
3657
|
+
ref: confirmButton,
|
|
3572
3658
|
type: "button",
|
|
3573
3659
|
"data-keep-action": "confirm-replace-backup",
|
|
3574
3660
|
disabled: view.isMutating,
|
|
@@ -3576,7 +3662,7 @@ function KeepBackup({
|
|
|
3576
3662
|
children: view.labels.replace
|
|
3577
3663
|
}
|
|
3578
3664
|
),
|
|
3579
|
-
/* @__PURE__ */
|
|
3665
|
+
/* @__PURE__ */ jsx4(
|
|
3580
3666
|
"button",
|
|
3581
3667
|
{
|
|
3582
3668
|
type: "button",
|
|
@@ -3589,7 +3675,7 @@ function KeepBackup({
|
|
|
3589
3675
|
]
|
|
3590
3676
|
}
|
|
3591
3677
|
) : null,
|
|
3592
|
-
view.result ? /* @__PURE__ */
|
|
3678
|
+
view.result ? /* @__PURE__ */ jsxs3("p", { role: "status", children: [
|
|
3593
3679
|
view.result.imported,
|
|
3594
3680
|
" ",
|
|
3595
3681
|
view.labels.importedCount,
|
|
@@ -3598,7 +3684,7 @@ function KeepBackup({
|
|
|
3598
3684
|
" ",
|
|
3599
3685
|
view.labels.failedCount
|
|
3600
3686
|
] }) : null,
|
|
3601
|
-
view.error ? /* @__PURE__ */
|
|
3687
|
+
view.error ? /* @__PURE__ */ jsx4("p", { role: "alert", children: isQuotaError(view.error) ? view.labels.quotaError : getErrorMessage(view.error, "Something went wrong.") }) : null
|
|
3602
3688
|
]
|
|
3603
3689
|
}
|
|
3604
3690
|
);
|
|
@@ -3610,11 +3696,11 @@ function isQuotaError(error) {
|
|
|
3610
3696
|
}
|
|
3611
3697
|
|
|
3612
3698
|
// src/features/actions/KeepBulkActions.tsx
|
|
3613
|
-
import { useRef as
|
|
3699
|
+
import { useRef as useRef6 } from "react";
|
|
3614
3700
|
|
|
3615
3701
|
// src/features/actions/hooks/useKeepBulkActions.ts
|
|
3616
3702
|
import { useKeepCollections as useKeepCollections2, useKeepList, useKeepStore } from "@keepkit/core/react";
|
|
3617
|
-
import { useEffect as
|
|
3703
|
+
import { useEffect as useEffect4, useRef as useRef4, useState as useState3 } from "react";
|
|
3618
3704
|
function isAllSelected(items, selectedIds) {
|
|
3619
3705
|
if (items.length === 0) return false;
|
|
3620
3706
|
const selected = new Set(selectedIds);
|
|
@@ -3645,29 +3731,29 @@ function useKeepBulkActions(options) {
|
|
|
3645
3731
|
const queryList = useKeepList(query ? { ...query, pagination: void 0 } : { pagination: void 0 });
|
|
3646
3732
|
const allList = useKeepList({ pagination: void 0 });
|
|
3647
3733
|
const collections = useKeepCollections2();
|
|
3648
|
-
const [uncontrolledScope, setUncontrolledScope] =
|
|
3734
|
+
const [uncontrolledScope, setUncontrolledScope] = useState3(controlledScope ?? "page");
|
|
3649
3735
|
const selectionScope = controlledScope ?? uncontrolledScope;
|
|
3650
3736
|
const targetItems = selectionScope === "page" ? list.items : selectionScope === "query" ? queryList.items : allList.items;
|
|
3651
|
-
const [uncontrolledSelectedIds, setUncontrolledSelectedIds] =
|
|
3737
|
+
const [uncontrolledSelectedIds, setUncontrolledSelectedIds] = useState3(defaultSelectedIds);
|
|
3652
3738
|
const selectedIds = controlledSelectedIds ?? uncontrolledSelectedIds;
|
|
3653
3739
|
const selected = new Set(selectedIds);
|
|
3654
|
-
const pendingRef =
|
|
3655
|
-
const [pending, setPending] =
|
|
3656
|
-
const [error, setError] =
|
|
3657
|
-
const [tagsInput, setTagsInput] =
|
|
3658
|
-
const [collectionId, setCollectionId] =
|
|
3659
|
-
const [confirmation, setConfirmation] =
|
|
3660
|
-
const confirmationRef =
|
|
3740
|
+
const pendingRef = useRef4(false);
|
|
3741
|
+
const [pending, setPending] = useState3(false);
|
|
3742
|
+
const [error, setError] = useState3(null);
|
|
3743
|
+
const [tagsInput, setTagsInput] = useState3("");
|
|
3744
|
+
const [collectionId, setCollectionId] = useState3("");
|
|
3745
|
+
const [confirmation, setConfirmation] = useState3(null);
|
|
3746
|
+
const confirmationRef = useRef4(null);
|
|
3661
3747
|
const confirmationValid = Boolean(
|
|
3662
3748
|
confirmation && confirmationRef.current === confirmation && confirmation.scope === selectionScope && confirmation.remove === list.removeBatchWithUndo && equalQueryValue(confirmation.ids, selectedIds) && equalQueryValue(confirmation.query, query)
|
|
3663
3749
|
);
|
|
3664
|
-
|
|
3750
|
+
useEffect4(() => {
|
|
3665
3751
|
if (confirmation && !confirmationValid) {
|
|
3666
3752
|
confirmationRef.current = null;
|
|
3667
3753
|
setConfirmation(null);
|
|
3668
3754
|
}
|
|
3669
3755
|
}, [confirmation, confirmationValid]);
|
|
3670
|
-
|
|
3756
|
+
useEffect4(
|
|
3671
3757
|
() => store.subscribe(() => {
|
|
3672
3758
|
if (store.getSnapshot().isHydrated) return;
|
|
3673
3759
|
confirmationRef.current = null;
|
|
@@ -3798,29 +3884,9 @@ function useKeepBulkActions(options) {
|
|
|
3798
3884
|
}
|
|
3799
3885
|
};
|
|
3800
3886
|
}
|
|
3801
|
-
function copyQueryValue(value) {
|
|
3802
|
-
if (value instanceof Date) return new Date(value.getTime());
|
|
3803
|
-
if (Array.isArray(value)) return value.map(copyQueryValue);
|
|
3804
|
-
if (value && typeof value === "object") {
|
|
3805
|
-
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, copyQueryValue(entry)]));
|
|
3806
|
-
}
|
|
3807
|
-
return value;
|
|
3808
|
-
}
|
|
3809
|
-
function equalQueryValue(left, right) {
|
|
3810
|
-
if (Object.is(left, right)) return true;
|
|
3811
|
-
if (left instanceof Date || right instanceof Date) {
|
|
3812
|
-
return left instanceof Date && right instanceof Date && Object.is(left.getTime(), right.getTime());
|
|
3813
|
-
}
|
|
3814
|
-
if (!left || !right || typeof left !== "object" || typeof right !== "object") return false;
|
|
3815
|
-
const leftEntries = Object.entries(left);
|
|
3816
|
-
const rightEntries = Object.entries(right);
|
|
3817
|
-
return leftEntries.length === rightEntries.length && leftEntries.every(
|
|
3818
|
-
([key, value]) => Object.getOwnPropertyDescriptor(right, key) !== void 0 && equalQueryValue(value, Reflect.get(right, key))
|
|
3819
|
-
);
|
|
3820
|
-
}
|
|
3821
3887
|
|
|
3822
3888
|
// src/features/actions/KeepItemCheckbox.tsx
|
|
3823
|
-
import { jsx as
|
|
3889
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
3824
3890
|
function KeepItemCheckbox({
|
|
3825
3891
|
item,
|
|
3826
3892
|
checked = false,
|
|
@@ -3831,7 +3897,7 @@ function KeepItemCheckbox({
|
|
|
3831
3897
|
}) {
|
|
3832
3898
|
const itemLabel = getItemLabel(item) ?? item.id;
|
|
3833
3899
|
const accessibleLabel = ariaLabel ?? (typeof label === "string" ? label : itemLabel);
|
|
3834
|
-
return /* @__PURE__ */
|
|
3900
|
+
return /* @__PURE__ */ jsx5(
|
|
3835
3901
|
"input",
|
|
3836
3902
|
{
|
|
3837
3903
|
...props,
|
|
@@ -3853,8 +3919,8 @@ function getItemLabel(item) {
|
|
|
3853
3919
|
}
|
|
3854
3920
|
|
|
3855
3921
|
// src/features/actions/KeepRemovalConfirmation.tsx
|
|
3856
|
-
import { useEffect as
|
|
3857
|
-
import { jsx as
|
|
3922
|
+
import { useEffect as useEffect5, useRef as useRef5 } from "react";
|
|
3923
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
3858
3924
|
function KeepRemovalConfirmation({
|
|
3859
3925
|
state,
|
|
3860
3926
|
triggerRef
|
|
@@ -3864,18 +3930,18 @@ function KeepRemovalConfirmation({
|
|
|
3864
3930
|
const selected = useUiLabel("selectedCount");
|
|
3865
3931
|
const remove = useUiLabel("deleteSelected");
|
|
3866
3932
|
const cancel = useUiLabel("cancel");
|
|
3867
|
-
const confirmRef =
|
|
3868
|
-
const wasOpen =
|
|
3869
|
-
const wasMutating =
|
|
3933
|
+
const confirmRef = useRef5(null);
|
|
3934
|
+
const wasOpen = useRef5(false);
|
|
3935
|
+
const wasMutating = useRef5(false);
|
|
3870
3936
|
const open = state.removalConfirmation !== null;
|
|
3871
|
-
|
|
3937
|
+
useEffect5(() => {
|
|
3872
3938
|
if (open && (!wasOpen.current || wasMutating.current && !state.isMutating)) confirmRef.current?.focus();
|
|
3873
3939
|
if (!open && wasOpen.current && triggerRef.current?.isConnected) triggerRef.current.focus();
|
|
3874
3940
|
wasOpen.current = open;
|
|
3875
3941
|
wasMutating.current = state.isMutating;
|
|
3876
3942
|
}, [open, state.isMutating, triggerRef]);
|
|
3877
3943
|
if (!state.removalConfirmation) return null;
|
|
3878
|
-
return /* @__PURE__ */
|
|
3944
|
+
return /* @__PURE__ */ jsxs4(
|
|
3879
3945
|
"div",
|
|
3880
3946
|
{
|
|
3881
3947
|
role: "dialog",
|
|
@@ -3889,14 +3955,14 @@ function KeepRemovalConfirmation({
|
|
|
3889
3955
|
state.cancelRemoval();
|
|
3890
3956
|
},
|
|
3891
3957
|
children: [
|
|
3892
|
-
/* @__PURE__ */
|
|
3958
|
+
/* @__PURE__ */ jsxs4("p", { children: [
|
|
3893
3959
|
state.removalConfirmation.count,
|
|
3894
3960
|
" ",
|
|
3895
3961
|
selected,
|
|
3896
3962
|
" \u2014 ",
|
|
3897
3963
|
question
|
|
3898
3964
|
] }),
|
|
3899
|
-
/* @__PURE__ */
|
|
3965
|
+
/* @__PURE__ */ jsx6(
|
|
3900
3966
|
"button",
|
|
3901
3967
|
{
|
|
3902
3968
|
ref: confirmRef,
|
|
@@ -3906,14 +3972,14 @@ function KeepRemovalConfirmation({
|
|
|
3906
3972
|
children: remove
|
|
3907
3973
|
}
|
|
3908
3974
|
),
|
|
3909
|
-
/* @__PURE__ */
|
|
3975
|
+
/* @__PURE__ */ jsx6("button", { type: "button", disabled: state.isMutating, onClick: state.cancelRemoval, children: cancel })
|
|
3910
3976
|
]
|
|
3911
3977
|
}
|
|
3912
3978
|
);
|
|
3913
3979
|
}
|
|
3914
3980
|
|
|
3915
3981
|
// src/features/actions/KeepBulkActions.tsx
|
|
3916
|
-
import { Fragment as Fragment3, jsx as
|
|
3982
|
+
import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3917
3983
|
function KeepBulkActions({
|
|
3918
3984
|
query,
|
|
3919
3985
|
selectedIds: controlledSelectedIds,
|
|
@@ -3938,7 +4004,7 @@ function KeepBulkActions({
|
|
|
3938
4004
|
onSelectionScopeChange,
|
|
3939
4005
|
confirmRemoval
|
|
3940
4006
|
});
|
|
3941
|
-
const removalTrigger =
|
|
4007
|
+
const removalTrigger = useRef6(null);
|
|
3942
4008
|
const showSelectItemsLabel = useUiLabelVisibility("selectItems");
|
|
3943
4009
|
const showSelectionScopeLabel = useUiLabelVisibility("selectionScope");
|
|
3944
4010
|
const showSelectedCountLabel = useUiLabelVisibility("selectedCount");
|
|
@@ -3955,12 +4021,12 @@ function KeepBulkActions({
|
|
|
3955
4021
|
const unarchiveLabel = useUiLabel("unarchiveSelected");
|
|
3956
4022
|
const pinLabel = useUiLabel("pinSelected");
|
|
3957
4023
|
const unpinLabel = useUiLabel("unpinSelected");
|
|
3958
|
-
const body = render ? render(state) : typeof children === "function" ? children(state) : children ?? /* @__PURE__ */
|
|
3959
|
-
/* @__PURE__ */
|
|
3960
|
-
showSelectItemsLabel ? /* @__PURE__ */
|
|
3961
|
-
/* @__PURE__ */
|
|
4024
|
+
const body = render ? render(state) : typeof children === "function" ? children(state) : children ?? /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
4025
|
+
/* @__PURE__ */ jsxs5("fieldset", { "aria-label": showSelectItemsLabel ? void 0 : labels.selectItems, children: [
|
|
4026
|
+
showSelectItemsLabel ? /* @__PURE__ */ jsx7("legend", { children: labels.selectItems }) : null,
|
|
4027
|
+
/* @__PURE__ */ jsxs5("label", { children: [
|
|
3962
4028
|
showSelectionScopeLabel ? labels.selectionScope : null,
|
|
3963
|
-
/* @__PURE__ */
|
|
4029
|
+
/* @__PURE__ */ jsxs5(
|
|
3964
4030
|
"select",
|
|
3965
4031
|
{
|
|
3966
4032
|
"data-keep-action": "select-scope",
|
|
@@ -3968,15 +4034,15 @@ function KeepBulkActions({
|
|
|
3968
4034
|
value: state.selectionScope,
|
|
3969
4035
|
onChange: (event) => state.setSelectionScope(event.currentTarget.value),
|
|
3970
4036
|
children: [
|
|
3971
|
-
/* @__PURE__ */
|
|
3972
|
-
/* @__PURE__ */
|
|
3973
|
-
/* @__PURE__ */
|
|
4037
|
+
/* @__PURE__ */ jsx7("option", { value: "page", children: labels.currentPage }),
|
|
4038
|
+
/* @__PURE__ */ jsx7("option", { value: "query", children: labels.searchResults }),
|
|
4039
|
+
/* @__PURE__ */ jsx7("option", { value: "all", children: labels.allItems })
|
|
3974
4040
|
]
|
|
3975
4041
|
}
|
|
3976
4042
|
)
|
|
3977
4043
|
] }),
|
|
3978
|
-
/* @__PURE__ */
|
|
3979
|
-
/* @__PURE__ */
|
|
4044
|
+
/* @__PURE__ */ jsxs5("label", { children: [
|
|
4045
|
+
/* @__PURE__ */ jsx7(
|
|
3980
4046
|
"input",
|
|
3981
4047
|
{
|
|
3982
4048
|
type: "checkbox",
|
|
@@ -3990,8 +4056,8 @@ function KeepBulkActions({
|
|
|
3990
4056
|
" ",
|
|
3991
4057
|
showSelectedCountLabel ? labels.selectedCount : null
|
|
3992
4058
|
] }),
|
|
3993
|
-
state.items.map((item) => /* @__PURE__ */
|
|
3994
|
-
/* @__PURE__ */
|
|
4059
|
+
state.items.map((item) => /* @__PURE__ */ jsxs5("span", { children: [
|
|
4060
|
+
/* @__PURE__ */ jsx7(
|
|
3995
4061
|
KeepItemCheckbox,
|
|
3996
4062
|
{
|
|
3997
4063
|
item,
|
|
@@ -4002,7 +4068,7 @@ function KeepBulkActions({
|
|
|
4002
4068
|
renderItem ? renderItem(item, selected.has(item.id)) : getMetaTitle(item.meta) ?? item.id
|
|
4003
4069
|
] }, item.id))
|
|
4004
4070
|
] }),
|
|
4005
|
-
/* @__PURE__ */
|
|
4071
|
+
/* @__PURE__ */ jsx7(
|
|
4006
4072
|
"button",
|
|
4007
4073
|
{
|
|
4008
4074
|
ref: removalTrigger,
|
|
@@ -4014,10 +4080,10 @@ function KeepBulkActions({
|
|
|
4014
4080
|
children: showDeleteLabel ? labels.deleteSelected : null
|
|
4015
4081
|
}
|
|
4016
4082
|
),
|
|
4017
|
-
/* @__PURE__ */
|
|
4018
|
-
/* @__PURE__ */
|
|
4083
|
+
/* @__PURE__ */ jsx7(KeepRemovalConfirmation, { state, triggerRef: removalTrigger }),
|
|
4084
|
+
/* @__PURE__ */ jsxs5("label", { children: [
|
|
4019
4085
|
showTagsLabel ? labels.tags : null,
|
|
4020
|
-
/* @__PURE__ */
|
|
4086
|
+
/* @__PURE__ */ jsx7(
|
|
4021
4087
|
"input",
|
|
4022
4088
|
{
|
|
4023
4089
|
"data-keep-action": "edit-tags",
|
|
@@ -4027,7 +4093,7 @@ function KeepBulkActions({
|
|
|
4027
4093
|
}
|
|
4028
4094
|
)
|
|
4029
4095
|
] }),
|
|
4030
|
-
/* @__PURE__ */
|
|
4096
|
+
/* @__PURE__ */ jsx7(
|
|
4031
4097
|
"button",
|
|
4032
4098
|
{
|
|
4033
4099
|
type: "button",
|
|
@@ -4038,7 +4104,7 @@ function KeepBulkActions({
|
|
|
4038
4104
|
children: showApplyTagsLabel ? labels.applyTags : null
|
|
4039
4105
|
}
|
|
4040
4106
|
),
|
|
4041
|
-
/* @__PURE__ */
|
|
4107
|
+
/* @__PURE__ */ jsx7(
|
|
4042
4108
|
"button",
|
|
4043
4109
|
{
|
|
4044
4110
|
type: "button",
|
|
@@ -4049,7 +4115,7 @@ function KeepBulkActions({
|
|
|
4049
4115
|
children: showAddTagsLabel ? labels.addTags : null
|
|
4050
4116
|
}
|
|
4051
4117
|
),
|
|
4052
|
-
/* @__PURE__ */
|
|
4118
|
+
/* @__PURE__ */ jsx7(
|
|
4053
4119
|
"button",
|
|
4054
4120
|
{
|
|
4055
4121
|
type: "button",
|
|
@@ -4060,14 +4126,14 @@ function KeepBulkActions({
|
|
|
4060
4126
|
children: showRemoveTagsLabel ? labels.removeTags : null
|
|
4061
4127
|
}
|
|
4062
4128
|
),
|
|
4063
|
-
/* @__PURE__ */
|
|
4129
|
+
/* @__PURE__ */ jsxs5("label", { children: [
|
|
4064
4130
|
collectionLabel,
|
|
4065
|
-
/* @__PURE__ */
|
|
4066
|
-
/* @__PURE__ */
|
|
4067
|
-
state.collections.map((collection) => /* @__PURE__ */
|
|
4131
|
+
/* @__PURE__ */ jsxs5("select", { value: state.collectionId, onChange: (event) => state.setCollectionId(event.currentTarget.value), children: [
|
|
4132
|
+
/* @__PURE__ */ jsx7("option", { value: "", children: uncategorizedLabel }),
|
|
4133
|
+
state.collections.map((collection) => /* @__PURE__ */ jsx7("option", { value: collection.id, children: collection.name }, collection.id))
|
|
4068
4134
|
] })
|
|
4069
4135
|
] }),
|
|
4070
|
-
/* @__PURE__ */
|
|
4136
|
+
/* @__PURE__ */ jsx7(
|
|
4071
4137
|
"button",
|
|
4072
4138
|
{
|
|
4073
4139
|
type: "button",
|
|
@@ -4076,7 +4142,7 @@ function KeepBulkActions({
|
|
|
4076
4142
|
children: moveLabel
|
|
4077
4143
|
}
|
|
4078
4144
|
),
|
|
4079
|
-
/* @__PURE__ */
|
|
4145
|
+
/* @__PURE__ */ jsx7(
|
|
4080
4146
|
"button",
|
|
4081
4147
|
{
|
|
4082
4148
|
type: "button",
|
|
@@ -4085,7 +4151,7 @@ function KeepBulkActions({
|
|
|
4085
4151
|
children: archiveLabel
|
|
4086
4152
|
}
|
|
4087
4153
|
),
|
|
4088
|
-
/* @__PURE__ */
|
|
4154
|
+
/* @__PURE__ */ jsx7(
|
|
4089
4155
|
"button",
|
|
4090
4156
|
{
|
|
4091
4157
|
type: "button",
|
|
@@ -4094,7 +4160,7 @@ function KeepBulkActions({
|
|
|
4094
4160
|
children: unarchiveLabel
|
|
4095
4161
|
}
|
|
4096
4162
|
),
|
|
4097
|
-
/* @__PURE__ */
|
|
4163
|
+
/* @__PURE__ */ jsx7(
|
|
4098
4164
|
"button",
|
|
4099
4165
|
{
|
|
4100
4166
|
type: "button",
|
|
@@ -4103,7 +4169,7 @@ function KeepBulkActions({
|
|
|
4103
4169
|
children: pinLabel
|
|
4104
4170
|
}
|
|
4105
4171
|
),
|
|
4106
|
-
/* @__PURE__ */
|
|
4172
|
+
/* @__PURE__ */ jsx7(
|
|
4107
4173
|
"button",
|
|
4108
4174
|
{
|
|
4109
4175
|
type: "button",
|
|
@@ -4113,7 +4179,7 @@ function KeepBulkActions({
|
|
|
4113
4179
|
}
|
|
4114
4180
|
)
|
|
4115
4181
|
] });
|
|
4116
|
-
return /* @__PURE__ */
|
|
4182
|
+
return /* @__PURE__ */ jsxs5(
|
|
4117
4183
|
"section",
|
|
4118
4184
|
{
|
|
4119
4185
|
...props,
|
|
@@ -4123,7 +4189,7 @@ function KeepBulkActions({
|
|
|
4123
4189
|
"data-loading": isLoading || state.isMutating ? "true" : void 0,
|
|
4124
4190
|
children: [
|
|
4125
4191
|
body,
|
|
4126
|
-
state.error ? /* @__PURE__ */
|
|
4192
|
+
state.error ? /* @__PURE__ */ jsx7("p", { role: "alert", children: getErrorMessage(state.error, errorLabel) }) : null
|
|
4127
4193
|
]
|
|
4128
4194
|
}
|
|
4129
4195
|
);
|
|
@@ -4133,7 +4199,7 @@ function KeepBulkActions({
|
|
|
4133
4199
|
import {
|
|
4134
4200
|
KeepButton as CoreKeepButton
|
|
4135
4201
|
} from "@keepkit/core/react";
|
|
4136
|
-
import { createElement, useEffect as
|
|
4202
|
+
import { createElement, useEffect as useEffect6, useRef as useRef7 } from "react";
|
|
4137
4203
|
|
|
4138
4204
|
// src/features/actions/hooks/useKeepButton.ts
|
|
4139
4205
|
import { useKeepItem as useKeepItem2 } from "@keepkit/core/react";
|
|
@@ -4156,7 +4222,7 @@ function useKeepButton({ item, labels, icons, children }) {
|
|
|
4156
4222
|
}
|
|
4157
4223
|
|
|
4158
4224
|
// src/features/actions/KeepButton.tsx
|
|
4159
|
-
import { Fragment as Fragment4, jsx as
|
|
4225
|
+
import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
4160
4226
|
function KeepButton({
|
|
4161
4227
|
labels,
|
|
4162
4228
|
icons,
|
|
@@ -4173,8 +4239,8 @@ function KeepButton({
|
|
|
4173
4239
|
const showSavedLabel = useUiLabelVisibility("saved");
|
|
4174
4240
|
const showLoadingLabel = useUiLabelVisibility("loading");
|
|
4175
4241
|
const showErrorLabel = useUiLabelVisibility("error");
|
|
4176
|
-
const pendingToggle =
|
|
4177
|
-
|
|
4242
|
+
const pendingToggle = useRef7(null);
|
|
4243
|
+
useEffect6(() => {
|
|
4178
4244
|
const pending = pendingToggle.current;
|
|
4179
4245
|
if (!pending || view.buttonState.isMutating || pending.wasSaved === view.buttonState.isSaved) return;
|
|
4180
4246
|
pendingToggle.current = null;
|
|
@@ -4207,7 +4273,7 @@ function KeepButton({
|
|
|
4207
4273
|
const showStateLabel = state.error ? showErrorLabel : state.isMutating ? showLoadingLabel : state.isSaved ? showSavedLabel : showSaveLabel;
|
|
4208
4274
|
if (!icons) return showStateLabel ? label : null;
|
|
4209
4275
|
const icon = state.error ? icons.error : state.isMutating ? icons.loading : state.isSaved ? icons.remove ?? icons.saved : icons.save;
|
|
4210
|
-
return /* @__PURE__ */
|
|
4276
|
+
return /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
4211
4277
|
renderIcon(icon, iconClassName),
|
|
4212
4278
|
showLabel && showStateLabel && !iconOnly ? label : null
|
|
4213
4279
|
] });
|
|
@@ -4237,8 +4303,8 @@ function KeepButton({
|
|
|
4237
4303
|
savedAriaLabel: labels?.savedAriaLabel ?? props.savedAriaLabel ?? (props.children === void 0 && !props.asChild && (iconOnly || !showLabel || !showSavedLabel) ? accessibleLabel(removeLabel) : void 0),
|
|
4238
4304
|
unsavedAriaLabel: labels?.unsavedAriaLabel ?? props.unsavedAriaLabel ?? (props.children === void 0 && !props.asChild && (iconOnly || !showLabel || !showSaveLabel) ? accessibleLabel(view.labels.save) : void 0)
|
|
4239
4305
|
};
|
|
4240
|
-
if (!view.customStateLabel) return /* @__PURE__ */
|
|
4241
|
-
return /* @__PURE__ */
|
|
4306
|
+
if (!view.customStateLabel) return /* @__PURE__ */ jsx8(CoreKeepButton, { ...sharedProps });
|
|
4307
|
+
return /* @__PURE__ */ jsx8(CoreKeepButton, { ...sharedProps, children: (state) => /* @__PURE__ */ jsx8(Fragment4, { children: getStateContent(state) }) });
|
|
4242
4308
|
}
|
|
4243
4309
|
function renderIcon(icon, className) {
|
|
4244
4310
|
if (typeof icon === "function") return createElement(icon, { "aria-hidden": true, className });
|
|
@@ -4249,11 +4315,11 @@ function renderIcon(icon, className) {
|
|
|
4249
4315
|
import { useKeepItem as useKeepItem4 } from "@keepkit/core/react";
|
|
4250
4316
|
import {
|
|
4251
4317
|
useCallback as useCallback3,
|
|
4252
|
-
useEffect as
|
|
4253
|
-
useId,
|
|
4318
|
+
useEffect as useEffect8,
|
|
4319
|
+
useId as useId2,
|
|
4254
4320
|
useLayoutEffect,
|
|
4255
|
-
useRef as
|
|
4256
|
-
useState as
|
|
4321
|
+
useRef as useRef9,
|
|
4322
|
+
useState as useState5
|
|
4257
4323
|
} from "react";
|
|
4258
4324
|
import { createPortal } from "react-dom";
|
|
4259
4325
|
|
|
@@ -4263,7 +4329,7 @@ import {
|
|
|
4263
4329
|
isValidElement as isValidElement2,
|
|
4264
4330
|
useContext as useContext3
|
|
4265
4331
|
} from "react";
|
|
4266
|
-
import { jsx as
|
|
4332
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
4267
4333
|
var keepThemeNames = [
|
|
4268
4334
|
"default",
|
|
4269
4335
|
"ocean",
|
|
@@ -4325,8 +4391,8 @@ function KeepThemeProvider({
|
|
|
4325
4391
|
if (!isValidElement2(children))
|
|
4326
4392
|
throw new Error("KeepThemeProvider with asChild requires a single React element child.");
|
|
4327
4393
|
return createSlot(children, rootProps);
|
|
4328
|
-
})() : /* @__PURE__ */
|
|
4329
|
-
return /* @__PURE__ */
|
|
4394
|
+
})() : /* @__PURE__ */ jsx9("div", { ...rootProps, children });
|
|
4395
|
+
return /* @__PURE__ */ jsx9(
|
|
4330
4396
|
KeepThemeContext.Provider,
|
|
4331
4397
|
{
|
|
4332
4398
|
value: { theme, mode, density, radius, accentColor, highContrast, reducedMotion, variables, style },
|
|
@@ -4339,34 +4405,34 @@ function KeepThemeProvider({
|
|
|
4339
4405
|
import { useKeepCollections as useKeepCollections3, useKeepItem as useKeepItem3 } from "@keepkit/core/react";
|
|
4340
4406
|
import {
|
|
4341
4407
|
useCallback as useCallback2,
|
|
4342
|
-
useEffect as
|
|
4343
|
-
useRef as
|
|
4344
|
-
useState as
|
|
4408
|
+
useEffect as useEffect7,
|
|
4409
|
+
useRef as useRef8,
|
|
4410
|
+
useState as useState4
|
|
4345
4411
|
} from "react";
|
|
4346
|
-
import { Fragment as Fragment5, jsx as
|
|
4412
|
+
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
4347
4413
|
function useKeepQuickEditor(item, options = {}) {
|
|
4348
4414
|
const { debounceMs = 300, onSaved, onSaveError } = options;
|
|
4349
4415
|
const itemState = useKeepItem3(item);
|
|
4350
4416
|
const { error, isMutating, moveToCollection, refreshMetadata, updateNote, updateTags } = itemState;
|
|
4351
4417
|
const baseline = itemState.item ?? item;
|
|
4352
4418
|
const initialTitle = getMetaTitle(baseline.meta) ?? "";
|
|
4353
|
-
const [title, setTitle] =
|
|
4354
|
-
const [note, setNote] =
|
|
4355
|
-
const [tags, setTags] =
|
|
4356
|
-
const [collectionId, setCollectionId] =
|
|
4357
|
-
const [saveStatus, setSaveStatus] =
|
|
4358
|
-
const [saveError, setSaveError] =
|
|
4359
|
-
const baselineRef =
|
|
4419
|
+
const [title, setTitle] = useState4(initialTitle);
|
|
4420
|
+
const [note, setNote] = useState4(baseline.note ?? "");
|
|
4421
|
+
const [tags, setTags] = useState4(baseline.tags ?? []);
|
|
4422
|
+
const [collectionId, setCollectionId] = useState4(baseline.collectionId);
|
|
4423
|
+
const [saveStatus, setSaveStatus] = useState4("idle");
|
|
4424
|
+
const [saveError, setSaveError] = useState4(null);
|
|
4425
|
+
const baselineRef = useRef8({
|
|
4360
4426
|
title: initialTitle,
|
|
4361
4427
|
note: baseline.note ?? "",
|
|
4362
4428
|
tags: baseline.tags ?? [],
|
|
4363
4429
|
collectionId: baseline.collectionId
|
|
4364
4430
|
});
|
|
4365
|
-
const draftRef =
|
|
4366
|
-
const flushRequestedRef =
|
|
4367
|
-
const flushPromiseRef =
|
|
4431
|
+
const draftRef = useRef8({ title, note, tags, collectionId });
|
|
4432
|
+
const flushRequestedRef = useRef8(false);
|
|
4433
|
+
const flushPromiseRef = useRef8(null);
|
|
4368
4434
|
draftRef.current = { title, note, tags, collectionId };
|
|
4369
|
-
|
|
4435
|
+
useEffect7(() => {
|
|
4370
4436
|
const nextTitle = getMetaTitle(baseline.meta) ?? "";
|
|
4371
4437
|
if (draftRef.current.title === baselineRef.current.title && draftRef.current.note === baselineRef.current.note && sameTags(draftRef.current.tags, baselineRef.current.tags) && draftRef.current.collectionId === baselineRef.current.collectionId) {
|
|
4372
4438
|
setTitle(nextTitle);
|
|
@@ -4382,7 +4448,7 @@ function useKeepQuickEditor(item, options = {}) {
|
|
|
4382
4448
|
}
|
|
4383
4449
|
}, [baseline]);
|
|
4384
4450
|
const isDirty = title !== baselineRef.current.title || note !== baselineRef.current.note || !sameTags(tags, baselineRef.current.tags) || collectionId !== baselineRef.current.collectionId;
|
|
4385
|
-
|
|
4451
|
+
useEffect7(() => {
|
|
4386
4452
|
if (!isDirty && saveStatus === "dirty" && !flushPromiseRef.current) setSaveStatus("idle");
|
|
4387
4453
|
}, [isDirty, saveStatus]);
|
|
4388
4454
|
const flush = useCallback2(() => {
|
|
@@ -4432,7 +4498,7 @@ function useKeepQuickEditor(item, options = {}) {
|
|
|
4432
4498
|
flushPromiseRef.current = promise;
|
|
4433
4499
|
return promise;
|
|
4434
4500
|
}, [baseline, moveToCollection, onSaveError, onSaved, refreshMetadata, updateNote, updateTags]);
|
|
4435
|
-
|
|
4501
|
+
useEffect7(() => {
|
|
4436
4502
|
if (!isDirty || debounceMs <= 0 || saveStatus === "error") return;
|
|
4437
4503
|
const timer = window.setTimeout(() => void flush().catch(() => void 0), debounceMs);
|
|
4438
4504
|
return () => window.clearTimeout(timer);
|
|
@@ -4481,7 +4547,7 @@ function KeepQuickEditor({
|
|
|
4481
4547
|
...props
|
|
4482
4548
|
}) {
|
|
4483
4549
|
const view = useKeepQuickEditor(item, { debounceMs, onSaved, onSaveError });
|
|
4484
|
-
return /* @__PURE__ */
|
|
4550
|
+
return /* @__PURE__ */ jsx10(KeepQuickEditorView, { ...props, features, state: view.state });
|
|
4485
4551
|
}
|
|
4486
4552
|
var DEFAULT_FEATURES = {
|
|
4487
4553
|
title: false,
|
|
@@ -4503,7 +4569,7 @@ function KeepQuickEditorView({
|
|
|
4503
4569
|
}) {
|
|
4504
4570
|
const enabled = { ...DEFAULT_FEATURES, ...features };
|
|
4505
4571
|
const collections = useKeepCollections3({ targetType: state.item.targetType, orderBy: "name" });
|
|
4506
|
-
const rootRef =
|
|
4572
|
+
const rootRef = useRef8(null);
|
|
4507
4573
|
const titleLabel = useUiLabel("title");
|
|
4508
4574
|
const showTitleLabel = useUiLabelVisibility("title");
|
|
4509
4575
|
const noteLabel = useUiLabel("note");
|
|
@@ -4522,16 +4588,16 @@ function KeepQuickEditorView({
|
|
|
4522
4588
|
const savingLabel = useUiLabel("saving");
|
|
4523
4589
|
const savedLabel = useUiLabel("saved");
|
|
4524
4590
|
const errorLabel = useUiLabel("error");
|
|
4525
|
-
const [tagsInput, setTagsInput] =
|
|
4591
|
+
const [tagsInput, setTagsInput] = useState4(() => formatTags(state.tags));
|
|
4526
4592
|
const submit = (event) => {
|
|
4527
4593
|
event.preventDefault();
|
|
4528
4594
|
void state.flush().catch(() => void 0);
|
|
4529
4595
|
};
|
|
4530
|
-
|
|
4596
|
+
useEffect7(() => {
|
|
4531
4597
|
if (!sameTags(parseTags(tagsInput), state.tags)) setTagsInput(formatTags(state.tags));
|
|
4532
4598
|
}, [state.tags, tagsInput]);
|
|
4533
|
-
const [closeFailed, setCloseFailed] =
|
|
4534
|
-
|
|
4599
|
+
const [closeFailed, setCloseFailed] = useState4(false);
|
|
4600
|
+
useEffect7(() => {
|
|
4535
4601
|
if (!closeFailed || state.saveStatus !== "error") return;
|
|
4536
4602
|
rootRef.current?.querySelector('[role="alert"]')?.focus();
|
|
4537
4603
|
setCloseFailed(false);
|
|
@@ -4550,10 +4616,10 @@ function KeepQuickEditorView({
|
|
|
4550
4616
|
if (event.key === "Tab" && focusScopeRef?.current) trapFocus(event, focusScopeRef.current);
|
|
4551
4617
|
};
|
|
4552
4618
|
const statusMessage = state.saveStatus === "dirty" ? unsavedChangesLabel : state.saveStatus === "saving" ? savingLabel : state.saveStatus === "saved" ? savedLabel : state.saveStatus === "error" ? getErrorMessage(state.error, errorLabel) : null;
|
|
4553
|
-
const body = typeof children === "function" ? children(state) : children ?? /* @__PURE__ */
|
|
4554
|
-
enabled.note ? /* @__PURE__ */
|
|
4555
|
-
showNoteLabel ? /* @__PURE__ */
|
|
4556
|
-
/* @__PURE__ */
|
|
4619
|
+
const body = typeof children === "function" ? children(state) : children ?? /* @__PURE__ */ jsxs7(Fragment5, { children: [
|
|
4620
|
+
enabled.note ? /* @__PURE__ */ jsxs7("label", { "data-keep-field": "note", children: [
|
|
4621
|
+
showNoteLabel ? /* @__PURE__ */ jsx10("span", { "data-keep-field-icon": true, children: noteLabel }) : null,
|
|
4622
|
+
/* @__PURE__ */ jsx10(
|
|
4557
4623
|
"textarea",
|
|
4558
4624
|
{
|
|
4559
4625
|
value: state.note,
|
|
@@ -4562,9 +4628,9 @@ function KeepQuickEditorView({
|
|
|
4562
4628
|
}
|
|
4563
4629
|
)
|
|
4564
4630
|
] }) : null,
|
|
4565
|
-
enabled.title ? /* @__PURE__ */
|
|
4566
|
-
showTitleLabel ? /* @__PURE__ */
|
|
4567
|
-
/* @__PURE__ */
|
|
4631
|
+
enabled.title ? /* @__PURE__ */ jsxs7("label", { "data-keep-field": "title", children: [
|
|
4632
|
+
showTitleLabel ? /* @__PURE__ */ jsx10("span", { "data-keep-field-icon": true, children: titleLabel }) : null,
|
|
4633
|
+
/* @__PURE__ */ jsx10(
|
|
4568
4634
|
"input",
|
|
4569
4635
|
{
|
|
4570
4636
|
value: state.title,
|
|
@@ -4573,9 +4639,9 @@ function KeepQuickEditorView({
|
|
|
4573
4639
|
}
|
|
4574
4640
|
)
|
|
4575
4641
|
] }) : null,
|
|
4576
|
-
enabled.tags ? /* @__PURE__ */
|
|
4577
|
-
showTagsLabel ? /* @__PURE__ */
|
|
4578
|
-
/* @__PURE__ */
|
|
4642
|
+
enabled.tags ? /* @__PURE__ */ jsxs7("label", { "data-keep-field": "tags", children: [
|
|
4643
|
+
showTagsLabel ? /* @__PURE__ */ jsx10("span", { "data-keep-field-icon": true, children: tagsLabel }) : null,
|
|
4644
|
+
/* @__PURE__ */ jsx10(
|
|
4579
4645
|
"input",
|
|
4580
4646
|
{
|
|
4581
4647
|
value: tagsInput,
|
|
@@ -4588,22 +4654,22 @@ function KeepQuickEditorView({
|
|
|
4588
4654
|
}
|
|
4589
4655
|
)
|
|
4590
4656
|
] }) : null,
|
|
4591
|
-
enabled.collection ? /* @__PURE__ */
|
|
4592
|
-
showCollectionLabel ? /* @__PURE__ */
|
|
4593
|
-
/* @__PURE__ */
|
|
4657
|
+
enabled.collection ? /* @__PURE__ */ jsxs7("label", { "data-keep-field": "collection", children: [
|
|
4658
|
+
showCollectionLabel ? /* @__PURE__ */ jsx10("span", { "data-keep-field-icon": true, children: collectionLabel }) : null,
|
|
4659
|
+
/* @__PURE__ */ jsxs7(
|
|
4594
4660
|
"select",
|
|
4595
4661
|
{
|
|
4596
4662
|
value: state.collectionId ?? "",
|
|
4597
4663
|
"aria-label": showCollectionLabel ? void 0 : collectionLabel,
|
|
4598
4664
|
onChange: (event) => state.setCollectionId(event.currentTarget.value || void 0),
|
|
4599
4665
|
children: [
|
|
4600
|
-
/* @__PURE__ */
|
|
4601
|
-
(collectionIds ?? collections.map((collection) => collection.id)).map((id) => /* @__PURE__ */
|
|
4666
|
+
/* @__PURE__ */ jsx10("option", { value: "", children: uncategorizedLabel }),
|
|
4667
|
+
(collectionIds ?? collections.map((collection) => collection.id)).map((id) => /* @__PURE__ */ jsx10("option", { value: id, children: collectionLabels?.[id] ?? collections.find((collection) => collection.id === id)?.name ?? id }, id))
|
|
4602
4668
|
]
|
|
4603
4669
|
}
|
|
4604
4670
|
)
|
|
4605
4671
|
] }) : null,
|
|
4606
|
-
statusMessage ? /* @__PURE__ */
|
|
4672
|
+
statusMessage ? /* @__PURE__ */ jsx10(
|
|
4607
4673
|
"p",
|
|
4608
4674
|
{
|
|
4609
4675
|
role: state.saveStatus === "error" ? "alert" : "status",
|
|
@@ -4614,7 +4680,7 @@ function KeepQuickEditorView({
|
|
|
4614
4680
|
children: statusMessage
|
|
4615
4681
|
}
|
|
4616
4682
|
) : null,
|
|
4617
|
-
showSaveButton || state.saveStatus === "error" ? /* @__PURE__ */
|
|
4683
|
+
showSaveButton || state.saveStatus === "error" ? /* @__PURE__ */ jsx10(
|
|
4618
4684
|
"button",
|
|
4619
4685
|
{
|
|
4620
4686
|
type: "submit",
|
|
@@ -4624,7 +4690,7 @@ function KeepQuickEditorView({
|
|
|
4624
4690
|
children: showSaveLabel ? saveLabel : null
|
|
4625
4691
|
}
|
|
4626
4692
|
) : null,
|
|
4627
|
-
onClose ? /* @__PURE__ */
|
|
4693
|
+
onClose ? /* @__PURE__ */ jsx10(
|
|
4628
4694
|
"button",
|
|
4629
4695
|
{
|
|
4630
4696
|
type: "button",
|
|
@@ -4636,7 +4702,7 @@ function KeepQuickEditorView({
|
|
|
4636
4702
|
}
|
|
4637
4703
|
) : null
|
|
4638
4704
|
] });
|
|
4639
|
-
return /* @__PURE__ */
|
|
4705
|
+
return /* @__PURE__ */ jsx10(
|
|
4640
4706
|
"form",
|
|
4641
4707
|
{
|
|
4642
4708
|
...props,
|
|
@@ -4681,7 +4747,7 @@ function trapFocus(event, root) {
|
|
|
4681
4747
|
}
|
|
4682
4748
|
|
|
4683
4749
|
// src/features/actions/KeepSavePopover.tsx
|
|
4684
|
-
import { jsx as
|
|
4750
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
4685
4751
|
function KeepSavePopover({
|
|
4686
4752
|
item,
|
|
4687
4753
|
open: controlledOpen,
|
|
@@ -4695,14 +4761,14 @@ function KeepSavePopover({
|
|
|
4695
4761
|
...props
|
|
4696
4762
|
}) {
|
|
4697
4763
|
const state = useKeepItem4(item);
|
|
4698
|
-
const [internalOpen, setInternalOpen] =
|
|
4764
|
+
const [internalOpen, setInternalOpen] = useState5(defaultOpen);
|
|
4699
4765
|
const isOpen = controlledOpen ?? internalOpen;
|
|
4700
|
-
const triggerRef =
|
|
4701
|
-
const wasOpenRef =
|
|
4702
|
-
const previousSaved =
|
|
4703
|
-
const initiatedSave =
|
|
4704
|
-
const observedHydration =
|
|
4705
|
-
const panelId =
|
|
4766
|
+
const triggerRef = useRef9(null);
|
|
4767
|
+
const wasOpenRef = useRef9(isOpen);
|
|
4768
|
+
const previousSaved = useRef9(state.isSaved);
|
|
4769
|
+
const initiatedSave = useRef9(false);
|
|
4770
|
+
const observedHydration = useRef9(!state.isLoading);
|
|
4771
|
+
const panelId = useId2();
|
|
4706
4772
|
const titleId = `${panelId}-title`;
|
|
4707
4773
|
const editSavedItemLabel = useUiLabel("editSavedItem");
|
|
4708
4774
|
const { ref: _buttonRef, ...resolvedButtonProps } = buttonProps ?? {};
|
|
@@ -4713,11 +4779,11 @@ function KeepSavePopover({
|
|
|
4713
4779
|
},
|
|
4714
4780
|
[controlledOpen, onOpenChange]
|
|
4715
4781
|
);
|
|
4716
|
-
|
|
4782
|
+
useEffect8(() => {
|
|
4717
4783
|
if (wasOpenRef.current && !isOpen) window.setTimeout(() => triggerRef.current?.focus(), 0);
|
|
4718
4784
|
wasOpenRef.current = isOpen;
|
|
4719
4785
|
}, [isOpen]);
|
|
4720
|
-
|
|
4786
|
+
useEffect8(() => {
|
|
4721
4787
|
if (!observedHydration.current) {
|
|
4722
4788
|
if (state.isLoading) return;
|
|
4723
4789
|
observedHydration.current = true;
|
|
@@ -4730,12 +4796,12 @@ function KeepSavePopover({
|
|
|
4730
4796
|
}
|
|
4731
4797
|
previousSaved.current = state.isSaved;
|
|
4732
4798
|
}, [setOpen, state.isLoading, state.isSaved]);
|
|
4733
|
-
|
|
4799
|
+
useEffect8(() => {
|
|
4734
4800
|
if (isOpen && observedHydration.current && !state.isSaved) setOpen(false);
|
|
4735
4801
|
}, [isOpen, setOpen, state.isSaved]);
|
|
4736
4802
|
const currentItem = state.item;
|
|
4737
|
-
return /* @__PURE__ */
|
|
4738
|
-
/* @__PURE__ */
|
|
4803
|
+
return /* @__PURE__ */ jsxs8("div", { ...props, "data-keepkit": "save-popover", "data-open": isOpen ? "true" : "false", children: [
|
|
4804
|
+
/* @__PURE__ */ jsx11(
|
|
4739
4805
|
KeepButton,
|
|
4740
4806
|
{
|
|
4741
4807
|
...resolvedButtonProps,
|
|
@@ -4755,7 +4821,7 @@ function KeepSavePopover({
|
|
|
4755
4821
|
"aria-controls": panelId
|
|
4756
4822
|
}
|
|
4757
4823
|
),
|
|
4758
|
-
isOpen && currentItem ? /* @__PURE__ */
|
|
4824
|
+
isOpen && currentItem ? /* @__PURE__ */ jsx11(
|
|
4759
4825
|
KeepSavePopoverPanel,
|
|
4760
4826
|
{
|
|
4761
4827
|
id: panelId,
|
|
@@ -4784,19 +4850,22 @@ function KeepSavePopoverPanel({
|
|
|
4784
4850
|
}) {
|
|
4785
4851
|
const { debounceMs, onSaved, onSaveError, ...editorViewProps } = editorProps ?? {};
|
|
4786
4852
|
const { state } = useKeepQuickEditor(item, { debounceMs, onSaved, onSaveError });
|
|
4787
|
-
const panelRef =
|
|
4788
|
-
const closingRef =
|
|
4853
|
+
const panelRef = useRef9(null);
|
|
4854
|
+
const closingRef = useRef9(null);
|
|
4789
4855
|
const closeLabel = useUiLabel("close");
|
|
4790
4856
|
const theme = useKeepTheme();
|
|
4791
|
-
const [position, setPosition] =
|
|
4857
|
+
const [position, setPosition] = useState5({ left: 8, top: 8, width: 320 });
|
|
4858
|
+
const [isMobile, setIsMobile] = useState5(false);
|
|
4792
4859
|
useLayoutEffect(() => {
|
|
4793
4860
|
const place = () => {
|
|
4861
|
+
const mobile = window.matchMedia?.("(max-width: 32rem)").matches ?? window.innerWidth <= 512;
|
|
4862
|
+
setIsMobile(mobile);
|
|
4794
4863
|
const trigger = triggerRef.current?.getBoundingClientRect();
|
|
4795
4864
|
const panel = panelRef.current;
|
|
4796
4865
|
if (!trigger || !panel) return;
|
|
4797
4866
|
const width = Math.min(Math.max(trigger.width, 320), window.innerWidth - 16);
|
|
4798
4867
|
const left = Math.max(8, Math.min(trigger.left, window.innerWidth - width - 8));
|
|
4799
|
-
panel.style.width = `${width}px`;
|
|
4868
|
+
panel.style.width = mobile ? "100%" : `${width}px`;
|
|
4800
4869
|
const height = panel.getBoundingClientRect().height;
|
|
4801
4870
|
const below = trigger.bottom + 8;
|
|
4802
4871
|
const top = Math.max(
|
|
@@ -4826,13 +4895,13 @@ function KeepSavePopoverPanel({
|
|
|
4826
4895
|
closingRef.current = promise;
|
|
4827
4896
|
return promise;
|
|
4828
4897
|
}, [onClose, state]);
|
|
4829
|
-
|
|
4898
|
+
useEffect8(() => {
|
|
4830
4899
|
const frame = window.requestAnimationFrame(() => {
|
|
4831
4900
|
panelRef.current?.querySelector('[data-keepkit="quick-editor"] :is(textarea, input, select, button)')?.focus();
|
|
4832
4901
|
});
|
|
4833
4902
|
return () => window.cancelAnimationFrame(frame);
|
|
4834
4903
|
}, []);
|
|
4835
|
-
|
|
4904
|
+
useEffect8(() => {
|
|
4836
4905
|
const closeFromOutside = (event) => {
|
|
4837
4906
|
const target = event.target;
|
|
4838
4907
|
if (!(target instanceof Node) || panelRef.current?.contains(target) || triggerRef.current?.contains(target))
|
|
@@ -4844,19 +4913,19 @@ function KeepSavePopoverPanel({
|
|
|
4844
4913
|
}, [requestClose, triggerRef]);
|
|
4845
4914
|
if (typeof document === "undefined") return null;
|
|
4846
4915
|
return createPortal(
|
|
4847
|
-
/* @__PURE__ */
|
|
4916
|
+
/* @__PURE__ */ jsx11(KeepThemeProvider, { ...theme, children: /* @__PURE__ */ jsxs8(
|
|
4848
4917
|
"div",
|
|
4849
4918
|
{
|
|
4850
4919
|
ref: panelRef,
|
|
4851
4920
|
style: {
|
|
4852
4921
|
position: "fixed",
|
|
4853
4922
|
boxSizing: "border-box",
|
|
4854
|
-
left: position.left,
|
|
4855
|
-
top: position.top,
|
|
4856
|
-
width: position.width,
|
|
4857
|
-
right: "auto",
|
|
4858
|
-
bottom: "auto",
|
|
4859
|
-
maxHeight: "calc(100dvh - 16px)",
|
|
4923
|
+
left: isMobile ? 0 : position.left,
|
|
4924
|
+
top: isMobile ? "auto" : position.top,
|
|
4925
|
+
width: isMobile ? "100%" : position.width,
|
|
4926
|
+
right: isMobile ? 0 : "auto",
|
|
4927
|
+
bottom: isMobile ? 0 : "auto",
|
|
4928
|
+
maxHeight: isMobile ? "min(85dvh, 40rem)" : "calc(100dvh - 16px)",
|
|
4860
4929
|
overflowY: "auto"
|
|
4861
4930
|
},
|
|
4862
4931
|
id,
|
|
@@ -4871,10 +4940,10 @@ function KeepSavePopoverPanel({
|
|
|
4871
4940
|
void requestClose();
|
|
4872
4941
|
},
|
|
4873
4942
|
children: [
|
|
4874
|
-
/* @__PURE__ */
|
|
4943
|
+
/* @__PURE__ */ jsx11("h2", { id: titleId, "data-keep-popover-title": "true", children: dialogLabel }),
|
|
4875
4944
|
children,
|
|
4876
|
-
/* @__PURE__ */
|
|
4877
|
-
/* @__PURE__ */
|
|
4945
|
+
/* @__PURE__ */ jsx11(KeepQuickEditorView, { ...editorViewProps, state, focusScopeRef: panelRef }),
|
|
4946
|
+
/* @__PURE__ */ jsx11(
|
|
4878
4947
|
"button",
|
|
4879
4948
|
{
|
|
4880
4949
|
type: "button",
|
|
@@ -4891,16 +4960,20 @@ function KeepSavePopoverPanel({
|
|
|
4891
4960
|
);
|
|
4892
4961
|
}
|
|
4893
4962
|
|
|
4963
|
+
// src/features/actions/KeepUndo.tsx
|
|
4964
|
+
import { useRef as useRef10, useState as useState7 } from "react";
|
|
4965
|
+
|
|
4894
4966
|
// src/features/actions/hooks/useKeepUndo.ts
|
|
4895
|
-
import { useKeepContext as
|
|
4896
|
-
import { useEffect as
|
|
4967
|
+
import { useKeepContext as useKeepContext3, useKeepStore as useKeepStore2 } from "@keepkit/core/react";
|
|
4968
|
+
import { useEffect as useEffect9, useState as useState6 } from "react";
|
|
4897
4969
|
function useKeepUndo() {
|
|
4898
|
-
const context =
|
|
4970
|
+
const context = useKeepContext3();
|
|
4971
|
+
const { store } = useKeepStore2();
|
|
4899
4972
|
const emitFeedback = useKeepUiFeedback();
|
|
4900
4973
|
const restoredMessage = useUiLabel("restoredMessage");
|
|
4901
4974
|
const { canUndo, startedAt, expiresAt } = context.undo;
|
|
4902
|
-
const [now, setNow] =
|
|
4903
|
-
|
|
4975
|
+
const [now, setNow] = useState6(() => Date.now());
|
|
4976
|
+
useEffect9(() => {
|
|
4904
4977
|
if (!canUndo || expiresAt === void 0) return;
|
|
4905
4978
|
setNow(Date.now());
|
|
4906
4979
|
const timer = setInterval(() => setNow(Date.now()), 250);
|
|
@@ -4917,9 +4990,12 @@ function useKeepUndo() {
|
|
|
4917
4990
|
remainingSeconds,
|
|
4918
4991
|
progress,
|
|
4919
4992
|
undo: async () => {
|
|
4920
|
-
const
|
|
4993
|
+
const before = store.getSnapshot().lastChange;
|
|
4994
|
+
const ids = context.undo.ids;
|
|
4921
4995
|
await context.undoLastRemoval();
|
|
4922
|
-
|
|
4996
|
+
const change = store.getSnapshot().lastChange;
|
|
4997
|
+
const items = change?.action === "undo" && change !== before ? change.items ?? [] : [];
|
|
4998
|
+
if (items.length > 0 && items.length === ids.length && items.every((item) => ids.includes(item.id))) {
|
|
4923
4999
|
emitFeedback({ type: "item-restored", item: items[0], items, message: restoredMessage });
|
|
4924
5000
|
}
|
|
4925
5001
|
},
|
|
@@ -4929,50 +5005,72 @@ function useKeepUndo() {
|
|
|
4929
5005
|
}
|
|
4930
5006
|
|
|
4931
5007
|
// src/features/actions/KeepUndo.tsx
|
|
4932
|
-
import { jsx as
|
|
5008
|
+
import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4933
5009
|
function KeepUndo({ children, label, ...props }) {
|
|
4934
5010
|
const view = useKeepUndo();
|
|
4935
5011
|
const showLabel = useUiLabelVisibility("undo");
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
}
|
|
4962
|
-
|
|
5012
|
+
const errorLabel = useUiLabel("error");
|
|
5013
|
+
const [error, setError] = useState7();
|
|
5014
|
+
const [pending, setPending] = useState7(false);
|
|
5015
|
+
const pendingRef = useRef10(false);
|
|
5016
|
+
if (!view.canUndo && !pending && !error) return null;
|
|
5017
|
+
async function undo() {
|
|
5018
|
+
if (pendingRef.current) return;
|
|
5019
|
+
pendingRef.current = true;
|
|
5020
|
+
setError(void 0);
|
|
5021
|
+
setPending(true);
|
|
5022
|
+
try {
|
|
5023
|
+
await view.undo();
|
|
5024
|
+
} catch (cause) {
|
|
5025
|
+
setError(cause);
|
|
5026
|
+
} finally {
|
|
5027
|
+
pendingRef.current = false;
|
|
5028
|
+
setPending(false);
|
|
5029
|
+
}
|
|
5030
|
+
}
|
|
5031
|
+
return /* @__PURE__ */ jsxs9("div", { ...props, role: "status", "aria-live": "polite", "data-keepkit": "undo", "data-state": error ? "error" : "available", children: [
|
|
5032
|
+
view.canUndo || pending ? /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
|
5033
|
+
/* @__PURE__ */ jsx12("span", { "data-keepkit": "undo-message", children: children ?? view.message }),
|
|
5034
|
+
/* @__PURE__ */ jsxs9("span", { "data-keepkit": "undo-countdown", "aria-hidden": "true", children: [
|
|
5035
|
+
view.remainingSeconds,
|
|
5036
|
+
"s"
|
|
5037
|
+
] }),
|
|
5038
|
+
/* @__PURE__ */ jsx12(
|
|
5039
|
+
"progress",
|
|
5040
|
+
{
|
|
5041
|
+
"data-keepkit": "undo-progress",
|
|
5042
|
+
max: 1,
|
|
5043
|
+
value: view.progress,
|
|
5044
|
+
"aria-label": String(view.label),
|
|
5045
|
+
"aria-valuetext": `${view.remainingSeconds}s`
|
|
5046
|
+
}
|
|
5047
|
+
),
|
|
5048
|
+
/* @__PURE__ */ jsx12(
|
|
5049
|
+
"button",
|
|
5050
|
+
{
|
|
5051
|
+
type: "button",
|
|
5052
|
+
"data-keep-action": "undo",
|
|
5053
|
+
"aria-label": showLabel ? void 0 : view.label,
|
|
5054
|
+
disabled: pending,
|
|
5055
|
+
onClick: () => void undo(),
|
|
5056
|
+
children: showLabel ? label ?? view.label : null
|
|
5057
|
+
}
|
|
5058
|
+
)
|
|
5059
|
+
] }) : null,
|
|
5060
|
+
error ? /* @__PURE__ */ jsx12("p", { role: "alert", children: getErrorMessage(error, errorLabel) }) : null
|
|
4963
5061
|
] });
|
|
4964
5062
|
}
|
|
4965
5063
|
|
|
4966
5064
|
// src/features/collection/KeepCollection.tsx
|
|
4967
5065
|
import { KeepErrorBoundary as KeepErrorBoundary2 } from "@keepkit/core/react";
|
|
4968
|
-
import { useEffect as
|
|
5066
|
+
import { useEffect as useEffect16, useId as useId5, useRef as useRef16, useState as useState21 } from "react";
|
|
4969
5067
|
|
|
4970
5068
|
// src/features/query/KeepActiveFiltersSummary.tsx
|
|
4971
5069
|
import {
|
|
4972
5070
|
isValidElement as isValidElement3,
|
|
4973
|
-
useRef as
|
|
5071
|
+
useRef as useRef11
|
|
4974
5072
|
} from "react";
|
|
4975
|
-
import { Fragment as
|
|
5073
|
+
import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4976
5074
|
function KeepActiveFiltersSummary({
|
|
4977
5075
|
query,
|
|
4978
5076
|
search: providedSearch,
|
|
@@ -5041,7 +5139,7 @@ function KeepActiveFiltersSummary({
|
|
|
5041
5139
|
all: useUiLabel("archiveScopeAll")
|
|
5042
5140
|
};
|
|
5043
5141
|
const resolvedArchiveScopeLabel = providedArchiveScopeLabel ?? (archiveScope === void 0 ? void 0 : archiveLabels[archiveScope]);
|
|
5044
|
-
const chipRefs =
|
|
5142
|
+
const chipRefs = useRef11([]);
|
|
5045
5143
|
const collectionIndex = Number(Boolean(search)) + tags.length;
|
|
5046
5144
|
const organizationIndex = collectionIndex + Number(Boolean(collection));
|
|
5047
5145
|
const activityIndex = organizationIndex + organizationFilters.length;
|
|
@@ -5130,12 +5228,12 @@ function KeepActiveFiltersSummary({
|
|
|
5130
5228
|
reset: () => onReset?.()
|
|
5131
5229
|
};
|
|
5132
5230
|
const contentChildren = asChild && isElement(children) ? void 0 : children;
|
|
5133
|
-
const body = typeof contentChildren === "function" ? contentChildren(state) : contentChildren ?? (hasFilters || canReset ? /* @__PURE__ */
|
|
5134
|
-
showActiveFiltersLabel ? /* @__PURE__ */
|
|
5135
|
-
/* @__PURE__ */
|
|
5136
|
-
search ? /* @__PURE__ */
|
|
5137
|
-
/* @__PURE__ */
|
|
5138
|
-
/* @__PURE__ */
|
|
5231
|
+
const body = typeof contentChildren === "function" ? contentChildren(state) : contentChildren ?? (hasFilters || canReset ? /* @__PURE__ */ jsxs10(Fragment7, { children: [
|
|
5232
|
+
showActiveFiltersLabel ? /* @__PURE__ */ jsx13("span", { "data-active-filters-label": "true", children: activeFiltersLabel }) : null,
|
|
5233
|
+
/* @__PURE__ */ jsxs10("ul", { "data-active-filters-list": "true", children: [
|
|
5234
|
+
search ? /* @__PURE__ */ jsxs10("li", { "data-filter-kind": "search", children: [
|
|
5235
|
+
/* @__PURE__ */ jsx13("span", { "data-filter-value": "true", children: search }),
|
|
5236
|
+
/* @__PURE__ */ jsx13(
|
|
5139
5237
|
"button",
|
|
5140
5238
|
{
|
|
5141
5239
|
type: "button",
|
|
@@ -5150,9 +5248,9 @@ function KeepActiveFiltersSummary({
|
|
|
5150
5248
|
}
|
|
5151
5249
|
)
|
|
5152
5250
|
] }) : null,
|
|
5153
|
-
tags.map((tag, tagIndex) => /* @__PURE__ */
|
|
5154
|
-
/* @__PURE__ */
|
|
5155
|
-
/* @__PURE__ */
|
|
5251
|
+
tags.map((tag, tagIndex) => /* @__PURE__ */ jsxs10("li", { "data-filter-kind": "tag", children: [
|
|
5252
|
+
/* @__PURE__ */ jsx13("span", { "data-filter-value": "true", children: tag }),
|
|
5253
|
+
/* @__PURE__ */ jsx13(
|
|
5156
5254
|
"button",
|
|
5157
5255
|
{
|
|
5158
5256
|
type: "button",
|
|
@@ -5167,9 +5265,9 @@ function KeepActiveFiltersSummary({
|
|
|
5167
5265
|
}
|
|
5168
5266
|
)
|
|
5169
5267
|
] }, tag)),
|
|
5170
|
-
collection && collectionLabel ? /* @__PURE__ */
|
|
5171
|
-
/* @__PURE__ */
|
|
5172
|
-
/* @__PURE__ */
|
|
5268
|
+
collection && collectionLabel ? /* @__PURE__ */ jsxs10("li", { "data-filter-kind": "collection", children: [
|
|
5269
|
+
/* @__PURE__ */ jsx13("span", { "data-filter-value": "true", children: collectionLabel }),
|
|
5270
|
+
/* @__PURE__ */ jsx13(
|
|
5173
5271
|
"button",
|
|
5174
5272
|
{
|
|
5175
5273
|
type: "button",
|
|
@@ -5187,9 +5285,9 @@ function KeepActiveFiltersSummary({
|
|
|
5187
5285
|
organizationFilters.map(({ field, value }, filterIndex) => {
|
|
5188
5286
|
const index = organizationIndex + filterIndex;
|
|
5189
5287
|
const label = `${field}: ${value}`;
|
|
5190
|
-
return /* @__PURE__ */
|
|
5191
|
-
/* @__PURE__ */
|
|
5192
|
-
/* @__PURE__ */
|
|
5288
|
+
return /* @__PURE__ */ jsxs10("li", { "data-filter-kind": `organization-${field}`, children: [
|
|
5289
|
+
/* @__PURE__ */ jsx13("span", { "data-filter-value": "true", children: label }),
|
|
5290
|
+
/* @__PURE__ */ jsx13(
|
|
5193
5291
|
"button",
|
|
5194
5292
|
{
|
|
5195
5293
|
type: "button",
|
|
@@ -5207,9 +5305,9 @@ function KeepActiveFiltersSummary({
|
|
|
5207
5305
|
}),
|
|
5208
5306
|
activityFilters.map((filter, filterIndex) => {
|
|
5209
5307
|
const index = activityIndex + filterIndex;
|
|
5210
|
-
return /* @__PURE__ */
|
|
5211
|
-
/* @__PURE__ */
|
|
5212
|
-
/* @__PURE__ */
|
|
5308
|
+
return /* @__PURE__ */ jsxs10("li", { "data-filter-kind": `activity-${filter.key}`, children: [
|
|
5309
|
+
/* @__PURE__ */ jsx13("span", { "data-filter-value": "true", children: filter.label }),
|
|
5310
|
+
/* @__PURE__ */ jsx13(
|
|
5213
5311
|
"button",
|
|
5214
5312
|
{
|
|
5215
5313
|
type: "button",
|
|
@@ -5225,9 +5323,9 @@ function KeepActiveFiltersSummary({
|
|
|
5225
5323
|
)
|
|
5226
5324
|
] }, filter.key);
|
|
5227
5325
|
}),
|
|
5228
|
-
savedBetweenLabel ? /* @__PURE__ */
|
|
5229
|
-
/* @__PURE__ */
|
|
5230
|
-
/* @__PURE__ */
|
|
5326
|
+
savedBetweenLabel ? /* @__PURE__ */ jsxs10("li", { "data-filter-kind": "saved-between", children: [
|
|
5327
|
+
/* @__PURE__ */ jsx13("span", { "data-filter-value": "true", children: savedBetweenLabel }),
|
|
5328
|
+
/* @__PURE__ */ jsx13(
|
|
5231
5329
|
"button",
|
|
5232
5330
|
{
|
|
5233
5331
|
type: "button",
|
|
@@ -5242,9 +5340,9 @@ function KeepActiveFiltersSummary({
|
|
|
5242
5340
|
}
|
|
5243
5341
|
)
|
|
5244
5342
|
] }) : null,
|
|
5245
|
-
hasArchiveScope && resolvedArchiveScopeLabel ? /* @__PURE__ */
|
|
5246
|
-
/* @__PURE__ */
|
|
5247
|
-
/* @__PURE__ */
|
|
5343
|
+
hasArchiveScope && resolvedArchiveScopeLabel ? /* @__PURE__ */ jsxs10("li", { "data-filter-kind": "archive-scope", children: [
|
|
5344
|
+
/* @__PURE__ */ jsx13("span", { "data-filter-value": "true", children: resolvedArchiveScopeLabel }),
|
|
5345
|
+
/* @__PURE__ */ jsx13(
|
|
5248
5346
|
"button",
|
|
5249
5347
|
{
|
|
5250
5348
|
type: "button",
|
|
@@ -5260,13 +5358,13 @@ function KeepActiveFiltersSummary({
|
|
|
5260
5358
|
)
|
|
5261
5359
|
] }) : null
|
|
5262
5360
|
] }),
|
|
5263
|
-
totalCount !== void 0 ? /* @__PURE__ */
|
|
5361
|
+
totalCount !== void 0 ? /* @__PURE__ */ jsxs10("span", { "data-filter-count": "true", children: [
|
|
5264
5362
|
totalCount,
|
|
5265
5363
|
" ",
|
|
5266
5364
|
totalCount === 1 ? collectionItemLabel : collectionItemsLabel
|
|
5267
5365
|
] }) : null,
|
|
5268
|
-
hasFilters ? /* @__PURE__ */
|
|
5269
|
-
canReset ? /* @__PURE__ */
|
|
5366
|
+
hasFilters ? /* @__PURE__ */ jsx13("button", { type: "button", "data-keep-action": "clear-filters", onClick: state.clear, children: clearAllLabel || clearLabel }) : null,
|
|
5367
|
+
canReset ? /* @__PURE__ */ jsx13("button", { type: "button", "data-keep-action": "reset-filters", onClick: state.reset, children: resetLabel }) : null
|
|
5270
5368
|
] }) : null);
|
|
5271
5369
|
if (!hasFilters && !canReset && !asChild && contentChildren === void 0) return null;
|
|
5272
5370
|
return renderRoot(
|
|
@@ -5343,8 +5441,8 @@ function focusFilterFallback(scope) {
|
|
|
5343
5441
|
}
|
|
5344
5442
|
|
|
5345
5443
|
// src/features/query/KeepArchiveScopeSelect.tsx
|
|
5346
|
-
import { useState as
|
|
5347
|
-
import { jsx as
|
|
5444
|
+
import { useState as useState8 } from "react";
|
|
5445
|
+
import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5348
5446
|
function KeepArchiveScopeSelect({
|
|
5349
5447
|
value: controlledValue,
|
|
5350
5448
|
defaultValue = "active",
|
|
@@ -5352,7 +5450,7 @@ function KeepArchiveScopeSelect({
|
|
|
5352
5450
|
"aria-label": ariaLabel,
|
|
5353
5451
|
...props
|
|
5354
5452
|
}) {
|
|
5355
|
-
const [internalValue, setInternalValue] =
|
|
5453
|
+
const [internalValue, setInternalValue] = useState8(controlledValue ?? defaultValue);
|
|
5356
5454
|
const value = controlledValue ?? internalValue;
|
|
5357
5455
|
const label = useUiLabel("archiveScope");
|
|
5358
5456
|
const activeLabel = useUiLabel("archiveScopeActive");
|
|
@@ -5363,9 +5461,9 @@ function KeepArchiveScopeSelect({
|
|
|
5363
5461
|
if (controlledValue === void 0) setInternalValue(next);
|
|
5364
5462
|
onValueChange?.(next);
|
|
5365
5463
|
};
|
|
5366
|
-
return /* @__PURE__ */
|
|
5367
|
-
/* @__PURE__ */
|
|
5368
|
-
/* @__PURE__ */
|
|
5464
|
+
return /* @__PURE__ */ jsxs11("label", { "data-keepkit": "archive-scope", children: [
|
|
5465
|
+
/* @__PURE__ */ jsx14("span", { children: label }),
|
|
5466
|
+
/* @__PURE__ */ jsxs11(
|
|
5369
5467
|
"select",
|
|
5370
5468
|
{
|
|
5371
5469
|
...props,
|
|
@@ -5374,9 +5472,9 @@ function KeepArchiveScopeSelect({
|
|
|
5374
5472
|
"data-keep-action": "archive-scope",
|
|
5375
5473
|
onChange: (event) => handleChange(event.currentTarget.value),
|
|
5376
5474
|
children: [
|
|
5377
|
-
/* @__PURE__ */
|
|
5378
|
-
/* @__PURE__ */
|
|
5379
|
-
/* @__PURE__ */
|
|
5475
|
+
/* @__PURE__ */ jsx14("option", { value: "active", children: activeLabel }),
|
|
5476
|
+
/* @__PURE__ */ jsx14("option", { value: "archived", children: archivedLabel }),
|
|
5477
|
+
/* @__PURE__ */ jsx14("option", { value: "all", children: allLabel })
|
|
5380
5478
|
]
|
|
5381
5479
|
}
|
|
5382
5480
|
)
|
|
@@ -5384,9 +5482,9 @@ function KeepArchiveScopeSelect({
|
|
|
5384
5482
|
}
|
|
5385
5483
|
|
|
5386
5484
|
// src/features/query/KeepCollectionFilter.tsx
|
|
5387
|
-
import { useKeepCollections as useKeepCollections4, useKeepContext as
|
|
5388
|
-
import { useState as
|
|
5389
|
-
import { jsx as
|
|
5485
|
+
import { useKeepCollections as useKeepCollections4, useKeepContext as useKeepContext4 } from "@keepkit/core/react";
|
|
5486
|
+
import { useState as useState9 } from "react";
|
|
5487
|
+
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5390
5488
|
function useCollectionOptions(collectionLabels, collections) {
|
|
5391
5489
|
return collections.map((collection) => ({
|
|
5392
5490
|
id: collection.id,
|
|
@@ -5403,8 +5501,8 @@ function KeepCollectionSelect({
|
|
|
5403
5501
|
uncategorizedLabel,
|
|
5404
5502
|
...props
|
|
5405
5503
|
}) {
|
|
5406
|
-
const context =
|
|
5407
|
-
const state =
|
|
5504
|
+
const context = useKeepContext4();
|
|
5505
|
+
const state = useState9(value ?? defaultValue ?? item.collectionId ?? "");
|
|
5408
5506
|
const selected = value ?? state[0];
|
|
5409
5507
|
const collections = useKeepCollections4({ targetType: item.targetType, orderBy: "name" });
|
|
5410
5508
|
const options = useCollectionOptions(collectionLabels, collections);
|
|
@@ -5417,7 +5515,7 @@ function KeepCollectionSelect({
|
|
|
5417
5515
|
onChange?.(resolved);
|
|
5418
5516
|
void context.moveToCollection(item.id, resolved);
|
|
5419
5517
|
};
|
|
5420
|
-
return /* @__PURE__ */
|
|
5518
|
+
return /* @__PURE__ */ jsxs12(
|
|
5421
5519
|
"select",
|
|
5422
5520
|
{
|
|
5423
5521
|
...props,
|
|
@@ -5425,8 +5523,8 @@ function KeepCollectionSelect({
|
|
|
5425
5523
|
onChange: (event) => handleChange(event.currentTarget.value),
|
|
5426
5524
|
"data-keep-action": "move-collection",
|
|
5427
5525
|
children: [
|
|
5428
|
-
/* @__PURE__ */
|
|
5429
|
-
options.map((option) => /* @__PURE__ */
|
|
5526
|
+
/* @__PURE__ */ jsx15("option", { value: "", children: uncategorized }),
|
|
5527
|
+
options.map((option) => /* @__PURE__ */ jsx15("option", { value: option.id, children: option.label }, option.id))
|
|
5430
5528
|
]
|
|
5431
5529
|
}
|
|
5432
5530
|
);
|
|
@@ -5441,7 +5539,7 @@ function KeepCollectionFilter({
|
|
|
5441
5539
|
uncategorizedLabel,
|
|
5442
5540
|
...props
|
|
5443
5541
|
}) {
|
|
5444
|
-
const [internalValue, setInternalValue] =
|
|
5542
|
+
const [internalValue, setInternalValue] = useState9(value ?? defaultValue ?? "");
|
|
5445
5543
|
const selected = value ?? internalValue;
|
|
5446
5544
|
const collections = useKeepCollections4({ orderBy: "name" });
|
|
5447
5545
|
const options = useCollectionOptions(collectionLabels, collections);
|
|
@@ -5457,9 +5555,9 @@ function KeepCollectionFilter({
|
|
|
5457
5555
|
onValueChange?.(resolved);
|
|
5458
5556
|
onChange?.(resolved);
|
|
5459
5557
|
};
|
|
5460
|
-
return /* @__PURE__ */
|
|
5461
|
-
showCollectionLabel ? /* @__PURE__ */
|
|
5462
|
-
/* @__PURE__ */
|
|
5558
|
+
return /* @__PURE__ */ jsxs12("label", { "data-keepkit": "collection-filter", children: [
|
|
5559
|
+
showCollectionLabel ? /* @__PURE__ */ jsx15("span", { children: collectionLabel }) : null,
|
|
5560
|
+
/* @__PURE__ */ jsxs12(
|
|
5463
5561
|
"select",
|
|
5464
5562
|
{
|
|
5465
5563
|
...props,
|
|
@@ -5468,9 +5566,9 @@ function KeepCollectionFilter({
|
|
|
5468
5566
|
onChange: (event) => handleChange(event.currentTarget.value),
|
|
5469
5567
|
"data-keep-action": "filter-collection",
|
|
5470
5568
|
children: [
|
|
5471
|
-
/* @__PURE__ */
|
|
5472
|
-
/* @__PURE__ */
|
|
5473
|
-
options.map((option) => /* @__PURE__ */
|
|
5569
|
+
/* @__PURE__ */ jsx15("option", { value: "", children: all }),
|
|
5570
|
+
/* @__PURE__ */ jsx15("option", { value: "__uncategorized__", children: uncategorized }),
|
|
5571
|
+
options.map((option) => /* @__PURE__ */ jsx15("option", { value: option.id, children: option.label }, option.id))
|
|
5474
5572
|
]
|
|
5475
5573
|
}
|
|
5476
5574
|
)
|
|
@@ -5482,7 +5580,7 @@ import { isValidElement as isValidElement4 } from "react";
|
|
|
5482
5580
|
|
|
5483
5581
|
// src/features/query/hooks/useKeepTagFilter.ts
|
|
5484
5582
|
import { useKeepList as useKeepList2 } from "@keepkit/core/react";
|
|
5485
|
-
import { useCallback as useCallback4, useMemo as useMemo3, useState as
|
|
5583
|
+
import { useCallback as useCallback4, useMemo as useMemo3, useState as useState10 } from "react";
|
|
5486
5584
|
function useKeepTagFilter(options) {
|
|
5487
5585
|
const {
|
|
5488
5586
|
query,
|
|
@@ -5494,7 +5592,7 @@ function useKeepTagFilter(options) {
|
|
|
5494
5592
|
onValueChange,
|
|
5495
5593
|
onValuesChange
|
|
5496
5594
|
} = options;
|
|
5497
|
-
const [uncontrolledValues, setUncontrolledValues] =
|
|
5595
|
+
const [uncontrolledValues, setUncontrolledValues] = useState10(
|
|
5498
5596
|
() => defaultValues ? normalizeUiTags(defaultValues) : defaultValue ? [defaultValue] : []
|
|
5499
5597
|
);
|
|
5500
5598
|
const resolvedValues = useMemo3(
|
|
@@ -5550,7 +5648,7 @@ function useKeepTagFilter(options) {
|
|
|
5550
5648
|
}
|
|
5551
5649
|
|
|
5552
5650
|
// src/features/query/KeepTagFilter.tsx
|
|
5553
|
-
import { jsx as
|
|
5651
|
+
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5554
5652
|
function KeepTagFilter({
|
|
5555
5653
|
query,
|
|
5556
5654
|
value: controlledValue,
|
|
@@ -5583,9 +5681,9 @@ function KeepTagFilter({
|
|
|
5583
5681
|
const showAllTagsLabel = useUiLabelVisibility("allTags");
|
|
5584
5682
|
const isMulti = controlledValues !== void 0 || defaultValues !== void 0 || onValuesChange !== void 0;
|
|
5585
5683
|
const contentChildren = asChild && isValidElement4(children) ? void 0 : children;
|
|
5586
|
-
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */
|
|
5587
|
-
showFilterLabel ? /* @__PURE__ */
|
|
5588
|
-
/* @__PURE__ */
|
|
5684
|
+
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */ jsxs13("fieldset", { "aria-label": showFilterLabel ? void 0 : ariaLabel ?? view.labels.aria, children: [
|
|
5685
|
+
showFilterLabel ? /* @__PURE__ */ jsx16("legend", { children: ariaLabel ?? view.labels.aria }) : null,
|
|
5686
|
+
/* @__PURE__ */ jsx16(
|
|
5589
5687
|
"button",
|
|
5590
5688
|
{
|
|
5591
5689
|
type: "button",
|
|
@@ -5598,7 +5696,7 @@ function KeepTagFilter({
|
|
|
5598
5696
|
),
|
|
5599
5697
|
view.state.tags.map((tag) => {
|
|
5600
5698
|
const selected = view.state.values.includes(tag);
|
|
5601
|
-
return /* @__PURE__ */
|
|
5699
|
+
return /* @__PURE__ */ jsxs13(
|
|
5602
5700
|
"button",
|
|
5603
5701
|
{
|
|
5604
5702
|
type: "button",
|
|
@@ -5607,7 +5705,7 @@ function KeepTagFilter({
|
|
|
5607
5705
|
onClick: () => isMulti ? view.state.toggle(tag) : view.state.select(tag),
|
|
5608
5706
|
children: [
|
|
5609
5707
|
renderTag ? renderTag(tag, view.state.tagCounts[tag] ?? 0, selected) : tag,
|
|
5610
|
-
/* @__PURE__ */
|
|
5708
|
+
/* @__PURE__ */ jsxs13("span", { children: [
|
|
5611
5709
|
" (",
|
|
5612
5710
|
view.state.tagCounts[tag] ?? 0,
|
|
5613
5711
|
")"
|
|
@@ -5634,14 +5732,14 @@ function KeepTagFilter({
|
|
|
5634
5732
|
}
|
|
5635
5733
|
|
|
5636
5734
|
// src/features/query/hooks/useQueryControls.ts
|
|
5637
|
-
import { useEffect as
|
|
5735
|
+
import { useEffect as useEffect10, useState as useState11 } from "react";
|
|
5638
5736
|
function useKeepSearchInput(options) {
|
|
5639
5737
|
const { controlledValue, defaultValue, debounceMs, onValueChange } = options;
|
|
5640
|
-
const [value, setValue] =
|
|
5641
|
-
|
|
5738
|
+
const [value, setValue] = useState11(controlledValue ?? defaultValue);
|
|
5739
|
+
useEffect10(() => {
|
|
5642
5740
|
if (controlledValue !== void 0) setValue(controlledValue);
|
|
5643
5741
|
}, [controlledValue]);
|
|
5644
|
-
|
|
5742
|
+
useEffect10(() => {
|
|
5645
5743
|
if (!onValueChange) return;
|
|
5646
5744
|
if (debounceMs <= 0) {
|
|
5647
5745
|
onValueChange(value);
|
|
@@ -5660,7 +5758,7 @@ function useKeepSearchInput(options) {
|
|
|
5660
5758
|
}
|
|
5661
5759
|
function useKeepSortSelect(options) {
|
|
5662
5760
|
const { controlledValue, defaultValue, onValueChange, onManualSort } = options;
|
|
5663
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
5761
|
+
const [uncontrolledValue, setUncontrolledValue] = useState11(defaultValue);
|
|
5664
5762
|
const value = controlledValue ?? uncontrolledValue;
|
|
5665
5763
|
return {
|
|
5666
5764
|
value,
|
|
@@ -5713,7 +5811,7 @@ function getVisiblePages(currentPage, pageCount, maxPageButtons) {
|
|
|
5713
5811
|
}
|
|
5714
5812
|
|
|
5715
5813
|
// src/features/query/query-controls.tsx
|
|
5716
|
-
import { Fragment as
|
|
5814
|
+
import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5717
5815
|
function KeepSearchInput({
|
|
5718
5816
|
value: controlledValue,
|
|
5719
5817
|
defaultValue = "",
|
|
@@ -5724,7 +5822,7 @@ function KeepSearchInput({
|
|
|
5724
5822
|
...props
|
|
5725
5823
|
}) {
|
|
5726
5824
|
const view = useKeepSearchInput({ controlledValue, defaultValue, debounceMs, onValueChange });
|
|
5727
|
-
return /* @__PURE__ */
|
|
5825
|
+
return /* @__PURE__ */ jsx17(
|
|
5728
5826
|
"input",
|
|
5729
5827
|
{
|
|
5730
5828
|
...props,
|
|
@@ -5750,14 +5848,14 @@ function KeepSortSelect({
|
|
|
5750
5848
|
...props
|
|
5751
5849
|
}) {
|
|
5752
5850
|
const view = useKeepSortSelect({ controlledValue, defaultValue, onValueChange, onManualSort });
|
|
5753
|
-
const options = children ?? /* @__PURE__ */
|
|
5754
|
-
onManualSort || view.value === "manual" ? /* @__PURE__ */
|
|
5755
|
-
/* @__PURE__ */
|
|
5756
|
-
/* @__PURE__ */
|
|
5757
|
-
/* @__PURE__ */
|
|
5758
|
-
/* @__PURE__ */
|
|
5851
|
+
const options = children ?? /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
5852
|
+
onManualSort || view.value === "manual" ? /* @__PURE__ */ jsx17("option", { value: "manual", children: view.labels.manualSort }) : null,
|
|
5853
|
+
/* @__PURE__ */ jsx17("option", { value: "updatedAt:desc", children: view.labels.updatedNewest }),
|
|
5854
|
+
/* @__PURE__ */ jsx17("option", { value: "updatedAt:asc", children: view.labels.updatedOldest }),
|
|
5855
|
+
/* @__PURE__ */ jsx17("option", { value: "savedAt:desc", children: view.labels.savedNewest }),
|
|
5856
|
+
/* @__PURE__ */ jsx17("option", { value: "savedAt:asc", children: view.labels.savedOldest })
|
|
5759
5857
|
] });
|
|
5760
|
-
return /* @__PURE__ */
|
|
5858
|
+
return /* @__PURE__ */ jsx17(
|
|
5761
5859
|
"select",
|
|
5762
5860
|
{
|
|
5763
5861
|
...props,
|
|
@@ -5791,9 +5889,9 @@ function KeepPagination({
|
|
|
5791
5889
|
"data-state": view.pageCount > 1 ? "active" : "idle"
|
|
5792
5890
|
};
|
|
5793
5891
|
if (render)
|
|
5794
|
-
return /* @__PURE__ */
|
|
5795
|
-
return /* @__PURE__ */
|
|
5796
|
-
/* @__PURE__ */
|
|
5892
|
+
return /* @__PURE__ */ jsx17("nav", { ...navProps, children: render({ page: view.currentPage, pageCount: view.pageCount, goToPage: view.goToPage }) });
|
|
5893
|
+
return /* @__PURE__ */ jsxs14("nav", { ...navProps, children: [
|
|
5894
|
+
/* @__PURE__ */ jsx17(
|
|
5797
5895
|
"button",
|
|
5798
5896
|
{
|
|
5799
5897
|
type: "button",
|
|
@@ -5804,7 +5902,7 @@ function KeepPagination({
|
|
|
5804
5902
|
children: showPreviousLabel ? view.labels.previous : null
|
|
5805
5903
|
}
|
|
5806
5904
|
),
|
|
5807
|
-
view.visiblePages.map((nextPage) => /* @__PURE__ */
|
|
5905
|
+
view.visiblePages.map((nextPage) => /* @__PURE__ */ jsx17(
|
|
5808
5906
|
"button",
|
|
5809
5907
|
{
|
|
5810
5908
|
type: "button",
|
|
@@ -5816,7 +5914,7 @@ function KeepPagination({
|
|
|
5816
5914
|
},
|
|
5817
5915
|
nextPage
|
|
5818
5916
|
)),
|
|
5819
|
-
/* @__PURE__ */
|
|
5917
|
+
/* @__PURE__ */ jsx17(
|
|
5820
5918
|
"button",
|
|
5821
5919
|
{
|
|
5822
5920
|
type: "button",
|
|
@@ -5831,16 +5929,16 @@ function KeepPagination({
|
|
|
5831
5929
|
}
|
|
5832
5930
|
|
|
5833
5931
|
// src/features/saved-views/KeepSavedViews.tsx
|
|
5834
|
-
import { useState as
|
|
5932
|
+
import { useState as useState13 } from "react";
|
|
5835
5933
|
|
|
5836
5934
|
// src/features/saved-views/useKeepSavedViews.ts
|
|
5837
5935
|
import { LocalStorageKeepSavedViewStorage } from "@keepkit/core/core";
|
|
5838
|
-
import { useCallback as useCallback5, useEffect as
|
|
5936
|
+
import { useCallback as useCallback5, useEffect as useEffect11, useMemo as useMemo4, useState as useState12 } from "react";
|
|
5839
5937
|
var changeEvent = "keepkit:saved-views:change";
|
|
5840
5938
|
function useKeepSavedViews(storage) {
|
|
5841
5939
|
const resolvedStorage = useMemo4(() => storage ?? new LocalStorageKeepSavedViewStorage(), [storage]);
|
|
5842
|
-
const [views, setViews] =
|
|
5843
|
-
const [error, setError] =
|
|
5940
|
+
const [views, setViews] = useState12([]);
|
|
5941
|
+
const [error, setError] = useState12();
|
|
5844
5942
|
const nameRequiredLabel = useUiLabel("savedViewNameRequired");
|
|
5845
5943
|
const notSerializableLabel = useUiLabel("savedViewNotSerializable");
|
|
5846
5944
|
const invalidDatesLabel = useUiLabel("savedViewInvalidDates");
|
|
@@ -5852,7 +5950,7 @@ function useKeepSavedViews(storage) {
|
|
|
5852
5950
|
setError(cause);
|
|
5853
5951
|
}
|
|
5854
5952
|
}, [resolvedStorage]);
|
|
5855
|
-
|
|
5953
|
+
useEffect11(() => {
|
|
5856
5954
|
void refresh();
|
|
5857
5955
|
if (typeof window === "undefined") return;
|
|
5858
5956
|
window.addEventListener(changeEvent, refresh);
|
|
@@ -5957,7 +6055,7 @@ function notifyChange() {
|
|
|
5957
6055
|
}
|
|
5958
6056
|
|
|
5959
6057
|
// src/features/saved-views/KeepSavedViews.tsx
|
|
5960
|
-
import { jsx as
|
|
6058
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5961
6059
|
function KeepSavedViews({ storage, onApply }) {
|
|
5962
6060
|
const { views, error, updateView, removeView, applyView } = useKeepSavedViews(storage);
|
|
5963
6061
|
const savedViewsLabel = useUiLabel("savedViews");
|
|
@@ -5966,9 +6064,9 @@ function KeepSavedViews({ storage, onApply }) {
|
|
|
5966
6064
|
const renameLabel = useUiLabel("renameSavedView");
|
|
5967
6065
|
const deleteLabel = useUiLabel("deleteSavedView");
|
|
5968
6066
|
const loadErrorLabel = useUiLabel("savedViewsLoadError");
|
|
5969
|
-
return /* @__PURE__ */
|
|
5970
|
-
/* @__PURE__ */
|
|
5971
|
-
/* @__PURE__ */
|
|
6067
|
+
return /* @__PURE__ */ jsxs15("nav", { "aria-label": savedViewsLabel, "data-keepkit": "saved-views", children: [
|
|
6068
|
+
/* @__PURE__ */ jsx18("ul", { children: views.map((view) => /* @__PURE__ */ jsxs15("li", { children: [
|
|
6069
|
+
/* @__PURE__ */ jsx18(
|
|
5972
6070
|
"button",
|
|
5973
6071
|
{
|
|
5974
6072
|
type: "button",
|
|
@@ -5976,7 +6074,7 @@ function KeepSavedViews({ storage, onApply }) {
|
|
|
5976
6074
|
children: view.name
|
|
5977
6075
|
}
|
|
5978
6076
|
),
|
|
5979
|
-
/* @__PURE__ */
|
|
6077
|
+
/* @__PURE__ */ jsx18(
|
|
5980
6078
|
"button",
|
|
5981
6079
|
{
|
|
5982
6080
|
type: "button",
|
|
@@ -5985,11 +6083,11 @@ function KeepSavedViews({ storage, onApply }) {
|
|
|
5985
6083
|
children: view.pinned ? unpinLabel : pinLabel
|
|
5986
6084
|
}
|
|
5987
6085
|
),
|
|
5988
|
-
/* @__PURE__ */
|
|
5989
|
-
/* @__PURE__ */
|
|
5990
|
-
/* @__PURE__ */
|
|
6086
|
+
/* @__PURE__ */ jsxs15("details", { children: [
|
|
6087
|
+
/* @__PURE__ */ jsx18("summary", { children: `${renameLabel} ${view.name}` }),
|
|
6088
|
+
/* @__PURE__ */ jsx18(RenameForm, { name: view.name, onRename: (name) => updateView(view.id, { name }) })
|
|
5991
6089
|
] }),
|
|
5992
|
-
/* @__PURE__ */
|
|
6090
|
+
/* @__PURE__ */ jsx18(
|
|
5993
6091
|
"button",
|
|
5994
6092
|
{
|
|
5995
6093
|
type: "button",
|
|
@@ -5999,7 +6097,7 @@ function KeepSavedViews({ storage, onApply }) {
|
|
|
5999
6097
|
}
|
|
6000
6098
|
)
|
|
6001
6099
|
] }, view.id)) }),
|
|
6002
|
-
error ? /* @__PURE__ */
|
|
6100
|
+
error ? /* @__PURE__ */ jsx18("p", { role: "alert", children: error instanceof Error ? error.message : loadErrorLabel }) : null
|
|
6003
6101
|
] });
|
|
6004
6102
|
}
|
|
6005
6103
|
function KeepSaveViewButton({
|
|
@@ -6010,9 +6108,9 @@ function KeepSaveViewButton({
|
|
|
6010
6108
|
const nameLabel = useUiLabel("savedViewName");
|
|
6011
6109
|
const saveLabel = useUiLabel("saveView");
|
|
6012
6110
|
const saveErrorLabel = useUiLabel("savedViewSaveError");
|
|
6013
|
-
const [name, setName] =
|
|
6014
|
-
const [error, setError] =
|
|
6015
|
-
return /* @__PURE__ */
|
|
6111
|
+
const [name, setName] = useState13("");
|
|
6112
|
+
const [error, setError] = useState13("");
|
|
6113
|
+
return /* @__PURE__ */ jsxs15(
|
|
6016
6114
|
"form",
|
|
6017
6115
|
{
|
|
6018
6116
|
"data-keepkit": "save-view",
|
|
@@ -6024,21 +6122,21 @@ function KeepSaveViewButton({
|
|
|
6024
6122
|
}).catch((cause) => setError(cause instanceof Error ? cause.message : saveErrorLabel));
|
|
6025
6123
|
},
|
|
6026
6124
|
children: [
|
|
6027
|
-
/* @__PURE__ */
|
|
6125
|
+
/* @__PURE__ */ jsxs15("label", { children: [
|
|
6028
6126
|
nameLabel,
|
|
6029
|
-
/* @__PURE__ */
|
|
6127
|
+
/* @__PURE__ */ jsx18("input", { value: name, onChange: (event) => setName(event.currentTarget.value), required: true })
|
|
6030
6128
|
] }),
|
|
6031
|
-
/* @__PURE__ */
|
|
6032
|
-
error ? /* @__PURE__ */
|
|
6129
|
+
/* @__PURE__ */ jsx18("button", { type: "submit", disabled: !name.trim(), children: saveLabel }),
|
|
6130
|
+
error ? /* @__PURE__ */ jsx18("p", { role: "alert", children: error }) : null
|
|
6033
6131
|
]
|
|
6034
6132
|
}
|
|
6035
6133
|
);
|
|
6036
6134
|
}
|
|
6037
6135
|
function RenameForm({ name, onRename }) {
|
|
6038
|
-
const [value, setValue] =
|
|
6136
|
+
const [value, setValue] = useState13(name);
|
|
6039
6137
|
const nameLabel = useUiLabel("savedViewNewName");
|
|
6040
6138
|
const renameLabel = useUiLabel("renameSavedView");
|
|
6041
|
-
return /* @__PURE__ */
|
|
6139
|
+
return /* @__PURE__ */ jsxs15(
|
|
6042
6140
|
"form",
|
|
6043
6141
|
{
|
|
6044
6142
|
onSubmit: (event) => {
|
|
@@ -6046,11 +6144,11 @@ function RenameForm({ name, onRename }) {
|
|
|
6046
6144
|
void onRename(value).catch(() => void 0);
|
|
6047
6145
|
},
|
|
6048
6146
|
children: [
|
|
6049
|
-
/* @__PURE__ */
|
|
6147
|
+
/* @__PURE__ */ jsxs15("label", { children: [
|
|
6050
6148
|
nameLabel,
|
|
6051
|
-
/* @__PURE__ */
|
|
6149
|
+
/* @__PURE__ */ jsx18("input", { value, onChange: (event) => setValue(event.currentTarget.value), required: true })
|
|
6052
6150
|
] }),
|
|
6053
|
-
/* @__PURE__ */
|
|
6151
|
+
/* @__PURE__ */ jsx18("button", { type: "submit", children: renameLabel })
|
|
6054
6152
|
]
|
|
6055
6153
|
}
|
|
6056
6154
|
);
|
|
@@ -6078,7 +6176,7 @@ function reorderVisibleItems(source, orderedIds) {
|
|
|
6078
6176
|
// src/features/collection/hooks/useKeepCollection.ts
|
|
6079
6177
|
import { queryKeepItems } from "@keepkit/core/core";
|
|
6080
6178
|
import { useKeepList as useKeepList3 } from "@keepkit/core/react";
|
|
6081
|
-
import { useCallback as useCallback6, useEffect as
|
|
6179
|
+
import { useCallback as useCallback6, useEffect as useEffect12, useMemo as useMemo5, useState as useState14 } from "react";
|
|
6082
6180
|
var DEFAULT_SORT = { by: "updatedAt", direction: "desc" };
|
|
6083
6181
|
var UNCATEGORIZED = "__uncategorized__";
|
|
6084
6182
|
function useKeepCollection({
|
|
@@ -6104,18 +6202,18 @@ function useKeepCollection({
|
|
|
6104
6202
|
savedViews: false,
|
|
6105
6203
|
...features
|
|
6106
6204
|
};
|
|
6107
|
-
const [searchValue, setSearchValue] =
|
|
6108
|
-
const [queryOverride, setQueryOverride] =
|
|
6205
|
+
const [searchValue, setSearchValue] = useState14(query.search?.query ?? "");
|
|
6206
|
+
const [queryOverride, setQueryOverride] = useState14({});
|
|
6109
6207
|
const defaultSort = reorderable || !enabled.sort ? void 0 : DEFAULT_SORT;
|
|
6110
|
-
const [sort, setSort] =
|
|
6111
|
-
const [activeTags, setActiveTags] =
|
|
6112
|
-
const [activeCollection, setActiveCollection] =
|
|
6113
|
-
const [activeActivity, setActiveActivity] =
|
|
6114
|
-
const [activeOrganization, setActiveOrganization] =
|
|
6115
|
-
const [activeSavedBetween, setActiveSavedBetween] =
|
|
6116
|
-
const [page, setPage] =
|
|
6208
|
+
const [sort, setSort] = useState14(query.sort ?? defaultSort);
|
|
6209
|
+
const [activeTags, setActiveTags] = useState14(query.tags ?? []);
|
|
6210
|
+
const [activeCollection, setActiveCollection] = useState14(getCollectionValue(query));
|
|
6211
|
+
const [activeActivity, setActiveActivity] = useState14(query.activity);
|
|
6212
|
+
const [activeOrganization, setActiveOrganization] = useState14(query.organization);
|
|
6213
|
+
const [activeSavedBetween, setActiveSavedBetween] = useState14(query.savedBetween);
|
|
6214
|
+
const [page, setPage] = useState14(query.pagination?.page ?? 1);
|
|
6117
6215
|
const initialArchiveScope = archiveScope ?? query.archiveScope ?? scopeFromArchived(query.archived);
|
|
6118
|
-
const [activeArchiveScope, setActiveArchiveScope] =
|
|
6216
|
+
const [activeArchiveScope, setActiveArchiveScope] = useState14(initialArchiveScope);
|
|
6119
6217
|
const applyQuery = useCallback6(
|
|
6120
6218
|
(next) => {
|
|
6121
6219
|
setQueryOverride(next);
|
|
@@ -6131,7 +6229,7 @@ function useKeepCollection({
|
|
|
6131
6229
|
},
|
|
6132
6230
|
[defaultSort]
|
|
6133
6231
|
);
|
|
6134
|
-
|
|
6232
|
+
useEffect12(() => {
|
|
6135
6233
|
if (archiveScope !== void 0) setActiveArchiveScope(archiveScope);
|
|
6136
6234
|
}, [archiveScope]);
|
|
6137
6235
|
const defaultPageSize = Number.isFinite(pageSize) ? Math.max(1, Math.floor(pageSize)) : 20;
|
|
@@ -6285,7 +6383,7 @@ function useKeepCollection({
|
|
|
6285
6383
|
setActiveTags((current) => current.filter((tag) => tag !== tagToRemove));
|
|
6286
6384
|
setPage(1);
|
|
6287
6385
|
},
|
|
6288
|
-
clearFilters: () => {
|
|
6386
|
+
clearFilters: (preserveArchiveScope = false) => {
|
|
6289
6387
|
setQueryOverride({});
|
|
6290
6388
|
setSearchValue("");
|
|
6291
6389
|
setActiveTags([]);
|
|
@@ -6293,7 +6391,7 @@ function useKeepCollection({
|
|
|
6293
6391
|
setActiveActivity(void 0);
|
|
6294
6392
|
setActiveOrganization(void 0);
|
|
6295
6393
|
setActiveSavedBetween(void 0);
|
|
6296
|
-
setActiveArchiveScope("active");
|
|
6394
|
+
if (!preserveArchiveScope) setActiveArchiveScope("active");
|
|
6297
6395
|
setPage(1);
|
|
6298
6396
|
},
|
|
6299
6397
|
resetFilters: () => applyQuery({ ...query, archiveScope: initialArchiveScope }),
|
|
@@ -6315,9 +6413,9 @@ function scopeFromArchived(archived) {
|
|
|
6315
6413
|
}
|
|
6316
6414
|
|
|
6317
6415
|
// src/features/collection/KeepCollectionCreate.tsx
|
|
6318
|
-
import { useKeepCollections as useKeepCollections5, useKeepContext as
|
|
6319
|
-
import { useId as
|
|
6320
|
-
import { jsx as
|
|
6416
|
+
import { useKeepCollections as useKeepCollections5, useKeepContext as useKeepContext5 } from "@keepkit/core/react";
|
|
6417
|
+
import { useId as useId3, useState as useState15 } from "react";
|
|
6418
|
+
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6321
6419
|
function KeepCollectionCreate({
|
|
6322
6420
|
onCreated,
|
|
6323
6421
|
onError,
|
|
@@ -6327,12 +6425,12 @@ function KeepCollectionCreate({
|
|
|
6327
6425
|
id: externalId,
|
|
6328
6426
|
...inputProps
|
|
6329
6427
|
}) {
|
|
6330
|
-
const { createCollection } =
|
|
6428
|
+
const { createCollection } = useKeepContext5();
|
|
6331
6429
|
const collections = useKeepCollections5();
|
|
6332
|
-
const [name, setName] =
|
|
6333
|
-
const [error, setError] =
|
|
6334
|
-
const [isSubmitting, setIsSubmitting] =
|
|
6335
|
-
const autoId =
|
|
6430
|
+
const [name, setName] = useState15("");
|
|
6431
|
+
const [error, setError] = useState15(null);
|
|
6432
|
+
const [isSubmitting, setIsSubmitting] = useState15(false);
|
|
6433
|
+
const autoId = useId3();
|
|
6336
6434
|
const inputId = externalId ?? autoId;
|
|
6337
6435
|
const resolvedLabel = useUiLabel("createCollection");
|
|
6338
6436
|
const showLabel = useUiLabelVisibility("createCollection");
|
|
@@ -6366,16 +6464,16 @@ function KeepCollectionCreate({
|
|
|
6366
6464
|
setIsSubmitting(false);
|
|
6367
6465
|
}
|
|
6368
6466
|
};
|
|
6369
|
-
return /* @__PURE__ */
|
|
6467
|
+
return /* @__PURE__ */ jsxs16(
|
|
6370
6468
|
"form",
|
|
6371
6469
|
{
|
|
6372
6470
|
"data-keepkit": "collection-create",
|
|
6373
6471
|
"data-state": error ? "error" : isSubmitting ? "submitting" : "idle",
|
|
6374
6472
|
onSubmit: handleSubmit,
|
|
6375
6473
|
children: [
|
|
6376
|
-
showLabel ? /* @__PURE__ */
|
|
6377
|
-
/* @__PURE__ */
|
|
6378
|
-
/* @__PURE__ */
|
|
6474
|
+
showLabel ? /* @__PURE__ */ jsx19("label", { htmlFor: inputId, children: label ?? resolvedLabel }) : null,
|
|
6475
|
+
/* @__PURE__ */ jsxs16("div", { "data-keepkit": "collection-create-row", children: [
|
|
6476
|
+
/* @__PURE__ */ jsx19(
|
|
6379
6477
|
"input",
|
|
6380
6478
|
{
|
|
6381
6479
|
...inputProps,
|
|
@@ -6393,7 +6491,7 @@ function KeepCollectionCreate({
|
|
|
6393
6491
|
"data-keep-action": "collection-name-input"
|
|
6394
6492
|
}
|
|
6395
6493
|
),
|
|
6396
|
-
/* @__PURE__ */
|
|
6494
|
+
/* @__PURE__ */ jsx19(
|
|
6397
6495
|
"button",
|
|
6398
6496
|
{
|
|
6399
6497
|
type: "submit",
|
|
@@ -6404,26 +6502,26 @@ function KeepCollectionCreate({
|
|
|
6404
6502
|
}
|
|
6405
6503
|
)
|
|
6406
6504
|
] }),
|
|
6407
|
-
error ? /* @__PURE__ */
|
|
6505
|
+
error ? /* @__PURE__ */ jsx19("p", { role: "alert", children: error }) : null
|
|
6408
6506
|
]
|
|
6409
6507
|
}
|
|
6410
6508
|
);
|
|
6411
6509
|
}
|
|
6412
6510
|
|
|
6413
6511
|
// src/features/collection/KeepInlineSelection.tsx
|
|
6414
|
-
import { useEffect as
|
|
6415
|
-
import { Fragment as
|
|
6512
|
+
import { useEffect as useEffect13, useRef as useRef12, useState as useState16 } from "react";
|
|
6513
|
+
import { Fragment as Fragment9, jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6416
6514
|
function KeepInlineSelection({
|
|
6417
6515
|
query,
|
|
6418
6516
|
children,
|
|
6419
6517
|
confirmRemoval = false
|
|
6420
6518
|
}) {
|
|
6421
|
-
const [selecting, setSelecting] =
|
|
6422
|
-
const [selectedIds, setSelectedIds] =
|
|
6423
|
-
const previousQuery =
|
|
6424
|
-
|
|
6425
|
-
if (previousQuery.current
|
|
6426
|
-
previousQuery.current = query;
|
|
6519
|
+
const [selecting, setSelecting] = useState16(false);
|
|
6520
|
+
const [selectedIds, setSelectedIds] = useState16([]);
|
|
6521
|
+
const previousQuery = useRef12(copyQueryValue(query));
|
|
6522
|
+
useEffect13(() => {
|
|
6523
|
+
if (equalQueryValue(previousQuery.current, query)) return;
|
|
6524
|
+
previousQuery.current = copyQueryValue(query);
|
|
6427
6525
|
setSelectedIds([]);
|
|
6428
6526
|
}, [query]);
|
|
6429
6527
|
const { state } = useKeepBulkActions({
|
|
@@ -6436,7 +6534,7 @@ function KeepInlineSelection({
|
|
|
6436
6534
|
onSelectionScopeChange: void 0,
|
|
6437
6535
|
confirmRemoval
|
|
6438
6536
|
});
|
|
6439
|
-
const removalTrigger =
|
|
6537
|
+
const removalTrigger = useRef12(null);
|
|
6440
6538
|
const selectLabel = useUiLabel("selectItems");
|
|
6441
6539
|
const doneLabel = useUiLabel("done");
|
|
6442
6540
|
const pageLabel = useUiLabel("currentPage");
|
|
@@ -6457,9 +6555,9 @@ function KeepInlineSelection({
|
|
|
6457
6555
|
const errorLabel = useUiLabel("error");
|
|
6458
6556
|
const run = (operation) => void operation().catch(() => void 0);
|
|
6459
6557
|
const archivedOnly = query.archiveScope === "archived" || query.archived === true;
|
|
6460
|
-
return /* @__PURE__ */
|
|
6461
|
-
/* @__PURE__ */
|
|
6462
|
-
/* @__PURE__ */
|
|
6558
|
+
return /* @__PURE__ */ jsxs17(Fragment9, { children: [
|
|
6559
|
+
/* @__PURE__ */ jsxs17("fieldset", { "data-keepkit": "inline-selection", "aria-label": selectLabel, "aria-busy": state.isMutating, children: [
|
|
6560
|
+
/* @__PURE__ */ jsx20(
|
|
6463
6561
|
"button",
|
|
6464
6562
|
{
|
|
6465
6563
|
type: "button",
|
|
@@ -6472,9 +6570,9 @@ function KeepInlineSelection({
|
|
|
6472
6570
|
children: selecting ? doneLabel : selectLabel
|
|
6473
6571
|
}
|
|
6474
6572
|
),
|
|
6475
|
-
selecting ? /* @__PURE__ */
|
|
6476
|
-
/* @__PURE__ */
|
|
6477
|
-
/* @__PURE__ */
|
|
6573
|
+
selecting ? /* @__PURE__ */ jsxs17(Fragment9, { children: [
|
|
6574
|
+
/* @__PURE__ */ jsxs17("label", { children: [
|
|
6575
|
+
/* @__PURE__ */ jsx20(
|
|
6478
6576
|
"input",
|
|
6479
6577
|
{
|
|
6480
6578
|
type: "checkbox",
|
|
@@ -6483,47 +6581,49 @@ function KeepInlineSelection({
|
|
|
6483
6581
|
disabled: state.isMutating || !state.items.length
|
|
6484
6582
|
}
|
|
6485
6583
|
),
|
|
6584
|
+
selectLabel,
|
|
6585
|
+
" \u2014 ",
|
|
6486
6586
|
pageLabel
|
|
6487
6587
|
] }),
|
|
6488
|
-
/* @__PURE__ */
|
|
6588
|
+
/* @__PURE__ */ jsxs17("span", { role: "status", children: [
|
|
6489
6589
|
state.selectedCount,
|
|
6490
6590
|
" ",
|
|
6491
6591
|
countLabel
|
|
6492
6592
|
] })
|
|
6493
6593
|
] }) : null,
|
|
6494
|
-
selecting && state.selectedCount > 0 ? /* @__PURE__ */
|
|
6495
|
-
/* @__PURE__ */
|
|
6594
|
+
selecting && state.selectedCount > 0 ? /* @__PURE__ */ jsxs17("fieldset", { disabled: state.isMutating, children: [
|
|
6595
|
+
/* @__PURE__ */ jsxs17("legend", { children: [
|
|
6496
6596
|
state.selectedCount,
|
|
6497
6597
|
" ",
|
|
6498
6598
|
countLabel
|
|
6499
6599
|
] }),
|
|
6500
|
-
/* @__PURE__ */
|
|
6600
|
+
/* @__PURE__ */ jsxs17("label", { children: [
|
|
6501
6601
|
collectionLabel,
|
|
6502
|
-
/* @__PURE__ */
|
|
6503
|
-
/* @__PURE__ */
|
|
6504
|
-
state.collections.map((collection) => /* @__PURE__ */
|
|
6602
|
+
/* @__PURE__ */ jsxs17("select", { value: state.collectionId, onChange: (event) => state.setCollectionId(event.currentTarget.value), children: [
|
|
6603
|
+
/* @__PURE__ */ jsx20("option", { value: "", children: uncategorizedLabel }),
|
|
6604
|
+
state.collections.map((collection) => /* @__PURE__ */ jsx20("option", { value: collection.id, children: collection.name }, collection.id))
|
|
6505
6605
|
] })
|
|
6506
6606
|
] }),
|
|
6507
|
-
/* @__PURE__ */
|
|
6508
|
-
/* @__PURE__ */
|
|
6509
|
-
/* @__PURE__ */
|
|
6510
|
-
/* @__PURE__ */
|
|
6511
|
-
/* @__PURE__ */
|
|
6512
|
-
/* @__PURE__ */
|
|
6607
|
+
/* @__PURE__ */ jsx20("button", { type: "button", onClick: () => run(state.moveToCollection), children: moveLabel }),
|
|
6608
|
+
/* @__PURE__ */ jsx20("button", { type: "button", onClick: () => run(archivedOnly ? state.unarchive : state.archive), children: archivedOnly ? unarchiveLabel : archiveLabel }),
|
|
6609
|
+
/* @__PURE__ */ jsxs17("details", { children: [
|
|
6610
|
+
/* @__PURE__ */ jsx20("summary", { children: moreLabel }),
|
|
6611
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
6612
|
+
/* @__PURE__ */ jsxs17("label", { children: [
|
|
6513
6613
|
tagsLabel,
|
|
6514
|
-
/* @__PURE__ */
|
|
6614
|
+
/* @__PURE__ */ jsx20("input", { value: state.tagsInput, onChange: (event) => state.setTagsInput(event.currentTarget.value) })
|
|
6515
6615
|
] }),
|
|
6516
|
-
/* @__PURE__ */
|
|
6517
|
-
/* @__PURE__ */
|
|
6518
|
-
/* @__PURE__ */
|
|
6519
|
-
/* @__PURE__ */
|
|
6520
|
-
/* @__PURE__ */
|
|
6521
|
-
/* @__PURE__ */
|
|
6616
|
+
/* @__PURE__ */ jsx20("button", { type: "button", onClick: () => run(state.addTags), children: addTagsLabel }),
|
|
6617
|
+
/* @__PURE__ */ jsx20("button", { type: "button", onClick: () => run(state.removeTags), children: removeTagsLabel }),
|
|
6618
|
+
/* @__PURE__ */ jsx20("button", { type: "button", onClick: () => run(state.updateTags), children: applyTagsLabel }),
|
|
6619
|
+
/* @__PURE__ */ jsx20("button", { type: "button", onClick: () => run(state.pin), children: pinLabel }),
|
|
6620
|
+
/* @__PURE__ */ jsx20("button", { type: "button", onClick: () => run(state.unpin), children: unpinLabel }),
|
|
6621
|
+
/* @__PURE__ */ jsx20("button", { ref: removalTrigger, type: "button", onClick: () => run(state.remove), children: removeLabel })
|
|
6522
6622
|
] })
|
|
6523
6623
|
] })
|
|
6524
6624
|
] }) : null,
|
|
6525
|
-
/* @__PURE__ */
|
|
6526
|
-
selecting && state.error ? /* @__PURE__ */
|
|
6625
|
+
/* @__PURE__ */ jsx20(KeepRemovalConfirmation, { state, triggerRef: removalTrigger }),
|
|
6626
|
+
selecting && state.error ? /* @__PURE__ */ jsx20("p", { role: "alert", children: getErrorMessage(state.error, errorLabel) }) : null
|
|
6527
6627
|
] }),
|
|
6528
6628
|
children(
|
|
6529
6629
|
selecting ? { selectedIds, onSelectedIdsChange: setSelectedIds, disabled: state.isMutating } : void 0
|
|
@@ -6542,12 +6642,15 @@ import {
|
|
|
6542
6642
|
createElement as createElement2,
|
|
6543
6643
|
isValidElement as isValidElement5,
|
|
6544
6644
|
useContext as useContext4,
|
|
6545
|
-
useEffect as
|
|
6546
|
-
useId as
|
|
6547
|
-
useRef as
|
|
6548
|
-
useState as
|
|
6645
|
+
useEffect as useEffect14,
|
|
6646
|
+
useId as useId4,
|
|
6647
|
+
useRef as useRef13,
|
|
6648
|
+
useState as useState19
|
|
6549
6649
|
} from "react";
|
|
6550
6650
|
|
|
6651
|
+
// src/features/status/KeepStaleNotice.tsx
|
|
6652
|
+
import { useState as useState18 } from "react";
|
|
6653
|
+
|
|
6551
6654
|
// src/features/item/hooks/useKeepItemStatusBadge.ts
|
|
6552
6655
|
function useKeepItemStatusBadge(status) {
|
|
6553
6656
|
return {
|
|
@@ -6588,10 +6691,10 @@ function getDisplayStatus(status) {
|
|
|
6588
6691
|
}
|
|
6589
6692
|
|
|
6590
6693
|
// src/features/item/KeepItemStatusBadge.tsx
|
|
6591
|
-
import { Fragment as
|
|
6694
|
+
import { Fragment as Fragment10, jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6592
6695
|
function KeepItemStatusBadge({ status = "available", label, className, ...props }) {
|
|
6593
6696
|
const view = useKeepItemStatusBadge(status);
|
|
6594
|
-
return /* @__PURE__ */
|
|
6697
|
+
return /* @__PURE__ */ jsxs18(
|
|
6595
6698
|
"span",
|
|
6596
6699
|
{
|
|
6597
6700
|
...props,
|
|
@@ -6602,14 +6705,14 @@ function KeepItemStatusBadge({ status = "available", label, className, ...props
|
|
|
6602
6705
|
"data-status": status,
|
|
6603
6706
|
"data-item-status": view.resolvedStatus,
|
|
6604
6707
|
children: [
|
|
6605
|
-
/* @__PURE__ */
|
|
6606
|
-
/* @__PURE__ */
|
|
6708
|
+
/* @__PURE__ */ jsx21(StatusIcon, { name: view.icon }),
|
|
6709
|
+
/* @__PURE__ */ jsx21("span", { "data-status-label": "true", children: label ?? view.statusLabel })
|
|
6607
6710
|
]
|
|
6608
6711
|
}
|
|
6609
6712
|
);
|
|
6610
6713
|
}
|
|
6611
6714
|
function StatusIcon({ name }) {
|
|
6612
|
-
return /* @__PURE__ */
|
|
6715
|
+
return /* @__PURE__ */ jsxs18(
|
|
6613
6716
|
"svg",
|
|
6614
6717
|
{
|
|
6615
6718
|
"data-status-icon": name,
|
|
@@ -6624,18 +6727,18 @@ function StatusIcon({ name }) {
|
|
|
6624
6727
|
"aria-hidden": "true",
|
|
6625
6728
|
focusable: "false",
|
|
6626
6729
|
children: [
|
|
6627
|
-
name === "check" ? /* @__PURE__ */
|
|
6628
|
-
name === "clock" ? /* @__PURE__ */
|
|
6629
|
-
/* @__PURE__ */
|
|
6630
|
-
/* @__PURE__ */
|
|
6730
|
+
name === "check" ? /* @__PURE__ */ jsx21("path", { d: "m5 12 4 4L19 6" }) : null,
|
|
6731
|
+
name === "clock" ? /* @__PURE__ */ jsxs18(Fragment10, { children: [
|
|
6732
|
+
/* @__PURE__ */ jsx21("circle", { cx: "12", cy: "12", r: "8" }),
|
|
6733
|
+
/* @__PURE__ */ jsx21("path", { d: "M12 7v5l3 2" })
|
|
6631
6734
|
] }) : null,
|
|
6632
|
-
name === "ban" ? /* @__PURE__ */
|
|
6633
|
-
/* @__PURE__ */
|
|
6634
|
-
/* @__PURE__ */
|
|
6735
|
+
name === "ban" ? /* @__PURE__ */ jsxs18(Fragment10, { children: [
|
|
6736
|
+
/* @__PURE__ */ jsx21("circle", { cx: "12", cy: "12", r: "8" }),
|
|
6737
|
+
/* @__PURE__ */ jsx21("path", { d: "m6.5 6.5 11 11" })
|
|
6635
6738
|
] }) : null,
|
|
6636
|
-
name === "lock" ? /* @__PURE__ */
|
|
6637
|
-
/* @__PURE__ */
|
|
6638
|
-
/* @__PURE__ */
|
|
6739
|
+
name === "lock" ? /* @__PURE__ */ jsxs18(Fragment10, { children: [
|
|
6740
|
+
/* @__PURE__ */ jsx21("rect", { x: "5", y: "10", width: "14", height: "10", rx: "2" }),
|
|
6741
|
+
/* @__PURE__ */ jsx21("path", { d: "M8 10V7a4 4 0 0 1 8 0v3" })
|
|
6639
6742
|
] }) : null
|
|
6640
6743
|
]
|
|
6641
6744
|
}
|
|
@@ -6643,16 +6746,18 @@ function StatusIcon({ name }) {
|
|
|
6643
6746
|
}
|
|
6644
6747
|
|
|
6645
6748
|
// src/features/status/hooks/useKeepStaleNotice.ts
|
|
6646
|
-
import { useKeepContext as
|
|
6647
|
-
import { useState as
|
|
6749
|
+
import { useKeepContext as useKeepContext6, useKeepStore as useKeepStore3 } from "@keepkit/core/react";
|
|
6750
|
+
import { useState as useState17 } from "react";
|
|
6648
6751
|
function useKeepStaleNotice({ item, onRetry, onRemoved }) {
|
|
6649
|
-
const context =
|
|
6752
|
+
const context = useKeepContext6();
|
|
6753
|
+
const { store } = useKeepStore3();
|
|
6650
6754
|
const emitFeedback = useKeepUiFeedback();
|
|
6651
6755
|
const removedMessage = useUiLabel("removedMessage");
|
|
6652
6756
|
const restoredMessage = useUiLabel("restoredMessage");
|
|
6653
6757
|
const undoLabel = useUiLabel("undo");
|
|
6654
|
-
const
|
|
6655
|
-
const [
|
|
6758
|
+
const errorLabel = useUiLabel("error");
|
|
6759
|
+
const [isRetrying, setIsRetrying] = useState17(false);
|
|
6760
|
+
const [error, setError] = useState17(null);
|
|
6656
6761
|
async function retry() {
|
|
6657
6762
|
setError(null);
|
|
6658
6763
|
setIsRetrying(true);
|
|
@@ -6668,6 +6773,7 @@ function useKeepStaleNotice({ item, onRetry, onRemoved }) {
|
|
|
6668
6773
|
async function remove() {
|
|
6669
6774
|
try {
|
|
6670
6775
|
await context.removeItemWithUndo(item.id);
|
|
6776
|
+
const undoState = store.getSnapshot().undo;
|
|
6671
6777
|
onRemoved?.(item);
|
|
6672
6778
|
emitFeedback({
|
|
6673
6779
|
type: "item-removed",
|
|
@@ -6675,6 +6781,9 @@ function useKeepStaleNotice({ item, onRetry, onRemoved }) {
|
|
|
6675
6781
|
message: removedMessage,
|
|
6676
6782
|
undoLabel,
|
|
6677
6783
|
undo: async () => {
|
|
6784
|
+
if (!undoState?.canUndo || store.getSnapshot().undo !== undoState || (undoState.expiresAt ?? 0) <= Date.now()) {
|
|
6785
|
+
throw new UndoUnavailableError(errorLabel);
|
|
6786
|
+
}
|
|
6678
6787
|
await context.undoLastRemoval();
|
|
6679
6788
|
emitFeedback({ type: "item-restored", item, items: [item], message: restoredMessage });
|
|
6680
6789
|
}
|
|
@@ -6698,13 +6807,15 @@ function useKeepStaleNotice({ item, onRetry, onRemoved }) {
|
|
|
6698
6807
|
};
|
|
6699
6808
|
}
|
|
6700
6809
|
function useKeepPruneStale({ statuses, onPruned }) {
|
|
6701
|
-
const context =
|
|
6810
|
+
const context = useKeepContext6();
|
|
6811
|
+
const { store } = useKeepStore3();
|
|
6702
6812
|
const emitFeedback = useKeepUiFeedback();
|
|
6703
6813
|
const staleItems = context.items.filter((item) => item.status && statuses.includes(item.status));
|
|
6704
6814
|
const staleIds = staleItems.map((item) => item.id);
|
|
6705
6815
|
const restoredMessage = useUiLabel("restoredMessage");
|
|
6706
6816
|
const prunedMessage = useUiLabel("stalePrunedMessage");
|
|
6707
6817
|
const undoLabel = useUiLabel("undo");
|
|
6818
|
+
const errorLabel = useUiLabel("error");
|
|
6708
6819
|
return {
|
|
6709
6820
|
staleIds,
|
|
6710
6821
|
isMutating: context.isMutating,
|
|
@@ -6713,6 +6824,7 @@ function useKeepPruneStale({ statuses, onPruned }) {
|
|
|
6713
6824
|
const ids = [...staleIds];
|
|
6714
6825
|
const items = [...staleItems];
|
|
6715
6826
|
await context.removeItemsWithUndo(ids);
|
|
6827
|
+
const undoState = store.getSnapshot().undo;
|
|
6716
6828
|
onPruned?.(ids);
|
|
6717
6829
|
if (items.length > 0) {
|
|
6718
6830
|
emitFeedback({
|
|
@@ -6722,6 +6834,9 @@ function useKeepPruneStale({ statuses, onPruned }) {
|
|
|
6722
6834
|
message: prunedMessage,
|
|
6723
6835
|
undoLabel,
|
|
6724
6836
|
undo: async () => {
|
|
6837
|
+
if (!undoState?.canUndo || store.getSnapshot().undo !== undoState || (undoState.expiresAt ?? 0) <= Date.now()) {
|
|
6838
|
+
throw new UndoUnavailableError(errorLabel);
|
|
6839
|
+
}
|
|
6725
6840
|
await context.undoLastRemoval();
|
|
6726
6841
|
emitFeedback({ type: "item-restored", item: items[0], items, message: restoredMessage });
|
|
6727
6842
|
}
|
|
@@ -6732,7 +6847,7 @@ function useKeepPruneStale({ statuses, onPruned }) {
|
|
|
6732
6847
|
}
|
|
6733
6848
|
|
|
6734
6849
|
// src/features/status/KeepStaleNotice.tsx
|
|
6735
|
-
import { jsx as
|
|
6850
|
+
import { Fragment as Fragment11, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6736
6851
|
function KeepStaleNotice({
|
|
6737
6852
|
item,
|
|
6738
6853
|
onRetry,
|
|
@@ -6746,11 +6861,11 @@ function KeepStaleNotice({
|
|
|
6746
6861
|
const view = useKeepStaleNotice({ item, onRetry, onRemoved });
|
|
6747
6862
|
const showRetryLabel = useUiLabelVisibility("retry");
|
|
6748
6863
|
const showRemoveLabel = useUiLabelVisibility("removeFromList");
|
|
6749
|
-
return /* @__PURE__ */
|
|
6750
|
-
/* @__PURE__ */
|
|
6751
|
-
children ?? (item.statusReason ? /* @__PURE__ */
|
|
6752
|
-
/* @__PURE__ */
|
|
6753
|
-
/* @__PURE__ */
|
|
6864
|
+
return /* @__PURE__ */ jsxs19("aside", { ...props, className, "data-keepkit": "stale-notice", "data-state": view.error ? "error" : "stale", children: [
|
|
6865
|
+
/* @__PURE__ */ jsx22(KeepItemStatusBadge, { status: view.status }),
|
|
6866
|
+
children ?? (item.statusReason ? /* @__PURE__ */ jsx22("p", { children: item.statusReason }) : null),
|
|
6867
|
+
/* @__PURE__ */ jsxs19("div", { children: [
|
|
6868
|
+
/* @__PURE__ */ jsx22(
|
|
6754
6869
|
"button",
|
|
6755
6870
|
{
|
|
6756
6871
|
type: "button",
|
|
@@ -6761,7 +6876,7 @@ function KeepStaleNotice({
|
|
|
6761
6876
|
children: showRetryLabel ? retryLabel ?? view.labels.retry : null
|
|
6762
6877
|
}
|
|
6763
6878
|
),
|
|
6764
|
-
/* @__PURE__ */
|
|
6879
|
+
/* @__PURE__ */ jsx22(
|
|
6765
6880
|
"button",
|
|
6766
6881
|
{
|
|
6767
6882
|
type: "button",
|
|
@@ -6773,7 +6888,7 @@ function KeepStaleNotice({
|
|
|
6773
6888
|
}
|
|
6774
6889
|
)
|
|
6775
6890
|
] }),
|
|
6776
|
-
view.error ? /* @__PURE__ */
|
|
6891
|
+
view.error ? /* @__PURE__ */ jsx22("p", { role: "alert", children: getErrorMessage(view.error, view.labels.error) }) : null
|
|
6777
6892
|
] });
|
|
6778
6893
|
}
|
|
6779
6894
|
function KeepPruneStaleButton({
|
|
@@ -6786,25 +6901,38 @@ function KeepPruneStaleButton({
|
|
|
6786
6901
|
}) {
|
|
6787
6902
|
const view = useKeepPruneStale({ statuses, onPruned });
|
|
6788
6903
|
const showLabel = useUiLabelVisibility("pruneStale");
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
"data-state": view.staleIds.length > 0 ? "available" : "empty",
|
|
6798
|
-
disabled: view.staleIds.length === 0 || view.isMutating || disabled,
|
|
6799
|
-
"aria-label": showLabel ? void 0 : view.label,
|
|
6800
|
-
onClick: () => void view.prune(),
|
|
6801
|
-
children: showLabel ? children ?? label ?? `${view.label} (${view.staleIds.length})` : null
|
|
6904
|
+
const errorLabel = useUiLabel("error");
|
|
6905
|
+
const [error, setError] = useState18();
|
|
6906
|
+
async function prune() {
|
|
6907
|
+
setError(void 0);
|
|
6908
|
+
try {
|
|
6909
|
+
await view.prune();
|
|
6910
|
+
} catch (cause) {
|
|
6911
|
+
setError(cause);
|
|
6802
6912
|
}
|
|
6803
|
-
|
|
6913
|
+
}
|
|
6914
|
+
return /* @__PURE__ */ jsxs19(Fragment11, { children: [
|
|
6915
|
+
/* @__PURE__ */ jsx22(
|
|
6916
|
+
"button",
|
|
6917
|
+
{
|
|
6918
|
+
...props,
|
|
6919
|
+
type: "button",
|
|
6920
|
+
className: props.className,
|
|
6921
|
+
"data-keepkit": "prune-stale",
|
|
6922
|
+
"data-keep-action": "prune-stale",
|
|
6923
|
+
"data-state": view.staleIds.length > 0 ? "available" : "empty",
|
|
6924
|
+
disabled: view.staleIds.length === 0 || view.isMutating || disabled,
|
|
6925
|
+
"aria-label": showLabel ? void 0 : view.label,
|
|
6926
|
+
onClick: () => void prune(),
|
|
6927
|
+
children: showLabel ? children ?? label ?? `${view.label} (${view.staleIds.length})` : null
|
|
6928
|
+
}
|
|
6929
|
+
),
|
|
6930
|
+
error ? /* @__PURE__ */ jsx22("p", { role: "alert", children: getErrorMessage(error, errorLabel) }) : null
|
|
6931
|
+
] });
|
|
6804
6932
|
}
|
|
6805
6933
|
|
|
6806
6934
|
// src/features/item/hooks/useKeepItemCard.ts
|
|
6807
|
-
import { useKeepItem as useKeepItem5 } from "@keepkit/core/react";
|
|
6935
|
+
import { useKeepItem as useKeepItem5, useKeepStore as useKeepStore4 } from "@keepkit/core/react";
|
|
6808
6936
|
function useKeepItemCard(options) {
|
|
6809
6937
|
const {
|
|
6810
6938
|
item,
|
|
@@ -6818,10 +6946,12 @@ function useKeepItemCard(options) {
|
|
|
6818
6946
|
onRemoved
|
|
6819
6947
|
} = options;
|
|
6820
6948
|
const itemState = useKeepItem5(item);
|
|
6949
|
+
const { store } = useKeepStore4();
|
|
6821
6950
|
const emitFeedback = useKeepUiFeedback();
|
|
6822
6951
|
const removedMessage = useUiLabel("removedMessage");
|
|
6823
6952
|
const restoredMessage = useUiLabel("restoredMessage");
|
|
6824
6953
|
const undoLabel = useUiLabel("undo");
|
|
6954
|
+
const errorLabel = useUiLabel("error");
|
|
6825
6955
|
const resolvedTitle = typeof title === "function" ? title(item) : title ?? getTitle?.(item) ?? getMetaTitle(item.meta) ?? item.id;
|
|
6826
6956
|
const imageProps = getImageProps?.(item, resolvedTitle);
|
|
6827
6957
|
const href = typeof hrefOption === "function" ? hrefOption(item) : hrefOption;
|
|
@@ -6833,6 +6963,7 @@ function useKeepItemCard(options) {
|
|
|
6833
6963
|
const wasSaved = itemState.isSaved;
|
|
6834
6964
|
try {
|
|
6835
6965
|
await itemState.removeWithUndo();
|
|
6966
|
+
const undoState = store.getSnapshot().undo;
|
|
6836
6967
|
onRemoved?.(item);
|
|
6837
6968
|
if (!wasSaved) return;
|
|
6838
6969
|
emitFeedback({
|
|
@@ -6841,6 +6972,9 @@ function useKeepItemCard(options) {
|
|
|
6841
6972
|
message: removedMessage,
|
|
6842
6973
|
undoLabel,
|
|
6843
6974
|
undo: async () => {
|
|
6975
|
+
if (!undoState?.canUndo || store.getSnapshot().undo !== undoState || (undoState.expiresAt ?? 0) <= Date.now()) {
|
|
6976
|
+
throw new UndoUnavailableError(errorLabel);
|
|
6977
|
+
}
|
|
6844
6978
|
await itemState.undo();
|
|
6845
6979
|
emitFeedback({ type: "item-restored", item, items: [item], message: restoredMessage });
|
|
6846
6980
|
}
|
|
@@ -6900,7 +7034,7 @@ function getDisplayStatus2(status) {
|
|
|
6900
7034
|
}
|
|
6901
7035
|
|
|
6902
7036
|
// src/features/item/KeepItemCard.tsx
|
|
6903
|
-
import { Fragment as
|
|
7037
|
+
import { Fragment as Fragment12, jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6904
7038
|
var KeepItemCardContext = createContext4(null);
|
|
6905
7039
|
function useKeepItemCardCompound(part) {
|
|
6906
7040
|
const context = useContext4(KeepItemCardContext);
|
|
@@ -6971,23 +7105,23 @@ function KeepItemCardRoot({
|
|
|
6971
7105
|
const contentChildren = asChild && isValidElement5(children) ? void 0 : children;
|
|
6972
7106
|
const hasCustomBody = render !== void 0 || contentChildren !== void 0;
|
|
6973
7107
|
const cardLinkSurface = linkTarget === "card" && !hasCustomBody && Boolean(view.href) && view.isAvailable;
|
|
6974
|
-
const [isEditOpen, setEditOpen] =
|
|
6975
|
-
const editTriggerRef =
|
|
6976
|
-
const editPanelRef =
|
|
6977
|
-
const wasEditOpen =
|
|
6978
|
-
const editPanelId =
|
|
7108
|
+
const [isEditOpen, setEditOpen] = useState19(false);
|
|
7109
|
+
const editTriggerRef = useRef13(null);
|
|
7110
|
+
const editPanelRef = useRef13(null);
|
|
7111
|
+
const wasEditOpen = useRef13(false);
|
|
7112
|
+
const editPanelId = useId4();
|
|
6979
7113
|
const editLabel = useUiLabel("editSavedItem");
|
|
6980
7114
|
const showEditLabel = useUiLabelVisibility("editSavedItem");
|
|
6981
7115
|
const showSavedAtLabel = useUiLabelVisibility("saved");
|
|
6982
7116
|
const closeEdit = () => setEditOpen(false);
|
|
6983
|
-
|
|
7117
|
+
useEffect14(() => {
|
|
6984
7118
|
if (isEditOpen) editPanelRef.current?.querySelector("textarea, input, select")?.focus();
|
|
6985
7119
|
if (wasEditOpen.current && !isEditOpen) editTriggerRef.current?.focus();
|
|
6986
7120
|
wasEditOpen.current = isEditOpen;
|
|
6987
7121
|
}, [isEditOpen]);
|
|
6988
7122
|
function renderLink(content, props = {}) {
|
|
6989
7123
|
if (!view.href || !view.isAvailable) {
|
|
6990
|
-
return /* @__PURE__ */
|
|
7124
|
+
return /* @__PURE__ */ jsx23("span", { ...props, "aria-disabled": view.href ? true : void 0, "data-link-disabled": view.href ? true : void 0, children: content });
|
|
6991
7125
|
}
|
|
6992
7126
|
const linkProps = {
|
|
6993
7127
|
...props,
|
|
@@ -7003,17 +7137,17 @@ function KeepItemCardRoot({
|
|
|
7003
7137
|
},
|
|
7004
7138
|
children: content
|
|
7005
7139
|
};
|
|
7006
|
-
return LinkComponent ? /* @__PURE__ */
|
|
7140
|
+
return LinkComponent ? /* @__PURE__ */ jsx23(LinkComponent, { ...linkProps }) : /* @__PURE__ */ jsx23("a", { ...linkProps });
|
|
7007
7141
|
}
|
|
7008
7142
|
function renderTitle(content) {
|
|
7009
7143
|
if (cardLinkSurface) return content;
|
|
7010
7144
|
if (view.isAvailable) return renderLink(content);
|
|
7011
|
-
return view.href ? /* @__PURE__ */
|
|
7145
|
+
return view.href ? /* @__PURE__ */ jsx23("span", { "aria-disabled": "true", "data-link-disabled": "true", children: content }) : content;
|
|
7012
7146
|
}
|
|
7013
7147
|
const resolvedImageProps = view.imageProps ? { ...view.imageProps, alt: imageAlt ?? view.imageProps.alt } : void 0;
|
|
7014
7148
|
const imageSource = resolvedImageProps?.src;
|
|
7015
|
-
const [imageStatus, setImageStatus] =
|
|
7016
|
-
|
|
7149
|
+
const [imageStatus, setImageStatus] = useState19(imageSource ? "loading" : "error");
|
|
7150
|
+
useEffect14(() => {
|
|
7017
7151
|
setImageStatus(imageSource ? "loading" : "error");
|
|
7018
7152
|
}, [imageSource]);
|
|
7019
7153
|
let image = null;
|
|
@@ -7031,21 +7165,21 @@ function KeepItemCardRoot({
|
|
|
7031
7165
|
setImageStatus("error");
|
|
7032
7166
|
}
|
|
7033
7167
|
};
|
|
7034
|
-
image = renderImage?.(imagePropsWithHandlers, item) ?? (ImageComponent ? /* @__PURE__ */
|
|
7168
|
+
image = renderImage?.(imagePropsWithHandlers, item) ?? (ImageComponent ? /* @__PURE__ */ jsx23(ImageComponent, { ...imagePropsWithHandlers }) : /* @__PURE__ */ jsx23("img", { ...imagePropsWithHandlers, alt: imagePropsWithHandlers.alt }));
|
|
7035
7169
|
}
|
|
7036
7170
|
const tags = showTags ? item.tags ?? [] : [];
|
|
7037
7171
|
const renderedTags = showTags && tags.length > 0 ? renderTags?.(tags, item) ?? null : null;
|
|
7038
|
-
const meta = showSavedAt ? /* @__PURE__ */
|
|
7039
|
-
showSavedAtLabel ? /* @__PURE__ */
|
|
7172
|
+
const meta = showSavedAt ? /* @__PURE__ */ jsxs20("div", { "data-card-meta": true, children: [
|
|
7173
|
+
showSavedAtLabel ? /* @__PURE__ */ jsxs20("span", { children: [
|
|
7040
7174
|
view.labels.savedAt,
|
|
7041
7175
|
":"
|
|
7042
7176
|
] }) : null,
|
|
7043
7177
|
showSavedAtLabel ? " " : null,
|
|
7044
|
-
/* @__PURE__ */
|
|
7178
|
+
/* @__PURE__ */ jsx23("time", { dateTime: new Date(item.savedAt).toISOString(), children: formatSavedAt(item.savedAt) })
|
|
7045
7179
|
] }) : null;
|
|
7046
|
-
const error = view.itemState.error && !isEditOpen ? /* @__PURE__ */
|
|
7047
|
-
const actions = view.statusLabel ? /* @__PURE__ */
|
|
7048
|
-
showEditButton ? isEditOpen ? /* @__PURE__ */
|
|
7180
|
+
const error = view.itemState.error && !isEditOpen ? /* @__PURE__ */ jsx23("p", { role: "alert", children: getErrorMessage(view.itemState.error, view.labels.error) }) : null;
|
|
7181
|
+
const actions = view.statusLabel ? /* @__PURE__ */ jsx23(KeepStaleNotice, { item, onRetry, onRemoved }) : /* @__PURE__ */ jsxs20(Fragment12, { children: [
|
|
7182
|
+
showEditButton ? isEditOpen ? /* @__PURE__ */ jsx23("div", { ref: editPanelRef, id: editPanelId, role: "dialog", "aria-label": editLabel, "data-keepkit": "item-edit-dialog", children: editSlot ? editSlot(item, closeEdit) : /* @__PURE__ */ jsx23(
|
|
7049
7183
|
KeepQuickEditor,
|
|
7050
7184
|
{
|
|
7051
7185
|
item: view.itemState.item ?? item,
|
|
@@ -7054,7 +7188,7 @@ function KeepItemCardRoot({
|
|
|
7054
7188
|
collectionLabels,
|
|
7055
7189
|
...presentation === "reading" ? { showSaveButton: false, closeLabel: doneLabel } : {}
|
|
7056
7190
|
}
|
|
7057
|
-
) }) : /* @__PURE__ */
|
|
7191
|
+
) }) : /* @__PURE__ */ jsx23(
|
|
7058
7192
|
"button",
|
|
7059
7193
|
{
|
|
7060
7194
|
ref: editTriggerRef,
|
|
@@ -7071,23 +7205,23 @@ function KeepItemCardRoot({
|
|
|
7071
7205
|
children: showEditLabel ? editLabel : null
|
|
7072
7206
|
}
|
|
7073
7207
|
) : null,
|
|
7074
|
-
isEditOpen ? null : /* @__PURE__ */
|
|
7075
|
-
showSaveButton ? /* @__PURE__ */
|
|
7076
|
-
showPinButton ? /* @__PURE__ */
|
|
7077
|
-
presentation === "reading" ? /* @__PURE__ */
|
|
7078
|
-
/* @__PURE__ */
|
|
7079
|
-
/* @__PURE__ */
|
|
7080
|
-
showArchiveButton ? /* @__PURE__ */
|
|
7081
|
-
/* @__PURE__ */
|
|
7208
|
+
isEditOpen ? null : /* @__PURE__ */ jsxs20(Fragment12, { children: [
|
|
7209
|
+
showSaveButton ? /* @__PURE__ */ jsx23(KeepItemCardSave, {}) : null,
|
|
7210
|
+
showPinButton ? /* @__PURE__ */ jsx23(KeepItemCardPin, {}) : null,
|
|
7211
|
+
presentation === "reading" ? /* @__PURE__ */ jsxs20("details", { "data-keep-card-part": "more-actions", children: [
|
|
7212
|
+
/* @__PURE__ */ jsx23("summary", { children: moreLabel }),
|
|
7213
|
+
/* @__PURE__ */ jsxs20("div", { children: [
|
|
7214
|
+
showArchiveButton ? /* @__PURE__ */ jsx23(KeepItemCardArchive, {}) : null,
|
|
7215
|
+
/* @__PURE__ */ jsx23(KeepItemCardRemove, {})
|
|
7082
7216
|
] })
|
|
7083
|
-
] }) : /* @__PURE__ */
|
|
7084
|
-
showArchiveButton ? /* @__PURE__ */
|
|
7085
|
-
/* @__PURE__ */
|
|
7217
|
+
] }) : /* @__PURE__ */ jsxs20(Fragment12, { children: [
|
|
7218
|
+
showArchiveButton ? /* @__PURE__ */ jsx23(KeepItemCardArchive, {}) : null,
|
|
7219
|
+
/* @__PURE__ */ jsx23(KeepItemCardRemove, {})
|
|
7086
7220
|
] })
|
|
7087
7221
|
] }),
|
|
7088
|
-
isEditOpen && presentation !== "reading" && (showPinButton || showArchiveButton) ? /* @__PURE__ */
|
|
7089
|
-
showPinButton ? /* @__PURE__ */
|
|
7090
|
-
showArchiveButton ? /* @__PURE__ */
|
|
7222
|
+
isEditOpen && presentation !== "reading" && (showPinButton || showArchiveButton) ? /* @__PURE__ */ jsxs20("div", { "data-keep-card-part": "actions-secondary", children: [
|
|
7223
|
+
showPinButton ? /* @__PURE__ */ jsx23(KeepItemCardPin, {}) : null,
|
|
7224
|
+
showArchiveButton ? /* @__PURE__ */ jsx23(KeepItemCardArchive, {}) : null
|
|
7091
7225
|
] }) : null
|
|
7092
7226
|
] });
|
|
7093
7227
|
const compoundValue = {
|
|
@@ -7100,7 +7234,7 @@ function KeepItemCardRoot({
|
|
|
7100
7234
|
imageStatus,
|
|
7101
7235
|
fallbackLabel: String(view.resolvedTitle),
|
|
7102
7236
|
note: showNote ? item.note : void 0,
|
|
7103
|
-
activity: showActivity ? /* @__PURE__ */
|
|
7237
|
+
activity: showActivity ? /* @__PURE__ */ jsx23(KeepLastActivity, { item, kind: activityKind }) : null,
|
|
7104
7238
|
tags,
|
|
7105
7239
|
tagsLabel: view.labels.tags,
|
|
7106
7240
|
filterTagsLabel,
|
|
@@ -7117,24 +7251,24 @@ function KeepItemCardRoot({
|
|
|
7117
7251
|
remove: view.remove,
|
|
7118
7252
|
isMutating: view.itemState.isMutating,
|
|
7119
7253
|
saveAriaLabel: `${view.labels.remove} ${String(view.resolvedTitle)}`,
|
|
7120
|
-
renderText: (content) => /* @__PURE__ */
|
|
7254
|
+
renderText: (content) => /* @__PURE__ */ jsx23(KeepHighlight, { query: searchQuery, children: content })
|
|
7121
7255
|
};
|
|
7122
|
-
const media = presentation !== "reading" || resolvedImageProps?.src ? /* @__PURE__ */
|
|
7256
|
+
const media = presentation !== "reading" || resolvedImageProps?.src ? /* @__PURE__ */ jsx23(KeepItemCardMedia, {}) : null;
|
|
7123
7257
|
const customMedia = renderImage !== void 0 || ImageComponent !== void 0;
|
|
7124
|
-
const defaultBody = cardLinkSurface ? /* @__PURE__ */
|
|
7258
|
+
const defaultBody = cardLinkSurface ? /* @__PURE__ */ jsxs20(Fragment12, { children: [
|
|
7125
7259
|
customMedia ? media : null,
|
|
7126
7260
|
renderLink(
|
|
7127
|
-
/* @__PURE__ */
|
|
7261
|
+
/* @__PURE__ */ jsxs20(Fragment12, { children: [
|
|
7128
7262
|
customMedia ? null : media,
|
|
7129
|
-
/* @__PURE__ */
|
|
7263
|
+
/* @__PURE__ */ jsx23(KeepItemCardContent, {})
|
|
7130
7264
|
] })
|
|
7131
7265
|
),
|
|
7132
|
-
/* @__PURE__ */
|
|
7133
|
-
/* @__PURE__ */
|
|
7134
|
-
] }) : /* @__PURE__ */
|
|
7266
|
+
/* @__PURE__ */ jsx23(KeepItemCardTags, {}),
|
|
7267
|
+
/* @__PURE__ */ jsx23(KeepItemCardActions, {})
|
|
7268
|
+
] }) : /* @__PURE__ */ jsxs20(Fragment12, { children: [
|
|
7135
7269
|
media,
|
|
7136
|
-
/* @__PURE__ */
|
|
7137
|
-
/* @__PURE__ */
|
|
7270
|
+
/* @__PURE__ */ jsx23(KeepItemCardContent, {}),
|
|
7271
|
+
/* @__PURE__ */ jsx23(KeepItemCardActions, {})
|
|
7138
7272
|
] });
|
|
7139
7273
|
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? defaultBody;
|
|
7140
7274
|
const root = renderRoot(
|
|
@@ -7159,28 +7293,28 @@ function KeepItemCardRoot({
|
|
|
7159
7293
|
body,
|
|
7160
7294
|
"KeepItemCard"
|
|
7161
7295
|
);
|
|
7162
|
-
return /* @__PURE__ */
|
|
7296
|
+
return /* @__PURE__ */ jsx23(KeepItemCardContext.Provider, { value: compoundValue, children: root });
|
|
7163
7297
|
}
|
|
7164
7298
|
function KeepItemCardMedia({ children, fallback, ...props }) {
|
|
7165
7299
|
const context = useKeepItemCardCompound("Media");
|
|
7166
|
-
return /* @__PURE__ */
|
|
7300
|
+
return /* @__PURE__ */ jsx23("div", { ...props, "data-keep-card-part": "media", "data-media-status": context.imageStatus, "data-aspect-ratio": "1/1", children: children ?? context.image ?? /* @__PURE__ */ jsx23("span", { role: "img", "aria-label": context.fallbackLabel, "data-keep-card-fallback": "true", children: fallback ?? /* @__PURE__ */ jsx23(KeepMediaPlaceholderIcon, {}) }) });
|
|
7167
7301
|
}
|
|
7168
7302
|
function KeepItemCardLink({ children, ...props }) {
|
|
7169
7303
|
const context = useKeepItemCardCompound("Link");
|
|
7170
|
-
const content = /* @__PURE__ */
|
|
7304
|
+
const content = /* @__PURE__ */ jsx23(KeepItemCardContext.Provider, { value: { ...context, cardLinkSurface: true, renderTitle: (title) => title }, children });
|
|
7171
7305
|
return context.cardLinkSurface ? content : context.renderLink(content, props);
|
|
7172
7306
|
}
|
|
7173
7307
|
function KeepItemCardContent({ children, ...props }) {
|
|
7174
7308
|
const context = useKeepItemCardCompound("Content");
|
|
7175
|
-
return /* @__PURE__ */
|
|
7176
|
-
context.reading && context.source ? /* @__PURE__ */
|
|
7177
|
-
/* @__PURE__ */
|
|
7178
|
-
context.reading ? /* @__PURE__ */
|
|
7309
|
+
return /* @__PURE__ */ jsx23("div", { ...props, "data-keep-card-part": "content", children: children === void 0 ? /* @__PURE__ */ jsxs20(Fragment12, { children: [
|
|
7310
|
+
context.reading && context.source ? /* @__PURE__ */ jsx23("span", { "data-keep-card-part": "source", children: context.source }) : null,
|
|
7311
|
+
/* @__PURE__ */ jsx23(KeepItemCardTitle, {}),
|
|
7312
|
+
context.reading ? /* @__PURE__ */ jsx23(KeepItemCardCollectionBadge, {}) : null,
|
|
7179
7313
|
context.reading ? null : context.meta,
|
|
7180
7314
|
context.reading ? null : context.activity,
|
|
7181
|
-
context.note ? /* @__PURE__ */
|
|
7182
|
-
context.cardLinkSurface ? null : /* @__PURE__ */
|
|
7183
|
-
context.reading ? /* @__PURE__ */
|
|
7315
|
+
context.note ? /* @__PURE__ */ jsx23("p", { "data-keep-card-part": "memo-preview", "data-line-clamp": "2", children: context.note }) : null,
|
|
7316
|
+
context.cardLinkSurface ? null : /* @__PURE__ */ jsx23(KeepItemCardTags, {}),
|
|
7317
|
+
context.reading ? /* @__PURE__ */ jsxs20("div", { "data-keep-card-part": "reading-metadata", children: [
|
|
7184
7318
|
context.meta,
|
|
7185
7319
|
context.activity
|
|
7186
7320
|
] }) : null,
|
|
@@ -7196,8 +7330,8 @@ function KeepItemCardTitle({ as = "h3", children, ...props }) {
|
|
|
7196
7330
|
);
|
|
7197
7331
|
}
|
|
7198
7332
|
function KeepMediaPlaceholderIcon() {
|
|
7199
|
-
return /* @__PURE__ */
|
|
7200
|
-
/* @__PURE__ */
|
|
7333
|
+
return /* @__PURE__ */ jsxs20("svg", { "data-media-fallback-icon": "true", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
|
|
7334
|
+
/* @__PURE__ */ jsx23(
|
|
7201
7335
|
"path",
|
|
7202
7336
|
{
|
|
7203
7337
|
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",
|
|
@@ -7205,15 +7339,15 @@ function KeepMediaPlaceholderIcon() {
|
|
|
7205
7339
|
stroke: "currentColor"
|
|
7206
7340
|
}
|
|
7207
7341
|
),
|
|
7208
|
-
/* @__PURE__ */
|
|
7209
|
-
/* @__PURE__ */
|
|
7342
|
+
/* @__PURE__ */ jsx23("circle", { cx: "9", cy: "9", r: "1.5", fill: "currentColor" }),
|
|
7343
|
+
/* @__PURE__ */ jsx23("path", { d: "m5.5 18 4.5-4.5 3 3 2-2L19 18", fill: "none", stroke: "currentColor" })
|
|
7210
7344
|
] });
|
|
7211
7345
|
}
|
|
7212
7346
|
function KeepItemCardTags({ children, ...props }) {
|
|
7213
7347
|
const context = useKeepItemCardCompound("Tags");
|
|
7214
7348
|
if (children === void 0 && context.renderedTags) return context.renderedTags;
|
|
7215
7349
|
if (children === void 0 && context.tags.length === 0) return null;
|
|
7216
|
-
return /* @__PURE__ */
|
|
7350
|
+
return /* @__PURE__ */ jsx23("ul", { ...props, "aria-label": props["aria-label"] ?? context.tagsLabel, "data-keep-card-part": "tags", children: children ?? context.tags.map((tag) => /* @__PURE__ */ jsx23("li", { children: context.onTagClick ? /* @__PURE__ */ jsx23(
|
|
7217
7351
|
"button",
|
|
7218
7352
|
{
|
|
7219
7353
|
type: "button",
|
|
@@ -7226,7 +7360,7 @@ function KeepItemCardTags({ children, ...props }) {
|
|
|
7226
7360
|
}
|
|
7227
7361
|
function KeepItemCardActions({ children, ...props }) {
|
|
7228
7362
|
const context = useKeepItemCardCompound("Actions");
|
|
7229
|
-
return /* @__PURE__ */
|
|
7363
|
+
return /* @__PURE__ */ jsx23("div", { ...props, "data-keep-card-part": "actions", children: children ?? context.actions });
|
|
7230
7364
|
}
|
|
7231
7365
|
function KeepLastActivity({
|
|
7232
7366
|
item,
|
|
@@ -7238,15 +7372,15 @@ function KeepLastActivity({
|
|
|
7238
7372
|
const neverOpenedLabel = useUiLabel("activityNeverOpened");
|
|
7239
7373
|
const inactiveSuffix = useUiLabel("activityInactiveSuffix");
|
|
7240
7374
|
if (item.lastOpenedAt === void 0) {
|
|
7241
|
-
return /* @__PURE__ */
|
|
7375
|
+
return /* @__PURE__ */ jsx23("span", { ...props, "data-keep-card-part": "activity", children: neverOpenedLabel });
|
|
7242
7376
|
}
|
|
7243
7377
|
const age = Math.max(0, Date.now() - item.lastOpenedAt);
|
|
7244
7378
|
const label = kind === "opened" ? `${openedLabel} ${formatRelativeAge(age, locale)}` : `${formatInactiveAge(age, locale)}${isCjkLocale2(locale) ? "" : " "}${inactiveSuffix}`;
|
|
7245
|
-
return /* @__PURE__ */
|
|
7379
|
+
return /* @__PURE__ */ jsx23("span", { ...props, "data-keep-card-part": "activity", children: /* @__PURE__ */ jsx23("time", { dateTime: new Date(item.lastOpenedAt).toISOString(), children: label }) });
|
|
7246
7380
|
}
|
|
7247
7381
|
function KeepItemCardSave({ labels, getAriaLabel, ...props }) {
|
|
7248
7382
|
const context = useKeepItemCardCompound("Save");
|
|
7249
|
-
return /* @__PURE__ */
|
|
7383
|
+
return /* @__PURE__ */ jsx23(
|
|
7250
7384
|
KeepButton,
|
|
7251
7385
|
{
|
|
7252
7386
|
...props,
|
|
@@ -7259,7 +7393,7 @@ function KeepItemCardSave({ labels, getAriaLabel, ...props }) {
|
|
|
7259
7393
|
}
|
|
7260
7394
|
function KeepItemCardRemove({ children, disabled, onClick, ...props }) {
|
|
7261
7395
|
const context = useKeepItemCardCompound("Remove");
|
|
7262
|
-
return /* @__PURE__ */
|
|
7396
|
+
return /* @__PURE__ */ jsx23(
|
|
7263
7397
|
"button",
|
|
7264
7398
|
{
|
|
7265
7399
|
...props,
|
|
@@ -7276,19 +7410,19 @@ function KeepItemCardRemove({ children, disabled, onClick, ...props }) {
|
|
|
7276
7410
|
}
|
|
7277
7411
|
function KeepItemCardPin({ children, ...props }) {
|
|
7278
7412
|
const context = useKeepItemCardCompound("Pin");
|
|
7279
|
-
return /* @__PURE__ */
|
|
7413
|
+
return /* @__PURE__ */ jsx23(KeepPinButton, { ...props, item: context.item, children });
|
|
7280
7414
|
}
|
|
7281
7415
|
function KeepItemCardArchive({
|
|
7282
7416
|
children,
|
|
7283
7417
|
...props
|
|
7284
7418
|
}) {
|
|
7285
7419
|
const context = useKeepItemCardCompound("Archive");
|
|
7286
|
-
return /* @__PURE__ */
|
|
7420
|
+
return /* @__PURE__ */ jsx23(KeepArchiveButton, { ...props, item: context.item, children });
|
|
7287
7421
|
}
|
|
7288
7422
|
function KeepItemCardCollectionBadge({ children, ...props }) {
|
|
7289
7423
|
const context = useKeepItemCardCompound("CollectionBadge");
|
|
7290
7424
|
if (!context.item.collectionId) return null;
|
|
7291
|
-
return /* @__PURE__ */
|
|
7425
|
+
return /* @__PURE__ */ jsx23("span", { ...props, "data-keep-card-part": "collection-badge", children: children ?? context.collectionLabel });
|
|
7292
7426
|
}
|
|
7293
7427
|
var KeepItemCard = Object.assign(KeepItemCardRoot, {
|
|
7294
7428
|
Link: KeepItemCardLink,
|
|
@@ -7304,12 +7438,12 @@ var KeepItemCard = Object.assign(KeepItemCardRoot, {
|
|
|
7304
7438
|
CollectionBadge: KeepItemCardCollectionBadge
|
|
7305
7439
|
});
|
|
7306
7440
|
function KeepItemCardSkeleton({ layout = "list", ...props }) {
|
|
7307
|
-
return /* @__PURE__ */
|
|
7308
|
-
/* @__PURE__ */
|
|
7309
|
-
/* @__PURE__ */
|
|
7310
|
-
/* @__PURE__ */
|
|
7311
|
-
/* @__PURE__ */
|
|
7312
|
-
/* @__PURE__ */
|
|
7441
|
+
return /* @__PURE__ */ jsxs20("article", { ...props, "aria-hidden": "true", "data-keepkit": "card-skeleton", "data-layout": layout, "data-state": "loading", children: [
|
|
7442
|
+
/* @__PURE__ */ jsx23("span", { "data-skeleton-part": "media" }),
|
|
7443
|
+
/* @__PURE__ */ jsx23("span", { "data-skeleton-part": "title" }),
|
|
7444
|
+
/* @__PURE__ */ jsx23("span", { "data-skeleton-part": "meta" }),
|
|
7445
|
+
/* @__PURE__ */ jsx23("span", { "data-skeleton-part": "tag" }),
|
|
7446
|
+
/* @__PURE__ */ jsx23("span", { "data-skeleton-part": "tag" })
|
|
7313
7447
|
] });
|
|
7314
7448
|
}
|
|
7315
7449
|
function formatSavedAt(timestamp) {
|
|
@@ -7345,7 +7479,7 @@ function getSource(href) {
|
|
|
7345
7479
|
|
|
7346
7480
|
// src/features/status/KeepEmptyState.tsx
|
|
7347
7481
|
import { isValidElement as isValidElement6 } from "react";
|
|
7348
|
-
import { Fragment as
|
|
7482
|
+
import { Fragment as Fragment13, jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7349
7483
|
function KeepEmptyState({
|
|
7350
7484
|
title,
|
|
7351
7485
|
description,
|
|
@@ -7364,10 +7498,10 @@ function KeepEmptyState({
|
|
|
7364
7498
|
);
|
|
7365
7499
|
const clearLabel = useUiLabel("clearFilters");
|
|
7366
7500
|
const contentChildren = asChild && isValidElement6(children) ? void 0 : children;
|
|
7367
|
-
const body = contentChildren ?? /* @__PURE__ */
|
|
7368
|
-
/* @__PURE__ */
|
|
7369
|
-
description ?? /* @__PURE__ */
|
|
7370
|
-
action ?? (resolvedVariant === "empty-filtered" && onClearFilters ? /* @__PURE__ */
|
|
7501
|
+
const body = contentChildren ?? /* @__PURE__ */ jsxs21(Fragment13, { children: [
|
|
7502
|
+
/* @__PURE__ */ jsx24("h2", { children: title ?? defaultTitle }),
|
|
7503
|
+
description ?? /* @__PURE__ */ jsx24("p", { children: defaultDescription }),
|
|
7504
|
+
action ?? (resolvedVariant === "empty-filtered" && onClearFilters ? /* @__PURE__ */ jsx24("button", { type: "button", "data-keep-action": "clear-filters", onClick: onClearFilters, children: clearLabel }) : null)
|
|
7371
7505
|
] });
|
|
7372
7506
|
return renderRoot(
|
|
7373
7507
|
asChild,
|
|
@@ -7396,9 +7530,9 @@ function useKeepListView(query) {
|
|
|
7396
7530
|
}
|
|
7397
7531
|
|
|
7398
7532
|
// src/features/collection/hooks/useRovingTabIndex.ts
|
|
7399
|
-
import { useCallback as useCallback7, useEffect as
|
|
7533
|
+
import { useCallback as useCallback7, useEffect as useEffect15, useRef as useRef14 } from "react";
|
|
7400
7534
|
function useRovingTabIndex() {
|
|
7401
|
-
const ref =
|
|
7535
|
+
const ref = useRef14(null);
|
|
7402
7536
|
const getItems = useCallback7(() => {
|
|
7403
7537
|
const root = ref.current;
|
|
7404
7538
|
if (!root) return [];
|
|
@@ -7416,7 +7550,7 @@ function useRovingTabIndex() {
|
|
|
7416
7550
|
item.tabIndex = index === activeIndex ? 0 : -1;
|
|
7417
7551
|
});
|
|
7418
7552
|
}, [getItems]);
|
|
7419
|
-
|
|
7553
|
+
useEffect15(() => {
|
|
7420
7554
|
const root = ref.current;
|
|
7421
7555
|
if (!root) return;
|
|
7422
7556
|
syncTabIndices();
|
|
@@ -7461,8 +7595,8 @@ function useRovingTabIndex() {
|
|
|
7461
7595
|
}
|
|
7462
7596
|
|
|
7463
7597
|
// src/features/collection/KeepReorderableList.tsx
|
|
7464
|
-
import { useRef as
|
|
7465
|
-
import { Fragment as
|
|
7598
|
+
import { useRef as useRef15, useState as useState20 } from "react";
|
|
7599
|
+
import { Fragment as Fragment14, jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7466
7600
|
function KeepReorderableList({
|
|
7467
7601
|
items,
|
|
7468
7602
|
onReorder,
|
|
@@ -7470,12 +7604,12 @@ function KeepReorderableList({
|
|
|
7470
7604
|
itemLabel,
|
|
7471
7605
|
...props
|
|
7472
7606
|
}) {
|
|
7473
|
-
const [draggedId, setDraggedId] =
|
|
7474
|
-
const [dropTargetIndex, setDropTargetIndex] =
|
|
7475
|
-
const [announcement, setAnnouncement] =
|
|
7476
|
-
const [error, setError] =
|
|
7477
|
-
const [pending, setPending] =
|
|
7478
|
-
const pendingRef =
|
|
7607
|
+
const [draggedId, setDraggedId] = useState20(null);
|
|
7608
|
+
const [dropTargetIndex, setDropTargetIndex] = useState20(null);
|
|
7609
|
+
const [announcement, setAnnouncement] = useState20("");
|
|
7610
|
+
const [error, setError] = useState20("");
|
|
7611
|
+
const [pending, setPending] = useState20(false);
|
|
7612
|
+
const pendingRef = useRef15(false);
|
|
7479
7613
|
const moveLabel = useUiLabel("moveItem");
|
|
7480
7614
|
const movedLabel = useUiLabel("reorderMoved");
|
|
7481
7615
|
const failedLabel = useUiLabel("reorderFailed");
|
|
@@ -7518,8 +7652,8 @@ function KeepReorderableList({
|
|
|
7518
7652
|
if (next[index] === id) return;
|
|
7519
7653
|
void commit(next, index);
|
|
7520
7654
|
}
|
|
7521
|
-
return /* @__PURE__ */
|
|
7522
|
-
/* @__PURE__ */
|
|
7655
|
+
return /* @__PURE__ */ jsxs22(Fragment14, { children: [
|
|
7656
|
+
/* @__PURE__ */ jsx25("ul", { ...props, "aria-busy": pending || props["aria-busy"], "data-keepkit": "reorderable-list", children: items.map((item, index) => {
|
|
7523
7657
|
const moveUp = () => move(index, index - 1);
|
|
7524
7658
|
const moveDown = () => move(index, index + 1);
|
|
7525
7659
|
const onHandleKeyDown = (event) => {
|
|
@@ -7567,7 +7701,7 @@ function KeepReorderableList({
|
|
|
7567
7701
|
onKeyDown: onHandleKeyDown
|
|
7568
7702
|
}
|
|
7569
7703
|
};
|
|
7570
|
-
return /* @__PURE__ */
|
|
7704
|
+
return /* @__PURE__ */ jsx25(
|
|
7571
7705
|
"li",
|
|
7572
7706
|
{
|
|
7573
7707
|
"data-reorder-index": index,
|
|
@@ -7596,18 +7730,18 @@ function KeepReorderableList({
|
|
|
7596
7730
|
item.id
|
|
7597
7731
|
);
|
|
7598
7732
|
}) }),
|
|
7599
|
-
/* @__PURE__ */
|
|
7600
|
-
error ? /* @__PURE__ */
|
|
7733
|
+
/* @__PURE__ */ jsx25("span", { role: "status", "aria-live": "polite", "aria-atomic": "true", children: announcement }),
|
|
7734
|
+
error ? /* @__PURE__ */ jsx25("p", { role: "alert", children: error }) : null
|
|
7601
7735
|
] });
|
|
7602
7736
|
}
|
|
7603
7737
|
|
|
7604
7738
|
// src/features/collection/KeepList.tsx
|
|
7605
|
-
import { Fragment as
|
|
7739
|
+
import { Fragment as Fragment15, jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7606
7740
|
function KeepList(props) {
|
|
7607
7741
|
const { fallback, onBoundaryError, boundaryResetKey, ...listProps } = props;
|
|
7608
|
-
const content = /* @__PURE__ */
|
|
7742
|
+
const content = /* @__PURE__ */ jsx26(KeepListContent, { ...listProps });
|
|
7609
7743
|
if (fallback === void 0 && onBoundaryError === void 0) return content;
|
|
7610
|
-
return /* @__PURE__ */
|
|
7744
|
+
return /* @__PURE__ */ jsx26(KeepErrorBoundary, { fallback, onError: onBoundaryError, resetKey: boundaryResetKey, children: content });
|
|
7611
7745
|
}
|
|
7612
7746
|
function KeepListContent({
|
|
7613
7747
|
query,
|
|
@@ -7674,7 +7808,7 @@ function KeepListContent({
|
|
|
7674
7808
|
if (!event.defaultPrevented) roving.onFocusCapture(event);
|
|
7675
7809
|
}
|
|
7676
7810
|
},
|
|
7677
|
-
/* @__PURE__ */
|
|
7811
|
+
/* @__PURE__ */ jsx26(KeepSearchQueryProvider, { query: query?.search?.query, children: body }),
|
|
7678
7812
|
"KeepList"
|
|
7679
7813
|
);
|
|
7680
7814
|
}
|
|
@@ -7689,17 +7823,17 @@ function getListBody(state, options) {
|
|
|
7689
7823
|
if (state.isLoading && !state.isHydrated) {
|
|
7690
7824
|
if (options.loading !== void 0) return resolveContent(options.loading, state);
|
|
7691
7825
|
const count = Number.isFinite(options.loadingCount) ? Math.max(0, Math.floor(options.loadingCount)) : 6;
|
|
7692
|
-
return /* @__PURE__ */
|
|
7693
|
-
/* @__PURE__ */
|
|
7694
|
-
/* @__PURE__ */
|
|
7826
|
+
return /* @__PURE__ */ jsxs23(Fragment15, { children: [
|
|
7827
|
+
/* @__PURE__ */ jsx26("span", { role: "status", "data-keepkit": "loading-label", children: options.loadingLabel }),
|
|
7828
|
+
/* @__PURE__ */ jsx26("ul", { "data-keepkit": "skeleton-list", "data-layout": options.layout, children: Array.from({ length: count }, (_, index) => (
|
|
7695
7829
|
// biome-ignore lint/suspicious/noArrayIndexKey: Static loading placeholders never reorder.
|
|
7696
|
-
/* @__PURE__ */
|
|
7830
|
+
/* @__PURE__ */ jsx26("li", { children: /* @__PURE__ */ jsx26(KeepItemCardSkeleton, { layout: options.layout }) }, index)
|
|
7697
7831
|
)) })
|
|
7698
7832
|
] });
|
|
7699
7833
|
}
|
|
7700
7834
|
if (state.isHydrated && state.items.length === 0) {
|
|
7701
7835
|
if (options.empty !== void 0) return resolveContent(options.empty, state);
|
|
7702
|
-
return /* @__PURE__ */
|
|
7836
|
+
return /* @__PURE__ */ jsx26(
|
|
7703
7837
|
KeepEmptyState,
|
|
7704
7838
|
{
|
|
7705
7839
|
variant: options.allItemCount > 0 && hasActiveQueryFilters(options.query) ? "empty-filtered" : "empty-storage",
|
|
@@ -7710,7 +7844,7 @@ function getListBody(state, options) {
|
|
|
7710
7844
|
if (typeof options.children === "function") return options.children(state);
|
|
7711
7845
|
if (options.children !== void 0 && !isValidElement7(options.children)) return options.children;
|
|
7712
7846
|
if (options.reorderable) {
|
|
7713
|
-
return /* @__PURE__ */
|
|
7847
|
+
return /* @__PURE__ */ jsx26(
|
|
7714
7848
|
KeepReorderableList,
|
|
7715
7849
|
{
|
|
7716
7850
|
items: state.items,
|
|
@@ -7718,21 +7852,21 @@ function getListBody(state, options) {
|
|
|
7718
7852
|
await options.reorder(orderedIds);
|
|
7719
7853
|
await options.onReorder?.(orderedIds);
|
|
7720
7854
|
},
|
|
7721
|
-
renderItem: (item, reorderState) => /* @__PURE__ */
|
|
7722
|
-
/* @__PURE__ */
|
|
7723
|
-
options.renderItem ? options.renderItem(item, state, getItemSelection(item.id, options.selection)) : /* @__PURE__ */
|
|
7724
|
-
options.selection ? /* @__PURE__ */
|
|
7725
|
-
/* @__PURE__ */
|
|
7855
|
+
renderItem: (item, reorderState) => /* @__PURE__ */ jsxs23(Fragment15, { children: [
|
|
7856
|
+
/* @__PURE__ */ jsx26("button", { type: "button", ...reorderState.dragHandleProps, children: "\u2195" }),
|
|
7857
|
+
options.renderItem ? options.renderItem(item, state, getItemSelection(item.id, options.selection)) : /* @__PURE__ */ jsxs23(Fragment15, { children: [
|
|
7858
|
+
options.selection ? /* @__PURE__ */ jsx26(KeepItemCheckbox, { item, ...getItemSelection(item.id, options.selection) }) : null,
|
|
7859
|
+
/* @__PURE__ */ jsx26(KeepItemCard, { item, ...options.itemCardProps })
|
|
7726
7860
|
] })
|
|
7727
7861
|
] }),
|
|
7728
7862
|
"data-layout": options.layout
|
|
7729
7863
|
}
|
|
7730
7864
|
);
|
|
7731
7865
|
}
|
|
7732
|
-
return /* @__PURE__ */
|
|
7733
|
-
(item) => options.renderItem ? options.renderItem(item, state, getItemSelection(item.id, options.selection)) : /* @__PURE__ */
|
|
7734
|
-
options.selection ? /* @__PURE__ */
|
|
7735
|
-
/* @__PURE__ */
|
|
7866
|
+
return /* @__PURE__ */ jsx26("ul", { "data-layout": options.layout, children: state.items.map(
|
|
7867
|
+
(item) => options.renderItem ? options.renderItem(item, state, getItemSelection(item.id, options.selection)) : /* @__PURE__ */ jsxs23("li", { "data-selectable": options.selection ? "true" : void 0, children: [
|
|
7868
|
+
options.selection ? /* @__PURE__ */ jsx26(KeepItemCheckbox, { item, ...getItemSelection(item.id, options.selection) }) : null,
|
|
7869
|
+
/* @__PURE__ */ jsx26(KeepItemCard, { item, ...options.itemCardProps })
|
|
7736
7870
|
] }, item.id)
|
|
7737
7871
|
) });
|
|
7738
7872
|
}
|
|
@@ -7756,13 +7890,13 @@ function getItemSelection(id, selection) {
|
|
|
7756
7890
|
}
|
|
7757
7891
|
|
|
7758
7892
|
// src/features/collection/KeepCollection.tsx
|
|
7759
|
-
import { Fragment as
|
|
7893
|
+
import { Fragment as Fragment16, jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
7760
7894
|
var EMPTY_QUERY = {};
|
|
7761
7895
|
function KeepCollection(props) {
|
|
7762
7896
|
const { fallback, onBoundaryError, boundaryResetKey, ...collectionProps } = props;
|
|
7763
|
-
const content = /* @__PURE__ */
|
|
7897
|
+
const content = /* @__PURE__ */ jsx27(KeepCollectionContent, { ...collectionProps });
|
|
7764
7898
|
if (fallback === void 0 && onBoundaryError === void 0) return content;
|
|
7765
|
-
return /* @__PURE__ */
|
|
7899
|
+
return /* @__PURE__ */ jsx27(KeepErrorBoundary2, { fallback, onError: onBoundaryError, resetKey: boundaryResetKey, children: content });
|
|
7766
7900
|
}
|
|
7767
7901
|
function KeepCollectionContent({
|
|
7768
7902
|
query = EMPTY_QUERY,
|
|
@@ -7770,6 +7904,7 @@ function KeepCollectionContent({
|
|
|
7770
7904
|
layout = "list",
|
|
7771
7905
|
toolbarVariant = "plain",
|
|
7772
7906
|
toolbarLayout = "flat",
|
|
7907
|
+
collapsibleFilters = false,
|
|
7773
7908
|
urlSync = false,
|
|
7774
7909
|
urlAdapter,
|
|
7775
7910
|
archiveScope,
|
|
@@ -7796,15 +7931,15 @@ function KeepCollectionContent({
|
|
|
7796
7931
|
...rootProps
|
|
7797
7932
|
}) {
|
|
7798
7933
|
const view = useKeepCollection({ query, pageSize, urlSync, urlAdapter, features, archiveScope, reorderable });
|
|
7799
|
-
const revealRequestId =
|
|
7800
|
-
|
|
7934
|
+
const revealRequestId = useRef16(void 0);
|
|
7935
|
+
useEffect16(() => {
|
|
7801
7936
|
if (!view.list.isHydrated || !revealRequest || revealRequestId.current === revealRequest.requestId) return;
|
|
7802
7937
|
revealRequestId.current = revealRequest.requestId;
|
|
7803
7938
|
const status = view.reveal(revealRequest.itemId);
|
|
7804
7939
|
onRevealResult?.({ ...revealRequest, status });
|
|
7805
7940
|
}, [onRevealResult, revealRequest, view.list.isHydrated, view.reveal]);
|
|
7806
|
-
const [reorderUndoIds, setReorderUndoIds] =
|
|
7807
|
-
const [reorderError, setReorderError] =
|
|
7941
|
+
const [reorderUndoIds, setReorderUndoIds] = useState21(null);
|
|
7942
|
+
const [reorderError, setReorderError] = useState21(false);
|
|
7808
7943
|
const reorderUndoLabel = useUiLabel("undoReorder");
|
|
7809
7944
|
const reorderFailedLabel = useUiLabel("reorderFailed");
|
|
7810
7945
|
const handleReorder = async (orderedIds) => {
|
|
@@ -7818,7 +7953,7 @@ function KeepCollectionContent({
|
|
|
7818
7953
|
setReorderUndoIds(previousIds);
|
|
7819
7954
|
await onReorder?.(orderedItems);
|
|
7820
7955
|
};
|
|
7821
|
-
|
|
7956
|
+
useEffect16(() => {
|
|
7822
7957
|
if (!reorderUndoIds) return;
|
|
7823
7958
|
const timer = window.setTimeout(() => setReorderUndoIds(null), 5e3);
|
|
7824
7959
|
return () => window.clearTimeout(timer);
|
|
@@ -7846,13 +7981,14 @@ function KeepCollectionContent({
|
|
|
7846
7981
|
showEditButton: itemCardProps?.showEditButton ?? features?.note ?? (itemCardProps?.presentation === "reading" || view.enabled.note),
|
|
7847
7982
|
showNote: itemCardProps?.showNote ?? features?.note ?? (itemCardProps?.presentation === "reading" || view.enabled.note)
|
|
7848
7983
|
};
|
|
7849
|
-
const toolbarId =
|
|
7850
|
-
const
|
|
7984
|
+
const toolbarId = useId5();
|
|
7985
|
+
const [filtersOpen, setFiltersOpen] = useState21(false);
|
|
7986
|
+
const structuredToolbar = collapsibleFilters || toolbarLayout === "grouped" || toolbarVariant === "panel" || creatable || slots?.toolbarStart !== void 0 || slots?.toolbarEnd !== void 0;
|
|
7851
7987
|
const hasQueryControls = view.enabled.search || view.enabled.sort;
|
|
7852
7988
|
const hasFilterControls = view.enabled.tagFilter || view.enabled.collectionFilter || archiveScope !== void 0;
|
|
7853
|
-
const queryControls = hasQueryControls ? /* @__PURE__ */
|
|
7854
|
-
view.enabled.search ? /* @__PURE__ */
|
|
7855
|
-
view.enabled.sort ? /* @__PURE__ */
|
|
7989
|
+
const queryControls = hasQueryControls ? /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
7990
|
+
view.enabled.search ? /* @__PURE__ */ jsx27(KeepSearchInput, { value: view.searchValue, onValueChange: view.setSearchValue }) : null,
|
|
7991
|
+
view.enabled.sort ? /* @__PURE__ */ jsx27(
|
|
7856
7992
|
KeepSortSelect,
|
|
7857
7993
|
{
|
|
7858
7994
|
value: view.sortValue,
|
|
@@ -7861,9 +7997,9 @@ function KeepCollectionContent({
|
|
|
7861
7997
|
}
|
|
7862
7998
|
) : null
|
|
7863
7999
|
] }) : null;
|
|
7864
|
-
const filterControls = hasFilterControls ? /* @__PURE__ */
|
|
7865
|
-
view.enabled.tagFilter ? /* @__PURE__ */
|
|
7866
|
-
view.enabled.collectionFilter ? /* @__PURE__ */
|
|
8000
|
+
const filterControls = hasFilterControls ? /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
8001
|
+
view.enabled.tagFilter ? /* @__PURE__ */ jsx27(KeepTagFilter, { query, values: view.activeTags, onValuesChange: view.setTags }) : null,
|
|
8002
|
+
view.enabled.collectionFilter ? /* @__PURE__ */ jsx27(
|
|
7867
8003
|
KeepCollectionFilter,
|
|
7868
8004
|
{
|
|
7869
8005
|
value: view.activeCollection ?? "",
|
|
@@ -7871,7 +8007,7 @@ function KeepCollectionContent({
|
|
|
7871
8007
|
collectionLabels
|
|
7872
8008
|
}
|
|
7873
8009
|
) : null,
|
|
7874
|
-
archiveScope !== void 0 ? /* @__PURE__ */
|
|
8010
|
+
archiveScope !== void 0 ? /* @__PURE__ */ jsx27(
|
|
7875
8011
|
KeepArchiveScopeSelect,
|
|
7876
8012
|
{
|
|
7877
8013
|
value: view.archiveScope,
|
|
@@ -7889,8 +8025,8 @@ function KeepCollectionContent({
|
|
|
7889
8025
|
const uncategorizedLabel = useUiLabel("uncategorized");
|
|
7890
8026
|
const activeCollectionLabel = view.activeCollection === "__uncategorized__" ? uncategorizedLabel : view.activeCollection === void 0 ? void 0 : collectionLabels?.[view.activeCollection] ?? view.activeCollection;
|
|
7891
8027
|
const toolbarStartContent = slots?.toolbarStart === void 0 ? null : resolveContent(slots.toolbarStart, view.list);
|
|
7892
|
-
const creatableContent = creatable ? /* @__PURE__ */
|
|
7893
|
-
const toolbarEndContent = /* @__PURE__ */
|
|
8028
|
+
const creatableContent = creatable ? /* @__PURE__ */ jsx27(KeepCollectionCreate, {}) : null;
|
|
8029
|
+
const toolbarEndContent = /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
7894
8030
|
creatableContent,
|
|
7895
8031
|
slots?.toolbarEnd === void 0 ? null : resolveContent(slots.toolbarEnd, view.list)
|
|
7896
8032
|
] });
|
|
@@ -7898,7 +8034,7 @@ function KeepCollectionContent({
|
|
|
7898
8034
|
const renderToolbarGroup = (group, content, label) => {
|
|
7899
8035
|
if (!hasRenderableContent(content)) return null;
|
|
7900
8036
|
const labelId = `${toolbarId}-${group}`;
|
|
7901
|
-
return /* @__PURE__ */
|
|
8037
|
+
return /* @__PURE__ */ jsxs24(
|
|
7902
8038
|
"fieldset",
|
|
7903
8039
|
{
|
|
7904
8040
|
"data-keepkit": "collection-toolbar-group",
|
|
@@ -7906,23 +8042,35 @@ function KeepCollectionContent({
|
|
|
7906
8042
|
role: "group",
|
|
7907
8043
|
"aria-labelledby": labelId,
|
|
7908
8044
|
children: [
|
|
7909
|
-
/* @__PURE__ */
|
|
7910
|
-
/* @__PURE__ */
|
|
8045
|
+
/* @__PURE__ */ jsx27("legend", { id: labelId, "data-keepkit": "collection-toolbar-label", children: label }),
|
|
8046
|
+
/* @__PURE__ */ jsx27("div", { "data-keepkit": "collection-toolbar-content", children: content })
|
|
7911
8047
|
]
|
|
7912
8048
|
}
|
|
7913
8049
|
);
|
|
7914
8050
|
};
|
|
7915
|
-
const toolbar = !structuredToolbar ? /* @__PURE__ */
|
|
8051
|
+
const toolbar = !structuredToolbar ? /* @__PURE__ */ jsxs24("div", { children: [
|
|
7916
8052
|
queryControls,
|
|
7917
8053
|
filterControls
|
|
7918
|
-
] }) : !hasToolbarContent ? null : /* @__PURE__ */
|
|
8054
|
+
] }) : !hasToolbarContent ? null : /* @__PURE__ */ jsxs24("div", { "data-keepkit": "collection-toolbar", "data-variant": toolbarVariant, "data-layout": toolbarLayout, children: [
|
|
7919
8055
|
renderToolbarGroup("toolbarStart", toolbarStartContent, toolbarStartLabel),
|
|
7920
8056
|
renderToolbarGroup("query", queryControls, toolbarQueryLabel),
|
|
7921
|
-
|
|
8057
|
+
hasFilterControls && collapsibleFilters ? /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
8058
|
+
/* @__PURE__ */ jsx27(
|
|
8059
|
+
"button",
|
|
8060
|
+
{
|
|
8061
|
+
type: "button",
|
|
8062
|
+
"aria-expanded": filtersOpen,
|
|
8063
|
+
"aria-controls": `${toolbarId}-filter-controls`,
|
|
8064
|
+
onClick: () => setFiltersOpen(!filtersOpen),
|
|
8065
|
+
children: toolbarFiltersLabel
|
|
8066
|
+
}
|
|
8067
|
+
),
|
|
8068
|
+
/* @__PURE__ */ jsx27("div", { id: `${toolbarId}-filter-controls`, hidden: !filtersOpen, children: renderToolbarGroup("filters", filterControls, toolbarFiltersLabel) })
|
|
8069
|
+
] }) : renderToolbarGroup("filters", filterControls, toolbarFiltersLabel),
|
|
7922
8070
|
renderToolbarGroup("toolbarEnd", toolbarEndContent, toolbarEndLabel)
|
|
7923
8071
|
] });
|
|
7924
|
-
const renderList = (selection) => /* @__PURE__ */
|
|
7925
|
-
/* @__PURE__ */
|
|
8072
|
+
const renderList = (selection) => /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
8073
|
+
/* @__PURE__ */ jsx27(
|
|
7926
8074
|
KeepList,
|
|
7927
8075
|
{
|
|
7928
8076
|
query: view.resolvedQuery,
|
|
@@ -7933,14 +8081,14 @@ function KeepCollectionContent({
|
|
|
7933
8081
|
loading,
|
|
7934
8082
|
renderLoading,
|
|
7935
8083
|
loadingCount,
|
|
7936
|
-
onClearFilters: view.clearFilters,
|
|
8084
|
+
onClearFilters: () => view.clearFilters(true),
|
|
7937
8085
|
reorderable,
|
|
7938
8086
|
onReorder: reorderable ? handleReorder : void 0,
|
|
7939
8087
|
empty: view.list.totalCount === 0 && view.allState.totalCount > 0 ? void 0 : empty,
|
|
7940
8088
|
error
|
|
7941
8089
|
}
|
|
7942
8090
|
),
|
|
7943
|
-
view.enabled.pagination ? /* @__PURE__ */
|
|
8091
|
+
view.enabled.pagination ? /* @__PURE__ */ jsx27(
|
|
7944
8092
|
KeepPagination,
|
|
7945
8093
|
{
|
|
7946
8094
|
totalCount: view.list.totalCount,
|
|
@@ -7950,7 +8098,7 @@ function KeepCollectionContent({
|
|
|
7950
8098
|
}
|
|
7951
8099
|
) : null
|
|
7952
8100
|
] });
|
|
7953
|
-
return /* @__PURE__ */
|
|
8101
|
+
return /* @__PURE__ */ jsxs24(
|
|
7954
8102
|
"section",
|
|
7955
8103
|
{
|
|
7956
8104
|
...rootProps,
|
|
@@ -7964,11 +8112,11 @@ function KeepCollectionContent({
|
|
|
7964
8112
|
"data-loading": view.list.isLoading || view.list.isMutating ? "true" : void 0,
|
|
7965
8113
|
children: [
|
|
7966
8114
|
toolbar,
|
|
7967
|
-
view.enabled.savedViews ? /* @__PURE__ */
|
|
7968
|
-
/* @__PURE__ */
|
|
7969
|
-
/* @__PURE__ */
|
|
8115
|
+
view.enabled.savedViews ? /* @__PURE__ */ jsxs24("div", { "data-keepkit": "saved-view-controls", children: [
|
|
8116
|
+
/* @__PURE__ */ jsx27(KeepSavedViews, { onApply: view.applyQuery }),
|
|
8117
|
+
/* @__PURE__ */ jsx27(KeepSaveViewButton, { query: view.resolvedQuery })
|
|
7970
8118
|
] }) : null,
|
|
7971
|
-
activeFilters === void 0 ? /* @__PURE__ */
|
|
8119
|
+
activeFilters === void 0 ? /* @__PURE__ */ jsx27(
|
|
7972
8120
|
KeepActiveFiltersSummary,
|
|
7973
8121
|
{
|
|
7974
8122
|
search: view.searchValue,
|
|
@@ -7990,18 +8138,18 @@ function KeepCollectionContent({
|
|
|
7990
8138
|
view.setArchiveScope(next);
|
|
7991
8139
|
onArchiveScopeChange?.(next);
|
|
7992
8140
|
},
|
|
7993
|
-
onClear: view.clearFilters,
|
|
8141
|
+
onClear: () => view.clearFilters(),
|
|
7994
8142
|
onReset: view.resetFilters,
|
|
7995
8143
|
canReset: view.canReset
|
|
7996
8144
|
}
|
|
7997
8145
|
) : resolveContent(activeFilters, view.list),
|
|
7998
|
-
view.enabled.bulkActions && bulkActionsVariant === "inline" ? /* @__PURE__ */
|
|
8146
|
+
view.enabled.bulkActions && bulkActionsVariant === "inline" ? /* @__PURE__ */ jsx27(KeepInlineSelection, { query: view.resolvedQuery, confirmRemoval, children: renderList }) : /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
7999
8147
|
renderList(),
|
|
8000
|
-
view.enabled.bulkActions ? /* @__PURE__ */
|
|
8148
|
+
view.enabled.bulkActions ? /* @__PURE__ */ jsx27(KeepBulkActions, { query: view.resolvedQuery, confirmRemoval }) : null
|
|
8001
8149
|
] }),
|
|
8002
|
-
reorderable && reorderUndoIds ? /* @__PURE__ */
|
|
8003
|
-
reorderError ? /* @__PURE__ */
|
|
8004
|
-
/* @__PURE__ */
|
|
8150
|
+
reorderable && reorderUndoIds ? /* @__PURE__ */ jsxs24("div", { "data-keepkit": "reorder-feedback", role: "status", "aria-live": "polite", children: [
|
|
8151
|
+
reorderError ? /* @__PURE__ */ jsx27("p", { role: "alert", children: reorderFailedLabel }) : null,
|
|
8152
|
+
/* @__PURE__ */ jsx27("button", { type: "button", "data-keep-action": "undo-reorder", onClick: () => void undoReorder(), children: reorderUndoLabel })
|
|
8005
8153
|
] }) : null
|
|
8006
8154
|
]
|
|
8007
8155
|
}
|
|
@@ -8015,11 +8163,11 @@ function getCollectionState(list) {
|
|
|
8015
8163
|
}
|
|
8016
8164
|
|
|
8017
8165
|
// src/features/collection/KeepCollectionManager.tsx
|
|
8018
|
-
import { useId as
|
|
8166
|
+
import { useId as useId6 } from "react";
|
|
8019
8167
|
|
|
8020
8168
|
// src/features/collection/hooks/useKeepCollectionManager.ts
|
|
8021
|
-
import { useKeepCollections as useKeepCollections7, useKeepContext as
|
|
8022
|
-
import { useCallback as useCallback8, useState as
|
|
8169
|
+
import { useKeepCollections as useKeepCollections7, useKeepContext as useKeepContext7 } from "@keepkit/core/react";
|
|
8170
|
+
import { useCallback as useCallback8, useState as useState22 } from "react";
|
|
8023
8171
|
function useKeepCollectionManager({
|
|
8024
8172
|
onError,
|
|
8025
8173
|
onRenamed,
|
|
@@ -8032,13 +8180,13 @@ function useKeepCollectionManager({
|
|
|
8032
8180
|
renameCollection,
|
|
8033
8181
|
removeCollection,
|
|
8034
8182
|
moveToCollection
|
|
8035
|
-
} =
|
|
8183
|
+
} = useKeepContext7();
|
|
8036
8184
|
const collections = useKeepCollections7({ orderBy: "name" });
|
|
8037
|
-
const [editingId, setEditingId] =
|
|
8038
|
-
const [editingName, setEditingName] =
|
|
8039
|
-
const [pendingDeleteId, setPendingDeleteId] =
|
|
8040
|
-
const [error, setError] =
|
|
8041
|
-
const [isMutating, setIsMutating] =
|
|
8185
|
+
const [editingId, setEditingId] = useState22(null);
|
|
8186
|
+
const [editingName, setEditingName] = useState22("");
|
|
8187
|
+
const [pendingDeleteId, setPendingDeleteId] = useState22(null);
|
|
8188
|
+
const [error, setError] = useState22(null);
|
|
8189
|
+
const [isMutating, setIsMutating] = useState22(false);
|
|
8042
8190
|
const reportError = useCallback8(
|
|
8043
8191
|
(cause, fallback) => {
|
|
8044
8192
|
const message = cause instanceof Error ? cause.message : fallback;
|
|
@@ -8147,7 +8295,7 @@ function useKeepCollectionManager({
|
|
|
8147
8295
|
}
|
|
8148
8296
|
|
|
8149
8297
|
// src/features/collection/KeepCollectionManager.tsx
|
|
8150
|
-
import { Fragment as
|
|
8298
|
+
import { Fragment as Fragment17, jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
8151
8299
|
function KeepCollectionManager({
|
|
8152
8300
|
allowCreate = true,
|
|
8153
8301
|
allowRename = true,
|
|
@@ -8165,7 +8313,7 @@ function KeepCollectionManager({
|
|
|
8165
8313
|
...rootProps
|
|
8166
8314
|
}) {
|
|
8167
8315
|
const manager = useKeepCollectionManager({ onError, onRenamed, onDeleted });
|
|
8168
|
-
const headingId =
|
|
8316
|
+
const headingId = useId6();
|
|
8169
8317
|
const renameLabel = useUiLabel("renameCollection");
|
|
8170
8318
|
const renameSubmitLabel = useUiLabel("renameCollectionSubmit");
|
|
8171
8319
|
const deleteLabel = useUiLabel("deleteCollection");
|
|
@@ -8175,7 +8323,7 @@ function KeepCollectionManager({
|
|
|
8175
8323
|
const itemLabel = useUiLabel("collectionItem");
|
|
8176
8324
|
const itemsLabel = useUiLabel("collectionItems");
|
|
8177
8325
|
const defaultTitle = useUiLabel("manageCollections");
|
|
8178
|
-
return /* @__PURE__ */
|
|
8326
|
+
return /* @__PURE__ */ jsxs25(
|
|
8179
8327
|
"section",
|
|
8180
8328
|
{
|
|
8181
8329
|
...rootProps,
|
|
@@ -8185,17 +8333,17 @@ function KeepCollectionManager({
|
|
|
8185
8333
|
"data-loading": manager.isMutating ? "true" : void 0,
|
|
8186
8334
|
"aria-labelledby": rootProps["aria-labelledby"] ?? headingId,
|
|
8187
8335
|
children: [
|
|
8188
|
-
/* @__PURE__ */
|
|
8189
|
-
/* @__PURE__ */
|
|
8190
|
-
hasRenderableContent(description) ? /* @__PURE__ */
|
|
8336
|
+
/* @__PURE__ */ jsxs25("header", { "data-keepkit": "collection-manager-heading", children: [
|
|
8337
|
+
/* @__PURE__ */ jsx28("h2", { id: headingId, children: title ?? defaultTitle }),
|
|
8338
|
+
hasRenderableContent(description) ? /* @__PURE__ */ jsx28("p", { children: description }) : null
|
|
8191
8339
|
] }),
|
|
8192
|
-
allowCreate ? /* @__PURE__ */
|
|
8193
|
-
manager.error ? /* @__PURE__ */
|
|
8194
|
-
manager.collections.length > 0 ? /* @__PURE__ */
|
|
8340
|
+
allowCreate ? /* @__PURE__ */ jsx28(KeepCollectionCreate, { onCreated, onError }) : null,
|
|
8341
|
+
manager.error ? /* @__PURE__ */ jsx28("p", { "data-keepkit": "collection-manager-error", role: "alert", children: manager.error }) : null,
|
|
8342
|
+
manager.collections.length > 0 ? /* @__PURE__ */ jsx28("ul", { "data-keepkit": "collection-manager-list", children: manager.collections.map((collection) => {
|
|
8195
8343
|
const name = collectionLabels?.[collection.id] ?? collection.name;
|
|
8196
8344
|
const isEditing = manager.editingId === collection.id;
|
|
8197
8345
|
const isPendingDelete = manager.pendingDeleteId === collection.id;
|
|
8198
|
-
return /* @__PURE__ */
|
|
8346
|
+
return /* @__PURE__ */ jsx28("li", { "data-keepkit": "collection-manager-item", children: isEditing && allowRename ? /* @__PURE__ */ jsxs25(
|
|
8199
8347
|
"form",
|
|
8200
8348
|
{
|
|
8201
8349
|
"data-keepkit": "collection-manager-rename",
|
|
@@ -8204,12 +8352,12 @@ function KeepCollectionManager({
|
|
|
8204
8352
|
void manager.rename(collection.id);
|
|
8205
8353
|
},
|
|
8206
8354
|
children: [
|
|
8207
|
-
/* @__PURE__ */
|
|
8355
|
+
/* @__PURE__ */ jsxs25("label", { htmlFor: `${headingId}-rename-${collection.id}`, children: [
|
|
8208
8356
|
renameLabel,
|
|
8209
8357
|
": ",
|
|
8210
8358
|
name
|
|
8211
8359
|
] }),
|
|
8212
|
-
/* @__PURE__ */
|
|
8360
|
+
/* @__PURE__ */ jsx28(
|
|
8213
8361
|
"input",
|
|
8214
8362
|
{
|
|
8215
8363
|
id: `${headingId}-rename-${collection.id}`,
|
|
@@ -8219,7 +8367,7 @@ function KeepCollectionManager({
|
|
|
8219
8367
|
"data-keep-action": "rename-collection-input"
|
|
8220
8368
|
}
|
|
8221
8369
|
),
|
|
8222
|
-
/* @__PURE__ */
|
|
8370
|
+
/* @__PURE__ */ jsx28(
|
|
8223
8371
|
"button",
|
|
8224
8372
|
{
|
|
8225
8373
|
type: "submit",
|
|
@@ -8228,7 +8376,7 @@ function KeepCollectionManager({
|
|
|
8228
8376
|
children: renameSubmitLabel
|
|
8229
8377
|
}
|
|
8230
8378
|
),
|
|
8231
|
-
/* @__PURE__ */
|
|
8379
|
+
/* @__PURE__ */ jsx28(
|
|
8232
8380
|
"button",
|
|
8233
8381
|
{
|
|
8234
8382
|
type: "button",
|
|
@@ -8240,18 +8388,18 @@ function KeepCollectionManager({
|
|
|
8240
8388
|
)
|
|
8241
8389
|
]
|
|
8242
8390
|
}
|
|
8243
|
-
) : /* @__PURE__ */
|
|
8244
|
-
/* @__PURE__ */
|
|
8245
|
-
/* @__PURE__ */
|
|
8246
|
-
showCounts ? /* @__PURE__ */
|
|
8391
|
+
) : /* @__PURE__ */ jsxs25(Fragment17, { children: [
|
|
8392
|
+
/* @__PURE__ */ jsxs25("div", { "data-keepkit": "collection-manager-summary", children: [
|
|
8393
|
+
/* @__PURE__ */ jsx28("span", { "data-keepkit": "collection-manager-name", children: name }),
|
|
8394
|
+
showCounts ? /* @__PURE__ */ jsxs25("span", { "data-keepkit": "collection-manager-count", children: [
|
|
8247
8395
|
collection.count,
|
|
8248
8396
|
" ",
|
|
8249
8397
|
collection.count === 1 ? itemLabel : itemsLabel
|
|
8250
8398
|
] }) : null
|
|
8251
8399
|
] }),
|
|
8252
|
-
isPendingDelete && allowDelete ? /* @__PURE__ */
|
|
8253
|
-
/* @__PURE__ */
|
|
8254
|
-
/* @__PURE__ */
|
|
8400
|
+
isPendingDelete && allowDelete ? /* @__PURE__ */ jsxs25("fieldset", { "data-keepkit": "collection-manager-delete-confirmation", children: [
|
|
8401
|
+
/* @__PURE__ */ jsx28("legend", { children: deleteConfirmLabel }),
|
|
8402
|
+
/* @__PURE__ */ jsx28(
|
|
8255
8403
|
"button",
|
|
8256
8404
|
{
|
|
8257
8405
|
type: "button",
|
|
@@ -8261,7 +8409,7 @@ function KeepCollectionManager({
|
|
|
8261
8409
|
children: deleteSubmitLabel
|
|
8262
8410
|
}
|
|
8263
8411
|
),
|
|
8264
|
-
/* @__PURE__ */
|
|
8412
|
+
/* @__PURE__ */ jsx28(
|
|
8265
8413
|
"button",
|
|
8266
8414
|
{
|
|
8267
8415
|
type: "button",
|
|
@@ -8271,8 +8419,8 @@ function KeepCollectionManager({
|
|
|
8271
8419
|
children: cancelLabel
|
|
8272
8420
|
}
|
|
8273
8421
|
)
|
|
8274
|
-
] }) : /* @__PURE__ */
|
|
8275
|
-
allowRename ? /* @__PURE__ */
|
|
8422
|
+
] }) : /* @__PURE__ */ jsxs25("div", { "data-keepkit": "collection-manager-actions", children: [
|
|
8423
|
+
allowRename ? /* @__PURE__ */ jsx28(
|
|
8276
8424
|
"button",
|
|
8277
8425
|
{
|
|
8278
8426
|
type: "button",
|
|
@@ -8283,7 +8431,7 @@ function KeepCollectionManager({
|
|
|
8283
8431
|
children: renameLabel
|
|
8284
8432
|
}
|
|
8285
8433
|
) : null,
|
|
8286
|
-
allowDelete ? /* @__PURE__ */
|
|
8434
|
+
allowDelete ? /* @__PURE__ */ jsx28(
|
|
8287
8435
|
"button",
|
|
8288
8436
|
{
|
|
8289
8437
|
type: "button",
|
|
@@ -8296,7 +8444,7 @@ function KeepCollectionManager({
|
|
|
8296
8444
|
) : null
|
|
8297
8445
|
] })
|
|
8298
8446
|
] }) }, collection.id);
|
|
8299
|
-
}) }) : hasRenderableContent(empty) ? /* @__PURE__ */
|
|
8447
|
+
}) }) : hasRenderableContent(empty) ? /* @__PURE__ */ jsx28("div", { "data-keepkit": "collection-manager-empty", children: empty }) : null
|
|
8300
8448
|
]
|
|
8301
8449
|
}
|
|
8302
8450
|
);
|
|
@@ -8304,10 +8452,10 @@ function KeepCollectionManager({
|
|
|
8304
8452
|
|
|
8305
8453
|
// src/features/collection/KeepInbox.tsx
|
|
8306
8454
|
import { createInboxQuery } from "@keepkit/core/core";
|
|
8307
|
-
import { jsx as
|
|
8455
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
8308
8456
|
function KeepInbox({ query, ...props }) {
|
|
8309
8457
|
const inboxQuery = createInboxQuery({ organization: query?.organization });
|
|
8310
|
-
return /* @__PURE__ */
|
|
8458
|
+
return /* @__PURE__ */ jsx29(
|
|
8311
8459
|
KeepCollection,
|
|
8312
8460
|
{
|
|
8313
8461
|
...props,
|
|
@@ -8318,12 +8466,12 @@ function KeepInbox({ query, ...props }) {
|
|
|
8318
8466
|
}
|
|
8319
8467
|
|
|
8320
8468
|
// src/features/collection/KeepLayout.tsx
|
|
8321
|
-
import { jsx as
|
|
8469
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
8322
8470
|
function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...props }) {
|
|
8323
8471
|
const roving = useRovingTabIndex();
|
|
8324
8472
|
return (
|
|
8325
8473
|
// biome-ignore lint/a11y/noStaticElementInteractions: The group manages keyboard focus for descendant cards.
|
|
8326
|
-
/* @__PURE__ */
|
|
8474
|
+
/* @__PURE__ */ jsx30(
|
|
8327
8475
|
"div",
|
|
8328
8476
|
{
|
|
8329
8477
|
...props,
|
|
@@ -8350,7 +8498,7 @@ function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...p
|
|
|
8350
8498
|
import { isValidElement as isValidElement8 } from "react";
|
|
8351
8499
|
|
|
8352
8500
|
// src/features/navigation/KeepShortcutHint.tsx
|
|
8353
|
-
import { jsx as
|
|
8501
|
+
import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
8354
8502
|
function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
8355
8503
|
const keys = typeof shortcut === "string" ? shortcut.split("+") : [...shortcut];
|
|
8356
8504
|
const occurrences = /* @__PURE__ */ new Map();
|
|
@@ -8359,23 +8507,23 @@ function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
|
8359
8507
|
occurrences.set(key, occurrence + 1);
|
|
8360
8508
|
return { id: `${key}-${occurrence}`, value: key };
|
|
8361
8509
|
});
|
|
8362
|
-
return /* @__PURE__ */
|
|
8363
|
-
index > 0 ? /* @__PURE__ */
|
|
8364
|
-
/* @__PURE__ */
|
|
8510
|
+
return /* @__PURE__ */ jsx31("span", { ...props, "data-keepkit": "shortcut-hint", "aria-hidden": props["aria-hidden"] ?? true, children: keyedKeys.map((key, index) => /* @__PURE__ */ jsxs26("span", { children: [
|
|
8511
|
+
index > 0 ? /* @__PURE__ */ jsx31("span", { "data-shortcut-separator": "true", children: separator }) : null,
|
|
8512
|
+
/* @__PURE__ */ jsx31("kbd", { children: key.value.trim() })
|
|
8365
8513
|
] }, key.id)) });
|
|
8366
8514
|
}
|
|
8367
8515
|
|
|
8368
8516
|
// src/features/editor/hooks/useKeepNoteEditor.ts
|
|
8369
8517
|
import { useKeepItem as useKeepItem6 } from "@keepkit/core/react";
|
|
8370
|
-
import { useCallback as useCallback9, useEffect as
|
|
8518
|
+
import { useCallback as useCallback9, useEffect as useEffect17, useRef as useRef17, useState as useState23 } from "react";
|
|
8371
8519
|
function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
8372
8520
|
const itemState = useKeepItem6(item);
|
|
8373
8521
|
const { error, isMutating, item: savedItem, updateNote } = itemState;
|
|
8374
|
-
const [note, setNote] =
|
|
8522
|
+
const [note, setNote] = useState23(item.note ?? "");
|
|
8375
8523
|
const baselineNote = savedItem?.note ?? item.note ?? "";
|
|
8376
8524
|
const isDirty = note !== baselineNote;
|
|
8377
|
-
const lastSavedNoteRef =
|
|
8378
|
-
|
|
8525
|
+
const lastSavedNoteRef = useRef17(void 0);
|
|
8526
|
+
useEffect17(() => setNote(baselineNote), [baselineNote]);
|
|
8379
8527
|
const save = useCallback9(async () => {
|
|
8380
8528
|
const nextNote = note.trim() || void 0;
|
|
8381
8529
|
try {
|
|
@@ -8387,7 +8535,7 @@ function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
|
8387
8535
|
throw cause;
|
|
8388
8536
|
}
|
|
8389
8537
|
}, [note, onSaveError, onSaved, updateNote]);
|
|
8390
|
-
|
|
8538
|
+
useEffect17(() => {
|
|
8391
8539
|
if (!isDirty || debounceMs <= 0 || lastSavedNoteRef.current === note) return;
|
|
8392
8540
|
const timer = window.setTimeout(() => void save().catch(() => void 0), debounceMs);
|
|
8393
8541
|
return () => window.clearTimeout(timer);
|
|
@@ -8422,7 +8570,7 @@ function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
|
8422
8570
|
}
|
|
8423
8571
|
|
|
8424
8572
|
// src/features/editor/KeepNoteEditor.tsx
|
|
8425
|
-
import { Fragment as
|
|
8573
|
+
import { Fragment as Fragment18, jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
8426
8574
|
function KeepNoteEditor({
|
|
8427
8575
|
item,
|
|
8428
8576
|
label,
|
|
@@ -8445,10 +8593,10 @@ function KeepNoteEditor({
|
|
|
8445
8593
|
const saveAccessibleLabel = useUiLabel("saveNote");
|
|
8446
8594
|
const { error, isDirty, isSaving, note, setNote } = view.state;
|
|
8447
8595
|
const contentChildren = asChild && isValidElement8(children) ? void 0 : children;
|
|
8448
|
-
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */
|
|
8449
|
-
/* @__PURE__ */
|
|
8596
|
+
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */ jsxs27(Fragment18, { children: [
|
|
8597
|
+
/* @__PURE__ */ jsxs27("label", { children: [
|
|
8450
8598
|
showNoteLabel ? label ?? view.labels.note : null,
|
|
8451
|
-
/* @__PURE__ */
|
|
8599
|
+
/* @__PURE__ */ jsx32(
|
|
8452
8600
|
"textarea",
|
|
8453
8601
|
{
|
|
8454
8602
|
"data-keep-action": "edit-note",
|
|
@@ -8461,7 +8609,7 @@ function KeepNoteEditor({
|
|
|
8461
8609
|
}
|
|
8462
8610
|
)
|
|
8463
8611
|
] }),
|
|
8464
|
-
/* @__PURE__ */
|
|
8612
|
+
/* @__PURE__ */ jsxs27(
|
|
8465
8613
|
"button",
|
|
8466
8614
|
{
|
|
8467
8615
|
type: "submit",
|
|
@@ -8471,13 +8619,13 @@ function KeepNoteEditor({
|
|
|
8471
8619
|
"aria-label": showSaveLabel ? void 0 : saveAccessibleLabel,
|
|
8472
8620
|
children: [
|
|
8473
8621
|
showSaveLabel ? saveLabel ?? view.labels.save : null,
|
|
8474
|
-
showShortcutHint ? /* @__PURE__ */
|
|
8622
|
+
showShortcutHint ? /* @__PURE__ */ jsx32(KeepShortcutHint, { shortcut: "Ctrl+Enter" }) : null
|
|
8475
8623
|
]
|
|
8476
8624
|
}
|
|
8477
8625
|
)
|
|
8478
8626
|
] });
|
|
8479
8627
|
if (!asChild) {
|
|
8480
|
-
return /* @__PURE__ */
|
|
8628
|
+
return /* @__PURE__ */ jsxs27(
|
|
8481
8629
|
"form",
|
|
8482
8630
|
{
|
|
8483
8631
|
...formProps,
|
|
@@ -8490,7 +8638,7 @@ function KeepNoteEditor({
|
|
|
8490
8638
|
"data-disabled": isSaving ? "true" : void 0,
|
|
8491
8639
|
children: [
|
|
8492
8640
|
body,
|
|
8493
|
-
error ? /* @__PURE__ */
|
|
8641
|
+
error ? /* @__PURE__ */ jsx32("p", { role: "alert", children: getErrorMessage(error, view.labels.error) }) : null
|
|
8494
8642
|
]
|
|
8495
8643
|
}
|
|
8496
8644
|
);
|
|
@@ -8515,12 +8663,12 @@ function KeepNoteEditor({
|
|
|
8515
8663
|
|
|
8516
8664
|
// src/features/editor/hooks/useKeepTagEditor.ts
|
|
8517
8665
|
import { useKeepItem as useKeepItem7 } from "@keepkit/core/react";
|
|
8518
|
-
import { useCallback as useCallback10, useEffect as
|
|
8666
|
+
import { useCallback as useCallback10, useEffect as useEffect18, useState as useState24 } from "react";
|
|
8519
8667
|
function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
8520
8668
|
const itemState = useKeepItem7(item);
|
|
8521
|
-
const [tags, setTags] =
|
|
8522
|
-
const [input, setInput] =
|
|
8523
|
-
|
|
8669
|
+
const [tags, setTags] = useState24(item.tags ?? []);
|
|
8670
|
+
const [input, setInput] = useState24("");
|
|
8671
|
+
useEffect18(() => setTags(itemState.item?.tags ?? item.tags ?? []), [item.tags, itemState.item?.tags]);
|
|
8524
8672
|
const save = useCallback10(async () => {
|
|
8525
8673
|
const nextTags = normalizeUiTags(tags);
|
|
8526
8674
|
try {
|
|
@@ -8567,7 +8715,7 @@ function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
|
8567
8715
|
}
|
|
8568
8716
|
|
|
8569
8717
|
// src/features/editor/KeepTagEditor.tsx
|
|
8570
|
-
import { Fragment as
|
|
8718
|
+
import { Fragment as Fragment19, jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
8571
8719
|
function KeepTagEditor({
|
|
8572
8720
|
item,
|
|
8573
8721
|
availableTags = [],
|
|
@@ -8582,10 +8730,10 @@ function KeepTagEditor({
|
|
|
8582
8730
|
const showRemoveLabel = useUiLabelVisibility("remove");
|
|
8583
8731
|
const showApplyLabel = useUiLabelVisibility("applyTags");
|
|
8584
8732
|
const { isSaving, tags } = view.state;
|
|
8585
|
-
const body = render ? render(view.state) : /* @__PURE__ */
|
|
8586
|
-
/* @__PURE__ */
|
|
8733
|
+
const body = render ? render(view.state) : /* @__PURE__ */ jsxs28(Fragment19, { children: [
|
|
8734
|
+
/* @__PURE__ */ jsxs28("label", { children: [
|
|
8587
8735
|
showTagsLabel ? view.labels.tags : null,
|
|
8588
|
-
/* @__PURE__ */
|
|
8736
|
+
/* @__PURE__ */ jsx33(
|
|
8589
8737
|
"input",
|
|
8590
8738
|
{
|
|
8591
8739
|
"data-keep-action": "edit-tags",
|
|
@@ -8597,10 +8745,10 @@ function KeepTagEditor({
|
|
|
8597
8745
|
}
|
|
8598
8746
|
)
|
|
8599
8747
|
] }),
|
|
8600
|
-
availableTags.length > 0 ? /* @__PURE__ */
|
|
8601
|
-
/* @__PURE__ */
|
|
8748
|
+
availableTags.length > 0 ? /* @__PURE__ */ jsx33("datalist", { id: `keep-tags-${item.id}`, children: availableTags.map((tag) => /* @__PURE__ */ jsx33("option", { value: tag }, tag)) }) : null,
|
|
8749
|
+
/* @__PURE__ */ jsx33("ul", { "aria-label": view.labels.tags, children: tags.map((tag) => /* @__PURE__ */ jsxs28("li", { children: [
|
|
8602
8750
|
tag,
|
|
8603
|
-
/* @__PURE__ */
|
|
8751
|
+
/* @__PURE__ */ jsx33(
|
|
8604
8752
|
"button",
|
|
8605
8753
|
{
|
|
8606
8754
|
type: "button",
|
|
@@ -8611,7 +8759,7 @@ function KeepTagEditor({
|
|
|
8611
8759
|
}
|
|
8612
8760
|
)
|
|
8613
8761
|
] }, tag)) }),
|
|
8614
|
-
/* @__PURE__ */
|
|
8762
|
+
/* @__PURE__ */ jsx33(
|
|
8615
8763
|
"button",
|
|
8616
8764
|
{
|
|
8617
8765
|
type: "submit",
|
|
@@ -8623,7 +8771,7 @@ function KeepTagEditor({
|
|
|
8623
8771
|
}
|
|
8624
8772
|
)
|
|
8625
8773
|
] });
|
|
8626
|
-
return /* @__PURE__ */
|
|
8774
|
+
return /* @__PURE__ */ jsxs28(
|
|
8627
8775
|
"form",
|
|
8628
8776
|
{
|
|
8629
8777
|
...props,
|
|
@@ -8635,7 +8783,7 @@ function KeepTagEditor({
|
|
|
8635
8783
|
"data-disabled": isSaving ? "true" : void 0,
|
|
8636
8784
|
children: [
|
|
8637
8785
|
body,
|
|
8638
|
-
view.error ? /* @__PURE__ */
|
|
8786
|
+
view.error ? /* @__PURE__ */ jsx33("p", { role: "alert", children: getErrorMessage(view.error, view.labels.error) }) : null
|
|
8639
8787
|
]
|
|
8640
8788
|
}
|
|
8641
8789
|
);
|
|
@@ -8644,34 +8792,44 @@ function KeepTagEditor({
|
|
|
8644
8792
|
// src/features/feedback/useKeepToastFeedback.ts
|
|
8645
8793
|
import { useCallback as useCallback11 } from "react";
|
|
8646
8794
|
function useKeepToastFeedback(showToast) {
|
|
8795
|
+
const errorLabel = useUiLabel("error");
|
|
8647
8796
|
return useCallback11(
|
|
8648
8797
|
(event) => {
|
|
8649
8798
|
if (!("undo" in event)) {
|
|
8650
8799
|
showToast(event.message);
|
|
8651
8800
|
return;
|
|
8652
8801
|
}
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8802
|
+
let pending = false;
|
|
8803
|
+
const action = {
|
|
8804
|
+
label: event.undoLabel,
|
|
8805
|
+
onClick: () => {
|
|
8806
|
+
if (pending) return;
|
|
8807
|
+
pending = true;
|
|
8808
|
+
void Promise.resolve().then(event.undo).catch((error) => {
|
|
8809
|
+
if (error instanceof UndoUnavailableError) showToast(getErrorMessage(error, errorLabel));
|
|
8810
|
+
else showToast(getErrorMessage(error, errorLabel), { action });
|
|
8811
|
+
}).finally(() => {
|
|
8812
|
+
pending = false;
|
|
8813
|
+
});
|
|
8657
8814
|
}
|
|
8658
|
-
}
|
|
8815
|
+
};
|
|
8816
|
+
showToast(event.message, { action });
|
|
8659
8817
|
},
|
|
8660
|
-
[showToast]
|
|
8818
|
+
[errorLabel, showToast]
|
|
8661
8819
|
);
|
|
8662
8820
|
}
|
|
8663
8821
|
|
|
8664
8822
|
// src/features/navigation/KeepFloatingTour.tsx
|
|
8665
8823
|
import { useKeepList as useKeepList6 } from "@keepkit/core/react";
|
|
8666
|
-
import { useEffect as
|
|
8824
|
+
import { useEffect as useEffect21, useMemo as useMemo7, useRef as useRef18, useState as useState26 } from "react";
|
|
8667
8825
|
import { createPortal as createPortal2 } from "react-dom";
|
|
8668
8826
|
|
|
8669
8827
|
// src/features/navigation/KeepTourBar.tsx
|
|
8670
8828
|
import { useKeepNavigator } from "@keepkit/core/react";
|
|
8671
|
-
import { useId as
|
|
8829
|
+
import { useId as useId7 } from "react";
|
|
8672
8830
|
|
|
8673
8831
|
// src/features/navigation/hooks/useKeepTourShortcuts.ts
|
|
8674
|
-
import { useEffect as
|
|
8832
|
+
import { useEffect as useEffect19 } from "react";
|
|
8675
8833
|
function useKeepTourShortcuts({
|
|
8676
8834
|
onNext,
|
|
8677
8835
|
onPrev,
|
|
@@ -8682,7 +8840,7 @@ function useKeepTourShortcuts({
|
|
|
8682
8840
|
prevKeys = ["k", "["],
|
|
8683
8841
|
onError
|
|
8684
8842
|
}) {
|
|
8685
|
-
|
|
8843
|
+
useEffect19(() => {
|
|
8686
8844
|
if (!enabled) return;
|
|
8687
8845
|
const handleKeyDown = (event) => {
|
|
8688
8846
|
if (!allowInEditable && isEditableTarget(event.target)) return;
|
|
@@ -8703,7 +8861,7 @@ function isEditableTarget(target) {
|
|
|
8703
8861
|
}
|
|
8704
8862
|
|
|
8705
8863
|
// src/features/navigation/KeepTourBar.tsx
|
|
8706
|
-
import { Fragment as
|
|
8864
|
+
import { Fragment as Fragment20, jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
8707
8865
|
function KeepTourBar({
|
|
8708
8866
|
navigation: providedNavigation,
|
|
8709
8867
|
currentId,
|
|
@@ -8773,9 +8931,9 @@ function KeepTourBar({
|
|
|
8773
8931
|
return resolvedPrev();
|
|
8774
8932
|
}
|
|
8775
8933
|
});
|
|
8776
|
-
const body = /* @__PURE__ */
|
|
8777
|
-
showProgress ? /* @__PURE__ */
|
|
8778
|
-
/* @__PURE__ */
|
|
8934
|
+
const body = /* @__PURE__ */ jsxs29(Fragment20, { children: [
|
|
8935
|
+
showProgress ? /* @__PURE__ */ jsx34("span", { "data-keepkit": "tour-progress", "aria-live": "polite", children: progress ?? `${navigation.currentPosition ?? 0} / ${navigation.items.length}` }) : null,
|
|
8936
|
+
/* @__PURE__ */ jsx34(
|
|
8779
8937
|
TourAction,
|
|
8780
8938
|
{
|
|
8781
8939
|
href: resolvedPrevHref,
|
|
@@ -8783,7 +8941,7 @@ function KeepTourBar({
|
|
|
8783
8941
|
onClick: resolvedPrevHref ? notifyPrevNavigation : resolvedPrev,
|
|
8784
8942
|
"data-keep-action": "tour-prev",
|
|
8785
8943
|
shortcut: showShortcutHint ? shortcutOptions?.prevKeys?.[0] ?? "K" : void 0,
|
|
8786
|
-
preview: navigation.prevItem ? /* @__PURE__ */
|
|
8944
|
+
preview: navigation.prevItem ? /* @__PURE__ */ jsxs29(Fragment20, { children: [
|
|
8787
8945
|
previousLabel,
|
|
8788
8946
|
": ",
|
|
8789
8947
|
getItemTitle(navigation.prevItem)
|
|
@@ -8791,7 +8949,7 @@ function KeepTourBar({
|
|
|
8791
8949
|
children: previousLabel
|
|
8792
8950
|
}
|
|
8793
8951
|
),
|
|
8794
|
-
/* @__PURE__ */
|
|
8952
|
+
/* @__PURE__ */ jsx34(
|
|
8795
8953
|
TourAction,
|
|
8796
8954
|
{
|
|
8797
8955
|
href: resolvedNextHref,
|
|
@@ -8799,7 +8957,7 @@ function KeepTourBar({
|
|
|
8799
8957
|
onClick: resolvedNextHref ? notifyNextNavigation : resolvedNext,
|
|
8800
8958
|
"data-keep-action": "tour-next",
|
|
8801
8959
|
shortcut: showShortcutHint ? shortcutOptions?.nextKeys?.[0] ?? "J" : void 0,
|
|
8802
|
-
preview: navigation.nextItem ? /* @__PURE__ */
|
|
8960
|
+
preview: navigation.nextItem ? /* @__PURE__ */ jsxs29(Fragment20, { children: [
|
|
8803
8961
|
nextItemLabel,
|
|
8804
8962
|
": ",
|
|
8805
8963
|
getItemTitle(navigation.nextItem)
|
|
@@ -8807,7 +8965,7 @@ function KeepTourBar({
|
|
|
8807
8965
|
children: nextItemLabel
|
|
8808
8966
|
}
|
|
8809
8967
|
),
|
|
8810
|
-
resolvedBackHref || onBack ? /* @__PURE__ */
|
|
8968
|
+
resolvedBackHref || onBack ? /* @__PURE__ */ jsx34(TourAction, { href: resolvedBackHref, onClick: onBack, "data-keep-action": "tour-back", children: listLabel }) : null
|
|
8811
8969
|
] });
|
|
8812
8970
|
return renderRoot(
|
|
8813
8971
|
asChild,
|
|
@@ -8818,14 +8976,14 @@ function KeepTourBar({
|
|
|
8818
8976
|
);
|
|
8819
8977
|
}
|
|
8820
8978
|
function TourAction({ href, disabled = false, onClick, children, preview, shortcut, ...props }) {
|
|
8821
|
-
const previewId =
|
|
8822
|
-
const content = /* @__PURE__ */
|
|
8823
|
-
/* @__PURE__ */
|
|
8824
|
-
shortcut ? /* @__PURE__ */
|
|
8825
|
-
preview ? /* @__PURE__ */
|
|
8979
|
+
const previewId = useId7();
|
|
8980
|
+
const content = /* @__PURE__ */ jsxs29(Fragment20, { children: [
|
|
8981
|
+
/* @__PURE__ */ jsx34("span", { "data-tour-label": "true", children }),
|
|
8982
|
+
shortcut ? /* @__PURE__ */ jsx34(KeepShortcutHint, { shortcut }) : null,
|
|
8983
|
+
preview ? /* @__PURE__ */ jsx34("small", { id: previewId, "data-tour-preview": "true", children: preview }) : null
|
|
8826
8984
|
] });
|
|
8827
8985
|
if (href && !disabled) {
|
|
8828
|
-
return /* @__PURE__ */
|
|
8986
|
+
return /* @__PURE__ */ jsx34(
|
|
8829
8987
|
"a",
|
|
8830
8988
|
{
|
|
8831
8989
|
...props,
|
|
@@ -8837,7 +8995,7 @@ function TourAction({ href, disabled = false, onClick, children, preview, shortc
|
|
|
8837
8995
|
}
|
|
8838
8996
|
);
|
|
8839
8997
|
}
|
|
8840
|
-
return /* @__PURE__ */
|
|
8998
|
+
return /* @__PURE__ */ jsx34(
|
|
8841
8999
|
"button",
|
|
8842
9000
|
{
|
|
8843
9001
|
...props,
|
|
@@ -8858,8 +9016,8 @@ function navigateTo(item, href) {
|
|
|
8858
9016
|
|
|
8859
9017
|
// src/features/navigation/tour-context.tsx
|
|
8860
9018
|
import { useKeepList as useKeepList5 } from "@keepkit/core/react";
|
|
8861
|
-
import { createContext as createContext5, useCallback as useCallback12, useContext as useContext5, useEffect as
|
|
8862
|
-
import { jsx as
|
|
9019
|
+
import { createContext as createContext5, useCallback as useCallback12, useContext as useContext5, useEffect as useEffect20, useMemo as useMemo6, useState as useState25 } from "react";
|
|
9020
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
8863
9021
|
var SESSION_VERSION = 1;
|
|
8864
9022
|
var KeepTourContext = createContext5(null);
|
|
8865
9023
|
function KeepTourProvider({
|
|
@@ -8870,10 +9028,10 @@ function KeepTourProvider({
|
|
|
8870
9028
|
onNavigate
|
|
8871
9029
|
}) {
|
|
8872
9030
|
const list = useKeepList5();
|
|
8873
|
-
const [tour, setTour] =
|
|
9031
|
+
const [tour, setTour] = useState25(
|
|
8874
9032
|
null
|
|
8875
9033
|
);
|
|
8876
|
-
const [persistenceStatus, setPersistenceStatus] =
|
|
9034
|
+
const [persistenceStatus, setPersistenceStatus] = useState25("persistent");
|
|
8877
9035
|
const itemsById = useMemo6(() => new Map(list.items.map((item) => [item.id, item])), [list.items]);
|
|
8878
9036
|
const readStorage = useCallback12(() => {
|
|
8879
9037
|
try {
|
|
@@ -8909,7 +9067,7 @@ function KeepTourProvider({
|
|
|
8909
9067
|
},
|
|
8910
9068
|
[sessionKey]
|
|
8911
9069
|
);
|
|
8912
|
-
|
|
9070
|
+
useEffect20(() => {
|
|
8913
9071
|
if (!list.isHydrated || list.error || tour) return;
|
|
8914
9072
|
const stored = typeof window === "undefined" ? null : readStorage();
|
|
8915
9073
|
if (!stored) return;
|
|
@@ -8921,7 +9079,7 @@ function KeepTourProvider({
|
|
|
8921
9079
|
const currentId = ids.includes(stored.currentId) ? stored.currentId : ids[0];
|
|
8922
9080
|
setTour({ itemIds: ids, currentId, collapsed: stored.collapsed });
|
|
8923
9081
|
}, [itemsById, list.error, list.isHydrated, readStorage, tour, writeStorage]);
|
|
8924
|
-
|
|
9082
|
+
useEffect20(() => {
|
|
8925
9083
|
if (!tour || list.isLoading || list.error) return;
|
|
8926
9084
|
const ids = tour.itemIds.filter((id) => itemsById.has(id));
|
|
8927
9085
|
if (!ids.length) {
|
|
@@ -8996,23 +9154,23 @@ function KeepTourProvider({
|
|
|
8996
9154
|
}),
|
|
8997
9155
|
[end, getBackHref, getItemHref, move, onNavigate, persistenceStatus, setCurrentId, start, tour]
|
|
8998
9156
|
);
|
|
8999
|
-
|
|
9157
|
+
useEffect20(() => {
|
|
9000
9158
|
if (!tour) return;
|
|
9001
9159
|
if (tour.currentId) writeStorage(tour);
|
|
9002
9160
|
}, [tour, writeStorage]);
|
|
9003
|
-
return /* @__PURE__ */
|
|
9161
|
+
return /* @__PURE__ */ jsx35(KeepTourContext.Provider, { value, children });
|
|
9004
9162
|
}
|
|
9005
9163
|
function useKeepTour(options = {}) {
|
|
9006
9164
|
const context = useContext5(KeepTourContext);
|
|
9007
9165
|
if (!context) throw new Error("useKeepTour must be used within KeepTourProvider.");
|
|
9008
|
-
|
|
9166
|
+
useEffect20(() => {
|
|
9009
9167
|
if (options.currentId && context.active) context.setCurrentId(options.currentId);
|
|
9010
9168
|
}, [context, options.currentId]);
|
|
9011
9169
|
return context;
|
|
9012
9170
|
}
|
|
9013
9171
|
|
|
9014
9172
|
// src/features/navigation/KeepFloatingTour.tsx
|
|
9015
|
-
import { Fragment as
|
|
9173
|
+
import { Fragment as Fragment21, jsx as jsx36, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
9016
9174
|
function KeepFloatingTour({
|
|
9017
9175
|
currentId,
|
|
9018
9176
|
getItemHref,
|
|
@@ -9030,15 +9188,15 @@ function KeepFloatingTour({
|
|
|
9030
9188
|
const tour = useKeepTour({ currentId });
|
|
9031
9189
|
const { items } = useKeepList6();
|
|
9032
9190
|
const theme = useKeepTheme();
|
|
9033
|
-
const [mounted, setMounted] =
|
|
9191
|
+
const [mounted, setMounted] = useState26(false);
|
|
9034
9192
|
const { labels } = useKeepUiLabels();
|
|
9035
9193
|
const collapseLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u6298\u308A\u305F\u305F\u3080" : "Collapse tour";
|
|
9036
9194
|
const expandLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u5C55\u958B" : "Expand tour";
|
|
9037
9195
|
const endLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u7D42\u4E86" : "End tour";
|
|
9038
|
-
const expandRef =
|
|
9039
|
-
const collapseRef =
|
|
9040
|
-
|
|
9041
|
-
|
|
9196
|
+
const expandRef = useRef18(null);
|
|
9197
|
+
const collapseRef = useRef18(null);
|
|
9198
|
+
useEffect21(() => setMounted(true), []);
|
|
9199
|
+
useEffect21(() => {
|
|
9042
9200
|
if (!mounted || !tour.active) return;
|
|
9043
9201
|
const button = tour.collapsed ? expandRef.current : collapseRef.current;
|
|
9044
9202
|
if (button) button.focus();
|
|
@@ -9074,7 +9232,7 @@ function KeepFloatingTour({
|
|
|
9074
9232
|
"--keep-tour-z-index": zIndex,
|
|
9075
9233
|
...style
|
|
9076
9234
|
};
|
|
9077
|
-
const content = tour.collapsed ? /* @__PURE__ */
|
|
9235
|
+
const content = tour.collapsed ? /* @__PURE__ */ jsxs30(
|
|
9078
9236
|
"button",
|
|
9079
9237
|
{
|
|
9080
9238
|
ref: expandRef,
|
|
@@ -9089,8 +9247,8 @@ function KeepFloatingTour({
|
|
|
9089
9247
|
tour.itemIds.length
|
|
9090
9248
|
]
|
|
9091
9249
|
}
|
|
9092
|
-
) : /* @__PURE__ */
|
|
9093
|
-
/* @__PURE__ */
|
|
9250
|
+
) : /* @__PURE__ */ jsxs30(Fragment21, { children: [
|
|
9251
|
+
/* @__PURE__ */ jsx36(
|
|
9094
9252
|
KeepTourBar,
|
|
9095
9253
|
{
|
|
9096
9254
|
className: "keep-floating-tour__bar",
|
|
@@ -9107,7 +9265,7 @@ function KeepFloatingTour({
|
|
|
9107
9265
|
showShortcutHint
|
|
9108
9266
|
}
|
|
9109
9267
|
),
|
|
9110
|
-
/* @__PURE__ */
|
|
9268
|
+
/* @__PURE__ */ jsx36(
|
|
9111
9269
|
"button",
|
|
9112
9270
|
{
|
|
9113
9271
|
ref: collapseRef,
|
|
@@ -9119,7 +9277,7 @@ function KeepFloatingTour({
|
|
|
9119
9277
|
children: "\u2212"
|
|
9120
9278
|
}
|
|
9121
9279
|
),
|
|
9122
|
-
/* @__PURE__ */
|
|
9280
|
+
/* @__PURE__ */ jsx36(
|
|
9123
9281
|
"button",
|
|
9124
9282
|
{
|
|
9125
9283
|
type: "button",
|
|
@@ -9132,7 +9290,7 @@ function KeepFloatingTour({
|
|
|
9132
9290
|
)
|
|
9133
9291
|
] });
|
|
9134
9292
|
return createPortal2(
|
|
9135
|
-
/* @__PURE__ */
|
|
9293
|
+
/* @__PURE__ */ jsx36(KeepThemeProvider, { ...theme, children: /* @__PURE__ */ jsx36(
|
|
9136
9294
|
"aside",
|
|
9137
9295
|
{
|
|
9138
9296
|
className: ["keep-floating-tour", `keep-floating-tour--${position}`, className].filter(Boolean).join(" "),
|
|
@@ -9149,8 +9307,8 @@ function KeepFloatingTour({
|
|
|
9149
9307
|
}
|
|
9150
9308
|
|
|
9151
9309
|
// src/features/recovery/KeepFallbackRecovery.tsx
|
|
9152
|
-
import { useEffect as
|
|
9153
|
-
import { jsx as
|
|
9310
|
+
import { useEffect as useEffect22, useRef as useRef19, useState as useState27 } from "react";
|
|
9311
|
+
import { jsx as jsx37, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
9154
9312
|
function KeepFallbackRecovery({
|
|
9155
9313
|
recovery,
|
|
9156
9314
|
...props
|
|
@@ -9187,22 +9345,22 @@ function KeepFallbackRecovery({
|
|
|
9187
9345
|
saved: useUiLabel("saved"),
|
|
9188
9346
|
uncategorized: useUiLabel("uncategorized")
|
|
9189
9347
|
};
|
|
9190
|
-
const [state, setState] =
|
|
9191
|
-
const [storedInspection, setInspection] =
|
|
9192
|
-
const [selections, setSelections] =
|
|
9193
|
-
const [reviewed, setReviewed] =
|
|
9194
|
-
const [pending, setPending] =
|
|
9195
|
-
const [error, setError] =
|
|
9196
|
-
const [result, setResult] =
|
|
9197
|
-
const pendingRecoveries =
|
|
9198
|
-
const activeRecovery =
|
|
9348
|
+
const [state, setState] = useState27(() => recovery.getState());
|
|
9349
|
+
const [storedInspection, setInspection] = useState27(null);
|
|
9350
|
+
const [selections, setSelections] = useState27({});
|
|
9351
|
+
const [reviewed, setReviewed] = useState27(false);
|
|
9352
|
+
const [pending, setPending] = useState27(false);
|
|
9353
|
+
const [error, setError] = useState27(false);
|
|
9354
|
+
const [result, setResult] = useState27(null);
|
|
9355
|
+
const pendingRecoveries = useRef19(/* @__PURE__ */ new WeakSet());
|
|
9356
|
+
const activeRecovery = useRef19(recovery);
|
|
9199
9357
|
activeRecovery.current = recovery;
|
|
9200
|
-
const inspectionRecovery =
|
|
9358
|
+
const inspectionRecovery = useRef19(recovery);
|
|
9201
9359
|
const inspection = inspectionRecovery.current === recovery ? storedInspection : null;
|
|
9202
|
-
const compareRef =
|
|
9203
|
-
const firstChoiceRef =
|
|
9204
|
-
const applyRef =
|
|
9205
|
-
|
|
9360
|
+
const compareRef = useRef19(null);
|
|
9361
|
+
const firstChoiceRef = useRef19(null);
|
|
9362
|
+
const applyRef = useRef19(null);
|
|
9363
|
+
useEffect22(() => {
|
|
9206
9364
|
setPending(pendingRecoveries.current.has(recovery));
|
|
9207
9365
|
setState(recovery.getState());
|
|
9208
9366
|
setInspection(null);
|
|
@@ -9277,7 +9435,7 @@ function KeepFallbackRecovery({
|
|
|
9277
9435
|
if (activeRecovery.current !== recovery) return;
|
|
9278
9436
|
setResult(next.status);
|
|
9279
9437
|
});
|
|
9280
|
-
|
|
9438
|
+
useEffect22(() => {
|
|
9281
9439
|
if (pending) return;
|
|
9282
9440
|
if (reviewed) applyRef.current?.focus();
|
|
9283
9441
|
else if (inspection) firstChoiceRef.current?.focus();
|
|
@@ -9314,7 +9472,7 @@ function KeepFallbackRecovery({
|
|
|
9314
9472
|
const retainedBackupJson = [
|
|
9315
9473
|
...new Set((inspection?.retainedBackups ?? []).map((backup) => JSON.stringify(backup, null, 2)))
|
|
9316
9474
|
];
|
|
9317
|
-
return /* @__PURE__ */
|
|
9475
|
+
return /* @__PURE__ */ jsxs31(
|
|
9318
9476
|
"section",
|
|
9319
9477
|
{
|
|
9320
9478
|
...props,
|
|
@@ -9322,17 +9480,17 @@ function KeepFallbackRecovery({
|
|
|
9322
9480
|
"aria-label": props["aria-label"] ?? labels.fallbackRecovery,
|
|
9323
9481
|
"aria-busy": pending,
|
|
9324
9482
|
children: [
|
|
9325
|
-
/* @__PURE__ */
|
|
9326
|
-
/* @__PURE__ */
|
|
9483
|
+
/* @__PURE__ */ jsx37("h2", { children: labels.fallbackRecovery }),
|
|
9484
|
+
/* @__PURE__ */ jsxs31("p", { role: "status", "aria-live": "polite", children: [
|
|
9327
9485
|
state.source === "primary" ? labels.recoveryPrimary : labels.recoveryFallback,
|
|
9328
9486
|
":",
|
|
9329
9487
|
" ",
|
|
9330
9488
|
state.pendingOperations > 0 ? labels.recoveryPending : labels.recoveryReady
|
|
9331
9489
|
] }),
|
|
9332
|
-
state.capturedAt !== void 0 ? /* @__PURE__ */
|
|
9333
|
-
state.snapshotStale ? /* @__PURE__ */
|
|
9334
|
-
state.issue ? /* @__PURE__ */
|
|
9335
|
-
canRepair ? /* @__PURE__ */
|
|
9490
|
+
state.capturedAt !== void 0 ? /* @__PURE__ */ jsx37("time", { dateTime: new Date(state.capturedAt).toISOString(), children: new Date(state.capturedAt).toLocaleString(locale) }) : null,
|
|
9491
|
+
state.snapshotStale ? /* @__PURE__ */ jsx37("p", { role: "status", children: labels.recoveryStale }) : null,
|
|
9492
|
+
state.issue ? /* @__PURE__ */ jsx37("p", { role: "alert", children: labels.error }) : null,
|
|
9493
|
+
canRepair ? /* @__PURE__ */ jsx37(
|
|
9336
9494
|
"button",
|
|
9337
9495
|
{
|
|
9338
9496
|
ref: compareRef,
|
|
@@ -9341,13 +9499,13 @@ function KeepFallbackRecovery({
|
|
|
9341
9499
|
onClick: () => void compare(),
|
|
9342
9500
|
children: labels.inspectRecovery
|
|
9343
9501
|
}
|
|
9344
|
-
) : /* @__PURE__ */
|
|
9345
|
-
recovery.retry && state.pendingOperations > 0 ? /* @__PURE__ */
|
|
9346
|
-
result ? /* @__PURE__ */
|
|
9347
|
-
error ? /* @__PURE__ */
|
|
9348
|
-
inspection ? /* @__PURE__ */
|
|
9349
|
-
retainedBackupJson.length > 0 ? /* @__PURE__ */
|
|
9350
|
-
/* @__PURE__ */
|
|
9502
|
+
) : /* @__PURE__ */ jsx37("p", { children: labels.recoveryUnavailable }),
|
|
9503
|
+
recovery.retry && state.pendingOperations > 0 ? /* @__PURE__ */ jsx37("button", { type: "button", disabled: pending, onClick: () => void retry(), children: labels.retry }) : null,
|
|
9504
|
+
result ? /* @__PURE__ */ jsx37("p", { role: "status", children: result === "applied" ? labels.recoveryApplied : labels.recoveryCommitted }) : null,
|
|
9505
|
+
error ? /* @__PURE__ */ jsx37("p", { role: "alert", children: labels.error }) : null,
|
|
9506
|
+
inspection ? /* @__PURE__ */ jsxs31("div", { children: [
|
|
9507
|
+
retainedBackupJson.length > 0 ? /* @__PURE__ */ jsxs31("details", { "data-keepkit": "retained-recovery-backups", children: [
|
|
9508
|
+
/* @__PURE__ */ jsxs31("summary", { children: [
|
|
9351
9509
|
labels.saved,
|
|
9352
9510
|
": ",
|
|
9353
9511
|
labels.recoveryBackups,
|
|
@@ -9355,14 +9513,14 @@ function KeepFallbackRecovery({
|
|
|
9355
9513
|
retainedBackupJson.length,
|
|
9356
9514
|
")"
|
|
9357
9515
|
] }),
|
|
9358
|
-
retainedBackupJson.map((json) => /* @__PURE__ */
|
|
9516
|
+
retainedBackupJson.map((json) => /* @__PURE__ */ jsx37("pre", { children: json }, json))
|
|
9359
9517
|
] }) : null,
|
|
9360
|
-
/* @__PURE__ */
|
|
9361
|
-
/* @__PURE__ */
|
|
9362
|
-
inspection.rows.map((row, index) => /* @__PURE__ */
|
|
9363
|
-
/* @__PURE__ */
|
|
9518
|
+
/* @__PURE__ */ jsxs31("fieldset", { disabled: pending, children: [
|
|
9519
|
+
/* @__PURE__ */ jsx37("legend", { children: labels.recoveryChooseSource }),
|
|
9520
|
+
inspection.rows.map((row, index) => /* @__PURE__ */ jsxs31("div", { children: [
|
|
9521
|
+
/* @__PURE__ */ jsxs31("label", { children: [
|
|
9364
9522
|
rowLabel(row),
|
|
9365
|
-
/* @__PURE__ */
|
|
9523
|
+
/* @__PURE__ */ jsxs31(
|
|
9366
9524
|
"select",
|
|
9367
9525
|
{
|
|
9368
9526
|
ref: index === 0 ? firstChoiceRef : void 0,
|
|
@@ -9372,32 +9530,32 @@ function KeepFallbackRecovery({
|
|
|
9372
9530
|
setReviewed(false);
|
|
9373
9531
|
},
|
|
9374
9532
|
children: [
|
|
9375
|
-
/* @__PURE__ */
|
|
9376
|
-
row.candidates.map((candidate) => /* @__PURE__ */
|
|
9377
|
-
/* @__PURE__ */
|
|
9533
|
+
/* @__PURE__ */ jsx37("option", { value: "", disabled: true, children: labels.recoveryChooseSource }),
|
|
9534
|
+
row.candidates.map((candidate) => /* @__PURE__ */ jsx37("option", { value: candidate.source, children: sourceLabel(candidate.source) }, candidate.source)),
|
|
9535
|
+
/* @__PURE__ */ jsx37("option", { value: "__remove__", children: labels.remove })
|
|
9378
9536
|
]
|
|
9379
9537
|
}
|
|
9380
9538
|
)
|
|
9381
9539
|
] }),
|
|
9382
|
-
row.candidates.map((candidate) => /* @__PURE__ */
|
|
9383
|
-
/* @__PURE__ */
|
|
9384
|
-
/* @__PURE__ */
|
|
9540
|
+
row.candidates.map((candidate) => /* @__PURE__ */ jsxs31("details", { children: [
|
|
9541
|
+
/* @__PURE__ */ jsx37("summary", { children: sourceLabel(candidate.source) }),
|
|
9542
|
+
/* @__PURE__ */ jsx37("pre", { children: JSON.stringify(candidate.value, null, 2) })
|
|
9385
9543
|
] }, candidate.source))
|
|
9386
9544
|
] }, row.key))
|
|
9387
9545
|
] }),
|
|
9388
|
-
/* @__PURE__ */
|
|
9389
|
-
inspection.issues.length > 0 ? /* @__PURE__ */
|
|
9390
|
-
/* @__PURE__ */
|
|
9391
|
-
/* @__PURE__ */
|
|
9546
|
+
/* @__PURE__ */ jsx37("button", { type: "button", disabled: pending, onClick: () => void review(), children: labels.recoveryPreview }),
|
|
9547
|
+
inspection.issues.length > 0 ? /* @__PURE__ */ jsxs31("div", { role: "alert", children: [
|
|
9548
|
+
/* @__PURE__ */ jsx37("p", { children: labels.recoveryIssues }),
|
|
9549
|
+
/* @__PURE__ */ jsx37("ul", { children: [...new Set(inspection.issues)].map((issue) => /* @__PURE__ */ jsx37("li", { children: issueLabel(issue) }, issue)) })
|
|
9392
9550
|
] }) : null,
|
|
9393
|
-
reviewed ? /* @__PURE__ */
|
|
9394
|
-
inspection.operations.length > 0 ? /* @__PURE__ */
|
|
9395
|
-
/* @__PURE__ */
|
|
9396
|
-
/* @__PURE__ */
|
|
9397
|
-
/* @__PURE__ */
|
|
9551
|
+
reviewed ? /* @__PURE__ */ jsxs31("section", { "aria-label": labels.recoveryPreview, children: [
|
|
9552
|
+
inspection.operations.length > 0 ? /* @__PURE__ */ jsx37("ul", { children: inspection.operations.map((operation) => /* @__PURE__ */ jsx37("li", { children: describeOperation(operation) }, JSON.stringify(operation))) }) : /* @__PURE__ */ jsx37("p", { children: labels.recoveryNoChanges }),
|
|
9553
|
+
/* @__PURE__ */ jsxs31("details", { children: [
|
|
9554
|
+
/* @__PURE__ */ jsx37("summary", { children: labels.recoveryBackups }),
|
|
9555
|
+
/* @__PURE__ */ jsx37("pre", { children: JSON.stringify(inspection.backups, null, 2) })
|
|
9398
9556
|
] })
|
|
9399
9557
|
] }) : null,
|
|
9400
|
-
/* @__PURE__ */
|
|
9558
|
+
/* @__PURE__ */ jsx37(
|
|
9401
9559
|
"button",
|
|
9402
9560
|
{
|
|
9403
9561
|
ref: applyRef,
|
|
@@ -9407,7 +9565,7 @@ function KeepFallbackRecovery({
|
|
|
9407
9565
|
children: labels.recoveryApply
|
|
9408
9566
|
}
|
|
9409
9567
|
),
|
|
9410
|
-
/* @__PURE__ */
|
|
9568
|
+
/* @__PURE__ */ jsx37(
|
|
9411
9569
|
"button",
|
|
9412
9570
|
{
|
|
9413
9571
|
type: "button",
|
|
@@ -9428,8 +9586,8 @@ function KeepFallbackRecovery({
|
|
|
9428
9586
|
|
|
9429
9587
|
// src/features/rediscovery/KeepRediscovery.tsx
|
|
9430
9588
|
import { createRediscoveryQuery } from "@keepkit/core/core";
|
|
9431
|
-
import { useId as
|
|
9432
|
-
import { jsx as
|
|
9589
|
+
import { useId as useId8, useMemo as useMemo8 } from "react";
|
|
9590
|
+
import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
9433
9591
|
function KeepRediscovery({
|
|
9434
9592
|
strategy,
|
|
9435
9593
|
inactiveForMs,
|
|
@@ -9444,7 +9602,7 @@ function KeepRediscovery({
|
|
|
9444
9602
|
}),
|
|
9445
9603
|
[inactiveForMs, limit, strategy]
|
|
9446
9604
|
);
|
|
9447
|
-
return /* @__PURE__ */
|
|
9605
|
+
return /* @__PURE__ */ jsx38(
|
|
9448
9606
|
KeepList,
|
|
9449
9607
|
{
|
|
9450
9608
|
...props,
|
|
@@ -9464,18 +9622,18 @@ function KeepRediscoveryPanel({
|
|
|
9464
9622
|
strategy,
|
|
9465
9623
|
...props
|
|
9466
9624
|
}) {
|
|
9467
|
-
const headingId =
|
|
9625
|
+
const headingId = useId8();
|
|
9468
9626
|
const { className, ...rediscoveryProps } = props;
|
|
9469
9627
|
const neverOpenedLabel = useUiLabel("activityNeverOpened");
|
|
9470
9628
|
const inactiveLabel = useUiLabel("activityInactiveFor");
|
|
9471
9629
|
const openedLabel = useUiLabel("activityOpened");
|
|
9472
9630
|
const strategyLabel = strategy === "never-opened" ? neverOpenedLabel : strategy === "forgotten" ? inactiveLabel : openedLabel;
|
|
9473
|
-
return /* @__PURE__ */
|
|
9474
|
-
/* @__PURE__ */
|
|
9475
|
-
/* @__PURE__ */
|
|
9476
|
-
/* @__PURE__ */
|
|
9631
|
+
return /* @__PURE__ */ jsxs32("section", { className, "data-keepkit": "rediscovery-panel", "aria-labelledby": headingId, children: [
|
|
9632
|
+
/* @__PURE__ */ jsxs32("header", { children: [
|
|
9633
|
+
/* @__PURE__ */ jsx38("h2", { id: headingId, children: title ?? strategyLabel }),
|
|
9634
|
+
/* @__PURE__ */ jsx38("p", { children: description ?? strategyLabel })
|
|
9477
9635
|
] }),
|
|
9478
|
-
/* @__PURE__ */
|
|
9636
|
+
/* @__PURE__ */ jsx38(KeepRediscovery, { ...rediscoveryProps, strategy })
|
|
9479
9637
|
] });
|
|
9480
9638
|
}
|
|
9481
9639
|
|
|
@@ -9483,10 +9641,10 @@ function KeepRediscoveryPanel({
|
|
|
9483
9641
|
import { isValidElement as isValidElement9 } from "react";
|
|
9484
9642
|
|
|
9485
9643
|
// src/features/status/hooks/useStatusViews.ts
|
|
9486
|
-
import { useKeepContext as
|
|
9487
|
-
import { useEffect as
|
|
9644
|
+
import { useKeepContext as useKeepContext8 } from "@keepkit/core/react";
|
|
9645
|
+
import { useEffect as useEffect23, useRef as useRef20, useState as useState28 } from "react";
|
|
9488
9646
|
function useKeepStatus(status) {
|
|
9489
|
-
const context =
|
|
9647
|
+
const context = useKeepContext8();
|
|
9490
9648
|
const resolvedStatus = status ?? getDerivedStatus(context);
|
|
9491
9649
|
const state = {
|
|
9492
9650
|
status: resolvedStatus,
|
|
@@ -9497,13 +9655,13 @@ function useKeepStatus(status) {
|
|
|
9497
9655
|
return { state, defaultLabel: useUiLabel(getStatusLabelKey3(resolvedStatus)) };
|
|
9498
9656
|
}
|
|
9499
9657
|
function useKeepAnnouncements(messages) {
|
|
9500
|
-
const context =
|
|
9658
|
+
const context = useKeepContext8();
|
|
9501
9659
|
const savedMessage = useUiLabel("savedMessage", messages?.save);
|
|
9502
9660
|
const removedMessage = useUiLabel("removedMessage", messages?.remove);
|
|
9503
9661
|
const noteSavedMessage = useUiLabel("noteSavedMessage", messages?.note);
|
|
9504
|
-
const [message, setMessage] =
|
|
9505
|
-
const lastChangeRef =
|
|
9506
|
-
|
|
9662
|
+
const [message, setMessage] = useState28("");
|
|
9663
|
+
const lastChangeRef = useRef20(void 0);
|
|
9664
|
+
useEffect23(() => {
|
|
9507
9665
|
const change = context.lastChange;
|
|
9508
9666
|
if (!change || change === lastChangeRef.current) return;
|
|
9509
9667
|
lastChangeRef.current = change;
|
|
@@ -9531,7 +9689,7 @@ function getStatusLabelKey3(status) {
|
|
|
9531
9689
|
}
|
|
9532
9690
|
|
|
9533
9691
|
// src/features/status/status.tsx
|
|
9534
|
-
import { jsx as
|
|
9692
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
9535
9693
|
function KeepStatus({
|
|
9536
9694
|
status,
|
|
9537
9695
|
labels,
|
|
@@ -9563,7 +9721,7 @@ function KeepStatus({
|
|
|
9563
9721
|
}
|
|
9564
9722
|
function KeepAnnouncements({ messages, ...props }) {
|
|
9565
9723
|
const message = useKeepAnnouncements(messages);
|
|
9566
|
-
return /* @__PURE__ */
|
|
9724
|
+
return /* @__PURE__ */ jsx39(
|
|
9567
9725
|
"div",
|
|
9568
9726
|
{
|
|
9569
9727
|
...props,
|
|
@@ -9579,15 +9737,15 @@ function KeepAnnouncements({ messages, ...props }) {
|
|
|
9579
9737
|
var KeepAnnouncer = KeepAnnouncements;
|
|
9580
9738
|
|
|
9581
9739
|
// src/features/sync/hooks/useKeepSyncFeedback.ts
|
|
9582
|
-
import { useKeepContext as
|
|
9583
|
-
import { useEffect as
|
|
9740
|
+
import { useKeepContext as useKeepContext9 } from "@keepkit/core/react";
|
|
9741
|
+
import { useEffect as useEffect24, useRef as useRef21 } from "react";
|
|
9584
9742
|
function useKeepSyncFeedback() {
|
|
9585
|
-
const { syncState } =
|
|
9743
|
+
const { syncState } = useKeepContext9();
|
|
9586
9744
|
const emitFeedback = useKeepUiFeedback();
|
|
9587
9745
|
const completedMessage = useUiLabel("syncSynced");
|
|
9588
9746
|
const failedMessage = useUiLabel("syncFailedMessage");
|
|
9589
|
-
const previousStatus =
|
|
9590
|
-
|
|
9747
|
+
const previousStatus = useRef21("idle");
|
|
9748
|
+
useEffect24(() => {
|
|
9591
9749
|
const previous = previousStatus.current;
|
|
9592
9750
|
previousStatus.current = syncState.status;
|
|
9593
9751
|
if (syncState.status === "error" && previous !== "error") {
|
|
@@ -9607,17 +9765,17 @@ function KeepSyncFeedbackObserver() {
|
|
|
9607
9765
|
}
|
|
9608
9766
|
|
|
9609
9767
|
// src/features/sync/hooks/useKeepSyncRecoveryDialog.ts
|
|
9610
|
-
import { useKeepContext as
|
|
9611
|
-
import { useEffect as
|
|
9768
|
+
import { useKeepContext as useKeepContext10 } from "@keepkit/core/react";
|
|
9769
|
+
import { useEffect as useEffect25, useState as useState29 } from "react";
|
|
9612
9770
|
function useKeepSyncRecoveryDialog(options) {
|
|
9613
9771
|
const { open, onOpenChange, conflicts, onManualMerge } = options;
|
|
9614
|
-
const context =
|
|
9772
|
+
const context = useKeepContext10();
|
|
9615
9773
|
const conflictList = conflicts ?? context.syncState.conflicts ?? [];
|
|
9616
9774
|
const hasRecovery = conflictList.length > 0 || context.syncState.status === "error" || Boolean(context.error);
|
|
9617
|
-
const [dismissed, setDismissed] =
|
|
9618
|
-
const [busyId, setBusyId] =
|
|
9619
|
-
const [error, setError] =
|
|
9620
|
-
|
|
9775
|
+
const [dismissed, setDismissed] = useState29(false);
|
|
9776
|
+
const [busyId, setBusyId] = useState29();
|
|
9777
|
+
const [error, setError] = useState29();
|
|
9778
|
+
useEffect25(() => {
|
|
9621
9779
|
if (hasRecovery) setDismissed(false);
|
|
9622
9780
|
}, [hasRecovery]);
|
|
9623
9781
|
return {
|
|
@@ -9662,7 +9820,7 @@ function useKeepSyncRecoveryDialog(options) {
|
|
|
9662
9820
|
}
|
|
9663
9821
|
|
|
9664
9822
|
// src/features/sync/KeepSyncRecoveryDialog.tsx
|
|
9665
|
-
import { jsx as
|
|
9823
|
+
import { jsx as jsx40, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
9666
9824
|
function KeepSyncRecoveryDialog({
|
|
9667
9825
|
open,
|
|
9668
9826
|
onOpenChange,
|
|
@@ -9677,7 +9835,7 @@ function KeepSyncRecoveryDialog({
|
|
|
9677
9835
|
}) {
|
|
9678
9836
|
const view = useKeepSyncRecoveryDialog({ open, onOpenChange, conflicts, onManualMerge });
|
|
9679
9837
|
if (!view.isOpen) return null;
|
|
9680
|
-
return /* @__PURE__ */
|
|
9838
|
+
return /* @__PURE__ */ jsxs33(
|
|
9681
9839
|
"section",
|
|
9682
9840
|
{
|
|
9683
9841
|
...props,
|
|
@@ -9691,17 +9849,17 @@ function KeepSyncRecoveryDialog({
|
|
|
9691
9849
|
"data-state": view.conflictList.length > 0 ? "conflict" : "error",
|
|
9692
9850
|
"data-loading": view.busyId !== void 0 ? "true" : void 0,
|
|
9693
9851
|
children: [
|
|
9694
|
-
/* @__PURE__ */
|
|
9695
|
-
/* @__PURE__ */
|
|
9696
|
-
/* @__PURE__ */
|
|
9852
|
+
/* @__PURE__ */ jsxs33("header", { children: [
|
|
9853
|
+
/* @__PURE__ */ jsx40("h2", { id: "keepkit-sync-recovery-title", children: title ?? view.labels.title }),
|
|
9854
|
+
/* @__PURE__ */ jsx40("button", { type: "button", "data-keep-action": "close-dialog", onClick: view.close, "aria-label": view.labels.close, children: view.labels.close })
|
|
9697
9855
|
] }),
|
|
9698
9856
|
children,
|
|
9699
|
-
view.conflictList.length > 0 ? /* @__PURE__ */
|
|
9700
|
-
/* @__PURE__ */
|
|
9701
|
-
view.conflictList.map((conflict) => /* @__PURE__ */
|
|
9702
|
-
/* @__PURE__ */
|
|
9703
|
-
/* @__PURE__ */
|
|
9704
|
-
/* @__PURE__ */
|
|
9857
|
+
view.conflictList.length > 0 ? /* @__PURE__ */ jsxs33("div", { children: [
|
|
9858
|
+
/* @__PURE__ */ jsx40("p", { children: view.labels.conflict }),
|
|
9859
|
+
view.conflictList.map((conflict) => /* @__PURE__ */ jsxs33("article", { "data-conflict-id": conflict.id, children: [
|
|
9860
|
+
/* @__PURE__ */ jsx40("h3", { children: getMetaTitle(conflict.operation.item?.meta) ?? conflict.id }),
|
|
9861
|
+
/* @__PURE__ */ jsxs33("div", { "data-conflict-preview": true, children: [
|
|
9862
|
+
/* @__PURE__ */ jsx40(
|
|
9705
9863
|
ConflictPreview,
|
|
9706
9864
|
{
|
|
9707
9865
|
item: conflict.operation.item,
|
|
@@ -9711,7 +9869,7 @@ function KeepSyncRecoveryDialog({
|
|
|
9711
9869
|
side: "local"
|
|
9712
9870
|
}
|
|
9713
9871
|
),
|
|
9714
|
-
/* @__PURE__ */
|
|
9872
|
+
/* @__PURE__ */ jsx40(
|
|
9715
9873
|
ConflictPreview,
|
|
9716
9874
|
{
|
|
9717
9875
|
item: conflict.remote,
|
|
@@ -9722,8 +9880,8 @@ function KeepSyncRecoveryDialog({
|
|
|
9722
9880
|
}
|
|
9723
9881
|
)
|
|
9724
9882
|
] }),
|
|
9725
|
-
/* @__PURE__ */
|
|
9726
|
-
/* @__PURE__ */
|
|
9883
|
+
/* @__PURE__ */ jsxs33("div", { children: [
|
|
9884
|
+
/* @__PURE__ */ jsx40(
|
|
9727
9885
|
"button",
|
|
9728
9886
|
{
|
|
9729
9887
|
type: "button",
|
|
@@ -9733,7 +9891,7 @@ function KeepSyncRecoveryDialog({
|
|
|
9733
9891
|
children: view.labels.keepLocal
|
|
9734
9892
|
}
|
|
9735
9893
|
),
|
|
9736
|
-
/* @__PURE__ */
|
|
9894
|
+
/* @__PURE__ */ jsx40(
|
|
9737
9895
|
"button",
|
|
9738
9896
|
{
|
|
9739
9897
|
type: "button",
|
|
@@ -9743,7 +9901,7 @@ function KeepSyncRecoveryDialog({
|
|
|
9743
9901
|
children: view.labels.useServer
|
|
9744
9902
|
}
|
|
9745
9903
|
),
|
|
9746
|
-
/* @__PURE__ */
|
|
9904
|
+
/* @__PURE__ */ jsx40(
|
|
9747
9905
|
"button",
|
|
9748
9906
|
{
|
|
9749
9907
|
type: "button",
|
|
@@ -9756,12 +9914,12 @@ function KeepSyncRecoveryDialog({
|
|
|
9756
9914
|
] })
|
|
9757
9915
|
] }, conflict.id))
|
|
9758
9916
|
] }) : null,
|
|
9759
|
-
view.showBackupRecovery ? /* @__PURE__ */
|
|
9760
|
-
/* @__PURE__ */
|
|
9761
|
-
/* @__PURE__ */
|
|
9762
|
-
backup ?? (showBackupControls ? /* @__PURE__ */
|
|
9917
|
+
view.showBackupRecovery ? /* @__PURE__ */ jsxs33("section", { "data-recovery": "backup", children: [
|
|
9918
|
+
/* @__PURE__ */ jsx40("h3", { children: view.labels.backupRecovery }),
|
|
9919
|
+
/* @__PURE__ */ jsx40("p", { children: view.labels.backupRecoveryDescription }),
|
|
9920
|
+
backup ?? (showBackupControls ? /* @__PURE__ */ jsx40(KeepBackup, {}) : null)
|
|
9763
9921
|
] }) : null,
|
|
9764
|
-
view.error ? /* @__PURE__ */
|
|
9922
|
+
view.error ? /* @__PURE__ */ jsx40("p", { id: "keepkit-sync-recovery-error", role: "alert", "aria-live": "assertive", children: getErrorMessage(view.error, view.labels.error) }) : null
|
|
9765
9923
|
]
|
|
9766
9924
|
}
|
|
9767
9925
|
);
|
|
@@ -9773,16 +9931,16 @@ function ConflictPreview({
|
|
|
9773
9931
|
noteLabel,
|
|
9774
9932
|
side
|
|
9775
9933
|
}) {
|
|
9776
|
-
return /* @__PURE__ */
|
|
9777
|
-
/* @__PURE__ */
|
|
9778
|
-
/* @__PURE__ */
|
|
9779
|
-
/* @__PURE__ */
|
|
9780
|
-
/* @__PURE__ */
|
|
9781
|
-
/* @__PURE__ */
|
|
9934
|
+
return /* @__PURE__ */ jsxs33("article", { "data-conflict-version": side, "aria-label": heading, children: [
|
|
9935
|
+
/* @__PURE__ */ jsx40("h4", { children: heading }),
|
|
9936
|
+
/* @__PURE__ */ jsxs33("dl", { children: [
|
|
9937
|
+
/* @__PURE__ */ jsxs33("div", { children: [
|
|
9938
|
+
/* @__PURE__ */ jsx40("dt", { children: updatedAtLabel }),
|
|
9939
|
+
/* @__PURE__ */ jsx40("dd", { children: item ? /* @__PURE__ */ jsx40("time", { dateTime: new Date(item.updatedAt).toISOString(), children: formatConflictDate(item.updatedAt) }) : "\u2014" })
|
|
9782
9940
|
] }),
|
|
9783
|
-
/* @__PURE__ */
|
|
9784
|
-
/* @__PURE__ */
|
|
9785
|
-
/* @__PURE__ */
|
|
9941
|
+
/* @__PURE__ */ jsxs33("div", { children: [
|
|
9942
|
+
/* @__PURE__ */ jsx40("dt", { children: noteLabel }),
|
|
9943
|
+
/* @__PURE__ */ jsx40("dd", { children: item?.note || "\u2014" })
|
|
9786
9944
|
] })
|
|
9787
9945
|
] })
|
|
9788
9946
|
] });
|
|
@@ -9792,9 +9950,9 @@ function formatConflictDate(timestamp) {
|
|
|
9792
9950
|
}
|
|
9793
9951
|
|
|
9794
9952
|
// src/features/sync/hooks/useKeepSyncStatusBanner.ts
|
|
9795
|
-
import { useKeepContext as
|
|
9953
|
+
import { useKeepContext as useKeepContext11 } from "@keepkit/core/react";
|
|
9796
9954
|
function useKeepSyncStatusBanner({ onRetry, children }) {
|
|
9797
|
-
const context =
|
|
9955
|
+
const context = useKeepContext11();
|
|
9798
9956
|
const retryLabel = useUiLabel("retrySync");
|
|
9799
9957
|
const resolveLabel = useUiLabel("resolveSync");
|
|
9800
9958
|
const conflictLabel = useUiLabel("syncConflict");
|
|
@@ -9824,7 +9982,7 @@ function useKeepSyncStatusBanner({ onRetry, children }) {
|
|
|
9824
9982
|
}
|
|
9825
9983
|
|
|
9826
9984
|
// src/features/sync/KeepSyncStatusBanner.tsx
|
|
9827
|
-
import { jsx as
|
|
9985
|
+
import { jsx as jsx41, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
9828
9986
|
function KeepSyncStatusBanner({
|
|
9829
9987
|
onRetry,
|
|
9830
9988
|
onResolveConflicts,
|
|
@@ -9836,7 +9994,7 @@ function KeepSyncStatusBanner({
|
|
|
9836
9994
|
const showRetryLabel = useUiLabelVisibility("retrySync");
|
|
9837
9995
|
const showResolveLabel = useUiLabelVisibility("resolveSync");
|
|
9838
9996
|
if (view.status === "idle" && !view.hasConflicts) return null;
|
|
9839
|
-
return /* @__PURE__ */
|
|
9997
|
+
return /* @__PURE__ */ jsxs34(
|
|
9840
9998
|
"aside",
|
|
9841
9999
|
{
|
|
9842
10000
|
...props,
|
|
@@ -9846,8 +10004,8 @@ function KeepSyncStatusBanner({
|
|
|
9846
10004
|
"data-keepkit": "sync-status",
|
|
9847
10005
|
"data-state": view.status,
|
|
9848
10006
|
children: [
|
|
9849
|
-
/* @__PURE__ */
|
|
9850
|
-
view.showRetry ? /* @__PURE__ */
|
|
10007
|
+
/* @__PURE__ */ jsx41("p", { children: view.message }),
|
|
10008
|
+
view.showRetry ? /* @__PURE__ */ jsx41(
|
|
9851
10009
|
"button",
|
|
9852
10010
|
{
|
|
9853
10011
|
type: "button",
|
|
@@ -9858,7 +10016,7 @@ function KeepSyncStatusBanner({
|
|
|
9858
10016
|
children: showRetryLabel ? view.retryLabel : null
|
|
9859
10017
|
}
|
|
9860
10018
|
) : null,
|
|
9861
|
-
view.hasConflicts ? /* @__PURE__ */
|
|
10019
|
+
view.hasConflicts ? /* @__PURE__ */ jsx41(
|
|
9862
10020
|
"button",
|
|
9863
10021
|
{
|
|
9864
10022
|
type: "button",
|
|
@@ -9878,7 +10036,7 @@ function KeepSyncStatusBanner({
|
|
|
9878
10036
|
import { createInboxQuery as createInboxQuery2 } from "@keepkit/core/core";
|
|
9879
10037
|
|
|
9880
10038
|
// src/features/workspace/hooks/useKeepWorkspace.ts
|
|
9881
|
-
import { useCallback as useCallback13, useState as
|
|
10039
|
+
import { useCallback as useCallback13, useState as useState30 } from "react";
|
|
9882
10040
|
var PRESET_MODULES = {
|
|
9883
10041
|
basic: {
|
|
9884
10042
|
syncStatus: false,
|
|
@@ -9930,7 +10088,7 @@ function useKeepWorkspace({
|
|
|
9930
10088
|
onRecoveryOpenChange,
|
|
9931
10089
|
onResolveConflicts
|
|
9932
10090
|
}) {
|
|
9933
|
-
const [internalRecoveryOpen, setInternalRecoveryOpen] =
|
|
10091
|
+
const [internalRecoveryOpen, setInternalRecoveryOpen] = useState30(false);
|
|
9934
10092
|
const resolvedModules = { ...PRESET_MODULES[preset], ...modules };
|
|
9935
10093
|
const setRecoveryOpen = useCallback13(
|
|
9936
10094
|
(open) => {
|
|
@@ -9954,7 +10112,7 @@ function useKeepWorkspace({
|
|
|
9954
10112
|
}
|
|
9955
10113
|
|
|
9956
10114
|
// src/features/workspace/KeepWorkspace.tsx
|
|
9957
|
-
import { jsx as
|
|
10115
|
+
import { jsx as jsx42, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
9958
10116
|
function KeepWorkspace({
|
|
9959
10117
|
preset = "standard",
|
|
9960
10118
|
modules,
|
|
@@ -10002,27 +10160,27 @@ function KeepWorkspace({
|
|
|
10002
10160
|
if (!structuredRegions) return content;
|
|
10003
10161
|
if (!hasRenderableContent(content)) return null;
|
|
10004
10162
|
const resolvedSurface = typeof surface === "string" ? surface : surface[name] ?? "plain";
|
|
10005
|
-
return /* @__PURE__ */
|
|
10163
|
+
return /* @__PURE__ */ jsx42("div", { "data-keepkit": "workspace-region", "data-region": name, "data-surface": resolvedSurface, children: content });
|
|
10006
10164
|
};
|
|
10007
10165
|
const before = resolveOptionalSlot(slots?.before, state);
|
|
10008
10166
|
const syncStatus = view.modules.syncStatus ? resolveSlot(
|
|
10009
10167
|
slots?.syncStatus,
|
|
10010
|
-
/* @__PURE__ */
|
|
10168
|
+
/* @__PURE__ */ jsx42(KeepSyncStatusBanner, { ...syncStatusProps, onResolveConflicts: view.openRecovery }),
|
|
10011
10169
|
state
|
|
10012
10170
|
) : null;
|
|
10013
|
-
const collection = resolveSlot(slots?.collection, /* @__PURE__ */
|
|
10171
|
+
const collection = resolveSlot(slots?.collection, /* @__PURE__ */ jsx42(KeepCollection, { ...resolvedCollectionProps }), state);
|
|
10014
10172
|
const actions = view.modules.backup || view.modules.stalePrune ? resolveSlot(
|
|
10015
10173
|
slots?.actions,
|
|
10016
|
-
/* @__PURE__ */
|
|
10017
|
-
view.modules.stalePrune ? /* @__PURE__ */
|
|
10018
|
-
view.modules.backup ? /* @__PURE__ */
|
|
10174
|
+
/* @__PURE__ */ jsxs35("div", { "data-keepkit": "workspace-actions", children: [
|
|
10175
|
+
view.modules.stalePrune ? /* @__PURE__ */ jsx42(KeepPruneStaleButton, { ...stalePruneProps }) : null,
|
|
10176
|
+
view.modules.backup ? /* @__PURE__ */ jsx42(KeepBackup, { ...backupProps }) : null
|
|
10019
10177
|
] }),
|
|
10020
10178
|
state
|
|
10021
10179
|
) : null;
|
|
10022
|
-
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */
|
|
10180
|
+
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */ jsx42(KeepUndo, { ...undoProps }), state) : null;
|
|
10023
10181
|
const recovery = view.modules.recovery ? resolveSlot(
|
|
10024
10182
|
slots?.recovery,
|
|
10025
|
-
/* @__PURE__ */
|
|
10183
|
+
/* @__PURE__ */ jsx42(
|
|
10026
10184
|
KeepSyncRecoveryDialog,
|
|
10027
10185
|
{
|
|
10028
10186
|
...recoveryProps,
|
|
@@ -10034,7 +10192,7 @@ function KeepWorkspace({
|
|
|
10034
10192
|
) : null;
|
|
10035
10193
|
const additionalContent = resolveOptionalSlot(children, state);
|
|
10036
10194
|
const after = resolveOptionalSlot(slots?.after, state);
|
|
10037
|
-
return /* @__PURE__ */
|
|
10195
|
+
return /* @__PURE__ */ jsxs35(
|
|
10038
10196
|
"section",
|
|
10039
10197
|
{
|
|
10040
10198
|
...props,
|
|
@@ -10071,7 +10229,7 @@ import {
|
|
|
10071
10229
|
KeepErrorBoundary as KeepErrorBoundary3,
|
|
10072
10230
|
KeepProvider,
|
|
10073
10231
|
useKeepCollections as useKeepCollections8,
|
|
10074
|
-
useKeepContext as
|
|
10232
|
+
useKeepContext as useKeepContext12,
|
|
10075
10233
|
useKeepItem as useKeepItem8,
|
|
10076
10234
|
useKeepList as useKeepList7,
|
|
10077
10235
|
useKeepNavigator as useKeepNavigator2,
|
|
@@ -10088,7 +10246,7 @@ import {
|
|
|
10088
10246
|
LocalStorageSyncQueueAdapter,
|
|
10089
10247
|
SyncStorageAdapter
|
|
10090
10248
|
} from "@keepkit/core/storage";
|
|
10091
|
-
import { jsx as
|
|
10249
|
+
import { jsx as jsx43, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
10092
10250
|
function KeepKitProvider({
|
|
10093
10251
|
labels,
|
|
10094
10252
|
labelOptions,
|
|
@@ -10110,7 +10268,7 @@ function KeepKitProvider({
|
|
|
10110
10268
|
children,
|
|
10111
10269
|
...providerProps
|
|
10112
10270
|
}) {
|
|
10113
|
-
return /* @__PURE__ */
|
|
10271
|
+
return /* @__PURE__ */ jsx43(
|
|
10114
10272
|
KeepUiProvider,
|
|
10115
10273
|
{
|
|
10116
10274
|
labels,
|
|
@@ -10118,7 +10276,7 @@ function KeepKitProvider({
|
|
|
10118
10276
|
locale,
|
|
10119
10277
|
labelResolver,
|
|
10120
10278
|
onFeedback,
|
|
10121
|
-
children: /* @__PURE__ */
|
|
10279
|
+
children: /* @__PURE__ */ jsx43(
|
|
10122
10280
|
KeepThemeProvider,
|
|
10123
10281
|
{
|
|
10124
10282
|
theme,
|
|
@@ -10132,10 +10290,10 @@ function KeepKitProvider({
|
|
|
10132
10290
|
className: themeClassName,
|
|
10133
10291
|
style: themeStyle,
|
|
10134
10292
|
asChild: themeAsChild,
|
|
10135
|
-
children: /* @__PURE__ */
|
|
10136
|
-
/* @__PURE__ */
|
|
10137
|
-
/* @__PURE__ */
|
|
10138
|
-
/* @__PURE__ */
|
|
10293
|
+
children: /* @__PURE__ */ jsxs36(CoreKeepProvider, { ...providerProps, children: [
|
|
10294
|
+
/* @__PURE__ */ jsx43(KeepSyncFeedbackObserver, {}),
|
|
10295
|
+
/* @__PURE__ */ jsx43(KeepTourProvider, { ...tour, children }),
|
|
10296
|
+
/* @__PURE__ */ jsx43(KeepAnnouncements, {})
|
|
10139
10297
|
] })
|
|
10140
10298
|
}
|
|
10141
10299
|
)
|
|
@@ -10166,7 +10324,7 @@ function createKeepKit(options = {}) {
|
|
|
10166
10324
|
} = options;
|
|
10167
10325
|
const coreKit = createCoreKeepKit(coreOptions);
|
|
10168
10326
|
return {
|
|
10169
|
-
Provider: (props) => /* @__PURE__ */
|
|
10327
|
+
Provider: (props) => /* @__PURE__ */ jsx43(
|
|
10170
10328
|
KeepKitProvider,
|
|
10171
10329
|
{
|
|
10172
10330
|
...coreOptions,
|
|
@@ -10189,9 +10347,9 @@ function createKeepKit(options = {}) {
|
|
|
10189
10347
|
...props
|
|
10190
10348
|
}
|
|
10191
10349
|
),
|
|
10192
|
-
Button: (props) => /* @__PURE__ */
|
|
10193
|
-
Backup: (props) => /* @__PURE__ */
|
|
10194
|
-
Collection: (props) => /* @__PURE__ */
|
|
10350
|
+
Button: (props) => /* @__PURE__ */ jsx43(KeepButton, { ...props }),
|
|
10351
|
+
Backup: (props) => /* @__PURE__ */ jsx43(KeepBackup, { ...props }),
|
|
10352
|
+
Collection: (props) => /* @__PURE__ */ jsx43(
|
|
10195
10353
|
KeepCollection,
|
|
10196
10354
|
{
|
|
10197
10355
|
...props,
|
|
@@ -10202,11 +10360,11 @@ function createKeepKit(options = {}) {
|
|
|
10202
10360
|
}
|
|
10203
10361
|
}
|
|
10204
10362
|
),
|
|
10205
|
-
Inbox: (props) => /* @__PURE__ */
|
|
10206
|
-
SavedViews: (props) => /* @__PURE__ */
|
|
10207
|
-
CollectionManager: (props) => /* @__PURE__ */
|
|
10208
|
-
FallbackRecovery: (props) => /* @__PURE__ */
|
|
10209
|
-
Workspace: (props) => /* @__PURE__ */
|
|
10363
|
+
Inbox: (props) => /* @__PURE__ */ jsx43(KeepInbox, { ...props }),
|
|
10364
|
+
SavedViews: (props) => /* @__PURE__ */ jsx43(KeepSavedViews, { ...props }),
|
|
10365
|
+
CollectionManager: (props) => /* @__PURE__ */ jsx43(KeepCollectionManager, { ...props }),
|
|
10366
|
+
FallbackRecovery: (props) => /* @__PURE__ */ jsx43(KeepFallbackRecovery, { ...props }),
|
|
10367
|
+
Workspace: (props) => /* @__PURE__ */ jsx43(
|
|
10210
10368
|
KeepWorkspace,
|
|
10211
10369
|
{
|
|
10212
10370
|
...props,
|
|
@@ -10228,8 +10386,8 @@ function createKeepKit(options = {}) {
|
|
|
10228
10386
|
useCollections: (collectionsOptions) => coreKit.useCollections(collectionsOptions),
|
|
10229
10387
|
useNavigator: (navigatorOptions) => coreKit.useNavigator(navigatorOptions),
|
|
10230
10388
|
useShortcut: (shortcutOptions) => coreKit.useShortcut(shortcutOptions),
|
|
10231
|
-
FloatingTour: (props) => /* @__PURE__ */
|
|
10232
|
-
TourProvider: (props) => /* @__PURE__ */
|
|
10389
|
+
FloatingTour: (props) => /* @__PURE__ */ jsx43(KeepFloatingTour, { ...props }),
|
|
10390
|
+
TourProvider: (props) => /* @__PURE__ */ jsx43(KeepTourProvider, { ...props }),
|
|
10233
10391
|
useTour: (tourOptions) => useKeepTour(tourOptions)
|
|
10234
10392
|
};
|
|
10235
10393
|
}
|
|
@@ -10242,6 +10400,7 @@ export {
|
|
|
10242
10400
|
KeepAnnouncer,
|
|
10243
10401
|
KeepArchiveButton,
|
|
10244
10402
|
KeepArchiveScopeSelect,
|
|
10403
|
+
KeepArchiveUndo,
|
|
10245
10404
|
KeepBackup,
|
|
10246
10405
|
KeepBulkActions,
|
|
10247
10406
|
KeepButton,
|
|
@@ -10310,7 +10469,7 @@ export {
|
|
|
10310
10469
|
mergeProps,
|
|
10311
10470
|
toggleSelectAll,
|
|
10312
10471
|
useKeepCollections8 as useKeepCollections,
|
|
10313
|
-
|
|
10472
|
+
useKeepContext12 as useKeepContext,
|
|
10314
10473
|
useKeepItem8 as useKeepItem,
|
|
10315
10474
|
useKeepList7 as useKeepList,
|
|
10316
10475
|
useKeepNavigator2 as useKeepNavigator,
|