@nebularstreams/libmui 3.1.1 → 4.0.1
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/dist/libmui.esm.js +3 -0
- package/dist/libmui.esm.min.js +3 -0
- package/package.json +6 -2
- package/dist/libui.esm.js +0 -3
- package/rollup.config.js +0 -20
- package/src/app/MainState.js +0 -22
- package/src/app/app.js +0 -9
- package/src/css/a-measures.css +0 -6
- package/src/css/b-colors.css +0 -12
- package/src/css/b-root-bootstrap-ext.css +0 -81
- package/src/css/b-root-bootstrap.css +0 -178
- package/src/css/b-root-semantic-flex.css +0 -87
- package/src/css/b-root-semantic-size-new.css +0 -37
- package/src/css/b-root-semantic-size.css +0 -75
- package/src/css/b-root-semantic-skin.css +0 -48
- package/src/css/b-root-semantic.css +0 -111
- package/src/css/b-root.css +0 -3
- package/src/css/cardie.css +0 -6
- package/src/css/flex.css +0 -46
- package/src/css/fontawesome/brands.min.css +0 -16
- package/src/css/fontawesome/fontawesome-ext.css +0 -7
- package/src/css/fontawesome/fontawesome-solid.css +0 -17
- package/src/css/fontawesome/fontawesome.css +0 -4359
- package/src/css/ui.notifications.css +0 -23
- package/src/css/ui.popup.css +0 -127
- package/src/css/ui.witharia.css +0 -25
- package/src/index.js +0 -112
- package/src/meta/InputTemplates.js +0 -3
- package/src/style.js +0 -37
- package/src/util/colorjoe.js +0 -1370
- package/src/util/filepath.js +0 -10
- package/src/util/fuckingconfirm.js +0 -28
- package/src/util/mithril-range.js +0 -445
- package/src/util/tainter.js +0 -39
- package/src/util/util.clone.js +0 -8
- package/src/util/util.tokenizer.js +0 -266
- package/src/util/widgets.core.js +0 -314
- package/src/util/widgets.js +0 -79
- package/src/util/widgets.utils.js +0 -10
- package/src/widgets/Basic.js +0 -352
- package/src/widgets/ButtonChoiceWidget.js +0 -72
- package/src/widgets/CardieWidget.js +0 -168
- package/src/widgets/ColorJoePack.js +0 -108
- package/src/widgets/ColorJoeWidget.js +0 -140
- package/src/widgets/ComboPrompt.js +0 -112
- package/src/widgets/ComboWidget.js +0 -156
- package/src/widgets/CoolContentTicker.js +0 -244
- package/src/widgets/CoolerEmpty.js +0 -37
- package/src/widgets/EmptyButton.js +0 -36
- package/src/widgets/FontSelectorButton.js +0 -37
- package/src/widgets/InputWidget.js +0 -254
- package/src/widgets/NoticeWidget.js +0 -31
- package/src/widgets/OverflowUtils.js +0 -449
- package/src/widgets/PlusMinusWidget.js +0 -55
- package/src/widgets/RangeWidget.js +0 -200
- package/src/widgets/SelectFileMiniButton.js +0 -170
- package/src/widgets/Separator.js +0 -21
- package/src/widgets/SmileysButton.js +0 -19
- package/src/widgets/SwitchWidget.js +0 -42
- package/src/widgets/TemplatedInputWidget.js +0 -1395
- package/src/widgets/TitleBarWidget.js +0 -71
- package/src/widgets/css/buttonchoice.css +0 -62
- package/src/widgets/css/buttonchoice.toggle.css +0 -37
- package/src/widgets/css/choicer.css +0 -24
- package/src/widgets/css/colorjoe.css +0 -230
- package/src/widgets/css/colorjoewidget.css +0 -105
- package/src/widgets/css/combo-ellipsis.css +0 -29
- package/src/widgets/css/fileminibutton.css +0 -12
- package/src/widgets/css/input.css +0 -35
- package/src/widgets/css/mithril-range.css +0 -69
- package/src/widgets/css/progressstrip.css +0 -31
- package/src/widgets/css/range-anims.css +0 -23
- package/src/widgets/css/separator.css +0 -21
- package/src/widgets/css/smileys.css +0 -85
- package/src/widgets/css/templatedinput.css +0 -67
- package/src/widgets/css/ui.titlebar.css +0 -44
- package/src/widgets/css/uploadfile.css +0 -5
- /package/dist/{libui.css → libmui.css} +0 -0
|
@@ -1,1395 +0,0 @@
|
|
|
1
|
-
import m from "mithril";
|
|
2
|
-
|
|
3
|
-
import {defineWidget, Notification, ButtonNew, Icon, Empty, Selector} from "./Basic";
|
|
4
|
-
import CardieWidget from "./CardieWidget";
|
|
5
|
-
import ButtonChoiceWidget from "./ButtonChoiceWidget";
|
|
6
|
-
import InputWidget from "./InputWidget";
|
|
7
|
-
import NoticeWidget from "./NoticeWidget";
|
|
8
|
-
import ComboWidget from "./ComboWidget";
|
|
9
|
-
import ComboPrompt from "./ComboPrompt";
|
|
10
|
-
import SwitchWidget from "./SwitchWidget";
|
|
11
|
-
import ColorJoeWidget from "./ColorJoeWidget";
|
|
12
|
-
import Separator from "./Separator";
|
|
13
|
-
import PlusMinusWidget from "./PlusMinusWidget";
|
|
14
|
-
import RangeWidget from "./RangeWidget";
|
|
15
|
-
import FontSelectorButton from "./FontSelectorButton";
|
|
16
|
-
import SmileysButton from "./SmileysButton.js"
|
|
17
|
-
import InputTemplates from "../meta/InputTemplates.js"
|
|
18
|
-
|
|
19
|
-
import cloneObject from "../util/util.clone.js"
|
|
20
|
-
|
|
21
|
-
import {confirm} from "../util/fuckingconfirm.js"
|
|
22
|
-
import {promptName} from "./OverflowUtils.js"
|
|
23
|
-
import {sanitizeFilename} from "../util/util.tokenizer"
|
|
24
|
-
import {taint} from "../util/tainter"
|
|
25
|
-
import MainState, {getWidget} from "../app/MainState.js"
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
NEEDS_UPDATE = "needsUpdate",
|
|
30
|
-
REBUILD_CHILDREN = "_rebuild_children",
|
|
31
|
-
NEEDS_DELETE = "delete",
|
|
32
|
-
KeyWrapper = defineWidget(
|
|
33
|
-
({children}) => [children]
|
|
34
|
-
),
|
|
35
|
-
ToggleWidget = defineWidget(
|
|
36
|
-
({attrs}) => m(ButtonNew, {
|
|
37
|
-
text: attrs.text,
|
|
38
|
-
icon: attrs.icon,
|
|
39
|
-
title: attrs.hint,
|
|
40
|
-
iconClass: attrs.iconClass,
|
|
41
|
-
class: (attrs.checked ? attrs.inverted ? "" : "accent " : attrs.inverted ? "accent " : "") + (attrs.class || "") + (attrs.noclass || " tgbutton"),
|
|
42
|
-
onClick: () => attrs.onchange(!attrs.checked)
|
|
43
|
-
})
|
|
44
|
-
),
|
|
45
|
-
RangeToggleWidget = defineWidget(
|
|
46
|
-
({attrs}) => m(RangeWidget, {
|
|
47
|
-
|
|
48
|
-
min: 0,
|
|
49
|
-
max: attrs.max || 1,
|
|
50
|
-
step: 0.1,
|
|
51
|
-
...attrs.mul && {multiplier: attrs.mul},
|
|
52
|
-
class: "tgrange grows innerlabel",
|
|
53
|
-
title: attrs.text,
|
|
54
|
-
value: attrs.value ?? 0,
|
|
55
|
-
hint: attrs.hint,
|
|
56
|
-
onchange: (value) => attrs.onchange(value),
|
|
57
|
-
parser: (v) => v || "OFF"
|
|
58
|
-
})
|
|
59
|
-
),
|
|
60
|
-
|
|
61
|
-
MultiToggleWidget = defineWidget(
|
|
62
|
-
({attrs, children}) => m(".flexrow.wrap", {class: attrs.class}, attrs.source
|
|
63
|
-
? Object.keys(attrs.source)
|
|
64
|
-
.map((key) => m(getWidget(attrs.widget) || ToggleWidget, {
|
|
65
|
-
text: key,
|
|
66
|
-
icon: attrs.icon,
|
|
67
|
-
checked: !!attrs.source[key],
|
|
68
|
-
hint: attrs.hint,
|
|
69
|
-
value: attrs.source[key],
|
|
70
|
-
class: attrs.buttonClass,
|
|
71
|
-
max: attrs.max,
|
|
72
|
-
mul: attrs.mul,
|
|
73
|
-
onchange: (checked) => {
|
|
74
|
-
attrs.source[key] = checked >= 0 ? checked : !!checked;
|
|
75
|
-
attrs.onchange(key);
|
|
76
|
-
}
|
|
77
|
-
}))
|
|
78
|
-
.concat(children)
|
|
79
|
-
: [])
|
|
80
|
-
),
|
|
81
|
-
PagedMultiToggleWidget = defineWidget(
|
|
82
|
-
({attrs, state, children}) => [
|
|
83
|
-
...attrs.keys.length > 1
|
|
84
|
-
? [
|
|
85
|
-
m(
|
|
86
|
-
".flexrow.wrap",
|
|
87
|
-
{class: attrs.class},
|
|
88
|
-
attrs.source
|
|
89
|
-
? attrs.keys
|
|
90
|
-
.map((key) => m(ToggleWidget, {
|
|
91
|
-
text: key,
|
|
92
|
-
checked: state.current === key,
|
|
93
|
-
class: attrs.selectorButtonClass || "transp",
|
|
94
|
-
hint: attrs.hint,
|
|
95
|
-
onchange: () => {
|
|
96
|
-
state.current = key;
|
|
97
|
-
m.redraw();
|
|
98
|
-
}
|
|
99
|
-
}))
|
|
100
|
-
: []
|
|
101
|
-
)
|
|
102
|
-
]
|
|
103
|
-
: [],
|
|
104
|
-
...state.current
|
|
105
|
-
? [
|
|
106
|
-
m(MultiToggleWidget, {
|
|
107
|
-
class: attrs.class,
|
|
108
|
-
source: attrs.source[state.current],
|
|
109
|
-
icon: attrs.icon,
|
|
110
|
-
buttonClass: attrs.buttonClass,
|
|
111
|
-
onchange: attrs.onchange,
|
|
112
|
-
hint: attrs.hint,
|
|
113
|
-
widget: attrs.nocustom !== state.current ? getWidget(attrs.widget) : undefined,
|
|
114
|
-
max: attrs.max,
|
|
115
|
-
mul: attrs.mul
|
|
116
|
-
}, children)
|
|
117
|
-
]
|
|
118
|
-
: []
|
|
119
|
-
],
|
|
120
|
-
({attrs, state}) => {
|
|
121
|
-
state.current = attrs.keys[0];
|
|
122
|
-
}
|
|
123
|
-
),
|
|
124
|
-
KeyIteratorWidget = defineWidget(
|
|
125
|
-
({attrs, children}) => {
|
|
126
|
-
const
|
|
127
|
-
isArray = attrs.source && Array.isArray(attrs.source),
|
|
128
|
-
keys = isArray ? attrs.source.map((_, i) => i) : attrs.keys || attrs.source && Object.keys(attrs.source),
|
|
129
|
-
expandedView = () => (keys && keys.length) || attrs.add
|
|
130
|
-
? [
|
|
131
|
-
...attrs.cardie || attrs.noseparator
|
|
132
|
-
? []
|
|
133
|
-
: [m(Separator, {
|
|
134
|
-
class: attrs.separatorClass,
|
|
135
|
-
text: attrs.caption
|
|
136
|
-
})],
|
|
137
|
-
|
|
138
|
-
m(".flexrow.wrap", {class: attrs.class},
|
|
139
|
-
(
|
|
140
|
-
attrs.source
|
|
141
|
-
? keys.map((key) => m(getWidget(attrs.widget.name), {
|
|
142
|
-
keyName: key,
|
|
143
|
-
class: attrs.widgetClass,
|
|
144
|
-
...((typeof attrs.widget.attrs === "function" ? attrs.widget.attrs(attrs, key) : attrs.widget.attrs) || {}),
|
|
145
|
-
value: attrs.source[key],
|
|
146
|
-
parameters: attrs.targetParameters,
|
|
147
|
-
onchange: (newValue, event) => {
|
|
148
|
-
if (!newValue && attrs.add && event.shiftKey) {
|
|
149
|
-
|
|
150
|
-
if (isArray) {
|
|
151
|
-
attrs.source.splice(key, 1);
|
|
152
|
-
} else {
|
|
153
|
-
delete attrs.source[key];
|
|
154
|
-
}
|
|
155
|
-
} else {
|
|
156
|
-
attrs.source[key] = newValue;
|
|
157
|
-
}
|
|
158
|
-
attrs.onchange(key);
|
|
159
|
-
}
|
|
160
|
-
}))
|
|
161
|
-
: []
|
|
162
|
-
)
|
|
163
|
-
.concat(attrs.add && !attrs.keys ? [
|
|
164
|
-
m(ButtonNew, {
|
|
165
|
-
icon: "plus",
|
|
166
|
-
class: attrs.addButtonClass || "marg-1 transp leftbutton grows unitsizesmall",
|
|
167
|
-
text: `add ${attrs.add}`,
|
|
168
|
-
onClick: () => {
|
|
169
|
-
promptName(
|
|
170
|
-
`Enter new ${attrs.add} name`,
|
|
171
|
-
"",
|
|
172
|
-
`type ${attrs.add} name`,
|
|
173
|
-
(newName) => {
|
|
174
|
-
|
|
175
|
-
const NEWITEM = ""; // TODO
|
|
176
|
-
|
|
177
|
-
if (newName) {
|
|
178
|
-
newName = sanitizeFilename(newName)
|
|
179
|
-
.toLowerCase();
|
|
180
|
-
}
|
|
181
|
-
if (newName) {
|
|
182
|
-
if (isArray) {
|
|
183
|
-
attrs.source.push(NEWITEM);
|
|
184
|
-
} else {
|
|
185
|
-
if (!attrs.source[newName]) {
|
|
186
|
-
attrs.source[newName] = NEWITEM;
|
|
187
|
-
m.redraw();
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
})
|
|
194
|
-
] : [])
|
|
195
|
-
.concat(children)
|
|
196
|
-
)
|
|
197
|
-
]
|
|
198
|
-
: attrs.empty ? m(Empty, attrs.empty) : [];
|
|
199
|
-
|
|
200
|
-
return attrs.cardie
|
|
201
|
-
? m(CardieWidget, {
|
|
202
|
-
nofold: false,
|
|
203
|
-
size: 1,
|
|
204
|
-
cols: false,
|
|
205
|
-
|
|
206
|
-
title: attrs.caption,
|
|
207
|
-
|
|
208
|
-
cardid: attrs.cardie,
|
|
209
|
-
class: "relative grows" + (attrs.cardieClass ? " " + attrs.cardieClass : ""),
|
|
210
|
-
expandedView
|
|
211
|
-
})
|
|
212
|
-
: expandedView();
|
|
213
|
-
}
|
|
214
|
-
),
|
|
215
|
-
ToggleStateWidget = defineWidget(
|
|
216
|
-
({attrs}) => m(ButtonNew, {
|
|
217
|
-
text: attrs.states[Number.parseInt(attrs.checked, 10) || 0] || "---",
|
|
218
|
-
icon: attrs.icon,
|
|
219
|
-
hint: attrs.hint,
|
|
220
|
-
class: "tgbutton " + (attrs.checked ? attrs.inverted ? "" : "accent " : attrs.inverted ? "accent " : "") + (attrs.class || ""),
|
|
221
|
-
onClick: () => {
|
|
222
|
-
let v = Number.parseInt(attrs.checked, 10) || 0;
|
|
223
|
-
v++;
|
|
224
|
-
v %= attrs.states.length;
|
|
225
|
-
attrs.onchange(v);
|
|
226
|
-
}
|
|
227
|
-
})
|
|
228
|
-
),
|
|
229
|
-
|
|
230
|
-
TemplateWidget = defineWidget(
|
|
231
|
-
({attrs, state}) => {
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
items = attrs.template.presets
|
|
235
|
-
.concat(state.files || []);
|
|
236
|
-
|
|
237
|
-
return m(".templatepresets.flexrow.wrap", {class: attrs.class}, items.length ? items.map((item) => m(attrs.template.render, {
|
|
238
|
-
item,
|
|
239
|
-
title: "Apply " + attrs.template.name + " to " + attrs.type,
|
|
240
|
-
onClick: () => attrs.onClick(item),
|
|
241
|
-
layer: attrs.layer
|
|
242
|
-
})) : attrs.template.empty ? m(NoticeWidget, attrs.template.empty) : m(".emptybox", "No presets available"));
|
|
243
|
-
},
|
|
244
|
-
|
|
245
|
-
({attrs, state}) => {
|
|
246
|
-
if (attrs.template.files && attrs.entity) {
|
|
247
|
-
attrs.template.files(attrs.entity)
|
|
248
|
-
.then((files) => {
|
|
249
|
-
state.files = files;
|
|
250
|
-
m.redraw();
|
|
251
|
-
})
|
|
252
|
-
.catch(() => {
|
|
253
|
-
//
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
),
|
|
258
|
-
|
|
259
|
-
checkWhen = (whenner, parameters, auxParameters, targetParameters) => {
|
|
260
|
-
return typeof whenner === "function"
|
|
261
|
-
? whenner(parameters, auxParameters)
|
|
262
|
-
: typeof whenner === "string"
|
|
263
|
-
? !!targetParameters[whenner]
|
|
264
|
-
: whenner.key
|
|
265
|
-
? whenner.value
|
|
266
|
-
? whenner.not
|
|
267
|
-
? targetParameters[whenner.key] !== whenner.value
|
|
268
|
-
: targetParameters[whenner.key] == whenner.value
|
|
269
|
-
: whenner.not
|
|
270
|
-
? !targetParameters[whenner.key]
|
|
271
|
-
: !!targetParameters[whenner.key]
|
|
272
|
-
: !!targetParameters[whenner.key];
|
|
273
|
-
|
|
274
|
-
},
|
|
275
|
-
|
|
276
|
-
ParameterTable = defineWidget(
|
|
277
|
-
({attrs, state, children}) => {
|
|
278
|
-
|
|
279
|
-
let total = 0;
|
|
280
|
-
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
{
|
|
284
|
-
meta,
|
|
285
|
-
crit = {}, when = {}, sizes = {},
|
|
286
|
-
metaKeys = Object.keys(attrs.meta),
|
|
287
|
-
global,
|
|
288
|
-
parameters, auxParameters, clone, onchange, itemClass, wrapper,
|
|
289
|
-
empty: vacioperovacio,
|
|
290
|
-
name // new to index a parent
|
|
291
|
-
} = attrs,
|
|
292
|
-
|
|
293
|
-
widgets = metaKeys.map((metaKey) => {
|
|
294
|
-
|
|
295
|
-
const
|
|
296
|
-
metaDef = meta[metaKey],
|
|
297
|
-
whenner = metaDef.when || (when ? when[metaKey] : undefined),
|
|
298
|
-
isObj = typeof metaDef === "object" && !metaDef.length,
|
|
299
|
-
targetSource = isObj && ((metaDef.auxTarget && !metaDef.target) || attrs.auxTargetIsDefault)
|
|
300
|
-
? auxParameters : parameters,
|
|
301
|
-
|
|
302
|
-
targetParameters = isObj && (metaDef.target || metaDef.forTarget)
|
|
303
|
-
? targetSource[metaDef.target || targetSource.forTarget]
|
|
304
|
-
: targetSource;
|
|
305
|
-
|
|
306
|
-
// targetSource estaba antes, targetParameters incluye TARGET !!!!
|
|
307
|
-
if (!parameters || (whenner && !checkWhen(whenner, parameters, auxParameters, targetParameters))) {
|
|
308
|
-
return [];
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
isWidget = isObj && metaDef.widget,
|
|
314
|
-
UPDATECODE = isObj ? metaDef.update || crit[metaKey] : false,
|
|
315
|
-
|
|
316
|
-
paramKey = (isObj && metaDef.key) || metaKey,
|
|
317
|
-
|
|
318
|
-
isCardie = isObj && metaDef.type === "group",
|
|
319
|
-
isCardieArray = isObj && metaDef.type === "groupArray",
|
|
320
|
-
isString = typeof metaDef === "string" || (isObj && metaDef.type === "text"),
|
|
321
|
-
isJson = (isObj && metaDef.type === "json"),
|
|
322
|
-
isBoolean = typeof metaDef === "boolean" || (isObj && metaDef.type === "boolean"),
|
|
323
|
-
|
|
324
|
-
isNumber = isObj && metaDef.type === "number",
|
|
325
|
-
isRange = isObj && !Number.isNaN(metaDef.min),
|
|
326
|
-
isActionButton = isObj && (metaDef.type === "action"),
|
|
327
|
-
isButtonChoice = isObj && (metaDef.choices || metaDef.choose || metaDef.chooseKey),
|
|
328
|
-
isMultiToggle = isObj && metaDef.type === "keytoggle",
|
|
329
|
-
isKeyIterator = isObj && metaDef.type === "iterakey",
|
|
330
|
-
isCombo = isObj && (metaDef.options || metaDef.optionsKey),
|
|
331
|
-
isFullCombo = isObj && metaDef.items,
|
|
332
|
-
isColor = isObj && metaDef.type === "color",
|
|
333
|
-
isPlusMinus = isObj && metaDef.type === "plusminus",
|
|
334
|
-
isSeparator = isObj && metaDef.type === "separator",
|
|
335
|
-
isText = isObj && metaDef.type === "static",
|
|
336
|
-
isEmoji = isObj && metaDef.type === "emoji",
|
|
337
|
-
isFont = isObj && metaDef.type === "font",
|
|
338
|
-
isNotice = isObj && metaDef.type === "notice",
|
|
339
|
-
isAsset = isObj && metaDef.type === "asset",
|
|
340
|
-
|
|
341
|
-
size = isSeparator ? "col-12" : "col-" + (metaDef.size || sizes[metaKey] || 4);
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
// TODO
|
|
345
|
-
if (!targetParameters) return [];
|
|
346
|
-
|
|
347
|
-
// situacion: mostrar props f0 (objeto 3d), pero source[f0] no existe
|
|
348
|
-
// targetParameters es NULL en ese caso !
|
|
349
|
-
const
|
|
350
|
-
altMeta = isObj && metaDef.altMeta && meta[metaDef.altMeta],
|
|
351
|
-
|
|
352
|
-
idx = metaDef.idx,
|
|
353
|
-
hasIndex = idx >= 0,
|
|
354
|
-
|
|
355
|
-
rawValue = isObj && metaDef.get
|
|
356
|
-
? metaDef.get(targetParameters, auxParameters, parameters)
|
|
357
|
-
: hasIndex ? targetParameters[paramKey] ? targetParameters[paramKey][idx] : 0 : targetParameters[paramKey],
|
|
358
|
-
|
|
359
|
-
altMetaKey = altMeta && metaDef.altMeta,
|
|
360
|
-
altKey = altMeta && altMeta.key,
|
|
361
|
-
|
|
362
|
-
internalSet = isObj && metaDef.set
|
|
363
|
-
? (v) => metaDef.set(
|
|
364
|
-
targetParameters,
|
|
365
|
-
(
|
|
366
|
-
(v && clone && typeof v === "object")
|
|
367
|
-
? cloneObject(v)
|
|
368
|
-
: v
|
|
369
|
-
),
|
|
370
|
-
auxParameters,
|
|
371
|
-
parameters,
|
|
372
|
-
idx
|
|
373
|
-
)
|
|
374
|
-
// eslint-disable-next-line no-return-assign
|
|
375
|
-
: (v, nothing, altKey) => {
|
|
376
|
-
|
|
377
|
-
const
|
|
378
|
-
finalKey = altKey || paramKey,
|
|
379
|
-
xdest = hasIndex ? idx : altKey || paramKey;
|
|
380
|
-
let
|
|
381
|
-
xsource = hasIndex ? targetParameters[finalKey] : targetParameters;
|
|
382
|
-
|
|
383
|
-
if (idx >= 0 && !xsource) targetParameters[finalKey] = xsource = [0, 0, 0];
|
|
384
|
-
|
|
385
|
-
return xsource[xdest] = ((v && clone && typeof v === "object")
|
|
386
|
-
? cloneObject(v)
|
|
387
|
-
: v);
|
|
388
|
-
},
|
|
389
|
-
|
|
390
|
-
set = attrs.onbeforechange
|
|
391
|
-
? (value, nothing, altKey, altMeta) => {
|
|
392
|
-
if (attrs.onbeforechange(altKey || metaKey, value, altMeta || metaDef)) {
|
|
393
|
-
internalSet(value, undefined, altKey, altMeta);
|
|
394
|
-
return true;
|
|
395
|
-
}
|
|
396
|
-
return false;
|
|
397
|
-
}
|
|
398
|
-
: internalSet;
|
|
399
|
-
|
|
400
|
-
total++;
|
|
401
|
-
|
|
402
|
-
return m(
|
|
403
|
-
".grows.flexrow." + size,
|
|
404
|
-
{
|
|
405
|
-
class: "mk_" + metaKey
|
|
406
|
-
+ (isObj && metaDef.type ? " ptype_" + metaDef.type : "")
|
|
407
|
-
+ (isString ? "witharia" : "")
|
|
408
|
-
+ ((metaDef.itemClass || itemClass) ? " " + (metaDef.itemClass || itemClass) : ""),
|
|
409
|
-
"aria-label": metaKey
|
|
410
|
-
},
|
|
411
|
-
isCardieArray
|
|
412
|
-
? Array.isArray(rawValue)
|
|
413
|
-
? rawValue.map(
|
|
414
|
-
(item, index) => metaDef.small
|
|
415
|
-
? m(ParameterTable, {
|
|
416
|
-
meta: metaDef.items,
|
|
417
|
-
crit: {},
|
|
418
|
-
when: {},
|
|
419
|
-
sizes: {},
|
|
420
|
-
|
|
421
|
-
parameters: item,
|
|
422
|
-
auxParameters,
|
|
423
|
-
|
|
424
|
-
arrayInfo: {source: rawValue, item: targetParameters, index},
|
|
425
|
-
|
|
426
|
-
global,
|
|
427
|
-
clone,
|
|
428
|
-
onchange,
|
|
429
|
-
itemClass,
|
|
430
|
-
wrapper,
|
|
431
|
-
empty: vacioperovacio,
|
|
432
|
-
itemsDict: attrs.itemsDict,
|
|
433
|
-
layer: attrs.layer,
|
|
434
|
-
onAction: attrs.onAction,
|
|
435
|
-
optionsDict: attrs.optionsDict,
|
|
436
|
-
play: attrs.play,
|
|
437
|
-
auxTargetIsDefault: false,
|
|
438
|
-
AssetButton: attrs.AssetButton,
|
|
439
|
-
CodeMirror: attrs.CodeMirror
|
|
440
|
-
})
|
|
441
|
-
: m(CardieWidget, {
|
|
442
|
-
class: "relative grows " + (metaDef.class || "pad-h emby w-max") + (metaDef.dynClass ? " " + metaDef.dynClass(parameters, auxParameters, index) : ""),
|
|
443
|
-
title: metaDef.dynTitle ? metaDef.dynTitle(parameters, auxParameters, index) : metaDef.title + " " + (index + 1) + (item.title ? " - " + item.title : ""),
|
|
444
|
-
cardid: metaDef.cardid + "-" + index,
|
|
445
|
-
nofold: false,
|
|
446
|
-
size: metaDef.margin || 0,
|
|
447
|
-
expandedView: () => [
|
|
448
|
-
m(ParameterTable, {
|
|
449
|
-
meta: metaDef.items,
|
|
450
|
-
crit: {},
|
|
451
|
-
when: {},
|
|
452
|
-
sizes: {},
|
|
453
|
-
|
|
454
|
-
parameters: item,
|
|
455
|
-
auxParameters,
|
|
456
|
-
|
|
457
|
-
global,
|
|
458
|
-
clone,
|
|
459
|
-
onchange,
|
|
460
|
-
itemClass,
|
|
461
|
-
wrapper,
|
|
462
|
-
empty: vacioperovacio,
|
|
463
|
-
itemsDict: attrs.itemsDict,
|
|
464
|
-
layer: attrs.layer,
|
|
465
|
-
onAction: attrs.onAction,
|
|
466
|
-
optionsDict: attrs.optionsDict,
|
|
467
|
-
play: attrs.play,
|
|
468
|
-
auxTargetIsDefault: false,
|
|
469
|
-
AssetButton: attrs.AssetButton,
|
|
470
|
-
CodeMirror: attrs.CodeMirror
|
|
471
|
-
})
|
|
472
|
-
],
|
|
473
|
-
titleExpended: metaDef.titleExpanded || metaDef.hint,
|
|
474
|
-
titleCollapsed: metaDef.titleCollapsed || metaDef.hint,
|
|
475
|
-
})
|
|
476
|
-
)
|
|
477
|
-
.concat(
|
|
478
|
-
metaDef.addAction ? [
|
|
479
|
-
m(ButtonNew, {
|
|
480
|
-
...metaDef.addAction,
|
|
481
|
-
onClick: (e) => {
|
|
482
|
-
if (metaDef.addAction.onClick) {
|
|
483
|
-
metaDef.addAction.onClick(e, parameters, auxParameters);
|
|
484
|
-
} else if (metaDef.addAction.template) {
|
|
485
|
-
rawValue.push(cloneObject(metaDef.addAction.template));
|
|
486
|
-
}
|
|
487
|
-
m.redraw();
|
|
488
|
-
}
|
|
489
|
-
})
|
|
490
|
-
] : [])
|
|
491
|
-
: []
|
|
492
|
-
|
|
493
|
-
: isCardie
|
|
494
|
-
? [
|
|
495
|
-
m(CardieWidget, {
|
|
496
|
-
class: "relative grows " + (metaDef.class || "emby w-max") + (metaDef.dynClass ? " " + metaDef.dynClass(parameters, auxParameters) : ""),
|
|
497
|
-
title: metaDef.dynTitle ? metaDef.dynTitle(parameters, auxParameters) : metaDef.title,
|
|
498
|
-
cardid: metaDef.cardid,
|
|
499
|
-
nofold: false,
|
|
500
|
-
size: metaDef.margin || 0,
|
|
501
|
-
expandedView: () => [
|
|
502
|
-
m(ParameterTable, {
|
|
503
|
-
meta: metaDef.items,
|
|
504
|
-
crit: {},
|
|
505
|
-
when: {},
|
|
506
|
-
sizes: {},
|
|
507
|
-
|
|
508
|
-
parameters,
|
|
509
|
-
auxParameters,
|
|
510
|
-
|
|
511
|
-
global,
|
|
512
|
-
clone,
|
|
513
|
-
onchange,
|
|
514
|
-
itemClass,
|
|
515
|
-
wrapper,
|
|
516
|
-
empty: vacioperovacio,
|
|
517
|
-
itemsDict: attrs.itemsDict,
|
|
518
|
-
layer: attrs.layer,
|
|
519
|
-
onAction: attrs.onAction,
|
|
520
|
-
optionsDict: attrs.optionsDict,
|
|
521
|
-
play: attrs.play,
|
|
522
|
-
auxTargetIsDefault: attrs.auxTargetIsDefault,
|
|
523
|
-
AssetButton: attrs.AssetButton,
|
|
524
|
-
CodeMirror: attrs.CodeMirror
|
|
525
|
-
}),
|
|
526
|
-
...metaDef.addAction ? [
|
|
527
|
-
m(ButtonNew, {
|
|
528
|
-
...metaDef.addAction,
|
|
529
|
-
onClick: (e) => {
|
|
530
|
-
metaDef.addAction.onClick(e, parameters, auxParameters);
|
|
531
|
-
m.redraw();
|
|
532
|
-
}
|
|
533
|
-
})
|
|
534
|
-
] : []
|
|
535
|
-
],
|
|
536
|
-
titleExpended: metaDef.titleExpanded || metaDef.hint,
|
|
537
|
-
titleCollapsed: metaDef.titleCollapsed || metaDef.hint,
|
|
538
|
-
})
|
|
539
|
-
]
|
|
540
|
-
: isSeparator
|
|
541
|
-
? [
|
|
542
|
-
m(Separator, {
|
|
543
|
-
class: metaDef.class || "mini",
|
|
544
|
-
text: typeof metaDef.title === "string"
|
|
545
|
-
? metaDef.title : metaDef.label || metaKey
|
|
546
|
-
})
|
|
547
|
-
]
|
|
548
|
-
: isText
|
|
549
|
-
? metaDef.icon
|
|
550
|
-
? [
|
|
551
|
-
m(Icon, {icon: metaDef.icon, class: metaDef.iconClass}),
|
|
552
|
-
m(".innertext", {class: metaDef.class, title: metaDef.hint}, rawValue)
|
|
553
|
-
] : [
|
|
554
|
-
m(".innertext", {class: metaDef.class, title: metaDef.hint}, rawValue)
|
|
555
|
-
]
|
|
556
|
-
: isWidget
|
|
557
|
-
? [
|
|
558
|
-
m(
|
|
559
|
-
getWidget(metaDef.widget),
|
|
560
|
-
|
|
561
|
-
typeof metaDef.attrs === "function"
|
|
562
|
-
? metaDef.attrs(
|
|
563
|
-
rawValue,
|
|
564
|
-
state,
|
|
565
|
-
(critical, rootParameters) => onchange(critical || UPDATECODE, rootParameters ? parameters : targetParameters, metaKey, undefined, metaDef),
|
|
566
|
-
global,
|
|
567
|
-
attrs,
|
|
568
|
-
targetParameters
|
|
569
|
-
)
|
|
570
|
-
: metaDef.attrs,
|
|
571
|
-
|
|
572
|
-
metaDef.children
|
|
573
|
-
? metaDef.children(rawValue, state, (critical, rootParameters) => {
|
|
574
|
-
onchange(critical || UPDATECODE, rootParameters ? parameters : targetParameters, metaKey, undefined, metaDef);
|
|
575
|
-
}, global, attrs, targetParameters)
|
|
576
|
-
: [])
|
|
577
|
-
]
|
|
578
|
-
: isPlusMinus
|
|
579
|
-
? [
|
|
580
|
-
m(PlusMinusWidget, {
|
|
581
|
-
max: metaDef.max,
|
|
582
|
-
min: metaDef.min,
|
|
583
|
-
title: metaDef.title,
|
|
584
|
-
label: metaDef.label,
|
|
585
|
-
value: rawValue,
|
|
586
|
-
onchange: (value) => {
|
|
587
|
-
set(value);
|
|
588
|
-
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
589
|
-
}
|
|
590
|
-
})
|
|
591
|
-
]
|
|
592
|
-
: isString || (isJson && !attrs.CodeMirror)
|
|
593
|
-
? [
|
|
594
|
-
m(InputWidget, {
|
|
595
|
-
containerClass: "grows",
|
|
596
|
-
class: metaDef.inputClass,
|
|
597
|
-
value: rawValue,
|
|
598
|
-
label: metaDef.label,
|
|
599
|
-
hint: isObj ? metaDef.hint : metaDef,
|
|
600
|
-
title: metaDef.title,
|
|
601
|
-
maxlength: isObj ? metaDef.maxlength || 256 : 256,
|
|
602
|
-
...metaDef.final && {
|
|
603
|
-
oninput: () => {
|
|
604
|
-
}
|
|
605
|
-
},
|
|
606
|
-
multi: isJson || metaDef.multi,
|
|
607
|
-
alwaysmulti: isJson || metaDef.alwaysmulti,
|
|
608
|
-
onchange: (value) => {
|
|
609
|
-
set(value);
|
|
610
|
-
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
611
|
-
}
|
|
612
|
-
})]
|
|
613
|
-
: isJson
|
|
614
|
-
? [
|
|
615
|
-
m(KeyWrapper, [
|
|
616
|
-
m(attrs.CodeMirror, {
|
|
617
|
-
key: parameters.id,
|
|
618
|
-
doc: rawValue,
|
|
619
|
-
schema: metaDef.schema,
|
|
620
|
-
templates: metaDef.templates,
|
|
621
|
-
hint: metaDef.dynamicHint ? metaDef.dynamicHint(targetParameters) : metaDef.hint,
|
|
622
|
-
empty: metaDef.empty,
|
|
623
|
-
onSave: (content) => {
|
|
624
|
-
if (content !== null) {
|
|
625
|
-
set(content || "");
|
|
626
|
-
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
627
|
-
if (!content) {
|
|
628
|
-
Notification.add(metaDef.hint + " cleared");
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
})
|
|
633
|
-
])
|
|
634
|
-
]
|
|
635
|
-
: isNumber
|
|
636
|
-
? [
|
|
637
|
-
m(InputWidget, {
|
|
638
|
-
containerClass: "grows",
|
|
639
|
-
class: metaDef.inputClass,
|
|
640
|
-
value: (metaDef.step > 0 && metaDef.step < 1 || metaDef.float)
|
|
641
|
-
? rawValue !== undefined
|
|
642
|
-
? (parseFloat(rawValue) || 0).toFixed(3)
|
|
643
|
-
: ""
|
|
644
|
-
: rawValue,
|
|
645
|
-
type: "text",
|
|
646
|
-
label: metaDef.label,
|
|
647
|
-
hint: isObj ? metaDef.hint : metaDef,
|
|
648
|
-
title: metaDef.title,
|
|
649
|
-
subtype: "number",
|
|
650
|
-
...metaDef.final && {
|
|
651
|
-
oninput: () => {
|
|
652
|
-
}
|
|
653
|
-
},
|
|
654
|
-
onchange: (value) => {
|
|
655
|
-
|
|
656
|
-
let
|
|
657
|
-
isFloat = metaDef.step > 0 && metaDef.step < 1 || metaDef.float,
|
|
658
|
-
{min, max} = metaDef;
|
|
659
|
-
|
|
660
|
-
if (value === undefined) {
|
|
661
|
-
set(undefined);
|
|
662
|
-
} else {
|
|
663
|
-
|
|
664
|
-
let val = isFloat ? parseFloat(value) : parseInt(value, 10);
|
|
665
|
-
|
|
666
|
-
if (!isNaN(val)) {
|
|
667
|
-
|
|
668
|
-
if (val < min) val = min;
|
|
669
|
-
if (val > max) val = max;
|
|
670
|
-
|
|
671
|
-
} else {
|
|
672
|
-
val = undefined;
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
set(val);
|
|
676
|
-
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
680
|
-
}
|
|
681
|
-
})]
|
|
682
|
-
: isNotice
|
|
683
|
-
? [m(NoticeWidget, metaDef)]
|
|
684
|
-
: isAsset
|
|
685
|
-
? attrs.AssetButton ? [
|
|
686
|
-
m(attrs.AssetButton, {
|
|
687
|
-
global,
|
|
688
|
-
value: rawValue, // metaDef.values ? metaDef.values[parameters[metaKey].id] : parameters[metaKey],
|
|
689
|
-
confirm: metaDef.confirm,
|
|
690
|
-
class: "grows " + (metaDef.containerClass || "scaff scaff-b1"),
|
|
691
|
-
buttonClass: (metaDef.buttonClass || "unitheight scaff-left"),
|
|
692
|
-
readonly: metaDef.readOnly,
|
|
693
|
-
closeClass: metaDef.closeClass,
|
|
694
|
-
textClass: metaDef.textClass || "",
|
|
695
|
-
iconClass: metaDef.iconClass || "",
|
|
696
|
-
field: metaDef.field,
|
|
697
|
-
|
|
698
|
-
types: metaDef.types,
|
|
699
|
-
subtype: metaDef.subtype,
|
|
700
|
-
file: metaDef.file,
|
|
701
|
-
pack: metaDef.pack,
|
|
702
|
-
|
|
703
|
-
shiftUpdate: metaDef.shiftUpdate,
|
|
704
|
-
shiftIcon: metaDef.shiftIcon,
|
|
705
|
-
removeIcon: metaDef.removeIcon,
|
|
706
|
-
emptyValue: metaDef.emptyText || "off",
|
|
707
|
-
emptyText: metaDef.emptyText || "off",
|
|
708
|
-
emptyIcon: metaDef.emptyIcon || metaDef.icon,
|
|
709
|
-
icon: metaDef.icon,
|
|
710
|
-
title: metaDef.title,
|
|
711
|
-
titleCollapsed: metaDef.titleCollapsed,
|
|
712
|
-
titleClass: "pad-2 pad-v no-pad-bottom",
|
|
713
|
-
parameters,
|
|
714
|
-
auxParameters,
|
|
715
|
-
onchange: (value, e) => {
|
|
716
|
-
if (e && e.shiftKey && attrs.onShiftPress) {
|
|
717
|
-
attrs.onShiftPress(metaKey, targetParameters, value);
|
|
718
|
-
} else {
|
|
719
|
-
if (value === undefined) value = metaDef.nullValue || undefined;
|
|
720
|
-
set(value);
|
|
721
|
-
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
})]
|
|
725
|
-
: [
|
|
726
|
-
m(ButtonNew, {
|
|
727
|
-
icon: metaDef.icon,
|
|
728
|
-
title: metaDef.title,
|
|
729
|
-
class: "unitheight",
|
|
730
|
-
text: "No Asset Module"
|
|
731
|
-
})
|
|
732
|
-
]
|
|
733
|
-
: isEmoji
|
|
734
|
-
? [
|
|
735
|
-
m(SmileysButton, {
|
|
736
|
-
class: "grows " + (metaDef.class || "scaff scaff-b1 unitheight font-200"),
|
|
737
|
-
icon: {glyph: rawValue},
|
|
738
|
-
icons: false,
|
|
739
|
-
onchange: (glyph) => {
|
|
740
|
-
set(glyph);
|
|
741
|
-
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
742
|
-
}
|
|
743
|
-
})]
|
|
744
|
-
: isFont
|
|
745
|
-
? [
|
|
746
|
-
m(FontSelectorButton, {
|
|
747
|
-
class: "grows " + (metaDef.class || "scaff-right unitheight"),
|
|
748
|
-
fontFamily: rawValue,
|
|
749
|
-
nodelete: metaDef.nodelete,
|
|
750
|
-
onchange: (glyph) => {
|
|
751
|
-
if (metaDef.nodelete && !glyph) return;
|
|
752
|
-
set(glyph);
|
|
753
|
-
// could be erased
|
|
754
|
-
const newTargetParameters = (metaDef.target || metaDef.forTarget) ? parameters[metaDef.target || metaDef.forTarget] : parameters;
|
|
755
|
-
onchange(!glyph ? NEEDS_DELETE : UPDATECODE, newTargetParameters, metaKey, !glyph, metaDef);
|
|
756
|
-
}
|
|
757
|
-
})]
|
|
758
|
-
: isColor
|
|
759
|
-
? [
|
|
760
|
-
m(ColorJoeWidget, {
|
|
761
|
-
class: "grows " + (metaDef.class || "unitheight") + (altKey ? " withalt" : ""),
|
|
762
|
-
color: rawValue,
|
|
763
|
-
caption: metaDef.caption,
|
|
764
|
-
noalpha: metaDef.noalpha,
|
|
765
|
-
remove: metaDef.remove,
|
|
766
|
-
onchange: (color, colorObject) => {
|
|
767
|
-
let finalColor = color;
|
|
768
|
-
if (finalColor) {
|
|
769
|
-
if (metaDef.hsl) {
|
|
770
|
-
const hsl = colorObject.hsl();
|
|
771
|
-
finalColor = [hsl.hue(), hsl.saturation(), hsl.lightness()];
|
|
772
|
-
} else if (metaDef.rgba) {
|
|
773
|
-
finalColor = [colorObject.r(), colorObject.g(), colorObject.b(), colorObject.a()];
|
|
774
|
-
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
set(finalColor);
|
|
778
|
-
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
779
|
-
},
|
|
780
|
-
...altKey && {
|
|
781
|
-
style: {
|
|
782
|
-
"--data-altval": ((((targetParameters[altKey] ?? altMeta.min) - altMeta.min) / (altMeta.max - altMeta.min)) * 100) + "%"
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
},
|
|
787
|
-
altMeta
|
|
788
|
-
? [
|
|
789
|
-
m(RangeWidget, {
|
|
790
|
-
auto0: altMeta.auto0,
|
|
791
|
-
min: altMeta.min,
|
|
792
|
-
max: altMeta.max,
|
|
793
|
-
step: altMeta.step || 0.1,
|
|
794
|
-
...altMeta.mul && {multiplier: altMeta.mul},
|
|
795
|
-
class: "col-11 grows innerlabel order-first",
|
|
796
|
-
title: altMeta.title,
|
|
797
|
-
value: targetParameters[altKey] ?? altMeta.min,
|
|
798
|
-
onchange: (value) => {
|
|
799
|
-
set(value, undefined, altKey, altMeta);
|
|
800
|
-
onchange(crit[altMetaKey], targetParameters, altMetaKey, undefined, metaDef);
|
|
801
|
-
}
|
|
802
|
-
})
|
|
803
|
-
]
|
|
804
|
-
: undefined)]
|
|
805
|
-
: isBoolean
|
|
806
|
-
? [
|
|
807
|
-
m(
|
|
808
|
-
isObj && metaDef.toggle
|
|
809
|
-
? metaDef.states ? ToggleStateWidget : ToggleWidget
|
|
810
|
-
: SwitchWidget,
|
|
811
|
-
{
|
|
812
|
-
class: "grows " + (metaDef.class || "unitheight"),
|
|
813
|
-
text: isObj ? metaDef.title || metaDef.label : metaKey,
|
|
814
|
-
icon: isObj ? metaDef.icon : undefined,
|
|
815
|
-
noclass: metaDef.noclass,
|
|
816
|
-
subline: metaDef.subline,
|
|
817
|
-
checked: rawValue,
|
|
818
|
-
title: metaDef.hint,
|
|
819
|
-
hint: metaDef.hint,
|
|
820
|
-
inverted: isObj && metaDef.inverted,
|
|
821
|
-
states: metaDef.states,
|
|
822
|
-
iconClass: metaDef.iconClass,
|
|
823
|
-
onchange: (st) => {
|
|
824
|
-
set(metaDef.states ? st : !!st);
|
|
825
|
-
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
)
|
|
829
|
-
]
|
|
830
|
-
: isActionButton
|
|
831
|
-
? [
|
|
832
|
-
m(
|
|
833
|
-
ButtonNew,
|
|
834
|
-
{
|
|
835
|
-
class: "grows " + (metaDef.class || "accentbutton unitheight"),
|
|
836
|
-
text: metaDef.label === ""
|
|
837
|
-
? null
|
|
838
|
-
: metaDef.parse ? metaDef.parse(targetParameters, auxParameters) : metaDef.label || metaDef.text || metaKey,
|
|
839
|
-
icon: metaDef.icon,
|
|
840
|
-
title: metaDef.title || metaDef.hint,
|
|
841
|
-
onClick: (e) => {
|
|
842
|
-
|
|
843
|
-
const runAction = () => {
|
|
844
|
-
if (metaDef.onClick) {
|
|
845
|
-
metaDef.onClick(metaKey, e, targetParameters, auxParameters, global, attrs);
|
|
846
|
-
} else {
|
|
847
|
-
if (attrs.onAction) attrs.onAction(metaKey, e, targetSource, attrs.arrayInfo);
|
|
848
|
-
}
|
|
849
|
-
};
|
|
850
|
-
|
|
851
|
-
if (metaDef.confirm) {
|
|
852
|
-
confirm(metaDef.confirm, runAction);
|
|
853
|
-
} else {
|
|
854
|
-
runAction();
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
)
|
|
859
|
-
]
|
|
860
|
-
: isMultiToggle
|
|
861
|
-
? [
|
|
862
|
-
m(metaDef.keys ? PagedMultiToggleWidget : MultiToggleWidget, {
|
|
863
|
-
class: "col-12 " + (metaDef.toggle ? "istoggler" : ""),
|
|
864
|
-
icon: metaDef.icon,
|
|
865
|
-
buttonClass: metaDef.buttonClass,
|
|
866
|
-
selectorClass: metaDef.selectorClass || "grows",
|
|
867
|
-
selectorButtonClass: metaDef.selectorButtonClass,
|
|
868
|
-
keys: metaDef.keys,
|
|
869
|
-
hint: metaDef.hint,
|
|
870
|
-
nocustom: metaDef.nocustom,
|
|
871
|
-
source: rawValue,
|
|
872
|
-
onchange: () => onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef),
|
|
873
|
-
...(metaDef.customWidget || {})
|
|
874
|
-
})
|
|
875
|
-
]
|
|
876
|
-
: isKeyIterator
|
|
877
|
-
? [
|
|
878
|
-
m(KeyIteratorWidget, {
|
|
879
|
-
class: "col-12" + (metaDef.class ? " " + metaDef.class : ""),
|
|
880
|
-
buttonClass: metaDef.widgetClass,
|
|
881
|
-
cardie: metaDef.cardie,
|
|
882
|
-
cardieClass: metaDef.cardieClass,
|
|
883
|
-
addButtonClass: metaDef.addButtonClass,
|
|
884
|
-
caption: metaDef.caption,
|
|
885
|
-
separatorClass: metaDef.separatorClass,
|
|
886
|
-
noseparator: metaDef.noseparator,
|
|
887
|
-
source: rawValue,
|
|
888
|
-
onchange: () => onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef),
|
|
889
|
-
widget: metaDef.keyWidget,
|
|
890
|
-
keys: metaDef.keys,
|
|
891
|
-
add: metaDef.add,
|
|
892
|
-
targetParameters,
|
|
893
|
-
auxParameters,
|
|
894
|
-
empty: metaDef.empty
|
|
895
|
-
})
|
|
896
|
-
]
|
|
897
|
-
: isButtonChoice
|
|
898
|
-
? [
|
|
899
|
-
m(ButtonChoiceWidget, {
|
|
900
|
-
class: "col-12 " + (metaDef.toggle ? "istoggler" : ""),
|
|
901
|
-
subclass: metaDef.class,
|
|
902
|
-
buttonClass: metaDef.buttonClass,
|
|
903
|
-
choices: metaDef.choices,
|
|
904
|
-
choose: metaDef.choose,
|
|
905
|
-
chooseKey: metaDef.chooseKey,
|
|
906
|
-
chooseDict: attrs.chooseDict,
|
|
907
|
-
label: metaDef.label,
|
|
908
|
-
field: metaDef.field,
|
|
909
|
-
icon: metaDef.icon,
|
|
910
|
-
value: rawValue,
|
|
911
|
-
title: metaDef.title,
|
|
912
|
-
onchange: (choice) => {
|
|
913
|
-
|
|
914
|
-
let
|
|
915
|
-
{value} = choice;
|
|
916
|
-
|
|
917
|
-
if (value || value >= 0) {
|
|
918
|
-
if (metaDef.toggle && value === rawValue) value = !value;
|
|
919
|
-
set(value, choice);
|
|
920
|
-
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
921
|
-
} else {
|
|
922
|
-
set(undefined, choice);
|
|
923
|
-
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
924
|
-
}
|
|
925
|
-
taint();
|
|
926
|
-
}
|
|
927
|
-
})
|
|
928
|
-
]
|
|
929
|
-
: !isCombo
|
|
930
|
-
? isFullCombo
|
|
931
|
-
? [
|
|
932
|
-
m(ComboWidget, {
|
|
933
|
-
class: "grows scaff scaff-b1 " + (metaDef.class || "unitheight"),
|
|
934
|
-
value: rawValue,
|
|
935
|
-
emptyText: metaDef.emptyText || "off",
|
|
936
|
-
icon: metaDef.icon,
|
|
937
|
-
title: metaDef.title,
|
|
938
|
-
items: metaDef.items,
|
|
939
|
-
textClass: metaDef.textClass || "",
|
|
940
|
-
onchange: (value) => {
|
|
941
|
-
if (typeof value === "string") value = value.trim();
|
|
942
|
-
if (value) {
|
|
943
|
-
set(value);
|
|
944
|
-
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
945
|
-
} else {
|
|
946
|
-
set(undefined);
|
|
947
|
-
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
948
|
-
}
|
|
949
|
-
taint();
|
|
950
|
-
}
|
|
951
|
-
})
|
|
952
|
-
]
|
|
953
|
-
: isRange
|
|
954
|
-
? [
|
|
955
|
-
m(RangeWidget, {
|
|
956
|
-
auto0: metaDef.auto0,
|
|
957
|
-
relative: !metaDef.auto0 && !metaDef.absolute,
|
|
958
|
-
factor: metaDef.factor,
|
|
959
|
-
min: metaDef.min,
|
|
960
|
-
max: metaDef.max,
|
|
961
|
-
step: metaDef.step || 0.1,
|
|
962
|
-
...metaDef.mul
|
|
963
|
-
? {
|
|
964
|
-
multiplier: metaDef.mul
|
|
965
|
-
}
|
|
966
|
-
: {},
|
|
967
|
-
class: "col-11 grows innerlabel",
|
|
968
|
-
title: metaDef.label || metaDef.title || (metaKey.indexOf("-") === -1 ? metaKey : metaKey.substring(metaKey.lastIndexOf("-") + 1)),
|
|
969
|
-
hint: metaDef.hint,
|
|
970
|
-
value: parseFloat(rawValue) ?? metaDef ?? metaDef.min,
|
|
971
|
-
parser: metaDef.parser,
|
|
972
|
-
onchange: (value) => {
|
|
973
|
-
set(value);
|
|
974
|
-
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
975
|
-
}
|
|
976
|
-
})
|
|
977
|
-
]
|
|
978
|
-
: [
|
|
979
|
-
m(RangeWidget, {
|
|
980
|
-
min: metaDef[0],
|
|
981
|
-
max: metaDef[1],
|
|
982
|
-
step: metaDef[2] || 0.1,
|
|
983
|
-
...metaDef[3]
|
|
984
|
-
? {
|
|
985
|
-
multiplier: metaDef[3]
|
|
986
|
-
} : {},
|
|
987
|
-
class: "col-11 grows innerlabel",
|
|
988
|
-
title: metaDef[4] || (metaKey.indexOf("-") === -1 ? metaKey : metaKey.substring(metaKey.lastIndexOf("-") + 1)),
|
|
989
|
-
value: parseFloat(rawValue) || metaDef[0],
|
|
990
|
-
onchange: (value) => {
|
|
991
|
-
set(value);
|
|
992
|
-
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
993
|
-
}
|
|
994
|
-
})
|
|
995
|
-
]
|
|
996
|
-
: [
|
|
997
|
-
m(ComboPrompt, {
|
|
998
|
-
class: metaDef.containerClass || "scaff scaff-b1",
|
|
999
|
-
buttonClass: metaDef.class || "unitheightsmall scaff-left",
|
|
1000
|
-
closeClass: metaDef.buttonClass || undefined,
|
|
1001
|
-
textClass: metaDef.textClass || "",
|
|
1002
|
-
locked: metaDef.locked,
|
|
1003
|
-
value: rawValue, // metaDef.values ? metaDef.values[parameters[metaKey].id] : parameters[metaKey],
|
|
1004
|
-
field: metaDef.field,
|
|
1005
|
-
fieldTitle: metaDef.fieldTitle,
|
|
1006
|
-
emptyText: metaDef.emptyText || "off",
|
|
1007
|
-
emptyIcon: metaDef.emptyIcon || metaDef.icon,
|
|
1008
|
-
confirm: metaDef.confirm,
|
|
1009
|
-
icon: metaDef.icon || attrs.icon,
|
|
1010
|
-
hint: metaDef.hint,
|
|
1011
|
-
label: metaDef.label,
|
|
1012
|
-
title: metaDef.question,
|
|
1013
|
-
itemsKey: typeof metaDef.optionsKey === "function" ? () => {
|
|
1014
|
-
return metaDef.optionsKey(targetParameters);
|
|
1015
|
-
} : metaDef.optionsKey,
|
|
1016
|
-
items: metaDef.options || attrs.optionsDict,
|
|
1017
|
-
removeIcon: metaDef.removeIcon,
|
|
1018
|
-
nodelete: metaDef.nodelete,
|
|
1019
|
-
onchange: (value, event) => {
|
|
1020
|
-
if (event?.shiftKey) {
|
|
1021
|
-
if (metaDef.shiftPress) {
|
|
1022
|
-
metaDef.shiftPress(targetParameters, auxParameters);
|
|
1023
|
-
}
|
|
1024
|
-
return;
|
|
1025
|
-
}
|
|
1026
|
-
if (typeof value === "string") value = value.trim();
|
|
1027
|
-
if (value) {
|
|
1028
|
-
set(metaDef.values ? metaDef.values[value] : value, metaDef.clone);
|
|
1029
|
-
onchange(UPDATECODE, targetParameters, metaKey, false, metaDef);
|
|
1030
|
-
} else {
|
|
1031
|
-
set(metaDef.nullValue || undefined);
|
|
1032
|
-
onchange(UPDATECODE, targetParameters, metaKey, true, metaDef);
|
|
1033
|
-
}
|
|
1034
|
-
taint();
|
|
1035
|
-
}
|
|
1036
|
-
})]);
|
|
1037
|
-
});
|
|
1038
|
-
|
|
1039
|
-
return total || children.length
|
|
1040
|
-
|
|
1041
|
-
? wrapper
|
|
1042
|
-
? wrapper(widgets.concat(children))
|
|
1043
|
-
: widgets.concat(children)
|
|
1044
|
-
|
|
1045
|
-
: vacioperovacio && !children.length
|
|
1046
|
-
? m(Empty, vacioperovacio)
|
|
1047
|
-
: [];
|
|
1048
|
-
}
|
|
1049
|
-
),
|
|
1050
|
-
|
|
1051
|
-
ParameterCardie = defineWidget(
|
|
1052
|
-
({attrs, children}) => {
|
|
1053
|
-
|
|
1054
|
-
const
|
|
1055
|
-
{
|
|
1056
|
-
busy, parameters, auxParameters, cardid, size, index,
|
|
1057
|
-
titleWidget, parametersTitle, parametersBody, rootUpdate: mainRootUpdate, global, layer,
|
|
1058
|
-
tableChildren, cols, onLayerReset, onAction, nofold, bodyClass, titleAction,
|
|
1059
|
-
AssetButton, CodeMirror, optionsDict
|
|
1060
|
-
} = attrs;
|
|
1061
|
-
|
|
1062
|
-
return m(CardieWidget, {
|
|
1063
|
-
|
|
1064
|
-
busy,
|
|
1065
|
-
nofold,
|
|
1066
|
-
size,
|
|
1067
|
-
cols,
|
|
1068
|
-
|
|
1069
|
-
title: parametersBody.titleCollapsed || parametersBody.title,
|
|
1070
|
-
titleCollapsed: parametersBody.titleCollapsed || parametersBody.title,
|
|
1071
|
-
titleExpanded: parametersBody.titleExpanded || parametersBody.title,
|
|
1072
|
-
action: titleAction,
|
|
1073
|
-
expandedClass: attrs.expandedClass,
|
|
1074
|
-
|
|
1075
|
-
onShiftOpen: () => {
|
|
1076
|
-
|
|
1077
|
-
},
|
|
1078
|
-
|
|
1079
|
-
titleWidget: titleWidget || ParameterTable,
|
|
1080
|
-
titleAttrs: {
|
|
1081
|
-
...parametersTitle,
|
|
1082
|
-
onShiftPress: attrs.onShiftPress,
|
|
1083
|
-
confirm: attrs.confirmTitle,
|
|
1084
|
-
itemClass: "",
|
|
1085
|
-
parameters,
|
|
1086
|
-
auxParameters,
|
|
1087
|
-
clone: true,
|
|
1088
|
-
global, layer,
|
|
1089
|
-
AssetButton,
|
|
1090
|
-
CodeMirror,
|
|
1091
|
-
optionsDict,
|
|
1092
|
-
onAction,
|
|
1093
|
-
onchange: (realtime, targetParameters, metaKey, wasDeleted, metaDef) => {
|
|
1094
|
-
|
|
1095
|
-
taint();
|
|
1096
|
-
|
|
1097
|
-
const rootUpdate = metaDef.rootUpdate || mainRootUpdate;
|
|
1098
|
-
|
|
1099
|
-
if (metaDef?.onchange) {
|
|
1100
|
-
metaDef.onchange(realtime, targetParameters, parameters);
|
|
1101
|
-
} else if (realtime) {
|
|
1102
|
-
|
|
1103
|
-
if (rootUpdate === "none") return;
|
|
1104
|
-
|
|
1105
|
-
if (rootUpdate === "both" && auxParameters) {
|
|
1106
|
-
targetParameters[NEEDS_UPDATE] = auxParameters[NEEDS_UPDATE] = realtime;
|
|
1107
|
-
} else if (rootUpdate === "parent" && auxParameters) {
|
|
1108
|
-
targetParameters[NEEDS_UPDATE] = realtime;
|
|
1109
|
-
auxParameters[NEEDS_UPDATE] = true;
|
|
1110
|
-
} else if (rootUpdate === "target" && targetParameters !== parameters) {
|
|
1111
|
-
targetParameters[NEEDS_UPDATE] = realtime;
|
|
1112
|
-
parameters[NEEDS_UPDATE] = true;
|
|
1113
|
-
} else if (rootUpdate === 2) {
|
|
1114
|
-
parameters[NEEDS_UPDATE] = realtime;
|
|
1115
|
-
} else if (rootUpdate === 1) {
|
|
1116
|
-
if (targetParameters) targetParameters[NEEDS_UPDATE] = realtime;
|
|
1117
|
-
} else if (typeof rootUpdate === "string" && rootUpdate !== "both" && rootUpdate !== "parent" && rootUpdate !== "target") {
|
|
1118
|
-
if (parameters[rootUpdate]) {
|
|
1119
|
-
parameters[rootUpdate][NEEDS_UPDATE] = realtime;
|
|
1120
|
-
parameters[NEEDS_UPDATE] = true;
|
|
1121
|
-
} else {
|
|
1122
|
-
parameters[NEEDS_UPDATE] = REBUILD_CHILDREN;
|
|
1123
|
-
}
|
|
1124
|
-
} else if (rootUpdate !== -1 && targetParameters) targetParameters[NEEDS_UPDATE] = realtime;
|
|
1125
|
-
|
|
1126
|
-
} else {
|
|
1127
|
-
onLayerReset && onLayerReset();
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
if (attrs.onTitleChange) {
|
|
1131
|
-
attrs.onTitleChange(realtime, targetParameters, metaKey, wasDeleted);
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
m.redraw();
|
|
1135
|
-
}
|
|
1136
|
-
},
|
|
1137
|
-
|
|
1138
|
-
cardid,
|
|
1139
|
-
class: "withbottommargin relative" + (attrs.class ? " " + attrs.class : ""),
|
|
1140
|
-
bodyClass,
|
|
1141
|
-
expandedView: () => [
|
|
1142
|
-
|
|
1143
|
-
...parametersBody.meta
|
|
1144
|
-
? [
|
|
1145
|
-
m(ParameterTable, {
|
|
1146
|
-
...parametersBody,
|
|
1147
|
-
confirm: attrs.confirmBody,
|
|
1148
|
-
itemClass: "pad-1",
|
|
1149
|
-
parameters,
|
|
1150
|
-
auxParameters,
|
|
1151
|
-
clone: true,
|
|
1152
|
-
global, layer,
|
|
1153
|
-
index,
|
|
1154
|
-
play: attrs.play,
|
|
1155
|
-
itemsDict: attrs.itemsDict,
|
|
1156
|
-
optionsDict,
|
|
1157
|
-
AssetButton,
|
|
1158
|
-
CodeMirror,
|
|
1159
|
-
onAction,
|
|
1160
|
-
onchange: (realtime, targetParameters, metaKey, wasDeleted, metaDef, event) => {
|
|
1161
|
-
const rootUpdate = metaDef.rootUpdate || mainRootUpdate;
|
|
1162
|
-
taint();
|
|
1163
|
-
if (metaDef?.onchange) {
|
|
1164
|
-
metaDef.onchange(realtime, targetParameters, parameters);
|
|
1165
|
-
} else if (realtime) {
|
|
1166
|
-
|
|
1167
|
-
if (rootUpdate === "none") return;
|
|
1168
|
-
|
|
1169
|
-
if (rootUpdate === "both" && auxParameters) {
|
|
1170
|
-
targetParameters[NEEDS_UPDATE] = auxParameters[NEEDS_UPDATE] = realtime;
|
|
1171
|
-
} else if (rootUpdate === "parent" && auxParameters) {
|
|
1172
|
-
targetParameters[NEEDS_UPDATE] = realtime;
|
|
1173
|
-
auxParameters[NEEDS_UPDATE] = true;
|
|
1174
|
-
} else if (rootUpdate === "target" && targetParameters !== parameters) {
|
|
1175
|
-
targetParameters[NEEDS_UPDATE] = realtime;
|
|
1176
|
-
parameters[NEEDS_UPDATE] = true;
|
|
1177
|
-
} else if (rootUpdate === 2) {
|
|
1178
|
-
parameters[NEEDS_UPDATE] = realtime;
|
|
1179
|
-
} else if (rootUpdate === 1) {
|
|
1180
|
-
if (targetParameters) targetParameters[NEEDS_UPDATE] = realtime;
|
|
1181
|
-
} else if (typeof rootUpdate === "string" && rootUpdate !== "both" && rootUpdate !== "parent" && rootUpdate !== "target") {
|
|
1182
|
-
if (parameters[rootUpdate]) {
|
|
1183
|
-
parameters[rootUpdate][NEEDS_UPDATE] = realtime;
|
|
1184
|
-
parameters[NEEDS_UPDATE] = true;
|
|
1185
|
-
} else {
|
|
1186
|
-
parameters[NEEDS_UPDATE] = REBUILD_CHILDREN;
|
|
1187
|
-
}
|
|
1188
|
-
} else if (rootUpdate !== -1 && targetParameters) targetParameters[NEEDS_UPDATE] = realtime;
|
|
1189
|
-
|
|
1190
|
-
} else {
|
|
1191
|
-
onLayerReset && onLayerReset();
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
|
-
if (attrs.onChange) {
|
|
1195
|
-
attrs.onChange(realtime, metaKey, targetParameters, auxParameters, wasDeleted, metaDef, event, attrs);
|
|
1196
|
-
}
|
|
1197
|
-
m.redraw();
|
|
1198
|
-
}
|
|
1199
|
-
}, tableChildren)
|
|
1200
|
-
]
|
|
1201
|
-
: parametersBody.emptyMeta
|
|
1202
|
-
? [m(Empty, parametersBody.emptyMeta)]
|
|
1203
|
-
: [],
|
|
1204
|
-
|
|
1205
|
-
...(children || [])
|
|
1206
|
-
],
|
|
1207
|
-
collapsedView: attrs.collapsedView,
|
|
1208
|
-
|
|
1209
|
-
});
|
|
1210
|
-
}
|
|
1211
|
-
),
|
|
1212
|
-
|
|
1213
|
-
TemplatedInputWidget = defineWidget(({attrs, state, children}) => {
|
|
1214
|
-
|
|
1215
|
-
const {layer, property, colorProperty} = attrs,
|
|
1216
|
-
template = InputTemplates[property],
|
|
1217
|
-
currentProperty = layer[property],
|
|
1218
|
-
|
|
1219
|
-
has = currentProperty !== undefined && currentProperty !== null,
|
|
1220
|
-
hasObject = has && typeof currentProperty === "object" && currentProperty !== null,
|
|
1221
|
-
parameters = hasObject && currentProperty,
|
|
1222
|
-
dynamicExp = parameters && parameters.exp,
|
|
1223
|
-
|
|
1224
|
-
[, meta] = dynamicExp || [],
|
|
1225
|
-
metaKeys = parameters && meta && Object.keys(meta),
|
|
1226
|
-
title = hasObject && currentProperty ? currentProperty.title : currentProperty,
|
|
1227
|
-
hasMeta = metaKeys && metaKeys.length,
|
|
1228
|
-
hasSize = (attrs.size && hasObject);
|
|
1229
|
-
|
|
1230
|
-
// noinspection JSObjectNullOrUndefined
|
|
1231
|
-
return m(
|
|
1232
|
-
"li.coord.witharia.relative.templatedinput",
|
|
1233
|
-
{
|
|
1234
|
-
"aria-label": attrs["aria-label"],
|
|
1235
|
-
class: (state.chooser && template ? attrs.chooserClass : attrs.containerClass) || "col-12"
|
|
1236
|
-
},
|
|
1237
|
-
[
|
|
1238
|
-
...attrs.docs
|
|
1239
|
-
? [
|
|
1240
|
-
m(
|
|
1241
|
-
"a.extlink.absolute.to-right.to-top.font-75.pad-2.pointer",
|
|
1242
|
-
{
|
|
1243
|
-
target: "tool",
|
|
1244
|
-
onclick: () => {
|
|
1245
|
-
NIPX.sys.open(attrs.docs.url);
|
|
1246
|
-
}
|
|
1247
|
-
},
|
|
1248
|
-
attrs.docs.caption || "docs"
|
|
1249
|
-
)
|
|
1250
|
-
]
|
|
1251
|
-
: [],
|
|
1252
|
-
|
|
1253
|
-
attrs.chooser ? [m(".flexrow.grows.fontgroup", [m(ButtonNew, {
|
|
1254
|
-
class: "grows unitheightsmall rectbutton ohidden",
|
|
1255
|
-
text: title || "--- NONE ---",
|
|
1256
|
-
icon: attrs.icon,
|
|
1257
|
-
onClick: (e) => {
|
|
1258
|
-
if (!state.chooser && e.shiftKey && template.images) {
|
|
1259
|
-
MainState.setTransState("image", undefined, {
|
|
1260
|
-
giphyQuery: "frame",
|
|
1261
|
-
onOverride: (global, item) => {
|
|
1262
|
-
const translated = item && template.images(item);
|
|
1263
|
-
if (translated) {
|
|
1264
|
-
layer[property] = cloneObject(translated);
|
|
1265
|
-
taint();
|
|
1266
|
-
m.redraw();
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
});
|
|
1270
|
-
return;
|
|
1271
|
-
}
|
|
1272
|
-
state.chooser = !state.chooser;
|
|
1273
|
-
m.redraw();
|
|
1274
|
-
}
|
|
1275
|
-
}), ...layer[property] ? [m(ButtonNew, {
|
|
1276
|
-
class: "clearfont unitheightsmall bg-accent",
|
|
1277
|
-
text: "X",
|
|
1278
|
-
onClick: () => {
|
|
1279
|
-
delete layer[property];
|
|
1280
|
-
taint();
|
|
1281
|
-
m.redraw();
|
|
1282
|
-
}
|
|
1283
|
-
})] : template.images && !title ? [m(ButtonNew, {
|
|
1284
|
-
class: "unitsizesmall rectbutton ohidden",
|
|
1285
|
-
icon: "images",
|
|
1286
|
-
onClick: () => MainState.setTransState("image", undefined, {
|
|
1287
|
-
giphyQuery: "frame",
|
|
1288
|
-
onOverride: (global, item) => {
|
|
1289
|
-
const translated = item && template.images(item);
|
|
1290
|
-
if (translated) {
|
|
1291
|
-
layer[property] = cloneObject(translated);
|
|
1292
|
-
taint();
|
|
1293
|
-
m.redraw();
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
|
-
})
|
|
1297
|
-
})] : []])] : [m(InputWidget, {
|
|
1298
|
-
class: "withicon-2" + (has ? " has" : "") + (attrs.class ? " " + attrs.class : ""),
|
|
1299
|
-
value: layer[property] || "",
|
|
1300
|
-
hint: attrs.hint,
|
|
1301
|
-
title: attrs.title,
|
|
1302
|
-
maxlength: attrs.maxlength || 2048,
|
|
1303
|
-
multi: attrs.multi,
|
|
1304
|
-
actions: [{
|
|
1305
|
-
icon: "plus",
|
|
1306
|
-
onClick: () => {
|
|
1307
|
-
state.chooser = !state.chooser;
|
|
1308
|
-
m.redraw();
|
|
1309
|
-
}
|
|
1310
|
-
}],
|
|
1311
|
-
onchange: (value) => {
|
|
1312
|
-
|
|
1313
|
-
value = value.split("\n")
|
|
1314
|
-
.join(" ")
|
|
1315
|
-
.trim();
|
|
1316
|
-
|
|
1317
|
-
layer[property] = value;
|
|
1318
|
-
taint();
|
|
1319
|
-
m.redraw();
|
|
1320
|
-
}
|
|
1321
|
-
})],
|
|
1322
|
-
|
|
1323
|
-
...(hasMeta || hasSize) ? [m(".flexrow.wrap.paramgroup", [
|
|
1324
|
-
|
|
1325
|
-
...hasMeta ? [m(ParameterTable, {
|
|
1326
|
-
|
|
1327
|
-
meta,
|
|
1328
|
-
metaKeys,
|
|
1329
|
-
parameters,
|
|
1330
|
-
onchange: () => {
|
|
1331
|
-
delete currentProperty.calc;
|
|
1332
|
-
taint();
|
|
1333
|
-
m.redraw();
|
|
1334
|
-
},
|
|
1335
|
-
AssetButton: attrs.AssetButton,
|
|
1336
|
-
CodeMirror: attrs.CodeMirror
|
|
1337
|
-
})] : [],
|
|
1338
|
-
|
|
1339
|
-
...hasSize ? [m(".flexbreak"), m(RangeWidget, {
|
|
1340
|
-
class: "col-6 grows innerlabel",
|
|
1341
|
-
title: "size x",
|
|
1342
|
-
min: 0,
|
|
1343
|
-
max: 100,
|
|
1344
|
-
step: 0.1,
|
|
1345
|
-
relative: true,
|
|
1346
|
-
value: parseFloat(currentProperty.w) || 0,
|
|
1347
|
-
onchange: (value) => {
|
|
1348
|
-
currentProperty.w = value;
|
|
1349
|
-
taint();
|
|
1350
|
-
m.redraw();
|
|
1351
|
-
}
|
|
1352
|
-
}), m(RangeWidget, {
|
|
1353
|
-
class: "col-6 grows innerlabel",
|
|
1354
|
-
title: "size y",
|
|
1355
|
-
min: 0,
|
|
1356
|
-
max: 100,
|
|
1357
|
-
step: 0.1,
|
|
1358
|
-
relative: true,
|
|
1359
|
-
value: parseFloat(currentProperty.h) || 0,
|
|
1360
|
-
onchange: (value) => {
|
|
1361
|
-
currentProperty.h = value;
|
|
1362
|
-
taint();
|
|
1363
|
-
m.redraw();
|
|
1364
|
-
}
|
|
1365
|
-
})] : []])] : [],
|
|
1366
|
-
|
|
1367
|
-
...(state.chooser && template) ? [m(TemplateWidget, {
|
|
1368
|
-
entity: attrs.entity,
|
|
1369
|
-
template,
|
|
1370
|
-
type: layer.type,
|
|
1371
|
-
layer,
|
|
1372
|
-
onClick: (item) => {
|
|
1373
|
-
|
|
1374
|
-
state.chooser = false;
|
|
1375
|
-
|
|
1376
|
-
layer[property] = typeof item.value === "object"
|
|
1377
|
-
? cloneObject(item.value)
|
|
1378
|
-
: item.value;
|
|
1379
|
-
|
|
1380
|
-
if (item.color && colorProperty) {
|
|
1381
|
-
layer[colorProperty] = item.color;
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
taint();
|
|
1385
|
-
|
|
1386
|
-
m.redraw();
|
|
1387
|
-
|
|
1388
|
-
}
|
|
1389
|
-
})] : [], ...has ? children : []]
|
|
1390
|
-
);
|
|
1391
|
-
});
|
|
1392
|
-
|
|
1393
|
-
export {
|
|
1394
|
-
TemplatedInputWidget, ParameterTable, ParameterCardie, MultiToggleWidget, RangeToggleWidget
|
|
1395
|
-
};
|