elbe-ui 0.2.30 → 0.2.37
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/bit/bit.d.ts +34 -0
- package/dist/bit/bit.js +83 -0
- package/dist/bit/ctrl_bit.d.ts +30 -0
- package/dist/bit/ctrl_bit.js +89 -0
- package/dist/elbe.css +203 -284
- package/dist/elbe.css.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/service/s_api.d.ts +30 -0
- package/dist/service/s_api.js +89 -0
- package/dist/ui/components/badge.d.ts +25 -0
- package/dist/ui/components/badge.js +53 -0
- package/dist/ui/components/base/box.d.ts +2564 -0
- package/dist/ui/components/base/box.js +30 -0
- package/dist/ui/components/base/card.d.ts +14 -0
- package/dist/ui/components/base/card.js +11 -0
- package/dist/ui/components/base/padded.d.ts +25 -0
- package/dist/ui/components/base/padded.js +28 -0
- package/dist/ui/components/button/button.d.ts +21 -0
- package/dist/ui/components/button/button.js +27 -0
- package/dist/ui/components/button/choose_button.d.ts +14 -0
- package/dist/ui/components/button/choose_button.js +11 -0
- package/dist/ui/components/button/icon_button.d.ts +17 -0
- package/dist/ui/components/button/icon_button.js +31 -0
- package/dist/ui/components/button/toggle_button.d.ts +10 -0
- package/dist/ui/components/button/toggle_button.js +11 -0
- package/dist/ui/components/dialog.d.ts +8 -0
- package/dist/ui/components/dialog.js +14 -0
- package/dist/ui/components/error_view.d.ts +15 -0
- package/dist/ui/components/error_view.js +26 -0
- package/dist/ui/components/input/checkbox.d.ts +6 -0
- package/dist/ui/components/input/checkbox.js +12 -0
- package/dist/ui/components/input/input_field.d.ts +22 -0
- package/dist/ui/components/input/input_field.js +31 -0
- package/dist/ui/components/input/range.d.ts +8 -0
- package/dist/ui/components/input/range.js +14 -0
- package/dist/ui/components/input/select.d.ts +10 -0
- package/dist/ui/components/input/select.js +8 -0
- package/dist/ui/components/input/text_area.d.ts +10 -0
- package/dist/ui/components/input/text_area.js +13 -0
- package/dist/ui/components/layout/flex.d.ts +11 -0
- package/dist/ui/components/layout/flex.js +23 -0
- package/dist/ui/components/layout/scaffold.d.ts +27 -0
- package/dist/ui/components/layout/scaffold.js +44 -0
- package/dist/ui/components/layout/scroll.d.ts +18 -0
- package/dist/ui/components/layout/scroll.js +20 -0
- package/dist/ui/components/layout/spaced.d.ts +3 -0
- package/dist/ui/components/layout/spaced.js +7 -0
- package/dist/ui/components/spinner.d.ts +11 -0
- package/dist/ui/components/spinner.js +48 -0
- package/dist/ui/components/text.d.ts +33 -0
- package/dist/ui/components/text.js +42 -0
- package/dist/ui/theme/color_theme.d.ts +2 -0
- package/dist/ui/theme/color_theme.js +63 -0
- package/dist/ui/theme/colors.d.ts +142 -0
- package/dist/ui/theme/colors.js +317 -0
- package/dist/ui/theme/geometry_theme.d.ts +16 -0
- package/dist/ui/theme/geometry_theme.js +38 -0
- package/dist/ui/theme/theme.d.ts +28 -0
- package/dist/ui/theme/theme.js +49 -0
- package/dist/ui/theme/type_theme.d.ts +38 -0
- package/dist/ui/theme/type_theme.js +98 -0
- package/dist/ui/util/confirm_dialog.d.ts +10 -0
- package/dist/ui/util/confirm_dialog.js +46 -0
- package/dist/ui/util/error_view.d.ts +1 -0
- package/dist/ui/util/error_view.js +8 -0
- package/dist/ui/util/toast.d.ts +5 -0
- package/dist/ui/util/toast.js +17 -0
- package/dist/ui/util/util.d.ts +21 -0
- package/dist/ui/util/util.js +39 -0
- package/package.json +3 -6
|
@@ -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
|
-
"
|
|
4
|
-
"version": "0.2.30",
|
|
3
|
+
"version": "0.2.37",
|
|
5
4
|
"author": "Robin Naumann",
|
|
6
5
|
"license": "MIT",
|
|
7
6
|
"repository": {
|
|
@@ -14,16 +13,14 @@
|
|
|
14
13
|
"flutter"
|
|
15
14
|
],
|
|
16
15
|
"files": [
|
|
17
|
-
"dist
|
|
18
|
-
"dist/*.d.ts",
|
|
19
|
-
"dist/*.css"
|
|
16
|
+
"dist"
|
|
20
17
|
],
|
|
21
18
|
"main": "dist/index.js",
|
|
22
19
|
"types": "dist/index.d.ts",
|
|
23
20
|
"scripts": {
|
|
24
21
|
"build:ts": "tsc",
|
|
25
22
|
"build:dts": "tsc --declaration",
|
|
26
|
-
"build:css": "sass
|
|
23
|
+
"build:css": "sass -q style/elbe.scss dist/elbe.css",
|
|
27
24
|
"build": "rm -rf ./dist && bun run build:ts && bun run build:dts && bun run build:css"
|
|
28
25
|
},
|
|
29
26
|
"devDependencies": {
|