elbe-ui 0.4.27 → 1.0.3

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 (96) hide show
  1. package/README.md +1 -1
  2. package/dist/bit/_bit_provider.d.ts +1 -1
  3. package/dist/bit/_bit_provider.js +11 -6
  4. package/dist/bit/_bit_utils.d.ts +5 -1
  5. package/dist/bit/bit.d.ts +2 -2
  6. package/dist/bit/bit.js +1 -2
  7. package/dist/elbe.css +97 -61
  8. package/dist/elbe.css.map +1 -1
  9. package/dist/index.d.ts +1529 -1527
  10. package/dist/index.js +3 -2
  11. package/dist/ui/components/badge.d.ts +7 -7
  12. package/dist/ui/components/badge.js +3 -3
  13. package/dist/ui/components/banner.d.ts +2 -2
  14. package/dist/ui/components/banner.js +8 -8
  15. package/dist/ui/components/base/box.d.ts +28 -2550
  16. package/dist/ui/components/base/box.js +6 -3
  17. package/dist/ui/components/base/card.d.ts +1 -1
  18. package/dist/ui/components/base/card.js +1 -1
  19. package/dist/ui/components/base/padded.d.ts +4 -4
  20. package/dist/ui/components/base/padded.js +2 -2
  21. package/dist/ui/components/button/button.d.ts +10 -9
  22. package/dist/ui/components/button/button.js +15 -13
  23. package/dist/ui/components/button/choose_button.d.ts +2 -2
  24. package/dist/ui/components/button/choose_button.js +5 -4
  25. package/dist/ui/components/button/icon_button.d.ts +9 -8
  26. package/dist/ui/components/button/icon_button.js +16 -4
  27. package/dist/ui/components/button/toggle_button.d.ts +2 -2
  28. package/dist/ui/components/button/toggle_button.js +8 -4
  29. package/dist/ui/components/dev/todo.d.ts +4 -4
  30. package/dist/ui/components/dev/todo.js +2 -2
  31. package/dist/ui/components/dialog.d.ts +4 -3
  32. package/dist/ui/components/dialog.js +25 -4
  33. package/dist/ui/components/error_view.d.ts +2 -2
  34. package/dist/ui/components/error_view.js +12 -8
  35. package/dist/ui/components/footer.d.ts +3 -3
  36. package/dist/ui/components/footer.js +3 -3
  37. package/dist/ui/components/input/checkbox.d.ts +1 -1
  38. package/dist/ui/components/input/checkbox.js +5 -5
  39. package/dist/ui/components/input/range.d.ts +1 -1
  40. package/dist/ui/components/input/range.js +1 -1
  41. package/dist/ui/components/input/select.d.ts +1 -1
  42. package/dist/ui/components/input/select.js +2 -2
  43. package/dist/ui/components/input/switch.d.ts +1 -1
  44. package/dist/ui/components/input/switch.js +1 -1
  45. package/dist/ui/components/input/text/input_field.d.ts +9 -9
  46. package/dist/ui/components/input/text/input_field.js +7 -7
  47. package/dist/ui/components/input/text/multi_line.d.ts +1 -1
  48. package/dist/ui/components/input/text/multi_line.js +3 -3
  49. package/dist/ui/components/input/text/single_line.d.ts +1 -1
  50. package/dist/ui/components/input/text/single_line.js +4 -4
  51. package/dist/ui/components/layout/alignment.d.ts +3 -2
  52. package/dist/ui/components/layout/alignment.js +2 -2
  53. package/dist/ui/components/layout/app_base.d.ts +1 -1
  54. package/dist/ui/components/layout/app_base.js +33 -9
  55. package/dist/ui/components/layout/ctx_app_base.d.ts +8 -3
  56. package/dist/ui/components/layout/ctx_app_base.js +1 -2
  57. package/dist/ui/components/layout/flex.d.ts +3 -3
  58. package/dist/ui/components/layout/flex.js +5 -5
  59. package/dist/ui/components/layout/header.d.ts +5 -8
  60. package/dist/ui/components/layout/header.js +11 -13
  61. package/dist/ui/components/layout/menu.d.ts +1 -1
  62. package/dist/ui/components/layout/menu.js +6 -6
  63. package/dist/ui/components/layout/page.d.ts +3 -1
  64. package/dist/ui/components/layout/page.js +3 -1
  65. package/dist/ui/components/layout/scroll.d.ts +4 -4
  66. package/dist/ui/components/layout/scroll.js +3 -3
  67. package/dist/ui/components/layout/spaced.d.ts +1 -1
  68. package/dist/ui/components/layout/spaced.js +1 -1
  69. package/dist/ui/components/layout/toolbar.d.ts +2 -2
  70. package/dist/ui/components/layout/toolbar.js +4 -6
  71. package/dist/ui/components/link.d.ts +1 -1
  72. package/dist/ui/components/link.js +2 -2
  73. package/dist/ui/components/progress_bar.d.ts +1 -1
  74. package/dist/ui/components/progress_bar.js +1 -1
  75. package/dist/ui/components/routing/route.d.ts +8 -8
  76. package/dist/ui/components/routing/route.js +4 -4
  77. package/dist/ui/components/spinner.d.ts +4 -4
  78. package/dist/ui/components/spinner.js +33 -33
  79. package/dist/ui/components/text.d.ts +15 -15
  80. package/dist/ui/components/text.js +6 -6
  81. package/dist/ui/theme/colors.js +0 -1
  82. package/dist/ui/theme/theme.d.ts +1 -1
  83. package/dist/ui/theme/theme.js +5 -3
  84. package/dist/ui/theme/theme_context.d.ts +2 -2
  85. package/dist/ui/theme/theme_context.js +1 -2
  86. package/dist/ui/util/ctx_toolbar.d.ts +1 -2
  87. package/dist/ui/util/ctx_toolbar.js +2 -2
  88. package/dist/ui/util/error_view.d.ts +1 -1
  89. package/dist/ui/util/error_view.js +8 -2
  90. package/dist/ui/util/l10n/_l10n_util.d.ts +1 -1
  91. package/dist/ui/util/l10n/_l10n_util.js +1 -1
  92. package/dist/ui/util/l10n/l10n.d.ts +1 -1
  93. package/dist/ui/util/l10n/l10n.js +2 -2
  94. package/dist/ui/util/types.d.ts +3 -2
  95. package/dist/ui/util/util.js +1 -2
  96. package/package.json +6 -8
