@1337exp/taoux 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +2 -0
- package/README.ru.md +2 -0
- package/dist/chunks/{curveeditor-B1mAStQs.js → curveeditor-C9SsYXjQ.js} +4 -166
- package/dist/chunks/curveeditor-C9SsYXjQ.js.map +1 -0
- package/dist/commands.d.ts +7 -0
- package/dist/commands.js +6 -3
- package/dist/commands.js.map +1 -1
- package/dist/commandsvue.d.ts +47 -0
- package/dist/commandsvue.js +51 -0
- package/dist/commandsvue.js.map +1 -0
- package/dist/curveeditor/ops.d.ts +1 -63
- package/dist/curveeditor.js +3 -1
- package/dist/curvefield.css +10 -10
- package/dist/curvefield.js +6 -5
- package/dist/curvefield.js.map +1 -1
- package/dist/curveops.d.ts +63 -0
- package/dist/curveops.js +167 -0
- package/dist/curveops.js.map +1 -0
- package/package.json +12 -4
- package/skills/taoux/SKILL.md +2 -0
- package/dist/chunks/curveeditor-B1mAStQs.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"curveops.js","names":[],"sources":["../src/curveops.ts"],"sourcesContent":["import { easeValue, type Ease } from './ease';\nimport { clamp01 } from './num';\n\n/**\n * A curve point: t in 0…1, v is the value. `ease` sets how to go from this point to the next (linear by default);\n * on the last point it has no effect.\n * Точка кривой: t в 0…1, v значение. `ease` задаёт, как идти от этой точки к следующей (по умолчанию линейно);\n * у последней точки он ни на что не влияет.\n */\n/**\n * Guides from the selected point to the axes: none, lines only, lines and values.\n * Направляющие от выбранной точки к осям: нет, только линии, линии и значения.\n */\nexport type CurveGuides = 'off' | 'lines' | 'values';\n\nexport interface CurvePoint {\n t: number;\n v: number;\n ease?: Ease;\n}\n\n/**\n * The curve value at t: beyond the end points it equals the end point, between them it follows the `ease` of the left point (linear without it).\n * Значение кривой в t: вне крайних точек равно крайней, между ними по переходу `ease` левой точки (без него линейно).\n */\nexport function sampleCurve(points: readonly CurvePoint[], t: number): number {\n const n = points.length;\n if (n === 0) return 0;\n const x = clamp01(t);\n if (x <= points[0]!.t) return points[0]!.v;\n if (x >= points[n - 1]!.t) return points[n - 1]!.v;\n for (let i = 1; i < n; i++) {\n const b = points[i]!;\n if (x <= b.t) {\n const a = points[i - 1]!;\n const span = b.t - a.t;\n return span <= 0 ? b.v : a.v + (b.v - a.v) * easeValue(a.ease, (x - a.t) / span);\n }\n }\n return points[n - 1]!.v;\n}\n\n/**\n * Moves point `i`: along t it stays between its neighbours (the order is kept), along v it is free.\n * Двигает точку `i`: по t она остаётся между соседями (порядок не нарушается), по v свободна.\n */\nexport function movePoint(points: readonly CurvePoint[], i: number, t: number, v: number): CurvePoint[] {\n const next = points.map((p) => ({ ...p }));\n const lo = i > 0 ? next[i - 1]!.t : 0;\n const hi = i < next.length - 1 ? next[i + 1]!.t : 1;\n next[i] = { ...next[i]!, t: Math.min(hi, Math.max(lo, clamp01(t))), v };\n return next;\n}\n\n/**\n * Adds a point at `t` with value `v` (the curve value at that point by default); returns the new list and the point index.\n * Добавляет точку в `t` со значением `v` (по умолчанию значение кривой в этой точке); возвращает новый список и индекс точки.\n */\nexport function addPoint(points: readonly CurvePoint[], t: number, v?: number): { points: CurvePoint[]; index: number } {\n const x = clamp01(t);\n const next = points.map((p) => ({ ...p }));\n const at = next.findIndex((p) => p.t > x);\n const index = at === -1 ? next.length : at;\n next.splice(index, 0, { t: x, v: v ?? sampleCurve(points, x) });\n return { points: next, index };\n}\n\n/**\n * Removes a point; never leaves fewer than two (a curve of one point is just a number).\n * Убирает точку; меньше двух точек не оставляет (кривая из одной точки это просто число).\n */\nexport function removePoint(points: readonly CurvePoint[], i: number): CurvePoint[] {\n if (points.length <= 2) return points.map((p) => ({ ...p }));\n return points.filter((_, k) => k !== i).map((p) => ({ ...p }));\n}\n\n/**\n * A segment transition that is neither a straight line nor a step: its shape has to be drawn and taken into account when choosing the view.\n * Переход участка, который не прямая и не ступенька: его форму нужно рисовать и учитывать при подборе вида.\n */\nconst curved = (e: Ease | undefined) => e !== undefined && e !== 'linear' && e !== 'step';\n\n/**\n * The polyline of segment a→b for drawing: a straight one has two ends, other transitions `steps` pieces (a step: a corner).\n * Ломаная участка a→b для рисования: у прямой два конца, у остальных переходов `steps` отрезков (ступенька: угол).\n */\nexport function sampleSegment(a: CurvePoint, b: CurvePoint, steps = 24): { t: number; v: number }[] {\n if (a.ease === 'step') return [{ t: a.t, v: a.v }, { t: b.t, v: a.v }, { t: b.t, v: b.v }];\n if (!curved(a.ease)) return [{ t: a.t, v: a.v }, { t: b.t, v: b.v }];\n const out: { t: number; v: number }[] = [];\n for (let i = 0; i <= steps; i++) {\n const u = i / steps;\n out.push({ t: a.t + (b.t - a.t) * u, v: a.v + (b.v - a.v) * easeValue(a.ease, u) });\n }\n return out;\n}\n\n/**\n * A copy of the list with the transition of point `i` (`undefined` and `linear` remove the field: the file stays short).\n * Копия списка с переходом точки `i` (`undefined` и `linear` убирают поле: файл остаётся коротким).\n */\nexport function setEase(points: readonly CurvePoint[], i: number, ease: Ease | undefined): CurvePoint[] {\n return points.map((p, k) => {\n if (k !== i) return { ...p };\n const { ease: _old, ...rest } = p;\n return ease === undefined || ease === 'linear' ? rest : { ...rest, ease };\n });\n}\n\n/**\n * Value limits for drawing: from 0 (or below the minimum) to the maximum with some headroom, no narrower than 0…1.\n * The given `min`/`max` (the field bounds) fix the view: the plot neither drifts nor leaves the allowed range.\n * Пределы значений для отрисовки: от 0 (или ниже минимума) до максимума с запасом, не уже чем 0…1.\n * Заданные `min`/`max` (границы поля) фиксируют вид: график не плывёт и не выходит за допустимое.\n */\nexport function valueBounds(points: readonly CurvePoint[], min?: number, max?: number): { min: number; max: number } {\n let lo = 0;\n let hi = 1;\n for (const p of points) {\n lo = Math.min(lo, p.v);\n hi = Math.max(hi, p.v);\n }\n // what goes beyond the point values (overshoot, handles): the field bounds are the allowed point values, but all of it has to be visible\n // то, что выходит за значения точек (заступ, ручки): границы поля это допустимые значения точек, а видеть это нужно всё\n let outLo = Infinity;\n let outHi = -Infinity;\n const see = (v: number) => {\n lo = Math.min(lo, v);\n hi = Math.max(hi, v);\n outLo = Math.min(outLo, v);\n outHi = Math.max(outHi, v);\n };\n // transitions with overshoot (back, elastic, Bezier) go beyond the point values: the view is chosen by the curve itself\n // переходы с заступом (back, elastic, Безье) выходят за значения точек: вид подбираем по самой кривой\n for (let i = 0; i < points.length - 1; i++) {\n const a = points[i]!;\n if (!curved(a.ease)) continue;\n // Bezier handles must fit the view too: otherwise a handle that went off the edge cannot be reached\n // ручки Безье тоже должны попадать в вид: иначе уехавшую за край ручку не достать\n if (typeof a.ease === 'object') {\n const dv = points[i + 1]!.v - a.v;\n for (const y of [a.ease.bezier[1], a.ease.bezier[3]]) see(a.v + y * dv);\n }\n for (const s of sampleSegment(points[i]!, points[i + 1]!)) see(s.v);\n }\n const auto = { min: lo, max: hi === lo ? lo + 1 : hi * 1.1 };\n // a given bound fixes the view, but overshoot and handles widen it: so they do not hide behind the edge\n // заданная граница фиксирует вид, но заступ и ручки её раздвигают: так они не прячутся за край\n const a = min === undefined ? auto.min : Math.min(min, outLo);\n const b = max === undefined ? auto.max : Math.max(max, outHi);\n return b > a ? { min: a, max: b } : { min: a, max: a + 1 };\n}\n"],"mappings":";;;;;;;AAyBA,SAAgB,YAAY,QAA+B,GAAmB;CAC1E,MAAM,IAAI,OAAO;CACjB,IAAI,MAAM,GAAG,OAAO;CACpB,MAAM,IAAI,QAAQ,CAAC;CACnB,IAAI,KAAK,OAAO,EAAE,CAAE,GAAG,OAAO,OAAO,EAAE,CAAE;CACzC,IAAI,KAAK,OAAO,IAAI,EAAE,CAAE,GAAG,OAAO,OAAO,IAAI,EAAE,CAAE;CACjD,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK;EACxB,MAAM,IAAI,OAAO;EACjB,IAAI,KAAK,EAAE,GAAG;GACV,MAAM,IAAI,OAAO,IAAI;GACrB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ACnB,KAAK,KAAK,IAAI,IAAI,CAAC;EACnB,QAAQ,KAAK,IAAI,OAAO,CAAC;EACzB,QAAQ,KAAK,IAAI,OAAO,CAAC;CAC7B;CAGA,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,SAAS,GAAG,KAAK;EACxC,MAAM,IAAI,OAAO;EACjB,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG;EAGrB,IAAI,OAAO,EAAE,SAAS,UAAU;GAC5B,MAAM,KAAK,OAAO,IAAI,EAAE,CAAE,IAAI,EAAE;GAChC,KAAK,MAAM,KAAK,CAAC,EAAE,KAAK,OAAO,IAAI,EAAE,KAAK,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,IAAI,EAAE;EAC1E;EACA,KAAK,MAAM,KAAK,cAAc,OAAO,IAAK,OAAO,IAAI,EAAG,GAAG,IAAI,EAAE,CAAC;CACtE;CACA,MAAM,OAAO;EAAE,KAAK;EAAI,KAAK,OAAO,KAAK,KAAK,IAAI,KAAK;CAAI;CAG3D,MAAM,IAAI,QAAQ,KAAA,IAAY,KAAK,MAAM,KAAK,IAAI,KAAK,KAAK;CAC5D,MAAM,IAAI,QAAQ,KAAA,IAAY,KAAK,MAAM,KAAK,IAAI,KAAK,KAAK;CAC5D,OAAO,IAAI,IAAI;EAAE,KAAK;EAAG,KAAK;CAAE,IAAI;EAAE,KAAK;EAAG,KAAK,IAAI;CAAE;AAC7D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1337exp/taoux",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Interaction and behavior building blocks for Vue apps: curve and gradient editors, canvas, undo/redo, playback. Import only what you need, bring your own design.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -51,10 +51,18 @@
|
|
|
51
51
|
"types": "./dist/commands.d.ts",
|
|
52
52
|
"import": "./dist/commands.js"
|
|
53
53
|
},
|
|
54
|
+
"./commandsvue": {
|
|
55
|
+
"types": "./dist/commandsvue.d.ts",
|
|
56
|
+
"import": "./dist/commandsvue.js"
|
|
57
|
+
},
|
|
54
58
|
"./curve": {
|
|
55
59
|
"types": "./dist/curve.d.ts",
|
|
56
60
|
"import": "./dist/curve.js"
|
|
57
61
|
},
|
|
62
|
+
"./curveops": {
|
|
63
|
+
"types": "./dist/curveops.d.ts",
|
|
64
|
+
"import": "./dist/curveops.js"
|
|
65
|
+
},
|
|
58
66
|
"./curveeditor": {
|
|
59
67
|
"types": "./dist/curveeditor/index.d.ts",
|
|
60
68
|
"import": "./dist/curveeditor.js"
|
|
@@ -190,8 +198,8 @@
|
|
|
190
198
|
"media": "node scripts/media.mjs"
|
|
191
199
|
},
|
|
192
200
|
"peerDependencies": {
|
|
193
|
-
"@1337exp/taoui": "^
|
|
194
|
-
"vue": "^3.
|
|
201
|
+
"@1337exp/taoui": "^6.0.0",
|
|
202
|
+
"vue": "^3.5.0"
|
|
195
203
|
},
|
|
196
204
|
"peerDependenciesMeta": {
|
|
197
205
|
"@1337exp/taoui": {
|
|
@@ -202,7 +210,7 @@
|
|
|
202
210
|
}
|
|
203
211
|
},
|
|
204
212
|
"devDependencies": {
|
|
205
|
-
"@1337exp/taoui": "^
|
|
213
|
+
"@1337exp/taoui": "^6.0.0",
|
|
206
214
|
"@types/node": "^26.6.4",
|
|
207
215
|
"@vitejs/plugin-vue": "^6.0.10",
|
|
208
216
|
"@vue/test-utils": "^2.5.1",
|
package/skills/taoux/SKILL.md
CHANGED
|
@@ -32,6 +32,7 @@ controls, or with your own design.
|
|
|
32
32
|
| `sortable` | `useSortable(listRef, { onMove: (from, to) => (list.value = moveItem(list.value, from, to)) })`; mark each item `data-sortable-item` and a focusable grip inside it `data-sortable-handle` (a TaoButton with `icon="tao-grip"` and an aria-label); style `[data-sortable-dragging]` / `[data-sortable-lifted]`. Keyboard: Space lifts, arrows move, Space drops, Esc returns; `texts: sortableTextsRu` for Russian; works inside a zoomed (scaled) canvas too |
|
|
33
33
|
| `session` | `createDocumentSession(...)`: history + autosave + files + restore + notices for one document; `canUndo` / `canRedo` refs; `dirty` ref + `markSaved()` for an "unsaved" mark (a flag, not a history position); `saveHistory()` / `restoreHistory(state)` give each of several documents its own undo (`load` the next with `resetHistory`, then restore its history). `camera` is optional (a list, not a canvas); count with `countItems` (`countNodes` is its old name); `zoom` clamps a loaded view to the canvas range |
|
|
34
34
|
| `commands` | `createCommands([...])`: one registry for menus, shortcuts and palettes (see below) |
|
|
35
|
+
| `commandsvue` | `useCommands(registry, { add })` in the root component: the commands live with it, the keys are heard while it is mounted, `menu(layout)` is a `computed` for `TaoMenubar :items`, `onSelect` goes to its `@select` (TaoUI 6 emits the item, not an id) |
|
|
35
36
|
| `hotkeys` | `parseHotkey('Mod+Shift+Z')`, `matchHotkey`, `formatHotkey` (`Ctrl+Shift+Z` / `⇧⌘Z`), `isReservedHotkey`, `bindHotkeys(element, map)` |
|
|
36
37
|
| `storage` | autosave to localStorage that never throws; `tryWrite` gives the reason (`quota` / `denied`), `remove`, `subscribe` for changes from other tabs |
|
|
37
38
|
| `file` | `downloadBlob(name, data, mime?)` saves bytes or a `Blob`; `downloadText(name, text, mime?)`; `readTextFile(file, limit?)` reads a picked file, refusing a big one; `readBytesFile(file, limit?)` the same as bytes (an archive, an image) |
|
|
@@ -55,6 +56,7 @@ controls, or with your own design.
|
|
|
55
56
|
| `links` (Vue) | `TaoxLinks`: an SVG layer of links from ready geometry |
|
|
56
57
|
| `canvas` (Vue) | `TaoxCanvas`: pan / zoom canvas with mouse, touch, wheel, auto-scroll, keys; the `CanvasHost` contract; prop `background: 'grid' | 'dots' | 'none'`; options `marquee: 'contain'` (only nodes wholly inside the frame), `zoom: { min, max }`; option `inertia: true | { friction, minSpeed, maxSpeed }` (the camera glides after a pan released on the move: only a clear flick, 0.4 px/ms by default, glides; a pointer held still before the release stops it, a 1:1 drag; the arithmetic is `canvas/glide`); the world offset lands on whole device pixels; `TaoxGuides :lines` (also exported from `canvas`) draws the `lines` of `snapToGuides` in the world over the nodes, look by `--tx-guide-color`, `--tx-guide-width`, `--tx-guide-dash`; option `keys: 'window' | 'focus'` (default `'window'`: the keys Delete / Esc / Ctrl+Z work from the whole window; `'focus'`: only when the event comes from inside the canvas, which takes focus on a press, for a canvas beside a drawer or text fields); host `claimsKey(e)` keeps a key from the canvas while a tool uses it; host `placing` + `placeAt(screen, world)` is a "place a node" tool (the next left press only says where); host `contextMenu(screen, world, target)` shows the app's menu on a right click (true) or leaves the palette (false) |
|
|
57
58
|
| `curveeditor` (Vue) | `TaoxCurveEditor`: points, snapping, bounds, per-segment easing with Bezier handles, keyboard; time is 0…1, `formatT(t)` writes it as years, seconds… on the axis and tag |
|
|
59
|
+
| `curveops` | The point operations and `sampleCurve(points, t)` of a curve, with no Vue (the part of `curveeditor` a game or a worker needs): `import { sampleCurve } from '@1337exp/taoux/curveops'` |
|
|
58
60
|
| `gradienteditor` (Vue) | `TaoxGradientEditor`: stops on a bar, `gradientCss`, keyboard |
|
|
59
61
|
| `curvefield` (Vue, needs TaoUI) | `TaoxCurveField`: a curve editor with TaoUI fields for time, value, easing, snapping |
|
|
60
62
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"curveeditor-B1mAStQs.js","names":["_openBlock","_createElementBlock","_withModifiers","_Fragment","_renderList","_normalizeClass","_toDisplayString","_createElementVNode","_createCommentVNode","_sfc_main"],"sources":["../../src/curveeditor/ops.ts","../../src/curveeditor/TaoxCurveEditor.vue","../../src/curveeditor/TaoxCurveEditor.vue"],"sourcesContent":["import { easeValue, type Ease } from '../ease';\r\nimport { clamp01 } from '../num';\r\n\r\n/**\r\n * A curve point: t in 0…1, v is the value. `ease` sets how to go from this point to the next (linear by default);\r\n * on the last point it has no effect.\r\n * Точка кривой: t в 0…1, v значение. `ease` задаёт, как идти от этой точки к следующей (по умолчанию линейно);\r\n * у последней точки он ни на что не влияет.\r\n */\r\n/**\r\n * Guides from the selected point to the axes: none, lines only, lines and values.\r\n * Направляющие от выбранной точки к осям: нет, только линии, линии и значения.\r\n */\r\nexport type CurveGuides = 'off' | 'lines' | 'values';\r\n\r\nexport interface CurvePoint {\r\n t: number;\r\n v: number;\r\n ease?: Ease;\r\n}\r\n\r\n/**\r\n * The curve value at t: beyond the end points it equals the end point, between them it follows the `ease` of the left point (linear without it).\r\n * Значение кривой в t: вне крайних точек равно крайней, между ними по переходу `ease` левой точки (без него линейно).\r\n */\r\nexport function sampleCurve(points: readonly CurvePoint[], t: number): number {\r\n const n = points.length;\r\n if (n === 0) return 0;\r\n const x = clamp01(t);\r\n if (x <= points[0]!.t) return points[0]!.v;\r\n if (x >= points[n - 1]!.t) return points[n - 1]!.v;\r\n for (let i = 1; i < n; i++) {\r\n const b = points[i]!;\r\n if (x <= b.t) {\r\n const a = points[i - 1]!;\r\n const span = b.t - a.t;\r\n return span <= 0 ? b.v : a.v + (b.v - a.v) * easeValue(a.ease, (x - a.t) / span);\r\n }\r\n }\r\n return points[n - 1]!.v;\r\n}\r\n\r\n/**\r\n * Moves point `i`: along t it stays between its neighbours (the order is kept), along v it is free.\r\n * Двигает точку `i`: по t она остаётся между соседями (порядок не нарушается), по v свободна.\r\n */\r\nexport function movePoint(points: readonly CurvePoint[], i: number, t: number, v: number): CurvePoint[] {\r\n const next = points.map((p) => ({ ...p }));\r\n const lo = i > 0 ? next[i - 1]!.t : 0;\r\n const hi = i < next.length - 1 ? next[i + 1]!.t : 1;\r\n next[i] = { ...next[i]!, t: Math.min(hi, Math.max(lo, clamp01(t))), v };\r\n return next;\r\n}\r\n\r\n/**\r\n * Adds a point at `t` with value `v` (the curve value at that point by default); returns the new list and the point index.\r\n * Добавляет точку в `t` со значением `v` (по умолчанию значение кривой в этой точке); возвращает новый список и индекс точки.\r\n */\r\nexport function addPoint(points: readonly CurvePoint[], t: number, v?: number): { points: CurvePoint[]; index: number } {\r\n const x = clamp01(t);\r\n const next = points.map((p) => ({ ...p }));\r\n const at = next.findIndex((p) => p.t > x);\r\n const index = at === -1 ? next.length : at;\r\n next.splice(index, 0, { t: x, v: v ?? sampleCurve(points, x) });\r\n return { points: next, index };\r\n}\r\n\r\n/**\r\n * Removes a point; never leaves fewer than two (a curve of one point is just a number).\r\n * Убирает точку; меньше двух точек не оставляет (кривая из одной точки это просто число).\r\n */\r\nexport function removePoint(points: readonly CurvePoint[], i: number): CurvePoint[] {\r\n if (points.length <= 2) return points.map((p) => ({ ...p }));\r\n return points.filter((_, k) => k !== i).map((p) => ({ ...p }));\r\n}\r\n\r\n/**\r\n * A segment transition that is neither a straight line nor a step: its shape has to be drawn and taken into account when choosing the view.\r\n * Переход участка, который не прямая и не ступенька: его форму нужно рисовать и учитывать при подборе вида.\r\n */\r\nconst curved = (e: Ease | undefined) => e !== undefined && e !== 'linear' && e !== 'step';\r\n\r\n/**\r\n * The polyline of segment a→b for drawing: a straight one has two ends, other transitions `steps` pieces (a step: a corner).\r\n * Ломаная участка a→b для рисования: у прямой два конца, у остальных переходов `steps` отрезков (ступенька: угол).\r\n */\r\nexport function sampleSegment(a: CurvePoint, b: CurvePoint, steps = 24): { t: number; v: number }[] {\r\n if (a.ease === 'step') return [{ t: a.t, v: a.v }, { t: b.t, v: a.v }, { t: b.t, v: b.v }];\r\n if (!curved(a.ease)) return [{ t: a.t, v: a.v }, { t: b.t, v: b.v }];\r\n const out: { t: number; v: number }[] = [];\r\n for (let i = 0; i <= steps; i++) {\r\n const u = i / steps;\r\n out.push({ t: a.t + (b.t - a.t) * u, v: a.v + (b.v - a.v) * easeValue(a.ease, u) });\r\n }\r\n return out;\r\n}\r\n\r\n/**\r\n * A copy of the list with the transition of point `i` (`undefined` and `linear` remove the field: the file stays short).\r\n * Копия списка с переходом точки `i` (`undefined` и `linear` убирают поле: файл остаётся коротким).\r\n */\r\nexport function setEase(points: readonly CurvePoint[], i: number, ease: Ease | undefined): CurvePoint[] {\r\n return points.map((p, k) => {\r\n if (k !== i) return { ...p };\r\n const { ease: _old, ...rest } = p;\r\n return ease === undefined || ease === 'linear' ? rest : { ...rest, ease };\r\n });\r\n}\r\n\r\n/**\r\n * Value limits for drawing: from 0 (or below the minimum) to the maximum with some headroom, no narrower than 0…1.\r\n * The given `min`/`max` (the field bounds) fix the view: the plot neither drifts nor leaves the allowed range.\r\n * Пределы значений для отрисовки: от 0 (или ниже минимума) до максимума с запасом, не уже чем 0…1.\r\n * Заданные `min`/`max` (границы поля) фиксируют вид: график не плывёт и не выходит за допустимое.\r\n */\r\nexport function valueBounds(points: readonly CurvePoint[], min?: number, max?: number): { min: number; max: number } {\r\n let lo = 0;\r\n let hi = 1;\r\n for (const p of points) {\r\n lo = Math.min(lo, p.v);\r\n hi = Math.max(hi, p.v);\r\n }\r\n // what goes beyond the point values (overshoot, handles): the field bounds are the allowed point values, but all of it has to be visible\r\n // то, что выходит за значения точек (заступ, ручки): границы поля это допустимые значения точек, а видеть это нужно всё\r\n let outLo = Infinity;\r\n let outHi = -Infinity;\r\n const see = (v: number) => {\r\n lo = Math.min(lo, v);\r\n hi = Math.max(hi, v);\r\n outLo = Math.min(outLo, v);\r\n outHi = Math.max(outHi, v);\r\n };\r\n // transitions with overshoot (back, elastic, Bezier) go beyond the point values: the view is chosen by the curve itself\r\n // переходы с заступом (back, elastic, Безье) выходят за значения точек: вид подбираем по самой кривой\r\n for (let i = 0; i < points.length - 1; i++) {\r\n const a = points[i]!;\r\n if (!curved(a.ease)) continue;\r\n // Bezier handles must fit the view too: otherwise a handle that went off the edge cannot be reached\r\n // ручки Безье тоже должны попадать в вид: иначе уехавшую за край ручку не достать\r\n if (typeof a.ease === 'object') {\r\n const dv = points[i + 1]!.v - a.v;\r\n for (const y of [a.ease.bezier[1], a.ease.bezier[3]]) see(a.v + y * dv);\r\n }\r\n for (const s of sampleSegment(points[i]!, points[i + 1]!)) see(s.v);\r\n }\r\n const auto = { min: lo, max: hi === lo ? lo + 1 : hi * 1.1 };\r\n // a given bound fixes the view, but overshoot and handles widen it: so they do not hide behind the edge\r\n // заданная граница фиксирует вид, но заступ и ручки её раздвигают: так они не прячутся за край\r\n const a = min === undefined ? auto.min : Math.min(min, outLo);\r\n const b = max === undefined ? auto.max : Math.max(max, outHi);\r\n return b > a ? { min: a, max: b } : { min: a, max: a + 1 };\r\n}\r\n","<script lang=\"ts\" setup>\r\nimport { computed, nextTick, onBeforeUnmount, ref } from 'vue';\r\nimport { createEdgeScroller } from '../edgescroll';\r\nimport { clampTo, niceStep, roundTo, snapTo, ticks } from '../num';\r\nimport { addPoint, movePoint, removePoint, sampleSegment, setEase, valueBounds, type CurveGuides, type CurvePoint } from './ops';\r\n\r\nconst props = withDefaults(\r\n defineProps<{\r\n /**\r\n * Curve points in ascending t (at least two).\r\n * Точки кривой по возрастанию t (минимум две).\r\n */\r\n modelValue: readonly CurvePoint[];\r\n /**\r\n * Index of the selected point.\r\n * Индекс выбранной точки.\r\n */\r\n selected?: number;\r\n /**\r\n * Allowed values: they fix the plot view and do not let a point be dragged past the bound.\r\n * Допустимые значения: фиксируют вид графика и не дают утащить точку за границу.\r\n */\r\n min?: number;\r\n max?: number;\r\n /**\r\n * How many decimals to keep in t and v; not set means do not round.\r\n * Сколько знаков после запятой оставлять у t и v; не задано — не обрезать.\r\n */\r\n precision?: number;\r\n /**\r\n * Snapping to the grid (Shift flips the mode for the moment).\r\n * Прилипание к сетке (Shift на время меняет режим).\r\n */\r\n snap?: boolean;\r\n /**\r\n * The time step and the distance between labelled lines.\r\n * Шаг по времени и расстояние между подписанными линиями.\r\n */\r\n stepT?: number;\r\n majorT?: number;\r\n /**\r\n * A hint on hover over the field.\r\n * Подсказка при наведении на поле.\r\n */\r\n hint?: string;\r\n /**\r\n * The point label for screen readers; \"Point 1: t, v\" by default.\r\n * Подпись точки для скринридеров; по умолчанию «Point 1: t, v».\r\n */\r\n pointLabel?: (index: number, point: CurvePoint) => string;\r\n /**\r\n * How time is written: on the time axis, on the tag of the selected point and in the default point label. `t` is 0…1, the\r\n * editor's own time; a curve over years or seconds says so here (`(t) => `${Math.round(t * 14)} y``). By default the number\r\n * itself.\r\n * Как записывается время: на оси времени, на метке выбранной точки и в подписи точки по умолчанию. `t` — от 0 до 1, собственное\r\n * время редактора; кривая по годам или секундам говорит это здесь. По умолчанию само число.\r\n */\r\n formatT?: (t: number) => string;\r\n /**\r\n * Guides from the selected point to the axes: `off` none, `lines` dashed lines only, `values` lines and the point values on the axes.\r\n * `lines` by default: noticeable, but not overloaded.\r\n * Направляющие от выбранной точки к осям: `off` нет, `lines` только пунктирные линии, `values` линии и значения точки на осях.\r\n * По умолчанию `lines`: заметно, но не перегружает.\r\n */\r\n guides?: CurveGuides;\r\n /**\r\n * The label of a Bezier handle for screen readers (n: 1 or 2); \"Bezier handle n\" by default.\r\n * Подпись ручки Безье для скринридеров (n: 1 или 2); по умолчанию «Bezier handle n».\r\n */\r\n handleLabel?: (n: number, index: number) => string;\r\n }>(),\r\n { selected: 0, snap: true, stepT: 0.05, majorT: 0.25, guides: 'lines' },\r\n);\r\nconst emit = defineEmits<{\r\n 'update:modelValue': [value: CurvePoint[]];\r\n 'update:selected': [index: number];\r\n /**\r\n * An edit is finished (a point was released, added, removed): the moment to record into history.\r\n * Правка закончена (отпустили точку, добавили, убрали): момент для записи в историю.\r\n */\r\n commit: [];\r\n}>();\r\n\r\nconst W = 280;\r\nconst H = 132;\r\nconst PAD_L = 30;\r\nconst PAD_R = 10;\r\nconst PAD_T = 10;\r\nconst PAD_B = 16;\r\nconst PLOT_W = W - PAD_L - PAD_R;\r\nconst PLOT_H = H - PAD_T - PAD_B;\r\n\r\nconst svg = ref<SVGSVGElement | null>(null);\r\n\r\nconst points = computed(() => props.modelValue);\r\n// The limits are remembered for the duration of a drag: otherwise the plot would \"float\" under the hand\r\n// Пределы запоминаем на время перетаскивания: иначе график «плыл» бы под рукой\r\nconst frozen = ref<{ min: number; max: number } | null>(null);\r\n// The view shift by value: accumulated by auto-scroll at the edge while a point is dragged\r\n// Сдвиг вида по значению: накапливает автопрокрутка у края, пока тянут точку\r\nconst shift = ref(0);\r\nconst bounds = computed(() => (frozen.value ? { min: frozen.value.min + shift.value, max: frozen.value.max + shift.value } : valueBounds(points.value, props.min, props.max)));\r\nconst span = computed(() => bounds.value.max - bounds.value.min);\r\n\r\nconst majorV = computed(() => niceStep(span.value, 4));\r\nconst stepV = computed(() => niceStep(span.value, 20));\r\nconst gridT = computed(() => ticks(0, 1, props.stepT));\r\nconst gridV = computed(() => ticks(bounds.value.min, bounds.value.max, stepV.value));\r\nconst labelsV = computed(() => ticks(bounds.value.min, bounds.value.max, majorV.value));\r\nconst labelsT = computed(() => ticks(0, 1, props.majorT));\r\nconst isMajorT = (x: number) => Math.abs(x / props.majorT - Math.round(x / props.majorT)) < 1e-6;\r\nconst isMajorV = (v: number) => Math.abs(v / majorV.value - Math.round(v / majorV.value)) < 1e-6;\r\n\r\nconst px = (tt: number) => PAD_L + tt * PLOT_W;\r\nconst py = (v: number) => PAD_T + (1 - (v - bounds.value.min) / span.value) * PLOT_H;\r\n// Segments are drawn by their transitions: a straight one has two ends, smooth ones dozens of pieces, a step a corner\r\n// Участки рисуются по своим переходам: у прямой два конца, у плавных десятки отрезков, у ступеньки угол\r\nconst path = computed(() => {\r\n const pts = points.value;\r\n const out: string[] = [];\r\n for (let i = 0; i < pts.length - 1; i++) {\r\n sampleSegment(pts[i]!, pts[i + 1]!).forEach((p, k) => out.push(`${i === 0 && k === 0 ? 'M' : 'L'} ${px(p.t).toFixed(1)} ${py(p.v).toFixed(1)}`));\r\n }\r\n return out.join(' ');\r\n});\r\nconst fmt = (n: number) => String(Math.round(n * 1000) / 1000);\r\nconst fmtT = (tt: number) => (props.formatT ? props.formatT(tt) : fmt(tt));\r\n\r\n// The values of the selected point on the axes: time under the plot, value on the left. They show while the point is dragged, so there is no need to look for the fields.\r\n// Значения выбранной точки на осях: время под графиком, значение слева. Они видны, пока точку тянут, и не надо искать глазами поля.\r\nconst CHAR_W = 4.6;\r\nconst tagWidth = (text: string) => text.length * CHAR_W + 5;\r\nconst tags = computed(() => {\r\n const p = points.value[Math.min(props.selected, points.value.length - 1)];\r\n if (!p) return null;\r\n const t = fmtT(p.t);\r\n const v = fmt(p.v);\r\n const wt = tagWidth(t);\r\n const wv = tagWidth(v);\r\n const cx = Math.min(W - wt / 2 - 1, Math.max(wt / 2 + 1, px(p.t)));\r\n const cy = Math.min(PAD_T + PLOT_H - 5, Math.max(PAD_T + 5, py(p.v)));\r\n return {\r\n x: px(p.t),\r\n y: py(p.v),\r\n t: { text: t, cx, w: wt },\r\n v: { text: v, cy, w: wv },\r\n };\r\n});\r\n\r\ninterface PointerSample {\r\n clientX: number;\r\n clientY: number;\r\n shiftKey: boolean;\r\n}\r\n\r\n/**\r\n * Pointer coordinates in curve units as they are: no snapping, rounding or bounds.\r\n * Координаты указателя в единицах кривой, как есть: без прилипания, округления и границ.\r\n */\r\nfunction rawCurve(e: PointerSample): { t: number; v: number } {\r\n const r = svg.value!.getBoundingClientRect();\r\n const x = ((e.clientX - r.left) / r.width) * W;\r\n const y = ((e.clientY - r.top) / r.height) * H;\r\n const { min, max } = bounds.value;\r\n return { t: (x - PAD_L) / PLOT_W, v: min + (1 - (y - PAD_T) / PLOT_H) * (max - min) };\r\n}\r\n\r\n/**\r\n * Pointer coordinates in curve units; Shift temporarily flips the snapping mode.\r\n * Координаты указателя в единицах кривой; Shift временно меняет режим шага.\r\n */\r\nfunction toCurve(e: PointerSample): { t: number; v: number } {\r\n let { t: tt, v } = rawCurve(e);\r\n if (props.snap !== e.shiftKey) {\r\n tt = snapTo(tt, props.stepT);\r\n v = snapTo(v, stepV.value);\r\n }\r\n return { t: roundTo(tt, props.precision), v: clampTo(roundTo(v, props.precision), props.min, props.max) };\r\n}\r\n\r\nlet dragging = -1;\r\nlet lastPointer: PointerSample = { clientX: 0, clientY: 0, shiftKey: false };\r\n\r\n/**\r\n * The point follows the pointer: both when it moves and when the view moved under a still pointer.\r\n * Точка идёт за указателем: и при его движении, и когда вид уехал под неподвижным указателем.\r\n */\r\nfunction followPointer() {\r\n if (dragging < 0) return;\r\n const { t: tt, v } = toCurve(lastPointer);\r\n emit('update:modelValue', movePoint(points.value, dragging, tt, v));\r\n}\r\n\r\n// Dragging a point to the top/bottom edge of the plot: the view by value follows (by time it is always 0…1).\r\n// The field bounds are not crossed: with min and max set the view stands still.\r\n// Тянем точку к верхнему/нижнему краю графика: вид по значению едет следом (по времени он всегда 0…1).\r\n// Границы поля не пересекаем: при заданных min и max вид стоит.\r\nconst scroller = createEdgeScroller({\r\n bounds: () => svg.value?.getBoundingClientRect() ?? null,\r\n pointer: () => [lastPointer.clientX, lastPointer.clientY],\r\n enabled: () => dragging >= 0,\r\n zone: 18,\r\n maxSpeed: 240,\r\n onScroll: (_dx, dy) => {\r\n const base = frozen.value;\r\n const r = svg.value?.getBoundingClientRect();\r\n if (!base || !r) return;\r\n // The visible area moved down by dy px: the view values decreased\r\n // Видимая область уехала вниз на dy px: значения вида уменьшились\r\n const dv = ((dy * H) / r.height / PLOT_H) * (base.max - base.min);\r\n const lo = props.min === undefined ? -Infinity : props.min - base.min;\r\n const hi = props.max === undefined ? Infinity : props.max - base.max;\r\n shift.value = Math.min(hi, Math.max(lo, shift.value - dv));\r\n followPointer();\r\n },\r\n});\r\nonBeforeUnmount(scroller.stop);\r\n\r\nfunction onDown(e: PointerEvent, i: number) {\r\n emit('update:selected', i);\r\n if (e.altKey) {\r\n emit('update:modelValue', removePoint(points.value, i));\r\n emit('update:selected', 0);\r\n emit('commit');\r\n return;\r\n }\r\n dragging = i;\r\n lastPointer = e;\r\n shift.value = 0;\r\n frozen.value = valueBounds(points.value, props.min, props.max);\r\n try {\r\n (e.currentTarget as Element).setPointerCapture(e.pointerId);\r\n } catch {\r\n // the pointer has already gone or the capture is unavailable: dragging works without it\r\n // указатель уже ушёл или захват недоступен: тянуть можно и без него\r\n }\r\n}\r\n\r\nfunction onMove(e: PointerEvent) {\r\n if (dragging < 0) return;\r\n lastPointer = e;\r\n followPointer();\r\n scroller.kick();\r\n}\r\n\r\nfunction onUp() {\r\n if (dragging < 0) return;\r\n dragging = -1;\r\n scroller.stop();\r\n frozen.value = null;\r\n shift.value = 0;\r\n emit('commit');\r\n}\r\n\r\n//--------------------------------------------------\r\n// Handles of the cubic Bezier curve of the selected segment\r\n// Ручки кубической кривой Безье у выбранного участка\r\n\r\n/**\r\n * The segment that starts at the selected point and follows a Bezier: only it has handles (and only if the segment has height).\r\n * Участок, который начинается в выбранной точке и идёт по Безье: ручки есть только у него (и только если у участка есть высота).\r\n */\r\nconst bezierSegment = computed(() => {\r\n const i = Math.min(props.selected, points.value.length - 1);\r\n const a = points.value[i];\r\n const b = points.value[i + 1];\r\n if (!a || !b || typeof a.ease !== 'object' || Math.abs(b.v - a.v) < 1e-9 || b.t - a.t <= 0) return null;\r\n return { i, a, b, bezier: a.ease.bezier };\r\n});\r\n\r\n/**\r\n * The two handles of the segment in plot coordinates.\r\n * Две ручки участка в координатах плота.\r\n */\r\nconst bezierHandles = computed(() => {\r\n const s = bezierSegment.value;\r\n if (!s) return [];\r\n const [x1, y1, x2, y2] = s.bezier;\r\n return [\r\n { n: 0, t: s.a.t + x1 * (s.b.t - s.a.t), v: s.a.v + y1 * (s.b.v - s.a.v), from: s.a },\r\n { n: 1, t: s.a.t + x2 * (s.b.t - s.a.t), v: s.a.v + y2 * (s.b.v - s.a.v), from: s.b },\r\n ];\r\n});\r\n\r\n/**\r\n * Starts of segments with a Bezier: the \"B\" mark is drawn above them.\r\n * Начала участков с Безье: над ними рисуется метка «B».\r\n */\r\nconst bezierMarks = computed(() => points.value.flatMap((p, i) => (typeof p.ease === 'object' && i < points.value.length - 1 ? [{ i, t: p.t, v: p.v }] : [])));\r\n\r\nconst round2 = (x: number) => Math.round(x * 100) / 100;\r\nconst BEZIER_STEP = 0.05;\r\n\r\n/**\r\n * Handle `n` is put at (x, y) of the normalised segment: x in 0…1, y free within reasonable limits (overshoot).\r\n * Ручка `n` ставится в (x, y) нормализованного участка: x в 0…1, y свободный в разумных пределах (заступ).\r\n */\r\nfunction setBezierHandle(n: 0 | 1, x: number, y: number, commitNow = false) {\r\n const s = bezierSegment.value;\r\n if (!s) return;\r\n const next: [number, number, number, number] = [...s.bezier];\r\n next[n * 2] = Math.min(1, Math.max(0, round2(x)));\r\n next[n * 2 + 1] = Math.min(3, Math.max(-2, round2(y)));\r\n emit('update:modelValue', setEase(points.value, s.i, { bezier: next }));\r\n if (commitNow) emit('commit');\r\n}\r\n\r\nlet handleDrag = -1;\r\n\r\nfunction onHandleDown(e: PointerEvent, n: number) {\r\n handleDrag = n;\r\n frozen.value = valueBounds(points.value, props.min, props.max);\r\n try {\r\n (e.currentTarget as Element).setPointerCapture(e.pointerId);\r\n } catch {\r\n // the pointer has already gone or the capture is unavailable: dragging works without it\r\n // указатель уже ушёл или захват недоступен: тянуть можно и без него\r\n }\r\n}\r\n\r\nfunction onHandleMove(e: PointerEvent) {\r\n const s = bezierSegment.value;\r\n if (handleDrag < 0 || !s) return;\r\n const { t, v } = rawCurve(e);\r\n setBezierHandle(handleDrag as 0 | 1, (t - s.a.t) / (s.b.t - s.a.t), (v - s.a.v) / (s.b.v - s.a.v));\r\n}\r\n\r\nfunction onHandleUp() {\r\n if (handleDrag < 0) return;\r\n handleDrag = -1;\r\n frozen.value = null;\r\n emit('commit');\r\n}\r\n\r\n/**\r\n * Arrows on a handle move it by a step (Shift larger): left and right along x, up and down along y.\r\n * Стрелки на ручке сдвигают её на шаг (Shift крупнее): влево и вправо по x, вверх и вниз по y.\r\n */\r\nfunction onHandleKey(e: KeyboardEvent, n: number) {\r\n const s = bezierSegment.value;\r\n const arrows: Record<string, [number, number]> = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, 1], ArrowDown: [0, -1] };\r\n const d = arrows[e.key];\r\n if (!s || !d) return;\r\n e.preventDefault();\r\n e.stopPropagation();\r\n const k = BEZIER_STEP * (e.shiftKey ? 5 : 1);\r\n setBezierHandle(n as 0 | 1, s.bezier[n * 2]! + d[0] * k, s.bezier[n * 2 + 1]! + d[1] * k, true);\r\n}\r\n\r\n/**\r\n * A double click on the plot must not select the page text around it.\r\n * Двойной клик по графику не должен выделять текст страницы вокруг.\r\n */\r\nfunction noSelect(e: MouseEvent) {\r\n if (e.detail > 1) e.preventDefault();\r\n}\r\n\r\nfunction onDouble(e: MouseEvent) {\r\n const { t: tt, v } = toCurve(e);\r\n const r = addPoint(points.value, tt, v);\r\n emit('update:selected', r.index);\r\n emit('update:modelValue', r.points);\r\n emit('commit');\r\n}\r\n\r\n/**\r\n * The arrow step with Shift: this many times larger.\r\n * Шаг стрелки с Shift: во столько раз крупнее.\r\n */\r\nconst COARSE = 5;\r\n\r\n/**\r\n * Moves point `i` by `dx` steps in time and `dy` steps in value (grid steps), with snapping, rounding and bounds.\r\n * Сдвигает точку `i` на `dx` шагов по времени и `dy` шагов по значению (шаги сетки), с прижатием, округлением и границами.\r\n */\r\nfunction nudge(i: number, dx: number, dy: number, coarse: boolean) {\r\n const p = points.value[i];\r\n if (!p) return;\r\n const k = coarse ? COARSE : 1;\r\n const tt = roundTo(snapTo(p.t + dx * k * props.stepT, props.stepT), props.precision);\r\n const v = clampTo(roundTo(snapTo(p.v + dy * k * stepV.value, stepV.value), props.precision), props.min, props.max);\r\n emit('update:modelValue', movePoint(points.value, i, tt, v));\r\n emit('commit');\r\n}\r\n\r\n/**\r\n * Insert adds a point between the selected one and the next (for the last: between it and the previous) on the curve itself.\r\n * Insert добавляет точку между выбранной и следующей (у последней: между ней и предыдущей) на самой кривой.\r\n */\r\n/**\r\n * Focus on point `i` after a re-render: keys go to the selected point, and focus must not stay on the old one.\r\n * Фокус на точку `i` после перерисовки: клавиши идут к той точке, что выбрана, и фокус не должен оставаться на старой.\r\n */\r\nfunction focusDot(i: number) {\r\n void nextTick(() => svg.value?.querySelectorAll<SVGElement>('.tx-curve-dot')[i]?.focus());\r\n}\r\n\r\nfunction insertAfter(i: number) {\r\n const a = points.value[i];\r\n const b = points.value[i + 1] ?? points.value[i - 1];\r\n if (!a || !b) return;\r\n const r = addPoint(points.value, roundTo((a.t + b.t) / 2, props.precision));\r\n emit('update:selected', r.index);\r\n emit('update:modelValue', r.points);\r\n emit('commit');\r\n focusDot(r.index);\r\n}\r\n\r\nfunction removeAt(i: number) {\r\n const next = Math.max(0, i - 1);\r\n emit('update:modelValue', removePoint(points.value, i));\r\n emit('update:selected', next);\r\n emit('commit');\r\n focusDot(next);\r\n}\r\n\r\n/**\r\n * Point keys (focus on it): arrows move by a grid step, Shift larger; Insert adds, Delete removes.\r\n * Клавиши точки (фокус на ней): стрелки двигают на шаг сетки, Shift крупнее; Insert добавляет, Delete убирает.\r\n */\r\nfunction onKey(e: KeyboardEvent) {\r\n // the point that has focus; if the key came from the field itself (after a click on it), then the selected one\r\n // точка, на которой фокус; если клавиша пришла с самого поля (после клика по нему), то выбранная\r\n const target = (e.target as Element | null)?.closest('.tx-curve-dot');\r\n const index = target ? Number(target.getAttribute('data-index')) : NaN;\r\n const i = Number.isInteger(index) ? index : Math.min(props.selected, points.value.length - 1);\r\n const arrows: Record<string, [number, number]> = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, 1], ArrowDown: [0, -1] };\r\n const move = arrows[e.key];\r\n if (move) {\r\n e.preventDefault();\r\n nudge(i, move[0], move[1], e.shiftKey);\r\n } else if (e.key === 'Insert') {\r\n e.preventDefault();\r\n insertAfter(i);\r\n } else if (e.key === 'Delete' || e.key === 'Backspace') {\r\n e.preventDefault();\r\n removeAt(i);\r\n }\r\n}\r\n\r\nconst labelOf = (i: number, p: CurvePoint) => (props.pointLabel ? props.pointLabel(i, p) : `Point ${i + 1}: ${fmtT(p.t)}, ${fmt(p.v)}`);\r\n</script>\r\n\r\n<template>\r\n <svg ref=\"svg\" class=\"tx-curve\" :viewBox=\"`0 0 ${W} ${H}`\" :title=\"hint\" tabindex=\"-1\" role=\"group\" @dblclick.self=\"onDouble\" @mousedown=\"noSelect\" @keydown=\"onKey\">\r\n <!-- fine grid: the same steps as snapping / мелкая сетка: те же шаги, что у прилипания -->\r\n <line v-for=\"x in gridT\" :key=\"`gt${x}`\" class=\"tx-curve-grid\" :class=\"{ major: isMajorT(x) }\" :x1=\"px(x)\" :x2=\"px(x)\" :y1=\"PAD_T\" :y2=\"H - PAD_B\" />\r\n <line v-for=\"v in gridV\" :key=\"`gv${v}`\" class=\"tx-curve-grid\" :class=\"{ major: isMajorV(v) }\" :x1=\"PAD_L\" :x2=\"W - PAD_R\" :y1=\"py(v)\" :y2=\"py(v)\" />\r\n\r\n <text v-for=\"(v, i) in labelsV\" :key=\"`lv${v}`\" class=\"tx-curve-label\" :class=\"{ edge: v === 0 || i === 0 || i === labelsV.length - 1 }\" :x=\"PAD_L - 4\" :y=\"py(v)\" text-anchor=\"end\" dominant-baseline=\"middle\">{{ fmt(v) }}</text>\r\n <text v-for=\"x in labelsT\" :key=\"`lt${x}`\" class=\"tx-curve-label\" :class=\"{ edge: x === 0 || x === 1 }\" :x=\"px(x)\" :y=\"H - 4\" :text-anchor=\"x === 0 ? 'start' : x === 1 ? 'end' : 'middle'\">{{ fmtT(x) }}</text>\r\n\r\n <g v-if=\"tags && guides !== 'off'\" class=\"tx-curve-tags\" aria-hidden=\"true\">\r\n <line class=\"tx-curve-guide\" :x1=\"tags.x\" :x2=\"tags.x\" :y1=\"tags.y\" :y2=\"PAD_T + PLOT_H\" />\r\n <line class=\"tx-curve-guide\" :x1=\"PAD_L\" :x2=\"tags.x\" :y1=\"tags.y\" :y2=\"tags.y\" />\r\n <template v-if=\"guides === 'values'\">\r\n <rect class=\"tx-curve-tag-bg\" :x=\"tags.t.cx - tags.t.w / 2\" :y=\"H - 12\" :width=\"tags.t.w\" height=\"11\" rx=\"2\" />\r\n <text class=\"tx-curve-tag\" :x=\"tags.t.cx\" :y=\"H - 4\" text-anchor=\"middle\">{{ tags.t.text }}</text>\r\n <rect class=\"tx-curve-tag-bg\" :x=\"PAD_L - 3 - tags.v.w\" :y=\"tags.v.cy - 5.5\" :width=\"tags.v.w\" height=\"11\" rx=\"2\" />\r\n <text class=\"tx-curve-tag\" :x=\"PAD_L - 5\" :y=\"tags.v.cy\" text-anchor=\"end\" dominant-baseline=\"middle\">{{ tags.v.text }}</text>\r\n </template>\r\n </g>\r\n\r\n <path class=\"tx-curve-line\" :d=\"path\" />\r\n\r\n <!-- The \"B\" mark above the start of a Bezier segment: shows the point has handles even when it is not selected / Метка «B» над началом участка с Безье: видно, что у точки есть ручки, даже когда она не выбрана -->\r\n <text v-for=\"m in bezierMarks\" :key=\"`b${m.i}`\" class=\"tx-curve-mark\" :x=\"px(m.t)\" :y=\"py(m.v) - 8\" text-anchor=\"middle\" aria-hidden=\"true\">B</text>\r\n\r\n <g v-if=\"bezierHandles.length\" class=\"tx-curve-bezier\">\r\n <template v-for=\"h in bezierHandles\" :key=\"h.n\">\r\n <line class=\"tx-curve-arm\" :x1=\"px(h.from.t)\" :y1=\"py(h.from.v)\" :x2=\"px(h.t)\" :y2=\"py(h.v)\" />\r\n <circle\r\n class=\"tx-curve-handle\"\r\n :cx=\"px(h.t)\"\r\n :cy=\"py(h.v)\"\r\n r=\"4\"\r\n tabindex=\"0\"\r\n role=\"slider\"\r\n :aria-label=\"handleLabel ? handleLabel(h.n + 1, bezierSegment!.i) : `Bezier handle ${h.n + 1}`\"\r\n @pointerdown.stop=\"onHandleDown($event, h.n)\"\r\n @pointermove=\"onHandleMove\"\r\n @pointerup=\"onHandleUp\"\r\n @pointercancel=\"onHandleUp\"\r\n @keydown=\"onHandleKey($event, h.n)\"\r\n />\r\n </template>\r\n </g>\r\n <circle\r\n v-for=\"(p, i) in points\"\r\n :key=\"i\"\r\n class=\"tx-curve-dot\"\r\n :class=\"{ on: i === selected }\"\r\n :cx=\"px(p.t)\"\r\n :cy=\"py(p.v)\"\r\n r=\"5\"\r\n :data-index=\"i\"\r\n tabindex=\"0\"\r\n role=\"button\"\r\n :aria-label=\"labelOf(i, p)\"\r\n @focus=\"emit('update:selected', i)\"\r\n @pointerdown.stop=\"onDown($event, i)\"\r\n @pointermove=\"onMove\"\r\n @pointerup=\"onUp\"\r\n @pointercancel=\"onUp\"\r\n />\r\n </svg>\r\n</template>\r\n\r\n<style>\r\n/*\r\n * Configured with CSS variables on any ancestor:\r\n * Настройка через CSS-переменные на любом предке:\r\n * --tx-curve-bg, --tx-curve-border, --tx-curve-grid, --tx-curve-label, --tx-curve-accent,\r\n * --tx-curve-text (the numbers at the ends of the axes: start and end of the scale, brighter than the rest),\r\n * --tx-curve-radius (the corners of the plot, 4px by default),\r\n * --tx-curve-dot-opacity (opacity of unselected points, 0.3 by default).\r\n * --tx-curve-text (цифры у краёв осей: начало и конец шкалы, ярче остальных),\r\n * --tx-curve-radius (углы графика, по умолчанию 4px),\r\n * --tx-curve-dot-opacity (непрозрачность невыбранных точек, по умолчанию 0.3).\r\n */\r\n.tx-curve {\r\n display: block;\r\n width: 100%;\r\n height: auto;\r\n border: 1px solid var(--tx-curve-border, #2a2d33);\r\n border-radius: var(--tx-curve-radius, 4px);\r\n background: var(--tx-curve-bg, #15171b);\r\n touch-action: none;\r\n user-select: none;\r\n outline: none;\r\n}\r\n\r\n.tx-curve-grid {\r\n pointer-events: none; /* otherwise a double click hits the grid line, not the field / иначе двойной клик попадает в линию сетки, а не в поле */\r\n stroke: var(--tx-curve-grid, #2a2d33);\r\n stroke-width: 0.5;\r\n opacity: 0.45;\r\n}\r\n\r\n.tx-curve-grid.major {\r\n stroke-width: 1;\r\n opacity: 1;\r\n}\r\n\r\n.tx-curve-guide {\r\n stroke: var(--tx-curve-accent, #4fc3f7);\r\n stroke-width: 1;\r\n stroke-dasharray: 2 3;\r\n opacity: 0.45;\r\n pointer-events: none;\r\n}\r\n\r\n.tx-curve-tag-bg {\r\n fill: var(--tx-curve-bg, #15171b);\r\n pointer-events: none;\r\n}\r\n\r\n.tx-curve-tag {\r\n fill: var(--tx-curve-accent, #4fc3f7);\r\n font-size: 8px;\r\n font-weight: 700;\r\n pointer-events: none;\r\n user-select: none;\r\n}\r\n\r\n.tx-curve-label.edge {\r\n fill: var(--tx-curve-text, #d6d9e0);\r\n}\r\n\r\n.tx-curve-label {\r\n fill: var(--tx-curve-label, #8b929c);\r\n font-size: 8px;\r\n pointer-events: none;\r\n user-select: none;\r\n}\r\n\r\n.tx-curve-line {\r\n fill: none;\r\n stroke: var(--tx-curve-accent, #4fc3f7);\r\n stroke-width: 2;\r\n pointer-events: none;\r\n}\r\n\r\n.tx-curve-mark {\r\n fill: var(--tx-curve-accent, #4fc3f7);\r\n font: 600 9px/1 system-ui, sans-serif;\r\n pointer-events: none;\r\n user-select: none;\r\n}\r\n\r\n.tx-curve-arm {\r\n stroke: var(--tx-curve-label, #8b929c);\r\n stroke-width: 1;\r\n stroke-dasharray: 3 2;\r\n pointer-events: none;\r\n}\r\n\r\n.tx-curve-handle {\r\n fill: var(--tx-curve-label, #8b929c);\r\n stroke: var(--tx-curve-bg, #15171b);\r\n stroke-width: 1.5;\r\n cursor: grab;\r\n}\r\n\r\n.tx-curve-handle:active {\r\n cursor: grabbing;\r\n}\r\n\r\n.tx-curve-handle:hover,\r\n.tx-curve-handle:focus-visible {\r\n fill: var(--tx-curve-accent, #4fc3f7);\r\n outline: none;\r\n}\r\n\r\n.tx-curve-dot {\r\n fill: var(--tx-curve-bg, #15171b);\r\n stroke: var(--tx-curve-accent, #4fc3f7);\r\n stroke-width: 2;\r\n opacity: var(--tx-curve-dot-opacity, 0.3);\r\n cursor: grab;\r\n}\r\n\r\n.tx-curve-dot:active {\r\n cursor: grabbing;\r\n}\r\n\r\n.tx-curve-dot:focus {\r\n outline: none;\r\n}\r\n\r\n/* keyboard focus: a thicker outline and a glow (browsers draw the outline of SVG shapes differently) / фокус с клавиатуры: утолщённая обводка и свечение (контур у SVG-форм браузеры рисуют по-разному) */\r\n.tx-curve-dot:focus-visible {\r\n stroke-width: 3;\r\n filter: drop-shadow(0 0 3px var(--tx-curve-accent, #4fc3f7));\r\n opacity: 1;\r\n}\r\n\r\n.tx-curve-dot.on,\r\n.tx-curve-dot:hover {\r\n fill: var(--tx-curve-accent, #4fc3f7);\r\n opacity: 1;\r\n}\r\n</style>\r\n","<script lang=\"ts\" setup>\r\nimport { computed, nextTick, onBeforeUnmount, ref } from 'vue';\r\nimport { createEdgeScroller } from '../edgescroll';\r\nimport { clampTo, niceStep, roundTo, snapTo, ticks } from '../num';\r\nimport { addPoint, movePoint, removePoint, sampleSegment, setEase, valueBounds, type CurveGuides, type CurvePoint } from './ops';\r\n\r\nconst props = withDefaults(\r\n defineProps<{\r\n /**\r\n * Curve points in ascending t (at least two).\r\n * Точки кривой по возрастанию t (минимум две).\r\n */\r\n modelValue: readonly CurvePoint[];\r\n /**\r\n * Index of the selected point.\r\n * Индекс выбранной точки.\r\n */\r\n selected?: number;\r\n /**\r\n * Allowed values: they fix the plot view and do not let a point be dragged past the bound.\r\n * Допустимые значения: фиксируют вид графика и не дают утащить точку за границу.\r\n */\r\n min?: number;\r\n max?: number;\r\n /**\r\n * How many decimals to keep in t and v; not set means do not round.\r\n * Сколько знаков после запятой оставлять у t и v; не задано — не обрезать.\r\n */\r\n precision?: number;\r\n /**\r\n * Snapping to the grid (Shift flips the mode for the moment).\r\n * Прилипание к сетке (Shift на время меняет режим).\r\n */\r\n snap?: boolean;\r\n /**\r\n * The time step and the distance between labelled lines.\r\n * Шаг по времени и расстояние между подписанными линиями.\r\n */\r\n stepT?: number;\r\n majorT?: number;\r\n /**\r\n * A hint on hover over the field.\r\n * Подсказка при наведении на поле.\r\n */\r\n hint?: string;\r\n /**\r\n * The point label for screen readers; \"Point 1: t, v\" by default.\r\n * Подпись точки для скринридеров; по умолчанию «Point 1: t, v».\r\n */\r\n pointLabel?: (index: number, point: CurvePoint) => string;\r\n /**\r\n * How time is written: on the time axis, on the tag of the selected point and in the default point label. `t` is 0…1, the\r\n * editor's own time; a curve over years or seconds says so here (`(t) => `${Math.round(t * 14)} y``). By default the number\r\n * itself.\r\n * Как записывается время: на оси времени, на метке выбранной точки и в подписи точки по умолчанию. `t` — от 0 до 1, собственное\r\n * время редактора; кривая по годам или секундам говорит это здесь. По умолчанию само число.\r\n */\r\n formatT?: (t: number) => string;\r\n /**\r\n * Guides from the selected point to the axes: `off` none, `lines` dashed lines only, `values` lines and the point values on the axes.\r\n * `lines` by default: noticeable, but not overloaded.\r\n * Направляющие от выбранной точки к осям: `off` нет, `lines` только пунктирные линии, `values` линии и значения точки на осях.\r\n * По умолчанию `lines`: заметно, но не перегружает.\r\n */\r\n guides?: CurveGuides;\r\n /**\r\n * The label of a Bezier handle for screen readers (n: 1 or 2); \"Bezier handle n\" by default.\r\n * Подпись ручки Безье для скринридеров (n: 1 или 2); по умолчанию «Bezier handle n».\r\n */\r\n handleLabel?: (n: number, index: number) => string;\r\n }>(),\r\n { selected: 0, snap: true, stepT: 0.05, majorT: 0.25, guides: 'lines' },\r\n);\r\nconst emit = defineEmits<{\r\n 'update:modelValue': [value: CurvePoint[]];\r\n 'update:selected': [index: number];\r\n /**\r\n * An edit is finished (a point was released, added, removed): the moment to record into history.\r\n * Правка закончена (отпустили точку, добавили, убрали): момент для записи в историю.\r\n */\r\n commit: [];\r\n}>();\r\n\r\nconst W = 280;\r\nconst H = 132;\r\nconst PAD_L = 30;\r\nconst PAD_R = 10;\r\nconst PAD_T = 10;\r\nconst PAD_B = 16;\r\nconst PLOT_W = W - PAD_L - PAD_R;\r\nconst PLOT_H = H - PAD_T - PAD_B;\r\n\r\nconst svg = ref<SVGSVGElement | null>(null);\r\n\r\nconst points = computed(() => props.modelValue);\r\n// The limits are remembered for the duration of a drag: otherwise the plot would \"float\" under the hand\r\n// Пределы запоминаем на время перетаскивания: иначе график «плыл» бы под рукой\r\nconst frozen = ref<{ min: number; max: number } | null>(null);\r\n// The view shift by value: accumulated by auto-scroll at the edge while a point is dragged\r\n// Сдвиг вида по значению: накапливает автопрокрутка у края, пока тянут точку\r\nconst shift = ref(0);\r\nconst bounds = computed(() => (frozen.value ? { min: frozen.value.min + shift.value, max: frozen.value.max + shift.value } : valueBounds(points.value, props.min, props.max)));\r\nconst span = computed(() => bounds.value.max - bounds.value.min);\r\n\r\nconst majorV = computed(() => niceStep(span.value, 4));\r\nconst stepV = computed(() => niceStep(span.value, 20));\r\nconst gridT = computed(() => ticks(0, 1, props.stepT));\r\nconst gridV = computed(() => ticks(bounds.value.min, bounds.value.max, stepV.value));\r\nconst labelsV = computed(() => ticks(bounds.value.min, bounds.value.max, majorV.value));\r\nconst labelsT = computed(() => ticks(0, 1, props.majorT));\r\nconst isMajorT = (x: number) => Math.abs(x / props.majorT - Math.round(x / props.majorT)) < 1e-6;\r\nconst isMajorV = (v: number) => Math.abs(v / majorV.value - Math.round(v / majorV.value)) < 1e-6;\r\n\r\nconst px = (tt: number) => PAD_L + tt * PLOT_W;\r\nconst py = (v: number) => PAD_T + (1 - (v - bounds.value.min) / span.value) * PLOT_H;\r\n// Segments are drawn by their transitions: a straight one has two ends, smooth ones dozens of pieces, a step a corner\r\n// Участки рисуются по своим переходам: у прямой два конца, у плавных десятки отрезков, у ступеньки угол\r\nconst path = computed(() => {\r\n const pts = points.value;\r\n const out: string[] = [];\r\n for (let i = 0; i < pts.length - 1; i++) {\r\n sampleSegment(pts[i]!, pts[i + 1]!).forEach((p, k) => out.push(`${i === 0 && k === 0 ? 'M' : 'L'} ${px(p.t).toFixed(1)} ${py(p.v).toFixed(1)}`));\r\n }\r\n return out.join(' ');\r\n});\r\nconst fmt = (n: number) => String(Math.round(n * 1000) / 1000);\r\nconst fmtT = (tt: number) => (props.formatT ? props.formatT(tt) : fmt(tt));\r\n\r\n// The values of the selected point on the axes: time under the plot, value on the left. They show while the point is dragged, so there is no need to look for the fields.\r\n// Значения выбранной точки на осях: время под графиком, значение слева. Они видны, пока точку тянут, и не надо искать глазами поля.\r\nconst CHAR_W = 4.6;\r\nconst tagWidth = (text: string) => text.length * CHAR_W + 5;\r\nconst tags = computed(() => {\r\n const p = points.value[Math.min(props.selected, points.value.length - 1)];\r\n if (!p) return null;\r\n const t = fmtT(p.t);\r\n const v = fmt(p.v);\r\n const wt = tagWidth(t);\r\n const wv = tagWidth(v);\r\n const cx = Math.min(W - wt / 2 - 1, Math.max(wt / 2 + 1, px(p.t)));\r\n const cy = Math.min(PAD_T + PLOT_H - 5, Math.max(PAD_T + 5, py(p.v)));\r\n return {\r\n x: px(p.t),\r\n y: py(p.v),\r\n t: { text: t, cx, w: wt },\r\n v: { text: v, cy, w: wv },\r\n };\r\n});\r\n\r\ninterface PointerSample {\r\n clientX: number;\r\n clientY: number;\r\n shiftKey: boolean;\r\n}\r\n\r\n/**\r\n * Pointer coordinates in curve units as they are: no snapping, rounding or bounds.\r\n * Координаты указателя в единицах кривой, как есть: без прилипания, округления и границ.\r\n */\r\nfunction rawCurve(e: PointerSample): { t: number; v: number } {\r\n const r = svg.value!.getBoundingClientRect();\r\n const x = ((e.clientX - r.left) / r.width) * W;\r\n const y = ((e.clientY - r.top) / r.height) * H;\r\n const { min, max } = bounds.value;\r\n return { t: (x - PAD_L) / PLOT_W, v: min + (1 - (y - PAD_T) / PLOT_H) * (max - min) };\r\n}\r\n\r\n/**\r\n * Pointer coordinates in curve units; Shift temporarily flips the snapping mode.\r\n * Координаты указателя в единицах кривой; Shift временно меняет режим шага.\r\n */\r\nfunction toCurve(e: PointerSample): { t: number; v: number } {\r\n let { t: tt, v } = rawCurve(e);\r\n if (props.snap !== e.shiftKey) {\r\n tt = snapTo(tt, props.stepT);\r\n v = snapTo(v, stepV.value);\r\n }\r\n return { t: roundTo(tt, props.precision), v: clampTo(roundTo(v, props.precision), props.min, props.max) };\r\n}\r\n\r\nlet dragging = -1;\r\nlet lastPointer: PointerSample = { clientX: 0, clientY: 0, shiftKey: false };\r\n\r\n/**\r\n * The point follows the pointer: both when it moves and when the view moved under a still pointer.\r\n * Точка идёт за указателем: и при его движении, и когда вид уехал под неподвижным указателем.\r\n */\r\nfunction followPointer() {\r\n if (dragging < 0) return;\r\n const { t: tt, v } = toCurve(lastPointer);\r\n emit('update:modelValue', movePoint(points.value, dragging, tt, v));\r\n}\r\n\r\n// Dragging a point to the top/bottom edge of the plot: the view by value follows (by time it is always 0…1).\r\n// The field bounds are not crossed: with min and max set the view stands still.\r\n// Тянем точку к верхнему/нижнему краю графика: вид по значению едет следом (по времени он всегда 0…1).\r\n// Границы поля не пересекаем: при заданных min и max вид стоит.\r\nconst scroller = createEdgeScroller({\r\n bounds: () => svg.value?.getBoundingClientRect() ?? null,\r\n pointer: () => [lastPointer.clientX, lastPointer.clientY],\r\n enabled: () => dragging >= 0,\r\n zone: 18,\r\n maxSpeed: 240,\r\n onScroll: (_dx, dy) => {\r\n const base = frozen.value;\r\n const r = svg.value?.getBoundingClientRect();\r\n if (!base || !r) return;\r\n // The visible area moved down by dy px: the view values decreased\r\n // Видимая область уехала вниз на dy px: значения вида уменьшились\r\n const dv = ((dy * H) / r.height / PLOT_H) * (base.max - base.min);\r\n const lo = props.min === undefined ? -Infinity : props.min - base.min;\r\n const hi = props.max === undefined ? Infinity : props.max - base.max;\r\n shift.value = Math.min(hi, Math.max(lo, shift.value - dv));\r\n followPointer();\r\n },\r\n});\r\nonBeforeUnmount(scroller.stop);\r\n\r\nfunction onDown(e: PointerEvent, i: number) {\r\n emit('update:selected', i);\r\n if (e.altKey) {\r\n emit('update:modelValue', removePoint(points.value, i));\r\n emit('update:selected', 0);\r\n emit('commit');\r\n return;\r\n }\r\n dragging = i;\r\n lastPointer = e;\r\n shift.value = 0;\r\n frozen.value = valueBounds(points.value, props.min, props.max);\r\n try {\r\n (e.currentTarget as Element).setPointerCapture(e.pointerId);\r\n } catch {\r\n // the pointer has already gone or the capture is unavailable: dragging works without it\r\n // указатель уже ушёл или захват недоступен: тянуть можно и без него\r\n }\r\n}\r\n\r\nfunction onMove(e: PointerEvent) {\r\n if (dragging < 0) return;\r\n lastPointer = e;\r\n followPointer();\r\n scroller.kick();\r\n}\r\n\r\nfunction onUp() {\r\n if (dragging < 0) return;\r\n dragging = -1;\r\n scroller.stop();\r\n frozen.value = null;\r\n shift.value = 0;\r\n emit('commit');\r\n}\r\n\r\n//--------------------------------------------------\r\n// Handles of the cubic Bezier curve of the selected segment\r\n// Ручки кубической кривой Безье у выбранного участка\r\n\r\n/**\r\n * The segment that starts at the selected point and follows a Bezier: only it has handles (and only if the segment has height).\r\n * Участок, который начинается в выбранной точке и идёт по Безье: ручки есть только у него (и только если у участка есть высота).\r\n */\r\nconst bezierSegment = computed(() => {\r\n const i = Math.min(props.selected, points.value.length - 1);\r\n const a = points.value[i];\r\n const b = points.value[i + 1];\r\n if (!a || !b || typeof a.ease !== 'object' || Math.abs(b.v - a.v) < 1e-9 || b.t - a.t <= 0) return null;\r\n return { i, a, b, bezier: a.ease.bezier };\r\n});\r\n\r\n/**\r\n * The two handles of the segment in plot coordinates.\r\n * Две ручки участка в координатах плота.\r\n */\r\nconst bezierHandles = computed(() => {\r\n const s = bezierSegment.value;\r\n if (!s) return [];\r\n const [x1, y1, x2, y2] = s.bezier;\r\n return [\r\n { n: 0, t: s.a.t + x1 * (s.b.t - s.a.t), v: s.a.v + y1 * (s.b.v - s.a.v), from: s.a },\r\n { n: 1, t: s.a.t + x2 * (s.b.t - s.a.t), v: s.a.v + y2 * (s.b.v - s.a.v), from: s.b },\r\n ];\r\n});\r\n\r\n/**\r\n * Starts of segments with a Bezier: the \"B\" mark is drawn above them.\r\n * Начала участков с Безье: над ними рисуется метка «B».\r\n */\r\nconst bezierMarks = computed(() => points.value.flatMap((p, i) => (typeof p.ease === 'object' && i < points.value.length - 1 ? [{ i, t: p.t, v: p.v }] : [])));\r\n\r\nconst round2 = (x: number) => Math.round(x * 100) / 100;\r\nconst BEZIER_STEP = 0.05;\r\n\r\n/**\r\n * Handle `n` is put at (x, y) of the normalised segment: x in 0…1, y free within reasonable limits (overshoot).\r\n * Ручка `n` ставится в (x, y) нормализованного участка: x в 0…1, y свободный в разумных пределах (заступ).\r\n */\r\nfunction setBezierHandle(n: 0 | 1, x: number, y: number, commitNow = false) {\r\n const s = bezierSegment.value;\r\n if (!s) return;\r\n const next: [number, number, number, number] = [...s.bezier];\r\n next[n * 2] = Math.min(1, Math.max(0, round2(x)));\r\n next[n * 2 + 1] = Math.min(3, Math.max(-2, round2(y)));\r\n emit('update:modelValue', setEase(points.value, s.i, { bezier: next }));\r\n if (commitNow) emit('commit');\r\n}\r\n\r\nlet handleDrag = -1;\r\n\r\nfunction onHandleDown(e: PointerEvent, n: number) {\r\n handleDrag = n;\r\n frozen.value = valueBounds(points.value, props.min, props.max);\r\n try {\r\n (e.currentTarget as Element).setPointerCapture(e.pointerId);\r\n } catch {\r\n // the pointer has already gone or the capture is unavailable: dragging works without it\r\n // указатель уже ушёл или захват недоступен: тянуть можно и без него\r\n }\r\n}\r\n\r\nfunction onHandleMove(e: PointerEvent) {\r\n const s = bezierSegment.value;\r\n if (handleDrag < 0 || !s) return;\r\n const { t, v } = rawCurve(e);\r\n setBezierHandle(handleDrag as 0 | 1, (t - s.a.t) / (s.b.t - s.a.t), (v - s.a.v) / (s.b.v - s.a.v));\r\n}\r\n\r\nfunction onHandleUp() {\r\n if (handleDrag < 0) return;\r\n handleDrag = -1;\r\n frozen.value = null;\r\n emit('commit');\r\n}\r\n\r\n/**\r\n * Arrows on a handle move it by a step (Shift larger): left and right along x, up and down along y.\r\n * Стрелки на ручке сдвигают её на шаг (Shift крупнее): влево и вправо по x, вверх и вниз по y.\r\n */\r\nfunction onHandleKey(e: KeyboardEvent, n: number) {\r\n const s = bezierSegment.value;\r\n const arrows: Record<string, [number, number]> = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, 1], ArrowDown: [0, -1] };\r\n const d = arrows[e.key];\r\n if (!s || !d) return;\r\n e.preventDefault();\r\n e.stopPropagation();\r\n const k = BEZIER_STEP * (e.shiftKey ? 5 : 1);\r\n setBezierHandle(n as 0 | 1, s.bezier[n * 2]! + d[0] * k, s.bezier[n * 2 + 1]! + d[1] * k, true);\r\n}\r\n\r\n/**\r\n * A double click on the plot must not select the page text around it.\r\n * Двойной клик по графику не должен выделять текст страницы вокруг.\r\n */\r\nfunction noSelect(e: MouseEvent) {\r\n if (e.detail > 1) e.preventDefault();\r\n}\r\n\r\nfunction onDouble(e: MouseEvent) {\r\n const { t: tt, v } = toCurve(e);\r\n const r = addPoint(points.value, tt, v);\r\n emit('update:selected', r.index);\r\n emit('update:modelValue', r.points);\r\n emit('commit');\r\n}\r\n\r\n/**\r\n * The arrow step with Shift: this many times larger.\r\n * Шаг стрелки с Shift: во столько раз крупнее.\r\n */\r\nconst COARSE = 5;\r\n\r\n/**\r\n * Moves point `i` by `dx` steps in time and `dy` steps in value (grid steps), with snapping, rounding and bounds.\r\n * Сдвигает точку `i` на `dx` шагов по времени и `dy` шагов по значению (шаги сетки), с прижатием, округлением и границами.\r\n */\r\nfunction nudge(i: number, dx: number, dy: number, coarse: boolean) {\r\n const p = points.value[i];\r\n if (!p) return;\r\n const k = coarse ? COARSE : 1;\r\n const tt = roundTo(snapTo(p.t + dx * k * props.stepT, props.stepT), props.precision);\r\n const v = clampTo(roundTo(snapTo(p.v + dy * k * stepV.value, stepV.value), props.precision), props.min, props.max);\r\n emit('update:modelValue', movePoint(points.value, i, tt, v));\r\n emit('commit');\r\n}\r\n\r\n/**\r\n * Insert adds a point between the selected one and the next (for the last: between it and the previous) on the curve itself.\r\n * Insert добавляет точку между выбранной и следующей (у последней: между ней и предыдущей) на самой кривой.\r\n */\r\n/**\r\n * Focus on point `i` after a re-render: keys go to the selected point, and focus must not stay on the old one.\r\n * Фокус на точку `i` после перерисовки: клавиши идут к той точке, что выбрана, и фокус не должен оставаться на старой.\r\n */\r\nfunction focusDot(i: number) {\r\n void nextTick(() => svg.value?.querySelectorAll<SVGElement>('.tx-curve-dot')[i]?.focus());\r\n}\r\n\r\nfunction insertAfter(i: number) {\r\n const a = points.value[i];\r\n const b = points.value[i + 1] ?? points.value[i - 1];\r\n if (!a || !b) return;\r\n const r = addPoint(points.value, roundTo((a.t + b.t) / 2, props.precision));\r\n emit('update:selected', r.index);\r\n emit('update:modelValue', r.points);\r\n emit('commit');\r\n focusDot(r.index);\r\n}\r\n\r\nfunction removeAt(i: number) {\r\n const next = Math.max(0, i - 1);\r\n emit('update:modelValue', removePoint(points.value, i));\r\n emit('update:selected', next);\r\n emit('commit');\r\n focusDot(next);\r\n}\r\n\r\n/**\r\n * Point keys (focus on it): arrows move by a grid step, Shift larger; Insert adds, Delete removes.\r\n * Клавиши точки (фокус на ней): стрелки двигают на шаг сетки, Shift крупнее; Insert добавляет, Delete убирает.\r\n */\r\nfunction onKey(e: KeyboardEvent) {\r\n // the point that has focus; if the key came from the field itself (after a click on it), then the selected one\r\n // точка, на которой фокус; если клавиша пришла с самого поля (после клика по нему), то выбранная\r\n const target = (e.target as Element | null)?.closest('.tx-curve-dot');\r\n const index = target ? Number(target.getAttribute('data-index')) : NaN;\r\n const i = Number.isInteger(index) ? index : Math.min(props.selected, points.value.length - 1);\r\n const arrows: Record<string, [number, number]> = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, 1], ArrowDown: [0, -1] };\r\n const move = arrows[e.key];\r\n if (move) {\r\n e.preventDefault();\r\n nudge(i, move[0], move[1], e.shiftKey);\r\n } else if (e.key === 'Insert') {\r\n e.preventDefault();\r\n insertAfter(i);\r\n } else if (e.key === 'Delete' || e.key === 'Backspace') {\r\n e.preventDefault();\r\n removeAt(i);\r\n }\r\n}\r\n\r\nconst labelOf = (i: number, p: CurvePoint) => (props.pointLabel ? props.pointLabel(i, p) : `Point ${i + 1}: ${fmtT(p.t)}, ${fmt(p.v)}`);\r\n</script>\r\n\r\n<template>\r\n <svg ref=\"svg\" class=\"tx-curve\" :viewBox=\"`0 0 ${W} ${H}`\" :title=\"hint\" tabindex=\"-1\" role=\"group\" @dblclick.self=\"onDouble\" @mousedown=\"noSelect\" @keydown=\"onKey\">\r\n <!-- fine grid: the same steps as snapping / мелкая сетка: те же шаги, что у прилипания -->\r\n <line v-for=\"x in gridT\" :key=\"`gt${x}`\" class=\"tx-curve-grid\" :class=\"{ major: isMajorT(x) }\" :x1=\"px(x)\" :x2=\"px(x)\" :y1=\"PAD_T\" :y2=\"H - PAD_B\" />\r\n <line v-for=\"v in gridV\" :key=\"`gv${v}`\" class=\"tx-curve-grid\" :class=\"{ major: isMajorV(v) }\" :x1=\"PAD_L\" :x2=\"W - PAD_R\" :y1=\"py(v)\" :y2=\"py(v)\" />\r\n\r\n <text v-for=\"(v, i) in labelsV\" :key=\"`lv${v}`\" class=\"tx-curve-label\" :class=\"{ edge: v === 0 || i === 0 || i === labelsV.length - 1 }\" :x=\"PAD_L - 4\" :y=\"py(v)\" text-anchor=\"end\" dominant-baseline=\"middle\">{{ fmt(v) }}</text>\r\n <text v-for=\"x in labelsT\" :key=\"`lt${x}`\" class=\"tx-curve-label\" :class=\"{ edge: x === 0 || x === 1 }\" :x=\"px(x)\" :y=\"H - 4\" :text-anchor=\"x === 0 ? 'start' : x === 1 ? 'end' : 'middle'\">{{ fmtT(x) }}</text>\r\n\r\n <g v-if=\"tags && guides !== 'off'\" class=\"tx-curve-tags\" aria-hidden=\"true\">\r\n <line class=\"tx-curve-guide\" :x1=\"tags.x\" :x2=\"tags.x\" :y1=\"tags.y\" :y2=\"PAD_T + PLOT_H\" />\r\n <line class=\"tx-curve-guide\" :x1=\"PAD_L\" :x2=\"tags.x\" :y1=\"tags.y\" :y2=\"tags.y\" />\r\n <template v-if=\"guides === 'values'\">\r\n <rect class=\"tx-curve-tag-bg\" :x=\"tags.t.cx - tags.t.w / 2\" :y=\"H - 12\" :width=\"tags.t.w\" height=\"11\" rx=\"2\" />\r\n <text class=\"tx-curve-tag\" :x=\"tags.t.cx\" :y=\"H - 4\" text-anchor=\"middle\">{{ tags.t.text }}</text>\r\n <rect class=\"tx-curve-tag-bg\" :x=\"PAD_L - 3 - tags.v.w\" :y=\"tags.v.cy - 5.5\" :width=\"tags.v.w\" height=\"11\" rx=\"2\" />\r\n <text class=\"tx-curve-tag\" :x=\"PAD_L - 5\" :y=\"tags.v.cy\" text-anchor=\"end\" dominant-baseline=\"middle\">{{ tags.v.text }}</text>\r\n </template>\r\n </g>\r\n\r\n <path class=\"tx-curve-line\" :d=\"path\" />\r\n\r\n <!-- The \"B\" mark above the start of a Bezier segment: shows the point has handles even when it is not selected / Метка «B» над началом участка с Безье: видно, что у точки есть ручки, даже когда она не выбрана -->\r\n <text v-for=\"m in bezierMarks\" :key=\"`b${m.i}`\" class=\"tx-curve-mark\" :x=\"px(m.t)\" :y=\"py(m.v) - 8\" text-anchor=\"middle\" aria-hidden=\"true\">B</text>\r\n\r\n <g v-if=\"bezierHandles.length\" class=\"tx-curve-bezier\">\r\n <template v-for=\"h in bezierHandles\" :key=\"h.n\">\r\n <line class=\"tx-curve-arm\" :x1=\"px(h.from.t)\" :y1=\"py(h.from.v)\" :x2=\"px(h.t)\" :y2=\"py(h.v)\" />\r\n <circle\r\n class=\"tx-curve-handle\"\r\n :cx=\"px(h.t)\"\r\n :cy=\"py(h.v)\"\r\n r=\"4\"\r\n tabindex=\"0\"\r\n role=\"slider\"\r\n :aria-label=\"handleLabel ? handleLabel(h.n + 1, bezierSegment!.i) : `Bezier handle ${h.n + 1}`\"\r\n @pointerdown.stop=\"onHandleDown($event, h.n)\"\r\n @pointermove=\"onHandleMove\"\r\n @pointerup=\"onHandleUp\"\r\n @pointercancel=\"onHandleUp\"\r\n @keydown=\"onHandleKey($event, h.n)\"\r\n />\r\n </template>\r\n </g>\r\n <circle\r\n v-for=\"(p, i) in points\"\r\n :key=\"i\"\r\n class=\"tx-curve-dot\"\r\n :class=\"{ on: i === selected }\"\r\n :cx=\"px(p.t)\"\r\n :cy=\"py(p.v)\"\r\n r=\"5\"\r\n :data-index=\"i\"\r\n tabindex=\"0\"\r\n role=\"button\"\r\n :aria-label=\"labelOf(i, p)\"\r\n @focus=\"emit('update:selected', i)\"\r\n @pointerdown.stop=\"onDown($event, i)\"\r\n @pointermove=\"onMove\"\r\n @pointerup=\"onUp\"\r\n @pointercancel=\"onUp\"\r\n />\r\n </svg>\r\n</template>\r\n\r\n<style>\r\n/*\r\n * Configured with CSS variables on any ancestor:\r\n * Настройка через CSS-переменные на любом предке:\r\n * --tx-curve-bg, --tx-curve-border, --tx-curve-grid, --tx-curve-label, --tx-curve-accent,\r\n * --tx-curve-text (the numbers at the ends of the axes: start and end of the scale, brighter than the rest),\r\n * --tx-curve-radius (the corners of the plot, 4px by default),\r\n * --tx-curve-dot-opacity (opacity of unselected points, 0.3 by default).\r\n * --tx-curve-text (цифры у краёв осей: начало и конец шкалы, ярче остальных),\r\n * --tx-curve-radius (углы графика, по умолчанию 4px),\r\n * --tx-curve-dot-opacity (непрозрачность невыбранных точек, по умолчанию 0.3).\r\n */\r\n.tx-curve {\r\n display: block;\r\n width: 100%;\r\n height: auto;\r\n border: 1px solid var(--tx-curve-border, #2a2d33);\r\n border-radius: var(--tx-curve-radius, 4px);\r\n background: var(--tx-curve-bg, #15171b);\r\n touch-action: none;\r\n user-select: none;\r\n outline: none;\r\n}\r\n\r\n.tx-curve-grid {\r\n pointer-events: none; /* otherwise a double click hits the grid line, not the field / иначе двойной клик попадает в линию сетки, а не в поле */\r\n stroke: var(--tx-curve-grid, #2a2d33);\r\n stroke-width: 0.5;\r\n opacity: 0.45;\r\n}\r\n\r\n.tx-curve-grid.major {\r\n stroke-width: 1;\r\n opacity: 1;\r\n}\r\n\r\n.tx-curve-guide {\r\n stroke: var(--tx-curve-accent, #4fc3f7);\r\n stroke-width: 1;\r\n stroke-dasharray: 2 3;\r\n opacity: 0.45;\r\n pointer-events: none;\r\n}\r\n\r\n.tx-curve-tag-bg {\r\n fill: var(--tx-curve-bg, #15171b);\r\n pointer-events: none;\r\n}\r\n\r\n.tx-curve-tag {\r\n fill: var(--tx-curve-accent, #4fc3f7);\r\n font-size: 8px;\r\n font-weight: 700;\r\n pointer-events: none;\r\n user-select: none;\r\n}\r\n\r\n.tx-curve-label.edge {\r\n fill: var(--tx-curve-text, #d6d9e0);\r\n}\r\n\r\n.tx-curve-label {\r\n fill: var(--tx-curve-label, #8b929c);\r\n font-size: 8px;\r\n pointer-events: none;\r\n user-select: none;\r\n}\r\n\r\n.tx-curve-line {\r\n fill: none;\r\n stroke: var(--tx-curve-accent, #4fc3f7);\r\n stroke-width: 2;\r\n pointer-events: none;\r\n}\r\n\r\n.tx-curve-mark {\r\n fill: var(--tx-curve-accent, #4fc3f7);\r\n font: 600 9px/1 system-ui, sans-serif;\r\n pointer-events: none;\r\n user-select: none;\r\n}\r\n\r\n.tx-curve-arm {\r\n stroke: var(--tx-curve-label, #8b929c);\r\n stroke-width: 1;\r\n stroke-dasharray: 3 2;\r\n pointer-events: none;\r\n}\r\n\r\n.tx-curve-handle {\r\n fill: var(--tx-curve-label, #8b929c);\r\n stroke: var(--tx-curve-bg, #15171b);\r\n stroke-width: 1.5;\r\n cursor: grab;\r\n}\r\n\r\n.tx-curve-handle:active {\r\n cursor: grabbing;\r\n}\r\n\r\n.tx-curve-handle:hover,\r\n.tx-curve-handle:focus-visible {\r\n fill: var(--tx-curve-accent, #4fc3f7);\r\n outline: none;\r\n}\r\n\r\n.tx-curve-dot {\r\n fill: var(--tx-curve-bg, #15171b);\r\n stroke: var(--tx-curve-accent, #4fc3f7);\r\n stroke-width: 2;\r\n opacity: var(--tx-curve-dot-opacity, 0.3);\r\n cursor: grab;\r\n}\r\n\r\n.tx-curve-dot:active {\r\n cursor: grabbing;\r\n}\r\n\r\n.tx-curve-dot:focus {\r\n outline: none;\r\n}\r\n\r\n/* keyboard focus: a thicker outline and a glow (browsers draw the outline of SVG shapes differently) / фокус с клавиатуры: утолщённая обводка и свечение (контур у SVG-форм браузеры рисуют по-разному) */\r\n.tx-curve-dot:focus-visible {\r\n stroke-width: 3;\r\n filter: drop-shadow(0 0 3px var(--tx-curve-accent, #4fc3f7));\r\n opacity: 1;\r\n}\r\n\r\n.tx-curve-dot.on,\r\n.tx-curve-dot:hover {\r\n fill: var(--tx-curve-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