@nebularstreams/libmui 3.1.0 → 4.0.0

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 (78) hide show
  1. package/dist/libmui.esm.js +3 -0
  2. package/package.json +6 -2
  3. package/readme.md +48 -0
  4. package/dist/libui.esm.js +0 -3
  5. package/rollup.config.js +0 -20
  6. package/src/app/MainState.js +0 -22
  7. package/src/app/app.js +0 -9
  8. package/src/css/a-measures.css +0 -6
  9. package/src/css/b-colors.css +0 -12
  10. package/src/css/b-root-bootstrap-ext.css +0 -81
  11. package/src/css/b-root-bootstrap.css +0 -178
  12. package/src/css/b-root-semantic-flex.css +0 -87
  13. package/src/css/b-root-semantic-size-new.css +0 -37
  14. package/src/css/b-root-semantic-size.css +0 -75
  15. package/src/css/b-root-semantic-skin.css +0 -48
  16. package/src/css/b-root-semantic.css +0 -111
  17. package/src/css/b-root.css +0 -3
  18. package/src/css/cardie.css +0 -6
  19. package/src/css/flex.css +0 -46
  20. package/src/css/fontawesome/brands.min.css +0 -16
  21. package/src/css/fontawesome/fontawesome-ext.css +0 -7
  22. package/src/css/fontawesome/fontawesome-solid.css +0 -17
  23. package/src/css/fontawesome/fontawesome.css +0 -4359
  24. package/src/css/ui.notifications.css +0 -23
  25. package/src/css/ui.popup.css +0 -127
  26. package/src/css/ui.witharia.css +0 -25
  27. package/src/index.js +0 -112
  28. package/src/meta/InputTemplates.js +0 -3
  29. package/src/style.js +0 -37
  30. package/src/util/colorjoe.js +0 -1370
  31. package/src/util/filepath.js +0 -10
  32. package/src/util/fuckingconfirm.js +0 -28
  33. package/src/util/mithril-range.js +0 -445
  34. package/src/util/tainter.js +0 -39
  35. package/src/util/util.clone.js +0 -8
  36. package/src/util/util.tokenizer.js +0 -266
  37. package/src/util/widgets.core.js +0 -314
  38. package/src/util/widgets.js +0 -79
  39. package/src/util/widgets.utils.js +0 -10
  40. package/src/widgets/Basic.js +0 -352
  41. package/src/widgets/ButtonChoiceWidget.js +0 -72
  42. package/src/widgets/CardieWidget.js +0 -168
  43. package/src/widgets/ColorJoePack.js +0 -108
  44. package/src/widgets/ColorJoeWidget.js +0 -140
  45. package/src/widgets/ComboPrompt.js +0 -112
  46. package/src/widgets/ComboWidget.js +0 -156
  47. package/src/widgets/CoolContentTicker.js +0 -244
  48. package/src/widgets/CoolerEmpty.js +0 -37
  49. package/src/widgets/EmptyButton.js +0 -36
  50. package/src/widgets/FontSelectorButton.js +0 -37
  51. package/src/widgets/InputWidget.js +0 -254
  52. package/src/widgets/NoticeWidget.js +0 -31
  53. package/src/widgets/OverflowUtils.js +0 -449
  54. package/src/widgets/PlusMinusWidget.js +0 -55
  55. package/src/widgets/RangeWidget.js +0 -200
  56. package/src/widgets/SelectFileMiniButton.js +0 -170
  57. package/src/widgets/Separator.js +0 -21
  58. package/src/widgets/SmileysButton.js +0 -19
  59. package/src/widgets/SwitchWidget.js +0 -42
  60. package/src/widgets/TemplatedInputWidget.js +0 -1395
  61. package/src/widgets/TitleBarWidget.js +0 -71
  62. package/src/widgets/css/buttonchoice.css +0 -62
  63. package/src/widgets/css/buttonchoice.toggle.css +0 -37
  64. package/src/widgets/css/choicer.css +0 -24
  65. package/src/widgets/css/colorjoe.css +0 -230
  66. package/src/widgets/css/colorjoewidget.css +0 -105
  67. package/src/widgets/css/combo-ellipsis.css +0 -29
  68. package/src/widgets/css/fileminibutton.css +0 -12
  69. package/src/widgets/css/input.css +0 -35
  70. package/src/widgets/css/mithril-range.css +0 -69
  71. package/src/widgets/css/progressstrip.css +0 -31
  72. package/src/widgets/css/range-anims.css +0 -23
  73. package/src/widgets/css/separator.css +0 -21
  74. package/src/widgets/css/smileys.css +0 -85
  75. package/src/widgets/css/templatedinput.css +0 -67
  76. package/src/widgets/css/ui.titlebar.css +0 -44
  77. package/src/widgets/css/uploadfile.css +0 -5
  78. /package/dist/{libui.css → libmui.css} +0 -0