@@ -9,8 +9,8 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
13
- import React from "preact/compat";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import React from "react";
14
14
  import { KindAlertIcon, Text } from "../../../..";
15
15
  import { randomAlphaNum } from "../../../util/util";
16
16
  import { applyProps } from "../../base/box";
@@ -38,14 +38,14 @@ export class Field extends React.Component {
38
38
  ? this.props.flex === true
39
39
  ? 1
40
40
  : this.props.flex
41
- : null,
42
- width: this.props.flex ? null : ((_b = this.props.width) !== null && _b !== void 0 ? _b : 12) + "rem",
41
+ : undefined,
42
+ width: this.props.flex ? undefined : ((_b = this.props.width) !== null && _b !== void 0 ? _b : 12) + "rem",
43
43
  display: "flex",
44
44
  flexDirection: "column",
45
45
  alignItems: "stretch",
46
- filter: this.props.onInput ? null : "grayscale(1) opacity(0.5)",
47
- pointerEvents: this.props.onInput ? null : "none",
48
- cursor: this.props.onInput ? null : "not-allowed",
46
+ filter: this.props.onInput ? undefined : "grayscale(1) opacity(0.5)",
47
+ pointerEvents: this.props.onInput ? undefined : "none",
48
+ cursor: this.props.onInput ? undefined : "not-allowed",
49
49
  }, "data-tooltip": (_c = this.props) === null || _c === void 0 ? void 0 : _c.tooltip, children: [_jsx("label", { htmlFor: id, style: {
50
50
  display: this.props.hideLabel ? "none" : "block",
51
51
  fontSize: "0.8rem",
@@ -7,4 +7,4 @@ export interface MLInputFieldProps extends InputFieldProps {
7
7
  export declare function _MultiLineField(p: {
8
8
  props: MLInputFieldProps;
9
9
  id: string;
10
- }): import("preact").JSX.Element;
10
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "preact/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { applyProps } from "../../base/box";
3
3
  export function _MultiLineField(p) {
4
4
  var _a, _b;
@@ -10,10 +10,10 @@ export function _MultiLineField(p) {
10
10
  padding: "1rem",
11
11
  margin: "0 0",
12
12
  resize: p.props.notResizable ? "none" : "vertical",
13
- }), { size: 5, cols: 5, placeholder: p.props.hint, rows: (_b = p.props.rows) !== null && _b !== void 0 ? _b : 5, maxLength: p.props.maxLength, value: p.props.value, onInput: (e) => {
13
+ }), { cols: 5, placeholder: p.props.hint, rows: (_b = p.props.rows) !== null && _b !== void 0 ? _b : 5, maxLength: p.props.maxLength, value: p.props.value, onInput: (e) => {
14
14
  var _a, _b;
15
15
  e.stopPropagation();
16
16
  e.preventDefault();
17
17
  (_b = (_a = p.props).onInput) === null || _b === void 0 ? void 0 : _b.call(_a, e.currentTarget.value);
18
- }, readonly: p.props.onInput ? false : true })));
18
+ }, readOnly: p.props.onInput ? false : true })));
19
19
  }
@@ -14,5 +14,5 @@ export declare function _SingleLineField(p: {
14
14
  msg: _InputMsg | null;
15
15
  type: string;
16
16
  id: string;
17
- }): import("preact").JSX.Element;
17
+ }): import("react/jsx-runtime").JSX.Element;
18
18
  export {};
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { applyProps, Card, IconButton, Row, Spaced, } from "../../../..";
3
3
  export function _SingleLineField(p) {
4
4
  var _a, _b, _c;
@@ -9,17 +9,17 @@ export function _SingleLineField(p) {
9
9
  border: "none",
10
10
  outline: "none",
11
11
  background: "none",
12
- }), { size: 5, label: p.props.label, placeholder: p.props.hint, value: p.props.value, onInput: (e) => p.props.onInput && p.props.onInput(e.currentTarget.value), readonly: p.props.onInput ? false : true })), _jsx(_Supplement, { kind: (_c = p.msg) === null || _c === void 0 ? void 0 : _c.kind, trailing: true, icon: p.props.trailing, onTap: p.props.onTrailingTap })] }));
12
+ }), { size: 5, placeholder: p.props.hint, value: p.props.value, onInput: (e) => p.props.onInput && p.props.onInput(e.currentTarget.value), readOnly: p.props.onInput ? false : true })), _jsx(_Supplement, { kind: (_c = p.msg) === null || _c === void 0 ? void 0 : _c.kind, trailing: true, icon: p.props.trailing, onTap: p.props.onTrailingTap })] }));
13
13
  }
