@1337exp/taoux 0.5.6 → 0.7.1

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.1
4
+
5
+ Nothing to migrate: three options, all off by default; an app that does not pass them works as before.
6
+
7
+ - **`canvas`: a selection frame that picks only what lies wholly inside.** `options.marquee: 'contain'` (default `'intersect'`, as before). In a level editor a frame drawn over a few objects also touched the ground under them and picked it; with `contain` only the nodes inside the frame are selected (a container still counts by its strip).
8
+ - **`canvas` and `camera`: your own zoom range.** The wheel and the pinch were clamped to 0.2…2 by constants, too narrow for a world thousands of units long. `options.zoom: { min?, max? }` sets the range of the canvas; `zoomAt(cam, sx, sy, factor, limits?)` takes it too, and `zoomLimits(partial)` / `clampZoom(z, limits?)` / `ZOOM_LIMITS` are exported. `session` takes the same `zoom` so a loaded view is clamped to the same range.
9
+ - **`canvas`: the app can keep a key from the canvas.** The canvas listens to Delete, Backspace, Escape and Ctrl+Z / Y on the whole window, so a tool that used Backspace (drop the last point of a path) also deleted the selection. `host.claimsKey(event)` is asked first; returning true leaves the key to the app.
10
+
11
+ ## 0.7.0
12
+
13
+ Nothing to migrate: a new module, nothing existing changes.
14
+
15
+ - **New module `undovue`: reactive `canUndo` / `canRedo` for `UndoStack` and `History`.** Both are plain classes whose flags are getters, so an app that wants the Undo and Redo items of a menu to switch on and off had to keep two refs and a `syncFlags()` by hand (every project that uses `undo` or `history` did). `useUndoStack(optionsOrStack)` and `useHistory(initialOrHistory)` wrap the class and keep `canUndo` / `canRedo` (read-only refs) in step after `record`, `undo`, `redo`, `clear`, `commit`, `reset`; `useHistory` also fits `historyCommands` as a source. For a stack you already made (a factory of yours, a store), `useUndoFlags(source)` gives the refs and `sync()`. The classes themselves are not touched.
16
+
17
+ ## 0.6.0
18
+
19
+ - **New module `tour`: the model of a guided tour of a page.** `createTour({ steps, available, onEnd })` is a plain state machine without Vue: `start`, `next`, `prev`, `goTo`, `skip`, `finish`, `setSteps`, `subscribe`. A step is `{ id, ...yours }`; one that `available` refuses (its target is not on the page) is jumped over in both directions, and `first` / `last` say whether there is anywhere to go, and `position` / `total` count only the steps that can be shown (for a "2 of 4" that does not count the skipped ones). A tour ends once as `done` or `skipped`. `useTour` is the same with refs for a component, `createTourMemory(key)` remembers that a tour was seen. It draws nothing: the spotlight and the card belong to the app or to TaoUI.
20
+
3
21
  ## 0.5.6
4
22
 
5
23
  - **`swiperow`: an open row does not click through.** The row that stayed open on its actions still had a live face: a tap on the sliver of it that is left opened the item, and the press outside that closed the row went on to a click on whatever lay under the finger (another row opened). Now a click on the open row only closes it and does not reach its content, and the click after a press outside is swallowed once (a mail app does the same). `:swallow-outside-click="false"` lets the outside click through after the row has closed. A press that gives no click (a scroll) lets go of the guard after 0.6 s. The action buttons work as before.
package/README.md CHANGED
@@ -107,10 +107,12 @@ import { History } from '@1337exp/taoux/history';
107
107
  | `curvefield` (Vue, tier 2) | `TaoxCurveField`: a curve with fields on TaoUI components: point time and value, transition to the next point (`ease`), snapping, remove and reset; labels come from the app | vue, **@1337exp/taoui** (peer) |
108
108
  | `gradienteditor` (Vue) | gradient bar with stop handles; stop operations, `gradientCss`; keyboard (Tab, arrows, Home/End, Insert, Delete) | vue (peer) |
109
109
  | `playback` | playback model: time, pause, loop, speed, seeking; `createPlayback` without Vue and `usePlayback` for a component | vue (peer, for `usePlayback`) |
