@keepkit/ui 0.28.0 → 0.28.1
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 +6 -2
- package/dist/index.d.ts +30 -7
- package/dist/index.js +332 -275
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -51,6 +51,7 @@ function useKeepUrlSync({
|
|
|
51
51
|
...decoded.tags ? { tags: decoded.tags } : { tags: void 0 },
|
|
52
52
|
...decoded.sort ? { sort: decoded.sort } : {},
|
|
53
53
|
...decoded.pagination ? { pagination: { ...previousQuery.pagination, ...decoded.pagination } } : {},
|
|
54
|
+
...decoded.activity ? { activity: decoded.activity } : {},
|
|
54
55
|
...decoded.archiveScope !== void 0 ? { archived: decoded.archived, archiveScope: decoded.archiveScope } : decoded.archived !== void 0 ? { archived: decoded.archived, archiveScope: void 0 } : { archived: void 0, archiveScope: void 0 }
|
|
55
56
|
}));
|
|
56
57
|
};
|
|
@@ -2217,160 +2218,6 @@ function KeepPinButton({
|
|
|
2217
2218
|
);
|
|
2218
2219
|
}
|
|
2219
2220
|
|
|
2220
|
-
// src/features/actions/hooks/useKeepBackup.ts
|
|
2221
|
-
import { useKeepContext } from "@keepkit/core/react";
|
|
2222
|
-
import { useRef as useRef2, useState } from "react";
|
|
2223
|
-
function useKeepBackup({ filename, onExport, onImported }) {
|
|
2224
|
-
const context = useKeepContext();
|
|
2225
|
-
const inputRef = useRef2(null);
|
|
2226
|
-
const [mode, setMode] = useState("merge");
|
|
2227
|
-
const [result, setResult] = useState();
|
|
2228
|
-
const [error, setError] = useState();
|
|
2229
|
-
async function exportBackup() {
|
|
2230
|
-
setError(void 0);
|
|
2231
|
-
try {
|
|
2232
|
-
const data = await context.exportBackup();
|
|
2233
|
-
onExport?.(data);
|
|
2234
|
-
if (typeof document === "undefined") return;
|
|
2235
|
-
const url = URL.createObjectURL(new Blob([data], { type: "application/json" }));
|
|
2236
|
-
const anchor = document.createElement("a");
|
|
2237
|
-
anchor.href = url;
|
|
2238
|
-
anchor.download = filename;
|
|
2239
|
-
anchor.click();
|
|
2240
|
-
URL.revokeObjectURL(url);
|
|
2241
|
-
} catch (cause) {
|
|
2242
|
-
setError(cause);
|
|
2243
|
-
}
|
|
2244
|
-
}
|
|
2245
|
-
async function importBackup(event) {
|
|
2246
|
-
const file = event.currentTarget.files?.[0];
|
|
2247
|
-
event.currentTarget.value = "";
|
|
2248
|
-
if (!file) return;
|
|
2249
|
-
setError(void 0);
|
|
2250
|
-
setResult(void 0);
|
|
2251
|
-
try {
|
|
2252
|
-
const imported = await context.importBackup(await file.text(), { mode });
|
|
2253
|
-
setResult(imported);
|
|
2254
|
-
onImported?.(imported);
|
|
2255
|
-
} catch (cause) {
|
|
2256
|
-
setError(cause);
|
|
2257
|
-
}
|
|
2258
|
-
}
|
|
2259
|
-
return {
|
|
2260
|
-
inputRef,
|
|
2261
|
-
mode,
|
|
2262
|
-
setMode,
|
|
2263
|
-
result,
|
|
2264
|
-
error,
|
|
2265
|
-
isMutating: context.isMutating,
|
|
2266
|
-
exportBackup,
|
|
2267
|
-
importBackup,
|
|
2268
|
-
openFilePicker: () => inputRef.current?.click(),
|
|
2269
|
-
labels: {
|
|
2270
|
-
export: useUiLabel("exportData"),
|
|
2271
|
-
import: useUiLabel("importData"),
|
|
2272
|
-
importMode: useUiLabel("importMode"),
|
|
2273
|
-
merge: useUiLabel("merge"),
|
|
2274
|
-
replace: useUiLabel("replace"),
|
|
2275
|
-
importedCount: useUiLabel("importedCount"),
|
|
2276
|
-
failedCount: useUiLabel("failedCount"),
|
|
2277
|
-
quotaError: useUiLabel("storageQuotaError")
|
|
2278
|
-
}
|
|
2279
|
-
};
|
|
2280
|
-
}
|
|
2281
|
-
|
|
2282
|
-
// src/features/actions/KeepBackup.tsx
|
|
2283
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2284
|
-
function KeepBackup({
|
|
2285
|
-
filename = "keepkit-backup.json",
|
|
2286
|
-
onExport,
|
|
2287
|
-
onImported,
|
|
2288
|
-
...props
|
|
2289
|
-
}) {
|
|
2290
|
-
const view = useKeepBackup({ filename, onExport, onImported });
|
|
2291
|
-
const showExportLabel = useUiLabelVisibility("exportData");
|
|
2292
|
-
const showImportModeLabel = useUiLabelVisibility("importMode");
|
|
2293
|
-
const showImportLabel = useUiLabelVisibility("importData");
|
|
2294
|
-
return /* @__PURE__ */ jsxs2(
|
|
2295
|
-
"section",
|
|
2296
|
-
{
|
|
2297
|
-
...props,
|
|
2298
|
-
"data-keepkit": "backup",
|
|
2299
|
-
"data-state": view.error ? "error" : view.result ? "complete" : "idle",
|
|
2300
|
-
"data-loading": view.isMutating ? "true" : void 0,
|
|
2301
|
-
children: [
|
|
2302
|
-
/* @__PURE__ */ jsx2(
|
|
2303
|
-
"button",
|
|
2304
|
-
{
|
|
2305
|
-
type: "button",
|
|
2306
|
-
"data-keep-action": "export-backup",
|
|
2307
|
-
onClick: () => void view.exportBackup(),
|
|
2308
|
-
disabled: view.isMutating,
|
|
2309
|
-
"aria-label": showExportLabel ? void 0 : view.labels.export,
|
|
2310
|
-
children: showExportLabel ? view.labels.export : null
|
|
2311
|
-
}
|
|
2312
|
-
),
|
|
2313
|
-
/* @__PURE__ */ jsxs2("label", { children: [
|
|
2314
|
-
showImportModeLabel ? view.labels.importMode : null,
|
|
2315
|
-
/* @__PURE__ */ jsxs2(
|
|
2316
|
-
"select",
|
|
2317
|
-
{
|
|
2318
|
-
"data-keep-action": "select-import-mode",
|
|
2319
|
-
value: view.mode,
|
|
2320
|
-
"aria-label": showImportModeLabel ? void 0 : view.labels.importMode,
|
|
2321
|
-
onChange: (event) => view.setMode(event.currentTarget.value),
|
|
2322
|
-
children: [
|
|
2323
|
-
/* @__PURE__ */ jsx2("option", { value: "merge", children: view.labels.merge }),
|
|
2324
|
-
/* @__PURE__ */ jsx2("option", { value: "replace", children: view.labels.replace })
|
|
2325
|
-
]
|
|
2326
|
-
}
|
|
2327
|
-
)
|
|
2328
|
-
] }),
|
|
2329
|
-
/* @__PURE__ */ jsx2(
|
|
2330
|
-
"button",
|
|
2331
|
-
{
|
|
2332
|
-
type: "button",
|
|
2333
|
-
"data-keep-action": "import-backup",
|
|
2334
|
-
onClick: view.openFilePicker,
|
|
2335
|
-
disabled: view.isMutating,
|
|
2336
|
-
"aria-label": showImportLabel ? void 0 : view.labels.import,
|
|
2337
|
-
children: showImportLabel ? view.labels.import : null
|
|
2338
|
-
}
|
|
2339
|
-
),
|
|
2340
|
-
/* @__PURE__ */ jsx2(
|
|
2341
|
-
"input",
|
|
2342
|
-
{
|
|
2343
|
-
ref: view.inputRef,
|
|
2344
|
-
type: "file",
|
|
2345
|
-
"data-keep-action": "select-backup-file",
|
|
2346
|
-
accept: "application/json,.json",
|
|
2347
|
-
"aria-label": view.labels.import,
|
|
2348
|
-
onChange: (event) => void view.importBackup(event)
|
|
2349
|
-
}
|
|
2350
|
-
),
|
|
2351
|
-
view.result ? /* @__PURE__ */ jsxs2("p", { role: "status", children: [
|
|
2352
|
-
view.result.imported,
|
|
2353
|
-
" ",
|
|
2354
|
-
view.labels.importedCount,
|
|
2355
|
-
"; ",
|
|
2356
|
-
view.result.failed,
|
|
2357
|
-
" ",
|
|
2358
|
-
view.labels.failedCount
|
|
2359
|
-
] }) : null,
|
|
2360
|
-
view.error ? /* @__PURE__ */ jsx2("p", { role: "alert", children: isQuotaError(view.error) ? view.labels.quotaError : getErrorMessage(view.error) }) : null
|
|
2361
|
-
]
|
|
2362
|
-
}
|
|
2363
|
-
);
|
|
2364
|
-
}
|
|
2365
|
-
function isQuotaError(error) {
|
|
2366
|
-
if (error instanceof Error && error.name === "KeepStorageQuotaError") return true;
|
|
2367
|
-
if (error && typeof error === "object" && "cause" in error) return isQuotaError(error.cause);
|
|
2368
|
-
return false;
|
|
2369
|
-
}
|
|
2370
|
-
function getErrorMessage(error) {
|
|
2371
|
-
return error instanceof Error ? error.message : "Something went wrong.";
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
2221
|
// src/foundation/shared.tsx
|
|
2375
2222
|
import {
|
|
2376
2223
|
cloneElement,
|
|
@@ -2380,10 +2227,10 @@ import {
|
|
|
2380
2227
|
useContext as useContext2,
|
|
2381
2228
|
useMemo as useMemo2
|
|
2382
2229
|
} from "react";
|
|
2383
|
-
import { Fragment as Fragment2, jsx as
|
|
2230
|
+
import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
|
|
2384
2231
|
var KeepSearchQueryContext = createContext2(void 0);
|
|
2385
2232
|
function KeepSearchQueryProvider({ query, children }) {
|
|
2386
|
-
return /* @__PURE__ */
|
|
2233
|
+
return /* @__PURE__ */ jsx2(KeepSearchQueryContext.Provider, { value: query, children });
|
|
2387
2234
|
}
|
|
2388
2235
|
function useKeepSearchQuery() {
|
|
2389
2236
|
return useContext2(KeepSearchQueryContext);
|
|
@@ -2410,14 +2257,14 @@ function highlightText(text, query) {
|
|
|
2410
2257
|
const index = match.index;
|
|
2411
2258
|
if (index > lastIndex) parts.push(text.slice(lastIndex, index));
|
|
2412
2259
|
parts.push(
|
|
2413
|
-
/* @__PURE__ */
|
|
2260
|
+
/* @__PURE__ */ jsx2("mark", { className: "keep-highlight", "data-highlight": "true", children: match[0] }, `highlight-${matchIndex}`)
|
|
2414
2261
|
);
|
|
2415
2262
|
lastIndex = index + match[0].length;
|
|
2416
2263
|
matchIndex += 1;
|
|
2417
2264
|
}
|
|
2418
2265
|
if (lastIndex === 0) return text;
|
|
2419
2266
|
if (lastIndex < text.length) parts.push(text.slice(lastIndex));
|
|
2420
|
-
return /* @__PURE__ */
|
|
2267
|
+
return /* @__PURE__ */ jsx2(Fragment2, { children: parts });
|
|
2421
2268
|
}
|
|
2422
2269
|
function escapeRegExp(value) {
|
|
2423
2270
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -2439,6 +2286,9 @@ function getMetaTitle(meta) {
|
|
|
2439
2286
|
const title = meta.title;
|
|
2440
2287
|
return typeof title === "string" && title.trim() ? title.trim() : void 0;
|
|
2441
2288
|
}
|
|
2289
|
+
function getErrorMessage(error, fallback) {
|
|
2290
|
+
return error instanceof Error ? error.message : fallback;
|
|
2291
|
+
}
|
|
2442
2292
|
function normalizeUiTags(tags) {
|
|
2443
2293
|
return [...new Set(tags.map((tag) => tag.trim()).filter(Boolean))];
|
|
2444
2294
|
}
|
|
@@ -2531,7 +2381,158 @@ function renderRoot(asChild, child, props, body, componentName) {
|
|
|
2531
2381
|
if (!isValidElement(child)) throw new Error(`${componentName} with asChild requires a single React element child.`);
|
|
2532
2382
|
return createSlot(child, props, body);
|
|
2533
2383
|
}
|
|
2534
|
-
return /* @__PURE__ */
|
|
2384
|
+
return /* @__PURE__ */ jsx2("div", { ...props, children: body });
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
// src/features/actions/hooks/useKeepBackup.ts
|
|
2388
|
+
import { useKeepContext } from "@keepkit/core/react";
|
|
2389
|
+
import { useRef as useRef2, useState } from "react";
|
|
2390
|
+
function useKeepBackup({ filename, onExport, onImported }) {
|
|
2391
|
+
const context = useKeepContext();
|
|
2392
|
+
const inputRef = useRef2(null);
|
|
2393
|
+
const [mode, setMode] = useState("merge");
|
|
2394
|
+
const [result, setResult] = useState();
|
|
2395
|
+
const [error, setError] = useState();
|
|
2396
|
+
async function exportBackup() {
|
|
2397
|
+
setError(void 0);
|
|
2398
|
+
try {
|
|
2399
|
+
const data = await context.exportBackup();
|
|
2400
|
+
onExport?.(data);
|
|
2401
|
+
if (typeof document === "undefined") return;
|
|
2402
|
+
const url = URL.createObjectURL(new Blob([data], { type: "application/json" }));
|
|
2403
|
+
const anchor = document.createElement("a");
|
|
2404
|
+
anchor.href = url;
|
|
2405
|
+
anchor.download = filename;
|
|
2406
|
+
anchor.click();
|
|
2407
|
+
URL.revokeObjectURL(url);
|
|
2408
|
+
} catch (cause) {
|
|
2409
|
+
setError(cause);
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
async function importBackup(event) {
|
|
2413
|
+
const file = event.currentTarget.files?.[0];
|
|
2414
|
+
event.currentTarget.value = "";
|
|
2415
|
+
if (!file) return;
|
|
2416
|
+
setError(void 0);
|
|
2417
|
+
setResult(void 0);
|
|
2418
|
+
try {
|
|
2419
|
+
const imported = await context.importBackup(await file.text(), { mode });
|
|
2420
|
+
setResult(imported);
|
|
2421
|
+
onImported?.(imported);
|
|
2422
|
+
} catch (cause) {
|
|
2423
|
+
setError(cause);
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
return {
|
|
2427
|
+
inputRef,
|
|
2428
|
+
mode,
|
|
2429
|
+
setMode,
|
|
2430
|
+
result,
|
|
2431
|
+
error,
|
|
2432
|
+
isMutating: context.isMutating,
|
|
2433
|
+
exportBackup,
|
|
2434
|
+
importBackup,
|
|
2435
|
+
openFilePicker: () => inputRef.current?.click(),
|
|
2436
|
+
labels: {
|
|
2437
|
+
export: useUiLabel("exportData"),
|
|
2438
|
+
import: useUiLabel("importData"),
|
|
2439
|
+
importMode: useUiLabel("importMode"),
|
|
2440
|
+
merge: useUiLabel("merge"),
|
|
2441
|
+
replace: useUiLabel("replace"),
|
|
2442
|
+
importedCount: useUiLabel("importedCount"),
|
|
2443
|
+
failedCount: useUiLabel("failedCount"),
|
|
2444
|
+
quotaError: useUiLabel("storageQuotaError")
|
|
2445
|
+
}
|
|
2446
|
+
};
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
// src/features/actions/KeepBackup.tsx
|
|
2450
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2451
|
+
function KeepBackup({
|
|
2452
|
+
filename = "keepkit-backup.json",
|
|
2453
|
+
onExport,
|
|
2454
|
+
onImported,
|
|
2455
|
+
...props
|
|
2456
|
+
}) {
|
|
2457
|
+
const view = useKeepBackup({ filename, onExport, onImported });
|
|
2458
|
+
const showExportLabel = useUiLabelVisibility("exportData");
|
|
2459
|
+
const showImportModeLabel = useUiLabelVisibility("importMode");
|
|
2460
|
+
const showImportLabel = useUiLabelVisibility("importData");
|
|
2461
|
+
return /* @__PURE__ */ jsxs2(
|
|
2462
|
+
"section",
|
|
2463
|
+
{
|
|
2464
|
+
...props,
|
|
2465
|
+
"data-keepkit": "backup",
|
|
2466
|
+
"data-state": view.error ? "error" : view.result ? "complete" : "idle",
|
|
2467
|
+
"data-loading": view.isMutating ? "true" : void 0,
|
|
2468
|
+
children: [
|
|
2469
|
+
/* @__PURE__ */ jsx3(
|
|
2470
|
+
"button",
|
|
2471
|
+
{
|
|
2472
|
+
type: "button",
|
|
2473
|
+
"data-keep-action": "export-backup",
|
|
2474
|
+
onClick: () => void view.exportBackup(),
|
|
2475
|
+
disabled: view.isMutating,
|
|
2476
|
+
"aria-label": showExportLabel ? void 0 : view.labels.export,
|
|
2477
|
+
children: showExportLabel ? view.labels.export : null
|
|
2478
|
+
}
|
|
2479
|
+
),
|
|
2480
|
+
/* @__PURE__ */ jsxs2("label", { children: [
|
|
2481
|
+
showImportModeLabel ? view.labels.importMode : null,
|
|
2482
|
+
/* @__PURE__ */ jsxs2(
|
|
2483
|
+
"select",
|
|
2484
|
+
{
|
|
2485
|
+
"data-keep-action": "select-import-mode",
|
|
2486
|
+
value: view.mode,
|
|
2487
|
+
"aria-label": showImportModeLabel ? void 0 : view.labels.importMode,
|
|
2488
|
+
onChange: (event) => view.setMode(event.currentTarget.value),
|
|
2489
|
+
children: [
|
|
2490
|
+
/* @__PURE__ */ jsx3("option", { value: "merge", children: view.labels.merge }),
|
|
2491
|
+
/* @__PURE__ */ jsx3("option", { value: "replace", children: view.labels.replace })
|
|
2492
|
+
]
|
|
2493
|
+
}
|
|
2494
|
+
)
|
|
2495
|
+
] }),
|
|
2496
|
+
/* @__PURE__ */ jsx3(
|
|
2497
|
+
"button",
|
|
2498
|
+
{
|
|
2499
|
+
type: "button",
|
|
2500
|
+
"data-keep-action": "import-backup",
|
|
2501
|
+
onClick: view.openFilePicker,
|
|
2502
|
+
disabled: view.isMutating,
|
|
2503
|
+
"aria-label": showImportLabel ? void 0 : view.labels.import,
|
|
2504
|
+
children: showImportLabel ? view.labels.import : null
|
|
2505
|
+
}
|
|
2506
|
+
),
|
|
2507
|
+
/* @__PURE__ */ jsx3(
|
|
2508
|
+
"input",
|
|
2509
|
+
{
|
|
2510
|
+
ref: view.inputRef,
|
|
2511
|
+
type: "file",
|
|
2512
|
+
"data-keep-action": "select-backup-file",
|
|
2513
|
+
accept: "application/json,.json",
|
|
2514
|
+
"aria-label": view.labels.import,
|
|
2515
|
+
onChange: (event) => void view.importBackup(event)
|
|
2516
|
+
}
|
|
2517
|
+
),
|
|
2518
|
+
view.result ? /* @__PURE__ */ jsxs2("p", { role: "status", children: [
|
|
2519
|
+
view.result.imported,
|
|
2520
|
+
" ",
|
|
2521
|
+
view.labels.importedCount,
|
|
2522
|
+
"; ",
|
|
2523
|
+
view.result.failed,
|
|
2524
|
+
" ",
|
|
2525
|
+
view.labels.failedCount
|
|
2526
|
+
] }) : null,
|
|
2527
|
+
view.error ? /* @__PURE__ */ jsx3("p", { role: "alert", children: isQuotaError(view.error) ? view.labels.quotaError : getErrorMessage(view.error, "Something went wrong.") }) : null
|
|
2528
|
+
]
|
|
2529
|
+
}
|
|
2530
|
+
);
|
|
2531
|
+
}
|
|
2532
|
+
function isQuotaError(error) {
|
|
2533
|
+
if (error instanceof Error && error.name === "KeepStorageQuotaError") return true;
|
|
2534
|
+
if (error && typeof error === "object" && "cause" in error) return isQuotaError(error.cause);
|
|
2535
|
+
return false;
|
|
2535
2536
|
}
|
|
2536
2537
|
|
|
2537
2538
|
// src/features/actions/hooks/useKeepBulkActions.ts
|
|
@@ -3091,7 +3092,7 @@ function KeepQuickEditorView({
|
|
|
3091
3092
|
}
|
|
3092
3093
|
if (event.key === "Tab") trapFocus(event, focusScopeRef?.current ?? rootRef.current);
|
|
3093
3094
|
};
|
|
3094
|
-
const statusMessage = state.saveStatus === "dirty" ? unsavedChangesLabel : state.saveStatus === "saving" ? savingLabel : state.saveStatus === "saved" ? savedLabel : state.saveStatus === "error" ?
|
|
3095
|
+
const statusMessage = state.saveStatus === "dirty" ? unsavedChangesLabel : state.saveStatus === "saving" ? savingLabel : state.saveStatus === "saved" ? savedLabel : state.saveStatus === "error" ? getErrorMessage(state.error, errorLabel) : null;
|
|
3095
3096
|
const body = typeof children === "function" ? children(state) : children ?? /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
3096
3097
|
enabled.note ? /* @__PURE__ */ jsxs5("label", { "data-keep-field": "note", children: [
|
|
3097
3098
|
showNoteLabel ? /* @__PURE__ */ jsx7("span", { "data-keep-field-icon": true, children: noteLabel }) : null,
|
|
@@ -3185,9 +3186,6 @@ function KeepQuickEditorView({
|
|
|
3185
3186
|
function sameDraft(left, right) {
|
|
3186
3187
|
return left.note === right.note && sameTags(left.tags, right.tags) && left.collectionId === right.collectionId;
|
|
3187
3188
|
}
|
|
3188
|
-
function getErrorMessage2(error, fallback) {
|
|
3189
|
-
return error instanceof Error ? error.message : fallback;
|
|
3190
|
-
}
|
|
3191
3189
|
function sameTags(left, right) {
|
|
3192
3190
|
return left.length === right.length && left.every((tag, index) => tag === right[index]);
|
|
3193
3191
|
}
|
|
@@ -3440,7 +3438,7 @@ function KeepUndo({ children, label, ...props }) {
|
|
|
3440
3438
|
|
|
3441
3439
|
// src/features/collection/KeepCollection.tsx
|
|
3442
3440
|
import { KeepErrorBoundary as KeepErrorBoundary2 } from "@keepkit/core/react";
|
|
3443
|
-
import { useEffect as useEffect10, useId as useId4, useState as useState15 } from "react";
|
|
3441
|
+
import { useEffect as useEffect10, useId as useId4, useRef as useRef9, useState as useState15 } from "react";
|
|
3444
3442
|
|
|
3445
3443
|
// src/features/query/KeepActiveFiltersSummary.tsx
|
|
3446
3444
|
import {
|
|
@@ -3461,7 +3459,7 @@ function KeepActiveFiltersSummary({
|
|
|
3461
3459
|
...rootProps
|
|
3462
3460
|
}) {
|
|
3463
3461
|
const search = (providedSearch ?? query?.search?.query ?? "").trim();
|
|
3464
|
-
const tags =
|
|
3462
|
+
const tags = normalizeUiTags(providedTags ?? query?.tags ?? []);
|
|
3465
3463
|
const hasFilters = Boolean(search) || tags.length > 0;
|
|
3466
3464
|
const activeFiltersLabel = useUiLabel("activeFilters");
|
|
3467
3465
|
const showActiveFiltersLabel = useUiLabelVisibility("activeFilters");
|
|
@@ -3564,9 +3562,6 @@ function KeepActiveFiltersSummary({
|
|
|
3564
3562
|
"KeepActiveFiltersSummary"
|
|
3565
3563
|
);
|
|
3566
3564
|
}
|
|
3567
|
-
function normalizeTags(tags) {
|
|
3568
|
-
return [...new Set(tags.map((tag) => tag.trim()).filter(Boolean))];
|
|
3569
|
-
}
|
|
3570
3565
|
function isElement(value) {
|
|
3571
3566
|
return isValidElement2(value);
|
|
3572
3567
|
}
|
|
@@ -4014,7 +4009,7 @@ function KeepPagination({
|
|
|
4014
4009
|
|
|
4015
4010
|
// src/features/collection/hooks/useKeepCollection.ts
|
|
4016
4011
|
import { useKeepList as useKeepList3 } from "@keepkit/core/react";
|
|
4017
|
-
import { useEffect as useEffect7, useMemo as useMemo4, useState as useState10 } from "react";
|
|
4012
|
+
import { useCallback as useCallback5, useEffect as useEffect7, useMemo as useMemo4, useState as useState10 } from "react";
|
|
4018
4013
|
function useKeepCollection({
|
|
4019
4014
|
query,
|
|
4020
4015
|
pageSize,
|
|
@@ -4040,6 +4035,7 @@ function useKeepCollection({
|
|
|
4040
4035
|
const [sort, setSort] = useState10(query.sort ?? { by: "updatedAt", direction: "desc" });
|
|
4041
4036
|
const [activeTags, setActiveTags] = useState10(query.tags ?? []);
|
|
4042
4037
|
const [activeCollection, setActiveCollection] = useState10(query.collectionId);
|
|
4038
|
+
const [activeActivity, setActiveActivity] = useState10(query.activity);
|
|
4043
4039
|
const [page, setPage] = useState10(query.pagination?.page ?? 1);
|
|
4044
4040
|
const [activeArchiveScope, setActiveArchiveScope] = useState10(
|
|
4045
4041
|
archiveScope ?? query.archiveScope ?? scopeFromArchived(query.archived)
|
|
@@ -4051,6 +4047,7 @@ function useKeepCollection({
|
|
|
4051
4047
|
const resolvedQuery = useMemo4(
|
|
4052
4048
|
() => ({
|
|
4053
4049
|
...query,
|
|
4050
|
+
activity: activeActivity,
|
|
4054
4051
|
archiveScope: activeArchiveScope,
|
|
4055
4052
|
archived: activeArchiveScope === "active" ? false : activeArchiveScope === "archived" ? true : void 0,
|
|
4056
4053
|
search: enabled.search ? { ...query.search, query: searchValue } : query.search,
|
|
@@ -4062,6 +4059,7 @@ function useKeepCollection({
|
|
|
4062
4059
|
}),
|
|
4063
4060
|
[
|
|
4064
4061
|
activeCollection,
|
|
4062
|
+
activeActivity,
|
|
4065
4063
|
activeTags,
|
|
4066
4064
|
enabled.pagination,
|
|
4067
4065
|
enabled.search,
|
|
@@ -4083,6 +4081,7 @@ function useKeepCollection({
|
|
|
4083
4081
|
setSort(next.sort ?? { by: "updatedAt", direction: "desc" });
|
|
4084
4082
|
setActiveTags(next.tags ?? []);
|
|
4085
4083
|
setActiveCollection(next.collectionId);
|
|
4084
|
+
setActiveActivity(next.activity);
|
|
4086
4085
|
setActiveArchiveScope(next.archiveScope ?? scopeFromArchived(next.archived));
|
|
4087
4086
|
setPage(next.pagination?.page ?? 1);
|
|
4088
4087
|
},
|
|
@@ -4091,6 +4090,26 @@ function useKeepCollection({
|
|
|
4091
4090
|
});
|
|
4092
4091
|
const list = useKeepList3(resolvedQuery);
|
|
4093
4092
|
const allState = useKeepList3({ archiveScope: "all" });
|
|
4093
|
+
const reveal = useCallback5(
|
|
4094
|
+
(itemId) => {
|
|
4095
|
+
const target = allState.items.find((item) => item.id === itemId);
|
|
4096
|
+
if (!target) return "not-found";
|
|
4097
|
+
if (query.targetType !== void 0 && target.targetType !== query.targetType) return "excluded";
|
|
4098
|
+
if (query.filter && !query.filter(target)) return "excluded";
|
|
4099
|
+
const candidates = allState.items.filter(
|
|
4100
|
+
(item) => (query.targetType === void 0 || item.targetType === query.targetType) && (!query.filter || query.filter(item))
|
|
4101
|
+
).filter((item) => target.archived === true ? item.archived === true : item.archived !== true).sort((a, b) => compareItems(a, b, sort, query.pinnedFirst));
|
|
4102
|
+
const index = candidates.findIndex((item) => item.id === itemId);
|
|
4103
|
+
if (index < 0) return "excluded";
|
|
4104
|
+
setSearchValue("");
|
|
4105
|
+
setActiveTags([]);
|
|
4106
|
+
setActiveCollection(void 0);
|
|
4107
|
+
setActiveArchiveScope(target.archived === true ? "archived" : "active");
|
|
4108
|
+
setPage(Math.floor(index / resolvedPageSize) + 1);
|
|
4109
|
+
return "visible";
|
|
4110
|
+
},
|
|
4111
|
+
[allState.items, query, resolvedPageSize, sort]
|
|
4112
|
+
);
|
|
4094
4113
|
return {
|
|
4095
4114
|
enabled,
|
|
4096
4115
|
searchValue,
|
|
@@ -4132,9 +4151,20 @@ function useKeepCollection({
|
|
|
4132
4151
|
setActiveCollection(void 0);
|
|
4133
4152
|
setPage(1);
|
|
4134
4153
|
},
|
|
4135
|
-
setPage
|
|
4154
|
+
setPage,
|
|
4155
|
+
reveal
|
|
4136
4156
|
};
|
|
4137
4157
|
}
|
|
4158
|
+
function compareItems(a, b, sort, pinnedFirst) {
|
|
4159
|
+
if (pinnedFirst && a.pinned !== b.pinned) return a.pinned === true ? -1 : 1;
|
|
4160
|
+
const aValue = sort.by === "savedAt" ? a.savedAt : sort.by === "updatedAt" ? a.updatedAt : a.lastOpenedAt;
|
|
4161
|
+
const bValue = sort.by === "savedAt" ? b.savedAt : sort.by === "updatedAt" ? b.updatedAt : b.lastOpenedAt;
|
|
4162
|
+
const direction = sort.direction === "asc" ? 1 : -1;
|
|
4163
|
+
if (aValue === void 0 && bValue === void 0) return 0;
|
|
4164
|
+
if (aValue === void 0) return 1;
|
|
4165
|
+
if (bValue === void 0) return -1;
|
|
4166
|
+
return (aValue - bValue) * direction;
|
|
4167
|
+
}
|
|
4138
4168
|
function scopeFromArchived(archived) {
|
|
4139
4169
|
return archived === true ? "archived" : "active";
|
|
4140
4170
|
}
|
|
@@ -4184,7 +4214,7 @@ function KeepCollectionCreate({
|
|
|
4184
4214
|
setName("");
|
|
4185
4215
|
onCreated?.(normalizedId);
|
|
4186
4216
|
} catch (cause) {
|
|
4187
|
-
const message = cause
|
|
4217
|
+
const message = getErrorMessage(cause, "Failed to create collection.");
|
|
4188
4218
|
setError(message);
|
|
4189
4219
|
onError?.(cause);
|
|
4190
4220
|
} finally {
|
|
@@ -4476,7 +4506,7 @@ function KeepStaleNotice({
|
|
|
4476
4506
|
}
|
|
4477
4507
|
)
|
|
4478
4508
|
] }),
|
|
4479
|
-
view.error ? /* @__PURE__ */ jsx17("p", { role: "alert", children: view.error
|
|
4509
|
+
view.error ? /* @__PURE__ */ jsx17("p", { role: "alert", children: getErrorMessage(view.error, view.labels.error) }) : null
|
|
4480
4510
|
] });
|
|
4481
4511
|
}
|
|
4482
4512
|
function KeepPruneStaleButton({
|
|
@@ -4640,6 +4670,7 @@ function KeepItemCardRoot({
|
|
|
4640
4670
|
asChild = false,
|
|
4641
4671
|
href: hrefOption,
|
|
4642
4672
|
onOpen,
|
|
4673
|
+
trackOpen = false,
|
|
4643
4674
|
linkTarget = "title",
|
|
4644
4675
|
linkComponent: LinkComponent,
|
|
4645
4676
|
linkTargetAttribute,
|
|
@@ -4679,7 +4710,10 @@ function KeepItemCardRoot({
|
|
|
4679
4710
|
href: view.href,
|
|
4680
4711
|
target: view.resolvedLinkTarget,
|
|
4681
4712
|
rel: view.resolvedLinkRel,
|
|
4682
|
-
onClick: (event) =>
|
|
4713
|
+
onClick: (event) => {
|
|
4714
|
+
if (trackOpen) void view.itemState.recordOpen();
|
|
4715
|
+
onOpen?.(item, event);
|
|
4716
|
+
},
|
|
4683
4717
|
children: content
|
|
4684
4718
|
};
|
|
4685
4719
|
return LinkComponent ? /* @__PURE__ */ jsx18(LinkComponent, { ...linkProps }) : /* @__PURE__ */ jsx18("a", { ...linkProps });
|
|
@@ -4722,7 +4756,7 @@ function KeepItemCardRoot({
|
|
|
4722
4756
|
showSavedAtLabel ? " " : null,
|
|
4723
4757
|
/* @__PURE__ */ jsx18("time", { dateTime: new Date(item.savedAt).toISOString(), children: formatSavedAt(item.savedAt) })
|
|
4724
4758
|
] }) : null;
|
|
4725
|
-
const error = view.itemState.error ? /* @__PURE__ */ jsx18("p", { role: "alert", children:
|
|
4759
|
+
const error = view.itemState.error ? /* @__PURE__ */ jsx18("p", { role: "alert", children: getErrorMessage(view.itemState.error, view.labels.error) }) : null;
|
|
4726
4760
|
const actions = view.statusLabel ? /* @__PURE__ */ jsx18(KeepStaleNotice, { item, onRetry, onRemoved }) : /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
4727
4761
|
showEditButton ? isEditOpen ? /* @__PURE__ */ jsx18("div", { id: editPanelId, role: "dialog", "aria-label": editLabel, "data-keepkit": "item-edit-dialog", children: editSlot ? editSlot(item, closeEdit) : /* @__PURE__ */ jsx18(KeepQuickEditor, { item: view.itemState.item ?? item, onClose: closeEdit, features: editFeatures }) }) : /* @__PURE__ */ jsx18(
|
|
4728
4762
|
"button",
|
|
@@ -4917,9 +4951,6 @@ function KeepItemCardSkeleton({ layout = "list", ...props }) {
|
|
|
4917
4951
|
function formatSavedAt(timestamp) {
|
|
4918
4952
|
return new Date(timestamp).toISOString().slice(0, 10);
|
|
4919
4953
|
}
|
|
4920
|
-
function getErrorMessage3(error, fallback) {
|
|
4921
|
-
return error instanceof Error ? error.message : fallback;
|
|
4922
|
-
}
|
|
4923
4954
|
|
|
4924
4955
|
// src/features/status/KeepEmptyState.tsx
|
|
4925
4956
|
import { isValidElement as isValidElement5 } from "react";
|
|
@@ -4971,17 +5002,17 @@ function useKeepListView(query) {
|
|
|
4971
5002
|
}
|
|
4972
5003
|
|
|
4973
5004
|
// src/features/collection/hooks/useRovingTabIndex.ts
|
|
4974
|
-
import { useCallback as
|
|
5005
|
+
import { useCallback as useCallback6, useEffect as useEffect9, useRef as useRef8 } from "react";
|
|
4975
5006
|
function useRovingTabIndex() {
|
|
4976
5007
|
const ref = useRef8(null);
|
|
4977
|
-
const getItems =
|
|
5008
|
+
const getItems = useCallback6(() => {
|
|
4978
5009
|
const root = ref.current;
|
|
4979
5010
|
if (!root) return [];
|
|
4980
5011
|
return Array.from(root.querySelectorAll('[data-keepkit="card"]')).filter(
|
|
4981
5012
|
(item) => item.getAttribute("aria-hidden") !== "true" && item.getAttribute("data-roving-disabled") !== "true"
|
|
4982
5013
|
);
|
|
4983
5014
|
}, []);
|
|
4984
|
-
const syncTabIndices =
|
|
5015
|
+
const syncTabIndices = useCallback6(() => {
|
|
4985
5016
|
const items = getItems();
|
|
4986
5017
|
if (items.length === 0) return;
|
|
4987
5018
|
const activeElement = document.activeElement;
|
|
@@ -4999,7 +5030,7 @@ function useRovingTabIndex() {
|
|
|
4999
5030
|
observer.observe(root, { childList: true, subtree: true });
|
|
5000
5031
|
return () => observer.disconnect();
|
|
5001
5032
|
}, [syncTabIndices]);
|
|
5002
|
-
const onFocusCapture =
|
|
5033
|
+
const onFocusCapture = useCallback6(
|
|
5003
5034
|
(event) => {
|
|
5004
5035
|
if (!(event.target instanceof HTMLElement)) return;
|
|
5005
5036
|
const item = event.target.closest('[data-keepkit="card"]');
|
|
@@ -5010,7 +5041,7 @@ function useRovingTabIndex() {
|
|
|
5010
5041
|
},
|
|
5011
5042
|
[getItems]
|
|
5012
5043
|
);
|
|
5013
|
-
const onKeyDown =
|
|
5044
|
+
const onKeyDown = useCallback6(
|
|
5014
5045
|
(event) => {
|
|
5015
5046
|
if (event.defaultPrevented) return;
|
|
5016
5047
|
const items = getItems();
|
|
@@ -5276,7 +5307,7 @@ function getListBody(state, options) {
|
|
|
5276
5307
|
function hasActiveQueryFilters(query) {
|
|
5277
5308
|
if (!query) return false;
|
|
5278
5309
|
return Boolean(
|
|
5279
|
-
query.search?.query?.trim() || query.tags?.some((tag) => tag.trim()) || query.targetType || query.savedBetween || query.archiveScope !== void 0 && query.archiveScope !== "active" || query.collectionId || query.filter
|
|
5310
|
+
query.search?.query?.trim() || query.tags?.some((tag) => tag.trim()) || query.targetType || query.savedBetween || query.archiveScope !== void 0 && query.archiveScope !== "active" || query.collectionId || query.activity || query.filter
|
|
5280
5311
|
);
|
|
5281
5312
|
}
|
|
5282
5313
|
|
|
@@ -5312,10 +5343,19 @@ function KeepCollectionContent({
|
|
|
5312
5343
|
activeFilters,
|
|
5313
5344
|
empty,
|
|
5314
5345
|
error,
|
|
5346
|
+
revealRequest,
|
|
5347
|
+
onRevealResult,
|
|
5315
5348
|
className,
|
|
5316
5349
|
...rootProps
|
|
5317
5350
|
}) {
|
|
5318
5351
|
const view = useKeepCollection({ query, pageSize, urlSync, urlAdapter, features, archiveScope });
|
|
5352
|
+
const revealRequestId = useRef9(void 0);
|
|
5353
|
+
useEffect10(() => {
|
|
5354
|
+
if (!revealRequest || revealRequestId.current === revealRequest.requestId) return;
|
|
5355
|
+
revealRequestId.current = revealRequest.requestId;
|
|
5356
|
+
const status = view.reveal(revealRequest.itemId);
|
|
5357
|
+
onRevealResult?.({ ...revealRequest, status });
|
|
5358
|
+
}, [onRevealResult, revealRequest, view.reveal]);
|
|
5319
5359
|
const [reorderUndoIds, setReorderUndoIds] = useState15(null);
|
|
5320
5360
|
const reorderUndoLabel = useUiLabel("undoReorder");
|
|
5321
5361
|
const handleReorder = async (orderedIds) => {
|
|
@@ -5479,7 +5519,7 @@ import { useId as useId5 } from "react";
|
|
|
5479
5519
|
|
|
5480
5520
|
// src/features/collection/hooks/useKeepCollectionManager.ts
|
|
5481
5521
|
import { useKeepCollections as useKeepCollections4, useKeepContext as useKeepContext6 } from "@keepkit/core/react";
|
|
5482
|
-
import { useCallback as
|
|
5522
|
+
import { useCallback as useCallback7, useState as useState16 } from "react";
|
|
5483
5523
|
function useKeepCollectionManager({
|
|
5484
5524
|
onError,
|
|
5485
5525
|
onRenamed,
|
|
@@ -5499,7 +5539,7 @@ function useKeepCollectionManager({
|
|
|
5499
5539
|
const [pendingDeleteId, setPendingDeleteId] = useState16(null);
|
|
5500
5540
|
const [error, setError] = useState16(null);
|
|
5501
5541
|
const [isMutating, setIsMutating] = useState16(false);
|
|
5502
|
-
const reportError =
|
|
5542
|
+
const reportError = useCallback7(
|
|
5503
5543
|
(cause, fallback) => {
|
|
5504
5544
|
const message = cause instanceof Error ? cause.message : fallback;
|
|
5505
5545
|
setError(message);
|
|
@@ -5507,7 +5547,7 @@ function useKeepCollectionManager({
|
|
|
5507
5547
|
},
|
|
5508
5548
|
[onError]
|
|
5509
5549
|
);
|
|
5510
|
-
const runMutation =
|
|
5550
|
+
const runMutation = useCallback7(
|
|
5511
5551
|
async (operation) => {
|
|
5512
5552
|
setError(null);
|
|
5513
5553
|
setIsMutating(true);
|
|
@@ -5521,7 +5561,7 @@ function useKeepCollectionManager({
|
|
|
5521
5561
|
},
|
|
5522
5562
|
[reportError]
|
|
5523
5563
|
);
|
|
5524
|
-
const beginRename =
|
|
5564
|
+
const beginRename = useCallback7(
|
|
5525
5565
|
(id) => {
|
|
5526
5566
|
const collection = collections.find((entry) => entry.id === id);
|
|
5527
5567
|
if (!collection) return;
|
|
@@ -5532,11 +5572,11 @@ function useKeepCollectionManager({
|
|
|
5532
5572
|
},
|
|
5533
5573
|
[collections]
|
|
5534
5574
|
);
|
|
5535
|
-
const cancelRename =
|
|
5575
|
+
const cancelRename = useCallback7(() => {
|
|
5536
5576
|
setEditingId(null);
|
|
5537
5577
|
setEditingName("");
|
|
5538
5578
|
}, []);
|
|
5539
|
-
const rename =
|
|
5579
|
+
const rename = useCallback7(
|
|
5540
5580
|
async (id) => {
|
|
5541
5581
|
const name = editingName.trim();
|
|
5542
5582
|
if (!name) return;
|
|
@@ -5568,13 +5608,13 @@ function useKeepCollectionManager({
|
|
|
5568
5608
|
runMutation
|
|
5569
5609
|
]
|
|
5570
5610
|
);
|
|
5571
|
-
const requestDelete =
|
|
5611
|
+
const requestDelete = useCallback7((id) => {
|
|
5572
5612
|
setError(null);
|
|
5573
5613
|
setEditingId(null);
|
|
5574
5614
|
setPendingDeleteId(id);
|
|
5575
5615
|
}, []);
|
|
5576
|
-
const cancelDelete =
|
|
5577
|
-
const confirmDelete =
|
|
5616
|
+
const cancelDelete = useCallback7(() => setPendingDeleteId(null), []);
|
|
5617
|
+
const confirmDelete = useCallback7(async () => {
|
|
5578
5618
|
if (!pendingDeleteId) return;
|
|
5579
5619
|
const id = pendingDeleteId;
|
|
5580
5620
|
await runMutation(async () => {
|
|
@@ -5812,16 +5852,16 @@ function KeepShortcutHint({ shortcut, separator = "+", ...props }) {
|
|
|
5812
5852
|
|
|
5813
5853
|
// src/features/editor/hooks/useKeepNoteEditor.ts
|
|
5814
5854
|
import { useKeepItem as useKeepItem6 } from "@keepkit/core/react";
|
|
5815
|
-
import { useCallback as
|
|
5855
|
+
import { useCallback as useCallback8, useEffect as useEffect11, useRef as useRef10, useState as useState17 } from "react";
|
|
5816
5856
|
function useKeepNoteEditor({ item, debounceMs, onSaved, onSaveError }) {
|
|
5817
5857
|
const itemState = useKeepItem6(item);
|
|
5818
5858
|
const { error, isMutating, item: savedItem, updateNote } = itemState;
|
|
5819
5859
|
const [note, setNote] = useState17(item.note ?? "");
|
|
5820
5860
|
const baselineNote = savedItem?.note ?? item.note ?? "";
|
|
5821
5861
|
const isDirty = note !== baselineNote;
|
|
5822
|
-
const lastSavedNoteRef =
|
|
5862
|
+
const lastSavedNoteRef = useRef10(void 0);
|
|
5823
5863
|
useEffect11(() => setNote(baselineNote), [baselineNote]);
|
|
5824
|
-
const save =
|
|
5864
|
+
const save = useCallback8(async () => {
|
|
5825
5865
|
const nextNote = note.trim() || void 0;
|
|
5826
5866
|
try {
|
|
5827
5867
|
await updateNote(nextNote);
|
|
@@ -5935,7 +5975,7 @@ function KeepNoteEditor({
|
|
|
5935
5975
|
"data-disabled": isSaving ? "true" : void 0,
|
|
5936
5976
|
children: [
|
|
5937
5977
|
body,
|
|
5938
|
-
error ? /* @__PURE__ */ jsx26("p", { role: "alert", children:
|
|
5978
|
+
error ? /* @__PURE__ */ jsx26("p", { role: "alert", children: getErrorMessage(error, view.labels.error) }) : null
|
|
5939
5979
|
]
|
|
5940
5980
|
}
|
|
5941
5981
|
);
|
|
@@ -5957,19 +5997,16 @@ function KeepNoteEditor({
|
|
|
5957
5997
|
"KeepNoteEditor"
|
|
5958
5998
|
);
|
|
5959
5999
|
}
|
|
5960
|
-
function getErrorMessage4(error, fallback) {
|
|
5961
|
-
return error instanceof Error ? error.message : fallback;
|
|
5962
|
-
}
|
|
5963
6000
|
|
|
5964
6001
|
// src/features/editor/hooks/useKeepTagEditor.ts
|
|
5965
6002
|
import { useKeepItem as useKeepItem7 } from "@keepkit/core/react";
|
|
5966
|
-
import { useCallback as
|
|
6003
|
+
import { useCallback as useCallback9, useEffect as useEffect12, useState as useState18 } from "react";
|
|
5967
6004
|
function useKeepTagEditor({ item, onSaved, onSaveError }) {
|
|
5968
6005
|
const itemState = useKeepItem7(item);
|
|
5969
6006
|
const [tags, setTags] = useState18(item.tags ?? []);
|
|
5970
6007
|
const [input, setInput] = useState18("");
|
|
5971
6008
|
useEffect12(() => setTags(itemState.item?.tags ?? item.tags ?? []), [item.tags, itemState.item?.tags]);
|
|
5972
|
-
const save =
|
|
6009
|
+
const save = useCallback9(async () => {
|
|
5973
6010
|
const nextTags = normalizeUiTags(tags);
|
|
5974
6011
|
try {
|
|
5975
6012
|
await itemState.updateTags(nextTags);
|
|
@@ -6083,19 +6120,16 @@ function KeepTagEditor({
|
|
|
6083
6120
|
"data-disabled": isSaving ? "true" : void 0,
|
|
6084
6121
|
children: [
|
|
6085
6122
|
body,
|
|
6086
|
-
view.error ? /* @__PURE__ */ jsx27("p", { role: "alert", children:
|
|
6123
|
+
view.error ? /* @__PURE__ */ jsx27("p", { role: "alert", children: getErrorMessage(view.error, view.labels.error) }) : null
|
|
6087
6124
|
]
|
|
6088
6125
|
}
|
|
6089
6126
|
);
|
|
6090
6127
|
}
|
|
6091
|
-
function getErrorMessage5(error, fallback) {
|
|
6092
|
-
return error instanceof Error ? error.message : fallback;
|
|
6093
|
-
}
|
|
6094
6128
|
|
|
6095
6129
|
// src/features/feedback/useKeepToastFeedback.ts
|
|
6096
|
-
import { useCallback as
|
|
6130
|
+
import { useCallback as useCallback10 } from "react";
|
|
6097
6131
|
function useKeepToastFeedback(showToast) {
|
|
6098
|
-
return
|
|
6132
|
+
return useCallback10(
|
|
6099
6133
|
(event) => {
|
|
6100
6134
|
if (!("undo" in event)) {
|
|
6101
6135
|
showToast(event.message);
|
|
@@ -6114,7 +6148,7 @@ function useKeepToastFeedback(showToast) {
|
|
|
6114
6148
|
|
|
6115
6149
|
// src/features/navigation/KeepFloatingTour.tsx
|
|
6116
6150
|
import { useKeepList as useKeepList6 } from "@keepkit/core/react";
|
|
6117
|
-
import { useEffect as useEffect15, useMemo as useMemo6, useRef as
|
|
6151
|
+
import { useEffect as useEffect15, useMemo as useMemo6, useRef as useRef11, useState as useState20 } from "react";
|
|
6118
6152
|
import { createPortal } from "react-dom";
|
|
6119
6153
|
|
|
6120
6154
|
// src/foundation/theme.tsx
|
|
@@ -6387,7 +6421,7 @@ function navigateTo(item, href) {
|
|
|
6387
6421
|
|
|
6388
6422
|
// src/features/navigation/tour-context.tsx
|
|
6389
6423
|
import { useKeepList as useKeepList5 } from "@keepkit/core/react";
|
|
6390
|
-
import { createContext as createContext5, useCallback as
|
|
6424
|
+
import { createContext as createContext5, useCallback as useCallback11, useContext as useContext5, useEffect as useEffect14, useMemo as useMemo5, useState as useState19 } from "react";
|
|
6391
6425
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
6392
6426
|
var SESSION_VERSION = 1;
|
|
6393
6427
|
var KeepTourContext = createContext5(null);
|
|
@@ -6404,7 +6438,7 @@ function KeepTourProvider({
|
|
|
6404
6438
|
);
|
|
6405
6439
|
const [persistenceStatus, setPersistenceStatus] = useState19("persistent");
|
|
6406
6440
|
const itemsById = useMemo5(() => new Map(list.items.map((item) => [item.id, item])), [list.items]);
|
|
6407
|
-
const readStorage =
|
|
6441
|
+
const readStorage = useCallback11(() => {
|
|
6408
6442
|
try {
|
|
6409
6443
|
const raw = window.sessionStorage.getItem(sessionKey);
|
|
6410
6444
|
if (!raw) return null;
|
|
@@ -6426,7 +6460,7 @@ function KeepTourProvider({
|
|
|
6426
6460
|
return null;
|
|
6427
6461
|
}
|
|
6428
6462
|
}, [sessionKey]);
|
|
6429
|
-
const writeStorage =
|
|
6463
|
+
const writeStorage = useCallback11(
|
|
6430
6464
|
(value2) => {
|
|
6431
6465
|
try {
|
|
6432
6466
|
if (value2) window.sessionStorage.setItem(sessionKey, JSON.stringify({ version: SESSION_VERSION, ...value2 }));
|
|
@@ -6465,7 +6499,7 @@ function KeepTourProvider({
|
|
|
6465
6499
|
writeStorage(next);
|
|
6466
6500
|
}
|
|
6467
6501
|
}, [itemsById, list.error, list.isLoading, tour, writeStorage]);
|
|
6468
|
-
const start =
|
|
6502
|
+
const start = useCallback11(
|
|
6469
6503
|
(options) => {
|
|
6470
6504
|
const ids = [...options.itemIds];
|
|
6471
6505
|
if (!ids.length || new Set(ids).size !== ids.length || ids.some((id) => !itemsById.has(id))) return false;
|
|
@@ -6478,11 +6512,11 @@ function KeepTourProvider({
|
|
|
6478
6512
|
},
|
|
6479
6513
|
[itemsById, writeStorage]
|
|
6480
6514
|
);
|
|
6481
|
-
const end =
|
|
6515
|
+
const end = useCallback11(() => {
|
|
6482
6516
|
setTour(null);
|
|
6483
6517
|
writeStorage(null);
|
|
6484
6518
|
}, [writeStorage]);
|
|
6485
|
-
const setCurrentId =
|
|
6519
|
+
const setCurrentId = useCallback11(
|
|
6486
6520
|
(id) => {
|
|
6487
6521
|
setTour((current) => {
|
|
6488
6522
|
if (!current?.currentId || current.currentId === id || !current.itemIds.includes(id)) return current;
|
|
@@ -6493,7 +6527,7 @@ function KeepTourProvider({
|
|
|
6493
6527
|
},
|
|
6494
6528
|
[writeStorage]
|
|
6495
6529
|
);
|
|
6496
|
-
const move =
|
|
6530
|
+
const move = useCallback11(
|
|
6497
6531
|
(delta) => {
|
|
6498
6532
|
if (!tour?.currentId) return null;
|
|
6499
6533
|
const currentId = tour.currentId;
|
|
@@ -6564,8 +6598,8 @@ function KeepFloatingTour({
|
|
|
6564
6598
|
const collapseLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u6298\u308A\u305F\u305F\u3080" : "Collapse tour";
|
|
6565
6599
|
const expandLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u5C55\u958B" : "Expand tour";
|
|
6566
6600
|
const endLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u7D42\u4E86" : "End tour";
|
|
6567
|
-
const expandRef =
|
|
6568
|
-
const collapseRef =
|
|
6601
|
+
const expandRef = useRef11(null);
|
|
6602
|
+
const collapseRef = useRef11(null);
|
|
6569
6603
|
useEffect15(() => setMounted(true), []);
|
|
6570
6604
|
useEffect15(() => {
|
|
6571
6605
|
if (!mounted || !tour.active) return;
|
|
@@ -6677,12 +6711,33 @@ function KeepFloatingTour({
|
|
|
6677
6711
|
);
|
|
6678
6712
|
}
|
|
6679
6713
|
|
|
6714
|
+
// src/features/rediscovery/KeepRediscovery.tsx
|
|
6715
|
+
import { createRediscoveryQuery } from "@keepkit/core/core";
|
|
6716
|
+
import { useMemo as useMemo7 } from "react";
|
|
6717
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
6718
|
+
function KeepRediscovery({
|
|
6719
|
+
strategy,
|
|
6720
|
+
inactiveForMs,
|
|
6721
|
+
limit = 5,
|
|
6722
|
+
itemCardProps,
|
|
6723
|
+
...props
|
|
6724
|
+
}) {
|
|
6725
|
+
const query = useMemo7(
|
|
6726
|
+
() => ({
|
|
6727
|
+
...createRediscoveryQuery({ strategy, inactiveForMs }),
|
|
6728
|
+
pagination: { page: 1, pageSize: Math.max(1, limit) }
|
|
6729
|
+
}),
|
|
6730
|
+
[inactiveForMs, limit, strategy]
|
|
6731
|
+
);
|
|
6732
|
+
return /* @__PURE__ */ jsx32(KeepList, { ...props, query, itemCardProps: { trackOpen: true, ...itemCardProps } });
|
|
6733
|
+
}
|
|
6734
|
+
|
|
6680
6735
|
// src/features/status/status.tsx
|
|
6681
6736
|
import { isValidElement as isValidElement9 } from "react";
|
|
6682
6737
|
|
|
6683
6738
|
// src/features/status/hooks/useStatusViews.ts
|
|
6684
6739
|
import { useKeepContext as useKeepContext7 } from "@keepkit/core/react";
|
|
6685
|
-
import { useEffect as useEffect16, useRef as
|
|
6740
|
+
import { useEffect as useEffect16, useRef as useRef12, useState as useState21 } from "react";
|
|
6686
6741
|
function useKeepStatus(status) {
|
|
6687
6742
|
const context = useKeepContext7();
|
|
6688
6743
|
const resolvedStatus = status ?? getDerivedStatus(context);
|
|
@@ -6700,7 +6755,7 @@ function useKeepAnnouncements(messages) {
|
|
|
6700
6755
|
const removedMessage = useUiLabel("removedMessage", messages?.remove);
|
|
6701
6756
|
const noteSavedMessage = useUiLabel("noteSavedMessage", messages?.note);
|
|
6702
6757
|
const [message, setMessage] = useState21("");
|
|
6703
|
-
const lastChangeRef =
|
|
6758
|
+
const lastChangeRef = useRef12(void 0);
|
|
6704
6759
|
useEffect16(() => {
|
|
6705
6760
|
const change = context.lastChange;
|
|
6706
6761
|
if (!change || change === lastChangeRef.current) return;
|
|
@@ -6729,7 +6784,7 @@ function getStatusLabelKey3(status) {
|
|
|
6729
6784
|
}
|
|
6730
6785
|
|
|
6731
6786
|
// src/features/status/status.tsx
|
|
6732
|
-
import { jsx as
|
|
6787
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
6733
6788
|
function KeepStatus({
|
|
6734
6789
|
status,
|
|
6735
6790
|
labels,
|
|
@@ -6761,7 +6816,7 @@ function KeepStatus({
|
|
|
6761
6816
|
}
|
|
6762
6817
|
function KeepAnnouncements({ messages, ...props }) {
|
|
6763
6818
|
const message = useKeepAnnouncements(messages);
|
|
6764
|
-
return /* @__PURE__ */
|
|
6819
|
+
return /* @__PURE__ */ jsx33(
|
|
6765
6820
|
"div",
|
|
6766
6821
|
{
|
|
6767
6822
|
...props,
|
|
@@ -6778,13 +6833,13 @@ var KeepAnnouncer = KeepAnnouncements;
|
|
|
6778
6833
|
|
|
6779
6834
|
// src/features/sync/hooks/useKeepSyncFeedback.ts
|
|
6780
6835
|
import { useKeepContext as useKeepContext8 } from "@keepkit/core/react";
|
|
6781
|
-
import { useEffect as useEffect17, useRef as
|
|
6836
|
+
import { useEffect as useEffect17, useRef as useRef13 } from "react";
|
|
6782
6837
|
function useKeepSyncFeedback() {
|
|
6783
6838
|
const { syncState } = useKeepContext8();
|
|
6784
6839
|
const emitFeedback = useKeepUiFeedback();
|
|
6785
6840
|
const completedMessage = useUiLabel("syncSynced");
|
|
6786
6841
|
const failedMessage = useUiLabel("syncFailedMessage");
|
|
6787
|
-
const previousStatus =
|
|
6842
|
+
const previousStatus = useRef13("idle");
|
|
6788
6843
|
useEffect17(() => {
|
|
6789
6844
|
const previous = previousStatus.current;
|
|
6790
6845
|
previousStatus.current = syncState.status;
|
|
@@ -6860,7 +6915,7 @@ function useKeepSyncRecoveryDialog(options) {
|
|
|
6860
6915
|
}
|
|
6861
6916
|
|
|
6862
6917
|
// src/features/sync/KeepSyncRecoveryDialog.tsx
|
|
6863
|
-
import { jsx as
|
|
6918
|
+
import { jsx as jsx34, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6864
6919
|
function KeepSyncRecoveryDialog({
|
|
6865
6920
|
open,
|
|
6866
6921
|
onOpenChange,
|
|
@@ -6890,16 +6945,16 @@ function KeepSyncRecoveryDialog({
|
|
|
6890
6945
|
"data-loading": view.busyId !== void 0 ? "true" : void 0,
|
|
6891
6946
|
children: [
|
|
6892
6947
|
/* @__PURE__ */ jsxs26("header", { children: [
|
|
6893
|
-
/* @__PURE__ */
|
|
6894
|
-
/* @__PURE__ */
|
|
6948
|
+
/* @__PURE__ */ jsx34("h2", { id: "keepkit-sync-recovery-title", children: title ?? view.labels.title }),
|
|
6949
|
+
/* @__PURE__ */ jsx34("button", { type: "button", "data-keep-action": "close-dialog", onClick: view.close, "aria-label": view.labels.close, children: view.labels.close })
|
|
6895
6950
|
] }),
|
|
6896
6951
|
children,
|
|
6897
6952
|
view.conflictList.length > 0 ? /* @__PURE__ */ jsxs26("div", { children: [
|
|
6898
|
-
/* @__PURE__ */
|
|
6953
|
+
/* @__PURE__ */ jsx34("p", { children: view.labels.conflict }),
|
|
6899
6954
|
view.conflictList.map((conflict) => /* @__PURE__ */ jsxs26("article", { "data-conflict-id": conflict.id, children: [
|
|
6900
|
-
/* @__PURE__ */
|
|
6955
|
+
/* @__PURE__ */ jsx34("h3", { children: getMetaTitle(conflict.operation.item?.meta) ?? conflict.id }),
|
|
6901
6956
|
/* @__PURE__ */ jsxs26("div", { "data-conflict-preview": true, children: [
|
|
6902
|
-
/* @__PURE__ */
|
|
6957
|
+
/* @__PURE__ */ jsx34(
|
|
6903
6958
|
ConflictPreview,
|
|
6904
6959
|
{
|
|
6905
6960
|
item: conflict.operation.item,
|
|
@@ -6909,7 +6964,7 @@ function KeepSyncRecoveryDialog({
|
|
|
6909
6964
|
side: "local"
|
|
6910
6965
|
}
|
|
6911
6966
|
),
|
|
6912
|
-
/* @__PURE__ */
|
|
6967
|
+
/* @__PURE__ */ jsx34(
|
|
6913
6968
|
ConflictPreview,
|
|
6914
6969
|
{
|
|
6915
6970
|
item: conflict.remote,
|
|
@@ -6921,7 +6976,7 @@ function KeepSyncRecoveryDialog({
|
|
|
6921
6976
|
)
|
|
6922
6977
|
] }),
|
|
6923
6978
|
/* @__PURE__ */ jsxs26("div", { children: [
|
|
6924
|
-
/* @__PURE__ */
|
|
6979
|
+
/* @__PURE__ */ jsx34(
|
|
6925
6980
|
"button",
|
|
6926
6981
|
{
|
|
6927
6982
|
type: "button",
|
|
@@ -6931,7 +6986,7 @@ function KeepSyncRecoveryDialog({
|
|
|
6931
6986
|
children: view.labels.keepLocal
|
|
6932
6987
|
}
|
|
6933
6988
|
),
|
|
6934
|
-
/* @__PURE__ */
|
|
6989
|
+
/* @__PURE__ */ jsx34(
|
|
6935
6990
|
"button",
|
|
6936
6991
|
{
|
|
6937
6992
|
type: "button",
|
|
@@ -6941,7 +6996,7 @@ function KeepSyncRecoveryDialog({
|
|
|
6941
6996
|
children: view.labels.useServer
|
|
6942
6997
|
}
|
|
6943
6998
|
),
|
|
6944
|
-
/* @__PURE__ */
|
|
6999
|
+
/* @__PURE__ */ jsx34(
|
|
6945
7000
|
"button",
|
|
6946
7001
|
{
|
|
6947
7002
|
type: "button",
|
|
@@ -6955,11 +7010,11 @@ function KeepSyncRecoveryDialog({
|
|
|
6955
7010
|
] }, conflict.id))
|
|
6956
7011
|
] }) : null,
|
|
6957
7012
|
view.showBackupRecovery ? /* @__PURE__ */ jsxs26("section", { "data-recovery": "backup", children: [
|
|
6958
|
-
/* @__PURE__ */
|
|
6959
|
-
/* @__PURE__ */
|
|
6960
|
-
backup ?? (showBackupControls ? /* @__PURE__ */
|
|
7013
|
+
/* @__PURE__ */ jsx34("h3", { children: view.labels.backupRecovery }),
|
|
7014
|
+
/* @__PURE__ */ jsx34("p", { children: view.labels.backupRecoveryDescription }),
|
|
7015
|
+
backup ?? (showBackupControls ? /* @__PURE__ */ jsx34(KeepBackup, {}) : null)
|
|
6961
7016
|
] }) : null,
|
|
6962
|
-
view.error ? /* @__PURE__ */
|
|
7017
|
+
view.error ? /* @__PURE__ */ jsx34("p", { id: "keepkit-sync-recovery-error", role: "alert", "aria-live": "assertive", children: getErrorMessage(view.error, view.labels.error) }) : null
|
|
6963
7018
|
]
|
|
6964
7019
|
}
|
|
6965
7020
|
);
|
|
@@ -6972,15 +7027,15 @@ function ConflictPreview({
|
|
|
6972
7027
|
side
|
|
6973
7028
|
}) {
|
|
6974
7029
|
return /* @__PURE__ */ jsxs26("article", { "data-conflict-version": side, "aria-label": heading, children: [
|
|
6975
|
-
/* @__PURE__ */
|
|
7030
|
+
/* @__PURE__ */ jsx34("h4", { children: heading }),
|
|
6976
7031
|
/* @__PURE__ */ jsxs26("dl", { children: [
|
|
6977
7032
|
/* @__PURE__ */ jsxs26("div", { children: [
|
|
6978
|
-
/* @__PURE__ */
|
|
6979
|
-
/* @__PURE__ */
|
|
7033
|
+
/* @__PURE__ */ jsx34("dt", { children: updatedAtLabel }),
|
|
7034
|
+
/* @__PURE__ */ jsx34("dd", { children: item ? /* @__PURE__ */ jsx34("time", { dateTime: new Date(item.updatedAt).toISOString(), children: formatConflictDate(item.updatedAt) }) : "\u2014" })
|
|
6980
7035
|
] }),
|
|
6981
7036
|
/* @__PURE__ */ jsxs26("div", { children: [
|
|
6982
|
-
/* @__PURE__ */
|
|
6983
|
-
/* @__PURE__ */
|
|
7037
|
+
/* @__PURE__ */ jsx34("dt", { children: noteLabel }),
|
|
7038
|
+
/* @__PURE__ */ jsx34("dd", { children: item?.note || "\u2014" })
|
|
6984
7039
|
] })
|
|
6985
7040
|
] })
|
|
6986
7041
|
] });
|
|
@@ -6998,9 +7053,10 @@ function useKeepSyncStatusBanner({ onRetry, children }) {
|
|
|
6998
7053
|
const conflictLabel = useUiLabel("syncConflict");
|
|
6999
7054
|
const pendingLabel = useUiLabel("syncPending");
|
|
7000
7055
|
const syncedLabel = useUiLabel("syncSynced");
|
|
7056
|
+
const failedLabel = useUiLabel("syncFailedMessage");
|
|
7001
7057
|
const status = context.syncState.status;
|
|
7002
7058
|
const hasConflicts = (context.syncState.conflicts?.length ?? 0) > 0 || context.syncState.conflictIds.length > 0;
|
|
7003
|
-
const message = children ?? (status === "error" ?
|
|
7059
|
+
const message = children ?? (status === "error" ? getErrorMessage(context.syncState.error, failedLabel) : status === "conflict" || hasConflicts ? conflictLabel : status === "pending" || status === "syncing" ? pendingLabel : syncedLabel);
|
|
7004
7060
|
return {
|
|
7005
7061
|
status,
|
|
7006
7062
|
hasConflicts,
|
|
@@ -7019,12 +7075,9 @@ function useKeepSyncStatusBanner({ onRetry, children }) {
|
|
|
7019
7075
|
}
|
|
7020
7076
|
};
|
|
7021
7077
|
}
|
|
7022
|
-
function getErrorMessage6(error) {
|
|
7023
|
-
return error instanceof Error ? error.message : "Sync failed.";
|
|
7024
|
-
}
|
|
7025
7078
|
|
|
7026
7079
|
// src/features/sync/KeepSyncStatusBanner.tsx
|
|
7027
|
-
import { jsx as
|
|
7080
|
+
import { jsx as jsx35, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7028
7081
|
function KeepSyncStatusBanner({
|
|
7029
7082
|
onRetry,
|
|
7030
7083
|
onResolveConflicts,
|
|
@@ -7046,8 +7099,8 @@ function KeepSyncStatusBanner({
|
|
|
7046
7099
|
"data-keepkit": "sync-status",
|
|
7047
7100
|
"data-state": view.status,
|
|
7048
7101
|
children: [
|
|
7049
|
-
/* @__PURE__ */
|
|
7050
|
-
view.showRetry ? /* @__PURE__ */
|
|
7102
|
+
/* @__PURE__ */ jsx35("p", { children: view.message }),
|
|
7103
|
+
view.showRetry ? /* @__PURE__ */ jsx35(
|
|
7051
7104
|
"button",
|
|
7052
7105
|
{
|
|
7053
7106
|
type: "button",
|
|
@@ -7058,7 +7111,7 @@ function KeepSyncStatusBanner({
|
|
|
7058
7111
|
children: showRetryLabel ? view.retryLabel : null
|
|
7059
7112
|
}
|
|
7060
7113
|
) : null,
|
|
7061
|
-
view.hasConflicts ? /* @__PURE__ */
|
|
7114
|
+
view.hasConflicts ? /* @__PURE__ */ jsx35(
|
|
7062
7115
|
"button",
|
|
7063
7116
|
{
|
|
7064
7117
|
type: "button",
|
|
@@ -7075,7 +7128,7 @@ function KeepSyncStatusBanner({
|
|
|
7075
7128
|
}
|
|
7076
7129
|
|
|
7077
7130
|
// src/features/workspace/hooks/useKeepWorkspace.ts
|
|
7078
|
-
import { useCallback as
|
|
7131
|
+
import { useCallback as useCallback12, useState as useState23 } from "react";
|
|
7079
7132
|
var PRESET_MODULES = {
|
|
7080
7133
|
basic: { syncStatus: false, undo: false, recovery: false, backup: false, stalePrune: false },
|
|
7081
7134
|
standard: { syncStatus: false, undo: true, recovery: false, backup: false, stalePrune: false },
|
|
@@ -7097,14 +7150,14 @@ function useKeepWorkspace({
|
|
|
7097
7150
|
}) {
|
|
7098
7151
|
const [internalRecoveryOpen, setInternalRecoveryOpen] = useState23(false);
|
|
7099
7152
|
const resolvedModules = { ...PRESET_MODULES[preset], ...modules };
|
|
7100
|
-
const setRecoveryOpen =
|
|
7153
|
+
const setRecoveryOpen = useCallback12(
|
|
7101
7154
|
(open) => {
|
|
7102
7155
|
if (recoveryOpen === void 0) setInternalRecoveryOpen(open);
|
|
7103
7156
|
onRecoveryOpenChange?.(open);
|
|
7104
7157
|
},
|
|
7105
7158
|
[onRecoveryOpenChange, recoveryOpen]
|
|
7106
7159
|
);
|
|
7107
|
-
const openRecovery =
|
|
7160
|
+
const openRecovery = useCallback12(() => {
|
|
7108
7161
|
onResolveConflicts?.();
|
|
7109
7162
|
setRecoveryOpen(true);
|
|
7110
7163
|
}, [onResolveConflicts, setRecoveryOpen]);
|
|
@@ -7119,7 +7172,7 @@ function useKeepWorkspace({
|
|
|
7119
7172
|
}
|
|
7120
7173
|
|
|
7121
7174
|
// src/features/workspace/KeepWorkspace.tsx
|
|
7122
|
-
import { jsx as
|
|
7175
|
+
import { jsx as jsx36, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7123
7176
|
function KeepWorkspace({
|
|
7124
7177
|
preset = "standard",
|
|
7125
7178
|
modules,
|
|
@@ -7158,27 +7211,27 @@ function KeepWorkspace({
|
|
|
7158
7211
|
if (!structuredRegions) return content;
|
|
7159
7212
|
if (!hasRenderableContent(content)) return null;
|
|
7160
7213
|
const resolvedSurface = typeof surface === "string" ? surface : surface[name] ?? "plain";
|
|
7161
|
-
return /* @__PURE__ */
|
|
7214
|
+
return /* @__PURE__ */ jsx36("div", { "data-keepkit": "workspace-region", "data-region": name, "data-surface": resolvedSurface, children: content });
|
|
7162
7215
|
};
|
|
7163
7216
|
const before = resolveOptionalSlot(slots?.before, state);
|
|
7164
7217
|
const syncStatus = view.modules.syncStatus ? resolveSlot(
|
|
7165
7218
|
slots?.syncStatus,
|
|
7166
|
-
/* @__PURE__ */
|
|
7219
|
+
/* @__PURE__ */ jsx36(KeepSyncStatusBanner, { ...syncStatusProps, onResolveConflicts: view.openRecovery }),
|
|
7167
7220
|
state
|
|
7168
7221
|
) : null;
|
|
7169
|
-
const collection = resolveSlot(slots?.collection, /* @__PURE__ */
|
|
7222
|
+
const collection = resolveSlot(slots?.collection, /* @__PURE__ */ jsx36(KeepCollection, { ...resolvedCollectionProps }), state);
|
|
7170
7223
|
const actions = view.modules.backup || view.modules.stalePrune ? resolveSlot(
|
|
7171
7224
|
slots?.actions,
|
|
7172
7225
|
/* @__PURE__ */ jsxs28("div", { "data-keepkit": "workspace-actions", children: [
|
|
7173
|
-
view.modules.stalePrune ? /* @__PURE__ */
|
|
7174
|
-
view.modules.backup ? /* @__PURE__ */
|
|
7226
|
+
view.modules.stalePrune ? /* @__PURE__ */ jsx36(KeepPruneStaleButton, { ...stalePruneProps }) : null,
|
|
7227
|
+
view.modules.backup ? /* @__PURE__ */ jsx36(KeepBackup, { ...backupProps }) : null
|
|
7175
7228
|
] }),
|
|
7176
7229
|
state
|
|
7177
7230
|
) : null;
|
|
7178
|
-
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */
|
|
7231
|
+
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */ jsx36(KeepUndo, { ...undoProps }), state) : null;
|
|
7179
7232
|
const recovery = view.modules.recovery ? resolveSlot(
|
|
7180
7233
|
slots?.recovery,
|
|
7181
|
-
/* @__PURE__ */
|
|
7234
|
+
/* @__PURE__ */ jsx36(
|
|
7182
7235
|
KeepSyncRecoveryDialog,
|
|
7183
7236
|
{
|
|
7184
7237
|
...recoveryProps,
|
|
@@ -7231,6 +7284,7 @@ import {
|
|
|
7231
7284
|
useKeepItem as useKeepItem8,
|
|
7232
7285
|
useKeepList as useKeepList7,
|
|
7233
7286
|
useKeepNavigator as useKeepNavigator2,
|
|
7287
|
+
useKeepRediscovery,
|
|
7234
7288
|
useKeepShortcut
|
|
7235
7289
|
} from "@keepkit/core/react";
|
|
7236
7290
|
import {
|
|
@@ -7243,7 +7297,7 @@ import {
|
|
|
7243
7297
|
LocalStorageSyncQueueAdapter,
|
|
7244
7298
|
SyncStorageAdapter
|
|
7245
7299
|
} from "@keepkit/core/storage";
|
|
7246
|
-
import { jsx as
|
|
7300
|
+
import { jsx as jsx37, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7247
7301
|
function KeepKitProvider({
|
|
7248
7302
|
labels,
|
|
7249
7303
|
labelOptions,
|
|
@@ -7265,7 +7319,7 @@ function KeepKitProvider({
|
|
|
7265
7319
|
children,
|
|
7266
7320
|
...providerProps
|
|
7267
7321
|
}) {
|
|
7268
|
-
return /* @__PURE__ */
|
|
7322
|
+
return /* @__PURE__ */ jsx37(
|
|
7269
7323
|
KeepUiProvider,
|
|
7270
7324
|
{
|
|
7271
7325
|
labels,
|
|
@@ -7273,7 +7327,7 @@ function KeepKitProvider({
|
|
|
7273
7327
|
locale,
|
|
7274
7328
|
labelResolver,
|
|
7275
7329
|
onFeedback,
|
|
7276
|
-
children: /* @__PURE__ */
|
|
7330
|
+
children: /* @__PURE__ */ jsx37(
|
|
7277
7331
|
KeepThemeProvider,
|
|
7278
7332
|
{
|
|
7279
7333
|
theme,
|
|
@@ -7288,9 +7342,9 @@ function KeepKitProvider({
|
|
|
7288
7342
|
style: themeStyle,
|
|
7289
7343
|
asChild: themeAsChild,
|
|
7290
7344
|
children: /* @__PURE__ */ jsxs29(CoreKeepProvider, { ...providerProps, children: [
|
|
7291
|
-
/* @__PURE__ */
|
|
7292
|
-
/* @__PURE__ */
|
|
7293
|
-
/* @__PURE__ */
|
|
7345
|
+
/* @__PURE__ */ jsx37(KeepSyncFeedbackObserver, {}),
|
|
7346
|
+
/* @__PURE__ */ jsx37(KeepTourProvider, { ...tour, children }),
|
|
7347
|
+
/* @__PURE__ */ jsx37(KeepAnnouncements, {})
|
|
7294
7348
|
] })
|
|
7295
7349
|
}
|
|
7296
7350
|
)
|
|
@@ -7321,7 +7375,7 @@ function createKeepKit(options = {}) {
|
|
|
7321
7375
|
} = options;
|
|
7322
7376
|
const coreKit = createCoreKeepKit(coreOptions);
|
|
7323
7377
|
return {
|
|
7324
|
-
Provider: (props) => /* @__PURE__ */
|
|
7378
|
+
Provider: (props) => /* @__PURE__ */ jsx37(
|
|
7325
7379
|
KeepKitProvider,
|
|
7326
7380
|
{
|
|
7327
7381
|
...coreOptions,
|
|
@@ -7344,9 +7398,9 @@ function createKeepKit(options = {}) {
|
|
|
7344
7398
|
...props
|
|
7345
7399
|
}
|
|
7346
7400
|
),
|
|
7347
|
-
Button: (props) => /* @__PURE__ */
|
|
7348
|
-
Backup: (props) => /* @__PURE__ */
|
|
7349
|
-
Collection: (props) => /* @__PURE__ */
|
|
7401
|
+
Button: (props) => /* @__PURE__ */ jsx37(KeepButton, { ...props }),
|
|
7402
|
+
Backup: (props) => /* @__PURE__ */ jsx37(KeepBackup, { ...props }),
|
|
7403
|
+
Collection: (props) => /* @__PURE__ */ jsx37(
|
|
7350
7404
|
KeepCollection,
|
|
7351
7405
|
{
|
|
7352
7406
|
...props,
|
|
@@ -7357,8 +7411,8 @@ function createKeepKit(options = {}) {
|
|
|
7357
7411
|
}
|
|
7358
7412
|
}
|
|
7359
7413
|
),
|
|
7360
|
-
CollectionManager: (props) => /* @__PURE__ */
|
|
7361
|
-
Workspace: (props) => /* @__PURE__ */
|
|
7414
|
+
CollectionManager: (props) => /* @__PURE__ */ jsx37(KeepCollectionManager, { ...props }),
|
|
7415
|
+
Workspace: (props) => /* @__PURE__ */ jsx37(
|
|
7362
7416
|
KeepWorkspace,
|
|
7363
7417
|
{
|
|
7364
7418
|
...props,
|
|
@@ -7375,11 +7429,12 @@ function createKeepKit(options = {}) {
|
|
|
7375
7429
|
useContext: () => coreKit.useContext(),
|
|
7376
7430
|
useItem: (item) => coreKit.useItem(item),
|
|
7377
7431
|
useList: (query) => coreKit.useList(query),
|
|
7432
|
+
useRediscovery: (rediscoveryOptions) => coreKit.useRediscovery(rediscoveryOptions),
|
|
7378
7433
|
useCollections: (collectionsOptions) => coreKit.useCollections(collectionsOptions),
|
|
7379
7434
|
useNavigator: (navigatorOptions) => coreKit.useNavigator(navigatorOptions),
|
|
7380
7435
|
useShortcut: (shortcutOptions) => coreKit.useShortcut(shortcutOptions),
|
|
7381
|
-
FloatingTour: (props) => /* @__PURE__ */
|
|
7382
|
-
TourProvider: (props) => /* @__PURE__ */
|
|
7436
|
+
FloatingTour: (props) => /* @__PURE__ */ jsx37(KeepFloatingTour, { ...props }),
|
|
7437
|
+
TourProvider: (props) => /* @__PURE__ */ jsx37(KeepTourProvider, { ...props }),
|
|
7383
7438
|
useTour: (tourOptions) => useKeepTour(tourOptions)
|
|
7384
7439
|
};
|
|
7385
7440
|
}
|
|
@@ -7418,6 +7473,7 @@ export {
|
|
|
7418
7473
|
KeepProvider,
|
|
7419
7474
|
KeepPruneStaleButton,
|
|
7420
7475
|
KeepQuickEditor,
|
|
7476
|
+
KeepRediscovery,
|
|
7421
7477
|
KeepReorderableList,
|
|
7422
7478
|
KeepSavePopover,
|
|
7423
7479
|
KeepSearchInput,
|
|
@@ -7458,6 +7514,7 @@ export {
|
|
|
7458
7514
|
useKeepList7 as useKeepList,
|
|
7459
7515
|
useKeepNavigator2 as useKeepNavigator,
|
|
7460
7516
|
useKeepQuickEditor,
|
|
7517
|
+
useKeepRediscovery,
|
|
7461
7518
|
useKeepShortcut,
|
|
7462
7519
|
useKeepToastFeedback,
|
|
7463
7520
|
useKeepTour,
|