14
14
  function _Supplement(p) {
15
15
  if (!p.icon)
16
16
  return _jsx(Spaced, { width: 0.75 });
17
17
  return (_jsx(Card, { sharp: true, padding: 0, style: {
18
18
  border: "none",
19
- background: p.onTap ? null : "transparent",
19
+ background: p.onTap ? undefined : "transparent",
20
20
  }, children: _jsx(IconButton, { kind: p.kind, manner: p.kind ? "minor" : "plain", ariaLabel: p.trailing ? "trailing icon" : "leading icon", icon: p.icon, style: {
21
21
  borderRadius: 0,
22
- background: p.onTap ? null : "transparent",
22
+ background: p.onTap ? undefined : "transparent",
23
23
  }, onTap: (e) => {
24
24
  var _a;
25
25
  e.stopPropagation();
@@ -1,3 +1,4 @@
1
+ import { ElbeChildren } from "../../util/types";
1
2
  export type Alignment = "start_start" | "start_center" | "start_end" | "center_start" | "center" | "center_end" | "end_start" | "end_center" | "end_end";
2
3
  export declare function Align({ alignment, height, width, size, class: className, children, }: {
3
4
  alignment?: Alignment;
@@ -5,5 +6,5 @@ export declare function Align({ alignment, height, width, size, class: className
5
6
  width?: string | number;
6
7
  size?: string | number;
7
8
  class?: string;
8
- children: React.ReactNode;
9
- }): import("preact").JSX.Element;
9
+ children: ElbeChildren;
10
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "preact/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Column } from "./flex";
3
3
  export function Align({ alignment = "center", height, width, size, class: className, children, }) {
4
4
  var _a, _b;
@@ -9,5 +9,5 @@ export function Align({ alignment = "center", height, width, size, class: classN
9
9
  width = `${width}rem`;
10
10
  if (typeof size === "number")
11
11
  size = `${size}rem`;
12
- return (_jsx(Column, { class: className, cross: (_a = cross) !== null && _a !== void 0 ? _a : "center", style: { height: height !== null && height !== void 0 ? height : size, width: width !== null && width !== void 0 ? width : size }, main: (_b = main) !== null && _b !== void 0 ? _b : "center", children: children }));
12
+ return (_jsx(Column, { className: className, cross: (_a = cross) !== null && _a !== void 0 ? _a : "center", style: { height: height !== null && height !== void 0 ? height : size, width: width !== null && width !== void 0 ? width : size }, main: (_b = main) !== null && _b !== void 0 ? _b : "center", children: children }));
13
13
  }
@@ -12,4 +12,4 @@ export type AppBaseProps = HeaderLogos & {
12
12
  *
13
13
  * Provide `wouter.Route` or `MenuRoute` components as children to define the routes and menu items.
14
14
  */
15
- export declare function AppBase(p: AppBaseProps): import("preact/compat").JSX.Element;
15
+ export declare function AppBase(p: AppBaseProps): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,6 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
2
- import { useMemo, useState } from "preact/compat";
3
- import { Router } from "wouter";
4
- import { useHashLocation } from "wouter/use-hash-location";
5
- import { Box, isMenuRoute, wouter, } from "../../..";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo, useState } from "react";
3
+ import { Box, isMenuRoute, Wouter, } from "../../..";
6
4
  import { AppBaseContext } from "./ctx_app_base";
7
5
  import { Menu } from "./menu";
8
6
  /**
@@ -14,7 +12,10 @@ import { Menu } from "./menu";
14
12
  * Provide `wouter.Route` or `MenuRoute` components as children to define the routes and menu items.
15
13
  */
16
14
  export function AppBase(p) {
17
- return (_jsx(Router, { hook: p.hashBasedRouting ? useHashLocation : undefined, children: _jsx(_AppBase, Object.assign({}, 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);
18
19
  }
19
20
  function _AppBase(p) {
20
21
  var _a;
@@ -22,7 +23,8 @@ function _AppBase(p) {
22
23
  const menuItems = useMemo(() => {
23
24
  return _extractMenuItems(p.children);
24
25
  }, [p.children]);
25
- const [location, navigate] = wouter.useLocation();
26
+ const [location, navigate] = Wouter.useLocation();
27
+ const [history, setHistory] = useState([_initialLocation()]);
26
28
  return (_jsx(AppBaseContext.Provider, { value: {
27
29
  menuOpen: menuOpen,
28
30
  icons: {
@@ -33,12 +35,34 @@ function _AppBase(p) {
33
35
  },
34
36
  globalActions: (_a = p.globalActions) !== null && _a !== void 0 ? _a : [],
35
37
  setMenuOpen: (b) => setMenuOpen(b),
36
- go: (p, replace) => navigate(p, { replace: replace !== null && replace !== void 0 ? replace : false }),
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
+ },
37
61
  }, children: _jsxs(Box, { typeLabel: "app_base", scheme: "primary", style: {
38
62
  display: "flex",
39
63
  width: "100%",
40
64
  minHeight: "100vh",
41
- }, children: [menuItems.length > 0 && _jsx(Menu, { items: menuItems }), _jsx("div", { style: { flex: 1, width: "0px" }, children: _jsx(wouter.Switch, { children: p.children }) })] }) }));
65
+ }, children: [menuItems.length > 0 && _jsx(Menu, { items: menuItems }), _jsx("div", { style: { flex: 1, width: "0px" }, children: _jsx(Wouter.Switch, { children: p.children }) })] }) }));
42
66
  }
43
67
  function _extractMenuItems(children) {
44
68
  const childs = Array.isArray(children) ? children : [children];
@@ -1,14 +1,19 @@
1
- import { ElbeChild } from "../../util/types";
1
+ import { ElbeChild, int } from "../../util/types";
2
2
  import { HeaderLogos } from "./header";
3
3
  export interface _AppBaseState {
4
4
  menuOpen: boolean;
5
5
  icons: HeaderLogos;
6
6
  globalActions: ElbeChild[];
7
- go: (path: string, replace?: boolean) => void;
7
+ router: {
8
+ go: (path: string, replace?: int | "all") => void;
9
+ goBack: (steps?: number) => void;
10
+ history: string[];
11
+ location: string;
12
+ };
8
13
  }
9
14
  export interface _AppBaseControl extends _AppBaseState {
10
15
  setMenuOpen: (open: boolean) => void;
11
16
  }
12
- export declare const AppBaseContext: import("preact").Context<_AppBaseControl | null>;
17
+ export declare const AppBaseContext: import("react").Context<_AppBaseControl | null>;
13
18
  export declare function useAppBase(): _AppBaseControl;
14
19
  export declare function maybeAppBase(): _AppBaseControl | null;
@@ -1,5 +1,4 @@
1
- import { createContext } from "preact";
2
- import { useContext } from "preact/hooks";
1
+ import { createContext, useContext } from "react";
3
2
  export const AppBaseContext = createContext(null);
4
3
  export function useAppBase() {
5
4
  const ctx = useContext(AppBaseContext);
@@ -7,8 +7,8 @@ export type FlexProps = {
7
7
  main?: "start" | "center" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly";
8
8
  cross?: "start" | "center" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly";
9
9
  } & ElbeProps;
10
- export declare function FlexSpace({}: {}): import("preact").JSX.Element;
11
- export declare function Column({ gap, main, cross, children, noScrollbar, scroll, ...p }: FlexProps): import("preact").JSX.Element;
10
+ export declare function FlexSpace({}: {}): import("react/jsx-runtime").JSX.Element;
11
+ export declare function Column({ gap, main, cross, children, noScrollbar, scroll, ...p }: FlexProps): import("react/jsx-runtime").JSX.Element;
12
12
  export declare function Row({ gap, main, cross, wrap, children, noScrollbar, scroll, ...p }: FlexProps & {
13
13
  wrap?: boolean;
14
- }): import("preact").JSX.Element;
14
+ }): import("react/jsx-runtime").JSX.Element;
@@ -9,10 +9,10 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { jsx as _jsx } from "preact/jsx-runtime";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { applyProps } from "../base/box";
14
14
  export function FlexSpace({}) {
15
- return _jsx("div", { style: "flex:1" });
15
+ return _jsx("div", { style: { flex: 1 } });
16
16
  }
17
17
  export function Column(_a) {
18
18
  var { gap = 1, main = "start", cross = "stretch", children, noScrollbar = false, scroll = false } = _a, p = __rest(_a, ["gap", "main", "cross", "children", "noScrollbar", "scroll"]);
@@ -32,8 +32,8 @@ function _Flex(row, p, elbe, wraps) {
32
32
  justifyContent: p.main,
33
33
  alignItems: p.cross,
34
34
  gap: `${p.gap}rem`,
35
- overflowX: !row ? null : p.scroll ? "auto" : null,
36
- overflowY: row ? null : p.scroll ? "auto" : null,
37
- flex: ((_a = p.flex) !== null && _a !== void 0 ? _a : p.scroll) ? 1 : null,
35
+ overflowX: !row ? undefined : p.scroll ? "auto" : undefined,
36
+ overflowY: row ? undefined : p.scroll ? "auto" : undefined,
37
+ flex: ((_a = p.flex) !== null && _a !== void 0 ? _a : p.scroll) ? 1 : undefined,
38
38
  }), { children: p.children })));
39
39
  }
@@ -12,21 +12,18 @@ export type HeaderProps = HeaderLogos & {
12
12
  actions?: ElbeChild[];
13
13
  scheme?: ElbeColorSchemes;
14
14
  };
15
- export declare function Header(p: HeaderProps): import("preact").JSX.Element;
15
+ export declare function Header(p: HeaderProps): import("react/jsx-runtime").JSX.Element;
16
16
  export declare function _Logo(p: {
17
17
  flex?: boolean;
18
18
  logo: string | ElbeChild;
19
19
  logoDark?: string | ElbeChild | null;
20
20
  lMargin?: number;
21
21
  rMargin?: number;
22
- }): import("preact").JSX.Element | null;
22
+ }): import("react/jsx-runtime").JSX.Element | null;
23
23
  export declare function BackButton(p: {
24
- onTap: () => void;
25
- }): import("preact").JSX.Element;
26
- export declare function CloseButton(p: {
27
- onTap: () => void;
28
- }): import("preact").JSX.Element;
24
+ close?: boolean;
25
+ }): import("react/jsx-runtime").JSX.Element | null;
29
26
  export declare function _HeaderTitle(p: {
30
27
  title: string | ElbeChild;
31
28
  center: boolean;
32
- }): import("preact").JSX.Element;
29
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,9 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ChevronLeft, MenuIcon, XIcon } from "lucide-react";
3
- import { useEffect, useMemo, useState } from "preact/hooks";
3
+ import { useMemo, useState } from "react";
4
4
  import { Card, IconButton, Text, useLayoutMode, useSiteScroll, useTheme, useThemeConfig, } from "../../..";
5
5
  import { maybeAppBase } from "./ctx_app_base";
6
6
  import { _Toolbar } from "./toolbar";
7
- const _backBtn = _jsx(BackButton, { onTap: () => history.go(-1) });
8
- const _closeBtn = _jsx(CloseButton, { onTap: () => history.go(-1) });
9
7
  export function Header(p) {
10
8
  var _a, _b, _c, _d, _e, _f, _g, _h;
11
9
  const appBase = maybeAppBase();
@@ -25,21 +23,21 @@ export function Header(p) {
25
23
  borderTop: "none",
26
24
  borderLeft: "none",
27
25
  borderRight: "none",
28
- borderColor: tConfig.highVis || scroll ? null : "transparent",
26
+ borderColor: tConfig.highVis || scroll ? undefined : "transparent",
29
27
  gap: "1rem",
30
28
  zIndex: 80,
31
29
  }, children: [p.leading && p.leading !== "back" && p.leading !== "close"
32
30
  ? p.leading
33
31
  : appBase &&
34
- !layoutMode.isWide && (_jsx(IconButton.plain, { ariaLabel: "open/close menu", onTap: () => appBase.setMenuOpen(!appBase.menuOpen), icon: MenuIcon })), p.leading === "back" && _backBtn, p.leading === "close" && _closeBtn, !layoutMode.isMobile && (_jsx(_Logo, { logo: (_b = p.logo) !== null && _b !== void 0 ? _b : appBase === null || appBase === void 0 ? void 0 : appBase.icons.logo, logoDark: (_c = p.logoDark) !== null && _c !== void 0 ? _c : appBase === null || appBase === void 0 ? void 0 : appBase.icons.logoDark, lMargin: 0.5 })), (!appBase || layoutMode.isWide) && (_jsx("div", { style: { margin: "-1rem", width: "1.5rem" } })), _jsx(_HeaderTitle, { title: p.title, center: (_d = p.centerTitle) !== null && _d !== void 0 ? _d : false }), _jsx(_Toolbar, { actions: [...((_e = p.actions) !== null && _e !== void 0 ? _e : []), ...((_f = appBase === null || appBase === void 0 ? void 0 : appBase.globalActions) !== null && _f !== void 0 ? _f : [])] }), layoutMode.isWide && (_jsx(_Logo, { logo: (_g = p.endLogo) !== null && _g !== void 0 ? _g : appBase === null || appBase === void 0 ? void 0 : appBase.icons.endLogo, logoDark: (_h = p.endLogoDark) !== null && _h !== void 0 ? _h : appBase === null || appBase === void 0 ? void 0 : appBase.icons.endLogoDark, rMargin: 0.5 }))] }));
32
+ !layoutMode.isWide && (_jsx(IconButton.plain, { ariaLabel: "open/close menu", onTap: () => appBase.setMenuOpen(!appBase.menuOpen), icon: MenuIcon })), p.leading === "back" && _jsx(BackButton, {}), p.leading === "close" && _jsx(BackButton, { close: true }), !layoutMode.isMobile && (_jsx(_Logo, { logo: (_b = p.logo) !== null && _b !== void 0 ? _b : appBase === null || appBase === void 0 ? void 0 : appBase.icons.logo, logoDark: (_c = p.logoDark) !== null && _c !== void 0 ? _c : appBase === null || appBase === void 0 ? void 0 : appBase.icons.logoDark, lMargin: 0.5 })), (!appBase || layoutMode.isWide) && (_jsx("div", { style: { margin: "-1rem", width: "1.5rem" } })), _jsx(_HeaderTitle, { title: p.title, center: (_d = p.centerTitle) !== null && _d !== void 0 ? _d : false }), _jsx(_Toolbar, { actions: [...((_e = p.actions) !== null && _e !== void 0 ? _e : []), ...((_f = appBase === null || appBase === void 0 ? void 0 : appBase.globalActions) !== null && _f !== void 0 ? _f : [])] }), layoutMode.isWide && (_jsx(_Logo, { logo: (_g = p.endLogo) !== null && _g !== void 0 ? _g : appBase === null || appBase === void 0 ? void 0 : appBase.icons.endLogo, logoDark: (_h = p.endLogoDark) !== null && _h !== void 0 ? _h : appBase === null || appBase === void 0 ? void 0 : appBase.icons.endLogoDark, rMargin: 0.5 }))] }));
35
33
  }
