elbe-ui 0.2.37 → 0.2.41
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/README.md +6 -0
- package/dist/bit/bit.d.ts +4 -1
- package/dist/bit/bit.js +4 -5
- package/dist/elbe.css +13 -12
- package/dist/elbe.css.map +1 -1
- package/dist/ui/theme/colors.d.ts +2 -3
- package/dist/ui/theme/colors.js +5 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,3 +28,9 @@ so far, it has been optimized for React. It provides a variety of Widgets and th
|
|
|
28
28
|
# contribute
|
|
29
29
|
|
|
30
30
|
as of now, this is mainly a personal project for different stuff I built. So things might be a little rough around the edges. If you find any issues or want to help make elbe better, I'd love to hear from you :)
|
|
31
|
+
|
|
32
|
+
## publish
|
|
33
|
+
|
|
34
|
+
1. increment `version` number in `package.json`
|
|
35
|
+
2. run `bun run build`
|
|
36
|
+
3. run `npm publish`
|
package/dist/bit/bit.d.ts
CHANGED
|
@@ -4,7 +4,10 @@ export interface BitUseInterface<C, T> {
|
|
|
4
4
|
signal: Signal<BitState<T>>;
|
|
5
5
|
ctrl: C;
|
|
6
6
|
map: <D>(m: TriMap<T, D>) => D | preact.JSX.Element;
|
|
7
|
-
onData: (f: (d: T) => any
|
|
7
|
+
onData: <D>(f: (d: T) => any, { onLoading, onError, }?: {
|
|
8
|
+
onLoading?: () => any;
|
|
9
|
+
onError?: (e: string) => any;
|
|
10
|
+
}) => any;
|
|
8
11
|
}
|
|
9
12
|
interface BitData<C, T> {
|
|
10
13
|
ctrl: C;
|
package/dist/bit/bit.js
CHANGED
|
@@ -8,6 +8,7 @@ const signals_1 = require("@preact/signals");
|
|
|
8
8
|
const preact_1 = require("preact");
|
|
9
9
|
const hooks_1 = require("preact/hooks");
|
|
10
10
|
const error_view_1 = require("../ui/components/error_view");
|
|
11
|
+
const flex_1 = require("../ui/components/layout/flex");
|
|
11
12
|
const spinner_1 = require("../ui/components/spinner");
|
|
12
13
|
function makeBit(name) {
|
|
13
14
|
const c = (0, preact_1.createContext)(null);
|
|
@@ -48,7 +49,8 @@ function useBit(context) {
|
|
|
48
49
|
const v = state.value;
|
|
49
50
|
function map(m) {
|
|
50
51
|
if (v.loading)
|
|
51
|
-
return (m.onLoading ||
|
|
52
|
+
return (m.onLoading ||
|
|
53
|
+
(() => ((0, jsx_runtime_1.jsx)(flex_1.Column, { cross: "center", children: (0, jsx_runtime_1.jsx)(spinner_1.Spinner, {}) }))))();
|
|
52
54
|
if (v.error)
|
|
53
55
|
return (m.onError ||
|
|
54
56
|
((e) => (0, jsx_runtime_1.jsx)(error_view_1.ErrorView, { error: e, retry: ctrl.reload ?? null })))(v.error);
|
|
@@ -64,7 +66,7 @@ function useBit(context) {
|
|
|
64
66
|
* @param f the builder function
|
|
65
67
|
* @returns the built component
|
|
66
68
|
*/
|
|
67
|
-
onData: (f) => map({ onData: f }),
|
|
69
|
+
onData: (f, { onLoading, onError, } = {}) => map({ onData: f, onLoading: onLoading, onError: onError }),
|
|
68
70
|
};
|
|
69
71
|
}
|
|
70
72
|
catch (e) {
|
|
@@ -78,6 +80,3 @@ function useBit(context) {
|
|
|
78
80
|
};
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
|
-
function BitSpinner({ name }) {
|
|
82
|
-
return (0, jsx_runtime_1.jsx)(spinner_1.Spinner, {});
|
|
83
|
-
}
|
package/dist/elbe.css
CHANGED
|
@@ -58,6 +58,7 @@ body,
|
|
|
58
58
|
}
|
|
59
59
|
.elbe .padded,
|
|
60
60
|
.elbe .card,
|
|
61
|
+
.elbe .toast,
|
|
61
62
|
.elbe input[type=text],
|
|
62
63
|
.elbe input[type=number],
|
|
63
64
|
.elbe input[type=password],
|
|
@@ -66,7 +67,6 @@ body,
|
|
|
66
67
|
.elbe input[type=time],
|
|
67
68
|
.elbe textarea,
|
|
68
69
|
.elbe select,
|
|
69
|
-
.elbe .toast,
|
|
70
70
|
.elbe button {
|
|
71
71
|
padding: var(--g-padding);
|
|
72
72
|
}
|
|
@@ -84,6 +84,7 @@ body,
|
|
|
84
84
|
}
|
|
85
85
|
.elbe .rounded,
|
|
86
86
|
.elbe .card,
|
|
87
|
+
.elbe .toast,
|
|
87
88
|
.elbe input[type=text],
|
|
88
89
|
.elbe input[type=number],
|
|
89
90
|
.elbe input[type=password],
|
|
@@ -92,7 +93,6 @@ body,
|
|
|
92
93
|
.elbe input[type=time],
|
|
93
94
|
.elbe textarea,
|
|
94
95
|
.elbe select,
|
|
95
|
-
.elbe .toast,
|
|
96
96
|
.elbe button {
|
|
97
97
|
border-radius: var(--g-radius);
|
|
98
98
|
border-color: inherit;
|
|
@@ -141,6 +141,7 @@ body,
|
|
|
141
141
|
}
|
|
142
142
|
.elbe .box, .elbe .header, .elbe .base-limited,
|
|
143
143
|
.elbe .card,
|
|
144
|
+
.elbe .toast,
|
|
144
145
|
.elbe input[type=text],
|
|
145
146
|
.elbe input[type=number],
|
|
146
147
|
.elbe input[type=password],
|
|
@@ -149,7 +150,6 @@ body,
|
|
|
149
150
|
.elbe input[type=time],
|
|
150
151
|
.elbe textarea,
|
|
151
152
|
.elbe select,
|
|
152
|
-
.elbe .toast,
|
|
153
153
|
.elbe button {
|
|
154
154
|
border-style: solid;
|
|
155
155
|
border-width: var(--g-border-width);
|
|
@@ -382,15 +382,6 @@ body,
|
|
|
382
382
|
border-radius: 25%;
|
|
383
383
|
object-fit: cover;
|
|
384
384
|
}
|
|
385
|
-
.elbe .toast {
|
|
386
|
-
position: fixed;
|
|
387
|
-
bottom: 1rem;
|
|
388
|
-
right: 1rem;
|
|
389
|
-
z-index: 200;
|
|
390
|
-
left: 50%;
|
|
391
|
-
width: min(40rem, 90%);
|
|
392
|
-
transform: translateX(-50%);
|
|
393
|
-
}
|
|
394
385
|
.elbe select {
|
|
395
386
|
padding: 0 0.75rem;
|
|
396
387
|
height: 3rem;
|
|
@@ -537,4 +528,14 @@ body,
|
|
|
537
528
|
border: 0.16em solid var(--c-context-border);
|
|
538
529
|
}
|
|
539
530
|
|
|
531
|
+
.toast {
|
|
532
|
+
position: fixed;
|
|
533
|
+
bottom: 1rem;
|
|
534
|
+
right: 1rem;
|
|
535
|
+
z-index: 200;
|
|
536
|
+
left: 50%;
|
|
537
|
+
width: min(40rem, 90%);
|
|
538
|
+
transform: translateX(-50%);
|
|
539
|
+
}
|
|
540
|
+
|
|
540
541
|
/*# sourceMappingURL=elbe.css.map */
|
package/dist/elbe.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../style/elbe.scss","../style/_base.scss","../style/_flex.scss","../style/_components.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;AAAA;AAOQ;AAMR;EACE;EACA;EACA;EACA;EAEA;EACA;EACA;EAGA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAGF;AAAA;AAAA;EAGE;EACA;EACA;EACA;EACA;;;AAGF;AAAA;EAEE;EACA;EACA;EACA;;;AAIF;AC3DA;AAoBA;AA6DA;AAUA;AAaA;AA8BA;AC9GA;AAqBA;AAYA;AAkBA;AAqBA;;AD9FA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAEE;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;AAMF;EACE;;AAEF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAEE;EACA;EACA;;AAEF;EACE;;AAGF;AAAA;EAEE;;AAGF;EACE;;AAEF;EACE;;AAGF;EACE;EACA;;AACA;EACE;;AAIJ;EACE;;AAGF;EACE;;AAEF;EACE;;AAEF;EACE;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;AAKF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAEE;EACA;;AAOF;EACE;;AAGF;EAEE;EACA;EACA;;AAKF;AAAA;EAEE;;AAEF;AAAA;AAAA;AAAA;EAEE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;EACA;;AAKF;EACE;EACA;EACA;EACA;;AAGF;EACE;IACE;;EAEF;IACE;;;ACpJJ;AAAA;AAAA;AAAA;AAAA;EAGE;EACA;EACA;EACA;;AAGF;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;;AAKF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAKF;EACE;;AAIA;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AADF;EACE;;AAMJ;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAKF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAKF;EACE;IACE;;EAEF;IACE;;;AAIJ;EACE;IACE;;;AAIJ;EACE;;AClHF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EACE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAIF;EAIE;EACA;EACA;EACA;EACA;EACA;EACA;AAMA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAJA;EACE;;AAoBJ;EACE;EACA;EACA;;AAGF;
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../style/elbe.scss","../style/_base.scss","../style/_flex.scss","../style/_components.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;AAAA;AAOQ;AAMR;EACE;EACA;EACA;EACA;EAEA;EACA;EACA;EAGA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAGF;AAAA;AAAA;EAGE;EACA;EACA;EACA;EACA;;;AAGF;AAAA;EAEE;EACA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;EACE;;AAKF;EACE;IACE;;EAEF;IACE;;;AAIJ;EACE;IACE;;;AAIJ;EACE;;AClHF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EACE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAIF;EAIE;EACA;EACA;EACA;EACA;EACA;EACA;AAMA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAJA;EACE;;AAoBJ;EACE;EACA;EACA;;AAGF;EAGE;EACA;EACA;EACA;;AAGF;EAKE;EAEA;EACA;EACA;EACA;EACA;EAEA;EAEA;EAEA;EAEA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;EACA;;AACA;EACE;;AAKN;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EAGC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACC;EAGD;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;;AAKD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAWE;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAGF;EAEE;EACA;EACA;;AAGF;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;;AAOJ;EACE;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EAEA;EACA;EACA;;AAIF;EACE;EACA;;AACA;EACE;EACA;;AAMJ;EACE;EACA;;AAGF;EACE;EACA;;;AHxLF;EAIE;EACA;EACA;EACA;EACA;EACA;EACA","file":"elbe.css"}
|
|
@@ -42,7 +42,7 @@ export type ColorThemeSeed = ColorSeedColors & {
|
|
|
42
42
|
flat: SeedFlatSelector;
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
|
-
declare class RGBAColor {
|
|
45
|
+
export declare class RGBAColor {
|
|
46
46
|
r: number;
|
|
47
47
|
g: number;
|
|
48
48
|
b: number;
|
|
@@ -52,7 +52,7 @@ declare class RGBAColor {
|
|
|
52
52
|
get isDark(): boolean;
|
|
53
53
|
get luminance(): number;
|
|
54
54
|
get hex(): string;
|
|
55
|
-
static
|
|
55
|
+
static fromHex(hex: string | null): RGBAColor;
|
|
56
56
|
desaturated(f?: number): RGBAColor;
|
|
57
57
|
withAlpha(a: number): RGBAColor;
|
|
58
58
|
inter(other: RGBAColor, factor: number): RGBAColor;
|
|
@@ -139,4 +139,3 @@ export declare class ColorTheme {
|
|
|
139
139
|
asCss(): string;
|
|
140
140
|
static generate(seed?: Partial<ColorThemeSeed>): ColorTheme;
|
|
141
141
|
}
|
|
142
|
-
export {};
|
package/dist/ui/theme/colors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ColorTheme = exports.ModeColor = exports.SchemeColor = exports.KindColor = exports.MannerColor = exports.StateColor = exports.LayerColor = exports.colors = exports.cLayers = exports.cStates = exports.cManners = exports.cKinds = exports.cSchemes = exports.cModes = void 0;
|
|
3
|
+
exports.ColorTheme = exports.ModeColor = exports.SchemeColor = exports.KindColor = exports.MannerColor = exports.StateColor = exports.LayerColor = exports.colors = exports.RGBAColor = exports.cLayers = exports.cStates = exports.cManners = exports.cKinds = exports.cSchemes = exports.cModes = void 0;
|
|
4
4
|
const colors_convert_1 = require("colors-convert");
|
|
5
5
|
const util_1 = require("../util/util");
|
|
6
6
|
const color_theme_1 = require("./color_theme");
|
|
@@ -48,7 +48,7 @@ class RGBAColor {
|
|
|
48
48
|
.padStart(2, "0");
|
|
49
49
|
return `#${c.join("")}${a}`;
|
|
50
50
|
}
|
|
51
|
-
static
|
|
51
|
+
static fromHex(hex) {
|
|
52
52
|
if (!hex)
|
|
53
53
|
return new RGBAColor(0, 0, 0, 0);
|
|
54
54
|
const c = hex.replace("#", "").padEnd(6, "0").padEnd(8, "f").toLowerCase();
|
|
@@ -88,6 +88,7 @@ class RGBAColor {
|
|
|
88
88
|
return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
+
exports.RGBAColor = RGBAColor;
|
|
91
92
|
exports.colors = {
|
|
92
93
|
transparent: new RGBAColor(0, 0, 0, 0),
|
|
93
94
|
white: new RGBAColor(255, 255, 255, 1),
|
|
@@ -128,9 +129,9 @@ class LayerColor extends RGBAColor {
|
|
|
128
129
|
}
|
|
129
130
|
static fromHex(back, front, border) {
|
|
130
131
|
if (front === undefined && border === undefined) {
|
|
131
|
-
return LayerColor.fromBack(RGBAColor.
|
|
132
|
+
return LayerColor.fromBack(RGBAColor.fromHex(back));
|
|
132
133
|
}
|
|
133
|
-
return new LayerColor(RGBAColor.
|
|
134
|
+
return new LayerColor(RGBAColor.fromHex(back), RGBAColor.fromHex(front ?? null), RGBAColor.fromHex(border ?? null));
|
|
134
135
|
}
|
|
135
136
|
static fromBack(back, c) {
|
|
136
137
|
const front = back.isDark ? exports.colors.white : exports.colors.black;
|