@1337exp/taoux 0.13.0 → 0.15.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/CHANGELOG.md +13 -0
- package/dist/canvas/glide.d.ts +72 -0
- package/dist/canvas/host.d.ts +23 -0
- package/dist/canvas/index.d.ts +1 -0
- package/dist/canvas.js +107 -2
- package/dist/canvas.js.map +1 -1
- package/dist/links/index.d.ts +1 -1
- package/dist/links/types.d.ts +21 -0
- package/dist/links.css +71 -50
- package/dist/links.js +14 -5
- package/dist/links.js.map +1 -1
- package/package.json +2 -1
- package/skills/taoux/SKILL.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.15.0
|
|
4
|
+
|
|
5
|
+
Nothing to migrate: new optional members; without them links and keys behave as before.
|
|
6
|
+
|
|
7
|
+
- **`links`: `dash` and `width` per link.** A `LinkLine` (and the `preview`) may name its line style, `dash: 'solid' | 'dashed' | 'dotted'` (solid by default), and its thickness, `width` in screen pixels (default `--tx-link-width`, 2; one pixel more on hover and selection, as before). It was colour only, so an app that tells relations apart by line style drew its own SVG layer. The pattern is measured in line widths (`--tx-link-width` is a plain number): dashes `3w` with gaps `3w`, dots of one width with a gap of two widths between their centres, drawn with the round caps; and in screen pixels, so it does not change with the zoom, like the line. The arrowhead is a separate filled path and stays solid; the hit area is a separate transparent solid stroke, so the gaps of a dashed line are clickable. The preview keeps its own `6 4` dashes unless it names `dashed` or `dotted`. A link without the fields renders exactly as before. New type `LinkDash`.
|
|
8
|
+
- **`canvas`: `keys: 'window' | 'focus'` option, the scope of the canvas keys.** The canvas took Delete, Backspace, Escape and Ctrl+Z / Y from the whole window, so with a drawer or a text field beside it a key typed there reached the canvas and the app had to guard against it. With `keys: 'focus'` only an event whose target is inside the canvas root is taken (the root is focusable and takes focus on a press); typing in inputs, textareas, selects and contenteditable is never taken in either mode, and `claimsKey` is asked first. The default stays `'window'`: an app whose canvas is the whole page (`workspace`) needs keys without clicking it first.
|
|
9
|
+
|
|
10
|
+
## 0.14.0
|
|
11
|
+
|
|
12
|
+
Nothing to migrate: one optional member; without it the canvas behaves as before.
|
|
13
|
+
|
|
14
|
+
- **`canvas`: `inertia` option, the camera glides after a pan.** Dragging the camera was strictly 1:1: whatever distance the pointer went, the camera went, and it stopped the moment the pointer was released. With `inertia: true` (or `{ friction, minSpeed, maxSpeed }`) a pan that is released while still moving carries on and slows down smoothly, as in a map or a phone; a pointer held still for a moment before the release (`HOLD_STILL`, 90 ms) stops the camera at once, so a careful 1:1 drag is still there. The speed is measured over the last 40 ms (a flick starts from rest and speeds up, so a longer window would average the slow start in and a short push would not glide), decays exponentially (`friction` is the time constant, 140 ms) and the distance is the exact integral of it, so the glide does not depend on the frame rate. Only a clear flick glides: a release slower than `minSpeed` (0.4 px/ms) does not, so a careful drag, a small jerk or a tremor stays 1:1. A new press, the wheel and a zoom stop it; it is not run when the system asks for reduced motion. It applies to every pan of the canvas (the middle and right buttons, a finger). The arithmetic is in `canvas/glide` (`releaseVelocity`, `glideStep`, exported and unit-tested).
|
|
15
|
+
|
|
3
16
|
## 0.13.0
|
|
4
17
|
|
|
5
18
|
Nothing to migrate: new optional members.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The glide of the camera after a pan: if the pointer is released while still moving, the camera keeps going and slows
|
|
3
|
+
* down smoothly. Pure arithmetic (no DOM, no timers), so it is unit-tested; the gesture machine only feeds it samples.
|
|
4
|
+
* Скольжение камеры после перетаскивания: если указатель отпустили на ходу, камера продолжает движение и плавно
|
|
5
|
+
* тормозит. Чистая арифметика (без DOM и таймеров), поэтому проверяется тестом; машина жестов лишь подаёт отсчёты.
|
|
6
|
+
*/
|
|
7
|
+
export interface GlideOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Time constant of the slowing down, ms: the speed falls `e` times over it (the camera travels about speed × this in
|
|
10
|
+
* total). Default 140.
|
|
11
|
+
* Постоянная времени торможения, мс: за неё скорость падает в `e` раз (камера проедет примерно скорость × это).
|
|
12
|
+
* По умолчанию 140.
|
|
13
|
+
*/
|
|
14
|
+
friction?: number;
|
|
15
|
+
/**
|
|
16
|
+
* A release slower than this (px/ms) does not start a glide: a careful drag, a small jerk or a tremor of the hand must
|
|
17
|
+
* not glide. Default 0.4 (400 px/s, a clear flick).
|
|
18
|
+
* Отпускание медленнее этого (px/мс) скольжения не запускает: аккуратная протяжка, небольшой рывок или дрожь руки не
|
|
19
|
+
* должны скользить. По умолчанию 0.4 (400 px/с, явный бросок).
|
|
20
|
+
*/
|
|
21
|
+
minSpeed?: number;
|
|
22
|
+
/**
|
|
23
|
+
* The speed is not allowed to exceed this (px/ms). Default 6.
|
|
24
|
+
* Скорость не больше этого (px/мс). По умолчанию 6.
|
|
25
|
+
*/
|
|
26
|
+
maxSpeed?: number;
|
|
27
|
+
}
|
|
28
|
+
export declare const GLIDE_DEFAULTS: {
|
|
29
|
+
readonly friction: 140;
|
|
30
|
+
readonly minSpeed: 0.4;
|
|
31
|
+
readonly maxSpeed: 6;
|
|
32
|
+
};
|
|
33
|
+
/** A glide slower than this (px/ms) is over. / Скольжение медленнее этого (px/мс) окончено. */
|
|
34
|
+
export declare const STOP_SPEED = 0.03;
|
|
35
|
+
/**
|
|
36
|
+
* How far back the release speed is measured, ms. Short on purpose: a flick starts from rest and speeds up, and a longer
|
|
37
|
+
* window would average the slow start in and make a short push too weak to glide.
|
|
38
|
+
* За какое время до отпускания меряется скорость, мс. Намеренно короткое: бросок начинается с места и разгоняется, а
|
|
39
|
+
* длинное окно усреднило бы медленное начало, и короткий толчок не хватал бы на скольжение.
|
|
40
|
+
*/
|
|
41
|
+
export declare const VELOCITY_WINDOW = 40;
|
|
42
|
+
/** A pointer held still this long before the release does not glide (the person stopped on purpose), ms. / Указатель, который перед отпусканием стоял столько, не скользит (человек остановился намеренно), мс. */
|
|
43
|
+
export declare const HOLD_STILL = 90;
|
|
44
|
+
export interface PanSample {
|
|
45
|
+
/** Time, ms. */
|
|
46
|
+
t: number;
|
|
47
|
+
dx: number;
|
|
48
|
+
dy: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The release velocity (px/ms) from the last samples, or null when there should be no glide: nothing measured, the
|
|
52
|
+
* pointer stood still before the release, or it was slower than `minSpeed`.
|
|
53
|
+
* Скорость в момент отпускания (px/мс) по последним отсчётам, либо null, если скользить не надо: ничего не измерено,
|
|
54
|
+
* указатель перед отпусканием стоял или он медленнее `minSpeed`.
|
|
55
|
+
*/
|
|
56
|
+
export declare function releaseVelocity(samples: readonly PanSample[], now: number, options?: GlideOptions): [number, number] | null;
|
|
57
|
+
export interface GlideStep {
|
|
58
|
+
/** How far the camera moves in this step, px. */
|
|
59
|
+
dx: number;
|
|
60
|
+
dy: number;
|
|
61
|
+
/** The speed after the step, px/ms. */
|
|
62
|
+
v: [number, number];
|
|
63
|
+
/** The glide is over. */
|
|
64
|
+
done: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* One step of `dt` ms. The speed decays exponentially and the distance is its exact integral, so the glide does not
|
|
68
|
+
* depend on the frame rate (a slow frame travels as far as the fast ones it replaces).
|
|
69
|
+
* Один шаг в `dt` мс. Скорость затухает по экспоненте, а путь это её точный интеграл, поэтому скольжение не зависит
|
|
70
|
+
* от частоты кадров (медленный кадр проезжает столько же, сколько заменённые им быстрые).
|
|
71
|
+
*/
|
|
72
|
+
export declare function glideStep(v: readonly [number, number], dt: number, options?: GlideOptions): GlideStep;
|
package/dist/canvas/host.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Camera, ZoomLimits } from '../camera';
|
|
2
|
+
import type { GlideOptions } from './glide';
|
|
2
3
|
/**
|
|
3
4
|
* A mutable tuple: app stores accept exactly these.
|
|
4
5
|
* Изменяемый кортеж: сторы приложений принимают именно такие.
|
|
@@ -195,4 +196,26 @@ export interface CanvasOptions<P> {
|
|
|
195
196
|
* Диапазон масштаба колеса и щипка; не заданный конец остаётся по умолчанию (0.2…2).
|
|
196
197
|
*/
|
|
197
198
|
zoom?: Partial<ZoomLimits>;
|
|
199
|
+
/**
|
|
200
|
+
* The camera glides after a pan (a mouse drag with the middle or right button, a finger): drag and let go while the
|
|
201
|
+
* pointer is still moving, and the camera keeps going and slows down smoothly; a pointer held still before the release
|
|
202
|
+
* stops the camera at once (a 1:1 drag). A new press, the wheel and a zoom stop the glide. `true` for the defaults,
|
|
203
|
+
* or the settings (see `GlideOptions`). Off by default; not run when the system asks for reduced motion.
|
|
204
|
+
* Камера скользит после перетаскивания (средняя или правая кнопка, палец): потянули и отпустили на ходу, и камера
|
|
205
|
+
* продолжает движение, плавно тормозя; указатель, придержанный перед отпусканием, останавливает камеру сразу (1:1).
|
|
206
|
+
* Новое нажатие, колесо и масштаб останавливают скольжение. `true` для настроек по умолчанию или сами настройки
|
|
207
|
+
* (см. `GlideOptions`). По умолчанию выключено; не работает, если система просит поменьше анимации.
|
|
208
|
+
*/
|
|
209
|
+
inertia?: boolean | GlideOptions;
|
|
210
|
+
/**
|
|
211
|
+
* Where the canvas takes its keys (Delete, Backspace, Escape, Ctrl+Z / Y) from. `'window'` (default): from the whole
|
|
212
|
+
* window, so they work without a click on the canvas first (the canvas is the whole app). `'focus'`: only when the
|
|
213
|
+
* event target is inside the canvas root; the root takes focus on a press, so a drawer or a text field beside the
|
|
214
|
+
* canvas keeps its own keys. In both modes typing in input, textarea, select and contenteditable is never taken.
|
|
215
|
+
* Откуда холст берёт клавиши (Delete, Backspace, Escape, Ctrl+Z / Y). `'window'` (по умолчанию): со всего окна, так
|
|
216
|
+
* что они работают без предварительного клика по холсту (холст — всё приложение). `'focus'`: только если цель события
|
|
217
|
+
* внутри корня холста; корень получает фокус при нажатии, поэтому панель или поле ввода рядом с холстом сохраняют
|
|
218
|
+
* свои клавиши. В обоих режимах набор текста в input, textarea, select и contenteditable не перехватывается.
|
|
219
|
+
*/
|
|
220
|
+
keys?: 'window' | 'focus';
|
|
198
221
|
}
|
package/dist/canvas/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as TaoxCanvas } from './TaoxCanvas.vue';
|
|
2
2
|
export { useCanvasGestures, type Marquee } from './useCanvasGestures';
|
|
3
|
+
export { GLIDE_DEFAULTS, glideStep, releaseVelocity, type GlideOptions, type GlideStep, type PanSample } from './glide';
|
|
3
4
|
export type { ActivateTarget, CanvasHost, CanvasOptions, ConnectHost, ContextTarget, Point, Rect, ResizeEdge, ResizeHost, Size, } from './host';
|
package/dist/canvas.js
CHANGED
|
@@ -4,6 +4,65 @@ import { createEdgeScroller } from "./edgescroll.js";
|
|
|
4
4
|
import { PinchTracker, TapRecognizer, pinchOf } from "./gestures.js";
|
|
5
5
|
import { wheelIntent } from "./wheel.js";
|
|
6
6
|
import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, ref, renderSlot, toDisplayString, unref, watch, withModifiers } from "vue";
|
|
7
|
+
//#region src/canvas/glide.ts
|
|
8
|
+
var GLIDE_DEFAULTS = {
|
|
9
|
+
friction: 140,
|
|
10
|
+
minSpeed: .4,
|
|
11
|
+
maxSpeed: 6
|
|
12
|
+
};
|
|
13
|
+
/** A glide slower than this (px/ms) is over. / Скольжение медленнее этого (px/мс) окончено. */
|
|
14
|
+
var STOP_SPEED = .03;
|
|
15
|
+
/**
|
|
16
|
+
* The release velocity (px/ms) from the last samples, or null when there should be no glide: nothing measured, the
|
|
17
|
+
* pointer stood still before the release, or it was slower than `minSpeed`.
|
|
18
|
+
* Скорость в момент отпускания (px/мс) по последним отсчётам, либо null, если скользить не надо: ничего не измерено,
|
|
19
|
+
* указатель перед отпусканием стоял или он медленнее `minSpeed`.
|
|
20
|
+
*/
|
|
21
|
+
function releaseVelocity(samples, now, options = {}) {
|
|
22
|
+
const { minSpeed, maxSpeed } = {
|
|
23
|
+
...GLIDE_DEFAULTS,
|
|
24
|
+
...options
|
|
25
|
+
};
|
|
26
|
+
const from = samples.findIndex((s) => now - s.t <= 40);
|
|
27
|
+
const recent = from < 0 ? [] : samples.slice(from);
|
|
28
|
+
const last = recent[recent.length - 1];
|
|
29
|
+
if (!last || now - last.t > 90) return null;
|
|
30
|
+
const start = from > 0 ? samples[from - 1].t : recent[0].t - 16;
|
|
31
|
+
const span = Math.max(last.t - start, 16);
|
|
32
|
+
const sx = recent.reduce((s, p) => s + p.dx, 0);
|
|
33
|
+
const sy = recent.reduce((s, p) => s + p.dy, 0);
|
|
34
|
+
let vx = sx / span;
|
|
35
|
+
let vy = sy / span;
|
|
36
|
+
const speed = Math.hypot(vx, vy);
|
|
37
|
+
if (speed < minSpeed) return null;
|
|
38
|
+
if (speed > maxSpeed) {
|
|
39
|
+
vx = vx / speed * maxSpeed;
|
|
40
|
+
vy = vy / speed * maxSpeed;
|
|
41
|
+
}
|
|
42
|
+
return [vx, vy];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* One step of `dt` ms. The speed decays exponentially and the distance is its exact integral, so the glide does not
|
|
46
|
+
* depend on the frame rate (a slow frame travels as far as the fast ones it replaces).
|
|
47
|
+
* Один шаг в `dt` мс. Скорость затухает по экспоненте, а путь это её точный интеграл, поэтому скольжение не зависит
|
|
48
|
+
* от частоты кадров (медленный кадр проезжает столько же, сколько заменённые им быстрые).
|
|
49
|
+
*/
|
|
50
|
+
function glideStep(v, dt, options = {}) {
|
|
51
|
+
const { friction } = {
|
|
52
|
+
...GLIDE_DEFAULTS,
|
|
53
|
+
...options
|
|
54
|
+
};
|
|
55
|
+
const decay = Math.exp(-dt / friction);
|
|
56
|
+
const k = friction * (1 - decay);
|
|
57
|
+
const next = [v[0] * decay, v[1] * decay];
|
|
58
|
+
return {
|
|
59
|
+
dx: v[0] * k,
|
|
60
|
+
dy: v[1] * k,
|
|
61
|
+
v: next,
|
|
62
|
+
done: Math.hypot(next[0], next[1]) < STOP_SPEED
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
7
66
|
//#region src/canvas/useCanvasGestures.ts
|
|
8
67
|
var PAN_CLICK_THRESHOLD = 4;
|
|
9
68
|
/**
|
|
@@ -21,6 +80,35 @@ function useCanvasGestures(root, host, options) {
|
|
|
21
80
|
let baseSelection = [];
|
|
22
81
|
let panDistance = 0;
|
|
23
82
|
/**
|
|
83
|
+
* The last moves of a pan, for the glide after the release (see `CanvasOptions.inertia`).
|
|
84
|
+
* Последние сдвиги перетаскивания холста, для скольжения после отпускания (см. `CanvasOptions.inertia`).
|
|
85
|
+
*/
|
|
86
|
+
let panSamples = [];
|
|
87
|
+
let glideFrame = 0;
|
|
88
|
+
const glideOptions = () => {
|
|
89
|
+
if (!options.inertia) return null;
|
|
90
|
+
if (typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return null;
|
|
91
|
+
return options.inertia === true ? {} : options.inertia;
|
|
92
|
+
};
|
|
93
|
+
function stopGlide() {
|
|
94
|
+
if (glideFrame) cancelAnimationFrame(glideFrame);
|
|
95
|
+
glideFrame = 0;
|
|
96
|
+
}
|
|
97
|
+
function startGlide(v, opts) {
|
|
98
|
+
stopGlide();
|
|
99
|
+
let velocity = v;
|
|
100
|
+
let last = performance.now();
|
|
101
|
+
const frame = (now) => {
|
|
102
|
+
const dt = Math.min(now - last, 64);
|
|
103
|
+
last = now;
|
|
104
|
+
const step = glideStep(velocity, dt, opts);
|
|
105
|
+
host.setCamera(panBy(host.camera, step.dx, step.dy));
|
|
106
|
+
velocity = step.v;
|
|
107
|
+
glideFrame = step.done ? 0 : requestAnimationFrame(frame);
|
|
108
|
+
};
|
|
109
|
+
glideFrame = requestAnimationFrame(frame);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
24
112
|
* Alt is held: grid snapping is temporarily off. Remembered so that auto-scroll (no event) knows it too.
|
|
25
113
|
* Alt зажат: привязка к сетке временно отключена. Запоминаем, чтобы автопрокрутка (без события) тоже знала.
|
|
26
114
|
*/
|
|
@@ -313,6 +401,8 @@ function useCanvasGestures(root, host, options) {
|
|
|
313
401
|
const touch = e.pointerType === "touch";
|
|
314
402
|
if (touch && touchDown(e)) return;
|
|
315
403
|
host.closePalette();
|
|
404
|
+
stopGlide();
|
|
405
|
+
panSamples = [];
|
|
316
406
|
lastX = e.clientX;
|
|
317
407
|
lastY = e.clientY;
|
|
318
408
|
panDistance = 0;
|
|
@@ -511,6 +601,11 @@ function useCanvasGestures(root, host, options) {
|
|
|
511
601
|
if (mode === "pan") {
|
|
512
602
|
panDistance += Math.hypot(dx, dy);
|
|
513
603
|
host.setCamera(panBy(host.camera, dx, dy));
|
|
604
|
+
if (options.inertia) panSamples.push({
|
|
605
|
+
t: performance.now(),
|
|
606
|
+
dx,
|
|
607
|
+
dy
|
|
608
|
+
});
|
|
514
609
|
} else if (mode === "drag") host.moveSelected(dx / host.camera.z, dy / host.camera.z, snapNow());
|
|
515
610
|
else if (mode === "resize") {
|
|
516
611
|
resizeDx += dx / host.camera.z;
|
|
@@ -539,7 +634,12 @@ function useCanvasGestures(root, host, options) {
|
|
|
539
634
|
host.commit();
|
|
540
635
|
} else if (mode === "pan" && e.button === 2 && panDistance < PAN_CLICK_THRESHOLD) {
|
|
541
636
|
if (!openContextAt(e)) openPaletteAt(e, null);
|
|
637
|
+
} else if (mode === "pan") {
|
|
638
|
+
const opts = glideOptions();
|
|
639
|
+
const v = opts && releaseVelocity(panSamples, performance.now(), opts);
|
|
640
|
+
if (opts && v) startGlide(v, opts);
|
|
542
641
|
}
|
|
642
|
+
panSamples = [];
|
|
543
643
|
mode = "idle";
|
|
544
644
|
marquee.value = null;
|
|
545
645
|
stopAutoScroll();
|
|
@@ -552,6 +652,7 @@ function useCanvasGestures(root, host, options) {
|
|
|
552
652
|
* Смотрим на физическую клавишу (`code`), чтобы Ctrl+Z работало и в русской раскладке.
|
|
553
653
|
*/
|
|
554
654
|
function onKey(e) {
|
|
655
|
+
if (options.keys === "focus" && !(e.target instanceof Node && root.value?.contains(e.target))) return;
|
|
555
656
|
const tag = e.target?.tagName;
|
|
556
657
|
if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || e.target?.isContentEditable) return;
|
|
557
658
|
if (host.claimsKey?.(e)) return;
|
|
@@ -605,6 +706,7 @@ function useCanvasGestures(root, host, options) {
|
|
|
605
706
|
* заметкой, которую можно прокрутить, не масштабирует холст, стоит курсору случайно выйти за её край.
|
|
606
707
|
*/
|
|
607
708
|
function onWheel(e) {
|
|
709
|
+
stopGlide();
|
|
608
710
|
const el = root.value;
|
|
609
711
|
const zooming = e.ctrlKey || e.metaKey;
|
|
610
712
|
const field = e.target?.closest("textarea");
|
|
@@ -638,6 +740,7 @@ function useCanvasGestures(root, host, options) {
|
|
|
638
740
|
window.removeEventListener("pointercancel", purgeTouch);
|
|
639
741
|
stopAutoScroll();
|
|
640
742
|
clearLongPress();
|
|
743
|
+
stopGlide();
|
|
641
744
|
cancelAnimationFrame(pinchFrame);
|
|
642
745
|
});
|
|
643
746
|
watch(() => host.paletteOpen, (now, before) => {
|
|
@@ -680,7 +783,9 @@ var TaoxCanvas_default = /* @__PURE__ */ defineComponent({
|
|
|
680
783
|
const { marquee, debug, debugText, handlers } = useCanvasGestures(root, props.host, props.options);
|
|
681
784
|
const world = computed(() => {
|
|
682
785
|
const { x, y, z } = props.host.camera;
|
|
683
|
-
|
|
786
|
+
const dpr = typeof window !== "undefined" && window.devicePixelRatio || 1;
|
|
787
|
+
const snap = (v) => Math.round(v * dpr) / dpr;
|
|
788
|
+
return { transform: `translate(${snap(x)}px, ${snap(y)}px) scale(${z})` };
|
|
684
789
|
});
|
|
685
790
|
const gridStyle = computed(() => {
|
|
686
791
|
const { x, y, z } = props.host.camera;
|
|
@@ -744,6 +849,6 @@ var TaoxCanvas_default = /* @__PURE__ */ defineComponent({
|
|
|
744
849
|
}
|
|
745
850
|
});
|
|
746
851
|
//#endregion
|
|
747
|
-
export { TaoxCanvas_default as TaoxCanvas, useCanvasGestures };
|
|
852
|
+
export { GLIDE_DEFAULTS, TaoxCanvas_default as TaoxCanvas, glideStep, releaseVelocity, useCanvasGestures };
|
|
748
853
|
|
|
749
854
|
//# sourceMappingURL=canvas.js.map
|
package/dist/canvas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas.js","names":["_openBlock","_createElementBlock","_normalizeClass","_normalizeStyle","_unref","_withModifiers","_createElementVNode","_renderSlot","_createCommentVNode","_toDisplayString","_sfc_main"],"sources":["../src/canvas/useCanvasGestures.ts","../src/canvas/TaoxCanvas.vue","../src/canvas/TaoxCanvas.vue"],"sourcesContent":["import { onMounted, onUnmounted, ref, watch, type Ref } from 'vue';\nimport { panBy, screenToWorld, zoomAt, zoomLimits } from '../camera';\nimport { createEdgeScroller } from '../edgescroll';\nimport { LONG_PRESS_MS, PinchTracker, TapRecognizer, pinchOf, type Sample } from '../gestures';\nimport { wheelIntent } from '../wheel';\nimport type { CanvasHost, CanvasOptions, ContextTarget, Point, Rect, ResizeEdge } from './host';\n\nconst PAN_CLICK_THRESHOLD = 4; // a right button moved less than this is a click (it opens the palette) / ПКМ, сдвинутая меньше, это клик (открывает палитру)\n\n/**\n * Everything that must be known about the pointer position: both a real event and the last known position will do.\n * Всё, что нужно знать о положении указателя: годится и настоящее событие, и последнее известное положение.\n */\ntype Pointer = Pick<MouseEvent, 'clientX' | 'clientY'>;\n\ntype Mode = 'idle' | 'pan' | 'drag' | 'marquee' | 'connect' | 'resize' | 'pinch';\n\n/**\n * The selection frame in client coordinates.\n * Рамка выделения в клиентских координатах.\n */\nexport interface Marquee {\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n}\n\n/**\n * The canvas gesture machine: mouse, touch (tap, double tap, long press, pinch), wheel, auto-scroll at the edge,\n * keys. It does not know the data model: the app decides through `host`.\n * The host is taken once at creation: it must be a stable object.\n * Машина жестов холста: мышь, сенсор (тап, двойной тап, долгое нажатие, щипок), колесо, автопрокрутка у края,\n * клавиши. Не знает модель данных: решения принимает приложение через `host`.\n * Хост берётся один раз при создании: он должен быть стабильным объектом.\n */\nexport function useCanvasGestures<P>(root: Ref<HTMLElement | null>, host: CanvasHost<P>, options: CanvasOptions<P>) {\n let mode: Mode = 'idle';\n let lastX = 0;\n let lastY = 0;\n let baseSelection: string[] = [];\n let panDistance = 0;\n /**\n * Alt is held: grid snapping is temporarily off. Remembered so that auto-scroll (no event) knows it too.\n * Alt зажат: привязка к сетке временно отключена. Запоминаем, чтобы автопрокрутка (без события) тоже знала.\n */\n let altDown = false;\n const snapNow = () => (host.snapEnabled ?? false) && !altDown;\n let resizeId = '';\n let resizeEdge: ResizeEdge = 'se';\n let resizeStart: Rect = { x: 0, y: 0, w: 0, h: 0 };\n /**\n * Mouse shift since the resize began, world units.\n * Сдвиг мыши с начала изменения размера, мировые единицы.\n */\n let resizeDx = 0;\n let resizeDy = 0;\n\n // Touch: fingers on the canvas, recognition of taps and long press, pinch state.\n // Сенсор: пальцы на холсте, распознавание тапов и долгого нажатия, состояние щипка.\n const touches = new Map<number, { x: number; y: number }>();\n const taps = new TapRecognizer();\n let longPressTimer: ReturnType<typeof setTimeout> | undefined;\n let lastTouchAt = 0;\n const pinch = new PinchTracker();\n /**\n * The node a finger landed on: its selection and raise are postponed until the intent is clear. The touch may still\n * turn out to be the start of a two-finger gesture, and then the user's existing selection must not be lost.\n * We select when the finger started dragging (left the slop) or was lifted (tap, hold).\n * Нода, на которую лёг палец: её выделение и подъём откладываются, пока не ясно намерение. Касание ещё может\n * оказаться началом жеста двумя пальцами, и тогда выделение, которое было у пользователя, не должно слететь.\n * Выделяем, когда палец пошёл тянуть (вышел за допуск) или поднят (тап, удержание).\n */\n let armed: string | null = null;\n /**\n * The link a finger landed on: as with a node, it is selected only if this is a tap (the finger did not go to move the canvas).\n * Связь, на которую лёг палец: как с нодой, выбираем её только если это тап (палец не пошёл двигать холст).\n */\n let armedConn: string | null = null;\n\n /**\n * `?debug=touch`: the last recognised gesture and the number of fingers show in the corner.\n * `?debug=touch`: в углу видно последний распознанный жест и число пальцев.\n */\n const debug = typeof location !== 'undefined' && new URLSearchParams(location.search).get('debug') === 'touch';\n const debugText = ref('');\n const note = (label: string) => {\n if (debug) debugText.value = `${label} · fingers: ${touches.size}`;\n };\n\n const marquee = ref<Marquee | null>(null);\n\n //--------------------------------------------------\n // DOM\n\n const nodeIdAt = (target: EventTarget | null) =>\n (target as HTMLElement | null)?.closest<HTMLElement>('[data-node-id]')?.dataset.nodeId ?? null;\n\n const connIdAt = (target: EventTarget | null) =>\n (target as Element | null)?.closest<HTMLElement>('[data-conn-id]')?.dataset.connId ?? null;\n\n /**\n * Input fields inside nodes: a click on them selects the node but does not drag it and does not take focus away.\n * Поля ввода внутри нод: клик по ним выделяет ноду, но не тащит её и не отбирает фокус.\n */\n const isEditable = (target: EventTarget | null) =>\n !!(target as Element | null)?.closest('input, textarea, select, button, label, a[href], [contenteditable=\"true\"], [role=\"checkbox\"], [role=\"radio\"], [role=\"switch\"]');\n\n /**\n * The pin under the cursor: the nearest pin (if the app can) or the one exactly under the pointer.\n * Пин под курсором: ближайший пин (если приложение умеет) или тот, что точно под указателем.\n */\n const pinUnder = (e: Pointer): P | null =>\n options.pinNear?.(e) ?? options.pinAt(document.elementFromPoint(e.clientX, e.clientY));\n\n function cursorWorld(e: Pointer): Point {\n const rect = root.value!.getBoundingClientRect();\n return screenToWorld(host.camera, e.clientX - rect.left, e.clientY - rect.top);\n }\n\n /**\n * A right click: ask the app for a menu for what lies under the pointer. True when it showed one.\n * Правый клик: просим у приложения меню для того, что под указателем. True, если оно его показало.\n */\n function openContextAt(e: Pointer): boolean {\n if (!host.contextMenu) return false;\n const under = document.elementFromPoint(e.clientX, e.clientY);\n const link = connIdAt(under);\n const node = nodeIdAt(under);\n const target: ContextTarget = link ? { kind: 'link', id: link } : node ? { kind: 'node', nodeId: node } : { kind: 'empty' };\n const rect = root.value!.getBoundingClientRect();\n return host.contextMenu([e.clientX - rect.left, e.clientY - rect.top], cursorWorld(e), target);\n }\n\n function openPaletteAt(e: Pointer, origin: P | null) {\n const rect = root.value!.getBoundingClientRect();\n host.openPalette([e.clientX - rect.left, e.clientY - rect.top], cursorWorld(e), origin);\n }\n\n function nodesInMarquee(): string[] {\n const m = marquee.value;\n if (!m || !root.value) return [];\n\n const left = Math.min(m.x0, m.x1);\n const right = Math.max(m.x0, m.x1);\n const top = Math.min(m.y0, m.y1);\n const bottom = Math.max(m.y0, m.y1);\n\n const ids: string[] = [];\n for (const el of root.value.querySelectorAll<HTMLElement>('[data-node-id]')) {\n // A container is selected only by its strip: otherwise any frame would pick the whole group.\n // Контейнер выделяется только за полосу: иначе любая рамка выбирала бы всю группу целиком.\n const area = el.hasAttribute('data-node-container') ? (el.querySelector('[data-node-handle]') ?? el) : el;\n const r = area.getBoundingClientRect();\n const hit =\n options.marquee === 'contain'\n ? r.left >= left && r.right <= right && r.top >= top && r.bottom <= bottom\n : r.left < right && r.right > left && r.top < bottom && r.bottom > top;\n if (hit) ids.push(el.dataset.nodeId!);\n }\n return ids;\n }\n\n //--------------------------------------------------\n\n const sampleOf = (e: PointerEvent): Sample => ({ x: e.clientX, y: e.clientY, t: performance.now() });\n\n function capture(e: PointerEvent) {\n try {\n root.value?.setPointerCapture(e.pointerId);\n } catch {\n // the pointer has already gone: nothing to capture\n // указатель уже ушёл: захватывать нечего\n }\n }\n\n function releaseCapture(e: { pointerId: number }) {\n try {\n root.value?.releasePointerCapture(e.pointerId);\n } catch {\n // the capture is already gone\n // захвата уже нет\n }\n }\n\n function clearLongPress() {\n clearTimeout(longPressTimer);\n longPressTimer = undefined;\n }\n\n //--------------------------------------------------\n // Touch\n // Сенсор\n\n /**\n * A second finger landed on the canvas: the gesture in progress is cancelled and a pinch begins. Returns true if the event was handled.\n * Второй палец лёг на холст: начатый жест отменяется, начинается щипок. Возвращает true, если событие обработано.\n */\n function touchDown(e: PointerEvent): boolean {\n // The primary finger is the start of a new touch: there are no other fingers on screen now. Whatever we remember is stale\n // (a pointerup went past the canvas, for example onto a palette opened by a long press), and it must be forgotten, otherwise\n // the next tap would count as a second finger and turn the pinch on for good.\n // Первичный палец это начало нового касания: других пальцев на экране сейчас нет. Всё, что мы помним, зависло\n // (pointerup ушёл мимо холста, например на палитру, открытую долгим нажатием), и его надо забыть, иначе\n // следующий тап посчитается вторым пальцем и включит щипок насовсем.\n if (e.isPrimary) {\n touches.clear();\n armed = null;\n armedConn = null;\n if (mode !== 'idle') abortGesture();\n }\n\n touches.set(e.pointerId, { x: e.clientX, y: e.clientY });\n if (touches.size < 2) return false;\n\n host.closePalette();\n abortGesture();\n mode = 'pinch';\n rebasePinch();\n capture(e);\n e.preventDefault();\n note('pinch');\n return true;\n }\n\n /**\n * A finger landed on the canvas (the first one): remembered for a tap, and the long-press timer is set. Returns true for a second tap in a row.\n * Палец лёг на холст (первый): запоминаем для тапа и ставим таймер долгого нажатия. Возвращает true для второго тапа подряд.\n */\n function beginTouch(e: PointerEvent): boolean {\n clearLongPress();\n const doubleDown = taps.down(sampleOf(e));\n longPressTimer = setTimeout(onLongPress, LONG_PRESS_MS);\n return doubleDown;\n }\n\n /**\n * A finger lies without moving: this is the touch right click. On a node or a link the app's context menu opens\n * (when it has one); on an empty place, or when the app shows no menu, the palette opens (an empty place only).\n * Палец лежит и не двигается: это правый клик сенсора. На ноде или связи открывается контекстное меню приложения\n * (если оно есть); на пустом месте, или когда меню приложение не показало, открывается палитра (только на пустом месте).\n */\n function onLongPress() {\n longPressTimer = undefined;\n const onNode = mode === 'drag' && armed !== null; // a finger on a node that has not started dragging it / палец на ноде, которую он ещё не потащил\n if ((mode !== 'pan' && !onNode) || !taps.longPressDue(performance.now() + 50)) return;\n\n const target: ContextTarget = armed\n ? { kind: 'node', nodeId: armed }\n : armedConn\n ? { kind: 'link', id: armedConn }\n : { kind: 'empty' };\n const rect = root.value!.getBoundingClientRect();\n const handled = host.contextMenu?.([lastX - rect.left, lastY - rect.top], screenToWorld(host.camera, lastX - rect.left, lastY - rect.top), target) ?? false;\n // A node with no menu to show: nothing happens, as before (a hold on a node may still turn into a drag).\n // Ноде показывать нечего: ничего не происходит, как раньше (удержание на ноде ещё может стать перетаскиванием).\n if (!handled && target.kind !== 'empty') return;\n\n // The capture is not released: the menu or the palette opens under the finger, and without the capture pointerup would go to it, not to the canvas.\n // Захват не отпускаем: меню или палитра открывается под пальцем, и без захвата pointerup ушёл бы на неё, а не на холст.\n taps.cancel();\n armed = null;\n armedConn = null;\n mode = 'idle';\n navigator.vibrate?.(15);\n if (!handled) openPaletteAt({ clientX: lastX, clientY: lastY }, null);\n note('long press');\n }\n\n /**\n * A finger was lifted or cancelled anywhere in the window, not only over the canvas: for example, over a palette that opened\n * under it. The canvas must stop counting this finger as lying down, otherwise it stays \"the second\" forever.\n * Палец поднят или отменён где угодно в окне, а не только над холстом: например, над палитрой, которая открылась\n * под ним. Холст должен перестать считать этот палец лежащим, иначе он останется «вторым» навсегда.\n */\n function purgeTouch(e: PointerEvent) {\n if (e.pointerType !== 'touch' || !touches.delete(e.pointerId)) return;\n if (mode !== 'pinch') return;\n if (touches.size === 0) mode = 'idle';\n else rebasePinch();\n }\n\n /**\n * The intent became clear (the finger started dragging or was lifted): select and raise the node it landed on.\n * Намерение стало ясно (палец пошёл тянуть или поднят): выделяем и поднимаем ноду, на которую он лёг.\n */\n function commitArmed() {\n const id = armed;\n armed = null;\n if (!id) return;\n\n host.selectConnection(null);\n // Resizing selects only its own node; dragging keeps the selection if the node is already in it.\n // Изменение размера выделяет только свою ноду; перетаскивание сохраняет выделение, если нода уже в нём.\n if (mode === 'resize' || !host.selection.has(id)) host.setSelection([id]);\n host.raise?.(id);\n if (mode === 'drag') host.beginDrag(id);\n }\n\n /**\n * A finger was lifted. Returns true if the event was handled entirely (a pinch is going on).\n * Палец поднят. Возвращает true, если событие обработано целиком (идёт щипок).\n */\n function touchUp(e: PointerEvent): boolean {\n touches.delete(e.pointerId);\n\n if (mode === 'pinch') {\n if (touches.size === 0) {\n mode = 'idle';\n note('pinch ended');\n } else {\n rebasePinch();\n }\n releaseCapture(e);\n return true;\n }\n\n clearLongPress();\n lastTouchAt = Date.now();\n const result = taps.up(sampleOf(e));\n commitArmed(); // a tap or a hold without movement / тап или удержание без сдвига\n const onLine = armedConn !== null; // the finger landed on a link (a tap on it is not \"an empty place\") / палец лёг на связь (тап по ней не «пустое место»)\n if (armedConn) {\n const id = armedConn;\n armedConn = null;\n if (!taps.isMoved) {\n host.setSelection([]);\n host.selectConnection(id);\n }\n }\n if (result === 'double') {\n activateAt(e);\n note('double tap');\n } else if (result === 'tap') {\n // A tap on an empty place clears the selection (we did not touch it on contact: the finger might go and move the canvas).\n // Тап по пустому месту снимает выделение (мы не трогали его при касании: палец мог пойти двигать холст).\n if (mode === 'pan' && !onLine) {\n host.setSelection([]);\n host.selectConnection(null);\n }\n note('tap');\n }\n return false;\n }\n\n /**\n * The set of fingers changed (a second one landed, one was lifted): the gesture is counted from scratch, no jump.\n * Набор пальцев изменился (лёг второй, подняли один): отсчёт жеста начинается заново, скачка нет.\n */\n function rebasePinch() {\n const [a, b] = [...touches.values()];\n if (a) pinch.begin(pinchOf(a, b));\n }\n\n /**\n * The browser sends finger movement as separate events: one finger moved, then the other. Between them the distance\n * between the fingers \"jerks\" although the gesture is one. So the position of two fingers is processed once per frame, when\n * both have arrived.\n * Браузер присылает движение пальцев отдельными событиями: сдвинулся один палец, потом второй. Между ними расстояние\n * между пальцами «дёргается», хотя жест один. Поэтому положение двух пальцев разбираем один раз за кадр, когда\n * оба уже пришли.\n */\n let pinchFrame = 0;\n function schedulePinch() {\n if (pinchFrame) return;\n pinchFrame = requestAnimationFrame(() => {\n pinchFrame = 0;\n if (mode === 'pinch') pinchMove();\n });\n }\n\n /**\n * Pinch and a two-finger gesture; with one finger left we just move the canvas.\n * Щипок и жест двумя пальцами; с одним оставшимся пальцем просто двигаем холст.\n */\n function pinchMove() {\n const [a, b] = [...touches.values()];\n const el = root.value;\n if (!a || !el) return;\n\n const step = pinch.update(pinchOf(a, b));\n const rect = el.getBoundingClientRect();\n host.setCamera(panBy(zoomAt(host.camera, step.pivot[0] - rect.left, step.pivot[1] - rect.top, step.factor, zoomLimits(options.zoom)), step.pan[0], step.pan[1]));\n }\n\n //--------------------------------------------------\n\n function onPointerDown(e: PointerEvent) {\n const el = root.value;\n if (!el) return;\n altDown = e.altKey;\n\n const touch = e.pointerType === 'touch';\n if (touch && touchDown(e)) return; // a second finger: pinch / второй палец: щипок\n\n host.closePalette();\n lastX = e.clientX;\n lastY = e.clientY;\n panDistance = 0;\n const doubleDown = touch && beginTouch(e);\n\n if (e.button === 1 || e.button === 2) {\n el.focus();\n mode = 'pan';\n } else if (e.button === 0) {\n // A placing tool is armed: this press only says where, over a node and over a field inside it too (the person\n // chose the tool a moment ago, and a note under the cursor must not swallow the click).\n // Включён инструмент «поставить»: это нажатие лишь говорит куда, в том числе над нодой и над полем в ней (инструмент\n // выбрали только что, и заметка под курсором не должна глотать клик).\n if (host.placing && host.placeAt) {\n const rect = el.getBoundingClientRect();\n host.placeAt([e.clientX - rect.left, e.clientY - rect.top], cursorWorld(e));\n e.preventDefault();\n return;\n }\n\n const id = nodeIdAt(e.target);\n\n // An input field inside a node: select the node and hand the event to the field (focus, caret, text selection).\n // Поле ввода внутри ноды: выделяем ноду и отдаём событие полю (фокус, каретка, выделение текста).\n if (id && isEditable(e.target)) {\n if (touch) {\n armed = id; // select on release: the finger may turn out to be the start of a two-finger gesture / выделим при отпускании: палец может оказаться началом жеста двумя пальцами\n } else {\n host.raise?.(id);\n host.selectConnection(null);\n if (!host.selection.has(id)) host.setSelection([id]);\n }\n return;\n }\n\n el.focus();\n\n const connId = connIdAt(e.target);\n if (connId) {\n if (touch) {\n // The line is thin, and a finger on it more often starts moving the canvas than picking a link: behave as on an empty place.\n // Линия тонкая, и палец на ней чаще начинает двигать холст, чем выбирать связь: ведём себя как на пустом месте.\n armedConn = connId;\n mode = host.selectMode ? 'idle' : 'pan';\n e.preventDefault();\n capture(e);\n return;\n }\n host.setSelection([]);\n host.selectConnection(connId);\n e.preventDefault();\n return;\n }\n // On touch the link is deselected later (a tap on an empty place or the start of a frame), not on contact.\n // На сенсоре выбор связи снимаем позже (тап по пустому месту или начало рамки), а не при касании.\n if (!touch) host.selectConnection(null);\n\n const pin = host.connect ? options.pinAt(e.target) : null;\n // Touch has no Ctrl: its role is played by the \"Select\" mode.\n // На сенсоре Ctrl нет: его роль играет режим «Выделение».\n const additive = e.ctrlKey || e.shiftKey || (touch && !!host.selectMode);\n if (id && (!touch || additive)) host.raise?.(id);\n\n const resizeHandle = host.resize && id ? (e.target as Element).closest<HTMLElement>('[data-resize]') : null;\n\n if (pin && host.connect) {\n host.connect.start(pin, cursorWorld(e));\n mode = 'connect';\n } else if (id && resizeHandle && host.resize) {\n const rect = host.resize.rectOf(id);\n if (!rect) return;\n if (touch) armed = id;\n else host.setSelection([id]);\n resizeId = id;\n resizeEdge = resizeHandle.dataset.resize as ResizeEdge;\n resizeStart = rect;\n resizeDx = 0;\n resizeDy = 0;\n mode = 'resize';\n } else if (id) {\n if (additive) {\n host.toggleSelected(id);\n if (!host.selection.has(id)) return;\n host.beginDrag(id);\n } else if (touch) {\n armed = id; // selection and beginDrag: in commitArmed, when the finger started dragging / выделение и beginDrag: в commitArmed, когда палец пошёл тянуть\n } else {\n if (!host.selection.has(id)) host.setSelection([id]);\n host.beginDrag(id);\n }\n mode = 'drag';\n } else if (touch && !host.selectMode && !doubleDown) {\n // One finger on an empty place moves the canvas; the selection (if it was a tap) is cleared on release.\n // Один палец по пустому месту двигает холст; выделение (если тап) снимется при отпускании.\n mode = 'pan';\n note('pan');\n } else {\n if (touch) host.selectConnection(null);\n baseSelection = additive ? [...host.selection] : [];\n host.setSelection(baseSelection);\n marquee.value = { x0: e.clientX, y0: e.clientY, x1: e.clientX, y1: e.clientY };\n mode = 'marquee';\n if (touch) note('marquee');\n }\n } else {\n return;\n }\n\n e.preventDefault();\n capture(e);\n }\n\n /**\n * The gesture broke off and `pointerup` never came (alt-tab, the window was covered, the system took the pointer):\n * we close what was started so that nothing \"hangs\": a dragged link, the selection frame, a grabbed node.\n * What was done by then (a shift, a size) stays and goes into history.\n * Жест оборвался, а `pointerup` не пришёл (alt-tab, окно перекрыли, система забрала указатель):\n * закрываем начатое, чтобы ничего не «зависло»: протянутая связь, рамка выделения, захваченная нода.\n * Сделанное к этому моменту (сдвиг, размер) остаётся и записывается в историю.\n */\n function abortGesture() {\n clearLongPress();\n taps.cancel();\n armed = null;\n armedConn = null;\n if (mode === 'connect') {\n host.connect?.cancel();\n } else if (mode === 'drag' || mode === 'resize') {\n host.endDrag();\n host.commit();\n }\n mode = 'idle';\n marquee.value = null;\n stopAutoScroll();\n }\n\n /**\n * Abort everything, including fingers on the canvas (window focus lost, a system cancel).\n * Оборвать всё, включая пальцы на холсте (потеря фокуса окна, системная отмена).\n */\n function cancelGesture() {\n touches.clear();\n abortGesture();\n }\n\n function onPointerCancel(e: PointerEvent) {\n touches.delete(e.pointerId);\n if (mode === 'pinch' && touches.size > 0) {\n rebasePinch();\n return;\n }\n cancelGesture();\n }\n\n /**\n * The pointer capture is lost: if a gesture is still going and it is not a pinch (there the fingers are lifted by themselves), we break it.\n * Захват указателя пропал: если жест ещё идёт и это не щипок (там палец снимают сами), рвём его.\n */\n function onLostCapture() {\n if (mode === 'pinch' || mode === 'idle') return;\n cancelGesture();\n }\n\n //--------------------------------------------------\n // Auto-scroll: while you drag a node, a frame, a link or an edge and the cursor is at the canvas edge, the camera moves that way.\n // The loop runs even when the mouse stands still; speed is counted by time, not by frames.\n // Автопрокрутка: пока тянешь ноду, рамку, связь или край и курсор у края холста, камера едет в ту сторону.\n // Цикл крутится, даже когда мышь стоит; скорость считается по времени, а не по кадрам.\n\n const SCROLL_MODES: readonly Mode[] = ['drag', 'resize', 'marquee', 'connect'];\n\n const scroller = createEdgeScroller({\n bounds: () => root.value?.getBoundingClientRect() ?? null,\n pointer: () => [lastX, lastY],\n enabled: () => SCROLL_MODES.includes(mode),\n onScroll: autoScrollStep,\n });\n const kickAutoScroll = scroller.kick;\n const stopAutoScroll = scroller.stop;\n\n function autoScrollStep(sx: number, sy: number) {\n // The camera moved by (sx, sy) screen px, and what was under the cursor ended up aside:\n // we catch up with the cursor with whatever of the gesture is tied to the world.\n // Камера уехала на (sx, sy) экранных px, и то, что было под курсором, оказалось в стороне:\n // догоняем курсор тем, что у жеста привязано к миру.\n const z = host.camera.z;\n host.setCamera(panBy(host.camera, -sx, -sy));\n\n const pointer: Pointer = { clientX: lastX, clientY: lastY };\n if (mode === 'drag') {\n host.moveSelected(sx / z, sy / z, snapNow());\n } else if (mode === 'resize') {\n resizeDx += sx / z;\n resizeDy += sy / z;\n host.resize?.from(resizeId, resizeEdge, resizeStart, resizeDx, resizeDy, snapNow());\n } else if (mode === 'connect') {\n host.connect?.update(cursorWorld(pointer), pinUnder(pointer));\n } else if (mode === 'marquee' && marquee.value) {\n // The start of the frame stands still in the world, so on screen it moved with the camera.\n // Начало рамки стоит на месте в мире, значит на экране уехало вместе с камерой.\n const m = marquee.value;\n marquee.value = { x0: m.x0 - sx, y0: m.y0 - sy, x1: lastX, y1: lastY };\n host.setSelection([...baseSelection, ...nodesInMarquee()]);\n }\n }\n\n function onPointerMove(e: PointerEvent) {\n altDown = e.altKey;\n const touch = e.pointerType === 'touch';\n if (touch) {\n if (touches.has(e.pointerId)) touches.set(e.pointerId, { x: e.clientX, y: e.clientY });\n if (mode === 'pinch') {\n schedulePinch();\n return;\n }\n if (taps.move(sampleOf(e))) clearLongPress();\n // While the finger has not left the tap slop, the canvas and the nodes stand still: jitter must not move either.\n // Пока палец не вышел за допуск тапа, холст и ноды стоят: дрожание не должно двигать ни то, ни другое.\n if (!taps.isMoved && (mode === 'pan' || mode === 'drag' || mode === 'resize')) return;\n if (armed && (mode === 'drag' || mode === 'resize')) commitArmed();\n } else if (mode !== 'idle' && e.buttons === 0) {\n // The button was released somewhere outside the window: we did not see the event, but the movement shows the gesture is over.\n // Кнопку отпустили где-то вне окна: событие мы не увидели, но по движению видно, что жест окончен.\n cancelGesture();\n return;\n }\n\n const dx = e.clientX - lastX;\n const dy = e.clientY - lastY;\n lastX = e.clientX;\n lastY = e.clientY;\n\n if (mode === 'pan') {\n panDistance += Math.hypot(dx, dy);\n host.setCamera(panBy(host.camera, dx, dy));\n } else if (mode === 'drag') {\n host.moveSelected(dx / host.camera.z, dy / host.camera.z, snapNow());\n } else if (mode === 'resize') {\n resizeDx += dx / host.camera.z;\n resizeDy += dy / host.camera.z;\n host.resize?.from(resizeId, resizeEdge, resizeStart, resizeDx, resizeDy, snapNow());\n } else if (mode === 'connect') {\n host.connect?.update(cursorWorld(e), pinUnder(e));\n } else if (mode === 'marquee' && marquee.value) {\n marquee.value = { ...marquee.value, x1: e.clientX, y1: e.clientY };\n host.setSelection([...baseSelection, ...nodesInMarquee()]);\n }\n\n kickAutoScroll();\n }\n\n function onPointerUp(e: PointerEvent) {\n if (e.pointerType === 'touch' && touchUp(e)) return;\n if (mode === 'idle') return;\n if (mode === 'connect' && host.connect) {\n const under = document.elementFromPoint(e.clientX, e.clientY);\n const origin = host.connect.origin;\n const connected = host.connect.finish(pinUnder(e));\n\n // A link was released over an empty canvas: we offer to create a node and connect it.\n // Отпустили связь над пустым холстом: предлагаем создать ноду и подключить её.\n if (!connected && origin !== null && under && root.value?.contains(under) && !under.closest('[data-node-id]')) {\n openPaletteAt(e, origin);\n }\n } else if (mode === 'drag' || mode === 'resize') {\n host.endDrag();\n host.commit(); // a drag or a resize as a whole: one history step (nothing is recorded without a shift) / перетаскивание или изменение размера целиком: один шаг истории (без сдвига ничего не запишется)\n } else if (mode === 'pan' && e.button === 2 && panDistance < PAN_CLICK_THRESHOLD) {\n if (!openContextAt(e)) openPaletteAt(e, null);\n }\n mode = 'idle';\n marquee.value = null;\n stopAutoScroll();\n releaseCapture(e);\n }\n\n /**\n * Hotkeys on the whole window, so they work after a click on the toolbar too.\n * We look at the physical key (`code`) so that Ctrl+Z works in the Russian layout as well.\n * Горячие клавиши на всём окне, чтобы работали и после клика по панели инструментов.\n * Смотрим на физическую клавишу (`code`), чтобы Ctrl+Z работало и в русской раскладке.\n */\n function onKey(e: KeyboardEvent) {\n const tag = (e.target as HTMLElement | null)?.tagName;\n if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT' || (e.target as HTMLElement | null)?.isContentEditable) return;\n if (host.claimsKey?.(e)) return;\n\n if (e.ctrlKey || e.metaKey) {\n if (e.code === 'KeyZ' && !e.shiftKey) host.undo();\n else if (e.code === 'KeyY' || (e.code === 'KeyZ' && e.shiftKey)) host.redo();\n else return;\n } else if (e.key === 'Delete' || e.key === 'Backspace') {\n host.removeSelected();\n } else if (e.key === 'Escape') {\n host.closePalette();\n } else {\n return;\n }\n e.preventDefault();\n }\n\n /**\n * The double action (a double click or a double tap): on a link and on a node strip; what exactly happens\n * is decided by the app.\n * Двойное действие (двойной клик или двойной тап): по связи и по полосе ноды; что именно произойдёт,\n * решает приложение.\n */\n function activateAt(p: Pointer) {\n if (!host.activate) return;\n const under = document.elementFromPoint(p.clientX, p.clientY);\n const connId = connIdAt(under);\n if (connId) {\n host.activate({ kind: 'link', id: connId, at: cursorWorld(p), element: under });\n return;\n }\n\n const handle = (under as Element | null)?.closest('[data-node-handle]');\n const nodeId = handle ? nodeIdAt(handle) : null;\n if (nodeId) host.activate({ kind: 'handle', nodeId });\n }\n\n /**\n * The event arrives at the canvas (it holds the pointer capture). On touch we recognise the double tap ourselves, otherwise the action would fire twice.\n * Событие приходит на холст (он держит захват указателя). На сенсоре двойной тап распознаём сами, иначе действие сработало бы дважды.\n */\n function onDblClick(e: MouseEvent) {\n if (Date.now() - lastTouchAt < 800) return;\n activateAt(e);\n }\n\n /**\n * The wheel moves the canvas, zoom only with Ctrl/Cmd (a trackpad pinch arrives as Ctrl + wheel): so a wheel over a\n * scrollable note does not zoom the canvas the moment the cursor slips off its edge.\n * Колесо двигает холст, а масштаб только с Ctrl/Cmd (щипок тачпада приходит как Ctrl + колесо): так колесо над\n * заметкой, которую можно прокрутить, не масштабирует холст, стоит курсору случайно выйти за её край.\n */\n function onWheel(e: WheelEvent) {\n const el = root.value!;\n const zooming = e.ctrlKey || e.metaKey;\n\n // A wheel over a scrollable field (a long note) scrolls it instead of moving the canvas.\n // Колесо над прокручиваемым полем (длинная заметка) листает его, а не двигает холст.\n const field = (e.target as Element | null)?.closest('textarea');\n if (!zooming && field && field.scrollHeight > field.clientHeight) return;\n\n e.preventDefault();\n const rect = el.getBoundingClientRect();\n const intent = wheelIntent(e, rect.height);\n if (intent.kind === 'zoom') {\n host.setCamera(zoomAt(host.camera, e.clientX - rect.left, e.clientY - rect.top, intent.factor, zoomLimits(options.zoom)));\n } else {\n host.setCamera(panBy(host.camera, intent.dx, intent.dy));\n }\n }\n\n //--------------------------------------------------\n // Lifecycle\n // Жизненный цикл\n\n // The app needs the canvas size to place new nodes at the screen centre.\n // Размер холста нужен приложению, чтобы ставить новые ноды в центр экрана.\n let resizeObserver: ResizeObserver | null = null;\n\n onMounted(() => {\n const el = root.value!;\n const update = () => host.setViewport({ w: el.clientWidth, h: el.clientHeight });\n update();\n resizeObserver = new ResizeObserver(update);\n resizeObserver.observe(el);\n window.addEventListener('keydown', onKey);\n window.addEventListener('blur', cancelGesture);\n window.addEventListener('pointerup', purgeTouch);\n window.addEventListener('pointercancel', purgeTouch);\n });\n\n onUnmounted(() => {\n resizeObserver?.disconnect();\n window.removeEventListener('keydown', onKey);\n window.removeEventListener('blur', cancelGesture);\n window.removeEventListener('pointerup', purgeTouch);\n window.removeEventListener('pointercancel', purgeTouch);\n stopAutoScroll();\n clearLongPress();\n cancelAnimationFrame(pinchFrame);\n });\n\n // After the palette closes, focus returns to the canvas so that hotkeys work.\n // После закрытия палитры возвращаем фокус на холст, чтобы работали горячие клавиши.\n watch(\n () => host.paletteOpen,\n (now, before) => {\n if (!now && before) root.value?.focus();\n },\n );\n\n return {\n marquee,\n debug,\n debugText,\n handlers: {\n onPointerDown,\n onPointerMove,\n onPointerUp,\n onPointerCancel,\n onLostCapture,\n onWheel,\n onDblClick,\n },\n };\n}\n","<script lang=\"ts\" setup generic=\"P\">\nimport { computed, ref } from 'vue';\nimport { GRID } from '../snap';\nimport type { CanvasHost, CanvasOptions } from './host';\nimport { useCanvasGestures } from './useCanvasGestures';\n\nconst props = withDefaults(\n defineProps<{\n /**\n * The bridge to the app. Must be a stable object: the canvas takes it once.\n * Мост к приложению. Должен быть стабильным объектом: холст берёт его один раз.\n */\n host: CanvasHost<P>;\n options: CanvasOptions<P>;\n /**\n * The step of the fine background grid, world units.\n * Шаг мелкой сетки на фоне, мировые единицы.\n */\n grid?: number;\n /**\n * What is drawn on the background: `grid` (lines, the default), `dots` (a dot at every crossing, fewer details) or\n * `none`. It is only a look: snapping to the grid is the app's own setting.\n * Что нарисовано на фоне: `grid` (линии, по умолчанию), `dots` (точка в каждом пересечении, меньше деталей) или `none`.\n * Это только вид: привязка к сетке отдельная настройка приложения.\n */\n background?: 'grid' | 'dots' | 'none';\n }>(),\n { grid: GRID, background: 'grid' },\n);\n\nconst root = ref<HTMLElement | null>(null);\nconst { marquee, debug, debugText, handlers } = useCanvasGestures(root, props.host, props.options);\n\nconst world = computed(() => {\n const { x, y, z } = props.host.camera;\n return { transform: `translate(${x}px, ${y}px) scale(${z})` };\n});\n\nconst gridStyle = computed(() => {\n const { x, y, z } = props.host.camera;\n const small = props.grid * z;\n const big = small * 5;\n if (props.background === 'none') return { backgroundImage: 'none' };\n if (props.background === 'dots') {\n // Zoomed far out the dots of every step would turn into a haze: then every fifth step only.\n // При сильном отдалении точки каждого шага слились бы в дымку: тогда только каждого пятого.\n const step = small < 10 ? big : small;\n return {\n backgroundImage: 'radial-gradient(circle, var(--tx-canvas-dot, rgba(255, 255, 255, 0.1)) 1.1px, transparent 1.6px)',\n backgroundSize: `${step}px ${step}px`,\n // the dot sits in the middle of its tile: shift the tile so that dots lie on the grid lines / точка в середине плитки: сдвигаем плитку, чтобы точки лежали на линиях сетки\n backgroundPosition: `${x - step / 2}px ${y - step / 2}px`,\n };\n }\n return {\n backgroundSize: `${small}px ${small}px, ${small}px ${small}px, ${big}px ${big}px, ${big}px ${big}px`,\n backgroundPosition: `${x}px ${y}px`,\n };\n});\n\nconst marqueeStyle = computed(() => {\n const m = marquee.value;\n const rect = root.value?.getBoundingClientRect();\n if (!m || !rect) return {};\n return {\n left: `${Math.min(m.x0, m.x1) - rect.left}px`,\n top: `${Math.min(m.y0, m.y1) - rect.top}px`,\n width: `${Math.abs(m.x1 - m.x0)}px`,\n height: `${Math.abs(m.y1 - m.y0)}px`,\n };\n});\n\ndefineExpose({ root });\n</script>\n\n<template>\n <div\n ref=\"root\"\n class=\"tx-canvas\"\n :class=\"{ connecting: host.connect?.origin != null }\"\n tabindex=\"0\"\n :style=\"gridStyle\"\n @pointerdown=\"handlers.onPointerDown\"\n @pointermove=\"handlers.onPointerMove\"\n @pointerup=\"handlers.onPointerUp\"\n @pointercancel=\"handlers.onPointerCancel\"\n @lostpointercapture=\"handlers.onLostCapture\"\n @wheel=\"handlers.onWheel\"\n @contextmenu.prevent\n @dblclick=\"handlers.onDblClick\"\n >\n <!-- The world: the app puts containers, the links layer and nodes here in the right order. / Мир: сюда приложение кладёт контейнеры, слой связей и ноды в нужном порядке. -->\n <div class=\"tx-canvas-world\" :style=\"world\">\n <slot />\n </div>\n\n <div v-if=\"marquee\" class=\"tx-canvas-marquee\" :style=\"marqueeStyle\" />\n <div v-if=\"debug\" class=\"tx-canvas-debug\">{{ debugText }}</div>\n\n <!-- On top of the world, in screen coordinates. / Поверх мира, в экранных координатах. -->\n <slot name=\"overlay\" />\n </div>\n</template>\n\n<style>\n/*\n * Configured with CSS variables on the canvas or an ancestor:\n * Настройка через CSS-переменные на холсте или предке:\n * --tx-canvas-bg, --tx-canvas-grid-minor, --tx-canvas-grid-major, --tx-canvas-dot, --tx-canvas-accent, --tx-canvas-accent-subtle,\n * --tx-canvas-radius (the corners of the debug badge, 6px by default).\n * --tx-canvas-radius — углы отладочной плашки, по умолчанию 6px.\n */\n.tx-canvas {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: hidden;\n outline: none;\n background-color: var(--tx-canvas-bg, #1b1d21);\n background-image:\n linear-gradient(to right, var(--tx-canvas-grid-minor, rgba(255, 255, 255, 0.035)) 1px, transparent 1px),\n linear-gradient(to bottom, var(--tx-canvas-grid-minor, rgba(255, 255, 255, 0.035)) 1px, transparent 1px),\n linear-gradient(to right, var(--tx-canvas-grid-major, rgba(255, 255, 255, 0.07)) 1px, transparent 1px),\n linear-gradient(to bottom, var(--tx-canvas-grid-major, rgba(255, 255, 255, 0.07)) 1px, transparent 1px);\n touch-action: none;\n /* Touch: no text selection, magnifier or tap highlight; text in inputs is selected as usual. / Сенсор: без выделения текста, лупы и подсветки тапа; в полях ввода текст выделяется как обычно. */\n -webkit-user-select: none;\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n.tx-canvas textarea,\n.tx-canvas input {\n -webkit-user-select: text;\n user-select: text;\n}\n\n.tx-canvas-world {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n transform-origin: 0 0;\n}\n\n.tx-canvas-marquee {\n position: absolute;\n border: 1px solid var(--tx-canvas-accent, #f59e0b);\n background: var(--tx-canvas-accent-subtle, rgba(245, 158, 11, 0.1));\n pointer-events: none;\n}\n\n.tx-canvas-debug {\n position: absolute;\n left: 8px;\n bottom: 8px;\n padding: 4px 8px;\n border-radius: var(--tx-canvas-radius, 6px);\n background: rgba(0, 0, 0, 0.7);\n color: #fff;\n font: 12px/1.3 monospace;\n pointer-events: none;\n}\n</style>\n","<script lang=\"ts\" setup generic=\"P\">\nimport { computed, ref } from 'vue';\nimport { GRID } from '../snap';\nimport type { CanvasHost, CanvasOptions } from './host';\nimport { useCanvasGestures } from './useCanvasGestures';\n\nconst props = withDefaults(\n defineProps<{\n /**\n * The bridge to the app. Must be a stable object: the canvas takes it once.\n * Мост к приложению. Должен быть стабильным объектом: холст берёт его один раз.\n */\n host: CanvasHost<P>;\n options: CanvasOptions<P>;\n /**\n * The step of the fine background grid, world units.\n * Шаг мелкой сетки на фоне, мировые единицы.\n */\n grid?: number;\n /**\n * What is drawn on the background: `grid` (lines, the default), `dots` (a dot at every crossing, fewer details) or\n * `none`. It is only a look: snapping to the grid is the app's own setting.\n * Что нарисовано на фоне: `grid` (линии, по умолчанию), `dots` (точка в каждом пересечении, меньше деталей) или `none`.\n * Это только вид: привязка к сетке отдельная настройка приложения.\n */\n background?: 'grid' | 'dots' | 'none';\n }>(),\n { grid: GRID, background: 'grid' },\n);\n\nconst root = ref<HTMLElement | null>(null);\nconst { marquee, debug, debugText, handlers } = useCanvasGestures(root, props.host, props.options);\n\nconst world = computed(() => {\n const { x, y, z } = props.host.camera;\n return { transform: `translate(${x}px, ${y}px) scale(${z})` };\n});\n\nconst gridStyle = computed(() => {\n const { x, y, z } = props.host.camera;\n const small = props.grid * z;\n const big = small * 5;\n if (props.background === 'none') return { backgroundImage: 'none' };\n if (props.background === 'dots') {\n // Zoomed far out the dots of every step would turn into a haze: then every fifth step only.\n // При сильном отдалении точки каждого шага слились бы в дымку: тогда только каждого пятого.\n const step = small < 10 ? big : small;\n return {\n backgroundImage: 'radial-gradient(circle, var(--tx-canvas-dot, rgba(255, 255, 255, 0.1)) 1.1px, transparent 1.6px)',\n backgroundSize: `${step}px ${step}px`,\n // the dot sits in the middle of its tile: shift the tile so that dots lie on the grid lines / точка в середине плитки: сдвигаем плитку, чтобы точки лежали на линиях сетки\n backgroundPosition: `${x - step / 2}px ${y - step / 2}px`,\n };\n }\n return {\n backgroundSize: `${small}px ${small}px, ${small}px ${small}px, ${big}px ${big}px, ${big}px ${big}px`,\n backgroundPosition: `${x}px ${y}px`,\n };\n});\n\nconst marqueeStyle = computed(() => {\n const m = marquee.value;\n const rect = root.value?.getBoundingClientRect();\n if (!m || !rect) return {};\n return {\n left: `${Math.min(m.x0, m.x1) - rect.left}px`,\n top: `${Math.min(m.y0, m.y1) - rect.top}px`,\n width: `${Math.abs(m.x1 - m.x0)}px`,\n height: `${Math.abs(m.y1 - m.y0)}px`,\n };\n});\n\ndefineExpose({ root });\n</script>\n\n<template>\n <div\n ref=\"root\"\n class=\"tx-canvas\"\n :class=\"{ connecting: host.connect?.origin != null }\"\n tabindex=\"0\"\n :style=\"gridStyle\"\n @pointerdown=\"handlers.onPointerDown\"\n @pointermove=\"handlers.onPointerMove\"\n @pointerup=\"handlers.onPointerUp\"\n @pointercancel=\"handlers.onPointerCancel\"\n @lostpointercapture=\"handlers.onLostCapture\"\n @wheel=\"handlers.onWheel\"\n @contextmenu.prevent\n @dblclick=\"handlers.onDblClick\"\n >\n <!-- The world: the app puts containers, the links layer and nodes here in the right order. / Мир: сюда приложение кладёт контейнеры, слой связей и ноды в нужном порядке. -->\n <div class=\"tx-canvas-world\" :style=\"world\">\n <slot />\n </div>\n\n <div v-if=\"marquee\" class=\"tx-canvas-marquee\" :style=\"marqueeStyle\" />\n <div v-if=\"debug\" class=\"tx-canvas-debug\">{{ debugText }}</div>\n\n <!-- On top of the world, in screen coordinates. / Поверх мира, в экранных координатах. -->\n <slot name=\"overlay\" />\n </div>\n</template>\n\n<style>\n/*\n * Configured with CSS variables on the canvas or an ancestor:\n * Настройка через CSS-переменные на холсте или предке:\n * --tx-canvas-bg, --tx-canvas-grid-minor, --tx-canvas-grid-major, --tx-canvas-dot, --tx-canvas-accent, --tx-canvas-accent-subtle,\n * --tx-canvas-radius (the corners of the debug badge, 6px by default).\n * --tx-canvas-radius — углы отладочной плашки, по умолчанию 6px.\n */\n.tx-canvas {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: hidden;\n outline: none;\n background-color: var(--tx-canvas-bg, #1b1d21);\n background-image:\n linear-gradient(to right, var(--tx-canvas-grid-minor, rgba(255, 255, 255, 0.035)) 1px, transparent 1px),\n linear-gradient(to bottom, var(--tx-canvas-grid-minor, rgba(255, 255, 255, 0.035)) 1px, transparent 1px),\n linear-gradient(to right, var(--tx-canvas-grid-major, rgba(255, 255, 255, 0.07)) 1px, transparent 1px),\n linear-gradient(to bottom, var(--tx-canvas-grid-major, rgba(255, 255, 255, 0.07)) 1px, transparent 1px);\n touch-action: none;\n /* Touch: no text selection, magnifier or tap highlight; text in inputs is selected as usual. / Сенсор: без выделения текста, лупы и подсветки тапа; в полях ввода текст выделяется как обычно. */\n -webkit-user-select: none;\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n.tx-canvas textarea,\n.tx-canvas input {\n -webkit-user-select: text;\n user-select: text;\n}\n\n.tx-canvas-world {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n transform-origin: 0 0;\n}\n\n.tx-canvas-marquee {\n position: absolute;\n border: 1px solid var(--tx-canvas-accent, #f59e0b);\n background: var(--tx-canvas-accent-subtle, rgba(245, 158, 11, 0.1));\n pointer-events: none;\n}\n\n.tx-canvas-debug {\n position: absolute;\n left: 8px;\n bottom: 8px;\n padding: 4px 8px;\n border-radius: var(--tx-canvas-radius, 6px);\n background: rgba(0, 0, 0, 0.7);\n color: #fff;\n font: 12px/1.3 monospace;\n pointer-events: none;\n}\n</style>\n"],"mappings":";;;;;;;AAOA,IAAM,sBAAsB;;;;;;;;;AA6B5B,SAAgB,kBAAqB,MAA+B,MAAqB,SAA2B;CAChH,IAAI,OAAa;CACjB,IAAI,QAAQ;CACZ,IAAI,QAAQ;CACZ,IAAI,gBAA0B,CAAC;CAC/B,IAAI,cAAc;;;;;CAKlB,IAAI,UAAU;CACd,MAAM,iBAAiB,KAAK,eAAe,UAAU,CAAC;CACtD,IAAI,WAAW;CACf,IAAI,aAAyB;CAC7B,IAAI,cAAoB;EAAE,GAAG;EAAG,GAAG;EAAG,GAAG;EAAG,GAAG;CAAE;;;;;CAKjD,IAAI,WAAW;CACf,IAAI,WAAW;CAIf,MAAM,0BAAU,IAAI,IAAsC;CAC1D,MA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A,OAAA,OAAA,MAAE,GAAA,SAAAA,MAAA,QAAA,CAAQ,CAAC,WAATA,MAAA,QAAA,CAAQ,CAAC,QAAO,GAAA,IAAA;IACvB,eAAW,OAAA,OAAA,OAAA,KAAAC,oBAAZ,CAAA,GAAoB,CAAA,SAAA,CAAA;IACnB,YAAQ,OAAA,OAAA,OAAA,MAAE,GAAA,SAAAD,MAAA,QAAA,CAAQ,CAAC,cAATA,MAAA,QAAA,CAAQ,CAAC,WAAU,GAAA,IAAA;;IAG9BE,mBAEM,OAAA;KAFD,OAAM;KAAmB,OAAKH,eAAE,MAAA,KAAK;I,IACtCI,WAAQ,KAAA,QAAA,SAAA,C;IAGDH,MAAA,OAAA,KAAXJ,UAAA,GAAAC,mBAAsE,OAAA;;KAAlD,OAAM;KAAqB,OAAKE,eAAE,aAAA,KAAY;;IACvDC,MAAA,KAAA,KAAXJ,UAAA,GAAAC,mBAA+D,OAA/D,YAA+DQ,gBAAlBL,MAAA,SAAA,CAAS,GAAA,CAAA,K;IAGtDG,WAAuB,KAAA,QAAA,SAAA"}
|
|
1
|
+
{"version":3,"file":"canvas.js","names":["_openBlock","_createElementBlock","_normalizeClass","_normalizeStyle","_unref","_withModifiers","_createElementVNode","_renderSlot","_createCommentVNode","_toDisplayString","_sfc_main"],"sources":["../src/canvas/glide.ts","../src/canvas/useCanvasGestures.ts","../src/canvas/TaoxCanvas.vue","../src/canvas/TaoxCanvas.vue"],"sourcesContent":["/**\n * The glide of the camera after a pan: if the pointer is released while still moving, the camera keeps going and slows\n * down smoothly. Pure arithmetic (no DOM, no timers), so it is unit-tested; the gesture machine only feeds it samples.\n * Скольжение камеры после перетаскивания: если указатель отпустили на ходу, камера продолжает движение и плавно\n * тормозит. Чистая арифметика (без DOM и таймеров), поэтому проверяется тестом; машина жестов лишь подаёт отсчёты.\n */\nexport interface GlideOptions {\n /**\n * Time constant of the slowing down, ms: the speed falls `e` times over it (the camera travels about speed × this in\n * total). Default 140.\n * Постоянная времени торможения, мс: за неё скорость падает в `e` раз (камера проедет примерно скорость × это).\n * По умолчанию 140.\n */\n friction?: number;\n /**\n * A release slower than this (px/ms) does not start a glide: a careful drag, a small jerk or a tremor of the hand must\n * not glide. Default 0.4 (400 px/s, a clear flick).\n * Отпускание медленнее этого (px/мс) скольжения не запускает: аккуратная протяжка, небольшой рывок или дрожь руки не\n * должны скользить. По умолчанию 0.4 (400 px/с, явный бросок).\n */\n minSpeed?: number;\n /**\n * The speed is not allowed to exceed this (px/ms). Default 6.\n * Скорость не больше этого (px/мс). По умолчанию 6.\n */\n maxSpeed?: number;\n}\n\nexport const GLIDE_DEFAULTS = { friction: 140, minSpeed: 0.4, maxSpeed: 6 } as const;\n/** A glide slower than this (px/ms) is over. / Скольжение медленнее этого (px/мс) окончено. */\nexport const STOP_SPEED = 0.03;\n/**\n * How far back the release speed is measured, ms. Short on purpose: a flick starts from rest and speeds up, and a longer\n * window would average the slow start in and make a short push too weak to glide.\n * За какое время до отпускания меряется скорость, мс. Намеренно короткое: бросок начинается с места и разгоняется, а\n * длинное окно усреднило бы медленное начало, и короткий толчок не хватал бы на скольжение.\n */\nexport const VELOCITY_WINDOW = 40;\n/** A pointer held still this long before the release does not glide (the person stopped on purpose), ms. / Указатель, который перед отпусканием стоял столько, не скользит (человек остановился намеренно), мс. */\nexport const HOLD_STILL = 90;\n\nexport interface PanSample {\n /** Time, ms. */\n t: number;\n dx: number;\n dy: number;\n}\n\n/**\n * The release velocity (px/ms) from the last samples, or null when there should be no glide: nothing measured, the\n * pointer stood still before the release, or it was slower than `minSpeed`.\n * Скорость в момент отпускания (px/мс) по последним отсчётам, либо null, если скользить не надо: ничего не измерено,\n * указатель перед отпусканием стоял или он медленнее `minSpeed`.\n */\nexport function releaseVelocity(samples: readonly PanSample[], now: number, options: GlideOptions = {}): [number, number] | null {\n const { minSpeed, maxSpeed } = { ...GLIDE_DEFAULTS, ...options };\n const from = samples.findIndex((s) => now - s.t <= VELOCITY_WINDOW);\n const recent = from < 0 ? [] : samples.slice(from);\n const last = recent[recent.length - 1];\n if (!last || now - last.t > HOLD_STILL) return null;\n\n // A sample is the movement that ended at its time, so the span starts at the sample before the first one used.\n // Отсчёт это сдвиг, закончившийся в его момент, поэтому отрезок времени начинается с отсчёта перед первым взятым.\n const start = from > 0 ? samples[from - 1]!.t : recent[0]!.t - 16;\n const span = Math.max(last.t - start, 16);\n const sx = recent.reduce((s, p) => s + p.dx, 0);\n const sy = recent.reduce((s, p) => s + p.dy, 0);\n let vx = sx / span;\n let vy = sy / span;\n\n const speed = Math.hypot(vx, vy);\n if (speed < minSpeed) return null;\n if (speed > maxSpeed) {\n vx = (vx / speed) * maxSpeed;\n vy = (vy / speed) * maxSpeed;\n }\n return [vx, vy];\n}\n\nexport interface GlideStep {\n /** How far the camera moves in this step, px. */\n dx: number;\n dy: number;\n /** The speed after the step, px/ms. */\n v: [number, number];\n /** The glide is over. */\n done: boolean;\n}\n\n/**\n * One step of `dt` ms. The speed decays exponentially and the distance is its exact integral, so the glide does not\n * depend on the frame rate (a slow frame travels as far as the fast ones it replaces).\n * Один шаг в `dt` мс. Скорость затухает по экспоненте, а путь это её точный интеграл, поэтому скольжение не зависит\n * от частоты кадров (медленный кадр проезжает столько же, сколько заменённые им быстрые).\n */\nexport function glideStep(v: readonly [number, number], dt: number, options: GlideOptions = {}): GlideStep {\n const { friction } = { ...GLIDE_DEFAULTS, ...options };\n const decay = Math.exp(-dt / friction);\n const k = friction * (1 - decay);\n const next: [number, number] = [v[0] * decay, v[1] * decay];\n return { dx: v[0] * k, dy: v[1] * k, v: next, done: Math.hypot(next[0], next[1]) < STOP_SPEED };\n}\n","import { onMounted, onUnmounted, ref, watch, type Ref } from 'vue';\nimport { glideStep, releaseVelocity, type GlideOptions, type PanSample } from './glide';\nimport { panBy, screenToWorld, zoomAt, zoomLimits } from '../camera';\nimport { createEdgeScroller } from '../edgescroll';\nimport { LONG_PRESS_MS, PinchTracker, TapRecognizer, pinchOf, type Sample } from '../gestures';\nimport { wheelIntent } from '../wheel';\nimport type { CanvasHost, CanvasOptions, ContextTarget, Point, Rect, ResizeEdge } from './host';\n\nconst PAN_CLICK_THRESHOLD = 4; // a right button moved less than this is a click (it opens the palette) / ПКМ, сдвинутая меньше, это клик (открывает палитру)\n\n/**\n * Everything that must be known about the pointer position: both a real event and the last known position will do.\n * Всё, что нужно знать о положении указателя: годится и настоящее событие, и последнее известное положение.\n */\ntype Pointer = Pick<MouseEvent, 'clientX' | 'clientY'>;\n\ntype Mode = 'idle' | 'pan' | 'drag' | 'marquee' | 'connect' | 'resize' | 'pinch';\n\n/**\n * The selection frame in client coordinates.\n * Рамка выделения в клиентских координатах.\n */\nexport interface Marquee {\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n}\n\n/**\n * The canvas gesture machine: mouse, touch (tap, double tap, long press, pinch), wheel, auto-scroll at the edge,\n * keys. It does not know the data model: the app decides through `host`.\n * The host is taken once at creation: it must be a stable object.\n * Машина жестов холста: мышь, сенсор (тап, двойной тап, долгое нажатие, щипок), колесо, автопрокрутка у края,\n * клавиши. Не знает модель данных: решения принимает приложение через `host`.\n * Хост берётся один раз при создании: он должен быть стабильным объектом.\n */\nexport function useCanvasGestures<P>(root: Ref<HTMLElement | null>, host: CanvasHost<P>, options: CanvasOptions<P>) {\n let mode: Mode = 'idle';\n let lastX = 0;\n let lastY = 0;\n let baseSelection: string[] = [];\n let panDistance = 0;\n /**\n * The last moves of a pan, for the glide after the release (see `CanvasOptions.inertia`).\n * Последние сдвиги перетаскивания холста, для скольжения после отпускания (см. `CanvasOptions.inertia`).\n */\n let panSamples: PanSample[] = [];\n let glideFrame = 0;\n const glideOptions = (): GlideOptions | null => {\n if (!options.inertia) return null;\n if (typeof window !== 'undefined' && window.matchMedia?.('(prefers-reduced-motion: reduce)').matches) return null;\n return options.inertia === true ? {} : options.inertia;\n };\n function stopGlide() {\n if (glideFrame) cancelAnimationFrame(glideFrame);\n glideFrame = 0;\n }\n function startGlide(v: [number, number], opts: GlideOptions) {\n stopGlide();\n let velocity = v;\n let last = performance.now();\n const frame = (now: number) => {\n const dt = Math.min(now - last, 64); // a stalled tab must not throw the camera across the world\n last = now;\n const step = glideStep(velocity, dt, opts);\n host.setCamera(panBy(host.camera, step.dx, step.dy));\n velocity = step.v;\n glideFrame = step.done ? 0 : requestAnimationFrame(frame);\n };\n glideFrame = requestAnimationFrame(frame);\n }\n /**\n * Alt is held: grid snapping is temporarily off. Remembered so that auto-scroll (no event) knows it too.\n * Alt зажат: привязка к сетке временно отключена. Запоминаем, чтобы автопрокрутка (без события) тоже знала.\n */\n let altDown = false;\n const snapNow = () => (host.snapEnabled ?? false) && !altDown;\n let resizeId = '';\n let resizeEdge: ResizeEdge = 'se';\n let resizeStart: Rect = { x: 0, y: 0, w: 0, h: 0 };\n /**\n * Mouse shift since the resize began, world units.\n * Сдвиг мыши с начала изменения размера, мировые единицы.\n */\n let resizeDx = 0;\n let resizeDy = 0;\n\n // Touch: fingers on the canvas, recognition of taps and long press, pinch state.\n // Сенсор: пальцы на холсте, распознавание тапов и долгого нажатия, состояние щипка.\n const touches = new Map<number, { x: number; y: number }>();\n const taps = new TapRecognizer();\n let longPressTimer: ReturnType<typeof setTimeout> | undefined;\n let lastTouchAt = 0;\n const pinch = new PinchTracker();\n /**\n * The node a finger landed on: its selection and raise are postponed until the intent is clear. The touch may still\n * turn out to be the start of a two-finger gesture, and then the user's existing selection must not be lost.\n * We select when the finger started dragging (left the slop) or was lifted (tap, hold).\n * Нода, на которую лёг палец: её выделение и подъём откладываются, пока не ясно намерение. Касание ещё может\n * оказаться началом жеста двумя пальцами, и тогда выделение, которое было у пользователя, не должно слететь.\n * Выделяем, когда палец пошёл тянуть (вышел за допуск) или поднят (тап, удержание).\n */\n let armed: string | null = null;\n /**\n * The link a finger landed on: as with a node, it is selected only if this is a tap (the finger did not go to move the canvas).\n * Связь, на которую лёг палец: как с нодой, выбираем её только если это тап (палец не пошёл двигать холст).\n */\n let armedConn: string | null = null;\n\n /**\n * `?debug=touch`: the last recognised gesture and the number of fingers show in the corner.\n * `?debug=touch`: в углу видно последний распознанный жест и число пальцев.\n */\n const debug = typeof location !== 'undefined' && new URLSearchParams(location.search).get('debug') === 'touch';\n const debugText = ref('');\n const note = (label: string) => {\n if (debug) debugText.value = `${label} · fingers: ${touches.size}`;\n };\n\n const marquee = ref<Marquee | null>(null);\n\n //--------------------------------------------------\n // DOM\n\n const nodeIdAt = (target: EventTarget | null) =>\n (target as HTMLElement | null)?.closest<HTMLElement>('[data-node-id]')?.dataset.nodeId ?? null;\n\n const connIdAt = (target: EventTarget | null) =>\n (target as Element | null)?.closest<HTMLElement>('[data-conn-id]')?.dataset.connId ?? null;\n\n /**\n * Input fields inside nodes: a click on them selects the node but does not drag it and does not take focus away.\n * Поля ввода внутри нод: клик по ним выделяет ноду, но не тащит её и не отбирает фокус.\n */\n const isEditable = (target: EventTarget | null) =>\n !!(target as Element | null)?.closest('input, textarea, select, button, label, a[href], [contenteditable=\"true\"], [role=\"checkbox\"], [role=\"radio\"], [role=\"switch\"]');\n\n /**\n * The pin under the cursor: the nearest pin (if the app can) or the one exactly under the pointer.\n * Пин под курсором: ближайший пин (если приложение умеет) или тот, что точно под указателем.\n */\n const pinUnder = (e: Pointer): P | null =>\n options.pinNear?.(e) ?? options.pinAt(document.elementFromPoint(e.clientX, e.clientY));\n\n function cursorWorld(e: Pointer): Point {\n const rect = root.value!.getBoundingClientRect();\n return screenToWorld(host.camera, e.clientX - rect.left, e.clientY - rect.top);\n }\n\n /**\n * A right click: ask the app for a menu for what lies under the pointer. True when it showed one.\n * Правый клик: просим у приложения меню для того, что под указателем. True, если оно его показало.\n */\n function openContextAt(e: Pointer): boolean {\n if (!host.contextMenu) return false;\n const under = document.elementFromPoint(e.clientX, e.clientY);\n const link = connIdAt(under);\n const node = nodeIdAt(under);\n const target: ContextTarget = link ? { kind: 'link', id: link } : node ? { kind: 'node', nodeId: node } : { kind: 'empty' };\n const rect = root.value!.getBoundingClientRect();\n return host.contextMenu([e.clientX - rect.left, e.clientY - rect.top], cursorWorld(e), target);\n }\n\n function openPaletteAt(e: Pointer, origin: P | null) {\n const rect = root.value!.getBoundingClientRect();\n host.openPalette([e.clientX - rect.left, e.clientY - rect.top], cursorWorld(e), origin);\n }\n\n function nodesInMarquee(): string[] {\n const m = marquee.value;\n if (!m || !root.value) return [];\n\n const left = Math.min(m.x0, m.x1);\n const right = Math.max(m.x0, m.x1);\n const top = Math.min(m.y0, m.y1);\n const bottom = Math.max(m.y0, m.y1);\n\n const ids: string[] = [];\n for (const el of root.value.querySelectorAll<HTMLElement>('[data-node-id]')) {\n // A container is selected only by its strip: otherwise any frame would pick the whole group.\n // Контейнер выделяется только за полосу: иначе любая рамка выбирала бы всю группу целиком.\n const area = el.hasAttribute('data-node-container') ? (el.querySelector('[data-node-handle]') ?? el) : el;\n const r = area.getBoundingClientRect();\n const hit =\n options.marquee === 'contain'\n ? r.left >= left && r.right <= right && r.top >= top && r.bottom <= bottom\n : r.left < right && r.right > left && r.top < bottom && r.bottom > top;\n if (hit) ids.push(el.dataset.nodeId!);\n }\n return ids;\n }\n\n //--------------------------------------------------\n\n const sampleOf = (e: PointerEvent): Sample => ({ x: e.clientX, y: e.clientY, t: performance.now() });\n\n function capture(e: PointerEvent) {\n try {\n root.value?.setPointerCapture(e.pointerId);\n } catch {\n // the pointer has already gone: nothing to capture\n // указатель уже ушёл: захватывать нечего\n }\n }\n\n function releaseCapture(e: { pointerId: number }) {\n try {\n root.value?.releasePointerCapture(e.pointerId);\n } catch {\n // the capture is already gone\n // захвата уже нет\n }\n }\n\n function clearLongPress() {\n clearTimeout(longPressTimer);\n longPressTimer = undefined;\n }\n\n //--------------------------------------------------\n // Touch\n // Сенсор\n\n /**\n * A second finger landed on the canvas: the gesture in progress is cancelled and a pinch begins. Returns true if the event was handled.\n * Второй палец лёг на холст: начатый жест отменяется, начинается щипок. Возвращает true, если событие обработано.\n */\n function touchDown(e: PointerEvent): boolean {\n // The primary finger is the start of a new touch: there are no other fingers on screen now. Whatever we remember is stale\n // (a pointerup went past the canvas, for example onto a palette opened by a long press), and it must be forgotten, otherwise\n // the next tap would count as a second finger and turn the pinch on for good.\n // Первичный палец это начало нового касания: других пальцев на экране сейчас нет. Всё, что мы помним, зависло\n // (pointerup ушёл мимо холста, например на палитру, открытую долгим нажатием), и его надо забыть, иначе\n // следующий тап посчитается вторым пальцем и включит щипок насовсем.\n if (e.isPrimary) {\n touches.clear();\n armed = null;\n armedConn = null;\n if (mode !== 'idle') abortGesture();\n }\n\n touches.set(e.pointerId, { x: e.clientX, y: e.clientY });\n if (touches.size < 2) return false;\n\n host.closePalette();\n abortGesture();\n mode = 'pinch';\n rebasePinch();\n capture(e);\n e.preventDefault();\n note('pinch');\n return true;\n }\n\n /**\n * A finger landed on the canvas (the first one): remembered for a tap, and the long-press timer is set. Returns true for a second tap in a row.\n * Палец лёг на холст (первый): запоминаем для тапа и ставим таймер долгого нажатия. Возвращает true для второго тапа подряд.\n */\n function beginTouch(e: PointerEvent): boolean {\n clearLongPress();\n const doubleDown = taps.down(sampleOf(e));\n longPressTimer = setTimeout(onLongPress, LONG_PRESS_MS);\n return doubleDown;\n }\n\n /**\n * A finger lies without moving: this is the touch right click. On a node or a link the app's context menu opens\n * (when it has one); on an empty place, or when the app shows no menu, the palette opens (an empty place only).\n * Палец лежит и не двигается: это правый клик сенсора. На ноде или связи открывается контекстное меню приложения\n * (если оно есть); на пустом месте, или когда меню приложение не показало, открывается палитра (только на пустом месте).\n */\n function onLongPress() {\n longPressTimer = undefined;\n const onNode = mode === 'drag' && armed !== null; // a finger on a node that has not started dragging it / палец на ноде, которую он ещё не потащил\n if ((mode !== 'pan' && !onNode) || !taps.longPressDue(performance.now() + 50)) return;\n\n const target: ContextTarget = armed\n ? { kind: 'node', nodeId: armed }\n : armedConn\n ? { kind: 'link', id: armedConn }\n : { kind: 'empty' };\n const rect = root.value!.getBoundingClientRect();\n const handled = host.contextMenu?.([lastX - rect.left, lastY - rect.top], screenToWorld(host.camera, lastX - rect.left, lastY - rect.top), target) ?? false;\n // A node with no menu to show: nothing happens, as before (a hold on a node may still turn into a drag).\n // Ноде показывать нечего: ничего не происходит, как раньше (удержание на ноде ещё может стать перетаскиванием).\n if (!handled && target.kind !== 'empty') return;\n\n // The capture is not released: the menu or the palette opens under the finger, and without the capture pointerup would go to it, not to the canvas.\n // Захват не отпускаем: меню или палитра открывается под пальцем, и без захвата pointerup ушёл бы на неё, а не на холст.\n taps.cancel();\n armed = null;\n armedConn = null;\n mode = 'idle';\n navigator.vibrate?.(15);\n if (!handled) openPaletteAt({ clientX: lastX, clientY: lastY }, null);\n note('long press');\n }\n\n /**\n * A finger was lifted or cancelled anywhere in the window, not only over the canvas: for example, over a palette that opened\n * under it. The canvas must stop counting this finger as lying down, otherwise it stays \"the second\" forever.\n * Палец поднят или отменён где угодно в окне, а не только над холстом: например, над палитрой, которая открылась\n * под ним. Холст должен перестать считать этот палец лежащим, иначе он останется «вторым» навсегда.\n */\n function purgeTouch(e: PointerEvent) {\n if (e.pointerType !== 'touch' || !touches.delete(e.pointerId)) return;\n if (mode !== 'pinch') return;\n if (touches.size === 0) mode = 'idle';\n else rebasePinch();\n }\n\n /**\n * The intent became clear (the finger started dragging or was lifted): select and raise the node it landed on.\n * Намерение стало ясно (палец пошёл тянуть или поднят): выделяем и поднимаем ноду, на которую он лёг.\n */\n function commitArmed() {\n const id = armed;\n armed = null;\n if (!id) return;\n\n host.selectConnection(null);\n // Resizing selects only its own node; dragging keeps the selection if the node is already in it.\n // Изменение размера выделяет только свою ноду; перетаскивание сохраняет выделение, если нода уже в нём.\n if (mode === 'resize' || !host.selection.has(id)) host.setSelection([id]);\n host.raise?.(id);\n if (mode === 'drag') host.beginDrag(id);\n }\n\n /**\n * A finger was lifted. Returns true if the event was handled entirely (a pinch is going on).\n * Палец поднят. Возвращает true, если событие обработано целиком (идёт щипок).\n */\n function touchUp(e: PointerEvent): boolean {\n touches.delete(e.pointerId);\n\n if (mode === 'pinch') {\n if (touches.size === 0) {\n mode = 'idle';\n note('pinch ended');\n } else {\n rebasePinch();\n }\n releaseCapture(e);\n return true;\n }\n\n clearLongPress();\n lastTouchAt = Date.now();\n const result = taps.up(sampleOf(e));\n commitArmed(); // a tap or a hold without movement / тап или удержание без сдвига\n const onLine = armedConn !== null; // the finger landed on a link (a tap on it is not \"an empty place\") / палец лёг на связь (тап по ней не «пустое место»)\n if (armedConn) {\n const id = armedConn;\n armedConn = null;\n if (!taps.isMoved) {\n host.setSelection([]);\n host.selectConnection(id);\n }\n }\n if (result === 'double') {\n activateAt(e);\n note('double tap');\n } else if (result === 'tap') {\n // A tap on an empty place clears the selection (we did not touch it on contact: the finger might go and move the canvas).\n // Тап по пустому месту снимает выделение (мы не трогали его при касании: палец мог пойти двигать холст).\n if (mode === 'pan' && !onLine) {\n host.setSelection([]);\n host.selectConnection(null);\n }\n note('tap');\n }\n return false;\n }\n\n /**\n * The set of fingers changed (a second one landed, one was lifted): the gesture is counted from scratch, no jump.\n * Набор пальцев изменился (лёг второй, подняли один): отсчёт жеста начинается заново, скачка нет.\n */\n function rebasePinch() {\n const [a, b] = [...touches.values()];\n if (a) pinch.begin(pinchOf(a, b));\n }\n\n /**\n * The browser sends finger movement as separate events: one finger moved, then the other. Between them the distance\n * between the fingers \"jerks\" although the gesture is one. So the position of two fingers is processed once per frame, when\n * both have arrived.\n * Браузер присылает движение пальцев отдельными событиями: сдвинулся один палец, потом второй. Между ними расстояние\n * между пальцами «дёргается», хотя жест один. Поэтому положение двух пальцев разбираем один раз за кадр, когда\n * оба уже пришли.\n */\n let pinchFrame = 0;\n function schedulePinch() {\n if (pinchFrame) return;\n pinchFrame = requestAnimationFrame(() => {\n pinchFrame = 0;\n if (mode === 'pinch') pinchMove();\n });\n }\n\n /**\n * Pinch and a two-finger gesture; with one finger left we just move the canvas.\n * Щипок и жест двумя пальцами; с одним оставшимся пальцем просто двигаем холст.\n */\n function pinchMove() {\n const [a, b] = [...touches.values()];\n const el = root.value;\n if (!a || !el) return;\n\n const step = pinch.update(pinchOf(a, b));\n const rect = el.getBoundingClientRect();\n host.setCamera(panBy(zoomAt(host.camera, step.pivot[0] - rect.left, step.pivot[1] - rect.top, step.factor, zoomLimits(options.zoom)), step.pan[0], step.pan[1]));\n }\n\n //--------------------------------------------------\n\n function onPointerDown(e: PointerEvent) {\n const el = root.value;\n if (!el) return;\n altDown = e.altKey;\n\n const touch = e.pointerType === 'touch';\n if (touch && touchDown(e)) return; // a second finger: pinch / второй палец: щипок\n\n host.closePalette();\n stopGlide();\n panSamples = [];\n lastX = e.clientX;\n lastY = e.clientY;\n panDistance = 0;\n const doubleDown = touch && beginTouch(e);\n\n if (e.button === 1 || e.button === 2) {\n el.focus();\n mode = 'pan';\n } else if (e.button === 0) {\n // A placing tool is armed: this press only says where, over a node and over a field inside it too (the person\n // chose the tool a moment ago, and a note under the cursor must not swallow the click).\n // Включён инструмент «поставить»: это нажатие лишь говорит куда, в том числе над нодой и над полем в ней (инструмент\n // выбрали только что, и заметка под курсором не должна глотать клик).\n if (host.placing && host.placeAt) {\n const rect = el.getBoundingClientRect();\n host.placeAt([e.clientX - rect.left, e.clientY - rect.top], cursorWorld(e));\n e.preventDefault();\n return;\n }\n\n const id = nodeIdAt(e.target);\n\n // An input field inside a node: select the node and hand the event to the field (focus, caret, text selection).\n // Поле ввода внутри ноды: выделяем ноду и отдаём событие полю (фокус, каретка, выделение текста).\n if (id && isEditable(e.target)) {\n if (touch) {\n armed = id; // select on release: the finger may turn out to be the start of a two-finger gesture / выделим при отпускании: палец может оказаться началом жеста двумя пальцами\n } else {\n host.raise?.(id);\n host.selectConnection(null);\n if (!host.selection.has(id)) host.setSelection([id]);\n }\n return;\n }\n\n el.focus();\n\n const connId = connIdAt(e.target);\n if (connId) {\n if (touch) {\n // The line is thin, and a finger on it more often starts moving the canvas than picking a link: behave as on an empty place.\n // Линия тонкая, и палец на ней чаще начинает двигать холст, чем выбирать связь: ведём себя как на пустом месте.\n armedConn = connId;\n mode = host.selectMode ? 'idle' : 'pan';\n e.preventDefault();\n capture(e);\n return;\n }\n host.setSelection([]);\n host.selectConnection(connId);\n e.preventDefault();\n return;\n }\n // On touch the link is deselected later (a tap on an empty place or the start of a frame), not on contact.\n // На сенсоре выбор связи снимаем позже (тап по пустому месту или начало рамки), а не при касании.\n if (!touch) host.selectConnection(null);\n\n const pin = host.connect ? options.pinAt(e.target) : null;\n // Touch has no Ctrl: its role is played by the \"Select\" mode.\n // На сенсоре Ctrl нет: его роль играет режим «Выделение».\n const additive = e.ctrlKey || e.shiftKey || (touch && !!host.selectMode);\n if (id && (!touch || additive)) host.raise?.(id);\n\n const resizeHandle = host.resize && id ? (e.target as Element).closest<HTMLElement>('[data-resize]') : null;\n\n if (pin && host.connect) {\n host.connect.start(pin, cursorWorld(e));\n mode = 'connect';\n } else if (id && resizeHandle && host.resize) {\n const rect = host.resize.rectOf(id);\n if (!rect) return;\n if (touch) armed = id;\n else host.setSelection([id]);\n resizeId = id;\n resizeEdge = resizeHandle.dataset.resize as ResizeEdge;\n resizeStart = rect;\n resizeDx = 0;\n resizeDy = 0;\n mode = 'resize';\n } else if (id) {\n if (additive) {\n host.toggleSelected(id);\n if (!host.selection.has(id)) return;\n host.beginDrag(id);\n } else if (touch) {\n armed = id; // selection and beginDrag: in commitArmed, when the finger started dragging / выделение и beginDrag: в commitArmed, когда палец пошёл тянуть\n } else {\n if (!host.selection.has(id)) host.setSelection([id]);\n host.beginDrag(id);\n }\n mode = 'drag';\n } else if (touch && !host.selectMode && !doubleDown) {\n // One finger on an empty place moves the canvas; the selection (if it was a tap) is cleared on release.\n // Один палец по пустому месту двигает холст; выделение (если тап) снимется при отпускании.\n mode = 'pan';\n note('pan');\n } else {\n if (touch) host.selectConnection(null);\n baseSelection = additive ? [...host.selection] : [];\n host.setSelection(baseSelection);\n marquee.value = { x0: e.clientX, y0: e.clientY, x1: e.clientX, y1: e.clientY };\n mode = 'marquee';\n if (touch) note('marquee');\n }\n } else {\n return;\n }\n\n e.preventDefault();\n capture(e);\n }\n\n /**\n * The gesture broke off and `pointerup` never came (alt-tab, the window was covered, the system took the pointer):\n * we close what was started so that nothing \"hangs\": a dragged link, the selection frame, a grabbed node.\n * What was done by then (a shift, a size) stays and goes into history.\n * Жест оборвался, а `pointerup` не пришёл (alt-tab, окно перекрыли, система забрала указатель):\n * закрываем начатое, чтобы ничего не «зависло»: протянутая связь, рамка выделения, захваченная нода.\n * Сделанное к этому моменту (сдвиг, размер) остаётся и записывается в историю.\n */\n function abortGesture() {\n clearLongPress();\n taps.cancel();\n armed = null;\n armedConn = null;\n if (mode === 'connect') {\n host.connect?.cancel();\n } else if (mode === 'drag' || mode === 'resize') {\n host.endDrag();\n host.commit();\n }\n mode = 'idle';\n marquee.value = null;\n stopAutoScroll();\n }\n\n /**\n * Abort everything, including fingers on the canvas (window focus lost, a system cancel).\n * Оборвать всё, включая пальцы на холсте (потеря фокуса окна, системная отмена).\n */\n function cancelGesture() {\n touches.clear();\n abortGesture();\n }\n\n function onPointerCancel(e: PointerEvent) {\n touches.delete(e.pointerId);\n if (mode === 'pinch' && touches.size > 0) {\n rebasePinch();\n return;\n }\n cancelGesture();\n }\n\n /**\n * The pointer capture is lost: if a gesture is still going and it is not a pinch (there the fingers are lifted by themselves), we break it.\n * Захват указателя пропал: если жест ещё идёт и это не щипок (там палец снимают сами), рвём его.\n */\n function onLostCapture() {\n if (mode === 'pinch' || mode === 'idle') return;\n cancelGesture();\n }\n\n //--------------------------------------------------\n // Auto-scroll: while you drag a node, a frame, a link or an edge and the cursor is at the canvas edge, the camera moves that way.\n // The loop runs even when the mouse stands still; speed is counted by time, not by frames.\n // Автопрокрутка: пока тянешь ноду, рамку, связь или край и курсор у края холста, камера едет в ту сторону.\n // Цикл крутится, даже когда мышь стоит; скорость считается по времени, а не по кадрам.\n\n const SCROLL_MODES: readonly Mode[] = ['drag', 'resize', 'marquee', 'connect'];\n\n const scroller = createEdgeScroller({\n bounds: () => root.value?.getBoundingClientRect() ?? null,\n pointer: () => [lastX, lastY],\n enabled: () => SCROLL_MODES.includes(mode),\n onScroll: autoScrollStep,\n });\n const kickAutoScroll = scroller.kick;\n const stopAutoScroll = scroller.stop;\n\n function autoScrollStep(sx: number, sy: number) {\n // The camera moved by (sx, sy) screen px, and what was under the cursor ended up aside:\n // we catch up with the cursor with whatever of the gesture is tied to the world.\n // Камера уехала на (sx, sy) экранных px, и то, что было под курсором, оказалось в стороне:\n // догоняем курсор тем, что у жеста привязано к миру.\n const z = host.camera.z;\n host.setCamera(panBy(host.camera, -sx, -sy));\n\n const pointer: Pointer = { clientX: lastX, clientY: lastY };\n if (mode === 'drag') {\n host.moveSelected(sx / z, sy / z, snapNow());\n } else if (mode === 'resize') {\n resizeDx += sx / z;\n resizeDy += sy / z;\n host.resize?.from(resizeId, resizeEdge, resizeStart, resizeDx, resizeDy, snapNow());\n } else if (mode === 'connect') {\n host.connect?.update(cursorWorld(pointer), pinUnder(pointer));\n } else if (mode === 'marquee' && marquee.value) {\n // The start of the frame stands still in the world, so on screen it moved with the camera.\n // Начало рамки стоит на месте в мире, значит на экране уехало вместе с камерой.\n const m = marquee.value;\n marquee.value = { x0: m.x0 - sx, y0: m.y0 - sy, x1: lastX, y1: lastY };\n host.setSelection([...baseSelection, ...nodesInMarquee()]);\n }\n }\n\n function onPointerMove(e: PointerEvent) {\n altDown = e.altKey;\n const touch = e.pointerType === 'touch';\n if (touch) {\n if (touches.has(e.pointerId)) touches.set(e.pointerId, { x: e.clientX, y: e.clientY });\n if (mode === 'pinch') {\n schedulePinch();\n return;\n }\n if (taps.move(sampleOf(e))) clearLongPress();\n // While the finger has not left the tap slop, the canvas and the nodes stand still: jitter must not move either.\n // Пока палец не вышел за допуск тапа, холст и ноды стоят: дрожание не должно двигать ни то, ни другое.\n if (!taps.isMoved && (mode === 'pan' || mode === 'drag' || mode === 'resize')) return;\n if (armed && (mode === 'drag' || mode === 'resize')) commitArmed();\n } else if (mode !== 'idle' && e.buttons === 0) {\n // The button was released somewhere outside the window: we did not see the event, but the movement shows the gesture is over.\n // Кнопку отпустили где-то вне окна: событие мы не увидели, но по движению видно, что жест окончен.\n cancelGesture();\n return;\n }\n\n const dx = e.clientX - lastX;\n const dy = e.clientY - lastY;\n lastX = e.clientX;\n lastY = e.clientY;\n\n if (mode === 'pan') {\n panDistance += Math.hypot(dx, dy);\n host.setCamera(panBy(host.camera, dx, dy));\n if (options.inertia) panSamples.push({ t: performance.now(), dx, dy });\n } else if (mode === 'drag') {\n host.moveSelected(dx / host.camera.z, dy / host.camera.z, snapNow());\n } else if (mode === 'resize') {\n resizeDx += dx / host.camera.z;\n resizeDy += dy / host.camera.z;\n host.resize?.from(resizeId, resizeEdge, resizeStart, resizeDx, resizeDy, snapNow());\n } else if (mode === 'connect') {\n host.connect?.update(cursorWorld(e), pinUnder(e));\n } else if (mode === 'marquee' && marquee.value) {\n marquee.value = { ...marquee.value, x1: e.clientX, y1: e.clientY };\n host.setSelection([...baseSelection, ...nodesInMarquee()]);\n }\n\n kickAutoScroll();\n }\n\n function onPointerUp(e: PointerEvent) {\n if (e.pointerType === 'touch' && touchUp(e)) return;\n if (mode === 'idle') return;\n if (mode === 'connect' && host.connect) {\n const under = document.elementFromPoint(e.clientX, e.clientY);\n const origin = host.connect.origin;\n const connected = host.connect.finish(pinUnder(e));\n\n // A link was released over an empty canvas: we offer to create a node and connect it.\n // Отпустили связь над пустым холстом: предлагаем создать ноду и подключить её.\n if (!connected && origin !== null && under && root.value?.contains(under) && !under.closest('[data-node-id]')) {\n openPaletteAt(e, origin);\n }\n } else if (mode === 'drag' || mode === 'resize') {\n host.endDrag();\n host.commit(); // a drag or a resize as a whole: one history step (nothing is recorded without a shift) / перетаскивание или изменение размера целиком: один шаг истории (без сдвига ничего не запишется)\n } else if (mode === 'pan' && e.button === 2 && panDistance < PAN_CLICK_THRESHOLD) {\n if (!openContextAt(e)) openPaletteAt(e, null);\n } else if (mode === 'pan') {\n // Released on the move: the camera keeps gliding. / Отпустили на ходу: камера продолжает скользить.\n const opts = glideOptions();\n const v = opts && releaseVelocity(panSamples, performance.now(), opts);\n if (opts && v) startGlide(v, opts);\n }\n panSamples = [];\n mode = 'idle';\n marquee.value = null;\n stopAutoScroll();\n releaseCapture(e);\n }\n\n /**\n * Hotkeys on the whole window, so they work after a click on the toolbar too.\n * We look at the physical key (`code`) so that Ctrl+Z works in the Russian layout as well.\n * Горячие клавиши на всём окне, чтобы работали и после клика по панели инструментов.\n * Смотрим на физическую клавишу (`code`), чтобы Ctrl+Z работало и в русской раскладке.\n */\n function onKey(e: KeyboardEvent) {\n // `keys: 'focus'`: only an event that comes from inside the canvas. / `keys: 'focus'`: только событие изнутри холста.\n if (options.keys === 'focus' && !(e.target instanceof Node && root.value?.contains(e.target))) return;\n const tag = (e.target as HTMLElement | null)?.tagName;\n if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT' || (e.target as HTMLElement | null)?.isContentEditable) return;\n if (host.claimsKey?.(e)) return;\n\n if (e.ctrlKey || e.metaKey) {\n if (e.code === 'KeyZ' && !e.shiftKey) host.undo();\n else if (e.code === 'KeyY' || (e.code === 'KeyZ' && e.shiftKey)) host.redo();\n else return;\n } else if (e.key === 'Delete' || e.key === 'Backspace') {\n host.removeSelected();\n } else if (e.key === 'Escape') {\n host.closePalette();\n } else {\n return;\n }\n e.preventDefault();\n }\n\n /**\n * The double action (a double click or a double tap): on a link and on a node strip; what exactly happens\n * is decided by the app.\n * Двойное действие (двойной клик или двойной тап): по связи и по полосе ноды; что именно произойдёт,\n * решает приложение.\n */\n function activateAt(p: Pointer) {\n if (!host.activate) return;\n const under = document.elementFromPoint(p.clientX, p.clientY);\n const connId = connIdAt(under);\n if (connId) {\n host.activate({ kind: 'link', id: connId, at: cursorWorld(p), element: under });\n return;\n }\n\n const handle = (under as Element | null)?.closest('[data-node-handle]');\n const nodeId = handle ? nodeIdAt(handle) : null;\n if (nodeId) host.activate({ kind: 'handle', nodeId });\n }\n\n /**\n * The event arrives at the canvas (it holds the pointer capture). On touch we recognise the double tap ourselves, otherwise the action would fire twice.\n * Событие приходит на холст (он держит захват указателя). На сенсоре двойной тап распознаём сами, иначе действие сработало бы дважды.\n */\n function onDblClick(e: MouseEvent) {\n if (Date.now() - lastTouchAt < 800) return;\n activateAt(e);\n }\n\n /**\n * The wheel moves the canvas, zoom only with Ctrl/Cmd (a trackpad pinch arrives as Ctrl + wheel): so a wheel over a\n * scrollable note does not zoom the canvas the moment the cursor slips off its edge.\n * Колесо двигает холст, а масштаб только с Ctrl/Cmd (щипок тачпада приходит как Ctrl + колесо): так колесо над\n * заметкой, которую можно прокрутить, не масштабирует холст, стоит курсору случайно выйти за её край.\n */\n function onWheel(e: WheelEvent) {\n stopGlide();\n const el = root.value!;\n const zooming = e.ctrlKey || e.metaKey;\n\n // A wheel over a scrollable field (a long note) scrolls it instead of moving the canvas.\n // Колесо над прокручиваемым полем (длинная заметка) листает его, а не двигает холст.\n const field = (e.target as Element | null)?.closest('textarea');\n if (!zooming && field && field.scrollHeight > field.clientHeight) return;\n\n e.preventDefault();\n const rect = el.getBoundingClientRect();\n const intent = wheelIntent(e, rect.height);\n if (intent.kind === 'zoom') {\n host.setCamera(zoomAt(host.camera, e.clientX - rect.left, e.clientY - rect.top, intent.factor, zoomLimits(options.zoom)));\n } else {\n host.setCamera(panBy(host.camera, intent.dx, intent.dy));\n }\n }\n\n //--------------------------------------------------\n // Lifecycle\n // Жизненный цикл\n\n // The app needs the canvas size to place new nodes at the screen centre.\n // Размер холста нужен приложению, чтобы ставить новые ноды в центр экрана.\n let resizeObserver: ResizeObserver | null = null;\n\n onMounted(() => {\n const el = root.value!;\n const update = () => host.setViewport({ w: el.clientWidth, h: el.clientHeight });\n update();\n resizeObserver = new ResizeObserver(update);\n resizeObserver.observe(el);\n window.addEventListener('keydown', onKey);\n window.addEventListener('blur', cancelGesture);\n window.addEventListener('pointerup', purgeTouch);\n window.addEventListener('pointercancel', purgeTouch);\n });\n\n onUnmounted(() => {\n resizeObserver?.disconnect();\n window.removeEventListener('keydown', onKey);\n window.removeEventListener('blur', cancelGesture);\n window.removeEventListener('pointerup', purgeTouch);\n window.removeEventListener('pointercancel', purgeTouch);\n stopAutoScroll();\n clearLongPress();\n stopGlide();\n cancelAnimationFrame(pinchFrame);\n });\n\n // After the palette closes, focus returns to the canvas so that hotkeys work.\n // После закрытия палитры возвращаем фокус на холст, чтобы работали горячие клавиши.\n watch(\n () => host.paletteOpen,\n (now, before) => {\n if (!now && before) root.value?.focus();\n },\n );\n\n return {\n marquee,\n debug,\n debugText,\n handlers: {\n onPointerDown,\n onPointerMove,\n onPointerUp,\n onPointerCancel,\n onLostCapture,\n onWheel,\n onDblClick,\n },\n };\n}\n","<script lang=\"ts\" setup generic=\"P\">\nimport { computed, ref } from 'vue';\nimport { GRID } from '../snap';\nimport type { CanvasHost, CanvasOptions } from './host';\nimport { useCanvasGestures } from './useCanvasGestures';\n\nconst props = withDefaults(\n defineProps<{\n /**\n * The bridge to the app. Must be a stable object: the canvas takes it once.\n * Мост к приложению. Должен быть стабильным объектом: холст берёт его один раз.\n */\n host: CanvasHost<P>;\n options: CanvasOptions<P>;\n /**\n * The step of the fine background grid, world units.\n * Шаг мелкой сетки на фоне, мировые единицы.\n */\n grid?: number;\n /**\n * What is drawn on the background: `grid` (lines, the default), `dots` (a dot at every crossing, fewer details) or\n * `none`. It is only a look: snapping to the grid is the app's own setting.\n * Что нарисовано на фоне: `grid` (линии, по умолчанию), `dots` (точка в каждом пересечении, меньше деталей) или `none`.\n * Это только вид: привязка к сетке отдельная настройка приложения.\n */\n background?: 'grid' | 'dots' | 'none';\n }>(),\n { grid: GRID, background: 'grid' },\n);\n\nconst root = ref<HTMLElement | null>(null);\nconst { marquee, debug, debugText, handlers } = useCanvasGestures(root, props.host, props.options);\n\nconst world = computed(() => {\n const { x, y, z } = props.host.camera;\n // The offset lands on whole device pixels: a fractional one (a glide, a trackpad, a zoom) makes the text shimmer.\n // Сдвиг ложится на целые пиксели экрана: дробный (скольжение, тачпад, зум) заставляет текст мерцать.\n const dpr = (typeof window !== 'undefined' && window.devicePixelRatio) || 1;\n const snap = (v: number) => Math.round(v * dpr) / dpr;\n return { transform: `translate(${snap(x)}px, ${snap(y)}px) scale(${z})` };\n});\n\nconst gridStyle = computed(() => {\n const { x, y, z } = props.host.camera;\n const small = props.grid * z;\n const big = small * 5;\n if (props.background === 'none') return { backgroundImage: 'none' };\n if (props.background === 'dots') {\n // Zoomed far out the dots of every step would turn into a haze: then every fifth step only.\n // При сильном отдалении точки каждого шага слились бы в дымку: тогда только каждого пятого.\n const step = small < 10 ? big : small;\n return {\n backgroundImage: 'radial-gradient(circle, var(--tx-canvas-dot, rgba(255, 255, 255, 0.1)) 1.1px, transparent 1.6px)',\n backgroundSize: `${step}px ${step}px`,\n // the dot sits in the middle of its tile: shift the tile so that dots lie on the grid lines / точка в середине плитки: сдвигаем плитку, чтобы точки лежали на линиях сетки\n backgroundPosition: `${x - step / 2}px ${y - step / 2}px`,\n };\n }\n return {\n backgroundSize: `${small}px ${small}px, ${small}px ${small}px, ${big}px ${big}px, ${big}px ${big}px`,\n backgroundPosition: `${x}px ${y}px`,\n };\n});\n\nconst marqueeStyle = computed(() => {\n const m = marquee.value;\n const rect = root.value?.getBoundingClientRect();\n if (!m || !rect) return {};\n return {\n left: `${Math.min(m.x0, m.x1) - rect.left}px`,\n top: `${Math.min(m.y0, m.y1) - rect.top}px`,\n width: `${Math.abs(m.x1 - m.x0)}px`,\n height: `${Math.abs(m.y1 - m.y0)}px`,\n };\n});\n\ndefineExpose({ root });\n</script>\n\n<template>\n <div\n ref=\"root\"\n class=\"tx-canvas\"\n :class=\"{ connecting: host.connect?.origin != null }\"\n tabindex=\"0\"\n :style=\"gridStyle\"\n @pointerdown=\"handlers.onPointerDown\"\n @pointermove=\"handlers.onPointerMove\"\n @pointerup=\"handlers.onPointerUp\"\n @pointercancel=\"handlers.onPointerCancel\"\n @lostpointercapture=\"handlers.onLostCapture\"\n @wheel=\"handlers.onWheel\"\n @contextmenu.prevent\n @dblclick=\"handlers.onDblClick\"\n >\n <!-- The world: the app puts containers, the links layer and nodes here in the right order. / Мир: сюда приложение кладёт контейнеры, слой связей и ноды в нужном порядке. -->\n <div class=\"tx-canvas-world\" :style=\"world\">\n <slot />\n </div>\n\n <div v-if=\"marquee\" class=\"tx-canvas-marquee\" :style=\"marqueeStyle\" />\n <div v-if=\"debug\" class=\"tx-canvas-debug\">{{ debugText }}</div>\n\n <!-- On top of the world, in screen coordinates. / Поверх мира, в экранных координатах. -->\n <slot name=\"overlay\" />\n </div>\n</template>\n\n<style>\n/*\n * Configured with CSS variables on the canvas or an ancestor:\n * Настройка через CSS-переменные на холсте или предке:\n * --tx-canvas-bg, --tx-canvas-grid-minor, --tx-canvas-grid-major, --tx-canvas-dot, --tx-canvas-accent, --tx-canvas-accent-subtle,\n * --tx-canvas-radius (the corners of the debug badge, 6px by default).\n * --tx-canvas-radius — углы отладочной плашки, по умолчанию 6px.\n */\n.tx-canvas {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: hidden;\n outline: none;\n background-color: var(--tx-canvas-bg, #1b1d21);\n background-image:\n linear-gradient(to right, var(--tx-canvas-grid-minor, rgba(255, 255, 255, 0.035)) 1px, transparent 1px),\n linear-gradient(to bottom, var(--tx-canvas-grid-minor, rgba(255, 255, 255, 0.035)) 1px, transparent 1px),\n linear-gradient(to right, var(--tx-canvas-grid-major, rgba(255, 255, 255, 0.07)) 1px, transparent 1px),\n linear-gradient(to bottom, var(--tx-canvas-grid-major, rgba(255, 255, 255, 0.07)) 1px, transparent 1px);\n touch-action: none;\n /* Touch: no text selection, magnifier or tap highlight; text in inputs is selected as usual. / Сенсор: без выделения текста, лупы и подсветки тапа; в полях ввода текст выделяется как обычно. */\n -webkit-user-select: none;\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n.tx-canvas textarea,\n.tx-canvas input {\n -webkit-user-select: text;\n user-select: text;\n}\n\n.tx-canvas-world {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n transform-origin: 0 0;\n}\n\n.tx-canvas-marquee {\n position: absolute;\n border: 1px solid var(--tx-canvas-accent, #f59e0b);\n background: var(--tx-canvas-accent-subtle, rgba(245, 158, 11, 0.1));\n pointer-events: none;\n}\n\n.tx-canvas-debug {\n position: absolute;\n left: 8px;\n bottom: 8px;\n padding: 4px 8px;\n border-radius: var(--tx-canvas-radius, 6px);\n background: rgba(0, 0, 0, 0.7);\n color: #fff;\n font: 12px/1.3 monospace;\n pointer-events: none;\n}\n</style>\n","<script lang=\"ts\" setup generic=\"P\">\nimport { computed, ref } from 'vue';\nimport { GRID } from '../snap';\nimport type { CanvasHost, CanvasOptions } from './host';\nimport { useCanvasGestures } from './useCanvasGestures';\n\nconst props = withDefaults(\n defineProps<{\n /**\n * The bridge to the app. Must be a stable object: the canvas takes it once.\n * Мост к приложению. Должен быть стабильным объектом: холст берёт его один раз.\n */\n host: CanvasHost<P>;\n options: CanvasOptions<P>;\n /**\n * The step of the fine background grid, world units.\n * Шаг мелкой сетки на фоне, мировые единицы.\n */\n grid?: number;\n /**\n * What is drawn on the background: `grid` (lines, the default), `dots` (a dot at every crossing, fewer details) or\n * `none`. It is only a look: snapping to the grid is the app's own setting.\n * Что нарисовано на фоне: `grid` (линии, по умолчанию), `dots` (точка в каждом пересечении, меньше деталей) или `none`.\n * Это только вид: привязка к сетке отдельная настройка приложения.\n */\n background?: 'grid' | 'dots' | 'none';\n }>(),\n { grid: GRID, background: 'grid' },\n);\n\nconst root = ref<HTMLElement | null>(null);\nconst { marquee, debug, debugText, handlers } = useCanvasGestures(root, props.host, props.options);\n\nconst world = computed(() => {\n const { x, y, z } = props.host.camera;\n // The offset lands on whole device pixels: a fractional one (a glide, a trackpad, a zoom) makes the text shimmer.\n // Сдвиг ложится на целые пиксели экрана: дробный (скольжение, тачпад, зум) заставляет текст мерцать.\n const dpr = (typeof window !== 'undefined' && window.devicePixelRatio) || 1;\n const snap = (v: number) => Math.round(v * dpr) / dpr;\n return { transform: `translate(${snap(x)}px, ${snap(y)}px) scale(${z})` };\n});\n\nconst gridStyle = computed(() => {\n const { x, y, z } = props.host.camera;\n const small = props.grid * z;\n const big = small * 5;\n if (props.background === 'none') return { backgroundImage: 'none' };\n if (props.background === 'dots') {\n // Zoomed far out the dots of every step would turn into a haze: then every fifth step only.\n // При сильном отдалении точки каждого шага слились бы в дымку: тогда только каждого пятого.\n const step = small < 10 ? big : small;\n return {\n backgroundImage: 'radial-gradient(circle, var(--tx-canvas-dot, rgba(255, 255, 255, 0.1)) 1.1px, transparent 1.6px)',\n backgroundSize: `${step}px ${step}px`,\n // the dot sits in the middle of its tile: shift the tile so that dots lie on the grid lines / точка в середине плитки: сдвигаем плитку, чтобы точки лежали на линиях сетки\n backgroundPosition: `${x - step / 2}px ${y - step / 2}px`,\n };\n }\n return {\n backgroundSize: `${small}px ${small}px, ${small}px ${small}px, ${big}px ${big}px, ${big}px ${big}px`,\n backgroundPosition: `${x}px ${y}px`,\n };\n});\n\nconst marqueeStyle = computed(() => {\n const m = marquee.value;\n const rect = root.value?.getBoundingClientRect();\n if (!m || !rect) return {};\n return {\n left: `${Math.min(m.x0, m.x1) - rect.left}px`,\n top: `${Math.min(m.y0, m.y1) - rect.top}px`,\n width: `${Math.abs(m.x1 - m.x0)}px`,\n height: `${Math.abs(m.y1 - m.y0)}px`,\n };\n});\n\ndefineExpose({ root });\n</script>\n\n<template>\n <div\n ref=\"root\"\n class=\"tx-canvas\"\n :class=\"{ connecting: host.connect?.origin != null }\"\n tabindex=\"0\"\n :style=\"gridStyle\"\n @pointerdown=\"handlers.onPointerDown\"\n @pointermove=\"handlers.onPointerMove\"\n @pointerup=\"handlers.onPointerUp\"\n @pointercancel=\"handlers.onPointerCancel\"\n @lostpointercapture=\"handlers.onLostCapture\"\n @wheel=\"handlers.onWheel\"\n @contextmenu.prevent\n @dblclick=\"handlers.onDblClick\"\n >\n <!-- The world: the app puts containers, the links layer and nodes here in the right order. / Мир: сюда приложение кладёт контейнеры, слой связей и ноды в нужном порядке. -->\n <div class=\"tx-canvas-world\" :style=\"world\">\n <slot />\n </div>\n\n <div v-if=\"marquee\" class=\"tx-canvas-marquee\" :style=\"marqueeStyle\" />\n <div v-if=\"debug\" class=\"tx-canvas-debug\">{{ debugText }}</div>\n\n <!-- On top of the world, in screen coordinates. / Поверх мира, в экранных координатах. -->\n <slot name=\"overlay\" />\n </div>\n</template>\n\n<style>\n/*\n * Configured with CSS variables on the canvas or an ancestor:\n * Настройка через CSS-переменные на холсте или предке:\n * --tx-canvas-bg, --tx-canvas-grid-minor, --tx-canvas-grid-major, --tx-canvas-dot, --tx-canvas-accent, --tx-canvas-accent-subtle,\n * --tx-canvas-radius (the corners of the debug badge, 6px by default).\n * --tx-canvas-radius — углы отладочной плашки, по умолчанию 6px.\n */\n.tx-canvas {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: hidden;\n outline: none;\n background-color: var(--tx-canvas-bg, #1b1d21);\n background-image:\n linear-gradient(to right, var(--tx-canvas-grid-minor, rgba(255, 255, 255, 0.035)) 1px, transparent 1px),\n linear-gradient(to bottom, var(--tx-canvas-grid-minor, rgba(255, 255, 255, 0.035)) 1px, transparent 1px),\n linear-gradient(to right, var(--tx-canvas-grid-major, rgba(255, 255, 255, 0.07)) 1px, transparent 1px),\n linear-gradient(to bottom, var(--tx-canvas-grid-major, rgba(255, 255, 255, 0.07)) 1px, transparent 1px);\n touch-action: none;\n /* Touch: no text selection, magnifier or tap highlight; text in inputs is selected as usual. / Сенсор: без выделения текста, лупы и подсветки тапа; в полях ввода текст выделяется как обычно. */\n -webkit-user-select: none;\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n.tx-canvas textarea,\n.tx-canvas input {\n -webkit-user-select: text;\n user-select: text;\n}\n\n.tx-canvas-world {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n transform-origin: 0 0;\n}\n\n.tx-canvas-marquee {\n position: absolute;\n border: 1px solid var(--tx-canvas-accent, #f59e0b);\n background: var(--tx-canvas-accent-subtle, rgba(245, 158, 11, 0.1));\n pointer-events: none;\n}\n\n.tx-canvas-debug {\n position: absolute;\n left: 8px;\n bottom: 8px;\n padding: 4px 8px;\n border-radius: var(--tx-canvas-radius, 6px);\n background: rgba(0, 0, 0, 0.7);\n color: #fff;\n font: 12px/1.3 monospace;\n pointer-events: none;\n}\n</style>\n"],"mappings":";;;;;;;AA4BA,IAAa,iBAAiB;CAAE,UAAU;CAAK,UAAU;CAAK,UAAU;AAAE;;AAE1E,IAAa,aAAa;;;;;;;AAwB1B,SAAgB,gBAAgB,SAA+B,KAAa,UAAwB,CAAC,GAA4B;CAC7H,MAAM,EAAE,UAAU,aAAa;EAAE,GAAG;EAAgB,GAAG;CAAQ;CAC/D,MAAM,OAAO,QAAQ,WAAW,MAAM,MAAM,EAAE,KAAA,EAAoB;CAClE,MAAM,SAAS,OAAO,IAAI,CAAC,IAAI,QAAQ,MAAM,IAAI;CACjD,MAAM,OAAO,OAAO,OAAO,SAAS;CACpC,IAAI,CAAC,QAAQ,MAAM,KAAK,IAAA,IAAgB,OAAO;CAI/C,MAAM,QAAQ,OAAO,IAAI,QAAQ,OAAO,EAAE,CAAE,IAAI,OAAO,EAAE,CAAE,IAAI;CAC/D,MAAM,OAAO,KAAK,IAAI,KAAK,IAAI,OAAO,EAAE;CACxC,MAAM,KAAK,OAAO,QAAQ,GAAG,MAAM,IAAI,EAAE,IAAI,CAAC;CAC9C,MAAM,KAAK,OAAO,QAAQ,GAAG,MAAM,IAAI,EAAE,IAAI,CAAC;CAC9C,IAAI,KAAK,KAAK;CACd,IAAI,KAAK,KAAK;CAEd,MAAM,QAAQ,KAAK,MAAM,IAAI,EAAE;CAC/B,IAAI,QAAQ,UAAU,OAAO;CAC7B,IAAI,QAAQ,UAAU;EAClB,KAAM,KAAK,QAAS;EACpB,KAAM,KAAK,QAAS;CACxB;CACA,OAAO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eAAE,MAAA,KAAK;I,IACtCI,WAAQ,KAAA,QAAA,SAAA,C;IAGDH,MAAA,OAAA,KAAXJ,UAAA,GAAAC,mBAAsE,OAAA;;KAAlD,OAAM;KAAqB,OAAKE,eAAE,aAAA,KAAY;;IACvDC,MAAA,KAAA,KAAXJ,UAAA,GAAAC,mBAA+D,OAA/D,YAA+DQ,gBAAlBL,MAAA,SAAA,CAAS,GAAA,CAAA,K;IAGtDG,WAAuB,KAAA,QAAA,SAAA"}
|
package/dist/links/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as TaoxLinks } from './TaoxLinks.vue';
|
|
2
|
-
export type { LinkLine, LinkPreview } from './types';
|
|
2
|
+
export type { LinkDash, LinkLine, LinkPreview } from './types';
|
package/dist/links/types.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The line style of a link: a solid line, dashes or dots.
|
|
3
|
+
* Стиль линии связи: сплошная, штрихи или точки.
|
|
4
|
+
*/
|
|
5
|
+
export type LinkDash = 'solid' | 'dashed' | 'dotted';
|
|
1
6
|
/**
|
|
2
7
|
* Ready-made link geometry. Paths are built by the app (see `curve`): the canvas does not know how pins are laid out.
|
|
3
8
|
* Готовая геометрия связи. Пути строит приложение (см. `curve`): холст не знает, как устроены пины.
|
|
@@ -23,6 +28,22 @@ export interface LinkLine {
|
|
|
23
28
|
* Цвет этой связи (любой CSS-цвет). Без него берётся `--tx-link-color`.
|
|
24
29
|
*/
|
|
25
30
|
color?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The line style: `'solid'` (default), `'dashed'` or `'dotted'`. The dashes are measured in line widths (so they grow
|
|
33
|
+
* with `width`) and in screen pixels (they do not change with the zoom, like the line itself); the arrowhead stays
|
|
34
|
+
* solid and the hit area ignores the gaps. A preview keeps its own dashes unless it names `'dashed'` or `'dotted'`.
|
|
35
|
+
* Стиль линии: `'solid'` (по умолчанию), `'dashed'` или `'dotted'`. Штрихи меряются в толщинах линии (растут вместе с
|
|
36
|
+
* `width`) и в экранных пикселях (от зума не меняются, как и сама линия); наконечник остаётся сплошным, а зона
|
|
37
|
+
* попадания пропусков не имеет. У предпросмотра свой пунктир, пока не задан `'dashed'` или `'dotted'`.
|
|
38
|
+
*/
|
|
39
|
+
dash?: LinkDash;
|
|
40
|
+
/**
|
|
41
|
+
* The thickness of this link in screen pixels (a positive number). Without it `--tx-link-width` is used (2); on hover
|
|
42
|
+
* and selection it grows by one pixel, as the default does.
|
|
43
|
+
* Толщина этой связи в экранных пикселях (положительное число). Без неё берётся `--tx-link-width` (2); при наведении
|
|
44
|
+
* и выборе растёт на один пиксель, как и по умолчанию.
|
|
45
|
+
*/
|
|
46
|
+
width?: number;
|
|
26
47
|
}
|
|
27
48
|
/**
|
|
28
49
|
* The link the user is dragging out right now.
|
package/dist/links.css
CHANGED
|
@@ -1,82 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
/*
|
|
3
|
-
* Configured with CSS variables on any ancestor:
|
|
4
|
-
* Настройка через CSS-переменные на любом предке:
|
|
5
|
-
* --tx-link-color, --tx-link-hover-color, --tx-link-selected-color, --tx-link-preview-color, --tx-link-invalid-color,
|
|
6
|
-
* --tx-link-width, --tx-link-width-active, --tx-link-hit, --tx-link-hit-coarse, --tx-link-glow (opacity of the glow).
|
|
7
|
-
* --tx-link-width, --tx-link-width-active, --tx-link-hit, --tx-link-hit-coarse, --tx-link-glow (непрозрачность свечения).
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
* Configured with CSS variables on any ancestor:
|
|
4
|
+
* Настройка через CSS-переменные на любом предке:
|
|
5
|
+
* --tx-link-color, --tx-link-hover-color, --tx-link-selected-color, --tx-link-preview-color, --tx-link-invalid-color,
|
|
6
|
+
* --tx-link-width, --tx-link-width-active, --tx-link-hit, --tx-link-hit-coarse, --tx-link-glow (opacity of the glow).
|
|
7
|
+
* --tx-link-width, --tx-link-width-active, --tx-link-hit, --tx-link-hit-coarse, --tx-link-glow (непрозрачность свечения).
|
|
8
8
|
*/
|
|
9
|
-
.tx-links {
|
|
10
|
-
position: absolute;
|
|
11
|
-
top: 0;
|
|
12
|
-
left: 0;
|
|
13
|
-
overflow: visible;
|
|
9
|
+
.tx-links {
|
|
10
|
+
position: absolute;
|
|
11
|
+
top: 0;
|
|
12
|
+
left: 0;
|
|
13
|
+
overflow: visible;
|
|
14
14
|
pointer-events: none;
|
|
15
15
|
}
|
|
16
|
-
.tx-links path {
|
|
17
|
-
fill: none;
|
|
18
|
-
stroke-linecap: round;
|
|
19
|
-
/* thickness in screen pixels, independent of zoom / толщина в экранных пикселях, не зависит от зума */
|
|
16
|
+
.tx-links path {
|
|
17
|
+
fill: none;
|
|
18
|
+
stroke-linecap: round;
|
|
19
|
+
/* thickness in screen pixels, independent of zoom / толщина в экранных пикселях, не зависит от зума */
|
|
20
20
|
vector-effect: non-scaling-stroke;
|
|
21
21
|
}
|
|
22
|
-
.tx-link {
|
|
22
|
+
.tx-link {
|
|
23
23
|
--tx-link-now: var(--tx-link-line-color, var(--tx-link-color, #9ca3af));
|
|
24
|
-
}
|
|
25
|
-
|
|
24
|
+
}
|
|
25
|
+
|
|
26
26
|
/* A link without its own colour turns the hover colour on hover. An own colour stays on hover (it gets thicker and glows). / Своего цвета у связи нет: наведение красит её в hover-цвет. Свой цвет при наведении остаётся (утолщается и светится). */
|
|
27
|
-
.tx-link:hover {
|
|
27
|
+
.tx-link:hover {
|
|
28
28
|
--tx-link-now: var(--tx-link-line-color, var(--tx-link-hover-color, #fff));
|
|
29
29
|
}
|
|
30
|
-
.tx-link.selected {
|
|
30
|
+
.tx-link.selected {
|
|
31
31
|
--tx-link-now: var(--tx-link-selected-color, #f59e0b);
|
|
32
32
|
}
|
|
33
|
-
.tx-link-line {
|
|
34
|
-
stroke: var(--tx-link-now);
|
|
35
|
-
stroke-width: var(--tx-link-width, 2);
|
|
33
|
+
.tx-link-line {
|
|
34
|
+
stroke: var(--tx-link-now);
|
|
35
|
+
stroke-width: var(--tx-link-line-width, var(--tx-link-width, 2));
|
|
36
36
|
pointer-events: none;
|
|
37
37
|
}
|
|
38
|
-
.tx-link:hover .tx-link-line,
|
|
39
|
-
.tx-link.selected .tx-link-line {
|
|
40
|
-
stroke-width: var(--tx-link-width-active, 3);
|
|
38
|
+
.tx-link:hover .tx-link-line,
|
|
39
|
+
.tx-link.selected .tx-link-line {
|
|
40
|
+
stroke-width: var(--tx-link-line-width-active, var(--tx-link-width-active, 3));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
* Line styles. The pattern is in line widths (`--tx-link-width` is a plain number, as the width is), in screen pixels
|
|
45
|
+
* because of non-scaling-stroke. The round caps add half a width to both ends of a dash: dashes 4w long with gaps 2w,
|
|
46
|
+
* and dots of one width with a gap of one width. The hover width does not change the pattern.
|
|
47
|
+
* Стили линии. Узор в толщинах линии (`--tx-link-width` — просто число, как и толщина), в экранных пикселях из-за
|
|
48
|
+
* non-scaling-stroke. Круглые концы прибавляют полтолщины с обеих сторон штриха: штрихи длиной 4w с пропусками 2w
|
|
49
|
+
* и точки в одну толщину с пропуском в одну толщину. Толщина при наведении узор не меняет.
|
|
50
|
+
*/
|
|
51
|
+
.tx-link-dashed .tx-link-line {
|
|
52
|
+
stroke-dasharray: calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 3px) calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 3px);
|
|
41
53
|
}
|
|
42
|
-
|
|
54
|
+
.tx-link-dotted .tx-link-line {
|
|
55
|
+
stroke-dasharray: 0 calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 2px);
|
|
56
|
+
}
|
|
57
|
+
|
|
43
58
|
/* The selector is as specific as `.tx-links path` above: with a shorter one `fill: none` won and the arrowhead was invisible. / Селектор той же специфичности, что у `.tx-links path` выше: с коротким побеждал `fill: none`, и наконечник не был виден. */
|
|
44
|
-
.tx-links .tx-link-head {
|
|
45
|
-
fill: var(--tx-link-now);
|
|
46
|
-
stroke: none;
|
|
59
|
+
.tx-links .tx-link-head {
|
|
60
|
+
fill: var(--tx-link-now);
|
|
61
|
+
stroke: none;
|
|
47
62
|
pointer-events: none;
|
|
48
63
|
}
|
|
49
|
-
.tx-link-glow {
|
|
50
|
-
stroke: var(--tx-link-now);
|
|
51
|
-
stroke-width: 9;
|
|
52
|
-
opacity: 0;
|
|
53
|
-
filter: blur(3px);
|
|
64
|
+
.tx-link-glow {
|
|
65
|
+
stroke: var(--tx-link-now);
|
|
66
|
+
stroke-width: 9;
|
|
67
|
+
opacity: 0;
|
|
68
|
+
filter: blur(3px);
|
|
54
69
|
pointer-events: none;
|
|
55
70
|
}
|
|
56
|
-
.tx-link:hover .tx-link-glow,
|
|
57
|
-
.tx-link.selected .tx-link-glow {
|
|
71
|
+
.tx-link:hover .tx-link-glow,
|
|
72
|
+
.tx-link.selected .tx-link-glow {
|
|
58
73
|
opacity: var(--tx-link-glow, 0.35);
|
|
59
74
|
}
|
|
60
|
-
.tx-link-hit {
|
|
61
|
-
stroke: transparent;
|
|
62
|
-
stroke-width: var(--tx-link-hit, 14);
|
|
63
|
-
pointer-events: stroke;
|
|
75
|
+
.tx-link-hit {
|
|
76
|
+
stroke: transparent;
|
|
77
|
+
stroke-width: var(--tx-link-hit, 14);
|
|
78
|
+
pointer-events: stroke;
|
|
64
79
|
cursor: pointer;
|
|
65
|
-
}
|
|
66
|
-
|
|
80
|
+
}
|
|
81
|
+
|
|
67
82
|
/* A finger is thicker than a cursor: the hit area of a link is wider. / Палец толще курсора: зона попадания по связи шире. */
|
|
68
83
|
@media (pointer: coarse) {
|
|
69
|
-
.tx-link-hit {
|
|
84
|
+
.tx-link-hit {
|
|
70
85
|
stroke-width: var(--tx-link-hit-coarse, 30);
|
|
71
86
|
}
|
|
72
87
|
}
|
|
73
|
-
.tx-link-preview {
|
|
74
|
-
--tx-link-now: var(--tx-link-line-color, var(--tx-link-preview-color, #f59e0b));
|
|
88
|
+
.tx-link-preview {
|
|
89
|
+
--tx-link-now: var(--tx-link-line-color, var(--tx-link-preview-color, #f59e0b));
|
|
75
90
|
opacity: 0.85;
|
|
76
91
|
}
|
|
77
|
-
.tx-link-preview .tx-link-line {
|
|
92
|
+
.tx-link-preview .tx-link-line {
|
|
78
93
|
stroke-dasharray: 6 4;
|
|
79
94
|
}
|
|
80
|
-
.tx-link-preview.
|
|
81
|
-
--tx-link-
|
|
95
|
+
.tx-link-preview.tx-link-dashed .tx-link-line {
|
|
96
|
+
stroke-dasharray: calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 3px) calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 3px);
|
|
97
|
+
}
|
|
98
|
+
.tx-link-preview.tx-link-dotted .tx-link-line {
|
|
99
|
+
stroke-dasharray: 0 calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 2px);
|
|
82
100
|
}
|
|
101
|
+
.tx-link-preview.invalid {
|
|
102
|
+
--tx-link-now: var(--tx-link-invalid-color, #ef4444);
|
|
103
|
+
}
|
package/dist/links.js
CHANGED
|
@@ -23,14 +23,23 @@ var TaoxLinks_default = /* @__PURE__ */ defineComponent({
|
|
|
23
23
|
glow: { type: Boolean }
|
|
24
24
|
},
|
|
25
25
|
setup(__props) {
|
|
26
|
-
|
|
26
|
+
function lineStyle(line) {
|
|
27
|
+
const style = {};
|
|
28
|
+
if (line.color) style["--tx-link-line-color"] = line.color;
|
|
29
|
+
if (typeof line.width === "number" && Number.isFinite(line.width) && line.width > 0) {
|
|
30
|
+
style["--tx-link-line-width"] = String(line.width);
|
|
31
|
+
style["--tx-link-line-width-active"] = String(line.width + 1);
|
|
32
|
+
}
|
|
33
|
+
return Object.keys(style).length ? style : void 0;
|
|
34
|
+
}
|
|
35
|
+
const dashClass = (dash) => dash === "dashed" ? "tx-link-dashed" : dash === "dotted" ? "tx-link-dotted" : void 0;
|
|
27
36
|
return (_ctx, _cache) => {
|
|
28
37
|
return openBlock(), createElementBlock("svg", _hoisted_1, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.lines, (line) => {
|
|
29
38
|
return openBlock(), createElementBlock("g", {
|
|
30
39
|
key: line.id,
|
|
31
|
-
class: normalizeClass(["tx-link", { selected: __props.selectedId === line.id }]),
|
|
40
|
+
class: normalizeClass(["tx-link", [{ selected: __props.selectedId === line.id }, dashClass(line.dash)]]),
|
|
32
41
|
"data-conn-id": line.id,
|
|
33
|
-
style: normalizeStyle(
|
|
42
|
+
style: normalizeStyle(lineStyle(line))
|
|
34
43
|
}, [
|
|
35
44
|
__props.glow ? (openBlock(), createElementBlock("path", {
|
|
36
45
|
key: 0,
|
|
@@ -53,8 +62,8 @@ var TaoxLinks_default = /* @__PURE__ */ defineComponent({
|
|
|
53
62
|
], 14, _hoisted_2);
|
|
54
63
|
}), 128)), __props.preview ? (openBlock(), createElementBlock("g", {
|
|
55
64
|
key: 0,
|
|
56
|
-
class: normalizeClass(["tx-link tx-link-preview", { invalid: __props.preview.invalid }]),
|
|
57
|
-
style: normalizeStyle(
|
|
65
|
+
class: normalizeClass(["tx-link tx-link-preview", [{ invalid: __props.preview.invalid }, dashClass(__props.preview.dash)]]),
|
|
66
|
+
style: normalizeStyle(lineStyle(__props.preview))
|
|
58
67
|
}, [createElementVNode("path", {
|
|
59
68
|
class: "tx-link-line",
|
|
60
69
|
d: __props.preview.d
|
package/dist/links.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links.js","names":["_openBlock","_createElementBlock","_Fragment","_renderList","_normalizeClass","_normalizeStyle","_createCommentVNode","_createElementVNode","_sfc_main"],"sources":["../src/links/TaoxLinks.vue","../src/links/TaoxLinks.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { LinkLine, LinkPreview } from './types';\n\ndefineProps<{\n lines: readonly LinkLine[];\n selectedId?: string | null;\n preview?: LinkPreview | null;\n /**\n * Highlight the hovered and selected link with a blurred glow.\n * Подсвечивать наведённую и выбранную связь размытым свечением.\n */\n glow?: boolean;\n}>();\n\nconst colorStyle = (line: LinkLine) => (line.color ? { '--tx-link-line-color': line.color } : undefined);\n</script>\n\n<template>\n <svg class=\"tx-links\" width=\"1\" height=\"1\">\n <g\n v-for=\"line in lines\"\n :key=\"line.id\"\n class=\"tx-link\"\n :class=\"{ selected: selectedId === line.id }\"\n :data-conn-id=\"line.id\"\n :style=\"colorStyle(line)\"\n >\n <path v-if=\"glow\" class=\"tx-link-glow\" :d=\"line.d\" />\n <path class=\"tx-link-line\" :d=\"line.d\" />\n <path v-if=\"line.head\" class=\"tx-link-head\" :d=\"line.head\" />\n <path class=\"tx-link-hit\" :d=\"line.d\" />\n </g>\n\n <g v-if=\"preview\" class=\"tx-link tx-link-preview\" :class=\"{ invalid: preview.invalid }\" :style=\"colorStyle(preview)\">\n <path class=\"tx-link-line\" :d=\"preview.d\" />\n <path v-if=\"preview.head\" class=\"tx-link-head\" :d=\"preview.head\" />\n </g>\n </svg>\n</template>\n\n<style>\n/*\n * Configured with CSS variables on any ancestor:\n * Настройка через CSS-переменные на любом предке:\n * --tx-link-color, --tx-link-hover-color, --tx-link-selected-color, --tx-link-preview-color, --tx-link-invalid-color,\n * --tx-link-width, --tx-link-width-active, --tx-link-hit, --tx-link-hit-coarse, --tx-link-glow (opacity of the glow).\n * --tx-link-width, --tx-link-width-active, --tx-link-hit, --tx-link-hit-coarse, --tx-link-glow (непрозрачность свечения).\n */\n.tx-links {\n position: absolute;\n top: 0;\n left: 0;\n overflow: visible;\n pointer-events: none;\n}\n\n.tx-links path {\n fill: none;\n stroke-linecap: round;\n /* thickness in screen pixels, independent of zoom / толщина в экранных пикселях, не зависит от зума */\n vector-effect: non-scaling-stroke;\n}\n\n.tx-link {\n --tx-link-now: var(--tx-link-line-color, var(--tx-link-color, #9ca3af));\n}\n\n/* A link without its own colour turns the hover colour on hover. An own colour stays on hover (it gets thicker and glows). / Своего цвета у связи нет: наведение красит её в hover-цвет. Свой цвет при наведении остаётся (утолщается и светится). */\n.tx-link:hover {\n --tx-link-now: var(--tx-link-line-color, var(--tx-link-hover-color, #fff));\n}\n\n.tx-link.selected {\n --tx-link-now: var(--tx-link-selected-color, #f59e0b);\n}\n\n.tx-link-line {\n stroke: var(--tx-link-now);\n stroke-width: var(--tx-link-width, 2);\n pointer-events: none;\n}\n\n.tx-link:hover .tx-link-line,\n.tx-link.selected .tx-link-line {\n stroke-width: var(--tx-link-width-active, 3);\n}\n\n/* The selector is as specific as `.tx-links path` above: with a shorter one `fill: none` won and the arrowhead was invisible. / Селектор той же специфичности, что у `.tx-links path` выше: с коротким побеждал `fill: none`, и наконечник не был виден. */\n.tx-links .tx-link-head {\n fill: var(--tx-link-now);\n stroke: none;\n pointer-events: none;\n}\n\n.tx-link-glow {\n stroke: var(--tx-link-now);\n stroke-width: 9;\n opacity: 0;\n filter: blur(3px);\n pointer-events: none;\n}\n\n.tx-link:hover .tx-link-glow,\n.tx-link.selected .tx-link-glow {\n opacity: var(--tx-link-glow, 0.35);\n}\n\n.tx-link-hit {\n stroke: transparent;\n stroke-width: var(--tx-link-hit, 14);\n pointer-events: stroke;\n cursor: pointer;\n}\n\n/* A finger is thicker than a cursor: the hit area of a link is wider. / Палец толще курсора: зона попадания по связи шире. */\n@media (pointer: coarse) {\n .tx-link-hit {\n stroke-width: var(--tx-link-hit-coarse, 30);\n }\n}\n\n.tx-link-preview {\n --tx-link-now: var(--tx-link-line-color, var(--tx-link-preview-color, #f59e0b));\n opacity: 0.85;\n}\n\n.tx-link-preview .tx-link-line {\n stroke-dasharray: 6 4;\n}\n\n.tx-link-preview.invalid {\n --tx-link-now: var(--tx-link-invalid-color, #ef4444);\n}\n</style>\n","<script lang=\"ts\" setup>\nimport type { LinkLine, LinkPreview } from './types';\n\ndefineProps<{\n lines: readonly LinkLine[];\n selectedId?: string | null;\n preview?: LinkPreview | null;\n /**\n * Highlight the hovered and selected link with a blurred glow.\n * Подсвечивать наведённую и выбранную связь размытым свечением.\n */\n glow?: boolean;\n}>();\n\nconst colorStyle = (line: LinkLine) => (line.color ? { '--tx-link-line-color': line.color } : undefined);\n</script>\n\n<template>\n <svg class=\"tx-links\" width=\"1\" height=\"1\">\n <g\n v-for=\"line in lines\"\n :key=\"line.id\"\n class=\"tx-link\"\n :class=\"{ selected: selectedId === line.id }\"\n :data-conn-id=\"line.id\"\n :style=\"colorStyle(line)\"\n >\n <path v-if=\"glow\" class=\"tx-link-glow\" :d=\"line.d\" />\n <path class=\"tx-link-line\" :d=\"line.d\" />\n <path v-if=\"line.head\" class=\"tx-link-head\" :d=\"line.head\" />\n <path class=\"tx-link-hit\" :d=\"line.d\" />\n </g>\n\n <g v-if=\"preview\" class=\"tx-link tx-link-preview\" :class=\"{ invalid: preview.invalid }\" :style=\"colorStyle(preview)\">\n <path class=\"tx-link-line\" :d=\"preview.d\" />\n <path v-if=\"preview.head\" class=\"tx-link-head\" :d=\"preview.head\" />\n </g>\n </svg>\n</template>\n\n<style>\n/*\n * Configured with CSS variables on any ancestor:\n * Настройка через CSS-переменные на любом предке:\n * --tx-link-color, --tx-link-hover-color, --tx-link-selected-color, --tx-link-preview-color, --tx-link-invalid-color,\n * --tx-link-width, --tx-link-width-active, --tx-link-hit, --tx-link-hit-coarse, --tx-link-glow (opacity of the glow).\n * --tx-link-width, --tx-link-width-active, --tx-link-hit, --tx-link-hit-coarse, --tx-link-glow (непрозрачность свечения).\n */\n.tx-links {\n position: absolute;\n top: 0;\n left: 0;\n overflow: visible;\n pointer-events: none;\n}\n\n.tx-links path {\n fill: none;\n stroke-linecap: round;\n /* thickness in screen pixels, independent of zoom / толщина в экранных пикселях, не зависит от зума */\n vector-effect: non-scaling-stroke;\n}\n\n.tx-link {\n --tx-link-now: var(--tx-link-line-color, var(--tx-link-color, #9ca3af));\n}\n\n/* A link without its own colour turns the hover colour on hover. An own colour stays on hover (it gets thicker and glows). / Своего цвета у связи нет: наведение красит её в hover-цвет. Свой цвет при наведении остаётся (утолщается и светится). */\n.tx-link:hover {\n --tx-link-now: var(--tx-link-line-color, var(--tx-link-hover-color, #fff));\n}\n\n.tx-link.selected {\n --tx-link-now: var(--tx-link-selected-color, #f59e0b);\n}\n\n.tx-link-line {\n stroke: var(--tx-link-now);\n stroke-width: var(--tx-link-width, 2);\n pointer-events: none;\n}\n\n.tx-link:hover .tx-link-line,\n.tx-link.selected .tx-link-line {\n stroke-width: var(--tx-link-width-active, 3);\n}\n\n/* The selector is as specific as `.tx-links path` above: with a shorter one `fill: none` won and the arrowhead was invisible. / Селектор той же специфичности, что у `.tx-links path` выше: с коротким побеждал `fill: none`, и наконечник не был виден. */\n.tx-links .tx-link-head {\n fill: var(--tx-link-now);\n stroke: none;\n pointer-events: none;\n}\n\n.tx-link-glow {\n stroke: var(--tx-link-now);\n stroke-width: 9;\n opacity: 0;\n filter: blur(3px);\n pointer-events: none;\n}\n\n.tx-link:hover .tx-link-glow,\n.tx-link.selected .tx-link-glow {\n opacity: var(--tx-link-glow, 0.35);\n}\n\n.tx-link-hit {\n stroke: transparent;\n stroke-width: var(--tx-link-hit, 14);\n pointer-events: stroke;\n cursor: pointer;\n}\n\n/* A finger is thicker than a cursor: the hit area of a link is wider. / Палец толще курсора: зона попадания по связи шире. */\n@media (pointer: coarse) {\n .tx-link-hit {\n stroke-width: var(--tx-link-hit-coarse, 30);\n }\n}\n\n.tx-link-preview {\n --tx-link-now: var(--tx-link-line-color, var(--tx-link-preview-color, #f59e0b));\n opacity: 0.85;\n}\n\n.tx-link-preview .tx-link-line {\n stroke-dasharray: 6 4;\n}\n\n.tx-link-preview.invalid {\n --tx-link-now: var(--tx-link-invalid-color, #ef4444);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;EAcA,MAAM,cAAc,SAAoB,KAAK,QAAQ,EAAE,wBAAwB,KAAK,MAAM,IAAI,KAAA;;GAI1F,OAAAA,UAAA,GAAAC,mBAmBM,OAnBN,YAmBM,EAlBFD,UAAA,IAAA,GAAAC,mBAYIC,UAAA,MAAAC,WAXe,QAAA,QAAR,SAAI;IADf,OAAAH,UAAA,GAAAC,mBAYI,KAAA;KAVC,KAAK,KAAK;KACX,OAAKG,eAAA,CAAC,WAAS,EAAA,UACK,QAAA,eAAe,KAAK,GAAE,CAAA,CAAA;KACzC,gBAAc,KAAK;KACnB,OAAKC,eAAE,WAAW,IAAI,CAAA;;KAEX,QAAA,QAAZL,UAAA,GAAAC,mBAAqD,QAAA;;MAAnC,OAAM;MAAgB,GAAG,KAAK;;KAChDM,mBAAyC,QAAA;MAAnC,OAAM;MAAgB,GAAG,KAAK;;KACxB,KAAK,QAAjBP,UAAA,GAAAC,mBAA6D,QAAA;;MAAtC,OAAM;MAAgB,GAAG,KAAK;;KACrDM,mBAAwC,QAAA;MAAlC,OAAM;MAAe,GAAG,KAAK;;;G,WAG9B,QAAA,WAATP,UAAA,GAAAC,mBAGI,KAAA;;IAHc,OAAKG,eAAA,CAAC,2BAAyB,EAAA,SAAoB,QAAA,QAAQ,QAAO,CAAA,CAAA;IAAK,OAAKC,eAAE,WAAW,QAAA,OAAO,CAAA;G,IAC9GE,mBAA4C,QAAA;IAAtC,OAAM;IAAgB,GAAG,QAAA,QAAQ;G,yBAC3B,QAAA,QAAQ,QAApBP,UAAA,GAAAC,mBAAmE,QAAA;;IAAzC,OAAM;IAAgB,GAAG,QAAA,QAAQ"}
|
|
1
|
+
{"version":3,"file":"links.js","names":["_openBlock","_createElementBlock","_Fragment","_renderList","_normalizeClass","_normalizeStyle","_createCommentVNode","_createElementVNode","_sfc_main"],"sources":["../src/links/TaoxLinks.vue","../src/links/TaoxLinks.vue"],"sourcesContent":["<script lang=\"ts\" setup>\r\nimport type { LinkDash, LinkLine, LinkPreview } from './types';\r\n\r\ndefineProps<{\r\n lines: readonly LinkLine[];\r\n selectedId?: string | null;\r\n preview?: LinkPreview | null;\r\n /**\r\n * Highlight the hovered and selected link with a blurred glow.\r\n * Подсвечивать наведённую и выбранную связь размытым свечением.\r\n */\r\n glow?: boolean;\r\n}>();\r\n\r\n// Own colour and thickness go as variables: a link without them renders as before.\r\n// Свои цвет и толщина идут переменными: связь без них рисуется как раньше.\r\nfunction lineStyle(line: LinkLine) {\r\n const style: Record<string, string> = {};\r\n if (line.color) style['--tx-link-line-color'] = line.color;\r\n if (typeof line.width === 'number' && Number.isFinite(line.width) && line.width > 0) {\r\n style['--tx-link-line-width'] = String(line.width);\r\n style['--tx-link-line-width-active'] = String(line.width + 1);\r\n }\r\n return Object.keys(style).length ? style : undefined;\r\n}\r\n\r\nconst dashClass = (dash: LinkDash | undefined) => (dash === 'dashed' ? 'tx-link-dashed' : dash === 'dotted' ? 'tx-link-dotted' : undefined);\r\n</script>\r\n\r\n<template>\r\n <svg class=\"tx-links\" width=\"1\" height=\"1\">\r\n <g\r\n v-for=\"line in lines\"\r\n :key=\"line.id\"\r\n class=\"tx-link\"\r\n :class=\"[{ selected: selectedId === line.id }, dashClass(line.dash)]\"\r\n :data-conn-id=\"line.id\"\r\n :style=\"lineStyle(line)\"\r\n >\r\n <path v-if=\"glow\" class=\"tx-link-glow\" :d=\"line.d\" />\r\n <path class=\"tx-link-line\" :d=\"line.d\" />\r\n <path v-if=\"line.head\" class=\"tx-link-head\" :d=\"line.head\" />\r\n <path class=\"tx-link-hit\" :d=\"line.d\" />\r\n </g>\r\n\r\n <g v-if=\"preview\" class=\"tx-link tx-link-preview\" :class=\"[{ invalid: preview.invalid }, dashClass(preview.dash)]\" :style=\"lineStyle(preview)\">\r\n <path class=\"tx-link-line\" :d=\"preview.d\" />\r\n <path v-if=\"preview.head\" class=\"tx-link-head\" :d=\"preview.head\" />\r\n </g>\r\n </svg>\r\n</template>\r\n\r\n<style>\r\n/*\r\n * Configured with CSS variables on any ancestor:\r\n * Настройка через CSS-переменные на любом предке:\r\n * --tx-link-color, --tx-link-hover-color, --tx-link-selected-color, --tx-link-preview-color, --tx-link-invalid-color,\r\n * --tx-link-width, --tx-link-width-active, --tx-link-hit, --tx-link-hit-coarse, --tx-link-glow (opacity of the glow).\r\n * --tx-link-width, --tx-link-width-active, --tx-link-hit, --tx-link-hit-coarse, --tx-link-glow (непрозрачность свечения).\r\n */\r\n.tx-links {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n overflow: visible;\r\n pointer-events: none;\r\n}\r\n\r\n.tx-links path {\r\n fill: none;\r\n stroke-linecap: round;\r\n /* thickness in screen pixels, independent of zoom / толщина в экранных пикселях, не зависит от зума */\r\n vector-effect: non-scaling-stroke;\r\n}\r\n\r\n.tx-link {\r\n --tx-link-now: var(--tx-link-line-color, var(--tx-link-color, #9ca3af));\r\n}\r\n\r\n/* A link without its own colour turns the hover colour on hover. An own colour stays on hover (it gets thicker and glows). / Своего цвета у связи нет: наведение красит её в hover-цвет. Свой цвет при наведении остаётся (утолщается и светится). */\r\n.tx-link:hover {\r\n --tx-link-now: var(--tx-link-line-color, var(--tx-link-hover-color, #fff));\r\n}\r\n\r\n.tx-link.selected {\r\n --tx-link-now: var(--tx-link-selected-color, #f59e0b);\r\n}\r\n\r\n.tx-link-line {\r\n stroke: var(--tx-link-now);\r\n stroke-width: var(--tx-link-line-width, var(--tx-link-width, 2));\r\n pointer-events: none;\r\n}\r\n\r\n.tx-link:hover .tx-link-line,\r\n.tx-link.selected .tx-link-line {\r\n stroke-width: var(--tx-link-line-width-active, var(--tx-link-width-active, 3));\r\n}\r\n\r\n/*\r\n * Line styles. The pattern is in line widths (`--tx-link-width` is a plain number, as the width is), in screen pixels\r\n * because of non-scaling-stroke. The round caps add half a width to both ends of a dash: dashes 4w long with gaps 2w,\r\n * and dots of one width with a gap of one width. The hover width does not change the pattern.\r\n * Стили линии. Узор в толщинах линии (`--tx-link-width` — просто число, как и толщина), в экранных пикселях из-за\r\n * non-scaling-stroke. Круглые концы прибавляют полтолщины с обеих сторон штриха: штрихи длиной 4w с пропусками 2w\r\n * и точки в одну толщину с пропуском в одну толщину. Толщина при наведении узор не меняет.\r\n */\r\n.tx-link-dashed .tx-link-line {\r\n stroke-dasharray: calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 3px) calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 3px);\r\n}\r\n\r\n.tx-link-dotted .tx-link-line {\r\n stroke-dasharray: 0 calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 2px);\r\n}\r\n\r\n/* The selector is as specific as `.tx-links path` above: with a shorter one `fill: none` won and the arrowhead was invisible. / Селектор той же специфичности, что у `.tx-links path` выше: с коротким побеждал `fill: none`, и наконечник не был виден. */\r\n.tx-links .tx-link-head {\r\n fill: var(--tx-link-now);\r\n stroke: none;\r\n pointer-events: none;\r\n}\r\n\r\n.tx-link-glow {\r\n stroke: var(--tx-link-now);\r\n stroke-width: 9;\r\n opacity: 0;\r\n filter: blur(3px);\r\n pointer-events: none;\r\n}\r\n\r\n.tx-link:hover .tx-link-glow,\r\n.tx-link.selected .tx-link-glow {\r\n opacity: var(--tx-link-glow, 0.35);\r\n}\r\n\r\n.tx-link-hit {\r\n stroke: transparent;\r\n stroke-width: var(--tx-link-hit, 14);\r\n pointer-events: stroke;\r\n cursor: pointer;\r\n}\r\n\r\n/* A finger is thicker than a cursor: the hit area of a link is wider. / Палец толще курсора: зона попадания по связи шире. */\r\n@media (pointer: coarse) {\r\n .tx-link-hit {\r\n stroke-width: var(--tx-link-hit-coarse, 30);\r\n }\r\n}\r\n\r\n.tx-link-preview {\r\n --tx-link-now: var(--tx-link-line-color, var(--tx-link-preview-color, #f59e0b));\r\n opacity: 0.85;\r\n}\r\n\r\n.tx-link-preview .tx-link-line {\r\n stroke-dasharray: 6 4;\r\n}\r\n\r\n.tx-link-preview.tx-link-dashed .tx-link-line {\r\n stroke-dasharray: calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 3px) calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 3px);\r\n}\r\n\r\n.tx-link-preview.tx-link-dotted .tx-link-line {\r\n stroke-dasharray: 0 calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 2px);\r\n}\r\n\r\n.tx-link-preview.invalid {\r\n --tx-link-now: var(--tx-link-invalid-color, #ef4444);\r\n}\r\n</style>\r\n","<script lang=\"ts\" setup>\r\nimport type { LinkDash, LinkLine, LinkPreview } from './types';\r\n\r\ndefineProps<{\r\n lines: readonly LinkLine[];\r\n selectedId?: string | null;\r\n preview?: LinkPreview | null;\r\n /**\r\n * Highlight the hovered and selected link with a blurred glow.\r\n * Подсвечивать наведённую и выбранную связь размытым свечением.\r\n */\r\n glow?: boolean;\r\n}>();\r\n\r\n// Own colour and thickness go as variables: a link without them renders as before.\r\n// Свои цвет и толщина идут переменными: связь без них рисуется как раньше.\r\nfunction lineStyle(line: LinkLine) {\r\n const style: Record<string, string> = {};\r\n if (line.color) style['--tx-link-line-color'] = line.color;\r\n if (typeof line.width === 'number' && Number.isFinite(line.width) && line.width > 0) {\r\n style['--tx-link-line-width'] = String(line.width);\r\n style['--tx-link-line-width-active'] = String(line.width + 1);\r\n }\r\n return Object.keys(style).length ? style : undefined;\r\n}\r\n\r\nconst dashClass = (dash: LinkDash | undefined) => (dash === 'dashed' ? 'tx-link-dashed' : dash === 'dotted' ? 'tx-link-dotted' : undefined);\r\n</script>\r\n\r\n<template>\r\n <svg class=\"tx-links\" width=\"1\" height=\"1\">\r\n <g\r\n v-for=\"line in lines\"\r\n :key=\"line.id\"\r\n class=\"tx-link\"\r\n :class=\"[{ selected: selectedId === line.id }, dashClass(line.dash)]\"\r\n :data-conn-id=\"line.id\"\r\n :style=\"lineStyle(line)\"\r\n >\r\n <path v-if=\"glow\" class=\"tx-link-glow\" :d=\"line.d\" />\r\n <path class=\"tx-link-line\" :d=\"line.d\" />\r\n <path v-if=\"line.head\" class=\"tx-link-head\" :d=\"line.head\" />\r\n <path class=\"tx-link-hit\" :d=\"line.d\" />\r\n </g>\r\n\r\n <g v-if=\"preview\" class=\"tx-link tx-link-preview\" :class=\"[{ invalid: preview.invalid }, dashClass(preview.dash)]\" :style=\"lineStyle(preview)\">\r\n <path class=\"tx-link-line\" :d=\"preview.d\" />\r\n <path v-if=\"preview.head\" class=\"tx-link-head\" :d=\"preview.head\" />\r\n </g>\r\n </svg>\r\n</template>\r\n\r\n<style>\r\n/*\r\n * Configured with CSS variables on any ancestor:\r\n * Настройка через CSS-переменные на любом предке:\r\n * --tx-link-color, --tx-link-hover-color, --tx-link-selected-color, --tx-link-preview-color, --tx-link-invalid-color,\r\n * --tx-link-width, --tx-link-width-active, --tx-link-hit, --tx-link-hit-coarse, --tx-link-glow (opacity of the glow).\r\n * --tx-link-width, --tx-link-width-active, --tx-link-hit, --tx-link-hit-coarse, --tx-link-glow (непрозрачность свечения).\r\n */\r\n.tx-links {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n overflow: visible;\r\n pointer-events: none;\r\n}\r\n\r\n.tx-links path {\r\n fill: none;\r\n stroke-linecap: round;\r\n /* thickness in screen pixels, independent of zoom / толщина в экранных пикселях, не зависит от зума */\r\n vector-effect: non-scaling-stroke;\r\n}\r\n\r\n.tx-link {\r\n --tx-link-now: var(--tx-link-line-color, var(--tx-link-color, #9ca3af));\r\n}\r\n\r\n/* A link without its own colour turns the hover colour on hover. An own colour stays on hover (it gets thicker and glows). / Своего цвета у связи нет: наведение красит её в hover-цвет. Свой цвет при наведении остаётся (утолщается и светится). */\r\n.tx-link:hover {\r\n --tx-link-now: var(--tx-link-line-color, var(--tx-link-hover-color, #fff));\r\n}\r\n\r\n.tx-link.selected {\r\n --tx-link-now: var(--tx-link-selected-color, #f59e0b);\r\n}\r\n\r\n.tx-link-line {\r\n stroke: var(--tx-link-now);\r\n stroke-width: var(--tx-link-line-width, var(--tx-link-width, 2));\r\n pointer-events: none;\r\n}\r\n\r\n.tx-link:hover .tx-link-line,\r\n.tx-link.selected .tx-link-line {\r\n stroke-width: var(--tx-link-line-width-active, var(--tx-link-width-active, 3));\r\n}\r\n\r\n/*\r\n * Line styles. The pattern is in line widths (`--tx-link-width` is a plain number, as the width is), in screen pixels\r\n * because of non-scaling-stroke. The round caps add half a width to both ends of a dash: dashes 4w long with gaps 2w,\r\n * and dots of one width with a gap of one width. The hover width does not change the pattern.\r\n * Стили линии. Узор в толщинах линии (`--tx-link-width` — просто число, как и толщина), в экранных пикселях из-за\r\n * non-scaling-stroke. Круглые концы прибавляют полтолщины с обеих сторон штриха: штрихи длиной 4w с пропусками 2w\r\n * и точки в одну толщину с пропуском в одну толщину. Толщина при наведении узор не меняет.\r\n */\r\n.tx-link-dashed .tx-link-line {\r\n stroke-dasharray: calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 3px) calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 3px);\r\n}\r\n\r\n.tx-link-dotted .tx-link-line {\r\n stroke-dasharray: 0 calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 2px);\r\n}\r\n\r\n/* The selector is as specific as `.tx-links path` above: with a shorter one `fill: none` won and the arrowhead was invisible. / Селектор той же специфичности, что у `.tx-links path` выше: с коротким побеждал `fill: none`, и наконечник не был виден. */\r\n.tx-links .tx-link-head {\r\n fill: var(--tx-link-now);\r\n stroke: none;\r\n pointer-events: none;\r\n}\r\n\r\n.tx-link-glow {\r\n stroke: var(--tx-link-now);\r\n stroke-width: 9;\r\n opacity: 0;\r\n filter: blur(3px);\r\n pointer-events: none;\r\n}\r\n\r\n.tx-link:hover .tx-link-glow,\r\n.tx-link.selected .tx-link-glow {\r\n opacity: var(--tx-link-glow, 0.35);\r\n}\r\n\r\n.tx-link-hit {\r\n stroke: transparent;\r\n stroke-width: var(--tx-link-hit, 14);\r\n pointer-events: stroke;\r\n cursor: pointer;\r\n}\r\n\r\n/* A finger is thicker than a cursor: the hit area of a link is wider. / Палец толще курсора: зона попадания по связи шире. */\r\n@media (pointer: coarse) {\r\n .tx-link-hit {\r\n stroke-width: var(--tx-link-hit-coarse, 30);\r\n }\r\n}\r\n\r\n.tx-link-preview {\r\n --tx-link-now: var(--tx-link-line-color, var(--tx-link-preview-color, #f59e0b));\r\n opacity: 0.85;\r\n}\r\n\r\n.tx-link-preview .tx-link-line {\r\n stroke-dasharray: 6 4;\r\n}\r\n\r\n.tx-link-preview.tx-link-dashed .tx-link-line {\r\n stroke-dasharray: calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 3px) calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 3px);\r\n}\r\n\r\n.tx-link-preview.tx-link-dotted .tx-link-line {\r\n stroke-dasharray: 0 calc(var(--tx-link-line-width, var(--tx-link-width, 2)) * 2px);\r\n}\r\n\r\n.tx-link-preview.invalid {\r\n --tx-link-now: var(--tx-link-invalid-color, #ef4444);\r\n}\r\n</style>\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;EAgBA,SAAS,UAAU,MAAgB;GAC/B,MAAM,QAAgC,CAAC;GACvC,IAAI,KAAK,OAAO,MAAM,0BAA0B,KAAK;GACrD,IAAI,OAAO,KAAK,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,KAAK,KAAK,QAAQ,GAAG;IACjF,MAAM,0BAA0B,OAAO,KAAK,KAAK;IACjD,MAAM,iCAAiC,OAAO,KAAK,QAAQ,CAAC;GAChE;GACA,OAAO,OAAO,KAAK,KAAK,CAAC,CAAC,SAAS,QAAQ,KAAA;EAC/C;EAEA,MAAM,aAAa,SAAgC,SAAS,WAAW,mBAAmB,SAAS,WAAW,mBAAmB,KAAA;;GAI7H,OAAAA,UAAA,GAAAC,mBAmBM,OAnBN,YAmBM,EAlBFD,UAAA,IAAA,GAAAC,mBAYIC,UAAA,MAAAC,WAXe,QAAA,QAAR,SAAI;IADf,OAAAH,UAAA,GAAAC,mBAYI,KAAA;KAVC,KAAK,KAAK;KACX,OAAKG,eAAA,CAAC,WAAS,CAAA,EAAA,UACM,QAAA,eAAe,KAAK,GAAE,GAAI,UAAU,KAAK,IAAI,CAAA,CAAA,CAAA;KACjE,gBAAc,KAAK;KACnB,OAAKC,eAAE,UAAU,IAAI,CAAA;;KAEV,QAAA,QAAZL,UAAA,GAAAC,mBAAqD,QAAA;;MAAnC,OAAM;MAAgB,GAAG,KAAK;;KAChDM,mBAAyC,QAAA;MAAnC,OAAM;MAAgB,GAAG,KAAK;;KACxB,KAAK,QAAjBP,UAAA,GAAAC,mBAA6D,QAAA;;MAAtC,OAAM;MAAgB,GAAG,KAAK;;KACrDM,mBAAwC,QAAA;MAAlC,OAAM;MAAe,GAAG,KAAK;;;G,WAG9B,QAAA,WAATP,UAAA,GAAAC,mBAGI,KAAA;;IAHc,OAAKG,eAAA,CAAC,2BAAyB,CAAA,EAAA,SAAqB,QAAA,QAAQ,QAAO,GAAI,UAAU,QAAA,QAAQ,IAAI,CAAA,CAAA,CAAA;IAAK,OAAKC,eAAE,UAAU,QAAA,OAAO,CAAA;G,IACxIE,mBAA4C,QAAA;IAAtC,OAAM;IAAgB,GAAG,QAAA,QAAQ;G,yBAC3B,QAAA,QAAQ,QAApBP,UAAA,GAAAC,mBAAmE,QAAA;;IAAzC,OAAM;IAAgB,GAAG,QAAA,QAAQ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1337exp/taoux",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Interaction and behavior building blocks for Vue apps: curve and gradient editors, canvas, undo/redo, playback. Import only what you need, bring your own design.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -177,6 +177,7 @@
|
|
|
177
177
|
},
|
|
178
178
|
"scripts": {
|
|
179
179
|
"build": "vite build && vue-tsc -p tsconfig.build.json",
|
|
180
|
+
"build:watch": "vite build --watch --emptyOutDir false",
|
|
180
181
|
"dev": "node scripts/dev.mjs",
|
|
181
182
|
"sandbox": "vite --config vite.sandbox.config.ts",
|
|
182
183
|
"sandbox:build": "vite build --config vite.sandbox.config.ts",
|
package/skills/taoux/SKILL.md
CHANGED
|
@@ -53,7 +53,7 @@ controls, or with your own design.
|
|
|
53
53
|
| `undovue` | `undo` and `history` for Vue: `useUndoStack`, `useHistory` (the same classes with `canUndo` / `canRedo` as refs, so the Undo / Redo menu items follow), `useUndoFlags(existing)` + `sync()` |
|
|
54
54
|
| `i18n` | typed i18n: `createI18n({ locales, fallback, storageKey })` |
|
|
55
55
|
| `links` (Vue) | `TaoxLinks`: an SVG layer of links from ready geometry |
|
|
56
|
-
| `canvas` (Vue) | `TaoxCanvas`: pan / zoom canvas with mouse, touch, wheel, auto-scroll, keys; the `CanvasHost` contract; prop `background: 'grid' | 'dots' | 'none'`; options `marquee: 'contain'` (only nodes wholly inside the frame), `zoom: { min, max }`; host `claimsKey(e)` keeps a key from the canvas while a tool uses it; host `placing` + `placeAt(screen, world)` is a "place a node" tool (the next left press only says where); host `contextMenu(screen, world, target)` shows the app's menu on a right click (true) or leaves the palette (false) |
|
|
56
|
+
| `canvas` (Vue) | `TaoxCanvas`: pan / zoom canvas with mouse, touch, wheel, auto-scroll, keys; the `CanvasHost` contract; prop `background: 'grid' | 'dots' | 'none'`; options `marquee: 'contain'` (only nodes wholly inside the frame), `zoom: { min, max }`; option `inertia: true | { friction, minSpeed, maxSpeed }` (the camera glides after a pan released on the move: only a clear flick, 0.4 px/ms by default, glides; a pointer held still before the release stops it, a 1:1 drag; the arithmetic is `canvas/glide`); the world offset lands on whole device pixels; option `keys: 'window' | 'focus'` (default `'window'`: the keys Delete / Esc / Ctrl+Z work from the whole window; `'focus'`: only when the event comes from inside the canvas, which takes focus on a press, for a canvas beside a drawer or text fields); host `claimsKey(e)` keeps a key from the canvas while a tool uses it; host `placing` + `placeAt(screen, world)` is a "place a node" tool (the next left press only says where); host `contextMenu(screen, world, target)` shows the app's menu on a right click (true) or leaves the palette (false) |
|
|
57
57
|
| `curveeditor` (Vue) | `TaoxCurveEditor`: points, snapping, bounds, per-segment easing with Bezier handles, keyboard; time is 0…1, `formatT(t)` writes it as years, seconds… on the axis and tag |
|
|
58
58
|
| `gradienteditor` (Vue) | `TaoxGradientEditor`: stops on a bar, `gradientCss`, keyboard |
|
|
59
59
|
| `curvefield` (Vue, needs TaoUI) | `TaoxCurveField`: a curve editor with TaoUI fields for time, value, easing, snapping |
|