36
34
  export function _Logo(p) {
37
35
  var _a, _b;
38
36
  const tConfig = useThemeConfig();
39
37
  const [logo, setLogo] = useState(p.logo);
40
- useEffect(() => { var _a; return setLogo(tConfig.dark ? (_a = p.logoDark) !== null && _a !== void 0 ? _a : p.logo : p.logo); }, [tConfig]);
38
+ useMemo(() => { var _a; return setLogo(tConfig.dark ? (_a = p.logoDark) !== null && _a !== void 0 ? _a : p.logo : p.logo); }, [tConfig]);
41
39
  return !logo ? null : (_jsx("div", { style: {
42
- flex: p.flex ? 1 : null,
40
+ flex: p.flex ? 1 : undefined,
43
41
  display: "flex",
44
42
  alignItems: "center",
45
43
  justifyContent: "center",
@@ -47,13 +45,13 @@ export function _Logo(p) {
47
45
  marginRight: `${(_b = p.rMargin) !== null && _b !== void 0 ? _b : 0}rem`,
48
46
  }, children: typeof logo === "string" ? (_jsx("img", { src: logo, style: {
49
47
  height: "1.25rem",
50
- } })) : (p.logo) }));
48
+ } })) : (logo) }));
51
49
  }
52
50
  export function BackButton(p) {
53
- return (_jsx(IconButton.plain, { ariaLabel: "go back", onTap: p.onTap, icon: ChevronLeft }));
54
- }
55
- export function CloseButton(p) {
56
- return _jsx(IconButton.plain, { ariaLabel: "close", onTap: p.onTap, icon: XIcon });
51
+ var _a, _b;
52
+ const appBase = maybeAppBase();
53
+ const hidden = ((_b = (_a = appBase === null || appBase === void 0 ? void 0 : appBase.router.history) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) < 2;
54
+ return hidden ? null : (_jsx(IconButton.plain, { ariaLabel: p.close ? "close" : "go back", onTap: () => appBase === null || appBase === void 0 ? void 0 : appBase.router.goBack(), icon: p.close ? XIcon : ChevronLeft }, "hello-back"));
57
55
  }
58
56
  export function _HeaderTitle(p) {
59
57
  const layoutMode = useLayoutMode();
@@ -1,4 +1,4 @@
1
1
  import { MenuItem } from "../../..";
2
2
  export declare function Menu(p: {
3
3
  items: MenuItem[];
4
- }): import("preact").JSX.Element;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,5 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "preact/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { MenuIcon } from "lucide-react";
3
- import { useLocation } from "wouter";
4
3
  import { _Logo, useLayoutMode, useTheme, useThemeConfig, } from "../../..";
5
4
  import { Card, elevatedShadow } from "../base/card";
6
5
  import { Button } from "../button/button";
@@ -42,7 +41,7 @@ export function Menu(p) {
42
41
  appBase.setMenuOpen(false);
43
42
  }, sharp: layoutMode.isMobile, bordered: true, scheme: "primary", padding: wideOrOpen() ? 0.5 : 0, style: Object.assign({ zIndex: 101, position: "fixed", left: 0, top: 0, height: "100vh", overflow: "hidden", width: menuWidth(), display: "flex",
44
43
  //display: appBase.menuOpen || layoutMode == "wide" ? "flex" : "none",
45
- flexDirection: "column", justifyContent: "start", alignItems: "stretch", borderTopLeftRadius: 0, borderBottomLeftRadius: 0, borderLeft: "none", borderTop: "none", borderBottom: "none", borderColor: tConfig.highVis ? null : "transparent", gap: "1rem", transition: tConfig.reducedMotion
44
+ flexDirection: "column", justifyContent: "start", alignItems: "stretch", borderTopLeftRadius: 0, borderBottomLeftRadius: 0, borderLeft: "none", borderTop: "none", borderBottom: "none", borderColor: tConfig.highVis ? undefined : "transparent", gap: "1rem", transition: tConfig.reducedMotion
46
45
  ? "none"
47
46
  : "width 200ms ease-in-out" }, (layoutMode.isNarrow && appBase.menuOpen
48
47
  ? {
@@ -54,9 +53,10 @@ export function Menu(p) {
54
53
  }, children: !layoutMode.isWide && (_jsx(_Logo, { logo: appBase === null || appBase === void 0 ? void 0 : appBase.icons.logo, logoDark: appBase === null || appBase === void 0 ? void 0 : appBase.icons.logoDark, lMargin: 0.5 })) }), _jsx(Column, { flex: 1, scroll: true, noScrollbar: true, children: topBot.top.map((i) => (_jsx(_MenuItemView, { item: i }))) }), topBot.bottom.map((i) => (_jsx(_MenuItemView, { item: i })))] })) })] }));
