flexdesk 0.2.0 → 0.3.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.
- package/css/base.css +1484 -181
- package/css/flexdesk.css +1311 -18
- package/css/overrides.css +44 -0
- package/css/tokens.css +45 -0
- package/dist/charts.js +5 -3
- package/dist/charts.js.map +1 -1
- package/dist/{chunk-DVU44T77.js → chunk-ELXVW542.js} +196 -75
- package/dist/chunk-ELXVW542.js.map +7 -0
- package/dist/chunk-LH5TSOZW.js +1237 -0
- package/dist/chunk-LH5TSOZW.js.map +7 -0
- package/dist/{chunk-TLZUUFOE.js → chunk-O5OHMWBB.js} +10 -2
- package/dist/chunk-O5OHMWBB.js.map +7 -0
- package/dist/{chunk-CT4YXXLP.js → chunk-QIU5S2RU.js} +371 -73
- package/dist/chunk-QIU5S2RU.js.map +7 -0
- package/dist/chunk-QNQHQ24V.js +408 -0
- package/dist/chunk-QNQHQ24V.js.map +7 -0
- package/dist/{chunk-DRYCDMEG.js → chunk-XKDTIT4Q.js} +168 -12
- package/dist/chunk-XKDTIT4Q.js.map +7 -0
- package/dist/editor.js +3 -380
- package/dist/editor.js.map +3 -3
- package/dist/flexdesk.css +1311 -18
- package/dist/tiles.js +168 -41
- package/dist/tiles.js.map +2 -2
- package/dist/tokens.css +45 -0
- package/dist/widgets.js +44 -14
- package/dist/widgets.js.map +2 -2
- package/dist/wm.js +2983 -142
- package/dist/wm.js.map +4 -4
- package/package.json +3 -2
- package/src/charts/chart_types.js +167 -0
- package/src/charts/plotly_wrapper.js +178 -10
- package/src/editor/notebook_tab_bar.js +39 -3
- package/src/tiles/tile_base.js +143 -35
- package/src/tiles/tile_grid.js +52 -1
- package/src/tiling/command_palette.js +71 -18
- package/src/tiling/desktops.js +36 -12
- package/src/tiling/keymap.js +24 -4
- package/src/tiling/shell.js +135 -24
- package/src/tiling/tab_strip.js +184 -0
- package/src/tiling/tile_breadcrumb.js +34 -2
- package/src/tiling/tile_renderer.js +1386 -21
- package/src/tiling/tile_tab_menu.js +101 -0
- package/src/tiling/tile_tree.js +82 -0
- package/src/tiling/wm.js +2352 -74
- package/src/ui/components/action_dropdown.js +34 -3
- package/src/ui/components/autocomplete_field.js +65 -13
- package/src/ui/components/context_menu.js +79 -8
- package/src/ui/components/data_table.js +508 -84
- package/src/ui/components/managed_window.js +928 -36
- package/src/ui/components/modal.js +214 -8
- package/dist/chunk-CT4YXXLP.js.map +0 -7
- package/dist/chunk-DRYCDMEG.js.map +0 -7
- package/dist/chunk-DVU44T77.js.map +0 -7
- package/dist/chunk-TLZUUFOE.js.map +0 -7
- package/dist/chunk-UCJ2WD4D.js +0 -625
- package/dist/chunk-UCJ2WD4D.js.map +0 -7
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DataTable,
|
|
3
3
|
createRafResizeObserver
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QIU5S2RU.js";
|
|
5
5
|
import {
|
|
6
6
|
ManagedWindow
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LH5TSOZW.js";
|
|
8
8
|
|
|
9
9
|
// src/charts/plotly_wrapper.js
|
|
10
10
|
var _plotlySrc = null;
|
|
@@ -121,28 +121,94 @@ async function ensurePlotly() {
|
|
|
121
121
|
'[twm/charts] Plotly is not loaded and no source is configured. Either load Plotly yourself (a <script> tag that sets window.Plotly), or call setPlotlySource("/path/to/plotly.min.js") before rendering a chart.'
|
|
122
122
|
);
|
|
123
123
|
}
|
|
124
|
-
_plotlyLoadPromise =
|
|
124
|
+
_plotlyLoadPromise = (async () => {
|
|
125
|
+
let code;
|
|
126
|
+
try {
|
|
127
|
+
const response = await fetch(_plotlySrc, { credentials: "same-origin" });
|
|
128
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
129
|
+
code = await response.text();
|
|
130
|
+
} catch (err) {
|
|
131
|
+
return loadThroughMaskedDefine();
|
|
132
|
+
}
|
|
133
|
+
return evaluateWithoutAmd(code, _plotlySrc);
|
|
134
|
+
})();
|
|
135
|
+
return _plotlyLoadPromise;
|
|
136
|
+
}
|
|
137
|
+
function evaluateWithoutAmd(code, src) {
|
|
138
|
+
const run = new Function(
|
|
139
|
+
"define",
|
|
140
|
+
"module",
|
|
141
|
+
"exports",
|
|
142
|
+
`${code}
|
|
143
|
+
//# sourceURL=${src}`
|
|
144
|
+
);
|
|
145
|
+
run(void 0, void 0, void 0);
|
|
146
|
+
if (typeof Plotly === "undefined") {
|
|
147
|
+
throw new Error(`Plotly.js was evaluated from ${src} but did not define a Plotly global \u2014 the file may not be a Plotly UMD bundle.`);
|
|
148
|
+
}
|
|
149
|
+
return Plotly;
|
|
150
|
+
}
|
|
151
|
+
function loadThroughMaskedDefine() {
|
|
152
|
+
return new Promise((resolve, reject) => {
|
|
153
|
+
const hadDefine = "define" in window;
|
|
125
154
|
const savedDefine = window.define;
|
|
126
|
-
|
|
155
|
+
let arrivedDefine;
|
|
156
|
+
let arrived = false;
|
|
157
|
+
let guarded = false;
|
|
158
|
+
const maskAmd = (value) => {
|
|
159
|
+
if (typeof value !== "function") return void 0;
|
|
160
|
+
const masked = function define(...args) {
|
|
161
|
+
return value.apply(this, args);
|
|
162
|
+
};
|
|
163
|
+
for (const key of Object.getOwnPropertyNames(value)) {
|
|
164
|
+
if (key === "amd" || key === "length" || key === "name") continue;
|
|
165
|
+
try {
|
|
166
|
+
masked[key] = value[key];
|
|
167
|
+
} catch {
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
masked.amd = void 0;
|
|
171
|
+
return masked;
|
|
172
|
+
};
|
|
173
|
+
try {
|
|
174
|
+
Object.defineProperty(window, "define", {
|
|
175
|
+
configurable: true,
|
|
176
|
+
enumerable: true,
|
|
177
|
+
get: () => maskAmd(arrived ? arrivedDefine : savedDefine),
|
|
178
|
+
set: (value) => {
|
|
179
|
+
arrivedDefine = value;
|
|
180
|
+
arrived = true;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
guarded = true;
|
|
184
|
+
} catch {
|
|
185
|
+
window.define = void 0;
|
|
186
|
+
}
|
|
187
|
+
const release = () => {
|
|
188
|
+
const value = arrived ? arrivedDefine : savedDefine;
|
|
189
|
+
if (guarded) {
|
|
190
|
+
delete window.define;
|
|
191
|
+
guarded = false;
|
|
192
|
+
}
|
|
193
|
+
if (arrived || hadDefine) window.define = value;
|
|
194
|
+
};
|
|
127
195
|
const script = document.createElement("script");
|
|
128
196
|
script.src = _plotlySrc;
|
|
129
197
|
script.async = true;
|
|
130
198
|
script.onload = () => {
|
|
131
|
-
|
|
199
|
+
release();
|
|
132
200
|
if (typeof Plotly !== "undefined") {
|
|
133
|
-
console.log("[PlotlyWrapper] Plotly.js loaded successfully");
|
|
134
201
|
resolve(Plotly);
|
|
135
202
|
} else {
|
|
136
|
-
reject(new Error("Plotly.js loaded but Plotly global not found"));
|
|
203
|
+
reject(new Error("Plotly.js loaded but Plotly global not found. Something defined an AMD loader while it was loading, so Plotly registered as a module instead of a global."));
|
|
137
204
|
}
|
|
138
205
|
};
|
|
139
206
|
script.onerror = () => {
|
|
140
|
-
|
|
207
|
+
release();
|
|
141
208
|
reject(new Error(`Failed to load Plotly.js from ${_plotlySrc} \u2014 call setPlotlySource() with the path to your copy.`));
|
|
142
209
|
};
|
|
143
210
|
document.head.appendChild(script);
|
|
144
211
|
});
|
|
145
|
-
return _plotlyLoadPromise;
|
|
146
212
|
}
|
|
147
213
|
async function createChart(container, data, layout = {}, config = {}) {
|
|
148
214
|
const Plotly2 = await ensurePlotly();
|
|
@@ -278,7 +344,16 @@ var CHART_TYPES_2D = Object.freeze([
|
|
|
278
344
|
{ value: "scatter", label: "Scatter" },
|
|
279
345
|
{ value: "area", label: "Area" },
|
|
280
346
|
{ value: "area-stacked", label: "Area (Stacked %)" },
|
|
281
|
-
{ value: "phase", label: "Phase" }
|
|
347
|
+
{ value: "phase", label: "Phase" },
|
|
348
|
+
// Categorical part-of-whole. They belong in this list because the list is
|
|
349
|
+
// what a consumer renders as its chart-type dropdown — but they are NOT
|
|
350
|
+
// (x[], y[]) charts, and `buildTrace` leaves for them before the switch:
|
|
351
|
+
// read the early return there before adding a fourth. `indicator` is
|
|
352
|
+
// deliberately NOT here, because it takes a SCALAR — a dropdown offering it
|
|
353
|
+
// beside these would offer a rendering of data the chart is not bound to.
|
|
354
|
+
{ value: "pie", label: "Pie" },
|
|
355
|
+
{ value: "donut", label: "Donut" },
|
|
356
|
+
{ value: "funnel", label: "Funnel" }
|
|
282
357
|
]);
|
|
283
358
|
var CHART_TYPES_3D = Object.freeze([
|
|
284
359
|
{ value: "scatter3d", label: "3D Scatter" },
|
|
@@ -316,9 +391,39 @@ function buildTrace(options) {
|
|
|
316
391
|
yAxisId = "y",
|
|
317
392
|
showMarkers = false,
|
|
318
393
|
seriesIndex = 0,
|
|
319
|
-
stackGroup = null
|
|
394
|
+
stackGroup = null,
|
|
395
|
+
colors = null
|
|
320
396
|
} = options;
|
|
321
397
|
const seriesColor = color || getSeriesColor(seriesIndex);
|
|
398
|
+
if (chartType === "pie" || chartType === "donut" || chartType === "funnel") {
|
|
399
|
+
const sliceColors = Array.isArray(colors) && colors.length ? colors : y.map((_, i) => getSeriesColor(i));
|
|
400
|
+
if (chartType === "funnel") {
|
|
401
|
+
return {
|
|
402
|
+
type: "funnel",
|
|
403
|
+
name,
|
|
404
|
+
y: x,
|
|
405
|
+
// stages read down the categorical axis
|
|
406
|
+
x: y,
|
|
407
|
+
// ...and the measure runs across
|
|
408
|
+
marker: { color: sliceColors },
|
|
409
|
+
textinfo: "value+percent initial"
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
return {
|
|
413
|
+
type: "pie",
|
|
414
|
+
name,
|
|
415
|
+
labels: x,
|
|
416
|
+
values: y,
|
|
417
|
+
marker: { colors: sliceColors },
|
|
418
|
+
// Plotly sorts slices descending by default. The caller has
|
|
419
|
+
// already ordered its rows — a dashboard binding carries its own
|
|
420
|
+
// `sort` — and a second, invisible reordering here makes the chart
|
|
421
|
+
// disagree with the table beside it and with the config that
|
|
422
|
+
// produced both.
|
|
423
|
+
sort: false,
|
|
424
|
+
...chartType === "donut" ? { hole: 0.55 } : {}
|
|
425
|
+
};
|
|
426
|
+
}
|
|
322
427
|
let plotlyType, mode;
|
|
323
428
|
switch (chartType) {
|
|
324
429
|
case "line":
|
|
@@ -750,6 +855,56 @@ function buildHeatmapTrace(options) {
|
|
|
750
855
|
if (y) trace.y = y;
|
|
751
856
|
return trace;
|
|
752
857
|
}
|
|
858
|
+
var DELTA_UP = "#859900";
|
|
859
|
+
var DELTA_DOWN = "#dc322f";
|
|
860
|
+
function buildIndicatorTrace(options) {
|
|
861
|
+
const {
|
|
862
|
+
value,
|
|
863
|
+
min = 0,
|
|
864
|
+
max = null,
|
|
865
|
+
title = "",
|
|
866
|
+
steps = null,
|
|
867
|
+
threshold = null,
|
|
868
|
+
color = null,
|
|
869
|
+
seriesIndex = 0,
|
|
870
|
+
delta = null
|
|
871
|
+
} = options;
|
|
872
|
+
const hasGauge = typeof max === "number" && Number.isFinite(max);
|
|
873
|
+
const deltaSpec = typeof delta === "number" ? { reference: delta } : delta && typeof delta === "object" ? delta : null;
|
|
874
|
+
const parts = ["number"];
|
|
875
|
+
if (hasGauge) parts.unshift("gauge");
|
|
876
|
+
if (deltaSpec) parts.push("delta");
|
|
877
|
+
const trace = {
|
|
878
|
+
type: "indicator",
|
|
879
|
+
mode: parts.join("+"),
|
|
880
|
+
value
|
|
881
|
+
};
|
|
882
|
+
if (title) trace.title = { text: title };
|
|
883
|
+
if (deltaSpec) {
|
|
884
|
+
trace.delta = {
|
|
885
|
+
reference: deltaSpec.reference,
|
|
886
|
+
relative: deltaSpec.relative === true,
|
|
887
|
+
increasing: { color: deltaSpec.increasing || DELTA_UP },
|
|
888
|
+
decreasing: { color: deltaSpec.decreasing || DELTA_DOWN }
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
if (hasGauge) {
|
|
892
|
+
trace.gauge = {
|
|
893
|
+
axis: { range: [min, max] },
|
|
894
|
+
bar: { color: color || getSeriesColor(seriesIndex) }
|
|
895
|
+
};
|
|
896
|
+
if (Array.isArray(steps) && steps.length) trace.gauge.steps = steps;
|
|
897
|
+
if (threshold !== null && threshold !== void 0) {
|
|
898
|
+
const t = typeof threshold === "number" ? { value: threshold } : threshold;
|
|
899
|
+
trace.gauge.threshold = {
|
|
900
|
+
line: { color: t.color || DELTA_DOWN, width: t.width ?? 3 },
|
|
901
|
+
thickness: t.thickness ?? 0.9,
|
|
902
|
+
value: t.value
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
return trace;
|
|
907
|
+
}
|
|
753
908
|
|
|
754
909
|
// src/charts/plot_config.js
|
|
755
910
|
var _uid = 0;
|
|
@@ -2204,6 +2359,7 @@ export {
|
|
|
2204
2359
|
buildHistogramTrace,
|
|
2205
2360
|
buildBoxTrace,
|
|
2206
2361
|
buildHeatmapTrace,
|
|
2362
|
+
buildIndicatorTrace,
|
|
2207
2363
|
uid,
|
|
2208
2364
|
applyNanHandling,
|
|
2209
2365
|
PLOT_LAYOUTS,
|
|
@@ -2214,4 +2370,4 @@ export {
|
|
|
2214
2370
|
openPlotPopoutWindow,
|
|
2215
2371
|
openRawTracesWindow
|
|
2216
2372
|
};
|
|
2217
|
-
//# sourceMappingURL=chunk-
|
|
2373
|
+
//# sourceMappingURL=chunk-XKDTIT4Q.js.map
|