@1337exp/taoux 0.0.0-stage → 0.1.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.
Files changed (94) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +21 -0
  3. package/README.md +137 -2
  4. package/README.ru.md +140 -0
  5. package/dist/camera.d.ts +22 -0
  6. package/dist/camera.js +38 -0
  7. package/dist/camera.js.map +1 -0
  8. package/dist/canvas/TaoxCanvas.vue.d.ts +37 -0
  9. package/dist/canvas/host.d.ts +138 -0
  10. package/dist/canvas/index.d.ts +3 -0
  11. package/dist/canvas/useCanvasGestures.d.ts +44 -0
  12. package/dist/canvas.css +55 -0
  13. package/dist/canvas.js +696 -0
  14. package/dist/canvas.js.map +1 -0
  15. package/dist/chunks/curveeditor-goX9maE5.js +759 -0
  16. package/dist/chunks/curveeditor-goX9maE5.js.map +1 -0
  17. package/dist/curve.d.ts +53 -0
  18. package/dist/curve.js +81 -0
  19. package/dist/curve.js.map +1 -0
  20. package/dist/curveeditor/TaoxCurveEditor.vue.d.ts +74 -0
  21. package/dist/curveeditor/index.d.ts +3 -0
  22. package/dist/curveeditor/ops.d.ts +63 -0
  23. package/dist/curveeditor.css +115 -0
  24. package/dist/curveeditor.js +1 -0
  25. package/dist/curvefield/TaoxCurveField.vue.d.ts +64 -0
  26. package/dist/curvefield/index.d.ts +2 -0
  27. package/dist/curvefield/labels.d.ts +13 -0
  28. package/dist/curvefield.css +57 -0
  29. package/dist/curvefield.js +252 -0
  30. package/dist/curvefield.js.map +1 -0
  31. package/dist/ease.d.ts +62 -0
  32. package/dist/ease.js +157 -0
  33. package/dist/ease.js.map +1 -0
  34. package/dist/edgescroll.d.ts +77 -0
  35. package/dist/edgescroll.js +78 -0
  36. package/dist/edgescroll.js.map +1 -0
  37. package/dist/file.d.ts +10 -0
  38. package/dist/file.js +22 -0
  39. package/dist/file.js.map +1 -0
  40. package/dist/gestures.d.ts +174 -0
  41. package/dist/gestures.js +229 -0
  42. package/dist/gestures.js.map +1 -0
  43. package/dist/gradienteditor/TaoxGradientEditor.vue.d.ts +48 -0
  44. package/dist/gradienteditor/index.d.ts +2 -0
  45. package/dist/gradienteditor/ops.d.ts +83 -0
  46. package/dist/gradienteditor.css +81 -0
  47. package/dist/gradienteditor.js +337 -0
  48. package/dist/gradienteditor.js.map +1 -0
  49. package/dist/history.d.ts +42 -0
  50. package/dist/history.js +89 -0
  51. package/dist/history.js.map +1 -0
  52. package/dist/i18n.d.ts +51 -0
  53. package/dist/i18n.js +102 -0
  54. package/dist/i18n.js.map +1 -0
  55. package/dist/ids.d.ts +5 -0
  56. package/dist/ids.js +17 -0
  57. package/dist/ids.js.map +1 -0
  58. package/dist/links/TaoxLinks.vue.d.ts +14 -0
  59. package/dist/links/index.d.ts +2 -0
  60. package/dist/links/types.d.ts +37 -0
  61. package/dist/links.css +80 -0
  62. package/dist/links.js +72 -0
  63. package/dist/links.js.map +1 -0
  64. package/dist/num.d.ts +35 -0
  65. package/dist/num.js +60 -0
  66. package/dist/num.js.map +1 -0
  67. package/dist/palette.d.ts +34 -0
  68. package/dist/palette.js +41 -0
  69. package/dist/palette.js.map +1 -0
  70. package/dist/pins.d.ts +66 -0
  71. package/dist/pins.js +83 -0
  72. package/dist/pins.js.map +1 -0
  73. package/dist/playback/core.d.ts +81 -0
  74. package/dist/playback/index.d.ts +2 -0
  75. package/dist/playback/use.d.ts +38 -0
  76. package/dist/playback.js +199 -0
  77. package/dist/playback.js.map +1 -0
  78. package/dist/session.d.ts +125 -0
  79. package/dist/session.js +195 -0
  80. package/dist/session.js.map +1 -0
  81. package/dist/snap.d.ts +24 -0
  82. package/dist/snap.js +34 -0
  83. package/dist/snap.js.map +1 -0
  84. package/dist/storage.d.ts +16 -0
  85. package/dist/storage.js +30 -0
  86. package/dist/storage.js.map +1 -0
  87. package/dist/touch.d.ts +9 -0
  88. package/dist/touch.js +20 -0
  89. package/dist/touch.js.map +1 -0
  90. package/dist/wheel.d.ts +31 -0
  91. package/dist/wheel.js +47 -0
  92. package/dist/wheel.js.map +1 -0
  93. package/package.json +183 -4
  94. package/theme/taoui.css +43 -0