110
+ | `tour` | a guided tour of a page, step by step: `createTour` without Vue (jumps over steps whose target is gone, ends as `done` or `skipped`), `useTour` for a component, `createTourMemory` so it shows once | vue (peer, for `useTour`), storage |
111
+ | `undovue` | `undo` and `history` for Vue: `useUndoStack` and `useHistory` keep `canUndo` / `canRedo` as refs after every move (for `historyCommands` and the menu); `useUndoFlags(source)` + `sync()` for a stack you already have | vue (peer) |
110
112
  | `pins` | row pin positions measured from the DOM: `usePinMeasure`, `createPinRegistry` | vue (peer) |
111
113
  | `i18n` | typed i18n: `createI18n({ locales, fallback, storageKey })` | vue (peer, optional) |
112
114
 
113
- Vue modules (`links`, `canvas`, `curveeditor`, `curvefield`, `gradienteditor`, `swiperow`) need their styles imported explicitly: `import '@1337exp/taoux/canvas.css'`. Composite modules (session, commands, palette, links, canvas, pins, curveeditor, gradienteditor, playback) import only primitives. Tier 2, fields (`curvefield`, `swiperow`), assemble composites into a ready field on TaoUI components: it is the only tier allowed to import TaoUI, which is why `@1337exp/taoui` is an optional peer dependency. `curvefield` needs both `curveeditor.css` and `curvefield.css`. The `tiers.test.ts` test guards all of that. The swipe row, its variables and how to test a swipe are in [docs/swiperow.md](docs/swiperow.md) ([Русский](docs/swiperow.ru.md)). The canvas contract is described in [docs/canvas.md](docs/canvas.md) ([Русский](docs/canvas.ru.md)); transitions between curve points are in [docs/ease.md](docs/ease.md) ([Русский](docs/ease.ru.md)).
115
+ Vue modules (`links`, `canvas`, `curveeditor`, `curvefield`, `gradienteditor`, `swiperow`) need their styles imported explicitly: `import '@1337exp/taoux/canvas.css'`. Composite modules (session, commands, palette, links, canvas, pins, curveeditor, gradienteditor, playback, tour, undovue) import only primitives. Tier 2, fields (`curvefield`, `swiperow`), assemble composites into a ready field on TaoUI components: it is the only tier allowed to import TaoUI, which is why `@1337exp/taoui` is an optional peer dependency. `curvefield` needs both `curveeditor.css` and `curvefield.css`. The `tiers.test.ts` test guards all of that. The swipe row, its variables and how to test a swipe are in [docs/swiperow.md](docs/swiperow.md) ([Русский](docs/swiperow.ru.md)). The canvas contract is described in [docs/canvas.md](docs/canvas.md) ([Русский](docs/canvas.ru.md)); transitions between curve points are in [docs/ease.md](docs/ease.md) ([Русский](docs/ease.ru.md)).
114
116
 
115
117
  The rule: a module lands here when a second project needs it. A module's core knows nothing about Vue or the DOM unless that is its job.
116
118
 
