@mindexec/cli 0.2.478 → 0.2.480

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 (146) hide show
  1. package/README.md +323 -323
  2. package/codex-model-catalog.js +202 -202
  3. package/codex-runtime.js +1608 -1608
  4. package/desktop-workspace-state.cjs +120 -120
  5. package/electron/main.cjs +517 -517
  6. package/electron/preload.cjs +17 -17
  7. package/electron/recurring-update-owner-smoke.mjs +55 -55
  8. package/electron/recurring-update-owner.cjs +97 -97
  9. package/electron/source-smoke.mjs +108 -108
  10. package/electron/update-feed-resolver.cjs +79 -79
  11. package/electron/update-feed.json +10 -10
  12. package/electron/update-manager-smoke.mjs +146 -146
  13. package/electron/update-manager.cjs +297 -297
  14. package/electron/windows-package-smoke.mjs +156 -156
  15. package/launch-bridge.cjs +236 -236
  16. package/lzo1x.js +110 -110
  17. package/mode4-atlas-worker.js +440 -440
  18. package/mode4-atlas.js +130 -130
  19. package/package.json +1 -1
  20. package/port-guard.cjs +285 -285
  21. package/remote-fast/osx-arm64/MacScreenCaptureKitH264.swift +339 -339
  22. package/remote-fast/osx-arm64/MacSystemAudioCapture.swift +214 -214
  23. package/remote-fast/osx-arm64/UnixRawCaptureHelper.mjs +80 -80
  24. package/remote-fast/osx-arm64/livedesk-raw-capture-resampler.mjs +73 -73
  25. package/remote-fast/osx-arm64/mindexec-remote-fast.dll +0 -0
  26. package/remote-fast/osx-x64/MacScreenCaptureKitH264.swift +339 -339
  27. package/remote-fast/osx-x64/MacSystemAudioCapture.swift +214 -214
  28. package/remote-fast/osx-x64/UnixRawCaptureHelper.mjs +80 -80
  29. package/remote-fast/osx-x64/livedesk-raw-capture-resampler.mjs +73 -73
  30. package/remote-fast/osx-x64/mindexec-remote-fast.dll +0 -0
  31. package/remote-fast/win-x64/mindexec-remote-fast.dll +0 -0
  32. package/remote-hub.js +3698 -3698
  33. package/scripts/auth-session-smoke.mjs +262 -262
  34. package/scripts/board-render-ownership-smoke.mjs +85 -85
  35. package/scripts/codex-model-catalog-smoke.mjs +150 -150
  36. package/scripts/codex-runtime-home-smoke.mjs +58 -58
  37. package/scripts/codex-sdk-image-live-smoke.mjs +43 -43
  38. package/scripts/codex-sdk-image-runtime-smoke.mjs +122 -122
  39. package/scripts/codex-sdk-runtime-smoke.mjs +89 -89
  40. package/scripts/desktop-update-publisher-smoke.mjs +89 -89
  41. package/scripts/desktop-update-worker-smoke.mjs +72 -72
  42. package/scripts/desktop-workspace-state-smoke.mjs +81 -81
  43. package/scripts/drive-installed-update-smoke.mjs +67 -67
  44. package/scripts/npm-fresh-install-smoke.mjs +216 -216
  45. package/scripts/publish-mindexec-desktop-updates.mjs +224 -224
  46. package/scripts/remote-agent-managed-smoke.mjs +318 -318
  47. package/scripts/remote-agent-package-smoke.mjs +64 -64
  48. package/scripts/remote-agent-ws-smoke.mjs +269 -269
  49. package/scripts/remote-fast-live-rate-smoke.mjs +343 -343
  50. package/scripts/remote-fast-mdm-browser-smoke.mjs +453 -453
  51. package/scripts/remote-fleet-render-smoke.mjs +1350 -1350
  52. package/scripts/remote-frame-ws-smoke.mjs +234 -234
  53. package/scripts/remote-http-smoke.mjs +592 -592
  54. package/scripts/remote-hub-identity-smoke.mjs +146 -146
  55. package/scripts/remote-hub-scale-smoke.mjs +124 -124
  56. package/scripts/remote-hub-smoke.mjs +699 -699
  57. package/scripts/remote-input-ws-smoke.mjs +263 -263
  58. package/scripts/remote-registry-follower-smoke.mjs +815 -815
  59. package/scripts/setup-tree-sitter-grammars.mjs +59 -59
  60. package/server.js +7510 -7510
  61. package/start-bridge.bat +32 -32
  62. package/start-bridge.sh +81 -81
  63. package/tree-sitter-grammars/README.md +18 -0
  64. package/tree-sitter-grammars/tree-sitter-c_sharp.wasm +0 -0
  65. package/tree-sitter-grammars/tree-sitter-go.wasm +0 -0
  66. package/tree-sitter-grammars/tree-sitter-java.wasm +0 -0
  67. package/tree-sitter-grammars/tree-sitter-javascript.wasm +0 -0
  68. package/tree-sitter-grammars/tree-sitter-python.wasm +0 -0
  69. package/tree-sitter-grammars/tree-sitter-rust.wasm +0 -0
  70. package/tree-sitter-grammars/tree-sitter-tsx.wasm +0 -0
  71. package/tree-sitter-grammars/tree-sitter-typescript.wasm +0 -0
  72. package/wwwroot/_content/MindExecution.Plugins.Admin/css/admin-dashboard.css +546 -546
  73. package/wwwroot/_content/MindExecution.Plugins.Directory/background.png +0 -0
  74. package/wwwroot/_content/MindExecution.Plugins.YouTube/css/youtube-search.css +251 -251
  75. package/wwwroot/_content/MindExecution.Shared/css/mind-map-overrides.css +3789 -3789
  76. package/wwwroot/_content/MindExecution.Shared/fonts/NotoSansKR-Bold.ttf +0 -0
  77. package/wwwroot/_content/MindExecution.Shared/fonts/NotoSansKR-Regular.ttf +0 -0
  78. package/wwwroot/_content/MindExecution.Shared/js/agent-visualization.js +27 -27
  79. package/wwwroot/_content/MindExecution.Shared/js/background-themes.js +1449 -1449
  80. package/wwwroot/_content/MindExecution.Shared/js/code-master.js +8316 -8316
  81. package/wwwroot/_content/MindExecution.Shared/js/file-system-helper.js +338 -338
  82. package/wwwroot/_content/MindExecution.Shared/js/marked.min.js +69 -69
  83. package/wwwroot/_content/MindExecution.Shared/js/mind-map-animated-image-preview.js +270 -270
  84. package/wwwroot/_content/MindExecution.Shared/js/mind-map-automation-edge-motion.js +170 -170
  85. package/wwwroot/_content/MindExecution.Shared/js/mind-map-board-render-ownership.js +81 -81
  86. package/wwwroot/_content/MindExecution.Shared/js/mind-map-core.js +10528 -10506
  87. package/wwwroot/_content/MindExecution.Shared/js/mind-map-core.js.backup +1059 -0
  88. package/wwwroot/_content/MindExecution.Shared/js/mind-map-css3d-hotpath.js +902 -902
  89. package/wwwroot/_content/MindExecution.Shared/js/mind-map-css3d-manager.js +24637 -24637
  90. package/wwwroot/_content/MindExecution.Shared/js/mind-map-dev-guards.js +325 -325
  91. package/wwwroot/_content/MindExecution.Shared/js/mind-map-dnd.js +1491 -1491
  92. package/wwwroot/_content/MindExecution.Shared/js/mind-map-dnd.js.bak +434 -0
  93. package/wwwroot/_content/MindExecution.Shared/js/mind-map-glow-shader.js +70 -70
  94. package/wwwroot/_content/MindExecution.Shared/js/mind-map-image-policy.js +218 -218
  95. package/wwwroot/_content/MindExecution.Shared/js/mind-map-interactions.js +7081 -7087
  96. package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-plan-worker.js +160 -160
  97. package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-renderer.js +9960 -9958
  98. package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-video-placeholder.js +107 -107
  99. package/wwwroot/_content/MindExecution.Shared/js/mind-map-logic-workers.js +1004 -1004
  100. package/wwwroot/_content/MindExecution.Shared/js/mind-map-menu-manager.js +1351 -1351
  101. package/wwwroot/_content/MindExecution.Shared/js/mind-map-multi-select.js +865 -865
  102. package/wwwroot/_content/MindExecution.Shared/js/mind-map-node-search-worker.js +554 -554
  103. package/wwwroot/_content/MindExecution.Shared/js/mind-map-nodes.js +4771 -4744
  104. package/wwwroot/_content/MindExecution.Shared/js/mind-map-normal-boundary-optimizer.js +624 -624
  105. package/wwwroot/_content/MindExecution.Shared/js/mind-map-object-manager.js +241 -241
  106. package/wwwroot/_content/MindExecution.Shared/js/mind-map-object-manager.js.backup +372 -0
  107. package/wwwroot/_content/MindExecution.Shared/js/mind-map-pipeline.js +2290 -2290
  108. package/wwwroot/_content/MindExecution.Shared/js/mind-map-remote-codecs.js +202 -202
  109. package/wwwroot/_content/MindExecution.Shared/js/mind-map-render-plan.js +1971 -1971
  110. package/wwwroot/_content/MindExecution.Shared/js/mind-map-text-lod-system.js +93 -93
  111. package/wwwroot/_content/MindExecution.Shared/js/mind-map-texture-factory.js +2391 -2391
  112. package/wwwroot/_content/MindExecution.Shared/js/mind-map-texture-factory.js.backup +1258 -0
  113. package/wwwroot/_content/MindExecution.Shared/js/mind-map-video-playback-controls.js +95 -95
  114. package/wwwroot/_content/MindExecution.Shared/js/mind-map-visibility-worker.js +895 -895
  115. package/wwwroot/_content/MindExecution.Shared/js/mindmap-toolbar.js +636 -636
  116. package/wwwroot/_content/MindExecution.Shared/js/native-drop-handler.js +45 -45
  117. package/wwwroot/_content/MindExecution.Shared/js/plan-master.js +117 -117
  118. package/wwwroot/_content/MindExecution.Shared/js/renderers/CSS3DRenderer.js +114 -114
  119. package/wwwroot/_content/MindExecution.Shared/js/texture-worker-manager.js +10 -10
  120. package/wwwroot/_content/MindExecution.Shared/js/three.min.js +6 -6
  121. package/wwwroot/_content/MindExecution.Shared/js/token-manager.js +7 -7
  122. package/wwwroot/_content/MindExecution.Shared/js/troika-bundle.js +6 -6
  123. package/wwwroot/_content/MindExecution.Shared/js/troika-bundle.js.map +2 -2
  124. package/wwwroot/_content/MindExecution.Shared/lib/font-awesome/css/all.min.css +8 -8
  125. package/wwwroot/_content/MindExecution.Shared/models/vocab.txt +30522 -30522
  126. package/wwwroot/_framework/{Google.Protobuf.33g2gb5is0.dll → Google.Protobuf.9h59ukbel7.dll} +0 -0
  127. package/wwwroot/_framework/{MindExecution.Core.z100xo4mg0.dll → MindExecution.Core.gnj3fo0pr7.dll} +0 -0
  128. package/wwwroot/_framework/{MindExecution.Kernel.i9cldrx8yc.dll → MindExecution.Kernel.1qygzf8o02.dll} +0 -0
  129. package/wwwroot/_framework/{MindExecution.Plugins.Admin.48lzqddb0a.dll → MindExecution.Plugins.Admin.n3uxh144wo.dll} +0 -0
  130. package/wwwroot/_framework/{MindExecution.Plugins.Business.7m8u1q142p.dll → MindExecution.Plugins.Business.vl5dximn25.dll} +0 -0
  131. package/wwwroot/_framework/{MindExecution.Plugins.Concept.cl5wmr53od.dll → MindExecution.Plugins.Concept.rutru9qeoi.dll} +0 -0
  132. package/wwwroot/_framework/{MindExecution.Plugins.Directory.slipi39041.dll → MindExecution.Plugins.Directory.fqbmq85het.dll} +0 -0
  133. package/wwwroot/_framework/{MindExecution.Plugins.PlanMaster.qfge05l671.dll → MindExecution.Plugins.PlanMaster.ko11cc9pll.dll} +0 -0
  134. package/wwwroot/_framework/{MindExecution.Plugins.YouTube.tn7v29ut77.dll → MindExecution.Plugins.YouTube.mt39q0to2j.dll} +0 -0
  135. package/wwwroot/_framework/MindExecution.Shared.umgls362or.dll +0 -0
  136. package/wwwroot/_framework/{MindExecution.Web.rwawrxxk38.dll → MindExecution.Web.1dwoarj2hg.dll} +0 -0
  137. package/wwwroot/_framework/{System.Collections.23yxgetbju.dll → System.Collections.zyvbaq6mpd.dll} +0 -0
  138. package/wwwroot/_framework/blazor.boot.json +25 -25
  139. package/wwwroot/_headers +40 -40
  140. package/wwwroot/_redirects +1 -1
  141. package/wwwroot/index.html +772 -772
  142. package/wwwroot/js/marketing-tool.js +180 -180
  143. package/wwwroot/manifest.webmanifest +23 -23
  144. package/wwwroot/service-worker-assets.js +109 -81
  145. package/wwwroot/service-worker.js +33 -33
  146. package/wwwroot/_framework/MindExecution.Shared.rjqlf0umjn.dll +0 -0
