elbe-ui 0.2.41 → 0.2.44

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.
Files changed (38) hide show
  1. package/dist/bit/bit.js +22 -25
  2. package/dist/bit/ctrl_bit.js +47 -28
  3. package/dist/elbe.css +58 -18
  4. package/dist/elbe.css.map +1 -1
  5. package/dist/index.js +33 -62
  6. package/dist/service/s_api.js +62 -49
  7. package/dist/ui/components/badge.js +13 -34
  8. package/dist/ui/components/base/box.js +21 -23
  9. package/dist/ui/components/base/card.js +19 -10
  10. package/dist/ui/components/base/padded.js +25 -16
  11. package/dist/ui/components/button/button.js +30 -22
  12. package/dist/ui/components/button/choose_button.js +7 -10
  13. package/dist/ui/components/button/icon_button.js +36 -26
  14. package/dist/ui/components/button/toggle_button.js +19 -10
  15. package/dist/ui/components/dialog.js +7 -10
  16. package/dist/ui/components/error_view.js +14 -16
  17. package/dist/ui/components/input/checkbox.js +17 -8
  18. package/dist/ui/components/input/input_field.js +28 -23
  19. package/dist/ui/components/input/range.js +26 -9
  20. package/dist/ui/components/input/select.js +16 -7
  21. package/dist/ui/components/input/text_area.js +17 -8
  22. package/dist/ui/components/layout/flex.js +24 -16
  23. package/dist/ui/components/layout/scaffold.d.ts +4 -3
  24. package/dist/ui/components/layout/scaffold.js +28 -18
  25. package/dist/ui/components/layout/scroll.js +10 -14
  26. package/dist/ui/components/layout/spaced.js +3 -6
  27. package/dist/ui/components/spinner.js +16 -19
  28. package/dist/ui/components/text.js +42 -37
  29. package/dist/ui/theme/color_theme.js +36 -42
  30. package/dist/ui/theme/colors.js +40 -77
  31. package/dist/ui/theme/geometry_theme.js +8 -16
  32. package/dist/ui/theme/theme.js +12 -34
  33. package/dist/ui/theme/type_theme.js +11 -39
  34. package/dist/ui/util/confirm_dialog.js +1 -4
  35. package/dist/ui/util/error_view.js +4 -7
  36. package/dist/ui/util/toast.js +1 -4
  37. package/dist/ui/util/util.js +8 -13
  38. package/package.json +3 -2
