@pixerate/editor 0.171.0 → 0.174.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/README.md +4 -0
- package/dist/agent/index.cjs +28 -28
- package/dist/agent/index.js +3 -3
- package/dist/animation-editor/index.cjs +9 -9
- package/dist/animation-editor/index.js +1 -1
- package/dist/canvas/index.cjs +10 -10
- package/dist/canvas/index.js +2 -2
- package/dist/chart/index.cjs +156 -68
- package/dist/chart/index.d.cts +1 -0
- package/dist/chart/index.d.ts +1 -0
- package/dist/chart/index.js +91 -3
- package/dist/chart/layout-shared.d.cts +2 -1
- package/dist/chart/layout-shared.d.ts +2 -1
- package/dist/chart/layout.d.cts +5 -0
- package/dist/chart/layout.d.ts +5 -0
- package/dist/chart/tooltip.d.cts +53 -0
- package/dist/chart/tooltip.d.ts +53 -0
- package/dist/chart/types.d.cts +14 -0
- package/dist/chart/types.d.ts +14 -0
- package/dist/{chunk-CYKWYP6D.cjs → chunk-6DUEV36F.cjs} +14 -14
- package/dist/{chunk-7KWJEYIK.js → chunk-6G2NLMVK.js} +36 -4
- package/dist/{chunk-RUZQMYXH.cjs → chunk-A3A5TI6R.cjs} +43 -11
- package/dist/{chunk-SBAPXFPB.cjs → chunk-FHNGNL3V.cjs} +44 -44
- package/dist/{chunk-2F4GAZL5.cjs → chunk-GXEC4FS6.cjs} +16 -16
- package/dist/{chunk-T62BRXMS.js → chunk-IMHRN4ZZ.js} +1 -1
- package/dist/{chunk-N3ACT6VJ.js → chunk-KPWG3PSW.js} +1 -1
- package/dist/chunk-NZ3CTY7K.js +260 -0
- package/dist/{chunk-M52UCHVZ.js → chunk-OJQVKJYD.js} +12 -1
- package/dist/{chunk-YN4AYYBJ.js → chunk-OZSA5YEJ.js} +1 -1
- package/dist/{chunk-ZUPP4NKM.js → chunk-R2VHVQVY.js} +2 -2
- package/dist/{chunk-GD34ICEX.cjs → chunk-RLOIEDA3.cjs} +10 -10
- package/dist/{chunk-WOIXNDHV.cjs → chunk-TUXKLM5W.cjs} +13 -2
- package/dist/chunk-VCL7CB56.cjs +260 -0
- package/dist/{chunk-HCC2LBCW.js → chunk-WMVEYSOA.js} +1 -1
- package/dist/{chunk-3OSXHLIT.cjs → chunk-Z64NRDEH.cjs} +7 -7
- package/dist/commands/format.d.cts +43 -0
- package/dist/commands/format.d.ts +43 -0
- package/dist/commands/index.cjs +7 -1
- package/dist/commands/index.d.cts +1 -0
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.js +6 -0
- package/dist/effects/helpers.d.cts +11 -2
- package/dist/effects/helpers.d.ts +11 -2
- package/dist/effects/index.cjs +40 -34
- package/dist/effects/index.js +8 -2
- package/dist/effects/types.d.cts +2 -0
- package/dist/effects/types.d.ts +2 -0
- package/dist/extensions/index.cjs +5 -5
- package/dist/extensions/index.js +4 -4
- package/dist/image-editor/index.cjs +13 -13
- package/dist/image-editor/index.js +1 -1
- package/dist/index.cjs +16 -10
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +10 -4
- package/dist/paint-editor/index.cjs +7 -7
- package/dist/paint-editor/index.js +2 -2
- package/dist/vector/index.cjs +6 -6
- package/dist/vector/index.js +1 -1
- package/dist/video-editor/index.cjs +309 -309
- package/dist/video-editor/index.js +3 -3
- package/package.json +114 -11
- package/skills/pixerate-chart/SKILL.md +1 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
// ../markdown-conformance/manifest.json
|
|
2
|
+
var manifest_default = {
|
|
3
|
+
$schema: "./schema/manifest.schema.json",
|
|
4
|
+
commands: [
|
|
5
|
+
{
|
|
6
|
+
id: "format.bold",
|
|
7
|
+
label: "Bold",
|
|
8
|
+
group: "Format",
|
|
9
|
+
shortcut: "Mod+B",
|
|
10
|
+
surfaces: ["bubble", "menu"],
|
|
11
|
+
enabledWhen: ["notInCode"]
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: "format.italic",
|
|
15
|
+
label: "Italic",
|
|
16
|
+
group: "Format",
|
|
17
|
+
shortcut: "Mod+I",
|
|
18
|
+
surfaces: ["bubble", "menu"],
|
|
19
|
+
enabledWhen: ["notInCode"]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: "format.strikethrough",
|
|
23
|
+
label: "Strikethrough",
|
|
24
|
+
group: "Format",
|
|
25
|
+
shortcut: "Mod+Shift+X",
|
|
26
|
+
surfaces: ["bubble", "menu"],
|
|
27
|
+
enabledWhen: ["notInCode"]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: "format.code",
|
|
31
|
+
label: "Inline Code",
|
|
32
|
+
group: "Format",
|
|
33
|
+
shortcut: "Mod+E",
|
|
34
|
+
surfaces: ["bubble", "menu"]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "format.link",
|
|
38
|
+
label: "Link\u2026",
|
|
39
|
+
group: "Format",
|
|
40
|
+
shortcut: "Mod+K",
|
|
41
|
+
surfaces: ["bubble", "menu"],
|
|
42
|
+
params: {
|
|
43
|
+
type: "object",
|
|
44
|
+
properties: {
|
|
45
|
+
url: { type: ["string", "null"] }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: "format.heading",
|
|
51
|
+
label: "Heading",
|
|
52
|
+
group: "Block",
|
|
53
|
+
surfaces: ["bubble", "menu"],
|
|
54
|
+
params: {
|
|
55
|
+
type: "object",
|
|
56
|
+
properties: {
|
|
57
|
+
level: { type: "integer", minimum: 1, maximum: 6 }
|
|
58
|
+
},
|
|
59
|
+
required: ["level"]
|
|
60
|
+
},
|
|
61
|
+
shortcuts: {
|
|
62
|
+
"level=1": "Mod+Alt+1",
|
|
63
|
+
"level=2": "Mod+Alt+2",
|
|
64
|
+
"level=3": "Mod+Alt+3"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "format.paragraph",
|
|
69
|
+
label: "Paragraph",
|
|
70
|
+
group: "Block",
|
|
71
|
+
shortcut: "Mod+Alt+0",
|
|
72
|
+
surfaces: ["menu"]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "format.bulletList",
|
|
76
|
+
label: "Bullet List",
|
|
77
|
+
group: "Block",
|
|
78
|
+
shortcut: "Mod+Shift+8",
|
|
79
|
+
surfaces: ["bubble", "menu"]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: "format.numberedList",
|
|
83
|
+
label: "Numbered List",
|
|
84
|
+
group: "Block",
|
|
85
|
+
shortcut: "Mod+Shift+7",
|
|
86
|
+
surfaces: ["bubble", "menu"]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: "format.taskList",
|
|
90
|
+
label: "To-do List",
|
|
91
|
+
group: "Block",
|
|
92
|
+
shortcut: "Mod+Shift+9",
|
|
93
|
+
surfaces: ["menu"]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: "format.quote",
|
|
97
|
+
label: "Quote",
|
|
98
|
+
group: "Block",
|
|
99
|
+
shortcut: "Mod+Shift+.",
|
|
100
|
+
surfaces: ["bubble", "menu"]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: "format.codeBlock",
|
|
104
|
+
label: "Code Block",
|
|
105
|
+
group: "Block",
|
|
106
|
+
shortcut: "Mod+Alt+C",
|
|
107
|
+
surfaces: ["bubble", "menu"],
|
|
108
|
+
params: {
|
|
109
|
+
type: "object",
|
|
110
|
+
properties: {
|
|
111
|
+
language: { type: ["string", "null"] }
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: "format.table",
|
|
117
|
+
label: "Table",
|
|
118
|
+
group: "Insert",
|
|
119
|
+
surfaces: ["bubble"],
|
|
120
|
+
enabledWhen: ["inTable"]
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
codeLanguages: [
|
|
124
|
+
{ id: "javascript", label: "JavaScript", shortLabel: "JS" },
|
|
125
|
+
{ id: "swift", label: "Swift" },
|
|
126
|
+
{ id: "python", label: "Python" },
|
|
127
|
+
{ id: "html", label: "HTML" },
|
|
128
|
+
{ id: "css", label: "CSS" },
|
|
129
|
+
{ id: "json", label: "JSON" },
|
|
130
|
+
{ id: "bash", label: "Bash" }
|
|
131
|
+
]
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// src/commands/format.ts
|
|
135
|
+
function formatCommandsFor(surface, manifest = manifest_default) {
|
|
136
|
+
return manifest.commands.filter((cmd) => cmd.surfaces?.includes(surface));
|
|
137
|
+
}
|
|
138
|
+
function createFormatCommands(editor, options = {}) {
|
|
139
|
+
const manifest = options.manifest ?? manifest_default;
|
|
140
|
+
const prefix = options.prefix ?? "format.";
|
|
141
|
+
const scope = options.scope ? { scope: options.scope } : {};
|
|
142
|
+
const shouldFocus = options.focus ?? true;
|
|
143
|
+
const withFocus = () => {
|
|
144
|
+
return shouldFocus ? editor.chain().focus() : editor.chain();
|
|
145
|
+
};
|
|
146
|
+
return manifest.commands.map((cmdDef) => {
|
|
147
|
+
const canonicalId = cmdDef.id.startsWith("format.") ? cmdDef.id.slice("format.".length) : cmdDef.id;
|
|
148
|
+
const id = `${prefix}${canonicalId}`;
|
|
149
|
+
let run;
|
|
150
|
+
let enabled;
|
|
151
|
+
switch (canonicalId) {
|
|
152
|
+
case "bold":
|
|
153
|
+
enabled = () => editor.can().toggleBold() ? true : "Cannot toggle bold at current selection.";
|
|
154
|
+
run = () => withFocus().toggleBold().run();
|
|
155
|
+
break;
|
|
156
|
+
case "italic":
|
|
157
|
+
enabled = () => editor.can().toggleItalic() ? true : "Cannot toggle italic at current selection.";
|
|
158
|
+
run = () => withFocus().toggleItalic().run();
|
|
159
|
+
break;
|
|
160
|
+
case "strikethrough":
|
|
161
|
+
enabled = () => editor.can().toggleStrike() ? true : "Cannot toggle strikethrough at current selection.";
|
|
162
|
+
run = () => withFocus().toggleStrike().run();
|
|
163
|
+
break;
|
|
164
|
+
case "code":
|
|
165
|
+
enabled = () => editor.can().toggleCode() ? true : "Cannot toggle inline code at current selection.";
|
|
166
|
+
run = () => withFocus().toggleCode().run();
|
|
167
|
+
break;
|
|
168
|
+
case "link":
|
|
169
|
+
enabled = (_ctx, p) => {
|
|
170
|
+
if (p?.url) {
|
|
171
|
+
return editor.can().setLink({ href: p.url }) ? true : "Cannot set link at current selection.";
|
|
172
|
+
}
|
|
173
|
+
return editor.can().unsetLink() || editor.can().setLink({ href: "https://example.com" }) ? true : "Cannot modify link at current selection.";
|
|
174
|
+
};
|
|
175
|
+
run = (_ctx, p) => {
|
|
176
|
+
if (p?.url) {
|
|
177
|
+
return withFocus().setLink({ href: p.url }).run();
|
|
178
|
+
}
|
|
179
|
+
return withFocus().unsetLink().run();
|
|
180
|
+
};
|
|
181
|
+
break;
|
|
182
|
+
case "heading":
|
|
183
|
+
enabled = (_ctx, p) => {
|
|
184
|
+
const level = p?.level;
|
|
185
|
+
if (level) {
|
|
186
|
+
return editor.can().toggleHeading({ level }) ? true : `Cannot toggle heading level ${level}.`;
|
|
187
|
+
}
|
|
188
|
+
return true;
|
|
189
|
+
};
|
|
190
|
+
run = (_ctx, p) => {
|
|
191
|
+
return withFocus().toggleHeading({ level: p.level }).run();
|
|
192
|
+
};
|
|
193
|
+
break;
|
|
194
|
+
case "paragraph":
|
|
195
|
+
enabled = () => editor.can().setParagraph() ? true : "Cannot set paragraph at current selection.";
|
|
196
|
+
run = () => withFocus().setParagraph().run();
|
|
197
|
+
break;
|
|
198
|
+
case "bulletList":
|
|
199
|
+
enabled = () => editor.can().toggleBulletList() ? true : "Cannot toggle bullet list at current selection.";
|
|
200
|
+
run = () => withFocus().toggleBulletList().run();
|
|
201
|
+
break;
|
|
202
|
+
case "numberedList":
|
|
203
|
+
enabled = () => editor.can().toggleOrderedList() ? true : "Cannot toggle numbered list at current selection.";
|
|
204
|
+
run = () => withFocus().toggleOrderedList().run();
|
|
205
|
+
break;
|
|
206
|
+
case "taskList":
|
|
207
|
+
enabled = () => editor.can().toggleTaskList() ? true : "Cannot toggle task list at current selection.";
|
|
208
|
+
run = () => withFocus().toggleTaskList().run();
|
|
209
|
+
break;
|
|
210
|
+
case "quote":
|
|
211
|
+
enabled = () => editor.can().toggleBlockquote() ? true : "Cannot toggle blockquote at current selection.";
|
|
212
|
+
run = () => withFocus().toggleBlockquote().run();
|
|
213
|
+
break;
|
|
214
|
+
case "codeBlock":
|
|
215
|
+
enabled = (_ctx, p) => {
|
|
216
|
+
const lang = p?.language;
|
|
217
|
+
if (editor.isActive("codeBlock")) {
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
return editor.can().toggleCodeBlock(lang ? { language: lang } : void 0) ? true : "Cannot toggle code block at current selection.";
|
|
221
|
+
};
|
|
222
|
+
run = (_ctx, p) => {
|
|
223
|
+
const lang = p?.language;
|
|
224
|
+
if (editor.isActive("codeBlock")) {
|
|
225
|
+
if (p !== void 0 && "language" in p) {
|
|
226
|
+
return withFocus().updateAttributes("codeBlock", { language: lang ?? null }).run();
|
|
227
|
+
}
|
|
228
|
+
return withFocus().toggleCodeBlock().run();
|
|
229
|
+
}
|
|
230
|
+
return withFocus().toggleCodeBlock(lang ? { language: lang } : void 0).run();
|
|
231
|
+
};
|
|
232
|
+
break;
|
|
233
|
+
case "table":
|
|
234
|
+
enabled = () => editor.isActive("table") ? true : "Not inside a table.";
|
|
235
|
+
run = () => {
|
|
236
|
+
return true;
|
|
237
|
+
};
|
|
238
|
+
break;
|
|
239
|
+
default:
|
|
240
|
+
enabled = () => true;
|
|
241
|
+
run = () => true;
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
return {
|
|
245
|
+
id,
|
|
246
|
+
label: cmdDef.label,
|
|
247
|
+
group: cmdDef.group,
|
|
248
|
+
shortcut: cmdDef.shortcut,
|
|
249
|
+
...cmdDef.params ? { params: cmdDef.params } : {},
|
|
250
|
+
...scope,
|
|
251
|
+
enabled,
|
|
252
|
+
run
|
|
253
|
+
};
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export {
|
|
258
|
+
formatCommandsFor,
|
|
259
|
+
createFormatCommands
|
|
260
|
+
};
|
|
@@ -1503,6 +1503,7 @@ function layoutCartesian(ctx, area, visible) {
|
|
|
1503
1503
|
plot,
|
|
1504
1504
|
valueScale: toValueScale(frame.value, horizontal ? "x" : "y"),
|
|
1505
1505
|
...frame.value2 ? { valueScale2: toValueScale(frame.value2, horizontal ? "x" : "y") } : {},
|
|
1506
|
+
categoryScale: { axis: horizontal ? "y" : "x", start: catStart, length: frame.catLen, count: frame.n, reverse: !!spec.xAxis.reverse },
|
|
1506
1507
|
percent
|
|
1507
1508
|
};
|
|
1508
1509
|
}
|
|
@@ -2732,7 +2733,8 @@ function layoutChart(spec, options) {
|
|
|
2732
2733
|
warnings,
|
|
2733
2734
|
...result.valueScale ? { valueScale: result.valueScale } : {},
|
|
2734
2735
|
...result.valueScale2 ? { valueScale2: result.valueScale2 } : {},
|
|
2735
|
-
...result.xScale ? { xScale: result.xScale } : {}
|
|
2736
|
+
...result.xScale ? { xScale: result.xScale } : {},
|
|
2737
|
+
...result.categoryScale ? { categoryScale: result.categoryScale } : {}
|
|
2736
2738
|
};
|
|
2737
2739
|
};
|
|
2738
2740
|
const empty = (message) => {
|
|
@@ -2935,6 +2937,14 @@ function chartValueAtPoint(scene, point, secondary = false) {
|
|
|
2935
2937
|
const px = scale.axis === "y" ? point.y : point.x;
|
|
2936
2938
|
return chartScaleFromPixel(px, scale);
|
|
2937
2939
|
}
|
|
2940
|
+
function chartCategoryAtPoint(scene, point) {
|
|
2941
|
+
const scale = scene.categoryScale;
|
|
2942
|
+
const { plot } = scene;
|
|
2943
|
+
if (!scale || point.x < plot.x || point.x > plot.x + plot.width || point.y < plot.y || point.y > plot.y + plot.height) return void 0;
|
|
2944
|
+
const offset = (scale.axis === "x" ? point.x : point.y) - scale.start;
|
|
2945
|
+
const k = Math.min(scale.count - 1, Math.max(0, Math.floor(offset / scale.length * scale.count)));
|
|
2946
|
+
return scale.reverse ? scale.count - 1 - k : k;
|
|
2947
|
+
}
|
|
2938
2948
|
function chartXAtPoint(scene, point) {
|
|
2939
2949
|
const scale = scene.xScale;
|
|
2940
2950
|
if (!scale) return void 0;
|
|
@@ -2996,6 +3006,7 @@ export {
|
|
|
2996
3006
|
chartRaceRanking,
|
|
2997
3007
|
layoutChart,
|
|
2998
3008
|
chartValueAtPoint,
|
|
3009
|
+
chartCategoryAtPoint,
|
|
2999
3010
|
chartXAtPoint,
|
|
3000
3011
|
snapChartValue
|
|
3001
3012
|
};
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
chartToMermaid,
|
|
6
6
|
describeChart,
|
|
7
7
|
layoutSparkline
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KPWG3PSW.js";
|
|
9
9
|
import {
|
|
10
10
|
layoutChart
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-OJQVKJYD.js";
|
|
12
12
|
import {
|
|
13
13
|
DEFAULT_CHART_THEME,
|
|
14
14
|
normalizeChartSpec
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkGXEC4FS6cjs = require('./chunk-GXEC4FS6.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkTUXKLM5Wcjs = require('./chunk-TUXKLM5W.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -1211,7 +1211,7 @@ var ChartNodeView = (_class = class {
|
|
|
1211
1211
|
this.dom.contentEditable = "false";
|
|
1212
1212
|
this.syncAttributes();
|
|
1213
1213
|
this.key = specKey(this.node.attrs.spec);
|
|
1214
|
-
this.controller = new (0,
|
|
1214
|
+
this.controller = new (0, _chunkGXEC4FS6cjs.ChartController)({ spec: this.node.attrs.spec });
|
|
1215
1215
|
this.unsubscribe = this.controller.subscribe((state) => {
|
|
1216
1216
|
if (!state.gesture) this.writeBack();
|
|
1217
1217
|
});
|
|
@@ -1470,10 +1470,10 @@ function staticChartSvg(node, options) {
|
|
|
1470
1470
|
const spec = node.attrs.spec;
|
|
1471
1471
|
const width = _nullishCoalesce(node.attrs.width, () => ( options.defaultWidth));
|
|
1472
1472
|
const height = _nullishCoalesce(node.attrs.height, () => ( options.defaultHeight));
|
|
1473
|
-
const scene =
|
|
1474
|
-
return
|
|
1473
|
+
const scene = _chunkTUXKLM5Wcjs.layoutChart.call(void 0, spec, { width, height, theme: options.theme, selection: null });
|
|
1474
|
+
return _chunkGXEC4FS6cjs.chartSceneToDomSpec.call(void 0, scene, {
|
|
1475
1475
|
ariaLabel: spec.title || "Chart",
|
|
1476
|
-
description:
|
|
1476
|
+
description: _chunkGXEC4FS6cjs.describeChart.call(void 0, spec),
|
|
1477
1477
|
attrs: { style: "max-width: 100%; height: auto; display: block" }
|
|
1478
1478
|
});
|
|
1479
1479
|
}
|
|
@@ -1541,7 +1541,7 @@ var Chart = _core.Node.create({
|
|
|
1541
1541
|
const code = element.querySelector("code");
|
|
1542
1542
|
const language = _nullishCoalesce(_nullishCoalesce(_optionalChain([code, 'optionalAccess', _34 => _34.getAttribute, 'call', _35 => _35("class")]), () => ( element.getAttribute("data-language"))), () => ( ""));
|
|
1543
1543
|
if (!/(?:^|\s)language-mermaid(?:\s|$)/.test(language) && language !== "mermaid") return false;
|
|
1544
|
-
const result =
|
|
1544
|
+
const result = _chunkGXEC4FS6cjs.chartFromMermaid.call(void 0, _nullishCoalesce((_nullishCoalesce(code, () => ( element))).textContent, () => ( "")));
|
|
1545
1545
|
return result.family ? { spec: result.spec } : false;
|
|
1546
1546
|
}
|
|
1547
1547
|
}
|
|
@@ -1565,7 +1565,7 @@ var Chart = _core.Node.create({
|
|
|
1565
1565
|
return {
|
|
1566
1566
|
markdown: {
|
|
1567
1567
|
serialize(state, node) {
|
|
1568
|
-
const text =
|
|
1568
|
+
const text = _chunkGXEC4FS6cjs.chartToMermaid.call(void 0, node.attrs.spec);
|
|
1569
1569
|
const fence = "`".repeat(Math.max(3, longestBacktickRun(text) + 1));
|
|
1570
1570
|
state.write(`${fence}mermaid
|
|
1571
1571
|
`);
|
|
@@ -1705,14 +1705,14 @@ var Sparkline = _core.Node.create({
|
|
|
1705
1705
|
return [{ tag: 'span[data-type="sparkline"]', priority: 60 }];
|
|
1706
1706
|
},
|
|
1707
1707
|
renderHTML({ node, HTMLAttributes }) {
|
|
1708
|
-
const scene =
|
|
1708
|
+
const scene = _chunkGXEC4FS6cjs.layoutSparkline.call(void 0, node.attrs.values, {
|
|
1709
1709
|
kind: node.attrs.kind,
|
|
1710
1710
|
width: node.attrs.width,
|
|
1711
1711
|
height: node.attrs.height,
|
|
1712
1712
|
color: _nullishCoalesce(node.attrs.color, () => ( this.options.color)),
|
|
1713
1713
|
negativeColor: this.options.negativeColor
|
|
1714
1714
|
});
|
|
1715
|
-
const svg =
|
|
1715
|
+
const svg = _chunkGXEC4FS6cjs.chartSceneToDomSpec.call(void 0, scene, {
|
|
1716
1716
|
ariaLabel: sparklineLabel(node),
|
|
1717
1717
|
attrs: { style: "display: inline-block; vertical-align: middle" }
|
|
1718
1718
|
});
|
|
@@ -1503,6 +1503,7 @@ function layoutCartesian(ctx, area, visible) {
|
|
|
1503
1503
|
plot,
|
|
1504
1504
|
valueScale: toValueScale(frame.value, horizontal ? "x" : "y"),
|
|
1505
1505
|
...frame.value2 ? { valueScale2: toValueScale(frame.value2, horizontal ? "x" : "y") } : {},
|
|
1506
|
+
categoryScale: { axis: horizontal ? "y" : "x", start: catStart, length: frame.catLen, count: frame.n, reverse: !!spec.xAxis.reverse },
|
|
1506
1507
|
percent
|
|
1507
1508
|
};
|
|
1508
1509
|
}
|
|
@@ -2732,7 +2733,8 @@ function layoutChart(spec, options) {
|
|
|
2732
2733
|
warnings,
|
|
2733
2734
|
...result.valueScale ? { valueScale: result.valueScale } : {},
|
|
2734
2735
|
...result.valueScale2 ? { valueScale2: result.valueScale2 } : {},
|
|
2735
|
-
...result.xScale ? { xScale: result.xScale } : {}
|
|
2736
|
+
...result.xScale ? { xScale: result.xScale } : {},
|
|
2737
|
+
...result.categoryScale ? { categoryScale: result.categoryScale } : {}
|
|
2736
2738
|
};
|
|
2737
2739
|
};
|
|
2738
2740
|
const empty = (message) => {
|
|
@@ -2935,6 +2937,14 @@ function chartValueAtPoint(scene, point, secondary = false) {
|
|
|
2935
2937
|
const px = scale.axis === "y" ? point.y : point.x;
|
|
2936
2938
|
return chartScaleFromPixel(px, scale);
|
|
2937
2939
|
}
|
|
2940
|
+
function chartCategoryAtPoint(scene, point) {
|
|
2941
|
+
const scale = scene.categoryScale;
|
|
2942
|
+
const { plot } = scene;
|
|
2943
|
+
if (!scale || point.x < plot.x || point.x > plot.x + plot.width || point.y < plot.y || point.y > plot.y + plot.height) return void 0;
|
|
2944
|
+
const offset = (scale.axis === "x" ? point.x : point.y) - scale.start;
|
|
2945
|
+
const k = Math.min(scale.count - 1, Math.max(0, Math.floor(offset / scale.length * scale.count)));
|
|
2946
|
+
return scale.reverse ? scale.count - 1 - k : k;
|
|
2947
|
+
}
|
|
2938
2948
|
function chartXAtPoint(scene, point) {
|
|
2939
2949
|
const scale = scene.xScale;
|
|
2940
2950
|
if (!scale) return void 0;
|
|
@@ -2998,4 +3008,5 @@ function snapChartValue(scene, value, step, ticks = _nullishCoalesce(_optionalCh
|
|
|
2998
3008
|
|
|
2999
3009
|
|
|
3000
3010
|
|
|
3001
|
-
|
|
3011
|
+
|
|
3012
|
+
exports.parseChartDate = parseChartDate; exports.CHART_DATE_STEPS = CHART_DATE_STEPS; exports.formatChartDate = formatChartDate; exports.chartDateLabels = chartDateLabels; exports.compileChartFormatCode = compileChartFormatCode; exports.formatChartValueWithCode = formatChartValueWithCode; exports.chartSerialToDate = chartSerialToDate; exports.chartDateToSerial = chartDateToSerial; exports.niceStep = niceStep; exports.niceScale = niceScale; exports.stepDecimals = stepDecimals; exports.formatChartNumber = formatChartNumber; exports.linearMap = linearMap; exports.niceLogScale = niceLogScale; exports.chartScaleToPixel = chartScaleToPixel; exports.chartScaleFromPixel = chartScaleFromPixel; exports.estimateChartTextWidth = estimateChartTextWidth; exports.sameChartSelection = sameChartSelection; exports.contrastingTextColor = contrastingTextColor; exports.r2 = r2; exports.chartHistogram = chartHistogram; exports.chartQuantile = chartQuantile; exports.suggestChartReferences = suggestChartReferences; exports.chartBoxStats = chartBoxStats; exports.chartSquarify = chartSquarify; exports.decimateChartPoints = decimateChartPoints; exports.summarizeChartSeries = summarizeChartSeries; exports.fitChartTrendline = fitChartTrendline; exports.trendNumberText = trendNumberText; exports.chartMovingAverage = chartMovingAverage; exports.chartTrendlineName = chartTrendlineName; exports.chartSupportsTrendlines = chartSupportsTrendlines; exports.MAX_CHART_DATA_LABELS = MAX_CHART_DATA_LABELS; exports.MAX_CHART_LINE_POINTS = MAX_CHART_LINE_POINTS; exports.MAX_CHART_MARKERS = MAX_CHART_MARKERS; exports.registerChartMap = registerChartMap; exports.getChartMap = getChartMap; exports.listChartMaps = listChartMaps; exports.matchChartMapRegions = matchChartMapRegions; exports.chartMapBreaks = chartMapBreaks; exports.chartMapClass = chartMapClass; exports.chartMapRamp = chartMapRamp; exports.chartRaceValueAt = chartRaceValueAt; exports.chartRaceMoment = chartRaceMoment; exports.chartRaceRanking = chartRaceRanking; exports.layoutChart = layoutChart; exports.chartValueAtPoint = chartValueAtPoint; exports.chartCategoryAtPoint = chartCategoryAtPoint; exports.chartXAtPoint = chartXAtPoint; exports.snapChartValue = snapChartValue;
|