55
54
  }
56
55
  function _MenuItemView({ item }) {
57
- const [location, navigate] = useLocation();
58
56
  const appBase = useAppBase();
59
- return (_jsx(Button, { ariaLabel: item.label, contentAlign: "start", manner: (item.path === "/" ? location === "/" : location.startsWith(item.path))
57
+ return (_jsx(Button, { ariaLabel: item.label, contentAlign: "start", manner: (item.path === "/"
58
+ ? appBase.router.location === "/"
59
+ : appBase.router.location.startsWith(item.path))
60
60
  ? "major"
61
- : "plain", label: appBase.menuOpen ? item.label : undefined, icon: item.icon, onTap: item.disabled ? undefined : () => navigate(item.path) }));
61
+ : "plain", label: appBase.menuOpen ? item.label : undefined, icon: item.icon, onTap: item.disabled ? undefined : () => appBase.router.go(item.path, "all") }));
62
62
  }
@@ -14,9 +14,11 @@ type ContentBaseProps = {
14
14
  * ### Properties:
15
15
  * - `narrow` will limit the width of the content to `900px`, and center it.
16
16
  * - `padding` will add padding around the content, defaulting to `1rem`.
17
+ * - `leading` can be used to add a back or close button to the header. Setting it
18
+ * "back" or "close" will automatically show the button if there is history to go back to.
17
19
  */
18
20
  export declare function Page(p: HeaderProps & ContentBaseProps & {
19
21
  children?: ElbeChildren;
20
22
  footer?: ElbeChild;
21
- }): import("preact").JSX.Element;
23
+ }): import("react/jsx-runtime").JSX.Element;
22
24
  export {};
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Column } from "../../..";
3
3
  import { Box } from "../base/box";
