@nebularstreams/libmui 2.5.34 → 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.34",
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
  }
@@ -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;
@@ -927,7 +924,7 @@ const
927
924
 
928
925
  const
929
926
  {
930
- busy, mainState, parameters, auxParameters, cardid, size, index,
927
+ busy, parameters, auxParameters, cardid, size, index,
931
928
  titleWidget, parametersTitle, parametersBody, rootUpdate, global, layer,
932
929
  tableChildren, cols, onLayerReset, onAction, nofold, bodyClass
933
930
  } = attrs;
@@ -957,7 +954,7 @@ const
957
954
  parameters,
958
955
  auxParameters,
959
956
  clone: true,
960
- global, layer, selfState: mainState,
957
+ global, layer,
961
958
  onAction,
962
959
  onchange: (realtime, targetParameters, metaKey, wasDeleted, metaDef) => {
963
960
 
@@ -1005,7 +1002,7 @@ const
1005
1002
  parameters,
1006
1003
  auxParameters,
1007
1004
  clone: true,
1008
- global, selfState: mainState, layer,
1005
+ global, layer,
1009
1006
  index,
1010
1007
  play: attrs.play,
1011
1008
  itemsDict: attrs.itemsDict,
@@ -1056,9 +1053,7 @@ const
1056
1053
 
1057
1054
  TemplatedInputWidget = defineWidget(({attrs, state, children}) => {
1058
1055
 
1059
- const {
1060
- layer, property, colorProperty, selfState
1061
- } = attrs,
1056
+ const {layer, property, colorProperty} = attrs,
1062
1057
  template = InputTemplates[property],
1063
1058
  currentProperty = layer[property],
1064
1059
 
@@ -1101,8 +1096,8 @@ const
1101
1096
  text: title || "--- NONE ---",
1102
1097
  icon: attrs.icon,
1103
1098
  onClick: (e) => {
1104
- if (selfState && !state.chooser && e.shiftKey && template.images) {
1105
- selfState.setTransState("image", undefined, {
1099
+ if (!state.chooser && e.shiftKey && template.images) {
1100
+ MainState.setTransState("image", undefined, {
1106
1101
  giphyQuery: "frame",
1107
1102
  onOverride: (global, item) => {
1108
1103
  const translated = item && template.images(item);
@@ -1126,10 +1121,10 @@ const
1126
1121
  taint();
1127
1122
  m.redraw();
1128
1123
  }
1129
- })] : template.images && selfState && !title ? [m(ButtonNew, {
1124
+ })] : template.images && !title ? [m(ButtonNew, {
1130
1125
  class: "unitsizesmall rectbutton ohidden",
1131
1126
  icon: "images",
1132
- onClick: () => selfState.setTransState("image", undefined, {
1127
+ onClick: () => MainState.setTransState("image", undefined, {
1133
1128
  giphyQuery: "frame",
1134
1129
  onOverride: (global, item) => {
1135
1130
  const translated = item && template.images(item);