@@ -1,23 +1,31 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FlexSpace = FlexSpace;
4
- exports.Column = Column;
5
- exports.Row = Row;
6
- const jsx_runtime_1 = require("preact/jsx-runtime");
7
- const box_1 = require("../base/box");
8
- function FlexSpace({}) {
9
- return (0, jsx_runtime_1.jsx)("div", { style: "flex:1" });
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "preact/jsx-runtime";
13
+ import { applyProps } from "../base/box";
14
+ export function FlexSpace({}) {
15
+ return _jsx("div", { style: "flex:1" });
10
16
  }
11
- function Column({ gap = 1, main = "start", cross = "stretch", stretch = false, children, ...p }) {
17
+ export function Column(_a) {
18
+ var { gap = 1, main = "start", cross = "stretch", stretch = false, children } = _a, p = __rest(_a, ["gap", "main", "cross", "stretch", "children"]);
12
19
  return _Flex(false, { gap, main, cross, stretch, children }, p);
13
20
  }
14
- function Row({ gap = 1, main = "start", cross, stretch = false, children, ...p }) {
21
+ export function Row(_a) {
22
+ var { gap = 1, main = "start", cross, stretch = false, children } = _a, p = __rest(_a, ["gap", "main", "cross", "stretch", "children"]);
15
23
  return _Flex(true, { gap, main, cross, stretch, children }, p);
16
24
  }
17
25
  function _Flex(row, p, elbe) {
18
- return ((0, jsx_runtime_1.jsx)("div", { ...(0, box_1.applyProps)(elbe, row ? "row" : "column", {
19
- justifyContent: p.main,
20
- alignItems: p.cross || (p.stretch ? "stretch" : "center"),
21
- gap: `${p.gap}rem`,
22
- }), children: p.children }));
26
+ return (_jsx("div", Object.assign({}, applyProps(elbe, row ? "row" : "column", {
27
+ justifyContent: p.main,
28
+ alignItems: p.cross || (p.stretch ? "stretch" : "center"),
29
+ gap: `${p.gap}rem`,
30
+ }), { children: p.children })));
23
31
  }
@@ -1,7 +1,8 @@
1
+ import { JSX } from "preact/jsx-runtime";
1
2
  import { type ElbeColorSchemes } from "../../..";
2
3
  type HeaderParams = {
3
4
  title?: string;
4
- back: null | "close" | "back";
5
+ back: null | "close" | "back" | JSX.Element;
5
6
  actions?: any;
6
7
  limitedHeight?: number;
7
8
  };
@@ -12,7 +13,7 @@ type HeaderParams = {
12
13
  * @param title - The title of the page.
13
14
  * @param actions - The actions to show on the right side of the header.
14
15
  */
15
- export declare function Header({ back, title, actions, limitedHeight }: HeaderParams): import("preact").JSX.Element;
16
+ export declare function Header({ back, title, actions, limitedHeight }: HeaderParams): JSX.Element;
16
17
  /**
17
18
  * Scaffold is a layout component that provides a header and a content area.
18
19
  * It is used to create a consistent layout for pages.
@@ -23,5 +24,5 @@ export declare function Scaffold({ children, limited, gap, padded, scheme, ...he
23
24
  gap?: number;
24
25
  padded?: boolean;
25
26
  scheme?: ElbeColorSchemes;
26
- } & HeaderParams): import("preact").JSX.Element;
27
+ } & HeaderParams): JSX.Element;
27
28
  export {};
@@ -1,12 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Header = Header;
4
- exports.Scaffold = Scaffold;
5
- const jsx_runtime_1 = require("preact/jsx-runtime");
6
- const hooks_1 = require("preact/hooks");
7
- const __1 = require("../../..");
8
- const icon_button_1 = require("../button/icon_button");
9
- const flex_1 = require("./flex");
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
13
+ import { useEffect, useState } from "preact/hooks";
14
+ import { Icons, Text } from "../../..";
15
+ import { IconButton } from "../button/icon_button";
16
+ import { Column, Row } from "./flex";
10
17
  /**
11
18
  * Header is a layout component that provides a header for a page.
12
19
  * It is used to create a consistent header for pages.
@@ -14,31 +21,34 @@ const flex_1 = require("./flex");
14
21
  * @param title - The title of the page.
15
22
  * @param actions - The actions to show on the right side of the header.
16
23
  */
17
- function Header({ back, title, actions, limitedHeight }) {
24
+ export function Header({ back, title, actions, limitedHeight }) {
18
25
  if (history.length == 0)
19
26
  back = null;
20
27
  const goBack = () => history.go(-1);
21
- const [isScrolledTop, setIsScrolled] = (0, hooks_1.useState)(false);
22
- (0, hooks_1.useEffect)(() => {
28
+ const [isScrolled, setIsScrolled] = useState(false);
29
+ useEffect(() => {
23
30
  const _handle = () => setIsScrolled(window.scrollY > 0);
24
31
  window.addEventListener("scroll", _handle);
25
32
  return () => {
26
33
  window.removeEventListener("scroll", _handle);
27
34
  };
28
35
  }, []);
29
- return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { style: "height: 4.5rem" }), (0, jsx_runtime_1.jsxs)("div", { class: "header", style: {
30
- borderColor: isScrolledTop ? "" : "transparent",
36
+ return (_jsxs("div", { children: [_jsx("div", { style: "height: 4.5rem" }), _jsxs("div", { class: "header", style: {
37
+ borderColor: isScrolled
38
+ ? "color-mix(in srgb, var(--c-context-border) 40%, transparent)"
39
+ : "transparent",
31
40
  position: limitedHeight ? "absolute" : "fixed",
32
- }, children: [(0, jsx_runtime_1.jsx)("div", { class: "flex-1", children: back ? ((0, jsx_runtime_1.jsx)(icon_button_1.IconButton.plain, { icon: back === "back" ? __1.Icons.ArrowLeft : __1.Icons.X, onTap: goBack })) : null }), (0, jsx_runtime_1.jsx)(__1.Text.h4, { v: title }), (0, jsx_runtime_1.jsx)(flex_1.Row, { class: "flex-1", gap: 0.5, main: "end", children: actions })] })] }));
41
+ }, children: [_jsx("div", { class: "flex-1", children: back ? (typeof back !== "string" ? (back) : (_jsx(IconButton.plain, { icon: back === "back" ? Icons.ArrowLeft : Icons.X, onTap: goBack }))) : null }), _jsx(Text.h4, { v: title }), _jsx(Row, { class: "flex-1", gap: 0.5, main: "end", children: actions })] })] }));
33
42
  }
34
43
  /**
35
44
  * Scaffold is a layout component that provides a header and a content area.
36
45
  * It is used to create a consistent layout for pages.
37
46
  */
38
- function Scaffold({ children, limited = false, gap = 1, padded = true, scheme, ...header }) {
39
- return ((0, jsx_runtime_1.jsxs)(flex_1.Column, { cross: "stretch", gap: 0, class: `${scheme ?? "primary"}`, style: {
47
+ export function Scaffold(_a) {
48
+ var { children, limited = false, gap = 1, padded = true, scheme } = _a, header = __rest(_a, ["children", "limited", "gap", "padded", "scheme"]);
49
+ return (_jsxs(Column, { cross: "stretch", gap: 0, class: `${scheme !== null && scheme !== void 0 ? scheme : "primary"}`, style: {
40
50
  overflowY: header.limitedHeight ? "scroll" : null,
41
51
  maxHeight: header.limitedHeight ? `${header.limitedHeight}rem` : null,
42
52
  //height: header.limitToParent ? "100px" : null,
43
- }, children: [(0, jsx_runtime_1.jsx)(Header, { ...header }), (0, jsx_runtime_1.jsx)("div", { class: `${padded ? "padded" : ""} ${limited ? "base-limited" : ""}`, children: (0, jsx_runtime_1.jsx)(flex_1.Column, { cross: "stretch", gap: gap ?? 1, children: children }) })] }));
53
+ }, children: [_jsx(Header, Object.assign({}, header)), _jsx("div", { class: `${padded ? "padded" : ""} ${limited ? "base-limited" : ""}`, children: _jsx(Column, { cross: "stretch", gap: gap !== null && gap !== void 0 ? gap : 1, children: children }) })] }));
44
54
  }
@@ -1,20 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Scroll = void 0;
4
- const jsx_runtime_1 = require("preact/jsx-runtime");
5
- const preact_1 = require("preact");
6
- const box_1 = require("../base/box");
7
- class Scroll extends preact_1.Component {
1
+ import { jsx as _jsx } from "preact/jsx-runtime";
2
+ import { Component } from "preact";
3
+ import { applyProps } from "../base/box";
4
+ export class Scroll extends Component {
8
5
  constructor(props) {
9
6
  super(props);
10
7
  }
11
- static vertical = (p) => new Scroll({ ...p, axis: "vertical" }).render();
12
- static horizontal = (p) => new Scroll({ ...p, axis: "horizontal" }).render();
13
8
  render() {
14
- return ((0, jsx_runtime_1.jsx)("div", { ...(0, box_1.applyProps)(this.props, null, {
15
- overflowY: this.props.axis === "vertical" ? "scroll" : "hidden",
16
- overflowX: this.props.axis === "horizontal" ? "scroll" : "hidden",
17
- }), children: (0, jsx_runtime_1.jsx)("div", { class: this.props.innerClass, style: this.props.axis === "horizontal" ? "min-width: min-content;" : "", children: this.props.children }) }));
9
+ return (_jsx("div", Object.assign({}, applyProps(this.props, null, {
10
+ overflowY: this.props.axis === "vertical" ? "scroll" : "hidden",
11
+ overflowX: this.props.axis === "horizontal" ? "scroll" : "hidden",
12
+ }), { children: _jsx("div", { class: this.props.innerClass, style: this.props.axis === "horizontal" ? "min-width: min-content;" : "", children: this.props.children }) })));
18
13
  }
19
14
  }
20
- exports.Scroll = Scroll;
15
+ Scroll.vertical = (p) => new Scroll(Object.assign(Object.assign({}, p), { axis: "vertical" })).render();
16
+ Scroll.horizontal = (p) => new Scroll(Object.assign(Object.assign({}, p), { axis: "horizontal" })).render();
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Spaced = Spaced;
4
- const jsx_runtime_1 = require("preact/jsx-runtime");
5
- function Spaced({ amount = 1 }) {
6
- return (0, jsx_runtime_1.jsx)("div", { style: { width: amount + "rem", height: amount + "rem" } });
1
+ import { jsx as _jsx } from "preact/jsx-runtime";
2
+ export function Spaced({ amount = 1 }) {
3
+ return _jsx("div", { style: { width: amount + "rem", height: amount + "rem" } });
7
4
  }
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Spinner = void 0;
4
- const jsx_runtime_1 = require("preact/jsx-runtime");
5
- const signals_1 = require("@preact/signals");
6
- const preact_1 = require("preact");
7
- const hooks_1 = require("preact/hooks");
1
+ import { jsx as _jsx } from "preact/jsx-runtime";
2
+ import { useComputed, useSignal } from "@preact/signals";
3
+ import { Component } from "preact";
4
+ import { useEffect } from "preact/hooks";
8
5
  function _toPath(c, yFac, yOffset = 0, clamp = [0, 1], xFac = 1) {
9
6
  return c
10
7
  .filter((p) => p[0] >= clamp[0] && p[0] <= clamp[1])
@@ -14,19 +11,18 @@ function _toPath(c, yFac, yOffset = 0, clamp = [0, 1], xFac = 1) {
14
11
  (p[1] * yFac + yOffset).toFixed(2))
15
12
  .join(" ");
16
13
  }
17
- class Spinner extends preact_1.Component {
18
- static flat = (p) => new Spinner({ manner: "flat", ...p }).render();
19
- static plain = (p) => new Spinner({ manner: "plain", ...p }).render();
14
+ export class Spinner extends Component {
20
15
  render() {
21
- const flat = (this.props.manner ?? "flat") === "flat";
22
- const xSig = (0, signals_1.useSignal)(0);
23
- (0, hooks_1.useEffect)(() => {
16
+ var _a, _b;
17
+ const flat = ((_a = this.props.manner) !== null && _a !== void 0 ? _a : "flat") === "flat";
18
+ const xSig = useSignal(0);
19
+ useEffect(() => {
24
20
  const interval = setInterval(() => {
25
21
  xSig.value = (xSig.value + 2) % 100;
26
22
  }, 16);
27
23
  return () => clearInterval(interval);
28
24
  });
29
- const path = (0, signals_1.useComputed)(() => {
25
+ const path = useComputed(() => {
30
26
  const x = xSig.value;
31
27
  const path = [];
32
28
  for (let i = 0; i <= 1; i += 0.01) {
@@ -36,13 +32,14 @@ class Spinner extends preact_1.Component {
36
32
  }
37
33
  return path;
38
34
  });
39
- return ((0, jsx_runtime_1.jsx)("div", { class: `${flat ? "accent flat" : "plain"}`, style: {
40
- padding: `${this.props.padding ?? 1}rem`,
41
- }, children: (0, jsx_runtime_1.jsx)("svg", { style: "width: 40px; height: 40px", viewBox: `-10 -10 120 120`, children: [
35
+ return (_jsx("div", { class: `${flat ? "accent flat" : "plain"}`, style: {
36
+ padding: `${(_b = this.props.padding) !== null && _b !== void 0 ? _b : 1}rem`,
37
+ }, children: _jsx("svg", { style: "width: 40px; height: 40px", viewBox: `-10 -10 120 120`, children: [
42
38
  _toPath(path.value, 13, 20, [0.4, 0.8], 1),
43
39
  _toPath(path.value, 10, 50),
44
40
  _toPath(path.value, 11, 80, [0.2, 0.6], 1),
45
- ].map((p) => ((0, jsx_runtime_1.jsx)("path", { d: p, fill: "none", stroke: "currentcolor", "stroke-width": "10", "stroke-linecap": "round" }))) }) }));
41
+ ].map((p) => (_jsx("path", { d: p, fill: "none", stroke: "currentcolor", "stroke-width": "10", "stroke-linecap": "round" }))) }) }));
46
42
  }
47
43
  }
48
- exports.Spinner = Spinner;
44
+ Spinner.flat = (p) => new Spinner(Object.assign({ manner: "flat" }, p)).render();
45
+ Spinner.plain = (p) => new Spinner(Object.assign({ manner: "plain" }, p)).render();
@@ -1,42 +1,47 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
4
11
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Text = void 0;
7
- const jsx_runtime_1 = require("preact/jsx-runtime");
8
- const compat_1 = __importDefault(require("preact/compat"));
9
- const box_1 = require("./base/box");
10
- class Text extends compat_1.default.Component {
11
- static h1 = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "h1" });
12
- static h2 = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "h2" });
13
- static h3 = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "h3" });
14
- static h4 = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "h4" });
15
- static h5 = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "h5" });
16
- static h6 = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "h6" });
17
- static s = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "body-s" });
18
- static m = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "body-m" });
19
- static l = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "body-l" });
20
- static code = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "code" });
21
- constructor({ variant = "body-m", ...props }) {
22
- super({ ...props, variant });
12
+ import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
13
+ import React from "preact/compat";
14
+ import { applyProps } from "./base/box";
15
+ export class Text extends React.Component {
16
+ constructor(_a) {
17
+ var { variant = "body-m" } = _a, props = __rest(_a, ["variant"]);
18
+ super(Object.assign(Object.assign({}, props), { variant }));
23
19
  }
24
20
  render() {
25
- const { align, bold, italic, underline, striked, color, size, children, variant, v, ...elbe } = this.props;
26
- return ((0, jsx_runtime_1.jsxs)("span", { ...(0, box_1.applyProps)(elbe, [
27
- "text",
28
- align,
29
- bold && "b",
30
- italic && "i",
31
- underline && "underline",
32
- striked && "striked",
33
- color,
34
- variant,
35
- ], {
36
- fontSize: size ? `${size}rem` : "",
37
- color: color || "",
38
- scrollMarginTop: "2rem",
39
- }), children: [v, children] }));
21
+ const _a = this.props, { align, bold, italic, underline, striked, color, size, children, variant, v } = _a, elbe = __rest(_a, ["align", "bold", "italic", "underline", "striked", "color", "size", "children", "variant", "v"]);
22
+ return (_jsxs("span", Object.assign({}, applyProps(elbe, [
23
+ "text",
24
+ align,
25
+ bold && "b",
26
+ italic && "i",
27
+ underline && "underline",
28
+ striked && "striked",
29
+ color,
30
+ variant,
31
+ ], {
32
+ fontSize: size ? `${size}rem` : "",
33
+ color: color || "",
34
+ scrollMarginTop: "2rem",
35
+ }), { children: [v, children] })));
40
36
  }
41
37
  }
42
- exports.Text = Text;
38
+ Text.h1 = (p) => _jsx(Text, Object.assign({}, p, { variant: "h1" }));
39
+ Text.h2 = (p) => _jsx(Text, Object.assign({}, p, { variant: "h2" }));
40
+ Text.h3 = (p) => _jsx(Text, Object.assign({}, p, { variant: "h3" }));
41
+ Text.h4 = (p) => _jsx(Text, Object.assign({}, p, { variant: "h4" }));
42
+ Text.h5 = (p) => _jsx(Text, Object.assign({}, p, { variant: "h5" }));
43
+ Text.h6 = (p) => _jsx(Text, Object.assign({}, p, { variant: "h6" }));
44
+ Text.s = (p) => _jsx(Text, Object.assign({}, p, { variant: "body-s" }));
45
+ Text.m = (p) => _jsx(Text, Object.assign({}, p, { variant: "body-m" }));
46
+ Text.l = (p) => _jsx(Text, Object.assign({}, p, { variant: "body-l" }));
47
+ Text.code = (p) => _jsx(Text, Object.assign({}, p, { variant: "code" }));
@@ -1,31 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.colorThemePreset = colorThemePreset;
4
- const colors_1 = require("./colors");
5
- function colorThemePreset(merge) {
1
+ import { colors, LayerColor, } from "./colors";
2
+ export function colorThemePreset(merge) {
3
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
6
4
  const styleSel = (_, b, s) => {
7
5
  const bL = b.luminance;
8
6
  if (bL === 1)
9
7
  return s;
10
- return s.inter(colors_1.LayerColor.fromBack(bL > 0.5 ? colors_1.colors.black : colors_1.colors.white), 0.1);
8
+ return s.inter(LayerColor.fromBack(bL > 0.5 ? colors.black : colors.white), 0.1);
11
9
  };
12
- const seed = merge ?? {};
10
+ const seed = merge !== null && merge !== void 0 ? merge : {};
13
11
  return {
14
- base: seed.base ?? colors_1.LayerColor.fromBack(colors_1.colors.white),
15
- accent: seed.accent ?? colors_1.LayerColor.fromBack(colors_1.colors.blueAccent),
16
- info: seed.info ?? colors_1.LayerColor.fromBack(colors_1.colors.blue),
17
- success: seed.success ?? colors_1.LayerColor.fromBack(colors_1.colors.green),
18
- warning: seed.warning ?? colors_1.LayerColor.fromBack(colors_1.colors.yellow),
19
- error: seed.error ?? colors_1.LayerColor.fromBack(colors_1.colors.red),
12
+ base: (_a = seed.base) !== null && _a !== void 0 ? _a : LayerColor.fromBack(colors.white),
13
+ accent: (_b = seed.accent) !== null && _b !== void 0 ? _b : LayerColor.fromBack(colors.blueAccent),
14
+ info: (_c = seed.info) !== null && _c !== void 0 ? _c : LayerColor.fromBack(colors.blue),
15
+ success: (_d = seed.success) !== null && _d !== void 0 ? _d : LayerColor.fromBack(colors.green),
16
+ warning: (_e = seed.warning) !== null && _e !== void 0 ? _e : LayerColor.fromBack(colors.yellow),
17
+ error: (_f = seed.error) !== null && _f !== void 0 ? _f : LayerColor.fromBack(colors.red),
20
18
  mode: {
21
- light: seed.mode?.light ?? ((_, b) => b),
22
- dark: seed.mode?.dark ?? ((_, b) => b.mirrorBrightness()),
19
+ light: (_h = (_g = seed.mode) === null || _g === void 0 ? void 0 : _g.light) !== null && _h !== void 0 ? _h : ((_, b) => b),
20
+ dark: (_k = (_j = seed.mode) === null || _j === void 0 ? void 0 : _j.dark) !== null && _k !== void 0 ? _k : ((_, b) => b.mirrorBrightness()),
23
21
  },
24
22
  scheme: {
25
- primary: seed.scheme?.primary ?? ((_, b) => b),
26
- secondary: seed.scheme?.secondary ??
27
- ((c, b) => new colors_1.LayerColor(b.back.inter(c.accent.back, 0.1).desaturated(0.5), b.front, b.border)),
28
- inverse: seed.scheme?.inverse ?? ((_, b) => b.mirrorBrightness()),
23
+ primary: (_m = (_l = seed.scheme) === null || _l === void 0 ? void 0 : _l.primary) !== null && _m !== void 0 ? _m : ((_, b) => b),
24
+ secondary: (_p = (_o = seed.scheme) === null || _o === void 0 ? void 0 : _o.secondary) !== null && _p !== void 0 ? _p : ((c, b) => new LayerColor(b.back.inter(c.accent.back, 0.1).desaturated(0.5), b.front, b.border)),
25
+ inverse: (_r = (_q = seed.scheme) === null || _q === void 0 ? void 0 : _q.inverse) !== null && _r !== void 0 ? _r : ((_, b) => b.mirrorBrightness()),
29
26
  },
30
27
  style: {
31
28
  accent: styleSel,
@@ -35,29 +32,26 @@ function colorThemePreset(merge) {
35
32
  error: styleSel,
36
33
  },
37
34
  variant: {
38
- major: seed.variant?.major ??
39
- ((_, b, s) => colors_1.LayerColor.fromBack(s.back, { border: s.back })),
40
- minor: seed.variant?.minor ??
41
- ((_, b, s) => {
42
- const back = b.back;
43
- const backIn = back.mirrorBrightness();
44
- const major = s.back;
45
- const minor = s.back.inter(back, 0.8);
46
- const minorFront = minor.hasWCAGContrast(major) ? major : null;
47
- return new colors_1.LayerColor(s.back.withAlpha(0.25), minorFront ?? major.inter(backIn, 0.6), minorFront ?? major.inter(backIn, 0.3));
48
- }),
49
- flat: seed.variant?.flat ??
50
- ((_, b, s) => {
51
- //return new LayerColor(b.back, s?.back ?? b.front, b.front);
52
- //calculate front brightness
53
- const front = !s
54
- ? b.front
55
- : b.back.hasWCAGContrast(s?.back)
56
- ? s?.back
57
- : s?.back.inter(b.front, 0.6);
58
- return new colors_1.LayerColor(b.back, //.withAlpha(0),
59
- front, null, !s ? b.front.withAlpha(0.3) : b.front);
60
- }),
35
+ major: (_t = (_s = seed.variant) === null || _s === void 0 ? void 0 : _s.major) !== null && _t !== void 0 ? _t : ((_, __, s) => LayerColor.fromBack(s.back, { border: s.back })),
36
+ minor: (_v = (_u = seed.variant) === null || _u === void 0 ? void 0 : _u.minor) !== null && _v !== void 0 ? _v : ((_, b, s) => {
37
+ const back = b.back;
38
+ const backIn = back.mirrorBrightness();
39
+ const major = s.back;
40
+ const minor = s.back.inter(back, 0.8);
41
+ const minorFront = minor.hasWCAGContrast(major) ? major : null;
42
+ return new LayerColor(s.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));
43
+ }),
44
+ flat: (_x = (_w = seed.variant) === null || _w === void 0 ? void 0 : _w.flat) !== null && _x !== void 0 ? _x : ((_, b, s) => {
45
+ //return new LayerColor(b.back, s?.back ?? b.front, b.front);
46
+ //calculate front brightness
47
+ const front = !s
48
+ ? b.front
49
+ : b.back.hasWCAGContrast(s === null || s === void 0 ? void 0 : s.back)
50
+ ? s === null || s === void 0 ? void 0 : s.back
51
+ : s === null || s === void 0 ? void 0 : s.back.inter(b.front, 0.6);
52
+ return new LayerColor(b.back, //.withAlpha(0),
53
+ front, null, !s ? b.front.withAlpha(0.3) : b.front);
54
+ }),
61
55
  },
62
56
  };
63
57
  }