elbe-ui 0.2.41 → 0.2.44
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.js +22 -25
- package/dist/bit/ctrl_bit.js +47 -28
- package/dist/elbe.css +58 -18
- package/dist/elbe.css.map +1 -1
- package/dist/index.js +33 -62
- package/dist/service/s_api.js +62 -49
- package/dist/ui/components/badge.js +13 -34
- package/dist/ui/components/base/box.js +21 -23
- package/dist/ui/components/base/card.js +19 -10
- package/dist/ui/components/base/padded.js +25 -16
- package/dist/ui/components/button/button.js +30 -22
- package/dist/ui/components/button/choose_button.js +7 -10
- package/dist/ui/components/button/icon_button.js +36 -26
- package/dist/ui/components/button/toggle_button.js +19 -10
- package/dist/ui/components/dialog.js +7 -10
- package/dist/ui/components/error_view.js +14 -16
- package/dist/ui/components/input/checkbox.js +17 -8
- package/dist/ui/components/input/input_field.js +28 -23
- package/dist/ui/components/input/range.js +26 -9
- package/dist/ui/components/input/select.js +16 -7
- package/dist/ui/components/input/text_area.js +17 -8
- package/dist/ui/components/layout/flex.js +24 -16
- package/dist/ui/components/layout/scaffold.d.ts +4 -3
- package/dist/ui/components/layout/scaffold.js +28 -18
- package/dist/ui/components/layout/scroll.js +10 -14
- package/dist/ui/components/layout/spaced.js +3 -6
- package/dist/ui/components/spinner.js +16 -19
- package/dist/ui/components/text.js +42 -37
- package/dist/ui/theme/color_theme.js +36 -42
- package/dist/ui/theme/colors.js +40 -77
- package/dist/ui/theme/geometry_theme.js +8 -16
- package/dist/ui/theme/theme.js +12 -34
- package/dist/ui/theme/type_theme.js +11 -39
- package/dist/ui/util/confirm_dialog.js +1 -4
- package/dist/ui/util/error_view.js +4 -7
- package/dist/ui/util/toast.js +1 -4
- package/dist/ui/util/util.js +8 -13
- package/package.json +3 -2
package/dist/bit/bit.js
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const error_view_1 = require("../ui/components/error_view");
|
|
11
|
-
const flex_1 = require("../ui/components/layout/flex");
|
|
12
|
-
const spinner_1 = require("../ui/components/spinner");
|
|
13
|
-
function makeBit(name) {
|
|
14
|
-
const c = (0, preact_1.createContext)(null);
|
|
1
|
+
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { useSignal } from "@preact/signals";
|
|
3
|
+
import { createContext } from "preact";
|
|
4
|
+
import { useContext } from "preact/hooks";
|
|
5
|
+
import { ErrorView } from "../ui/components/error_view";
|
|
6
|
+
import { Column } from "../ui/components/layout/flex";
|
|
7
|
+
import { Spinner } from "../ui/components/spinner";
|
|
8
|
+
export function makeBit(name) {
|
|
9
|
+
const c = createContext(null);
|
|
15
10
|
c.displayName = name;
|
|
16
11
|
return c;
|
|
17
12
|
}
|
|
18
|
-
function ProvideBit(context, parameters, worker, ctrl, children) {
|
|
19
|
-
const s =
|
|
13
|
+
export function ProvideBit(context, parameters, worker, ctrl, children) {
|
|
14
|
+
const s = useSignal({ loading: true });
|
|
20
15
|
const _set = (n) => {
|
|
21
16
|
try {
|
|
22
17
|
if (JSON.stringify(n) === JSON.stringify(s.peek()))
|
|
@@ -32,29 +27,31 @@ function ProvideBit(context, parameters, worker, ctrl, children) {
|
|
|
32
27
|
return _set({ error });
|
|
33
28
|
};
|
|
34
29
|
function map(m) {
|
|
30
|
+
var _a;
|
|
35
31
|
const st = s.value;
|
|
36
32
|
if (st.loading)
|
|
37
33
|
return m.onLoading();
|
|
38
34
|
if (st.error)
|
|
39
35
|
return m.onError(st.error);
|
|
40
|
-
return m.onData(st.data
|
|
36
|
+
return m.onData((_a = st.data) !== null && _a !== void 0 ? _a : null);
|
|
41
37
|
}
|
|
42
38
|
const c = ctrl(parameters, { emit, emitLoading, emitError, map, signal: s });
|
|
43
39
|
worker(parameters, { emit, emitLoading, emitError, map, signal: s }, c);
|
|
44
|
-
return ((
|
|
40
|
+
return (_jsx(context.Provider, { value: { ctrl: c, state: s }, children: children }));
|
|
45
41
|
}
|
|
46
|
-
function useBit(context) {
|
|
42
|
+
export function useBit(context) {
|
|
47
43
|
try {
|
|
48
|
-
const { ctrl, state } =
|
|
44
|
+
const { ctrl, state } = useContext(context);
|
|
49
45
|
const v = state.value;
|
|
50
46
|
function map(m) {
|
|
47
|
+
var _a;
|
|
51
48
|
if (v.loading)
|
|
52
49
|
return (m.onLoading ||
|
|
53
|
-
(() => ((
|
|
50
|
+
(() => (_jsx(Column, { cross: "center", children: _jsx(Spinner, {}) }))))();
|
|
54
51
|
if (v.error)
|
|
55
52
|
return (m.onError ||
|
|
56
|
-
((e) =>
|
|
57
|
-
return m.onData(v.data
|
|
53
|
+
((e) => { var _a; return _jsx(ErrorView, { error: e, retry: (_a = ctrl.reload) !== null && _a !== void 0 ? _a : null }); }))(v.error);
|
|
54
|
+
return m.onData((_a = v.data) !== null && _a !== void 0 ? _a : null);
|
|
58
55
|
}
|
|
59
56
|
return {
|
|
60
57
|
signal: state,
|
|
@@ -73,10 +70,10 @@ function useBit(context) {
|
|
|
73
70
|
const err = `BIT ERROR: NO ${context.displayName} PROVIDED`;
|
|
74
71
|
console.error(err, e);
|
|
75
72
|
return {
|
|
76
|
-
map: (_) => (
|
|
73
|
+
map: (_) => _jsx("div", { children: err }),
|
|
77
74
|
ctrl: null,
|
|
78
75
|
signal: null,
|
|
79
|
-
onData: () => (
|
|
76
|
+
onData: () => _jsx("div", { children: err }),
|
|
80
77
|
};
|
|
81
78
|
}
|
|
82
79
|
}
|
package/dist/bit/ctrl_bit.js
CHANGED
|
@@ -1,21 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
import { useEffect } from "preact/hooks";
|
|
22
|
+
import { makeBit as mb, ProvideBit, useBit } from "./bit";
|
|
7
23
|
class BitControl {
|
|
8
|
-
p;
|
|
9
|
-
bit;
|
|
10
24
|
constructor(p, bit) {
|
|
11
25
|
this.bit = bit;
|
|
12
26
|
this.p = p;
|
|
13
27
|
}
|
|
14
28
|
act(fn) {
|
|
15
29
|
this.bit.map({
|
|
16
|
-
onData:
|
|
30
|
+
onData: (d) => __awaiter(this, void 0, void 0, function* () {
|
|
17
31
|
try {
|
|
18
|
-
|
|
32
|
+
yield fn(d);
|
|
19
33
|
}
|
|
20
34
|
catch (e) {
|
|
21
35
|
if (e && e.code && e.message)
|
|
@@ -23,7 +37,7 @@ class BitControl {
|
|
|
23
37
|
else
|
|
24
38
|
console.error("[BitERROR] act: ", e);
|
|
25
39
|
}
|
|
26
|
-
},
|
|
40
|
+
}),
|
|
27
41
|
});
|
|
28
42
|
}
|
|
29
43
|
/**
|
|
@@ -32,33 +46,38 @@ class BitControl {
|
|
|
32
46
|
*/
|
|
33
47
|
dispose() { }
|
|
34
48
|
}
|
|
35
|
-
class WorkerControl extends BitControl {
|
|
36
|
-
|
|
49
|
+
export class WorkerControl extends BitControl {
|
|
50
|
+
constructor() {
|
|
51
|
+
super(...arguments);
|
|
52
|
+
this.reload = null;
|
|
53
|
+
}
|
|
37
54
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
55
|
+
export class StreamControl extends BitControl {
|
|
56
|
+
constructor() {
|
|
57
|
+
super(...arguments);
|
|
58
|
+
this.stream = null;
|
|
59
|
+
}
|
|
41
60
|
dispose() {
|
|
42
61
|
if (this.stream)
|
|
43
62
|
this.disposeStream(this.stream);
|
|
44
63
|
}
|
|
45
64
|
}
|
|
46
|
-
exports.StreamControl = StreamControl;
|
|
47
65
|
function make(name) {
|
|
48
|
-
return (
|
|
66
|
+
return mb(name);
|
|
49
67
|
}
|
|
50
68
|
function use(b) {
|
|
51
|
-
return
|
|
69
|
+
return useBit(b);
|
|
52
70
|
}
|
|
53
|
-
function CtrlBit(ctrl, name) {
|
|
71
|
+
export function CtrlBit(ctrl, name) {
|
|
54
72
|
const context = make((name || "Unknown") + "Bit");
|
|
55
|
-
function Provide(
|
|
56
|
-
|
|
73
|
+
function Provide(_a) {
|
|
74
|
+
var { children } = _a, p = __rest(_a, ["children"]);
|
|
75
|
+
return ProvideBit(context, p, (p, b, c) => __awaiter(this, void 0, void 0, function* () {
|
|
57
76
|
b.emitLoading();
|
|
58
77
|
try {
|
|
59
78
|
if (c instanceof WorkerControl) {
|
|
60
79
|
if (c.reload)
|
|
61
|
-
|
|
80
|
+
yield c.reload();
|
|
62
81
|
}
|
|
63
82
|
if (c instanceof StreamControl) {
|
|
64
83
|
c.stream = c.listen();
|
|
@@ -67,20 +86,20 @@ function CtrlBit(ctrl, name) {
|
|
|
67
86
|
catch (e) {
|
|
68
87
|
b.emitError(e);
|
|
69
88
|
}
|
|
70
|
-
}, (p, b) => {
|
|
89
|
+
}), (p, b) => {
|
|
71
90
|
const c = ctrl(p, b);
|
|
72
91
|
// clean up on unmount
|
|
73
|
-
|
|
92
|
+
useEffect(() => () => c.dispose(), []);
|
|
74
93
|
if (c instanceof WorkerControl) {
|
|
75
|
-
c.reload =
|
|
94
|
+
c.reload = () => __awaiter(this, void 0, void 0, function* () {
|
|
76
95
|
b.emitLoading();
|
|
77
96
|
try {
|
|
78
|
-
b.emit(
|
|
97
|
+
b.emit(yield c.worker());
|
|
79
98
|
}
|
|
80
99
|
catch (e) {
|
|
81
100
|
b.emitError(e);
|
|
82
101
|
}
|
|
83
|
-
};
|
|
102
|
+
});
|
|
84
103
|
}
|
|
85
104
|
return c;
|
|
86
105
|
}, children);
|
package/dist/elbe.css
CHANGED
|
@@ -55,6 +55,39 @@ body,
|
|
|
55
55
|
/* ========== ALIGN =========== */
|
|
56
56
|
/* ========== JUSTIFY =========== */
|
|
57
57
|
/* ========== RESPONSIVE =========== */
|
|
58
|
+
/*input[type="range"] {
|
|
59
|
+
-webkit-appearance: none;
|
|
60
|
+
appearance: none;
|
|
61
|
+
background: green;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
width: 15rem;
|
|
64
|
+
|
|
65
|
+
&::-moz-range-track{
|
|
66
|
+
background-color: var(--c-context-border);
|
|
67
|
+
border-radius: 100px;
|
|
68
|
+
border: none;
|
|
69
|
+
height: 0.5rem;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&::-webkit-slider-runnable-track
|
|
73
|
+
{
|
|
74
|
+
border-radius: 100px;
|
|
75
|
+
border: none;
|
|
76
|
+
height: 0.5rem;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&::-webkit-slider-thumb
|
|
80
|
+
{
|
|
81
|
+
|
|
82
|
+
border: none;
|
|
83
|
+
-webkit-appearance: none; // Override default look
|
|
84
|
+
appearance: none;
|
|
85
|
+
margin-top: -6px;
|
|
86
|
+
border-radius: 100px;
|
|
87
|
+
height: 1.2rem;
|
|
88
|
+
width: 1.2rem;
|
|
89
|
+
}
|
|
90
|
+
}*/
|
|
58
91
|
}
|
|
59
92
|
.elbe .padded,
|
|
60
93
|
.elbe .card,
|
|
@@ -463,29 +496,36 @@ body,
|
|
|
463
496
|
.elbe input[type=range] {
|
|
464
497
|
-webkit-appearance: none;
|
|
465
498
|
appearance: none;
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
border: none;
|
|
474
|
-
height: 0.5rem;
|
|
499
|
+
width: 100%;
|
|
500
|
+
height: 0.4rem;
|
|
501
|
+
border-radius: 1rem;
|
|
502
|
+
background-color: var(--c-context-back);
|
|
503
|
+
outline: none;
|
|
504
|
+
-webkit-transition: 0.2s;
|
|
505
|
+
transition: background-color 0.2s;
|
|
475
506
|
}
|
|
476
|
-
.elbe input[type=range]
|
|
477
|
-
|
|
478
|
-
border: none;
|
|
479
|
-
height: 0.5rem;
|
|
507
|
+
.elbe input[type=range]:hover {
|
|
508
|
+
background-color: var(--c-context-back);
|
|
480
509
|
}
|
|
481
510
|
.elbe input[type=range]::-webkit-slider-thumb {
|
|
482
|
-
border: none;
|
|
483
511
|
-webkit-appearance: none;
|
|
484
512
|
appearance: none;
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
513
|
+
width: 1.5rem;
|
|
514
|
+
height: 1.5rem;
|
|
515
|
+
border-radius: 1rem;
|
|
516
|
+
background: var(--c-context-front);
|
|
517
|
+
border: none;
|
|
518
|
+
outline: none;
|
|
519
|
+
cursor: pointer;
|
|
520
|
+
}
|
|
521
|
+
.elbe input[type=range]::-moz-range-thumb {
|
|
522
|
+
width: 1.5rem;
|
|
523
|
+
height: 1.5rem;
|
|
524
|
+
border-radius: 1rem;
|
|
525
|
+
background: var(--c-context-front);
|
|
526
|
+
border: none;
|
|
527
|
+
outline: none;
|
|
528
|
+
cursor: pointer;
|
|
489
529
|
}
|
|
490
530
|
.elbe input[type=checkbox] {
|
|
491
531
|
-webkit-appearance: none;
|
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;;
|
|
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;AC2GA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AFzMA;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;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;;AAaF;EACE;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;EA5BF;EACA;EACA;EACA;EACA;EACA;EACA;;AA0BA;EAhCA;EACA;EACA;EACA;EACA;EACA;EACA;;AAsEF;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;;;AHhOF;EAIE;EACA;EACA;EACA;EACA;EACA;EACA","file":"elbe.css"}
|
package/dist/index.js
CHANGED
|
@@ -1,65 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.Icons = void 0;
|
|
30
|
-
const jsx_runtime_1 = require("preact/jsx-runtime");
|
|
31
|
-
const Lucide = __importStar(require("lucide-react"));
|
|
32
|
-
require("./elbe.css");
|
|
1
|
+
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
+
import * as Lucide from "lucide-react";
|
|
3
|
+
import "./elbe.css";
|
|
33
4
|
// exports
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
5
|
+
export * from "./bit/bit";
|
|
6
|
+
export * from "./bit/ctrl_bit";
|
|
7
|
+
export * from "./service/s_api";
|
|
8
|
+
export * from "./ui/util/confirm_dialog";
|
|
9
|
+
export * from "./ui/util/toast";
|
|
10
|
+
export * from "./ui/util/util";
|
|
11
|
+
export * from "./ui/components/base/box";
|
|
12
|
+
export * from "./ui/components/base/card";
|
|
13
|
+
export * from "./ui/components/base/padded";
|
|
14
|
+
export * from "./ui/components/button/button";
|
|
15
|
+
export * from "./ui/components/button/choose_button";
|
|
16
|
+
export * from "./ui/components/button/icon_button";
|
|
17
|
+
export * from "./ui/components/button/toggle_button";
|
|
18
|
+
export * from "./ui/components/layout/flex";
|
|
19
|
+
export * from "./ui/components/layout/scaffold";
|
|
20
|
+
export * from "./ui/components/layout/scroll";
|
|
21
|
+
export * from "./ui/components/layout/spaced";
|
|
22
|
+
export * from "./ui/components/input/checkbox";
|
|
23
|
+
export * from "./ui/components/input/input_field";
|
|
24
|
+
export * from "./ui/components/input/range";
|
|
25
|
+
export * from "./ui/components/input/select";
|
|
26
|
+
export * from "./ui/components/input/text_area";
|
|
27
|
+
export * from "./ui/components/badge";
|
|
28
|
+
export * from "./ui/components/dialog";
|
|
29
|
+
export * from "./ui/components/error_view";
|
|
30
|
+
export * from "./ui/components/spinner";
|
|
31
|
+
export * from "./ui/components/text";
|
|
32
|
+
export * from "./ui/theme/theme";
|
|
62
33
|
function None({}) {
|
|
63
|
-
return (
|
|
34
|
+
return _jsx("div", { style: { width: "1.5rem", height: "1.5rem" } });
|
|
64
35
|
}
|
|
65
|
-
|
|
36
|
+
export const Icons = Object.assign(Object.assign({}, Lucide.icons), { None });
|
package/dist/service/s_api.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
5
10
|
const _noArgs = {};
|
|
6
11
|
/**
|
|
7
12
|
* ApiService is a simple wrapper around fetch that handles JSON serialization and error handling.
|
|
8
13
|
* to use it, you must first call `ApiService.init(apiURL)` with the base URL of your API.
|
|
9
14
|
*/
|
|
10
|
-
class ApiService {
|
|
11
|
-
apiURL;
|
|
12
|
-
static _i = null;
|
|
15
|
+
export class ApiService {
|
|
13
16
|
static get i() {
|
|
14
17
|
if (!ApiService._i)
|
|
15
18
|
throw "ApiService not initialized. Call ApiService.init(apiURL)";
|
|
@@ -23,66 +26,76 @@ class ApiService {
|
|
|
23
26
|
throw "ApiService already initialized";
|
|
24
27
|
ApiService._i = new ApiService(apiURL);
|
|
25
28
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
29
|
+
_fetch(p_1, method_1, _a) {
|
|
30
|
+
return __awaiter(this, arguments, void 0, function* (p, method, { path, query, body }) {
|
|
31
|
+
var _b;
|
|
32
|
+
try {
|
|
33
|
+
p = path
|
|
34
|
+
? p.replace(/:([a-zA-Z0-9_]+)/g, (m, p1) => {
|
|
35
|
+
var _a;
|
|
36
|
+
const v = path[p1];
|
|
37
|
+
if (v === undefined)
|
|
38
|
+
throw { code: 400, message: `missing parameter ${p1}` };
|
|
39
|
+
return (_a = v === null || v === void 0 ? void 0 : v.toString()) !== null && _a !== void 0 ? _a : "";
|
|
40
|
+
})
|
|
41
|
+
: p;
|
|
42
|
+
const queryStr = query != null ? "?" + new URLSearchParams(query).toString() : "";
|
|
43
|
+
const response = yield fetch(this.apiURL + p + queryStr, {
|
|
44
|
+
method,
|
|
45
|
+
credentials: "include",
|
|
46
|
+
headers: { "Content-Type": "application/json" },
|
|
47
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
48
|
+
});
|
|
49
|
+
if (response.ok) {
|
|
50
|
+
try {
|
|
51
|
+
return yield response.json();
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
let data = null;
|
|
44
58
|
try {
|
|
45
|
-
|
|
59
|
+
data = yield response.clone().json();
|
|
46
60
|
}
|
|
47
61
|
catch (e) {
|
|
48
|
-
|
|
62
|
+
data = yield response.text();
|
|
49
63
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
64
|
+
throw {
|
|
65
|
+
code: response.status,
|
|
66
|
+
message: (_b = data.message) !== null && _b !== void 0 ? _b : "undefined error",
|
|
67
|
+
data,
|
|
68
|
+
};
|
|
54
69
|
}
|
|
55
70
|
catch (e) {
|
|
56
|
-
|
|
71
|
+
rethrow(e, 0, "unknown error");
|
|
57
72
|
}
|
|
58
|
-
|
|
59
|
-
code: response.status,
|
|
60
|
-
message: data.message ?? "undefined error",
|
|
61
|
-
data,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
catch (e) {
|
|
65
|
-
rethrow(e, 0, "unknown error");
|
|
66
|
-
}
|
|
73
|
+
});
|
|
67
74
|
}
|
|
68
|
-
|
|
69
|
-
return this
|
|
75
|
+
get(path, args) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
return this._fetch(path, "GET", args || _noArgs);
|
|
78
|
+
});
|
|
70
79
|
}
|
|
71
|
-
|
|
72
|
-
return this
|
|
80
|
+
post(path, args) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
return this._fetch(path, "POST", args || _noArgs);
|
|
83
|
+
});
|
|
73
84
|
}
|
|
74
|
-
|
|
75
|
-
return this
|
|
85
|
+
delete(path, args) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
return this._fetch(path, "DELETE", args || _noArgs);
|
|
88
|
+
});
|
|
76
89
|
}
|
|
77
90
|
}
|
|
78
|
-
|
|
91
|
+
ApiService._i = null;
|
|
79
92
|
function rethrow(e, code, message) {
|
|
80
93
|
// if e implements the apiError interface, rethrow it:
|
|
81
94
|
if (e && e.code !== null && e.message !== null)
|
|
82
95
|
throw e;
|
|
83
96
|
throw { code, message, data: e };
|
|
84
97
|
}
|
|
85
|
-
function ifApiError(e) {
|
|
98
|
+
export function ifApiError(e) {
|
|
86
99
|
if (e && e.code !== null && e.message !== null)
|
|
87
100
|
return e;
|
|
88
101
|
return null;
|
|
@@ -1,53 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Badge = void 0;
|
|
7
|
-
exports.TestBadge = TestBadge;
|
|
8
|
-
const jsx_runtime_1 = require("preact/jsx-runtime");
|
|
9
|
-
const compat_1 = __importDefault(require("preact/compat"));
|
|
10
|
-
function TestBadge(p) {
|
|
11
|
-
return new Badge({ ...p, kind: "accent" });
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import React from "preact/compat";
|
|
3
|
+
export function TestBadge(p) {
|
|
4
|
+
return new Badge(Object.assign(Object.assign({}, p), { kind: "accent" }));
|
|
12
5
|
}
|
|
13
|
-
class Badge extends
|
|
6
|
+
export class Badge extends React.Component {
|
|
14
7
|
constructor(props) {
|
|
15
8
|
super(props);
|
|
16
9
|
}
|
|
17
10
|
static accent(p) {
|
|
18
|
-
return (
|
|
11
|
+
return _jsx(Badge, Object.assign({}, p, { kind: "accent" }));
|
|
19
12
|
}
|
|
20
13
|
static error(p) {
|
|
21
|
-
return (
|
|
14
|
+
return _jsx(Badge, Object.assign({}, p, { kind: "error" }));
|
|
22
15
|
}
|
|
23
16
|
static warning(p) {
|
|
24
|
-
return (
|
|
17
|
+
return _jsx(Badge, Object.assign({}, p, { kind: "warning" }));
|
|
25
18
|
}
|
|
26
19
|
static success(p) {
|
|
27
|
-
return (
|
|
20
|
+
return _jsx(Badge, Object.assign({}, p, { kind: "success" }));
|
|
28
21
|
}
|
|
29
22
|
static info(p) {
|
|
30
|
-
return (
|
|
23
|
+
return _jsx(Badge, Object.assign({}, p, { kind: "info" }));
|
|
31
24
|
}
|
|
32
25
|
render() {
|
|
33
|
-
|
|
26
|
+
var _a, _b;
|
|
27
|
+
return (_jsxs("div", { style: {
|
|
34
28
|
position: "relative",
|
|
35
29
|
display: "inline-block",
|
|
36
|
-
}, children: [this.props.child, this.props.children, (
|
|
37
|
-
position: "absolute",
|
|
38
|
-
top: "-0.25rem",
|
|
39
|
-
right: "-0.25rem",
|
|
40
|
-
minWidth: "1.5rem",
|
|
41
|
-
minHeight: "1.5rem",
|
|
42
|
-
padding: "0rem .4rem",
|
|
43
|
-
borderRadius: "3rem",
|
|
44
|
-
fontWeight: "bold",
|
|
45
|
-
display: "flex",
|
|
46
|
-
justifyContent: "center",
|
|
47
|
-
alignItems: "center",
|
|
48
|
-
visibility: this.props.hidden ? "hidden" : "visible",
|
|
49
|
-
...this.props.style,
|
|
50
|
-
}, children: this.props.label ?? this.props.count })] }));
|
|
30
|
+
}, children: [this.props.child, this.props.children, _jsx("div", { class: `b ${this.props.kind} major ${(_a = this.props.class) !== null && _a !== void 0 ? _a : ""}`, style: Object.assign({ position: "absolute", top: "-0.25rem", right: "-0.25rem", minWidth: "1.5rem", minHeight: "1.5rem", padding: "0rem .4rem", borderRadius: "3rem", fontWeight: "bold", display: "flex", justifyContent: "center", alignItems: "center", visibility: this.props.hidden ? "hidden" : "visible" }, this.props.style), children: (_b = this.props.label) !== null && _b !== void 0 ? _b : this.props.count })] }));
|
|
51
31
|
}
|
|
52
32
|
}
|
|
53
|
-
exports.Badge = Badge;
|