@@ -0,0 +1,434 @@
1
+ // 파일 이름: mind-map-dnd.js
2
+ // MindMap 드래그 앤 드롭 처리 (플러그인 레지스트리 기반 + 브라우저 이미지 드래그 강화)
3
+ window.MindMapDnD = (function () {
4
+
5
+ if (!window.MindMapFileRegistry) {
6
+ window.MindMapFileRegistry = [];
7
+ }
8
+
9
+ function registerCoreHandlers() {
10
+ if (window.MindMapFileRegistry.some(h => h.name === 'CorePDF')) return;
11
+
12
+ window.MindMapFileRegistry.push({
13
+ name: 'CorePDF',
14
+ priority: 5,
15
+ check: (file) => file.type === 'application/pdf',
16
+ getType: () => 'pdf'
17
+ });
18
+ console.log('[MindMapDnD] Core file handlers registered');
19
+ }
20
+ registerCoreHandlers();
21
+
22
+ const eventHandlers = new WeakMap();
23
+ const GRID_SNAP = 10;
24
+
25
+ function getBoundHandlers(module) {
26
+ if (!eventHandlers.has(module)) {
27
+ eventHandlers.set(module, {
28
+ boundOnDragOver: onDragOver.bind(null, module),
29
+ boundOnDragLeave: onDragLeave.bind(null, module),
30
+ boundOnDrop: onDrop.bind(null, module)
31
+ });
32
+ }
33
+ return eventHandlers.get(module);
34
+ }
35
+
36
+ function onDragOver(module, e) {
37
+ e.preventDefault();
38
+ e.stopPropagation();
39
+ e.dataTransfer.dropEffect = 'copy';
40
+ return false;
41
+ }
42
+
43
+ async function handleBrowserImageDrop(module, e, imageUrl) {
44
+ const mouse = {
45
+ x: (e.clientX / module.container.clientWidth) * 2 - 1,
46
+ y: -(e.clientY / module.container.clientHeight) * 2 + 1
47
+ };
48
+ const vfov = (module.camera.fov * Math.PI) / 180;
49
+ const viewHeight = 2 * Math.tan(vfov / 2) * module.camera.position.z;
50
+ const viewWidth = viewHeight * module.camera.aspect;
51
+ const worldX = module.camera.position.x + (mouse.x * viewWidth) / 2;
52
+ const worldY = module.camera.position.y + (mouse.y * viewHeight) / 2;
53
+
54
+ const tempId = `temp_browser_${Date.now()}`;
55
+ const placeholderNode = {
56
+ TempId: tempId,
57
+ ContentType: 'image',
58
+ FileName: 'Web Image',
59
+ X: module.snapToGrid(worldX),
60
+ Y: module.snapToGrid(worldY),
61
+ Width: 300,
62
+ Height: 200,
63
+ IsLoading: true
64
+ };
65
+
66
+ try {
67
+ const actualNodeIdsMap = await module.dotNetHelper.invokeMethodAsync('AddFileNodesFromJs', [placeholderNode]);
68
+ const actualId = actualNodeIdsMap[tempId];
69
+ if (!actualId) return;
70
+
71
+ const finalUrl = await fetchImageAsBlobUrl(imageUrl);
72
+
73
+ const { width, height } = await new Promise((resolve) => {
74
+ const img = new Image();
75
+ img.crossOrigin = 'anonymous';
76
+ img.onload = () => {
77
+ const TARGET_WIDTH = 400;
78
+ const aspectRatio = (img.naturalHeight > 0 && img.naturalWidth > 0)
79
+ ? img.naturalHeight / img.naturalWidth
80
+ : 0.75;
81
+ const targetHeight = TARGET_WIDTH * aspectRatio;
82
+ resolve({
83
+ width: Math.round(TARGET_WIDTH / GRID_SNAP) * GRID_SNAP,
84
+ height: Math.round(targetHeight / GRID_SNAP) * GRID_SNAP
85
+ });
86
+ };
87
+ img.onerror = () => {
88
+ console.warn('[MindMapDnD] Failed to measure browser image size.');
89
+ resolve({ width: 300, height: 200 });
90
+ };
91
+ img.src = finalUrl;
92
+ });
93
+
94
+ await module.dotNetHelper.invokeMethodAsync('UpdateMultipleFileNodeDetails', [{
95
+ NodeId: actualId,
96
+ FileUrl: finalUrl,
97
+ Width: width,
98
+ Height: height
99
+ }]);
100
+
101
+ console.log('[MindMapDnD] Browser image dropped and processed successfully.');
102
+ } catch (err) {
103
+ console.error('[MindMapDnD] Failed to process browser image drop:', err);
104
+ }
105
+ }
106
+
107
+ function onDragLeave(module, e) {
108
+ e.preventDefault();
109
+ e.stopPropagation();
110
+ }
111
+
112
+ function extractImageUrl(dataTransfer) {
113
+ if (!dataTransfer) return null;
114
+ const html = dataTransfer.getData('text/html');
115
+ if (html) {
116
+ const parser = new DOMParser();
117
+ const doc = parser.parseFromString(html, 'text/html');
118
+ const img = doc.querySelector('img');
119
+ if (img && img.src) return img.src;
120
+ }
121
+ const uri = dataTransfer.getData('text/uri-list');
122
+ if (uri && /\.(jpg|jpeg|png|gif|webp)$/i.test(uri)) {
123
+ return uri;
124
+ }
125
+ return null;
126
+ }
127
+
128
+ async function fetchImageAsBlobUrl(url) {
129
+ try {
130
+ const response = await fetch(url, { mode: 'cors' });
131
+ if (!response.ok) throw new Error('Network response was not ok');
132
+ const blob = await response.blob();
133
+ return URL.createObjectURL(blob);
134
+ } catch (e) {
135
+ console.warn('[MindMapDnD] CORS fetch failed, using raw URL. (Canvas tainting may occur)', e);
136
+ return url;
137
+ }
138
+ }
139
+
140
+ async function onDrop(module, e) {
141
+ e.preventDefault();
142
+ e.stopPropagation();
143
+ if (!module.dotNetHelper) return false;
144
+
145
+ const dataTransfer = e.dataTransfer;
146
+ if (!dataTransfer) return false;
147
+
148
+ dataTransfer.dropEffect = 'copy';
149
+
150
+ // ▼▼▼ [프로파일링] 전체 프로세스 시간 측정 시작 ▼▼▼
151
+ console.time('[DnD] Total Drop Process');
152
+ // ▲▲▲ [프로파일링] ▲▲▲
153
+
154
+ const files = e.dataTransfer?.files ? Array.from(e.dataTransfer.files) : [];
155
+
156
+ if (files.length === 0) {
157
+ const imageUrl = extractImageUrl(e.dataTransfer);
158
+ if (imageUrl) {
159
+ console.log(`[MindMapDnD] Detected browser image drop: ${imageUrl}`);
160
+ await handleBrowserImageDrop(module, e, imageUrl);
161
+ return false;
162
+ }
163
+ }
164
+
165
+ // ▼▼▼ [수정] 레지스트리 기반 파일 필터링 ▼▼▼
166
+ const filesToProcess = [];
167
+
168
+ for (const file of files) {
169
+ let matchedType = null;
170
+
171
+ // 레지스트리 정렬 (priority 낮을수록 먼저)
172
+ const sortedRegistry = [...window.MindMapFileRegistry].sort((a, b) =>
173
+ (a.priority ?? 50) - (b.priority ?? 50)
174
+ );
175
+
176
+ // 등록된 핸들러들을 순회하며 매치되는 첫 번째 타입 사용
177
+ for (const handler of sortedRegistry) {
178
+ if (handler.check(file)) {
179
+ matchedType = handler.getType(file);
180
+ console.log(`[MindMapDnD] File '${file.name}' matched handler '${handler.name}' -> type: '${matchedType}'`);
181
+ break;
182
+ }
183
+ }
184
+
185
+ if (matchedType) {
186
+ filesToProcess.push({ file, type: matchedType });
187
+ } else {
188
+ console.warn(`[MindMapDnD] File '${file.name}' - no handler found, skipping`);
189
+ }
190
+ }
191
+
192
+ if (filesToProcess.length === 0) {
193
+ console.log('[MindMapDnD] No files matched any handler');
194
+ return false;
195
+ }
196
+ // ▲▲▲ [수정] ▲▲▲
197
+
198
+ // 드롭 위치의 월드 좌표 계산
199
+ const mouse = {
200
+ x: (e.clientX / module.container.clientWidth) * 2 - 1,
201
+ y: -(e.clientY / module.container.clientHeight) * 2 + 1
202
+ };
203
+ const vfov = (module.camera.fov * Math.PI) / 180;
204
+ const viewHeight = 2 * Math.tan(vfov / 2) * module.camera.position.z;
205
+ const viewWidth = viewHeight * module.camera.aspect;
206
+ const worldX = module.camera.position.x + (mouse.x * viewWidth) / 2;
207
+ const worldY = module.camera.position.y + (mouse.y * viewHeight) / 2;
208
+
209
+ // ▼▼▼ [수정] 플레이스홀더 생성 (타입별 크기) ▼▼▼
210
+ const placeholderNodes = filesToProcess.map(({ file, type }, index) => {
211
+ const tempId = `temp_${Date.now()}_${index}`;
212
+
213
+ // 타입별 기본 크기 설정
214
+ let nodeWidth, nodeHeight;
215
+ switch (type) {
216
+ case 'image':
217
+ nodeWidth = 300;
218
+ nodeHeight = 200;
219
+ break;
220
+ case 'pdf':
221
+ nodeWidth = 400;
222
+ nodeHeight = 56;
223
+ break;
224
+ case 'text':
225
+ nodeWidth = 500;
226
+ nodeHeight = 300;
227
+ break;
228
+ case 'directory':
229
+ nodeWidth = 400;
230
+ nodeHeight = 200;
231
+ break;
232
+ default:
233
+ nodeWidth = 400;
234
+ nodeHeight = 200;
235
+ }
236
+
237
+ return {
238
+ TempId: tempId,
239
+ ContentType: type,
240
+ FileName: file.name,
241
+ X: module.snapToGrid(worldX + index * 20),
242
+ Y: module.snapToGrid(worldY - index * 20),
243
+ Width: nodeWidth,
244
+ Height: nodeHeight,
245
+ IsLoading: true
246
+ };
247
+ });
248
+ // ▲▲▲ [수정] ▲▲▲
249
+
250
+ // ▼▼▼ [프로파일링] C# AddFileNodesFromJs 시간 측정 ▼▼▼
251
+ console.time('[DnD] 1. C# AddFileNodesFromJs');
252
+ // ▲▲▲ [프로파일링] ▲▲▲
253
+ const actualNodeIdsMap = await module.dotNetHelper.invokeMethodAsync('AddFileNodesFromJs', placeholderNodes);
254
+ // ▼▼▼ [프로파일링] ▼▼▼
255
+ console.timeEnd('[DnD] 1. C# AddFileNodesFromJs');
256
+ // ▲▲▲ [프로파일링] ▲▲▲
257
+
258
+ (async () => {
259
+ // ▼▼▼ [프로파일링] 병렬 파일 처리 시간 측정 ▼▼▼
260
+ console.time('[DnD] 2. Parallel File Processing (All)');
261
+ // ▲▲▲ [프로파일링] ▲▲▲
262
+
263
+ // ▼▼▼ [수정] 타입별 파일 처리 로직 ▼▼▼
264
+ const processingPromises = filesToProcess.map(async ({ file, type }, i) => {
265
+ const placeholder = placeholderNodes[i];
266
+ const actualId = actualNodeIdsMap[placeholder.TempId];
267
+ if (!actualId) return null;
268
+
269
+ const objectUrl = URL.createObjectURL(file);
270
+
271
+ switch (type) {
272
+ case 'image': {
273
+ console.time(`[DnD] 2a. Get Image Size - ${placeholder.FileName}`);
274
+ try {
275
+ const { width, height } = await new Promise((resolve, reject) => {
276
+ const img = new Image();
277
+ img.onload = () => {
278
+ const TARGET_WIDTH = 400;
279
+ const aspectRatio = (img.naturalHeight > 0 && img.naturalWidth > 0)
280
+ ? img.naturalHeight / img.naturalWidth
281
+ : 0.75;
282
+ const targetHeight = TARGET_WIDTH * aspectRatio;
283
+ resolve({
284
+ width: Math.round(TARGET_WIDTH / GRID_SNAP) * GRID_SNAP,
285
+ height: Math.round(targetHeight / GRID_SNAP) * GRID_SNAP
286
+ });
287
+ };
288
+ img.onerror = reject;
289
+ img.src = objectUrl;
290
+ });
291
+ console.timeEnd(`[DnD] 2a. Get Image Size - ${placeholder.FileName}`);
292
+ return {
293
+ NodeId: actualId,
294
+ FileUrl: objectUrl,
295
+ Width: width,
296
+ Height: height
297
+ };
298
+ } catch (err) {
299
+ console.timeEnd(`[DnD] 2a. Get Image Size - ${placeholder.FileName}`);
300
+ console.warn(`[DnD] Image load failed - ${placeholder.FileName}:`, err);
301
+ return {
302
+ NodeId: actualId,
303
+ FileUrl: '',
304
+ Width: 300,
305
+ Height: 200
306
+ };
307
+ }
308
+ }
309
+ case 'text': {
310
+ console.time(`[DnD] 2b. Read Text File - ${placeholder.FileName}`);
311
+ try {
312
+ // ▼▼▼ [디버깅] 파일 읽기 시작 ▼▼▼
313
+ console.log(`[DnD] Starting to read text file: ${placeholder.FileName}, actualId: ${actualId}`);
314
+ // ▲▲▲ [디버깅] ▲▲▲
315
+
316
+ const textContent = await file.text();
317
+
318
+ console.timeEnd(`[DnD] 2b. Read Text File - ${placeholder.FileName}`);
319
+
320
+ // ▼▼▼ [디버깅] 파일 읽기 성공 ▼▼▼
321
+ console.log(`[DnD] Successfully read ${textContent.length} chars from ${placeholder.FileName}`);
322
+ // ▲▲▲ [디버깅] ▲▲▲
323
+
324
+ // ▼▼▼ [디버깅] C# 메서드 호출 직전 ▼▼▼
325
+ console.log(`[DnD] About to call UpdateNodeContent with nodeId: ${actualId}, contentLength: ${textContent.length}`);
326
+ // ▲▲▲ [디버깅] ▲▲▲
327
+
328
+ // 텍스트는 별도로 업데이트 (URL 대신 내용 저장)
329
+ await module.dotNetHelper.invokeMethodAsync('UpdateNodeContent', actualId, textContent);
330
+
331
+ // ▼▼▼ [디버깅] C# 메서드 호출 성공 ▼▼▼
332
+ console.log(`[DnD] UpdateNodeContent completed for nodeId: ${actualId}`);
333
+ // ▲▲▲ [디버깅] ▲▲▲
334
+
335
+ // ▼▼▼ [핵심 수정] 화면 갱신 요청 추가 ▼▼▼
336
+ // 이 줄이 없어서 텍스처가 '로딩 중' 상태에서 멈춰 있었습니다.
337
+ if (window.mindMap) {
338
+ // 로컬 3D 뷰어에게 "이 노드 내용이 바뀌었으니 다시 그려라"고 명령
339
+ await window.mindMap.updateNodeContent(actualId, textContent);
340
+ console.log(`[DnD] Triggered local view update for node ${actualId}`);
341
+ }
342
+ // ▲▲▲ [핵심 수정] ▲▲▲
343
+
344
+ return null; // 배치 업데이트에서 제외
345
+ } catch (err) {
346
+ console.timeEnd(`[DnD] 2b. Read Text File - ${placeholder.FileName}`);
347
+ // ▼▼▼ [디버깅] 오류 상세 로그 ▼▼▼
348
+ console.error(`[DnD] Text processing FAILED for ${placeholder.FileName}:`, err);
349
+ console.error(`[DnD] Error Details:`, {
350
+ name: err.name,
351
+ message: err.message,
352
+ stack: err.stack
353
+ });
354
+ // ▲▲▲ [디버깅] ▲▲▲
355
+ return null;
356
+ }
357
+ }
358
+ case 'pdf':
359
+ default: {
360
+ return {
361
+ NodeId: actualId,
362
+ FileUrl: objectUrl,
363
+ Width: 400,
364
+ Height: 56
365
+ };
366
+ }
367
+ }
368
+ });
369
+ // ▲▲▲ [수정] ▲▲▲
370
+
371
+ const results = await Promise.allSettled(processingPromises);
372
+ // ▼▼▼ [프로파일링] ▼▼▼
373
+ console.timeEnd('[DnD] 2. Parallel File Processing (All)');
374
+ // ▲▲▲ [프로파일링] ▲▲▲
375
+
376
+ const successfulUpdates = results
377
+ .filter(res => res.status === 'fulfilled' && res.value !== null)
378
+ .map(res => res.value);
379
+
380
+ const failedCount = results.filter(res => res.status === 'rejected' || res.value === null).length;
381
+ console.log(`[MindMapDnD] File processing completed: ${successfulUpdates.length} succeeded, ${failedCount} failed.`);
382
+
383
+ if (successfulUpdates.length > 0) {
384
+ // ▼▼▼ [프로파일링] C# 일괄 업데이트 시간 측정 ▼▼▼
385
+ console.time('[DnD] 3. C# UpdateMultipleFileNodeDetails');
386
+ // ▲▲▲ [프로파일링] ▲▲▲
387
+ try {
388
+ await module.dotNetHelper.invokeMethodAsync('UpdateMultipleFileNodeDetails', successfulUpdates);
389
+ // ▼▼▼ [프로파일링] ▼▼▼
390
+ console.timeEnd('[DnD] 3. C# UpdateMultipleFileNodeDetails');
391
+ console.log(`[MindMapDnD] Batch update sent to C#: ${successfulUpdates.length} nodes.`);
392
+ // ▲▲▲ [프로파일링] ▲▲▲
393
+ } catch (error) {
394
+ // ▼▼▼ [프로파일링] ▼▼▼
395
+ console.timeEnd('[DnD] 3. C# UpdateMultipleFileNodeDetails');
396
+ // ▲▲▲ [프로파일링] ▲▲▲
397
+ console.error('[MindMapDnD] Batch update failed:', error);
398
+ }
399
+ }
400
+ })();
401
+
402
+ return false;
403
+ }
404
+
405
+ return {
406
+ addEventListeners: function (moduleInstance) {
407
+ const handlers = getBoundHandlers(moduleInstance);
408
+ if (moduleInstance.cssRenderer && moduleInstance.cssRenderer.domElement) {
409
+ moduleInstance.cssRenderer.domElement.addEventListener('dragover', handlers.boundOnDragOver);
410
+ moduleInstance.cssRenderer.domElement.addEventListener('dragleave', handlers.boundOnDragLeave);
411
+ moduleInstance.cssRenderer.domElement.addEventListener('drop', handlers.boundOnDrop);
412
+ } else if (moduleInstance.renderer && moduleInstance.renderer.domElement) {
413
+ moduleInstance.renderer.domElement.addEventListener('dragover', handlers.boundOnDragOver);
414
+ moduleInstance.renderer.domElement.addEventListener('dragleave', handlers.boundOnDragLeave);
415
+ moduleInstance.renderer.domElement.addEventListener('drop', handlers.boundOnDrop);
416
+ }
417
+ },
418
+ removeEventListeners: function (moduleInstance) {
419
+ const handlers = getBoundHandlers(moduleInstance);
420
+ if (moduleInstance.cssRenderer && moduleInstance.cssRenderer.domElement) {
421
+ moduleInstance.cssRenderer.domElement.removeEventListener('dragover', handlers.boundOnDragOver);
422
+ moduleInstance.cssRenderer.domElement.removeEventListener('dragleave', handlers.boundOnDragLeave);
423
+ moduleInstance.cssRenderer.domElement.removeEventListener('drop', handlers.boundOnDrop);
424
+ } else if (moduleInstance.renderer && moduleInstance.renderer.domElement) {
425
+ moduleInstance.renderer.domElement.removeEventListener('dragover', handlers.boundOnDragOver);
426
+ moduleInstance.renderer.domElement.removeEventListener('dragleave', handlers.boundOnDragLeave);
427
+ moduleInstance.renderer.domElement.removeEventListener('drop', handlers.boundOnDrop);
428
+ }
429
+ eventHandlers.delete(moduleInstance);
430
+ }
431
+ };
432
+ })();
433
+
434
+ console.log('✓ mind-map-dnd.js loaded (Registry-based, plugin-extensible).');
@@ -1,11 +1,11 @@
1
1
  // File: mind-map-glow-shader.js
