elbe-ui 0.2.46 → 0.2.52

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 (54) hide show
  1. package/dist/elbe.css +60 -18
  2. package/dist/elbe.css.map +1 -1
  3. package/dist/index.d.ts +6 -0
  4. package/dist/index.js +6 -0
  5. package/dist/ui/components/banner.d.ts +12 -0
  6. package/dist/ui/components/banner.js +17 -0
  7. package/dist/ui/components/base/box.d.ts +15 -1
  8. package/dist/ui/components/base/box.js +4 -4
  9. package/dist/ui/components/base/card.d.ts +4 -1
  10. package/dist/ui/components/base/card.js +11 -2
  11. package/dist/ui/components/base/padded.js +1 -1
  12. package/dist/ui/components/button/button.d.ts +3 -2
  13. package/dist/ui/components/button/button.js +4 -2
  14. package/dist/ui/components/button/choose_button.d.ts +1 -0
  15. package/dist/ui/components/button/choose_button.js +5 -2
  16. package/dist/ui/components/button/icon_button.d.ts +3 -2
  17. package/dist/ui/components/button/icon_button.js +2 -1
  18. package/dist/ui/components/button/toggle_button.d.ts +2 -2
  19. package/dist/ui/components/button/toggle_button.js +1 -1
  20. package/dist/ui/components/dev/todo.js +3 -3
  21. package/dist/ui/components/dialog.js +1 -1
  22. package/dist/ui/components/input/checkbox.d.ts +2 -2
  23. package/dist/ui/components/input/checkbox.js +3 -1
  24. package/dist/ui/components/input/input_field.d.ts +2 -2
  25. package/dist/ui/components/input/input_field.js +1 -1
  26. package/dist/ui/components/input/range.d.ts +2 -2
  27. package/dist/ui/components/input/range.js +2 -2
  28. package/dist/ui/components/input/select.d.ts +2 -2
  29. package/dist/ui/components/input/select.js +1 -1
  30. package/dist/ui/components/input/switch.d.ts +6 -0
  31. package/dist/ui/components/input/switch.js +49 -0
  32. package/dist/ui/components/input/text_area.d.ts +2 -2
  33. package/dist/ui/components/input/text_area.js +1 -1
  34. package/dist/ui/components/layout/alignment.d.ts +9 -0
  35. package/dist/ui/components/layout/alignment.js +13 -0
  36. package/dist/ui/components/layout/flex.js +1 -1
  37. package/dist/ui/components/layout/header.d.ts +19 -0
  38. package/dist/ui/components/layout/header.js +52 -0
  39. package/dist/ui/components/layout/scaffold.d.ts +2 -17
  40. package/dist/ui/components/layout/scaffold.js +3 -34
  41. package/dist/ui/components/layout/scroll.js +1 -1
  42. package/dist/ui/components/progress_bar.d.ts +6 -0
  43. package/dist/ui/components/progress_bar.js +28 -0
  44. package/dist/ui/components/text.js +3 -2
  45. package/dist/ui/theme/color_theme.d.ts +2 -2
  46. package/dist/ui/theme/color_theme.js +51 -27
  47. package/dist/ui/theme/colors.d.ts +5 -33
  48. package/dist/ui/theme/colors.js +13 -11
  49. package/dist/ui/theme/seed.d.ts +43 -0
  50. package/dist/ui/theme/seed.js +1 -0
  51. package/dist/ui/theme/theme.d.ts +9 -5
  52. package/dist/ui/theme/theme.js +12 -4
  53. package/dist/ui/util/confirm_dialog.js +6 -3
  54. package/package.json +1 -1
@@ -1,12 +1,14 @@
1
- import { ColorTheme, type ColorThemeSeed } from "./colors";
1
+ import "../../elbe.css";
2
+ import { ColorTheme } from "./colors";
2
3
  import { GeometryTheme, type GeometryThemeSeed } from "./geometry_theme";
4
+ import { PartialColorThemeSeed } from "./seed";
3
5
  import { TypeTheme, type TypeThemeSeed } from "./type_theme";
4
6
  export * from "./color_theme";
5
7
  export * from "./colors";
6
8
  export * from "./geometry_theme";
7
9
  export * from "./type_theme";
8
10
  export interface ElbeThemeSeed {
9
- color?: Partial<ColorThemeSeed>;
11
+ color?: Partial<PartialColorThemeSeed>;
10
12
  type?: Partial<TypeThemeSeed>;
11
13
  geometry?: Partial<GeometryThemeSeed>;
12
14
  }
