edododraw 0.1.1 → 0.1.3
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-lib/chunks/{EdodoDraw-DGkcHuA6.js → EdodoDraw-BCfKu4Q3.js} +59 -8
- package/dist-lib/chunks/EdodoDraw-BCfKu4Q3.js.map +1 -0
- package/dist-lib/engine/camera/controller.d.ts +5 -0
- package/dist-lib/engine/camera/controller.d.ts.map +1 -1
- package/dist-lib/engine/render/svgRenderer.d.ts +6 -0
- package/dist-lib/engine/render/svgRenderer.d.ts.map +1 -1
- package/dist-lib/engine/scene/types.d.ts +4 -0
- package/dist-lib/engine/scene/types.d.ts.map +1 -1
- package/dist-lib/engine/timeline/player.d.ts.map +1 -1
- package/dist-lib/index.js +1 -1
- package/dist-lib/lib/EdodoDraw.d.ts.map +1 -1
- package/dist-lib/llms-full.txt +67 -5
- package/dist-lib/react.js +1 -1
- package/package.json +1 -1
- package/dist-lib/chunks/EdodoDraw-DGkcHuA6.js.map +0 -1
|
@@ -3067,9 +3067,7 @@ class CameraController {
|
|
|
3067
3067
|
};
|
|
3068
3068
|
/** Duration heuristic: further travel + bigger zoom change => longer. */
|
|
3069
3069
|
autoDuration(from, to) {
|
|
3070
|
-
|
|
3071
|
-
const zoomRatio = Math.abs(Math.log(to.zoom / from.zoom));
|
|
3072
|
-
return clamp(420 + dist2 * 0.12 + zoomRatio * 320, 420, 1300);
|
|
3070
|
+
return autoDuration(from, to);
|
|
3073
3071
|
}
|
|
3074
3072
|
// ---- high-level ops -----------------------------------------------------
|
|
3075
3073
|
fitAll(scene, opts = {}) {
|
|
@@ -3109,6 +3107,11 @@ class CameraController {
|
|
|
3109
3107
|
this.setImmediate({ cx: cam.cx - dx / cam.zoom, cy: cam.cy - dy / cam.zoom, zoom: cam.zoom });
|
|
3110
3108
|
}
|
|
3111
3109
|
}
|
|
3110
|
+
function autoDuration(from, to) {
|
|
3111
|
+
const dist2 = Math.hypot(to.cx - from.cx, to.cy - from.cy) * Math.min(from.zoom, to.zoom);
|
|
3112
|
+
const zoomRatio = Math.abs(Math.log(to.zoom / from.zoom));
|
|
3113
|
+
return clamp(420 + dist2 * 0.12 + zoomRatio * 320, 420, 1300);
|
|
3114
|
+
}
|
|
3112
3115
|
function lerp(a, b, t) {
|
|
3113
3116
|
return a + (b - a) * t;
|
|
3114
3117
|
}
|
|
@@ -4276,8 +4279,30 @@ function applyRevealToStep(c, scene, step) {
|
|
|
4276
4279
|
const ids = c.targets.flatMap((t) => resolveTargetIds(t, scene));
|
|
4277
4280
|
if (c.verb === "hide" || c.verb === "fade-out" || c.verb === "remove") {
|
|
4278
4281
|
step.hide.push(...ids);
|
|
4279
|
-
|
|
4280
|
-
|
|
4282
|
+
return;
|
|
4283
|
+
}
|
|
4284
|
+
step.reveal.push(...ids);
|
|
4285
|
+
const effect = revealEffect(c.with ?? (c.verb !== "show" ? c.verb : void 0));
|
|
4286
|
+
if (effect) {
|
|
4287
|
+
step.revealFx = step.revealFx ?? {};
|
|
4288
|
+
for (const id of ids) step.revealFx[id] = effect;
|
|
4289
|
+
}
|
|
4290
|
+
}
|
|
4291
|
+
function revealEffect(raw) {
|
|
4292
|
+
switch (raw) {
|
|
4293
|
+
case "fade-in":
|
|
4294
|
+
case "fade":
|
|
4295
|
+
return "fade";
|
|
4296
|
+
case "pop":
|
|
4297
|
+
case "pop-in":
|
|
4298
|
+
case "emphasize":
|
|
4299
|
+
return "pop";
|
|
4300
|
+
case "draw-on":
|
|
4301
|
+
case "draw":
|
|
4302
|
+
case "sweep":
|
|
4303
|
+
return "sweep";
|
|
4304
|
+
default:
|
|
4305
|
+
return void 0;
|
|
4281
4306
|
}
|
|
4282
4307
|
}
|
|
4283
4308
|
function cameraDirective(cam, scene, _tokens, timelineProps) {
|
|
@@ -5149,6 +5174,11 @@ function ensureEngineStyles(doc = document) {
|
|
|
5149
5174
|
injected = true;
|
|
5150
5175
|
}
|
|
5151
5176
|
const SVG_NS = "http://www.w3.org/2000/svg";
|
|
5177
|
+
const REVEAL_EFFECT_CLASS = {
|
|
5178
|
+
fade: "edd-reveal-fade",
|
|
5179
|
+
pop: "edd-reveal-pop",
|
|
5180
|
+
sweep: "edd-reveal-sweep"
|
|
5181
|
+
};
|
|
5152
5182
|
class SvgRenderer {
|
|
5153
5183
|
container;
|
|
5154
5184
|
svg;
|
|
@@ -5268,6 +5298,23 @@ class SvgRenderer {
|
|
|
5268
5298
|
else el.classList.remove("edd-hidden");
|
|
5269
5299
|
});
|
|
5270
5300
|
}
|
|
5301
|
+
/**
|
|
5302
|
+
* Play a per-beat reveal animation (`fade` | `pop` | `sweep`) on the named
|
|
5303
|
+
* element groups. Clears any prior reveal classes first and forces a reflow so
|
|
5304
|
+
* re-entering the same beat restarts the animation. `fx` = id -> effect.
|
|
5305
|
+
*/
|
|
5306
|
+
playReveal(fx) {
|
|
5307
|
+
const classes = ["edd-reveal-fade", "edd-reveal-pop", "edd-reveal-sweep"];
|
|
5308
|
+
const els = this.svg.querySelectorAll("[data-node],[data-edge]");
|
|
5309
|
+
els.forEach((el) => el.classList.remove(...classes));
|
|
5310
|
+
if (!fx || !Object.keys(fx).length) return;
|
|
5311
|
+
void this.svg.getBoundingClientRect();
|
|
5312
|
+
els.forEach((el) => {
|
|
5313
|
+
const id = el.getAttribute("data-node") ?? el.getAttribute("data-edge");
|
|
5314
|
+
const cls = id ? REVEAL_EFFECT_CLASS[fx[id]] : void 0;
|
|
5315
|
+
if (cls) el.classList.add(cls);
|
|
5316
|
+
});
|
|
5317
|
+
}
|
|
5271
5318
|
render(scene) {
|
|
5272
5319
|
this.scene = scene;
|
|
5273
5320
|
this.bg.setAttribute("fill", scene.meta.background || scene.theme.background);
|
|
@@ -5435,6 +5482,7 @@ class TimelinePlayer {
|
|
|
5435
5482
|
const step = this.steps[i];
|
|
5436
5483
|
const scene = this.scene;
|
|
5437
5484
|
this.renderer.applyVisibility(this.computeHidden(i));
|
|
5485
|
+
if (animate) this.renderer.playReveal(step.revealFx);
|
|
5438
5486
|
this.annotations.render(scene, [...scene.annotations, ...step.annotations], animate);
|
|
5439
5487
|
this.emit();
|
|
5440
5488
|
if (step.camera) {
|
|
@@ -5858,6 +5906,8 @@ class EdodoDraw {
|
|
|
5858
5906
|
this.renderer.measure();
|
|
5859
5907
|
this.renderer.applyCamera(this.renderer.getCamera());
|
|
5860
5908
|
this.updateGrid(this.controller.current);
|
|
5909
|
+
this.edit.render();
|
|
5910
|
+
this.live.render();
|
|
5861
5911
|
}
|
|
5862
5912
|
destroy() {
|
|
5863
5913
|
for (const fn of this.cleanup) fn();
|
|
@@ -5948,8 +5998,9 @@ class EdodoDraw {
|
|
|
5948
5998
|
this.edit.dblclick(this.renderer.screenToWorld(this.localPoint(e)));
|
|
5949
5999
|
});
|
|
5950
6000
|
const onKey = (e) => {
|
|
5951
|
-
const
|
|
5952
|
-
|
|
6001
|
+
const t = e.target;
|
|
6002
|
+
const tag = t?.tagName;
|
|
6003
|
+
if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || t?.isContentEditable || t?.closest?.("[contenteditable='true'], .cm-editor")) return;
|
|
5953
6004
|
if (this.mode === "edit" && this.edit.handleKey(e)) {
|
|
5954
6005
|
e.preventDefault();
|
|
5955
6006
|
return;
|
|
@@ -6116,4 +6167,4 @@ export {
|
|
|
6116
6167
|
deleteElements as y,
|
|
6117
6168
|
dist as z
|
|
6118
6169
|
};
|
|
6119
|
-
//# sourceMappingURL=EdodoDraw-
|
|
6170
|
+
//# sourceMappingURL=EdodoDraw-BCfKu4Q3.js.map
|