4
4
  import { Header } from "./header";
@@ -13,6 +13,8 @@ function _hasMoreThan(p, expected) {
13
13
  * ### Properties:
14
14
  * - `narrow` will limit the width of the content to `900px`, and center it.
15
15
  * - `padding` will add padding around the content, defaulting to `1rem`.
16
+ * - `leading` can be used to add a back or close button to the header. Setting it
17
+ * "back" or "close" will automatically show the button if there is history to go back to.
16
18
  */
17
19
  export function Page(p) {
18
20
  var _a;
@@ -1,4 +1,4 @@
1
- import { Component } from "preact";
1
+ import { Component } from "react";
2
2
  import { type ElbeProps } from "../base/box";
3
3
  export type ScrollProps = ElbeProps & {
4
4
  innerClass?: string;
@@ -11,8 +11,8 @@ type _ScrollProps = ScrollProps & {
11
11
  };
12
12
  export declare class Scroll extends Component<_ScrollProps> {
13
13
  constructor(props: _ScrollProps);
14
- static vertical: (p: ScrollProps) => import("preact").JSX.Element;
15
- static horizontal: (p: ScrollProps) => import("preact").JSX.Element;
16
- render(): import("preact").JSX.Element;
14
+ static vertical: (p: ScrollProps) => import("react/jsx-runtime").JSX.Element;
15
+ static horizontal: (p: ScrollProps) => import("react/jsx-runtime").JSX.Element;
16
+ render(): import("react/jsx-runtime").JSX.Element;
17
17
  }
18
18
  export {};
@@ -1,5 +1,5 @@
1
- import { jsx as _jsx } from "preact/jsx-runtime";
2
- import { Component } from "preact";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Component } from "react";
3
3
  import { applyProps } from "../base/box";
4
4
  export class Scroll extends Component {
5
5
  constructor(props) {
@@ -9,7 +9,7 @@ export class Scroll extends Component {
9
9
  return (_jsx("div", Object.assign({}, applyProps("scroll", this.props, null, {
10
10
  overflowY: this.props.axis === "vertical" ? "scroll" : "hidden",
11
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 }) })));
12
+ }), { children: _jsx("div", { className: this.props.innerClass, style: this.props.axis === "horizontal" ? { minWidth: "min-content" } : {}, children: this.props.children }) })));
13
13
  }
