@vertebr/react 0.1.1 → 0.2.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/dist/{VertebrAdmin.d.ts → components/admin/VertebrAdmin.d.ts} +3 -1
- package/dist/components/admin/VertebrAdmin.d.ts.map +1 -0
- package/dist/{VertebrAdmin.js → components/admin/VertebrAdmin.js} +117 -33
- package/dist/components/config/ConfigForm.d.ts +19 -0
- package/dist/components/config/ConfigForm.d.ts.map +1 -0
- package/dist/components/config/ConfigForm.js +281 -0
- package/dist/{EnvSelect.d.ts → components/env/EnvSelect.d.ts} +1 -1
- package/dist/components/env/EnvSelect.d.ts.map +1 -0
- package/dist/components/gallery/GalleryBoard.d.ts +14 -0
- package/dist/components/gallery/GalleryBoard.d.ts.map +1 -0
- package/dist/components/gallery/GalleryBoard.js +14 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +6 -0
- package/dist/{MetricsBoard.d.ts → components/metrics/MetricsBoard.d.ts} +1 -1
- package/dist/components/metrics/MetricsBoard.d.ts.map +1 -0
- package/dist/components/resources/BulkImageUploadModal.d.ts +17 -0
- package/dist/components/resources/BulkImageUploadModal.d.ts.map +1 -0
- package/dist/components/resources/BulkImageUploadModal.js +47 -0
- package/dist/components/resources/ColumnVisibilityMenu.d.ts +11 -0
- package/dist/components/resources/ColumnVisibilityMenu.d.ts.map +1 -0
- package/dist/components/resources/ColumnVisibilityMenu.js +40 -0
- package/dist/components/resources/ImageUploadControl.d.ts +10 -0
- package/dist/components/resources/ImageUploadControl.d.ts.map +1 -0
- package/dist/components/resources/ImageUploadControl.js +50 -0
- package/dist/components/resources/ResourceCell.d.ts +10 -0
- package/dist/components/resources/ResourceCell.d.ts.map +1 -0
- package/dist/components/resources/ResourceCell.js +114 -0
- package/dist/{ResourceTable.d.ts → components/resources/ResourceTable.d.ts} +10 -2
- package/dist/components/resources/ResourceTable.d.ts.map +1 -0
- package/dist/components/resources/ResourceTable.js +200 -0
- package/dist/components/resources/ResourceViewModal.d.ts +11 -0
- package/dist/components/resources/ResourceViewModal.d.ts.map +1 -0
- package/dist/components/resources/ResourceViewModal.js +44 -0
- package/dist/components/theme/ThemeToggle.d.ts +7 -0
- package/dist/components/theme/ThemeToggle.d.ts.map +1 -0
- package/dist/components/theme/ThemeToggle.js +10 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +2 -0
- package/dist/{useVertebrControls.d.ts → hooks/useVertebrControls.d.ts} +2 -2
- package/dist/hooks/useVertebrControls.d.ts.map +1 -0
- package/dist/{useVertebrControls.js → hooks/useVertebrControls.js} +7 -18
- package/dist/hooks/useVertebrTheme.d.ts +7 -0
- package/dist/hooks/useVertebrTheme.d.ts.map +1 -0
- package/dist/hooks/useVertebrTheme.js +38 -0
- package/dist/index.d.ts +15 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -6
- package/dist/styles/auth.css +39 -0
- package/dist/styles/base.css +70 -0
- package/dist/styles/buttons.css +86 -0
- package/dist/styles/cells.css +178 -0
- package/dist/styles/columns.css +103 -0
- package/dist/styles/form.css +498 -0
- package/dist/styles/gallery.css +90 -0
- package/dist/styles/index.css +18 -0
- package/dist/styles/main.css +89 -0
- package/dist/styles/modal.css +110 -0
- package/dist/styles/nav.css +92 -0
- package/dist/styles/panel.css +204 -0
- package/dist/styles/select.css +151 -0
- package/dist/styles/sidebar.css +42 -0
- package/dist/styles/states.css +169 -0
- package/dist/styles/table.css +92 -0
- package/dist/styles/theme-toggle.css +87 -0
- package/dist/styles.css +2 -997
- package/dist/themes/dark.css +55 -0
- package/dist/themes/index.css +2 -0
- package/dist/themes/light.css +102 -0
- package/package.json +6 -3
- package/dist/ConfigForm.d.ts +0 -9
- package/dist/ConfigForm.d.ts.map +0 -1
- package/dist/ConfigForm.js +0 -87
- package/dist/EnvSelect.d.ts.map +0 -1
- package/dist/MetricsBoard.d.ts.map +0 -1
- package/dist/ResourceTable.d.ts.map +0 -1
- package/dist/ResourceTable.js +0 -112
- package/dist/VertebrAdmin.d.ts.map +0 -1
- package/dist/client.d.ts +0 -32
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -65
- package/dist/types.d.ts +0 -103
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -1
- package/dist/useVertebrControls.d.ts.map +0 -1
- /package/dist/{EnvSelect.js → components/env/EnvSelect.js} +0 -0
- /package/dist/{MetricsBoard.js → components/metrics/MetricsBoard.js} +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { ResourceCell } from "./ResourceCell";
|
|
4
|
+
function humanizeKey(key) {
|
|
5
|
+
return key
|
|
6
|
+
.replace(/([a-z])([A-Z])/g, "$1 $2")
|
|
7
|
+
.replace(/[_-]+/g, " ")
|
|
8
|
+
.replace(/\bcents\b/i, "")
|
|
9
|
+
.trim();
|
|
10
|
+
}
|
|
11
|
+
function findHeroImage(schema, row) {
|
|
12
|
+
for (const [key, value] of Object.entries(row)) {
|
|
13
|
+
if (typeof value !== "string" || !/^https?:\/\//i.test(value))
|
|
14
|
+
continue;
|
|
15
|
+
const field = schema[key];
|
|
16
|
+
if (/(image|img|photo|avatar|thumbnail|thumb|cover)/i.test(key) ||
|
|
17
|
+
/(image|img|photo)/i.test(field?.label ?? "") ||
|
|
18
|
+
/(image|img|media|cdn|photo)/i.test(value)) {
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
export function ResourceViewModal({ schema, row, title, canEdit, onClose, onEdit, }) {
|
|
25
|
+
const fields = Object.keys(schema);
|
|
26
|
+
const entries = fields.length > 0
|
|
27
|
+
? fields.map((key) => [key, row[key]])
|
|
28
|
+
: Object.entries(row);
|
|
29
|
+
const hero = findHeroImage(schema, row);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const onKeyDown = (event) => {
|
|
32
|
+
if (event.key === "Escape")
|
|
33
|
+
onClose();
|
|
34
|
+
};
|
|
35
|
+
window.addEventListener("keydown", onKeyDown);
|
|
36
|
+
const previous = document.body.style.overflow;
|
|
37
|
+
document.body.style.overflow = "hidden";
|
|
38
|
+
return () => {
|
|
39
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
40
|
+
document.body.style.overflow = previous;
|
|
41
|
+
};
|
|
42
|
+
}, [onClose]);
|
|
43
|
+
return (_jsx("div", { className: "vertebr-modal-backdrop", role: "presentation", onClick: onClose, children: _jsxs("div", { className: "vertebr-modal", role: "dialog", "aria-modal": "true", "aria-label": title, onClick: (event) => event.stopPropagation(), children: [_jsxs("header", { className: "vertebr-modal-head", children: [_jsxs("div", { className: "vertebr-modal-heading", children: [_jsx("p", { className: "vertebr-modal-eyebrow", children: "Record" }), _jsx("h2", { children: title })] }), _jsxs("div", { className: "vertebr-modal-actions", children: [canEdit && onEdit ? (_jsx("button", { type: "button", className: "vertebr-btn vertebr-btn-primary", onClick: onEdit, children: "Edit" })) : null, _jsx("button", { type: "button", className: "vertebr-btn", onClick: onClose, "aria-label": "Close", children: "Close" })] })] }), _jsxs("div", { className: "vertebr-modal-body", children: [hero ? (_jsx("div", { className: "vertebr-modal-hero", children: _jsx("img", { src: hero, alt: "" }) })) : null, _jsx("dl", { className: "vertebr-modal-fields", children: entries.map(([key, value]) => (_jsxs("div", { className: "vertebr-modal-field", children: [_jsx("dt", { children: schema[key]?.label ?? humanizeKey(key) }), _jsx("dd", { children: _jsx(ResourceCell, { fieldKey: key, field: schema[key], value: value, variant: "detail" }) })] }, key))) })] })] }) }));
|
|
44
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { VbTheme } from "../../hooks/useVertebrTheme";
|
|
2
|
+
export type ThemeToggleProps = {
|
|
3
|
+
theme: VbTheme;
|
|
4
|
+
onChange: (theme: VbTheme) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare function ThemeToggle({ theme, onChange }: ThemeToggleProps): import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=ThemeToggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeToggle.d.ts","sourceRoot":"","sources":["../../../src/components/theme/ThemeToggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAE3D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,gBAAgB,+BAgChE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function ThemeToggle({ theme, onChange }) {
|
|
3
|
+
return (_jsxs("div", { className: "vertebr-theme", children: [_jsx("div", { className: "vertebr-nav-label", children: "Appearance" }), _jsxs("div", { className: "vertebr-theme-toggle", role: "group", "aria-label": "Color theme", children: [_jsxs("button", { type: "button", className: "vertebr-theme-option", "data-active": theme === "light", "aria-pressed": theme === "light", onClick: () => onChange("light"), children: [_jsx(ThemeSunIcon, {}), "Light"] }), _jsxs("button", { type: "button", className: "vertebr-theme-option", "data-active": theme === "dark", "aria-pressed": theme === "dark", onClick: () => onChange("dark"), children: [_jsx(ThemeMoonIcon, {}), "Dark"] })] })] }));
|
|
4
|
+
}
|
|
5
|
+
function ThemeSunIcon() {
|
|
6
|
+
return (_jsxs("svg", { className: "vertebr-theme-icon", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [_jsx("circle", { cx: "12", cy: "12", r: "4" }), _jsx("path", { d: "M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41" })] }));
|
|
7
|
+
}
|
|
8
|
+
function ThemeMoonIcon() {
|
|
9
|
+
return (_jsx("svg", { className: "vertebr-theme-icon", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "M21 14.5A8.5 8.5 0 0 1 9.5 3 7 7 0 1 0 21 14.5z" }) }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { useVertebrTheme } from "./useVertebrTheme";
|
|
2
|
+
export type { VbTheme } from "./useVertebrTheme";
|
|
3
|
+
export { VertebrControlsProvider, useVertebrConfig, useVertebrControls, } from "./useVertebrControls";
|
|
4
|
+
export type { VertebrControlsProviderProps } from "./useVertebrControls";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
|
|
2
|
+
import { type VertebrControlsMap } from "@vertebr/client";
|
|
3
3
|
type ControlsContextValue = {
|
|
4
4
|
environment: string;
|
|
5
5
|
controls: VertebrControlsMap;
|
|
@@ -14,6 +14,7 @@ export type VertebrControlsProviderProps = {
|
|
|
14
14
|
environment: string;
|
|
15
15
|
children: ReactNode;
|
|
16
16
|
};
|
|
17
|
+
export type { VertebrControlsMap };
|
|
17
18
|
/**
|
|
18
19
|
* Loads all public Vertebr controls for the storefront once and shares them.
|
|
19
20
|
*/
|
|
@@ -30,5 +31,4 @@ export declare function useVertebrConfig<T extends Record<string, unknown>>(id:
|
|
|
30
31
|
};
|
|
31
32
|
/** Access the full public controls map (for gates like comingSoon). */
|
|
32
33
|
export declare function useVertebrControls(): ControlsContextValue;
|
|
33
|
-
export {};
|
|
34
34
|
//# sourceMappingURL=useVertebrControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useVertebrControls.d.ts","sourceRoot":"","sources":["../../src/hooks/useVertebrControls.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAuB,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE/E,KAAK,oBAAoB,GAAG;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAIF,MAAM,MAAM,4BAA4B,GAAG;IACzC,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAEnC;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,OAAsB,EACtB,WAAW,EACX,QAAQ,GACT,EAAE,4BAA4B,+BAuC9B;AAYD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChE,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,CAAC,GACV;IACD,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAMA;AAED,uEAAuE;AACvE,wBAAgB,kBAAkB,IAAI,oBAAoB,CAEzD"}
|
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { createVertebrClient } from "@vertebr/client";
|
|
4
4
|
const ControlsContext = createContext(null);
|
|
5
|
-
async function fetchPublicControls(apiBase, environment) {
|
|
6
|
-
const base = apiBase.replace(/\/$/, "");
|
|
7
|
-
const response = await fetch(`${base}/public/controls`, {
|
|
8
|
-
headers: {
|
|
9
|
-
Accept: "application/json",
|
|
10
|
-
[VERTEBR_ENV_HEADER]: environment,
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
if (!response.ok) {
|
|
14
|
-
const text = await response.text();
|
|
15
|
-
throw new Error(text || `Failed to load controls (${response.status})`);
|
|
16
|
-
}
|
|
17
|
-
const body = (await response.json());
|
|
18
|
-
return body.configs ?? {};
|
|
19
|
-
}
|
|
20
5
|
/**
|
|
21
6
|
* Loads all public Vertebr controls for the storefront once and shares them.
|
|
22
7
|
*/
|
|
@@ -24,11 +9,15 @@ export function VertebrControlsProvider({ apiBase = "/admin/api", environment, c
|
|
|
24
9
|
const [controls, setControls] = useState({});
|
|
25
10
|
const [loading, setLoading] = useState(true);
|
|
26
11
|
const [error, setError] = useState(null);
|
|
12
|
+
const client = useMemo(() => createVertebrClient({
|
|
13
|
+
apiBase,
|
|
14
|
+
getEnvironment: () => environment,
|
|
15
|
+
}), [apiBase, environment]);
|
|
27
16
|
const refresh = useCallback(async () => {
|
|
28
17
|
setLoading(true);
|
|
29
18
|
setError(null);
|
|
30
19
|
try {
|
|
31
|
-
const next = await
|
|
20
|
+
const next = await client.getPublicControls();
|
|
32
21
|
setControls(next);
|
|
33
22
|
}
|
|
34
23
|
catch (err) {
|
|
@@ -37,7 +26,7 @@ export function VertebrControlsProvider({ apiBase = "/admin/api", environment, c
|
|
|
37
26
|
finally {
|
|
38
27
|
setLoading(false);
|
|
39
28
|
}
|
|
40
|
-
}, [
|
|
29
|
+
}, [client]);
|
|
41
30
|
useEffect(() => {
|
|
42
31
|
void refresh();
|
|
43
32
|
}, [refresh]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useVertebrTheme.d.ts","sourceRoot":"","sources":["../../src/hooks/useVertebrTheme.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AA0BvC,wBAAgB,eAAe,CAAC,UAAU,SAAsB;;qBAU1B,OAAO;;EAS5C"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from "react";
|
|
2
|
+
const DEFAULT_STORAGE_KEY = "vertebr:theme";
|
|
3
|
+
function readStoredTheme(key) {
|
|
4
|
+
try {
|
|
5
|
+
const value = localStorage.getItem(key);
|
|
6
|
+
if (value === "light" || value === "dark")
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
// ignore
|
|
11
|
+
}
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
function writeStoredTheme(key, theme) {
|
|
15
|
+
try {
|
|
16
|
+
localStorage.setItem(key, theme);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
// ignore
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function applyTheme(theme) {
|
|
23
|
+
document.documentElement.setAttribute("data-vb-theme", theme);
|
|
24
|
+
}
|
|
25
|
+
export function useVertebrTheme(storageKey = DEFAULT_STORAGE_KEY) {
|
|
26
|
+
const [theme, setThemeState] = useState(() => readStoredTheme(storageKey) ?? "dark");
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
applyTheme(theme);
|
|
29
|
+
writeStoredTheme(storageKey, theme);
|
|
30
|
+
}, [theme, storageKey]);
|
|
31
|
+
const setTheme = useCallback((next) => {
|
|
32
|
+
setThemeState(next);
|
|
33
|
+
}, []);
|
|
34
|
+
const toggleTheme = useCallback(() => {
|
|
35
|
+
setThemeState((current) => (current === "dark" ? "light" : "dark"));
|
|
36
|
+
}, []);
|
|
37
|
+
return { theme, setTheme, toggleTheme };
|
|
38
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
export { VertebrAdmin } from "./VertebrAdmin";
|
|
2
|
-
export type { VertebrAdminProps } from "./VertebrAdmin";
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export {
|
|
1
|
+
export { VertebrAdmin } from "./components/admin/VertebrAdmin";
|
|
2
|
+
export type { VertebrAdminProps } from "./components/admin/VertebrAdmin";
|
|
3
|
+
export { MetricsBoard } from "./components/metrics/MetricsBoard";
|
|
4
|
+
export { GalleryBoard } from "./components/gallery/GalleryBoard";
|
|
5
|
+
export { ResourcePanel, ResourceTable } from "./components/resources/ResourceTable";
|
|
6
|
+
export { ThemeToggle } from "./components/theme/ThemeToggle";
|
|
7
|
+
export type { ThemeToggleProps } from "./components/theme/ThemeToggle";
|
|
8
|
+
export { ConfigForm } from "./components/config/ConfigForm";
|
|
9
|
+
export { EnvSelect } from "./components/env/EnvSelect";
|
|
10
|
+
export { useVertebrTheme } from "./hooks/useVertebrTheme";
|
|
11
|
+
export type { VbTheme } from "./hooks/useVertebrTheme";
|
|
12
|
+
export { VertebrControlsProvider, useVertebrConfig, useVertebrControls, } from "./hooks/useVertebrControls";
|
|
13
|
+
export type { VertebrControlsProviderProps } from "./hooks/useVertebrControls";
|
|
14
|
+
export { createVertebrClient, VERTEBR_ENV_HEADER, } from "@vertebr/client";
|
|
15
|
+
export type { VertebrClient, VertebrClientOptions, AdminEnvironment, BootstrapResponse, CatalogResponse, CatalogResource, CatalogConfig, CatalogConfigSection, EnvironmentAuthPublic, FieldSchema, FieldType, GalleryItem, GalleryMeta, GalleryResponse, MetricCard, MetricsResponse, ResourceListResponse, ResourceActionMeta, ResourceUploadMeta, ResourceUploadResponse, ResourceBulkUploadResponse, ConfigResponse, VertebrControlsMap, } from "@vertebr/client";
|
|
11
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,YAAY,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,YAAY,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,YAAY,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAG/E,OAAO,EACL,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,EACX,eAAe,EACf,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,cAAc,EACd,kBAAkB,GACnB,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
export { VertebrAdmin } from "./VertebrAdmin";
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export { ResourcePanel, ResourceTable } from "./ResourceTable";
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
1
|
+
export { VertebrAdmin } from "./components/admin/VertebrAdmin";
|
|
2
|
+
export { MetricsBoard } from "./components/metrics/MetricsBoard";
|
|
3
|
+
export { GalleryBoard } from "./components/gallery/GalleryBoard";
|
|
4
|
+
export { ResourcePanel, ResourceTable } from "./components/resources/ResourceTable";
|
|
5
|
+
export { ThemeToggle } from "./components/theme/ThemeToggle";
|
|
6
|
+
export { ConfigForm } from "./components/config/ConfigForm";
|
|
7
|
+
export { EnvSelect } from "./components/env/EnvSelect";
|
|
8
|
+
export { useVertebrTheme } from "./hooks/useVertebrTheme";
|
|
9
|
+
export { VertebrControlsProvider, useVertebrConfig, useVertebrControls, } from "./hooks/useVertebrControls";
|
|
10
|
+
// Re-export the framework-agnostic client for convenience.
|
|
11
|
+
export { createVertebrClient, VERTEBR_ENV_HEADER, } from "@vertebr/client";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* ── Auth ────────────────────────────────────────────── */
|
|
2
|
+
|
|
3
|
+
.vertebr-auth {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: 0.5rem;
|
|
7
|
+
padding: 0.15rem 0.2rem 0.35rem;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.vertebr-auth-hint {
|
|
11
|
+
margin: 0;
|
|
12
|
+
color: var(--vb-text-muted);
|
|
13
|
+
font-size: 0.78rem;
|
|
14
|
+
line-height: 1.4;
|
|
15
|
+
word-break: break-all;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.vertebr-auth-input {
|
|
19
|
+
width: 100%;
|
|
20
|
+
border: 1px solid var(--vb-border);
|
|
21
|
+
background: var(--vb-bg);
|
|
22
|
+
color: var(--vb-text);
|
|
23
|
+
border-radius: var(--vb-radius-sm);
|
|
24
|
+
padding: 0.55rem 0.65rem;
|
|
25
|
+
font: inherit;
|
|
26
|
+
font-size: 0.85rem;
|
|
27
|
+
transition: border-color 140ms ease, box-shadow 140ms ease;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.vertebr-auth-input:focus {
|
|
31
|
+
outline: none;
|
|
32
|
+
border-color: var(--vb-accent-dim);
|
|
33
|
+
box-shadow: 0 0 0 3px var(--vb-accent-soft);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.vertebr-auth-actions {
|
|
37
|
+
display: flex;
|
|
38
|
+
gap: 0.5rem;
|
|
39
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
html:has(.vertebr-root),
|
|
2
|
+
html:has(.vertebr-login),
|
|
3
|
+
html:has(.vertebr-loading),
|
|
4
|
+
html:has(.vertebr-error) {
|
|
5
|
+
background: var(--vb-bg);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
html:has(.vertebr-root) body,
|
|
9
|
+
html:has(.vertebr-login) body,
|
|
10
|
+
html:has(.vertebr-loading) body,
|
|
11
|
+
html:has(.vertebr-error) body {
|
|
12
|
+
margin: 0;
|
|
13
|
+
padding: 0;
|
|
14
|
+
min-height: 100vh;
|
|
15
|
+
background: var(--vb-bg);
|
|
16
|
+
color: var(--vb-text);
|
|
17
|
+
font-family: var(--vb-font);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.vertebr-root {
|
|
21
|
+
position: relative;
|
|
22
|
+
z-index: 1;
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
height: 100vh;
|
|
25
|
+
max-height: 100vh;
|
|
26
|
+
min-height: 100vh;
|
|
27
|
+
width: 100%;
|
|
28
|
+
display: grid;
|
|
29
|
+
grid-template-columns: var(--vb-sidebar-width) 1fr;
|
|
30
|
+
background:
|
|
31
|
+
radial-gradient(
|
|
32
|
+
900px 480px at 0% -10%,
|
|
33
|
+
var(--vb-glow-accent),
|
|
34
|
+
transparent 55%
|
|
35
|
+
),
|
|
36
|
+
radial-gradient(
|
|
37
|
+
700px 400px at 100% 100%,
|
|
38
|
+
var(--vb-glow-cool),
|
|
39
|
+
transparent 50%
|
|
40
|
+
),
|
|
41
|
+
linear-gradient(180deg, var(--vb-bg-deep) 0%, var(--vb-bg) 45%);
|
|
42
|
+
color: var(--vb-text);
|
|
43
|
+
font-family: var(--vb-font);
|
|
44
|
+
font-size: 15px;
|
|
45
|
+
line-height: 1.45;
|
|
46
|
+
-webkit-font-smoothing: antialiased;
|
|
47
|
+
isolation: isolate;
|
|
48
|
+
overflow: clip;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.vertebr-root *,
|
|
52
|
+
.vertebr-root *::before,
|
|
53
|
+
.vertebr-root *::after {
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Guard against host-page CSS leaking into the sidebar. */
|
|
58
|
+
.vertebr-sidebar,
|
|
59
|
+
.vertebr-sidebar-top,
|
|
60
|
+
.vertebr-sidebar-bottom,
|
|
61
|
+
.vertebr-nav,
|
|
62
|
+
.vertebr-nav-group,
|
|
63
|
+
.vertebr-brand,
|
|
64
|
+
.vertebr-env,
|
|
65
|
+
.vertebr-auth,
|
|
66
|
+
.vertebr-theme {
|
|
67
|
+
position: relative;
|
|
68
|
+
float: none;
|
|
69
|
+
inset: auto;
|
|
70
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/* ── Buttons / status ────────────────────────────────── */
|
|
2
|
+
|
|
3
|
+
.vertebr-btn {
|
|
4
|
+
appearance: none;
|
|
5
|
+
border: 1px solid var(--vb-border);
|
|
6
|
+
background: var(--vb-bg-muted);
|
|
7
|
+
color: var(--vb-text);
|
|
8
|
+
border-radius: var(--vb-radius-sm);
|
|
9
|
+
padding: 0.52rem 0.95rem;
|
|
10
|
+
font: inherit;
|
|
11
|
+
font-size: 0.88rem;
|
|
12
|
+
font-weight: 500;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
transition:
|
|
15
|
+
background 120ms ease,
|
|
16
|
+
border-color 120ms ease,
|
|
17
|
+
transform 80ms ease;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.vertebr-btn:hover:not(:disabled) {
|
|
21
|
+
background: var(--vb-bg-hover);
|
|
22
|
+
border-color: var(--vb-border-strong);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.vertebr-btn:active:not(:disabled) {
|
|
26
|
+
transform: translateY(1px);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.vertebr-btn-primary {
|
|
30
|
+
background: linear-gradient(
|
|
31
|
+
180deg,
|
|
32
|
+
var(--vb-btn-primary-from) 0%,
|
|
33
|
+
var(--vb-btn-primary-to) 100%
|
|
34
|
+
);
|
|
35
|
+
border-color: var(--vb-btn-primary-border);
|
|
36
|
+
color: var(--vb-accent-contrast);
|
|
37
|
+
font-weight: 600;
|
|
38
|
+
box-shadow: 0 1px 0 var(--vb-surface-tint-strong) inset;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.vertebr-btn-primary:hover:not(:disabled) {
|
|
42
|
+
background: linear-gradient(
|
|
43
|
+
180deg,
|
|
44
|
+
var(--vb-btn-primary-hover-from) 0%,
|
|
45
|
+
var(--vb-btn-primary-hover-to) 100%
|
|
46
|
+
);
|
|
47
|
+
border-color: var(--vb-btn-primary-hover-border);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.vertebr-btn:disabled {
|
|
51
|
+
opacity: 0.5;
|
|
52
|
+
cursor: not-allowed;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.vertebr-btn-quiet {
|
|
56
|
+
border-color: transparent;
|
|
57
|
+
background: transparent;
|
|
58
|
+
color: var(--vb-text-muted);
|
|
59
|
+
box-shadow: none;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.vertebr-btn-quiet:hover:not(:disabled) {
|
|
63
|
+
background: var(--vb-bg-hover);
|
|
64
|
+
border-color: transparent;
|
|
65
|
+
color: var(--vb-text);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.vertebr-btn-danger-quiet:hover:not(:disabled) {
|
|
69
|
+
background: var(--vb-danger-soft);
|
|
70
|
+
color: var(--vb-danger);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.vertebr-status {
|
|
74
|
+
font-family: var(--vb-mono);
|
|
75
|
+
font-size: 0.75rem;
|
|
76
|
+
color: var(--vb-text-muted);
|
|
77
|
+
letter-spacing: 0.02em;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.vertebr-status[data-tone="ok"] {
|
|
81
|
+
color: var(--vb-ok);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.vertebr-status[data-tone="danger"] {
|
|
85
|
+
color: var(--vb-danger);
|
|
86
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/* ── Cells ───────────────────────────────────────────── */
|
|
2
|
+
|
|
3
|
+
.vertebr-table tr:last-child td {
|
|
4
|
+
border-bottom: 0;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.vertebr-table td:has(.vertebr-cell-clamp),
|
|
8
|
+
.vertebr-table td:has(.vertebr-cell-media),
|
|
9
|
+
.vertebr-table td:has(.vertebr-cell-link) {
|
|
10
|
+
white-space: normal;
|
|
11
|
+
min-width: 10rem;
|
|
12
|
+
max-width: 16rem;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.vertebr-cell-empty {
|
|
16
|
+
color: var(--vb-text-subtle);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.vertebr-cell-text,
|
|
20
|
+
.vertebr-cell-number,
|
|
21
|
+
.vertebr-cell-money,
|
|
22
|
+
.vertebr-cell-datetime {
|
|
23
|
+
color: var(--vb-text);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.vertebr-cell-number,
|
|
27
|
+
.vertebr-cell-money {
|
|
28
|
+
font-variant-numeric: tabular-nums;
|
|
29
|
+
font-family: var(--vb-mono);
|
|
30
|
+
font-size: 0.86rem;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.vertebr-cell-money {
|
|
34
|
+
font-weight: 600;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.vertebr-cell-datetime {
|
|
38
|
+
font-family: var(--vb-mono);
|
|
39
|
+
font-size: 0.8rem;
|
|
40
|
+
color: var(--vb-text-muted);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.vertebr-cell-clamp {
|
|
44
|
+
display: -webkit-box;
|
|
45
|
+
-webkit-line-clamp: 2;
|
|
46
|
+
-webkit-box-orient: vertical;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
white-space: normal;
|
|
49
|
+
line-height: 1.35;
|
|
50
|
+
color: var(--vb-text-muted);
|
|
51
|
+
max-width: 16rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.vertebr-cell-link {
|
|
55
|
+
display: inline-block;
|
|
56
|
+
max-width: 14rem;
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
text-overflow: ellipsis;
|
|
59
|
+
white-space: nowrap;
|
|
60
|
+
color: var(--vb-accent);
|
|
61
|
+
text-decoration: none;
|
|
62
|
+
font-size: 0.82rem;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.vertebr-cell-link:hover {
|
|
66
|
+
text-decoration: underline;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.vertebr-cell-media {
|
|
70
|
+
display: inline-flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
gap: 0.65rem;
|
|
73
|
+
max-width: 16rem;
|
|
74
|
+
text-decoration: none;
|
|
75
|
+
color: inherit;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.vertebr-cell-media img {
|
|
79
|
+
width: 44px;
|
|
80
|
+
height: 44px;
|
|
81
|
+
object-fit: cover;
|
|
82
|
+
border-radius: var(--vb-radius-sm);
|
|
83
|
+
border: 1px solid var(--vb-border);
|
|
84
|
+
background: var(--vb-bg-muted);
|
|
85
|
+
flex: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.vertebr-cell-truncate {
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
text-overflow: ellipsis;
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
font-size: 0.75rem;
|
|
93
|
+
color: var(--vb-text-subtle);
|
|
94
|
+
font-family: var(--vb-mono);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.vertebr-cell-json {
|
|
98
|
+
display: inline-block;
|
|
99
|
+
max-width: 14rem;
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
text-overflow: ellipsis;
|
|
102
|
+
white-space: nowrap;
|
|
103
|
+
font-family: var(--vb-mono);
|
|
104
|
+
font-size: 0.75rem;
|
|
105
|
+
color: var(--vb-text-muted);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.vertebr-badge {
|
|
109
|
+
display: inline-flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
border-radius: 999px;
|
|
112
|
+
padding: 0.18rem 0.55rem;
|
|
113
|
+
font-size: 0.72rem;
|
|
114
|
+
font-weight: 600;
|
|
115
|
+
letter-spacing: 0.04em;
|
|
116
|
+
text-transform: uppercase;
|
|
117
|
+
border: 1px solid var(--vb-border);
|
|
118
|
+
color: var(--vb-text-muted);
|
|
119
|
+
background: var(--vb-surface-tint);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.vertebr-badge[data-tone="ok"] {
|
|
123
|
+
color: var(--vb-ok);
|
|
124
|
+
border-color: color-mix(in srgb, var(--vb-ok) 40%, transparent);
|
|
125
|
+
background: var(--vb-ok-soft);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.vertebr-badge[data-tone="neutral"] {
|
|
129
|
+
color: var(--vb-text-subtle);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.vertebr-chip-row {
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-wrap: wrap;
|
|
135
|
+
gap: 0.3rem;
|
|
136
|
+
max-width: 14rem;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.vertebr-chip {
|
|
140
|
+
border: 1px solid var(--vb-border);
|
|
141
|
+
border-radius: 999px;
|
|
142
|
+
padding: 0.1rem 0.45rem;
|
|
143
|
+
font-size: 0.72rem;
|
|
144
|
+
color: var(--vb-text-muted);
|
|
145
|
+
background: var(--vb-surface-tint);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.vertebr-empty {
|
|
149
|
+
flex: 1 1 auto;
|
|
150
|
+
display: grid;
|
|
151
|
+
place-items: center;
|
|
152
|
+
padding: 3rem 1.5rem;
|
|
153
|
+
text-align: center;
|
|
154
|
+
color: var(--vb-text-muted);
|
|
155
|
+
font-size: 0.92rem;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.vertebr-cell-media-detail {
|
|
159
|
+
flex-direction: column;
|
|
160
|
+
align-items: flex-start;
|
|
161
|
+
max-width: none;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.vertebr-cell-media-detail img {
|
|
165
|
+
width: min(100%, 280px);
|
|
166
|
+
height: auto;
|
|
167
|
+
max-height: 280px;
|
|
168
|
+
object-fit: cover;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.vertebr-cell-prose {
|
|
172
|
+
margin: 0;
|
|
173
|
+
white-space: pre-wrap;
|
|
174
|
+
line-height: 1.5;
|
|
175
|
+
color: var(--vb-text);
|
|
176
|
+
max-width: 40rem;
|
|
177
|
+
}
|
|
178
|
+
|