elbe-ui 1.0.8 → 2.0.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/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 +12 -0
- package/dist/ui/{components/layout/app_base.js → app/app.js} +24 -31
- 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 +36 -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 +20 -13
- 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 +63 -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 +25 -18
- package/dist/ui/components/layout/menu.js +74 -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 +1 -0
- package/dist/ui/util/_util.js +3 -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 +8 -0
- package/dist/ui/util/util.js +54 -1
- package/package.json +10 -8
- 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/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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useRef, useState } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { useApp } from "../app/app_ctxt";
|
|
5
|
+
import { getRootElement } from "../util/root";
|
|
6
|
+
export function WithTooltip(p) {
|
|
7
|
+
const rootDOM = useMemo(() => getRootElement("elbe_tooltip"), []);
|
|
8
|
+
const timeoutRef = useRef(null);
|
|
9
|
+
const [visible, setVisible] = useState(false);
|
|
10
|
+
const [coords, setCoords] = useState({ x: 0, y: 0, top: false, left: false });
|
|
11
|
+
const { _appThemeContext } = useApp();
|
|
12
|
+
const { theme } = _appThemeContext.useTheme().useWith((c) => ({
|
|
13
|
+
color: Object.assign(Object.assign({}, c.color), { selection: Object.assign(Object.assign({}, c.color.selection), { scheme: "inverse", kind: "accent", manner: "plain", state: "neutral" }) }),
|
|
14
|
+
}), []);
|
|
15
|
+
if (!p.tooltip)
|
|
16
|
+
return _jsx(_Fragment, { children: p.children });
|
|
17
|
+
return (_jsxs("span", { onMouseEnter: () => {
|
|
18
|
+
timeoutRef.current = window.setTimeout(() => setVisible(true), 1000);
|
|
19
|
+
}, onMouseLeave: () => {
|
|
20
|
+
console.log("leave");
|
|
21
|
+
if (timeoutRef.current) {
|
|
22
|
+
clearTimeout(timeoutRef.current);
|
|
23
|
+
timeoutRef.current = null;
|
|
24
|
+
}
|
|
25
|
+
setVisible(false);
|
|
26
|
+
}, onMouseMove: (e) => {
|
|
27
|
+
setCoords({
|
|
28
|
+
x: e.clientX,
|
|
29
|
+
y: e.clientY,
|
|
30
|
+
top: e.clientY > window.innerHeight / 2,
|
|
31
|
+
left: e.clientX > window.innerWidth / 2,
|
|
32
|
+
});
|
|
33
|
+
}, style: { display: "contents" }, children: [p.children, visible &&
|
|
34
|
+
createPortal(_jsx("div", { role: "tooltip", className: "elbe_tooltip", style: {
|
|
35
|
+
position: "fixed",
|
|
36
|
+
pointerEvents: "none",
|
|
37
|
+
zIndex: 1001,
|
|
38
|
+
top: coords.y + (coords.top ? -12 : 12), // offset below cursor
|
|
39
|
+
left: coords.x + (coords.left ? -12 : 12), // offset right of cursor
|
|
40
|
+
background: theme.color.currentColor.back
|
|
41
|
+
.inter(theme.color.currentColor.front, 0.2)
|
|
42
|
+
.asCss(),
|
|
43
|
+
color: theme.color.currentColor.front.asCss(),
|
|
44
|
+
padding: ".125rem .3rem",
|
|
45
|
+
borderRadius: ".25rem",
|
|
46
|
+
transform: `translate(${coords.left ? "-100%" : "0"}, ${coords.top ? "-100%" : "0"})`,
|
|
47
|
+
}, children: p.tooltip }), rootDOM)] }));
|
|
48
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const _data = {
|
|
2
|
+
size: 16,
|
|
3
|
+
radius: 0.75,
|
|
4
|
+
padding: 1,
|
|
5
|
+
borderWidth: 0.125,
|
|
6
|
+
};
|
|
7
|
+
export const geometryThemeData = {
|
|
8
|
+
seed: _data,
|
|
9
|
+
_configType: _data,
|
|
10
|
+
compute: (c) => c,
|
|
11
|
+
asCss: (c) => ({}),
|
|
12
|
+
asCssContext(c) {
|
|
13
|
+
document.documentElement.style.fontSize = `${c.size}px`;
|
|
14
|
+
return {
|
|
15
|
+
size: `${c.size}px`,
|
|
16
|
+
padding: `${c.padding}rem`,
|
|
17
|
+
"border-radius": `${c.radius}rem`,
|
|
18
|
+
"border-width": `${c.borderWidth}rem`,
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
fromSeed: (seed) => seed,
|
|
22
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ElbeSubThemeData } from "../theme";
|
|
2
|
+
import { ColorSelection } from "./color/colors/colors";
|
|
3
|
+
declare const _theme: {
|
|
4
|
+
scheme: ColorSelection.Schemes;
|
|
5
|
+
elevated: boolean;
|
|
6
|
+
sharp: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const menuThemeData: ElbeSubThemeData<typeof _theme, typeof _theme>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ElbeSubThemeData } from "../theme";
|
|
2
|
+
type _ToastAlignment = "top_start" | "top_center" | "top_end" | "bottom_start" | "bottom_center" | "bottom_end";
|
|
3
|
+
declare const _theme: {
|
|
4
|
+
alignment: _ToastAlignment;
|
|
5
|
+
duration: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const toastThemeData: ElbeSubThemeData<typeof _theme, typeof _theme>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ElbeSubThemeData } from "../theme";
|
|
2
|
+
export type TypeStyle<T extends Dict<any> = {}> = T & {
|
|
3
|
+
bold?: boolean;
|
|
4
|
+
italic?: boolean;
|
|
5
|
+
underline?: boolean;
|
|
6
|
+
family: string[];
|
|
7
|
+
size: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function typeStyleAsCss(style: TypeStyle | undefined): React.CSSProperties;
|
|
10
|
+
type _VariantSelector<T> = (style: TypeStyle, variant: T) => TypeStyle;
|
|
11
|
+
declare const _seed: {
|
|
12
|
+
heading: {
|
|
13
|
+
bold: boolean;
|
|
14
|
+
family: string[];
|
|
15
|
+
size: number;
|
|
16
|
+
};
|
|
17
|
+
body: {
|
|
18
|
+
bold: boolean;
|
|
19
|
+
family: string[];
|
|
20
|
+
size: number;
|
|
21
|
+
};
|
|
22
|
+
code: {
|
|
23
|
+
bold: boolean;
|
|
24
|
+
family: string[];
|
|
25
|
+
size: number;
|
|
26
|
+
};
|
|
27
|
+
headingVariants: _VariantSelector<2 | 1 | 3 | 4 | 5 | 6>;
|
|
28
|
+
bodyVariants: _VariantSelector<"s" | "l">;
|
|
29
|
+
};
|
|
30
|
+
declare const _data: {
|
|
31
|
+
h1: TypeStyle;
|
|
32
|
+
h2: TypeStyle;
|
|
33
|
+
h3: TypeStyle;
|
|
34
|
+
h4: TypeStyle;
|
|
35
|
+
h5: TypeStyle;
|
|
36
|
+
h6: TypeStyle;
|
|
37
|
+
bodyL: TypeStyle;
|
|
38
|
+
bodyM: TypeStyle;
|
|
39
|
+
bodyS: TypeStyle;
|
|
40
|
+
code: TypeStyle;
|
|
41
|
+
};
|
|
42
|
+
type _Computed = {
|
|
43
|
+
[key in keyof typeof _data]: TypeStyle<{
|
|
44
|
+
asCss: (override?: Partial<TypeStyle>) => React.CSSProperties;
|
|
45
|
+
}>;
|
|
46
|
+
};
|
|
47
|
+
export type ElbeTypeVariants = keyof typeof _data;
|
|
48
|
+
export declare const typeThemeData: ElbeSubThemeData<_Computed, typeof _seed, typeof _data>;
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { dictMap, dictWithoutUndefined } from "../../util/util";
|
|
2
|
+
export function typeStyleAsCss(style) {
|
|
3
|
+
var _a, _b;
|
|
4
|
+
if (!style)
|
|
5
|
+
return {};
|
|
6
|
+
return {
|
|
7
|
+
fontFamily: (_a = style.family.join(", ")) !== null && _a !== void 0 ? _a : "sans-serif",
|
|
8
|
+
fontWeight: style.bold ? "bold" : "normal",
|
|
9
|
+
fontSize: `${(_b = style.size) !== null && _b !== void 0 ? _b : 1}rem`,
|
|
10
|
+
fontStyle: style.italic ? "italic" : "normal",
|
|
11
|
+
textDecoration: style.underline ? "underline" : "none",
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const _headingVariants = (style, variant) => {
|
|
15
|
+
const reg = 1;
|
|
16
|
+
const diff = style.size - reg;
|
|
17
|
+
const varFac = (4 - (variant - 2)) / 6;
|
|
18
|
+
const size = reg + diff * Math.pow(varFac, 1.5);
|
|
19
|
+
return Object.assign(Object.assign({}, style), { size });
|
|
20
|
+
};
|
|
21
|
+
const _bodyVariants = (style, variant) => {
|
|
22
|
+
const size = style.size * (variant === "s" ? 0.8 : 1.2);
|
|
23
|
+
return Object.assign(Object.assign({}, style), { size });
|
|
24
|
+
};
|
|
25
|
+
const _seed = {
|
|
26
|
+
heading: {
|
|
27
|
+
bold: true,
|
|
28
|
+
family: ["Calistoga", "Arial", "sans-serif"],
|
|
29
|
+
size: 2,
|
|
30
|
+
},
|
|
31
|
+
body: {
|
|
32
|
+
bold: false,
|
|
33
|
+
family: ["Helvetica", "Arial", "sans-serif"],
|
|
34
|
+
size: 1,
|
|
35
|
+
},
|
|
36
|
+
code: {
|
|
37
|
+
bold: false,
|
|
38
|
+
family: ["Courier", "monospace"],
|
|
39
|
+
size: 1,
|
|
40
|
+
},
|
|
41
|
+
headingVariants: _headingVariants,
|
|
42
|
+
bodyVariants: _bodyVariants,
|
|
43
|
+
};
|
|
44
|
+
const _data = {
|
|
45
|
+
h1: {},
|
|
46
|
+
h2: {},
|
|
47
|
+
h3: {},
|
|
48
|
+
h4: {},
|
|
49
|
+
h5: {},
|
|
50
|
+
h6: {},
|
|
51
|
+
bodyL: {},
|
|
52
|
+
bodyM: {},
|
|
53
|
+
bodyS: {},
|
|
54
|
+
code: {},
|
|
55
|
+
};
|
|
56
|
+
export const typeThemeData = {
|
|
57
|
+
seed: _seed,
|
|
58
|
+
_configType: _data,
|
|
59
|
+
compute: (c) => dictMap(c, (v) => (Object.assign(Object.assign({}, v), { asCss: (override) => typeStyleAsCss(Object.assign(Object.assign({}, v), dictWithoutUndefined(override))) }))),
|
|
60
|
+
asCss: (c) => typeStyleAsCss(c.bodyM),
|
|
61
|
+
fromSeed: (seed) => ({
|
|
62
|
+
h1: seed.heading,
|
|
63
|
+
h2: seed.headingVariants(seed.heading, 2),
|
|
64
|
+
h3: seed.headingVariants(seed.heading, 3),
|
|
65
|
+
h4: seed.headingVariants(seed.heading, 4),
|
|
66
|
+
h5: seed.headingVariants(seed.heading, 5),
|
|
67
|
+
h6: seed.headingVariants(seed.heading, 6),
|
|
68
|
+
bodyL: seed.bodyVariants(seed.body, "l"),
|
|
69
|
+
bodyM: seed.body,
|
|
70
|
+
bodyS: seed.bodyVariants(seed.body, "s"),
|
|
71
|
+
code: seed.code,
|
|
72
|
+
}),
|
|
73
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { LayerColor } from "./colors/_color_layer";
|
|
2
|
+
import { RGBAColor } from "./colors/_color_rgba";
|
|
3
|
+
import { colors, } from "./colors/colors";
|
|
4
|
+
const _styleSel = ({ base, style }) => {
|
|
5
|
+
const bL = base.luminance();
|
|
6
|
+
if (bL === 1)
|
|
7
|
+
return style;
|
|
8
|
+
//if (bL === 0) return s.mirrorBrightness();
|
|
9
|
+
if (style.luminance() == 0)
|
|
10
|
+
return style.mirrorBrightnessLayer();
|
|
11
|
+
return style.interLayerLayer(LayerColor.fromBack(bL > 0.5 ? colors.black : colors.white), 0.1);
|
|
12
|
+
};
|
|
13
|
+
const _makePrimary = (p) => p.base;
|
|
14
|
+
const _makeSecondary = ({ base, seed }) => LayerColor.new({
|
|
15
|
+
back: base.back
|
|
16
|
+
.inter(LayerColor.fromBack(seed.accent).back, base.back.luminance() < 0.3 ? 0.2 : 0.1)
|
|
17
|
+
.desaturated(0.5),
|
|
18
|
+
front: base.front,
|
|
19
|
+
border: base.border,
|
|
20
|
+
});
|
|
21
|
+
const _makeInverse = ({ base }) => base.mirrorBrightnessLayer();
|
|
22
|
+
const _makeMajor = ({ style, path }) => {
|
|
23
|
+
return LayerColor.fromBack(style.back, { border: style.back });
|
|
24
|
+
};
|
|
25
|
+
const _makeMinor = ({ base, style }) => {
|
|
26
|
+
const b = base.back;
|
|
27
|
+
const backIn = b.mirrorBrightness();
|
|
28
|
+
const major = style.back;
|
|
29
|
+
const minor = style.back.inter(b, 0.8);
|
|
30
|
+
const minorFront = minor.hasWCAGContrast(major) ? major : null;
|
|
31
|
+
return LayerColor.new({
|
|
32
|
+
back: minor, //.back.withAlpha(0.25),
|
|
33
|
+
front: minorFront !== null && minorFront !== void 0 ? minorFront : major.inter(backIn, 0.6),
|
|
34
|
+
border: minorFront !== null && minorFront !== void 0 ? minorFront : major.inter(backIn, 0.3),
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
const _makeFlat = ({ path, style, base }) => {
|
|
38
|
+
const highVis = path.includes("highvis");
|
|
39
|
+
const front = !style
|
|
40
|
+
? base.front
|
|
41
|
+
: base.back.hasWCAGContrast(style === null || style === void 0 ? void 0 : style.back)
|
|
42
|
+
? style === null || style === void 0 ? void 0 : style.back
|
|
43
|
+
: style === null || style === void 0 ? void 0 : style.back.inter(base.front, 0.6);
|
|
44
|
+
const isDark = base.back.luminance() < 0.3;
|
|
45
|
+
const border = !highVis && !style
|
|
46
|
+
? base.front.inter(base.back, isDark ? 0.75 : 0.9)
|
|
47
|
+
: base.front;
|
|
48
|
+
return LayerColor.new({
|
|
49
|
+
back: base.back, //.withAlpha(0),
|
|
50
|
+
front,
|
|
51
|
+
border: front,
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
export const _seed = {
|
|
55
|
+
base: LayerColor.fromBack(colors.white, {
|
|
56
|
+
border: RGBAColor.fromHex("#ccc"),
|
|
57
|
+
}),
|
|
58
|
+
accent: LayerColor.fromBack(colors.accent.blue),
|
|
59
|
+
info: LayerColor.fromBack(colors.blue),
|
|
60
|
+
success: LayerColor.fromBack(colors.green),
|
|
61
|
+
warning: LayerColor.fromBack(colors.yellow),
|
|
62
|
+
error: LayerColor.fromBack(colors.red),
|
|
63
|
+
selection: {
|
|
64
|
+
contrast: "normal",
|
|
65
|
+
mode: "light",
|
|
66
|
+
scheme: "primary",
|
|
67
|
+
kind: "accent",
|
|
68
|
+
manner: "plain",
|
|
69
|
+
state: "neutral",
|
|
70
|
+
},
|
|
71
|
+
contrast: {
|
|
72
|
+
highvis: ({ seed }) => {
|
|
73
|
+
const base = LayerColor.fromBack(seed.base);
|
|
74
|
+
return Object.assign(Object.assign({}, seed), { base: base.withBorder(base.front), accent: LayerColor.fromBack(colors.black) });
|
|
75
|
+
},
|
|
76
|
+
normal: ({ seed }) => seed,
|
|
77
|
+
},
|
|
78
|
+
mode: {
|
|
79
|
+
light: ({ base }) => base,
|
|
80
|
+
dark: ({ base }) => base.mirrorBrightnessLayer(),
|
|
81
|
+
},
|
|
82
|
+
scheme: {
|
|
83
|
+
primary: _makePrimary,
|
|
84
|
+
secondary: (p) => {
|
|
85
|
+
const highVis = p.path.includes("highvis");
|
|
86
|
+
return (highVis ? _makePrimary : _makeSecondary)(p);
|
|
87
|
+
},
|
|
88
|
+
inverse: _makeInverse,
|
|
89
|
+
},
|
|
90
|
+
kind: {
|
|
91
|
+
accent: _styleSel,
|
|
92
|
+
info: _styleSel,
|
|
93
|
+
success: _styleSel,
|
|
94
|
+
warning: _styleSel,
|
|
95
|
+
error: _styleSel,
|
|
96
|
+
},
|
|
97
|
+
manner: {
|
|
98
|
+
major: _makeMajor,
|
|
99
|
+
minor: (p) => {
|
|
100
|
+
const highVis = p.path.includes("highvis");
|
|
101
|
+
return highVis ? _makeMajor(p) : _makeMinor(p);
|
|
102
|
+
},
|
|
103
|
+
flat: _makeFlat,
|
|
104
|
+
},
|
|
105
|
+
};
|