@keepkit/ui 0.27.3 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/index.d.ts +62 -2
- package/dist/index.js +476 -156
- package/dist/index.js.map +1 -1
- package/dist/styles/collection.css +66 -0
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -6112,6 +6112,89 @@ function useKeepToastFeedback(showToast) {
|
|
|
6112
6112
|
);
|
|
6113
6113
|
}
|
|
6114
6114
|
|
|
6115
|
+
// src/features/navigation/KeepFloatingTour.tsx
|
|
6116
|
+
import { useKeepList as useKeepList6 } from "@keepkit/core/react";
|
|
6117
|
+
import { useEffect as useEffect15, useMemo as useMemo6, useRef as useRef10, useState as useState20 } from "react";
|
|
6118
|
+
import { createPortal } from "react-dom";
|
|
6119
|
+
|
|
6120
|
+
// src/foundation/theme.tsx
|
|
6121
|
+
import {
|
|
6122
|
+
createContext as createContext4,
|
|
6123
|
+
isValidElement as isValidElement8,
|
|
6124
|
+
useContext as useContext4
|
|
6125
|
+
} from "react";
|
|
6126
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
6127
|
+
var keepThemeNames = [
|
|
6128
|
+
"default",
|
|
6129
|
+
"ocean",
|
|
6130
|
+
"forest",
|
|
6131
|
+
"sunset",
|
|
6132
|
+
"lavender",
|
|
6133
|
+
"compact",
|
|
6134
|
+
"minimal",
|
|
6135
|
+
"rounded",
|
|
6136
|
+
"high-contrast",
|
|
6137
|
+
"dark"
|
|
6138
|
+
];
|
|
6139
|
+
var KeepThemeContext = createContext4({});
|
|
6140
|
+
function useKeepTheme() {
|
|
6141
|
+
return useContext4(KeepThemeContext);
|
|
6142
|
+
}
|
|
6143
|
+
function KeepThemeProvider({
|
|
6144
|
+
children,
|
|
6145
|
+
theme = "default",
|
|
6146
|
+
mode = "system",
|
|
6147
|
+
density = "comfortable",
|
|
6148
|
+
radius = "medium",
|
|
6149
|
+
accentColor,
|
|
6150
|
+
highContrast = false,
|
|
6151
|
+
reducedMotion = false,
|
|
6152
|
+
variables,
|
|
6153
|
+
style,
|
|
6154
|
+
className,
|
|
6155
|
+
asChild = false,
|
|
6156
|
+
...props
|
|
6157
|
+
}) {
|
|
6158
|
+
const themeClassName = [
|
|
6159
|
+
"keep-theme",
|
|
6160
|
+
`keep-theme--${theme}`,
|
|
6161
|
+
`keep-theme--${mode}`,
|
|
6162
|
+
`keep-theme--density-${density}`,
|
|
6163
|
+
`keep-theme--radius-${radius}`,
|
|
6164
|
+
className
|
|
6165
|
+
].filter(Boolean).join(" ");
|
|
6166
|
+
const themeStyle = {
|
|
6167
|
+
...style,
|
|
6168
|
+
...accentColor && !highContrast ? { "--keep-accent": accentColor, "--keep-primary": accentColor } : {},
|
|
6169
|
+
...variables
|
|
6170
|
+
};
|
|
6171
|
+
const rootProps = {
|
|
6172
|
+
...props,
|
|
6173
|
+
className: themeClassName,
|
|
6174
|
+
style: themeStyle,
|
|
6175
|
+
"data-keep-theme": theme,
|
|
6176
|
+
"data-theme": theme,
|
|
6177
|
+
"data-mode": mode,
|
|
6178
|
+
"data-density": density,
|
|
6179
|
+
"data-radius": radius,
|
|
6180
|
+
"data-accent-color": accentColor,
|
|
6181
|
+
"data-high-contrast": highContrast ? "true" : void 0,
|
|
6182
|
+
"data-reduced-motion": reducedMotion ? "true" : void 0
|
|
6183
|
+
};
|
|
6184
|
+
const content = asChild ? (() => {
|
|
6185
|
+
if (!isValidElement8(children))
|
|
6186
|
+
throw new Error("KeepThemeProvider with asChild requires a single React element child.");
|
|
6187
|
+
return createSlot(children, rootProps);
|
|
6188
|
+
})() : /* @__PURE__ */ jsx28("div", { ...rootProps, children });
|
|
6189
|
+
return /* @__PURE__ */ jsx28(
|
|
6190
|
+
KeepThemeContext.Provider,
|
|
6191
|
+
{
|
|
6192
|
+
value: { theme, mode, density, radius, accentColor, highContrast, reducedMotion, variables, style },
|
|
6193
|
+
children: content
|
|
6194
|
+
}
|
|
6195
|
+
);
|
|
6196
|
+
}
|
|
6197
|
+
|
|
6115
6198
|
// src/features/navigation/KeepTourBar.tsx
|
|
6116
6199
|
import { useKeepNavigator } from "@keepkit/core/react";
|
|
6117
6200
|
import { useId as useId6 } from "react";
|
|
@@ -6149,7 +6232,7 @@ function isEditableTarget(target) {
|
|
|
6149
6232
|
}
|
|
6150
6233
|
|
|
6151
6234
|
// src/features/navigation/KeepTourBar.tsx
|
|
6152
|
-
import { Fragment as Fragment16, jsx as
|
|
6235
|
+
import { Fragment as Fragment16, jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6153
6236
|
function KeepTourBar({
|
|
6154
6237
|
navigation: providedNavigation,
|
|
6155
6238
|
currentId,
|
|
@@ -6220,8 +6303,8 @@ function KeepTourBar({
|
|
|
6220
6303
|
}
|
|
6221
6304
|
});
|
|
6222
6305
|
const body = /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
6223
|
-
showProgress ? /* @__PURE__ */
|
|
6224
|
-
/* @__PURE__ */
|
|
6306
|
+
showProgress ? /* @__PURE__ */ jsx29("span", { "data-keepkit": "tour-progress", "aria-live": "polite", children: progress ?? `${navigation.currentPosition ?? 0} / ${navigation.items.length}` }) : null,
|
|
6307
|
+
/* @__PURE__ */ jsx29(
|
|
6225
6308
|
TourAction,
|
|
6226
6309
|
{
|
|
6227
6310
|
href: resolvedPrevHref,
|
|
@@ -6237,7 +6320,7 @@ function KeepTourBar({
|
|
|
6237
6320
|
children: previousLabel
|
|
6238
6321
|
}
|
|
6239
6322
|
),
|
|
6240
|
-
/* @__PURE__ */
|
|
6323
|
+
/* @__PURE__ */ jsx29(
|
|
6241
6324
|
TourAction,
|
|
6242
6325
|
{
|
|
6243
6326
|
href: resolvedNextHref,
|
|
@@ -6253,7 +6336,7 @@ function KeepTourBar({
|
|
|
6253
6336
|
children: nextItemLabel
|
|
6254
6337
|
}
|
|
6255
6338
|
),
|
|
6256
|
-
resolvedBackHref || onBack ? /* @__PURE__ */
|
|
6339
|
+
resolvedBackHref || onBack ? /* @__PURE__ */ jsx29(TourAction, { href: resolvedBackHref, onClick: onBack, "data-keep-action": "tour-back", children: listLabel }) : null
|
|
6257
6340
|
] });
|
|
6258
6341
|
return renderRoot(
|
|
6259
6342
|
asChild,
|
|
@@ -6266,12 +6349,12 @@ function KeepTourBar({
|
|
|
6266
6349
|
function TourAction({ href, disabled = false, onClick, children, preview, shortcut, ...props }) {
|
|
6267
6350
|
const previewId = useId6();
|
|
6268
6351
|
const content = /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
6269
|
-
/* @__PURE__ */
|
|
6270
|
-
shortcut ? /* @__PURE__ */
|
|
6271
|
-
preview ? /* @__PURE__ */
|
|
6352
|
+
/* @__PURE__ */ jsx29("span", { "data-tour-label": "true", children }),
|
|
6353
|
+
shortcut ? /* @__PURE__ */ jsx29(KeepShortcutHint, { shortcut }) : null,
|
|
6354
|
+
preview ? /* @__PURE__ */ jsx29("small", { id: previewId, "data-tour-preview": "true", children: preview }) : null
|
|
6272
6355
|
] });
|
|
6273
6356
|
if (href && !disabled) {
|
|
6274
|
-
return /* @__PURE__ */
|
|
6357
|
+
return /* @__PURE__ */ jsx29(
|
|
6275
6358
|
"a",
|
|
6276
6359
|
{
|
|
6277
6360
|
...props,
|
|
@@ -6283,7 +6366,7 @@ function TourAction({ href, disabled = false, onClick, children, preview, shortc
|
|
|
6283
6366
|
}
|
|
6284
6367
|
);
|
|
6285
6368
|
}
|
|
6286
|
-
return /* @__PURE__ */
|
|
6369
|
+
return /* @__PURE__ */ jsx29(
|
|
6287
6370
|
"button",
|
|
6288
6371
|
{
|
|
6289
6372
|
...props,
|
|
@@ -6302,12 +6385,304 @@ function navigateTo(item, href) {
|
|
|
6302
6385
|
window.location.assign(href);
|
|
6303
6386
|
}
|
|
6304
6387
|
|
|
6388
|
+
// src/features/navigation/tour-context.tsx
|
|
6389
|
+
import { useKeepList as useKeepList5 } from "@keepkit/core/react";
|
|
6390
|
+
import { createContext as createContext5, useCallback as useCallback10, useContext as useContext5, useEffect as useEffect14, useMemo as useMemo5, useState as useState19 } from "react";
|
|
6391
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
6392
|
+
var SESSION_VERSION = 1;
|
|
6393
|
+
var KeepTourContext = createContext5(null);
|
|
6394
|
+
function KeepTourProvider({
|
|
6395
|
+
children,
|
|
6396
|
+
sessionKey = "keepkit:tour",
|
|
6397
|
+
getItemHref,
|
|
6398
|
+
getBackHref,
|
|
6399
|
+
onNavigate
|
|
6400
|
+
}) {
|
|
6401
|
+
const list = useKeepList5();
|
|
6402
|
+
const [tour, setTour] = useState19(
|
|
6403
|
+
null
|
|
6404
|
+
);
|
|
6405
|
+
const [persistenceStatus, setPersistenceStatus] = useState19("persistent");
|
|
6406
|
+
const itemsById = useMemo5(() => new Map(list.items.map((item) => [item.id, item])), [list.items]);
|
|
6407
|
+
const readStorage = useCallback10(() => {
|
|
6408
|
+
try {
|
|
6409
|
+
const raw = window.sessionStorage.getItem(sessionKey);
|
|
6410
|
+
if (!raw) return null;
|
|
6411
|
+
const parsed = JSON.parse(raw);
|
|
6412
|
+
if (!parsed || typeof parsed !== "object") return null;
|
|
6413
|
+
const value2 = parsed;
|
|
6414
|
+
if (value2.version !== SESSION_VERSION || !Array.isArray(value2.itemIds) || typeof value2.currentId !== "string")
|
|
6415
|
+
return null;
|
|
6416
|
+
const ids = value2.itemIds.filter((id) => typeof id === "string");
|
|
6417
|
+
if (!ids.length || new Set(ids).size !== ids.length) return null;
|
|
6418
|
+
return {
|
|
6419
|
+
version: SESSION_VERSION,
|
|
6420
|
+
itemIds: ids,
|
|
6421
|
+
currentId: value2.currentId,
|
|
6422
|
+
collapsed: value2.collapsed === true
|
|
6423
|
+
};
|
|
6424
|
+
} catch {
|
|
6425
|
+
setPersistenceStatus("memory");
|
|
6426
|
+
return null;
|
|
6427
|
+
}
|
|
6428
|
+
}, [sessionKey]);
|
|
6429
|
+
const writeStorage = useCallback10(
|
|
6430
|
+
(value2) => {
|
|
6431
|
+
try {
|
|
6432
|
+
if (value2) window.sessionStorage.setItem(sessionKey, JSON.stringify({ version: SESSION_VERSION, ...value2 }));
|
|
6433
|
+
else window.sessionStorage.removeItem(sessionKey);
|
|
6434
|
+
setPersistenceStatus("persistent");
|
|
6435
|
+
} catch {
|
|
6436
|
+
setPersistenceStatus("memory");
|
|
6437
|
+
}
|
|
6438
|
+
},
|
|
6439
|
+
[sessionKey]
|
|
6440
|
+
);
|
|
6441
|
+
useEffect14(() => {
|
|
6442
|
+
if (!list.isHydrated || list.error || tour) return;
|
|
6443
|
+
const stored = typeof window === "undefined" ? null : readStorage();
|
|
6444
|
+
if (!stored) return;
|
|
6445
|
+
const ids = stored.itemIds.filter((id) => itemsById.has(id));
|
|
6446
|
+
if (!ids.length) {
|
|
6447
|
+
writeStorage(null);
|
|
6448
|
+
return;
|
|
6449
|
+
}
|
|
6450
|
+
const currentId = ids.includes(stored.currentId) ? stored.currentId : ids[0];
|
|
6451
|
+
setTour({ itemIds: ids, currentId, collapsed: stored.collapsed });
|
|
6452
|
+
}, [itemsById, list.error, list.isHydrated, readStorage, tour, writeStorage]);
|
|
6453
|
+
useEffect14(() => {
|
|
6454
|
+
if (!tour || list.isLoading || list.error) return;
|
|
6455
|
+
const ids = tour.itemIds.filter((id) => itemsById.has(id));
|
|
6456
|
+
if (!ids.length) {
|
|
6457
|
+
setTour(null);
|
|
6458
|
+
writeStorage(null);
|
|
6459
|
+
return;
|
|
6460
|
+
}
|
|
6461
|
+
const currentId = tour.currentId && ids.includes(tour.currentId) ? tour.currentId : ids[0];
|
|
6462
|
+
if (ids.length !== tour.itemIds.length || currentId !== tour.currentId) {
|
|
6463
|
+
const next = { ...tour, itemIds: ids, currentId };
|
|
6464
|
+
setTour(next);
|
|
6465
|
+
writeStorage(next);
|
|
6466
|
+
}
|
|
6467
|
+
}, [itemsById, list.error, list.isLoading, tour, writeStorage]);
|
|
6468
|
+
const start = useCallback10(
|
|
6469
|
+
(options) => {
|
|
6470
|
+
const ids = [...options.itemIds];
|
|
6471
|
+
if (!ids.length || new Set(ids).size !== ids.length || ids.some((id) => !itemsById.has(id))) return false;
|
|
6472
|
+
const currentId = options.currentId ?? ids[0];
|
|
6473
|
+
if (!ids.includes(currentId)) return false;
|
|
6474
|
+
const next = { itemIds: ids, currentId, collapsed: false };
|
|
6475
|
+
setTour(next);
|
|
6476
|
+
writeStorage(next);
|
|
6477
|
+
return true;
|
|
6478
|
+
},
|
|
6479
|
+
[itemsById, writeStorage]
|
|
6480
|
+
);
|
|
6481
|
+
const end = useCallback10(() => {
|
|
6482
|
+
setTour(null);
|
|
6483
|
+
writeStorage(null);
|
|
6484
|
+
}, [writeStorage]);
|
|
6485
|
+
const setCurrentId = useCallback10(
|
|
6486
|
+
(id) => {
|
|
6487
|
+
setTour((current) => {
|
|
6488
|
+
if (!current?.currentId || current.currentId === id || !current.itemIds.includes(id)) return current;
|
|
6489
|
+
const next = { ...current, currentId: id };
|
|
6490
|
+
writeStorage(next);
|
|
6491
|
+
return next;
|
|
6492
|
+
});
|
|
6493
|
+
},
|
|
6494
|
+
[writeStorage]
|
|
6495
|
+
);
|
|
6496
|
+
const move = useCallback10(
|
|
6497
|
+
(delta) => {
|
|
6498
|
+
if (!tour?.currentId) return null;
|
|
6499
|
+
const currentId = tour.currentId;
|
|
6500
|
+
const index = tour.itemIds.indexOf(currentId);
|
|
6501
|
+
const id = tour.itemIds[index + delta];
|
|
6502
|
+
if (!id) return null;
|
|
6503
|
+
setCurrentId(id);
|
|
6504
|
+
return itemsById.get(id) ?? null;
|
|
6505
|
+
},
|
|
6506
|
+
[itemsById, setCurrentId, tour]
|
|
6507
|
+
);
|
|
6508
|
+
const value = useMemo5(
|
|
6509
|
+
() => ({
|
|
6510
|
+
active: tour !== null,
|
|
6511
|
+
itemIds: tour?.itemIds ?? [],
|
|
6512
|
+
currentId: tour?.currentId ?? null,
|
|
6513
|
+
collapsed: tour?.collapsed ?? false,
|
|
6514
|
+
persistenceStatus,
|
|
6515
|
+
getItemHref,
|
|
6516
|
+
getBackHref,
|
|
6517
|
+
onNavigate,
|
|
6518
|
+
start,
|
|
6519
|
+
end,
|
|
6520
|
+
collapse: () => setTour((current) => current ? { ...current, collapsed: true } : current),
|
|
6521
|
+
expand: () => setTour((current) => current ? { ...current, collapsed: false } : current),
|
|
6522
|
+
goNext: () => move(1),
|
|
6523
|
+
goPrev: () => move(-1),
|
|
6524
|
+
setCurrentId
|
|
6525
|
+
}),
|
|
6526
|
+
[end, getBackHref, getItemHref, move, onNavigate, persistenceStatus, setCurrentId, start, tour]
|
|
6527
|
+
);
|
|
6528
|
+
useEffect14(() => {
|
|
6529
|
+
if (!tour) return;
|
|
6530
|
+
if (tour.currentId) writeStorage(tour);
|
|
6531
|
+
}, [tour, writeStorage]);
|
|
6532
|
+
return /* @__PURE__ */ jsx30(KeepTourContext.Provider, { value, children });
|
|
6533
|
+
}
|
|
6534
|
+
function useKeepTour(options = {}) {
|
|
6535
|
+
const context = useContext5(KeepTourContext);
|
|
6536
|
+
if (!context) throw new Error("useKeepTour must be used within KeepTourProvider.");
|
|
6537
|
+
useEffect14(() => {
|
|
6538
|
+
if (options.currentId && context.active) context.setCurrentId(options.currentId);
|
|
6539
|
+
}, [context, options.currentId]);
|
|
6540
|
+
return context;
|
|
6541
|
+
}
|
|
6542
|
+
|
|
6543
|
+
// src/features/navigation/KeepFloatingTour.tsx
|
|
6544
|
+
import { Fragment as Fragment17, jsx as jsx31, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6545
|
+
function KeepFloatingTour({
|
|
6546
|
+
currentId,
|
|
6547
|
+
getItemHref,
|
|
6548
|
+
getBackHref,
|
|
6549
|
+
onNavigate,
|
|
6550
|
+
onBack,
|
|
6551
|
+
position = "bottom-center",
|
|
6552
|
+
offset = 16,
|
|
6553
|
+
zIndex = 1e3,
|
|
6554
|
+
className,
|
|
6555
|
+
style,
|
|
6556
|
+
keyboardShortcuts = false,
|
|
6557
|
+
showShortcutHint = false
|
|
6558
|
+
}) {
|
|
6559
|
+
const tour = useKeepTour({ currentId });
|
|
6560
|
+
const { items } = useKeepList6();
|
|
6561
|
+
const theme = useKeepTheme();
|
|
6562
|
+
const [mounted, setMounted] = useState20(false);
|
|
6563
|
+
const { labels } = useKeepUiLabels();
|
|
6564
|
+
const collapseLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u6298\u308A\u305F\u305F\u3080" : "Collapse tour";
|
|
6565
|
+
const expandLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u5C55\u958B" : "Expand tour";
|
|
6566
|
+
const endLabel = labels.previousPage === "\u524D\u306E\u30DA\u30FC\u30B8" ? "\u7D42\u4E86" : "End tour";
|
|
6567
|
+
const expandRef = useRef10(null);
|
|
6568
|
+
const collapseRef = useRef10(null);
|
|
6569
|
+
useEffect15(() => setMounted(true), []);
|
|
6570
|
+
useEffect15(() => {
|
|
6571
|
+
if (!mounted || !tour.active) return;
|
|
6572
|
+
const button = tour.collapsed ? expandRef.current : collapseRef.current;
|
|
6573
|
+
if (button) button.focus();
|
|
6574
|
+
}, [mounted, tour.active, tour.collapsed]);
|
|
6575
|
+
const activeId = currentId ?? tour.currentId;
|
|
6576
|
+
const navigation = useMemo6(() => {
|
|
6577
|
+
const tourItems = tour.itemIds.map((id) => items.find((item) => item.id === id)).filter((item) => item !== void 0);
|
|
6578
|
+
const currentIndex = activeId ? tourItems.findIndex((item) => item.id === activeId) : -1;
|
|
6579
|
+
const currentItem = currentIndex >= 0 ? tourItems[currentIndex] ?? null : null;
|
|
6580
|
+
return {
|
|
6581
|
+
items: tourItems,
|
|
6582
|
+
currentIndex,
|
|
6583
|
+
currentPosition: currentIndex >= 0 ? currentIndex + 1 : null,
|
|
6584
|
+
currentItem,
|
|
6585
|
+
hasNext: currentIndex >= 0 && currentIndex < tourItems.length - 1,
|
|
6586
|
+
hasPrev: currentIndex > 0,
|
|
6587
|
+
nextItem: currentIndex >= 0 ? tourItems[currentIndex + 1] ?? null : null,
|
|
6588
|
+
prevItem: currentIndex > 0 ? tourItems[currentIndex - 1] ?? null : null,
|
|
6589
|
+
goToNext: tour.goNext,
|
|
6590
|
+
goToPrev: tour.goPrev,
|
|
6591
|
+
goToIndex: (index) => {
|
|
6592
|
+
const item = tourItems[index];
|
|
6593
|
+
if (!item) return null;
|
|
6594
|
+
tour.setCurrentId(item.id);
|
|
6595
|
+
return item;
|
|
6596
|
+
},
|
|
6597
|
+
goToItem: (id) => tourItems.find((item) => item.id === id) ?? null
|
|
6598
|
+
};
|
|
6599
|
+
}, [activeId, items, tour]);
|
|
6600
|
+
if (!mounted || !tour.active || typeof document === "undefined" || !activeId) return null;
|
|
6601
|
+
const placementStyle = {
|
|
6602
|
+
"--keep-tour-offset": typeof offset === "number" ? `${offset}px` : offset,
|
|
6603
|
+
"--keep-tour-z-index": zIndex,
|
|
6604
|
+
...style
|
|
6605
|
+
};
|
|
6606
|
+
const content = tour.collapsed ? /* @__PURE__ */ jsxs25(
|
|
6607
|
+
"button",
|
|
6608
|
+
{
|
|
6609
|
+
ref: expandRef,
|
|
6610
|
+
type: "button",
|
|
6611
|
+
className: "keep-floating-tour__expand",
|
|
6612
|
+
"data-keep-action": "tour-expand",
|
|
6613
|
+
"aria-label": `${expandLabel} (${tour.itemIds.indexOf(activeId) + 1} / ${tour.itemIds.length})`,
|
|
6614
|
+
onClick: () => tour.expand(),
|
|
6615
|
+
children: [
|
|
6616
|
+
tour.itemIds.indexOf(activeId) + 1,
|
|
6617
|
+
" / ",
|
|
6618
|
+
tour.itemIds.length
|
|
6619
|
+
]
|
|
6620
|
+
}
|
|
6621
|
+
) : /* @__PURE__ */ jsxs25(Fragment17, { children: [
|
|
6622
|
+
/* @__PURE__ */ jsx31(
|
|
6623
|
+
KeepTourBar,
|
|
6624
|
+
{
|
|
6625
|
+
className: "keep-floating-tour__bar",
|
|
6626
|
+
navigation,
|
|
6627
|
+
currentId: activeId,
|
|
6628
|
+
getItemHref: getItemHref ?? tour.getItemHref,
|
|
6629
|
+
getBackHref: getBackHref ?? tour.getBackHref,
|
|
6630
|
+
onNavigate: onNavigate ?? tour.onNavigate,
|
|
6631
|
+
onBack: () => {
|
|
6632
|
+
tour.end();
|
|
6633
|
+
return onBack?.();
|
|
6634
|
+
},
|
|
6635
|
+
keyboardShortcuts,
|
|
6636
|
+
showShortcutHint
|
|
6637
|
+
}
|
|
6638
|
+
),
|
|
6639
|
+
/* @__PURE__ */ jsx31(
|
|
6640
|
+
"button",
|
|
6641
|
+
{
|
|
6642
|
+
ref: collapseRef,
|
|
6643
|
+
type: "button",
|
|
6644
|
+
className: "keep-floating-tour__control",
|
|
6645
|
+
"data-keep-action": "tour-collapse",
|
|
6646
|
+
"aria-label": collapseLabel,
|
|
6647
|
+
onClick: () => tour.collapse(),
|
|
6648
|
+
children: "\u2212"
|
|
6649
|
+
}
|
|
6650
|
+
),
|
|
6651
|
+
/* @__PURE__ */ jsx31(
|
|
6652
|
+
"button",
|
|
6653
|
+
{
|
|
6654
|
+
type: "button",
|
|
6655
|
+
className: "keep-floating-tour__control",
|
|
6656
|
+
"data-keep-action": "tour-end",
|
|
6657
|
+
"aria-label": endLabel,
|
|
6658
|
+
onClick: () => tour.end(),
|
|
6659
|
+
children: "\xD7"
|
|
6660
|
+
}
|
|
6661
|
+
)
|
|
6662
|
+
] });
|
|
6663
|
+
return createPortal(
|
|
6664
|
+
/* @__PURE__ */ jsx31(KeepThemeProvider, { ...theme, children: /* @__PURE__ */ jsx31(
|
|
6665
|
+
"aside",
|
|
6666
|
+
{
|
|
6667
|
+
className: ["keep-floating-tour", `keep-floating-tour--${position}`, className].filter(Boolean).join(" "),
|
|
6668
|
+
style: placementStyle,
|
|
6669
|
+
"data-keepkit": "floating-tour",
|
|
6670
|
+
"data-state": tour.collapsed ? "collapsed" : "expanded",
|
|
6671
|
+
"data-persistence": tour.persistenceStatus,
|
|
6672
|
+
"aria-label": "KeepKit tour",
|
|
6673
|
+
children: content
|
|
6674
|
+
}
|
|
6675
|
+
) }),
|
|
6676
|
+
document.body
|
|
6677
|
+
);
|
|
6678
|
+
}
|
|
6679
|
+
|
|
6305
6680
|
// src/features/status/status.tsx
|
|
6306
|
-
import { isValidElement as
|
|
6681
|
+
import { isValidElement as isValidElement9 } from "react";
|
|
6307
6682
|
|
|
6308
6683
|
// src/features/status/hooks/useStatusViews.ts
|
|
6309
6684
|
import { useKeepContext as useKeepContext7 } from "@keepkit/core/react";
|
|
6310
|
-
import { useEffect as
|
|
6685
|
+
import { useEffect as useEffect16, useRef as useRef11, useState as useState21 } from "react";
|
|
6311
6686
|
function useKeepStatus(status) {
|
|
6312
6687
|
const context = useKeepContext7();
|
|
6313
6688
|
const resolvedStatus = status ?? getDerivedStatus(context);
|
|
@@ -6324,9 +6699,9 @@ function useKeepAnnouncements(messages) {
|
|
|
6324
6699
|
const savedMessage = useUiLabel("savedMessage", messages?.save);
|
|
6325
6700
|
const removedMessage = useUiLabel("removedMessage", messages?.remove);
|
|
6326
6701
|
const noteSavedMessage = useUiLabel("noteSavedMessage", messages?.note);
|
|
6327
|
-
const [message, setMessage] =
|
|
6328
|
-
const lastChangeRef =
|
|
6329
|
-
|
|
6702
|
+
const [message, setMessage] = useState21("");
|
|
6703
|
+
const lastChangeRef = useRef11(void 0);
|
|
6704
|
+
useEffect16(() => {
|
|
6330
6705
|
const change = context.lastChange;
|
|
6331
6706
|
if (!change || change === lastChangeRef.current) return;
|
|
6332
6707
|
lastChangeRef.current = change;
|
|
@@ -6354,7 +6729,7 @@ function getStatusLabelKey3(status) {
|
|
|
6354
6729
|
}
|
|
6355
6730
|
|
|
6356
6731
|
// src/features/status/status.tsx
|
|
6357
|
-
import { jsx as
|
|
6732
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
6358
6733
|
function KeepStatus({
|
|
6359
6734
|
status,
|
|
6360
6735
|
labels,
|
|
@@ -6365,12 +6740,12 @@ function KeepStatus({
|
|
|
6365
6740
|
...rootProps
|
|
6366
6741
|
}) {
|
|
6367
6742
|
const view = useKeepStatus(status);
|
|
6368
|
-
const contentChildren = asChild &&
|
|
6743
|
+
const contentChildren = asChild && isValidElement9(children) ? void 0 : children;
|
|
6369
6744
|
const body = render ? render(view.state) : typeof contentChildren === "function" ? contentChildren(view.state) : contentChildren ?? labels?.[view.state.status] ?? view.defaultLabel;
|
|
6370
6745
|
const role = rootProps.role ?? (view.state.status === "error" ? "alert" : "status");
|
|
6371
6746
|
return renderRoot(
|
|
6372
6747
|
asChild,
|
|
6373
|
-
|
|
6748
|
+
isValidElement9(children) ? children : void 0,
|
|
6374
6749
|
{
|
|
6375
6750
|
...rootProps,
|
|
6376
6751
|
className,
|
|
@@ -6386,7 +6761,7 @@ function KeepStatus({
|
|
|
6386
6761
|
}
|
|
6387
6762
|
function KeepAnnouncements({ messages, ...props }) {
|
|
6388
6763
|
const message = useKeepAnnouncements(messages);
|
|
6389
|
-
return /* @__PURE__ */
|
|
6764
|
+
return /* @__PURE__ */ jsx32(
|
|
6390
6765
|
"div",
|
|
6391
6766
|
{
|
|
6392
6767
|
...props,
|
|
@@ -6403,14 +6778,14 @@ var KeepAnnouncer = KeepAnnouncements;
|
|
|
6403
6778
|
|
|
6404
6779
|
// src/features/sync/hooks/useKeepSyncFeedback.ts
|
|
6405
6780
|
import { useKeepContext as useKeepContext8 } from "@keepkit/core/react";
|
|
6406
|
-
import { useEffect as
|
|
6781
|
+
import { useEffect as useEffect17, useRef as useRef12 } from "react";
|
|
6407
6782
|
function useKeepSyncFeedback() {
|
|
6408
6783
|
const { syncState } = useKeepContext8();
|
|
6409
6784
|
const emitFeedback = useKeepUiFeedback();
|
|
6410
6785
|
const completedMessage = useUiLabel("syncSynced");
|
|
6411
6786
|
const failedMessage = useUiLabel("syncFailedMessage");
|
|
6412
|
-
const previousStatus =
|
|
6413
|
-
|
|
6787
|
+
const previousStatus = useRef12("idle");
|
|
6788
|
+
useEffect17(() => {
|
|
6414
6789
|
const previous = previousStatus.current;
|
|
6415
6790
|
previousStatus.current = syncState.status;
|
|
6416
6791
|
if (syncState.status === "error" && previous !== "error") {
|
|
@@ -6431,16 +6806,16 @@ function KeepSyncFeedbackObserver() {
|
|
|
6431
6806
|
|
|
6432
6807
|
// src/features/sync/hooks/useKeepSyncRecoveryDialog.ts
|
|
6433
6808
|
import { useKeepContext as useKeepContext9 } from "@keepkit/core/react";
|
|
6434
|
-
import { useEffect as
|
|
6809
|
+
import { useEffect as useEffect18, useState as useState22 } from "react";
|
|
6435
6810
|
function useKeepSyncRecoveryDialog(options) {
|
|
6436
6811
|
const { open, onOpenChange, conflicts, onManualMerge } = options;
|
|
6437
6812
|
const context = useKeepContext9();
|
|
6438
6813
|
const conflictList = conflicts ?? context.syncState.conflicts ?? [];
|
|
6439
6814
|
const hasRecovery = conflictList.length > 0 || context.syncState.status === "error" || Boolean(context.error);
|
|
6440
|
-
const [dismissed, setDismissed] =
|
|
6441
|
-
const [busyId, setBusyId] =
|
|
6442
|
-
const [error, setError] =
|
|
6443
|
-
|
|
6815
|
+
const [dismissed, setDismissed] = useState22(false);
|
|
6816
|
+
const [busyId, setBusyId] = useState22();
|
|
6817
|
+
const [error, setError] = useState22();
|
|
6818
|
+
useEffect18(() => {
|
|
6444
6819
|
if (hasRecovery) setDismissed(false);
|
|
6445
6820
|
}, [hasRecovery]);
|
|
6446
6821
|
return {
|
|
@@ -6485,7 +6860,7 @@ function useKeepSyncRecoveryDialog(options) {
|
|
|
6485
6860
|
}
|
|
6486
6861
|
|
|
6487
6862
|
// src/features/sync/KeepSyncRecoveryDialog.tsx
|
|
6488
|
-
import { jsx as
|
|
6863
|
+
import { jsx as jsx33, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6489
6864
|
function KeepSyncRecoveryDialog({
|
|
6490
6865
|
open,
|
|
6491
6866
|
onOpenChange,
|
|
@@ -6500,7 +6875,7 @@ function KeepSyncRecoveryDialog({
|
|
|
6500
6875
|
}) {
|
|
6501
6876
|
const view = useKeepSyncRecoveryDialog({ open, onOpenChange, conflicts, onManualMerge });
|
|
6502
6877
|
if (!view.isOpen) return null;
|
|
6503
|
-
return /* @__PURE__ */
|
|
6878
|
+
return /* @__PURE__ */ jsxs26(
|
|
6504
6879
|
"section",
|
|
6505
6880
|
{
|
|
6506
6881
|
...props,
|
|
@@ -6514,17 +6889,17 @@ function KeepSyncRecoveryDialog({
|
|
|
6514
6889
|
"data-state": view.conflictList.length > 0 ? "conflict" : "error",
|
|
6515
6890
|
"data-loading": view.busyId !== void 0 ? "true" : void 0,
|
|
6516
6891
|
children: [
|
|
6517
|
-
/* @__PURE__ */
|
|
6518
|
-
/* @__PURE__ */
|
|
6519
|
-
/* @__PURE__ */
|
|
6892
|
+
/* @__PURE__ */ jsxs26("header", { children: [
|
|
6893
|
+
/* @__PURE__ */ jsx33("h2", { id: "keepkit-sync-recovery-title", children: title ?? view.labels.title }),
|
|
6894
|
+
/* @__PURE__ */ jsx33("button", { type: "button", "data-keep-action": "close-dialog", onClick: view.close, "aria-label": view.labels.close, children: view.labels.close })
|
|
6520
6895
|
] }),
|
|
6521
6896
|
children,
|
|
6522
|
-
view.conflictList.length > 0 ? /* @__PURE__ */
|
|
6523
|
-
/* @__PURE__ */
|
|
6524
|
-
view.conflictList.map((conflict) => /* @__PURE__ */
|
|
6525
|
-
/* @__PURE__ */
|
|
6526
|
-
/* @__PURE__ */
|
|
6527
|
-
/* @__PURE__ */
|
|
6897
|
+
view.conflictList.length > 0 ? /* @__PURE__ */ jsxs26("div", { children: [
|
|
6898
|
+
/* @__PURE__ */ jsx33("p", { children: view.labels.conflict }),
|
|
6899
|
+
view.conflictList.map((conflict) => /* @__PURE__ */ jsxs26("article", { "data-conflict-id": conflict.id, children: [
|
|
6900
|
+
/* @__PURE__ */ jsx33("h3", { children: getMetaTitle(conflict.operation.item?.meta) ?? conflict.id }),
|
|
6901
|
+
/* @__PURE__ */ jsxs26("div", { "data-conflict-preview": true, children: [
|
|
6902
|
+
/* @__PURE__ */ jsx33(
|
|
6528
6903
|
ConflictPreview,
|
|
6529
6904
|
{
|
|
6530
6905
|
item: conflict.operation.item,
|
|
@@ -6534,7 +6909,7 @@ function KeepSyncRecoveryDialog({
|
|
|
6534
6909
|
side: "local"
|
|
6535
6910
|
}
|
|
6536
6911
|
),
|
|
6537
|
-
/* @__PURE__ */
|
|
6912
|
+
/* @__PURE__ */ jsx33(
|
|
6538
6913
|
ConflictPreview,
|
|
6539
6914
|
{
|
|
6540
6915
|
item: conflict.remote,
|
|
@@ -6545,8 +6920,8 @@ function KeepSyncRecoveryDialog({
|
|
|
6545
6920
|
}
|
|
6546
6921
|
)
|
|
6547
6922
|
] }),
|
|
6548
|
-
/* @__PURE__ */
|
|
6549
|
-
/* @__PURE__ */
|
|
6923
|
+
/* @__PURE__ */ jsxs26("div", { children: [
|
|
6924
|
+
/* @__PURE__ */ jsx33(
|
|
6550
6925
|
"button",
|
|
6551
6926
|
{
|
|
6552
6927
|
type: "button",
|
|
@@ -6556,7 +6931,7 @@ function KeepSyncRecoveryDialog({
|
|
|
6556
6931
|
children: view.labels.keepLocal
|
|
6557
6932
|
}
|
|
6558
6933
|
),
|
|
6559
|
-
/* @__PURE__ */
|
|
6934
|
+
/* @__PURE__ */ jsx33(
|
|
6560
6935
|
"button",
|
|
6561
6936
|
{
|
|
6562
6937
|
type: "button",
|
|
@@ -6566,7 +6941,7 @@ function KeepSyncRecoveryDialog({
|
|
|
6566
6941
|
children: view.labels.useServer
|
|
6567
6942
|
}
|
|
6568
6943
|
),
|
|
6569
|
-
/* @__PURE__ */
|
|
6944
|
+
/* @__PURE__ */ jsx33(
|
|
6570
6945
|
"button",
|
|
6571
6946
|
{
|
|
6572
6947
|
type: "button",
|
|
@@ -6579,12 +6954,12 @@ function KeepSyncRecoveryDialog({
|
|
|
6579
6954
|
] })
|
|
6580
6955
|
] }, conflict.id))
|
|
6581
6956
|
] }) : null,
|
|
6582
|
-
view.showBackupRecovery ? /* @__PURE__ */
|
|
6583
|
-
/* @__PURE__ */
|
|
6584
|
-
/* @__PURE__ */
|
|
6585
|
-
backup ?? (showBackupControls ? /* @__PURE__ */
|
|
6957
|
+
view.showBackupRecovery ? /* @__PURE__ */ jsxs26("section", { "data-recovery": "backup", children: [
|
|
6958
|
+
/* @__PURE__ */ jsx33("h3", { children: view.labels.backupRecovery }),
|
|
6959
|
+
/* @__PURE__ */ jsx33("p", { children: view.labels.backupRecoveryDescription }),
|
|
6960
|
+
backup ?? (showBackupControls ? /* @__PURE__ */ jsx33(KeepBackup, {}) : null)
|
|
6586
6961
|
] }) : null,
|
|
6587
|
-
view.error ? /* @__PURE__ */
|
|
6962
|
+
view.error ? /* @__PURE__ */ jsx33("p", { id: "keepkit-sync-recovery-error", role: "alert", "aria-live": "assertive", children: view.error instanceof Error ? view.error.message : view.labels.error }) : null
|
|
6588
6963
|
]
|
|
6589
6964
|
}
|
|
6590
6965
|
);
|
|
@@ -6596,16 +6971,16 @@ function ConflictPreview({
|
|
|
6596
6971
|
noteLabel,
|
|
6597
6972
|
side
|
|
6598
6973
|
}) {
|
|
6599
|
-
return /* @__PURE__ */
|
|
6600
|
-
/* @__PURE__ */
|
|
6601
|
-
/* @__PURE__ */
|
|
6602
|
-
/* @__PURE__ */
|
|
6603
|
-
/* @__PURE__ */
|
|
6604
|
-
/* @__PURE__ */
|
|
6974
|
+
return /* @__PURE__ */ jsxs26("article", { "data-conflict-version": side, "aria-label": heading, children: [
|
|
6975
|
+
/* @__PURE__ */ jsx33("h4", { children: heading }),
|
|
6976
|
+
/* @__PURE__ */ jsxs26("dl", { children: [
|
|
6977
|
+
/* @__PURE__ */ jsxs26("div", { children: [
|
|
6978
|
+
/* @__PURE__ */ jsx33("dt", { children: updatedAtLabel }),
|
|
6979
|
+
/* @__PURE__ */ jsx33("dd", { children: item ? /* @__PURE__ */ jsx33("time", { dateTime: new Date(item.updatedAt).toISOString(), children: formatConflictDate(item.updatedAt) }) : "\u2014" })
|
|
6605
6980
|
] }),
|
|
6606
|
-
/* @__PURE__ */
|
|
6607
|
-
/* @__PURE__ */
|
|
6608
|
-
/* @__PURE__ */
|
|
6981
|
+
/* @__PURE__ */ jsxs26("div", { children: [
|
|
6982
|
+
/* @__PURE__ */ jsx33("dt", { children: noteLabel }),
|
|
6983
|
+
/* @__PURE__ */ jsx33("dd", { children: item?.note || "\u2014" })
|
|
6609
6984
|
] })
|
|
6610
6985
|
] })
|
|
6611
6986
|
] });
|
|
@@ -6649,7 +7024,7 @@ function getErrorMessage6(error) {
|
|
|
6649
7024
|
}
|
|
6650
7025
|
|
|
6651
7026
|
// src/features/sync/KeepSyncStatusBanner.tsx
|
|
6652
|
-
import { jsx as
|
|
7027
|
+
import { jsx as jsx34, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6653
7028
|
function KeepSyncStatusBanner({
|
|
6654
7029
|
onRetry,
|
|
6655
7030
|
onResolveConflicts,
|
|
@@ -6661,7 +7036,7 @@ function KeepSyncStatusBanner({
|
|
|
6661
7036
|
const showRetryLabel = useUiLabelVisibility("retrySync");
|
|
6662
7037
|
const showResolveLabel = useUiLabelVisibility("resolveSync");
|
|
6663
7038
|
if (view.status === "idle" && !view.hasConflicts) return null;
|
|
6664
|
-
return /* @__PURE__ */
|
|
7039
|
+
return /* @__PURE__ */ jsxs27(
|
|
6665
7040
|
"aside",
|
|
6666
7041
|
{
|
|
6667
7042
|
...props,
|
|
@@ -6671,8 +7046,8 @@ function KeepSyncStatusBanner({
|
|
|
6671
7046
|
"data-keepkit": "sync-status",
|
|
6672
7047
|
"data-state": view.status,
|
|
6673
7048
|
children: [
|
|
6674
|
-
/* @__PURE__ */
|
|
6675
|
-
view.showRetry ? /* @__PURE__ */
|
|
7049
|
+
/* @__PURE__ */ jsx34("p", { children: view.message }),
|
|
7050
|
+
view.showRetry ? /* @__PURE__ */ jsx34(
|
|
6676
7051
|
"button",
|
|
6677
7052
|
{
|
|
6678
7053
|
type: "button",
|
|
@@ -6683,7 +7058,7 @@ function KeepSyncStatusBanner({
|
|
|
6683
7058
|
children: showRetryLabel ? view.retryLabel : null
|
|
6684
7059
|
}
|
|
6685
7060
|
) : null,
|
|
6686
|
-
view.hasConflicts ? /* @__PURE__ */
|
|
7061
|
+
view.hasConflicts ? /* @__PURE__ */ jsx34(
|
|
6687
7062
|
"button",
|
|
6688
7063
|
{
|
|
6689
7064
|
type: "button",
|
|
@@ -6700,7 +7075,7 @@ function KeepSyncStatusBanner({
|
|
|
6700
7075
|
}
|
|
6701
7076
|
|
|
6702
7077
|
// src/features/workspace/hooks/useKeepWorkspace.ts
|
|
6703
|
-
import { useCallback as
|
|
7078
|
+
import { useCallback as useCallback11, useState as useState23 } from "react";
|
|
6704
7079
|
var PRESET_MODULES = {
|
|
6705
7080
|
basic: { syncStatus: false, undo: false, recovery: false, backup: false, stalePrune: false },
|
|
6706
7081
|
standard: { syncStatus: false, undo: true, recovery: false, backup: false, stalePrune: false },
|
|
@@ -6720,16 +7095,16 @@ function useKeepWorkspace({
|
|
|
6720
7095
|
onRecoveryOpenChange,
|
|
6721
7096
|
onResolveConflicts
|
|
6722
7097
|
}) {
|
|
6723
|
-
const [internalRecoveryOpen, setInternalRecoveryOpen] =
|
|
7098
|
+
const [internalRecoveryOpen, setInternalRecoveryOpen] = useState23(false);
|
|
6724
7099
|
const resolvedModules = { ...PRESET_MODULES[preset], ...modules };
|
|
6725
|
-
const setRecoveryOpen =
|
|
7100
|
+
const setRecoveryOpen = useCallback11(
|
|
6726
7101
|
(open) => {
|
|
6727
7102
|
if (recoveryOpen === void 0) setInternalRecoveryOpen(open);
|
|
6728
7103
|
onRecoveryOpenChange?.(open);
|
|
6729
7104
|
},
|
|
6730
7105
|
[onRecoveryOpenChange, recoveryOpen]
|
|
6731
7106
|
);
|
|
6732
|
-
const openRecovery =
|
|
7107
|
+
const openRecovery = useCallback11(() => {
|
|
6733
7108
|
onResolveConflicts?.();
|
|
6734
7109
|
setRecoveryOpen(true);
|
|
6735
7110
|
}, [onResolveConflicts, setRecoveryOpen]);
|
|
@@ -6744,7 +7119,7 @@ function useKeepWorkspace({
|
|
|
6744
7119
|
}
|
|
6745
7120
|
|
|
6746
7121
|
// src/features/workspace/KeepWorkspace.tsx
|
|
6747
|
-
import { jsx as
|
|
7122
|
+
import { jsx as jsx35, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6748
7123
|
function KeepWorkspace({
|
|
6749
7124
|
preset = "standard",
|
|
6750
7125
|
modules,
|
|
@@ -6783,27 +7158,27 @@ function KeepWorkspace({
|
|
|
6783
7158
|
if (!structuredRegions) return content;
|
|
6784
7159
|
if (!hasRenderableContent(content)) return null;
|
|
6785
7160
|
const resolvedSurface = typeof surface === "string" ? surface : surface[name] ?? "plain";
|
|
6786
|
-
return /* @__PURE__ */
|
|
7161
|
+
return /* @__PURE__ */ jsx35("div", { "data-keepkit": "workspace-region", "data-region": name, "data-surface": resolvedSurface, children: content });
|
|
6787
7162
|
};
|
|
6788
7163
|
const before = resolveOptionalSlot(slots?.before, state);
|
|
6789
7164
|
const syncStatus = view.modules.syncStatus ? resolveSlot(
|
|
6790
7165
|
slots?.syncStatus,
|
|
6791
|
-
/* @__PURE__ */
|
|
7166
|
+
/* @__PURE__ */ jsx35(KeepSyncStatusBanner, { ...syncStatusProps, onResolveConflicts: view.openRecovery }),
|
|
6792
7167
|
state
|
|
6793
7168
|
) : null;
|
|
6794
|
-
const collection = resolveSlot(slots?.collection, /* @__PURE__ */
|
|
7169
|
+
const collection = resolveSlot(slots?.collection, /* @__PURE__ */ jsx35(KeepCollection, { ...resolvedCollectionProps }), state);
|
|
6795
7170
|
const actions = view.modules.backup || view.modules.stalePrune ? resolveSlot(
|
|
6796
7171
|
slots?.actions,
|
|
6797
|
-
/* @__PURE__ */
|
|
6798
|
-
view.modules.stalePrune ? /* @__PURE__ */
|
|
6799
|
-
view.modules.backup ? /* @__PURE__ */
|
|
7172
|
+
/* @__PURE__ */ jsxs28("div", { "data-keepkit": "workspace-actions", children: [
|
|
7173
|
+
view.modules.stalePrune ? /* @__PURE__ */ jsx35(KeepPruneStaleButton, { ...stalePruneProps }) : null,
|
|
7174
|
+
view.modules.backup ? /* @__PURE__ */ jsx35(KeepBackup, { ...backupProps }) : null
|
|
6800
7175
|
] }),
|
|
6801
7176
|
state
|
|
6802
7177
|
) : null;
|
|
6803
|
-
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */
|
|
7178
|
+
const undo = view.modules.undo ? resolveSlot(slots?.undo, /* @__PURE__ */ jsx35(KeepUndo, { ...undoProps }), state) : null;
|
|
6804
7179
|
const recovery = view.modules.recovery ? resolveSlot(
|
|
6805
7180
|
slots?.recovery,
|
|
6806
|
-
/* @__PURE__ */
|
|
7181
|
+
/* @__PURE__ */ jsx35(
|
|
6807
7182
|
KeepSyncRecoveryDialog,
|
|
6808
7183
|
{
|
|
6809
7184
|
...recoveryProps,
|
|
@@ -6815,7 +7190,7 @@ function KeepWorkspace({
|
|
|
6815
7190
|
) : null;
|
|
6816
7191
|
const additionalContent = resolveOptionalSlot(children, state);
|
|
6817
7192
|
const after = resolveOptionalSlot(slots?.after, state);
|
|
6818
|
-
return /* @__PURE__ */
|
|
7193
|
+
return /* @__PURE__ */ jsxs28(
|
|
6819
7194
|
"section",
|
|
6820
7195
|
{
|
|
6821
7196
|
...props,
|
|
@@ -6846,70 +7221,6 @@ function resolveOptionalSlot(slot, state) {
|
|
|
6846
7221
|
return resolveContent(slot, state);
|
|
6847
7222
|
}
|
|
6848
7223
|
|
|
6849
|
-
// src/foundation/theme.tsx
|
|
6850
|
-
import { isValidElement as isValidElement9 } from "react";
|
|
6851
|
-
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
6852
|
-
var keepThemeNames = [
|
|
6853
|
-
"default",
|
|
6854
|
-
"ocean",
|
|
6855
|
-
"forest",
|
|
6856
|
-
"sunset",
|
|
6857
|
-
"lavender",
|
|
6858
|
-
"compact",
|
|
6859
|
-
"minimal",
|
|
6860
|
-
"rounded",
|
|
6861
|
-
"high-contrast",
|
|
6862
|
-
"dark"
|
|
6863
|
-
];
|
|
6864
|
-
function KeepThemeProvider({
|
|
6865
|
-
children,
|
|
6866
|
-
theme = "default",
|
|
6867
|
-
mode = "system",
|
|
6868
|
-
density = "comfortable",
|
|
6869
|
-
radius = "medium",
|
|
6870
|
-
accentColor,
|
|
6871
|
-
highContrast = false,
|
|
6872
|
-
reducedMotion = false,
|
|
6873
|
-
variables,
|
|
6874
|
-
style,
|
|
6875
|
-
className,
|
|
6876
|
-
asChild = false,
|
|
6877
|
-
...props
|
|
6878
|
-
}) {
|
|
6879
|
-
const themeClassName = [
|
|
6880
|
-
"keep-theme",
|
|
6881
|
-
`keep-theme--${theme}`,
|
|
6882
|
-
`keep-theme--${mode}`,
|
|
6883
|
-
`keep-theme--density-${density}`,
|
|
6884
|
-
`keep-theme--radius-${radius}`,
|
|
6885
|
-
className
|
|
6886
|
-
].filter(Boolean).join(" ");
|
|
6887
|
-
const themeStyle = {
|
|
6888
|
-
...style,
|
|
6889
|
-
...accentColor && !highContrast ? { "--keep-accent": accentColor, "--keep-primary": accentColor } : {},
|
|
6890
|
-
...variables
|
|
6891
|
-
};
|
|
6892
|
-
const rootProps = {
|
|
6893
|
-
...props,
|
|
6894
|
-
className: themeClassName,
|
|
6895
|
-
style: themeStyle,
|
|
6896
|
-
"data-keep-theme": theme,
|
|
6897
|
-
"data-theme": theme,
|
|
6898
|
-
"data-mode": mode,
|
|
6899
|
-
"data-density": density,
|
|
6900
|
-
"data-radius": radius,
|
|
6901
|
-
"data-accent-color": accentColor,
|
|
6902
|
-
"data-high-contrast": highContrast ? "true" : void 0,
|
|
6903
|
-
"data-reduced-motion": reducedMotion ? "true" : void 0
|
|
6904
|
-
};
|
|
6905
|
-
if (asChild) {
|
|
6906
|
-
if (!isValidElement9(children))
|
|
6907
|
-
throw new Error("KeepThemeProvider with asChild requires a single React element child.");
|
|
6908
|
-
return createSlot(children, rootProps);
|
|
6909
|
-
}
|
|
6910
|
-
return /* @__PURE__ */ jsx33("div", { ...rootProps, children });
|
|
6911
|
-
}
|
|
6912
|
-
|
|
6913
7224
|
// src/index.tsx
|
|
6914
7225
|
import { createAuthenticatedSyncKit } from "@keepkit/core/core";
|
|
6915
7226
|
import {
|
|
@@ -6918,7 +7229,7 @@ import {
|
|
|
6918
7229
|
useKeepCollections as useKeepCollections5,
|
|
6919
7230
|
useKeepContext as useKeepContext11,
|
|
6920
7231
|
useKeepItem as useKeepItem8,
|
|
6921
|
-
useKeepList as
|
|
7232
|
+
useKeepList as useKeepList7,
|
|
6922
7233
|
useKeepNavigator as useKeepNavigator2,
|
|
6923
7234
|
useKeepShortcut
|
|
6924
7235
|
} from "@keepkit/core/react";
|
|
@@ -6932,7 +7243,7 @@ import {
|
|
|
6932
7243
|
LocalStorageSyncQueueAdapter,
|
|
6933
7244
|
SyncStorageAdapter
|
|
6934
7245
|
} from "@keepkit/core/storage";
|
|
6935
|
-
import { jsx as
|
|
7246
|
+
import { jsx as jsx36, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6936
7247
|
function KeepKitProvider({
|
|
6937
7248
|
labels,
|
|
6938
7249
|
labelOptions,
|
|
@@ -6950,10 +7261,11 @@ function KeepKitProvider({
|
|
|
6950
7261
|
className: themeClassName,
|
|
6951
7262
|
style: themeStyle,
|
|
6952
7263
|
asChild: themeAsChild,
|
|
7264
|
+
tour,
|
|
6953
7265
|
children,
|
|
6954
7266
|
...providerProps
|
|
6955
7267
|
}) {
|
|
6956
|
-
return /* @__PURE__ */
|
|
7268
|
+
return /* @__PURE__ */ jsx36(
|
|
6957
7269
|
KeepUiProvider,
|
|
6958
7270
|
{
|
|
6959
7271
|
labels,
|
|
@@ -6961,7 +7273,7 @@ function KeepKitProvider({
|
|
|
6961
7273
|
locale,
|
|
6962
7274
|
labelResolver,
|
|
6963
7275
|
onFeedback,
|
|
6964
|
-
children: /* @__PURE__ */
|
|
7276
|
+
children: /* @__PURE__ */ jsx36(
|
|
6965
7277
|
KeepThemeProvider,
|
|
6966
7278
|
{
|
|
6967
7279
|
theme,
|
|
@@ -6975,10 +7287,10 @@ function KeepKitProvider({
|
|
|
6975
7287
|
className: themeClassName,
|
|
6976
7288
|
style: themeStyle,
|
|
6977
7289
|
asChild: themeAsChild,
|
|
6978
|
-
children: /* @__PURE__ */
|
|
6979
|
-
/* @__PURE__ */
|
|
6980
|
-
children,
|
|
6981
|
-
/* @__PURE__ */
|
|
7290
|
+
children: /* @__PURE__ */ jsxs29(CoreKeepProvider, { ...providerProps, children: [
|
|
7291
|
+
/* @__PURE__ */ jsx36(KeepSyncFeedbackObserver, {}),
|
|
7292
|
+
/* @__PURE__ */ jsx36(KeepTourProvider, { ...tour, children }),
|
|
7293
|
+
/* @__PURE__ */ jsx36(KeepAnnouncements, {})
|
|
6982
7294
|
] })
|
|
6983
7295
|
}
|
|
6984
7296
|
)
|
|
@@ -7002,13 +7314,14 @@ function createKeepKit(options = {}) {
|
|
|
7002
7314
|
variables,
|
|
7003
7315
|
themeClassName,
|
|
7004
7316
|
themeStyle,
|
|
7317
|
+
tour,
|
|
7005
7318
|
getTitle,
|
|
7006
7319
|
getImageProps,
|
|
7007
7320
|
...coreOptions
|
|
7008
7321
|
} = options;
|
|
7009
7322
|
const coreKit = createCoreKeepKit(coreOptions);
|
|
7010
7323
|
return {
|
|
7011
|
-
Provider: (props) => /* @__PURE__ */
|
|
7324
|
+
Provider: (props) => /* @__PURE__ */ jsx36(
|
|
7012
7325
|
KeepKitProvider,
|
|
7013
7326
|
{
|
|
7014
7327
|
...coreOptions,
|
|
@@ -7027,12 +7340,13 @@ function createKeepKit(options = {}) {
|
|
|
7027
7340
|
variables,
|
|
7028
7341
|
className: themeClassName,
|
|
7029
7342
|
style: themeStyle,
|
|
7343
|
+
tour,
|
|
7030
7344
|
...props
|
|
7031
7345
|
}
|
|
7032
7346
|
),
|
|
7033
|
-
Button: (props) => /* @__PURE__ */
|
|
7034
|
-
Backup: (props) => /* @__PURE__ */
|
|
7035
|
-
Collection: (props) => /* @__PURE__ */
|
|
7347
|
+
Button: (props) => /* @__PURE__ */ jsx36(KeepButton, { ...props }),
|
|
7348
|
+
Backup: (props) => /* @__PURE__ */ jsx36(KeepBackup, { ...props }),
|
|
7349
|
+
Collection: (props) => /* @__PURE__ */ jsx36(
|
|
7036
7350
|
KeepCollection,
|
|
7037
7351
|
{
|
|
7038
7352
|
...props,
|
|
@@ -7043,8 +7357,8 @@ function createKeepKit(options = {}) {
|
|
|
7043
7357
|
}
|
|
7044
7358
|
}
|
|
7045
7359
|
),
|
|
7046
|
-
CollectionManager: (props) => /* @__PURE__ */
|
|
7047
|
-
Workspace: (props) => /* @__PURE__ */
|
|
7360
|
+
CollectionManager: (props) => /* @__PURE__ */ jsx36(KeepCollectionManager, { ...props }),
|
|
7361
|
+
Workspace: (props) => /* @__PURE__ */ jsx36(
|
|
7048
7362
|
KeepWorkspace,
|
|
7049
7363
|
{
|
|
7050
7364
|
...props,
|
|
@@ -7063,7 +7377,10 @@ function createKeepKit(options = {}) {
|
|
|
7063
7377
|
useList: (query) => coreKit.useList(query),
|
|
7064
7378
|
useCollections: (collectionsOptions) => coreKit.useCollections(collectionsOptions),
|
|
7065
7379
|
useNavigator: (navigatorOptions) => coreKit.useNavigator(navigatorOptions),
|
|
7066
|
-
useShortcut: (shortcutOptions) => coreKit.useShortcut(shortcutOptions)
|
|
7380
|
+
useShortcut: (shortcutOptions) => coreKit.useShortcut(shortcutOptions),
|
|
7381
|
+
FloatingTour: (props) => /* @__PURE__ */ jsx36(KeepFloatingTour, { ...props }),
|
|
7382
|
+
TourProvider: (props) => /* @__PURE__ */ jsx36(KeepTourProvider, { ...props }),
|
|
7383
|
+
useTour: (tourOptions) => useKeepTour(tourOptions)
|
|
7067
7384
|
};
|
|
7068
7385
|
}
|
|
7069
7386
|
export {
|
|
@@ -7085,6 +7402,7 @@ export {
|
|
|
7085
7402
|
KeepCollectionSelect,
|
|
7086
7403
|
KeepEmptyState,
|
|
7087
7404
|
KeepErrorBoundary3 as KeepErrorBoundary,
|
|
7405
|
+
KeepFloatingTour,
|
|
7088
7406
|
KeepHighlight,
|
|
7089
7407
|
KeepItemCard,
|
|
7090
7408
|
KeepItemCardSkeleton,
|
|
@@ -7113,6 +7431,7 @@ export {
|
|
|
7113
7431
|
KeepTagFilter,
|
|
7114
7432
|
KeepThemeProvider,
|
|
7115
7433
|
KeepTourBar,
|
|
7434
|
+
KeepTourProvider,
|
|
7116
7435
|
KeepUiProvider,
|
|
7117
7436
|
KeepUndo,
|
|
7118
7437
|
KeepWorkspace,
|
|
@@ -7136,11 +7455,12 @@ export {
|
|
|
7136
7455
|
useKeepCollections5 as useKeepCollections,
|
|
7137
7456
|
useKeepContext11 as useKeepContext,
|
|
7138
7457
|
useKeepItem8 as useKeepItem,
|
|
7139
|
-
|
|
7458
|
+
useKeepList7 as useKeepList,
|
|
7140
7459
|
useKeepNavigator2 as useKeepNavigator,
|
|
7141
7460
|
useKeepQuickEditor,
|
|
7142
7461
|
useKeepShortcut,
|
|
7143
7462
|
useKeepToastFeedback,
|
|
7463
|
+
useKeepTour,
|
|
7144
7464
|
useKeepTourShortcuts,
|
|
7145
7465
|
useKeepUiLabels,
|
|
7146
7466
|
useKeepUrlSync,
|