2
2
  // [New] SDF-based glow shader - NO TEXTURES, pure GPU math
3
3
  // Memory usage: 0 MB (vs hundreds of MBs for per-node textures)
4
- (function () {
5
- 'use strict';
6
-
7
- // Shared across all glow materials to avoid per-node time uniform updates.
8
- const SHARED_TIME_UNIFORM = { value: 0.0 };
4
+ (function () {
5
+ 'use strict';
6
+
7
+ // Shared across all glow materials to avoid per-node time uniform updates.
8
+ const SHARED_TIME_UNIFORM = { value: 0.0 };
9
9
 
10
10
  // ▼▼▼ SDF Glow Shader (Aspect Ratio Corrected) ▼▼▼
11
11
  // Uses pixel-based coordinates for uniform glow thickness
@@ -68,40 +68,40 @@
68
68
  return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r;
69
69
  }
70
70
 
71
- void main() {
72
- vec2 p = (vUv - 0.5) * vScale;
73
- vec2 boxSize = (vScale * 0.5) - glowPadding;
74
- float dist = sdRoundedBox(p, boxSize, cornerRadius);
75
-
76
- // Keep glow organic, but modulate intensity instead of distorting the edge.
77
- float noiseFreq = 0.65;
78
- float noiseSpeed = 0.045;
79
- float rawNoise = snoise(vUv * noiseFreq + time * noiseSpeed);
80
- float noiseMod = 1.0 + (rawNoise * 0.08);
81
-
82
- float aa = max(fwidth(dist), 0.9);
83
- float outsideDist = max(dist, 0.0);
84
- float outerFade = 1.0 - smoothstep(0.0, glowPadding + aa * 2.0, outsideDist);
85
- float innerFade = smoothstep(-aa * 2.0, aa * 2.0, dist);
86
- float coreBoost = 1.0 - smoothstep(glowPadding * 0.22, glowPadding * 0.78, outsideDist);
87
-
88
- float alpha = outerFade * innerFade;
89
- alpha *= mix(0.62, 1.0, coreBoost);
90
- alpha *= noiseMod;
91
-
92
- // Corner glow naturally looks heavier; taper it a bit for a softer envelope.
93
- vec2 q = abs(p) - boxSize;
94
- float cornerAmount = 0.0;
95
- if (q.x > 0.0 && q.y > 0.0) {
96
- cornerAmount = smoothstep(0.0, glowPadding * 0.65, min(q.x, q.y));
97
- }
98
- float cornerFactor = 1.0 - cornerAmount * 0.35;
99
- alpha *= cornerFactor;
100
- alpha = clamp(alpha, 0.0, 1.0);
101
-
102
- gl_FragColor = vec4(color, alpha * opacity); // No inversion needed now
103
- }
104
- `;
71
+ void main() {
72
+ vec2 p = (vUv - 0.5) * vScale;
73
+ vec2 boxSize = (vScale * 0.5) - glowPadding;
74
+ float dist = sdRoundedBox(p, boxSize, cornerRadius);
75
+
76
+ // Keep glow organic, but modulate intensity instead of distorting the edge.
77
+ float noiseFreq = 0.65;
78
+ float noiseSpeed = 0.045;
79
+ float rawNoise = snoise(vUv * noiseFreq + time * noiseSpeed);
80
+ float noiseMod = 1.0 + (rawNoise * 0.08);
81
+
82
+ float aa = max(fwidth(dist), 0.9);
83
+ float outsideDist = max(dist, 0.0);
84
+ float outerFade = 1.0 - smoothstep(0.0, glowPadding + aa * 2.0, outsideDist);
85
+ float innerFade = smoothstep(-aa * 2.0, aa * 2.0, dist);
86
+ float coreBoost = 1.0 - smoothstep(glowPadding * 0.22, glowPadding * 0.78, outsideDist);
87
+
88
+ float alpha = outerFade * innerFade;
89
+ alpha *= mix(0.62, 1.0, coreBoost);
90
+ alpha *= noiseMod;
91
+
92
+ // Corner glow naturally looks heavier; taper it a bit for a softer envelope.
93
+ vec2 q = abs(p) - boxSize;
94
+ float cornerAmount = 0.0;
95
+ if (q.x > 0.0 && q.y > 0.0) {
96
+ cornerAmount = smoothstep(0.0, glowPadding * 0.65, min(q.x, q.y));
97
+ }
98
+ float cornerFactor = 1.0 - cornerAmount * 0.35;
99
+ alpha *= cornerFactor;
100
+ alpha = clamp(alpha, 0.0, 1.0);
101
+
102
+ gl_FragColor = vec4(color, alpha * opacity); // No inversion needed now
103
+ }
104
+ `;
105
105
 
106
106
  /**
107
107
  * Create SDF glow material with pixel-based uniforms
@@ -122,22 +122,22 @@
122
122
  ? new THREE.Color(config.color)
123
123
  : config.color;
124
124
 
125
- return new THREE.ShaderMaterial({
126
- transparent: true,
127
- depthWrite: false,
128
- depthTest: true,
129
- uniforms: {
125
+ return new THREE.ShaderMaterial({
126
+ transparent: true,
127
+ depthWrite: false,
128
+ depthTest: true,
129
+ uniforms: {
130
130
  color: { value: colorValue },
131
131
  opacity: { value: config.opacity },
132
- meshScale: { value: new THREE.Vector2(config.meshScale[0], config.meshScale[1]) },
133
- glowPadding: { value: config.glowPadding },
134
- cornerRadius: { value: config.cornerRadius },
135
- time: SHARED_TIME_UNIFORM // ★ Shared animation time uniform
136
- },
137
- vertexShader: GLOW_VERTEX_SHADER,
138
- fragmentShader: GLOW_FRAGMENT_SHADER
139
- });
140
- }
132
+ meshScale: { value: new THREE.Vector2(config.meshScale[0], config.meshScale[1]) },
133
+ glowPadding: { value: config.glowPadding },
134
+ cornerRadius: { value: config.cornerRadius },
135
+ time: SHARED_TIME_UNIFORM // ★ Shared animation time uniform
136
+ },
137
+ vertexShader: GLOW_VERTEX_SHADER,
138
+ fragmentShader: GLOW_FRAGMENT_SHADER
139
+ });
140
+ }
141
141
 
142
142
  /**
143
143
  * Create or update glow mesh using SDF shader (pixel-based)
@@ -234,27 +234,27 @@
234
234
  * @param {THREE.Mesh} glowMesh - Glow mesh to update
235
235
  * @param {number} time - Current time in seconds
236
236
  */
237
- function updateGlowTime(glowMesh, time) {
238
- setTime(time);
239
- }
240
-
241
- /**
242
- * Update shared time uniform for all glow meshes in O(1).
243
- * @param {number} time - Current time in seconds
244
- */
245
- function setTime(time) {
246
- SHARED_TIME_UNIFORM.value = time;
247
- }
237
+ function updateGlowTime(glowMesh, time) {
238
+ setTime(time);
239
+ }
240
+
241
+ /**
242
+ * Update shared time uniform for all glow meshes in O(1).
243
+ * @param {number} time - Current time in seconds
244
+ */
245
+ function setTime(time) {
246
+ SHARED_TIME_UNIFORM.value = time;
247
+ }
248
248
 
249
249
  // Expose API globally
250
250
  window.MindMapGlowShader = {
251
251
  createSDFGlowMaterial,
252
- createSDFGlowMesh,
253
- updateGlowSelection,
254
- updateGlowSize,
255
- updateGlowTime, // Backward compatibility
256
- setTime
257
- };
252
+ createSDFGlowMesh,
253
+ updateGlowSelection,
254
+ updateGlowSize,
255
+ updateGlowTime, // Backward compatibility
256
+ setTime
257
+ };
258
258
 
259
259
  console.log('✅ mind-map-glow-shader.js loaded (SDF Glow - No Textures!)');
260
260
  })();