@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
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// ../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) => _optionalChain([cmd, 'access', _ => _.surfaces, 'optionalAccess', _2 => _2.includes, 'call', _3 => _3(surface)]));
|
|
137
|
+
}
|
|
138
|
+
function createFormatCommands(editor, options = {}) {
|
|
139
|
+
const manifest = _nullishCoalesce(options.manifest, () => ( manifest_default));
|
|
140
|
+
const prefix = _nullishCoalesce(options.prefix, () => ( "format."));
|
|
141
|
+
const scope = options.scope ? { scope: options.scope } : {};
|
|
142
|
+
const shouldFocus = _nullishCoalesce(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 (_optionalChain([p, 'optionalAccess', _4 => _4.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 (_optionalChain([p, 'optionalAccess', _5 => _5.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 = _optionalChain([p, 'optionalAccess', _6 => _6.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 = _optionalChain([p, 'optionalAccess', _7 => _7.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 = _optionalChain([p, 'optionalAccess', _8 => _8.language]);
|
|
224
|
+
if (editor.isActive("codeBlock")) {
|
|
225
|
+
if (p !== void 0 && "language" in p) {
|
|
226
|
+
return withFocus().updateAttributes("codeBlock", { language: _nullishCoalesce(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
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
exports.formatCommandsFor = formatCommandsFor; exports.createFormatCommands = createFormatCommands;
|
|
@@ -7,7 +7,7 @@ var _chunkPY4GWSE2cjs = require('./chunk-PY4GWSE2.cjs');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkA3A5TI6Rcjs = require('./chunk-A3A5TI6R.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkWOFXZ3XUcjs = require('./chunk-WOFXZ3XU.cjs');
|
|
@@ -1307,12 +1307,12 @@ function videoEffectLayerKey(layer, width, height) {
|
|
|
1307
1307
|
}
|
|
1308
1308
|
function mixEffectPixels(a, b, k) {
|
|
1309
1309
|
if (k >= 1) return b;
|
|
1310
|
-
const out =
|
|
1310
|
+
const out = _chunkA3A5TI6Rcjs.createEffectPixels.call(void 0, a.width, a.height);
|
|
1311
1311
|
for (let i = 0; i < out.data.length; i++) out.data[i] = a.data[i] + (b.data[i] - a.data[i]) * k;
|
|
1312
1312
|
return out;
|
|
1313
1313
|
}
|
|
1314
1314
|
function overEffectPixels(base, top, opacity = 1) {
|
|
1315
|
-
const out =
|
|
1315
|
+
const out = _chunkA3A5TI6Rcjs.createEffectPixels.call(void 0, base.width, base.height);
|
|
1316
1316
|
const o = out.data;
|
|
1317
1317
|
const b = base.data;
|
|
1318
1318
|
const t = top.data;
|
|
@@ -1357,7 +1357,7 @@ var VideoEffectsEngine = (_class2 = class {
|
|
|
1357
1357
|
__init10() {this.generation = 0}
|
|
1358
1358
|
|
|
1359
1359
|
constructor(options = {}) {;_class2.prototype.__init5.call(this);_class2.prototype.__init6.call(this);_class2.prototype.__init7.call(this);_class2.prototype.__init8.call(this);_class2.prototype.__init9.call(this);_class2.prototype.__init10.call(this);
|
|
1360
|
-
this.slot = _nullishCoalesce(options.slot, () => ( new (0,
|
|
1360
|
+
this.slot = _nullishCoalesce(options.slot, () => ( new (0, _chunkA3A5TI6Rcjs.EffectsSlot)()));
|
|
1361
1361
|
this.maxEntries = _nullishCoalesce(options.maxEntries, () => ( 120));
|
|
1362
1362
|
this.toImage = _nullishCoalesce(options.toImage, () => ( defaultToImage));
|
|
1363
1363
|
this.pool = new (0, _chunkPY4GWSE2cjs.EffectRendererPool)({ maxRenderers: options.maxRenderers });
|
|
@@ -1499,7 +1499,7 @@ function checkVideoEffectPlace(d, place) {
|
|
|
1499
1499
|
if (d.kind === "motion" || !d.uses.some((u) => allowed.includes(u))) {
|
|
1500
1500
|
const where = place === "clip" ? "on a clip" : place === "transition" ? "as a transition" : "as an effect clip";
|
|
1501
1501
|
const instead = d.uses.includes("transition") ? "set_video_effect_transition" : d.uses.some((u) => VIDEO_EFFECT_PLACES.generator.includes(u)) ? "add_video_effect_clip" : d.uses.some((u) => u === "filter") ? "apply_effect" : null;
|
|
1502
|
-
throw new (0,
|
|
1502
|
+
throw new (0, _chunkA3A5TI6Rcjs.EffectUnsupportedError)(
|
|
1503
1503
|
`"${d.id}" (${d.name}) is a ${d.uses.join(" / ")} effect and cannot be used ${where}, which takes ${allowed.join(" or ")} effects${instead ? `; use ${instead} instead` : ""}. search_effects with use "${allowed[0]}" lists ones that fit.`,
|
|
1504
1504
|
d.id
|
|
1505
1505
|
);
|
|
@@ -1520,12 +1520,12 @@ function checkVideoEffectValues(d, values, options = {}) {
|
|
|
1520
1520
|
else if (type !== "number" && type !== "integer") errors.push({ path: `/${k}`, message: "only number controls can be keyframed." });
|
|
1521
1521
|
else for (const [i, key] of v.keys.entries()) for (const e of _chunkWOFXZ3XUcjs.validateJsonSchema.call(void 0, key.v, schema)) errors.push({ path: `/${k}/keys/${i}/v`, message: e.message });
|
|
1522
1522
|
}
|
|
1523
|
-
for (const e of
|
|
1523
|
+
for (const e of _chunkA3A5TI6Rcjs.effectValueErrors.call(void 0, d, plain)) {
|
|
1524
1524
|
const name = e.path.split("/")[1];
|
|
1525
1525
|
const about = name && _optionalChain([d, 'access', _46 => _46.controls, 'access', _47 => _47.properties, 'access', _48 => _48[name], 'optionalAccess', _49 => _49.description]);
|
|
1526
1526
|
errors.push(about ? { path: e.path, message: `${e.message} (${about})` } : e);
|
|
1527
1527
|
}
|
|
1528
|
-
if (errors.length) throw new (0,
|
|
1528
|
+
if (errors.length) throw new (0, _chunkA3A5TI6Rcjs.EffectControlError)(d.id, errors);
|
|
1529
1529
|
return { ..._nullishCoalesce(options.base, () => ( d.defaults)), ..._nullishCoalesce(values, () => ( {})) };
|
|
1530
1530
|
}
|
|
1531
1531
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/core';
|
|
2
|
+
import type { CommandParamsSchema, CommandSpec } from './registry.cjs';
|
|
3
|
+
import type { ShortcutInput } from './shortcuts.cjs';
|
|
4
|
+
export interface FormatManifestCommand {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
group?: string;
|
|
8
|
+
shortcut?: ShortcutInput;
|
|
9
|
+
shortcuts?: Record<string, string>;
|
|
10
|
+
surfaces?: readonly string[];
|
|
11
|
+
params?: CommandParamsSchema;
|
|
12
|
+
enabledWhen?: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
export interface CodeLanguageOption {
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
shortLabel?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface FormatManifest {
|
|
20
|
+
$schema?: string;
|
|
21
|
+
commands: readonly FormatManifestCommand[];
|
|
22
|
+
codeLanguages?: readonly CodeLanguageOption[];
|
|
23
|
+
}
|
|
24
|
+
export interface FormatCommandOptions {
|
|
25
|
+
/** Custom manifest or subset; defaults to the full manifest from `@pixerate/markdown-conformance`. */
|
|
26
|
+
manifest?: FormatManifest;
|
|
27
|
+
/** Id prefix (default `format.`). Commands in manifest matching this prefix will be stripped/remapped appropriately. */
|
|
28
|
+
prefix?: string;
|
|
29
|
+
/** Scope the commands belong to, e.g. `editor`. */
|
|
30
|
+
scope?: string;
|
|
31
|
+
/** Focus the editor when a command runs (default `true`). */
|
|
32
|
+
focus?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns commands from a format manifest filtered for a specific UI surface
|
|
36
|
+
* (e.g. `'bubble'`, `'menu'`, `'palette'`, or `'keyboardBar'`).
|
|
37
|
+
*/
|
|
38
|
+
export declare function formatCommandsFor(surface: 'bubble' | 'menu' | 'palette' | 'keyboardBar' | string, manifest?: FormatManifest): FormatManifestCommand[];
|
|
39
|
+
/**
|
|
40
|
+
* Creates format commands (`format.*`) registered from the format manifest in `@pixerate/markdown-conformance`.
|
|
41
|
+
* Commands can be placed in bubble menus, menus, keyboard bars, or palettes, or called programmatically by agent tools.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createFormatCommands(editor: Editor, options?: FormatCommandOptions): CommandSpec[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/core';
|
|
2
|
+
import type { CommandParamsSchema, CommandSpec } from './registry.js';
|
|
3
|
+
import type { ShortcutInput } from './shortcuts.js';
|
|
4
|
+
export interface FormatManifestCommand {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
group?: string;
|
|
8
|
+
shortcut?: ShortcutInput;
|
|
9
|
+
shortcuts?: Record<string, string>;
|
|
10
|
+
surfaces?: readonly string[];
|
|
11
|
+
params?: CommandParamsSchema;
|
|
12
|
+
enabledWhen?: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
export interface CodeLanguageOption {
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
shortLabel?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface FormatManifest {
|
|
20
|
+
$schema?: string;
|
|
21
|
+
commands: readonly FormatManifestCommand[];
|
|
22
|
+
codeLanguages?: readonly CodeLanguageOption[];
|
|
23
|
+
}
|
|
24
|
+
export interface FormatCommandOptions {
|
|
25
|
+
/** Custom manifest or subset; defaults to the full manifest from `@pixerate/markdown-conformance`. */
|
|
26
|
+
manifest?: FormatManifest;
|
|
27
|
+
/** Id prefix (default `format.`). Commands in manifest matching this prefix will be stripped/remapped appropriately. */
|
|
28
|
+
prefix?: string;
|
|
29
|
+
/** Scope the commands belong to, e.g. `editor`. */
|
|
30
|
+
scope?: string;
|
|
31
|
+
/** Focus the editor when a command runs (default `true`). */
|
|
32
|
+
focus?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns commands from a format manifest filtered for a specific UI surface
|
|
36
|
+
* (e.g. `'bubble'`, `'menu'`, `'palette'`, or `'keyboardBar'`).
|
|
37
|
+
*/
|
|
38
|
+
export declare function formatCommandsFor(surface: 'bubble' | 'menu' | 'palette' | 'keyboardBar' | string, manifest?: FormatManifest): FormatManifestCommand[];
|
|
39
|
+
/**
|
|
40
|
+
* Creates format commands (`format.*`) registered from the format manifest in `@pixerate/markdown-conformance`.
|
|
41
|
+
* Commands can be placed in bubble menus, menus, keyboard bars, or palettes, or called programmatically by agent tools.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createFormatCommands(editor: Editor, options?: FormatCommandOptions): CommandSpec[];
|
package/dist/commands/index.cjs
CHANGED
|
@@ -30,6 +30,10 @@ var _chunk4EFNS2HVcjs = require('../chunk-4EFNS2HV.cjs');
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
var _chunk5EMS4BZGcjs = require('../chunk-5EMS4BZG.cjs');
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
var _chunkVCL7CB56cjs = require('../chunk-VCL7CB56.cjs');
|
|
33
37
|
require('../chunk-SWTUM32H.cjs');
|
|
34
38
|
|
|
35
39
|
|
|
@@ -1021,4 +1025,6 @@ function createCanvasAnimationCommands(controller, options = {}) {
|
|
|
1021
1025
|
|
|
1022
1026
|
|
|
1023
1027
|
|
|
1024
|
-
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
exports.CommandRegistry = CommandRegistry; exports.CommandRegistryError = CommandRegistryError; exports.DEFAULT_HISTORY_SHORTCUTS = _chunkGLQQ2VILcjs.DEFAULT_HISTORY_SHORTCUTS; exports.DEFAULT_RECENT_LIMIT = DEFAULT_RECENT_LIMIT; exports.PLATFORMS = _chunk4EFNS2HVcjs.PLATFORMS; exports.ShortcutMap = _chunk4EFNS2HVcjs.ShortcutMap; exports.chordToString = _chunk4EFNS2HVcjs.chordToString; exports.codeFromKey = _chunk4EFNS2HVcjs.codeFromKey; exports.codeToKeyText = _chunk4EFNS2HVcjs.codeToKeyText; exports.createArrangeCommands = _chunkGLQQ2VILcjs.createArrangeCommands; exports.createCanvasAnimationCommands = createCanvasAnimationCommands; exports.createCommandPaletteController = createCommandPaletteController; exports.createCommandRegistry = createCommandRegistry; exports.createCommandToolProvider = createCommandToolProvider; exports.createComponentCommands = _chunkGLQQ2VILcjs.createComponentCommands; exports.createDrawCommands = _chunkGLQQ2VILcjs.createDrawCommands; exports.createFormatCommands = _chunkVCL7CB56cjs.createFormatCommands; exports.createHistoryCommands = _chunkGLQQ2VILcjs.createHistoryCommands; exports.createShapeCommands = _chunkGLQQ2VILcjs.createShapeCommands; exports.createSpreadsheetCommands = _chunkGLQQ2VILcjs.createSpreadsheetCommands; exports.defineCommand = defineCommand; exports.detectPlatform = _chunk4EFNS2HVcjs.detectPlatform; exports.effectiveChord = _chunk4EFNS2HVcjs.effectiveChord; exports.effectiveChordKey = _chunk4EFNS2HVcjs.effectiveChordKey; exports.eventCode = _chunk4EFNS2HVcjs.eventCode; exports.exactBonus = exactBonus; exports.formatCommandsFor = _chunkVCL7CB56cjs.formatCommandsFor; exports.formatShortcut = _chunk4EFNS2HVcjs.formatShortcut; exports.fuzzyMatch = fuzzyMatch; exports.fuzzyScore = fuzzyScore; exports.hasVariantCommands = _chunkGLQQ2VILcjs.hasVariantCommands; exports.isEditableEventTarget = _chunk4EFNS2HVcjs.isEditableEventTarget; exports.keyToCode = _chunk4EFNS2HVcjs.keyToCode; exports.matchHistoryShortcut = _chunkGLQQ2VILcjs.matchHistoryShortcut; exports.matchPaletteHotkey = matchPaletteHotkey; exports.normalizeChord = _chunk4EFNS2HVcjs.normalizeChord; exports.parseChord = _chunk4EFNS2HVcjs.parseChord; exports.pushRecent = pushRecent; exports.rankCommands = rankCommands; exports.shortcutCode = _chunk4EFNS2HVcjs.shortcutCode; exports.toShortcutBindings = _chunk4EFNS2HVcjs.toShortcutBindings;
|
package/dist/commands/index.d.ts
CHANGED
package/dist/commands/index.js
CHANGED
|
@@ -30,6 +30,10 @@ import {
|
|
|
30
30
|
import {
|
|
31
31
|
derivePlaybackSteps
|
|
32
32
|
} from "../chunk-WL4IN36A.js";
|
|
33
|
+
import {
|
|
34
|
+
createFormatCommands,
|
|
35
|
+
formatCommandsFor
|
|
36
|
+
} from "../chunk-NZ3CTY7K.js";
|
|
33
37
|
import "../chunk-O2ANJFUF.js";
|
|
34
38
|
import {
|
|
35
39
|
validateJsonSchema
|
|
@@ -998,6 +1002,7 @@ export {
|
|
|
998
1002
|
createCommandToolProvider,
|
|
999
1003
|
createComponentCommands,
|
|
1000
1004
|
createDrawCommands,
|
|
1005
|
+
createFormatCommands,
|
|
1001
1006
|
createHistoryCommands,
|
|
1002
1007
|
createShapeCommands,
|
|
1003
1008
|
createSpreadsheetCommands,
|
|
@@ -1007,6 +1012,7 @@ export {
|
|
|
1007
1012
|
effectiveChordKey,
|
|
1008
1013
|
eventCode,
|
|
1009
1014
|
exactBonus,
|
|
1015
|
+
formatCommandsFor,
|
|
1010
1016
|
formatShortcut,
|
|
1011
1017
|
fuzzyMatch,
|
|
1012
1018
|
fuzzyScore,
|
|
@@ -12,9 +12,18 @@ export declare function effectValueErrors(description: Pick<EffectDescription, '
|
|
|
12
12
|
* it before saving values.
|
|
13
13
|
*/
|
|
14
14
|
export declare function resolveEffectValues(description: Pick<EffectDescription, 'id' | 'controls' | 'defaults'>, values?: EffectValues): Record<string, EffectValues[string]>;
|
|
15
|
+
/** A tag as tags are compared: trimmed, lower case, spaces and underscores as single hyphens (`"Game Boy"` → `game-boy`). */
|
|
16
|
+
export declare function normaliseEffectTag(tag: string): string;
|
|
17
|
+
/** True when the effect carries every one of `tags` (compared with `normaliseEffectTag`). */
|
|
18
|
+
export declare function hasEffectTags(e: Pick<EffectSummary, 'tags'>, tags: readonly string[] | undefined): boolean;
|
|
19
|
+
/** The tags of `effects` with how many carry each, the most used first (ties alphabetical). */
|
|
20
|
+
export declare function countEffectTags(effects: readonly Pick<EffectSummary, 'tags'>[]): {
|
|
21
|
+
tag: string;
|
|
22
|
+
count: number;
|
|
23
|
+
}[];
|
|
15
24
|
/**
|
|
16
|
-
* Filters a catalog and ranks it against `query` (every word
|
|
17
|
-
* category, tags or description; name matches rank first). An empty query keeps catalog order.
|
|
25
|
+
* Filters a catalog (kind, category, use and every tag) and ranks it against `query` (every word
|
|
26
|
+
* must appear in the id, name, category, tags or description; name matches rank first). An empty query keeps catalog order.
|
|
18
27
|
* Providers can implement `list` and `search` with it.
|
|
19
28
|
*/
|
|
20
29
|
export declare function searchEffectSummaries<T extends EffectSummary>(catalog: readonly T[], query?: string, options?: EffectSearchOptions): T[];
|
|
@@ -12,9 +12,18 @@ export declare function effectValueErrors(description: Pick<EffectDescription, '
|
|
|
12
12
|
* it before saving values.
|
|
13
13
|
*/
|
|
14
14
|
export declare function resolveEffectValues(description: Pick<EffectDescription, 'id' | 'controls' | 'defaults'>, values?: EffectValues): Record<string, EffectValues[string]>;
|
|
15
|
+
/** A tag as tags are compared: trimmed, lower case, spaces and underscores as single hyphens (`"Game Boy"` → `game-boy`). */
|
|
16
|
+
export declare function normaliseEffectTag(tag: string): string;
|
|
17
|
+
/** True when the effect carries every one of `tags` (compared with `normaliseEffectTag`). */
|
|
18
|
+
export declare function hasEffectTags(e: Pick<EffectSummary, 'tags'>, tags: readonly string[] | undefined): boolean;
|
|
19
|
+
/** The tags of `effects` with how many carry each, the most used first (ties alphabetical). */
|
|
20
|
+
export declare function countEffectTags(effects: readonly Pick<EffectSummary, 'tags'>[]): {
|
|
21
|
+
tag: string;
|
|
22
|
+
count: number;
|
|
23
|
+
}[];
|
|
15
24
|
/**
|
|
16
|
-
* Filters a catalog and ranks it against `query` (every word
|
|
17
|
-
* category, tags or description; name matches rank first). An empty query keeps catalog order.
|
|
25
|
+
* Filters a catalog (kind, category, use and every tag) and ranks it against `query` (every word
|
|
26
|
+
* must appear in the id, name, category, tags or description; name matches rank first). An empty query keeps catalog order.
|
|
18
27
|
* Providers can implement `list` and `search` with it.
|
|
19
28
|
*/
|
|
20
29
|
export declare function searchEffectSummaries<T extends EffectSummary>(catalog: readonly T[], query?: string, options?: EffectSearchOptions): T[];
|