@pixerate/editor 0.165.0 → 0.166.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/agent/index.cjs +34 -34
- package/dist/agent/index.js +5 -5
- package/dist/canvas/index.cjs +6 -6
- package/dist/canvas/index.js +2 -2
- package/dist/chart/controller.d.cts +29 -0
- package/dist/chart/controller.d.ts +29 -0
- package/dist/chart/index.cjs +301 -179
- package/dist/chart/index.d.cts +1 -0
- package/dist/chart/index.d.ts +1 -0
- package/dist/chart/index.js +132 -10
- package/dist/chart/layout-families.d.cts +7 -0
- package/dist/chart/layout-families.d.ts +7 -0
- package/dist/chart/layout-shared.d.cts +5 -0
- package/dist/chart/layout-shared.d.ts +5 -0
- package/dist/chart/race.d.cts +26 -0
- package/dist/chart/race.d.ts +26 -0
- package/dist/chart/schemas.d.cts +2 -0
- package/dist/chart/schemas.d.ts +2 -0
- package/dist/chart/spec.d.cts +1 -1
- package/dist/chart/spec.d.ts +1 -1
- package/dist/chart/types.d.cts +6 -2
- package/dist/chart/types.d.ts +6 -2
- package/dist/{chunk-FEU2XVQH.js → chunk-5UNQDC3Q.js} +5 -2
- package/dist/{chunk-64VWWR5U.cjs → chunk-6FYIFGBW.cjs} +16 -16
- package/dist/{chunk-UVXTOZ2B.cjs → chunk-BPX4Z3N3.cjs} +12 -3
- package/dist/{chunk-MKXK6E4O.cjs → chunk-CHLV7UFP.cjs} +51 -51
- package/dist/{chunk-X5W645RI.js → chunk-DFCAR7AW.js} +3 -3
- package/dist/{chunk-2ZRN43IN.js → chunk-FR432ROA.js} +12 -3
- package/dist/{chunk-ODFCS7HF.cjs → chunk-HXOBOHH2.cjs} +8 -8
- package/dist/{chunk-V5GSY3NC.js → chunk-ITANXMZD.js} +78 -2
- package/dist/{chunk-TVQW26AV.cjs → chunk-MZFZSVUJ.cjs} +26 -23
- package/dist/{chunk-N7NBGT2Y.js → chunk-NQQDGGXY.js} +2 -2
- package/dist/{chunk-Q25WAFTD.cjs → chunk-SZWVMB3B.cjs} +21 -18
- package/dist/{chunk-QO2T6KA5.cjs → chunk-UUUTEVX6.cjs} +116 -40
- package/dist/{chunk-IMRXC7OA.cjs → chunk-V5L2G22R.cjs} +153 -77
- package/dist/{chunk-2J5VLJHC.js → chunk-VB2CY6EG.js} +3 -3
- package/dist/{chunk-CRFSQWKQ.js → chunk-XNU45TYA.js} +4 -1
- package/dist/{chunk-FRBRLKNQ.js → chunk-YUFTVNLX.js} +78 -2
- package/dist/export/index.cjs +4 -4
- package/dist/export/index.js +3 -3
- package/dist/extensions/index.cjs +7 -7
- package/dist/extensions/index.js +6 -6
- package/dist/index.cjs +13 -13
- package/dist/index.js +7 -7
- package/package.json +1 -1
- package/skills/pixerate-chart/SKILL.md +20 -2
package/dist/agent/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkMZFZSVUJcjs = require('../chunk-MZFZSVUJ.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkGLQQ2VILcjs = require('../chunk-GLQQ2VIL.cjs');
|
|
@@ -121,16 +121,16 @@ var _chunkN2FGYZ4Qcjs = require('../chunk-N2FGYZ4Q.cjs');
|
|
|
121
121
|
|
|
122
122
|
|
|
123
123
|
|
|
124
|
-
var
|
|
124
|
+
var _chunk6FYIFGBWcjs = require('../chunk-6FYIFGBW.cjs');
|
|
125
125
|
|
|
126
126
|
|
|
127
|
-
var
|
|
127
|
+
var _chunkV5L2G22Rcjs = require('../chunk-V5L2G22R.cjs');
|
|
128
128
|
require('../chunk-TTCJPX4U.cjs');
|
|
129
|
-
require('../chunk-
|
|
129
|
+
require('../chunk-UUUTEVX6.cjs');
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
|
|
133
|
-
var
|
|
133
|
+
var _chunkBPX4Z3N3cjs = require('../chunk-BPX4Z3N3.cjs');
|
|
134
134
|
require('../chunk-VU6WQSMB.cjs');
|
|
135
135
|
|
|
136
136
|
|
|
@@ -633,14 +633,14 @@ var SIZE_WIDTH = {
|
|
|
633
633
|
};
|
|
634
634
|
var SIZE_HEIGHT = { type: "number", minimum: 50, maximum: 4096, description: "Height in pixels (default 320)." };
|
|
635
635
|
var SPEC_PROPERTIES = {
|
|
636
|
-
...
|
|
636
|
+
..._chunkMZFZSVUJcjs.CHART_UPDATE_PROPERTIES,
|
|
637
637
|
categories: { type: "array", items: { type: "string" }, description: "Category labels in order (x axis labels, or pie slices)." },
|
|
638
638
|
series: {
|
|
639
639
|
type: "array",
|
|
640
640
|
description: "The series, each with one value per category (padded with gaps).",
|
|
641
641
|
items: {
|
|
642
642
|
type: "object",
|
|
643
|
-
properties: { id: { type: "string", description: "Stable id (default: from the name)." }, ...
|
|
643
|
+
properties: { id: { type: "string", description: "Stable id (default: from the name)." }, ..._chunkMZFZSVUJcjs.SERIES_PROPS },
|
|
644
644
|
required: ["name", "values"],
|
|
645
645
|
additionalProperties: false
|
|
646
646
|
}
|
|
@@ -651,7 +651,7 @@ function cleanSeries(series) {
|
|
|
651
651
|
return series.map((s) => s && typeof s === "object" ? Object.fromEntries(Object.entries(s).filter(([, v]) => v !== null)) : s);
|
|
652
652
|
}
|
|
653
653
|
function checkedSpec(input) {
|
|
654
|
-
const { spec, issues } =
|
|
654
|
+
const { spec, issues } = _chunkBPX4Z3N3cjs.normalizeChartSpec.call(void 0, { ...input, ...input.series !== void 0 ? { series: cleanSeries(input.series) } : {} });
|
|
655
655
|
if (issues.length) throw new Error(`The chart was not changed: ${issues.map((i) => i.message).join(" ")}`);
|
|
656
656
|
return spec;
|
|
657
657
|
}
|
|
@@ -666,14 +666,14 @@ function describe(chart, includeSpec) {
|
|
|
666
666
|
series: spec.series.map((s) => ({ id: s.id, name: s.name })),
|
|
667
667
|
width: _nullishCoalesce(node.attrs.width, () => ( null)),
|
|
668
668
|
height: node.attrs.height,
|
|
669
|
-
description:
|
|
669
|
+
description: _chunkV5L2G22Rcjs.describeChart.call(void 0, spec),
|
|
670
670
|
...includeSpec ? { spec } : {}
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
673
|
function sparklines(doc) {
|
|
674
674
|
const found = [];
|
|
675
675
|
doc.descendants((node, pos) => {
|
|
676
|
-
if (node.type.name === "sparkline") found.push({ pos, kind: node.attrs.kind, values: node.attrs.values, label:
|
|
676
|
+
if (node.type.name === "sparkline") found.push({ pos, kind: node.attrs.kind, values: node.attrs.values, label: _chunk6FYIFGBWcjs.sparklineLabel.call(void 0, node) });
|
|
677
677
|
});
|
|
678
678
|
return found;
|
|
679
679
|
}
|
|
@@ -684,7 +684,7 @@ function checkPosition(editor, at) {
|
|
|
684
684
|
function createDocumentChartTools(editor) {
|
|
685
685
|
const chartType = () => editor().schema.nodes.chart;
|
|
686
686
|
const findChart = (args) => {
|
|
687
|
-
const charts =
|
|
687
|
+
const charts = _chunk6FYIFGBWcjs.getDocumentCharts.call(void 0, editor().state.doc);
|
|
688
688
|
const list = charts.map((c) => `"${c.id}" at ${c.pos}`).join(", ") || "none; add one with insert_chart";
|
|
689
689
|
if (args.chartId !== void 0) {
|
|
690
690
|
const chart = charts.find((c) => c.id === args.chartId);
|
|
@@ -711,7 +711,7 @@ function createDocumentChartTools(editor) {
|
|
|
711
711
|
annotations: { title: "List charts in the document", ...READ },
|
|
712
712
|
handler: ({ includeSpec = false }) => {
|
|
713
713
|
const doc = editor().state.doc;
|
|
714
|
-
return { charts:
|
|
714
|
+
return { charts: _chunk6FYIFGBWcjs.getDocumentCharts.call(void 0, doc).map((c) => describe(c, includeSpec)), sparklines: editor().schema.nodes.sparkline ? sparklines(doc) : [] };
|
|
715
715
|
}
|
|
716
716
|
};
|
|
717
717
|
const insertChart = {
|
|
@@ -738,7 +738,7 @@ function createDocumentChartTools(editor) {
|
|
|
738
738
|
const node = { type: "chart", attrs: { id, spec, width, ...height !== void 0 ? { height } : {} } };
|
|
739
739
|
const chain = ed.chain().command(({ tr }) => (_history.closeHistory.call(void 0, tr), true));
|
|
740
740
|
const ok = (at !== void 0 ? chain.insertContentAt(at, node) : chain.insertContent(node)).run();
|
|
741
|
-
const chart =
|
|
741
|
+
const chart = _chunk6FYIFGBWcjs.getDocumentCharts.call(void 0, ed.state.doc).find((c) => c.id === id);
|
|
742
742
|
if (!ok || !chart) throw new Error(`A chart cannot go at ${_nullishCoalesce(at, () => ( ed.state.selection.from))}; pass a position between blocks or inside a paragraph.`);
|
|
743
743
|
return { id: chart.id, pos: chart.pos, spec: chart.spec, width: chart.node.attrs.width, height: chart.node.attrs.height };
|
|
744
744
|
}
|
|
@@ -785,8 +785,8 @@ function createDocumentChartTools(editor) {
|
|
|
785
785
|
inputSchema: {
|
|
786
786
|
type: "object",
|
|
787
787
|
properties: {
|
|
788
|
-
values: { type: "array", items:
|
|
789
|
-
kind: { type: "string", enum: [...
|
|
788
|
+
values: { type: "array", items: _chunkMZFZSVUJcjs.VALUE, minItems: 1, maxItems: _chunk6FYIFGBWcjs.MAX_SPARKLINE_VALUES, description: "Values in order (null for a gap)." },
|
|
789
|
+
kind: { type: "string", enum: [..._chunk6FYIFGBWcjs.SPARKLINE_KINDS], description: "line (default), column, or win-loss (sign only)." },
|
|
790
790
|
at: { type: "integer", minimum: 0, description: "Document position inside a paragraph (default: the selection)." },
|
|
791
791
|
width: { type: "number", minimum: 4, maximum: 1e3, description: "Width in pixels (default 80)." },
|
|
792
792
|
height: { type: "number", minimum: 4, maximum: 200, description: "Height in pixels (default 18)." },
|
|
@@ -800,12 +800,12 @@ function createDocumentChartTools(editor) {
|
|
|
800
800
|
handler: ({ values, kind = "line", at, width = 80, height = 18, color = null, label = null }) => {
|
|
801
801
|
const ed = editor();
|
|
802
802
|
checkPosition(ed, at);
|
|
803
|
-
const parsed = values.map((v) =>
|
|
803
|
+
const parsed = values.map((v) => _chunkBPX4Z3N3cjs.parseChartValue.call(void 0, v));
|
|
804
804
|
const bad = parsed.findIndex((v) => v === void 0);
|
|
805
805
|
if (bad >= 0) throw new Error(`values[${bad}] ("${String(values[bad])}") is not a number; pass numbers, numeric text or null. Nothing was inserted.`);
|
|
806
806
|
const pos = _nullishCoalesce(at, () => ( ed.state.selection.from));
|
|
807
807
|
if (!ed.state.doc.resolve(pos).parent.inlineContent) throw new Error(`Position ${pos} is between blocks; a sparkline goes inside a paragraph (use a position from get_text {blocks: true}).`);
|
|
808
|
-
const stored =
|
|
808
|
+
const stored = _chunk6FYIFGBWcjs.normalizeSparklineValues.call(void 0, parsed);
|
|
809
809
|
ed.chain().command(({ tr }) => (_history.closeHistory.call(void 0, tr), true)).insertContentAt(pos, { type: "sparkline", attrs: { values: stored, kind, width, height, color, label } }).run();
|
|
810
810
|
return { pos, kind, values: stored };
|
|
811
811
|
}
|
|
@@ -1143,8 +1143,8 @@ function createTextPresence(editor, providerId, option) {
|
|
|
1143
1143
|
const config = option === false ? null : option === true || option === void 0 ? {} : option;
|
|
1144
1144
|
const caret = {
|
|
1145
1145
|
id: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _43 => _43.id]), () => ( providerId)),
|
|
1146
|
-
name: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _44 => _44.name]), () => (
|
|
1147
|
-
color: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _45 => _45.color]), () => (
|
|
1146
|
+
name: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _44 => _44.name]), () => ( _chunk6FYIFGBWcjs.DEFAULT_AGENT_CARET_NAME)),
|
|
1147
|
+
color: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _45 => _45.color]), () => ( _chunk6FYIFGBWcjs.DEFAULT_AGENT_CARET_COLOR))
|
|
1148
1148
|
};
|
|
1149
1149
|
const typing = !_optionalChain([config, 'optionalAccess', _46 => _46.typing]) ? null : config.typing === true ? {} : config.typing;
|
|
1150
1150
|
const idleMs = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _47 => _47.idleMs]), () => ( 12e3));
|
|
@@ -1157,19 +1157,19 @@ function createTextPresence(editor, providerId, option) {
|
|
|
1157
1157
|
};
|
|
1158
1158
|
const touch = () => {
|
|
1159
1159
|
clearTimeout(idleTimer);
|
|
1160
|
-
if (idleMs > 0) idleTimer = setTimeout(() => live() &&
|
|
1160
|
+
if (idleMs > 0) idleTimer = setTimeout(() => live() && _chunk6FYIFGBWcjs.clearAgentCaret.call(void 0, live(), caret.id), idleMs);
|
|
1161
1161
|
};
|
|
1162
1162
|
const tint = (ed, ranges) => {
|
|
1163
1163
|
clearTimeout(tintTimer);
|
|
1164
|
-
|
|
1165
|
-
if (changedMs > 0 && ranges.length) tintTimer = setTimeout(() => live() &&
|
|
1164
|
+
_chunk6FYIFGBWcjs.markAgentChanges.call(void 0, ed, caret.id, ranges);
|
|
1165
|
+
if (changedMs > 0 && ranges.length) tintTimer = setTimeout(() => live() && _chunk6FYIFGBWcjs.markAgentChanges.call(void 0, live(), caret.id, []), changedMs);
|
|
1166
1166
|
};
|
|
1167
1167
|
return {
|
|
1168
1168
|
/** Puts the caret at `head`, selecting from `anchor`. */
|
|
1169
1169
|
show(anchor, head = anchor) {
|
|
1170
1170
|
const ed = live();
|
|
1171
1171
|
if (!ed) return;
|
|
1172
|
-
|
|
1172
|
+
_chunk6FYIFGBWcjs.setAgentCaret.call(void 0, ed, { ...caret, from: anchor, to: head });
|
|
1173
1173
|
touch();
|
|
1174
1174
|
},
|
|
1175
1175
|
/** Shows the caret after ranges just changed by a tool, tinting them. */
|
|
@@ -1177,7 +1177,7 @@ function createTextPresence(editor, providerId, option) {
|
|
|
1177
1177
|
const ed = live();
|
|
1178
1178
|
if (!ed || !ranges.length) return;
|
|
1179
1179
|
const last = ranges[ranges.length - 1];
|
|
1180
|
-
|
|
1180
|
+
_chunk6FYIFGBWcjs.setAgentCaret.call(void 0, ed, { ...caret, from: last.to });
|
|
1181
1181
|
tint(ed, ranges);
|
|
1182
1182
|
touch();
|
|
1183
1183
|
},
|
|
@@ -1185,12 +1185,12 @@ function createTextPresence(editor, providerId, option) {
|
|
|
1185
1185
|
async write(ed, from, to, text, signal) {
|
|
1186
1186
|
if (live() && typing) {
|
|
1187
1187
|
clearTimeout(tintTimer);
|
|
1188
|
-
const range2 = await
|
|
1189
|
-
if (changedMs > 0) tintTimer = setTimeout(() => live() &&
|
|
1188
|
+
const range2 = await _chunk6FYIFGBWcjs.typeAgentText.call(void 0, ed, { ...typing, from, to, text, caret, signal });
|
|
1189
|
+
if (changedMs > 0) tintTimer = setTimeout(() => live() && _chunk6FYIFGBWcjs.markAgentChanges.call(void 0, live(), caret.id, []), changedMs);
|
|
1190
1190
|
touch();
|
|
1191
1191
|
return range2;
|
|
1192
1192
|
}
|
|
1193
|
-
const tr = _history.closeHistory.call(void 0,
|
|
1193
|
+
const tr = _history.closeHistory.call(void 0, _chunk6FYIFGBWcjs.replaceWithTextTransaction.call(void 0, ed.state, from, to, text));
|
|
1194
1194
|
const end = tr.mapping.map(to, 1);
|
|
1195
1195
|
const range = { from: Math.min(tr.mapping.map(from, -1), end), to: end };
|
|
1196
1196
|
ed.view.dispatch(tr.scrollIntoView());
|
|
@@ -1219,7 +1219,7 @@ function findMatches(editor, query, args, replacement) {
|
|
|
1219
1219
|
wholeWord: !!args.wholeWord,
|
|
1220
1220
|
...args.regex ? { regex: true } : { literal: true }
|
|
1221
1221
|
};
|
|
1222
|
-
const result =
|
|
1222
|
+
const result = _chunk6FYIFGBWcjs.searchDocument.call(void 0, editor.state.doc, query, options, replacement !== void 0 ? { replacement } : {});
|
|
1223
1223
|
if (result.error) throw new Error(`Invalid search pattern: ${result.error.message}`);
|
|
1224
1224
|
return { matches: result.matches, truncated: result.truncated };
|
|
1225
1225
|
}
|
|
@@ -1381,7 +1381,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
1381
1381
|
replacement: String(replace).replace(/\r\n?|\n/g, "\r")
|
|
1382
1382
|
}));
|
|
1383
1383
|
const tr = _history.closeHistory.call(void 0, ed.state.tr);
|
|
1384
|
-
const ends =
|
|
1384
|
+
const ends = _chunk6FYIFGBWcjs.applyReplacements.call(void 0, tr, chosen);
|
|
1385
1385
|
ed.view.dispatch(tr.scrollIntoView());
|
|
1386
1386
|
const ranges = chosen.map((m, i) => ({ from: tr.mapping.map(m.from, -1), to: ends[i] }));
|
|
1387
1387
|
presence.changed(ranges.filter((r) => r.from < r.to));
|
|
@@ -1482,7 +1482,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
1482
1482
|
inputSchema: {
|
|
1483
1483
|
type: "object",
|
|
1484
1484
|
properties: {
|
|
1485
|
-
operation: { type: "string", enum:
|
|
1485
|
+
operation: { type: "string", enum: _chunk6FYIFGBWcjs.TABLE_ACTIONS.map((a) => a.action), description: "Table operation." },
|
|
1486
1486
|
at: { type: "integer", minimum: 0, description: "Document position to place the cursor first (e.g. inside a cell)." },
|
|
1487
1487
|
rows: { type: "integer", minimum: 1, maximum: 100, description: "insertTable: rows (default 3)." },
|
|
1488
1488
|
cols: { type: "integer", minimum: 1, maximum: 50, description: "insertTable: columns (default 3)." },
|
|
@@ -1512,10 +1512,10 @@ function createRichTextToolProvider(target, options) {
|
|
|
1512
1512
|
ed.view.dispatch(ed.state.tr.setSelection(_state.TextSelection.near(ed.state.doc.resolve(at))));
|
|
1513
1513
|
}
|
|
1514
1514
|
const action = operation;
|
|
1515
|
-
const state =
|
|
1515
|
+
const state = _chunk6FYIFGBWcjs.getTableActionState.call(void 0, ed, action, params);
|
|
1516
1516
|
if (state !== true) throw new Error(state);
|
|
1517
|
-
|
|
1518
|
-
const table =
|
|
1517
|
+
_chunk6FYIFGBWcjs.runTableAction.call(void 0, ed, action, params);
|
|
1518
|
+
const table = _chunk6FYIFGBWcjs.getTableState.call(void 0, ed);
|
|
1519
1519
|
return {
|
|
1520
1520
|
operation,
|
|
1521
1521
|
table: table.inTable ? { rows: table.rows, columns: table.columns, row: table.row, column: table.column } : null,
|
|
@@ -1534,7 +1534,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
1534
1534
|
if (!ed || ed.isDestroyed) return [];
|
|
1535
1535
|
if (!ed.isEditable) return [getText, findText, ...charts.read()];
|
|
1536
1536
|
const tools = [getText, findText, insertText, replaceText, replaceRange, replaceSelection, setSelection, ...formatting.tools(ed)];
|
|
1537
|
-
return [...tools, ...
|
|
1537
|
+
return [...tools, ..._chunk6FYIFGBWcjs.isTableEnabled.call(void 0, ed) ? [editTable] : [], ...charts.read(), ...charts.write().map(withCaret)];
|
|
1538
1538
|
},
|
|
1539
1539
|
subscribe: (notify) => {
|
|
1540
1540
|
const ed = editor();
|
package/dist/agent/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
CHART_UPDATE_PROPERTIES,
|
|
3
3
|
SERIES_PROPS,
|
|
4
4
|
VALUE
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-5UNQDC3Q.js";
|
|
6
6
|
import {
|
|
7
7
|
hasVariantCommands
|
|
8
8
|
} from "../chunk-3TNA7JKI.js";
|
|
@@ -121,16 +121,16 @@ import {
|
|
|
121
121
|
setAgentCaret,
|
|
122
122
|
sparklineLabel,
|
|
123
123
|
typeAgentText
|
|
124
|
-
} from "../chunk-
|
|
124
|
+
} from "../chunk-DFCAR7AW.js";
|
|
125
125
|
import {
|
|
126
126
|
describeChart
|
|
127
|
-
} from "../chunk-
|
|
127
|
+
} from "../chunk-YUFTVNLX.js";
|
|
128
128
|
import "../chunk-KGRZMHZB.js";
|
|
129
|
-
import "../chunk-
|
|
129
|
+
import "../chunk-ITANXMZD.js";
|
|
130
130
|
import {
|
|
131
131
|
normalizeChartSpec,
|
|
132
132
|
parseChartValue
|
|
133
|
-
} from "../chunk-
|
|
133
|
+
} from "../chunk-FR432ROA.js";
|
|
134
134
|
import "../chunk-O6OGNDND.js";
|
|
135
135
|
import {
|
|
136
136
|
getEditorMarkdown,
|
package/dist/canvas/index.cjs
CHANGED
|
@@ -113,10 +113,10 @@ var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
|
|
|
113
113
|
var _chunkN2FGYZ4Qcjs = require('../chunk-N2FGYZ4Q.cjs');
|
|
114
114
|
|
|
115
115
|
|
|
116
|
-
var
|
|
116
|
+
var _chunkUUUTEVX6cjs = require('../chunk-UUUTEVX6.cjs');
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
var
|
|
119
|
+
var _chunkBPX4Z3N3cjs = require('../chunk-BPX4Z3N3.cjs');
|
|
120
120
|
require('../chunk-VU6WQSMB.cjs');
|
|
121
121
|
require('../chunk-55AKPTLM.cjs');
|
|
122
122
|
|
|
@@ -8926,7 +8926,7 @@ function xyChartSpec(graph, palette) {
|
|
|
8926
8926
|
);
|
|
8927
8927
|
}
|
|
8928
8928
|
const bars = graph.nodes.some((n3) => n3.shape === "bar");
|
|
8929
|
-
return
|
|
8929
|
+
return _chunkBPX4Z3N3cjs.createChartSpec.call(void 0, {
|
|
8930
8930
|
type: bars ? "bar" : "line",
|
|
8931
8931
|
title: _nullishCoalesce(graph.title, () => ( "")),
|
|
8932
8932
|
categories,
|
|
@@ -8940,7 +8940,7 @@ function xyChartSpec(graph, palette) {
|
|
|
8940
8940
|
}
|
|
8941
8941
|
function radarChartSpec(graph, palette) {
|
|
8942
8942
|
const data = _nullishCoalesce(graph.data, () => ( {}));
|
|
8943
|
-
return
|
|
8943
|
+
return _chunkBPX4Z3N3cjs.createChartSpec.call(void 0, {
|
|
8944
8944
|
type: "radar",
|
|
8945
8945
|
title: _nullishCoalesce(graph.title, () => ( "")),
|
|
8946
8946
|
categories: Array.isArray(data.axes) ? data.axes.map(String) : [],
|
|
@@ -8988,12 +8988,12 @@ function translatePath(d, dx, dy) {
|
|
|
8988
8988
|
}
|
|
8989
8989
|
var xyChartScene = ({ graph, theme }) => {
|
|
8990
8990
|
const box = _chunk3FSUJIXNcjs.XY_CHART_BOX;
|
|
8991
|
-
const scene =
|
|
8991
|
+
const scene = _chunkUUUTEVX6cjs.layoutChart.call(void 0, xyChartSpec(graph, theme.palette), { width: box.width, height: box.height, theme: chartTheme(theme) });
|
|
8992
8992
|
return toDiagramMarks(scene.marks, box.x, box.y);
|
|
8993
8993
|
};
|
|
8994
8994
|
var radarScene = ({ graph, theme }) => {
|
|
8995
8995
|
const box = _chunk3FSUJIXNcjs.RADAR_CHART_BOX;
|
|
8996
|
-
const scene =
|
|
8996
|
+
const scene = _chunkUUUTEVX6cjs.layoutChart.call(void 0, radarChartSpec(graph, theme.palette), { width: box.width, height: box.height, theme: chartTheme(theme) });
|
|
8997
8997
|
return toDiagramMarks(scene.marks, box.x, box.y);
|
|
8998
8998
|
};
|
|
8999
8999
|
|
package/dist/canvas/index.js
CHANGED
|
@@ -113,10 +113,10 @@ import {
|
|
|
113
113
|
} from "../chunk-5ED73EC6.js";
|
|
114
114
|
import {
|
|
115
115
|
layoutChart
|
|
116
|
-
} from "../chunk-
|
|
116
|
+
} from "../chunk-ITANXMZD.js";
|
|
117
117
|
import {
|
|
118
118
|
createChartSpec
|
|
119
|
-
} from "../chunk-
|
|
119
|
+
} from "../chunk-FR432ROA.js";
|
|
120
120
|
import "../chunk-O6OGNDND.js";
|
|
121
121
|
import "../chunk-II2WIF5Z.js";
|
|
122
122
|
import {
|
|
@@ -10,6 +10,13 @@ export interface ChartControllerOptions {
|
|
|
10
10
|
history?: HistoryManager;
|
|
11
11
|
/** Called after the spec changes (edit, undo, redo, load). */
|
|
12
12
|
onChange?: (spec: Readonly<ChartSpec>) => void;
|
|
13
|
+
/** Time and frames for playing a bar race (default: `performance.now` / `requestAnimationFrame`, else timers). */
|
|
14
|
+
raceTicker?: ChartRaceTicker;
|
|
15
|
+
}
|
|
16
|
+
/** Drives bar race playback: the current time in ms, and a way to run `step` on the next frame (returns a cancel). */
|
|
17
|
+
export interface ChartRaceTicker {
|
|
18
|
+
now(): number;
|
|
19
|
+
next(step: () => void): () => void;
|
|
13
20
|
}
|
|
14
21
|
/** A snapshot of the controller. The same object is returned until something changes. */
|
|
15
22
|
export interface ChartState {
|
|
@@ -27,6 +34,10 @@ export interface ChartState {
|
|
|
27
34
|
canRedo: boolean;
|
|
28
35
|
undoLabel: string;
|
|
29
36
|
redoLabel: string;
|
|
37
|
+
/** Bar race: the moment shown, a fractional category index (null: the last time point). View state, not undone. */
|
|
38
|
+
raceFrame: number | null;
|
|
39
|
+
/** Bar race: playback is running. */
|
|
40
|
+
racePlaying: boolean;
|
|
30
41
|
/** Bumped on every change. */
|
|
31
42
|
revision: number;
|
|
32
43
|
}
|
|
@@ -109,6 +120,9 @@ export declare class ChartController {
|
|
|
109
120
|
private revision;
|
|
110
121
|
private applying;
|
|
111
122
|
private readonly onChange?;
|
|
123
|
+
private readonly raceTicker;
|
|
124
|
+
private raceFrame;
|
|
125
|
+
private raceStop;
|
|
112
126
|
private readonly listeners;
|
|
113
127
|
private unsubscribeHistory?;
|
|
114
128
|
private state;
|
|
@@ -374,6 +388,21 @@ export declare class ChartController {
|
|
|
374
388
|
* undo step). Series colours, types and other per-series settings are dropped.
|
|
375
389
|
*/
|
|
376
390
|
transpose(): ChartActionResult;
|
|
391
|
+
/**
|
|
392
|
+
* Shows a bar race at a moment: a category index, fractional between time points (`null`:
|
|
393
|
+
* the last one). View state like the selection, so not an undo step. Stops playback.
|
|
394
|
+
*/
|
|
395
|
+
setRaceFrame(frame: number | null): ChartActionResult;
|
|
396
|
+
/**
|
|
397
|
+
* Plays the bar race from the moment shown (from the start when it is at the end), moving
|
|
398
|
+
* one time point every `msPerStep` (default 1000) until the last. Not an undo step.
|
|
399
|
+
*/
|
|
400
|
+
playRace(options?: {
|
|
401
|
+
msPerStep?: number;
|
|
402
|
+
}): ChartActionResult;
|
|
403
|
+
/** Pauses bar race playback where it is. */
|
|
404
|
+
pauseRace(): void;
|
|
405
|
+
private stopRace;
|
|
377
406
|
/** Selects a chart element (view state; not an undo step). */
|
|
378
407
|
select(selection: ChartSelection | null): void;
|
|
379
408
|
/**
|
|
@@ -10,6 +10,13 @@ export interface ChartControllerOptions {
|
|
|
10
10
|
history?: HistoryManager;
|
|
11
11
|
/** Called after the spec changes (edit, undo, redo, load). */
|
|
12
12
|
onChange?: (spec: Readonly<ChartSpec>) => void;
|
|
13
|
+
/** Time and frames for playing a bar race (default: `performance.now` / `requestAnimationFrame`, else timers). */
|
|
14
|
+
raceTicker?: ChartRaceTicker;
|
|
15
|
+
}
|
|
16
|
+
/** Drives bar race playback: the current time in ms, and a way to run `step` on the next frame (returns a cancel). */
|
|
17
|
+
export interface ChartRaceTicker {
|
|
18
|
+
now(): number;
|
|
19
|
+
next(step: () => void): () => void;
|
|
13
20
|
}
|
|
14
21
|
/** A snapshot of the controller. The same object is returned until something changes. */
|
|
15
22
|
export interface ChartState {
|
|
@@ -27,6 +34,10 @@ export interface ChartState {
|
|
|
27
34
|
canRedo: boolean;
|
|
28
35
|
undoLabel: string;
|
|
29
36
|
redoLabel: string;
|
|
37
|
+
/** Bar race: the moment shown, a fractional category index (null: the last time point). View state, not undone. */
|
|
38
|
+
raceFrame: number | null;
|
|
39
|
+
/** Bar race: playback is running. */
|
|
40
|
+
racePlaying: boolean;
|
|
30
41
|
/** Bumped on every change. */
|
|
31
42
|
revision: number;
|
|
32
43
|
}
|
|
@@ -109,6 +120,9 @@ export declare class ChartController {
|
|
|
109
120
|
private revision;
|
|
110
121
|
private applying;
|
|
111
122
|
private readonly onChange?;
|
|
123
|
+
private readonly raceTicker;
|
|
124
|
+
private raceFrame;
|
|
125
|
+
private raceStop;
|
|
112
126
|
private readonly listeners;
|
|
113
127
|
private unsubscribeHistory?;
|
|
114
128
|
private state;
|
|
@@ -374,6 +388,21 @@ export declare class ChartController {
|
|
|
374
388
|
* undo step). Series colours, types and other per-series settings are dropped.
|
|
375
389
|
*/
|
|
376
390
|
transpose(): ChartActionResult;
|
|
391
|
+
/**
|
|
392
|
+
* Shows a bar race at a moment: a category index, fractional between time points (`null`:
|
|
393
|
+
* the last one). View state like the selection, so not an undo step. Stops playback.
|
|
394
|
+
*/
|
|
395
|
+
setRaceFrame(frame: number | null): ChartActionResult;
|
|
396
|
+
/**
|
|
397
|
+
* Plays the bar race from the moment shown (from the start when it is at the end), moving
|
|
398
|
+
* one time point every `msPerStep` (default 1000) until the last. Not an undo step.
|
|
399
|
+
*/
|
|
400
|
+
playRace(options?: {
|
|
401
|
+
msPerStep?: number;
|
|
402
|
+
}): ChartActionResult;
|
|
403
|
+
/** Pauses bar race playback where it is. */
|
|
404
|
+
pauseRace(): void;
|
|
405
|
+
private stopRace;
|
|
377
406
|
/** Selects a chart element (view state; not an undo step). */
|
|
378
407
|
select(selection: ChartSelection | null): void;
|
|
379
408
|
/**
|