elbe-ui 1.0.8 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bit/_bit_provider.d.ts +1 -1
- package/dist/bit/_bit_provider.js +4 -4
- package/dist/bit/bit.d.ts +1 -1
- package/dist/bit/bit.js +1 -0
- package/dist/elbe.css +150 -562
- package/dist/elbe.css.map +1 -1
- package/dist/index.d.ts +188 -46
- package/dist/index.js +8 -6
- package/dist/ui/app/app.d.ts +13 -0
- package/dist/ui/app/app.js +81 -0
- package/dist/ui/app/app_ctxt.d.ts +35 -0
- package/dist/ui/app/app_ctxt.js +10 -0
- package/dist/ui/components/badge.d.ts +3 -3
- package/dist/ui/components/badge.js +16 -5
- package/dist/ui/components/banner.d.ts +3 -3
- package/dist/ui/components/banner.js +1 -1
- package/dist/ui/components/base/box.d.ts +82 -35
- package/dist/ui/components/base/box.js +56 -8
- package/dist/ui/components/base/card.d.ts +11 -12
- package/dist/ui/components/base/card.js +41 -19
- package/dist/ui/components/base/padded.d.ts +2 -4
- package/dist/ui/components/base/state_builder.d.ts +9 -0
- package/dist/ui/components/base/state_builder.js +33 -0
- package/dist/ui/components/button/button.d.ts +8 -6
- package/dist/ui/components/button/button.js +27 -16
- package/dist/ui/components/button/choose_button.d.ts +5 -3
- package/dist/ui/components/button/choose_button.js +9 -6
- package/dist/ui/components/button/icon_button.d.ts +6 -5
- package/dist/ui/components/button/icon_button.js +33 -23
- package/dist/ui/components/button/toggle_button.d.ts +5 -5
- package/dist/ui/components/button/toggle_button.js +13 -7
- package/dist/ui/components/dialog/dialog.d.ts +13 -0
- package/dist/ui/components/dialog/dialog.js +69 -0
- package/dist/ui/components/dialog/dialog_ctx.d.ts +34 -0
- package/dist/ui/components/dialog/dialog_ctx.js +44 -0
- package/dist/ui/components/dialog/dialogs/_alert.d.ts +7 -0
- package/dist/ui/components/dialog/dialogs/_alert.js +9 -0
- package/dist/ui/components/dialog/dialogs/_confirm.d.ts +9 -0
- package/dist/ui/components/dialog/dialogs/_confirm.js +21 -0
- package/dist/ui/components/error_view.js +3 -3
- package/dist/ui/components/footer.js +7 -7
- package/dist/ui/components/input/_labeled_input.d.ts +21 -0
- package/dist/ui/components/input/_labeled_input.js +21 -0
- package/dist/ui/components/input/checkbox.d.ts +4 -2
- package/dist/ui/components/input/checkbox.js +16 -8
- package/dist/ui/components/input/range.d.ts +5 -3
- package/dist/ui/components/input/range.js +19 -18
- package/dist/ui/components/input/select.d.ts +4 -3
- package/dist/ui/components/input/select.js +13 -40
- package/dist/ui/components/input/switch.d.ts +4 -2
- package/dist/ui/components/input/switch.js +30 -40
- package/dist/ui/components/input/text/input_field.d.ts +14 -19
- package/dist/ui/components/input/text/input_field.js +59 -61
- package/dist/ui/components/input/text/single_line.d.ts +11 -9
- package/dist/ui/components/input/text/single_line.js +15 -21
- package/dist/ui/components/layout/flex.d.ts +7 -3
- package/dist/ui/components/layout/flex.js +15 -12
- package/dist/ui/components/layout/header.d.ts +2 -2
- package/dist/ui/components/layout/header.js +26 -18
- package/dist/ui/components/layout/menu.d.ts +1 -1
- package/dist/ui/components/layout/menu.js +80 -49
- package/dist/ui/components/layout/scroll.d.ts +1 -0
- package/dist/ui/components/layout/scroll.js +3 -1
- package/dist/ui/components/layout/toolbar.js +9 -6
- package/dist/ui/components/link.d.ts +4 -2
- package/dist/ui/components/link.js +24 -11
- package/dist/ui/components/progress_bar.d.ts +2 -2
- package/dist/ui/components/progress_bar.js +12 -9
- package/dist/ui/components/spinner.d.ts +2 -7
- package/dist/ui/components/spinner.js +15 -16
- package/dist/ui/components/text.d.ts +5 -6
- package/dist/ui/components/text.js +34 -21
- package/dist/ui/components/tooltip.d.ts +5 -0
- package/dist/ui/components/tooltip.js +48 -0
- package/dist/ui/theme/subthemes/_theme_geometry.d.ts +9 -0
- package/dist/ui/theme/subthemes/_theme_geometry.js +22 -0
- package/dist/ui/theme/subthemes/_theme_menu.d.ts +9 -0
- package/dist/ui/theme/subthemes/_theme_menu.js +12 -0
- package/dist/ui/theme/subthemes/_theme_motion.d.ts +9 -0
- package/dist/ui/theme/subthemes/_theme_motion.js +13 -0
- package/dist/ui/theme/subthemes/_theme_toast.d.ts +8 -0
- package/dist/ui/theme/subthemes/_theme_toast.js +11 -0
- package/dist/ui/theme/subthemes/_theme_type.d.ts +49 -0
- package/dist/ui/theme/subthemes/_theme_type.js +73 -0
- package/dist/ui/theme/subthemes/color/_seed.d.ts +2 -0
- package/dist/ui/theme/subthemes/color/_seed.js +105 -0
- package/dist/ui/theme/subthemes/color/_theme_color.d.ts +865 -0
- package/dist/ui/theme/subthemes/color/_theme_color.js +83 -0
- package/dist/ui/theme/subthemes/color/colors/_color_contrast.d.ts +284 -0
- package/dist/ui/theme/subthemes/color/colors/_color_contrast.js +17 -0
- package/dist/ui/theme/subthemes/color/colors/_color_kind.d.ts +242 -0
- package/dist/ui/theme/subthemes/color/colors/_color_kind.js +45 -0
- package/dist/ui/theme/subthemes/color/colors/_color_layer.d.ts +226 -0
- package/dist/ui/theme/subthemes/color/colors/_color_layer.js +95 -0
- package/dist/ui/theme/subthemes/color/colors/_color_manner.d.ts +280 -0
- package/dist/ui/theme/subthemes/color/colors/_color_manner.js +17 -0
- package/dist/ui/theme/subthemes/color/colors/_color_mode.d.ts +269 -0
- package/dist/ui/theme/subthemes/color/colors/_color_mode.js +16 -0
- package/dist/ui/theme/subthemes/color/colors/_color_rgba.d.ts +166 -0
- package/dist/ui/theme/subthemes/color/colors/_color_rgba.js +86 -0
- package/dist/ui/theme/subthemes/color/colors/_color_scheme.d.ts +256 -0
- package/dist/ui/theme/subthemes/color/colors/_color_scheme.js +17 -0
- package/dist/ui/theme/subthemes/color/colors/_color_state.d.ts +252 -0
- package/dist/ui/theme/subthemes/color/colors/_color_state.js +49 -0
- package/dist/ui/theme/subthemes/color/colors/_colordef.d.ts +22 -0
- package/dist/ui/theme/subthemes/color/colors/_colordef.js +34 -0
- package/dist/ui/theme/subthemes/color/colors/colors.d.ts +511 -0
- package/dist/ui/theme/subthemes/color/colors/colors.js +24 -0
- package/dist/ui/theme/theme.d.ts +984 -30
- package/dist/ui/theme/theme.js +14 -82
- package/dist/ui/theme/theme_context.d.ts +15 -17
- package/dist/ui/theme/theme_context.js +79 -18
- package/dist/ui/util/_util.d.ts +8 -0
- package/dist/ui/util/_util.js +42 -0
- package/dist/ui/util/error_view.js +3 -3
- package/dist/ui/util/merge_deep.d.ts +1 -0
- package/dist/ui/util/merge_deep.js +18 -0
- package/dist/ui/util/root.d.ts +17 -0
- package/dist/ui/util/root.js +23 -0
- package/dist/ui/util/toast/_toast.d.ts +5 -0
- package/dist/ui/util/toast/_toast.js +7 -0
- package/dist/ui/util/toast/toast_ctx.d.ts +28 -0
- package/dist/ui/util/toast/toast_ctx.js +62 -0
- package/dist/ui/util/toast/toast_legacy.d.ts +5 -0
- package/dist/ui/util/{toast.js → toast/toast_legacy.js} +4 -4
- package/dist/ui/util/util.d.ts +15 -0
- package/dist/ui/util/util.js +69 -1
- package/package.json +11 -9
- package/dist/ui/components/dialog.d.ts +0 -10
- package/dist/ui/components/dialog.js +0 -35
- package/dist/ui/components/layout/app_base.d.ts +0 -15
- package/dist/ui/components/layout/app_base.js +0 -76
- package/dist/ui/components/layout/ctx_app_base.d.ts +0 -19
- package/dist/ui/components/layout/ctx_app_base.js +0 -12
- package/dist/ui/theme/color_theme.d.ts +0 -2
- package/dist/ui/theme/color_theme.js +0 -92
- package/dist/ui/theme/colors.d.ts +0 -133
- package/dist/ui/theme/colors.js +0 -309
- package/dist/ui/theme/geometry_theme.d.ts +0 -16
- package/dist/ui/theme/geometry_theme.js +0 -28
- package/dist/ui/theme/seed.d.ts +0 -53
- package/dist/ui/theme/seed.js +0 -4
- package/dist/ui/theme/type_theme.d.ts +0 -38
- package/dist/ui/theme/type_theme.js +0 -73
- package/dist/ui/util/confirm_dialog.d.ts +0 -10
- package/dist/ui/util/confirm_dialog.js +0 -46
- package/dist/ui/util/toast.d.ts +0 -5
- /package/dist/bit/{_bit_utils.d.ts → _bit_types.d.ts} +0 -0
- /package/dist/bit/{_bit_utils.js → _bit_types.js} +0 -0
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ElbeChildren } from "../util/types";
|
|
2
|
-
export declare function ElbeDialog({ title, open, onClose, children, _style, barrierDismissible, maxWidth, }: {
|
|
3
|
-
_style?: React.CSSProperties;
|
|
4
|
-
title: string;
|
|
5
|
-
open: boolean;
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
children: ElbeChildren;
|
|
8
|
-
barrierDismissible?: boolean;
|
|
9
|
-
maxWidth?: number;
|
|
10
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { X } from "lucide-react";
|
|
3
|
-
import { useEffect } from "react";
|
|
4
|
-
import { IconButton } from "./button/icon_button";
|
|
5
|
-
import { Spaced } from "./layout/spaced";
|
|
6
|
-
export function ElbeDialog({ title, open, onClose, children, _style, barrierDismissible, maxWidth, }) {
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
if (open) {
|
|
9
|
-
document.body.style.overflow = "hidden";
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
document.body.style.overflow = "";
|
|
13
|
-
}
|
|
14
|
-
return () => {
|
|
15
|
-
document.body.style.overflow = "";
|
|
16
|
-
};
|
|
17
|
-
}, [open]);
|
|
18
|
-
return (_jsx("dialog", { onClick: (e) => {
|
|
19
|
-
e.stopPropagation();
|
|
20
|
-
e.preventDefault();
|
|
21
|
-
if (barrierDismissible)
|
|
22
|
-
onClose();
|
|
23
|
-
}, open: open, style: Object.assign({ textAlign: "start" }, (_style !== null && _style !== void 0 ? _style : {})), children: _jsxs("div", { className: "elbe_dialog_base primary card plain-opaque padding-none", style: {
|
|
24
|
-
maxWidth: `min(${maxWidth !== null && maxWidth !== void 0 ? maxWidth : 40}rem, 100%)`,
|
|
25
|
-
minWidth: "10rem",
|
|
26
|
-
}, children: [_jsxs("div", { className: "row cross-center padded main-between", children: [_jsx("div", { className: "body-l b", children: title }), _jsx(IconButton.plain, { ariaLabel: "Close", icon: X, onTap: (e) => {
|
|
27
|
-
e.stopPropagation();
|
|
28
|
-
e.preventDefault();
|
|
29
|
-
onClose();
|
|
30
|
-
} })] }), _jsx(Spaced, { amount: 0.5 }), _jsx("div", { className: "padded", style: {
|
|
31
|
-
paddingTop: 0,
|
|
32
|
-
maxHeight: "80vh",
|
|
33
|
-
overflow: "auto",
|
|
34
|
-
}, children: children })] }) }));
|
|
35
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ElbeChild, ElbeRoute, HeaderLogos } from "../../..";
|
|
2
|
-
export type AppBaseProps = HeaderLogos & {
|
|
3
|
-
globalActions?: ElbeChild[];
|
|
4
|
-
children: ElbeRoute | ElbeRoute[];
|
|
5
|
-
hashBasedRouting?: boolean;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* app base is a layout component that provides an optional side menu and a content area.
|
|
9
|
-
* it is designed to be used as a base for other components and is
|
|
10
|
-
* used to create a consistent layout for pages. You can also pass global actions
|
|
11
|
-
* that will be displayed in the header of all pages.
|
|
12
|
-
*
|
|
13
|
-
* Provide `wouter.Route` or `MenuRoute` components as children to define the routes and menu items.
|
|
14
|
-
*/
|
|
15
|
-
export declare function AppBase(p: AppBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo, useState } from "react";
|
|
3
|
-
import { Box, isMenuRoute, Wouter, } from "../../..";
|
|
4
|
-
import { AppBaseContext } from "./ctx_app_base";
|
|
5
|
-
import { Menu } from "./menu";
|
|
6
|
-
/**
|
|
7
|
-
* app base is a layout component that provides an optional side menu and a content area.
|
|
8
|
-
* it is designed to be used as a base for other components and is
|
|
9
|
-
* used to create a consistent layout for pages. You can also pass global actions
|
|
10
|
-
* that will be displayed in the header of all pages.
|
|
11
|
-
*
|
|
12
|
-
* Provide `wouter.Route` or `MenuRoute` components as children to define the routes and menu items.
|
|
13
|
-
*/
|
|
14
|
-
export function AppBase(p) {
|
|
15
|
-
return _jsx(Wouter.Router, { children: _jsx(_AppBase, Object.assign({}, p)) });
|
|
16
|
-
}
|
|
17
|
-
function _initialLocation() {
|
|
18
|
-
return (window.location.pathname + window.location.search + window.location.hash);
|
|
19
|
-
}
|
|
20
|
-
function _AppBase(p) {
|
|
21
|
-
var _a;
|
|
22
|
-
const [menuOpen, setMenuOpen] = useState(false);
|
|
23
|
-
const menuItems = useMemo(() => {
|
|
24
|
-
return _extractMenuItems(p.children);
|
|
25
|
-
}, [p.children]);
|
|
26
|
-
const [location, navigate] = Wouter.useLocation();
|
|
27
|
-
const [history, setHistory] = useState([_initialLocation()]);
|
|
28
|
-
return (_jsx(AppBaseContext.Provider, { value: {
|
|
29
|
-
menuOpen: menuOpen,
|
|
30
|
-
icons: {
|
|
31
|
-
logo: p.logo,
|
|
32
|
-
logoDark: p.logoDark,
|
|
33
|
-
endLogo: p.endLogo,
|
|
34
|
-
endLogoDark: p.endLogoDark,
|
|
35
|
-
},
|
|
36
|
-
globalActions: (_a = p.globalActions) !== null && _a !== void 0 ? _a : [],
|
|
37
|
-
setMenuOpen: (b) => setMenuOpen(b),
|
|
38
|
-
router: {
|
|
39
|
-
goBack: (steps = 1) => {
|
|
40
|
-
if (history.length === 0)
|
|
41
|
-
return;
|
|
42
|
-
const targetIndex = Math.max(0, history.length - 1 - steps);
|
|
43
|
-
const target = history[targetIndex];
|
|
44
|
-
setHistory((h) => h.slice(0, targetIndex + 1));
|
|
45
|
-
navigate(target, { replace: true });
|
|
46
|
-
},
|
|
47
|
-
go: (p, replace) => {
|
|
48
|
-
setHistory((h) => {
|
|
49
|
-
if (replace === "all")
|
|
50
|
-
return [p];
|
|
51
|
-
const repl = Math.max(0, replace !== null && replace !== void 0 ? replace : 0);
|
|
52
|
-
if (repl === 0)
|
|
53
|
-
return [...h, p];
|
|
54
|
-
return [...h.slice(0, -repl), p];
|
|
55
|
-
});
|
|
56
|
-
navigate(p, { replace: (replace !== null && replace !== void 0 ? replace : 0) !== 0 });
|
|
57
|
-
},
|
|
58
|
-
history: history,
|
|
59
|
-
location: location,
|
|
60
|
-
},
|
|
61
|
-
}, children: _jsxs(Box, { typeLabel: "app_base", scheme: "primary", style: {
|
|
62
|
-
display: "flex",
|
|
63
|
-
width: "100%",
|
|
64
|
-
minHeight: "100vh",
|
|
65
|
-
}, children: [menuItems.length > 0 && _jsx(Menu, { items: menuItems }), _jsx("div", { style: { flex: 1, width: "0px" }, children: _jsx(Wouter.Switch, { children: p.children }) })] }) }));
|
|
66
|
-
}
|
|
67
|
-
function _extractMenuItems(children) {
|
|
68
|
-
const childs = Array.isArray(children) ? children : [children];
|
|
69
|
-
const items = [];
|
|
70
|
-
for (const child of childs) {
|
|
71
|
-
if (!isMenuRoute(child))
|
|
72
|
-
continue;
|
|
73
|
-
items.push(child.props);
|
|
74
|
-
}
|
|
75
|
-
return items;
|
|
76
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ElbeChild, int } from "../../util/types";
|
|
2
|
-
import { HeaderLogos } from "./header";
|
|
3
|
-
export interface _AppBaseState {
|
|
4
|
-
menuOpen: boolean;
|
|
5
|
-
icons: HeaderLogos;
|
|
6
|
-
globalActions: ElbeChild[];
|
|
7
|
-
router: {
|
|
8
|
-
go: (path: string, replace?: int | "all") => void;
|
|
9
|
-
goBack: (steps?: number) => void;
|
|
10
|
-
history: string[];
|
|
11
|
-
location: string;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export interface _AppBaseControl extends _AppBaseState {
|
|
15
|
-
setMenuOpen: (open: boolean) => void;
|
|
16
|
-
}
|
|
17
|
-
export declare const AppBaseContext: import("react").Context<_AppBaseControl | null>;
|
|
18
|
-
export declare function useAppBase(): _AppBaseControl;
|
|
19
|
-
export declare function maybeAppBase(): _AppBaseControl | null;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from "react";
|
|
2
|
-
export const AppBaseContext = createContext(null);
|
|
3
|
-
export function useAppBase() {
|
|
4
|
-
const ctx = useContext(AppBaseContext);
|
|
5
|
-
if (ctx)
|
|
6
|
-
return ctx;
|
|
7
|
-
throw new Error("useAppBase must be used within an AppBase. try using maybeAppBase()");
|
|
8
|
-
}
|
|
9
|
-
export function maybeAppBase() {
|
|
10
|
-
var _a;
|
|
11
|
-
return (_a = useContext(AppBaseContext)) !== null && _a !== void 0 ? _a : null;
|
|
12
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { colors, LayerColor, } from "./colors";
|
|
2
|
-
import { lColor } from "./seed";
|
|
3
|
-
export function colorThemePreset(merge
|
|
4
|
-
//highVis: boolean = false
|
|
5
|
-
) {
|
|
6
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
7
|
-
const seed = merge !== null && merge !== void 0 ? merge : {};
|
|
8
|
-
return {
|
|
9
|
-
base: (_a = seed.base) !== null && _a !== void 0 ? _a : LayerColor.fromBack(colors.white),
|
|
10
|
-
accent: (_b = seed.accent) !== null && _b !== void 0 ? _b : LayerColor.fromBack(colors.blueAccent),
|
|
11
|
-
info: (_c = seed.info) !== null && _c !== void 0 ? _c : LayerColor.fromBack(colors.blue),
|
|
12
|
-
success: (_d = seed.success) !== null && _d !== void 0 ? _d : LayerColor.fromBack(colors.green),
|
|
13
|
-
warning: (_e = seed.warning) !== null && _e !== void 0 ? _e : LayerColor.fromBack(colors.yellow),
|
|
14
|
-
error: (_f = seed.error) !== null && _f !== void 0 ? _f : LayerColor.fromBack(colors.red),
|
|
15
|
-
contrast: {
|
|
16
|
-
highvis: (_h = (_g = seed.contrast) === null || _g === void 0 ? void 0 : _g.highvis) !== null && _h !== void 0 ? _h : (({ seed }) => (Object.assign(Object.assign({}, seed), { accent: LayerColor.fromBack(colors.black) }))),
|
|
17
|
-
normal: (_k = (_j = seed.contrast) === null || _j === void 0 ? void 0 : _j.normal) !== null && _k !== void 0 ? _k : (({ seed }) => seed),
|
|
18
|
-
},
|
|
19
|
-
mode: {
|
|
20
|
-
light: (_m = (_l = seed.mode) === null || _l === void 0 ? void 0 : _l.light) !== null && _m !== void 0 ? _m : (({ base }) => base),
|
|
21
|
-
dark: (_p = (_o = seed.mode) === null || _o === void 0 ? void 0 : _o.dark) !== null && _p !== void 0 ? _p : (({ base }) => base.mirrorBrightness()),
|
|
22
|
-
},
|
|
23
|
-
scheme: {
|
|
24
|
-
primary: (_r = (_q = seed.scheme) === null || _q === void 0 ? void 0 : _q.primary) !== null && _r !== void 0 ? _r : _makePrimary,
|
|
25
|
-
secondary: (p) => {
|
|
26
|
-
var _a, _b, _c, _d;
|
|
27
|
-
const highVis = p.path.includes("highvis");
|
|
28
|
-
return (highVis
|
|
29
|
-
? (_b = (_a = seed.scheme) === null || _a === void 0 ? void 0 : _a.primary) !== null && _b !== void 0 ? _b : _makePrimary
|
|
30
|
-
: (_d = (_c = seed.scheme) === null || _c === void 0 ? void 0 : _c.secondary) !== null && _d !== void 0 ? _d : _makeSecondary)(p);
|
|
31
|
-
},
|
|
32
|
-
inverse: (_t = (_s = seed.scheme) === null || _s === void 0 ? void 0 : _s.inverse) !== null && _t !== void 0 ? _t : _makeInverse,
|
|
33
|
-
},
|
|
34
|
-
style: {
|
|
35
|
-
accent: _styleSel,
|
|
36
|
-
info: _styleSel,
|
|
37
|
-
success: _styleSel,
|
|
38
|
-
warning: _styleSel,
|
|
39
|
-
error: _styleSel,
|
|
40
|
-
},
|
|
41
|
-
variant: {
|
|
42
|
-
major: (_v = (_u = seed.variant) === null || _u === void 0 ? void 0 : _u.major) !== null && _v !== void 0 ? _v : _makeMajor,
|
|
43
|
-
minor: (p) => {
|
|
44
|
-
var _a, _b;
|
|
45
|
-
if ((_a = seed.variant) === null || _a === void 0 ? void 0 : _a.minor)
|
|
46
|
-
return (_b = seed.variant) === null || _b === void 0 ? void 0 : _b.minor(p);
|
|
47
|
-
const highVis = p.path.includes("highvis");
|
|
48
|
-
return highVis ? _makeMajor(p) : _makeMinor(p);
|
|
49
|
-
},
|
|
50
|
-
flat: (_x = (_w = seed.variant) === null || _w === void 0 ? void 0 : _w.flat) !== null && _x !== void 0 ? _x : _makeFlat,
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
const _styleSel = ({ base, style }) => {
|
|
55
|
-
const bL = base.luminance;
|
|
56
|
-
if (bL === 1)
|
|
57
|
-
return style;
|
|
58
|
-
//if (bL === 0) return s.mirrorBrightness();
|
|
59
|
-
if (style.luminance == 0)
|
|
60
|
-
return style.mirrorBrightness();
|
|
61
|
-
return style.inter(LayerColor.fromBack(bL > 0.5 ? colors.black : colors.white), 0.1);
|
|
62
|
-
};
|
|
63
|
-
const _makePrimary = (p) => p.base;
|
|
64
|
-
const _makeSecondary = ({ base, seed }) => new LayerColor(base.back
|
|
65
|
-
.inter(lColor(seed.accent).back, base.back.luminance < 0.3 ? 0.2 : 0.1)
|
|
66
|
-
.desaturated(0.5), base.front, base.border);
|
|
67
|
-
const _makeInverse = ({ base }) => base.mirrorBrightness();
|
|
68
|
-
const _makeMajor = ({ style, path }) => {
|
|
69
|
-
return LayerColor.fromBack(style.back, { border: style.back });
|
|
70
|
-
};
|
|
71
|
-
const _makeMinor = ({ base, style }) => {
|
|
72
|
-
const b = base.back;
|
|
73
|
-
const backIn = b.mirrorBrightness();
|
|
74
|
-
const major = style.back;
|
|
75
|
-
const minor = style.back.inter(b, 0.8);
|
|
76
|
-
const minorFront = minor.hasWCAGContrast(major) ? major : null;
|
|
77
|
-
return new LayerColor(style.back.withAlpha(0.25), minorFront !== null && minorFront !== void 0 ? minorFront : major.inter(backIn, 0.6), minorFront !== null && minorFront !== void 0 ? minorFront : major.inter(backIn, 0.3));
|
|
78
|
-
};
|
|
79
|
-
const _makeFlat = ({ path, style, base }) => {
|
|
80
|
-
const highVis = path.includes("highvis");
|
|
81
|
-
const front = !style
|
|
82
|
-
? base.front
|
|
83
|
-
: base.back.hasWCAGContrast(style === null || style === void 0 ? void 0 : style.back)
|
|
84
|
-
? style === null || style === void 0 ? void 0 : style.back
|
|
85
|
-
: style === null || style === void 0 ? void 0 : style.back.inter(base.front, 0.6);
|
|
86
|
-
const isDark = base.back.luminance < 0.3;
|
|
87
|
-
const border = !highVis && !style
|
|
88
|
-
? base.front.inter(base.back, isDark ? 0.75 : 0.9)
|
|
89
|
-
: base.front;
|
|
90
|
-
return new LayerColor(base.back, //.withAlpha(0),
|
|
91
|
-
front, highVis ? border : null, border);
|
|
92
|
-
};
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { ColorThemeSeed, PartialColorThemeSeed, ThemeColors } from "./seed";
|
|
2
|
-
export type ElbeColorContrasts = "normal" | "highvis";
|
|
3
|
-
export type ElbeColorModes = "light" | "dark";
|
|
4
|
-
export type ElbeColorSchemes = "primary" | "secondary" | "inverse";
|
|
5
|
-
export type ElbeAlertKinds = "success" | "warning" | "error" | "info";
|
|
6
|
-
export type ElbeColorKinds = ElbeAlertKinds | "plain" | "accent";
|
|
7
|
-
export type ElbeColorManners = "major" | "minor" | "flat" | "plain";
|
|
8
|
-
export declare const cContrasts: ElbeColorContrasts[];
|
|
9
|
-
export declare const cModes: ElbeColorModes[];
|
|
10
|
-
export declare const cSchemes: ElbeColorSchemes[];
|
|
11
|
-
export declare const cKinds: ElbeColorKinds[];
|
|
12
|
-
export declare const cManners: ElbeColorManners[];
|
|
13
|
-
export declare const cStates: string[];
|
|
14
|
-
export declare const cLayers: string[];
|
|
15
|
-
type _SeedSelInput = {
|
|
16
|
-
path: string[];
|
|
17
|
-
seed: ColorThemeSeed;
|
|
18
|
-
base: LayerColor;
|
|
19
|
-
};
|
|
20
|
-
export type SeedSelector = (p: _SeedSelInput) => LayerColor;
|
|
21
|
-
export type SeedModifier = (p: _SeedSelInput) => ColorThemeSeed;
|
|
22
|
-
export type SeedFlatSelector = (p: _SeedSelInput & {
|
|
23
|
-
style?: LayerColor;
|
|
24
|
-
}) => LayerColor;
|
|
25
|
-
export type SeedStyleSelector = (p: _SeedSelInput & {
|
|
26
|
-
style: LayerColor;
|
|
27
|
-
}) => LayerColor;
|
|
28
|
-
export declare class RGBAColor {
|
|
29
|
-
r: number;
|
|
30
|
-
g: number;
|
|
31
|
-
b: number;
|
|
32
|
-
a: number;
|
|
33
|
-
constructor(r: number, g: number, b: number, a: number);
|
|
34
|
-
asCss(): string;
|
|
35
|
-
get isDark(): boolean;
|
|
36
|
-
get luminance(): number;
|
|
37
|
-
get hex(): string;
|
|
38
|
-
static fromHex(hex: string | null): RGBAColor;
|
|
39
|
-
desaturated(f?: number): RGBAColor;
|
|
40
|
-
withAlpha(a: number): RGBAColor;
|
|
41
|
-
inter(other: RGBAColor, factor: number): RGBAColor;
|
|
42
|
-
mirrorBrightness(factor?: number): RGBAColor;
|
|
43
|
-
get values(): [number, number, number, number];
|
|
44
|
-
hasWCAGContrast(color: RGBAColor): boolean;
|
|
45
|
-
contrastRatio(color: RGBAColor): number;
|
|
46
|
-
}
|
|
47
|
-
export declare const colors: {
|
|
48
|
-
transparent: RGBAColor;
|
|
49
|
-
white: RGBAColor;
|
|
50
|
-
black: RGBAColor;
|
|
51
|
-
blueAccent: RGBAColor;
|
|
52
|
-
blue: RGBAColor;
|
|
53
|
-
green: RGBAColor;
|
|
54
|
-
yellow: RGBAColor;
|
|
55
|
-
red: RGBAColor;
|
|
56
|
-
};
|
|
57
|
-
export declare class LayerColor extends RGBAColor {
|
|
58
|
-
back: RGBAColor;
|
|
59
|
-
border?: (RGBAColor | null) | undefined;
|
|
60
|
-
borderContext?: (RGBAColor | null) | undefined;
|
|
61
|
-
front: RGBAColor;
|
|
62
|
-
constructor(back: RGBAColor, front: RGBAColor | null, border?: (RGBAColor | null) | undefined, borderContext?: (RGBAColor | null) | undefined);
|
|
63
|
-
asCss(): string;
|
|
64
|
-
inter(other: LayerColor, factor: number): LayerColor;
|
|
65
|
-
mirrorBrightness(factor?: number): LayerColor;
|
|
66
|
-
desaturated(): LayerColor;
|
|
67
|
-
static fromHex(back: string, front?: string | null, border?: string | null): LayerColor;
|
|
68
|
-
withBorder(border: RGBAColor): LayerColor;
|
|
69
|
-
static fromBack(back: RGBAColor, c?: {
|
|
70
|
-
front?: RGBAColor;
|
|
71
|
-
border?: RGBAColor;
|
|
72
|
-
}): LayerColor;
|
|
73
|
-
contextCss(): string;
|
|
74
|
-
}
|
|
75
|
-
export declare class StateColor extends LayerColor {
|
|
76
|
-
neutral: LayerColor;
|
|
77
|
-
hover: LayerColor;
|
|
78
|
-
active: LayerColor;
|
|
79
|
-
disabled: LayerColor;
|
|
80
|
-
constructor(neutral: LayerColor, hover: LayerColor, active: LayerColor, disabled: LayerColor);
|
|
81
|
-
asCss(): string;
|
|
82
|
-
static generate(p: string[], _: ColorThemeSeed, context: LayerColor, style: LayerColor, fromFront?: boolean): StateColor;
|
|
83
|
-
}
|
|
84
|
-
export declare class MannerColor extends StateColor {
|
|
85
|
-
major: StateColor | null;
|
|
86
|
-
minor: StateColor | null;
|
|
87
|
-
flat: StateColor;
|
|
88
|
-
constructor(major: StateColor | null, minor: StateColor | null, flat: StateColor);
|
|
89
|
-
asCss(fallback?: MannerColor): string;
|
|
90
|
-
raisedCss(): string;
|
|
91
|
-
static generate(path: string[], seed: ColorThemeSeed, base: LayerColor, style?: LayerColor): MannerColor;
|
|
92
|
-
}
|
|
93
|
-
export declare class KindColor extends MannerColor {
|
|
94
|
-
plain: MannerColor;
|
|
95
|
-
accent: MannerColor;
|
|
96
|
-
info: MannerColor;
|
|
97
|
-
success: MannerColor;
|
|
98
|
-
warning: MannerColor;
|
|
99
|
-
error: MannerColor;
|
|
100
|
-
constructor(plain: MannerColor, accent: MannerColor, info: MannerColor, success: MannerColor, warning: MannerColor, error: MannerColor);
|
|
101
|
-
asCss(): string;
|
|
102
|
-
static generate(path: string[], seed: ColorThemeSeed, base: LayerColor): KindColor;
|
|
103
|
-
}
|
|
104
|
-
export declare class SchemeColor extends KindColor {
|
|
105
|
-
primary: KindColor;
|
|
106
|
-
secondary: KindColor;
|
|
107
|
-
inverse: KindColor;
|
|
108
|
-
constructor(primary: KindColor, secondary: KindColor, inverse: KindColor);
|
|
109
|
-
asCss(): string;
|
|
110
|
-
static generate(path: string[], seed: ColorThemeSeed, base: LayerColor): SchemeColor;
|
|
111
|
-
}
|
|
112
|
-
export declare class ModeColor extends SchemeColor {
|
|
113
|
-
light: SchemeColor;
|
|
114
|
-
dark: SchemeColor;
|
|
115
|
-
constructor(light: SchemeColor, dark: SchemeColor);
|
|
116
|
-
asCss(): string;
|
|
117
|
-
static generate(path: string[], seed: ColorThemeSeed): ModeColor;
|
|
118
|
-
}
|
|
119
|
-
export declare class ContrastColor extends ModeColor {
|
|
120
|
-
normal: ModeColor;
|
|
121
|
-
highvis: ModeColor;
|
|
122
|
-
constructor(normal: ModeColor, highvis: ModeColor);
|
|
123
|
-
asCss(): string;
|
|
124
|
-
static generate(path: string[], seed: ColorThemeSeed): ContrastColor;
|
|
125
|
-
}
|
|
126
|
-
export declare class ColorTheme {
|
|
127
|
-
colors: ThemeColors;
|
|
128
|
-
color: ContrastColor;
|
|
129
|
-
constructor(colors: ThemeColors, color: ContrastColor);
|
|
130
|
-
asCss(): string;
|
|
131
|
-
static generate(seed?: Partial<PartialColorThemeSeed>): ColorTheme;
|
|
132
|
-
}
|
|
133
|
-
export {};
|