@nebularstreams/libmui 2.5.34 → 2.5.36

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.36",
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,9 +924,10 @@ 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
- tableChildren, cols, onLayerReset, onAction, nofold, bodyClass
929
+ tableChildren, cols, onLayerReset, onAction, nofold, bodyClass,
930
+ AssetButton
933
931
  } = attrs;
934
932
 
935
933
  return m(CardieWidget, {
@@ -957,7 +955,7 @@ const
957
955
  parameters,
958
956
  auxParameters,
959
957
  clone: true,
960
- global, layer, selfState: mainState,
958
+ global, layer,
961
959
  onAction,
962
960
  onchange: (realtime, targetParameters, metaKey, wasDeleted, metaDef) => {
963
961
 
@@ -1005,7 +1003,7 @@ const
1005
1003
  parameters,
1006
1004
  auxParameters,
1007
1005
  clone: true,
1008
- global, selfState: mainState, layer,
1006
+ global, layer,
1009
1007
  index,
1010
1008
  play: attrs.play,
1011
1009
  itemsDict: attrs.itemsDict,
@@ -1049,16 +1047,16 @@ const
1049
1047
 
1050
1048
  ...(children || [])
1051
1049
  ],
1052
- collapsedView: attrs.collapsedView
1050
+ collapsedView: attrs.collapsedView,
1051
+
1052
+ AssetButton
1053
1053
  });
1054
1054
  }
1055
1055
  ),
1056
1056
 
1057
1057
  TemplatedInputWidget = defineWidget(({attrs, state, children}) => {
1058
1058
 
1059
- const {
1060
- layer, property, colorProperty, selfState
1061
- } = attrs,
1059
+ const {layer, property, colorProperty} = attrs,
1062
1060
  template = InputTemplates[property],
1063
1061
  currentProperty = layer[property],
1064
1062
 
@@ -1101,8 +1099,8 @@ const
1101
1099
  text: title || "--- NONE ---",
1102
1100
  icon: attrs.icon,
1103
1101
  onClick: (e) => {
1104
- if (selfState && !state.chooser && e.shiftKey && template.images) {
1105
- selfState.setTransState("image", undefined, {
1102
+ if (!state.chooser && e.shiftKey && template.images) {
1103
+ MainState.setTransState("image", undefined, {
1106
1104
  giphyQuery: "frame",
1107
1105
  onOverride: (global, item) => {
1108
1106
  const translated = item && template.images(item);
@@ -1126,10 +1124,10 @@ const
1126
1124
  taint();
1127
1125
  m.redraw();
1128
1126
  }
1129
- })] : template.images && selfState && !title ? [m(ButtonNew, {
1127
+ })] : template.images && !title ? [m(ButtonNew, {
1130
1128
  class: "unitsizesmall rectbutton ohidden",
1131
1129
  icon: "images",
1132
- onClick: () => selfState.setTransState("image", undefined, {
1130
+ onClick: () => MainState.setTransState("image", undefined, {
1133
1131
  giphyQuery: "frame",
1134
1132
  onOverride: (global, item) => {
1135
1133
  const translated = item && template.images(item);