@@ -134,7 +136,7 @@ Working against a local checkout instead of npm: put `"@1337exp/taoux": "file:..
134
136
 
135
137
  ## Sandbox
136
138
 
137
- The `sandbox/` folder is a demo and a testing ground: pages import the modules straight from `src/`, with no build. It holds `curveeditor`, `curvefield`, `gradienteditor`, `slider`, `color`, `playback`, `sortable` and `swiperow`, with an EN / RU switch and a dark / light switch (the TaoUI theme, through the bridge). A new page is `sandbox/<name>.html` + `.ts` + a demo `.vue` and a link in `sandbox/index.html`. `npm run sandbox:build` makes a static copy with relative paths, ready for any folder (for example `/sandbox/taoux/`).
139
+ The `sandbox/` folder is a demo and a testing ground: pages import the modules straight from `src/`, with no build. It holds `curveeditor`, `curvefield`, `gradienteditor`, `slider`, `color`, `playback`, `sortable`, `swiperow` and `tour`, with an EN / RU switch and a dark / light switch (the TaoUI theme, through the bridge). A new page is `sandbox/<name>.html` + `.ts` + a demo `.vue` and a link in `sandbox/index.html`. `npm run sandbox:build` makes a static copy with relative paths, ready for any folder (for example `/sandbox/taoux/`).
138
140
 
139
141
  Screenshots and clips in this README come from the sandbox: see [docs/media](docs/media/README.md).
140
142
 
package/README.ru.md CHANGED
@@ -107,10 +107,12 @@ import { History } from '@1337exp/taoux/history';
107
107
  | `curvefield` (Vue, ярус 2) | `TaoxCurveField`: кривая с полями на компонентах TaoUI: время и значение точки, переход к следующей точке (`ease`), шаг, удаление и сброс; надписи задаёт приложение | vue, **@1337exp/taoui** (peer) |
108
108
  | `gradienteditor` (Vue) | полоса градиента с ручками остановок; операции над остановками, `gradientCss`; клавиатура (Tab, стрелки, Home/End, Insert, Delete) | vue (peer) |
109
109
  | `playback` | модель воспроизведения: время, пауза, цикл, скорость, перемотка; `createPlayback` без Vue и `usePlayback` для компонента | vue (peer, для `usePlayback`) |
110
+ | `tour` | тур по странице по шагам: `createTour` без Vue (перепрыгивает шаги, у которых пропала цель, завершается как `done` или `skipped`), `useTour` для компонента, `createTourMemory`, чтобы показывался один раз | vue (peer, для `useTour`), storage |
111
+ | `undovue` | `undo` и `history` для Vue: `useUndoStack` и `useHistory` держат `canUndo` / `canRedo` как ref после каждого хода (для `historyCommands` и меню); `useUndoFlags(source)` + `sync()` для уже готового стека | vue (peer) |
110
112
  | `pins` | позиции пинов-строк, измеренные по DOM: `usePinMeasure`, `createPinRegistry` | vue (peer) |
111
113
  | `i18n` | типизированный i18n: `createI18n({ locales, fallback, storageKey })` | vue (peer, опционально) |
112
114
 
113
- Vue-модули (`links`, `canvas`, `curveeditor`, `curvefield`, `gradienteditor`, `swiperow`) требуют явного импорта стилей: `import '@1337exp/taoux/canvas.css'`. Составные модули (session, commands, palette, links, canvas, pins, curveeditor, gradienteditor, playback) импортируют только примитивы. Ярус 2, поля (`curvefield`, `swiperow`), собирает составные модули в готовое поле на компонентах TaoUI: только ему можно импортировать TaoUI, поэтому `@1337exp/taoui` это необязательная peer-зависимость. Для `curvefield` нужны оба файла стилей, `curveeditor.css` и `curvefield.css`. Всё это охраняет тест `tiers.test.ts`; строка со свайпом, её переменные и как проверять свайп — в [docs/swiperow.ru.md](docs/swiperow.ru.md); контракт холста описан в [docs/canvas.ru.md](docs/canvas.ru.md), переходы между точками кривой в [docs/ease.ru.md](docs/ease.ru.md).
115
+ Vue-модули (`links`, `canvas`, `curveeditor`, `curvefield`, `gradienteditor`, `swiperow`) требуют явного импорта стилей: `import '@1337exp/taoux/canvas.css'`. Составные модули (session, commands, palette, links, canvas, pins, curveeditor, gradienteditor, playback, tour, undovue) импортируют только примитивы. Ярус 2, поля (`curvefield`, `swiperow`), собирает составные модули в готовое поле на компонентах TaoUI: только ему можно импортировать TaoUI, поэтому `@1337exp/taoui` это необязательная peer-зависимость. Для `curvefield` нужны оба файла стилей, `curveeditor.css` и `curvefield.css`. Всё это охраняет тест `tiers.test.ts`; строка со свайпом, её переменные и как проверять свайп — в [docs/swiperow.ru.md](docs/swiperow.ru.md); контракт холста описан в [docs/canvas.ru.md](docs/canvas.ru.md), переходы между точками кривой в [docs/ease.ru.md](docs/ease.ru.md).
114
116
 
115
117
  Правило: модуль попадает сюда, когда он понадобился во втором проекте. Ядро модулей не знает про Vue и DOM, если это не их задача.
116
118
 
@@ -136,7 +138,7 @@ npm run dev # watch: пересборка JS и деклараций
136
138
 
137
139
  ## Песочница
138
140
 
139
- Папка `sandbox/` это демо и поле для проверки: страницы подключают модули прямо из `src/`, без сборки. Сейчас там `curveeditor`, `curvefield`, `gradienteditor`, `slider`, `color`, `playback`, `sortable` и `swiperow`, с переключателем языка (EN / RU) и темы (тёмная / светлая: тема TaoUI через мост). Новая страница = `sandbox/<имя>.html` + `.ts` + демо `.vue` и ссылка в `sandbox/index.html`. `npm run sandbox:build` собирает статическую копию с относительными путями, её можно положить в любую папку (например, `/sandbox/taoux/`).
141
+ Папка `sandbox/` это демо и поле для проверки: страницы подключают модули прямо из `src/`, без сборки. Сейчас там `curveeditor`, `curvefield`, `gradienteditor`, `slider`, `color`, `playback`, `sortable`, `swiperow` и `tour`, с переключателем языка (EN / RU) и темы (тёмная / светлая: тема TaoUI через мост). Новая страница = `sandbox/<имя>.html` + `.ts` + демо `.vue` и ссылка в `sandbox/index.html`. `npm run sandbox:build` собирает статическую копию с относительными путями, её можно положить в любую папку (например, `/sandbox/taoux/`).
140
142
 
141
143
  Скриншоты и ролики в этом README сняты с песочницы: см. [docs/media](docs/media/README.md).
142
144
 
package/dist/camera.d.ts CHANGED
@@ -11,12 +11,27 @@ export interface Camera {
11
11
  }
12
12
  export declare const MIN_ZOOM = 0.2;
13
13
  export declare const MAX_ZOOM = 2;
14
+ /**
15
+ * The range of the zoom. Apps with another scale of the world (a level a thousand units long) pass their own.
16
+ * Диапазон масштаба. Приложения с другим масштабом мира (уровень длиной в тысячу единиц) передают свой.
17
+ */
18
+ export interface ZoomLimits {
19
+ min: number;
20
+ max: number;
21
+ }
22
+ export declare const ZOOM_LIMITS: Readonly<ZoomLimits>;
23
+ /**
24
+ * Limits with the defaults filled in: `{ min: 0.05 }` keeps the default maximum.
25
+ * Пределы с подставленными значениями по умолчанию: `{ min: 0.05 }` оставляет максимум прежним.
26
+ */
27
+ export declare function zoomLimits(limits?: Partial<ZoomLimits>): ZoomLimits;
28
+ export declare const clampZoom: (z: number, limits?: Readonly<ZoomLimits>) => number;
14
29
  export declare const createCamera: () => Camera;
15
30
  export declare function screenToWorld(cam: Camera, sx: number, sy: number): [number, number];
16
31
  export declare function worldToScreen(cam: Camera, wx: number, wy: number): [number, number];
17
32
  export declare function panBy(cam: Camera, dx: number, dy: number): Camera;
18
33
  /**
19
- * Zoom by `factor`; the point under the cursor (sx, sy) stays where it is.
20
- * Масштаб в `factor` раз; точка под курсором (sx, sy) остаётся на месте.
34
+ * Zoom by `factor`; the point under the cursor (sx, sy) stays where it is. `limits` default to 0.2…2.
35
+ * Масштаб в `factor` раз; точка под курсором (sx, sy) остаётся на месте. `limits` по умолчанию 0.2…2.
21
36
  */
22
- export declare function zoomAt(cam: Camera, sx: number, sy: number, factor: number): Camera;
37
+ export declare function zoomAt(cam: Camera, sx: number, sy: number, factor: number, limits?: Readonly<ZoomLimits>): Camera;
package/dist/camera.js CHANGED
@@ -1,6 +1,21 @@
1
1
  //#region src/camera.ts
2
2
  var MIN_ZOOM = .2;
3
3
  var MAX_ZOOM = 2;
4
+ var ZOOM_LIMITS = {
5
+ min: MIN_ZOOM,
6
+ max: 2
7
+ };
8
+ /**
9
+ * Limits with the defaults filled in: `{ min: 0.05 }` keeps the default maximum.
10
+ * Пределы с подставленными значениями по умолчанию: `{ min: 0.05 }` оставляет максимум прежним.
11
+ */
12
+ function zoomLimits(limits) {
13
+ return {
14
+ min: limits?.min ?? .2,
15
+ max: limits?.max ?? 2
16
+ };
17
+ }
18
+ var clampZoom = (z, limits = ZOOM_LIMITS) => Math.min(limits.max, Math.max(limits.min, z));
4
19
  var createCamera = () => ({
5
20
  x: 0,
6
21
  y: 0,
@@ -20,11 +35,11 @@ function panBy(cam, dx, dy) {
20
35
  };
21
36
  }
22
37
  /**
23
- * Zoom by `factor`; the point under the cursor (sx, sy) stays where it is.
24
- * Масштаб в `factor` раз; точка под курсором (sx, sy) остаётся на месте.
38
+ * Zoom by `factor`; the point under the cursor (sx, sy) stays where it is. `limits` default to 0.2…2.
39
+ * Масштаб в `factor` раз; точка под курсором (sx, sy) остаётся на месте. `limits` по умолчанию 0.2…2.
25
40
  */
26
- function zoomAt(cam, sx, sy, factor) {
27
- const z = Math.min(2, Math.max(MIN_ZOOM, cam.z * factor));
41
+ function zoomAt(cam, sx, sy, factor, limits = ZOOM_LIMITS) {
42
+ const z = clampZoom(cam.z * factor, limits);
28
43
  const k = z / cam.z;
29
44
  return {
30
45
  x: sx - (sx - cam.x) * k,
@@ -33,6 +48,6 @@ function zoomAt(cam, sx, sy, factor) {
33
48
  };
34
49
  }
35
50
  //#endregion
36
- export { MAX_ZOOM, MIN_ZOOM, createCamera, panBy, screenToWorld, worldToScreen, zoomAt };
51
+ export { MAX_ZOOM, MIN_ZOOM, ZOOM_LIMITS, clampZoom, createCamera, panBy, screenToWorld, worldToScreen, zoomAt, zoomLimits };
37
52
 
38
53
  //# sourceMappingURL=camera.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"camera.js","names":[],"sources":["../src/camera.ts"],"sourcesContent":["/**\n * Camera: screen point = world * z + (x, y).\n * Screen coordinates here are relative to the top-left corner of the canvas.\n * Камера: экранная точка = мировая * z + (x, y).\n * Экранные координаты здесь — относительно левого верхнего угла холста.\n */\nexport interface Camera {\n x: number;\n y: number;\n z: number;\n}\n\nexport const MIN_ZOOM = 0.2;\nexport const MAX_ZOOM = 2;\n\nexport const createCamera = (): Camera => ({ x: 0, y: 0, z: 1 });\n\nexport function screenToWorld(cam: Camera, sx: number, sy: number): [number, number] {\n return [(sx - cam.x) / cam.z, (sy - cam.y) / cam.z];\n}\n\nexport function worldToScreen(cam: Camera, wx: number, wy: number): [number, number] {\n return [wx * cam.z + cam.x, wy * cam.z + cam.y];\n}\n\nexport function panBy(cam: Camera, dx: number, dy: number): Camera {\n return { ...cam, x: cam.x + dx, y: cam.y + dy };\n}\n\n/**\n * Zoom by `factor`; the point under the cursor (sx, sy) stays where it is.\n * Масштаб в `factor` раз; точка под курсором (sx, sy) остаётся на месте.\n */\nexport function zoomAt(cam: Camera, sx: number, sy: number, factor: number): Camera {\n const z = Math.min(MAX_ZOOM, Math.max(MIN_ZOOM, cam.z * factor));\n const k = z / cam.z;\n return { x: sx - (sx - cam.x) * k, y: sy - (sy - cam.y) * k, z };\n}\n"],"mappings":";AAYA,IAAa,WAAW;AACxB,IAAa,WAAW;AAExB,IAAa,sBAA8B;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;AAAE;AAE9D,SAAgB,cAAc,KAAa,IAAY,IAA8B;CACjF,OAAO,EAAE,KAAK,IAAI,KAAK,IAAI,IAAI,KAAK,IAAI,KAAK,IAAI,CAAC;AACtD;AAEA,SAAgB,cAAc,KAAa,IAAY,IAA8B;CACjF,OAAO,CAAC,KAAK,IAAI,IAAI,IAAI,GAAG,KAAK,IAAI,IAAI,IAAI,CAAC;AAClD;AAEA,SAAgB,MAAM,KAAa,IAAY,IAAoB;CAC/D,OAAO;EAAE,GAAG;EAAK,GAAG,IAAI,IAAI;EAAI,GAAG,IAAI,IAAI;CAAG;AAClD;;;;;AAMA,SAAgB,OAAO,KAAa,IAAY,IAAY,QAAwB;CAChF,MAAM,IAAI,KAAK,IAAA,GAAc,KAAK,IAAI,UAAU,IAAI,IAAI,MAAM,CAAC;CAC/D,MAAM,IAAI,IAAI,IAAI;CAClB,OAAO;EAAE,GAAG,MAAM,KAAK,IAAI,KAAK;EAAG,GAAG,MAAM,KAAK,IAAI,KAAK;EAAG;CAAE;AACnE"}
1
+ {"version":3,"file":"camera.js","names":[],"sources":["../src/camera.ts"],"sourcesContent":["/**\n * Camera: screen point = world * z + (x, y).\n * Screen coordinates here are relative to the top-left corner of the canvas.\n * Камера: экранная точка = мировая * z + (x, y).\n * Экранные координаты здесь — относительно левого верхнего угла холста.\n */\nexport interface Camera {\n x: number;\n y: number;\n z: number;\n}\n\nexport const MIN_ZOOM = 0.2;\nexport const MAX_ZOOM = 2;\n\n/**\n * The range of the zoom. Apps with another scale of the world (a level a thousand units long) pass their own.\n * Диапазон масштаба. Приложения с другим масштабом мира (уровень длиной в тысячу единиц) передают свой.\n */\nexport interface ZoomLimits {\n min: number;\n max: number;\n}\n\nexport const ZOOM_LIMITS: Readonly<ZoomLimits> = { min: MIN_ZOOM, max: MAX_ZOOM };\n\n/**\n * Limits with the defaults filled in: `{ min: 0.05 }` keeps the default maximum.\n * Пределы с подставленными значениями по умолчанию: `{ min: 0.05 }` оставляет максимум прежним.\n */\nexport function zoomLimits(limits?: Partial<ZoomLimits>): ZoomLimits {\n return { min: limits?.min ?? MIN_ZOOM, max: limits?.max ?? MAX_ZOOM };\n}\n\nexport const clampZoom = (z: number, limits: Readonly<ZoomLimits> = ZOOM_LIMITS): number => Math.min(limits.max, Math.max(limits.min, z));\n\nexport const createCamera = (): Camera => ({ x: 0, y: 0, z: 1 });\n\nexport function screenToWorld(cam: Camera, sx: number, sy: number): [number, number] {\n return [(sx - cam.x) / cam.z, (sy - cam.y) / cam.z];\n}\n\nexport function worldToScreen(cam: Camera, wx: number, wy: number): [number, number] {\n return [wx * cam.z + cam.x, wy * cam.z + cam.y];\n}\n\nexport function panBy(cam: Camera, dx: number, dy: number): Camera {\n return { ...cam, x: cam.x + dx, y: cam.y + dy };\n}\n\n/**\n * Zoom by `factor`; the point under the cursor (sx, sy) stays where it is. `limits` default to 0.2…2.\n * Масштаб в `factor` раз; точка под курсором (sx, sy) остаётся на месте. `limits` по умолчанию 0.2…2.\n */\nexport function zoomAt(cam: Camera, sx: number, sy: number, factor: number, limits: Readonly<ZoomLimits> = ZOOM_LIMITS): Camera {\n const z = clampZoom(cam.z * factor, limits);\n const k = z / cam.z;\n return { x: sx - (sx - cam.x) * k, y: sy - (sy - cam.y) * k, z };\n}\n"],"mappings":";AAYA,IAAa,WAAW;AACxB,IAAa,WAAW;AAWxB,IAAa,cAAoC;CAAE,KAAK;CAAU,KAAA;AAAc;;;;;AAMhF,SAAgB,WAAW,QAA0C;CACjE,OAAO;EAAE,KAAK,QAAQ,OAAA;EAAiB,KAAK,QAAQ,OAAA;CAAgB;AACxE;AAEA,IAAa,aAAa,GAAW,SAA+B,gBAAwB,KAAK,IAAI,OAAO,KAAK,KAAK,IAAI,OAAO,KAAK,CAAC,CAAC;AAExI,IAAa,sBAA8B;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;AAAE;AAE9D,SAAgB,cAAc,KAAa,IAAY,IAA8B;CACjF,OAAO,EAAE,KAAK,IAAI,KAAK,IAAI,IAAI,KAAK,IAAI,KAAK,IAAI,CAAC;AACtD;AAEA,SAAgB,cAAc,KAAa,IAAY,IAA8B;CACjF,OAAO,CAAC,KAAK,IAAI,IAAI,IAAI,GAAG,KAAK,IAAI,IAAI,IAAI,CAAC;AAClD;AAEA,SAAgB,MAAM,KAAa,IAAY,IAAoB;CAC/D,OAAO;EAAE,GAAG;EAAK,GAAG,IAAI,IAAI;EAAI,GAAG,IAAI,IAAI;CAAG;AAClD;;;;;AAMA,SAAgB,OAAO,KAAa,IAAY,IAAY,QAAgB,SAA+B,aAAqB;CAC5H,MAAM,IAAI,UAAU,IAAI,IAAI,QAAQ,MAAM;CAC1C,MAAM,IAAI,IAAI,IAAI;CAClB,OAAO;EAAE,GAAG,MAAM,KAAK,IAAI,KAAK;EAAG,GAAG,MAAM,KAAK,IAAI,KAAK;EAAG;CAAE;AACnE"}
@@ -1,4 +1,4 @@
1
- import type { Camera } from '../camera';
1
+ import type { Camera, ZoomLimits } from '../camera';
2
2
  /**
3
3
  * A mutable tuple: app stores accept exactly these.
4
4
  * Изменяемый кортеж: сторы приложений принимают именно такие.
@@ -110,6 +110,13 @@ export interface CanvasHost<P = unknown> {
110
110
  * Сенсорный режим «Выделение»: один палец рисует рамку, тап добавляет в выделение.
111
111
  */
112
112
  readonly selectMode?: boolean;
113
+ /**
114
+ * The app takes this key now (a tool in progress uses Backspace or Escape): the canvas leaves it alone.
115
+ * Asked before the canvas keys (Delete, Backspace, Escape, Ctrl+Z / Y). No member: the canvas takes its keys as before.
116
+ * Приложение сейчас забирает эту клавишу (идущий инструмент занял Backspace или Escape): холст её не трогает.
117
+ * Спрашивается перед клавишами холста (Delete, Backspace, Escape, Ctrl+Z / Y). Нет члена: холст берёт свои клавиши, как раньше.
118
+ */
119
+ claimsKey?(event: KeyboardEvent): boolean;
113
120
  }
114
121
  /**
115
122
  * How the canvas finds pins in the DOM. The rest of the DOM contract the app's node view must keep:
@@ -135,4 +142,16 @@ export interface CanvasOptions<P> {
135
142
  clientX: number;
136
143
  clientY: number;
137
144
  }): P | null;
145
+ /**
146
+ * What the selection frame picks: `intersect` (default) — every node it touches; `contain` — only nodes lying
147
+ * wholly inside it (a level editor, where a frame over objects must not pick the ground under them).
148
+ * Что берёт рамка выделения: `intersect` (по умолчанию) — всякую ноду, которую задела; `contain` — только ноды,
149
+ * целиком лежащие внутри (редактор уровней, где рамка над объектами не должна брать землю под ними).
150
+ */
151
+ marquee?: 'intersect' | 'contain';
152
+ /**
153
+ * The zoom range of the wheel and the pinch; an end not given keeps its default (0.2…2).
154
+ * Диапазон масштаба колеса и щипка; не заданный конец остаётся по умолчанию (0.2…2).
155
+ */
156
+ zoom?: Partial<ZoomLimits>;
138
157
  }
package/dist/canvas.js CHANGED
@@ -1,4 +1,4 @@
1
- import { panBy, screenToWorld, zoomAt } from "./camera.js";
1
+ import { panBy, screenToWorld, zoomAt, zoomLimits } from "./camera.js";
2
2
  import "./snap.js";
3
3
  import { createEdgeScroller } from "./edgescroll.js";
4
4
  import { PinchTracker, TapRecognizer, pinchOf } from "./gestures.js";
@@ -99,7 +99,7 @@ function useCanvasGestures(root, host, options) {
99
99
  const ids = [];
100
100
  for (const el of root.value.querySelectorAll("[data-node-id]")) {
101
101
  const r = (el.hasAttribute("data-node-container") ? el.querySelector("[data-node-handle]") ?? el : el).getBoundingClientRect();
102
- if (r.left < right && r.right > left && r.top < bottom && r.bottom > top) ids.push(el.dataset.nodeId);
102
+ if (options.marquee === "contain" ? r.left >= left && r.right <= right && r.top >= top && r.bottom <= bottom : r.left < right && r.right > left && r.top < bottom && r.bottom > top) ids.push(el.dataset.nodeId);
103
103
  }
104
104
  return ids;
105
105
  }
@@ -271,7 +271,7 @@ function useCanvasGestures(root, host, options) {
271
271
  if (!a || !el) return;
272
272
  const step = pinch.update(pinchOf(a, b));
273
273
  const rect = el.getBoundingClientRect();
274
- host.setCamera(panBy(zoomAt(host.camera, step.pivot[0] - rect.left, step.pivot[1] - rect.top, step.factor), step.pan[0], step.pan[1]));
274
+ 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]));
275
275
  }
276
276
  function onPointerDown(e) {
277
277
  const el = root.value;
@@ -513,6 +513,7 @@ function useCanvasGestures(root, host, options) {
513
513
  function onKey(e) {
514
514
  const tag = e.target?.tagName;
515
515
  if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || e.target?.isContentEditable) return;
516
+ if (host.claimsKey?.(e)) return;
516
517
  if (e.ctrlKey || e.metaKey) {
517
518
  if (e.code === "KeyZ" && !e.shiftKey) host.undo();
518
519
  else if (e.code === "KeyY" || e.code === "KeyZ" && e.shiftKey) host.redo();
@@ -569,7 +570,7 @@ function useCanvasGestures(root, host, options) {
569
570
  e.preventDefault();
570
571
  const rect = el.getBoundingClientRect();
571
572
  const intent = wheelIntent(e, rect.height);
572
- if (intent.kind === "zoom") host.setCamera(zoomAt(host.camera, e.clientX - rect.left, e.clientY - rect.top, intent.factor));
573
+ if (intent.kind === "zoom") host.setCamera(zoomAt(host.camera, e.clientX - rect.left, e.clientY - rect.top, intent.factor, zoomLimits(options.zoom)));
573
574
  else host.setCamera(panBy(host.camera, intent.dx, intent.dy));
574
575
  }
575
576
  let resizeObserver = null;
@@ -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 } 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, 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, [contenteditable=\"true\"]');\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 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 if (r.left < right && r.right > left && r.top < bottom && r.bottom > top) 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 on an empty place without moving: this is the touch right click, the palette opens.\n * Палец лежит на пустом месте и не двигается: это правый клик сенсора, открываем палитру.\n */\n function onLongPress() {\n longPressTimer = undefined;\n if (mode !== 'pan' || !taps.longPressDue(performance.now() + 50)) return;\n\n // The capture is not released: 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 mode = 'idle';\n navigator.vibrate?.(15);\n 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), 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 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 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\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) });\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));\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 { grid: 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 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-accent, --tx-canvas-accent-subtle.\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: 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 { grid: 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 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-accent, --tx-canvas-accent-subtle.\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: 6px;\n background: rgba(0, 0, 0, 0.7);\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OAAA,OAAA,OAAA,MAAE,GAAA,SAAAA,MAAA,QAAA,CAAQ,CAAC,iBAATA,MAAA,QAAA,CAAQ,CAAC,cAAa,GAAA,IAAA;IAC1C,SAAK,OAAA,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/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, 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, [contenteditable=\"true\"]');\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 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 on an empty place without moving: this is the touch right click, the palette opens.\n * Палец лежит на пустом месте и не двигается: это правый клик сенсора, открываем палитру.\n */\n function onLongPress() {\n longPressTimer = undefined;\n if (mode !== 'pan' || !taps.longPressDue(performance.now() + 50)) return;\n\n // The capture is not released: 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 mode = 'idle';\n navigator.vibrate?.(15);\n 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 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 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) });\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 { grid: 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 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-accent, --tx-canvas-accent-subtle.\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: 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 { grid: 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 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-accent, --tx-canvas-accent-subtle.\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: 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,IA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C,sBAAkB,OAAA,OAAA,OAAA,MAAE,GAAA,SAAAA,MAAA,QAAA,CAAQ,CAAC,iBAATA,MAAA,QAAA,CAAQ,CAAC,cAAa,GAAA,IAAA;IAC1C,SAAK,OAAA,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"}
package/dist/session.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type Camera } from './camera';
1
+ import { type Camera, type ZoomLimits } from './camera';
2
2
  import type { SavedStorage } from './storage';
3
3
  export type NoticeArgs = readonly (string | number)[];
4
4
  /**
@@ -99,6 +99,11 @@ export interface SessionOptions<D, K extends string> {
99
99
  * Сколько секунд показывать уведомление, мс.
100
100
  */
101
101
  noticeMs?: number;
102
+ /**
103
+ * The zoom range a loaded view is clamped to: the same as the canvas `zoom` option (default 0.2…2).
104
+ * Диапазон, в который зажимается масштаб загруженного вида: тот же, что у опции холста `zoom` (по умолчанию 0.2…2).
105
+ */
106
+ zoom?: Partial<ZoomLimits>;
102
107
  }
103
108
  /**
104
109
  * The lifecycle of an editor document: history (undo/redo with merged edits), autosave guarded against storage