@nebularstreams/libmui 2.5.48 → 2.5.49

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nebularstreams/libmui",
3
3
  "description": "Micro UI based on Mithril",
4
- "version": "2.5.48",
4
+ "version": "2.5.49",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "scripts": {
package/src/index.js CHANGED
@@ -25,6 +25,7 @@ import clone from "./util/util.clone"
25
25
  import Tokenizer from "./util/util.tokenizer"
26
26
  import {CoolContentTicker, CoolGenericTicker, GenericButtonTicker, optionsPrompt} from "./widgets/CoolContentTicker";
27
27
  import EmptyButton from "./widgets/EmptyButton";
28
+ import CoolerEmpty from "./widgets/CoolerEmpty";
28
29
  import tainter from "./util/tainter"
29
30
 
30
31
  import MainState, {implement} from "./app/MainState";
@@ -56,6 +57,7 @@ export {
56
57
  ColorJoePack,
57
58
  ComboPrompt,
58
59
  ComboWidget,
60
+ CoolerEmpty,
59
61
  Empty,
60
62
  EmptyButton,
61
63
  Icon,
@@ -20,8 +20,6 @@ const
20
20
  const item = items[index];
21
21
 
22
22
  confirmPromise(
23
- null,
24
-
25
23
  "Choose an action for this preset",
26
24
 
27
25
  onAdd && allowUpdate
@@ -0,0 +1,37 @@
1
+ import m from "mithril"
2
+ import {defineWidget, ButtonNew, Empty} from "./Basic.js"
3
+
4
+
5
+ function TRANSLATE(message, arr, def) {
6
+ return arr ? arr[message] || (def || message) : (def || message);
7
+ }
8
+
9
+ const
10
+ CoolerEmpty = {
11
+ oninit: ({attrs}) => {
12
+ attrs.oninit && attrs.oninit()
13
+ },
14
+ view: ({attrs}) => m(Empty, {
15
+ class: attrs.class,
16
+ icon: attrs.icon,
17
+ size: attrs.size || 4
18
+ }, [
19
+ ...attrs.header ? [m("h3.pad-2.marg-0", TRANSLATE(attrs.header, attrs.headers))] : [],
20
+ m(".pad-2", TRANSLATE(attrs.message, attrs.messages)),
21
+ ...attrs.action ? [
22
+ m(ButtonNew, {
23
+ text: attrs.action.caption,
24
+ class: "accentbutton marg-4 marg-v pad-2 font-150",
25
+ onClick: attrs.action.onclick
26
+ })
27
+ ] : [],
28
+ ...attrs.actions
29
+ ? attrs.actions.map((action) => m(ButtonNew, {
30
+ text: action.caption,
31
+ class: "accentbutton marg-4 marg-v pad-2 font-150",
32
+ onClick: action.onclick
33
+ }))
34
+ : []
35
+ ])
36
+ };
37
+ export default CoolerEmpty;