@@ -16,14 +18,16 @@ export declare class ElbeThemeData {
16
18
  readonly geometry: GeometryTheme;
17
19
  constructor(color: ColorTheme, type: TypeTheme, geometry: GeometryTheme);
18
20
  asCss(): string;
19
- static fromSeed(seed: ElbeThemeSeed): ElbeThemeData;
21
+ _pageBackground(dark?: boolean): string;
22
+ static fromSeed(seed: ElbeThemeSeed, highVis: boolean): ElbeThemeData;
20
23
  }
21
24
  export declare function ElbeTheme(p: {
22
25
  children: any;
23
26
  dark?: boolean;
24
27
  todoOverlay?: boolean;
28
+ highVis?: boolean;
25
29
  } & ({
26
- seed: ElbeThemeSeed;
27
- } | {
28
30
  theme: ElbeThemeData;
31
+ } | {
32
+ seed?: ElbeThemeSeed;
29
33
  })): import("preact").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
2
+ import "../../elbe.css";
2
3
  import { ToDo } from "../components/dev/todo";
3
4
  import { ColorTheme } from "./colors";
4
5
  import { GeometryTheme } from "./geometry_theme";
@@ -18,11 +19,18 @@ export class ElbeThemeData {
18
19
  .map((s) => s.asCss())
19
20
  .join("\n");
20
21
  }
21
- static fromSeed(seed) {
22
- return new ElbeThemeData(ColorTheme.generate(seed.color), TypeTheme.generate(seed.type), GeometryTheme.generate(seed.geometry));
22
+ _pageBackground(dark) {
23
+ const c = this.color.color;
24
+ return `html,:root {${(!!dark ? c.dark : c.light).asCss()};`;
25
+ }
26
+ static fromSeed(seed, highVis) {
27
+ return new ElbeThemeData(ColorTheme.generate(seed.color, highVis), TypeTheme.generate(seed.type), GeometryTheme.generate(seed.geometry));
23
28
  }
24
29
  }
25
30
  export function ElbeTheme(p) {
26
- const theme = "seed" in p ? ElbeThemeData.fromSeed(p.seed) : p.theme;
27
- return (_jsxs("div", { class: `elbe ${p.dark ? "dark" : ""}`, children: [p.todoOverlay && _jsx(ToDo.Overlay, {}), _jsx("style", { children: theme.asCss() }), p.children] }));
31
+ var _a, _b;
32
+ const theme = "theme" in p
33
+ ? p.theme
34
+ : ElbeThemeData.fromSeed((_a = p.seed) !== null && _a !== void 0 ? _a : {}, (_b = p.highVis) !== null && _b !== void 0 ? _b : false);
35
+ return (_jsxs("div", { class: `elbe ${p.dark ? "dark" : ""} ${p.highVis ? "high_vis" : ""}`, children: [p.todoOverlay && _jsx(ToDo.Overlay, {}), _jsx("style", { children: theme.asCss() }), _jsx("style", { children: theme._pageBackground(p.dark) }), p.children] }));
28
36
  }
@@ -5,11 +5,12 @@
5
5
  */
6
6
  export function showConfirmDialog({ title, message, okay = false, }) {
7
7
  return new Promise((resolve, reject) => {
8
+ var _a;
8
9
  const dialog = document.createElement("div");
9
10
  dialog.classList.add("dialog");
10
11
  dialog.innerHTML = `<dialog open>
11
12
  <div
12
- class="elbe card primary"
13
+ class="card primary"
13
14
  style="max-width: 30rem; min-width: 10rem"
14
15
  >
15
16
  <div class="row cross-center">
@@ -34,9 +35,11 @@ export function showConfirmDialog({ title, message, okay = false, }) {
34
35
  </div>
35
36
  </dialog>
36
37
  `;
37
- document.body.appendChild(dialog);
38
+ (_a = document.getElementsByClassName("elbe")[0]) === null || _a === void 0 ? void 0 : _a.appendChild(dialog);
39
+ //document.body.appendChild(dialog);
38
40
  window["conf_resolve"] = (v) => {
39
- document.body.removeChild(dialog);
41
+ var _a;
42
+ (_a = document.getElementsByClassName("elbe")[0]) === null || _a === void 0 ? void 0 : _a.removeChild(dialog);
40
43
  resolve(v);
41
44
  };
42
45
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elbe-ui",
3
- "version": "0.2.46",
3
+ "version": "0.2.52",
4
4
  "author": "Robin Naumann",
5
5
  "license": "MIT",
6
6
  "repository": {