@hellboy/ds 0.1.2 → 0.2.7
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 +568 -71
- package/{src/style/components/badge → dist/components}/badge.css +9 -25
- package/dist/components/badge.d.mts +12 -0
- package/dist/components/badge.d.ts +12 -0
- package/dist/components/badge.js +42 -0
- package/dist/components/badge.mjs +15 -0
- package/dist/components/banner.css +280 -0
- package/dist/components/banner.d.mts +12 -0
- package/dist/components/banner.d.ts +12 -0
- package/dist/components/banner.js +184 -0
- package/dist/components/banner.mjs +147 -0
- package/dist/components/button-group.css +289 -0
- package/dist/components/button-group.d.mts +81 -0
- package/dist/components/button-group.d.ts +81 -0
- package/dist/components/button-group.js +180 -0
- package/dist/components/button-group.mjs +143 -0
- package/{src/style/components/button → dist/components}/button.css +59 -62
- package/dist/components/button.d.mts +57 -0
- package/dist/components/button.d.ts +57 -0
- package/dist/components/button.js +129 -0
- package/dist/components/button.mjs +92 -0
- package/{src/style/components/card → dist/components}/card.css +9 -30
- package/dist/components/card.d.mts +31 -0
- package/dist/components/card.d.ts +31 -0
- package/dist/components/card.js +59 -0
- package/dist/components/card.mjs +32 -0
- package/{src/style → dist}/components/checkbox.css +51 -43
- package/dist/components/checkbox.d.mts +31 -0
- package/dist/components/checkbox.d.ts +31 -0
- package/dist/components/checkbox.js +130 -0
- package/dist/components/checkbox.mjs +93 -0
- package/{src/style/components/code-block → dist/components}/code-block.css +3 -7
- package/dist/components/code-block.d.mts +24 -0
- package/dist/components/code-block.d.ts +24 -0
- package/dist/components/code-block.js +43 -0
- package/dist/components/code-block.mjs +16 -0
- package/dist/components/color-control.css +285 -0
- package/dist/components/color-control.d.mts +5 -0
- package/dist/components/color-control.d.ts +5 -0
- package/dist/components/color-control.js +534 -0
- package/dist/components/color-control.mjs +497 -0
- package/dist/components/dialog.css +930 -0
- package/dist/components/dialog.d.mts +32 -0
- package/dist/components/dialog.d.ts +32 -0
- package/dist/components/dialog.js +1111 -0
- package/dist/components/dialog.mjs +1074 -0
- package/dist/components/divider.css +356 -0
- package/dist/components/divider.d.mts +32 -0
- package/dist/components/divider.d.ts +32 -0
- package/dist/components/divider.js +344 -0
- package/dist/components/divider.mjs +307 -0
- package/{src/style/components/drag-handle → dist/components}/drag-handle.css +3 -18
- package/dist/components/drag-handle.d.mts +11 -0
- package/dist/components/drag-handle.d.ts +11 -0
- package/dist/components/drag-handle.js +103 -0
- package/dist/components/drag-handle.mjs +66 -0
- package/dist/components/drawer.css +1027 -0
- package/dist/components/drawer.d.mts +14 -0
- package/dist/components/drawer.d.ts +14 -0
- package/dist/components/drawer.js +1072 -0
- package/dist/components/drawer.mjs +1035 -0
- package/dist/components/floating-bar.css +17 -0
- package/dist/components/floating-bar.d.mts +25 -0
- package/dist/components/floating-bar.d.ts +25 -0
- package/dist/components/floating-bar.js +52 -0
- package/dist/components/floating-bar.mjs +25 -0
- package/dist/components/footer.css +40 -0
- package/dist/components/footer.d.mts +8 -0
- package/dist/components/footer.d.ts +8 -0
- package/dist/components/footer.js +44 -0
- package/dist/components/footer.mjs +17 -0
- package/dist/components/grid.css +47 -0
- package/dist/components/grid.d.mts +27 -0
- package/dist/components/grid.d.ts +27 -0
- package/dist/components/grid.js +52 -0
- package/dist/components/grid.mjs +25 -0
- package/dist/components/header.css +1075 -0
- package/dist/components/header.d.mts +35 -0
- package/dist/components/header.d.ts +35 -0
- package/dist/components/header.js +1402 -0
- package/dist/components/header.mjs +1365 -0
- package/dist/components/hero.css +121 -0
- package/dist/components/hero.d.mts +111 -0
- package/dist/components/hero.d.ts +111 -0
- package/dist/components/hero.js +285 -0
- package/dist/components/hero.mjs +248 -0
- package/{src/style/components/icons → dist/components}/icons.css +14 -15
- package/dist/components/icons.d.mts +104 -0
- package/dist/components/icons.d.ts +104 -0
- package/dist/components/icons.js +239 -0
- package/dist/components/icons.mjs +203 -0
- package/{src/style/components/input → dist/components}/input.css +189 -102
- package/dist/components/input.d.mts +114 -0
- package/dist/components/input.d.ts +114 -0
- package/dist/components/input.js +926 -0
- package/dist/components/input.mjs +879 -0
- package/dist/components/layout.css +551 -0
- package/dist/components/layout.d.mts +16 -0
- package/dist/components/layout.d.ts +16 -0
- package/dist/components/layout.js +387 -0
- package/dist/components/layout.mjs +352 -0
- package/{src/style/components/list → dist/components}/list.css +47 -41
- package/dist/components/list.d.mts +46 -0
- package/dist/components/list.d.ts +46 -0
- package/dist/components/list.js +124 -0
- package/dist/components/list.mjs +96 -0
- package/dist/components/navbar.css +706 -0
- package/dist/components/navbar.d.mts +56 -0
- package/dist/components/navbar.d.ts +56 -0
- package/dist/components/navbar.js +994 -0
- package/dist/components/navbar.mjs +952 -0
- package/{src/style/components/page-index → dist/components}/page-index.css +2 -47
- package/dist/components/page-index.d.mts +25 -0
- package/dist/components/page-index.d.ts +25 -0
- package/dist/components/page-index.js +239 -0
- package/dist/components/page-index.mjs +202 -0
- package/{src/style/components/page → dist/components}/page.css +4 -15
- package/dist/components/page.d.mts +30 -0
- package/dist/components/page.d.ts +30 -0
- package/dist/components/page.js +40 -0
- package/dist/components/page.mjs +13 -0
- package/dist/components/popover.css +87 -0
- package/dist/components/popover.d.mts +22 -0
- package/dist/components/popover.d.ts +22 -0
- package/dist/components/popover.js +243 -0
- package/dist/components/popover.mjs +206 -0
- package/{src/style → dist}/components/radio.css +8 -51
- package/dist/components/radio.d.mts +59 -0
- package/dist/components/radio.d.ts +59 -0
- package/dist/components/radio.js +133 -0
- package/dist/components/radio.mjs +95 -0
- package/dist/components/section.css +993 -0
- package/dist/components/section.d.mts +33 -0
- package/dist/components/section.d.ts +33 -0
- package/dist/components/section.js +1401 -0
- package/dist/components/section.mjs +1364 -0
- package/dist/components/select.css +391 -0
- package/dist/components/select.d.mts +63 -0
- package/dist/components/select.d.ts +63 -0
- package/dist/components/select.js +452 -0
- package/dist/components/select.mjs +415 -0
- package/{src/style/components/slider → dist/components}/slider.css +55 -33
- package/dist/components/slider.d.mts +69 -0
- package/dist/components/slider.d.ts +69 -0
- package/dist/components/slider.js +254 -0
- package/dist/components/slider.mjs +217 -0
- package/dist/components/switch.css +1081 -0
- package/dist/components/switch.d.mts +33 -0
- package/dist/components/switch.d.ts +33 -0
- package/dist/components/switch.js +1092 -0
- package/dist/components/switch.mjs +1055 -0
- package/{src/style/components/table → dist/components}/table.css +3 -28
- package/dist/components/table.d.mts +42 -0
- package/dist/components/table.d.ts +42 -0
- package/dist/components/table.js +108 -0
- package/dist/components/table.mjs +76 -0
- package/dist/components/tag.css +97 -0
- package/dist/components/tag.d.mts +12 -0
- package/dist/components/tag.d.ts +12 -0
- package/dist/components/tag.js +42 -0
- package/dist/components/tag.mjs +15 -0
- package/dist/components/textarea.css +1359 -0
- package/dist/components/textarea.d.mts +84 -0
- package/dist/components/textarea.d.ts +84 -0
- package/dist/components/textarea.js +1962 -0
- package/dist/components/textarea.mjs +1924 -0
- package/{src/style/components/theme-control → dist/components}/theme-control.css +3 -7
- package/dist/components/theme-control.d.mts +9 -0
- package/dist/components/theme-control.d.ts +9 -0
- package/dist/components/theme-control.js +235 -0
- package/dist/components/theme-control.mjs +200 -0
- package/{src/style/components/tooltip → dist/components}/tooltip.css +5 -13
- package/dist/components/tooltip.d.mts +12 -0
- package/dist/components/tooltip.d.ts +12 -0
- package/dist/components/tooltip.js +200 -0
- package/dist/components/tooltip.mjs +163 -0
- package/dist/icons-Czahnf-r.d.mts +15 -0
- package/dist/icons-Czahnf-r.d.ts +15 -0
- package/dist/index.css +2915 -2068
- package/dist/index.d.mts +144 -721
- package/dist/index.d.ts +144 -721
- package/dist/index.js +4076 -2282
- package/dist/index.mjs +4132 -2366
- package/dist/theme.css +34 -34
- package/package.json +27 -8
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/hellboy-ds-0.1.2.tgz +0 -0
- package/src/components/badge/Badge.tsx +0 -29
- package/src/components/badge/index.ts +0 -1
- package/src/components/banner/Banner.tsx +0 -48
- package/src/components/banner/banner.css +0 -44
- package/src/components/banner/index.ts +0 -1
- package/src/components/button/button.tsx +0 -127
- package/src/components/button/index.ts +0 -1
- package/src/components/card/card.tsx +0 -57
- package/src/components/card/index.ts +0 -1
- package/src/components/checkbox/Checkbox.tsx +0 -98
- package/src/components/checkbox/index.ts +0 -1
- package/src/components/code-block/code-block.tsx +0 -44
- package/src/components/code-block/index.ts +0 -1
- package/src/components/color-control/color-control.tsx +0 -322
- package/src/components/color-control/index.ts +0 -1
- package/src/components/drag-handle/DragHandle.tsx +0 -78
- package/src/components/drag-handle/index.ts +0 -1
- package/src/components/drawer/drawer.tsx +0 -82
- package/src/components/drawer/index.ts +0 -1
- package/src/components/floating-bar/floating-bar.tsx +0 -52
- package/src/components/floating-bar/index.ts +0 -2
- package/src/components/footer/footer.tsx +0 -28
- package/src/components/footer/index.ts +0 -1
- package/src/components/grid/Grid.tsx +0 -53
- package/src/components/grid/index.ts +0 -1
- package/src/components/header/header.tsx +0 -57
- package/src/components/header/index.ts +0 -1
- package/src/components/icons/icons.tsx +0 -44
- package/src/components/icons/index.ts +0 -1
- package/src/components/index.ts +0 -29
- package/src/components/input/DatePicker.tsx +0 -133
- package/src/components/input/Input.tsx +0 -220
- package/src/components/input/InputDate.tsx +0 -10
- package/src/components/input/InputDateTime.tsx +0 -10
- package/src/components/input/InputEmail.tsx +0 -10
- package/src/components/input/InputField.tsx +0 -137
- package/src/components/input/InputNumber.tsx +0 -10
- package/src/components/input/InputPassword.tsx +0 -10
- package/src/components/input/InputSearch.tsx +0 -10
- package/src/components/input/InputTel.tsx +0 -10
- package/src/components/input/InputText.tsx +0 -10
- package/src/components/input/InputTime.tsx +0 -10
- package/src/components/input/InputUrl.tsx +0 -10
- package/src/components/input/TimePicker.tsx +0 -151
- package/src/components/input/index.ts +0 -11
- package/src/components/layout/Layout.tsx +0 -244
- package/src/components/layout/index.ts +0 -1
- package/src/components/list/List.tsx +0 -159
- package/src/components/list/index.ts +0 -1
- package/src/components/navbar/MenuCategory.tsx +0 -20
- package/src/components/navbar/MenuGroup.tsx +0 -288
- package/src/components/navbar/MenuItem.tsx +0 -65
- package/src/components/navbar/Navbar.tsx +0 -23
- package/src/components/navbar/index.ts +0 -4
- package/src/components/page/index.ts +0 -1
- package/src/components/page/page.tsx +0 -46
- package/src/components/page-index/PageIndex.tsx +0 -275
- package/src/components/page-index/index.ts +0 -1
- package/src/components/popover/index.ts +0 -1
- package/src/components/popover/popover.tsx +0 -199
- package/src/components/radio/Radio.tsx +0 -176
- package/src/components/radio/index.ts +0 -1
- package/src/components/section/index.ts +0 -1
- package/src/components/section/section.tsx +0 -66
- package/src/components/select/Select.tsx +0 -212
- package/src/components/select/index.ts +0 -1
- package/src/components/slider/Slider.tsx +0 -267
- package/src/components/slider/index.ts +0 -1
- package/src/components/switch/index.ts +0 -1
- package/src/components/switch/switch.tsx +0 -99
- package/src/components/table/Table.tsx +0 -147
- package/src/components/table/index.ts +0 -1
- package/src/components/theme-control/index.ts +0 -1
- package/src/components/theme-control/theme-control.tsx +0 -78
- package/src/components/tooltip/index.ts +0 -1
- package/src/components/tooltip/tooltip.tsx +0 -207
- package/src/contexts/NavbarTooltipContext.tsx +0 -48
- package/src/contexts/index.ts +0 -1
- package/src/foundations/motion.md +0 -136
- package/src/index.ts +0 -40
- package/src/style/_shared/field.css +0 -69
- package/src/style/components/color-control/color-control.css +0 -126
- package/src/style/components/drawer/drawer.css +0 -210
- package/src/style/components/floating-bar/floating-bar.css +0 -39
- package/src/style/components/footer/footer.css +0 -108
- package/src/style/components/grid/grid.css +0 -33
- package/src/style/components/header/header.css +0 -44
- package/src/style/components/layout/layout.css +0 -205
- package/src/style/components/navbar/navbar.css +0 -342
- package/src/style/components/popover/popover.css +0 -44
- package/src/style/components/section/section.css +0 -67
- package/src/style/components/select/select.css +0 -143
- package/src/style/components/switch/switch.css +0 -267
- package/src/style/foundations/global.css +0 -316
- package/src/style/foundations/motion.css +0 -164
- package/src/style/foundations/spacing.css +0 -51
- package/src/style/foundations/typography.css +0 -39
- package/src/style/foundations/z-index.css +0 -81
- package/src/style/modes/dark.css +0 -146
- package/src/style/modes/light.css +0 -147
- package/src/style/semantic.css +0 -52
- package/src/style/styles.css +0 -51
- package/src/style/themes/theme.json +0 -37
- package/src/utils/README.md +0 -305
- package/src/utils/USER_PREFERENCES.md +0 -558
- package/src/utils/theme.ts +0 -127
- package/src/utils/user-preferences.ts +0 -577
- package/tsconfig.json +0 -25
- package/tsup.config.ts +0 -52
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
31
|
+
|
|
32
|
+
// src/components/layout/index.ts
|
|
33
|
+
var layout_exports = {};
|
|
34
|
+
__export(layout_exports, {
|
|
35
|
+
Layout: () => Layout
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(layout_exports);
|
|
38
|
+
|
|
39
|
+
// src/components/layout/Layout.tsx
|
|
40
|
+
var React3 = __toESM(require("react"));
|
|
41
|
+
|
|
42
|
+
// src/components/drag-handle/DragHandle.tsx
|
|
43
|
+
var import_react = __toESM(require("react"));
|
|
44
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
+
var DragHandle = ({
|
|
46
|
+
onResize,
|
|
47
|
+
onResizeEnd,
|
|
48
|
+
orientation = "vertical",
|
|
49
|
+
className = ""
|
|
50
|
+
}) => {
|
|
51
|
+
const [isDragging, setIsDragging] = (0, import_react.useState)(false);
|
|
52
|
+
const dragHandleRef = (0, import_react.useRef)(null);
|
|
53
|
+
const startPosRef = (0, import_react.useRef)(0);
|
|
54
|
+
const handleMouseDown = (0, import_react.useCallback)((e) => {
|
|
55
|
+
setIsDragging(true);
|
|
56
|
+
startPosRef.current = orientation === "vertical" ? e.clientX : e.clientY;
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
}, [orientation]);
|
|
59
|
+
const handleMouseMove = (0, import_react.useCallback)((e) => {
|
|
60
|
+
if (!isDragging) return;
|
|
61
|
+
const currentPos = orientation === "vertical" ? e.clientX : e.clientY;
|
|
62
|
+
const delta = currentPos - startPosRef.current;
|
|
63
|
+
onResize(delta);
|
|
64
|
+
startPosRef.current = currentPos;
|
|
65
|
+
}, [isDragging, onResize, orientation]);
|
|
66
|
+
const handleMouseUp = (0, import_react.useCallback)(() => {
|
|
67
|
+
setIsDragging(false);
|
|
68
|
+
onResizeEnd?.();
|
|
69
|
+
}, [onResizeEnd]);
|
|
70
|
+
import_react.default.useEffect(() => {
|
|
71
|
+
if (isDragging) {
|
|
72
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
73
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
74
|
+
document.body.style.cursor = orientation === "vertical" ? "col-resize" : "row-resize";
|
|
75
|
+
document.body.style.userSelect = "none";
|
|
76
|
+
} else {
|
|
77
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
78
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
79
|
+
document.body.style.cursor = "";
|
|
80
|
+
document.body.style.userSelect = "";
|
|
81
|
+
}
|
|
82
|
+
return () => {
|
|
83
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
84
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
85
|
+
document.body.style.cursor = "";
|
|
86
|
+
document.body.style.userSelect = "";
|
|
87
|
+
};
|
|
88
|
+
}, [isDragging, handleMouseMove, handleMouseUp, orientation]);
|
|
89
|
+
const classes = [
|
|
90
|
+
"drag-handle",
|
|
91
|
+
`drag-handle--${orientation}`,
|
|
92
|
+
isDragging && "drag-handle--dragging",
|
|
93
|
+
className
|
|
94
|
+
].filter(Boolean).join(" ");
|
|
95
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
ref: dragHandleRef,
|
|
99
|
+
className: classes,
|
|
100
|
+
onMouseDown: handleMouseDown,
|
|
101
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "drag-handle__indicator" })
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// src/utils/user-preferences.ts
|
|
107
|
+
var DEFAULT_CONFIG = {
|
|
108
|
+
backend: "localStorage",
|
|
109
|
+
prefix: "hellboy-ds",
|
|
110
|
+
dbName: "hellboy-ds-prefs",
|
|
111
|
+
storeName: "preferences"
|
|
112
|
+
};
|
|
113
|
+
var config = { ...DEFAULT_CONFIG };
|
|
114
|
+
var getStorageKey = (key) => {
|
|
115
|
+
return `${config.prefix}:${key}`;
|
|
116
|
+
};
|
|
117
|
+
var isLocalStorageAvailable = () => {
|
|
118
|
+
try {
|
|
119
|
+
const test = "__storage_test__";
|
|
120
|
+
localStorage.setItem(test, test);
|
|
121
|
+
localStorage.removeItem(test);
|
|
122
|
+
return true;
|
|
123
|
+
} catch {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
var IndexedDBStore = class {
|
|
128
|
+
constructor() {
|
|
129
|
+
__publicField(this, "db", null);
|
|
130
|
+
}
|
|
131
|
+
async init() {
|
|
132
|
+
if (typeof window === "undefined" || !window.indexedDB) {
|
|
133
|
+
throw new Error("IndexedDB not available");
|
|
134
|
+
}
|
|
135
|
+
return new Promise((resolve, reject) => {
|
|
136
|
+
const request = indexedDB.open(config.dbName, 1);
|
|
137
|
+
request.onerror = () => reject(request.error);
|
|
138
|
+
request.onsuccess = () => {
|
|
139
|
+
this.db = request.result;
|
|
140
|
+
resolve();
|
|
141
|
+
};
|
|
142
|
+
request.onupgradeneeded = (event) => {
|
|
143
|
+
const db = event.target.result;
|
|
144
|
+
if (!db.objectStoreNames.contains(config.storeName)) {
|
|
145
|
+
db.createObjectStore(config.storeName, { keyPath: "key" });
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
async get(key) {
|
|
151
|
+
if (!this.db) await this.init();
|
|
152
|
+
return new Promise((resolve, reject) => {
|
|
153
|
+
const transaction = this.db.transaction([config.storeName], "readonly");
|
|
154
|
+
const store = transaction.objectStore(config.storeName);
|
|
155
|
+
const request = store.get(key);
|
|
156
|
+
request.onsuccess = () => resolve(request.result?.value);
|
|
157
|
+
request.onerror = () => reject(request.error);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
async set(key, value) {
|
|
161
|
+
if (!this.db) await this.init();
|
|
162
|
+
return new Promise((resolve, reject) => {
|
|
163
|
+
const transaction = this.db.transaction([config.storeName], "readwrite");
|
|
164
|
+
const store = transaction.objectStore(config.storeName);
|
|
165
|
+
const request = store.put({ key, value });
|
|
166
|
+
request.onsuccess = () => resolve();
|
|
167
|
+
request.onerror = () => reject(request.error);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
async remove(key) {
|
|
171
|
+
if (!this.db) await this.init();
|
|
172
|
+
return new Promise((resolve, reject) => {
|
|
173
|
+
const transaction = this.db.transaction([config.storeName], "readwrite");
|
|
174
|
+
const store = transaction.objectStore(config.storeName);
|
|
175
|
+
const request = store.delete(key);
|
|
176
|
+
request.onsuccess = () => resolve();
|
|
177
|
+
request.onerror = () => reject(request.error);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
async clear() {
|
|
181
|
+
if (!this.db) await this.init();
|
|
182
|
+
return new Promise((resolve, reject) => {
|
|
183
|
+
const transaction = this.db.transaction([config.storeName], "readwrite");
|
|
184
|
+
const store = transaction.objectStore(config.storeName);
|
|
185
|
+
const request = store.clear();
|
|
186
|
+
request.onsuccess = () => resolve();
|
|
187
|
+
request.onerror = () => reject(request.error);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
var indexedDBStore = new IndexedDBStore();
|
|
192
|
+
var getPreference = (key, defaultValue) => {
|
|
193
|
+
try {
|
|
194
|
+
if (config.backend === "localStorage" && isLocalStorageAvailable()) {
|
|
195
|
+
const stored = localStorage.getItem(getStorageKey(key));
|
|
196
|
+
if (stored !== null) {
|
|
197
|
+
return JSON.parse(stored);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return defaultValue;
|
|
201
|
+
} catch (error) {
|
|
202
|
+
console.warn(`Failed to get preference "${key}":`, error);
|
|
203
|
+
return defaultValue;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
var setPreference = (key, value) => {
|
|
207
|
+
try {
|
|
208
|
+
if (config.backend === "localStorage" && isLocalStorageAvailable()) {
|
|
209
|
+
localStorage.setItem(getStorageKey(key), JSON.stringify(value));
|
|
210
|
+
}
|
|
211
|
+
} catch (error) {
|
|
212
|
+
console.warn(`Failed to set preference "${key}":`, error);
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
// src/components/navbar/Navbar.tsx
|
|
217
|
+
var React2 = __toESM(require("react"));
|
|
218
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
219
|
+
var NAVBAR_COLLAPSED_WIDTH = 64;
|
|
220
|
+
var NAVBAR_MIN_PERSIST_WIDTH = 211;
|
|
221
|
+
|
|
222
|
+
// src/components/layout/Layout.tsx
|
|
223
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
224
|
+
var DEFAULT_LEFT_WIDTH = 280;
|
|
225
|
+
var DEFAULT_RIGHT_WIDTH = 300;
|
|
226
|
+
var MIN_WIDTH = NAVBAR_COLLAPSED_WIDTH;
|
|
227
|
+
var MAX_WIDTH = 600;
|
|
228
|
+
var Layout = ({
|
|
229
|
+
variant = "stacked",
|
|
230
|
+
header,
|
|
231
|
+
footer,
|
|
232
|
+
sidebarLeft,
|
|
233
|
+
sidebarRight,
|
|
234
|
+
bottomBar,
|
|
235
|
+
resizable = false,
|
|
236
|
+
hero,
|
|
237
|
+
children,
|
|
238
|
+
className = "",
|
|
239
|
+
...props
|
|
240
|
+
}) => {
|
|
241
|
+
const classes = ["layout", `layout--${variant}`, className].filter(Boolean).join(" ");
|
|
242
|
+
const hasSidebarLeft = sidebarLeft != null;
|
|
243
|
+
const hasSidebarRight = sidebarRight != null;
|
|
244
|
+
const columnCount = [hasSidebarLeft, true, hasSidebarRight].filter(Boolean).length;
|
|
245
|
+
const shouldShowResizers = resizable && columnCount >= 2;
|
|
246
|
+
const [leftSidebarWidth, setLeftSidebarWidth] = React3.useState(() => {
|
|
247
|
+
const isCollapsed = getPreference("layout.leftSidebarCollapsed", false);
|
|
248
|
+
if (isCollapsed) {
|
|
249
|
+
return NAVBAR_COLLAPSED_WIDTH;
|
|
250
|
+
}
|
|
251
|
+
const stored = getPreference("layout.leftSidebarWidth", DEFAULT_LEFT_WIDTH);
|
|
252
|
+
return typeof stored === "number" ? stored : DEFAULT_LEFT_WIDTH;
|
|
253
|
+
});
|
|
254
|
+
const [rightSidebarWidth, setRightSidebarWidth] = React3.useState(() => {
|
|
255
|
+
const stored = getPreference("layout.rightSidebarWidth", DEFAULT_RIGHT_WIDTH);
|
|
256
|
+
return typeof stored === "number" ? stored : DEFAULT_RIGHT_WIDTH;
|
|
257
|
+
});
|
|
258
|
+
const [leftSidebarPreferredWidth, setLeftSidebarPreferredWidth] = React3.useState(() => {
|
|
259
|
+
const savedWidth = getPreference("layout.leftSidebarWidth");
|
|
260
|
+
return typeof savedWidth === "number" && savedWidth >= NAVBAR_MIN_PERSIST_WIDTH ? savedWidth : DEFAULT_LEFT_WIDTH;
|
|
261
|
+
});
|
|
262
|
+
const [leftSidebarCollapsed, setLeftSidebarCollapsed] = React3.useState(() => {
|
|
263
|
+
const stored = getPreference("layout.leftSidebarCollapsed");
|
|
264
|
+
return typeof stored === "boolean" ? stored : false;
|
|
265
|
+
});
|
|
266
|
+
const clampWidth = React3.useCallback((width) => {
|
|
267
|
+
return Math.max(MIN_WIDTH, Math.min(MAX_WIDTH, Math.round(width)));
|
|
268
|
+
}, []);
|
|
269
|
+
const updateLeftSidebarWidth = React3.useCallback(
|
|
270
|
+
(width) => {
|
|
271
|
+
const clamped = clampWidth(width);
|
|
272
|
+
setLeftSidebarWidth(clamped);
|
|
273
|
+
if (clamped >= NAVBAR_MIN_PERSIST_WIDTH) {
|
|
274
|
+
setPreference("layout.leftSidebarWidth", clamped);
|
|
275
|
+
setLeftSidebarPreferredWidth(clamped);
|
|
276
|
+
setLeftSidebarCollapsed(false);
|
|
277
|
+
setPreference("layout.leftSidebarCollapsed", false);
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
[clampWidth]
|
|
281
|
+
);
|
|
282
|
+
const updateRightSidebarWidth = React3.useCallback(
|
|
283
|
+
(width) => {
|
|
284
|
+
const clamped = clampWidth(width);
|
|
285
|
+
setRightSidebarWidth(clamped);
|
|
286
|
+
setPreference("layout.rightSidebarWidth", clamped);
|
|
287
|
+
},
|
|
288
|
+
[clampWidth]
|
|
289
|
+
);
|
|
290
|
+
const handleLeftResize = React3.useCallback(
|
|
291
|
+
(delta) => {
|
|
292
|
+
setLeftSidebarWidth((prev) => {
|
|
293
|
+
const next = clampWidth(prev + delta);
|
|
294
|
+
return next;
|
|
295
|
+
});
|
|
296
|
+
},
|
|
297
|
+
[clampWidth]
|
|
298
|
+
);
|
|
299
|
+
const handleLeftResizeEnd = React3.useCallback(() => {
|
|
300
|
+
setLeftSidebarWidth((currentWidth) => {
|
|
301
|
+
if (currentWidth >= NAVBAR_MIN_PERSIST_WIDTH) {
|
|
302
|
+
setPreference("layout.leftSidebarWidth", currentWidth);
|
|
303
|
+
setLeftSidebarPreferredWidth(currentWidth);
|
|
304
|
+
setLeftSidebarCollapsed(false);
|
|
305
|
+
setPreference("layout.leftSidebarCollapsed", false);
|
|
306
|
+
return currentWidth;
|
|
307
|
+
} else {
|
|
308
|
+
setLeftSidebarCollapsed(true);
|
|
309
|
+
setPreference("layout.leftSidebarCollapsed", true);
|
|
310
|
+
return NAVBAR_COLLAPSED_WIDTH;
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
}, []);
|
|
314
|
+
const handleRightResize = React3.useCallback(
|
|
315
|
+
(delta) => {
|
|
316
|
+
setRightSidebarWidth((prev) => {
|
|
317
|
+
const next = clampWidth(prev - delta);
|
|
318
|
+
setPreference("layout.rightSidebarWidth", next);
|
|
319
|
+
return next;
|
|
320
|
+
});
|
|
321
|
+
},
|
|
322
|
+
[clampWidth]
|
|
323
|
+
);
|
|
324
|
+
if (variant === "single" || variant === "stacked") {
|
|
325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: classes, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "layout__container scrollable", children: [
|
|
326
|
+
hero,
|
|
327
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("main", { className: "layout__main", children: [
|
|
328
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("header", { className: "layout__header", children: header }),
|
|
329
|
+
children,
|
|
330
|
+
footer && footer
|
|
331
|
+
] }),
|
|
332
|
+
bottomBar && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "layout__bottom-bar", children: bottomBar })
|
|
333
|
+
] }) });
|
|
334
|
+
}
|
|
335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: classes, ...props, children: [
|
|
336
|
+
hasSidebarLeft && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
337
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
338
|
+
"aside",
|
|
339
|
+
{
|
|
340
|
+
className: "layout__sidebar layout__sidebar--left scrollable",
|
|
341
|
+
style: { width: leftSidebarWidth },
|
|
342
|
+
children: React3.isValidElement(sidebarLeft) ? React3.cloneElement(sidebarLeft, {
|
|
343
|
+
sidebarWidth: leftSidebarWidth,
|
|
344
|
+
onRequestWidthChange: updateLeftSidebarWidth,
|
|
345
|
+
preferredWidth: leftSidebarPreferredWidth,
|
|
346
|
+
initialCollapsed: leftSidebarCollapsed
|
|
347
|
+
}) : sidebarLeft
|
|
348
|
+
}
|
|
349
|
+
),
|
|
350
|
+
shouldShowResizers && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
351
|
+
DragHandle,
|
|
352
|
+
{
|
|
353
|
+
orientation: "vertical",
|
|
354
|
+
onResize: handleLeftResize,
|
|
355
|
+
onResizeEnd: handleLeftResizeEnd
|
|
356
|
+
}
|
|
357
|
+
)
|
|
358
|
+
] }),
|
|
359
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "layout__container scrollable", children: [
|
|
360
|
+
hero,
|
|
361
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("main", { className: "layout__main", children: [
|
|
362
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("header", { className: "layout__header", children: header }),
|
|
363
|
+
children,
|
|
364
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "layout__footer", children: footer })
|
|
365
|
+
] }),
|
|
366
|
+
bottomBar && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "layout__bottom-bar", children: bottomBar })
|
|
367
|
+
] }),
|
|
368
|
+
hasSidebarRight && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
369
|
+
shouldShowResizers && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DragHandle, { orientation: "vertical", onResize: handleRightResize }),
|
|
370
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
371
|
+
"aside",
|
|
372
|
+
{
|
|
373
|
+
className: "layout__sidebar layout__sidebar--right scrollable",
|
|
374
|
+
style: { width: rightSidebarWidth },
|
|
375
|
+
children: React3.isValidElement(sidebarRight) ? React3.cloneElement(sidebarRight, {
|
|
376
|
+
sidebarWidth: rightSidebarWidth,
|
|
377
|
+
onRequestWidthChange: updateRightSidebarWidth
|
|
378
|
+
}) : sidebarRight
|
|
379
|
+
}
|
|
380
|
+
)
|
|
381
|
+
] })
|
|
382
|
+
] });
|
|
383
|
+
};
|
|
384
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
385
|
+
0 && (module.exports = {
|
|
386
|
+
Layout
|
|
387
|
+
});
|