14
14
  }
15
15
  Scroll.vertical = (p) => new Scroll(Object.assign(Object.assign({}, p), { axis: "vertical" })).render();
@@ -2,4 +2,4 @@ export declare function Spaced({ width, height, amount, }: {
2
2
  amount?: number;
3
3
  width?: number;
4
4
  height?: number;
5
- }): import("preact").JSX.Element;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "preact/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  export function Spaced({ width, height, amount = 1, }) {
3
3
  const fromWH = !!(width || height);
4
4
  return (_jsx("div", { style: {
@@ -1,7 +1,7 @@
1
1
  import { ElbeChild } from "../../..";
2
2
  export declare function _Toolbar(p: {
3
3
  actions: ElbeChild[];
4
- }): import("preact").JSX.Element;
4
+ }): import("react/jsx-runtime").JSX.Element;
5
5
  export declare function OverflowMenu(p: {
6
6
  items: ElbeChild[];
7
- }): import("preact").JSX.Element | null;
7
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -1,16 +1,14 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { MoreVertical } from "lucide-react";
3
- import { useEffect, useState } from "preact/hooks";
3
+ import { useMemo, useState } from "react";
4
4
  import { Card, elevatedShadow, IconButton, ToolbarContext, useLayoutMode, useThemeConfig, } from "../../..";
5
- import { maybeAppBase } from "./ctx_app_base";
6
5
  export function _Toolbar(p) {
7
6
  const [sections, setSections] = useState([
8
7
  [],
9
8
  [],
10
9
  ]);
11
- const appBase = maybeAppBase();
12
10
  const layoutMode = useLayoutMode();
13
- useEffect(() => {
11
+ useMemo(() => {
14
12
  const cutoff = layoutMode.isWide ? 5 : layoutMode.screenWidth < 400 ? 1 : 2;
15
13
  const bar = [];
16
14
  const overflow = [];
@@ -54,7 +52,7 @@ export function OverflowMenu(p) {
54
52
  transform: open ? "scale(1)" : "scale(.6)",
55
53
  opacity: open ? 1 : 0,
56
54
  transition: tConfig.reducedMotion
57
- ? null
55
+ ? undefined
58
56
  : "transform 200ms ease-in-out, opacity 200ms ease-in-out",
59
57
  }, children: open && (_jsx(ToolbarContext.Provider, { value: "overflow", children: _jsx(Card, { onTap: () => setOpen(false), scheme: "primary", elevated: true, style: {
60
58
  display: "flex",
@@ -7,4 +7,4 @@ export declare function Link(p: {
7
7
  noIcon?: boolean;
8
8
  underline?: boolean;
9
9
  color?: string;
10
- }): import("preact").JSX.Element;
10
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ExternalLinkIcon } from "lucide-react";
3
3
  export function Link(p) {
4
- return (_jsxs("a", { class: p.plain ? "plain" : "accent action", href: p.href, target: p.external ? "_blank" : undefined, rel: p.external ? "noopener noreferrer" : undefined, style: {
4
+ return (_jsxs("a", { className: p.plain ? "plain" : "accent action", href: p.href, target: p.external ? "_blank" : undefined, rel: p.external ? "noopener noreferrer" : undefined, style: {
5
5
  color: p.color,
6
6
  display: "inline-flex",
7
7
  textDecoration: p.underline ? "underline" : "none",
@@ -3,4 +3,4 @@ export declare function ProgressBar({ value, max, plain, ...elbe }: {
3
3
  value: number;
4
4
  max?: number;
5
5
  plain?: boolean;
6
- } & ElbeProps): import("preact").JSX.Element;
6
+ } & ElbeProps): import("react/jsx-runtime").JSX.Element;
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { jsx as _jsx } from "preact/jsx-runtime";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { applyProps, clamp, useTheme, useThemeConfig } from "../..";
14
14
  export function ProgressBar(_a) {
15
15
  var { value, max = 100, plain } = _a, elbe = __rest(_a, ["value", "max", "plain"]);
@@ -1,5 +1,5 @@
1
- import { VNode } from "preact";
2
- import { ElbeChildren, IconChild, wouter } from "../../..";
1
+ import React from "react";
2
+ import { ElbeChildren, IconChild, Wouter } from "../../..";
3
3
  export type MenuItem = {
4
4
  path: string;
5
5
  label: string;
@@ -10,9 +10,9 @@ export type MenuItem = {
10
10
  type _MenuRouteProps = MenuItem & {
11
11
  children?: ElbeChildren;
12
12
  };
13
- export type ElbeRoute = VNode<{
13
+ export type ElbeRoute = React.ReactElement<{
14
14
  path: string;
15
- }> | VNode<_MenuRouteProps>;
15
+ }> | React.ReactElement<_MenuRouteProps>;
16
16
  /**
17
17
  * a route that also renders a menu item in the <AppBase> component.
18
18
  * place it as a child of <AppBase> to have it rendered in the menu.
@@ -21,10 +21,10 @@ export type ElbeRoute = VNode<{
21
21
  *
22
22
  * ⚠️ a route with path "/" can't be used for nesting
23
23
  */
24
- export declare function MenuRoute(p: _MenuRouteProps): import("preact").JSX.Element;
24
+ export declare function MenuRoute(p: _MenuRouteProps): import("react/jsx-runtime").JSX.Element;
25
25
  /**
26
- * a helper function to create a <wouter.Route> with a path.
26
+ * a helper function to create a <Wouter.Route> with a path.
27
27
  */
28
- export declare const Route: typeof wouter.Route;
29
- export declare function isMenuRoute(r: ElbeRoute): r is VNode<_MenuRouteProps>;
28
+ export declare const Route: typeof Wouter.Route;
29
+ export declare function isMenuRoute(r: ElbeRoute): r is React.ReactElement<_MenuRouteProps>;
30
30
  export {};
@@ -1,5 +1,5 @@
1
- import { jsx as _jsx } from "preact/jsx-runtime";
2
- import { wouter } from "../../..";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Wouter } from "../../..";
3
3
  /**
4
4
  * a route that also renders a menu item in the <AppBase> component.
5
5
  * place it as a child of <AppBase> to have it rendered in the menu.
@@ -12,9 +12,9 @@ export function MenuRoute(p) {
12
12
  return (_jsx(Route, { nest: true, path: p.path, children: p.children }));
13
13
  }
14
14
  /**
15
- * a helper function to create a <wouter.Route> with a path.
15
+ * a helper function to create a <Wouter.Route> with a path.
16
16
  */
17
- export const Route = wouter.Route;
17
+ export const Route = Wouter.Route;
18
18
  export function isMenuRoute(r) {
19
19
  return "path" in r.props && "label" in r.props && "icon" in r.props;
20
20
  }