@pixerate/editor 0.141.0 → 0.143.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 +107 -48
- package/dist/agent/index.js +76 -17
- package/dist/agent/planner.d.cts +7 -2
- package/dist/agent/planner.d.ts +7 -2
- package/dist/agent/providers.d.cts +4 -1
- package/dist/agent/providers.d.ts +4 -1
- package/dist/animation-editor/index.cjs +69 -19
- package/dist/animation-editor/index.d.cts +1 -0
- package/dist/animation-editor/index.d.ts +1 -0
- package/dist/animation-editor/index.js +54 -4
- package/dist/animation-editor/playback.d.cts +10 -0
- package/dist/animation-editor/playback.d.ts +10 -0
- package/dist/canvas/index.cjs +103 -101
- package/dist/canvas/index.js +3 -1
- package/dist/canvas/layout.d.cts +15 -2
- package/dist/canvas/layout.d.ts +15 -2
- package/dist/chart/index.cjs +254 -170
- package/dist/chart/index.d.cts +1 -0
- package/dist/chart/index.d.ts +1 -0
- package/dist/chart/index.js +243 -159
- package/dist/chart/playback.d.cts +22 -0
- package/dist/chart/playback.d.ts +22 -0
- package/dist/{chunk-MFFE55CS.js → chunk-54GVEVXS.js} +6 -4
- package/dist/{chunk-E747F3D5.js → chunk-CC6WKVIH.js} +86 -5
- package/dist/{chunk-UBRYHNRU.cjs → chunk-EL4PSKFT.cjs} +46 -4
- package/dist/{chunk-VTY64I6H.cjs → chunk-QSM3MDDJ.cjs} +85 -85
- package/dist/{chunk-2RUNJYOX.cjs → chunk-QZFEX2N4.cjs} +86 -5
- package/dist/{chunk-DW4CV5H4.js → chunk-U4VE4UI2.js} +45 -3
- package/dist/{chunk-LMSFXRAJ.js → chunk-VGJTUCWM.js} +1 -1
- package/dist/{chunk-6SFREX6H.cjs → chunk-X2HQP7DF.cjs} +6 -4
- package/dist/chunk-XH32BATE.cjs +68 -0
- package/dist/chunk-Y6SGC6KO.js +68 -0
- package/dist/commands/index.cjs +2 -2
- package/dist/commands/index.js +1 -1
- package/dist/index.cjs +7 -3
- package/dist/index.js +6 -2
- package/dist/paint-editor/index.cjs +67 -19
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +67 -19
- package/dist/paint-editor/playback.d.cts +16 -0
- package/dist/paint-editor/playback.d.ts +16 -0
- package/dist/parameters/index.cjs +32 -8
- package/dist/parameters/index.d.cts +1 -0
- package/dist/parameters/index.d.ts +1 -0
- package/dist/parameters/index.js +28 -4
- package/dist/parameters/playback.d.cts +10 -0
- package/dist/parameters/playback.d.ts +10 -0
- package/dist/spreadsheet/index.cjs +7 -3
- package/dist/spreadsheet/index.d.cts +1 -0
- package/dist/spreadsheet/index.d.ts +1 -0
- package/dist/spreadsheet/index.js +6 -2
- package/dist/spreadsheet/playback.d.cts +15 -0
- package/dist/spreadsheet/playback.d.ts +15 -0
- package/dist/tools/index.cjs +10 -3
- package/dist/tools/index.d.cts +1 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +9 -2
- package/dist/tools/script.d.cts +77 -0
- package/dist/tools/script.d.ts +77 -0
- package/dist/video-editor/index.cjs +81 -28
- package/dist/video-editor/index.d.cts +1 -0
- package/dist/video-editor/index.d.ts +1 -0
- package/dist/video-editor/index.js +58 -5
- package/dist/video-editor/playback.d.cts +20 -0
- package/dist/video-editor/playback.d.ts +20 -0
- package/package.json +1 -1
- package/skills/pixerate-animation-editor/SKILL.md +1 -0
- package/skills/pixerate-chart/SKILL.md +1 -0
- package/skills/pixerate-paint-editor/SKILL.md +1 -0
- package/skills/pixerate-parameters/SKILL.md +1 -0
- package/skills/pixerate-spreadsheet/SKILL.md +1 -0
- package/skills/pixerate-video-editor/SKILL.md +1 -0
- package/dist/chunk-PLKIYNJZ.js +0 -0
- package/dist/chunk-TNCWKC5M.cjs +0 -1
|
@@ -4,8 +4,14 @@ var DEFAULT_NODE_WIDTH = 200;
|
|
|
4
4
|
var DEFAULT_NODE_HEIGHT = 60;
|
|
5
5
|
var DEFAULT_PLACEMENT_GAP = 48;
|
|
6
6
|
function getCenteredNodePosition(width = 0, height = 0, screenToFlowPosition, screenDimensions) {
|
|
7
|
-
const rect = _nullishCoalesce(screenDimensions, () => ( (typeof document !== "undefined" ? {
|
|
8
|
-
|
|
7
|
+
const rect = _nullishCoalesce(screenDimensions, () => ( (typeof document !== "undefined" ? {
|
|
8
|
+
width: document.documentElement.clientWidth,
|
|
9
|
+
height: document.documentElement.clientHeight
|
|
10
|
+
} : { width: 1920, height: 1080 })));
|
|
11
|
+
const flowPos = screenToFlowPosition({
|
|
12
|
+
x: rect.width / 2,
|
|
13
|
+
y: rect.height / 2
|
|
14
|
+
});
|
|
9
15
|
return {
|
|
10
16
|
x: flowPos.x - width / 2,
|
|
11
17
|
y: flowPos.y - height / 2
|
|
@@ -73,7 +79,10 @@ function getLayoutedNodes(nodes, edges, getNodesBounds, options = {}) {
|
|
|
73
79
|
function estimateNodeSize(node, defaultWidth = DEFAULT_NODE_WIDTH, defaultHeight = DEFAULT_NODE_HEIGHT) {
|
|
74
80
|
const label = String(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([node, 'access', _10 => _10.data, 'optionalAccess', _11 => _11.label]), () => ( _optionalChain([node, 'access', _12 => _12.data, 'optionalAccess', _13 => _13.title]))), () => ( node.id)), () => ( "")));
|
|
75
81
|
const lines = label.split(/\n|<br\s*\/?>/);
|
|
76
|
-
const longest = Math.max(
|
|
82
|
+
const longest = Math.max(
|
|
83
|
+
...lines.map((l) => l.replace(/<[^>]+>/g, "").length),
|
|
84
|
+
1
|
|
85
|
+
);
|
|
77
86
|
const width = Math.min(480, Math.max(defaultWidth, longest * 8 + 48));
|
|
78
87
|
const height = Math.max(defaultHeight, lines.length * 20 + 24);
|
|
79
88
|
return { width, height };
|
|
@@ -203,6 +212,38 @@ function placeBeside(rects, size, side, nearNodeId, options = {}) {
|
|
|
203
212
|
y: Math.round(baseY)
|
|
204
213
|
};
|
|
205
214
|
}
|
|
215
|
+
function placeInView(rects, size, view, options = {}) {
|
|
216
|
+
const gap = _nullishCoalesce(options.gap, () => ( DEFAULT_PLACEMENT_GAP));
|
|
217
|
+
const maxRings = _nullishCoalesce(options.maxRings, () => ( 24));
|
|
218
|
+
const obstacles = Object.values(rects);
|
|
219
|
+
const start = {
|
|
220
|
+
x: view.x + view.width / 2 - size.width / 2,
|
|
221
|
+
y: view.y + view.height / 2 - size.height / 2
|
|
222
|
+
};
|
|
223
|
+
const free = (p) => !obstacles.some(
|
|
224
|
+
(o) => overlaps({ ...p, width: size.width, height: size.height }, o, gap / 2)
|
|
225
|
+
);
|
|
226
|
+
if (free(start)) return { x: Math.round(start.x), y: Math.round(start.y) };
|
|
227
|
+
const stepX = size.width + gap;
|
|
228
|
+
const stepY = size.height + gap;
|
|
229
|
+
for (let ring = 1; ring <= maxRings; ring++) {
|
|
230
|
+
const candidates = [];
|
|
231
|
+
for (let i = -ring; i <= ring; i++) {
|
|
232
|
+
candidates.push(
|
|
233
|
+
{ x: start.x + ring * stepX, y: start.y + i * stepY },
|
|
234
|
+
{ x: start.x - ring * stepX, y: start.y + i * stepY },
|
|
235
|
+
{ x: start.x + i * stepX, y: start.y + ring * stepY },
|
|
236
|
+
{ x: start.x + i * stepX, y: start.y - ring * stepY }
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
candidates.sort(
|
|
240
|
+
(a, b) => Math.hypot(a.x - start.x, a.y - start.y) - Math.hypot(b.x - start.x, b.y - start.y)
|
|
241
|
+
);
|
|
242
|
+
const spot = candidates.find(free);
|
|
243
|
+
if (spot) return { x: Math.round(spot.x), y: Math.round(spot.y) };
|
|
244
|
+
}
|
|
245
|
+
return { x: Math.round(start.x), y: Math.round(start.y) };
|
|
246
|
+
}
|
|
206
247
|
|
|
207
248
|
// src/canvas/arrange.ts
|
|
208
249
|
var LOCKED_DATA_KEY = "locked";
|
|
@@ -588,4 +629,5 @@ function invertNodeUpdates(nodes, updates) {
|
|
|
588
629
|
|
|
589
630
|
|
|
590
631
|
|
|
591
|
-
|
|
632
|
+
|
|
633
|
+
exports.DEFAULT_NODE_WIDTH = DEFAULT_NODE_WIDTH; exports.DEFAULT_NODE_HEIGHT = DEFAULT_NODE_HEIGHT; exports.DEFAULT_PLACEMENT_GAP = DEFAULT_PLACEMENT_GAP; exports.getCenteredNodePosition = getCenteredNodePosition; exports.centerNodes = centerNodes; exports.getLayoutedNodes = getLayoutedNodes; exports.estimateNodeSize = estimateNodeSize; exports.boundsOf = boundsOf; exports.centre = centre; exports.overlaps = overlaps; exports.flowSide = flowSide; exports.ensureLayout = ensureLayout; exports.placeBeside = placeBeside; exports.placeInView = placeInView; exports.LOCKED_DATA_KEY = LOCKED_DATA_KEY; exports.LOCKED_PREVIOUS_FLAGS_KEY = LOCKED_PREVIOUS_FLAGS_KEY; exports.readStyleSize = readStyleSize; exports.withStyleSize = withStyleSize; exports.getNodeSize = getNodeSize; exports.getAbsolutePosition = getAbsolutePosition; exports.createNodeLookup = createNodeLookup; exports.getNodeRect = getNodeRect; exports.isLocked = isLocked; exports.lockNodes = lockNodes; exports.unlockNodes = unlockNodes; exports.toggleLockNodes = toggleLockNodes; exports.alignNodes = alignNodes; exports.distributeNodes = distributeNodes; exports.matchSize = matchSize; exports.reorderNodes = reorderNodes; exports.applyNodeUpdates = applyNodeUpdates; exports.invertNodeUpdates = invertNodeUpdates;
|