@keepkit/ui 0.28.15 → 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 +86 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.js +1207 -984
- package/dist/index.js.map +1 -1
- package/dist/styles/base.css +26 -6
- package/dist/styles/collection.css +3 -6
- 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,11 +4273,14 @@ 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
|
] });
|
|
4214
4280
|
};
|
|
4281
|
+
const meta = props.item.meta;
|
|
4282
|
+
const title = typeof meta === "object" && meta !== null && "title" in meta && typeof meta.title === "string" ? meta.title.trim() : "";
|
|
4283
|
+
const accessibleLabel = (label) => title ? `${label}: ${title}` : label;
|
|
4215
4284
|
const sharedProps = {
|
|
4216
4285
|
...props,
|
|
4217
4286
|
onClick: (event) => {
|
|
@@ -4231,11 +4300,11 @@ function KeepButton({
|
|
|
4231
4300
|
"aria-busy": props["aria-busy"] ?? (view.buttonState.isLoading || view.buttonState.isMutating),
|
|
4232
4301
|
savedLabel: showSavedLabel ? labels?.saved ?? props.savedLabel ?? view.labels.saved : null,
|
|
4233
4302
|
unsavedLabel: showSaveLabel ? labels?.unsaved ?? props.unsavedLabel ?? view.labels.save : null,
|
|
4234
|
-
savedAriaLabel: labels?.savedAriaLabel ?? props.savedAriaLabel ?? (props.children === void 0 && !showSavedLabel ? removeLabel : void 0),
|
|
4235
|
-
unsavedAriaLabel: labels?.unsavedAriaLabel ?? props.unsavedAriaLabel ?? (props.children === void 0 && !showSaveLabel ? view.labels.save : void 0)
|
|
4303
|
+
savedAriaLabel: labels?.savedAriaLabel ?? props.savedAriaLabel ?? (props.children === void 0 && !props.asChild && (iconOnly || !showLabel || !showSavedLabel) ? accessibleLabel(removeLabel) : void 0),
|
|
4304
|
+
unsavedAriaLabel: labels?.unsavedAriaLabel ?? props.unsavedAriaLabel ?? (props.children === void 0 && !props.asChild && (iconOnly || !showLabel || !showSaveLabel) ? accessibleLabel(view.labels.save) : void 0)
|
|
4236
4305
|
};
|
|
4237
|
-
if (!view.customStateLabel) return /* @__PURE__ */
|
|
4238
|
-
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) }) });
|
|
4239
4308
|
}
|
|
4240
4309
|
function renderIcon(icon, className) {
|
|
4241
4310
|
if (typeof icon === "function") return createElement(icon, { "aria-hidden": true, className });
|
|
@@ -4246,44 +4315,124 @@ function renderIcon(icon, className) {
|
|
|
4246
4315
|
import { useKeepItem as useKeepItem4 } from "@keepkit/core/react";
|
|
4247
4316
|
import {
|
|
4248
4317
|
useCallback as useCallback3,
|
|
4249
|
-
useEffect as
|
|
4250
|
-
useId,
|
|
4251
|
-
|
|
4252
|
-
|
|
4318
|
+
useEffect as useEffect8,
|
|
4319
|
+
useId as useId2,
|
|
4320
|
+
useLayoutEffect,
|
|
4321
|
+
useRef as useRef9,
|
|
4322
|
+
useState as useState5
|
|
4253
4323
|
} from "react";
|
|
4324
|
+
import { createPortal } from "react-dom";
|
|
4325
|
+
|
|
4326
|
+
// src/foundation/theme.tsx
|
|
4327
|
+
import {
|
|
4328
|
+
createContext as createContext3,
|
|
4329
|
+
isValidElement as isValidElement2,
|
|
4330
|
+
useContext as useContext3
|
|
4331
|
+
} from "react";
|
|
4332
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
4333
|
+
var keepThemeNames = [
|
|
4334
|
+
"default",
|
|
4335
|
+
"ocean",
|
|
4336
|
+
"forest",
|
|
4337
|
+
"sunset",
|
|
4338
|
+
"lavender",
|
|
4339
|
+
"compact",
|
|
4340
|
+
"minimal",
|
|
4341
|
+
"rounded",
|
|
4342
|
+
"high-contrast",
|
|
4343
|
+
"dark"
|
|
4344
|
+
];
|
|
4345
|
+
var KeepThemeContext = createContext3({});
|
|
4346
|
+
function useKeepTheme() {
|
|
4347
|
+
return useContext3(KeepThemeContext);
|
|
4348
|
+
}
|
|
4349
|
+
function KeepThemeProvider({
|
|
4350
|
+
children,
|
|
4351
|
+
theme = "default",
|
|
4352
|
+
mode = "system",
|
|
4353
|
+
density = "comfortable",
|
|
4354
|
+
radius = "medium",
|
|
4355
|
+
accentColor,
|
|
4356
|
+
highContrast = false,
|
|
4357
|
+
reducedMotion = false,
|
|
4358
|
+
variables,
|
|
4359
|
+
style,
|
|
4360
|
+
className,
|
|
4361
|
+
asChild = false,
|
|
4362
|
+
...props
|
|
4363
|
+
}) {
|
|
4364
|
+
const themeClassName = [
|
|
4365
|
+
"keep-theme",
|
|
4366
|
+
`keep-theme--${theme}`,
|
|
4367
|
+
`keep-theme--${mode}`,
|
|
4368
|
+
`keep-theme--density-${density}`,
|
|
4369
|
+
`keep-theme--radius-${radius}`,
|
|
4370
|
+
className
|
|
4371
|
+
].filter(Boolean).join(" ");
|
|
4372
|
+
const themeStyle = {
|
|
4373
|
+
...style,
|
|
4374
|
+
...accentColor && !highContrast ? { "--keep-accent": accentColor, "--keep-primary": accentColor } : {},
|
|
4375
|
+
...variables
|
|
4376
|
+
};
|
|
4377
|
+
const rootProps = {
|
|
4378
|
+
...props,
|
|
4379
|
+
className: themeClassName,
|
|
4380
|
+
style: themeStyle,
|
|
4381
|
+
"data-keep-theme": theme,
|
|
4382
|
+
"data-theme": theme,
|
|
4383
|
+
"data-mode": mode,
|
|
4384
|
+
"data-density": density,
|
|
4385
|
+
"data-radius": radius,
|
|
4386
|
+
"data-accent-color": accentColor,
|
|
4387
|
+
"data-high-contrast": highContrast ? "true" : void 0,
|
|
4388
|
+
"data-reduced-motion": reducedMotion ? "true" : void 0
|
|
4389
|
+
};
|
|
4390
|
+
const content = asChild ? (() => {
|
|
4391
|
+
if (!isValidElement2(children))
|
|
4392
|
+
throw new Error("KeepThemeProvider with asChild requires a single React element child.");
|
|
4393
|
+
return createSlot(children, rootProps);
|
|
4394
|
+
})() : /* @__PURE__ */ jsx9("div", { ...rootProps, children });
|
|
4395
|
+
return /* @__PURE__ */ jsx9(
|
|
4396
|
+
KeepThemeContext.Provider,
|
|
4397
|
+
{
|
|
4398
|
+
value: { theme, mode, density, radius, accentColor, highContrast, reducedMotion, variables, style },
|
|
4399
|
+
children: content
|
|
4400
|
+
}
|
|
4401
|
+
);
|
|
4402
|
+
}
|
|
4254
4403
|
|
|
4255
4404
|
// src/features/editor/KeepQuickEditor.tsx
|
|
4256
4405
|
import { useKeepCollections as useKeepCollections3, useKeepItem as useKeepItem3 } from "@keepkit/core/react";
|
|
4257
4406
|
import {
|
|
4258
4407
|
useCallback as useCallback2,
|
|
4259
|
-
useEffect as
|
|
4260
|
-
useRef as
|
|
4261
|
-
useState as
|
|
4408
|
+
useEffect as useEffect7,
|
|
4409
|
+
useRef as useRef8,
|
|
4410
|
+
useState as useState4
|
|
4262
4411
|
} from "react";
|
|
4263
|
-
import { Fragment as Fragment5, jsx as
|
|
4412
|
+
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
4264
4413
|
function useKeepQuickEditor(item, options = {}) {
|
|
4265
4414
|
const { debounceMs = 300, onSaved, onSaveError } = options;
|
|
4266
4415
|
const itemState = useKeepItem3(item);
|
|
4267
4416
|
const { error, isMutating, moveToCollection, refreshMetadata, updateNote, updateTags } = itemState;
|
|
4268
4417
|
const baseline = itemState.item ?? item;
|
|
4269
4418
|
const initialTitle = getMetaTitle(baseline.meta) ?? "";
|
|
4270
|
-
const [title, setTitle] =
|
|
4271
|
-
const [note, setNote] =
|
|
4272
|
-
const [tags, setTags] =
|
|
4273
|
-
const [collectionId, setCollectionId] =
|
|
4274
|
-
const [saveStatus, setSaveStatus] =
|
|
4275
|
-
const [saveError, setSaveError] =
|
|
4276
|
-
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({
|
|
4277
4426
|
title: initialTitle,
|
|
4278
4427
|
note: baseline.note ?? "",
|
|
4279
4428
|
tags: baseline.tags ?? [],
|
|
4280
4429
|
collectionId: baseline.collectionId
|
|
4281
4430
|
});
|
|
4282
|
-
const draftRef =
|
|
4283
|
-
const flushRequestedRef =
|
|
4284
|
-
const flushPromiseRef =
|
|
4431
|
+
const draftRef = useRef8({ title, note, tags, collectionId });
|
|
4432
|
+
const flushRequestedRef = useRef8(false);
|
|
4433
|
+
const flushPromiseRef = useRef8(null);
|
|
4285
4434
|
draftRef.current = { title, note, tags, collectionId };
|
|
4286
|
-
|
|
4435
|
+
useEffect7(() => {
|
|
4287
4436
|
const nextTitle = getMetaTitle(baseline.meta) ?? "";
|
|
4288
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) {
|
|
4289
4438
|
setTitle(nextTitle);
|
|
@@ -4299,7 +4448,7 @@ function useKeepQuickEditor(item, options = {}) {
|
|
|
4299
4448
|
}
|
|
4300
4449
|
}, [baseline]);
|
|
4301
4450
|
const isDirty = title !== baselineRef.current.title || note !== baselineRef.current.note || !sameTags(tags, baselineRef.current.tags) || collectionId !== baselineRef.current.collectionId;
|
|
4302
|
-
|
|
4451
|
+
useEffect7(() => {
|
|
4303
4452
|
if (!isDirty && saveStatus === "dirty" && !flushPromiseRef.current) setSaveStatus("idle");
|
|
4304
4453
|
}, [isDirty, saveStatus]);
|
|
4305
4454
|
const flush = useCallback2(() => {
|
|
@@ -4349,7 +4498,7 @@ function useKeepQuickEditor(item, options = {}) {
|
|
|
4349
4498
|
flushPromiseRef.current = promise;
|
|
4350
4499
|
return promise;
|
|
4351
4500
|
}, [baseline, moveToCollection, onSaveError, onSaved, refreshMetadata, updateNote, updateTags]);
|
|
4352
|
-
|
|
4501
|
+
useEffect7(() => {
|
|
4353
4502
|
if (!isDirty || debounceMs <= 0 || saveStatus === "error") return;
|
|
4354
4503
|
const timer = window.setTimeout(() => void flush().catch(() => void 0), debounceMs);
|
|
4355
4504
|
return () => window.clearTimeout(timer);
|
|
@@ -4398,7 +4547,7 @@ function KeepQuickEditor({
|
|
|
4398
4547
|
...props
|
|
4399
4548
|
}) {
|
|
4400
4549
|
const view = useKeepQuickEditor(item, { debounceMs, onSaved, onSaveError });
|
|
4401
|
-
return /* @__PURE__ */
|
|
4550
|
+
return /* @__PURE__ */ jsx10(KeepQuickEditorView, { ...props, features, state: view.state });
|
|
4402
4551
|
}
|
|
4403
4552
|
var DEFAULT_FEATURES = {
|
|
4404
4553
|
title: false,
|
|
@@ -4420,7 +4569,7 @@ function KeepQuickEditorView({
|
|
|
4420
4569
|
}) {
|
|
4421
4570
|
const enabled = { ...DEFAULT_FEATURES, ...features };
|
|
4422
4571
|
const collections = useKeepCollections3({ targetType: state.item.targetType, orderBy: "name" });
|
|
4423
|
-
const rootRef =
|
|
4572
|
+
const rootRef = useRef8(null);
|
|
4424
4573
|
const titleLabel = useUiLabel("title");
|
|
4425
4574
|
const showTitleLabel = useUiLabelVisibility("title");
|
|
4426
4575
|
const noteLabel = useUiLabel("note");
|
|
@@ -4439,16 +4588,16 @@ function KeepQuickEditorView({
|
|
|
4439
4588
|
const savingLabel = useUiLabel("saving");
|
|
4440
4589
|
const savedLabel = useUiLabel("saved");
|
|
4441
4590
|
const errorLabel = useUiLabel("error");
|
|
4442
|
-
const [tagsInput, setTagsInput] =
|
|
4591
|
+
const [tagsInput, setTagsInput] = useState4(() => formatTags(state.tags));
|
|
4443
4592
|
const submit = (event) => {
|
|
4444
4593
|
event.preventDefault();
|
|
4445
4594
|
void state.flush().catch(() => void 0);
|
|
4446
4595
|
};
|
|
4447
|
-
|
|
4596
|
+
useEffect7(() => {
|
|
4448
4597
|
if (!sameTags(parseTags(tagsInput), state.tags)) setTagsInput(formatTags(state.tags));
|
|
4449
4598
|
}, [state.tags, tagsInput]);
|
|
4450
|
-
const [closeFailed, setCloseFailed] =
|
|
4451
|
-
|
|
4599
|
+
const [closeFailed, setCloseFailed] = useState4(false);
|
|
4600
|
+
useEffect7(() => {
|
|
4452
4601
|
if (!closeFailed || state.saveStatus !== "error") return;
|
|
4453
4602
|
rootRef.current?.querySelector('[role="alert"]')?.focus();
|
|
4454
4603
|
setCloseFailed(false);
|
|
@@ -4467,10 +4616,10 @@ function KeepQuickEditorView({
|
|
|
4467
4616
|
if (event.key === "Tab" && focusScopeRef?.current) trapFocus(event, focusScopeRef.current);
|
|
4468
4617
|
};
|
|
4469
4618
|
const statusMessage = state.saveStatus === "dirty" ? unsavedChangesLabel : state.saveStatus === "saving" ? savingLabel : state.saveStatus === "saved" ? savedLabel : state.saveStatus === "error" ? getErrorMessage(state.error, errorLabel) : null;
|
|
4470
|
-
const body = typeof children === "function" ? children(state) : children ?? /* @__PURE__ */
|
|
4471
|
-
enabled.note ? /* @__PURE__ */
|
|
4472
|
-
showNoteLabel ? /* @__PURE__ */
|
|
4473
|
-
/* @__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(
|
|
4474
4623
|
"textarea",
|
|
4475
4624
|
{
|
|
4476
4625
|
value: state.note,
|
|
@@ -4479,9 +4628,9 @@ function KeepQuickEditorView({
|
|
|
4479
4628
|
}
|
|
4480
4629
|
)
|
|
4481
4630
|
] }) : null,
|
|
4482
|
-
enabled.title ? /* @__PURE__ */
|
|
4483
|
-
showTitleLabel ? /* @__PURE__ */
|
|
4484
|
-
/* @__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(
|
|
4485
4634
|
"input",
|
|
4486
4635
|
{
|
|
4487
4636
|
value: state.title,
|
|
@@ -4490,9 +4639,9 @@ function KeepQuickEditorView({
|
|
|
4490
4639
|
}
|
|
4491
4640
|
)
|
|
4492
4641
|
] }) : null,
|
|
4493
|
-
enabled.tags ? /* @__PURE__ */
|
|
4494
|
-
showTagsLabel ? /* @__PURE__ */
|
|
4495
|
-
/* @__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(
|
|
4496
4645
|
"input",
|
|
4497
4646
|
{
|
|
4498
4647
|
value: tagsInput,
|
|
@@ -4505,22 +4654,22 @@ function KeepQuickEditorView({
|
|
|
4505
4654
|
}
|
|
4506
4655
|
)
|
|
4507
4656
|
] }) : null,
|
|
4508
|
-
enabled.collection ? /* @__PURE__ */
|
|
4509
|
-
showCollectionLabel ? /* @__PURE__ */
|
|
4510
|
-
/* @__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(
|
|
4511
4660
|
"select",
|
|
4512
4661
|
{
|
|
4513
4662
|
value: state.collectionId ?? "",
|
|
4514
4663
|
"aria-label": showCollectionLabel ? void 0 : collectionLabel,
|
|
4515
4664
|
onChange: (event) => state.setCollectionId(event.currentTarget.value || void 0),
|
|
4516
4665
|
children: [
|
|
4517
|
-
/* @__PURE__ */
|
|
4518
|
-
(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))
|
|
4519
4668
|
]
|
|
4520
4669
|
}
|
|
4521
4670
|
)
|
|
4522
4671
|
] }) : null,
|
|
4523
|
-
statusMessage ? /* @__PURE__ */
|
|
4672
|
+
statusMessage ? /* @__PURE__ */ jsx10(
|
|
4524
4673
|
"p",
|
|
4525
4674
|
{
|
|
4526
4675
|
role: state.saveStatus === "error" ? "alert" : "status",
|
|
@@ -4531,7 +4680,7 @@ function KeepQuickEditorView({
|
|
|
4531
4680
|
children: statusMessage
|
|
4532
4681
|
}
|
|
4533
4682
|
) : null,
|
|
4534
|
-
showSaveButton || state.saveStatus === "error" ? /* @__PURE__ */
|
|
4683
|
+
showSaveButton || state.saveStatus === "error" ? /* @__PURE__ */ jsx10(
|
|
4535
4684
|
"button",
|
|
4536
4685
|
{
|
|
4537
4686
|
type: "submit",
|
|
@@ -4541,7 +4690,7 @@ function KeepQuickEditorView({
|
|
|
4541
4690
|
children: showSaveLabel ? saveLabel : null
|
|
4542
4691
|
}
|
|
4543
4692
|
) : null,
|
|
4544
|
-
onClose ? /* @__PURE__ */
|
|
4693
|
+
onClose ? /* @__PURE__ */ jsx10(
|
|
4545
4694
|
"button",
|
|
4546
4695
|
{
|
|
4547
4696
|
type: "button",
|
|
@@ -4553,7 +4702,7 @@ function KeepQuickEditorView({
|
|
|
4553
4702
|
}
|
|
4554
4703
|
) : null
|
|
4555
4704
|
] });
|
|
4556
|
-
return /* @__PURE__ */
|
|
4705
|
+
return /* @__PURE__ */ jsx10(
|
|
4557
4706
|
"form",
|
|
4558
4707
|
{
|
|
4559
4708
|
...props,
|
|
@@ -4598,26 +4747,28 @@ function trapFocus(event, root) {
|
|
|
4598
4747
|
}
|
|
4599
4748
|
|
|
4600
4749
|
// src/features/actions/KeepSavePopover.tsx
|
|
4601
|
-
import { jsx as
|
|
4750
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
4602
4751
|
function KeepSavePopover({
|
|
4603
4752
|
item,
|
|
4604
4753
|
open: controlledOpen,
|
|
4605
4754
|
defaultOpen = false,
|
|
4606
4755
|
onOpenChange,
|
|
4607
4756
|
dialogLabel,
|
|
4757
|
+
portalContainer,
|
|
4608
4758
|
buttonProps,
|
|
4609
4759
|
editorProps,
|
|
4610
4760
|
children,
|
|
4611
4761
|
...props
|
|
4612
4762
|
}) {
|
|
4613
4763
|
const state = useKeepItem4(item);
|
|
4614
|
-
const [internalOpen, setInternalOpen] =
|
|
4764
|
+
const [internalOpen, setInternalOpen] = useState5(defaultOpen);
|
|
4615
4765
|
const isOpen = controlledOpen ?? internalOpen;
|
|
4616
|
-
const triggerRef =
|
|
4617
|
-
const wasOpenRef =
|
|
4618
|
-
const previousSaved =
|
|
4619
|
-
const
|
|
4620
|
-
const
|
|
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();
|
|
4621
4772
|
const titleId = `${panelId}-title`;
|
|
4622
4773
|
const editSavedItemLabel = useUiLabel("editSavedItem");
|
|
4623
4774
|
const { ref: _buttonRef, ...resolvedButtonProps } = buttonProps ?? {};
|
|
@@ -4628,30 +4779,41 @@ function KeepSavePopover({
|
|
|
4628
4779
|
},
|
|
4629
4780
|
[controlledOpen, onOpenChange]
|
|
4630
4781
|
);
|
|
4631
|
-
|
|
4782
|
+
useEffect8(() => {
|
|
4632
4783
|
if (wasOpenRef.current && !isOpen) window.setTimeout(() => triggerRef.current?.focus(), 0);
|
|
4633
4784
|
wasOpenRef.current = isOpen;
|
|
4634
4785
|
}, [isOpen]);
|
|
4635
|
-
|
|
4786
|
+
useEffect8(() => {
|
|
4636
4787
|
if (!observedHydration.current) {
|
|
4637
4788
|
if (state.isLoading) return;
|
|
4638
4789
|
observedHydration.current = true;
|
|
4639
4790
|
previousSaved.current = state.isSaved;
|
|
4640
4791
|
return;
|
|
4641
4792
|
}
|
|
4642
|
-
if (!previousSaved.current && state.isSaved)
|
|
4793
|
+
if (!previousSaved.current && state.isSaved && initiatedSave.current) {
|
|
4794
|
+
initiatedSave.current = false;
|
|
4795
|
+
setOpen(true);
|
|
4796
|
+
}
|
|
4643
4797
|
previousSaved.current = state.isSaved;
|
|
4644
4798
|
}, [setOpen, state.isLoading, state.isSaved]);
|
|
4645
|
-
|
|
4799
|
+
useEffect8(() => {
|
|
4646
4800
|
if (isOpen && observedHydration.current && !state.isSaved) setOpen(false);
|
|
4647
4801
|
}, [isOpen, setOpen, state.isSaved]);
|
|
4648
4802
|
const currentItem = state.item;
|
|
4649
|
-
return /* @__PURE__ */
|
|
4650
|
-
/* @__PURE__ */
|
|
4803
|
+
return /* @__PURE__ */ jsxs8("div", { ...props, "data-keepkit": "save-popover", "data-open": isOpen ? "true" : "false", children: [
|
|
4804
|
+
/* @__PURE__ */ jsx11(
|
|
4651
4805
|
KeepButton,
|
|
4652
4806
|
{
|
|
4653
4807
|
...resolvedButtonProps,
|
|
4654
4808
|
item,
|
|
4809
|
+
onClick: (event) => {
|
|
4810
|
+
resolvedButtonProps.onClick?.(event);
|
|
4811
|
+
if (!event.defaultPrevented && !state.isSaved) initiatedSave.current = true;
|
|
4812
|
+
},
|
|
4813
|
+
onToggleError: (error) => {
|
|
4814
|
+
initiatedSave.current = false;
|
|
4815
|
+
resolvedButtonProps.onToggleError?.(error);
|
|
4816
|
+
},
|
|
4655
4817
|
asChild: false,
|
|
4656
4818
|
ref: triggerRef,
|
|
4657
4819
|
"aria-haspopup": "dialog",
|
|
@@ -4659,7 +4821,7 @@ function KeepSavePopover({
|
|
|
4659
4821
|
"aria-controls": panelId
|
|
4660
4822
|
}
|
|
4661
4823
|
),
|
|
4662
|
-
isOpen && currentItem ? /* @__PURE__ */
|
|
4824
|
+
isOpen && currentItem ? /* @__PURE__ */ jsx11(
|
|
4663
4825
|
KeepSavePopoverPanel,
|
|
4664
4826
|
{
|
|
4665
4827
|
id: panelId,
|
|
@@ -4668,6 +4830,7 @@ function KeepSavePopover({
|
|
|
4668
4830
|
item: currentItem,
|
|
4669
4831
|
editorProps,
|
|
4670
4832
|
triggerRef,
|
|
4833
|
+
portalContainer,
|
|
4671
4834
|
onClose: () => setOpen(false),
|
|
4672
4835
|
children
|
|
4673
4836
|
}
|
|
@@ -4681,14 +4844,47 @@ function KeepSavePopoverPanel({
|
|
|
4681
4844
|
item,
|
|
4682
4845
|
editorProps,
|
|
4683
4846
|
triggerRef,
|
|
4847
|
+
portalContainer,
|
|
4684
4848
|
onClose,
|
|
4685
4849
|
children
|
|
4686
4850
|
}) {
|
|
4687
4851
|
const { debounceMs, onSaved, onSaveError, ...editorViewProps } = editorProps ?? {};
|
|
4688
4852
|
const { state } = useKeepQuickEditor(item, { debounceMs, onSaved, onSaveError });
|
|
4689
|
-
const panelRef =
|
|
4690
|
-
const closingRef =
|
|
4853
|
+
const panelRef = useRef9(null);
|
|
4854
|
+
const closingRef = useRef9(null);
|
|
4691
4855
|
const closeLabel = useUiLabel("close");
|
|
4856
|
+
const theme = useKeepTheme();
|
|
4857
|
+
const [position, setPosition] = useState5({ left: 8, top: 8, width: 320 });
|
|
4858
|
+
const [isMobile, setIsMobile] = useState5(false);
|
|
4859
|
+
useLayoutEffect(() => {
|
|
4860
|
+
const place = () => {
|
|
4861
|
+
const mobile = window.matchMedia?.("(max-width: 32rem)").matches ?? window.innerWidth <= 512;
|
|
4862
|
+
setIsMobile(mobile);
|
|
4863
|
+
const trigger = triggerRef.current?.getBoundingClientRect();
|
|
4864
|
+
const panel = panelRef.current;
|
|
4865
|
+
if (!trigger || !panel) return;
|
|
4866
|
+
const width = Math.min(Math.max(trigger.width, 320), window.innerWidth - 16);
|
|
4867
|
+
const left = Math.max(8, Math.min(trigger.left, window.innerWidth - width - 8));
|
|
4868
|
+
panel.style.width = mobile ? "100%" : `${width}px`;
|
|
4869
|
+
const height = panel.getBoundingClientRect().height;
|
|
4870
|
+
const below = trigger.bottom + 8;
|
|
4871
|
+
const top = Math.max(
|
|
4872
|
+
8,
|
|
4873
|
+
Math.min(
|
|
4874
|
+
below + height <= window.innerHeight - 8 ? below : trigger.top - height - 8,
|
|
4875
|
+
window.innerHeight - height - 8
|
|
4876
|
+
)
|
|
4877
|
+
);
|
|
4878
|
+
setPosition({ left, top, width });
|
|
4879
|
+
};
|
|
4880
|
+
place();
|
|
4881
|
+
window.addEventListener("resize", place);
|
|
4882
|
+
window.addEventListener("scroll", place, true);
|
|
4883
|
+
return () => {
|
|
4884
|
+
window.removeEventListener("resize", place);
|
|
4885
|
+
window.removeEventListener("scroll", place, true);
|
|
4886
|
+
};
|
|
4887
|
+
}, [triggerRef]);
|
|
4692
4888
|
const requestClose = useCallback3(() => {
|
|
4693
4889
|
if (closingRef.current) return closingRef.current;
|
|
4694
4890
|
const promise = state.flush().then(onClose).catch(() => {
|
|
@@ -4699,13 +4895,13 @@ function KeepSavePopoverPanel({
|
|
|
4699
4895
|
closingRef.current = promise;
|
|
4700
4896
|
return promise;
|
|
4701
4897
|
}, [onClose, state]);
|
|
4702
|
-
|
|
4898
|
+
useEffect8(() => {
|
|
4703
4899
|
const frame = window.requestAnimationFrame(() => {
|
|
4704
4900
|
panelRef.current?.querySelector('[data-keepkit="quick-editor"] :is(textarea, input, select, button)')?.focus();
|
|
4705
4901
|
});
|
|
4706
4902
|
return () => window.cancelAnimationFrame(frame);
|
|
4707
4903
|
}, []);
|
|
4708
|
-
|
|
4904
|
+
useEffect8(() => {
|
|
4709
4905
|
const closeFromOutside = (event) => {
|
|
4710
4906
|
const target = event.target;
|
|
4711
4907
|
if (!(target instanceof Node) || panelRef.current?.contains(target) || triggerRef.current?.contains(target))
|
|
@@ -4715,50 +4911,69 @@ function KeepSavePopoverPanel({
|
|
|
4715
4911
|
document.addEventListener("pointerdown", closeFromOutside);
|
|
4716
4912
|
return () => document.removeEventListener("pointerdown", closeFromOutside);
|
|
4717
4913
|
}, [requestClose, triggerRef]);
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
{
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4914
|
+
if (typeof document === "undefined") return null;
|
|
4915
|
+
return createPortal(
|
|
4916
|
+
/* @__PURE__ */ jsx11(KeepThemeProvider, { ...theme, children: /* @__PURE__ */ jsxs8(
|
|
4917
|
+
"div",
|
|
4918
|
+
{
|
|
4919
|
+
ref: panelRef,
|
|
4920
|
+
style: {
|
|
4921
|
+
position: "fixed",
|
|
4922
|
+
boxSizing: "border-box",
|
|
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)",
|
|
4929
|
+
overflowY: "auto"
|
|
4930
|
+
},
|
|
4931
|
+
id,
|
|
4932
|
+
role: "dialog",
|
|
4933
|
+
"aria-labelledby": titleId,
|
|
4934
|
+
"data-keep-popover-panel": "true",
|
|
4935
|
+
"data-save-status": state.saveStatus,
|
|
4936
|
+
onKeyDownCapture: (event) => {
|
|
4937
|
+
if (event.key !== "Escape") return;
|
|
4938
|
+
event.preventDefault();
|
|
4939
|
+
event.stopPropagation();
|
|
4940
|
+
void requestClose();
|
|
4941
|
+
},
|
|
4942
|
+
children: [
|
|
4943
|
+
/* @__PURE__ */ jsx11("h2", { id: titleId, "data-keep-popover-title": "true", children: dialogLabel }),
|
|
4944
|
+
children,
|
|
4945
|
+
/* @__PURE__ */ jsx11(KeepQuickEditorView, { ...editorViewProps, state, focusScopeRef: panelRef }),
|
|
4946
|
+
/* @__PURE__ */ jsx11(
|
|
4947
|
+
"button",
|
|
4948
|
+
{
|
|
4949
|
+
type: "button",
|
|
4950
|
+
onClick: () => void requestClose(),
|
|
4951
|
+
disabled: state.isSaving,
|
|
4952
|
+
"data-keep-action": "close-save-popover",
|
|
4953
|
+
children: closeLabel
|
|
4954
|
+
}
|
|
4955
|
+
)
|
|
4956
|
+
]
|
|
4957
|
+
}
|
|
4958
|
+
) }),
|
|
4959
|
+
portalContainer ?? triggerRef.current?.closest("dialog[open]") ?? document.body
|
|
4749
4960
|
);
|
|
4750
4961
|
}
|
|
4751
4962
|
|
|
4963
|
+
// src/features/actions/KeepUndo.tsx
|
|
4964
|
+
import { useRef as useRef10, useState as useState7 } from "react";
|
|
4965
|
+
|
|
4752
4966
|
// src/features/actions/hooks/useKeepUndo.ts
|
|
4753
|
-
import { useKeepContext as
|
|
4754
|
-
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";
|
|
4755
4969
|
function useKeepUndo() {
|
|
4756
|
-
const context =
|
|
4970
|
+
const context = useKeepContext3();
|
|
4971
|
+
const { store } = useKeepStore2();
|
|
4757
4972
|
const emitFeedback = useKeepUiFeedback();
|
|
4758
4973
|
const restoredMessage = useUiLabel("restoredMessage");
|
|
4759
4974
|
const { canUndo, startedAt, expiresAt } = context.undo;
|
|
4760
|
-
const [now, setNow] =
|
|
4761
|
-
|
|
4975
|
+
const [now, setNow] = useState6(() => Date.now());
|
|
4976
|
+
useEffect9(() => {
|
|
4762
4977
|
if (!canUndo || expiresAt === void 0) return;
|
|
4763
4978
|
setNow(Date.now());
|
|
4764
4979
|
const timer = setInterval(() => setNow(Date.now()), 250);
|
|
@@ -4775,9 +4990,12 @@ function useKeepUndo() {
|
|
|
4775
4990
|
remainingSeconds,
|
|
4776
4991
|
progress,
|
|
4777
4992
|
undo: async () => {
|
|
4778
|
-
const
|
|
4993
|
+
const before = store.getSnapshot().lastChange;
|
|
4994
|
+
const ids = context.undo.ids;
|
|
4779
4995
|
await context.undoLastRemoval();
|
|
4780
|
-
|
|
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))) {
|
|
4781
4999
|
emitFeedback({ type: "item-restored", item: items[0], items, message: restoredMessage });
|
|
4782
5000
|
}
|
|
4783
5001
|
},
|
|
@@ -4787,50 +5005,72 @@ function useKeepUndo() {
|
|
|
4787
5005
|
}
|
|
4788
5006
|
|
|
4789
5007
|
// src/features/actions/KeepUndo.tsx
|
|
4790
|
-
import { jsx as
|
|
5008
|
+
import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4791
5009
|
function KeepUndo({ children, label, ...props }) {
|
|
4792
5010
|
const view = useKeepUndo();
|
|
4793
5011
|
const showLabel = useUiLabelVisibility("undo");
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
}
|
|
4820
|
-
|
|
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
|
|
4821
5061
|
] });
|
|
4822
5062
|
}
|
|
4823
5063
|
|
|
4824
5064
|
// src/features/collection/KeepCollection.tsx
|
|
4825
5065
|
import { KeepErrorBoundary as KeepErrorBoundary2 } from "@keepkit/core/react";
|
|
4826
|
-
import { useEffect as
|
|
5066
|
+
import { useEffect as useEffect16, useId as useId5, useRef as useRef16, useState as useState21 } from "react";
|
|
4827
5067
|
|
|
4828
5068
|
// src/features/query/KeepActiveFiltersSummary.tsx
|
|
4829
5069
|
import {
|
|
4830
|
-
isValidElement as
|
|
4831
|
-
useRef as
|
|
5070
|
+
isValidElement as isValidElement3,
|
|
5071
|
+
useRef as useRef11
|
|
4832
5072
|
} from "react";
|
|
4833
|
-
import { Fragment as
|
|
5073
|
+
import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4834
5074
|
function KeepActiveFiltersSummary({
|
|
4835
5075
|
query,
|
|
4836
5076
|
search: providedSearch,
|
|
@@ -4899,7 +5139,7 @@ function KeepActiveFiltersSummary({
|
|
|
4899
5139
|
all: useUiLabel("archiveScopeAll")
|
|
4900
5140
|
};
|
|
4901
5141
|
const resolvedArchiveScopeLabel = providedArchiveScopeLabel ?? (archiveScope === void 0 ? void 0 : archiveLabels[archiveScope]);
|
|
4902
|
-
const chipRefs =
|
|
5142
|
+
const chipRefs = useRef11([]);
|
|
4903
5143
|
const collectionIndex = Number(Boolean(search)) + tags.length;
|
|
4904
5144
|
const organizationIndex = collectionIndex + Number(Boolean(collection));
|
|
4905
5145
|
const activityIndex = organizationIndex + organizationFilters.length;
|
|
@@ -4988,12 +5228,12 @@ function KeepActiveFiltersSummary({
|
|
|
4988
5228
|
reset: () => onReset?.()
|
|
4989
5229
|
};
|
|
4990
5230
|
const contentChildren = asChild && isElement(children) ? void 0 : children;
|
|
4991
|
-
const body = typeof contentChildren === "function" ? contentChildren(state) : contentChildren ?? (hasFilters || canReset ? /* @__PURE__ */
|
|
4992
|
-
showActiveFiltersLabel ? /* @__PURE__ */
|
|
4993
|
-
/* @__PURE__ */
|
|
4994
|
-
search ? /* @__PURE__ */
|
|
4995
|
-
/* @__PURE__ */
|
|
4996
|
-
/* @__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(
|
|
4997
5237
|
"button",
|
|
4998
5238
|
{
|
|
4999
5239
|
type: "button",
|
|
@@ -5008,9 +5248,9 @@ function KeepActiveFiltersSummary({
|
|
|
5008
5248
|
}
|
|
5009
5249
|
)
|
|
5010
5250
|
] }) : null,
|
|
5011
|
-
tags.map((tag, tagIndex) => /* @__PURE__ */
|
|
5012
|
-
/* @__PURE__ */
|
|
5013
|
-
/* @__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(
|
|
5014
5254
|
"button",
|
|
5015
5255
|
{
|
|
5016
5256
|
type: "button",
|
|
@@ -5025,9 +5265,9 @@ function KeepActiveFiltersSummary({
|
|
|
5025
5265
|
}
|
|
5026
5266
|
)
|
|
5027
5267
|
] }, tag)),
|
|
5028
|
-
collection && collectionLabel ? /* @__PURE__ */
|
|
5029
|
-
/* @__PURE__ */
|
|
5030
|
-
/* @__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(
|
|
5031
5271
|
"button",
|
|
5032
5272
|
{
|
|
5033
5273
|
type: "button",
|
|
@@ -5045,9 +5285,9 @@ function KeepActiveFiltersSummary({
|
|
|
5045
5285
|
organizationFilters.map(({ field, value }, filterIndex) => {
|
|
5046
5286
|
const index = organizationIndex + filterIndex;
|
|
5047
5287
|
const label = `${field}: ${value}`;
|
|
5048
|
-
return /* @__PURE__ */
|
|
5049
|
-
/* @__PURE__ */
|
|
5050
|
-
/* @__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(
|
|
5051
5291
|
"button",
|
|
5052
5292
|
{
|
|
5053
5293
|
type: "button",
|
|
@@ -5065,9 +5305,9 @@ function KeepActiveFiltersSummary({
|
|
|
5065
5305
|
}),
|
|
5066
5306
|
activityFilters.map((filter, filterIndex) => {
|
|
5067
5307
|
const index = activityIndex + filterIndex;
|
|
5068
|
-
return /* @__PURE__ */
|
|
5069
|
-
/* @__PURE__ */
|
|
5070
|
-
/* @__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(
|
|
5071
5311
|
"button",
|
|
5072
5312
|
{
|
|
5073
5313
|
type: "button",
|
|
@@ -5083,9 +5323,9 @@ function KeepActiveFiltersSummary({
|
|
|
5083
5323
|
)
|
|
5084
5324
|
] }, filter.key);
|
|
5085
5325
|
}),
|
|
5086
|
-
savedBetweenLabel ? /* @__PURE__ */
|
|
5087
|
-
/* @__PURE__ */
|
|
5088
|
-
/* @__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(
|
|
5089
5329
|
"button",
|
|
5090
5330
|
{
|
|
5091
5331
|
type: "button",
|
|
@@ -5100,9 +5340,9 @@ function KeepActiveFiltersSummary({
|
|
|
5100
5340
|
}
|
|
5101
5341
|
)
|
|
5102
5342
|
] }) : null,
|
|
5103
|
-
hasArchiveScope && resolvedArchiveScopeLabel ? /* @__PURE__ */
|
|
5104
|
-
/* @__PURE__ */
|
|
5105
|
-
/* @__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(
|
|
5106
5346
|
"button",
|
|
5107
5347
|
{
|
|
5108
5348
|
type: "button",
|
|
@@ -5118,13 +5358,13 @@ function KeepActiveFiltersSummary({
|
|
|
5118
5358
|
)
|
|
5119
5359
|
] }) : null
|
|
5120
5360
|
] }),
|
|
5121
|
-
totalCount !== void 0 ? /* @__PURE__ */
|
|
5361
|
+
totalCount !== void 0 ? /* @__PURE__ */ jsxs10("span", { "data-filter-count": "true", children: [
|
|
5122
5362
|
totalCount,
|
|
5123
5363
|
" ",
|
|
5124
5364
|
totalCount === 1 ? collectionItemLabel : collectionItemsLabel
|
|
5125
5365
|
] }) : null,
|
|
5126
|
-
hasFilters ? /* @__PURE__ */
|
|
5127
|
-
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
|
|
5128
5368
|
] }) : null);
|
|
5129
5369
|
if (!hasFilters && !canReset && !asChild && contentChildren === void 0) return null;
|
|
5130
5370
|
return renderRoot(
|
|
@@ -5180,7 +5420,7 @@ function isCjkLocale(locale) {
|
|
|
5180
5420
|
return /^(?:ja|ko|zh)/i.test(locale ?? "");
|
|
5181
5421
|
}
|
|
5182
5422
|
function isElement(value) {
|
|
5183
|
-
return
|
|
5423
|
+
return isValidElement3(value);
|
|
5184
5424
|
}
|
|
5185
5425
|
function focusFilterFallback(scope) {
|
|
5186
5426
|
const searchInput = scope?.querySelector('[data-keep-action="search"]');
|
|
@@ -5201,8 +5441,8 @@ function focusFilterFallback(scope) {
|
|
|
5201
5441
|
}
|
|
5202
5442
|
|
|
5203
5443
|
// src/features/query/KeepArchiveScopeSelect.tsx
|
|
5204
|
-
import { useState as
|
|
5205
|
-
import { jsx as
|
|
5444
|
+
import { useState as useState8 } from "react";
|
|
5445
|
+
import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5206
5446
|
function KeepArchiveScopeSelect({
|
|
5207
5447
|
value: controlledValue,
|
|
5208
5448
|
defaultValue = "active",
|
|
@@ -5210,7 +5450,7 @@ function KeepArchiveScopeSelect({
|
|
|
5210
5450
|
"aria-label": ariaLabel,
|
|
5211
5451
|
...props
|
|
5212
5452
|
}) {
|
|
5213
|
-
const [internalValue, setInternalValue] =
|
|
5453
|
+
const [internalValue, setInternalValue] = useState8(controlledValue ?? defaultValue);
|
|
5214
5454
|
const value = controlledValue ?? internalValue;
|
|
5215
5455
|
const label = useUiLabel("archiveScope");
|
|
5216
5456
|
const activeLabel = useUiLabel("archiveScopeActive");
|
|
@@ -5221,9 +5461,9 @@ function KeepArchiveScopeSelect({
|
|
|
5221
5461
|
if (controlledValue === void 0) setInternalValue(next);
|
|
5222
5462
|
onValueChange?.(next);
|
|
5223
5463
|
};
|
|
5224
|
-
return /* @__PURE__ */
|
|
5225
|
-
/* @__PURE__ */
|
|
5226
|
-
/* @__PURE__ */
|
|
5464
|
+
return /* @__PURE__ */ jsxs11("label", { "data-keepkit": "archive-scope", children: [
|
|
5465
|
+
/* @__PURE__ */ jsx14("span", { children: label }),
|
|
5466
|
+
/* @__PURE__ */ jsxs11(
|
|
5227
5467
|
"select",
|
|
5228
5468
|
{
|
|
5229
5469
|
...props,
|
|
@@ -5232,9 +5472,9 @@ function KeepArchiveScopeSelect({
|
|
|
5232
5472
|
"data-keep-action": "archive-scope",
|
|
5233
5473
|
onChange: (event) => handleChange(event.currentTarget.value),
|
|
5234
5474
|
children: [
|
|
5235
|
-
/* @__PURE__ */
|
|
5236
|
-
/* @__PURE__ */
|
|
5237
|
-
/* @__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 })
|
|
5238
5478
|
]
|
|
5239
5479
|
}
|
|
5240
5480
|
)
|
|
@@ -5242,9 +5482,9 @@ function KeepArchiveScopeSelect({
|
|
|
5242
5482
|
}
|
|
5243
5483
|
|
|
5244
5484
|
// src/features/query/KeepCollectionFilter.tsx
|
|
5245
|
-
import { useKeepCollections as useKeepCollections4, useKeepContext as
|
|
5246
|
-
import { useState as
|
|
5247
|
-
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";
|
|
5248
5488
|
function useCollectionOptions(collectionLabels, collections) {
|
|
5249
5489
|
return collections.map((collection) => ({
|
|
5250
5490
|
id: collection.id,
|
|
@@ -5261,8 +5501,8 @@ function KeepCollectionSelect({
|
|
|
5261
5501
|
uncategorizedLabel,
|
|
5262
5502
|
...props
|
|
5263
5503
|
}) {
|
|
5264
|
-
const context =
|
|
5265
|
-
const state =
|
|
5504
|
+
const context = useKeepContext4();
|
|
5505
|
+
const state = useState9(value ?? defaultValue ?? item.collectionId ?? "");
|
|
5266
5506
|
const selected = value ?? state[0];
|
|
5267
5507
|
const collections = useKeepCollections4({ targetType: item.targetType, orderBy: "name" });
|
|
5268
5508
|
const options = useCollectionOptions(collectionLabels, collections);
|
|
@@ -5275,7 +5515,7 @@ function KeepCollectionSelect({
|
|
|
5275
5515
|
onChange?.(resolved);
|
|
5276
5516
|
void context.moveToCollection(item.id, resolved);
|
|
5277
5517
|
};
|
|
5278
|
-
return /* @__PURE__ */
|
|
5518
|
+
return /* @__PURE__ */ jsxs12(
|
|
5279
5519
|
"select",
|
|
5280
5520
|
{
|
|
5281
5521
|
...props,
|
|
@@ -5283,8 +5523,8 @@ function KeepCollectionSelect({
|
|
|
5283
5523
|
onChange: (event) => handleChange(event.currentTarget.value),
|
|
5284
5524
|
"data-keep-action": "move-collection",
|
|
5285
5525
|
children: [
|
|
5286
|
-
/* @__PURE__ */
|
|
5287
|
-
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))
|
|
5288
5528
|
]
|
|
5289
5529
|
}
|
|
5290
5530
|
);
|
|
@@ -5299,7 +5539,7 @@ function KeepCollectionFilter({
|
|
|
5299
5539
|
uncategorizedLabel,
|
|
5300
5540
|
...props
|
|
5301
5541
|
}) {
|
|
5302
|
-
const [internalValue, setInternalValue] =
|
|
5542
|
+
const [internalValue, setInternalValue] = useState9(value ?? defaultValue ?? "");
|
|
5303
5543
|
const selected = value ?? internalValue;
|
|
5304
5544
|
const collections = useKeepCollections4({ orderBy: "name" });
|
|
5305
5545
|
const options = useCollectionOptions(collectionLabels, collections);
|
|
@@ -5315,9 +5555,9 @@ function KeepCollectionFilter({
|
|
|
5315
5555
|
onValueChange?.(resolved);
|
|
5316
5556
|
onChange?.(resolved);
|
|
5317
5557
|
};
|
|
5318
|
-
return /* @__PURE__ */
|
|
5319
|
-
showCollectionLabel ? /* @__PURE__ */
|
|
5320
|
-
/* @__PURE__ */
|
|
5558
|
+
return /* @__PURE__ */ jsxs12("label", { "data-keepkit": "collection-filter", children: [
|
|
5559
|
+
showCollectionLabel ? /* @__PURE__ */ jsx15("span", { children: collectionLabel }) : null,
|
|
5560
|
+
/* @__PURE__ */ jsxs12(
|
|
5321
5561
|
"select",
|
|
5322
5562
|
{
|
|
5323
5563
|
...props,
|
|
@@ -5326,9 +5566,9 @@ function KeepCollectionFilter({
|
|
|
5326
5566
|
onChange: (event) => handleChange(event.currentTarget.value),
|
|
5327
5567
|
"data-keep-action": "filter-collection",
|
|
5328
5568
|
children: [
|
|
5329
|
-
/* @__PURE__ */
|
|
5330
|
-
/* @__PURE__ */
|
|
5331
|
-
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))
|
|
5332
5572
|
]
|
|
5333
5573
|
}
|
|
5334
5574
|
)
|
|
@@ -5336,11 +5576,11 @@ function KeepCollectionFilter({
|
|
|
5336
5576
|
}
|
|
5337
5577
|
|
|
5338
5578
|
// src/features/query/KeepTagFilter.tsx
|
|
5339
|
-
import { isValidElement as
|
|
5579
|
+
import { isValidElement as isValidElement4 } from "react";
|
|
5340
5580
|
|
|
5341
5581
|
// src/features/query/hooks/useKeepTagFilter.ts
|
|
5342
5582
|
import { useKeepList as useKeepList2 } from "@keepkit/core/react";
|
|
5343
|
-
import { useCallback as useCallback4, useMemo as useMemo3, useState as
|
|
5583
|
+
import { useCallback as useCallback4, useMemo as useMemo3, useState as useState10 } from "react";
|
|
5344
5584
|
function useKeepTagFilter(options) {
|
|
5345
5585
|
const {
|
|
5346
5586
|
query,
|
|
@@ -5352,7 +5592,7 @@ function useKeepTagFilter(options) {
|
|
|
5352
5592
|
onValueChange,
|
|
5353
5593
|
onValuesChange
|
|
5354
5594
|
} = options;
|
|
5355
|
-
const [uncontrolledValues, setUncontrolledValues] =
|
|
5595
|
+
const [uncontrolledValues, setUncontrolledValues] = useState10(
|
|
5356
5596
|
() => defaultValues ? normalizeUiTags(defaultValues) : defaultValue ? [defaultValue] : []
|
|
5357
5597
|
);
|
|
5358
5598
|
const resolvedValues = useMemo3(
|
|
@@ -5408,7 +5648,7 @@ function useKeepTagFilter(options) {
|
|
|
5408
5648
|
}
|
|
5409
5649
|
|
|
5410
5650
|
// src/features/query/KeepTagFilter.tsx
|
|
5411
|
-
import { jsx as
|
|
5651
|
+
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5412
5652
|
function KeepTagFilter({
|
|
5413
5653
|
query,
|
|
5414
5654
|
value: controlledValue,
|
|
@@ -5440,10 +5680,10 @@ function KeepTagFilter({
|
|
|
5440
5680
|
const showFilterLabel = useUiLabelVisibility("filterTags");
|
|
5441
5681
|
const showAllTagsLabel = useUiLabelVisibility("allTags");
|
|
5442
5682
|
const isMulti = controlledValues !== void 0 || defaultValues !== void 0 || onValuesChange !== void 0;
|
|
5443
|
-
const contentChildren = asChild &&
|
|
5444
|
-
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */
|
|
5445
|
-
showFilterLabel ? /* @__PURE__ */
|
|
5446
|
-
/* @__PURE__ */
|
|
5683
|
+
const contentChildren = asChild && isValidElement4(children) ? void 0 : children;
|
|
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(
|
|
5447
5687
|
"button",
|
|
5448
5688
|
{
|
|
5449
5689
|
type: "button",
|
|
@@ -5456,7 +5696,7 @@ function KeepTagFilter({
|
|
|
5456
5696
|
),
|
|
5457
5697
|
view.state.tags.map((tag) => {
|
|
5458
5698
|
const selected = view.state.values.includes(tag);
|
|
5459
|
-
return /* @__PURE__ */
|
|
5699
|
+
return /* @__PURE__ */ jsxs13(
|
|
5460
5700
|
"button",
|
|
5461
5701
|
{
|
|
5462
5702
|
type: "button",
|
|
@@ -5465,7 +5705,7 @@ function KeepTagFilter({
|
|
|
5465
5705
|
onClick: () => isMulti ? view.state.toggle(tag) : view.state.select(tag),
|
|
5466
5706
|
children: [
|
|
5467
5707
|
renderTag ? renderTag(tag, view.state.tagCounts[tag] ?? 0, selected) : tag,
|
|
5468
|
-
/* @__PURE__ */
|
|
5708
|
+
/* @__PURE__ */ jsxs13("span", { children: [
|
|
5469
5709
|
" (",
|
|
5470
5710
|
view.state.tagCounts[tag] ?? 0,
|
|
5471
5711
|
")"
|
|
@@ -5478,7 +5718,7 @@ function KeepTagFilter({
|
|
|
5478
5718
|
] });
|
|
5479
5719
|
return renderRoot(
|
|
5480
5720
|
asChild,
|
|
5481
|
-
|
|
5721
|
+
isValidElement4(children) ? children : void 0,
|
|
5482
5722
|
{
|
|
5483
5723
|
...rootProps,
|
|
5484
5724
|
className,
|
|
@@ -5492,14 +5732,14 @@ function KeepTagFilter({
|
|
|
5492
5732
|
}
|
|
5493
5733
|
|
|
5494
5734
|
// src/features/query/hooks/useQueryControls.ts
|
|
5495
|
-
import { useEffect as
|
|
5735
|
+
import { useEffect as useEffect10, useState as useState11 } from "react";
|
|
5496
5736
|
function useKeepSearchInput(options) {
|
|
5497
5737
|
const { controlledValue, defaultValue, debounceMs, onValueChange } = options;
|
|
5498
|
-
const [value, setValue] =
|
|
5499
|
-
|
|
5738
|
+
const [value, setValue] = useState11(controlledValue ?? defaultValue);
|
|
5739
|
+
useEffect10(() => {
|
|
5500
5740
|
if (controlledValue !== void 0) setValue(controlledValue);
|
|
5501
5741
|
}, [controlledValue]);
|
|
5502
|
-
|
|
5742
|
+
useEffect10(() => {
|
|
5503
5743
|
if (!onValueChange) return;
|
|
5504
5744
|
if (debounceMs <= 0) {
|
|
5505
5745
|
onValueChange(value);
|
|
@@ -5518,7 +5758,7 @@ function useKeepSearchInput(options) {
|
|
|
5518
5758
|
}
|
|
5519
5759
|
function useKeepSortSelect(options) {
|
|
5520
5760
|
const { controlledValue, defaultValue, onValueChange, onManualSort } = options;
|
|
5521
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
5761
|
+
const [uncontrolledValue, setUncontrolledValue] = useState11(defaultValue);
|
|
5522
5762
|
const value = controlledValue ?? uncontrolledValue;
|
|
5523
5763
|
return {
|
|
5524
5764
|
value,
|
|
@@ -5571,7 +5811,7 @@ function getVisiblePages(currentPage, pageCount, maxPageButtons) {
|
|
|
5571
5811
|
}
|
|
5572
5812
|
|
|
5573
5813
|
// src/features/query/query-controls.tsx
|
|
5574
|
-
import { Fragment as
|
|
5814
|
+
import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5575
5815
|
function KeepSearchInput({
|
|
5576
5816
|
value: controlledValue,
|
|
5577
5817
|
defaultValue = "",
|
|
@@ -5582,7 +5822,7 @@ function KeepSearchInput({
|
|
|
5582
5822
|
...props
|
|
5583
5823
|
}) {
|
|
5584
5824
|
const view = useKeepSearchInput({ controlledValue, defaultValue, debounceMs, onValueChange });
|
|
5585
|
-
return /* @__PURE__ */
|
|
5825
|
+
return /* @__PURE__ */ jsx17(
|
|
5586
5826
|
"input",
|
|
5587
5827
|
{
|
|
5588
5828
|
...props,
|
|
@@ -5608,14 +5848,14 @@ function KeepSortSelect({
|
|
|
5608
5848
|
...props
|
|
5609
5849
|
}) {
|
|
5610
5850
|
const view = useKeepSortSelect({ controlledValue, defaultValue, onValueChange, onManualSort });
|
|
5611
|
-
const options = children ?? /* @__PURE__ */
|
|
5612
|
-
onManualSort || view.value === "manual" ? /* @__PURE__ */
|
|
5613
|
-
/* @__PURE__ */
|
|
5614
|
-
/* @__PURE__ */
|
|
5615
|
-
/* @__PURE__ */
|
|
5616
|
-
/* @__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 })
|
|
5617
5857
|
] });
|
|
5618
|
-
return /* @__PURE__ */
|
|
5858
|
+
return /* @__PURE__ */ jsx17(
|
|
5619
5859
|
"select",
|
|
5620
5860
|
{
|
|
5621
5861
|
...props,
|
|
@@ -5649,9 +5889,9 @@ function KeepPagination({
|
|
|
5649
5889
|
"data-state": view.pageCount > 1 ? "active" : "idle"
|
|
5650
5890
|
};
|
|
5651
5891
|
if (render)
|
|
5652
|
-
return /* @__PURE__ */
|
|
5653
|
-
return /* @__PURE__ */
|
|
5654
|
-
/* @__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(
|
|
5655
5895
|
"button",
|
|
5656
5896
|
{
|
|
5657
5897
|
type: "button",
|
|
@@ -5662,7 +5902,7 @@ function KeepPagination({
|
|
|
5662
5902
|
children: showPreviousLabel ? view.labels.previous : null
|
|
5663
5903
|
}
|
|
5664
5904
|
),
|
|
5665
|
-
view.visiblePages.map((nextPage) => /* @__PURE__ */
|
|
5905
|
+
view.visiblePages.map((nextPage) => /* @__PURE__ */ jsx17(
|
|
5666
5906
|
"button",
|
|
5667
5907
|
{
|
|
5668
5908
|
type: "button",
|
|
@@ -5674,7 +5914,7 @@ function KeepPagination({
|
|
|
5674
5914
|
},
|
|
5675
5915
|
nextPage
|
|
5676
5916
|
)),
|
|
5677
|
-
/* @__PURE__ */
|
|
5917
|
+
/* @__PURE__ */ jsx17(
|
|
5678
5918
|
"button",
|
|
5679
5919
|
{
|
|
5680
5920
|
type: "button",
|
|
@@ -5689,16 +5929,16 @@ function KeepPagination({
|
|
|
5689
5929
|
}
|
|
5690
5930
|
|
|
5691
5931
|
// src/features/saved-views/KeepSavedViews.tsx
|
|
5692
|
-
import { useState as
|
|
5932
|
+
import { useState as useState13 } from "react";
|
|
5693
5933
|
|
|
5694
5934
|
// src/features/saved-views/useKeepSavedViews.ts
|
|
5695
5935
|
import { LocalStorageKeepSavedViewStorage } from "@keepkit/core/core";
|
|
5696
|
-
import { useCallback as useCallback5, useEffect as
|
|
5936
|
+
import { useCallback as useCallback5, useEffect as useEffect11, useMemo as useMemo4, useState as useState12 } from "react";
|
|
5697
5937
|
var changeEvent = "keepkit:saved-views:change";
|
|
5698
5938
|
function useKeepSavedViews(storage) {
|
|
5699
5939
|
const resolvedStorage = useMemo4(() => storage ?? new LocalStorageKeepSavedViewStorage(), [storage]);
|
|
5700
|
-
const [views, setViews] =
|
|
5701
|
-
const [error, setError] =
|
|
5940
|
+
const [views, setViews] = useState12([]);
|
|
5941
|
+
const [error, setError] = useState12();
|
|
5702
5942
|
const nameRequiredLabel = useUiLabel("savedViewNameRequired");
|
|
5703
5943
|
const notSerializableLabel = useUiLabel("savedViewNotSerializable");
|
|
5704
5944
|
const invalidDatesLabel = useUiLabel("savedViewInvalidDates");
|
|
@@ -5710,7 +5950,7 @@ function useKeepSavedViews(storage) {
|
|
|
5710
5950
|
setError(cause);
|
|
5711
5951
|
}
|
|
5712
5952
|
}, [resolvedStorage]);
|
|
5713
|
-
|
|
5953
|
+
useEffect11(() => {
|
|
5714
5954
|
void refresh();
|
|
5715
5955
|
if (typeof window === "undefined") return;
|
|
5716
5956
|
window.addEventListener(changeEvent, refresh);
|
|
@@ -5815,7 +6055,7 @@ function notifyChange() {
|
|
|
5815
6055
|
}
|
|
5816
6056
|
|
|
5817
6057
|
// src/features/saved-views/KeepSavedViews.tsx
|
|
5818
|
-
import { jsx as
|
|
6058
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5819
6059
|
function KeepSavedViews({ storage, onApply }) {
|
|
5820
6060
|
const { views, error, updateView, removeView, applyView } = useKeepSavedViews(storage);
|
|
5821
6061
|
const savedViewsLabel = useUiLabel("savedViews");
|
|
@@ -5824,9 +6064,9 @@ function KeepSavedViews({ storage, onApply }) {
|
|
|
5824
6064
|
const renameLabel = useUiLabel("renameSavedView");
|
|
5825
6065
|
const deleteLabel = useUiLabel("deleteSavedView");
|
|
5826
6066
|
const loadErrorLabel = useUiLabel("savedViewsLoadError");
|
|
5827
|
-
return /* @__PURE__ */
|
|
5828
|
-
/* @__PURE__ */
|
|
5829
|
-
/* @__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(
|
|
5830
6070
|
"button",
|
|
5831
6071
|
{
|
|
5832
6072
|
type: "button",
|
|
@@ -5834,7 +6074,7 @@ function KeepSavedViews({ storage, onApply }) {
|
|
|
5834
6074
|
children: view.name
|
|
5835
6075
|
}
|
|
5836
6076
|
),
|
|
5837
|
-
/* @__PURE__ */
|
|
6077
|
+
/* @__PURE__ */ jsx18(
|
|
5838
6078
|
"button",
|
|
5839
6079
|
{
|
|
5840
6080
|
type: "button",
|
|
@@ -5843,11 +6083,11 @@ function KeepSavedViews({ storage, onApply }) {
|
|
|
5843
6083
|
children: view.pinned ? unpinLabel : pinLabel
|
|
5844
6084
|
}
|
|
5845
6085
|
),
|
|
5846
|
-
/* @__PURE__ */
|
|
5847
|
-
/* @__PURE__ */
|
|
5848
|
-
/* @__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 }) })
|
|
5849
6089
|
] }),
|
|
5850
|
-
/* @__PURE__ */
|
|
6090
|
+
/* @__PURE__ */ jsx18(
|
|
5851
6091
|
"button",
|
|
5852
6092
|
{
|
|
5853
6093
|
type: "button",
|
|
@@ -5857,7 +6097,7 @@ function KeepSavedViews({ storage, onApply }) {
|
|
|
5857
6097
|
}
|
|
5858
6098
|
)
|
|
5859
6099
|
] }, view.id)) }),
|
|
5860
|
-
error ? /* @__PURE__ */
|
|
6100
|
+
error ? /* @__PURE__ */ jsx18("p", { role: "alert", children: error instanceof Error ? error.message : loadErrorLabel }) : null
|
|
5861
6101
|
] });
|
|
5862
6102
|
}
|
|
5863
6103
|
function KeepSaveViewButton({
|
|
@@ -5868,9 +6108,9 @@ function KeepSaveViewButton({
|
|
|
5868
6108
|
const nameLabel = useUiLabel("savedViewName");
|
|
5869
6109
|
const saveLabel = useUiLabel("saveView");
|
|
5870
6110
|
const saveErrorLabel = useUiLabel("savedViewSaveError");
|
|
5871
|
-
const [name, setName] =
|
|
5872
|
-
const [error, setError] =
|
|
5873
|
-
return /* @__PURE__ */
|
|
6111
|
+
const [name, setName] = useState13("");
|
|
6112
|
+
const [error, setError] = useState13("");
|
|
6113
|
+
return /* @__PURE__ */ jsxs15(
|
|
5874
6114
|
"form",
|
|
5875
6115
|
{
|
|
5876
6116
|
"data-keepkit": "save-view",
|
|
@@ -5882,21 +6122,21 @@ function KeepSaveViewButton({
|
|
|
5882
6122
|
}).catch((cause) => setError(cause instanceof Error ? cause.message : saveErrorLabel));
|
|
5883
6123
|
},
|
|
5884
6124
|
children: [
|
|
5885
|
-
/* @__PURE__ */
|
|
6125
|
+
/* @__PURE__ */ jsxs15("label", { children: [
|
|
5886
6126
|
nameLabel,
|
|
5887
|
-
/* @__PURE__ */
|
|
6127
|
+
/* @__PURE__ */ jsx18("input", { value: name, onChange: (event) => setName(event.currentTarget.value), required: true })
|
|
5888
6128
|
] }),
|
|
5889
|
-
/* @__PURE__ */
|
|
5890
|
-
error ? /* @__PURE__ */
|
|
6129
|
+
/* @__PURE__ */ jsx18("button", { type: "submit", disabled: !name.trim(), children: saveLabel }),
|
|
6130
|
+
error ? /* @__PURE__ */ jsx18("p", { role: "alert", children: error }) : null
|
|
5891
6131
|
]
|
|
5892
6132
|
}
|
|
5893
6133
|
);
|
|
5894
6134
|
}
|
|
5895
6135
|
function RenameForm({ name, onRename }) {
|
|
5896
|
-
const [value, setValue] =
|
|
6136
|
+
const [value, setValue] = useState13(name);
|
|
5897
6137
|
const nameLabel = useUiLabel("savedViewNewName");
|
|
5898
6138
|
const renameLabel = useUiLabel("renameSavedView");
|
|
5899
|
-
return /* @__PURE__ */
|
|
6139
|
+
return /* @__PURE__ */ jsxs15(
|
|
5900
6140
|
"form",
|
|
5901
6141
|
{
|
|
5902
6142
|
onSubmit: (event) => {
|
|
@@ -5904,11 +6144,11 @@ function RenameForm({ name, onRename }) {
|
|
|
5904
6144
|
void onRename(value).catch(() => void 0);
|
|
5905
6145
|
},
|
|
5906
6146
|
children: [
|
|
5907
|
-
/* @__PURE__ */
|
|
6147
|
+
/* @__PURE__ */ jsxs15("label", { children: [
|
|
5908
6148
|
nameLabel,
|
|
5909
|
-
/* @__PURE__ */
|
|
6149
|
+
/* @__PURE__ */ jsx18("input", { value, onChange: (event) => setValue(event.currentTarget.value), required: true })
|
|
5910
6150
|
] }),
|
|
5911
|
-
/* @__PURE__ */
|
|
6151
|
+
/* @__PURE__ */ jsx18("button", { type: "submit", children: renameLabel })
|
|
5912
6152
|
]
|
|
5913
6153
|
}
|
|
5914
6154
|
);
|
|
@@ -5936,7 +6176,7 @@ function reorderVisibleItems(source, orderedIds) {
|
|
|
5936
6176
|
// src/features/collection/hooks/useKeepCollection.ts
|
|
5937
6177
|
import { queryKeepItems } from "@keepkit/core/core";
|
|
5938
6178
|
import { useKeepList as useKeepList3 } from "@keepkit/core/react";
|
|
5939
|
-
import { useCallback as useCallback6, useEffect as
|
|
6179
|
+
import { useCallback as useCallback6, useEffect as useEffect12, useMemo as useMemo5, useState as useState14 } from "react";
|
|
5940
6180
|
var DEFAULT_SORT = { by: "updatedAt", direction: "desc" };
|
|
5941
6181
|
var UNCATEGORIZED = "__uncategorized__";
|
|
5942
6182
|
function useKeepCollection({
|
|
@@ -5962,18 +6202,18 @@ function useKeepCollection({
|
|
|
5962
6202
|
savedViews: false,
|
|
5963
6203
|
...features
|
|
5964
6204
|
};
|
|
5965
|
-
const [searchValue, setSearchValue] =
|
|
5966
|
-
const [queryOverride, setQueryOverride] =
|
|
6205
|
+
const [searchValue, setSearchValue] = useState14(query.search?.query ?? "");
|
|
6206
|
+
const [queryOverride, setQueryOverride] = useState14({});
|
|
5967
6207
|
const defaultSort = reorderable || !enabled.sort ? void 0 : DEFAULT_SORT;
|
|
5968
|
-
const [sort, setSort] =
|
|
5969
|
-
const [activeTags, setActiveTags] =
|
|
5970
|
-
const [activeCollection, setActiveCollection] =
|
|
5971
|
-
const [activeActivity, setActiveActivity] =
|
|
5972
|
-
const [activeOrganization, setActiveOrganization] =
|
|
5973
|
-
const [activeSavedBetween, setActiveSavedBetween] =
|
|
5974
|
-
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);
|
|
5975
6215
|
const initialArchiveScope = archiveScope ?? query.archiveScope ?? scopeFromArchived(query.archived);
|
|
5976
|
-
const [activeArchiveScope, setActiveArchiveScope] =
|
|
6216
|
+
const [activeArchiveScope, setActiveArchiveScope] = useState14(initialArchiveScope);
|
|
5977
6217
|
const applyQuery = useCallback6(
|
|
5978
6218
|
(next) => {
|
|
5979
6219
|
setQueryOverride(next);
|
|
@@ -5989,7 +6229,7 @@ function useKeepCollection({
|
|
|
5989
6229
|
},
|
|
5990
6230
|
[defaultSort]
|
|
5991
6231
|
);
|
|
5992
|
-
|
|
6232
|
+
useEffect12(() => {
|
|
5993
6233
|
if (archiveScope !== void 0) setActiveArchiveScope(archiveScope);
|
|
5994
6234
|
}, [archiveScope]);
|
|
5995
6235
|
const defaultPageSize = Number.isFinite(pageSize) ? Math.max(1, Math.floor(pageSize)) : 20;
|
|
@@ -6143,7 +6383,7 @@ function useKeepCollection({
|
|
|
6143
6383
|
setActiveTags((current) => current.filter((tag) => tag !== tagToRemove));
|
|
6144
6384
|
setPage(1);
|
|
6145
6385
|
},
|
|
6146
|
-
clearFilters: () => {
|
|
6386
|
+
clearFilters: (preserveArchiveScope = false) => {
|
|
6147
6387
|
setQueryOverride({});
|
|
6148
6388
|
setSearchValue("");
|
|
6149
6389
|
setActiveTags([]);
|
|
@@ -6151,7 +6391,7 @@ function useKeepCollection({
|
|
|
6151
6391
|
setActiveActivity(void 0);
|
|
6152
6392
|
setActiveOrganization(void 0);
|
|
6153
6393
|
setActiveSavedBetween(void 0);
|
|
6154
|
-
setActiveArchiveScope("active");
|
|
6394
|
+
if (!preserveArchiveScope) setActiveArchiveScope("active");
|
|
6155
6395
|
setPage(1);
|
|
6156
6396
|
},
|
|
6157
6397
|
resetFilters: () => applyQuery({ ...query, archiveScope: initialArchiveScope }),
|
|
@@ -6173,9 +6413,9 @@ function scopeFromArchived(archived) {
|
|
|
6173
6413
|
}
|
|
6174
6414
|
|
|
6175
6415
|
// src/features/collection/KeepCollectionCreate.tsx
|
|
6176
|
-
import { useKeepCollections as useKeepCollections5, useKeepContext as
|
|
6177
|
-
import { useId as
|
|
6178
|
-
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";
|
|
6179
6419
|
function KeepCollectionCreate({
|
|
6180
6420
|
onCreated,
|
|
6181
6421
|
onError,
|
|
@@ -6185,12 +6425,12 @@ function KeepCollectionCreate({
|
|
|
6185
6425
|
id: externalId,
|
|
6186
6426
|
...inputProps
|
|
6187
6427
|
}) {
|
|
6188
|
-
const { createCollection } =
|
|
6428
|
+
const { createCollection } = useKeepContext5();
|
|
6189
6429
|
const collections = useKeepCollections5();
|
|
6190
|
-
const [name, setName] =
|
|
6191
|
-
const [error, setError] =
|
|
6192
|
-
const [isSubmitting, setIsSubmitting] =
|
|
6193
|
-
const autoId =
|
|
6430
|
+
const [name, setName] = useState15("");
|
|
6431
|
+
const [error, setError] = useState15(null);
|
|
6432
|
+
const [isSubmitting, setIsSubmitting] = useState15(false);
|
|
6433
|
+
const autoId = useId3();
|
|
6194
6434
|
const inputId = externalId ?? autoId;
|
|
6195
6435
|
const resolvedLabel = useUiLabel("createCollection");
|
|
6196
6436
|
const showLabel = useUiLabelVisibility("createCollection");
|
|
@@ -6224,16 +6464,16 @@ function KeepCollectionCreate({
|
|
|
6224
6464
|
setIsSubmitting(false);
|
|
6225
6465
|
}
|
|
6226
6466
|
};
|
|
6227
|
-
return /* @__PURE__ */
|
|
6467
|
+
return /* @__PURE__ */ jsxs16(
|
|
6228
6468
|
"form",
|
|
6229
6469
|
{
|
|
6230
6470
|
"data-keepkit": "collection-create",
|
|
6231
6471
|
"data-state": error ? "error" : isSubmitting ? "submitting" : "idle",
|
|
6232
6472
|
onSubmit: handleSubmit,
|
|
6233
6473
|
children: [
|
|
6234
|
-
showLabel ? /* @__PURE__ */
|
|
6235
|
-
/* @__PURE__ */
|
|
6236
|
-
/* @__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(
|
|
6237
6477
|
"input",
|
|
6238
6478
|
{
|
|
6239
6479
|
...inputProps,
|
|
@@ -6251,7 +6491,7 @@ function KeepCollectionCreate({
|
|
|
6251
6491
|
"data-keep-action": "collection-name-input"
|
|
6252
6492
|
}
|
|
6253
6493
|
),
|
|
6254
|
-
/* @__PURE__ */
|
|
6494
|
+
/* @__PURE__ */ jsx19(
|
|
6255
6495
|
"button",
|
|
6256
6496
|
{
|
|
6257
6497
|
type: "submit",
|
|
@@ -6262,26 +6502,26 @@ function KeepCollectionCreate({
|
|
|
6262
6502
|
}
|
|
6263
6503
|
)
|
|
6264
6504
|
] }),
|
|
6265
|
-
error ? /* @__PURE__ */
|
|
6505
|
+
error ? /* @__PURE__ */ jsx19("p", { role: "alert", children: error }) : null
|
|
6266
6506
|
]
|
|
6267
6507
|
}
|
|
6268
6508
|
);
|
|
6269
6509
|
}
|
|
6270
6510
|
|
|
6271
6511
|
// src/features/collection/KeepInlineSelection.tsx
|
|
6272
|
-
import { useEffect as
|
|
6273
|
-
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";
|
|
6274
6514
|
function KeepInlineSelection({
|
|
6275
6515
|
query,
|
|
6276
6516
|
children,
|
|
6277
6517
|
confirmRemoval = false
|
|
6278
6518
|
}) {
|
|
6279
|
-
const [selecting, setSelecting] =
|
|
6280
|
-
const [selectedIds, setSelectedIds] =
|
|
6281
|
-
const previousQuery =
|
|
6282
|
-
|
|
6283
|
-
if (previousQuery.current
|
|
6284
|
-
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);
|
|
6285
6525
|
setSelectedIds([]);
|
|
6286
6526
|
}, [query]);
|
|
6287
6527
|
const { state } = useKeepBulkActions({
|
|
@@ -6294,7 +6534,7 @@ function KeepInlineSelection({
|
|
|
6294
6534
|
onSelectionScopeChange: void 0,
|
|
6295
6535
|
confirmRemoval
|
|
6296
6536
|
});
|
|
6297
|
-
const removalTrigger =
|
|
6537
|
+
const removalTrigger = useRef12(null);
|
|
6298
6538
|
const selectLabel = useUiLabel("selectItems");
|
|
6299
6539
|
const doneLabel = useUiLabel("done");
|
|
6300
6540
|
const pageLabel = useUiLabel("currentPage");
|
|
@@ -6315,9 +6555,9 @@ function KeepInlineSelection({
|
|
|
6315
6555
|
const errorLabel = useUiLabel("error");
|
|
6316
6556
|
const run = (operation) => void operation().catch(() => void 0);
|
|
6317
6557
|
const archivedOnly = query.archiveScope === "archived" || query.archived === true;
|
|
6318
|
-
return /* @__PURE__ */
|
|
6319
|
-
/* @__PURE__ */
|
|
6320
|
-
/* @__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(
|
|
6321
6561
|
"button",
|
|
6322
6562
|
{
|
|
6323
6563
|
type: "button",
|
|
@@ -6330,9 +6570,9 @@ function KeepInlineSelection({
|
|
|
6330
6570
|
children: selecting ? doneLabel : selectLabel
|
|
6331
6571
|
}
|
|
6332
6572
|
),
|
|
6333
|
-
selecting ? /* @__PURE__ */
|
|
6334
|
-
/* @__PURE__ */
|
|
6335
|
-
/* @__PURE__ */
|
|
6573
|
+
selecting ? /* @__PURE__ */ jsxs17(Fragment9, { children: [
|
|
6574
|
+
/* @__PURE__ */ jsxs17("label", { children: [
|
|
6575
|
+
/* @__PURE__ */ jsx20(
|
|
6336
6576
|
"input",
|
|
6337
6577
|
{
|
|
6338
6578
|
type: "checkbox",
|
|
@@ -6341,47 +6581,49 @@ function KeepInlineSelection({
|
|
|
6341
6581
|
disabled: state.isMutating || !state.items.length
|
|
6342
6582
|
}
|
|
6343
6583
|
),
|
|
6584
|
+
selectLabel,
|
|
6585
|
+
" \u2014 ",
|
|
6344
6586
|
pageLabel
|
|
6345
6587
|
] }),
|
|
6346
|
-
/* @__PURE__ */
|
|
6588
|
+
/* @__PURE__ */ jsxs17("span", { role: "status", children: [
|
|
6347
6589
|
state.selectedCount,
|
|
6348
6590
|
" ",
|
|
6349
6591
|
countLabel
|
|
6350
6592
|
] })
|
|
6351
6593
|
] }) : null,
|
|
6352
|
-
selecting && state.selectedCount > 0 ? /* @__PURE__ */
|
|
6353
|
-
/* @__PURE__ */
|
|
6594
|
+
selecting && state.selectedCount > 0 ? /* @__PURE__ */ jsxs17("fieldset", { disabled: state.isMutating, children: [
|
|
6595
|
+
/* @__PURE__ */ jsxs17("legend", { children: [
|
|
6354
6596
|
state.selectedCount,
|
|
6355
6597
|
" ",
|
|
6356
6598
|
countLabel
|
|
6357
6599
|
] }),
|
|
6358
|
-
/* @__PURE__ */
|
|
6600
|
+
/* @__PURE__ */ jsxs17("label", { children: [
|
|
6359
6601
|
collectionLabel,
|
|
6360
|
-
/* @__PURE__ */
|
|
6361
|
-
/* @__PURE__ */
|
|
6362
|
-
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))
|
|
6363
6605
|
] })
|
|
6364
6606
|
] }),
|
|
6365
|
-
/* @__PURE__ */
|
|
6366
|
-
/* @__PURE__ */
|
|
6367
|
-
/* @__PURE__ */
|
|
6368
|
-
/* @__PURE__ */
|
|
6369
|
-
/* @__PURE__ */
|
|
6370
|
-
/* @__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: [
|
|
6371
6613
|
tagsLabel,
|
|
6372
|
-
/* @__PURE__ */
|
|
6614
|
+
/* @__PURE__ */ jsx20("input", { value: state.tagsInput, onChange: (event) => state.setTagsInput(event.currentTarget.value) })
|
|
6373
6615
|
] }),
|
|
6374
|
-
/* @__PURE__ */
|
|
6375
|
-
/* @__PURE__ */
|
|
6376
|
-
/* @__PURE__ */
|
|
6377
|
-
/* @__PURE__ */
|
|
6378
|
-
/* @__PURE__ */
|
|
6379
|
-
/* @__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 })
|
|
6380
6622
|
] })
|
|
6381
6623
|
] })
|
|
6382
6624
|
] }) : null,
|
|
6383
|
-
/* @__PURE__ */
|
|
6384
|
-
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
|
|
6385
6627
|
] }),
|
|
6386
6628
|
children(
|
|
6387
6629
|
selecting ? { selectedIds, onSelectedIdsChange: setSelectedIds, disabled: state.isMutating } : void 0
|
|
@@ -6391,21 +6633,24 @@ function KeepInlineSelection({
|
|
|
6391
6633
|
|
|
6392
6634
|
// src/features/collection/KeepList.tsx
|
|
6393
6635
|
import { KeepErrorBoundary } from "@keepkit/core/react";
|
|
6394
|
-
import { isValidElement as
|
|
6636
|
+
import { isValidElement as isValidElement7 } from "react";
|
|
6395
6637
|
|
|
6396
6638
|
// src/features/item/KeepItemCard.tsx
|
|
6397
6639
|
import { useKeepCollections as useKeepCollections6 } from "@keepkit/core/react";
|
|
6398
6640
|
import {
|
|
6399
|
-
createContext as
|
|
6641
|
+
createContext as createContext4,
|
|
6400
6642
|
createElement as createElement2,
|
|
6401
|
-
isValidElement as
|
|
6402
|
-
useContext as
|
|
6403
|
-
useEffect as
|
|
6404
|
-
useId as
|
|
6405
|
-
useRef as
|
|
6406
|
-
useState as
|
|
6643
|
+
isValidElement as isValidElement5,
|
|
6644
|
+
useContext as useContext4,
|
|
6645
|
+
useEffect as useEffect14,
|
|
6646
|
+
useId as useId4,
|
|
6647
|
+
useRef as useRef13,
|
|
6648
|
+
useState as useState19
|
|
6407
6649
|
} from "react";
|
|
6408
6650
|
|
|
6651
|
+
// src/features/status/KeepStaleNotice.tsx
|
|
6652
|
+
import { useState as useState18 } from "react";
|
|
6653
|
+
|
|
6409
6654
|
// src/features/item/hooks/useKeepItemStatusBadge.ts
|
|
6410
6655
|
function useKeepItemStatusBadge(status) {
|
|
6411
6656
|
return {
|
|
@@ -6446,10 +6691,10 @@ function getDisplayStatus(status) {
|
|
|
6446
6691
|
}
|
|
6447
6692
|
|
|
6448
6693
|
// src/features/item/KeepItemStatusBadge.tsx
|
|
6449
|
-
import { Fragment as
|
|
6694
|
+
import { Fragment as Fragment10, jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6450
6695
|
function KeepItemStatusBadge({ status = "available", label, className, ...props }) {
|
|
6451
6696
|
const view = useKeepItemStatusBadge(status);
|
|
6452
|
-
return /* @__PURE__ */
|
|
6697
|
+
return /* @__PURE__ */ jsxs18(
|
|
6453
6698
|
"span",
|
|
6454
6699
|
{
|
|
6455
6700
|
...props,
|
|
@@ -6460,14 +6705,14 @@ function KeepItemStatusBadge({ status = "available", label, className, ...props
|
|
|
6460
6705
|
"data-status": status,
|
|
6461
6706
|
"data-item-status": view.resolvedStatus,
|
|
6462
6707
|
children: [
|
|
6463
|
-
/* @__PURE__ */
|
|
6464
|
-
/* @__PURE__ */
|
|
6708
|
+
/* @__PURE__ */ jsx21(StatusIcon, { name: view.icon }),
|
|
6709
|
+
/* @__PURE__ */ jsx21("span", { "data-status-label": "true", children: label ?? view.statusLabel })
|
|
6465
6710
|
]
|
|
6466
6711
|
}
|
|
6467
6712
|
);
|
|
6468
6713
|
}
|
|
6469
6714
|
function StatusIcon({ name }) {
|
|
6470
|
-
return /* @__PURE__ */
|
|
6715
|
+
return /* @__PURE__ */ jsxs18(
|
|
6471
6716
|
"svg",
|
|
6472
6717
|
{
|
|
6473
6718
|
"data-status-icon": name,
|
|
@@ -6482,18 +6727,18 @@ function StatusIcon({ name }) {
|
|
|
6482
6727
|
"aria-hidden": "true",
|
|
6483
6728
|
focusable: "false",
|
|
6484
6729
|
children: [
|
|
6485
|
-
name === "check" ? /* @__PURE__ */
|
|
6486
|
-
name === "clock" ? /* @__PURE__ */
|
|
6487
|
-
/* @__PURE__ */
|
|
6488
|
-
/* @__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" })
|
|
6489
6734
|
] }) : null,
|
|
6490
|
-
name === "ban" ? /* @__PURE__ */
|
|
6491
|
-
/* @__PURE__ */
|
|
6492
|
-
/* @__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" })
|
|
6493
6738
|
] }) : null,
|
|
6494
|
-
name === "lock" ? /* @__PURE__ */
|
|
6495
|
-
/* @__PURE__ */
|
|
6496
|
-
/* @__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" })
|
|
6497
6742
|
] }) : null
|
|
6498
6743
|
]
|
|
6499
6744
|
}
|
|
@@ -6501,16 +6746,18 @@ function StatusIcon({ name }) {
|
|
|
6501
6746
|
}
|
|
6502
6747
|
|
|
6503
6748
|
// src/features/status/hooks/useKeepStaleNotice.ts
|
|
6504
|
-
import { useKeepContext as
|
|
6505
|
-
import { useState as
|
|
6749
|
+
import { useKeepContext as useKeepContext6, useKeepStore as useKeepStore3 } from "@keepkit/core/react";
|
|
6750
|
+
import { useState as useState17 } from "react";
|
|
6506
6751
|
function useKeepStaleNotice({ item, onRetry, onRemoved }) {
|
|
6507
|
-
const context =
|
|
6752
|
+
const context = useKeepContext6();
|
|
6753
|
+
const { store } = useKeepStore3();
|
|
6508
6754
|
const emitFeedback = useKeepUiFeedback();
|
|
6509
6755
|
const removedMessage = useUiLabel("removedMessage");
|
|
6510
6756
|
const restoredMessage = useUiLabel("restoredMessage");
|
|
6511
6757
|
const undoLabel = useUiLabel("undo");
|
|
6512
|
-
const
|
|
6513
|
-
const [
|
|
6758
|
+
const errorLabel = useUiLabel("error");
|
|
6759
|
+
const [isRetrying, setIsRetrying] = useState17(false);
|
|
6760
|
+
const [error, setError] = useState17(null);
|
|
6514
6761
|
async function retry() {
|
|
6515
6762
|
setError(null);
|
|
6516
6763
|
setIsRetrying(true);
|
|
@@ -6526,6 +6773,7 @@ function useKeepStaleNotice({ item, onRetry, onRemoved }) {
|
|
|
6526
6773
|
async function remove() {
|
|
6527
6774
|
try {
|
|
6528
6775
|
await context.removeItemWithUndo(item.id);
|
|
6776
|
+
const undoState = store.getSnapshot().undo;
|
|
6529
6777
|
onRemoved?.(item);
|
|
6530
6778
|
emitFeedback({
|
|
6531
6779
|
type: "item-removed",
|
|
@@ -6533,6 +6781,9 @@ function useKeepStaleNotice({ item, onRetry, onRemoved }) {
|
|
|
6533
6781
|
message: removedMessage,
|
|
6534
6782
|
undoLabel,
|
|
6535
6783
|
undo: async () => {
|
|
6784
|
+
if (!undoState?.canUndo || store.getSnapshot().undo !== undoState || (undoState.expiresAt ?? 0) <= Date.now()) {
|
|
6785
|
+
throw new UndoUnavailableError(errorLabel);
|
|
6786
|
+
}
|
|
6536
6787
|
await context.undoLastRemoval();
|
|
6537
6788
|
emitFeedback({ type: "item-restored", item, items: [item], message: restoredMessage });
|
|
6538
6789
|
}
|
|
@@ -6556,13 +6807,15 @@ function useKeepStaleNotice({ item, onRetry, onRemoved }) {
|
|
|
6556
6807
|
};
|
|
6557
6808
|
}
|
|
6558
6809
|
function useKeepPruneStale({ statuses, onPruned }) {
|
|
6559
|
-
const context =
|
|
6810
|
+
const context = useKeepContext6();
|
|
6811
|
+
const { store } = useKeepStore3();
|
|
6560
6812
|
const emitFeedback = useKeepUiFeedback();
|
|
6561
6813
|
const staleItems = context.items.filter((item) => item.status && statuses.includes(item.status));
|
|
6562
6814
|
const staleIds = staleItems.map((item) => item.id);
|
|
6563
6815
|
const restoredMessage = useUiLabel("restoredMessage");
|
|
6564
6816
|
const prunedMessage = useUiLabel("stalePrunedMessage");
|
|
6565
6817
|
const undoLabel = useUiLabel("undo");
|
|
6818
|
+
const errorLabel = useUiLabel("error");
|
|
6566
6819
|
return {
|
|
6567
6820
|
staleIds,
|
|
6568
6821
|
isMutating: context.isMutating,
|
|
@@ -6571,6 +6824,7 @@ function useKeepPruneStale({ statuses, onPruned }) {
|
|
|
6571
6824
|
const ids = [...staleIds];
|
|
6572
6825
|
const items = [...staleItems];
|
|
6573
6826
|
await context.removeItemsWithUndo(ids);
|
|
6827
|
+
const undoState = store.getSnapshot().undo;
|
|
6574
6828
|
onPruned?.(ids);
|
|
6575
6829
|
if (items.length > 0) {
|
|
6576
6830
|
emitFeedback({
|
|
@@ -6580,6 +6834,9 @@ function useKeepPruneStale({ statuses, onPruned }) {
|
|
|
6580
6834
|
message: prunedMessage,
|
|
6581
6835
|
undoLabel,
|
|
6582
6836
|
undo: async () => {
|
|
6837
|
+
if (!undoState?.canUndo || store.getSnapshot().undo !== undoState || (undoState.expiresAt ?? 0) <= Date.now()) {
|
|
6838
|
+
throw new UndoUnavailableError(errorLabel);
|
|
6839
|
+
}
|
|
6583
6840
|
await context.undoLastRemoval();
|
|
6584
6841
|
emitFeedback({ type: "item-restored", item: items[0], items, message: restoredMessage });
|
|
6585
6842
|
}
|
|
@@ -6590,7 +6847,7 @@ function useKeepPruneStale({ statuses, onPruned }) {
|
|
|
6590
6847
|
}
|
|
6591
6848
|
|
|
6592
6849
|
// src/features/status/KeepStaleNotice.tsx
|
|
6593
|
-
import { jsx as
|
|
6850
|
+
import { Fragment as Fragment11, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6594
6851
|
function KeepStaleNotice({
|
|
6595
6852
|
item,
|
|
6596
6853
|
onRetry,
|
|
@@ -6604,11 +6861,11 @@ function KeepStaleNotice({
|
|
|
6604
6861
|
const view = useKeepStaleNotice({ item, onRetry, onRemoved });
|
|
6605
6862
|
const showRetryLabel = useUiLabelVisibility("retry");
|
|
6606
6863
|
const showRemoveLabel = useUiLabelVisibility("removeFromList");
|
|
6607
|
-
return /* @__PURE__ */
|
|
6608
|
-
/* @__PURE__ */
|
|
6609
|
-
children ?? (item.statusReason ? /* @__PURE__ */
|
|
6610
|
-
/* @__PURE__ */
|
|
6611
|
-
/* @__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(
|
|
6612
6869
|
"button",
|
|
6613
6870
|
{
|
|
6614
6871
|
type: "button",
|
|
@@ -6619,7 +6876,7 @@ function KeepStaleNotice({
|
|
|
6619
6876
|
children: showRetryLabel ? retryLabel ?? view.labels.retry : null
|
|
6620
6877
|
}
|
|
6621
6878
|
),
|
|
6622
|
-
/* @__PURE__ */
|
|
6879
|
+
/* @__PURE__ */ jsx22(
|
|
6623
6880
|
"button",
|
|
6624
6881
|
{
|
|
6625
6882
|
type: "button",
|
|
@@ -6631,7 +6888,7 @@ function KeepStaleNotice({
|
|
|
6631
6888
|
}
|
|
6632
6889
|
)
|
|
6633
6890
|
] }),
|
|
6634
|
-
view.error ? /* @__PURE__ */
|
|
6891
|
+
view.error ? /* @__PURE__ */ jsx22("p", { role: "alert", children: getErrorMessage(view.error, view.labels.error) }) : null
|
|
6635
6892
|
] });
|
|
6636
6893
|
}
|
|
6637
6894
|
function KeepPruneStaleButton({
|
|
@@ -6644,25 +6901,38 @@ function KeepPruneStaleButton({
|
|
|
6644
6901
|
}) {
|
|
6645
6902
|
const view = useKeepPruneStale({ statuses, onPruned });
|
|
6646
6903
|
const showLabel = useUiLabelVisibility("pruneStale");
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
"data-state": view.staleIds.length > 0 ? "available" : "empty",
|
|
6656
|
-
disabled: view.staleIds.length === 0 || view.isMutating || disabled,
|
|
6657
|
-
"aria-label": showLabel ? void 0 : view.label,
|
|
6658
|
-
onClick: () => void view.prune(),
|
|
6659
|
-
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);
|
|
6660
6912
|
}
|
|
6661
|
-
|
|
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
|
+
] });
|
|
6662
6932
|
}
|
|
6663
6933
|
|
|
6664
6934
|
// src/features/item/hooks/useKeepItemCard.ts
|
|
6665
|
-
import { useKeepItem as useKeepItem5 } from "@keepkit/core/react";
|
|
6935
|
+
import { useKeepItem as useKeepItem5, useKeepStore as useKeepStore4 } from "@keepkit/core/react";
|
|
6666
6936
|
function useKeepItemCard(options) {
|
|
6667
6937
|
const {
|
|
6668
6938
|
item,
|
|
@@ -6676,10 +6946,12 @@ function useKeepItemCard(options) {
|
|
|
6676
6946
|
onRemoved
|
|
6677
6947
|
} = options;
|
|
6678
6948
|
const itemState = useKeepItem5(item);
|
|
6949
|
+
const { store } = useKeepStore4();
|
|
6679
6950
|
const emitFeedback = useKeepUiFeedback();
|
|
6680
6951
|
const removedMessage = useUiLabel("removedMessage");
|
|
6681
6952
|
const restoredMessage = useUiLabel("restoredMessage");
|
|
6682
6953
|
const undoLabel = useUiLabel("undo");
|
|
6954
|
+
const errorLabel = useUiLabel("error");
|
|
6683
6955
|
const resolvedTitle = typeof title === "function" ? title(item) : title ?? getTitle?.(item) ?? getMetaTitle(item.meta) ?? item.id;
|
|
6684
6956
|
const imageProps = getImageProps?.(item, resolvedTitle);
|
|
6685
6957
|
const href = typeof hrefOption === "function" ? hrefOption(item) : hrefOption;
|
|
@@ -6691,6 +6963,7 @@ function useKeepItemCard(options) {
|
|
|
6691
6963
|
const wasSaved = itemState.isSaved;
|
|
6692
6964
|
try {
|
|
6693
6965
|
await itemState.removeWithUndo();
|
|
6966
|
+
const undoState = store.getSnapshot().undo;
|
|
6694
6967
|
onRemoved?.(item);
|
|
6695
6968
|
if (!wasSaved) return;
|
|
6696
6969
|
emitFeedback({
|
|
@@ -6699,6 +6972,9 @@ function useKeepItemCard(options) {
|
|
|
6699
6972
|
message: removedMessage,
|
|
6700
6973
|
undoLabel,
|
|
6701
6974
|
undo: async () => {
|
|
6975
|
+
if (!undoState?.canUndo || store.getSnapshot().undo !== undoState || (undoState.expiresAt ?? 0) <= Date.now()) {
|
|
6976
|
+
throw new UndoUnavailableError(errorLabel);
|
|
6977
|
+
}
|
|
6702
6978
|
await itemState.undo();
|
|
6703
6979
|
emitFeedback({ type: "item-restored", item, items: [item], message: restoredMessage });
|
|
6704
6980
|
}
|
|
@@ -6758,10 +7034,10 @@ function getDisplayStatus2(status) {
|
|
|
6758
7034
|
}
|
|
6759
7035
|
|
|
6760
7036
|
// src/features/item/KeepItemCard.tsx
|
|
6761
|
-
import { Fragment as
|
|
6762
|
-
var KeepItemCardContext =
|
|
7037
|
+
import { Fragment as Fragment12, jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
7038
|
+
var KeepItemCardContext = createContext4(null);
|
|
6763
7039
|
function useKeepItemCardCompound(part) {
|
|
6764
|
-
const context =
|
|
7040
|
+
const context = useContext4(KeepItemCardContext);
|
|
6765
7041
|
if (!context) throw new Error(`KeepItemCard.${part} must be rendered inside KeepItemCard.`);
|
|
6766
7042
|
return context;
|
|
6767
7043
|
}
|
|
@@ -6826,26 +7102,26 @@ function KeepItemCardRoot({
|
|
|
6826
7102
|
const moreLabel = useUiLabel("moreActions");
|
|
6827
7103
|
const contextQuery = useKeepSearchQuery();
|
|
6828
7104
|
const searchQuery = highlightQuery ?? contextQuery;
|
|
6829
|
-
const contentChildren = asChild &&
|
|
7105
|
+
const contentChildren = asChild && isValidElement5(children) ? void 0 : children;
|
|
6830
7106
|
const hasCustomBody = render !== void 0 || contentChildren !== void 0;
|
|
6831
7107
|
const cardLinkSurface = linkTarget === "card" && !hasCustomBody && Boolean(view.href) && view.isAvailable;
|
|
6832
|
-
const [isEditOpen, setEditOpen] =
|
|
6833
|
-
const editTriggerRef =
|
|
6834
|
-
const editPanelRef =
|
|
6835
|
-
const wasEditOpen =
|
|
6836
|
-
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();
|
|
6837
7113
|
const editLabel = useUiLabel("editSavedItem");
|
|
6838
7114
|
const showEditLabel = useUiLabelVisibility("editSavedItem");
|
|
6839
7115
|
const showSavedAtLabel = useUiLabelVisibility("saved");
|
|
6840
7116
|
const closeEdit = () => setEditOpen(false);
|
|
6841
|
-
|
|
7117
|
+
useEffect14(() => {
|
|
6842
7118
|
if (isEditOpen) editPanelRef.current?.querySelector("textarea, input, select")?.focus();
|
|
6843
7119
|
if (wasEditOpen.current && !isEditOpen) editTriggerRef.current?.focus();
|
|
6844
7120
|
wasEditOpen.current = isEditOpen;
|
|
6845
7121
|
}, [isEditOpen]);
|
|
6846
7122
|
function renderLink(content, props = {}) {
|
|
6847
7123
|
if (!view.href || !view.isAvailable) {
|
|
6848
|
-
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 });
|
|
6849
7125
|
}
|
|
6850
7126
|
const linkProps = {
|
|
6851
7127
|
...props,
|
|
@@ -6861,17 +7137,17 @@ function KeepItemCardRoot({
|
|
|
6861
7137
|
},
|
|
6862
7138
|
children: content
|
|
6863
7139
|
};
|
|
6864
|
-
return LinkComponent ? /* @__PURE__ */
|
|
7140
|
+
return LinkComponent ? /* @__PURE__ */ jsx23(LinkComponent, { ...linkProps }) : /* @__PURE__ */ jsx23("a", { ...linkProps });
|
|
6865
7141
|
}
|
|
6866
7142
|
function renderTitle(content) {
|
|
6867
7143
|
if (cardLinkSurface) return content;
|
|
6868
7144
|
if (view.isAvailable) return renderLink(content);
|
|
6869
|
-
return view.href ? /* @__PURE__ */
|
|
7145
|
+
return view.href ? /* @__PURE__ */ jsx23("span", { "aria-disabled": "true", "data-link-disabled": "true", children: content }) : content;
|
|
6870
7146
|
}
|
|
6871
7147
|
const resolvedImageProps = view.imageProps ? { ...view.imageProps, alt: imageAlt ?? view.imageProps.alt } : void 0;
|
|
6872
7148
|
const imageSource = resolvedImageProps?.src;
|
|
6873
|
-
const [imageStatus, setImageStatus] =
|
|
6874
|
-
|
|
7149
|
+
const [imageStatus, setImageStatus] = useState19(imageSource ? "loading" : "error");
|
|
7150
|
+
useEffect14(() => {
|
|
6875
7151
|
setImageStatus(imageSource ? "loading" : "error");
|
|
6876
7152
|
}, [imageSource]);
|
|
6877
7153
|
let image = null;
|
|
@@ -6889,21 +7165,21 @@ function KeepItemCardRoot({
|
|
|
6889
7165
|
setImageStatus("error");
|
|
6890
7166
|
}
|
|
6891
7167
|
};
|
|
6892
|
-
image = renderImage?.(imagePropsWithHandlers, item) ?? (ImageComponent ? /* @__PURE__ */
|
|
7168
|
+
image = renderImage?.(imagePropsWithHandlers, item) ?? (ImageComponent ? /* @__PURE__ */ jsx23(ImageComponent, { ...imagePropsWithHandlers }) : /* @__PURE__ */ jsx23("img", { ...imagePropsWithHandlers, alt: imagePropsWithHandlers.alt }));
|
|
6893
7169
|
}
|
|
6894
7170
|
const tags = showTags ? item.tags ?? [] : [];
|
|
6895
7171
|
const renderedTags = showTags && tags.length > 0 ? renderTags?.(tags, item) ?? null : null;
|
|
6896
|
-
const meta = showSavedAt ? /* @__PURE__ */
|
|
6897
|
-
showSavedAtLabel ? /* @__PURE__ */
|
|
7172
|
+
const meta = showSavedAt ? /* @__PURE__ */ jsxs20("div", { "data-card-meta": true, children: [
|
|
7173
|
+
showSavedAtLabel ? /* @__PURE__ */ jsxs20("span", { children: [
|
|
6898
7174
|
view.labels.savedAt,
|
|
6899
7175
|
":"
|
|
6900
7176
|
] }) : null,
|
|
6901
7177
|
showSavedAtLabel ? " " : null,
|
|
6902
|
-
/* @__PURE__ */
|
|
7178
|
+
/* @__PURE__ */ jsx23("time", { dateTime: new Date(item.savedAt).toISOString(), children: formatSavedAt(item.savedAt) })
|
|
6903
7179
|
] }) : null;
|
|
6904
|
-
const error = view.itemState.error && !isEditOpen ? /* @__PURE__ */
|
|
6905
|
-
const actions = view.statusLabel ? /* @__PURE__ */
|
|
6906
|
-
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(
|
|
6907
7183
|
KeepQuickEditor,
|
|
6908
7184
|
{
|
|
6909
7185
|
item: view.itemState.item ?? item,
|
|
@@ -6912,7 +7188,7 @@ function KeepItemCardRoot({
|
|
|
6912
7188
|
collectionLabels,
|
|
6913
7189
|
...presentation === "reading" ? { showSaveButton: false, closeLabel: doneLabel } : {}
|
|
6914
7190
|
}
|
|
6915
|
-
) }) : /* @__PURE__ */
|
|
7191
|
+
) }) : /* @__PURE__ */ jsx23(
|
|
6916
7192
|
"button",
|
|
6917
7193
|
{
|
|
6918
7194
|
ref: editTriggerRef,
|
|
@@ -6929,23 +7205,23 @@ function KeepItemCardRoot({
|
|
|
6929
7205
|
children: showEditLabel ? editLabel : null
|
|
6930
7206
|
}
|
|
6931
7207
|
) : null,
|
|
6932
|
-
isEditOpen ? null : /* @__PURE__ */
|
|
6933
|
-
showSaveButton ? /* @__PURE__ */
|
|
6934
|
-
showPinButton ? /* @__PURE__ */
|
|
6935
|
-
presentation === "reading" ? /* @__PURE__ */
|
|
6936
|
-
/* @__PURE__ */
|
|
6937
|
-
/* @__PURE__ */
|
|
6938
|
-
showArchiveButton ? /* @__PURE__ */
|
|
6939
|
-
/* @__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, {})
|
|
6940
7216
|
] })
|
|
6941
|
-
] }) : /* @__PURE__ */
|
|
6942
|
-
showArchiveButton ? /* @__PURE__ */
|
|
6943
|
-
/* @__PURE__ */
|
|
7217
|
+
] }) : /* @__PURE__ */ jsxs20(Fragment12, { children: [
|
|
7218
|
+
showArchiveButton ? /* @__PURE__ */ jsx23(KeepItemCardArchive, {}) : null,
|
|
7219
|
+
/* @__PURE__ */ jsx23(KeepItemCardRemove, {})
|
|
6944
7220
|
] })
|
|
6945
7221
|
] }),
|
|
6946
|
-
isEditOpen && presentation !== "reading" && (showPinButton || showArchiveButton) ? /* @__PURE__ */
|
|
6947
|
-
showPinButton ? /* @__PURE__ */
|
|
6948
|
-
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
|
|
6949
7225
|
] }) : null
|
|
6950
7226
|
] });
|
|
6951
7227
|
const compoundValue = {
|
|
@@ -6958,7 +7234,7 @@ function KeepItemCardRoot({
|
|
|
6958
7234
|
imageStatus,
|
|
6959
7235
|
fallbackLabel: String(view.resolvedTitle),
|
|
6960
7236
|
note: showNote ? item.note : void 0,
|
|
6961
|
-
activity: showActivity ? /* @__PURE__ */
|
|
7237
|
+
activity: showActivity ? /* @__PURE__ */ jsx23(KeepLastActivity, { item, kind: activityKind }) : null,
|
|
6962
7238
|
tags,
|
|
6963
7239
|
tagsLabel: view.labels.tags,
|
|
6964
7240
|
filterTagsLabel,
|
|
@@ -6975,29 +7251,29 @@ function KeepItemCardRoot({
|
|
|
6975
7251
|
remove: view.remove,
|
|
6976
7252
|
isMutating: view.itemState.isMutating,
|
|
6977
7253
|
saveAriaLabel: `${view.labels.remove} ${String(view.resolvedTitle)}`,
|
|
6978
|
-
renderText: (content) => /* @__PURE__ */
|
|
7254
|
+
renderText: (content) => /* @__PURE__ */ jsx23(KeepHighlight, { query: searchQuery, children: content })
|
|
6979
7255
|
};
|
|
6980
|
-
const media = presentation !== "reading" || resolvedImageProps?.src ? /* @__PURE__ */
|
|
7256
|
+
const media = presentation !== "reading" || resolvedImageProps?.src ? /* @__PURE__ */ jsx23(KeepItemCardMedia, {}) : null;
|
|
6981
7257
|
const customMedia = renderImage !== void 0 || ImageComponent !== void 0;
|
|
6982
|
-
const defaultBody = cardLinkSurface ? /* @__PURE__ */
|
|
7258
|
+
const defaultBody = cardLinkSurface ? /* @__PURE__ */ jsxs20(Fragment12, { children: [
|
|
6983
7259
|
customMedia ? media : null,
|
|
6984
7260
|
renderLink(
|
|
6985
|
-
/* @__PURE__ */
|
|
7261
|
+
/* @__PURE__ */ jsxs20(Fragment12, { children: [
|
|
6986
7262
|
customMedia ? null : media,
|
|
6987
|
-
/* @__PURE__ */
|
|
7263
|
+
/* @__PURE__ */ jsx23(KeepItemCardContent, {})
|
|
6988
7264
|
] })
|
|
6989
7265
|
),
|
|
6990
|
-
/* @__PURE__ */
|
|
6991
|
-
/* @__PURE__ */
|
|
6992
|
-
] }) : /* @__PURE__ */
|
|
7266
|
+
/* @__PURE__ */ jsx23(KeepItemCardTags, {}),
|
|
7267
|
+
/* @__PURE__ */ jsx23(KeepItemCardActions, {})
|
|
7268
|
+
] }) : /* @__PURE__ */ jsxs20(Fragment12, { children: [
|
|
6993
7269
|
media,
|
|
6994
|
-
/* @__PURE__ */
|
|
6995
|
-
/* @__PURE__ */
|
|
7270
|
+
/* @__PURE__ */ jsx23(KeepItemCardContent, {}),
|
|
7271
|
+
/* @__PURE__ */ jsx23(KeepItemCardActions, {})
|
|
6996
7272
|
] });
|
|
6997
7273
|
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? defaultBody;
|
|
6998
7274
|
const root = renderRoot(
|
|
6999
7275
|
asChild,
|
|
7000
|
-
|
|
7276
|
+
isValidElement5(children) ? children : void 0,
|
|
7001
7277
|
{
|
|
7002
7278
|
...rootProps,
|
|
7003
7279
|
id: rootProps.id ?? `saved-item-${encodeURIComponent(item.id)}`,
|
|
@@ -7017,28 +7293,28 @@ function KeepItemCardRoot({
|
|
|
7017
7293
|
body,
|
|
7018
7294
|
"KeepItemCard"
|
|
7019
7295
|
);
|
|
7020
|
-
return /* @__PURE__ */
|
|
7296
|
+
return /* @__PURE__ */ jsx23(KeepItemCardContext.Provider, { value: compoundValue, children: root });
|
|
7021
7297
|
}
|
|
7022
7298
|
function KeepItemCardMedia({ children, fallback, ...props }) {
|
|
7023
7299
|
const context = useKeepItemCardCompound("Media");
|
|
7024
|
-
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, {}) }) });
|
|
7025
7301
|
}
|
|
7026
7302
|
function KeepItemCardLink({ children, ...props }) {
|
|
7027
7303
|
const context = useKeepItemCardCompound("Link");
|
|
7028
|
-
const content = /* @__PURE__ */
|
|
7304
|
+
const content = /* @__PURE__ */ jsx23(KeepItemCardContext.Provider, { value: { ...context, cardLinkSurface: true, renderTitle: (title) => title }, children });
|
|
7029
7305
|
return context.cardLinkSurface ? content : context.renderLink(content, props);
|
|
7030
7306
|
}
|
|
7031
7307
|
function KeepItemCardContent({ children, ...props }) {
|
|
7032
7308
|
const context = useKeepItemCardCompound("Content");
|
|
7033
|
-
return /* @__PURE__ */
|
|
7034
|
-
context.reading && context.source ? /* @__PURE__ */
|
|
7035
|
-
/* @__PURE__ */
|
|
7036
|
-
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,
|
|
7037
7313
|
context.reading ? null : context.meta,
|
|
7038
7314
|
context.reading ? null : context.activity,
|
|
7039
|
-
context.note ? /* @__PURE__ */
|
|
7040
|
-
context.cardLinkSurface ? null : /* @__PURE__ */
|
|
7041
|
-
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: [
|
|
7042
7318
|
context.meta,
|
|
7043
7319
|
context.activity
|
|
7044
7320
|
] }) : null,
|
|
@@ -7054,8 +7330,8 @@ function KeepItemCardTitle({ as = "h3", children, ...props }) {
|
|
|
7054
7330
|
);
|
|
7055
7331
|
}
|
|
7056
7332
|
function KeepMediaPlaceholderIcon() {
|
|
7057
|
-
return /* @__PURE__ */
|
|
7058
|
-
/* @__PURE__ */
|
|
7333
|
+
return /* @__PURE__ */ jsxs20("svg", { "data-media-fallback-icon": "true", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
|
|
7334
|
+
/* @__PURE__ */ jsx23(
|
|
7059
7335
|
"path",
|
|
7060
7336
|
{
|
|
7061
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",
|
|
@@ -7063,15 +7339,15 @@ function KeepMediaPlaceholderIcon() {
|
|
|
7063
7339
|
stroke: "currentColor"
|
|
7064
7340
|
}
|
|
7065
7341
|
),
|
|
7066
|
-
/* @__PURE__ */
|
|
7067
|
-
/* @__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" })
|
|
7068
7344
|
] });
|
|
7069
7345
|
}
|
|
7070
7346
|
function KeepItemCardTags({ children, ...props }) {
|
|
7071
7347
|
const context = useKeepItemCardCompound("Tags");
|
|
7072
7348
|
if (children === void 0 && context.renderedTags) return context.renderedTags;
|
|
7073
7349
|
if (children === void 0 && context.tags.length === 0) return null;
|
|
7074
|
-
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(
|
|
7075
7351
|
"button",
|
|
7076
7352
|
{
|
|
7077
7353
|
type: "button",
|
|
@@ -7084,7 +7360,7 @@ function KeepItemCardTags({ children, ...props }) {
|
|
|
7084
7360
|
}
|
|
7085
7361
|
function KeepItemCardActions({ children, ...props }) {
|
|
7086
7362
|
const context = useKeepItemCardCompound("Actions");
|
|
7087
|
-
return /* @__PURE__ */
|
|
7363
|
+
return /* @__PURE__ */ jsx23("div", { ...props, "data-keep-card-part": "actions", children: children ?? context.actions });
|
|
7088
7364
|
}
|
|
7089
7365
|
function KeepLastActivity({
|
|
7090
7366
|
item,
|
|
@@ -7096,15 +7372,15 @@ function KeepLastActivity({
|
|
|
7096
7372
|
const neverOpenedLabel = useUiLabel("activityNeverOpened");
|
|
7097
7373
|
const inactiveSuffix = useUiLabel("activityInactiveSuffix");
|
|
7098
7374
|
if (item.lastOpenedAt === void 0) {
|
|
7099
|
-
return /* @__PURE__ */
|
|
7375
|
+
return /* @__PURE__ */ jsx23("span", { ...props, "data-keep-card-part": "activity", children: neverOpenedLabel });
|
|
7100
7376
|
}
|
|
7101
7377
|
const age = Math.max(0, Date.now() - item.lastOpenedAt);
|
|
7102
7378
|
const label = kind === "opened" ? `${openedLabel} ${formatRelativeAge(age, locale)}` : `${formatInactiveAge(age, locale)}${isCjkLocale2(locale) ? "" : " "}${inactiveSuffix}`;
|
|
7103
|
-
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 }) });
|
|
7104
7380
|
}
|
|
7105
7381
|
function KeepItemCardSave({ labels, getAriaLabel, ...props }) {
|
|
7106
7382
|
const context = useKeepItemCardCompound("Save");
|
|
7107
|
-
return /* @__PURE__ */
|
|
7383
|
+
return /* @__PURE__ */ jsx23(
|
|
7108
7384
|
KeepButton,
|
|
7109
7385
|
{
|
|
7110
7386
|
...props,
|
|
@@ -7117,7 +7393,7 @@ function KeepItemCardSave({ labels, getAriaLabel, ...props }) {
|
|
|
7117
7393
|
}
|
|
7118
7394
|
function KeepItemCardRemove({ children, disabled, onClick, ...props }) {
|
|
7119
7395
|
const context = useKeepItemCardCompound("Remove");
|
|
7120
|
-
return /* @__PURE__ */
|
|
7396
|
+
return /* @__PURE__ */ jsx23(
|
|
7121
7397
|
"button",
|
|
7122
7398
|
{
|
|
7123
7399
|
...props,
|
|
@@ -7134,19 +7410,19 @@ function KeepItemCardRemove({ children, disabled, onClick, ...props }) {
|
|
|
7134
7410
|
}
|
|
7135
7411
|
function KeepItemCardPin({ children, ...props }) {
|
|
7136
7412
|
const context = useKeepItemCardCompound("Pin");
|
|
7137
|
-
return /* @__PURE__ */
|
|
7413
|
+
return /* @__PURE__ */ jsx23(KeepPinButton, { ...props, item: context.item, children });
|
|
7138
7414
|
}
|
|
7139
7415
|
function KeepItemCardArchive({
|
|
7140
7416
|
children,
|
|
7141
7417
|
...props
|
|
7142
7418
|
}) {
|
|
7143
7419
|
const context = useKeepItemCardCompound("Archive");
|
|
7144
|
-
return /* @__PURE__ */
|
|
7420
|
+
return /* @__PURE__ */ jsx23(KeepArchiveButton, { ...props, item: context.item, children });
|
|
7145
7421
|
}
|
|
7146
7422
|
function KeepItemCardCollectionBadge({ children, ...props }) {
|
|
7147
7423
|
const context = useKeepItemCardCompound("CollectionBadge");
|
|
7148
7424
|
if (!context.item.collectionId) return null;
|
|
7149
|
-
return /* @__PURE__ */
|
|
7425
|
+
return /* @__PURE__ */ jsx23("span", { ...props, "data-keep-card-part": "collection-badge", children: children ?? context.collectionLabel });
|
|
7150
7426
|
}
|
|
7151
7427
|
var KeepItemCard = Object.assign(KeepItemCardRoot, {
|
|
7152
7428
|
Link: KeepItemCardLink,
|
|
@@ -7162,12 +7438,12 @@ var KeepItemCard = Object.assign(KeepItemCardRoot, {
|
|
|
7162
7438
|
CollectionBadge: KeepItemCardCollectionBadge
|
|
7163
7439
|
});
|
|
7164
7440
|
function KeepItemCardSkeleton({ layout = "list", ...props }) {
|
|
7165
|
-
return /* @__PURE__ */
|
|
7166
|
-
/* @__PURE__ */
|
|
7167
|
-
/* @__PURE__ */
|
|
7168
|
-
/* @__PURE__ */
|
|
7169
|
-
/* @__PURE__ */
|
|
7170
|
-
/* @__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" })
|
|
7171
7447
|
] });
|
|
7172
7448
|
}
|
|
7173
7449
|
function formatSavedAt(timestamp) {
|
|
@@ -7202,8 +7478,8 @@ function getSource(href) {
|
|
|
7202
7478
|
}
|
|
7203
7479
|
|
|
7204
7480
|
// src/features/status/KeepEmptyState.tsx
|
|
7205
|
-
import { isValidElement as
|
|
7206
|
-
import { Fragment as
|
|
7481
|
+
import { isValidElement as isValidElement6 } from "react";
|
|
7482
|
+
import { Fragment as Fragment13, jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7207
7483
|
function KeepEmptyState({
|
|
7208
7484
|
title,
|
|
7209
7485
|
description,
|
|
@@ -7221,11 +7497,11 @@ function KeepEmptyState({
|
|
|
7221
7497
|
resolvedVariant === "empty-filtered" ? "noFilteredItemsDescription" : "emptyStorageDescription"
|
|
7222
7498
|
);
|
|
7223
7499
|
const clearLabel = useUiLabel("clearFilters");
|
|
7224
|
-
const contentChildren = asChild &&
|
|
7225
|
-
const body = contentChildren ?? /* @__PURE__ */
|
|
7226
|
-
/* @__PURE__ */
|
|
7227
|
-
description ?? /* @__PURE__ */
|
|
7228
|
-
action ?? (resolvedVariant === "empty-filtered" && onClearFilters ? /* @__PURE__ */
|
|
7500
|
+
const contentChildren = asChild && isValidElement6(children) ? void 0 : children;
|
|
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)
|
|
7229
7505
|
] });
|
|
7230
7506
|
return renderRoot(
|
|
7231
7507
|
asChild,
|
|
@@ -7254,9 +7530,9 @@ function useKeepListView(query) {
|
|
|
7254
7530
|
}
|
|
7255
7531
|
|
|
7256
7532
|
// src/features/collection/hooks/useRovingTabIndex.ts
|
|
7257
|
-
import { useCallback as useCallback7, useEffect as
|
|
7533
|
+
import { useCallback as useCallback7, useEffect as useEffect15, useRef as useRef14 } from "react";
|
|
7258
7534
|
function useRovingTabIndex() {
|
|
7259
|
-
const ref =
|
|
7535
|
+
const ref = useRef14(null);
|
|
7260
7536
|
const getItems = useCallback7(() => {
|
|
7261
7537
|
const root = ref.current;
|
|
7262
7538
|
if (!root) return [];
|
|
@@ -7274,7 +7550,7 @@ function useRovingTabIndex() {
|
|
|
7274
7550
|
item.tabIndex = index === activeIndex ? 0 : -1;
|
|
7275
7551
|
});
|
|
7276
7552
|
}, [getItems]);
|
|
7277
|
-
|
|
7553
|
+
useEffect15(() => {
|
|
7278
7554
|
const root = ref.current;
|
|
7279
7555
|
if (!root) return;
|
|
7280
7556
|
syncTabIndices();
|
|
@@ -7319,8 +7595,8 @@ function useRovingTabIndex() {
|
|
|
7319
7595
|
}
|
|
7320
7596
|
|
|
7321
7597
|
// src/features/collection/KeepReorderableList.tsx
|
|
7322
|
-
import { useRef as
|
|
7323
|
-
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";
|
|
7324
7600
|
function KeepReorderableList({
|
|
7325
7601
|
items,
|
|
7326
7602
|
onReorder,
|
|
@@ -7328,12 +7604,12 @@ function KeepReorderableList({
|
|
|
7328
7604
|
itemLabel,
|
|
7329
7605
|
...props
|
|
7330
7606
|
}) {
|
|
7331
|
-
const [draggedId, setDraggedId] =
|
|
7332
|
-
const [dropTargetIndex, setDropTargetIndex] =
|
|
7333
|
-
const [announcement, setAnnouncement] =
|
|
7334
|
-
const [error, setError] =
|
|
7335
|
-
const [pending, setPending] =
|
|
7336
|
-
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);
|
|
7337
7613
|
const moveLabel = useUiLabel("moveItem");
|
|
7338
7614
|
const movedLabel = useUiLabel("reorderMoved");
|
|
7339
7615
|
const failedLabel = useUiLabel("reorderFailed");
|
|
@@ -7376,8 +7652,8 @@ function KeepReorderableList({
|
|
|
7376
7652
|
if (next[index] === id) return;
|
|
7377
7653
|
void commit(next, index);
|
|
7378
7654
|
}
|
|
7379
|
-
return /* @__PURE__ */
|
|
7380
|
-
/* @__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) => {
|
|
7381
7657
|
const moveUp = () => move(index, index - 1);
|
|
7382
7658
|
const moveDown = () => move(index, index + 1);
|
|
7383
7659
|
const onHandleKeyDown = (event) => {
|
|
@@ -7425,7 +7701,7 @@ function KeepReorderableList({
|
|
|
7425
7701
|
onKeyDown: onHandleKeyDown
|
|
7426
7702
|
}
|
|
7427
7703
|
};
|
|
7428
|
-
return /* @__PURE__ */
|
|
7704
|
+
return /* @__PURE__ */ jsx25(
|
|
7429
7705
|
"li",
|
|
7430
7706
|
{
|
|
7431
7707
|
"data-reorder-index": index,
|
|
@@ -7454,18 +7730,18 @@ function KeepReorderableList({
|
|
|
7454
7730
|
item.id
|
|
7455
7731
|
);
|
|
7456
7732
|
}) }),
|
|
7457
|
-
/* @__PURE__ */
|
|
7458
|
-
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
|
|
7459
7735
|
] });
|
|
7460
7736
|
}
|
|
7461
7737
|
|
|
7462
7738
|
// src/features/collection/KeepList.tsx
|
|
7463
|
-
import { Fragment as
|
|
7739
|
+
import { Fragment as Fragment15, jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7464
7740
|
function KeepList(props) {
|
|
7465
7741
|
const { fallback, onBoundaryError, boundaryResetKey, ...listProps } = props;
|
|
7466
|
-
const content = /* @__PURE__ */
|
|
7742
|
+
const content = /* @__PURE__ */ jsx26(KeepListContent, { ...listProps });
|
|
7467
7743
|
if (fallback === void 0 && onBoundaryError === void 0) return content;
|
|
7468
|
-
return /* @__PURE__ */
|
|
7744
|
+
return /* @__PURE__ */ jsx26(KeepErrorBoundary, { fallback, onError: onBoundaryError, resetKey: boundaryResetKey, children: content });
|
|
7469
7745
|
}
|
|
7470
7746
|
function KeepListContent({
|
|
7471
7747
|
query,
|
|
@@ -7511,7 +7787,7 @@ function KeepListContent({
|
|
|
7511
7787
|
});
|
|
7512
7788
|
return renderRoot(
|
|
7513
7789
|
asChild,
|
|
7514
|
-
asChild &&
|
|
7790
|
+
asChild && isValidElement7(children) ? children : void 0,
|
|
7515
7791
|
{
|
|
7516
7792
|
...rootProps,
|
|
7517
7793
|
className,
|
|
@@ -7532,7 +7808,7 @@ function KeepListContent({
|
|
|
7532
7808
|
if (!event.defaultPrevented) roving.onFocusCapture(event);
|
|
7533
7809
|
}
|
|
7534
7810
|
},
|
|
7535
|
-
/* @__PURE__ */
|
|
7811
|
+
/* @__PURE__ */ jsx26(KeepSearchQueryProvider, { query: query?.search?.query, children: body }),
|
|
7536
7812
|
"KeepList"
|
|
7537
7813
|
);
|
|
7538
7814
|
}
|
|
@@ -7547,17 +7823,17 @@ function getListBody(state, options) {
|
|
|
7547
7823
|
if (state.isLoading && !state.isHydrated) {
|
|
7548
7824
|
if (options.loading !== void 0) return resolveContent(options.loading, state);
|
|
7549
7825
|
const count = Number.isFinite(options.loadingCount) ? Math.max(0, Math.floor(options.loadingCount)) : 6;
|
|
7550
|
-
return /* @__PURE__ */
|
|
7551
|
-
/* @__PURE__ */
|
|
7552
|
-
/* @__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) => (
|
|
7553
7829
|
// biome-ignore lint/suspicious/noArrayIndexKey: Static loading placeholders never reorder.
|
|
7554
|
-
/* @__PURE__ */
|
|
7830
|
+
/* @__PURE__ */ jsx26("li", { children: /* @__PURE__ */ jsx26(KeepItemCardSkeleton, { layout: options.layout }) }, index)
|
|
7555
7831
|
)) })
|
|
7556
7832
|
] });
|
|
7557
7833
|
}
|
|
7558
7834
|
if (state.isHydrated && state.items.length === 0) {
|
|
7559
7835
|
if (options.empty !== void 0) return resolveContent(options.empty, state);
|
|
7560
|
-
return /* @__PURE__ */
|
|
7836
|
+
return /* @__PURE__ */ jsx26(
|
|
7561
7837
|
KeepEmptyState,
|
|
7562
7838
|
{
|
|
7563
7839
|
variant: options.allItemCount > 0 && hasActiveQueryFilters(options.query) ? "empty-filtered" : "empty-storage",
|
|
@@ -7566,9 +7842,9 @@ function getListBody(state, options) {
|
|
|
7566
7842
|
);
|
|
7567
7843
|
}
|
|
7568
7844
|
if (typeof options.children === "function") return options.children(state);
|
|
7569
|
-
if (options.children !== void 0 && !
|
|
7845
|
+
if (options.children !== void 0 && !isValidElement7(options.children)) return options.children;
|
|
7570
7846
|
if (options.reorderable) {
|
|
7571
|
-
return /* @__PURE__ */
|
|
7847
|
+
return /* @__PURE__ */ jsx26(
|
|
7572
7848
|
KeepReorderableList,
|
|
7573
7849
|
{
|
|
7574
7850
|
items: state.items,
|
|
@@ -7576,21 +7852,21 @@ function getListBody(state, options) {
|
|
|
7576
7852
|
await options.reorder(orderedIds);
|
|
7577
7853
|
await options.onReorder?.(orderedIds);
|
|
7578
7854
|
},
|
|
7579
|
-
renderItem: (item, reorderState) => /* @__PURE__ */
|
|
7580
|
-
/* @__PURE__ */
|
|
7581
|
-
options.renderItem ? options.renderItem(item, state, getItemSelection(item.id, options.selection)) : /* @__PURE__ */
|
|
7582
|
-
options.selection ? /* @__PURE__ */
|
|
7583
|
-
/* @__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 })
|
|
7584
7860
|
] })
|
|
7585
7861
|
] }),
|
|
7586
7862
|
"data-layout": options.layout
|
|
7587
7863
|
}
|
|
7588
7864
|
);
|
|
7589
7865
|
}
|
|
7590
|
-
return /* @__PURE__ */
|
|
7591
|
-
(item) => options.renderItem ? options.renderItem(item, state, getItemSelection(item.id, options.selection)) : /* @__PURE__ */
|
|
7592
|
-
options.selection ? /* @__PURE__ */
|
|
7593
|
-
/* @__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 })
|
|
7594
7870
|
] }, item.id)
|
|
7595
7871
|
) });
|
|
7596
7872
|
}
|
|
@@ -7614,13 +7890,13 @@ function getItemSelection(id, selection) {
|
|
|
7614
7890
|
}
|
|
7615
7891
|
|
|
7616
7892
|
// src/features/collection/KeepCollection.tsx
|
|
7617
|
-
import { Fragment as
|
|
7893
|
+
import { Fragment as Fragment16, jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
7618
7894
|
var EMPTY_QUERY = {};
|
|
7619
7895
|
function KeepCollection(props) {
|
|
7620
7896
|
const { fallback, onBoundaryError, boundaryResetKey, ...collectionProps } = props;
|
|
7621
|
-
const content = /* @__PURE__ */
|
|
7897
|
+
const content = /* @__PURE__ */ jsx27(KeepCollectionContent, { ...collectionProps });
|
|
7622
7898
|
if (fallback === void 0 && onBoundaryError === void 0) return content;
|
|
7623
|
-
return /* @__PURE__ */
|
|
7899
|
+
return /* @__PURE__ */ jsx27(KeepErrorBoundary2, { fallback, onError: onBoundaryError, resetKey: boundaryResetKey, children: content });
|
|
7624
7900
|
}
|
|
7625
7901
|
function KeepCollectionContent({
|
|
7626
7902
|
query = EMPTY_QUERY,
|
|
@@ -7628,6 +7904,7 @@ function KeepCollectionContent({
|
|
|
7628
7904
|
layout = "list",
|
|
7629
7905
|
toolbarVariant = "plain",
|
|
7630
7906
|
toolbarLayout = "flat",
|
|
7907
|
+
collapsibleFilters = false,
|
|
7631
7908
|
urlSync = false,
|
|
7632
7909
|
urlAdapter,
|
|
7633
7910
|
archiveScope,
|
|
@@ -7654,15 +7931,15 @@ function KeepCollectionContent({
|
|
|
7654
7931
|
...rootProps
|
|
7655
7932
|
}) {
|
|
7656
7933
|
const view = useKeepCollection({ query, pageSize, urlSync, urlAdapter, features, archiveScope, reorderable });
|
|
7657
|
-
const revealRequestId =
|
|
7658
|
-
|
|
7934
|
+
const revealRequestId = useRef16(void 0);
|
|
7935
|
+
useEffect16(() => {
|
|
7659
7936
|
if (!view.list.isHydrated || !revealRequest || revealRequestId.current === revealRequest.requestId) return;
|
|
7660
7937
|
revealRequestId.current = revealRequest.requestId;
|
|
7661
7938
|
const status = view.reveal(revealRequest.itemId);
|
|
7662
7939
|
onRevealResult?.({ ...revealRequest, status });
|
|
7663
7940
|
}, [onRevealResult, revealRequest, view.list.isHydrated, view.reveal]);
|
|
7664
|
-
const [reorderUndoIds, setReorderUndoIds] =
|
|
7665
|
-
const [reorderError, setReorderError] =
|
|
7941
|
+
const [reorderUndoIds, setReorderUndoIds] = useState21(null);
|
|
7942
|
+
const [reorderError, setReorderError] = useState21(false);
|
|
7666
7943
|
const reorderUndoLabel = useUiLabel("undoReorder");
|
|
7667
7944
|
const reorderFailedLabel = useUiLabel("reorderFailed");
|
|
7668
7945
|
const handleReorder = async (orderedIds) => {
|
|
@@ -7676,7 +7953,7 @@ function KeepCollectionContent({
|
|
|
7676
7953
|
setReorderUndoIds(previousIds);
|
|
7677
7954
|
await onReorder?.(orderedItems);
|
|
7678
7955
|
};
|
|
7679
|
-
|
|
7956
|
+
useEffect16(() => {
|
|
7680
7957
|
if (!reorderUndoIds) return;
|
|
7681
7958
|
const timer = window.setTimeout(() => setReorderUndoIds(null), 5e3);
|
|
7682
7959
|
return () => window.clearTimeout(timer);
|
|
@@ -7704,13 +7981,14 @@ function KeepCollectionContent({
|
|
|
7704
7981
|
showEditButton: itemCardProps?.showEditButton ?? features?.note ?? (itemCardProps?.presentation === "reading" || view.enabled.note),
|
|
7705
7982
|
showNote: itemCardProps?.showNote ?? features?.note ?? (itemCardProps?.presentation === "reading" || view.enabled.note)
|
|
7706
7983
|
};
|
|
7707
|
-
const toolbarId =
|
|
7708
|
-
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;
|
|
7709
7987
|
const hasQueryControls = view.enabled.search || view.enabled.sort;
|
|
7710
7988
|
const hasFilterControls = view.enabled.tagFilter || view.enabled.collectionFilter || archiveScope !== void 0;
|
|
7711
|
-
const queryControls = hasQueryControls ? /* @__PURE__ */
|
|
7712
|
-
view.enabled.search ? /* @__PURE__ */
|
|
7713
|
-
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(
|
|
7714
7992
|
KeepSortSelect,
|
|
7715
7993
|
{
|
|
7716
7994
|
value: view.sortValue,
|
|
@@ -7719,9 +7997,9 @@ function KeepCollectionContent({
|
|
|
7719
7997
|
}
|
|
7720
7998
|
) : null
|
|
7721
7999
|
] }) : null;
|
|
7722
|
-
const filterControls = hasFilterControls ? /* @__PURE__ */
|
|
7723
|
-
view.enabled.tagFilter ? /* @__PURE__ */
|
|
7724
|
-
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(
|
|
7725
8003
|
KeepCollectionFilter,
|
|
7726
8004
|
{
|
|
7727
8005
|
value: view.activeCollection ?? "",
|
|
@@ -7729,7 +8007,7 @@ function KeepCollectionContent({
|
|
|
7729
8007
|
collectionLabels
|
|
7730
8008
|
}
|
|
7731
8009
|
) : null,
|
|
7732
|
-
archiveScope !== void 0 ? /* @__PURE__ */
|
|
8010
|
+
archiveScope !== void 0 ? /* @__PURE__ */ jsx27(
|
|
7733
8011
|
KeepArchiveScopeSelect,
|
|
7734
8012
|
{
|
|
7735
8013
|
value: view.archiveScope,
|
|
@@ -7747,8 +8025,8 @@ function KeepCollectionContent({
|
|
|
7747
8025
|
const uncategorizedLabel = useUiLabel("uncategorized");
|
|
7748
8026
|
const activeCollectionLabel = view.activeCollection === "__uncategorized__" ? uncategorizedLabel : view.activeCollection === void 0 ? void 0 : collectionLabels?.[view.activeCollection] ?? view.activeCollection;
|
|
7749
8027
|
const toolbarStartContent = slots?.toolbarStart === void 0 ? null : resolveContent(slots.toolbarStart, view.list);
|
|
7750
|
-
const creatableContent = creatable ? /* @__PURE__ */
|
|
7751
|
-
const toolbarEndContent = /* @__PURE__ */
|
|
8028
|
+
const creatableContent = creatable ? /* @__PURE__ */ jsx27(KeepCollectionCreate, {}) : null;
|
|
8029
|
+
const toolbarEndContent = /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
7752
8030
|
creatableContent,
|
|
7753
8031
|
slots?.toolbarEnd === void 0 ? null : resolveContent(slots.toolbarEnd, view.list)
|
|
7754
8032
|
] });
|
|
@@ -7756,7 +8034,7 @@ function KeepCollectionContent({
|
|
|
7756
8034
|
const renderToolbarGroup = (group, content, label) => {
|
|
7757
8035
|
if (!hasRenderableContent(content)) return null;
|
|
7758
8036
|
const labelId = `${toolbarId}-${group}`;
|
|
7759
|
-
return /* @__PURE__ */
|
|
8037
|
+
return /* @__PURE__ */ jsxs24(
|
|
7760
8038
|
"fieldset",
|
|
7761
8039
|
{
|
|
7762
8040
|
"data-keepkit": "collection-toolbar-group",
|
|
@@ -7764,23 +8042,35 @@ function KeepCollectionContent({
|
|
|
7764
8042
|
role: "group",
|
|
7765
8043
|
"aria-labelledby": labelId,
|
|
7766
8044
|
children: [
|
|
7767
|
-
/* @__PURE__ */
|
|
7768
|
-
/* @__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 })
|
|
7769
8047
|
]
|
|
7770
8048
|
}
|
|
7771
8049
|
);
|
|
7772
8050
|
};
|
|
7773
|
-
const toolbar = !structuredToolbar ? /* @__PURE__ */
|
|
8051
|
+
const toolbar = !structuredToolbar ? /* @__PURE__ */ jsxs24("div", { children: [
|
|
7774
8052
|
queryControls,
|
|
7775
8053
|
filterControls
|
|
7776
|
-
] }) : !hasToolbarContent ? null : /* @__PURE__ */
|
|
8054
|
+
] }) : !hasToolbarContent ? null : /* @__PURE__ */ jsxs24("div", { "data-keepkit": "collection-toolbar", "data-variant": toolbarVariant, "data-layout": toolbarLayout, children: [
|
|
7777
8055
|
renderToolbarGroup("toolbarStart", toolbarStartContent, toolbarStartLabel),
|
|
7778
8056
|
renderToolbarGroup("query", queryControls, toolbarQueryLabel),
|
|
7779
|
-
|
|
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),
|
|
7780
8070
|
renderToolbarGroup("toolbarEnd", toolbarEndContent, toolbarEndLabel)
|
|
7781
8071
|
] });
|
|
7782
|
-
const renderList = (selection) => /* @__PURE__ */
|
|
7783
|
-
/* @__PURE__ */
|
|
8072
|
+
const renderList = (selection) => /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
8073
|
+
/* @__PURE__ */ jsx27(
|
|
7784
8074
|
KeepList,
|
|
7785
8075
|
{
|
|
7786
8076
|
query: view.resolvedQuery,
|
|
@@ -7791,14 +8081,14 @@ function KeepCollectionContent({
|
|
|
7791
8081
|
loading,
|
|
7792
8082
|
renderLoading,
|
|
7793
8083
|
loadingCount,
|
|
7794
|
-
onClearFilters: view.clearFilters,
|
|
8084
|
+
onClearFilters: () => view.clearFilters(true),
|
|
7795
8085
|
reorderable,
|
|
7796
8086
|
onReorder: reorderable ? handleReorder : void 0,
|
|
7797
8087
|
empty: view.list.totalCount === 0 && view.allState.totalCount > 0 ? void 0 : empty,
|
|
7798
8088
|
error
|
|
7799
8089
|
}
|
|
7800
8090
|
),
|
|
7801
|
-
view.enabled.pagination ? /* @__PURE__ */
|
|
8091
|
+
view.enabled.pagination ? /* @__PURE__ */ jsx27(
|
|
7802
8092
|
KeepPagination,
|
|
7803
8093
|
{
|
|
7804
8094
|
totalCount: view.list.totalCount,
|
|
@@ -7808,7 +8098,7 @@ function KeepCollectionContent({
|
|
|
7808
8098
|
}
|
|
7809
8099
|
) : null
|
|
7810
8100
|
] });
|
|
7811
|
-
return /* @__PURE__ */
|
|
8101
|
+
return /* @__PURE__ */ jsxs24(
|
|
7812
8102
|
"section",
|
|
7813
8103
|
{
|
|
7814
8104
|
...rootProps,
|
|
@@ -7822,11 +8112,11 @@ function KeepCollectionContent({
|
|
|
7822
8112
|
"data-loading": view.list.isLoading || view.list.isMutating ? "true" : void 0,
|
|
7823
8113
|
children: [
|
|
7824
8114
|
toolbar,
|
|
7825
|
-
view.enabled.savedViews ? /* @__PURE__ */
|
|
7826
|
-
/* @__PURE__ */
|
|
7827
|
-
/* @__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 })
|
|
7828
8118
|
] }) : null,
|
|
7829
|
-
activeFilters === void 0 ? /* @__PURE__ */
|
|
8119
|
+
activeFilters === void 0 ? /* @__PURE__ */ jsx27(
|
|
7830
8120
|
KeepActiveFiltersSummary,
|
|
7831
8121
|
{
|
|
7832
8122
|
search: view.searchValue,
|
|
@@ -7848,18 +8138,18 @@ function KeepCollectionContent({
|
|
|
7848
8138
|
view.setArchiveScope(next);
|
|
7849
8139
|
onArchiveScopeChange?.(next);
|
|
7850
8140
|
},
|
|
7851
|
-
onClear: view.clearFilters,
|
|
8141
|
+
onClear: () => view.clearFilters(),
|
|
7852
8142
|
onReset: view.resetFilters,
|
|
7853
8143
|
canReset: view.canReset
|
|
7854
8144
|
}
|
|
7855
8145
|
) : resolveContent(activeFilters, view.list),
|
|
7856
|
-
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: [
|
|
7857
8147
|
renderList(),
|
|
7858
|
-
view.enabled.bulkActions ? /* @__PURE__ */
|
|
8148
|
+
view.enabled.bulkActions ? /* @__PURE__ */ jsx27(KeepBulkActions, { query: view.resolvedQuery, confirmRemoval }) : null
|
|
7859
8149
|
] }),
|
|
7860
|
-
reorderable && reorderUndoIds ? /* @__PURE__ */
|
|
7861
|
-
reorderError ? /* @__PURE__ */
|
|
7862
|
-
/* @__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 })
|
|
7863
8153
|
] }) : null
|
|
7864
8154
|
]
|
|
7865
8155
|
}
|
|
@@ -7873,11 +8163,11 @@ function getCollectionState(list) {
|
|
|
7873
8163
|
}
|
|
7874
8164
|
|
|
7875
8165
|
// src/features/collection/KeepCollectionManager.tsx
|
|
7876
|
-
import { useId as
|
|
8166
|
+
import { useId as useId6 } from "react";
|
|
7877
8167
|
|
|
7878
8168
|
// src/features/collection/hooks/useKeepCollectionManager.ts
|
|
7879
|
-
import { useKeepCollections as useKeepCollections7, useKeepContext as
|
|
7880
|
-
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";
|
|
7881
8171
|
function useKeepCollectionManager({
|
|
7882
8172
|
onError,
|
|
7883
8173
|
onRenamed,
|
|
@@ -7890,13 +8180,13 @@ function useKeepCollectionManager({
|
|
|
7890
8180
|
renameCollection,
|
|
7891
8181
|
removeCollection,
|
|
7892
8182
|
moveToCollection
|
|
7893
|
-
} =
|
|
8183
|
+
} = useKeepContext7();
|
|
7894
8184
|
const collections = useKeepCollections7({ orderBy: "name" });
|
|
7895
|
-
const [editingId, setEditingId] =
|
|
7896
|
-
const [editingName, setEditingName] =
|
|
7897
|
-
const [pendingDeleteId, setPendingDeleteId] =
|
|
7898
|
-
const [error, setError] =
|
|
7899
|
-
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);
|
|
7900
8190
|
const reportError = useCallback8(
|
|
7901
8191
|
(cause, fallback) => {
|
|
7902
8192
|
const message = cause instanceof Error ? cause.message : fallback;
|
|
@@ -8005,7 +8295,7 @@ function useKeepCollectionManager({
|
|
|
8005
8295
|
}
|
|
8006
8296
|
|
|
8007
8297
|
// src/features/collection/KeepCollectionManager.tsx
|
|
8008
|
-
import { Fragment as
|
|
8298
|
+
import { Fragment as Fragment17, jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
8009
8299
|
function KeepCollectionManager({
|
|
8010
8300
|
allowCreate = true,
|
|
8011
8301
|
allowRename = true,
|
|
@@ -8023,7 +8313,7 @@ function KeepCollectionManager({
|
|
|
8023
8313
|
...rootProps
|
|
8024
8314
|
}) {
|
|
8025
8315
|
const manager = useKeepCollectionManager({ onError, onRenamed, onDeleted });
|
|
8026
|
-
const headingId =
|
|
8316
|
+
const headingId = useId6();
|
|
8027
8317
|
const renameLabel = useUiLabel("renameCollection");
|
|
8028
8318
|
const renameSubmitLabel = useUiLabel("renameCollectionSubmit");
|
|
8029
8319
|
const deleteLabel = useUiLabel("deleteCollection");
|
|
@@ -8033,7 +8323,7 @@ function KeepCollectionManager({
|
|
|
8033
8323
|
const itemLabel = useUiLabel("collectionItem");
|
|
8034
8324
|
const itemsLabel = useUiLabel("collectionItems");
|
|
8035
8325
|
const defaultTitle = useUiLabel("manageCollections");
|
|
8036
|
-
return /* @__PURE__ */
|
|
8326
|
+
return /* @__PURE__ */ jsxs25(
|
|
8037
8327
|
"section",
|
|
8038
8328
|
{
|
|
8039
8329
|
...rootProps,
|
|
@@ -8043,17 +8333,17 @@ function KeepCollectionManager({
|
|
|
8043
8333
|
"data-loading": manager.isMutating ? "true" : void 0,
|
|
8044
8334
|
"aria-labelledby": rootProps["aria-labelledby"] ?? headingId,
|
|
8045
8335
|
children: [
|
|
8046
|
-
/* @__PURE__ */
|
|
8047
|
-
/* @__PURE__ */
|
|
8048
|
-
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
|
|
8049
8339
|
] }),
|
|
8050
|
-
allowCreate ? /* @__PURE__ */
|
|
8051
|
-
manager.error ? /* @__PURE__ */
|
|
8052
|
-
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) => {
|
|
8053
8343
|
const name = collectionLabels?.[collection.id] ?? collection.name;
|
|
8054
8344
|
const isEditing = manager.editingId === collection.id;
|
|
8055
8345
|
const isPendingDelete = manager.pendingDeleteId === collection.id;
|
|
8056
|
-
return /* @__PURE__ */
|
|
8346
|
+
return /* @__PURE__ */ jsx28("li", { "data-keepkit": "collection-manager-item", children: isEditing && allowRename ? /* @__PURE__ */ jsxs25(
|
|
8057
8347
|
"form",
|
|
8058
8348
|
{
|
|
8059
8349
|
"data-keepkit": "collection-manager-rename",
|
|
@@ -8062,12 +8352,12 @@ function KeepCollectionManager({
|
|
|
8062
8352
|
void manager.rename(collection.id);
|
|
8063
8353
|
},
|
|
8064
8354
|
children: [
|
|
8065
|
-
/* @__PURE__ */
|
|
8355
|
+
/* @__PURE__ */ jsxs25("label", { htmlFor: `${headingId}-rename-${collection.id}`, children: [
|
|
8066
8356
|
renameLabel,
|
|
8067
8357
|
": ",
|
|
8068
8358
|
name
|
|
8069
8359
|
] }),
|
|
8070
|
-
/* @__PURE__ */
|
|
8360
|
+
/* @__PURE__ */ jsx28(
|
|
8071
8361
|
"input",
|
|
8072
8362
|
{
|
|
8073
8363
|
id: `${headingId}-rename-${collection.id}`,
|
|
@@ -8077,7 +8367,7 @@ function KeepCollectionManager({
|
|
|
8077
8367
|
"data-keep-action": "rename-collection-input"
|
|
8078
8368
|
}
|
|
8079
8369
|
),
|
|
8080
|
-
/* @__PURE__ */
|
|
8370
|
+
/* @__PURE__ */ jsx28(
|
|
8081
8371
|
"button",
|
|
8082
8372
|
{
|
|
8083
8373
|
type: "submit",
|
|
@@ -8086,7 +8376,7 @@ function KeepCollectionManager({
|
|
|
8086
8376
|
children: renameSubmitLabel
|
|
8087
8377
|
}
|
|
8088
8378
|
),
|
|
8089
|
-
/* @__PURE__ */
|
|
8379
|
+
/* @__PURE__ */ jsx28(
|
|
8090
8380
|
"button",
|
|
8091
8381
|
{
|
|
8092
8382
|
type: "button",
|
|
@@ -8098,18 +8388,18 @@ function KeepCollectionManager({
|
|
|
8098
8388
|
)
|
|
8099
8389
|
]
|
|
8100
8390
|
}
|
|
8101
|
-
) : /* @__PURE__ */
|
|
8102
|
-
/* @__PURE__ */
|
|
8103
|
-
/* @__PURE__ */
|
|
8104
|
-
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: [
|
|
8105
8395
|
collection.count,
|
|
8106
8396
|
" ",
|
|
8107
8397
|
collection.count === 1 ? itemLabel : itemsLabel
|
|
8108
8398
|
] }) : null
|
|
8109
8399
|
] }),
|
|
8110
|
-
isPendingDelete && allowDelete ? /* @__PURE__ */
|
|
8111
|
-
/* @__PURE__ */
|
|
8112
|
-
/* @__PURE__ */
|
|
8400
|
+
isPendingDelete && allowDelete ? /* @__PURE__ */ jsxs25("fieldset", { "data-keepkit": "collection-manager-delete-confirmation", children: [
|
|
8401
|
+
/* @__PURE__ */ jsx28("legend", { children: deleteConfirmLabel }),
|
|
8402
|
+
/* @__PURE__ */ jsx28(
|
|
8113
8403
|
"button",
|
|
8114
8404
|
{
|
|
8115
8405
|
type: "button",
|
|
@@ -8119,7 +8409,7 @@ function KeepCollectionManager({
|
|
|
8119
8409
|
children: deleteSubmitLabel
|
|
8120
8410
|
}
|
|
8121
8411
|
),
|
|
8122
|
-
/* @__PURE__ */
|
|
8412
|
+
/* @__PURE__ */ jsx28(
|
|
8123
8413
|
"button",
|
|
8124
8414
|
{
|
|
8125
8415
|
type: "button",
|
|
@@ -8129,8 +8419,8 @@ function KeepCollectionManager({
|
|
|
8129
8419
|
children: cancelLabel
|
|
8130
8420
|
}
|
|
8131
8421
|
)
|
|
8132
|
-
] }) : /* @__PURE__ */
|
|
8133
|
-
allowRename ? /* @__PURE__ */
|
|
8422
|
+
] }) : /* @__PURE__ */ jsxs25("div", { "data-keepkit": "collection-manager-actions", children: [
|
|
8423
|
+
allowRename ? /* @__PURE__ */ jsx28(
|
|
8134
8424
|
"button",
|
|
8135
8425
|
{
|
|
8136
8426
|
type: "button",
|
|
@@ -8141,7 +8431,7 @@ function KeepCollectionManager({
|
|
|
8141
8431
|
children: renameLabel
|
|
8142
8432
|
}
|
|
8143
8433
|
) : null,
|
|
8144
|
-
allowDelete ? /* @__PURE__ */
|
|
8434
|
+
allowDelete ? /* @__PURE__ */ jsx28(
|
|
8145
8435
|
"button",
|
|
8146
8436
|
{
|
|
8147
8437
|
type: "button",
|
|
@@ -8154,7 +8444,7 @@ function KeepCollectionManager({
|
|
|
8154
8444
|
) : null
|
|
8155
8445
|
] })
|
|
8156
8446
|
] }) }, collection.id);
|
|
8157
|
-
}) }) : hasRenderableContent(empty) ? /* @__PURE__ */
|
|
8447
|
+
}) }) : hasRenderableContent(empty) ? /* @__PURE__ */ jsx28("div", { "data-keepkit": "collection-manager-empty", children: empty }) : null
|
|
8158
8448
|
]
|
|
8159
8449
|
}
|
|
8160
8450
|
);
|
|
@@ -8162,10 +8452,10 @@ function KeepCollectionManager({
|
|
|
8162
8452
|
|
|
8163
8453
|
// src/features/collection/KeepInbox.tsx
|
|
8164
8454
|
import { createInboxQuery } from "@keepkit/core/core";
|
|
8165
|
-
import { jsx as
|
|
8455
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
8166
8456
|
function KeepInbox({ query, ...props }) {
|
|
8167
8457
|
const inboxQuery = createInboxQuery({ organization: query?.organization });
|
|
8168
|
-
return /* @__PURE__ */
|
|
8458
|
+
return /* @__PURE__ */ jsx29(
|
|
8169
8459
|
KeepCollection,
|
|
8170
8460
|
{
|
|
8171
8461
|
...props,
|
|
@@ -8176,12 +8466,12 @@ function KeepInbox({ query, ...props }) {
|
|
|
8176
8466
|
}
|
|
8177
8467
|
|
|
8178
8468
|
// src/features/collection/KeepLayout.tsx
|
|
8179
|
-
import { jsx as
|
|
8469
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
8180
8470
|
function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...props }) {
|
|
8181
8471
|
const roving = useRovingTabIndex();
|
|
8182
8472
|
return (
|
|
8183
8473
|
// biome-ignore lint/a11y/noStaticElementInteractions: The group manages keyboard focus for descendant cards.
|
|
8184
|
-
/* @__PURE__ */
|
|
8474
|
+
/* @__PURE__ */ jsx30(
|
|
8185
8475
|
"div",
|
|
8186
8476
|
{
|
|
8187
8477
|
...props,
|
|
@@ -8205,10 +8495,10 @@ function KeepLayout({ layout = "list", children, onKeyDown, onFocusCapture, ...p
|
|
|
8205
8495
|
}
|
|
8206
8496
|
|
|
8207
8497
|
// src/features/editor/KeepNoteEditor.tsx
|
|
8208
|
-
import { isValidElement as
|
|
8498
|
+
import { isValidElement as isValidElement8 } from "react";
|
|
8209
8499
|
|
|
8210
8500
|
// src/features/navigation/KeepShortcutHint.tsx
|
|
8211
|
-
import { jsx as
|
|
8501
|
+
import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
8212
8502
|
function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
8213
8503
|
const keys = typeof shortcut === "string" ? shortcut.split("+") : [...shortcut];
|
|
8214
8504
|
const occurrences = /* @__PURE__ */ new Map();
|
|
@@ -8217,23 +8507,23 @@ function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
|
8217
8507
|
occurrences.set(key, occurrence + 1);
|
|
8218
8508
|
return { id: `${key}-${occurrence}`, value: key };
|
|
8219
8509
|
});
|
|
8220
|
-
return /* @__PURE__ */
|
|
8221
|
-
index > 0 ? /* @__PURE__ */
|
|
8222
|
-
/* @__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() })
|
|
8223
8513
|
] }, key.id)) });
|
|
8224
8514
|
}
|
|
8225
8515
|
|
|
8226
8516
|
// src/features/editor/hooks/useKeepNoteEditor.ts
|
|
8227
8517
|
import { useKeepItem as useKeepItem6 } from "@keepkit/core/react";
|
|
8228
|
-
import { useCallback as useCallback9, useEffect as
|
|
8518
|
+
import { useCallback as useCallback9, useEffect as useEffect17, useRef as useRef17, useState as useState23 } from "react";
|
|
8229
8519
|
function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
8230
8520
|
const itemState = useKeepItem6(item);
|
|
8231
8521
|
const { error, isMutating, item: savedItem, updateNote } = itemState;
|
|
8232
|
-
const [note, setNote] =
|
|
8522
|
+
const [note, setNote] = useState23(item.note ?? "");
|
|
8233
8523
|
const baselineNote = savedItem?.note ?? item.note ?? "";
|
|
8234
8524
|
const isDirty = note !== baselineNote;
|
|
8235
|
-
const lastSavedNoteRef =
|
|
8236
|
-
|
|
8525
|
+
const lastSavedNoteRef = useRef17(void 0);
|
|
8526
|
+
useEffect17(() => setNote(baselineNote), [baselineNote]);
|
|
8237
8527
|
const save = useCallback9(async () => {
|
|
8238
8528
|
const nextNote = note.trim() || void 0;
|
|
8239
8529
|
try {
|
|
@@ -8245,7 +8535,7 @@ function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
|
8245
8535
|
throw cause;
|
|
8246
8536
|
}
|
|
8247
8537
|
}, [note, onSaveError, onSaved, updateNote]);
|
|
8248
|
-
|
|
8538
|
+
useEffect17(() => {
|
|
8249
8539
|
if (!isDirty || debounceMs <= 0 || lastSavedNoteRef.current === note) return;
|
|
8250
8540
|
const timer = window.setTimeout(() => void save().catch(() => void 0), debounceMs);
|
|
8251
8541
|
return () => window.clearTimeout(timer);
|
|
@@ -8280,7 +8570,7 @@ function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
|
8280
8570
|
}
|
|
8281
8571
|
|
|
8282
8572
|
// src/features/editor/KeepNoteEditor.tsx
|
|
8283
|
-
import { Fragment as
|
|
8573
|
+
import { Fragment as Fragment18, jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
8284
8574
|
function KeepNoteEditor({
|
|
8285
8575
|
item,
|
|
8286
8576
|
label,
|
|
@@ -8302,11 +8592,11 @@ function KeepNoteEditor({
|
|
|
8302
8592
|
const showSaveLabel = useUiLabelVisibility("saveNote");
|
|
8303
8593
|
const saveAccessibleLabel = useUiLabel("saveNote");
|
|
8304
8594
|
const { error, isDirty, isSaving, note, setNote } = view.state;
|
|
8305
|
-
const contentChildren = asChild &&
|
|
8306
|
-
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */
|
|
8307
|
-
/* @__PURE__ */
|
|
8595
|
+
const contentChildren = asChild && isValidElement8(children) ? void 0 : children;
|
|
8596
|
+
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? /* @__PURE__ */ jsxs27(Fragment18, { children: [
|
|
8597
|
+
/* @__PURE__ */ jsxs27("label", { children: [
|
|
8308
8598
|
showNoteLabel ? label ?? view.labels.note : null,
|
|
8309
|
-
/* @__PURE__ */
|
|
8599
|
+
/* @__PURE__ */ jsx32(
|
|
8310
8600
|
"textarea",
|
|
8311
8601
|
{
|
|
8312
8602
|
"data-keep-action": "edit-note",
|
|
@@ -8319,7 +8609,7 @@ function KeepNoteEditor({
|
|
|
8319
8609
|
}
|
|
8320
8610
|
)
|
|
8321
8611
|
] }),
|
|
8322
|
-
/* @__PURE__ */
|
|
8612
|
+
/* @__PURE__ */ jsxs27(
|
|
8323
8613
|
"button",
|
|
8324
8614
|
{
|
|
8325
8615
|
type: "submit",
|
|
@@ -8329,13 +8619,13 @@ function KeepNoteEditor({
|
|
|
8329
8619
|
"aria-label": showSaveLabel ? void 0 : saveAccessibleLabel,
|
|
8330
8620
|
children: [
|
|
8331
8621
|
showSaveLabel ? saveLabel ?? view.labels.save : null,
|
|
8332
|
-
showShortcutHint ? /* @__PURE__ */
|
|
8622
|
+
showShortcutHint ? /* @__PURE__ */ jsx32(KeepShortcutHint, { shortcut: "Ctrl+Enter" }) : null
|
|
8333
8623
|
]
|
|
8334
8624
|
}
|
|
8335
8625
|
)
|
|
8336
8626
|
] });
|
|
8337
8627
|
if (!asChild) {
|
|
8338
|
-
return /* @__PURE__ */
|
|
8628
|
+
return /* @__PURE__ */ jsxs27(
|
|
8339
8629
|
"form",
|
|
8340
8630
|
{
|
|
8341
8631
|
...formProps,
|
|
@@ -8348,14 +8638,14 @@ function KeepNoteEditor({
|
|
|
8348
8638
|
"data-disabled": isSaving ? "true" : void 0,
|
|
8349
8639
|
children: [
|
|
8350
8640
|
body,
|
|
8351
|
-
error ? /* @__PURE__ */
|
|
8641
|
+
error ? /* @__PURE__ */ jsx32("p", { role: "alert", children: getErrorMessage(error, view.labels.error) }) : null
|
|
8352
8642
|
]
|
|
8353
8643
|
}
|
|
8354
8644
|
);
|
|
8355
8645
|
}
|
|
8356
8646
|
return renderRoot(
|
|
8357
8647
|
true,
|
|
8358
|
-
|
|
8648
|
+
isValidElement8(children) ? children : void 0,
|
|
8359
8649
|
{
|
|
8360
8650
|
...formProps,
|
|
8361
8651
|
className,
|
|
@@ -8373,12 +8663,12 @@ function KeepNoteEditor({
|
|
|
8373
8663
|
|
|
8374
8664
|
// src/features/editor/hooks/useKeepTagEditor.ts
|
|
8375
8665
|
import { useKeepItem as useKeepItem7 } from "@keepkit/core/react";
|
|
8376
|
-
import { useCallback as useCallback10, useEffect as
|
|
8666
|
+
import { useCallback as useCallback10, useEffect as useEffect18, useState as useState24 } from "react";
|
|
8377
8667
|
function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
8378
8668
|
const itemState = useKeepItem7(item);
|
|
8379
|
-
const [tags, setTags] =
|
|
8380
|
-
const [input, setInput] =
|
|
8381
|
-
|
|
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]);
|
|
8382
8672
|
const save = useCallback10(async () => {
|
|
8383
8673
|
const nextTags = normalizeUiTags(tags);
|
|
8384
8674
|
try {
|
|
@@ -8425,7 +8715,7 @@ function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
|
8425
8715
|
}
|
|
8426
8716
|
|
|
8427
8717
|
// src/features/editor/KeepTagEditor.tsx
|
|
8428
|
-
import { Fragment as
|
|
8718
|
+
import { Fragment as Fragment19, jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
8429
8719
|
function KeepTagEditor({
|
|
8430
8720
|
item,
|
|
8431
8721
|
availableTags = [],
|
|
@@ -8440,10 +8730,10 @@ function KeepTagEditor({
|
|
|
8440
8730
|
const showRemoveLabel = useUiLabelVisibility("remove");
|
|
8441
8731
|
const showApplyLabel = useUiLabelVisibility("applyTags");
|
|
8442
8732
|
const { isSaving, tags } = view.state;
|
|
8443
|
-
const body = render ? render(view.state) : /* @__PURE__ */
|
|
8444
|
-
/* @__PURE__ */
|
|
8733
|
+
const body = render ? render(view.state) : /* @__PURE__ */ jsxs28(Fragment19, { children: [
|
|
8734
|
+
/* @__PURE__ */ jsxs28("label", { children: [
|
|
8445
8735
|
showTagsLabel ? view.labels.tags : null,
|
|
8446
|
-
/* @__PURE__ */
|
|
8736
|
+
/* @__PURE__ */ jsx33(
|
|
8447
8737
|
"input",
|
|
8448
8738
|
{
|
|
8449
8739
|
"data-keep-action": "edit-tags",
|
|
@@ -8455,10 +8745,10 @@ function KeepTagEditor({
|
|
|
8455
8745
|
}
|
|
8456
8746
|
)
|
|
8457
8747
|
] }),
|
|
8458
|
-
availableTags.length > 0 ? /* @__PURE__ */
|
|
8459
|
-
/* @__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: [
|
|
8460
8750
|
tag,
|
|
8461
|
-
/* @__PURE__ */
|
|
8751
|
+
/* @__PURE__ */ jsx33(
|
|
8462
8752
|
"button",
|
|
8463
8753
|
{
|
|
8464
8754
|
type: "button",
|
|
@@ -8469,7 +8759,7 @@ function KeepTagEditor({
|
|
|
8469
8759
|
}
|
|
8470
8760
|
)
|
|
8471
8761
|
] }, tag)) }),
|
|
8472
|
-
/* @__PURE__ */
|
|
8762
|
+
/* @__PURE__ */ jsx33(
|
|
8473
8763
|
"button",
|
|
8474
8764
|
{
|
|
8475
8765
|
type: "submit",
|
|
@@ -8481,7 +8771,7 @@ function KeepTagEditor({
|
|
|
8481
8771
|
}
|
|
8482
8772
|
)
|
|
8483
8773
|
] });
|
|
8484
|
-
return /* @__PURE__ */
|
|
8774
|
+
return /* @__PURE__ */ jsxs28(
|
|
8485
8775
|
"form",
|
|
8486
8776
|
{
|
|
8487
8777
|
...props,
|
|
@@ -8493,7 +8783,7 @@ function KeepTagEditor({
|
|
|
8493
8783
|
"data-disabled": isSaving ? "true" : void 0,
|
|
8494
8784
|
children: [
|
|
8495
8785
|
body,
|
|
8496
|
-
view.error ? /* @__PURE__ */
|
|
8786
|
+
view.error ? /* @__PURE__ */ jsx33("p", { role: "alert", children: getErrorMessage(view.error, view.labels.error) }) : null
|
|
8497
8787
|
]
|
|
8498
8788
|
}
|
|
8499
8789
|
);
|
|
@@ -8502,112 +8792,44 @@ function KeepTagEditor({
|
|
|
8502
8792
|
// src/features/feedback/useKeepToastFeedback.ts
|
|
8503
8793
|
import { useCallback as useCallback11 } from "react";
|
|
8504
8794
|
function useKeepToastFeedback(showToast) {
|
|
8795
|
+
const errorLabel = useUiLabel("error");
|
|
8505
8796
|
return useCallback11(
|
|
8506
8797
|
(event) => {
|
|
8507
8798
|
if (!("undo" in event)) {
|
|
8508
8799
|
showToast(event.message);
|
|
8509
8800
|
return;
|
|
8510
8801
|
}
|
|
8511
|
-
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
|
|
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
|
+
});
|
|
8515
8814
|
}
|
|
8516
|
-
}
|
|
8815
|
+
};
|
|
8816
|
+
showToast(event.message, { action });
|
|
8517
8817
|
},
|
|
8518
|
-
[showToast]
|
|
8818
|
+
[errorLabel, showToast]
|
|
8519
8819
|
);
|
|
8520
8820
|
}
|
|
8521
8821
|
|
|
8522
8822
|
// src/features/navigation/KeepFloatingTour.tsx
|
|
8523
8823
|
import { useKeepList as useKeepList6 } from "@keepkit/core/react";
|
|
8524
|
-
import { useEffect as
|
|
8525
|
-
import { createPortal } from "react-dom";
|
|
8526
|
-
|
|
8527
|
-
// src/foundation/theme.tsx
|
|
8528
|
-
import {
|
|
8529
|
-
createContext as createContext4,
|
|
8530
|
-
isValidElement as isValidElement8,
|
|
8531
|
-
useContext as useContext4
|
|
8532
|
-
} from "react";
|
|
8533
|
-
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
8534
|
-
var keepThemeNames = [
|
|
8535
|
-
"default",
|
|
8536
|
-
"ocean",
|
|
8537
|
-
"forest",
|
|
8538
|
-
"sunset",
|
|
8539
|
-
"lavender",
|
|
8540
|
-
"compact",
|
|
8541
|
-
"minimal",
|
|
8542
|
-
"rounded",
|
|
8543
|
-
"high-contrast",
|
|
8544
|
-
"dark"
|
|
8545
|
-
];
|
|
8546
|
-
var KeepThemeContext = createContext4({});
|
|
8547
|
-
function useKeepTheme() {
|
|
8548
|
-
return useContext4(KeepThemeContext);
|
|
8549
|
-
}
|
|
8550
|
-
function KeepThemeProvider({
|
|
8551
|
-
children,
|
|
8552
|
-
theme = "default",
|
|
8553
|
-
mode = "system",
|
|
8554
|
-
density = "comfortable",
|
|
8555
|
-
radius = "medium",
|
|
8556
|
-
accentColor,
|
|
8557
|
-
highContrast = false,
|
|
8558
|
-
reducedMotion = false,
|
|
8559
|
-
variables,
|
|
8560
|
-
style,
|
|
8561
|
-
className,
|
|
8562
|
-
asChild = false,
|
|
8563
|
-
...props
|
|
8564
|
-
}) {
|
|
8565
|
-
const themeClassName = [
|
|
8566
|
-
"keep-theme",
|
|
8567
|
-
`keep-theme--${theme}`,
|
|
8568
|
-
`keep-theme--${mode}`,
|
|
8569
|
-
`keep-theme--density-${density}`,
|
|
8570
|
-
`keep-theme--radius-${radius}`,
|
|
8571
|
-
className
|
|
8572
|
-
].filter(Boolean).join(" ");
|
|
8573
|
-
const themeStyle = {
|
|
8574
|
-
...style,
|
|
8575
|
-
...accentColor && !highContrast ? { "--keep-accent": accentColor, "--keep-primary": accentColor } : {},
|
|
8576
|
-
...variables
|
|
8577
|
-
};
|
|
8578
|
-
const rootProps = {
|
|
8579
|
-
...props,
|
|
8580
|
-
className: themeClassName,
|
|
8581
|
-
style: themeStyle,
|
|
8582
|
-
"data-keep-theme": theme,
|
|
8583
|
-
"data-theme": theme,
|
|
8584
|
-
"data-mode": mode,
|
|
8585
|
-
"data-density": density,
|
|
8586
|
-
"data-radius": radius,
|
|
8587
|
-
"data-accent-color": accentColor,
|
|
8588
|
-
"data-high-contrast": highContrast ? "true" : void 0,
|
|
8589
|
-
"data-reduced-motion": reducedMotion ? "true" : void 0
|
|
8590
|
-
};
|
|
8591
|
-
const content = asChild ? (() => {
|
|
8592
|
-
if (!isValidElement8(children))
|
|
8593
|
-
throw new Error("KeepThemeProvider with asChild requires a single React element child.");
|
|
8594
|
-
return createSlot(children, rootProps);
|
|
8595
|
-
})() : /* @__PURE__ */ jsx32("div", { ...rootProps, children });
|
|
8596
|
-
return /* @__PURE__ */ jsx32(
|
|
8597
|
-
KeepThemeContext.Provider,
|
|
8598
|
-
{
|
|
8599
|
-
value: { theme, mode, density, radius, accentColor, highContrast, reducedMotion, variables, style },
|
|
8600
|
-
children: content
|
|
8601
|
-
}
|
|
8602
|
-
);
|
|
8603
|
-
}
|
|
8824
|
+
import { useEffect as useEffect21, useMemo as useMemo7, useRef as useRef18, useState as useState26 } from "react";
|
|
8825
|
+
import { createPortal as createPortal2 } from "react-dom";
|
|
8604
8826
|
|
|
8605
8827
|
// src/features/navigation/KeepTourBar.tsx
|
|
8606
8828
|
import { useKeepNavigator } from "@keepkit/core/react";
|
|
8607
|
-
import { useId as
|
|
8829
|
+
import { useId as useId7 } from "react";
|
|
8608
8830
|
|
|
8609
8831
|
// src/features/navigation/hooks/useKeepTourShortcuts.ts
|
|
8610
|
-
import { useEffect as
|
|
8832
|
+
import { useEffect as useEffect19 } from "react";
|
|
8611
8833
|
function useKeepTourShortcuts({
|
|
8612
8834
|
onNext,
|
|
8613
8835
|
onPrev,
|
|
@@ -8618,7 +8840,7 @@ function useKeepTourShortcuts({
|
|
|
8618
8840
|
prevKeys = ["k", "["],
|
|
8619
8841
|
onError
|
|
8620
8842
|
}) {
|
|
8621
|
-
|
|
8843
|
+
useEffect19(() => {
|
|
8622
8844
|
if (!enabled) return;
|
|
8623
8845
|
const handleKeyDown = (event) => {
|
|
8624
8846
|
if (!allowInEditable && isEditableTarget(event.target)) return;
|
|
@@ -8639,7 +8861,7 @@ function isEditableTarget(target) {
|
|
|
8639
8861
|
}
|
|
8640
8862
|
|
|
8641
8863
|
// src/features/navigation/KeepTourBar.tsx
|
|
8642
|
-
import { Fragment as
|
|
8864
|
+
import { Fragment as Fragment20, jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
8643
8865
|
function KeepTourBar({
|
|
8644
8866
|
navigation: providedNavigation,
|
|
8645
8867
|
currentId,
|
|
@@ -8709,9 +8931,9 @@ function KeepTourBar({
|
|
|
8709
8931
|
return resolvedPrev();
|
|
8710
8932
|
}
|
|
8711
8933
|
});
|
|
8712
|
-
const body = /* @__PURE__ */
|
|
8713
|
-
showProgress ? /* @__PURE__ */
|
|
8714
|
-
/* @__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(
|
|
8715
8937
|
TourAction,
|
|
8716
8938
|
{
|
|
8717
8939
|
href: resolvedPrevHref,
|
|
@@ -8719,7 +8941,7 @@ function KeepTourBar({
|
|
|
8719
8941
|
onClick: resolvedPrevHref ? notifyPrevNavigation : resolvedPrev,
|
|
8720
8942
|
"data-keep-action": "tour-prev",
|
|
8721
8943
|
shortcut: showShortcutHint ? shortcutOptions?.prevKeys?.[0] ?? "K" : void 0,
|
|
8722
|
-
preview: navigation.prevItem ? /* @__PURE__ */
|
|
8944
|
+
preview: navigation.prevItem ? /* @__PURE__ */ jsxs29(Fragment20, { children: [
|
|
8723
8945
|
previousLabel,
|
|
8724
8946
|
": ",
|
|
8725
8947
|
getItemTitle(navigation.prevItem)
|
|
@@ -8727,7 +8949,7 @@ function KeepTourBar({
|
|
|
8727
8949
|
children: previousLabel
|
|
8728
8950
|
}
|
|
8729
8951
|
),
|
|
8730
|
-
/* @__PURE__ */
|
|
8952
|
+
/* @__PURE__ */ jsx34(
|
|
8731
8953
|
TourAction,
|
|
8732
8954
|
{
|
|
8733
8955
|
href: resolvedNextHref,
|
|
@@ -8735,7 +8957,7 @@ function KeepTourBar({
|
|
|
8735
8957
|
onClick: resolvedNextHref ? notifyNextNavigation : resolvedNext,
|
|
8736
8958
|
"data-keep-action": "tour-next",
|
|
8737
8959
|
shortcut: showShortcutHint ? shortcutOptions?.nextKeys?.[0] ?? "J" : void 0,
|
|
8738
|
-
preview: navigation.nextItem ? /* @__PURE__ */
|
|
8960
|
+
preview: navigation.nextItem ? /* @__PURE__ */ jsxs29(Fragment20, { children: [
|
|
8739
8961
|
nextItemLabel,
|
|
8740
8962
|
": ",
|
|
8741
8963
|
getItemTitle(navigation.nextItem)
|
|
@@ -8743,7 +8965,7 @@ function KeepTourBar({
|
|
|
8743
8965
|
children: nextItemLabel
|
|
8744
8966
|
}
|
|
8745
8967
|
),
|
|
8746
|
-
resolvedBackHref || onBack ? /* @__PURE__ */
|
|
8968
|
+
resolvedBackHref || onBack ? /* @__PURE__ */ jsx34(TourAction, { href: resolvedBackHref, onClick: onBack, "data-keep-action": "tour-back", children: listLabel }) : null
|
|
8747
8969
|
] });
|
|
8748
8970
|
return renderRoot(
|
|
8749
8971
|
asChild,
|
|
@@ -8754,14 +8976,14 @@ function KeepTourBar({
|
|
|
8754
8976
|
);
|
|
8755
8977
|
}
|
|
8756
8978
|
function TourAction({ href, disabled = false, onClick, children, preview, shortcut, ...props }) {
|
|
8757
|
-
const previewId =
|
|
8758
|
-
const content = /* @__PURE__ */
|
|
8759
|
-
/* @__PURE__ */
|
|
8760
|
-
shortcut ? /* @__PURE__ */
|
|
8761
|
-
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
|
|
8762
8984
|
] });
|
|
8763
8985
|
if (href && !disabled) {
|
|
8764
|
-
return /* @__PURE__ */
|
|
8986
|
+
return /* @__PURE__ */ jsx34(
|
|
8765
8987
|
"a",
|
|
8766
8988
|
{
|
|
8767
8989
|
...props,
|
|
@@ -8773,7 +8995,7 @@ function TourAction({ href, disabled = false, onClick, children, preview, shortc
|
|
|
8773
8995
|
}
|
|
8774
8996
|
);
|
|
8775
8997
|
}
|
|
8776
|
-
return /* @__PURE__ */
|
|
8998
|
+
return /* @__PURE__ */ jsx34(
|
|
8777
8999
|
"button",
|
|
8778
9000
|
{
|
|
8779
9001
|
...props,
|
|
@@ -8794,8 +9016,8 @@ function navigateTo(item, href) {
|
|
|
8794
9016
|
|
|
8795
9017
|
// src/features/navigation/tour-context.tsx
|
|
8796
9018
|
import { useKeepList as useKeepList5 } from "@keepkit/core/react";
|
|
8797
|
-
import { createContext as createContext5, useCallback as useCallback12, useContext as useContext5, useEffect as
|
|
8798
|
-
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";
|
|
8799
9021
|
var SESSION_VERSION = 1;
|
|
8800
9022
|
var KeepTourContext = createContext5(null);
|
|
8801
9023
|
function KeepTourProvider({
|
|
@@ -8806,10 +9028,10 @@ function KeepTourProvider({
|
|
|
8806
9028
|
onNavigate
|
|
8807
9029
|
}) {
|
|
8808
9030
|
const list = useKeepList5();
|
|
8809
|
-
const [tour, setTour] =
|
|
9031
|
+
const [tour, setTour] = useState25(
|
|
8810
9032
|
null
|
|
8811
9033
|
);
|
|
8812
|
-
const [persistenceStatus, setPersistenceStatus] =
|
|
9034
|
+
const [persistenceStatus, setPersistenceStatus] = useState25("persistent");
|
|
8813
9035
|
const itemsById = useMemo6(() => new Map(list.items.map((item) => [item.id, item])), [list.items]);
|
|
8814
9036
|
const readStorage = useCallback12(() => {
|
|
8815
9037
|
try {
|
|
@@ -8845,7 +9067,7 @@ function KeepTourProvider({
|
|
|
8845
9067
|
},
|
|
8846
9068
|
[sessionKey]
|
|
8847
9069
|
);
|
|
8848
|
-
|
|
9070
|
+
useEffect20(() => {
|
|
8849
9071
|
if (!list.isHydrated || list.error || tour) return;
|
|
8850
9072
|
const stored = typeof window === "undefined" ? null : readStorage();
|
|
8851
9073
|
if (!stored) return;
|
|
@@ -8857,7 +9079,7 @@ function KeepTourProvider({
|
|
|
8857
9079
|
const currentId = ids.includes(stored.currentId) ? stored.currentId : ids[0];
|
|
8858
9080
|
setTour({ itemIds: ids, currentId, collapsed: stored.collapsed });
|
|
8859
9081
|
}, [itemsById, list.error, list.isHydrated, readStorage, tour, writeStorage]);
|
|
8860
|
-
|
|
9082
|
+
useEffect20(() => {
|
|
8861
9083
|
if (!tour || list.isLoading || list.error) return;
|
|
8862
9084
|
const ids = tour.itemIds.filter((id) => itemsById.has(id));
|
|
8863
9085
|
if (!ids.length) {
|
|
@@ -8932,23 +9154,23 @@ function KeepTourProvider({
|
|
|
8932
9154
|
}),
|
|
8933
9155
|
[end, getBackHref, getItemHref, move, onNavigate, persistenceStatus, setCurrentId, start, tour]
|
|
8934
9156
|
);
|
|
8935
|
-
|
|
9157
|
+
useEffect20(() => {
|
|
8936
9158
|
if (!tour) return;
|
|
8937
9159
|
if (tour.currentId) writeStorage(tour);
|
|
8938
9160
|
}, [tour, writeStorage]);
|
|
8939
|
-
return /* @__PURE__ */
|
|
9161
|
+
return /* @__PURE__ */ jsx35(KeepTourContext.Provider, { value, children });
|
|
8940
9162
|
}
|
|
8941
9163
|
function useKeepTour(options = {}) {
|
|
8942
9164
|
const context = useContext5(KeepTourContext);
|
|
8943
9165
|
if (!context) throw new Error("useKeepTour must be used within KeepTourProvider.");
|
|
8944
|
-
|
|
9166
|
+
useEffect20(() => {
|
|
8945
9167
|
if (options.currentId && context.active) context.setCurrentId(options.currentId);
|
|
8946
9168
|
}, [context, options.currentId]);
|
|
8947
9169
|
return context;
|
|
8948
9170
|
}
|
|
8949
9171
|
|
|
8950
9172
|
// src/features/navigation/KeepFloatingTour.tsx
|
|
8951
|
-
import { Fragment as
|
|
9173
|
+
import { Fragment as Fragment21, jsx as jsx36, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
8952
9174
|
function KeepFloatingTour({
|
|
8953
9175
|
currentId,
|
|
8954
9176
|
getItemHref,
|
|
@@ -8966,15 +9188,15 @@ function KeepFloatingTour({
|
|
|
8966
9188
|
const tour = useKeepTour({ currentId });
|
|
8967
9189
|
const { items } = useKeepList6();
|
|
8968
9190
|
const theme = useKeepTheme();
|
|
8969
|
-
const [mounted, setMounted] =
|
|
9191
|
+
const [mounted, setMounted] = useState26(false);
|
|
8970
9192
|
const { labels } = useKeepUiLabels();
|
|
8971
9193
|
const collapseLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u6298\u308A\u305F\u305F\u3080" : "Collapse tour";
|
|
8972
9194
|
const expandLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u5C55\u958B" : "Expand tour";
|
|
8973
9195
|
const endLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u7D42\u4E86" : "End tour";
|
|
8974
|
-
const expandRef =
|
|
8975
|
-
const collapseRef =
|
|
8976
|
-
|
|
8977
|
-
|
|
9196
|
+
const expandRef = useRef18(null);
|
|
9197
|
+
const collapseRef = useRef18(null);
|
|
9198
|
+
useEffect21(() => setMounted(true), []);
|
|
9199
|
+
useEffect21(() => {
|
|
8978
9200
|
if (!mounted || !tour.active) return;
|
|
8979
9201
|
const button = tour.collapsed ? expandRef.current : collapseRef.current;
|
|
8980
9202
|
if (button) button.focus();
|
|
@@ -9010,7 +9232,7 @@ function KeepFloatingTour({
|
|
|
9010
9232
|
"--keep-tour-z-index": zIndex,
|
|
9011
9233
|
...style
|
|
9012
9234
|
};
|
|
9013
|
-
const content = tour.collapsed ? /* @__PURE__ */
|
|
9235
|
+
const content = tour.collapsed ? /* @__PURE__ */ jsxs30(
|
|
9014
9236
|
"button",
|
|
9015
9237
|
{
|
|
9016
9238
|
ref: expandRef,
|
|
@@ -9025,8 +9247,8 @@ function KeepFloatingTour({
|
|
|
9025
9247
|
tour.itemIds.length
|
|
9026
9248
|
]
|
|
9027
9249
|
}
|
|
9028
|
-
) : /* @__PURE__ */
|
|
9029
|
-
/* @__PURE__ */
|
|
9250
|
+
) : /* @__PURE__ */ jsxs30(Fragment21, { children: [
|
|
9251
|
+
/* @__PURE__ */ jsx36(
|
|
9030
9252
|
KeepTourBar,
|
|
9031
9253
|
{
|
|
9032
9254
|
className: "keep-floating-tour__bar",
|
|
@@ -9043,7 +9265,7 @@ function KeepFloatingTour({
|
|
|
9043
9265
|
showShortcutHint
|
|
9044
9266
|
}
|
|
9045
9267
|
),
|
|
9046
|
-
/* @__PURE__ */
|
|
9268
|
+
/* @__PURE__ */ jsx36(
|
|
9047
9269
|
"button",
|
|
9048
9270
|
{
|
|
9049
9271
|
ref: collapseRef,
|
|
@@ -9055,7 +9277,7 @@ function KeepFloatingTour({
|
|
|
9055
9277
|
children: "\u2212"
|
|
9056
9278
|
}
|
|
9057
9279
|
),
|
|
9058
|
-
/* @__PURE__ */
|
|
9280
|
+
/* @__PURE__ */ jsx36(
|
|
9059
9281
|
"button",
|
|
9060
9282
|
{
|
|
9061
9283
|
type: "button",
|
|
@@ -9067,8 +9289,8 @@ function KeepFloatingTour({
|
|
|
9067
9289
|
}
|
|
9068
9290
|
)
|
|
9069
9291
|
] });
|
|
9070
|
-
return
|
|
9071
|
-
/* @__PURE__ */
|
|
9292
|
+
return createPortal2(
|
|
9293
|
+
/* @__PURE__ */ jsx36(KeepThemeProvider, { ...theme, children: /* @__PURE__ */ jsx36(
|
|
9072
9294
|
"aside",
|
|
9073
9295
|
{
|
|
9074
9296
|
className: ["keep-floating-tour", `keep-floating-tour--${position}`, className].filter(Boolean).join(" "),
|
|
@@ -9085,8 +9307,8 @@ function KeepFloatingTour({
|
|
|
9085
9307
|
}
|
|
9086
9308
|
|
|
9087
9309
|
// src/features/recovery/KeepFallbackRecovery.tsx
|
|
9088
|
-
import { useEffect as
|
|
9089
|
-
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";
|
|
9090
9312
|
function KeepFallbackRecovery({
|
|
9091
9313
|
recovery,
|
|
9092
9314
|
...props
|
|
@@ -9123,22 +9345,22 @@ function KeepFallbackRecovery({
|
|
|
9123
9345
|
saved: useUiLabel("saved"),
|
|
9124
9346
|
uncategorized: useUiLabel("uncategorized")
|
|
9125
9347
|
};
|
|
9126
|
-
const [state, setState] =
|
|
9127
|
-
const [storedInspection, setInspection] =
|
|
9128
|
-
const [selections, setSelections] =
|
|
9129
|
-
const [reviewed, setReviewed] =
|
|
9130
|
-
const [pending, setPending] =
|
|
9131
|
-
const [error, setError] =
|
|
9132
|
-
const [result, setResult] =
|
|
9133
|
-
const pendingRecoveries =
|
|
9134
|
-
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);
|
|
9135
9357
|
activeRecovery.current = recovery;
|
|
9136
|
-
const inspectionRecovery =
|
|
9358
|
+
const inspectionRecovery = useRef19(recovery);
|
|
9137
9359
|
const inspection = inspectionRecovery.current === recovery ? storedInspection : null;
|
|
9138
|
-
const compareRef =
|
|
9139
|
-
const firstChoiceRef =
|
|
9140
|
-
const applyRef =
|
|
9141
|
-
|
|
9360
|
+
const compareRef = useRef19(null);
|
|
9361
|
+
const firstChoiceRef = useRef19(null);
|
|
9362
|
+
const applyRef = useRef19(null);
|
|
9363
|
+
useEffect22(() => {
|
|
9142
9364
|
setPending(pendingRecoveries.current.has(recovery));
|
|
9143
9365
|
setState(recovery.getState());
|
|
9144
9366
|
setInspection(null);
|
|
@@ -9213,7 +9435,7 @@ function KeepFallbackRecovery({
|
|
|
9213
9435
|
if (activeRecovery.current !== recovery) return;
|
|
9214
9436
|
setResult(next.status);
|
|
9215
9437
|
});
|
|
9216
|
-
|
|
9438
|
+
useEffect22(() => {
|
|
9217
9439
|
if (pending) return;
|
|
9218
9440
|
if (reviewed) applyRef.current?.focus();
|
|
9219
9441
|
else if (inspection) firstChoiceRef.current?.focus();
|
|
@@ -9250,7 +9472,7 @@ function KeepFallbackRecovery({
|
|
|
9250
9472
|
const retainedBackupJson = [
|
|
9251
9473
|
...new Set((inspection?.retainedBackups ?? []).map((backup) => JSON.stringify(backup, null, 2)))
|
|
9252
9474
|
];
|
|
9253
|
-
return /* @__PURE__ */
|
|
9475
|
+
return /* @__PURE__ */ jsxs31(
|
|
9254
9476
|
"section",
|
|
9255
9477
|
{
|
|
9256
9478
|
...props,
|
|
@@ -9258,17 +9480,17 @@ function KeepFallbackRecovery({
|
|
|
9258
9480
|
"aria-label": props["aria-label"] ?? labels.fallbackRecovery,
|
|
9259
9481
|
"aria-busy": pending,
|
|
9260
9482
|
children: [
|
|
9261
|
-
/* @__PURE__ */
|
|
9262
|
-
/* @__PURE__ */
|
|
9483
|
+
/* @__PURE__ */ jsx37("h2", { children: labels.fallbackRecovery }),
|
|
9484
|
+
/* @__PURE__ */ jsxs31("p", { role: "status", "aria-live": "polite", children: [
|
|
9263
9485
|
state.source === "primary" ? labels.recoveryPrimary : labels.recoveryFallback,
|
|
9264
9486
|
":",
|
|
9265
9487
|
" ",
|
|
9266
9488
|
state.pendingOperations > 0 ? labels.recoveryPending : labels.recoveryReady
|
|
9267
9489
|
] }),
|
|
9268
|
-
state.capturedAt !== void 0 ? /* @__PURE__ */
|
|
9269
|
-
state.snapshotStale ? /* @__PURE__ */
|
|
9270
|
-
state.issue ? /* @__PURE__ */
|
|
9271
|
-
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(
|
|
9272
9494
|
"button",
|
|
9273
9495
|
{
|
|
9274
9496
|
ref: compareRef,
|
|
@@ -9277,13 +9499,13 @@ function KeepFallbackRecovery({
|
|
|
9277
9499
|
onClick: () => void compare(),
|
|
9278
9500
|
children: labels.inspectRecovery
|
|
9279
9501
|
}
|
|
9280
|
-
) : /* @__PURE__ */
|
|
9281
|
-
recovery.retry && state.pendingOperations > 0 ? /* @__PURE__ */
|
|
9282
|
-
result ? /* @__PURE__ */
|
|
9283
|
-
error ? /* @__PURE__ */
|
|
9284
|
-
inspection ? /* @__PURE__ */
|
|
9285
|
-
retainedBackupJson.length > 0 ? /* @__PURE__ */
|
|
9286
|
-
/* @__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: [
|
|
9287
9509
|
labels.saved,
|
|
9288
9510
|
": ",
|
|
9289
9511
|
labels.recoveryBackups,
|
|
@@ -9291,14 +9513,14 @@ function KeepFallbackRecovery({
|
|
|
9291
9513
|
retainedBackupJson.length,
|
|
9292
9514
|
")"
|
|
9293
9515
|
] }),
|
|
9294
|
-
retainedBackupJson.map((json) => /* @__PURE__ */
|
|
9516
|
+
retainedBackupJson.map((json) => /* @__PURE__ */ jsx37("pre", { children: json }, json))
|
|
9295
9517
|
] }) : null,
|
|
9296
|
-
/* @__PURE__ */
|
|
9297
|
-
/* @__PURE__ */
|
|
9298
|
-
inspection.rows.map((row, index) => /* @__PURE__ */
|
|
9299
|
-
/* @__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: [
|
|
9300
9522
|
rowLabel(row),
|
|
9301
|
-
/* @__PURE__ */
|
|
9523
|
+
/* @__PURE__ */ jsxs31(
|
|
9302
9524
|
"select",
|
|
9303
9525
|
{
|
|
9304
9526
|
ref: index === 0 ? firstChoiceRef : void 0,
|
|
@@ -9308,32 +9530,32 @@ function KeepFallbackRecovery({
|
|
|
9308
9530
|
setReviewed(false);
|
|
9309
9531
|
},
|
|
9310
9532
|
children: [
|
|
9311
|
-
/* @__PURE__ */
|
|
9312
|
-
row.candidates.map((candidate) => /* @__PURE__ */
|
|
9313
|
-
/* @__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 })
|
|
9314
9536
|
]
|
|
9315
9537
|
}
|
|
9316
9538
|
)
|
|
9317
9539
|
] }),
|
|
9318
|
-
row.candidates.map((candidate) => /* @__PURE__ */
|
|
9319
|
-
/* @__PURE__ */
|
|
9320
|
-
/* @__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) })
|
|
9321
9543
|
] }, candidate.source))
|
|
9322
9544
|
] }, row.key))
|
|
9323
9545
|
] }),
|
|
9324
|
-
/* @__PURE__ */
|
|
9325
|
-
inspection.issues.length > 0 ? /* @__PURE__ */
|
|
9326
|
-
/* @__PURE__ */
|
|
9327
|
-
/* @__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)) })
|
|
9328
9550
|
] }) : null,
|
|
9329
|
-
reviewed ? /* @__PURE__ */
|
|
9330
|
-
inspection.operations.length > 0 ? /* @__PURE__ */
|
|
9331
|
-
/* @__PURE__ */
|
|
9332
|
-
/* @__PURE__ */
|
|
9333
|
-
/* @__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) })
|
|
9334
9556
|
] })
|
|
9335
9557
|
] }) : null,
|
|
9336
|
-
/* @__PURE__ */
|
|
9558
|
+
/* @__PURE__ */ jsx37(
|
|
9337
9559
|
"button",
|
|
9338
9560
|
{
|
|
9339
9561
|
ref: applyRef,
|
|
@@ -9343,7 +9565,7 @@ function KeepFallbackRecovery({
|
|
|
9343
9565
|
children: labels.recoveryApply
|
|
9344
9566
|
}
|
|
9345
9567
|
),
|
|
9346
|
-
/* @__PURE__ */
|
|
9568
|
+
/* @__PURE__ */ jsx37(
|
|
9347
9569
|
"button",
|
|
9348
9570
|
{
|
|
9349
9571
|
type: "button",
|
|
@@ -9364,8 +9586,8 @@ function KeepFallbackRecovery({
|
|
|
9364
9586
|
|
|
9365
9587
|
// src/features/rediscovery/KeepRediscovery.tsx
|
|
9366
9588
|
import { createRediscoveryQuery } from "@keepkit/core/core";
|
|
9367
|
-
import { useId as
|
|
9368
|
-
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";
|
|
9369
9591
|
function KeepRediscovery({
|
|
9370
9592
|
strategy,
|
|
9371
9593
|
inactiveForMs,
|
|
@@ -9380,7 +9602,7 @@ function KeepRediscovery({
|
|
|
9380
9602
|
}),
|
|
9381
9603
|
[inactiveForMs, limit, strategy]
|
|
9382
9604
|
);
|
|
9383
|
-
return /* @__PURE__ */
|
|
9605
|
+
return /* @__PURE__ */ jsx38(
|
|
9384
9606
|
KeepList,
|
|
9385
9607
|
{
|
|
9386
9608
|
...props,
|
|
@@ -9400,18 +9622,18 @@ function KeepRediscoveryPanel({
|
|
|
9400
9622
|
strategy,
|
|
9401
9623
|
...props
|
|
9402
9624
|
}) {
|
|
9403
|
-
const headingId =
|
|
9625
|
+
const headingId = useId8();
|
|
9404
9626
|
const { className, ...rediscoveryProps } = props;
|
|
9405
9627
|
const neverOpenedLabel = useUiLabel("activityNeverOpened");
|
|
9406
9628
|
const inactiveLabel = useUiLabel("activityInactiveFor");
|
|
9407
9629
|
const openedLabel = useUiLabel("activityOpened");
|
|
9408
9630
|
const strategyLabel = strategy === "never-opened" ? neverOpenedLabel : strategy === "forgotten" ? inactiveLabel : openedLabel;
|
|
9409
|
-
return /* @__PURE__ */
|
|
9410
|
-
/* @__PURE__ */
|
|
9411
|
-
/* @__PURE__ */
|
|
9412
|
-
/* @__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 })
|
|
9413
9635
|
] }),
|
|
9414
|
-
/* @__PURE__ */
|
|
9636
|
+
/* @__PURE__ */ jsx38(KeepRediscovery, { ...rediscoveryProps, strategy })
|
|
9415
9637
|
] });
|
|
9416
9638
|
}
|
|
9417
9639
|
|
|
@@ -9419,10 +9641,10 @@ function KeepRediscoveryPanel({
|
|
|
9419
9641
|
import { isValidElement as isValidElement9 } from "react";
|
|
9420
9642
|
|
|
9421
9643
|
// src/features/status/hooks/useStatusViews.ts
|
|
9422
|
-
import { useKeepContext as
|
|
9423
|
-
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";
|
|
9424
9646
|
function useKeepStatus(status) {
|
|
9425
|
-
const context =
|
|
9647
|
+
const context = useKeepContext8();
|
|
9426
9648
|
const resolvedStatus = status ?? getDerivedStatus(context);
|
|
9427
9649
|
const state = {
|
|
9428
9650
|
status: resolvedStatus,
|
|
@@ -9433,13 +9655,13 @@ function useKeepStatus(status) {
|
|
|
9433
9655
|
return { state, defaultLabel: useUiLabel(getStatusLabelKey3(resolvedStatus)) };
|
|
9434
9656
|
}
|
|
9435
9657
|
function useKeepAnnouncements(messages) {
|
|
9436
|
-
const context =
|
|
9658
|
+
const context = useKeepContext8();
|
|
9437
9659
|
const savedMessage = useUiLabel("savedMessage", messages?.save);
|
|
9438
9660
|
const removedMessage = useUiLabel("removedMessage", messages?.remove);
|
|
9439
9661
|
const noteSavedMessage = useUiLabel("noteSavedMessage", messages?.note);
|
|
9440
|
-
const [message, setMessage] =
|
|
9441
|
-
const lastChangeRef =
|
|
9442
|
-
|
|
9662
|
+
const [message, setMessage] = useState28("");
|
|
9663
|
+
const lastChangeRef = useRef20(void 0);
|
|
9664
|
+
useEffect23(() => {
|
|
9443
9665
|
const change = context.lastChange;
|
|
9444
9666
|
if (!change || change === lastChangeRef.current) return;
|
|
9445
9667
|
lastChangeRef.current = change;
|
|
@@ -9467,7 +9689,7 @@ function getStatusLabelKey3(status) {
|
|
|
9467
9689
|
}
|
|
9468
9690
|
|
|
9469
9691
|
// src/features/status/status.tsx
|
|
9470
|
-
import { jsx as
|
|
9692
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
9471
9693
|
function KeepStatus({
|
|
9472
9694
|
status,
|
|
9473
9695
|
labels,
|
|
@@ -9499,7 +9721,7 @@ function KeepStatus({
|
|
|
9499
9721
|
}
|
|
9500
9722
|
function KeepAnnouncements({ messages, ...props }) {
|
|
9501
9723
|
const message = useKeepAnnouncements(messages);
|
|
9502
|
-
return /* @__PURE__ */
|
|
9724
|
+
return /* @__PURE__ */ jsx39(
|
|
9503
9725
|
"div",
|
|
9504
9726
|
{
|
|
9505
9727
|
...props,
|
|
@@ -9515,15 +9737,15 @@ function KeepAnnouncements({ messages, ...props }) {
|
|
|
9515
9737
|
var KeepAnnouncer = KeepAnnouncements;
|
|
9516
9738
|
|
|
9517
9739
|
// src/features/sync/hooks/useKeepSyncFeedback.ts
|
|
9518
|
-
import { useKeepContext as
|
|
9519
|
-
import { useEffect as
|
|
9740
|
+
import { useKeepContext as useKeepContext9 } from "@keepkit/core/react";
|
|
9741
|
+
import { useEffect as useEffect24, useRef as useRef21 } from "react";
|
|
9520
9742
|
function useKeepSyncFeedback() {
|
|
9521
|
-
const { syncState } =
|
|
9743
|
+
const { syncState } = useKeepContext9();
|
|
9522
9744
|
const emitFeedback = useKeepUiFeedback();
|
|
9523
9745
|
const completedMessage = useUiLabel("syncSynced");
|
|
9524
9746
|
const failedMessage = useUiLabel("syncFailedMessage");
|
|
9525
|
-
const previousStatus =
|
|
9526
|
-
|
|
9747
|
+
const previousStatus = useRef21("idle");
|
|
9748
|
+
useEffect24(() => {
|
|
9527
9749
|
const previous = previousStatus.current;
|
|
9528
9750
|
previousStatus.current = syncState.status;
|
|
9529
9751
|
if (syncState.status === "error" && previous !== "error") {
|
|
@@ -9543,17 +9765,17 @@ function KeepSyncFeedbackObserver() {
|
|
|
9543
9765
|
}
|
|
9544
9766
|
|
|
9545
9767
|
// src/features/sync/hooks/useKeepSyncRecoveryDialog.ts
|
|
9546
|
-
import { useKeepContext as
|
|
9547
|
-
import { useEffect as
|
|
9768
|
+
import { useKeepContext as useKeepContext10 } from "@keepkit/core/react";
|
|
9769
|
+
import { useEffect as useEffect25, useState as useState29 } from "react";
|
|
9548
9770
|
function useKeepSyncRecoveryDialog(options) {
|
|
9549
9771
|
const { open, onOpenChange, conflicts, onManualMerge } = options;
|
|
9550
|
-
const context =
|
|
9772
|
+
const context = useKeepContext10();
|
|
9551
9773
|
const conflictList = conflicts ?? context.syncState.conflicts ?? [];
|
|
9552
9774
|
const hasRecovery = conflictList.length > 0 || context.syncState.status === "error" || Boolean(context.error);
|
|
9553
|
-
const [dismissed, setDismissed] =
|
|
9554
|
-
const [busyId, setBusyId] =
|
|
9555
|
-
const [error, setError] =
|
|
9556
|
-
|
|
9775
|
+
const [dismissed, setDismissed] = useState29(false);
|
|
9776
|
+
const [busyId, setBusyId] = useState29();
|
|
9777
|
+
const [error, setError] = useState29();
|
|
9778
|
+
useEffect25(() => {
|
|
9557
9779
|
if (hasRecovery) setDismissed(false);
|
|
9558
9780
|
}, [hasRecovery]);
|
|
9559
9781
|
return {
|
|
@@ -9598,7 +9820,7 @@ function useKeepSyncRecoveryDialog(options) {
|
|
|
9598
9820
|
}
|
|
9599
9821
|
|
|
9600
9822
|
// src/features/sync/KeepSyncRecoveryDialog.tsx
|
|
9601
|
-
import { jsx as
|
|
9823
|
+
import { jsx as jsx40, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
9602
9824
|
function KeepSyncRecoveryDialog({
|
|
9603
9825
|
open,
|
|
9604
9826
|
onOpenChange,
|
|
@@ -9613,7 +9835,7 @@ function KeepSyncRecoveryDialog({
|
|
|
9613
9835
|
}) {
|
|
9614
9836
|
const view = useKeepSyncRecoveryDialog({ open, onOpenChange, conflicts, onManualMerge });
|
|
9615
9837
|
if (!view.isOpen) return null;
|
|
9616
|
-
return /* @__PURE__ */
|
|
9838
|
+
return /* @__PURE__ */ jsxs33(
|
|
9617
9839
|
"section",
|
|
9618
9840
|
{
|
|
9619
9841
|
...props,
|
|
@@ -9627,17 +9849,17 @@ function KeepSyncRecoveryDialog({
|
|
|
9627
9849
|
"data-state": view.conflictList.length > 0 ? "conflict" : "error",
|
|
9628
9850
|
"data-loading": view.busyId !== void 0 ? "true" : void 0,
|
|
9629
9851
|
children: [
|
|
9630
|
-
/* @__PURE__ */
|
|
9631
|
-
/* @__PURE__ */
|
|
9632
|
-
/* @__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 })
|
|
9633
9855
|
] }),
|
|
9634
9856
|
children,
|
|
9635
|
-
view.conflictList.length > 0 ? /* @__PURE__ */
|
|
9636
|
-
/* @__PURE__ */
|
|
9637
|
-
view.conflictList.map((conflict) => /* @__PURE__ */
|
|
9638
|
-
/* @__PURE__ */
|
|
9639
|
-
/* @__PURE__ */
|
|
9640
|
-
/* @__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(
|
|
9641
9863
|
ConflictPreview,
|
|
9642
9864
|
{
|
|
9643
9865
|
item: conflict.operation.item,
|
|
@@ -9647,7 +9869,7 @@ function KeepSyncRecoveryDialog({
|
|
|
9647
9869
|
side: "local"
|
|
9648
9870
|
}
|
|
9649
9871
|
),
|
|
9650
|
-
/* @__PURE__ */
|
|
9872
|
+
/* @__PURE__ */ jsx40(
|
|
9651
9873
|
ConflictPreview,
|
|
9652
9874
|
{
|
|
9653
9875
|
item: conflict.remote,
|
|
@@ -9658,8 +9880,8 @@ function KeepSyncRecoveryDialog({
|
|
|
9658
9880
|
}
|
|
9659
9881
|
)
|
|
9660
9882
|
] }),
|
|
9661
|
-
/* @__PURE__ */
|
|
9662
|
-
/* @__PURE__ */
|
|
9883
|
+
/* @__PURE__ */ jsxs33("div", { children: [
|
|
9884
|
+
/* @__PURE__ */ jsx40(
|
|
9663
9885
|
"button",
|
|
9664
9886
|
{
|
|
9665
9887
|
type: "button",
|
|
@@ -9669,7 +9891,7 @@ function KeepSyncRecoveryDialog({
|
|
|
9669
9891
|
children: view.labels.keepLocal
|
|
9670
9892
|
}
|
|
9671
9893
|
),
|
|
9672
|
-
/* @__PURE__ */
|
|
9894
|
+
/* @__PURE__ */ jsx40(
|
|
9673
9895
|
"button",
|
|
9674
9896
|
{
|
|
9675
9897
|
type: "button",
|
|
@@ -9679,7 +9901,7 @@ function KeepSyncRecoveryDialog({
|
|
|
9679
9901
|
children: view.labels.useServer
|
|
9680
9902
|
}
|
|
9681
9903
|
),
|
|
9682
|
-
/* @__PURE__ */
|
|
9904
|
+
/* @__PURE__ */ jsx40(
|
|
9683
9905
|
"button",
|
|
9684
9906
|
{
|
|
9685
9907
|
type: "button",
|
|
@@ -9692,12 +9914,12 @@ function KeepSyncRecoveryDialog({
|
|
|
9692
9914
|
] })
|
|
9693
9915
|
] }, conflict.id))
|
|
9694
9916
|
] }) : null,
|
|
9695
|
-
view.showBackupRecovery ? /* @__PURE__ */
|
|
9696
|
-
/* @__PURE__ */
|
|
9697
|
-
/* @__PURE__ */
|
|
9698
|
-
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)
|
|
9699
9921
|
] }) : null,
|
|
9700
|
-
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
|
|
9701
9923
|
]
|
|
9702
9924
|
}
|
|
9703
9925
|
);
|
|
@@ -9709,16 +9931,16 @@ function ConflictPreview({
|
|
|
9709
9931
|
noteLabel,
|
|
9710
9932
|
side
|
|
9711
9933
|
}) {
|
|
9712
|
-
return /* @__PURE__ */
|
|
9713
|
-
/* @__PURE__ */
|
|
9714
|
-
/* @__PURE__ */
|
|
9715
|
-
/* @__PURE__ */
|
|
9716
|
-
/* @__PURE__ */
|
|
9717
|
-
/* @__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" })
|
|
9718
9940
|
] }),
|
|
9719
|
-
/* @__PURE__ */
|
|
9720
|
-
/* @__PURE__ */
|
|
9721
|
-
/* @__PURE__ */
|
|
9941
|
+
/* @__PURE__ */ jsxs33("div", { children: [
|
|
9942
|
+
/* @__PURE__ */ jsx40("dt", { children: noteLabel }),
|
|
9943
|
+
/* @__PURE__ */ jsx40("dd", { children: item?.note || "\u2014" })
|
|
9722
9944
|
] })
|
|
9723
9945
|
] })
|
|
9724
9946
|
] });
|
|
@@ -9728,9 +9950,9 @@ function formatConflictDate(timestamp) {
|
|
|
9728
9950
|
}
|
|
9729
9951
|
|
|
9730
9952
|
// src/features/sync/hooks/useKeepSyncStatusBanner.ts
|
|
9731
|
-
import { useKeepContext as
|
|
9953
|
+
import { useKeepContext as useKeepContext11 } from "@keepkit/core/react";
|
|
9732
9954
|
function useKeepSyncStatusBanner({ onRetry, children }) {
|
|
9733
|
-
const context =
|
|
9955
|
+
const context = useKeepContext11();
|
|
9734
9956
|
const retryLabel = useUiLabel("retrySync");
|
|
9735
9957
|
const resolveLabel = useUiLabel("resolveSync");
|
|
9736
9958
|
const conflictLabel = useUiLabel("syncConflict");
|
|
@@ -9760,7 +9982,7 @@ function useKeepSyncStatusBanner({ onRetry, children }) {
|
|
|
9760
9982
|
}
|
|
9761
9983
|
|
|
9762
9984
|
// src/features/sync/KeepSyncStatusBanner.tsx
|
|
9763
|
-
import { jsx as
|
|
9985
|
+
import { jsx as jsx41, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
9764
9986
|
function KeepSyncStatusBanner({
|
|
9765
9987
|
onRetry,
|
|
9766
9988
|
onResolveConflicts,
|
|
@@ -9772,7 +9994,7 @@ function KeepSyncStatusBanner({
|
|
|
9772
9994
|
const showRetryLabel = useUiLabelVisibility("retrySync");
|
|
9773
9995
|
const showResolveLabel = useUiLabelVisibility("resolveSync");
|
|
9774
9996
|
if (view.status === "idle" && !view.hasConflicts) return null;
|
|
9775
|
-
return /* @__PURE__ */
|
|
9997
|
+
return /* @__PURE__ */ jsxs34(
|
|
9776
9998
|
"aside",
|
|
9777
9999
|
{
|
|
9778
10000
|
...props,
|
|
@@ -9782,8 +10004,8 @@ function KeepSyncStatusBanner({
|
|
|
9782
10004
|
"data-keepkit": "sync-status",
|
|
9783
10005
|
"data-state": view.status,
|
|
9784
10006
|
children: [
|
|
9785
|
-
/* @__PURE__ */
|
|
9786
|
-
view.showRetry ? /* @__PURE__ */
|
|
10007
|
+
/* @__PURE__ */ jsx41("p", { children: view.message }),
|
|
10008
|
+
view.showRetry ? /* @__PURE__ */ jsx41(
|
|
9787
10009
|
"button",
|
|
9788
10010
|
{
|
|
9789
10011
|
type: "button",
|
|
@@ -9794,7 +10016,7 @@ function KeepSyncStatusBanner({
|
|
|
9794
10016
|
children: showRetryLabel ? view.retryLabel : null
|
|
9795
10017
|
}
|
|
9796
10018
|
) : null,
|
|
9797
|
-
view.hasConflicts ? /* @__PURE__ */
|
|
10019
|
+
view.hasConflicts ? /* @__PURE__ */ jsx41(
|
|
9798
10020
|
"button",
|
|
9799
10021
|
{
|
|
9800
10022
|
type: "button",
|
|
@@ -9814,7 +10036,7 @@ function KeepSyncStatusBanner({
|
|
|
9814
10036
|
import { createInboxQuery as createInboxQuery2 } from "@keepkit/core/core";
|
|
9815
10037
|
|
|
9816
10038
|
// src/features/workspace/hooks/useKeepWorkspace.ts
|
|
9817
|
-
import { useCallback as useCallback13, useState as
|
|
10039
|
+
import { useCallback as useCallback13, useState as useState30 } from "react";
|
|
9818
10040
|
var PRESET_MODULES = {
|
|
9819
10041
|
basic: {
|
|
9820
10042
|
syncStatus: false,
|
|
@@ -9866,7 +10088,7 @@ function useKeepWorkspace({
|
|
|
9866
10088
|
onRecoveryOpenChange,
|
|
9867
10089
|
onResolveConflicts
|
|
9868
10090
|
}) {
|
|
9869
|
-
const [internalRecoveryOpen, setInternalRecoveryOpen] =
|
|
10091
|
+
const [internalRecoveryOpen, setInternalRecoveryOpen] = useState30(false);
|
|
9870
10092
|
const resolvedModules = { ...PRESET_MODULES[preset], ...modules };
|
|
9871
10093
|
const setRecoveryOpen = useCallback13(
|
|
9872
10094
|
(open) => {
|
|
@@ -9890,7 +10112,7 @@ function useKeepWorkspace({
|
|
|
9890
10112
|
}
|
|
9891
10113
|
|
|
9892
10114
|
// src/features/workspace/KeepWorkspace.tsx
|
|
9893
|
-
import { jsx as
|
|
10115
|
+
import { jsx as jsx42, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
9894
10116
|
function KeepWorkspace({
|
|
9895
10117
|
preset = "standard",
|
|
9896
10118
|
modules,
|
|
@@ -9938,27 +10160,27 @@ function KeepWorkspace({
|
|
|
9938
10160
|
if (!structuredRegions) return content;
|
|
9939
10161
|
if (!hasRenderableContent(content)) return null;
|
|
9940
10162
|
const resolvedSurface = typeof surface === "string" ? surface : surface[name] ?? "plain";
|
|
9941
|
-
return /* @__PURE__ */
|
|
10163
|
+
return /* @__PURE__ */ jsx42("div", { "data-keepkit": "workspace-region", "data-region": name, "data-surface": resolvedSurface, children: content });
|
|
9942
10164
|
};
|
|
9943
10165
|
const before = resolveOptionalSlot(slots?.before, state);
|
|
9944
10166
|
const syncStatus = view.modules.syncStatus ? resolveSlot(
|
|
9945
10167
|
slots?.syncStatus,
|
|
9946
|
-
/* @__PURE__ */
|
|
10168
|
+
/* @__PURE__ */ jsx42(KeepSyncStatusBanner, { ...syncStatusProps, onResolveConflicts: view.openRecovery }),
|
|
9947
10169
|
state
|
|
9948
10170
|
) : null;
|
|
9949
|
-
const collection = resolveSlot(slots?.collection, /* @__PURE__ */
|
|
10171
|
+
const collection = resolveSlot(slots?.collection, /* @__PURE__ */ jsx42(KeepCollection, { ...resolvedCollectionProps }), state);
|
|
9950
10172
|
const actions = view.modules.backup || view.modules.stalePrune ? resolveSlot(
|
|
9951
10173
|
slots?.actions,
|
|
9952
|
-
/* @__PURE__ */
|
|
9953
|
-
view.modules.stalePrune ? /* @__PURE__ */
|
|
9954
|
-
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
|
|
9955
10177
|
] }),
|
|
9956
10178
|
state
|
|
9957
10179
|
) : null;
|
|
9958
|
-
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */
|
|
10180
|
+
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */ jsx42(KeepUndo, { ...undoProps }), state) : null;
|
|
9959
10181
|
const recovery = view.modules.recovery ? resolveSlot(
|
|
9960
10182
|
slots?.recovery,
|
|
9961
|
-
/* @__PURE__ */
|
|
10183
|
+
/* @__PURE__ */ jsx42(
|
|
9962
10184
|
KeepSyncRecoveryDialog,
|
|
9963
10185
|
{
|
|
9964
10186
|
...recoveryProps,
|
|
@@ -9970,7 +10192,7 @@ function KeepWorkspace({
|
|
|
9970
10192
|
) : null;
|
|
9971
10193
|
const additionalContent = resolveOptionalSlot(children, state);
|
|
9972
10194
|
const after = resolveOptionalSlot(slots?.after, state);
|
|
9973
|
-
return /* @__PURE__ */
|
|
10195
|
+
return /* @__PURE__ */ jsxs35(
|
|
9974
10196
|
"section",
|
|
9975
10197
|
{
|
|
9976
10198
|
...props,
|
|
@@ -10007,7 +10229,7 @@ import {
|
|
|
10007
10229
|
KeepErrorBoundary as KeepErrorBoundary3,
|
|
10008
10230
|
KeepProvider,
|
|
10009
10231
|
useKeepCollections as useKeepCollections8,
|
|
10010
|
-
useKeepContext as
|
|
10232
|
+
useKeepContext as useKeepContext12,
|
|
10011
10233
|
useKeepItem as useKeepItem8,
|
|
10012
10234
|
useKeepList as useKeepList7,
|
|
10013
10235
|
useKeepNavigator as useKeepNavigator2,
|
|
@@ -10024,7 +10246,7 @@ import {
|
|
|
10024
10246
|
LocalStorageSyncQueueAdapter,
|
|
10025
10247
|
SyncStorageAdapter
|
|
10026
10248
|
} from "@keepkit/core/storage";
|
|
10027
|
-
import { jsx as
|
|
10249
|
+
import { jsx as jsx43, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
10028
10250
|
function KeepKitProvider({
|
|
10029
10251
|
labels,
|
|
10030
10252
|
labelOptions,
|
|
@@ -10046,7 +10268,7 @@ function KeepKitProvider({
|
|
|
10046
10268
|
children,
|
|
10047
10269
|
...providerProps
|
|
10048
10270
|
}) {
|
|
10049
|
-
return /* @__PURE__ */
|
|
10271
|
+
return /* @__PURE__ */ jsx43(
|
|
10050
10272
|
KeepUiProvider,
|
|
10051
10273
|
{
|
|
10052
10274
|
labels,
|
|
@@ -10054,7 +10276,7 @@ function KeepKitProvider({
|
|
|
10054
10276
|
locale,
|
|
10055
10277
|
labelResolver,
|
|
10056
10278
|
onFeedback,
|
|
10057
|
-
children: /* @__PURE__ */
|
|
10279
|
+
children: /* @__PURE__ */ jsx43(
|
|
10058
10280
|
KeepThemeProvider,
|
|
10059
10281
|
{
|
|
10060
10282
|
theme,
|
|
@@ -10068,10 +10290,10 @@ function KeepKitProvider({
|
|
|
10068
10290
|
className: themeClassName,
|
|
10069
10291
|
style: themeStyle,
|
|
10070
10292
|
asChild: themeAsChild,
|
|
10071
|
-
children: /* @__PURE__ */
|
|
10072
|
-
/* @__PURE__ */
|
|
10073
|
-
/* @__PURE__ */
|
|
10074
|
-
/* @__PURE__ */
|
|
10293
|
+
children: /* @__PURE__ */ jsxs36(CoreKeepProvider, { ...providerProps, children: [
|
|
10294
|
+
/* @__PURE__ */ jsx43(KeepSyncFeedbackObserver, {}),
|
|
10295
|
+
/* @__PURE__ */ jsx43(KeepTourProvider, { ...tour, children }),
|
|
10296
|
+
/* @__PURE__ */ jsx43(KeepAnnouncements, {})
|
|
10075
10297
|
] })
|
|
10076
10298
|
}
|
|
10077
10299
|
)
|
|
@@ -10102,7 +10324,7 @@ function createKeepKit(options = {}) {
|
|
|
10102
10324
|
} = options;
|
|
10103
10325
|
const coreKit = createCoreKeepKit(coreOptions);
|
|
10104
10326
|
return {
|
|
10105
|
-
Provider: (props) => /* @__PURE__ */
|
|
10327
|
+
Provider: (props) => /* @__PURE__ */ jsx43(
|
|
10106
10328
|
KeepKitProvider,
|
|
10107
10329
|
{
|
|
10108
10330
|
...coreOptions,
|
|
@@ -10125,9 +10347,9 @@ function createKeepKit(options = {}) {
|
|
|
10125
10347
|
...props
|
|
10126
10348
|
}
|
|
10127
10349
|
),
|
|
10128
|
-
Button: (props) => /* @__PURE__ */
|
|
10129
|
-
Backup: (props) => /* @__PURE__ */
|
|
10130
|
-
Collection: (props) => /* @__PURE__ */
|
|
10350
|
+
Button: (props) => /* @__PURE__ */ jsx43(KeepButton, { ...props }),
|
|
10351
|
+
Backup: (props) => /* @__PURE__ */ jsx43(KeepBackup, { ...props }),
|
|
10352
|
+
Collection: (props) => /* @__PURE__ */ jsx43(
|
|
10131
10353
|
KeepCollection,
|
|
10132
10354
|
{
|
|
10133
10355
|
...props,
|
|
@@ -10138,11 +10360,11 @@ function createKeepKit(options = {}) {
|
|
|
10138
10360
|
}
|
|
10139
10361
|
}
|
|
10140
10362
|
),
|
|
10141
|
-
Inbox: (props) => /* @__PURE__ */
|
|
10142
|
-
SavedViews: (props) => /* @__PURE__ */
|
|
10143
|
-
CollectionManager: (props) => /* @__PURE__ */
|
|
10144
|
-
FallbackRecovery: (props) => /* @__PURE__ */
|
|
10145
|
-
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(
|
|
10146
10368
|
KeepWorkspace,
|
|
10147
10369
|
{
|
|
10148
10370
|
...props,
|
|
@@ -10164,8 +10386,8 @@ function createKeepKit(options = {}) {
|
|
|
10164
10386
|
useCollections: (collectionsOptions) => coreKit.useCollections(collectionsOptions),
|
|
10165
10387
|
useNavigator: (navigatorOptions) => coreKit.useNavigator(navigatorOptions),
|
|
10166
10388
|
useShortcut: (shortcutOptions) => coreKit.useShortcut(shortcutOptions),
|
|
10167
|
-
FloatingTour: (props) => /* @__PURE__ */
|
|
10168
|
-
TourProvider: (props) => /* @__PURE__ */
|
|
10389
|
+
FloatingTour: (props) => /* @__PURE__ */ jsx43(KeepFloatingTour, { ...props }),
|
|
10390
|
+
TourProvider: (props) => /* @__PURE__ */ jsx43(KeepTourProvider, { ...props }),
|
|
10169
10391
|
useTour: (tourOptions) => useKeepTour(tourOptions)
|
|
10170
10392
|
};
|
|
10171
10393
|
}
|
|
@@ -10178,6 +10400,7 @@ export {
|
|
|
10178
10400
|
KeepAnnouncer,
|
|
10179
10401
|
KeepArchiveButton,
|
|
10180
10402
|
KeepArchiveScopeSelect,
|
|
10403
|
+
KeepArchiveUndo,
|
|
10181
10404
|
KeepBackup,
|
|
10182
10405
|
KeepBulkActions,
|
|
10183
10406
|
KeepButton,
|
|
@@ -10246,7 +10469,7 @@ export {
|
|
|
10246
10469
|
mergeProps,
|
|
10247
10470
|
toggleSelectAll,
|
|
10248
10471
|
useKeepCollections8 as useKeepCollections,
|
|
10249
|
-
|
|
10472
|
+
useKeepContext12 as useKeepContext,
|
|
10250
10473
|
useKeepItem8 as useKeepItem,
|
|
10251
10474
|
useKeepList7 as useKeepList,
|
|
10252
10475
|
useKeepNavigator2 as useKeepNavigator,
|