elbe-ui 0.2.30 → 0.2.34

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 (70) hide show
  1. package/dist/bit/bit.d.ts +34 -0
  2. package/dist/bit/bit.js +83 -0
  3. package/dist/bit/ctrl_bit.d.ts +30 -0
  4. package/dist/bit/ctrl_bit.js +89 -0
  5. package/dist/elbe.css.map +1 -0
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.js +1 -0
  8. package/dist/service/s_api.d.ts +30 -0
  9. package/dist/service/s_api.js +89 -0
  10. package/dist/ui/components/badge.d.ts +25 -0
  11. package/dist/ui/components/badge.js +53 -0
  12. package/dist/ui/components/base/box.d.ts +2564 -0
  13. package/dist/ui/components/base/box.js +30 -0
  14. package/dist/ui/components/base/card.d.ts +14 -0
  15. package/dist/ui/components/base/card.js +11 -0
  16. package/dist/ui/components/base/padded.d.ts +25 -0
  17. package/dist/ui/components/base/padded.js +28 -0
  18. package/dist/ui/components/button/button.d.ts +21 -0
  19. package/dist/ui/components/button/button.js +27 -0
  20. package/dist/ui/components/button/choose_button.d.ts +14 -0
  21. package/dist/ui/components/button/choose_button.js +11 -0
  22. package/dist/ui/components/button/icon_button.d.ts +17 -0
  23. package/dist/ui/components/button/icon_button.js +31 -0
  24. package/dist/ui/components/button/toggle_button.d.ts +10 -0
  25. package/dist/ui/components/button/toggle_button.js +11 -0
  26. package/dist/ui/components/dialog.d.ts +8 -0
  27. package/dist/ui/components/dialog.js +14 -0
  28. package/dist/ui/components/error_view.d.ts +15 -0
  29. package/dist/ui/components/error_view.js +26 -0
  30. package/dist/ui/components/input/checkbox.d.ts +6 -0
  31. package/dist/ui/components/input/checkbox.js +12 -0
  32. package/dist/ui/components/input/input_field.d.ts +22 -0
  33. package/dist/ui/components/input/input_field.js +31 -0
  34. package/dist/ui/components/input/range.d.ts +8 -0
  35. package/dist/ui/components/input/range.js +14 -0
  36. package/dist/ui/components/input/select.d.ts +10 -0
  37. package/dist/ui/components/input/select.js +8 -0
  38. package/dist/ui/components/input/text_area.d.ts +10 -0
  39. package/dist/ui/components/input/text_area.js +13 -0
  40. package/dist/ui/components/layout/flex.d.ts +11 -0
  41. package/dist/ui/components/layout/flex.js +23 -0
  42. package/dist/ui/components/layout/scaffold.d.ts +27 -0
  43. package/dist/ui/components/layout/scaffold.js +44 -0
  44. package/dist/ui/components/layout/scroll.d.ts +18 -0
  45. package/dist/ui/components/layout/scroll.js +20 -0
  46. package/dist/ui/components/layout/spaced.d.ts +3 -0
  47. package/dist/ui/components/layout/spaced.js +7 -0
  48. package/dist/ui/components/spinner.d.ts +11 -0
  49. package/dist/ui/components/spinner.js +48 -0
  50. package/dist/ui/components/text.d.ts +33 -0
  51. package/dist/ui/components/text.js +42 -0
  52. package/dist/ui/theme/color_theme.d.ts +2 -0
  53. package/dist/ui/theme/color_theme.js +63 -0
  54. package/dist/ui/theme/colors.d.ts +142 -0
  55. package/dist/ui/theme/colors.js +317 -0
  56. package/dist/ui/theme/geometry_theme.d.ts +16 -0
  57. package/dist/ui/theme/geometry_theme.js +38 -0
  58. package/dist/ui/theme/theme.d.ts +28 -0
  59. package/dist/ui/theme/theme.js +49 -0
  60. package/dist/ui/theme/type_theme.d.ts +38 -0
  61. package/dist/ui/theme/type_theme.js +98 -0
  62. package/dist/ui/util/confirm_dialog.d.ts +10 -0
  63. package/dist/ui/util/confirm_dialog.js +46 -0
  64. package/dist/ui/util/error_view.d.ts +1 -0
  65. package/dist/ui/util/error_view.js +8 -0
  66. package/dist/ui/util/toast.d.ts +5 -0
  67. package/dist/ui/util/toast.js +17 -0
  68. package/dist/ui/util/util.d.ts +21 -0
  69. package/dist/ui/util/util.js +39 -0
  70. package/package.json +2 -5
@@ -0,0 +1,21 @@
1
+ import type React from "preact/compat";
2
+ export type ElbeChild = React.ReactNode;
3
+ export type ElbeChildren = ElbeChild[] | ElbeChild;
4
+ export declare function clamp(value: number, min: number, max: number): number;
5
+ /**
6
+ * use the web share api if available, otherwise copy the data to the clipboard
7
+ * @param data the data you want to share
8
+ * @param toastMsg the message to show in the toast if the share api is not available
9
+ */
10
+ export declare function share(data: {
11
+ title: string;
12
+ text?: string;
13
+ url: string;
14
+ }, toastMsg?: string): void;
15
+ /**
16
+ * copy the text to the clipboard
17
+ * @param text the text to copy to the clipboard
18
+ * @param toastMsg the message to show in the toast
19
+ */
20
+ export declare function copyToClipboard(text: string, toastMsg?: string): void;
21
+ export declare function scrollToId(id: string): void;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clamp = clamp;
4
+ exports.share = share;
5
+ exports.copyToClipboard = copyToClipboard;
6
+ exports.scrollToId = scrollToId;
7
+ const toast_1 = require("./toast");
8
+ function clamp(value, min, max) {
9
+ return Math.min(Math.max(value, min), max);
10
+ }
11
+ /**
12
+ * use the web share api if available, otherwise copy the data to the clipboard
13
+ * @param data the data you want to share
14
+ * @param toastMsg the message to show in the toast if the share api is not available
15
+ */
16
+ function share(data, toastMsg = "copied to clipboard. Share it with others.") {
17
+ const msg = `${data.title}\n${data.text ?? ""}\n\n${data.url}`;
18
+ if (navigator.share) {
19
+ navigator.share(data).catch(() => copyToClipboard(msg, toastMsg));
20
+ }
21
+ else {
22
+ copyToClipboard(msg, toastMsg);
23
+ }
24
+ }
25
+ /**
26
+ * copy the text to the clipboard
27
+ * @param text the text to copy to the clipboard
28
+ * @param toastMsg the message to show in the toast
29
+ */
30
+ function copyToClipboard(text, toastMsg = "copied to clipboard") {
31
+ navigator.clipboard.writeText(text);
32
+ if (toastMsg)
33
+ (0, toast_1.showToast)(toastMsg);
34
+ }
35
+ function scrollToId(id) {
36
+ const el = document.getElementById(id);
37
+ if (el)
38
+ el.scrollIntoView({ behavior: "smooth" });
39
+ }
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "elbe-ui",
3
- "type": "module",
4
- "version": "0.2.30",
3
+ "version": "0.2.34",
5
4
  "author": "Robin Naumann",
6
5
  "license": "MIT",
7
6
  "repository": {
@@ -14,9 +13,7 @@
14
13
  "flutter"
15
14
  ],
16
15
  "files": [
17
- "dist/*.js",
18
- "dist/*.d.ts",
19
- "dist/*.css"
16
+ "dist"
20
17
  ],
21
18
  "main": "dist/index.js",
22
19
  "types": "dist/index.d.ts",