@mindexec/cli 0.2.476 → 0.2.478
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/README.md +323 -323
- package/codex-model-catalog.js +202 -202
- package/codex-runtime.js +1608 -1608
- package/desktop-workspace-state.cjs +120 -120
- package/electron/main.cjs +517 -517
- package/electron/preload.cjs +17 -17
- package/electron/recurring-update-owner-smoke.mjs +55 -55
- package/electron/recurring-update-owner.cjs +97 -97
- package/electron/source-smoke.mjs +108 -108
- package/electron/update-feed-resolver.cjs +79 -79
- package/electron/update-feed.json +10 -10
- package/electron/update-manager-smoke.mjs +146 -146
- package/electron/update-manager.cjs +297 -297
- package/electron/windows-package-smoke.mjs +156 -156
- package/launch-bridge.cjs +236 -236
- package/lzo1x.js +110 -110
- package/mode4-atlas-worker.js +440 -440
- package/mode4-atlas.js +130 -130
- package/package.json +1 -1
- package/port-guard.cjs +285 -285
- package/remote-fast/osx-arm64/MacScreenCaptureKitH264.swift +339 -339
- package/remote-fast/osx-arm64/MacSystemAudioCapture.swift +214 -214
- package/remote-fast/osx-arm64/UnixRawCaptureHelper.mjs +80 -80
- package/remote-fast/osx-arm64/livedesk-raw-capture-resampler.mjs +73 -73
- package/remote-fast/osx-arm64/mindexec-remote-fast.dll +0 -0
- package/remote-fast/osx-x64/MacScreenCaptureKitH264.swift +339 -339
- package/remote-fast/osx-x64/MacSystemAudioCapture.swift +214 -214
- package/remote-fast/osx-x64/UnixRawCaptureHelper.mjs +80 -80
- package/remote-fast/osx-x64/livedesk-raw-capture-resampler.mjs +73 -73
- package/remote-fast/osx-x64/mindexec-remote-fast.dll +0 -0
- package/remote-fast/win-x64/mindexec-remote-fast.dll +0 -0
- package/remote-hub.js +3698 -3698
- package/scripts/auth-session-smoke.mjs +262 -262
- package/scripts/board-render-ownership-smoke.mjs +85 -85
- package/scripts/codex-model-catalog-smoke.mjs +150 -150
- package/scripts/codex-runtime-home-smoke.mjs +58 -58
- package/scripts/codex-sdk-image-live-smoke.mjs +43 -43
- package/scripts/codex-sdk-image-runtime-smoke.mjs +122 -122
- package/scripts/codex-sdk-runtime-smoke.mjs +89 -89
- package/scripts/desktop-update-publisher-smoke.mjs +89 -89
- package/scripts/desktop-update-worker-smoke.mjs +72 -72
- package/scripts/desktop-workspace-state-smoke.mjs +81 -81
- package/scripts/drive-installed-update-smoke.mjs +67 -67
- package/scripts/npm-fresh-install-smoke.mjs +216 -216
- package/scripts/publish-mindexec-desktop-updates.mjs +224 -224
- package/scripts/remote-agent-managed-smoke.mjs +318 -318
- package/scripts/remote-agent-package-smoke.mjs +64 -64
- package/scripts/remote-agent-ws-smoke.mjs +269 -269
- package/scripts/remote-fast-live-rate-smoke.mjs +343 -343
- package/scripts/remote-fast-mdm-browser-smoke.mjs +453 -453
- package/scripts/remote-fleet-render-smoke.mjs +1350 -1350
- package/scripts/remote-frame-ws-smoke.mjs +234 -234
- package/scripts/remote-http-smoke.mjs +592 -592
- package/scripts/remote-hub-identity-smoke.mjs +146 -146
- package/scripts/remote-hub-scale-smoke.mjs +124 -124
- package/scripts/remote-hub-smoke.mjs +699 -699
- package/scripts/remote-input-ws-smoke.mjs +263 -263
- package/scripts/remote-registry-follower-smoke.mjs +815 -815
- package/scripts/setup-tree-sitter-grammars.mjs +59 -59
- package/server.js +7690 -7690
- package/start-bridge.bat +32 -32
- package/start-bridge.sh +81 -81
- package/wwwroot/_content/MindExecution.Plugins.Admin/css/admin-dashboard.css +546 -546
- package/wwwroot/_content/MindExecution.Plugins.YouTube/css/youtube-search.css +251 -251
- package/wwwroot/_content/MindExecution.Shared/css/app.css +1 -1
- package/wwwroot/_content/MindExecution.Shared/css/mind-map-overrides.css +3789 -3789
- package/wwwroot/_content/MindExecution.Shared/js/agent-visualization.js +27 -27
- package/wwwroot/_content/MindExecution.Shared/js/background-themes.js +1449 -1449
- package/wwwroot/_content/MindExecution.Shared/js/code-master.js +8316 -8316
- package/wwwroot/_content/MindExecution.Shared/js/file-system-helper.js +338 -338
- package/wwwroot/_content/MindExecution.Shared/js/marked.min.js +69 -69
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-animated-image-preview.js +270 -270
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-automation-edge-motion.js +170 -170
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-board-render-ownership.js +81 -81
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-core.js +10506 -10517
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-css3d-hotpath.js +902 -902
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-css3d-manager.js +24637 -24637
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-dev-guards.js +325 -325
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-dnd.js +1491 -1491
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-glow-shader.js +70 -70
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-image-policy.js +218 -218
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-interactions.js +7065 -7065
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-plan-worker.js +160 -160
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-renderer.js +9956 -9956
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-video-placeholder.js +107 -107
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-logic-workers.js +1004 -1004
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-menu-manager.js +1351 -1351
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-multi-select.js +865 -865
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-node-search-worker.js +554 -554
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-nodes.js +4744 -4744
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-normal-boundary-optimizer.js +624 -624
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-object-manager.js +241 -241
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-pipeline.js +2290 -2290
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-remote-codecs.js +202 -202
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-render-plan.js +1971 -1971
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-text-lod-system.js +93 -93
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-texture-factory.js +2391 -2391
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-video-playback-controls.js +95 -95
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-visibility-worker.js +895 -895
- package/wwwroot/_content/MindExecution.Shared/js/mindmap-toolbar.js +636 -636
- package/wwwroot/_content/MindExecution.Shared/js/native-drop-handler.js +45 -45
- package/wwwroot/_content/MindExecution.Shared/js/plan-master.js +117 -117
- package/wwwroot/_content/MindExecution.Shared/js/renderers/CSS3DRenderer.js +114 -114
- package/wwwroot/_content/MindExecution.Shared/js/texture-worker-manager.js +10 -10
- package/wwwroot/_content/MindExecution.Shared/js/three.min.js +6 -6
- package/wwwroot/_content/MindExecution.Shared/js/token-manager.js +7 -7
- package/wwwroot/_content/MindExecution.Shared/js/troika-bundle.js +6 -6
- package/wwwroot/_content/MindExecution.Shared/js/troika-bundle.js.map +2 -2
- package/wwwroot/_content/MindExecution.Shared/lib/font-awesome/css/all.min.css +8 -8
- package/wwwroot/_content/MindExecution.Shared/models/vocab.txt +30522 -30522
- package/wwwroot/_framework/{Google.Protobuf.9h59ukbel7.dll → Google.Protobuf.33g2gb5is0.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Core.cx2pre7qz2.dll → MindExecution.Core.z100xo4mg0.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Kernel.engfih12kr.dll → MindExecution.Kernel.i9cldrx8yc.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.Admin.xfunemn9zi.dll → MindExecution.Plugins.Admin.48lzqddb0a.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.Business.ja94a5ze3i.dll → MindExecution.Plugins.Business.7m8u1q142p.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.Concept.3q05vzviqb.dll → MindExecution.Plugins.Concept.cl5wmr53od.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.Directory.re4jjs91d1.dll → MindExecution.Plugins.Directory.slipi39041.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.PlanMaster.89etwfquz1.dll → MindExecution.Plugins.PlanMaster.qfge05l671.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.YouTube.aqf4vztjji.dll → MindExecution.Plugins.YouTube.tn7v29ut77.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Shared.9b1rucdxvv.dll → MindExecution.Shared.rjqlf0umjn.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Web.ssp0n0xf1e.dll → MindExecution.Web.rwawrxxk38.dll} +0 -0
- package/wwwroot/_framework/blazor.boot.json +23 -23
- package/wwwroot/_headers +40 -40
- package/wwwroot/_redirects +1 -1
- package/wwwroot/index.html +772 -772
- package/wwwroot/js/marketing-tool.js +180 -180
- package/wwwroot/manifest.webmanifest +23 -23
- package/wwwroot/service-worker-assets.js +78 -106
- package/wwwroot/service-worker.js +33 -33
- package/tree-sitter-grammars/README.md +0 -18
- package/tree-sitter-grammars/tree-sitter-c_sharp.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-go.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-java.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-javascript.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-python.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-rust.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-tsx.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-typescript.wasm +0 -0
- package/wwwroot/_content/MindExecution.Plugins.Directory/background.png +0 -0
- package/wwwroot/_content/MindExecution.Shared/fonts/NotoSansKR-Bold.ttf +0 -0
- package/wwwroot/_content/MindExecution.Shared/fonts/NotoSansKR-Regular.ttf +0 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-core.js.backup +0 -1059
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-dnd.js.bak +0 -434
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-object-manager.js.backup +0 -372
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-texture-factory.js.backup +0 -1258
|
@@ -1,639 +1,639 @@
|
|
|
1
1
|
// MindMap Toolbar Helper Functions
|
|
2
|
-
(function () {
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
const dropdownOutsideCloseHandlers = new WeakMap();
|
|
6
|
-
const surfaceOutsideClickCloseStatesByHelper = new WeakMap();
|
|
7
|
-
const surfaceOutsideClickCloseStatesByRoot = new WeakMap();
|
|
8
|
-
let layoutDotNetHelper = null;
|
|
9
|
-
let fallbackReadModeActive = false;
|
|
10
|
-
let fullscreenEventsRegistered = false;
|
|
11
|
-
let visibilityEventsRegistered = false;
|
|
12
|
-
let surfaceInteractionEventsRegistered = false;
|
|
13
|
-
let documentHiddenAtUtc = null;
|
|
14
|
-
|
|
15
|
-
function supportsFullscreenApi() {
|
|
16
|
-
const root = document.documentElement;
|
|
17
|
-
return !!(
|
|
18
|
-
root?.requestFullscreen ||
|
|
19
|
-
root?.webkitRequestFullscreen ||
|
|
20
|
-
root?.msRequestFullscreen ||
|
|
21
|
-
document.exitFullscreen ||
|
|
22
|
-
document.webkitExitFullscreen ||
|
|
23
|
-
document.msExitFullscreen
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function getFullscreenElement() {
|
|
28
|
-
return document.fullscreenElement || document.webkitFullscreenElement || document.msFullscreenElement || null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function getCurrentReadModeState() {
|
|
32
|
-
return supportsFullscreenApi() ? !!getFullscreenElement() : fallbackReadModeActive === true;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function notifyLayoutFullscreenChanged(isActive) {
|
|
36
|
-
layoutDotNetHelper?.invokeMethodAsync?.('OnMindCanvasFullscreenChanged', isActive === true)
|
|
37
|
-
?.catch?.(() => { });
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function ensureFullscreenListeners() {
|
|
41
|
-
if (fullscreenEventsRegistered) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const handler = () => {
|
|
46
|
-
if (supportsFullscreenApi()) {
|
|
47
|
-
fallbackReadModeActive = false;
|
|
48
|
-
}
|
|
49
|
-
notifyLayoutFullscreenChanged(getCurrentReadModeState());
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
document.addEventListener('fullscreenchange', handler);
|
|
53
|
-
document.addEventListener('webkitfullscreenchange', handler);
|
|
54
|
-
document.addEventListener('MSFullscreenChange', handler);
|
|
55
|
-
fullscreenEventsRegistered = true;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function notifyLayoutDocumentVisibilityChanged() {
|
|
59
|
-
if (!layoutDotNetHelper?.invokeMethodAsync) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const isVisible = document.visibilityState !== 'hidden';
|
|
64
|
-
const nowUtc = new Date().toISOString();
|
|
65
|
-
if (!isVisible) {
|
|
66
|
-
documentHiddenAtUtc = nowUtc;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const eventAtUtc = isVisible ? (documentHiddenAtUtc || nowUtc) : documentHiddenAtUtc;
|
|
70
|
-
layoutDotNetHelper.invokeMethodAsync('OnDocumentVisibilityChanged', isVisible, eventAtUtc)
|
|
71
|
-
.catch(() => { });
|
|
72
|
-
|
|
73
|
-
if (isVisible) {
|
|
74
|
-
documentHiddenAtUtc = null;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function ensureDocumentVisibilityListeners() {
|
|
79
|
-
if (visibilityEventsRegistered) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
document.addEventListener('visibilitychange', notifyLayoutDocumentVisibilityChanged);
|
|
84
|
-
window.addEventListener('pageshow', notifyLayoutDocumentVisibilityChanged);
|
|
85
|
-
window.addEventListener('focus', () => {
|
|
86
|
-
if (document.visibilityState !== 'hidden') {
|
|
87
|
-
notifyLayoutDocumentVisibilityChanged();
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
visibilityEventsRegistered = true;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function notifyMindCanvasSurfaceInteraction(event) {
|
|
94
|
-
if (!layoutDotNetHelper?.invokeMethodAsync) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const reason = String(event?.detail?.reason || 'canvas-interaction');
|
|
99
|
-
layoutDotNetHelper.invokeMethodAsync('OnMindCanvasSurfaceInteraction', reason)
|
|
100
|
-
.catch(() => { });
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function ensureMindCanvasSurfaceInteractionListener() {
|
|
104
|
-
if (surfaceInteractionEventsRegistered) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
window.addEventListener('mindcanvas:surface-interaction', notifyMindCanvasSurfaceInteraction);
|
|
109
|
-
surfaceInteractionEventsRegistered = true;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function isEventInsideRoot(rootElement, event) {
|
|
113
|
-
if (!rootElement || !event) {
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const path = typeof event.composedPath === 'function'
|
|
118
|
-
? event.composedPath()
|
|
119
|
-
: null;
|
|
120
|
-
if (Array.isArray(path) && path.includes(rootElement)) {
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const target = event.target;
|
|
125
|
-
return !!target && rootElement.contains(target);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function isEventInsideIgnoredSelector(ignoreSelector, event) {
|
|
129
|
-
if (!ignoreSelector || !event) {
|
|
130
|
-
return false;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const path = typeof event.composedPath === 'function'
|
|
134
|
-
? event.composedPath()
|
|
135
|
-
: null;
|
|
136
|
-
if (Array.isArray(path)) {
|
|
137
|
-
for (const entry of path) {
|
|
138
|
-
if (entry && typeof entry.matches === 'function' && entry.matches(ignoreSelector)) {
|
|
139
|
-
return true;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const target = event.target;
|
|
145
|
-
return !!target && typeof target.closest === 'function' && !!target.closest(ignoreSelector);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function isNativeSelectEvent(event) {
|
|
149
|
-
if (!event) {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const path = typeof event.composedPath === 'function'
|
|
154
|
-
? event.composedPath()
|
|
155
|
-
: null;
|
|
156
|
-
if (Array.isArray(path)) {
|
|
157
|
-
for (const entry of path) {
|
|
158
|
-
const tagName = entry?.tagName;
|
|
159
|
-
if (tagName === 'SELECT' || tagName === 'OPTION' || tagName === 'OPTGROUP') {
|
|
160
|
-
return true;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const tagName = event.target?.tagName;
|
|
166
|
-
return tagName === 'SELECT' || tagName === 'OPTION' || tagName === 'OPTGROUP';
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function getInteractionTime() {
|
|
170
|
-
return typeof performance !== 'undefined' && typeof performance.now === 'function'
|
|
171
|
-
? performance.now()
|
|
172
|
-
: Date.now();
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function markNativeSelectInteraction(state) {
|
|
176
|
-
if (!state) {
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
state.nativeSelectInteractionActive = true;
|
|
181
|
-
state.nativeSelectInteractionAt = getInteractionTime();
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function isNativeSelectFocusedInside(rootElement) {
|
|
185
|
-
const activeElement = document.activeElement;
|
|
186
|
-
return !!rootElement &&
|
|
187
|
-
!!activeElement &&
|
|
188
|
-
rootElement.contains(activeElement) &&
|
|
189
|
-
activeElement.tagName === 'SELECT';
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function scheduleNativeSelectInteractionClear(state) {
|
|
193
|
-
if (!state) {
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
window.setTimeout(() => {
|
|
198
|
-
if (!isNativeSelectFocusedInside(state.rootElement)) {
|
|
199
|
-
state.nativeSelectInteractionActive = false;
|
|
200
|
-
}
|
|
201
|
-
}, 500);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function shouldIgnoreDocumentClickForNativeSelect(state) {
|
|
205
|
-
if (!state?.nativeSelectInteractionActive) {
|
|
206
|
-
return false;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (isNativeSelectFocusedInside(state.rootElement)) {
|
|
210
|
-
return true;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
return getInteractionTime() - state.nativeSelectInteractionAt < 350;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
function resolveSurfaceRootElement(rootElement, options) {
|
|
217
|
-
const selector = options?.rootSelector;
|
|
218
|
-
if (selector && typeof document.querySelector === 'function') {
|
|
219
|
-
const currentElement = document.querySelector(selector);
|
|
220
|
-
if (currentElement) {
|
|
221
|
-
return currentElement;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return rootElement;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
function isPointerWithinElementBounds(element, event) {
|
|
229
|
-
if (!element || !event) {
|
|
230
|
-
return false;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
const clientX = Number(event.clientX);
|
|
234
|
-
const clientY = Number(event.clientY);
|
|
235
|
-
if (!Number.isFinite(clientX) || !Number.isFinite(clientY)) {
|
|
236
|
-
return false;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
const rect = element.getBoundingClientRect?.();
|
|
240
|
-
if (!rect) {
|
|
241
|
-
return false;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
return clientX >= rect.left &&
|
|
245
|
-
clientX <= rect.right &&
|
|
246
|
-
clientY >= rect.top &&
|
|
247
|
-
clientY <= rect.bottom;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
function isSurfaceOwnedPointerEvent(state, rootElement, event) {
|
|
251
|
-
if (!state || !event) {
|
|
252
|
-
return false;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
return isEventInsideRoot(rootElement, event) ||
|
|
256
|
-
isPointerWithinElementBounds(rootElement, event) ||
|
|
257
|
-
isEventInsideIgnoredSelector(state.options?.ignoreSelector, event);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
function rememberSurfacePointerDown(state, event) {
|
|
261
|
-
if (!state || !event) {
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
const currentRootElement = resolveSurfaceRootElement(state.rootElement, state.options);
|
|
266
|
-
const isInsideSurface = isSurfaceOwnedPointerEvent(state, currentRootElement, event);
|
|
267
|
-
state.lastPointerDownInsideSurface = isInsideSurface;
|
|
268
|
-
state.lastPointerDownAt = getInteractionTime();
|
|
269
|
-
|
|
270
|
-
if (isInsideSurface) {
|
|
271
|
-
state.suppressNextDocumentClick = true;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
if (isNativeSelectEvent(event)) {
|
|
275
|
-
markNativeSelectInteraction(state);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
function getUploadDropPosition(viewport) {
|
|
280
|
-
const fallbackRect = viewport.getBoundingClientRect();
|
|
281
|
-
const fallbackPosition = {
|
|
282
|
-
clientX: fallbackRect.left + (fallbackRect.width / 2),
|
|
283
|
-
clientY: fallbackRect.top + (fallbackRect.height / 2)
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
const cursorPosition = window.mindMap?.getCursorClientPosition?.();
|
|
287
|
-
if (!cursorPosition || !Number.isFinite(cursorPosition.clientX) || !Number.isFinite(cursorPosition.clientY)) {
|
|
288
|
-
return fallbackPosition;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
return cursorPosition;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
// Simulate a file drop event at the current cursor position
|
|
295
|
-
window.triggerMindMapFileUpload = function (inputElementId) {
|
|
296
|
-
const input = document.getElementById(inputElementId);
|
|
297
|
-
if (!input || !input.files || input.files.length === 0) {
|
|
298
|
-
console.warn('[MindMapToolbar] No file selected');
|
|
299
|
-
return false;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
const files = Array.from(input.files);
|
|
303
|
-
const dataTransfer = new DataTransfer();
|
|
304
|
-
files.forEach((file) => dataTransfer.items.add(file));
|
|
305
|
-
|
|
306
|
-
const viewport = document.getElementById('mind-map-viewport');
|
|
307
|
-
if (!viewport) {
|
|
308
|
-
console.error('[MindMapToolbar] Viewport not found');
|
|
309
|
-
return false;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
try {
|
|
313
|
-
const { clientX, clientY } = getUploadDropPosition(viewport);
|
|
314
|
-
const mockEvent = new DragEvent('drop', {
|
|
315
|
-
bubbles: true,
|
|
316
|
-
cancelable: true,
|
|
317
|
-
dataTransfer: dataTransfer
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
Object.defineProperty(mockEvent, 'clientX', {
|
|
321
|
-
value: clientX,
|
|
322
|
-
writable: false
|
|
323
|
-
});
|
|
324
|
-
Object.defineProperty(mockEvent, 'clientY', {
|
|
325
|
-
value: clientY,
|
|
326
|
-
writable: false
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
viewport.dispatchEvent(mockEvent);
|
|
330
|
-
console.log('[MindMapToolbar] File drop event triggered for:', files.map((file) => file.name));
|
|
331
|
-
|
|
332
|
-
// Reset file input so selecting the same file(s) again still fires change.
|
|
333
|
-
input.value = '';
|
|
334
|
-
return true;
|
|
335
|
-
} catch (error) {
|
|
336
|
-
console.error('[MindMapToolbar] Error triggering file drop:', error);
|
|
337
|
-
return false;
|
|
338
|
-
}
|
|
339
|
-
};
|
|
2
|
+
(function () {
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
const dropdownOutsideCloseHandlers = new WeakMap();
|
|
6
|
+
const surfaceOutsideClickCloseStatesByHelper = new WeakMap();
|
|
7
|
+
const surfaceOutsideClickCloseStatesByRoot = new WeakMap();
|
|
8
|
+
let layoutDotNetHelper = null;
|
|
9
|
+
let fallbackReadModeActive = false;
|
|
10
|
+
let fullscreenEventsRegistered = false;
|
|
11
|
+
let visibilityEventsRegistered = false;
|
|
12
|
+
let surfaceInteractionEventsRegistered = false;
|
|
13
|
+
let documentHiddenAtUtc = null;
|
|
14
|
+
|
|
15
|
+
function supportsFullscreenApi() {
|
|
16
|
+
const root = document.documentElement;
|
|
17
|
+
return !!(
|
|
18
|
+
root?.requestFullscreen ||
|
|
19
|
+
root?.webkitRequestFullscreen ||
|
|
20
|
+
root?.msRequestFullscreen ||
|
|
21
|
+
document.exitFullscreen ||
|
|
22
|
+
document.webkitExitFullscreen ||
|
|
23
|
+
document.msExitFullscreen
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getFullscreenElement() {
|
|
28
|
+
return document.fullscreenElement || document.webkitFullscreenElement || document.msFullscreenElement || null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getCurrentReadModeState() {
|
|
32
|
+
return supportsFullscreenApi() ? !!getFullscreenElement() : fallbackReadModeActive === true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function notifyLayoutFullscreenChanged(isActive) {
|
|
36
|
+
layoutDotNetHelper?.invokeMethodAsync?.('OnMindCanvasFullscreenChanged', isActive === true)
|
|
37
|
+
?.catch?.(() => { });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function ensureFullscreenListeners() {
|
|
41
|
+
if (fullscreenEventsRegistered) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const handler = () => {
|
|
46
|
+
if (supportsFullscreenApi()) {
|
|
47
|
+
fallbackReadModeActive = false;
|
|
48
|
+
}
|
|
49
|
+
notifyLayoutFullscreenChanged(getCurrentReadModeState());
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
document.addEventListener('fullscreenchange', handler);
|
|
53
|
+
document.addEventListener('webkitfullscreenchange', handler);
|
|
54
|
+
document.addEventListener('MSFullscreenChange', handler);
|
|
55
|
+
fullscreenEventsRegistered = true;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function notifyLayoutDocumentVisibilityChanged() {
|
|
59
|
+
if (!layoutDotNetHelper?.invokeMethodAsync) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const isVisible = document.visibilityState !== 'hidden';
|
|
64
|
+
const nowUtc = new Date().toISOString();
|
|
65
|
+
if (!isVisible) {
|
|
66
|
+
documentHiddenAtUtc = nowUtc;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const eventAtUtc = isVisible ? (documentHiddenAtUtc || nowUtc) : documentHiddenAtUtc;
|
|
70
|
+
layoutDotNetHelper.invokeMethodAsync('OnDocumentVisibilityChanged', isVisible, eventAtUtc)
|
|
71
|
+
.catch(() => { });
|
|
72
|
+
|
|
73
|
+
if (isVisible) {
|
|
74
|
+
documentHiddenAtUtc = null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function ensureDocumentVisibilityListeners() {
|
|
79
|
+
if (visibilityEventsRegistered) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
document.addEventListener('visibilitychange', notifyLayoutDocumentVisibilityChanged);
|
|
84
|
+
window.addEventListener('pageshow', notifyLayoutDocumentVisibilityChanged);
|
|
85
|
+
window.addEventListener('focus', () => {
|
|
86
|
+
if (document.visibilityState !== 'hidden') {
|
|
87
|
+
notifyLayoutDocumentVisibilityChanged();
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
visibilityEventsRegistered = true;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function notifyMindCanvasSurfaceInteraction(event) {
|
|
94
|
+
if (!layoutDotNetHelper?.invokeMethodAsync) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const reason = String(event?.detail?.reason || 'canvas-interaction');
|
|
99
|
+
layoutDotNetHelper.invokeMethodAsync('OnMindCanvasSurfaceInteraction', reason)
|
|
100
|
+
.catch(() => { });
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function ensureMindCanvasSurfaceInteractionListener() {
|
|
104
|
+
if (surfaceInteractionEventsRegistered) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
window.addEventListener('mindcanvas:surface-interaction', notifyMindCanvasSurfaceInteraction);
|
|
109
|
+
surfaceInteractionEventsRegistered = true;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function isEventInsideRoot(rootElement, event) {
|
|
113
|
+
if (!rootElement || !event) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const path = typeof event.composedPath === 'function'
|
|
118
|
+
? event.composedPath()
|
|
119
|
+
: null;
|
|
120
|
+
if (Array.isArray(path) && path.includes(rootElement)) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const target = event.target;
|
|
125
|
+
return !!target && rootElement.contains(target);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function isEventInsideIgnoredSelector(ignoreSelector, event) {
|
|
129
|
+
if (!ignoreSelector || !event) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const path = typeof event.composedPath === 'function'
|
|
134
|
+
? event.composedPath()
|
|
135
|
+
: null;
|
|
136
|
+
if (Array.isArray(path)) {
|
|
137
|
+
for (const entry of path) {
|
|
138
|
+
if (entry && typeof entry.matches === 'function' && entry.matches(ignoreSelector)) {
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const target = event.target;
|
|
145
|
+
return !!target && typeof target.closest === 'function' && !!target.closest(ignoreSelector);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function isNativeSelectEvent(event) {
|
|
149
|
+
if (!event) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const path = typeof event.composedPath === 'function'
|
|
154
|
+
? event.composedPath()
|
|
155
|
+
: null;
|
|
156
|
+
if (Array.isArray(path)) {
|
|
157
|
+
for (const entry of path) {
|
|
158
|
+
const tagName = entry?.tagName;
|
|
159
|
+
if (tagName === 'SELECT' || tagName === 'OPTION' || tagName === 'OPTGROUP') {
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const tagName = event.target?.tagName;
|
|
166
|
+
return tagName === 'SELECT' || tagName === 'OPTION' || tagName === 'OPTGROUP';
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function getInteractionTime() {
|
|
170
|
+
return typeof performance !== 'undefined' && typeof performance.now === 'function'
|
|
171
|
+
? performance.now()
|
|
172
|
+
: Date.now();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function markNativeSelectInteraction(state) {
|
|
176
|
+
if (!state) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
state.nativeSelectInteractionActive = true;
|
|
181
|
+
state.nativeSelectInteractionAt = getInteractionTime();
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function isNativeSelectFocusedInside(rootElement) {
|
|
185
|
+
const activeElement = document.activeElement;
|
|
186
|
+
return !!rootElement &&
|
|
187
|
+
!!activeElement &&
|
|
188
|
+
rootElement.contains(activeElement) &&
|
|
189
|
+
activeElement.tagName === 'SELECT';
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function scheduleNativeSelectInteractionClear(state) {
|
|
193
|
+
if (!state) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
window.setTimeout(() => {
|
|
198
|
+
if (!isNativeSelectFocusedInside(state.rootElement)) {
|
|
199
|
+
state.nativeSelectInteractionActive = false;
|
|
200
|
+
}
|
|
201
|
+
}, 500);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function shouldIgnoreDocumentClickForNativeSelect(state) {
|
|
205
|
+
if (!state?.nativeSelectInteractionActive) {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (isNativeSelectFocusedInside(state.rootElement)) {
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return getInteractionTime() - state.nativeSelectInteractionAt < 350;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function resolveSurfaceRootElement(rootElement, options) {
|
|
217
|
+
const selector = options?.rootSelector;
|
|
218
|
+
if (selector && typeof document.querySelector === 'function') {
|
|
219
|
+
const currentElement = document.querySelector(selector);
|
|
220
|
+
if (currentElement) {
|
|
221
|
+
return currentElement;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return rootElement;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function isPointerWithinElementBounds(element, event) {
|
|
229
|
+
if (!element || !event) {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const clientX = Number(event.clientX);
|
|
234
|
+
const clientY = Number(event.clientY);
|
|
235
|
+
if (!Number.isFinite(clientX) || !Number.isFinite(clientY)) {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const rect = element.getBoundingClientRect?.();
|
|
240
|
+
if (!rect) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return clientX >= rect.left &&
|
|
245
|
+
clientX <= rect.right &&
|
|
246
|
+
clientY >= rect.top &&
|
|
247
|
+
clientY <= rect.bottom;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function isSurfaceOwnedPointerEvent(state, rootElement, event) {
|
|
251
|
+
if (!state || !event) {
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return isEventInsideRoot(rootElement, event) ||
|
|
256
|
+
isPointerWithinElementBounds(rootElement, event) ||
|
|
257
|
+
isEventInsideIgnoredSelector(state.options?.ignoreSelector, event);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function rememberSurfacePointerDown(state, event) {
|
|
261
|
+
if (!state || !event) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const currentRootElement = resolveSurfaceRootElement(state.rootElement, state.options);
|
|
266
|
+
const isInsideSurface = isSurfaceOwnedPointerEvent(state, currentRootElement, event);
|
|
267
|
+
state.lastPointerDownInsideSurface = isInsideSurface;
|
|
268
|
+
state.lastPointerDownAt = getInteractionTime();
|
|
269
|
+
|
|
270
|
+
if (isInsideSurface) {
|
|
271
|
+
state.suppressNextDocumentClick = true;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (isNativeSelectEvent(event)) {
|
|
275
|
+
markNativeSelectInteraction(state);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function getUploadDropPosition(viewport) {
|
|
280
|
+
const fallbackRect = viewport.getBoundingClientRect();
|
|
281
|
+
const fallbackPosition = {
|
|
282
|
+
clientX: fallbackRect.left + (fallbackRect.width / 2),
|
|
283
|
+
clientY: fallbackRect.top + (fallbackRect.height / 2)
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
const cursorPosition = window.mindMap?.getCursorClientPosition?.();
|
|
287
|
+
if (!cursorPosition || !Number.isFinite(cursorPosition.clientX) || !Number.isFinite(cursorPosition.clientY)) {
|
|
288
|
+
return fallbackPosition;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return cursorPosition;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// Simulate a file drop event at the current cursor position
|
|
295
|
+
window.triggerMindMapFileUpload = function (inputElementId) {
|
|
296
|
+
const input = document.getElementById(inputElementId);
|
|
297
|
+
if (!input || !input.files || input.files.length === 0) {
|
|
298
|
+
console.warn('[MindMapToolbar] No file selected');
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
const files = Array.from(input.files);
|
|
303
|
+
const dataTransfer = new DataTransfer();
|
|
304
|
+
files.forEach((file) => dataTransfer.items.add(file));
|
|
305
|
+
|
|
306
|
+
const viewport = document.getElementById('mind-map-viewport');
|
|
307
|
+
if (!viewport) {
|
|
308
|
+
console.error('[MindMapToolbar] Viewport not found');
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
try {
|
|
313
|
+
const { clientX, clientY } = getUploadDropPosition(viewport);
|
|
314
|
+
const mockEvent = new DragEvent('drop', {
|
|
315
|
+
bubbles: true,
|
|
316
|
+
cancelable: true,
|
|
317
|
+
dataTransfer: dataTransfer
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
Object.defineProperty(mockEvent, 'clientX', {
|
|
321
|
+
value: clientX,
|
|
322
|
+
writable: false
|
|
323
|
+
});
|
|
324
|
+
Object.defineProperty(mockEvent, 'clientY', {
|
|
325
|
+
value: clientY,
|
|
326
|
+
writable: false
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
viewport.dispatchEvent(mockEvent);
|
|
330
|
+
console.log('[MindMapToolbar] File drop event triggered for:', files.map((file) => file.name));
|
|
331
|
+
|
|
332
|
+
// Reset file input so selecting the same file(s) again still fires change.
|
|
333
|
+
input.value = '';
|
|
334
|
+
return true;
|
|
335
|
+
} catch (error) {
|
|
336
|
+
console.error('[MindMapToolbar] Error triggering file drop:', error);
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
340
|
|
|
341
341
|
// Focus on the global textarea
|
|
342
|
-
window.focusGlobalTextarea = function () {
|
|
343
|
-
const textarea = document.getElementById('global-input-textarea');
|
|
344
|
-
if (textarea) {
|
|
345
|
-
textarea.focus();
|
|
346
|
-
return true;
|
|
347
|
-
}
|
|
348
|
-
return false;
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
window.setMindMapPageScrollLock = function (active) {
|
|
352
|
-
const shouldLock = active === true;
|
|
353
|
-
const html = document.documentElement;
|
|
354
|
-
const body = document.body;
|
|
355
|
-
|
|
356
|
-
html?.classList.toggle('mind-map-scroll-locked', shouldLock);
|
|
357
|
-
body?.classList.toggle('mind-map-scroll-locked', shouldLock);
|
|
358
|
-
|
|
359
|
-
if (shouldLock) {
|
|
360
|
-
if (html) {
|
|
361
|
-
html.scrollTop = 0;
|
|
362
|
-
html.scrollLeft = 0;
|
|
363
|
-
}
|
|
364
|
-
if (body) {
|
|
365
|
-
body.scrollTop = 0;
|
|
366
|
-
body.scrollLeft = 0;
|
|
367
|
-
}
|
|
368
|
-
window.scrollTo(0, 0);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
return shouldLock;
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
window.initMindCanvasLayout = function (helper) {
|
|
375
|
-
layoutDotNetHelper = helper || null;
|
|
376
|
-
ensureFullscreenListeners();
|
|
377
|
-
ensureDocumentVisibilityListeners();
|
|
378
|
-
ensureMindCanvasSurfaceInteractionListener();
|
|
379
|
-
notifyLayoutFullscreenChanged(getCurrentReadModeState());
|
|
380
|
-
notifyLayoutDocumentVisibilityChanged();
|
|
381
|
-
return true;
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
window.getMindCanvasFullscreenState = function () {
|
|
385
|
-
return getCurrentReadModeState();
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
window.setMindCanvasFullscreen = async function (enabled) {
|
|
389
|
-
const shouldEnable = enabled === true;
|
|
390
|
-
const root = document.documentElement;
|
|
391
|
-
if (!root) {
|
|
392
|
-
return false;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
if (!supportsFullscreenApi()) {
|
|
396
|
-
fallbackReadModeActive = shouldEnable;
|
|
397
|
-
notifyLayoutFullscreenChanged(fallbackReadModeActive);
|
|
398
|
-
return fallbackReadModeActive;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
try {
|
|
402
|
-
if (shouldEnable) {
|
|
403
|
-
if (!getFullscreenElement()) {
|
|
404
|
-
if (root.requestFullscreen) {
|
|
405
|
-
await root.requestFullscreen();
|
|
406
|
-
} else if (root.webkitRequestFullscreen) {
|
|
407
|
-
await root.webkitRequestFullscreen();
|
|
408
|
-
} else if (root.msRequestFullscreen) {
|
|
409
|
-
await root.msRequestFullscreen();
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
} else if (getFullscreenElement()) {
|
|
413
|
-
if (document.exitFullscreen) {
|
|
414
|
-
await document.exitFullscreen();
|
|
415
|
-
} else if (document.webkitExitFullscreen) {
|
|
416
|
-
await document.webkitExitFullscreen();
|
|
417
|
-
} else if (document.msExitFullscreen) {
|
|
418
|
-
await document.msExitFullscreen();
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
} catch (error) {
|
|
422
|
-
console.warn('[MindMapToolbar] Fullscreen toggle failed, falling back to read-mode only:', error);
|
|
423
|
-
fallbackReadModeActive = shouldEnable;
|
|
424
|
-
notifyLayoutFullscreenChanged(fallbackReadModeActive);
|
|
425
|
-
return fallbackReadModeActive;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
fallbackReadModeActive = false;
|
|
429
|
-
const nextState = getCurrentReadModeState();
|
|
430
|
-
notifyLayoutFullscreenChanged(nextState);
|
|
431
|
-
return nextState;
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
window.toggleMindCanvasReadMode = function () {
|
|
435
|
-
return window.setMindCanvasFullscreen(!getCurrentReadModeState());
|
|
436
|
-
};
|
|
437
|
-
|
|
438
|
-
window.registerDropdownOutsideClose = function (rootElement, helper) {
|
|
439
|
-
if (!rootElement || !helper) {
|
|
440
|
-
return false;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
window.unregisterDropdownOutsideClose(rootElement);
|
|
444
|
-
|
|
445
|
-
const handler = (event) => {
|
|
446
|
-
const target = event.target;
|
|
447
|
-
if (!target || rootElement.contains(target)) {
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
helper.invokeMethodAsync('CloseFromOutsidePointer')
|
|
452
|
-
.catch(() => { });
|
|
453
|
-
};
|
|
454
|
-
|
|
455
|
-
document.addEventListener('pointerdown', handler, true);
|
|
456
|
-
dropdownOutsideCloseHandlers.set(rootElement, handler);
|
|
457
|
-
return true;
|
|
458
|
-
};
|
|
459
|
-
|
|
460
|
-
window.unregisterDropdownOutsideClose = function (rootElement) {
|
|
461
|
-
if (!rootElement) {
|
|
462
|
-
return false;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
const handler = dropdownOutsideCloseHandlers.get(rootElement);
|
|
466
|
-
if (!handler) {
|
|
467
|
-
return false;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
document.removeEventListener('pointerdown', handler, true);
|
|
471
|
-
dropdownOutsideCloseHandlers.delete(rootElement);
|
|
472
|
-
return true;
|
|
473
|
-
};
|
|
474
|
-
|
|
475
|
-
function detachSurfaceOutsideClickCloseState(state) {
|
|
476
|
-
if (!state) {
|
|
477
|
-
return false;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
if (state.rootElement && state.rootPointerDownHandler) {
|
|
481
|
-
state.rootElement.removeEventListener('pointerdown', state.rootPointerDownHandler, true);
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
if (state.rootElement && state.rootClickHandler) {
|
|
485
|
-
state.rootElement.removeEventListener('click', state.rootClickHandler, true);
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
if (state.rootElement && state.rootChangeHandler) {
|
|
489
|
-
state.rootElement.removeEventListener('change', state.rootChangeHandler, true);
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
if (state.rootElement && state.rootFocusOutHandler) {
|
|
493
|
-
state.rootElement.removeEventListener('focusout', state.rootFocusOutHandler, true);
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
if (state.documentClickHandler) {
|
|
497
|
-
document.removeEventListener('click', state.documentClickHandler, false);
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
if (state.documentPointerDownHandler) {
|
|
501
|
-
document.removeEventListener('pointerdown', state.documentPointerDownHandler, true);
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
if (state.helper) {
|
|
505
|
-
surfaceOutsideClickCloseStatesByHelper.delete(state.helper);
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
if (state.rootElement) {
|
|
509
|
-
surfaceOutsideClickCloseStatesByRoot.delete(state.rootElement);
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
return true;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
window.registerSurfaceOutsideClickClose = function (rootElement, helper, options) {
|
|
516
|
-
if (!rootElement || !helper) {
|
|
517
|
-
return false;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
detachSurfaceOutsideClickCloseState(surfaceOutsideClickCloseStatesByHelper.get(helper));
|
|
521
|
-
detachSurfaceOutsideClickCloseState(surfaceOutsideClickCloseStatesByRoot.get(rootElement));
|
|
522
|
-
|
|
523
|
-
const state = {
|
|
524
|
-
helper,
|
|
525
|
-
options,
|
|
526
|
-
rootElement,
|
|
527
|
-
suppressNextDocumentClick: false,
|
|
528
|
-
nativeSelectInteractionActive: false,
|
|
529
|
-
nativeSelectInteractionAt: 0,
|
|
530
|
-
lastPointerDownInsideSurface: false,
|
|
531
|
-
lastPointerDownAt: 0,
|
|
532
|
-
rootPointerDownHandler: null,
|
|
533
|
-
rootClickHandler: null,
|
|
534
|
-
rootChangeHandler: null,
|
|
535
|
-
rootFocusOutHandler: null,
|
|
536
|
-
documentPointerDownHandler: null,
|
|
537
|
-
documentClickHandler: null
|
|
538
|
-
};
|
|
539
|
-
|
|
540
|
-
state.rootPointerDownHandler = (event) => {
|
|
541
|
-
state.suppressNextDocumentClick = true;
|
|
542
|
-
if (isNativeSelectEvent(event)) {
|
|
543
|
-
markNativeSelectInteraction(state);
|
|
544
|
-
}
|
|
545
|
-
};
|
|
546
|
-
|
|
547
|
-
state.rootClickHandler = (event) => {
|
|
548
|
-
state.suppressNextDocumentClick = true;
|
|
549
|
-
if (isNativeSelectEvent(event)) {
|
|
550
|
-
markNativeSelectInteraction(state);
|
|
551
|
-
}
|
|
552
|
-
};
|
|
553
|
-
|
|
554
|
-
state.rootChangeHandler = (event) => {
|
|
555
|
-
if (isNativeSelectEvent(event)) {
|
|
556
|
-
state.suppressNextDocumentClick = true;
|
|
557
|
-
markNativeSelectInteraction(state);
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
|
|
561
|
-
state.rootFocusOutHandler = () => {
|
|
562
|
-
scheduleNativeSelectInteractionClear(state);
|
|
563
|
-
};
|
|
564
|
-
|
|
565
|
-
state.documentPointerDownHandler = (event) => {
|
|
566
|
-
rememberSurfacePointerDown(state, event);
|
|
567
|
-
};
|
|
568
|
-
|
|
569
|
-
state.documentClickHandler = (event) => {
|
|
570
|
-
if (typeof event.button === 'number' && event.button !== 0) {
|
|
571
|
-
return;
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
if (state.suppressNextDocumentClick) {
|
|
575
|
-
state.suppressNextDocumentClick = false;
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
const currentRootElement = resolveSurfaceRootElement(state.rootElement, state.options);
|
|
580
|
-
if (currentRootElement && currentRootElement !== state.rootElement) {
|
|
581
|
-
state.rootElement.removeEventListener('pointerdown', state.rootPointerDownHandler, true);
|
|
582
|
-
state.rootElement.removeEventListener('click', state.rootClickHandler, true);
|
|
583
|
-
state.rootElement.removeEventListener('change', state.rootChangeHandler, true);
|
|
584
|
-
state.rootElement.removeEventListener('focusout', state.rootFocusOutHandler, true);
|
|
585
|
-
surfaceOutsideClickCloseStatesByRoot.delete(state.rootElement);
|
|
586
|
-
state.rootElement = currentRootElement;
|
|
587
|
-
surfaceOutsideClickCloseStatesByRoot.set(state.rootElement, state);
|
|
588
|
-
state.rootElement.addEventListener('pointerdown', state.rootPointerDownHandler, true);
|
|
589
|
-
state.rootElement.addEventListener('click', state.rootClickHandler, true);
|
|
590
|
-
state.rootElement.addEventListener('change', state.rootChangeHandler, true);
|
|
591
|
-
state.rootElement.addEventListener('focusout', state.rootFocusOutHandler, true);
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
if (shouldIgnoreDocumentClickForNativeSelect(state)) {
|
|
595
|
-
return;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
if (state.lastPointerDownInsideSurface === true && getInteractionTime() - state.lastPointerDownAt < 1000) {
|
|
599
|
-
return;
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
if (isEventInsideRoot(currentRootElement, event)) {
|
|
603
|
-
return;
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
if (isPointerWithinElementBounds(currentRootElement, event)) {
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
if (isEventInsideIgnoredSelector(state.options?.ignoreSelector, event)) {
|
|
611
|
-
return;
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
state.helper.invokeMethodAsync('CloseFromOutsidePointer')
|
|
615
|
-
.catch(() => { });
|
|
616
|
-
};
|
|
617
|
-
|
|
618
|
-
state.rootElement.addEventListener('pointerdown', state.rootPointerDownHandler, true);
|
|
619
|
-
state.rootElement.addEventListener('click', state.rootClickHandler, true);
|
|
620
|
-
state.rootElement.addEventListener('change', state.rootChangeHandler, true);
|
|
621
|
-
state.rootElement.addEventListener('focusout', state.rootFocusOutHandler, true);
|
|
622
|
-
document.addEventListener('pointerdown', state.documentPointerDownHandler, true);
|
|
623
|
-
document.addEventListener('click', state.documentClickHandler, false);
|
|
624
|
-
|
|
625
|
-
surfaceOutsideClickCloseStatesByHelper.set(helper, state);
|
|
626
|
-
surfaceOutsideClickCloseStatesByRoot.set(rootElement, state);
|
|
627
|
-
return true;
|
|
628
|
-
};
|
|
629
|
-
|
|
630
|
-
window.unregisterSurfaceOutsideClickClose = function (rootElement) {
|
|
631
|
-
if (!rootElement) {
|
|
632
|
-
return false;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
return detachSurfaceOutsideClickCloseState(surfaceOutsideClickCloseStatesByRoot.get(rootElement));
|
|
636
|
-
};
|
|
637
|
-
|
|
638
|
-
console.log('? mindmap-toolbar.js loaded');
|
|
639
|
-
})();
|
|
342
|
+
window.focusGlobalTextarea = function () {
|
|
343
|
+
const textarea = document.getElementById('global-input-textarea');
|
|
344
|
+
if (textarea) {
|
|
345
|
+
textarea.focus();
|
|
346
|
+
return true;
|
|
347
|
+
}
|
|
348
|
+
return false;
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
window.setMindMapPageScrollLock = function (active) {
|
|
352
|
+
const shouldLock = active === true;
|
|
353
|
+
const html = document.documentElement;
|
|
354
|
+
const body = document.body;
|
|
355
|
+
|
|
356
|
+
html?.classList.toggle('mind-map-scroll-locked', shouldLock);
|
|
357
|
+
body?.classList.toggle('mind-map-scroll-locked', shouldLock);
|
|
358
|
+
|
|
359
|
+
if (shouldLock) {
|
|
360
|
+
if (html) {
|
|
361
|
+
html.scrollTop = 0;
|
|
362
|
+
html.scrollLeft = 0;
|
|
363
|
+
}
|
|
364
|
+
if (body) {
|
|
365
|
+
body.scrollTop = 0;
|
|
366
|
+
body.scrollLeft = 0;
|
|
367
|
+
}
|
|
368
|
+
window.scrollTo(0, 0);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
return shouldLock;
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
window.initMindCanvasLayout = function (helper) {
|
|
375
|
+
layoutDotNetHelper = helper || null;
|
|
376
|
+
ensureFullscreenListeners();
|
|
377
|
+
ensureDocumentVisibilityListeners();
|
|
378
|
+
ensureMindCanvasSurfaceInteractionListener();
|
|
379
|
+
notifyLayoutFullscreenChanged(getCurrentReadModeState());
|
|
380
|
+
notifyLayoutDocumentVisibilityChanged();
|
|
381
|
+
return true;
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
window.getMindCanvasFullscreenState = function () {
|
|
385
|
+
return getCurrentReadModeState();
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
window.setMindCanvasFullscreen = async function (enabled) {
|
|
389
|
+
const shouldEnable = enabled === true;
|
|
390
|
+
const root = document.documentElement;
|
|
391
|
+
if (!root) {
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
if (!supportsFullscreenApi()) {
|
|
396
|
+
fallbackReadModeActive = shouldEnable;
|
|
397
|
+
notifyLayoutFullscreenChanged(fallbackReadModeActive);
|
|
398
|
+
return fallbackReadModeActive;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
try {
|
|
402
|
+
if (shouldEnable) {
|
|
403
|
+
if (!getFullscreenElement()) {
|
|
404
|
+
if (root.requestFullscreen) {
|
|
405
|
+
await root.requestFullscreen();
|
|
406
|
+
} else if (root.webkitRequestFullscreen) {
|
|
407
|
+
await root.webkitRequestFullscreen();
|
|
408
|
+
} else if (root.msRequestFullscreen) {
|
|
409
|
+
await root.msRequestFullscreen();
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
} else if (getFullscreenElement()) {
|
|
413
|
+
if (document.exitFullscreen) {
|
|
414
|
+
await document.exitFullscreen();
|
|
415
|
+
} else if (document.webkitExitFullscreen) {
|
|
416
|
+
await document.webkitExitFullscreen();
|
|
417
|
+
} else if (document.msExitFullscreen) {
|
|
418
|
+
await document.msExitFullscreen();
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
} catch (error) {
|
|
422
|
+
console.warn('[MindMapToolbar] Fullscreen toggle failed, falling back to read-mode only:', error);
|
|
423
|
+
fallbackReadModeActive = shouldEnable;
|
|
424
|
+
notifyLayoutFullscreenChanged(fallbackReadModeActive);
|
|
425
|
+
return fallbackReadModeActive;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
fallbackReadModeActive = false;
|
|
429
|
+
const nextState = getCurrentReadModeState();
|
|
430
|
+
notifyLayoutFullscreenChanged(nextState);
|
|
431
|
+
return nextState;
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
window.toggleMindCanvasReadMode = function () {
|
|
435
|
+
return window.setMindCanvasFullscreen(!getCurrentReadModeState());
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
window.registerDropdownOutsideClose = function (rootElement, helper) {
|
|
439
|
+
if (!rootElement || !helper) {
|
|
440
|
+
return false;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
window.unregisterDropdownOutsideClose(rootElement);
|
|
444
|
+
|
|
445
|
+
const handler = (event) => {
|
|
446
|
+
const target = event.target;
|
|
447
|
+
if (!target || rootElement.contains(target)) {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
helper.invokeMethodAsync('CloseFromOutsidePointer')
|
|
452
|
+
.catch(() => { });
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
document.addEventListener('pointerdown', handler, true);
|
|
456
|
+
dropdownOutsideCloseHandlers.set(rootElement, handler);
|
|
457
|
+
return true;
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
window.unregisterDropdownOutsideClose = function (rootElement) {
|
|
461
|
+
if (!rootElement) {
|
|
462
|
+
return false;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
const handler = dropdownOutsideCloseHandlers.get(rootElement);
|
|
466
|
+
if (!handler) {
|
|
467
|
+
return false;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
document.removeEventListener('pointerdown', handler, true);
|
|
471
|
+
dropdownOutsideCloseHandlers.delete(rootElement);
|
|
472
|
+
return true;
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
function detachSurfaceOutsideClickCloseState(state) {
|
|
476
|
+
if (!state) {
|
|
477
|
+
return false;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
if (state.rootElement && state.rootPointerDownHandler) {
|
|
481
|
+
state.rootElement.removeEventListener('pointerdown', state.rootPointerDownHandler, true);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
if (state.rootElement && state.rootClickHandler) {
|
|
485
|
+
state.rootElement.removeEventListener('click', state.rootClickHandler, true);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
if (state.rootElement && state.rootChangeHandler) {
|
|
489
|
+
state.rootElement.removeEventListener('change', state.rootChangeHandler, true);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
if (state.rootElement && state.rootFocusOutHandler) {
|
|
493
|
+
state.rootElement.removeEventListener('focusout', state.rootFocusOutHandler, true);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
if (state.documentClickHandler) {
|
|
497
|
+
document.removeEventListener('click', state.documentClickHandler, false);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
if (state.documentPointerDownHandler) {
|
|
501
|
+
document.removeEventListener('pointerdown', state.documentPointerDownHandler, true);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
if (state.helper) {
|
|
505
|
+
surfaceOutsideClickCloseStatesByHelper.delete(state.helper);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
if (state.rootElement) {
|
|
509
|
+
surfaceOutsideClickCloseStatesByRoot.delete(state.rootElement);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
return true;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
window.registerSurfaceOutsideClickClose = function (rootElement, helper, options) {
|
|
516
|
+
if (!rootElement || !helper) {
|
|
517
|
+
return false;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
detachSurfaceOutsideClickCloseState(surfaceOutsideClickCloseStatesByHelper.get(helper));
|
|
521
|
+
detachSurfaceOutsideClickCloseState(surfaceOutsideClickCloseStatesByRoot.get(rootElement));
|
|
522
|
+
|
|
523
|
+
const state = {
|
|
524
|
+
helper,
|
|
525
|
+
options,
|
|
526
|
+
rootElement,
|
|
527
|
+
suppressNextDocumentClick: false,
|
|
528
|
+
nativeSelectInteractionActive: false,
|
|
529
|
+
nativeSelectInteractionAt: 0,
|
|
530
|
+
lastPointerDownInsideSurface: false,
|
|
531
|
+
lastPointerDownAt: 0,
|
|
532
|
+
rootPointerDownHandler: null,
|
|
533
|
+
rootClickHandler: null,
|
|
534
|
+
rootChangeHandler: null,
|
|
535
|
+
rootFocusOutHandler: null,
|
|
536
|
+
documentPointerDownHandler: null,
|
|
537
|
+
documentClickHandler: null
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
state.rootPointerDownHandler = (event) => {
|
|
541
|
+
state.suppressNextDocumentClick = true;
|
|
542
|
+
if (isNativeSelectEvent(event)) {
|
|
543
|
+
markNativeSelectInteraction(state);
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
state.rootClickHandler = (event) => {
|
|
548
|
+
state.suppressNextDocumentClick = true;
|
|
549
|
+
if (isNativeSelectEvent(event)) {
|
|
550
|
+
markNativeSelectInteraction(state);
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
state.rootChangeHandler = (event) => {
|
|
555
|
+
if (isNativeSelectEvent(event)) {
|
|
556
|
+
state.suppressNextDocumentClick = true;
|
|
557
|
+
markNativeSelectInteraction(state);
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
state.rootFocusOutHandler = () => {
|
|
562
|
+
scheduleNativeSelectInteractionClear(state);
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
state.documentPointerDownHandler = (event) => {
|
|
566
|
+
rememberSurfacePointerDown(state, event);
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
state.documentClickHandler = (event) => {
|
|
570
|
+
if (typeof event.button === 'number' && event.button !== 0) {
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
if (state.suppressNextDocumentClick) {
|
|
575
|
+
state.suppressNextDocumentClick = false;
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
const currentRootElement = resolveSurfaceRootElement(state.rootElement, state.options);
|
|
580
|
+
if (currentRootElement && currentRootElement !== state.rootElement) {
|
|
581
|
+
state.rootElement.removeEventListener('pointerdown', state.rootPointerDownHandler, true);
|
|
582
|
+
state.rootElement.removeEventListener('click', state.rootClickHandler, true);
|
|
583
|
+
state.rootElement.removeEventListener('change', state.rootChangeHandler, true);
|
|
584
|
+
state.rootElement.removeEventListener('focusout', state.rootFocusOutHandler, true);
|
|
585
|
+
surfaceOutsideClickCloseStatesByRoot.delete(state.rootElement);
|
|
586
|
+
state.rootElement = currentRootElement;
|
|
587
|
+
surfaceOutsideClickCloseStatesByRoot.set(state.rootElement, state);
|
|
588
|
+
state.rootElement.addEventListener('pointerdown', state.rootPointerDownHandler, true);
|
|
589
|
+
state.rootElement.addEventListener('click', state.rootClickHandler, true);
|
|
590
|
+
state.rootElement.addEventListener('change', state.rootChangeHandler, true);
|
|
591
|
+
state.rootElement.addEventListener('focusout', state.rootFocusOutHandler, true);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
if (shouldIgnoreDocumentClickForNativeSelect(state)) {
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
if (state.lastPointerDownInsideSurface === true && getInteractionTime() - state.lastPointerDownAt < 1000) {
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
if (isEventInsideRoot(currentRootElement, event)) {
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
if (isPointerWithinElementBounds(currentRootElement, event)) {
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
if (isEventInsideIgnoredSelector(state.options?.ignoreSelector, event)) {
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
state.helper.invokeMethodAsync('CloseFromOutsidePointer')
|
|
615
|
+
.catch(() => { });
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
state.rootElement.addEventListener('pointerdown', state.rootPointerDownHandler, true);
|
|
619
|
+
state.rootElement.addEventListener('click', state.rootClickHandler, true);
|
|
620
|
+
state.rootElement.addEventListener('change', state.rootChangeHandler, true);
|
|
621
|
+
state.rootElement.addEventListener('focusout', state.rootFocusOutHandler, true);
|
|
622
|
+
document.addEventListener('pointerdown', state.documentPointerDownHandler, true);
|
|
623
|
+
document.addEventListener('click', state.documentClickHandler, false);
|
|
624
|
+
|
|
625
|
+
surfaceOutsideClickCloseStatesByHelper.set(helper, state);
|
|
626
|
+
surfaceOutsideClickCloseStatesByRoot.set(rootElement, state);
|
|
627
|
+
return true;
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
window.unregisterSurfaceOutsideClickClose = function (rootElement) {
|
|
631
|
+
if (!rootElement) {
|
|
632
|
+
return false;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
return detachSurfaceOutsideClickCloseState(surfaceOutsideClickCloseStatesByRoot.get(rootElement));
|
|
636
|
+
};
|
|
637
|
+
|
|
638
|
+
console.log('? mindmap-toolbar.js loaded');
|
|
639
|
+
})();
|