@nebularstreams/libmui 2.5.32 → 2.5.35

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.32",
4
+ "version": "2.5.35",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "scripts": {
@@ -0,0 +1,12 @@
1
+ const MAINSTATE = {
2
+ setTransState: () => {
3
+ console.warn("MainState: Not Implemented setTransState")
4
+ }
5
+ }
6
+
7
+ function implement(name, func) {
8
+ Object.assign(MAINSTATE, func);
9
+ }
10
+
11
+ export default MAINSTATE;
12
+ export {implement};
package/src/index.js CHANGED
@@ -27,6 +27,8 @@ import {CoolContentTicker, CoolGenericTicker, GenericButtonTicker, optionsPrompt
27
27
  import EmptyButton from "./widgets/EmptyButton";
28
28
  import tainter from "./util/tainter"
29
29
 
30
+ import * as MainState from "./app/MainState";
31
+
30
32
  import {
31
33
  VideoUploadButton,
32
34
  FileSelectButton,
@@ -100,5 +102,8 @@ export {
100
102
  processImage,
101
103
  popupMessage,
102
104
  startApp,
103
- tainter
105
+ tainter,
106
+
107
+ MainState
108
+
104
109
  }
@@ -20,7 +20,7 @@ function storyOverflow(attrs) {
20
20
  icon
21
21
  } = attrs,
22
22
  source = typeof maybeFunctionItems === "function" ? maybeFunctionItems() : maybeFunctionItems,
23
- items = itemsKey ? typeof itemsKey === "function" ? itemsKey() : source[itemsKey] : source;
23
+ items = itemsKey ? typeof itemsKey === "function" ? itemsKey() : source[itemsKey] || [] : source;
24
24
 
25
25
  return promptOptions(items, onchange, {title, field, icon, textNew, textHint, resolve});
26
26
  }
@@ -1,5 +1,6 @@
1
1
  import m from "mithril";
2
2
  import {defineWidget, ButtonNew} from "./Basic";
3
+ import MainState from "../app/MainState.js"
3
4
 
4
5
  const
5
6
  // TODO
@@ -14,7 +15,7 @@ const
14
15
  icon: "trash",
15
16
  onClick: () => {
16
17
  onchange(undefined);
17
- state.setTransState();
18
+ MainState.setTransState();
18
19
  }
19
20
  })
20
21
  ]
@@ -23,9 +24,9 @@ const
23
24
  class: "grows transp font-125 ohidden",
24
25
  text: fontFamily || "default",
25
26
  icon: "font",
26
- onClick: () => state.setTransState("fontsel", (selected) => {
27
+ onClick: () => MainState.setTransState("fontsel", (selected) => {
27
28
  onchange(selected);
28
- state.setTransState();
29
+ MainState.setTransState();
29
30
  })
30
31
  }),
31
32
 
@@ -9,6 +9,7 @@
9
9
 
10
10
  import m from "mithril";
11
11
  import {defineWidget, Icon, ButtonNew, Notification} from "./Basic";
12
+ import MainState from "../app/MainState.js"
12
13
 
13
14
 