@@ -0,0 +1,195 @@
1
+ import { MIN_ZOOM } from "./camera.js";
2
+ import { History } from "./history.js";
3
+ import { ref } from "vue";
4
+ //#region src/session.ts
5
+ var DEFAULT_NOTICE_MS = 5e3;
6
+ var DEFAULT_AUTOSAVE_MS = 400;
7
+ /**
8
+ * The lifecycle of an editor document: history (undo/redo with merged edits), autosave guarded against storage
9
+ * failures, opening and saving a file, restore after a reload, notices.
10
+ * The document, the camera and the file format belong to the app, only the mechanics are here.
11
+ * Жизненный цикл документа редактора: история (undo/redo со склейкой правок), автосохранение с защитой от сбоев
12
+ * хранилища, открытие и сохранение файла, восстановление после перезагрузки, уведомления.
13
+ * Документ, камера и формат файла принадлежат приложению, здесь только механика.
14
+ */
15
+ function createDocumentSession(options) {
16
+ const { document: doc, camera, storage, codec, keys } = options;
17
+ const noticeMs = options.noticeMs ?? DEFAULT_NOTICE_MS;
18
+ const autosaveDelay = options.autosaveDelay ?? DEFAULT_AUTOSAVE_MS;
19
+ const notice = ref(null);
20
+ let noticeTimer;
21
+ function showNotice(kind, key, args) {
22
+ notice.value = {
23
+ kind,
24
+ key,
25
+ args
26
+ };
27
+ clearTimeout(noticeTimer);
28
+ noticeTimer = setTimeout(() => notice.value = null, noticeMs);
29
+ }
30
+ let autosaveOn = false;
31
+ let saveTimer;
32
+ let saveFailedShown = false;
33
+ /**
34
+ * Writes the document and the camera position to storage.
35
+ * Записывает документ и положение камеры в хранилище.
36
+ */
37
+ function flushSave() {
38
+ clearTimeout(saveTimer);
39
+ saveTimer = void 0;
40
+ if (!autosaveOn) return;
41
+ if (storage.write(codec.serialize(doc.get(), camera.get(), false))) saveFailedShown = false;
42
+ else if (!saveFailedShown) {
43
+ saveFailedShown = true;
44
+ showNotice("error", keys.saveFailed);
45
+ }
46
+ }
47
+ function scheduleSave() {
48
+ if (!autosaveOn) return;
49
+ clearTimeout(saveTimer);
50
+ saveTimer = setTimeout(flushSave, autosaveDelay);
51
+ }
52
+ /**
53
+ * Turns autosave on. Off by default (nothing is written in tests and before restore).
54
+ * Edits are saved with a small delay, and at once when the tab is hidden or closed.
55
+ * Returns a function that turns everything off.
56
+ * Включает автосохранение. Выключено по умолчанию (в тестах и до восстановления ничего не пишется).
57
+ * Правки сохраняются с небольшой задержкой, а при скрытии вкладки и закрытии сразу.
58
+ * Возвращает функцию, которая всё отключает.
59
+ */
60
+ function startAutosave() {
61
+ autosaveOn = true;
62
+ const onHide = () => {
63
+ if (document.visibilityState === "hidden") flushSave();
64
+ };
65
+ window.addEventListener("pagehide", flushSave);
66
+ document.addEventListener("visibilitychange", onHide);
67
+ return () => {
68
+ autosaveOn = false;
69
+ clearTimeout(saveTimer);
70
+ window.removeEventListener("pagehide", flushSave);
71
+ document.removeEventListener("visibilitychange", onHide);
72
+ };
73
+ }
74
+ const snapshot = () => JSON.stringify(doc.get());
75
+ const history = new History(snapshot());
76
+ const canUndo = ref(false);
77
+ const canRedo = ref(false);
78
+ function syncHistory() {
79
+ canUndo.value = history.canUndo;
80
+ canRedo.value = history.canRedo;
81
+ scheduleSave();
82
+ }
83
+ /**
84
+ * Remembers the current state as a history step. The same `key` in a row merges edits (typing text).
85
+ * Запоминает текущее состояние как шаг истории. Одинаковый `key` подряд склеивает правки (набор текста).
86
+ */
87
+ function commit(key) {
88
+ history.commit(snapshot(), key);
89
+ syncHistory();
90
+ }
91
+ function restore(state) {
92
+ if (state === null) return false;
93
+ doc.set(JSON.parse(state));
94
+ options.onRestore?.(doc.get());
95
+ syncHistory();
96
+ return true;
97
+ }
98
+ const undo = () => restore(history.undo());
99
+ const redo = () => restore(history.redo());
100
+ /**
101
+ * An action that changes the document: afterwards the state goes into history.
102
+ * Действие, меняющее документ: после него состояние попадает в историю.
103
+ */
104
+ function recorded(fn, key) {
105
+ return (...args) => {
106
+ const result = fn(...args);
107
+ commit(key?.(...args));
108
+ return result;
109
+ };
110
+ }
111
+ /**
112
+ * Replaces the document as a whole. Without `resetHistory` it is an ordinary edit: it can be undone.
113
+ * Подменяет документ целиком. Без `resetHistory` это обычная правка: её можно отменить.
114
+ */
115
+ function load(next, view, resetHistory = false) {
116
+ doc.set(next);
117
+ options.onReset?.();
118
+ if (view) camera.set({
119
+ x: view.x,
120
+ y: view.y,
121
+ z: Math.min(2, Math.max(MIN_ZOOM, view.z))
122
+ });
123
+ if (resetHistory) {
124
+ history.reset(snapshot());
125
+ syncHistory();
126
+ } else commit();
127
+ }
128
+ /**
129
+ * The file text for download.
130
+ * Текст файла для скачивания.
131
+ */
132
+ const exportText = () => codec.serialize(doc.get(), camera.get(), true);
133
+ /**
134
+ * Opens a document from file text. On an error the document is unchanged. The result is shown as a notice.
135
+ * Открывает документ из текста файла. При ошибке документ не меняется. Результат показывается уведомлением.
136
+ */
137
+ function importText(text) {
138
+ const result = codec.parse(text);
139
+ if (!result.ok) {
140
+ const { code, detail } = result.error;
141
+ showNotice("error", keys.loadError(code), detail === void 0 ? void 0 : [detail]);
142
+ return result.error;
143
+ }
144
+ load(result.doc, result.view);
145
+ const nodes = options.countNodes(result.doc);
146
+ if (result.dropped > 0) showNotice("error", keys.loadedWithDropped, [nodes, result.dropped]);
147
+ else showNotice("info", keys.loaded, [nodes]);
148
+ return null;
149
+ }
150
+ function newDocument() {
151
+ load(options.empty(), {
152
+ x: 0,
153
+ y: 0,
154
+ z: 1
155
+ });
156
+ showNotice("info", keys.newDocument);
157
+ }
158
+ /**
159
+ * At app start: brings the document back from autosave. Returns true if there was something to restore.
160
+ * При старте приложения: поднимает документ из автосохранения. Возвращает true, если было что поднимать.
161
+ */
162
+ function restoreSaved() {
163
+ const text = storage.read();
164
+ if (text === null) return false;
165
+ const result = codec.parse(text);
166
+ if (!result.ok) {
167
+ storage.backupBroken(text);
168
+ showNotice("error", keys.restoreFailed);
169
+ return false;
170
+ }
171
+ load(result.doc, result.view, true);
172
+ return true;
173
+ }
174
+ return {
175
+ notice,
176
+ showNotice,
177
+ canUndo,
178
+ canRedo,
179
+ commit,
180
+ undo,
181
+ redo,
182
+ recorded,
183
+ load,
184
+ exportText,
185
+ importText,
186
+ newDocument,
187
+ restoreSaved,
188
+ startAutosave,
189
+ flushSave
190
+ };
191
+ }
192
+ //#endregion
193
+ export { createDocumentSession };
194
+
195
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.js","names":[],"sources":["../src/session.ts"],"sourcesContent":["import { ref } from 'vue';\nimport { MAX_ZOOM, MIN_ZOOM, type Camera } from './camera';\nimport { History } from './history';\nimport type { SavedStorage } from './storage';\n\nexport type NoticeArgs = readonly (string | number)[];\n\n/**\n * A short message to the user. Holds a translation key: the interface builds the text.\n * Короткое сообщение пользователю. Хранит ключ перевода: текст собирает интерфейс.\n */\nexport interface SessionNotice<K extends string = string> {\n kind: 'info' | 'error';\n key: K;\n args?: NoticeArgs;\n}\n\n/**\n * Why opening a file was refused; the interface builds the user text from `code`.\n * Причина отказа открыть файл; текст для пользователя собирает интерфейс по `code`.\n */\nexport interface LoadError {\n code: string;\n detail?: string | number;\n}\n\nexport type LoadResult<D> =\n | { ok: true; doc: D; view?: Camera; dropped: number }\n | { ok: false; error: LoadError };\n\n/**\n * Message keys the session shows by itself. The app dictionary must contain them.\n * Ключи сообщений, которые сессия показывает сама. Словарь приложения обязан их содержать.\n */\nexport interface SessionKeys<K extends string> {\n loaded: K; // {0} is the number of nodes / {0} — число нод\n loadedWithDropped: K; // {0} is the number of nodes, {1} how many links were dropped / {0} — число нод, {1} — сколько связей отброшено\n newDocument: K;\n saveFailed: K;\n restoreFailed: K;\n /**\n * The key for the reason a file was refused.\n * Ключ для причины отказа открыть файл.\n */\n loadError(code: string): K;\n}\n\nexport interface SessionOptions<D, K extends string> {\n /**\n * The document in the app store.\n * Документ в сторе приложения.\n */\n document: { get(): D; set(doc: D): void };\n camera: { get(): Camera; set(camera: Camera): void };\n storage: SavedStorage;\n codec: {\n serialize(doc: D, view: Camera | undefined, pretty: boolean): string;\n parse(text: string): LoadResult<D>;\n };\n empty(): D;\n /**\n * How many nodes are in the document: substituted into the message about opening a file.\n * Сколько нод в документе: подставляется в сообщение об открытии файла.\n */\n countNodes(doc: D): number;\n keys: SessionKeys<K>;\n /**\n * The document was replaced as a whole (open, new, restore): reset the selection, the drag, the palette.\n * Документ подменён целиком (открытие, новый, восстановление): сбросить выделение, протягивание, палитру.\n */\n onReset?(): void;\n /**\n * The state was restored from history (undo/redo): drop references to what is gone.\n * Состояние восстановлено из истории (undo/redo): убрать ссылки на то, чего больше нет.\n */\n onRestore?(doc: D): void;\n /**\n * The pause before autosave, ms.\n * Пауза перед автосохранением, мс.\n */\n autosaveDelay?: number;\n /**\n * How long to show a notice, ms.\n * Сколько секунд показывать уведомление, мс.\n */\n noticeMs?: number;\n}\n\nconst DEFAULT_NOTICE_MS = 5000;\nconst DEFAULT_AUTOSAVE_MS = 400;\n\n/**\n * The lifecycle of an editor document: history (undo/redo with merged edits), autosave guarded against storage\n * failures, opening and saving a file, restore after a reload, notices.\n * The document, the camera and the file format belong to the app, only the mechanics are here.\n * Жизненный цикл документа редактора: история (undo/redo со склейкой правок), автосохранение с защитой от сбоев\n * хранилища, открытие и сохранение файла, восстановление после перезагрузки, уведомления.\n * Документ, камера и формат файла принадлежат приложению, здесь только механика.\n */\nexport function createDocumentSession<D, K extends string>(options: SessionOptions<D, K>) {\n const { document: doc, camera, storage, codec, keys } = options;\n const noticeMs = options.noticeMs ?? DEFAULT_NOTICE_MS;\n const autosaveDelay = options.autosaveDelay ?? DEFAULT_AUTOSAVE_MS;\n\n //---]>\n // notices\n // уведомления\n\n const notice = ref<SessionNotice<K> | null>(null);\n let noticeTimer: ReturnType<typeof setTimeout> | undefined;\n\n function showNotice(kind: SessionNotice<K>['kind'], key: K, args?: NoticeArgs) {\n notice.value = { kind, key, args };\n clearTimeout(noticeTimer);\n noticeTimer = setTimeout(() => (notice.value = null), noticeMs);\n }\n\n //---]>\n // autosave\n // автосохранение\n\n let autosaveOn = false;\n let saveTimer: ReturnType<typeof setTimeout> | undefined;\n let saveFailedShown = false;\n\n /**\n * Writes the document and the camera position to storage.\n * Записывает документ и положение камеры в хранилище.\n */\n function flushSave() {\n clearTimeout(saveTimer);\n saveTimer = undefined;\n if (!autosaveOn) return;\n\n if (storage.write(codec.serialize(doc.get(), camera.get(), false))) {\n saveFailedShown = false;\n } else if (!saveFailedShown) {\n saveFailedShown = true; // tell once, not on every edit / сообщаем один раз, а не при каждой правке\n showNotice('error', keys.saveFailed);\n }\n }\n\n function scheduleSave() {\n if (!autosaveOn) return;\n clearTimeout(saveTimer);\n saveTimer = setTimeout(flushSave, autosaveDelay);\n }\n\n /**\n * Turns autosave on. Off by default (nothing is written in tests and before restore).\n * Edits are saved with a small delay, and at once when the tab is hidden or closed.\n * Returns a function that turns everything off.\n * Включает автосохранение. Выключено по умолчанию (в тестах и до восстановления ничего не пишется).\n * Правки сохраняются с небольшой задержкой, а при скрытии вкладки и закрытии сразу.\n * Возвращает функцию, которая всё отключает.\n */\n function startAutosave(): () => void {\n autosaveOn = true;\n const onHide = () => {\n if (document.visibilityState === 'hidden') flushSave();\n };\n window.addEventListener('pagehide', flushSave);\n document.addEventListener('visibilitychange', onHide);\n\n return () => {\n autosaveOn = false;\n clearTimeout(saveTimer);\n window.removeEventListener('pagehide', flushSave);\n document.removeEventListener('visibilitychange', onHide);\n };\n }\n\n //---]>\n // history\n // история\n\n const snapshot = () => JSON.stringify(doc.get());\n const history = new History(snapshot());\n const canUndo = ref(false);\n const canRedo = ref(false);\n\n function syncHistory() {\n canUndo.value = history.canUndo;\n canRedo.value = history.canRedo;\n scheduleSave(); // the document changed (an edit, undo or redo): autosave will pick it up / документ изменился (правка, undo или redo): автосохранение подхватит\n }\n\n /**\n * Remembers the current state as a history step. The same `key` in a row merges edits (typing text).\n * Запоминает текущее состояние как шаг истории. Одинаковый `key` подряд склеивает правки (набор текста).\n */\n function commit(key?: string) {\n history.commit(snapshot(), key);\n syncHistory();\n }\n\n function restore(state: string | null): boolean {\n if (state === null) return false;\n\n doc.set(JSON.parse(state) as D);\n options.onRestore?.(doc.get());\n syncHistory();\n return true;\n }\n\n const undo = () => restore(history.undo());\n const redo = () => restore(history.redo());\n\n /**\n * An action that changes the document: afterwards the state goes into history.\n * Действие, меняющее документ: после него состояние попадает в историю.\n */\n function recorded<A extends unknown[], R>(fn: (...args: A) => R, key?: (...args: A) => string): (...args: A) => R {\n return (...args) => {\n const result = fn(...args);\n commit(key?.(...args));\n return result;\n };\n }\n\n //---]>\n // opening, files, restore\n // открытие, файлы, восстановление\n\n /**\n * Replaces the document as a whole. Without `resetHistory` it is an ordinary edit: it can be undone.\n * Подменяет документ целиком. Без `resetHistory` это обычная правка: её можно отменить.\n */\n function load(next: D, view?: Camera, resetHistory = false) {\n doc.set(next);\n options.onReset?.();\n if (view) camera.set({ x: view.x, y: view.y, z: Math.min(MAX_ZOOM, Math.max(MIN_ZOOM, view.z)) });\n\n if (resetHistory) {\n history.reset(snapshot());\n syncHistory();\n } else {\n commit();\n }\n }\n\n /**\n * The file text for download.\n * Текст файла для скачивания.\n */\n const exportText = () => codec.serialize(doc.get(), camera.get(), true);\n\n /**\n * Opens a document from file text. On an error the document is unchanged. The result is shown as a notice.\n * Открывает документ из текста файла. При ошибке документ не меняется. Результат показывается уведомлением.\n */\n function importText(text: string): LoadError | null {\n const result = codec.parse(text);\n if (!result.ok) {\n const { code, detail } = result.error;\n showNotice('error', keys.loadError(code), detail === undefined ? undefined : [detail]);\n return result.error;\n }\n\n load(result.doc, result.view);\n const nodes = options.countNodes(result.doc);\n if (result.dropped > 0) showNotice('error', keys.loadedWithDropped, [nodes, result.dropped]);\n else showNotice('info', keys.loaded, [nodes]);\n return null;\n }\n\n function newDocument() {\n load(options.empty(), { x: 0, y: 0, z: 1 });\n showNotice('info', keys.newDocument);\n }\n\n /**\n * At app start: brings the document back from autosave. Returns true if there was something to restore.\n * При старте приложения: поднимает документ из автосохранения. Возвращает true, если было что поднимать.\n */\n function restoreSaved(): boolean {\n const text = storage.read();\n if (text === null) return false;\n\n const result = codec.parse(text);\n if (!result.ok) {\n storage.backupBroken(text);\n showNotice('error', keys.restoreFailed);\n return false;\n }\n\n load(result.doc, result.view, true);\n return true;\n }\n\n return {\n notice,\n showNotice,\n canUndo,\n canRedo,\n commit,\n undo,\n redo,\n recorded,\n load,\n exportText,\n importText,\n newDocument,\n restoreSaved,\n startAutosave,\n flushSave,\n };\n}\n\nexport type DocumentSession<D, K extends string> = ReturnType<typeof createDocumentSession<D, K>>;\n"],"mappings":"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"}
package/dist/snap.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Grid step in world units: matches the fine grid on the canvas background.
3
+ * Шаг сетки в мировых единицах: совпадает с мелкой сеткой на фоне холста.
4
+ */
5
+ export declare const GRID = 24;
6
+ /**
7
+ * How far from a grid line (screen px) a node is pulled to it.
8
+ * На каком расстоянии от линии сетки (экранные px) нода притягивается.
9
+ */
10
+ export declare const SNAP_PX = 6;
11
+ /**
12
+ * Soft snapping: a value is pulled to the nearest grid line only if it is closer than `threshold`,
13
+ * and moves freely between lines. Hard snapping would turn the grid step into a few px when zoomed out,
14
+ * and the node would crawl in jumps.
15
+ * Мягкая привязка: значение притягивается к ближайшей линии сетки, только если оно ближе `threshold`,
16
+ * а между линиями двигается свободно. Жёсткая привязка при отдалении превращала бы шаг сетки в несколько px,
17
+ * и нода ползла бы скачками.
18
+ */
19
+ export declare function softSnap(value: number, grid?: number, threshold?: number): number;
20
+ /**
21
+ * Snap threshold in world units for a camera scale: `SNAP_PX` on screen, but no more than half a step.
22
+ * Порог привязки в мировых единицах для масштаба камеры: `SNAP_PX` на экране, но не больше половины шага.
23
+ */
24
+ export declare function snapThreshold(zoom: number, grid?: number): number;
package/dist/snap.js ADDED
@@ -0,0 +1,34 @@
1
+ //#region src/snap.ts
2
+ /**
3
+ * Grid step in world units: matches the fine grid on the canvas background.
4
+ * Шаг сетки в мировых единицах: совпадает с мелкой сеткой на фоне холста.
5
+ */
6
+ var GRID = 24;
7
+ /**
8
+ * How far from a grid line (screen px) a node is pulled to it.
9
+ * На каком расстоянии от линии сетки (экранные px) нода притягивается.
10
+ */
11
+ var SNAP_PX = 6;
12
+ /**
13
+ * Soft snapping: a value is pulled to the nearest grid line only if it is closer than `threshold`,
14
+ * and moves freely between lines. Hard snapping would turn the grid step into a few px when zoomed out,
15
+ * and the node would crawl in jumps.
16
+ * Мягкая привязка: значение притягивается к ближайшей линии сетки, только если оно ближе `threshold`,
17
+ * а между линиями двигается свободно. Жёсткая привязка при отдалении превращала бы шаг сетки в несколько px,
18
+ * и нода ползла бы скачками.
19
+ */
20
+ function softSnap(value, grid = 24, threshold = grid / 2) {
21
+ const nearest = Math.round(value / grid) * grid;
22
+ return Math.abs(value - nearest) <= threshold ? nearest : value;
23
+ }
24
+ /**
25
+ * Snap threshold in world units for a camera scale: `SNAP_PX` on screen, but no more than half a step.
26
+ * Порог привязки в мировых единицах для масштаба камеры: `SNAP_PX` на экране, но не больше половины шага.
27
+ */
28
+ function snapThreshold(zoom, grid = 24) {
29
+ return Math.min(6 / zoom, grid / 2);
30
+ }
31
+ //#endregion
32
+ export { GRID, SNAP_PX, snapThreshold, softSnap };
33
+
34
+ //# sourceMappingURL=snap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snap.js","names":[],"sources":["../src/snap.ts"],"sourcesContent":["/**\n * Grid step in world units: matches the fine grid on the canvas background.\n * Шаг сетки в мировых единицах: совпадает с мелкой сеткой на фоне холста.\n */\nexport const GRID = 24;\n/**\n * How far from a grid line (screen px) a node is pulled to it.\n * На каком расстоянии от линии сетки (экранные px) нода притягивается.\n */\nexport const SNAP_PX = 6;\n\n/**\n * Soft snapping: a value is pulled to the nearest grid line only if it is closer than `threshold`,\n * and moves freely between lines. Hard snapping would turn the grid step into a few px when zoomed out,\n * and the node would crawl in jumps.\n * Мягкая привязка: значение притягивается к ближайшей линии сетки, только если оно ближе `threshold`,\n * а между линиями двигается свободно. Жёсткая привязка при отдалении превращала бы шаг сетки в несколько px,\n * и нода ползла бы скачками.\n */\nexport function softSnap(value: number, grid = GRID, threshold = grid / 2): number {\n const nearest = Math.round(value / grid) * grid;\n return Math.abs(value - nearest) <= threshold ? nearest : value;\n}\n\n/**\n * Snap threshold in world units for a camera scale: `SNAP_PX` on screen, but no more than half a step.\n * Порог привязки в мировых единицах для масштаба камеры: `SNAP_PX` на экране, но не больше половины шага.\n */\nexport function snapThreshold(zoom: number, grid = GRID): number {\n return Math.min(SNAP_PX / zoom, grid / 2);\n}\n"],"mappings":";;;;;AAIA,IAAa,OAAO;;;;;AAKpB,IAAa,UAAU;;;;;;;;;AAUvB,SAAgB,SAAS,OAAe,OAAA,IAAa,YAAY,OAAO,GAAW;CAC/E,MAAM,UAAU,KAAK,MAAM,QAAQ,IAAI,IAAI;CAC3C,OAAO,KAAK,IAAI,QAAQ,OAAO,KAAK,YAAY,UAAU;AAC9D;;;;;AAMA,SAAgB,cAAc,MAAc,OAAA,IAAqB;CAC7D,OAAO,KAAK,IAAA,IAAc,MAAM,OAAO,CAAC;AAC5C"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Autosave to localStorage. Any operation may fail: private mode, a site-level ban, a full quota.
3
+ * So errors are swallowed and reported as a result, not thrown.
4
+ * Автосохранение в localStorage. Любая операция может не сработать: приватный режим,
5
+ * запрет сайта, переполнение квоты. Поэтому ошибки глушим и сообщаем результатом, а не исключением.
6
+ */
7
+ export interface SavedStorage {
8
+ read(): string | null;
9
+ write(text: string): boolean;
10
+ /**
11
+ * What was saved could not be read: the copy is set aside so autosave does not overwrite it.
12
+ * Сохранённое не удалось прочитать: откладываем копию, чтобы автосохранение её не затёрло.
13
+ */
14
+ backupBroken(text: string): void;
15
+ }
16
+ export declare function createSavedStorage(key: string): SavedStorage;
@@ -0,0 +1,30 @@
1
+ //#region src/storage.ts
2
+ function createSavedStorage(key) {
3
+ const brokenKey = `${key}.broken`;
4
+ return {
5
+ read() {
6
+ try {
7
+ return localStorage.getItem(key);
8
+ } catch {
9
+ return null;
10
+ }
11
+ },
12
+ write(text) {
13
+ try {
14
+ localStorage.setItem(key, text);
15
+ return true;
16
+ } catch {
17
+ return false;
18
+ }
19
+ },
20
+ backupBroken(text) {
21
+ try {
22
+ localStorage.setItem(brokenKey, text);
23
+ } catch {}
24
+ }
25
+ };
26
+ }
27
+ //#endregion
28
+ export { createSavedStorage };
29
+
30
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","names":[],"sources":["../src/storage.ts"],"sourcesContent":["/**\n * Autosave to localStorage. Any operation may fail: private mode, a site-level ban, a full quota.\n * So errors are swallowed and reported as a result, not thrown.\n * Автосохранение в localStorage. Любая операция может не сработать: приватный режим,\n * запрет сайта, переполнение квоты. Поэтому ошибки глушим и сообщаем результатом, а не исключением.\n */\nexport interface SavedStorage {\n read(): string | null;\n write(text: string): boolean;\n /**\n * What was saved could not be read: the copy is set aside so autosave does not overwrite it.\n * Сохранённое не удалось прочитать: откладываем копию, чтобы автосохранение её не затёрло.\n */\n backupBroken(text: string): void;\n}\n\nexport function createSavedStorage(key: string): SavedStorage {\n const brokenKey = `${key}.broken`;\n\n return {\n read() {\n try {\n return localStorage.getItem(key);\n } catch {\n return null;\n }\n },\n write(text) {\n try {\n localStorage.setItem(key, text);\n return true;\n } catch {\n return false;\n }\n },\n backupBroken(text) {\n try {\n localStorage.setItem(brokenKey, text);\n } catch {\n // nothing to do: there is no room\n // нечего делать: места нет\n }\n },\n };\n}\n"],"mappings":";AAgBA,SAAgB,mBAAmB,KAA2B;CAC1D,MAAM,YAAY,GAAG,IAAI;CAEzB,OAAO;EACH,OAAO;GACH,IAAI;IACA,OAAO,aAAa,QAAQ,GAAG;GACnC,QAAQ;IACJ,OAAO;GACX;EACJ;EACA,MAAM,MAAM;GACR,IAAI;IACA,aAAa,QAAQ,KAAK,IAAI;IAC9B,OAAO;GACX,QAAQ;IACJ,OAAO;GACX;EACJ;EACA,aAAa,MAAM;GACf,IAAI;IACA,aAAa,QAAQ,WAAW,IAAI;GACxC,QAAQ,CAGR;EACJ;CACJ;AACJ"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Whether the device has a coarse pointer (a finger): then touch buttons are shown in the toolbar.
3
+ * `any-pointer` is used so that a laptop with a touch screen gets them too, while the size of touch targets
4
+ * in CSS depends on the primary pointer (`pointer: coarse`).
5
+ * Есть ли у устройства грубый указатель (палец): тогда показываем сенсорные кнопки в тулбаре.
6
+ * Берём `any-pointer`, чтобы ноутбук с сенсорным экраном тоже получил их, а размеры целей касания
7
+ * в CSS зависят от основного указателя (`pointer: coarse`).
8
+ */
9
+ export declare const coarse: import("vue").Ref<boolean, boolean>;
package/dist/touch.js ADDED
@@ -0,0 +1,20 @@
1
+ import { ref } from "vue";
2
+ //#region src/touch.ts
3
+ /**
4
+ * Whether the device has a coarse pointer (a finger): then touch buttons are shown in the toolbar.
5
+ * `any-pointer` is used so that a laptop with a touch screen gets them too, while the size of touch targets
6
+ * in CSS depends on the primary pointer (`pointer: coarse`).
7
+ * Есть ли у устройства грубый указатель (палец): тогда показываем сенсорные кнопки в тулбаре.
8
+ * Берём `any-pointer`, чтобы ноутбук с сенсорным экраном тоже получил их, а размеры целей касания
9
+ * в CSS зависят от основного указателя (`pointer: coarse`).
10
+ */
11
+ var coarse = ref(false);
12
+ if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
13
+ const query = window.matchMedia("(any-pointer: coarse)");
14
+ coarse.value = query.matches;
15
+ query.addEventListener?.("change", (e) => coarse.value = e.matches);
16
+ }
17
+ //#endregion
18
+ export { coarse };
19
+
20
+ //# sourceMappingURL=touch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"touch.js","names":[],"sources":["../src/touch.ts"],"sourcesContent":["import { ref } from 'vue';\n\n/**\n * Whether the device has a coarse pointer (a finger): then touch buttons are shown in the toolbar.\n * `any-pointer` is used so that a laptop with a touch screen gets them too, while the size of touch targets\n * in CSS depends on the primary pointer (`pointer: coarse`).\n * Есть ли у устройства грубый указатель (палец): тогда показываем сенсорные кнопки в тулбаре.\n * Берём `any-pointer`, чтобы ноутбук с сенсорным экраном тоже получил их, а размеры целей касания\n * в CSS зависят от основного указателя (`pointer: coarse`).\n */\nexport const coarse = ref(false);\n\nif (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {\n const query = window.matchMedia('(any-pointer: coarse)');\n coarse.value = query.matches;\n query.addEventListener?.('change', (e) => (coarse.value = e.matches));\n}\n"],"mappings":";;;;;;;;;;AAUA,IAAa,SAAS,IAAI,KAAK;AAE/B,IAAI,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,YAAY;CAC1E,MAAM,QAAQ,OAAO,WAAW,uBAAuB;CACvD,OAAO,QAAQ,MAAM;CACrB,MAAM,mBAAmB,WAAW,MAAO,OAAO,QAAQ,EAAE,OAAQ;AACxE"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * What the mouse wheel or a two-finger trackpad scroll does. Like Figma and Miro:
3
+ * the wheel moves the canvas, zoom only with Ctrl (or Cmd). A trackpad pinch reaches the browser
4
+ * as a wheel event with Ctrl held, so it zooms too, while ordinary scrolling never zooms by accident.
5
+ * A pure function: it decides what to do, the caller moves the camera.
6
+ * Что делает колесо мыши или двухпальцевая прокрутка тачпада. Как в Figma и Miro:
7
+ * колесо двигает холст, а масштаб только с Ctrl (или Cmd). Щипок на тачпаде браузер присылает
8
+ * как колесо с зажатым Ctrl, так что он тоже масштабирует, а обычная прокрутка не масштабирует случайно.
9
+ * Чистая функция: что делать, решает она, а камеру двигает вызывающий.
10
+ */
11
+ export interface WheelLike {
12
+ deltaX: number;
13
+ deltaY: number;
14
+ /**
15
+ * 0 is pixels, 1 is lines, 2 is pages.
16
+ * 0 — пиксели, 1 — строки, 2 — страницы.
17
+ */
18
+ deltaMode: number;
19
+ ctrlKey: boolean;
20
+ metaKey: boolean;
21
+ shiftKey: boolean;
22
+ }
23
+ export type WheelIntent = {
24
+ kind: 'zoom';
25
+ factor: number;
26
+ } | {
27
+ kind: 'pan';
28
+ dx: number;
29
+ dy: number;
30
+ };
31
+ export declare function wheelIntent(e: WheelLike, pageSize: number): WheelIntent;
package/dist/wheel.js ADDED
@@ -0,0 +1,47 @@
1
+ //#region src/wheel.ts
2
+ /**
3
+ * Zoom per notch of the mouse wheel (deltaY ±100) and per trackpad pinch event (deltaY in small units).
4
+ * Масштаб на одну засечку колеса мыши (deltaY ±100) и на одно событие щипка тачпада (deltaY — единицы).
5
+ */
6
+ var ZOOM_SPEED_MOUSE = .0015;
7
+ var ZOOM_SPEED_PINCH = .01;
8
+ /**
9
+ * An event smaller than this counts as smooth (trackpad), a larger one as a mouse wheel notch.
10
+ * Событие мельче этого считаем плавным (тачпад), крупнее — засечкой колеса мыши.
11
+ */
12
+ var SMOOTH_DELTA_PX = 30;
13
+ var LINE_PX = 16;
14
+ /**
15
+ * Delta size in pixels: a mouse wheel may send lines and pages.
16
+ * Размер дельты в пикселях: колесо мыши может присылать строки и страницы.
17
+ */
18
+ function toPixels(delta, mode, pageSize) {
19
+ if (mode === 1) return delta * LINE_PX;
20
+ if (mode === 2) return delta * pageSize;
21
+ return delta;
22
+ }
23
+ function wheelIntent(e, pageSize) {
24
+ const dx = toPixels(e.deltaX, e.deltaMode, pageSize);
25
+ const dy = toPixels(e.deltaY, e.deltaMode, pageSize);
26
+ if (e.ctrlKey || e.metaKey) {
27
+ const speed = Math.abs(dy) < SMOOTH_DELTA_PX ? ZOOM_SPEED_PINCH : ZOOM_SPEED_MOUSE;
28
+ return {
29
+ kind: "zoom",
30
+ factor: Math.exp(-dy * speed)
31
+ };
32
+ }
33
+ if (e.shiftKey && dx === 0) return {
34
+ kind: "pan",
35
+ dx: -dy,
36
+ dy: 0
37
+ };
38
+ return {
39
+ kind: "pan",
40
+ dx: -dx,
41
+ dy: -dy
42
+ };
43
+ }
44
+ //#endregion
45
+ export { wheelIntent };
46
+
47
+ //# sourceMappingURL=wheel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wheel.js","names":[],"sources":["../src/wheel.ts"],"sourcesContent":["/**\n * What the mouse wheel or a two-finger trackpad scroll does. Like Figma and Miro:\n * the wheel moves the canvas, zoom only with Ctrl (or Cmd). A trackpad pinch reaches the browser\n * as a wheel event with Ctrl held, so it zooms too, while ordinary scrolling never zooms by accident.\n * A pure function: it decides what to do, the caller moves the camera.\n * Что делает колесо мыши или двухпальцевая прокрутка тачпада. Как в Figma и Miro:\n * колесо двигает холст, а масштаб только с Ctrl (или Cmd). Щипок на тачпаде браузер присылает\n * как колесо с зажатым Ctrl, так что он тоже масштабирует, а обычная прокрутка не масштабирует случайно.\n * Чистая функция: что делать, решает она, а камеру двигает вызывающий.\n */\n\nexport interface WheelLike {\n deltaX: number;\n deltaY: number;\n /**\n * 0 is pixels, 1 is lines, 2 is pages.\n * 0 — пиксели, 1 — строки, 2 — страницы.\n */\n deltaMode: number;\n ctrlKey: boolean;\n metaKey: boolean;\n shiftKey: boolean;\n}\n\nexport type WheelIntent = { kind: 'zoom'; factor: number } | { kind: 'pan'; dx: number; dy: number };\n\n/**\n * Zoom per notch of the mouse wheel (deltaY ±100) and per trackpad pinch event (deltaY in small units).\n * Масштаб на одну засечку колеса мыши (deltaY ±100) и на одно событие щипка тачпада (deltaY — единицы).\n */\nconst ZOOM_SPEED_MOUSE = 0.0015;\nconst ZOOM_SPEED_PINCH = 0.01;\n/**\n * An event smaller than this counts as smooth (trackpad), a larger one as a mouse wheel notch.\n * Событие мельче этого считаем плавным (тачпад), крупнее — засечкой колеса мыши.\n */\nconst SMOOTH_DELTA_PX = 30;\nconst LINE_PX = 16;\n\n/**\n * Delta size in pixels: a mouse wheel may send lines and pages.\n * Размер дельты в пикселях: колесо мыши может присылать строки и страницы.\n */\nfunction toPixels(delta: number, mode: number, pageSize: number): number {\n if (mode === 1) return delta * LINE_PX;\n if (mode === 2) return delta * pageSize;\n return delta;\n}\n\nexport function wheelIntent(e: WheelLike, pageSize: number): WheelIntent {\n const dx = toPixels(e.deltaX, e.deltaMode, pageSize);\n const dy = toPixels(e.deltaY, e.deltaMode, pageSize);\n\n if (e.ctrlKey || e.metaKey) {\n const speed = Math.abs(dy) < SMOOTH_DELTA_PX ? ZOOM_SPEED_PINCH : ZOOM_SPEED_MOUSE;\n return { kind: 'zoom', factor: Math.exp(-dy * speed) };\n }\n\n // Shift + wheel: horizontal (on some platforms the browser already turns this into deltaX).\n // Shift + колесо: по горизонтали (на части платформ браузер уже сам превращает это в deltaX).\n if (e.shiftKey && dx === 0) return { kind: 'pan', dx: -dy, dy: 0 };\n return { kind: 'pan', dx: -dx, dy: -dy };\n}\n"],"mappings":";;;;;AA8BA,IAAM,mBAAmB;AACzB,IAAM,mBAAmB;;;;;AAKzB,IAAM,kBAAkB;AACxB,IAAM,UAAU;;;;;AAMhB,SAAS,SAAS,OAAe,MAAc,UAA0B;CACrE,IAAI,SAAS,GAAG,OAAO,QAAQ;CAC/B,IAAI,SAAS,GAAG,OAAO,QAAQ;CAC/B,OAAO;AACX;AAEA,SAAgB,YAAY,GAAc,UAA+B;CACrE,MAAM,KAAK,SAAS,EAAE,QAAQ,EAAE,WAAW,QAAQ;CACnD,MAAM,KAAK,SAAS,EAAE,QAAQ,EAAE,WAAW,QAAQ;CAEnD,IAAI,EAAE,WAAW,EAAE,SAAS;EACxB,MAAM,QAAQ,KAAK,IAAI,EAAE,IAAI,kBAAkB,mBAAmB;EAClE,OAAO;GAAE,MAAM;GAAQ,QAAQ,KAAK,IAAI,CAAC,KAAK,KAAK;EAAE;CACzD;CAIA,IAAI,EAAE,YAAY,OAAO,GAAG,OAAO;EAAE,MAAM;EAAO,IAAI,CAAC;EAAI,IAAI;CAAE;CACjE,OAAO;EAAE,MAAM;EAAO,IAAI,CAAC;EAAI,IAAI,CAAC;CAAG;AAC3C"}