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.
Files changed (38) hide show
  1. package/dist/bit/bit.js +22 -25
  2. package/dist/bit/ctrl_bit.js +47 -28
  3. package/dist/elbe.css +58 -18
  4. package/dist/elbe.css.map +1 -1
  5. package/dist/index.js +33 -62
  6. package/dist/service/s_api.js +62 -49
  7. package/dist/ui/components/badge.js +13 -34
  8. package/dist/ui/components/base/box.js +21 -23
  9. package/dist/ui/components/base/card.js +19 -10
  10. package/dist/ui/components/base/padded.js +25 -16
  11. package/dist/ui/components/button/button.js +30 -22
  12. package/dist/ui/components/button/choose_button.js +7 -10
  13. package/dist/ui/components/button/icon_button.js +36 -26
  14. package/dist/ui/components/button/toggle_button.js +19 -10
  15. package/dist/ui/components/dialog.js +7 -10
  16. package/dist/ui/components/error_view.js +14 -16
  17. package/dist/ui/components/input/checkbox.js +17 -8
  18. package/dist/ui/components/input/input_field.js +28 -23
  19. package/dist/ui/components/input/range.js +26 -9
  20. package/dist/ui/components/input/select.js +16 -7
  21. package/dist/ui/components/input/text_area.js +17 -8
  22. package/dist/ui/components/layout/flex.js +24 -16
  23. package/dist/ui/components/layout/scaffold.d.ts +4 -3
  24. package/dist/ui/components/layout/scaffold.js +28 -18
  25. package/dist/ui/components/layout/scroll.js +10 -14
  26. package/dist/ui/components/layout/spaced.js +3 -6
  27. package/dist/ui/components/spinner.js +16 -19
  28. package/dist/ui/components/text.js +42 -37
  29. package/dist/ui/theme/color_theme.js +36 -42
  30. package/dist/ui/theme/colors.js +40 -77
  31. package/dist/ui/theme/geometry_theme.js +8 -16
  32. package/dist/ui/theme/theme.js +12 -34
  33. package/dist/ui/theme/type_theme.js +11 -39
  34. package/dist/ui/util/confirm_dialog.js +1 -4
  35. package/dist/ui/util/error_view.js +4 -7
  36. package/dist/ui/util/toast.js +1 -4
  37. package/dist/ui/util/util.js +8 -13
  38. package/package.json +3 -2