14
15
  function processDataUrl(file) {
@@ -61,7 +62,7 @@ const
61
62
  ({attrs}) => m(ButtonNew, {
62
63
  class: "unitsizesmall rectbutton ohidden",
63
64
  icon: "images",
64
- onClick: () => attrs.state.setTransState("image", undefined, {
65
+ onClick: () => MainState.setTransState("image", undefined, {
65
66
  giphyQuery: "frame",
66
67
  onOverride: (global, item) => {
67
68
  const translated = item ? attrs.parse ? attrs.parse(item) : item : undefined;
@@ -1,5 +1,6 @@
1
1
  import m from "mithril";
2
2
  import {defineWidget, ButtonNew} from "./Basic";
3
+ import MainState from "../app/MainState.js"
3
4
 
4
5
  const
5
6
  SmileysButton = defineWidget(
@@ -10,7 +11,7 @@ const
10
11
  class: "chequered " + (attrs.class || "font-200"),
11
12
  icon: icon && icon.icon,
12
13
  text: icon && icon.glyph,
13
- onClick: () => state.setTransState("emoji", onchange, {icons})
14
+ onClick: () => MainState.setTransState("emoji", onchange, {icons})
14
15
  });
15
16
  }
16
17
  );
@@ -22,6 +22,7 @@ import {confirm} from "../util/fuckingconfirm.js"
22
22
  import {promptName} from "./OverflowUtils.js"
23
23
  import {sanitizeFilename} from "../util/util.tokenizer"
24
24
  import {taint} from "../util/tainter"
25
+ import MainState from "../app/MainState.js"
25
26
 
26
27
  const
27
28
 
@@ -269,7 +270,7 @@ const
269
270
  crit = {}, when = {}, sizes = {},
270
271
  metaKeys = Object.keys(attrs.meta),
271
272
  global,
272
- parameters, auxParameters, clone, onchange, selfState, itemClass, wrapper,
273
+ parameters, auxParameters, clone, onchange, itemClass, wrapper,
273
274
  empty: vacioperovacio,
274
275
  name // new to index a parent
275
276
  } = attrs,
@@ -411,7 +412,6 @@ const
411
412
  global,
412
413
  clone,
413
414
  onchange,
414
- selfState,
415
415
  itemClass,
416
416
  wrapper,
417
417
  empty: vacioperovacio,
@@ -584,7 +584,6 @@ const
584
584
  titleClass: "pad-2 pad-v no-pad-bottom",
585
585
  parameters,
586
586
  auxParameters,
587
- state: selfState,
588
587
  onchange: (value, e) => {
589
588
  if (e && e.shiftKey && attrs.onShiftPress) {
590
589
  attrs.onShiftPress(metaKey, targetParameters, value);
@@ -609,7 +608,6 @@ const
609
608
  class: "grows " + (metaDef.class || "scaff scaff-b1 unitheight font-200"),
610
609
  icon: {glyph: rawValue},
611
610
  icons: false,
612
- state: selfState,
613
611
  onchange: (glyph) => {
614
612
  set(glyph);
615
613
  onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
@@ -620,7 +618,6 @@ const
620
618
  m(FontSelectorButton, {
621
619
  class: "grows " + (metaDef.class || "scaff-right unitheight"),
622
620
  fontFamily: rawValue,
623
- state: selfState,
624
621
  nodelete: metaDef.nodelete,
625
622
  onchange: (glyph) => {
626
623
  if (metaDef.nodelete && !glyph) return;
@@ -883,6 +880,7 @@ const
883
880
  icon: metaDef.icon || attrs.icon,
884
881
  hint: metaDef.title,
885
882
  label: metaDef.label,
883
+ title: metaDef.question,
886
884
  itemsKey: typeof metaDef.optionsKey === "function" ? () => {
887
885
  return metaDef.optionsKey(targetParameters);
888
886
  } : metaDef.optionsKey,
@@ -926,7 +924,7 @@ const
926
924
 
927
925
  const
928
926
  {
929
- busy, mainState, parameters, auxParameters, cardid, size, index,
927
+ busy, parameters, auxParameters, cardid, size, index,
930
928
  titleWidget, parametersTitle, parametersBody, rootUpdate, global, layer,
931
929
  tableChildren, cols, onLayerReset, onAction, nofold, bodyClass
932
930
  } = attrs;
@@ -956,7 +954,7 @@ const
956
954
  parameters,
957
955
  auxParameters,
958
956
  clone: true,
959
- global, layer, selfState: mainState,
957
+ global, layer,
960
958
  onAction,
961
959
  onchange: (realtime, targetParameters, metaKey, wasDeleted, metaDef) => {
962
960
 
@@ -1004,7 +1002,7 @@ const
1004
1002
  parameters,
1005
1003
  auxParameters,
1006
1004
  clone: true,
1007
- global, selfState: mainState, layer,
1005
+ global, layer,
1008
1006
  index,
1009
1007
  play: attrs.play,
1010
1008
  itemsDict: attrs.itemsDict,
@@ -1055,9 +1053,7 @@ const
1055
1053
 
1056
1054
  TemplatedInputWidget = defineWidget(({attrs, state, children}) => {
1057
1055
 
1058
- const {
1059
- layer, property, colorProperty, selfState
1060
- } = attrs,
1056
+ const {layer, property, colorProperty} = attrs,
1061
1057
  template = InputTemplates[property],
1062
1058
  currentProperty = layer[property],
1063
1059
 
@@ -1100,8 +1096,8 @@ const
1100
1096
  text: title || "--- NONE ---",
1101
1097
  icon: attrs.icon,
1102
1098
  onClick: (e) => {
1103
- if (selfState && !state.chooser && e.shiftKey && template.images) {
1104
- selfState.setTransState("image", undefined, {
1099
+ if (!state.chooser && e.shiftKey && template.images) {
1100
+ MainState.setTransState("image", undefined, {
1105
1101
  giphyQuery: "frame",
1106
1102
  onOverride: (global, item) => {
1107
1103
  const translated = item && template.images(item);
@@ -1125,10 +1121,10 @@ const
1125
1121
  taint();
1126
1122
  m.redraw();
1127
1123
  }
1128
- })] : template.images && selfState && !title ? [m(ButtonNew, {
1124
+ })] : template.images && !title ? [m(ButtonNew, {
1129
1125
  class: "unitsizesmall rectbutton ohidden",
1130
1126
  icon: "images",
1131
- onClick: () => selfState.setTransState("image", undefined, {
1127
+ onClick: () => MainState.setTransState("image", undefined, {
1132
1128
  giphyQuery: "frame",
1133
1129
  onOverride: (global, item) => {
1134
1130
  const translated = item && template.images(item);