@@ -1,449 +0,0 @@
1
- import m from "mithril";
2
- import defineWidget from "../util/widgets.utils";
3
- import * as widget from "../util/widgets";
4
- import {Icon, Notification, ButtonNew} from "./Basic"
5
- import {OverflowMenu} from "../util/widgets.core";
6
- import SwitchWidget from "../widgets/SwitchWidget";
7
- import InputWidget from "../widgets/InputWidget";
8
- import Notice from "../widgets/NoticeWidget";
9
- import clone from "../util/util.clone"
10
-
11
- function choose(items, config = {
12
- icon: "circle", onSelect: () => {
13
- }
14
- }) {
15
-
16
- const
17
- {icon, title, field, onSelect, parser = (v) => v} = config,
18
- options = items.map((item, index) => ({
19
- icon: field && item.icon || icon,
20
- // WARNING !!!!!
21
- caption: parser(field ? item[field] : item, item),
22
- // caption: idField ? item[idField] : item,
23
- onClick: (e) => onSelect(item, e, index)
24
- }));
25
-
26
- if (Array.isArray(items) && !items.length) {
27
- Notification.add("No items available");
28
- } else {
29
- OverflowMenu(
30
- document.body,
31
- {title},
32
- options
33
- )
34
- .then(({action}) => action.onClick());
35
- }
36
- }
37
-
38
- function promptOptions(items, onchange, options = {}) {
39
-
40
- const
41
- {title, field, icon, textNew, textHint, resolve} = options,
42
- dialogOptions = Array.isArray(items)
43
- ? items.map((item) => ({
44
- icon,
45
- // WARNING !!!!!
46
- caption: field ? item[field] : item,
47
- // caption: idField ? item[idField] : item,
48
- onClick: (e) => onchange(item, e)
49
- }))
50
- : Object.keys(items)
51
- .map((key) => ({
52
- icon: items[key].icon || icon,
53
- caption: items[key].caption || key,
54
- onClick: (e) => onchange(
55
- resolve && items[key].value !== undefined
56
- ? items[key].value
57
- : items[key],
58
- e)
59
- }));
60
-
61
- if (Array.isArray(items) && !items.length) {
62
- Notification.add("No items available");
63
- } else {
64
- OverflowMenu(
65
- document.body,
66
- {title},
67
- [
68
- ...textNew && !field
69
- ? [
70
- {
71
- icon: "plus",
72
- caption: textNew,
73
- onClick: () => promptName(
74
- textNew,
75
- "",
76
- textHint,
77
- (value) => {
78
- if (value) {
79
- if (value && value.trim()) {
80
- onchange(value);
81
- m.redraw();
82
- }
83
- }
84
- }
85
- )
86
- }
87
- ]
88
- : [],
89
- ...dialogOptions
90
- ]
91
- )
92
- .then(({action}) => action.onClick())
93
- .finally(() => {
94
- });
95
- }
96
- }
97
-
98
- function promptName(title, value, hint, action, state = {}) {
99
- setTimeout(() => OverflowMenu(
100
- document.body,
101
- {title},
102
- [
103
- {
104
- type: "text",
105
- hint,
106
- value
107
- }
108
- ]
109
- )
110
- .then(({value: val}) => {
111
- state.refreshKey = String(Date.now());
112
- return action(val);
113
- }), 100);
114
- }
115
-
116
- const
117
- WHAT_DO_UPDATE_LIGHTS = 0, // 0
118
- WHAT_DO_UPDATE_FACE = 1, // 1
119
- WHAT_DO_UPDATE_PARTICLES = 2, // 4
120
- WHAT_DO_UPDATE_SEGMENTATION = 3,
121
- WHAT_DO_UPDATE_VAL_VPLANE = 4,
122
- WHAT_DO_UPDATE_VAL_PANO = 5,
123
- WHAT_DO_UPDATE_VAL_FREE = 6,
124
- WHAT_DO_UPDATE_VAL_DRONE = 7,
125
- WHAT_DO_UPDATE_VAL_TRANSITION = 8,
126
- WHAT_DO_UPDATE_TVFX = 9,
127
- WHAT_DO_UPDATE_VAL_FOLLOW = 10,
128
-
129
- PROPERTIES = [
130
- ["Lights and Fog", null, ["amblight", "l0", "l1", "l2", "l3", "fog"], WHAT_DO_UPDATE_LIGHTS],
131
- ["Face and Accessories", null, ["facekit"], WHAT_DO_UPDATE_FACE],
132
- ["Particle settings", null, ["particles"], WHAT_DO_UPDATE_PARTICLES],
133
- ["Video Segmentation", "common", ["segcam", "mask", "green"], WHAT_DO_UPDATE_SEGMENTATION, true],
134
- ["Video Effects", null, ["fxconfig"], WHAT_DO_UPDATE_TVFX],
135
- ["Video Plane", "val", ["xvideo", "yvideo", "zvideo", "rvideo", "svideo", "video"], WHAT_DO_UPDATE_VAL_VPLANE],
136
- ["Main Camera", "val", ["ypos", "xpos", "zoom", "yaw", "pitch", "roll", "ai"], WHAT_DO_UPDATE_VAL_PANO],
137
- ["Drone Camera", "val", ["free"], WHAT_DO_UPDATE_VAL_FREE],
138
- ["Followed Agent", "val", ["track"], WHAT_DO_UPDATE_VAL_FOLLOW],
139
- ["Game Camera", "val", ["orbit", "track", "ocam"], WHAT_DO_UPDATE_VAL_DRONE, undefined, true],
140
- ["Transition Speed", "val", ["spd"], WHAT_DO_UPDATE_VAL_TRANSITION]
141
- ],
142
-
143
- TitleBarWidget = defineWidget(
144
- ({attrs}) => m("h2.marg-2.no-marg-bottom", attrs.title)
145
- ),
146
- EntityTemplates = defineWidget(
147
- ({attrs}) => {
148
-
149
- const
150
- {type = "changes", meta, onInput, title, options} = attrs,
151
- valid = meta.title?.trim().length && meta.description?.trim().length,
152
- embedded = options && options.embedded;
153
-
154
- return m(".flexcol.grows.ohidden.fadein", [
155
- ...attrs.title ? [
156
- m(TitleBarWidget, {
157
- title
158
- })] : [],
159
- m(".flexrow.wrap.grows.pad-3.propsgroup.scrolly", [
160
- ...attrs.notice ? [
161
- m(Notice, {
162
- class: "marg-1 marg-v withbottommargin font-75 col-12",
163
- size: 1,
164
- icon: "info-circle",
165
- text: attrs.notice
166
- })
167
- ] : [],
168
- m(
169
- ".witharia.col-12.pad-1.pad-v",
170
- {"aria-label": type + " name"},
171
- m(InputWidget, {
172
- class: "pad-2 pad-xh " + (valid ? "valid" : "invalid"),
173
- value: meta.title,
174
- maxlength: 64,
175
- onchange: (newvalue) => {
176
- meta.title = newvalue;
177
- m.redraw();
178
- }
179
- })
180
- ),
181
- ...embedded ? []
182
- : [
183
- m(
184
- ".col-12.witharia.pad-1.pad-v",
185
- {"aria-label": "description"},
186
- m(InputWidget, {
187
- class: "pad-2 pad-xh " + (meta.description ? "valid" : "invalid"),
188
- value: meta.description,
189
- maxlength: 240,
190
- multi: true,
191
- alwaysmulti: true,
192
- onchange: (newvalue) => {
193
- meta.description = newvalue;
194
- m.redraw();
195
- }
196
- })
197
- ),
198
- m(
199
- ".col-8.witharia.pad-1.pad-v",
200
- {"aria-label": "tags"},
201
- m(InputWidget, {
202
- class: "pad-2 pad-xh",
203
- value: meta.tags,
204
- maxlength: 128,
205
- onchange: (newvalue) => {
206
- meta.tags = newvalue.toLowerCase()
207
- .split(" ")
208
- .join(",")
209
- .split(",")
210
- .filter((tag) => tag.length)
211
- .join(",");
212
- }
213
- })
214
- ),
215
- m(
216
- ".col-4.witharia.pad-1.pad-v",
217
- {"aria-label": "youtube video"},
218
- m(InputWidget, {
219
- class: "pad-2 pad-xh",
220
- value: meta.ytref || "",
221
- hint: "YouTube ID",
222
- maxlength: 16,
223
- onchange: (newvalue) => {
224
- newvalue = newvalue.trim();
225
- if (newvalue) {
226
- if (newvalue.indexOf(" ") === -1) {
227
- meta.ytref = newvalue.trim();
228
- }
229
- } else {
230
- delete meta.ytref;
231
- }
232
- }
233
- })
234
- )
235
- ],
236
- m(
237
- ".col-4.witharia.pad-1.pad-v",
238
- {"aria-label": "content attribution"},
239
- m(InputWidget, {
240
- class: "pad-2 pad-xh",
241
- value: meta.author,
242
- hint: "author name",
243
- maxlength: 128,
244
- onchange: (newvalue) => {
245
- meta.author = newvalue;
246
- }
247
- })
248
- ),
249
-
250
- m(
251
- ".col-4.witharia.pad-1.pad-v",
252
- {"aria-label": "license or author link"},
253
- m(InputWidget, {
254
- class: "pad-2 pad-xh",
255
- hint: "https://...",
256
- value: meta.link,
257
- maxlength: 128,
258
- onchange: (newvalue) => {
259
- meta.link = newvalue;
260
- }
261
- })
262
- ),
263
- m(
264
- ".col-4.witharia.pad-1.pad-v",
265
- {"aria-label": "source domain"},
266
- m(InputWidget, {
267
- class: "pad-2 pad-xh",
268
- value: meta.source,
269
- hint: "example.com",
270
- maxlength: 128,
271
- onchange: (newvalue) => {
272
- meta.source = newvalue;
273
- }
274
- })
275
- ),
276
-
277
- m(
278
- ".col-12.al-right.marg-2.marg-v",
279
- m(ButtonNew, {
280
- class: "noshrink accentbutton unitheightsmall col-4",
281
- text: "save " + type,
282
- onClick: () => {
283
-
284
- const isValid = meta.title?.trim().length && (embedded || meta.description?.trim().length);
285
-
286
- if (isValid) {
287
- widget.popupMessage(null);
288
- onInput(meta);
289
- } else {
290
- Notification.add("Information is incomplete or invalid");
291
- }
292
- }
293
- })
294
- )
295
- ])
296
- ]);
297
- }
298
- ),
299
- promptEntity = (meta, title, type, options = {}) => new Promise((resolve, reject) => {
300
- widget.popupMessage(
301
- m(EntityTemplates, {
302
- meta,
303
- type,
304
- title,
305
- options,
306
- onInput: (newMeta) => resolve(newMeta)
307
- }),
308
- () => {
309
- reject(new Error("cancelled"));
310
- }
311
- );
312
- }),
313
- PresetTemplate = defineWidget(
314
- ({attrs}) => {
315
-
316
- const
317
-
318
- {parameters, preset, presetComponents, types, globalData, fetcher} = attrs,
319
- available = [],
320
- sourceAvailable = [],
321
- items = types
322
- ? PROPERTIES
323
- : PROPERTIES.filter((cosa) => {
324
-
325
- const
326
- [, primaryTarget, elements, index, globalSource] = cosa,
327
- target = primaryTarget ? preset[primaryTarget] : preset,
328
- rootSource = globalSource ? globalData : parameters,
329
- source = primaryTarget ? rootSource[primaryTarget] : rootSource;
330
-
331
- let found = false;
332
-
333
- if (elements.length) {
334
-
335
- for (const element of elements) {
336
- if (target && target[element] !== undefined) {
337
- found = available[index] = true;
338
- }
339
- if (source[element] !== undefined) {
340
- found = sourceAvailable[index] = true;
341
- }
342
- }
343
- return found;
344
- } else {
345
- found = true;
346
- sourceAvailable[index] = !!source;
347
- available[index] = !!target;
348
- }
349
- return found;
350
-
351
- });
352
-
353
- return m(
354
- "ul.flexrow.wrap.userdialog",
355
- items.length
356
- ? items.map((cosa) => {
357
-
358
- const
359
- [title, primaryTarget, elements, cosaIndex, globalSource, fetchLive] = cosa,
360
- target = types ? undefined : primaryTarget ? preset[primaryTarget] : preset,
361
- rootSource = globalSource ? globalData : parameters,
362
- source = types ? undefined : primaryTarget ? rootSource[primaryTarget] : rootSource,
363
- deleteCurrent = () => {
364
- if (elements.length) {
365
- for (const field of elements) {
366
- delete target[field];
367
- }
368
- } else if (elements.length === 0 && primaryTarget) {
369
- delete preset[primaryTarget];
370
- }
371
- attrs.redraw && attrs.redraw();
372
- },
373
- updateCurrent = () => {
374
- if (elements.length) {
375
- if (primaryTarget && !preset[primaryTarget]) preset[primaryTarget] = {};
376
- const updatedTarget = primaryTarget ? preset[primaryTarget] : preset;
377
- for (const field of elements) {
378
- if (source[field] !== undefined) {
379
- const finalSource = fetchLive && fetcher ? fetcher(updatedTarget[field], cosaIndex) : source[field];
380
- updatedTarget[field] = clone(finalSource);
381
- }
382
- }
383
- } else if (elements.length === 0 && primaryTarget) {
384
- if (source !== undefined) {
385
- const finalSource = fetchLive && fetcher ? fetcher(source, cosaIndex) : source;
386
- preset[primaryTarget] = clone(finalSource);
387
- }
388
- }
389
- attrs.redraw && attrs.redraw();
390
- Notification.add(`updated ${title} from current scene`);
391
- },
392
- isAvailable = types || available[cosaIndex],
393
- isSourceAvailable = sourceAvailable[cosaIndex];
394
-
395
- return [
396
- ...presetComponents ? [
397
- m(SwitchWidget, {
398
- title: `Include ${cosa[0]} in snapshots`,
399
- class: "grows unitheightsmall" + (presetComponents[cosaIndex] ? " accent" : ""),
400
- checked: !!presetComponents[cosaIndex],
401
- onchange: (status) => {
402
- presetComponents[cosaIndex] = !presetComponents[cosaIndex];
403
- m.redraw();
404
- attrs.redraw && attrs.redraw();
405
- }
406
- }),
407
- m(".grows", {class: isAvailable ? "avail" : "unavail"}, title)
408
- ] : [],
409
- ...!attrs.types ? [
410
- m(ButtonNew, {
411
- class: "col-3" + (isSourceAvailable ? "avail" : "unavail"),
412
- icon: "sync", title: `Copy ${title} from current state`,
413
- onClick: updateCurrent
414
- }),
415
- m(ButtonNew, {
416
- class: "col-3 " + (isAvailable ? "" : "disabled text-lo"),
417
- icon: "trash", title: `Delete ${title} in preset`,
418
- onClick: () => isAvailable && deleteCurrent()
419
- })
420
- ] : [],
421
- m(".flexbreak")
422
- ];
423
-
424
- })
425
- : m("h3", "Preset is Empty")
426
- );
427
- }
428
- ),
429
- promptPreset = (preset, parameters, options = {}) => new Promise((resolve, reject) => {
430
- widget.popupMessage(
431
- () => m(PresetTemplate, {
432
- ...options,
433
- preset,
434
- parameters,
435
- redraw: () => widget.popupMessage.redraw()
436
- }),
437
- () => {
438
- reject(new Error("cancelled"));
439
- }
440
- );
441
- });
442
-
443
- export {
444
- promptName,
445
- promptEntity,
446
- promptPreset,
447
- promptOptions,
448
- choose
449
- };
@@ -1,55 +0,0 @@
1
- import m from "mithril";
2
- import {ButtonNew, defineWidget} from "./Basic";
3
-
4
- const
5
- PlusMinus = defineWidget(
6
- ({attrs}) => {
7
- return m(".flexrow.wrap.grows",
8
- {
9
- ...attrs.label && {"aria-label": attrs.label},
10
- class: (attrs.label ? "witharia" : "") + " " + (attrs.class || ""),
11
- title: attrs.title || ""
12
- },
13
- [
14
- m(ButtonNew, {
15
- icon: attrs.iconMinus ?? "minus",
16
- class: "unitsizesmall " + (attrs.buttonClass || "transp"),
17
- title: attrs.title ? "decrease the " + attrs.title : "",
18
- onClick: () => {
19
- const {
20
- step = 1,
21
- min = 0
22
- } = attrs;
23
- let v = attrs.value || 0;
24
- if (Number.isNaN(v)) v = 0;
25
- v -= step;
26
- if (min !== undefined && v < min) v = min;
27
- attrs.onchange(v);
28
- m.redraw();
29
- }
30
- }),
31
- m(".currentvalue.al-center.grows.unitheightsmall", {
32
- title: attrs.title
33
- }, attrs.parser ? attrs.parser(attrs.value) : String(attrs.value || 0)),
34
- m(ButtonNew, {
35
- icon: attrs.iconPlus ?? "plus",
36
- class: "unitsizesmall " + (attrs.buttonClass || "transp"),
37
- title: attrs.title ? "increase the " + attrs.title : "",
38
- onClick: () => {
39
- const {
40
- step = 1,
41
- max = 0
42
- } = attrs;
43
-
44
- let v = attrs.value || 0;
45
- if (max !== undefined && v === max) return;
46
- v += step;
47
- attrs.onchange(v);
48
- m.redraw();
49
- }
50
- })
51
- ]);
52
- }
53
- );
54
-
55
- export default PlusMinus;