@yuneta/gobj-ui 2.0.0 → 2.2.3
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/README.md +25 -20
- package/dist/gobj-ui.cjs.js +2340 -528
- package/dist/gobj-ui.es.js +2340 -530
- package/index.js +32 -31
- package/package.json +6 -7
- package/{c_g6_nodes_tree.js → src/c_g6_nodes_tree.js} +6 -1
- package/{c_yui_form.js → src/c_yui_form.js} +1 -1
- package/{c_yui_gobj_tree_js.js → src/c_yui_gobj_tree_js.js} +1 -1
- package/{c_yui_json_graph.js → src/c_yui_json_graph.js} +1 -1
- package/{c_yui_main.js → src/c_yui_main.js} +3 -3
- package/{c_yui_map.js → src/c_yui_map.js} +6 -1
- package/{c_yui_nav.js → src/c_yui_nav.js} +134 -26
- package/{c_yui_pager.js → src/c_yui_pager.js} +1 -1
- package/{c_yui_routing.css → src/c_yui_routing.css} +1 -1
- package/{c_yui_routing.js → src/c_yui_routing.js} +1 -1
- package/{c_yui_shell.css → src/c_yui_shell.css} +110 -0
- package/{c_yui_shell.js → src/c_yui_shell.js} +175 -13
- package/{c_yui_tabs.js → src/c_yui_tabs.js} +1 -1
- package/{c_yui_treedb_graph.js → src/c_yui_treedb_graph.js} +35 -9
- package/{c_yui_treedb_topic_with_form.js → src/c_yui_treedb_topic_with_form.js} +1 -1
- package/{c_yui_treedb_topics.js → src/c_yui_treedb_topics.js} +36 -8
- package/{c_yui_uplot.js → src/c_yui_uplot.js} +1 -1
- package/{c_yui_window.js → src/c_yui_window.js} +242 -21
- package/src/c_yui_window_manager.js +602 -0
- package/{c_yui_wizard.js → src/c_yui_wizard.js} +1 -1
- package/{shell_modals.js → src/shell_modals.js} +53 -13
- package/src/tabulator.css +53 -0
- package/src/yui_dev.js +1484 -0
- package/{yui_icons.css → src/yui_icons.css} +5 -0
- package/src/yui_inputs.css +32 -0
- package/src/yui_inputs.js +71 -0
- package/vite.config.js +0 -131
- package/yui_dev.js +0 -583
- /package/{c_yui_main.css → src/c_yui_main.css} +0 -0
- /package/{c_yui_map.css → src/c_yui_map.css} +0 -0
- /package/{c_yui_treedb_topic_with_form.css → src/c_yui_treedb_topic_with_form.css} +0 -0
- /package/{g6_drag_canvas_touch.js → src/g6_drag_canvas_touch.js} +0 -0
- /package/{lib_graph.css → src/lib_graph.css} +0 -0
- /package/{lib_graph.js → src/lib_graph.js} +0 -0
- /package/{lib_icons.js → src/lib_icons.js} +0 -0
- /package/{lib_maplibre.js → src/lib_maplibre.js} +0 -0
- /package/{pager_helpers.js → src/pager_helpers.js} +0 -0
- /package/{pager_helpers.test.js → src/pager_helpers.test.js} +0 -0
- /package/{route_resolver.js → src/route_resolver.js} +0 -0
- /package/{route_resolver.test.js → src/route_resolver.test.js} +0 -0
- /package/{shell_focus_trap.js → src/shell_focus_trap.js} +0 -0
- /package/{shell_focus_trap.test.js → src/shell_focus_trap.test.js} +0 -0
- /package/{shell_show_on.js → src/shell_show_on.js} +0 -0
- /package/{shell_show_on.test.js → src/shell_show_on.test.js} +0 -0
- /package/{shell_toolbar_helpers.js → src/shell_toolbar_helpers.js} +0 -0
- /package/{shell_toolbar_helpers.test.js → src/shell_toolbar_helpers.test.js} +0 -0
- /package/{themes.js → src/themes.js} +0 -0
- /package/{wizard_helpers.js → src/wizard_helpers.js} +0 -0
- /package/{wizard_helpers.test.js → src/wizard_helpers.test.js} +0 -0
- /package/{ytable.css → src/ytable.css} +0 -0
- /package/{ytable.js → src/ytable.js} +0 -0
- /package/{yui_toolbar.css → src/yui_toolbar.css} +0 -0
- /package/{yui_toolbar.js → src/yui_toolbar.js} +0 -0
package/yui_dev.js
DELETED
|
@@ -1,583 +0,0 @@
|
|
|
1
|
-
/***********************************************************************
|
|
2
|
-
* ui_dev.js
|
|
3
|
-
*
|
|
4
|
-
* Development Tools
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2024, ArtGins.
|
|
7
|
-
* All Rights Reserved.
|
|
8
|
-
***********************************************************************/
|
|
9
|
-
import {
|
|
10
|
-
gobj_yuno,
|
|
11
|
-
log_error,
|
|
12
|
-
is_string,
|
|
13
|
-
createElement2,
|
|
14
|
-
kw_get_local_storage_value,
|
|
15
|
-
kw_set_local_storage_value,
|
|
16
|
-
gobj_write_attr,
|
|
17
|
-
gobj_create_service,
|
|
18
|
-
trace_json,
|
|
19
|
-
} from "@yuneta/gobj-js";
|
|
20
|
-
|
|
21
|
-
import i18next from 'i18next';
|
|
22
|
-
|
|
23
|
-
import { JSONEditor } from 'vanilla-jsoneditor';
|
|
24
|
-
import "vanilla-jsoneditor/themes/jse-theme-dark.css";
|
|
25
|
-
|
|
26
|
-
/************************************************************
|
|
27
|
-
*
|
|
28
|
-
************************************************************/
|
|
29
|
-
function info_traffic(title, msg, direction, size)
|
|
30
|
-
{
|
|
31
|
-
// Render into the traffic logger if it is present (old shell:
|
|
32
|
-
// inside C_YUI_WINDOW; new shell: inside the build_dev_panel()
|
|
33
|
-
// modal). Otherwise just dump to the console.
|
|
34
|
-
if(!document.getElementById('developer-traffic-logger')) {
|
|
35
|
-
trace_json(msg);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if(!size) {
|
|
40
|
-
size = 0;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
let jn_msg;
|
|
44
|
-
try {
|
|
45
|
-
if(is_string(msg)) {
|
|
46
|
-
jn_msg = JSON.parse(msg);
|
|
47
|
-
} else {
|
|
48
|
-
jn_msg = JSON.parse(JSON.stringify(msg));
|
|
49
|
-
}
|
|
50
|
-
} catch (e) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
let content = {
|
|
55
|
-
text: undefined,
|
|
56
|
-
json: jn_msg
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
function formatCurrentTime() {
|
|
60
|
-
let now = new Date();
|
|
61
|
-
|
|
62
|
-
// Pad single digit numbers with a leading zero
|
|
63
|
-
let pad = (num, size) => ('000' + num).slice(size * -1);
|
|
64
|
-
|
|
65
|
-
let hours = pad(now.getHours(), 2);
|
|
66
|
-
let minutes = pad(now.getMinutes(), 2);
|
|
67
|
-
let seconds = pad(now.getSeconds(), 2);
|
|
68
|
-
let milliseconds = pad(now.getMilliseconds(), 4);
|
|
69
|
-
|
|
70
|
-
// Format to hh:mm:ss .SSSS
|
|
71
|
-
return `${hours}:${minutes}:${seconds} .${milliseconds}`;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
let element = document.getElementById('developer-traffic-logger');
|
|
75
|
-
if(element) {
|
|
76
|
-
let style = "background-color:#3883FA;";
|
|
77
|
-
if(direction === 2) {
|
|
78
|
-
style += "color:yellow;";
|
|
79
|
-
} else if(direction === 3) {
|
|
80
|
-
style += "color:red;";
|
|
81
|
-
} else {
|
|
82
|
-
style += "color:white;";
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
let $item = createElement2(
|
|
86
|
-
['div', {class: 'mt-4'}, [
|
|
87
|
-
['div', {class: 'is-flex with-border is-justify-content-space-between', style: style}, [
|
|
88
|
-
['div', {class: 'p-1'}, title],
|
|
89
|
-
['div', {class: 'p-1'}, `(${size} bytes)`],
|
|
90
|
-
['div', {class: 'p-1'}, formatCurrentTime()]
|
|
91
|
-
]],
|
|
92
|
-
['div', {class: 'x-jsoneditor jse-theme-dark'}, []],
|
|
93
|
-
]]
|
|
94
|
-
);
|
|
95
|
-
let $target = $item.querySelector('.x-jsoneditor');
|
|
96
|
-
let font_family = "DejaVu Sans Mono, monospace, consolas, monaco";
|
|
97
|
-
let sz = 15;
|
|
98
|
-
$target.style.setProperty('--jse-font-size-mono', sz + 'px');
|
|
99
|
-
$target.style.setProperty('--jse-font-family-mono', font_family);
|
|
100
|
-
|
|
101
|
-
document.getElementById("developer-traffic-logger").appendChild($item);
|
|
102
|
-
|
|
103
|
-
let editor = new JSONEditor({
|
|
104
|
-
target: $target,
|
|
105
|
-
props: {
|
|
106
|
-
content: content,
|
|
107
|
-
readOnly: true,
|
|
108
|
-
timestampTag: function ({field, value, path}) {
|
|
109
|
-
if (field === '__t__' || field === '__tm__' || field === 'tm' ||
|
|
110
|
-
field === 'from_t' || field === 'to_t' || field === 't' ||
|
|
111
|
-
field === 'from_tm' || field === 'to_tm' || field === 'time'
|
|
112
|
-
) {
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
return false;
|
|
116
|
-
},
|
|
117
|
-
timestampFormat: function ({field, value, path}) {
|
|
118
|
-
if (field === '__t__' || field === '__tm__' || field === 'tm' ||
|
|
119
|
-
field === 'from_t' || field === 'to_t' || field === 't' ||
|
|
120
|
-
field === 'from_tm' || field === 'to_tm' || field === 'time'
|
|
121
|
-
) {
|
|
122
|
-
return new Date(value * 1000).toISOString();
|
|
123
|
-
}
|
|
124
|
-
return null;
|
|
125
|
-
},
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
editor.expand(path => path.length < 2);
|
|
129
|
-
|
|
130
|
-
element.scrollIntoView({block: "end"});
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/************************************************************
|
|
135
|
-
*
|
|
136
|
-
************************************************************/
|
|
137
|
-
function trace_traffic()
|
|
138
|
-
{
|
|
139
|
-
let v = kw_get_local_storage_value("trace_traffic");
|
|
140
|
-
v = Number(v);
|
|
141
|
-
if(v) {
|
|
142
|
-
gobj_write_attr(gobj_yuno(), "trace_inter_event", false);
|
|
143
|
-
v = 0;
|
|
144
|
-
} else {
|
|
145
|
-
gobj_write_attr(gobj_yuno(), "trace_inter_event", true);
|
|
146
|
-
gobj_write_attr(gobj_yuno(), "trace_ievent_callback", info_traffic);
|
|
147
|
-
v = 1;
|
|
148
|
-
}
|
|
149
|
-
kw_set_local_storage_value("trace_traffic", v);
|
|
150
|
-
info_user();
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/************************************************************
|
|
154
|
-
*
|
|
155
|
-
************************************************************/
|
|
156
|
-
function trace_automata()
|
|
157
|
-
{
|
|
158
|
-
let v = kw_get_local_storage_value("trace_automata");
|
|
159
|
-
v = Number(v);
|
|
160
|
-
if(v===0) {
|
|
161
|
-
v = 1;
|
|
162
|
-
} else if(v===1) {
|
|
163
|
-
v = 2;
|
|
164
|
-
} else {
|
|
165
|
-
v = 0;
|
|
166
|
-
}
|
|
167
|
-
gobj_write_attr(gobj_yuno(), "tracing", v);
|
|
168
|
-
kw_set_local_storage_value("trace_automata", v);
|
|
169
|
-
info_user();
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/************************************************************
|
|
173
|
-
*
|
|
174
|
-
************************************************************/
|
|
175
|
-
function trace_creation()
|
|
176
|
-
{
|
|
177
|
-
let v = kw_get_local_storage_value("trace_creation");
|
|
178
|
-
v = Number(v);
|
|
179
|
-
if(v===0) {
|
|
180
|
-
v = 1;
|
|
181
|
-
} else {
|
|
182
|
-
v = 0;
|
|
183
|
-
}
|
|
184
|
-
gobj_write_attr(gobj_yuno(), "trace_creation", v);
|
|
185
|
-
kw_set_local_storage_value("trace_creation", v);
|
|
186
|
-
info_user();
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/************************************************************
|
|
190
|
-
*
|
|
191
|
-
************************************************************/
|
|
192
|
-
function trace_start_stop()
|
|
193
|
-
{
|
|
194
|
-
let v = kw_get_local_storage_value("trace_start_stop");
|
|
195
|
-
v = Number(v);
|
|
196
|
-
if(v===0) {
|
|
197
|
-
v = 1;
|
|
198
|
-
} else {
|
|
199
|
-
v = 0;
|
|
200
|
-
}
|
|
201
|
-
gobj_write_attr(gobj_yuno(), "trace_start_stop", v);
|
|
202
|
-
kw_set_local_storage_value("trace_start_stop", v);
|
|
203
|
-
info_user();
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/************************************************************
|
|
207
|
-
*
|
|
208
|
-
************************************************************/
|
|
209
|
-
function trace_subscriptions()
|
|
210
|
-
{
|
|
211
|
-
let v = kw_get_local_storage_value("trace_subscriptions");
|
|
212
|
-
v = Number(v);
|
|
213
|
-
if(v===0) {
|
|
214
|
-
v = 1;
|
|
215
|
-
} else {
|
|
216
|
-
v = 0;
|
|
217
|
-
}
|
|
218
|
-
gobj_write_attr(gobj_yuno(), "trace_subscriptions", v);
|
|
219
|
-
kw_set_local_storage_value("trace_subscriptions", v);
|
|
220
|
-
info_user();
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/************************************************************
|
|
224
|
-
*
|
|
225
|
-
************************************************************/
|
|
226
|
-
function trace_i18n()
|
|
227
|
-
{
|
|
228
|
-
let v = kw_get_local_storage_value("trace_i18n");
|
|
229
|
-
v = Number(v);
|
|
230
|
-
if(v===0) {
|
|
231
|
-
v = 1;
|
|
232
|
-
} else {
|
|
233
|
-
v = 0;
|
|
234
|
-
}
|
|
235
|
-
i18next.options.debug = v?true:false;
|
|
236
|
-
kw_set_local_storage_value("trace_i18n", v);
|
|
237
|
-
info_user();
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/************************************************************
|
|
241
|
-
*
|
|
242
|
-
************************************************************/
|
|
243
|
-
function set_no_poll()
|
|
244
|
-
{
|
|
245
|
-
let v = kw_get_local_storage_value("no_poll");
|
|
246
|
-
v = Number(v);
|
|
247
|
-
if(v) {
|
|
248
|
-
v = 0;
|
|
249
|
-
} else {
|
|
250
|
-
v = 1;
|
|
251
|
-
}
|
|
252
|
-
gobj_write_attr(gobj_yuno(), "no_poll", v);
|
|
253
|
-
kw_set_local_storage_value("no_poll", v);
|
|
254
|
-
info_user();
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/************************************************************
|
|
258
|
-
*
|
|
259
|
-
************************************************************/
|
|
260
|
-
function info_user()
|
|
261
|
-
{
|
|
262
|
-
let $info = document.getElementById("developer-window-info");
|
|
263
|
-
|
|
264
|
-
let traffic = Number(kw_get_local_storage_value("trace_traffic", 0, false));
|
|
265
|
-
let trace = Number(kw_get_local_storage_value("trace_automata", 0, false));
|
|
266
|
-
let creation = Number(kw_get_local_storage_value("trace_creation", 0, false));
|
|
267
|
-
let start_stop = Number(kw_get_local_storage_value("trace_start_stop", 0, false));
|
|
268
|
-
let subscriptions = Number(kw_get_local_storage_value("trace_subscriptions", 0, false));
|
|
269
|
-
|
|
270
|
-
let i18n = Number(kw_get_local_storage_value("trace_i18n", 0, false));
|
|
271
|
-
let no_poll = Number(kw_get_local_storage_value("no_poll", 0, false));
|
|
272
|
-
|
|
273
|
-
// Code repeated
|
|
274
|
-
// Build with DOM instead of innerHTML to prevent any XSS via localStorage values
|
|
275
|
-
$info.replaceChildren();
|
|
276
|
-
[
|
|
277
|
-
`Automata: ${trace}`,
|
|
278
|
-
`Creation: ${creation}`,
|
|
279
|
-
`Start/Stop: ${start_stop}`,
|
|
280
|
-
`Subscriptions: ${subscriptions}`,
|
|
281
|
-
`I18n: ${i18n}`,
|
|
282
|
-
`Traffic: ${traffic}`,
|
|
283
|
-
`No poll: ${no_poll}`,
|
|
284
|
-
].forEach(text => {
|
|
285
|
-
const div = document.createElement('div');
|
|
286
|
-
div.textContent = text;
|
|
287
|
-
$info.appendChild(div);
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/************************************************************
|
|
292
|
-
* Was the developer window open last session? setup_dev()
|
|
293
|
-
* persists open_developer_window (1 on open, 0 on close), so
|
|
294
|
-
* the host can reopen it on refresh and keep collecting
|
|
295
|
-
* traffic/traces it had enabled.
|
|
296
|
-
************************************************************/
|
|
297
|
-
function dev_window_was_open()
|
|
298
|
-
{
|
|
299
|
-
return Number(kw_get_local_storage_value("open_developer_window", 0, false))
|
|
300
|
-
? true : false;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
/************************************************************
|
|
304
|
-
* Apply ALL persisted developer-trace flags to the running
|
|
305
|
-
* yuno. Independent of the dev window — call it once at app
|
|
306
|
-
* startup so a refresh keeps logging whatever was enabled.
|
|
307
|
-
* Single source of truth for "localStorage flag → effect";
|
|
308
|
-
* setup_dev() and build_dev_panel() reuse it instead of each
|
|
309
|
-
* re-applying a partial subset.
|
|
310
|
-
************************************************************/
|
|
311
|
-
function apply_dev_traces()
|
|
312
|
-
{
|
|
313
|
-
let traffic = Number(kw_get_local_storage_value("trace_traffic", 0, false));
|
|
314
|
-
let trace = Number(kw_get_local_storage_value("trace_automata", 0, false));
|
|
315
|
-
let creation = Number(kw_get_local_storage_value("trace_creation", 0, false));
|
|
316
|
-
let start_stop = Number(kw_get_local_storage_value("trace_start_stop", 0, false));
|
|
317
|
-
let subscriptions = Number(kw_get_local_storage_value("trace_subscriptions", 0, false));
|
|
318
|
-
let i18n = Number(kw_get_local_storage_value("trace_i18n", 0, false));
|
|
319
|
-
let no_poll = Number(kw_get_local_storage_value("no_poll", 0, false));
|
|
320
|
-
|
|
321
|
-
if(traffic) {
|
|
322
|
-
gobj_write_attr(gobj_yuno(), "trace_inter_event", true);
|
|
323
|
-
gobj_write_attr(gobj_yuno(), "trace_ievent_callback", info_traffic);
|
|
324
|
-
} else {
|
|
325
|
-
gobj_write_attr(gobj_yuno(), "trace_inter_event", false);
|
|
326
|
-
}
|
|
327
|
-
gobj_write_attr(gobj_yuno(), "tracing", trace);
|
|
328
|
-
gobj_write_attr(gobj_yuno(), "trace_creation", creation);
|
|
329
|
-
gobj_write_attr(gobj_yuno(), "trace_start_stop", start_stop);
|
|
330
|
-
gobj_write_attr(gobj_yuno(), "trace_subscriptions", subscriptions);
|
|
331
|
-
gobj_write_attr(gobj_yuno(), "no_poll", no_poll);
|
|
332
|
-
i18next.options.debug = i18n ? true : false;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/************************************************************
|
|
336
|
-
* Open the developer panel inside a non-modal C_YUI_WINDOW
|
|
337
|
-
* (title bar + maximize + close + resize).
|
|
338
|
-
*
|
|
339
|
-
* Shell-agnostic: the legacy C_YUI_MAIN shell has a
|
|
340
|
-
* '#top-layer' stacking element; the new C_YUI_SHELL does not.
|
|
341
|
-
* We pass that element when present, otherwise null — and
|
|
342
|
-
* C_YUI_WINDOW falls back to document.body by contract. So the
|
|
343
|
-
* new shell gets the same windowed dev panel instead of the
|
|
344
|
-
* floating build_dev_panel() box. Legacy behaviour is
|
|
345
|
-
* unchanged (when '#top-layer' exists it is still used).
|
|
346
|
-
************************************************************/
|
|
347
|
-
function setup_dev(self, show)
|
|
348
|
-
{
|
|
349
|
-
let traffic = Number(kw_get_local_storage_value("trace_traffic", 0, false));
|
|
350
|
-
let trace = Number(kw_get_local_storage_value("trace_automata", 0, false));
|
|
351
|
-
let creation = Number(kw_get_local_storage_value("trace_creation", 0, false));
|
|
352
|
-
let start_stop = Number(kw_get_local_storage_value("trace_start_stop", 0, false));
|
|
353
|
-
let subscriptions = Number(kw_get_local_storage_value("trace_subscriptions", 0, false));
|
|
354
|
-
let i18n = Number(kw_get_local_storage_value("trace_i18n", 0, false));
|
|
355
|
-
let no_poll = Number(kw_get_local_storage_value("no_poll", 0, false));
|
|
356
|
-
|
|
357
|
-
if(show) {
|
|
358
|
-
const $dev_toolbar = createElement2(
|
|
359
|
-
['div', {class: 'buttons'}, [
|
|
360
|
-
['button', {
|
|
361
|
-
class: 'button',
|
|
362
|
-
}, 'Automata', {
|
|
363
|
-
click: (evt) => {
|
|
364
|
-
evt.stopPropagation();
|
|
365
|
-
trace_automata();
|
|
366
|
-
}
|
|
367
|
-
}],
|
|
368
|
-
['button', {
|
|
369
|
-
class: 'button',
|
|
370
|
-
}, 'Creation', {
|
|
371
|
-
click: (evt) => {
|
|
372
|
-
evt.stopPropagation();
|
|
373
|
-
trace_creation();
|
|
374
|
-
}
|
|
375
|
-
}],
|
|
376
|
-
['button', {
|
|
377
|
-
class: 'button',
|
|
378
|
-
}, 'Star/Stop', {
|
|
379
|
-
click: (evt) => {
|
|
380
|
-
evt.stopPropagation();
|
|
381
|
-
trace_start_stop();
|
|
382
|
-
}
|
|
383
|
-
}],
|
|
384
|
-
['button', {
|
|
385
|
-
class: 'button',
|
|
386
|
-
}, 'Subscriptions', {
|
|
387
|
-
click: (evt) => {
|
|
388
|
-
evt.stopPropagation();
|
|
389
|
-
trace_subscriptions();
|
|
390
|
-
}
|
|
391
|
-
}],
|
|
392
|
-
['button', {
|
|
393
|
-
class: 'button',
|
|
394
|
-
}, 'I18n', {
|
|
395
|
-
click: (evt) => {
|
|
396
|
-
evt.stopPropagation();
|
|
397
|
-
trace_i18n();
|
|
398
|
-
}
|
|
399
|
-
}],
|
|
400
|
-
['button', {
|
|
401
|
-
class: 'button',
|
|
402
|
-
}, 'Traffic', {
|
|
403
|
-
click: (evt) => {
|
|
404
|
-
evt.stopPropagation();
|
|
405
|
-
trace_traffic();
|
|
406
|
-
}
|
|
407
|
-
}],
|
|
408
|
-
['button', {
|
|
409
|
-
class: 'button',
|
|
410
|
-
}, 'No Poll', {
|
|
411
|
-
click: (evt) => {
|
|
412
|
-
evt.stopPropagation();
|
|
413
|
-
set_no_poll();
|
|
414
|
-
}
|
|
415
|
-
}],
|
|
416
|
-
['button', {
|
|
417
|
-
class: 'button',
|
|
418
|
-
}, 'Clear Traffic', {
|
|
419
|
-
click: (evt) => {
|
|
420
|
-
evt.stopPropagation();
|
|
421
|
-
document.getElementById("developer-traffic-logger").innerHTML = "";
|
|
422
|
-
}
|
|
423
|
-
}],
|
|
424
|
-
]]
|
|
425
|
-
);
|
|
426
|
-
|
|
427
|
-
// TODO repon la position
|
|
428
|
-
// onViewResize: function() {
|
|
429
|
-
// var record = filter_dict(this.config, self.config.traffic_window_position);
|
|
430
|
-
// gobj_update_writable_attrs({traffic_window_position: record});
|
|
431
|
-
// gobj_save_persistent_attrs();
|
|
432
|
-
// },
|
|
433
|
-
// onViewMoveEnd: function() {
|
|
434
|
-
// var record = filter_dict(this.config, self.config.traffic_window_position);
|
|
435
|
-
// gobj_update_writable_attrs({traffic_window_position: record});
|
|
436
|
-
// gobj_save_persistent_attrs();
|
|
437
|
-
// }
|
|
438
|
-
|
|
439
|
-
// Code repeated
|
|
440
|
-
let estados = `
|
|
441
|
-
<div>Automata: ${trace}</div>
|
|
442
|
-
<div>Creation: ${creation}</div>
|
|
443
|
-
<div>Start/Stop: ${start_stop}</div>
|
|
444
|
-
<div>Subscriptions: ${subscriptions}</div>
|
|
445
|
-
<div>I18n: ${i18n}</div>
|
|
446
|
-
<div>Traffic: ${traffic}</div>
|
|
447
|
-
<div>No poll: ${no_poll}</div>`;
|
|
448
|
-
|
|
449
|
-
gobj_create_service(
|
|
450
|
-
"Developer-Window",
|
|
451
|
-
"C_YUI_WINDOW",
|
|
452
|
-
{
|
|
453
|
-
$parent: document.getElementById('top-layer') || null,
|
|
454
|
-
subscriber: null,
|
|
455
|
-
showMax: true,
|
|
456
|
-
modal: false,
|
|
457
|
-
header: $dev_toolbar,
|
|
458
|
-
auto_save_size_and_position: true,
|
|
459
|
-
center: false,
|
|
460
|
-
// resizable: false,
|
|
461
|
-
body: '<div style="overflow:scroll;height:100%;"><div id="developer-traffic-logger" style="margin-left:10px;margin-right:10px;"/></div>',
|
|
462
|
-
footer: `<div id="developer-window-info" class="is-flex is-justify-content-space-between" style="gap:1.25rem;white-space:nowrap;">${estados}</div>`,
|
|
463
|
-
on_close: function() {
|
|
464
|
-
kw_set_local_storage_value("open_developer_window", 0);
|
|
465
|
-
}
|
|
466
|
-
},
|
|
467
|
-
self
|
|
468
|
-
);
|
|
469
|
-
|
|
470
|
-
kw_set_local_storage_value("open_developer_window", 1);
|
|
471
|
-
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
apply_dev_traces();
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
/************************************************************
|
|
478
|
-
* Build the developer panel as a self-contained DOM subtree,
|
|
479
|
-
* to be mounted by the new declarative shell via
|
|
480
|
-
* yui_shell_show_modal (no C_YUI_WINDOW, no 'top-layer').
|
|
481
|
-
*
|
|
482
|
-
* Returns { $el, dispose }:
|
|
483
|
-
* - $el: the panel element (header tabs + traffic logger
|
|
484
|
-
* body + footer counters).
|
|
485
|
-
* - dispose: stops the inter-event traffic trace; call it from
|
|
486
|
-
* the modal's on_close.
|
|
487
|
-
*
|
|
488
|
-
* Backwards compatible: setup_dev() (old shell, C_YUI_WINDOW) is
|
|
489
|
-
* untouched; the trace_* helpers and info_traffic are shared.
|
|
490
|
-
************************************************************/
|
|
491
|
-
function build_dev_panel()
|
|
492
|
-
{
|
|
493
|
-
let traffic = Number(kw_get_local_storage_value("trace_traffic", 0, false));
|
|
494
|
-
let trace = Number(kw_get_local_storage_value("trace_automata", 0, false));
|
|
495
|
-
let creation = Number(kw_get_local_storage_value("trace_creation", 0, false));
|
|
496
|
-
let start_stop = Number(kw_get_local_storage_value("trace_start_stop", 0, false));
|
|
497
|
-
let subscriptions = Number(kw_get_local_storage_value("trace_subscriptions", 0, false));
|
|
498
|
-
let i18n = Number(kw_get_local_storage_value("trace_i18n", 0, false));
|
|
499
|
-
let no_poll = Number(kw_get_local_storage_value("no_poll", 0, false));
|
|
500
|
-
|
|
501
|
-
let mk_btn = (label, fn) => ['button', {
|
|
502
|
-
class: 'button is-small',
|
|
503
|
-
}, label, {
|
|
504
|
-
click: (evt) => {
|
|
505
|
-
evt.stopPropagation();
|
|
506
|
-
fn();
|
|
507
|
-
}
|
|
508
|
-
}];
|
|
509
|
-
|
|
510
|
-
let counters = [
|
|
511
|
-
`Automata: ${trace}`, `Creation: ${creation}`,
|
|
512
|
-
`Start/Stop: ${start_stop}`, `Subscriptions: ${subscriptions}`,
|
|
513
|
-
`I18n: ${i18n}`, `Traffic: ${traffic}`, `No poll: ${no_poll}`,
|
|
514
|
-
].map(txt => ['div', {style: 'padding:0 8px;'}, txt]);
|
|
515
|
-
|
|
516
|
-
// The shell modal drops content into a transparent, unsized
|
|
517
|
-
// Bulma .modal-content; the panel must be its own opaque,
|
|
518
|
-
// sized window box. Theme-aware (read <html data-theme>).
|
|
519
|
-
let dark = (typeof document !== "undefined") &&
|
|
520
|
-
document.documentElement.getAttribute("data-theme") === "dark";
|
|
521
|
-
let surface = dark ? "#1f2733" : "#ffffff";
|
|
522
|
-
let fg = dark ? "#e8eaed" : "#0f172a";
|
|
523
|
-
let bd = dark ? "#3a4250" : "#cbd5e1";
|
|
524
|
-
|
|
525
|
-
let $el = createElement2(
|
|
526
|
-
['div', {
|
|
527
|
-
class: 'yui-dev-panel',
|
|
528
|
-
style:
|
|
529
|
-
'display:flex;flex-direction:column;box-sizing:border-box;' +
|
|
530
|
-
'width:100%;height:min(72vh,720px);max-height:82vh;' +
|
|
531
|
-
'background:' + surface + ';color:' + fg + ';' +
|
|
532
|
-
'border:1px solid ' + bd + ';border-radius:10px;' +
|
|
533
|
-
'box-shadow:0 10px 30px rgba(0,0,0,0.35);' +
|
|
534
|
-
'padding:14px;overflow:hidden;' +
|
|
535
|
-
'font-family:-apple-system,BlinkMacSystemFont,' +
|
|
536
|
-
"'Segoe UI',Roboto,Helvetica,Arial,sans-serif;",
|
|
537
|
-
}, [
|
|
538
|
-
['div', {
|
|
539
|
-
class: 'buttons',
|
|
540
|
-
style: 'flex:0 0 auto;display:flex;flex-wrap:wrap;' +
|
|
541
|
-
'gap:6px;margin:0 0 8px 0;',
|
|
542
|
-
}, [
|
|
543
|
-
mk_btn('Automata', trace_automata),
|
|
544
|
-
mk_btn('Creation', trace_creation),
|
|
545
|
-
mk_btn('Star/Stop', trace_start_stop),
|
|
546
|
-
mk_btn('Subscriptions', trace_subscriptions),
|
|
547
|
-
mk_btn('I18n', trace_i18n),
|
|
548
|
-
mk_btn('Traffic', trace_traffic),
|
|
549
|
-
mk_btn('No Poll', set_no_poll),
|
|
550
|
-
mk_btn('Clear Traffic', () => {
|
|
551
|
-
let l = document.getElementById("developer-traffic-logger");
|
|
552
|
-
if(l) {
|
|
553
|
-
l.innerHTML = "";
|
|
554
|
-
}
|
|
555
|
-
}),
|
|
556
|
-
]],
|
|
557
|
-
['div', {
|
|
558
|
-
style: 'flex:1 1 auto;min-height:0;overflow:auto;',
|
|
559
|
-
}, [
|
|
560
|
-
['div', {id: 'developer-traffic-logger',
|
|
561
|
-
style: 'margin:0 4px;'}, []],
|
|
562
|
-
]],
|
|
563
|
-
['div', {
|
|
564
|
-
id: 'developer-window-info',
|
|
565
|
-
class: 'is-flex is-justify-content-space-between',
|
|
566
|
-
style: 'flex:0 0 auto;border-top:1px solid ' + bd +
|
|
567
|
-
';padding-top:6px;margin-top:6px;font-size:12px;' +
|
|
568
|
-
'opacity:0.85;flex-wrap:nowrap;gap:1.25rem;white-space:nowrap;',
|
|
569
|
-
}, counters],
|
|
570
|
-
]]
|
|
571
|
-
);
|
|
572
|
-
|
|
573
|
-
apply_dev_traces();
|
|
574
|
-
|
|
575
|
-
let dispose = function() {
|
|
576
|
-
// Stop feeding traffic into a detached DOM.
|
|
577
|
-
gobj_write_attr(gobj_yuno(), "trace_inter_event", false);
|
|
578
|
-
};
|
|
579
|
-
|
|
580
|
-
return {$el: $el, dispose: dispose};
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
export {info_traffic, setup_dev, build_dev_panel, apply_dev_traces, dev_window_was_open};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|