@@ -1,12 +1,9 @@
1
- "use strict";
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.RGBAColor = exports.cLayers = exports.cStates = exports.cManners = exports.cKinds = exports.cSchemes = exports.cModes = void 0;
4
- const colors_convert_1 = require("colors-convert");
5
- const util_1 = require("../util/util");
6
- const color_theme_1 = require("./color_theme");
7
- exports.cModes = ["light", "dark"];
8
- exports.cSchemes = ["primary", "secondary", "inverse"];
9
- exports.cKinds = [
1
+ import { hslToRgb, rgbToHsl } from "colors-convert";
2
+ import { clamp } from "../util/util";
3
+ import { colorThemePreset } from "./color_theme";
4
+ export const cModes = ["light", "dark"];
5
+ export const cSchemes = ["primary", "secondary", "inverse"];
6
+ export const cKinds = [
10
7
  "plain",
11
8
  "accent",
12
9
  "info",
@@ -14,14 +11,10 @@ exports.cKinds = [
14
11
  "warning",
15
12
  "error",
16
13
  ];
17
- exports.cManners = ["major", "minor", "flat", "plain"];
18
- exports.cStates = ["neutral", "hover", "active", "disabled"];
19
- exports.cLayers = ["back", "front", "border"];
20
- class RGBAColor {
21
- r;
22
- g;
23
- b;
24
- a;
14
+ export const cManners = ["major", "minor", "flat", "plain"];
15
+ export const cStates = ["neutral", "hover", "active", "disabled"];
16
+ export const cLayers = ["back", "front", "border"];
17
+ export class RGBAColor {
25
18
  constructor(r, g, b, a) {
26
19
  this.r = r;
27
20
  this.g = g;
@@ -66,14 +59,9 @@ class RGBAColor {
66
59
  return new RGBAColor(this.r + (other.r - this.r) * factor, this.g + (other.g - this.g) * factor, this.b + (other.b - this.b) * factor, this.a + (other.a - this.a) * factor);
67
60
  }
68
61
  mirrorBrightness(factor = 1) {
69
- const hsl = (0, colors_convert_1.rgbToHsl)({ r: this.r, g: this.g, b: this.b });
62
+ const hsl = rgbToHsl({ r: this.r, g: this.g, b: this.b });
70
63
  const newL = (50 - hsl.l) * (factor * 2 - 1) + 50;
71
- const rgb = (0, colors_convert_1.hslToRgb)({
72
- ...hsl,
73
- l: (0, util_1.clamp)(newL, 0, 100),
74
- s: (0, util_1.clamp)(hsl.s, 0, 100),
75
- //s: -Math.abs(2 * newL - 100) + 100,
76
- });
64
+ const rgb = hslToRgb(Object.assign(Object.assign({}, hsl), { l: clamp(newL, 0, 100), s: clamp(hsl.s, 0, 100) }));
77
65
  return new RGBAColor(rgb.r, rgb.g, rgb.b, this.a);
78
66
  }
79
67
  get values() {
@@ -88,8 +76,7 @@ class RGBAColor {
88
76
  return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
89
77
  }
90
78
  }
91
- exports.RGBAColor = RGBAColor;
92
- exports.colors = {
79
+ export const colors = {
93
80
  transparent: new RGBAColor(0, 0, 0, 0),
94
81
  white: new RGBAColor(255, 255, 255, 1),
95
82
  black: new RGBAColor(0, 0, 0, 1),
@@ -99,56 +86,53 @@ exports.colors = {
99
86
  yellow: new RGBAColor(240, 221, 21, 1),
100
87
  red: new RGBAColor(243, 67, 67, 1),
101
88
  };
102
- class LayerColor extends RGBAColor {
103
- back;
104
- border;
105
- borderContext;
106
- front;
89
+ export class LayerColor extends RGBAColor {
107
90
  constructor(back, front, border, borderContext) {
108
91
  super(back.r, back.g, back.b, back.a);
109
92
  this.back = back;
110
93
  this.border = border;
111
94
  this.borderContext = borderContext;
112
- this.front = front ?? (back.isDark ? exports.colors.white : exports.colors.black);
95
+ this.front = front !== null && front !== void 0 ? front : (back.isDark ? colors.white : colors.black);
113
96
  }
114
97
  asCss() {
98
+ var _a, _b;
115
99
  return (`background-color: ${this.back.asCss()};\n` +
116
100
  `color: ${this.front.asCss()};\n` +
117
- `border-color: ${this.border?.asCss() ?? "transparent"};\n` +
101
+ `border-color: ${(_b = (_a = this.border) === null || _a === void 0 ? void 0 : _a.asCss()) !== null && _b !== void 0 ? _b : "transparent"};\n` +
118
102
  //`border-color: ${this.border?.asCss() ?? "transparent"};\n` +
119
103
  this.contextCss());
120
104
  }
121
105
  inter(other, factor) {
122
- return new LayerColor(this.back.inter(other.back, factor), this.front.inter(other.front, factor), this.border?.inter(other.border ?? exports.colors.transparent, factor), this.borderContext?.inter(other.borderContext ?? exports.colors.transparent, factor));
106
+ var _a, _b, _c, _d;
107
+ return new LayerColor(this.back.inter(other.back, factor), this.front.inter(other.front, factor), (_a = this.border) === null || _a === void 0 ? void 0 : _a.inter((_b = other.border) !== null && _b !== void 0 ? _b : colors.transparent, factor), (_c = this.borderContext) === null || _c === void 0 ? void 0 : _c.inter((_d = other.borderContext) !== null && _d !== void 0 ? _d : colors.transparent, factor));
123
108
  }
124
109
  mirrorBrightness(factor) {
125
- return new LayerColor(this.back.mirrorBrightness(factor), this.front.mirrorBrightness(factor), this.border?.mirrorBrightness(factor), this.borderContext?.mirrorBrightness(factor));
110
+ var _a, _b;
111
+ return new LayerColor(this.back.mirrorBrightness(factor), this.front.mirrorBrightness(factor), (_a = this.border) === null || _a === void 0 ? void 0 : _a.mirrorBrightness(factor), (_b = this.borderContext) === null || _b === void 0 ? void 0 : _b.mirrorBrightness(factor));
126
112
  }
127
113
  desaturated() {
128
- return new LayerColor(this.back.desaturated(), this.front.desaturated(), this.border?.desaturated(), this.borderContext?.desaturated());
114
+ var _a, _b;
115
+ return new LayerColor(this.back.desaturated(), this.front.desaturated(), (_a = this.border) === null || _a === void 0 ? void 0 : _a.desaturated(), (_b = this.borderContext) === null || _b === void 0 ? void 0 : _b.desaturated());
129
116
  }
130
117
  static fromHex(back, front, border) {
131
118
  if (front === undefined && border === undefined) {
132
119
  return LayerColor.fromBack(RGBAColor.fromHex(back));
133
120
  }
134
- return new LayerColor(RGBAColor.fromHex(back), RGBAColor.fromHex(front ?? null), RGBAColor.fromHex(border ?? null));
121
+ return new LayerColor(RGBAColor.fromHex(back), RGBAColor.fromHex(front !== null && front !== void 0 ? front : null), RGBAColor.fromHex(border !== null && border !== void 0 ? border : null));
135
122
  }
136
123
  static fromBack(back, c) {
137
- const front = back.isDark ? exports.colors.white : exports.colors.black;
138
- return new LayerColor(back, c?.front ?? front, c?.border ?? front);
124
+ var _a, _b;
125
+ const front = back.isDark ? colors.white : colors.black;
126
+ return new LayerColor(back, (_a = c === null || c === void 0 ? void 0 : c.front) !== null && _a !== void 0 ? _a : front, (_b = c === null || c === void 0 ? void 0 : c.border) !== null && _b !== void 0 ? _b : front);
139
127
  }
140
128
  contextCss() {
129
+ var _a, _b, _c;
141
130
  return (`--c-context-back: ${this.back.asCss()};\n` +
142
131
  `--c-context-front: ${this.front.asCss()};` +
143
- `--c-context-border: ${(this.borderContext ?? this.border)?.asCss() ?? "transparent"};`);
132
+ `--c-context-border: ${(_c = (_b = ((_a = this.borderContext) !== null && _a !== void 0 ? _a : this.border)) === null || _b === void 0 ? void 0 : _b.asCss()) !== null && _c !== void 0 ? _c : "transparent"};`);
144
133
  }
145
134
  }
146
- exports.LayerColor = LayerColor;
147
- class StateColor extends LayerColor {
148
- neutral;
149
- hover;
150
- active;
151
- disabled;
135
+ export class StateColor extends LayerColor {
152
136
  constructor(neutral, hover, active, disabled) {
153
137
  super(neutral.back, neutral.front, neutral.border);
154
138
  this.neutral = neutral;
@@ -182,21 +166,18 @@ class StateColor extends LayerColor {
182
166
  return new StateColor(style, _make(0.075), _make(0.25), style.desaturated());
183
167
  }
184
168
  }
185
- exports.StateColor = StateColor;
186
- class MannerColor extends StateColor {
187
- major;
188
- minor;
189
- flat;
169
+ export class MannerColor extends StateColor {
190
170
  constructor(major, minor, flat) {
191
- const m = major ?? flat;
171
+ const m = major !== null && major !== void 0 ? major : flat;
192
172
  super(m.neutral, m.hover, m.active, m.disabled);
193
173
  this.major = major;
194
174
  this.minor = minor;
195
175
  this.flat = flat;
196
176
  }
197
177
  asCss(fallback) {
198
- const maj = this.major ?? fallback?.major;
199
- const min = this.minor ?? fallback?.minor;
178
+ var _a, _b;
179
+ const maj = (_a = this.major) !== null && _a !== void 0 ? _a : fallback === null || fallback === void 0 ? void 0 : fallback.major;
180
+ const min = (_b = this.minor) !== null && _b !== void 0 ? _b : fallback === null || fallback === void 0 ? void 0 : fallback.minor;
200
181
  return (`${this.flat.asCss()}\n` +
201
182
  (maj ? `&.major { ${maj.asCss()} } \n` : "") +
202
183
  (min ? `&.minor { ${min.asCss()} } \n` : "") +
@@ -222,14 +203,7 @@ class MannerColor extends StateColor {
222
203
  */
223
204
  }
224
205
  }
225
- exports.MannerColor = MannerColor;
226
- class KindColor extends MannerColor {
227
- plain;
228
- accent;
229
- info;
230
- success;
231
- warning;
232
- error;
206
+ export class KindColor extends MannerColor {
233
207
  constructor(plain, accent, info, success, warning, error) {
234
208
  super(plain.major, plain.minor, plain.flat);
235
209
  this.plain = plain;
@@ -253,11 +227,7 @@ class KindColor extends MannerColor {
253
227
  return new KindColor(MannerColor.generate(s, c), MannerColor.generate(s, c, s.style.accent(s, c, s.accent)), MannerColor.generate(s, c, s.style.info(s, c, s.info)), MannerColor.generate(s, c, s.style.success(s, c, s.success)), MannerColor.generate(s, c, s.style.warning(s, c, s.warning)), MannerColor.generate(s, c, s.style.error(s, c, s.error)));
254
228
  }
255
229
  }
256
- exports.KindColor = KindColor;
257
- class SchemeColor extends KindColor {
258
- primary;
259
- secondary;
260
- inverse;
230
+ export class SchemeColor extends KindColor {
261
231
  constructor(primary, secondary, inverse) {
262
232
  super(primary.plain, primary.accent, primary.info, primary.success, primary.warning, primary.error);
263
233
  this.primary = primary;
@@ -275,10 +245,7 @@ class SchemeColor extends KindColor {
275
245
  return new SchemeColor(KindColor.generate(seed, m.primary(seed, c)), KindColor.generate(seed, m.secondary(seed, c)), KindColor.generate(seed, m.inverse(seed, c)));
276
246
  }
277
247
  }
278
- exports.SchemeColor = SchemeColor;
279
- class ModeColor extends SchemeColor {
280
- light;
281
- dark;
248
+ export class ModeColor extends SchemeColor {
282
249
  constructor(light, dark) {
283
250
  super(light.primary, light.secondary, light.inverse);
284
251
  this.light = light;
@@ -291,10 +258,7 @@ class ModeColor extends SchemeColor {
291
258
  return new ModeColor(SchemeColor.generate(seed, seed.base), SchemeColor.generate(seed, seed.mode.dark(seed, seed.base)));
292
259
  }
293
260
  }
294
- exports.ModeColor = ModeColor;
295
- class ColorTheme {
296
- colors;
297
- color;
261
+ export class ColorTheme {
298
262
  constructor(colors, color) {
299
263
  this.colors = colors;
300
264
  this.color = color;
@@ -310,9 +274,8 @@ class ColorTheme {
310
274
  this.color.asCss());
311
275
  }
312
276
  static generate(seed) {
313
- const s = (0, color_theme_1.colorThemePreset)(seed);
277
+ const s = colorThemePreset(seed);
314
278
  return new ColorTheme(s, ModeColor.generate(s));
315
279
  }
316
280
  }
317
- exports.ColorTheme = ColorTheme;
318
281
  //Bun.write("./example.css", ColorTheme.generate().asCss());
@@ -1,12 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GeometryTheme = void 0;
4
- exports.geometryThemePreset = geometryThemePreset;
5
- class GeometryTheme {
6
- size;
7
- radius;
8
- padding;
9
- borderWidth;
1
+ export class GeometryTheme {
10
2
  constructor(size, radius, padding, borderWidth) {
11
3
  this.size = size;
12
4
  this.radius = radius;
@@ -26,13 +18,13 @@ class GeometryTheme {
26
18
  return new GeometryTheme(s.size, s.radius, s.padding, s.borderWidth);
27
19
  }
28
20
  }
29
- exports.GeometryTheme = GeometryTheme;
30
- function geometryThemePreset(merge) {
31
- const seed = merge ?? {};
21
+ export function geometryThemePreset(merge) {
22
+ var _a, _b, _c, _d;
23
+ const seed = merge !== null && merge !== void 0 ? merge : {};
32
24
  return {
33
- size: seed.size ?? 16,
34
- radius: seed.radius ?? 0.75,
35
- padding: seed.padding ?? 1,
36
- borderWidth: seed.borderWidth ?? 0.125,
25
+ size: (_a = seed.size) !== null && _a !== void 0 ? _a : 16,
26
+ radius: (_b = seed.radius) !== null && _b !== void 0 ? _b : 0.75,
27
+ padding: (_c = seed.padding) !== null && _c !== void 0 ? _c : 1,
28
+ borderWidth: (_d = seed.borderWidth) !== null && _d !== void 0 ? _d : 0.125,
37
29
  };
38
30
  }
@@ -1,33 +1,12 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.ElbeThemeData = void 0;
18
- exports.ElbeTheme = ElbeTheme;
19
- const jsx_runtime_1 = require("preact/jsx-runtime");
20
- const colors_1 = require("./colors");
21
- const geometry_theme_1 = require("./geometry_theme");
22
- const type_theme_1 = require("./type_theme");
23
- __exportStar(require("./color_theme"), exports);
24
- __exportStar(require("./colors"), exports);
25
- __exportStar(require("./geometry_theme"), exports);
26
- __exportStar(require("./type_theme"), exports);
27
- class ElbeThemeData {
28
- color;
29
- type;
30
- geometry;
1
+ import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
2
+ import { ColorTheme } from "./colors";
3
+ import { GeometryTheme } from "./geometry_theme";
4
+ import { TypeTheme } from "./type_theme";
5
+ export * from "./color_theme";
6
+ export * from "./colors";
7
+ export * from "./geometry_theme";
8
+ export * from "./type_theme";
9
+ export class ElbeThemeData {
31
10
  constructor(color, type, geometry) {
32
11
  this.color = color;
33
12
  this.type = type;
@@ -39,11 +18,10 @@ class ElbeThemeData {
39
18
  .join("\n");
40
19
  }
41
20
  static fromSeed(seed) {
42
- return new ElbeThemeData(colors_1.ColorTheme.generate(seed.color), type_theme_1.TypeTheme.generate(seed.type), geometry_theme_1.GeometryTheme.generate(seed.geometry));
21
+ return new ElbeThemeData(ColorTheme.generate(seed.color), TypeTheme.generate(seed.type), GeometryTheme.generate(seed.geometry));
43
22
  }
44
23
  }
45
- exports.ElbeThemeData = ElbeThemeData;
46
- function ElbeTheme(p) {
24
+ export function ElbeTheme(p) {
47
25
  const theme = "seed" in p ? ElbeThemeData.fromSeed(p.seed) : p.theme;
48
- return ((0, jsx_runtime_1.jsxs)("div", { class: `elbe ${p.dark ? "dark" : ""}`, children: [(0, jsx_runtime_1.jsx)("style", { children: theme.asCss() }), p.children] }));
26
+ return (_jsxs("div", { class: `elbe ${p.dark ? "dark" : ""}`, children: [_jsx("style", { children: theme.asCss() }), p.children] }));
49
27
  }
@@ -1,8 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TypeTheme = exports.tVariants = void 0;
4
- exports.typeThemePreset = typeThemePreset;
5
- exports.tVariants = [
1
+ export const tVariants = [
6
2
  "h1",
7
3
  "h2",
8
4
  "h3",
@@ -21,17 +17,7 @@ function _typeStyleAsCss(t) {
21
17
  `font-style: ${t.italic ? "italic" : "normal"};\n` +
22
18
  `text-decoration: ${t.underline ? "underline" : "none"};\n`);
23
19
  }
24
- class TypeTheme {
25
- h1;
26
- h2;
27
- h3;
28
- h4;
29
- h5;
30
- h6;
31
- bodyL;
32
- body;
33
- bodyS;
34
- code;
20
+ export class TypeTheme {
35
21
  constructor(h1, h2, h3, h4, h5, h6, bodyL, body, bodyS, code) {
36
22
  this.h1 = h1;
37
23
  this.h2 = h2;
@@ -61,38 +47,24 @@ class TypeTheme {
61
47
  return new TypeTheme(s.heading, s.headingVariants(s.heading, 2), s.headingVariants(s.heading, 3), s.headingVariants(s.heading, 4), s.headingVariants(s.heading, 5), s.headingVariants(s.heading, 6), s.bodyVariants(s.body, "l"), s.body, s.bodyVariants(s.body, "s"), s.code);
62
48
  }
63
49
  }
64
- exports.TypeTheme = TypeTheme;
65
- function typeThemePreset(merge) {
66
- return {
67
- heading: {
50
+ export function typeThemePreset(merge) {
51
+ return Object.assign({ heading: {
68
52
  bold: true,
69
53
  family: ["Calistoga", "Arial", "sans-serif"],
70
54
  size: 2.2,
71
- },
72
- body: {
55
+ }, body: {
73
56
  bold: false,
74
57
  family: ["Helvetica", "Arial", "sans-serif"],
75
58
  size: 1,
76
- },
77
- code: {
59
+ }, code: {
78
60
  bold: false,
79
61
  family: ["Courier", "monospace"],
80
62
  size: 1,
81
- },
82
- headingVariants: (style, variant) => {
63
+ }, headingVariants: (style, variant) => {
83
64
  const size = style.size * (1 - (variant - 1) * 0.1);
84
- return {
85
- ...style,
86
- size,
87
- };
88
- },
89
- bodyVariants: (style, variant) => {
65
+ return Object.assign(Object.assign({}, style), { size });
66
+ }, bodyVariants: (style, variant) => {
90
67
  const size = style.size * (variant === "s" ? 0.8 : 1.2);
91
- return {
92
- ...style,
93
- size,
94
- };
95
- },
96
- ...merge,
97
- };
68
+ return Object.assign(Object.assign({}, style), { size });
69
+ } }, merge);
98
70
  }
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.showConfirmDialog = showConfirmDialog;
4
1
  /**
5
2
  * show a simple confirm dialog
6
3
  * @param param0 the title and message of the dialog
7
4
  * @returns a promise that resolves to true if the user clicks "yes" or "okay" and false if the user clicks "no"
8
5
  */
9
- function showConfirmDialog({ title, message, okay = false, }) {
6
+ export function showConfirmDialog({ title, message, okay = false, }) {
10
7
  return new Promise((resolve, reject) => {
11
8
  const dialog = document.createElement("div");
12
9
  dialog.classList.add("dialog");
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._ElbeErr = _ElbeErr;
4
- const jsx_runtime_1 = require("preact/jsx-runtime");
5
- const __1 = require("../..");
6
- function _ElbeErr(msg) {
7
- return ((0, jsx_runtime_1.jsxs)("div", { class: "row text-s gap-half", style: "background: #ee0044; color: white; border-radius: 4px; text-align: left; padding: .5rem", children: [(0, jsx_runtime_1.jsx)(__1.Icons.CircleX, {}), (0, jsx_runtime_1.jsxs)("div", { class: "column gap-none cross-stretch", children: [(0, jsx_runtime_1.jsx)("b", { class: "text-s", children: "elbe error" }), (0, jsx_runtime_1.jsx)("span", { style: "margin-top: -.125rem", children: msg })] })] }));
1
+ import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
2
+ import { Icons } from "../..";
3
+ export function _ElbeErr(msg) {
4
+ return (_jsxs("div", { class: "row text-s gap-half", style: "background: #ee0044; color: white; border-radius: 4px; text-align: left; padding: .5rem", children: [_jsx(Icons.CircleX, {}), _jsxs("div", { class: "column gap-none cross-stretch", children: [_jsx("b", { class: "text-s", children: "elbe error" }), _jsx("span", { style: "margin-top: -.125rem", children: msg })] })] }));
8
5
  }
@@ -1,11 +1,8 @@
1
- "use strict";
2
1
  /**
3
2
  * show a toast message at the bottom of the screen
4
3
  * @param message the message to show
5
4
  */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.showToast = showToast;
8
- function showToast(message) {
5
+ export function showToast(message) {
9
6
  const toast = document.createElement("div");
10
7
  toast.classList.add("toast");
11
8
  toast.classList.add("inverse");
@@ -1,11 +1,5 @@
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) {
1
+ import { showToast } from "./toast";
2
+ export function clamp(value, min, max) {
9
3
  return Math.min(Math.max(value, min), max);
10
4
  }
11
5
  /**
@@ -13,8 +7,9 @@ function clamp(value, min, max) {
13
7
  * @param data the data you want to share
14
8
  * @param toastMsg the message to show in the toast if the share api is not available
15
9
  */
16
- function share(data, toastMsg = "copied to clipboard. Share it with others.") {
17
- const msg = `${data.title}\n${data.text ?? ""}\n\n${data.url}`;
10
+ export function share(data, toastMsg = "copied to clipboard. Share it with others.") {
11
+ var _a;
12
+ const msg = `${data.title}\n${(_a = data.text) !== null && _a !== void 0 ? _a : ""}\n\n${data.url}`;
18
13
  if (navigator.share) {
19
14
  navigator.share(data).catch(() => copyToClipboard(msg, toastMsg));
20
15
  }
@@ -27,12 +22,12 @@ function share(data, toastMsg = "copied to clipboard. Share it with others.") {
27
22
  * @param text the text to copy to the clipboard
28
23
  * @param toastMsg the message to show in the toast
29
24
  */
30
- function copyToClipboard(text, toastMsg = "copied to clipboard") {
25
+ export function copyToClipboard(text, toastMsg = "copied to clipboard") {
31
26
  navigator.clipboard.writeText(text);
32
27
  if (toastMsg)
33
- (0, toast_1.showToast)(toastMsg);
28
+ showToast(toastMsg);
34
29
  }
35
- function scrollToId(id) {
30
+ export function scrollToId(id) {
36
31
  const el = document.getElementById(id);
37
32
  if (el)
38
33
  el.scrollIntoView({ behavior: "smooth" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elbe-ui",
3
- "version": "0.2.41",
3
+ "version": "0.2.44",
4
4
  "author": "Robin Naumann",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -21,7 +21,8 @@
21
21
  "build:ts": "tsc",
22
22
  "build:dts": "tsc --declaration",
23
23
  "build:css": "sass -q style/elbe.scss dist/elbe.css",
24
- "build": "rm -rf ./dist && bun run build:ts && bun run build:dts && bun run build:css"
24
+ "build": "rm -rf ./dist && bun run build:ts && bun run build:dts && bun run build:css",
25
+ "pub": "bun run build && npm publish"
25
26
  },
26
27
  "devDependencies": {
27
28
  "@types/bun": "latest",