@pixerate/editor 0.49.0 → 0.51.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/dist/canvas/index.cjs +151 -25
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +109 -3
- package/dist/canvas/index.d.ts +109 -3
- package/dist/canvas/index.js +127 -1
- package/dist/canvas/index.js.map +1 -1
- package/dist/chart/index.cjs +197 -52
- package/dist/chart/index.cjs.map +1 -1
- package/dist/chart/index.d.cts +88 -3
- package/dist/chart/index.d.ts +88 -3
- package/dist/chart/index.js +151 -6
- package/dist/chart/index.js.map +1 -1
- package/dist/{chunk-3LHWTGHW.js → chunk-TO22LX34.js} +11 -1
- package/dist/chunk-TO22LX34.js.map +1 -0
- package/dist/{chunk-VNYRI265.cjs → chunk-YNSK4MGT.cjs} +12 -2
- package/dist/chunk-YNSK4MGT.cjs.map +1 -0
- package/dist/{controller-DtbEo3om.d.ts → controller-BdKzaxs2.d.ts} +1 -1
- package/dist/{controller-ChjCCMLl.d.cts → controller-DS3drIvy.d.cts} +1 -1
- package/dist/extensions/index.d.cts +2 -2
- package/dist/extensions/index.d.ts +2 -2
- package/dist/image-editor/index.cjs +141 -1
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +42 -1
- package/dist/image-editor/index.d.ts +42 -1
- package/dist/image-editor/index.js +140 -0
- package/dist/image-editor/index.js.map +1 -1
- package/dist/{index-DoHqT1mq.d.cts → index-DOy9HzfC.d.cts} +1 -1
- package/dist/{index-YLZ0fKqE.d.ts → index-Dt9lzydb.d.ts} +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/{pathfinder-D98S2lV5.d.ts → pathfinder-B9xh_pCZ.d.ts} +2 -1
- package/dist/{pathfinder-DKRcXiLS.d.cts → pathfinder-QdG70sr9.d.cts} +2 -1
- package/dist/vector/index.cjs +153 -153
- package/dist/vector/index.d.cts +1 -1
- package/dist/vector/index.d.ts +1 -1
- package/dist/vector/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3LHWTGHW.js.map +0 -1
- package/dist/chunk-VNYRI265.cjs.map +0 -1
package/dist/chart/index.cjs
CHANGED
|
@@ -128,6 +128,127 @@ require('../chunk-XP5IUZUO.cjs');
|
|
|
128
128
|
var _chunkTNNJXF46cjs = require('../chunk-TNNJXF46.cjs');
|
|
129
129
|
require('../chunk-QKLRAA4T.cjs');
|
|
130
130
|
|
|
131
|
+
// src/chart/raster.ts
|
|
132
|
+
var CHART_RASTER_MAX_SIZE = 1024;
|
|
133
|
+
function chartRasterSize(width, height, scale = 2, maxSize = CHART_RASTER_MAX_SIZE) {
|
|
134
|
+
if (!(width > 0) || !(height > 0)) throw new Error(`A chart image needs a positive width and height; got ${width} \xD7 ${height}.`);
|
|
135
|
+
const factor = Math.min(scale > 0 ? scale : 1, maxSize / Math.max(width, height));
|
|
136
|
+
return { width: Math.max(1, Math.round(width * factor)), height: Math.max(1, Math.round(height * factor)), scale: factor };
|
|
137
|
+
}
|
|
138
|
+
function closingParen(text, open) {
|
|
139
|
+
let depth = 0;
|
|
140
|
+
for (let i = open; i < text.length; i++) {
|
|
141
|
+
if (text[i] === "(") depth++;
|
|
142
|
+
else if (text[i] === ")" && --depth === 0) return i + 1;
|
|
143
|
+
}
|
|
144
|
+
return -1;
|
|
145
|
+
}
|
|
146
|
+
function substituteVars(value, lookup, depth = 0) {
|
|
147
|
+
let out = "";
|
|
148
|
+
let i = 0;
|
|
149
|
+
for (let at = value.indexOf("var(", i); at !== -1; at = value.indexOf("var(", i)) {
|
|
150
|
+
const end = closingParen(value, at + 3);
|
|
151
|
+
if (end === -1) break;
|
|
152
|
+
const inner = value.slice(at + 4, end - 1);
|
|
153
|
+
let comma = -1;
|
|
154
|
+
for (let j = 0, d = 0; j < inner.length; j++) {
|
|
155
|
+
if (inner[j] === "(") d++;
|
|
156
|
+
else if (inner[j] === ")") d--;
|
|
157
|
+
else if (inner[j] === "," && d === 0) {
|
|
158
|
+
comma = j;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const name = (comma === -1 ? inner : inner.slice(0, comma)).trim();
|
|
163
|
+
const fallback = comma === -1 ? "" : inner.slice(comma + 1).trim();
|
|
164
|
+
const found = lookup(name).trim();
|
|
165
|
+
const resolved = found || fallback;
|
|
166
|
+
out += value.slice(i, at) + (depth < 8 && resolved.includes("var(") ? substituteVars(resolved, lookup, depth + 1) : resolved);
|
|
167
|
+
i = end;
|
|
168
|
+
}
|
|
169
|
+
return out + value.slice(i);
|
|
170
|
+
}
|
|
171
|
+
var PAINT_ATTRIBUTE = /(\s)([\w:-]+)="([^"]*)"/g;
|
|
172
|
+
function resolveChartSvgPaints(svg, options = {}) {
|
|
173
|
+
const doc = globalThis.document;
|
|
174
|
+
const scope = _nullishCoalesce(_nullishCoalesce(options.scope, () => ( _optionalChain([doc, 'optionalAccess', _2 => _2.documentElement]))), () => ( null));
|
|
175
|
+
const view = _nullishCoalesce(_optionalChain([scope, 'optionalAccess', _3 => _3.ownerDocument, 'optionalAccess', _4 => _4.defaultView]), () => ( globalThis));
|
|
176
|
+
let computed;
|
|
177
|
+
const style = () => {
|
|
178
|
+
if (computed === void 0) computed = scope && typeof _optionalChain([view, 'optionalAccess', _5 => _5.getComputedStyle]) === "function" ? view.getComputedStyle(scope) : null;
|
|
179
|
+
return computed;
|
|
180
|
+
};
|
|
181
|
+
const lookup = _nullishCoalesce(options.lookup, () => ( ((name) => _nullishCoalesce(_optionalChain([style, 'call', _6 => _6(), 'optionalAccess', _7 => _7.getPropertyValue, 'call', _8 => _8(name)]), () => ( "")))));
|
|
182
|
+
return svg.replace(PAINT_ATTRIBUTE, (match, space, name, raw) => {
|
|
183
|
+
let value = raw;
|
|
184
|
+
if (value.includes("var(")) value = substituteVars(value.replace(/"/g, '"'), lookup).replace(/"/g, """);
|
|
185
|
+
if (/currentcolor/i.test(value)) value = value.replace(/currentcolor/gi, _optionalChain([style, 'call', _9 => _9(), 'optionalAccess', _10 => _10.color]) || "#000000");
|
|
186
|
+
if (name === "font-family" && /^(inherit|unset|initial)$/i.test(value.trim())) value = (_optionalChain([style, 'call', _11 => _11(), 'optionalAccess', _12 => _12.fontFamily]) || "sans-serif").replace(/"/g, "'");
|
|
187
|
+
if (value === raw) return match;
|
|
188
|
+
return value.trim() ? `${space}${name}="${value}"` : "";
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
var NO_DOM = 'Rasterizing a chart needs a browser DOM (document, Image and a 2D canvas). Outside a browser, render SVG with chartToSvg (or render_chart with format "svg") and convert it with an SVG renderer, or pass your own rasterize option to createChartToolProvider.';
|
|
192
|
+
async function svgToPngDataUrl(svg, options) {
|
|
193
|
+
const doc = _nullishCoalesce(options.document, () => ( globalThis.document));
|
|
194
|
+
const ImageCtor = _nullishCoalesce(_optionalChain([doc, 'optionalAccess', _13 => _13.defaultView, 'optionalAccess', _14 => _14.Image]), () => ( globalThis.Image));
|
|
195
|
+
if (!doc || typeof doc.createElement !== "function" || !ImageCtor) throw new Error(NO_DOM);
|
|
196
|
+
const size = chartRasterSize(options.width, options.height, options.scale, options.maxSize);
|
|
197
|
+
const canvas = doc.createElement("canvas");
|
|
198
|
+
canvas.width = size.width;
|
|
199
|
+
canvas.height = size.height;
|
|
200
|
+
let context = null;
|
|
201
|
+
try {
|
|
202
|
+
context = canvas.getContext("2d");
|
|
203
|
+
} catch (e2) {
|
|
204
|
+
context = null;
|
|
205
|
+
}
|
|
206
|
+
if (!context) throw new Error(NO_DOM);
|
|
207
|
+
const drawable = resolveChartSvgPaints(svg, options);
|
|
208
|
+
const image = new ImageCtor();
|
|
209
|
+
await new Promise((resolve2, reject) => {
|
|
210
|
+
image.onload = () => resolve2();
|
|
211
|
+
image.onerror = () => reject(new Error("The chart SVG could not be loaded as an image; check that it is a complete <svg> document with the SVG namespace."));
|
|
212
|
+
image.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(drawable)}`;
|
|
213
|
+
});
|
|
214
|
+
const background = _nullishCoalesce(options.background, () => ( "#ffffff"));
|
|
215
|
+
if (background !== "transparent") {
|
|
216
|
+
context.fillStyle = background;
|
|
217
|
+
context.fillRect(0, 0, size.width, size.height);
|
|
218
|
+
}
|
|
219
|
+
context.drawImage(image, 0, 0, size.width, size.height);
|
|
220
|
+
const url = canvas.toDataURL("image/png");
|
|
221
|
+
if (!url.startsWith("data:image/png")) throw new Error("This canvas cannot export PNG (toDataURL returned no image).");
|
|
222
|
+
return { url, width: size.width, height: size.height };
|
|
223
|
+
}
|
|
224
|
+
async function rasterizeChartSvg(svg, options) {
|
|
225
|
+
const { url, width, height } = await svgToPngDataUrl(svg, options);
|
|
226
|
+
return { data: url.slice(url.indexOf(",") + 1), mimeType: "image/png", width, height };
|
|
227
|
+
}
|
|
228
|
+
function createChartRasterizer(options = {}) {
|
|
229
|
+
const doc = _nullishCoalesce(options.document, () => ( globalThis.document));
|
|
230
|
+
if (!doc || typeof doc.createElement !== "function") return void 0;
|
|
231
|
+
return (svg, size) => rasterizeChartSvg(svg, { ...options, ...size });
|
|
232
|
+
}
|
|
233
|
+
function chartFileName(spec, extension) {
|
|
234
|
+
const base = (_nullishCoalesce(spec.title, () => ( ""))).toLowerCase().replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "").slice(0, 60);
|
|
235
|
+
return `${base || "chart"}.${extension}`;
|
|
236
|
+
}
|
|
237
|
+
async function downloadChartPng(spec, options = {}) {
|
|
238
|
+
const { width = 800, height = 450, filename = chartFileName(spec, "png"), theme, ...raster } = options;
|
|
239
|
+
const svg = _chunkGTZXF4BIcjs.chartToSvg.call(void 0, spec, { width, height, theme });
|
|
240
|
+
const { url, width: w, height: h } = await svgToPngDataUrl(svg, { ...raster, width, height });
|
|
241
|
+
const doc = _nullishCoalesce(raster.document, () => ( globalThis.document));
|
|
242
|
+
const link = doc.createElement("a");
|
|
243
|
+
link.href = url;
|
|
244
|
+
link.download = filename;
|
|
245
|
+
link.style.display = "none";
|
|
246
|
+
_optionalChain([doc, 'access', _15 => _15.body, 'optionalAccess', _16 => _16.appendChild, 'call', _17 => _17(link)]);
|
|
247
|
+
link.click();
|
|
248
|
+
link.remove();
|
|
249
|
+
return { data: url.slice(url.indexOf(",") + 1), mimeType: "image/png", width: w, height: h, filename };
|
|
250
|
+
}
|
|
251
|
+
|
|
131
252
|
// src/chart/recommend.ts
|
|
132
253
|
var blank = (c) => c === null || c === void 0 || String(c).trim() === "";
|
|
133
254
|
var isText = (c) => blank(c) || _chunkJOX6MJW4cjs.parseChartValue.call(void 0, c) === void 0;
|
|
@@ -135,7 +256,7 @@ function analyzeChartTable(rows) {
|
|
|
135
256
|
const grid = rows.filter((r) => r.some((c) => !blank(c)));
|
|
136
257
|
const height = grid.length;
|
|
137
258
|
const width = Math.max(0, ...grid.map((r) => r.length));
|
|
138
|
-
const cell = (r, c) => _optionalChain([grid, 'access',
|
|
259
|
+
const cell = (r, c) => _optionalChain([grid, 'access', _18 => _18[r], 'optionalAccess', _19 => _19[c]]);
|
|
139
260
|
const headerRow = height > 1 && grid[0].some((c) => !blank(c) && isText(c)) && Array.from({ length: width - 1 }, (_, i) => i + 1).every((c) => isText(cell(0, c)));
|
|
140
261
|
const blankCorner = headerRow && blank(cell(0, 0));
|
|
141
262
|
const labelColumn = width > 1 && (blankCorner || Array.from({ length: height - (headerRow ? 1 : 0) }, (_, i) => i + (headerRow ? 1 : 0)).every((r) => isText(cell(r, 0))));
|
|
@@ -156,7 +277,7 @@ function analyzeChartTable(rows) {
|
|
|
156
277
|
anyNegative = true;
|
|
157
278
|
} else if (v > 0) anyPositive = true;
|
|
158
279
|
}
|
|
159
|
-
const labels = byRows ? _nullishCoalesce(_optionalChain([grid, 'access',
|
|
280
|
+
const labels = byRows ? _nullishCoalesce(_optionalChain([grid, 'access', _20 => _20[0], 'optionalAccess', _21 => _21.slice, 'call', _22 => _22(labelColumn ? 1 : 0)]), () => ( [])) : grid.slice(headerRow ? 1 : 0).map((r) => r[0]);
|
|
160
281
|
const dates = (byRows ? headerRow : labelColumn) && labels.length > 1 && labels.filter((l) => !blank(l) && _chunkGTZXF4BIcjs.parseChartDate.call(void 0, String(l)) !== null).length >= labels.length * 0.8;
|
|
161
282
|
return {
|
|
162
283
|
headerRow,
|
|
@@ -233,8 +354,8 @@ function recommendForShape(shape) {
|
|
|
233
354
|
function chartFromTable(rows, options = {}) {
|
|
234
355
|
const shape = analyzeChartTable(rows);
|
|
235
356
|
const rec = (_nullishCoalesce(options.type, () => ( "auto"))) === "auto" ? recommendForShape(shape)[0] : void 0;
|
|
236
|
-
const type = _nullishCoalesce(_optionalChain([rec, 'optionalAccess',
|
|
237
|
-
const stacking = _nullishCoalesce(_optionalChain([rec, 'optionalAccess',
|
|
357
|
+
const type = _nullishCoalesce(_optionalChain([rec, 'optionalAccess', _23 => _23.type]), () => ( (options.type === "auto" || !options.type ? "bar" : options.type)));
|
|
358
|
+
const stacking = _nullishCoalesce(_optionalChain([rec, 'optionalAccess', _24 => _24.stacking]), () => ( "none"));
|
|
238
359
|
const grid = rows.filter((r) => r.some((c) => !blank(c))).map((r) => [...r]);
|
|
239
360
|
const width = Math.max(0, ...grid.map((r) => r.length));
|
|
240
361
|
let table = grid;
|
|
@@ -283,7 +404,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
283
404
|
params: object({ width: _chunkTGBCBQFVcjs.WIDTH, height: _chunkTGBCBQFVcjs.HEIGHT }),
|
|
284
405
|
run: (_ctx, params = {}) => {
|
|
285
406
|
const spec = controller.getSpec();
|
|
286
|
-
return { spec: controller.toJSON(), table: _chunkJOX6MJW4cjs.chartDataToTable.call(void 0, spec), summary: _chunkGTZXF4BIcjs.summarizeChart.call(void 0, controller.toJSON(), { width: _nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
407
|
+
return { spec: controller.toJSON(), table: _chunkJOX6MJW4cjs.chartDataToTable.call(void 0, spec), summary: _chunkGTZXF4BIcjs.summarizeChart.call(void 0, controller.toJSON(), { width: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _25 => _25.width]), () => ( 640)), height: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _26 => _26.height]), () => ( 400)) }), issues: controller.getState().issues };
|
|
287
408
|
}
|
|
288
409
|
},
|
|
289
410
|
{
|
|
@@ -373,7 +494,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
373
494
|
keywords: ["chart", "category", "row", "label"],
|
|
374
495
|
description: "Inserts a category (gaps in every series) at `at` (default: the end).",
|
|
375
496
|
params: object({ label: { type: "string", description: "Category label (default: its number)." }, at: { type: "integer", minimum: 0, description: "Index to insert at (default: the end)." } }),
|
|
376
|
-
run: (_ctx, params = {}) => controller.addCategory(_optionalChain([params, 'optionalAccess',
|
|
497
|
+
run: (_ctx, params = {}) => controller.addCategory(_optionalChain([params, 'optionalAccess', _27 => _27.label]), { at: _optionalChain([params, 'optionalAccess', _28 => _28.at]) })
|
|
377
498
|
},
|
|
378
499
|
{
|
|
379
500
|
...base,
|
|
@@ -411,7 +532,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
411
532
|
params: object({ series: _chunkTGBCBQFVcjs.SERIES_REF, index: { type: "integer", minimum: 0, description: "Trendline index (0 = first)." } }, ["series", "index"]),
|
|
412
533
|
run: (_ctx, params) => {
|
|
413
534
|
check(controller.removeTrendline(resolveSeries(params.series).id, params.index));
|
|
414
|
-
return { trendlines: _nullishCoalesce(_optionalChain([controller, 'access',
|
|
535
|
+
return { trendlines: _nullishCoalesce(_optionalChain([controller, 'access', _29 => _29.getSeries, 'call', _30 => _30(resolveSeries(params.series).id), 'optionalAccess', _31 => _31.trendlines]), () => ( [])) };
|
|
415
536
|
}
|
|
416
537
|
},
|
|
417
538
|
{
|
|
@@ -482,7 +603,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
482
603
|
keywords: ["chart", "mermaid", "markdown", "export"],
|
|
483
604
|
description: "Returns the chart as Mermaid text (with a round-trip comment unless meta is false).",
|
|
484
605
|
params: object({ meta: { type: "boolean", description: "Include the %% @pixerate round-trip comment (default true)." } }),
|
|
485
|
-
run: (_ctx, params = {}) => ({ mermaid: _chunkGTZXF4BIcjs.chartToMermaid.call(void 0, controller.toJSON(), { meta: _optionalChain([params, 'optionalAccess',
|
|
606
|
+
run: (_ctx, params = {}) => ({ mermaid: _chunkGTZXF4BIcjs.chartToMermaid.call(void 0, controller.toJSON(), { meta: _optionalChain([params, 'optionalAccess', _32 => _32.meta]) }) })
|
|
486
607
|
},
|
|
487
608
|
{
|
|
488
609
|
...base,
|
|
@@ -502,7 +623,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
502
623
|
description: "Returns the chart drawn as a standalone, accessible SVG string (with <title> and <desc>).",
|
|
503
624
|
params: object({ width: _chunkTGBCBQFVcjs.WIDTH, height: _chunkTGBCBQFVcjs.HEIGHT }),
|
|
504
625
|
run: (_ctx, params = {}) => ({
|
|
505
|
-
svg: _chunkGTZXF4BIcjs.chartToSvg.call(void 0, controller.toJSON(), { width: _nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
626
|
+
svg: _chunkGTZXF4BIcjs.chartToSvg.call(void 0, controller.toJSON(), { width: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _33 => _33.width]), () => ( 640)), height: _nullishCoalesce(_optionalChain([params, 'optionalAccess', _34 => _34.height]), () => ( 400)) })
|
|
506
627
|
})
|
|
507
628
|
},
|
|
508
629
|
{
|
|
@@ -514,7 +635,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
514
635
|
description: "Suggests chart types for the current data (or CSV), best first, each with a reason.",
|
|
515
636
|
params: object({ csv: { type: "string", description: "CSV text to analyse instead of the current data." } }),
|
|
516
637
|
run: (_ctx, params = {}) => ({
|
|
517
|
-
recommendations: recommendChartTypes(_optionalChain([params, 'optionalAccess',
|
|
638
|
+
recommendations: recommendChartTypes(_optionalChain([params, 'optionalAccess', _35 => _35.csv]) !== void 0 ? _chunkTNNJXF46cjs.parseCsv.call(void 0, params.csv) : _chunkJOX6MJW4cjs.chartDataToTable.call(void 0, controller.getSpec()))
|
|
518
639
|
})
|
|
519
640
|
},
|
|
520
641
|
{
|
|
@@ -527,7 +648,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
527
648
|
run: () => {
|
|
528
649
|
const s = controller.getSpec();
|
|
529
650
|
const visible = s.series.filter((x) => !x.hidden);
|
|
530
|
-
const colors = _chunkJOX6MJW4cjs.chartColorsByCategory.call(void 0, s.type) ? s.categories.map((_, i) => _optionalChain([visible, 'access',
|
|
651
|
+
const colors = _chunkJOX6MJW4cjs.chartColorsByCategory.call(void 0, s.type) ? s.categories.map((_, i) => _optionalChain([visible, 'access', _36 => _36[0], 'optionalAccess', _37 => _37.pointColors, 'optionalAccess', _38 => _38[i]]) || _chunkJOX6MJW4cjs.chartSliceColor.call(void 0, s, i)) : visible.map((x) => _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, s, s.series.indexOf(x)));
|
|
531
652
|
return { colors, ..._chunkJOX6MJW4cjs.checkChartColors.call(void 0, colors) };
|
|
532
653
|
}
|
|
533
654
|
},
|
|
@@ -557,7 +678,7 @@ function chartClientToScene(scene, box, clientX, clientY) {
|
|
|
557
678
|
return { x: (clientX - box.left) * sx, y: (clientY - box.top) * sy };
|
|
558
679
|
}
|
|
559
680
|
function canDragChartPoint(controller, scene, target) {
|
|
560
|
-
if (_optionalChain([target, 'optionalAccess',
|
|
681
|
+
if (_optionalChain([target, 'optionalAccess', _39 => _39.kind]) !== "point" || !scene.valueScale || scene.percent) return false;
|
|
561
682
|
const spec = controller.getSpec();
|
|
562
683
|
const family = _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec);
|
|
563
684
|
if (family !== "cartesian" && family !== "xy" && family !== "waterfall") return false;
|
|
@@ -582,7 +703,7 @@ function snapChartDragValue(scene, value, options = {}) {
|
|
|
582
703
|
}
|
|
583
704
|
if (best !== null) return best;
|
|
584
705
|
}
|
|
585
|
-
return _chunkGTZXF4BIcjs.snapChartValue.call(void 0, scene, value, options.step, _optionalChain([scale, 'optionalAccess',
|
|
706
|
+
return _chunkGTZXF4BIcjs.snapChartValue.call(void 0, scene, value, options.step, _optionalChain([scale, 'optionalAccess', _40 => _40.ticks]));
|
|
586
707
|
}
|
|
587
708
|
function startChartPointDrag(controller, scene, target, start, options = {}) {
|
|
588
709
|
if (!canDragChartPoint(controller, scene, target)) return null;
|
|
@@ -593,7 +714,7 @@ function startChartPointDrag(controller, scene, target, start, options = {}) {
|
|
|
593
714
|
const scale = secondary ? scene.valueScale2 : scene.valueScale;
|
|
594
715
|
const xy = _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec) === "xy" && !!scene.xScale;
|
|
595
716
|
const startValue = _nullishCoalesce(series.values[index], () => ( 0));
|
|
596
|
-
const startX = _nullishCoalesce(_optionalChain([series, 'access',
|
|
717
|
+
const startX = _nullishCoalesce(_optionalChain([series, 'access', _41 => _41.x, 'optionalAccess', _42 => _42[index]]), () => ( null));
|
|
597
718
|
const startAt = _chunkGTZXF4BIcjs.chartValueAtPoint.call(void 0, scene, start, secondary);
|
|
598
719
|
const startAtX = xy ? _chunkGTZXF4BIcjs.chartXAtPoint.call(void 0, scene, start) : void 0;
|
|
599
720
|
if (startAt === void 0) return null;
|
|
@@ -640,7 +761,7 @@ function startChartPointDrag(controller, scene, target, start, options = {}) {
|
|
|
640
761
|
const xs = [..._nullishCoalesce(series.x, () => ( []))];
|
|
641
762
|
xs[index] = x;
|
|
642
763
|
controller.setValue(seriesId, index, y, { label });
|
|
643
|
-
if (x !== _optionalChain([controller, 'access',
|
|
764
|
+
if (x !== _optionalChain([controller, 'access', _43 => _43.getSeries, 'call', _44 => _44(seriesId), 'optionalAccess', _45 => _45.x, 'optionalAccess', _46 => _46[index]])) controller.updateSeries(seriesId, { x: xs });
|
|
644
765
|
} else controller.setValue(seriesId, index, y, { label });
|
|
645
766
|
},
|
|
646
767
|
end() {
|
|
@@ -674,7 +795,7 @@ function handleChartKey(controller, scene, event) {
|
|
|
674
795
|
return true;
|
|
675
796
|
case "ArrowLeft":
|
|
676
797
|
case "ArrowRight": {
|
|
677
|
-
if (event.altKey || _optionalChain([selection, 'optionalAccess',
|
|
798
|
+
if (event.altKey || _optionalChain([selection, 'optionalAccess', _47 => _47.kind]) !== "point" && _optionalChain([selection, 'optionalAccess', _48 => _48.kind]) !== "category") return false;
|
|
678
799
|
const n = spec.categories.length;
|
|
679
800
|
const index = Math.max(0, Math.min(n - 1, selection.index + (event.key === "ArrowRight" ? 1 : -1)));
|
|
680
801
|
controller.select({ ...selection, index });
|
|
@@ -682,9 +803,9 @@ function handleChartKey(controller, scene, event) {
|
|
|
682
803
|
}
|
|
683
804
|
case "ArrowUp":
|
|
684
805
|
case "ArrowDown": {
|
|
685
|
-
if (_optionalChain([selection, 'optionalAccess',
|
|
686
|
-
const secondary = _optionalChain([controller, 'access',
|
|
687
|
-
const ticks = _nullishCoalesce(_nullishCoalesce(_optionalChain([(secondary ? _optionalChain([scene, 'optionalAccess',
|
|
806
|
+
if (_optionalChain([selection, 'optionalAccess', _49 => _49.kind]) !== "point" || _optionalChain([scene, 'optionalAccess', _50 => _50.percent])) return false;
|
|
807
|
+
const secondary = _optionalChain([controller, 'access', _51 => _51.getSeries, 'call', _52 => _52(selection.seriesId), 'optionalAccess', _53 => _53.axis]) === "secondary";
|
|
808
|
+
const ticks = _nullishCoalesce(_nullishCoalesce(_optionalChain([(secondary ? _optionalChain([scene, 'optionalAccess', _54 => _54.valueScale2]) : null), 'optionalAccess', _55 => _55.ticks]), () => ( _optionalChain([scene, 'optionalAccess', _56 => _56.valueScale, 'optionalAccess', _57 => _57.ticks]))), () => ( []));
|
|
688
809
|
const step = ticks.length > 1 ? ticks[1] - ticks[0] : 1;
|
|
689
810
|
const amount = event.shiftKey ? step : event.altKey ? step / 100 : step / 10;
|
|
690
811
|
controller.nudgeValue(selection.seriesId, selection.index, amount * (event.key === "ArrowUp" ? 1 : -1));
|
|
@@ -709,20 +830,20 @@ function describeChartSelection(controller, selection = controller.getState().se
|
|
|
709
830
|
case "axis":
|
|
710
831
|
return selection.axis === "x" ? _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec) === "xy" ? "X axis" : "Category axis" : selection.axis === "y" ? "Value axis" : "Secondary value axis";
|
|
711
832
|
case "series":
|
|
712
|
-
return `Series "${_nullishCoalesce(_optionalChain([controller, 'access',
|
|
833
|
+
return `Series "${_nullishCoalesce(_optionalChain([controller, 'access', _58 => _58.getSeries, 'call', _59 => _59(selection.seriesId), 'optionalAccess', _60 => _60.name]), () => ( selection.seriesId))}"`;
|
|
713
834
|
case "category":
|
|
714
835
|
return `Category "${_nullishCoalesce(spec.categories[selection.index], () => ( selection.index))}"`;
|
|
715
836
|
case "trendline": {
|
|
716
837
|
const series = controller.getSeries(selection.seriesId);
|
|
717
|
-
const line = _optionalChain([series, 'optionalAccess',
|
|
718
|
-
return `${line ? line.type.replace("-", " ") : "Trendline"} trendline on "${_nullishCoalesce(_optionalChain([series, 'optionalAccess',
|
|
838
|
+
const line = _optionalChain([series, 'optionalAccess', _61 => _61.trendlines, 'optionalAccess', _62 => _62[selection.index]]);
|
|
839
|
+
return `${line ? line.type.replace("-", " ") : "Trendline"} trendline on "${_nullishCoalesce(_optionalChain([series, 'optionalAccess', _63 => _63.name]), () => ( selection.seriesId))}"`;
|
|
719
840
|
}
|
|
720
841
|
case "point": {
|
|
721
842
|
const series = controller.getSeries(selection.seriesId);
|
|
722
|
-
const value = _optionalChain([series, 'optionalAccess',
|
|
723
|
-
const x = _optionalChain([series, 'optionalAccess',
|
|
724
|
-
if (x !== void 0 && x !== null && _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec) === "xy") return `${_nullishCoalesce(_optionalChain([series, 'optionalAccess',
|
|
725
|
-
return `${_nullishCoalesce(_optionalChain([series, 'optionalAccess',
|
|
843
|
+
const value = _optionalChain([series, 'optionalAccess', _64 => _64.values, 'access', _65 => _65[selection.index]]);
|
|
844
|
+
const x = _optionalChain([series, 'optionalAccess', _66 => _66.x, 'optionalAccess', _67 => _67[selection.index]]);
|
|
845
|
+
if (x !== void 0 && x !== null && _chunkJOX6MJW4cjs.chartFamily.call(void 0, spec) === "xy") return `${_nullishCoalesce(_optionalChain([series, 'optionalAccess', _68 => _68.name]), () => ( selection.seriesId))}: (${x}, ${_nullishCoalesce(value, () => ( "blank"))})`;
|
|
846
|
+
return `${_nullishCoalesce(_optionalChain([series, 'optionalAccess', _69 => _69.name]), () => ( selection.seriesId))} \xB7 ${_nullishCoalesce(spec.categories[selection.index], () => ( selection.index))}: ${_nullishCoalesce(value, () => ( "blank"))}`;
|
|
726
847
|
}
|
|
727
848
|
}
|
|
728
849
|
}
|
|
@@ -763,6 +884,7 @@ function chartHitTest(scene, point, measure = (t, s, w = 400) => t.length * s *
|
|
|
763
884
|
}
|
|
764
885
|
|
|
765
886
|
// src/chart/tools.ts
|
|
887
|
+
var RENDER_CHART_INSTRUCTIONS = 'Draws the chart without changing it so you can check how it looks: SVG text by default, or a PNG image with format "png" when the host can rasterize. Returns the layout warnings (hidden or thinned labels, dropped markers) alongside. An image costs tokens, so render after a batch of edits rather than after each one, and use it to check what text cannot tell you: overlapping or cut-off labels, a crowded legend, unreadable colours, whether the chart reads at the given size. For values, ids and warnings alone, get_chart is cheaper.';
|
|
766
888
|
var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
767
889
|
var WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
768
890
|
var WRITE_IDEMPOTENT = { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
@@ -817,21 +939,36 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
817
939
|
const renderChart = {
|
|
818
940
|
name: "render_chart",
|
|
819
941
|
title: "Render the chart",
|
|
820
|
-
description:
|
|
942
|
+
description: RENDER_CHART_INSTRUCTIONS,
|
|
821
943
|
inputSchema: {
|
|
822
944
|
type: "object",
|
|
823
|
-
properties: {
|
|
945
|
+
properties: {
|
|
946
|
+
width: _chunkTGBCBQFVcjs.WIDTH,
|
|
947
|
+
height: _chunkTGBCBQFVcjs.HEIGHT,
|
|
948
|
+
format: { type: "string", enum: ["svg", "png"], description: "svg (default): the SVG document as text. png: an image to look at (only when the host can rasterize; costs image tokens)." }
|
|
949
|
+
},
|
|
824
950
|
additionalProperties: false
|
|
825
951
|
},
|
|
826
952
|
annotations: { title: "Render the chart", ...READ },
|
|
827
953
|
handler: async ({ width = size.width, height = size.height, format = "svg" }) => {
|
|
828
|
-
const
|
|
954
|
+
const json = controller.toJSON();
|
|
955
|
+
const scene = _chunkGTZXF4BIcjs.layoutChart.call(void 0, json, { width, height, selection: null });
|
|
956
|
+
const svg = _chunkGTZXF4BIcjs.chartSceneToSvg.call(void 0, scene, { ariaLabel: json.title || void 0, description: _chunkGTZXF4BIcjs.describeChart.call(void 0, json) });
|
|
957
|
+
const warnings = scene.warnings;
|
|
829
958
|
if (format === "png") {
|
|
830
|
-
if (!options.rasterize) fail2('This host cannot rasterize charts; call render_chart with format "svg".');
|
|
959
|
+
if (!options.rasterize) fail2('This host cannot rasterize charts; call render_chart with format "svg", or get_chart for the layout warnings.');
|
|
831
960
|
const image = await options.rasterize(svg, { width, height });
|
|
832
|
-
|
|
961
|
+
const info = { width, height, mimeType: image.mimeType, warnings };
|
|
962
|
+
const note = warnings.length ? `Layout warnings: ${warnings.map((w) => w.message).join(" ")}` : "No layout warnings.";
|
|
963
|
+
return {
|
|
964
|
+
content: [
|
|
965
|
+
{ type: "image", data: image.data, mimeType: image.mimeType },
|
|
966
|
+
{ type: "text", text: `Chart at ${width} \xD7 ${height}. ${note}` }
|
|
967
|
+
],
|
|
968
|
+
structuredContent: info
|
|
969
|
+
};
|
|
833
970
|
}
|
|
834
|
-
return { svg, width, height };
|
|
971
|
+
return { svg, width, height, warnings };
|
|
835
972
|
}
|
|
836
973
|
};
|
|
837
974
|
const checkColors = {
|
|
@@ -850,7 +987,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
850
987
|
handler: ({ colors, surface }) => {
|
|
851
988
|
const s = spec();
|
|
852
989
|
const visible = s.series.filter((x) => !x.hidden);
|
|
853
|
-
const own = _chunkJOX6MJW4cjs.chartColorsByCategory.call(void 0, s.type) ? s.categories.map((_, i) => _optionalChain([visible, 'access',
|
|
990
|
+
const own = _chunkJOX6MJW4cjs.chartColorsByCategory.call(void 0, s.type) ? s.categories.map((_, i) => _optionalChain([visible, 'access', _70 => _70[0], 'optionalAccess', _71 => _71.pointColors, 'optionalAccess', _72 => _72[i]]) || _chunkJOX6MJW4cjs.chartSliceColor.call(void 0, s, i)) : visible.map((x) => _chunkJOX6MJW4cjs.chartSeriesColor.call(void 0, s, s.series.indexOf(x)));
|
|
854
991
|
return { colors: _nullishCoalesce(colors, () => ( own)), ..._chunkJOX6MJW4cjs.checkChartColors.call(void 0, _nullishCoalesce(colors, () => ( own)), { surface }) };
|
|
855
992
|
}
|
|
856
993
|
};
|
|
@@ -880,8 +1017,8 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
880
1017
|
annotations: { title: "Read a trendline fit", ...READ },
|
|
881
1018
|
handler: ({ series, index }) => {
|
|
882
1019
|
const s = seriesById(series);
|
|
883
|
-
const line = _optionalChain([s, 'access',
|
|
884
|
-
if (!line) fail2(`"${s.name}" has no trendline ${index}; it has ${_nullishCoalesce(_optionalChain([s, 'access',
|
|
1020
|
+
const line = _optionalChain([s, 'access', _73 => _73.trendlines, 'optionalAccess', _74 => _74[index]]);
|
|
1021
|
+
if (!line) fail2(`"${s.name}" has no trendline ${index}; it has ${_nullishCoalesce(_optionalChain([s, 'access', _75 => _75.trendlines, 'optionalAccess', _76 => _76.length]), () => ( 0))}.`);
|
|
885
1022
|
if (line.type === "moving-average") return { trendline: line, points: controller.trendlineMovingAverage(s.id, index) };
|
|
886
1023
|
const fit = controller.trendlineFit(s.id, index);
|
|
887
1024
|
if (!fit) fail2(`The ${line.type} trendline on "${s.name}" cannot be fitted: it needs more points (and positive values for log, exponential and power fits).`);
|
|
@@ -1139,7 +1276,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1139
1276
|
handler: ({ series, index }) => {
|
|
1140
1277
|
const s = seriesById(series);
|
|
1141
1278
|
resolve(controller.removeTrendline(s.id, index));
|
|
1142
|
-
return { series: s.id, trendlines: _nullishCoalesce(_optionalChain([controller, 'access',
|
|
1279
|
+
return { series: s.id, trendlines: _nullishCoalesce(_optionalChain([controller, 'access', _77 => _77.getSeries, 'call', _78 => _78(s.id), 'optionalAccess', _79 => _79.trendlines]), () => ( [])) };
|
|
1143
1280
|
}
|
|
1144
1281
|
};
|
|
1145
1282
|
const applyPreset = {
|
|
@@ -1249,9 +1386,9 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1249
1386
|
const scene = _chunkGTZXF4BIcjs.layoutChart.call(void 0, controller.toJSON(), { width, height });
|
|
1250
1387
|
const start = { x: from.x * width, y: from.y * height };
|
|
1251
1388
|
const target = chartHitTest(scene, start);
|
|
1252
|
-
if (_optionalChain([target, 'optionalAccess',
|
|
1389
|
+
if (_optionalChain([target, 'optionalAccess', _80 => _80.kind]) !== "point") fail2(`There is no bar or point at (${from.x}, ${from.y}); ${target ? `that is the ${target.kind}` : "that is outside the chart"}. Use render_chart to find marks.`);
|
|
1253
1390
|
const t = target;
|
|
1254
|
-
const before = _nullishCoalesce(_optionalChain([controller, 'access',
|
|
1391
|
+
const before = _nullishCoalesce(_optionalChain([controller, 'access', _81 => _81.getSeries, 'call', _82 => _82(t.seriesId), 'optionalAccess', _83 => _83.values, 'access', _84 => _84[t.index]]), () => ( null));
|
|
1255
1392
|
const session = startChartPointDrag(controller, scene, t, start);
|
|
1256
1393
|
if (!session) fail2("That point cannot be dragged here (percent-stacked charts, pies and gaps cannot be dragged).");
|
|
1257
1394
|
session.move({ x: to.x * width, y: to.y * height }, { fine, lockAxis });
|
|
@@ -1279,7 +1416,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1279
1416
|
const scene = _chunkGTZXF4BIcjs.layoutChart.call(void 0, controller.toJSON(), size);
|
|
1280
1417
|
const used = handleChartKey(controller, scene, { key: k, shiftKey: shift, altKey: alt });
|
|
1281
1418
|
const sel = controller.getState().selection;
|
|
1282
|
-
const value = _optionalChain([sel, 'optionalAccess',
|
|
1419
|
+
const value = _optionalChain([sel, 'optionalAccess', _85 => _85.kind]) === "point" ? _nullishCoalesce(_optionalChain([controller, 'access', _86 => _86.getSeries, 'call', _87 => _87(sel.seriesId), 'optionalAccess', _88 => _88.values, 'access', _89 => _89[sel.index]]), () => ( null)) : void 0;
|
|
1283
1420
|
return { used, selection: sel, ...value !== void 0 ? { value } : {} };
|
|
1284
1421
|
}
|
|
1285
1422
|
};
|
|
@@ -1335,7 +1472,7 @@ function parsePartialChartJson(text) {
|
|
|
1335
1472
|
if (!src) return void 0;
|
|
1336
1473
|
try {
|
|
1337
1474
|
return JSON.parse(src);
|
|
1338
|
-
} catch (
|
|
1475
|
+
} catch (e3) {
|
|
1339
1476
|
}
|
|
1340
1477
|
const stack = [];
|
|
1341
1478
|
let inString = false;
|
|
@@ -1359,7 +1496,7 @@ function parsePartialChartJson(text) {
|
|
|
1359
1496
|
const candidate = trimmed + [...stack].reverse().join("");
|
|
1360
1497
|
try {
|
|
1361
1498
|
return JSON.parse(candidate);
|
|
1362
|
-
} catch (
|
|
1499
|
+
} catch (e4) {
|
|
1363
1500
|
const next = trimmed.replace(/,\s*$/, "").replace(/(?:,|\{)\s*"[^"]*"\s*:?\s*$/, (m) => m.trim().startsWith("{") ? "{" : "").replace(/:\s*$/, ": null").replace(/(?<=[\[,:]\s*)(-|tr?u?|fa?l?s?|nu?l?)$/, "").replace(/(?<=[\[,:]\s*)(-?\d+\.)$/, (m) => m.slice(0, -1));
|
|
1364
1501
|
if (next === trimmed) break;
|
|
1365
1502
|
out = next;
|
|
@@ -1413,7 +1550,7 @@ var ChartStream = (_class = class {
|
|
|
1413
1550
|
function safeParse(text) {
|
|
1414
1551
|
try {
|
|
1415
1552
|
return JSON.parse(text);
|
|
1416
|
-
} catch (
|
|
1553
|
+
} catch (e5) {
|
|
1417
1554
|
return parsePartialChartJson(text);
|
|
1418
1555
|
}
|
|
1419
1556
|
}
|
|
@@ -1501,7 +1638,7 @@ function createInstantChartClock(start = 0) {
|
|
|
1501
1638
|
};
|
|
1502
1639
|
}
|
|
1503
1640
|
function chartPointAnchor(scene, seriesId, index) {
|
|
1504
|
-
const mark = scene.marks.find((m) => (m.role === "bar" || m.role === "point") && _optionalChain([m, 'access',
|
|
1641
|
+
const mark = scene.marks.find((m) => (m.role === "bar" || m.role === "point") && _optionalChain([m, 'access', _90 => _90.target, 'optionalAccess', _91 => _91.kind]) === "point" && m.target.seriesId === seriesId && m.target.index === index);
|
|
1505
1642
|
if (!mark) return null;
|
|
1506
1643
|
if (mark.kind === "rect") return { x: mark.x + mark.width / 2, y: mark.y };
|
|
1507
1644
|
if (mark.kind === "circle") return { x: mark.cx, y: mark.cy };
|
|
@@ -1527,8 +1664,8 @@ function planChartCommand(spec, scene, command, speed = 1) {
|
|
|
1527
1664
|
case "setValue": {
|
|
1528
1665
|
const at = chartPointAnchor(scene, command.seriesId, command.index);
|
|
1529
1666
|
const series = spec.series.find((s) => s.id === command.seriesId);
|
|
1530
|
-
const from = _nullishCoalesce(_optionalChain([series, 'optionalAccess',
|
|
1531
|
-
const scale = _optionalChain([series, 'optionalAccess',
|
|
1667
|
+
const from = _nullishCoalesce(_optionalChain([series, 'optionalAccess', _92 => _92.values, 'access', _93 => _93[command.index]]), () => ( 0));
|
|
1668
|
+
const scale = _optionalChain([series, 'optionalAccess', _94 => _94.axis]) === "secondary" ? _nullishCoalesce(scene.valueScale2, () => ( scene.valueScale)) : scene.valueScale;
|
|
1532
1669
|
if (at && scale) {
|
|
1533
1670
|
const px = _chunkGTZXF4BIcjs.linearMap.call(void 0, command.value, scale.domain, scale.range);
|
|
1534
1671
|
const to = scale.axis === "y" ? { x: at.x, y: px } : { x: px, y: at.y };
|
|
@@ -1540,12 +1677,12 @@ function planChartCommand(spec, scene, command, speed = 1) {
|
|
|
1540
1677
|
case "select": {
|
|
1541
1678
|
const sel = command.selection;
|
|
1542
1679
|
let to = null;
|
|
1543
|
-
if (_optionalChain([sel, 'optionalAccess',
|
|
1680
|
+
if (_optionalChain([sel, 'optionalAccess', _95 => _95.kind]) === "point") to = chartPointAnchor(scene, sel.seriesId, sel.index);
|
|
1544
1681
|
else if (sel) {
|
|
1545
1682
|
const m = scene.marks.find((x) => x.target && JSON.stringify(x.target) === JSON.stringify(sel));
|
|
1546
|
-
if (_optionalChain([m, 'optionalAccess',
|
|
1547
|
-
else if (_optionalChain([m, 'optionalAccess',
|
|
1548
|
-
else if (_optionalChain([m, 'optionalAccess',
|
|
1683
|
+
if (_optionalChain([m, 'optionalAccess', _96 => _96.kind]) === "text") to = { x: m.x, y: m.y };
|
|
1684
|
+
else if (_optionalChain([m, 'optionalAccess', _97 => _97.kind]) === "rect") to = { x: m.x + m.width / 2, y: m.y + m.height / 2 };
|
|
1685
|
+
else if (_optionalChain([m, 'optionalAccess', _98 => _98.kind]) === "circle") to = { x: m.cx, y: m.cy };
|
|
1549
1686
|
}
|
|
1550
1687
|
if (to) steps.push({ type: "move", to, ms: ms(380) }, { type: "press" }, { type: "release" });
|
|
1551
1688
|
steps.push({ type: "commit" });
|
|
@@ -1612,7 +1749,7 @@ var ChartDirector = (_class3 = class {
|
|
|
1612
1749
|
const t = f / frames;
|
|
1613
1750
|
const e = 1 - Math.pow(1 - t, 3);
|
|
1614
1751
|
this.presence.set({ id, x: from.x + (to.x - from.x) * e, y: from.y + (to.y - from.y) * e });
|
|
1615
|
-
_optionalChain([each, 'optionalCall',
|
|
1752
|
+
_optionalChain([each, 'optionalCall', _99 => _99(e)]);
|
|
1616
1753
|
await this.clock.wait(ms / frames);
|
|
1617
1754
|
}
|
|
1618
1755
|
}
|
|
@@ -1644,7 +1781,7 @@ var ChartDirector = (_class3 = class {
|
|
|
1644
1781
|
if (command.kind !== "setValue") break;
|
|
1645
1782
|
const stale2 = this.stale(command);
|
|
1646
1783
|
if (stale2) return { ok: false, command, message: stale2 };
|
|
1647
|
-
const label = `${_nullishCoalesce(_optionalChain([this, 'access',
|
|
1784
|
+
const label = `${_nullishCoalesce(_optionalChain([this, 'access', _100 => _100.presence, 'access', _101 => _101.getState, 'call', _102 => _102(), 'access', _103 => _103.actors, 'access', _104 => _104.find, 'call', _105 => _105((a) => a.id === id), 'optionalAccess', _106 => _106.name]), () => ( "Agent"))}: edit value`;
|
|
1648
1785
|
await this.move(id, where(), step.to, step.ms, (e) => {
|
|
1649
1786
|
const v = step.from + (step.value - step.from) * e;
|
|
1650
1787
|
this.controller.setValue(command.seriesId, command.index, Number(v.toPrecision(12)), { label });
|
|
@@ -1799,5 +1936,13 @@ var ChartDirector = (_class3 = class {
|
|
|
1799
1936
|
|
|
1800
1937
|
|
|
1801
1938
|
|
|
1802
|
-
|
|
1939
|
+
|
|
1940
|
+
|
|
1941
|
+
|
|
1942
|
+
|
|
1943
|
+
|
|
1944
|
+
|
|
1945
|
+
|
|
1946
|
+
|
|
1947
|
+
exports.CHART_AXIS_KINDS = _chunkJOX6MJW4cjs.CHART_AXIS_KINDS; exports.CHART_COLOR_SCHEMES = _chunkGTZXF4BIcjs.CHART_COLOR_SCHEMES; exports.CHART_CURVES = _chunkJOX6MJW4cjs.CHART_CURVES; exports.CHART_DATE_STEPS = _chunkGTZXF4BIcjs.CHART_DATE_STEPS; exports.CHART_LABEL_POSITIONS = _chunkJOX6MJW4cjs.CHART_LABEL_POSITIONS; exports.CHART_LAYOUT_PRESETS = _chunkGTZXF4BIcjs.CHART_LAYOUT_PRESETS; exports.CHART_LEGEND_POSITIONS = _chunkJOX6MJW4cjs.CHART_LEGEND_POSITIONS; exports.CHART_MARKERS = _chunkJOX6MJW4cjs.CHART_MARKERS; exports.CHART_MERMAID_META_PREFIX = _chunkGTZXF4BIcjs.CHART_MERMAID_META_PREFIX; exports.CHART_NUMBER_STYLES = _chunkJOX6MJW4cjs.CHART_NUMBER_STYLES; exports.CHART_OOXML_CONTENT_TYPE = _chunk3JNRQVTScjs.CHART_OOXML_CONTENT_TYPE; exports.CHART_OOXML_NS = _chunk3JNRQVTScjs.CHART_OOXML_NS; exports.CHART_OOXML_RELATIONSHIP = _chunk3JNRQVTScjs.CHART_OOXML_RELATIONSHIP; exports.CHART_ORIENTATIONS = _chunkJOX6MJW4cjs.CHART_ORIENTATIONS; exports.CHART_PALETTE_SHADES = _chunkJOX6MJW4cjs.CHART_PALETTE_SHADES; exports.CHART_PRESENCE_COLORS = CHART_PRESENCE_COLORS; exports.CHART_RASTER_MAX_SIZE = CHART_RASTER_MAX_SIZE; exports.CHART_SERIES_TYPES = _chunkJOX6MJW4cjs.CHART_SERIES_TYPES; exports.CHART_STACKINGS = _chunkJOX6MJW4cjs.CHART_STACKINGS; exports.CHART_TRENDLINE_TYPES = _chunkJOX6MJW4cjs.CHART_TRENDLINE_TYPES; exports.CHART_TYPES = _chunkJOX6MJW4cjs.CHART_TYPES; exports.CHART_TYPE_LABELS = _chunkJOX6MJW4cjs.CHART_TYPE_LABELS; exports.CSS_VARIABLE_CHART_THEME = _chunkJOX6MJW4cjs.CSS_VARIABLE_CHART_THEME; exports.ChartController = _chunkGTZXF4BIcjs.ChartController; exports.ChartDirector = ChartDirector; exports.ChartPresence = ChartPresence; exports.ChartStream = ChartStream; exports.DEFAULT_CHART_PALETTE = _chunkJOX6MJW4cjs.DEFAULT_CHART_PALETTE; exports.DEFAULT_CHART_THEME = _chunkJOX6MJW4cjs.DEFAULT_CHART_THEME; exports.MAX_CHART_DATA_LABELS = _chunkGTZXF4BIcjs.MAX_CHART_DATA_LABELS; exports.MAX_CHART_LINE_POINTS = _chunkGTZXF4BIcjs.MAX_CHART_LINE_POINTS; exports.MAX_CHART_MARKERS = _chunkGTZXF4BIcjs.MAX_CHART_MARKERS; exports.RENDER_CHART_INSTRUCTIONS = RENDER_CHART_INSTRUCTIONS; exports.analyzeChartTable = analyzeChartTable; exports.blendChartScenes = blendChartScenes; exports.canDragChartPoint = canDragChartPoint; exports.chartBoxStats = _chunkGTZXF4BIcjs.chartBoxStats; exports.chartClientToScene = chartClientToScene; exports.chartColorDistance = _chunkJOX6MJW4cjs.chartColorDistance; exports.chartColorInputValue = _chunkJOX6MJW4cjs.chartColorInputValue; exports.chartColorsByCategory = _chunkJOX6MJW4cjs.chartColorsByCategory; exports.chartContrastRatio = _chunkJOX6MJW4cjs.chartContrastRatio; exports.chartDataFromTable = _chunkJOX6MJW4cjs.chartDataFromTable; exports.chartDataToTable = _chunkJOX6MJW4cjs.chartDataToTable; exports.chartDateLabels = _chunkGTZXF4BIcjs.chartDateLabels; exports.chartDateToSerial = _chunkGTZXF4BIcjs.chartDateToSerial; exports.chartFamily = _chunkJOX6MJW4cjs.chartFamily; exports.chartFileName = chartFileName; exports.chartFormatToCode = _chunk3JNRQVTScjs.chartFormatToCode; exports.chartFromMermaid = _chunkGTZXF4BIcjs.chartFromMermaid; exports.chartFromOoxml = _chunk3JNRQVTScjs.chartFromOoxml; exports.chartFromTable = chartFromTable; exports.chartHistogram = _chunkGTZXF4BIcjs.chartHistogram; exports.chartHitTest = chartHitTest; exports.chartLuminance = _chunkJOX6MJW4cjs.chartLuminance; exports.chartMermaidFamily = _chunkGTZXF4BIcjs.chartMermaidFamily; exports.chartMovingAverage = _chunkGTZXF4BIcjs.chartMovingAverage; exports.chartPointAnchor = chartPointAnchor; exports.chartPointColor = _chunkJOX6MJW4cjs.chartPointColor; exports.chartPresetPatch = _chunkGTZXF4BIcjs.chartPresetPatch; exports.chartQuantile = _chunkGTZXF4BIcjs.chartQuantile; exports.chartRasterSize = chartRasterSize; exports.chartRgbToHex = _chunkJOX6MJW4cjs.chartRgbToHex; exports.chartRgbToOklab = _chunkJOX6MJW4cjs.chartRgbToOklab; exports.chartSceneToDomSpec = _chunkGTZXF4BIcjs.chartSceneToDomSpec; exports.chartSceneToSvg = _chunkGTZXF4BIcjs.chartSceneToSvg; exports.chartSerialToDate = _chunkGTZXF4BIcjs.chartSerialToDate; exports.chartSeriesColor = _chunkJOX6MJW4cjs.chartSeriesColor; exports.chartSeriesType = _chunkJOX6MJW4cjs.chartSeriesType; exports.chartSliceColor = _chunkJOX6MJW4cjs.chartSliceColor; exports.chartSquarify = _chunkGTZXF4BIcjs.chartSquarify; exports.chartSupportsTrendlines = _chunkGTZXF4BIcjs.chartSupportsTrendlines; exports.chartTextBaseline = _chunkGTZXF4BIcjs.chartTextBaseline; exports.chartTextOn = _chunkJOX6MJW4cjs.chartTextOn; exports.chartTextTransform = _chunkGTZXF4BIcjs.chartTextTransform; exports.chartToMermaid = _chunkGTZXF4BIcjs.chartToMermaid; exports.chartToOoxml = _chunk3JNRQVTScjs.chartToOoxml; exports.chartToSvg = _chunkGTZXF4BIcjs.chartToSvg; exports.chartTrendlineName = _chunkGTZXF4BIcjs.chartTrendlineName; exports.chartValueAtPoint = _chunkGTZXF4BIcjs.chartValueAtPoint; exports.chartXAtPoint = _chunkGTZXF4BIcjs.chartXAtPoint; exports.checkChartColors = _chunkJOX6MJW4cjs.checkChartColors; exports.cloneChartSeries = _chunkJOX6MJW4cjs.cloneChartSeries; exports.cloneChartSpec = _chunkJOX6MJW4cjs.cloneChartSpec; exports.compileChartFormatCode = _chunkGTZXF4BIcjs.compileChartFormatCode; exports.contrastingTextColor = _chunkGTZXF4BIcjs.contrastingTextColor; exports.createChartCommands = createChartCommands; exports.createChartController = _chunkGTZXF4BIcjs.createChartController; exports.createChartRasterizer = createChartRasterizer; exports.createChartSpec = _chunkJOX6MJW4cjs.createChartSpec; exports.createChartToolProvider = createChartToolProvider; exports.createInstantChartClock = createInstantChartClock; exports.cyclePaletteColor = _chunkJOX6MJW4cjs.cyclePaletteColor; exports.decimateChartPoints = _chunkGTZXF4BIcjs.decimateChartPoints; exports.defaultChartAxis = _chunkJOX6MJW4cjs.defaultChartAxis; exports.describeChart = _chunkGTZXF4BIcjs.describeChart; exports.describeChartSelection = describeChartSelection; exports.downloadChartPng = downloadChartPng; exports.easeChartTween = easeChartTween; exports.estimateChartTextWidth = _chunkGTZXF4BIcjs.estimateChartTextWidth; exports.findMermaidCharts = _chunkGTZXF4BIcjs.findMermaidCharts; exports.fitChartTrendline = _chunkGTZXF4BIcjs.fitChartTrendline; exports.formatChartDate = _chunkGTZXF4BIcjs.formatChartDate; exports.formatChartNumber = _chunkGTZXF4BIcjs.formatChartNumber; exports.formatChartValueWithCode = _chunkGTZXF4BIcjs.formatChartValueWithCode; exports.handleChartKey = handleChartKey; exports.isCartesianChart = _chunkJOX6MJW4cjs.isCartesianChart; exports.isXyChart = _chunkJOX6MJW4cjs.isXyChart; exports.layoutChart = _chunkGTZXF4BIcjs.layoutChart; exports.layoutSparkline = _chunkGTZXF4BIcjs.layoutSparkline; exports.linearMap = _chunkGTZXF4BIcjs.linearMap; exports.monochromeChartPalette = _chunkGTZXF4BIcjs.monochromeChartPalette; exports.niceScale = _chunkGTZXF4BIcjs.niceScale; exports.niceStep = _chunkGTZXF4BIcjs.niceStep; exports.normalizeChartAxis = _chunkJOX6MJW4cjs.normalizeChartAxis; exports.normalizeChartSpec = _chunkJOX6MJW4cjs.normalizeChartSpec; exports.normalizeChartTrendline = _chunkJOX6MJW4cjs.normalizeChartTrendline; exports.normalizeChartValues = _chunkJOX6MJW4cjs.normalizeChartValues; exports.parseChartColor = _chunkJOX6MJW4cjs.parseChartColor; exports.parseChartDate = _chunkGTZXF4BIcjs.parseChartDate; exports.parseChartValue = _chunkJOX6MJW4cjs.parseChartValue; exports.parsePartialChartJson = parsePartialChartJson; exports.planChartCommand = planChartCommand; exports.rasterizeChartSvg = rasterizeChartSvg; exports.realChartClock = realChartClock; exports.recommendChartTypes = recommendChartTypes; exports.recommendForShape = recommendForShape; exports.resolveChartSvgPaints = resolveChartSvgPaints; exports.sameChartSelection = _chunkGTZXF4BIcjs.sameChartSelection; exports.shadeChartColor = _chunkJOX6MJW4cjs.shadeChartColor; exports.simulateChartVision = _chunkJOX6MJW4cjs.simulateChartVision; exports.snapChartDragValue = snapChartDragValue; exports.snapChartValue = _chunkGTZXF4BIcjs.snapChartValue; exports.sparklineToSvg = _chunkGTZXF4BIcjs.sparklineToSvg; exports.startChartPointDrag = startChartPointDrag; exports.stepDecimals = _chunkGTZXF4BIcjs.stepDecimals; exports.summarizeChart = _chunkGTZXF4BIcjs.summarizeChart; exports.summarizeChartSeries = _chunkGTZXF4BIcjs.summarizeChartSeries; exports.trendNumberText = _chunkGTZXF4BIcjs.trendNumberText; exports.uniqueChartSeriesId = _chunkJOX6MJW4cjs.uniqueChartSeriesId;
|
|
1803
1948
|
//# sourceMappingURL=index.cjs.map
|