@mlightcad/cad-simple-viewer 1.2.4 → 1.3.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 (287) hide show
  1. package/dist/index.js +13000 -10094
  2. package/dist/index.umd.cjs +327 -24
  3. package/dist/libredwg-parser-worker.js +7267 -7238
  4. package/dist/mtext-renderer-worker.js +81 -41
  5. package/lib/app/AcApContext.js +1 -1
  6. package/lib/app/AcApContext.js.map +1 -1
  7. package/lib/app/AcApDocManager.d.ts +20 -3
  8. package/lib/app/AcApDocManager.d.ts.map +1 -1
  9. package/lib/app/AcApDocManager.js +67 -12
  10. package/lib/app/AcApDocManager.js.map +1 -1
  11. package/lib/app/AcApProgress.d.ts +133 -0
  12. package/lib/app/AcApProgress.d.ts.map +1 -0
  13. package/lib/app/AcApProgress.js +148 -0
  14. package/lib/app/AcApProgress.js.map +1 -0
  15. package/lib/app/AcApSettingManager.d.ts +42 -0
  16. package/lib/app/AcApSettingManager.d.ts.map +1 -1
  17. package/lib/app/AcApSettingManager.js +63 -0
  18. package/lib/app/AcApSettingManager.js.map +1 -1
  19. package/lib/app/index.d.ts +0 -1
  20. package/lib/app/index.d.ts.map +1 -1
  21. package/lib/app/index.js +0 -1
  22. package/lib/app/index.js.map +1 -1
  23. package/lib/command/AcApCircleCmd.d.ts +21 -0
  24. package/lib/command/AcApCircleCmd.d.ts.map +1 -0
  25. package/lib/command/AcApCircleCmd.js +115 -0
  26. package/lib/command/AcApCircleCmd.js.map +1 -0
  27. package/lib/command/AcApDimCmd.d.ts +57 -0
  28. package/lib/command/AcApDimCmd.d.ts.map +1 -0
  29. package/lib/command/AcApDimCmd.js +228 -0
  30. package/lib/command/AcApDimCmd.js.map +1 -0
  31. package/lib/command/AcApLogCmd.d.ts +13 -0
  32. package/lib/command/AcApLogCmd.d.ts.map +1 -0
  33. package/lib/command/AcApLogCmd.js +97 -0
  34. package/lib/command/AcApLogCmd.js.map +1 -0
  35. package/lib/command/AcApSysVarCmd.d.ts +15 -0
  36. package/lib/command/AcApSysVarCmd.d.ts.map +1 -0
  37. package/lib/command/AcApSysVarCmd.js +94 -0
  38. package/lib/command/AcApSysVarCmd.js.map +1 -0
  39. package/lib/command/AcApZoomCmd.js +1 -1
  40. package/lib/command/AcApZoomCmd.js.map +1 -1
  41. package/lib/command/AcApZoomToBoxCmd.d.ts +0 -36
  42. package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -1
  43. package/lib/command/AcApZoomToBoxCmd.js +4 -61
  44. package/lib/command/AcApZoomToBoxCmd.js.map +1 -1
  45. package/lib/command/index.d.ts +4 -0
  46. package/lib/command/index.d.ts.map +1 -1
  47. package/lib/command/index.js +4 -0
  48. package/lib/command/index.js.map +1 -1
  49. package/lib/editor/command/AcEdCommandStack.d.ts +19 -1
  50. package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -1
  51. package/lib/editor/command/AcEdCommandStack.js +40 -0
  52. package/lib/editor/command/AcEdCommandStack.js.map +1 -1
  53. package/lib/editor/input/AcEdCursorManager.d.ts +14 -30
  54. package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -1
  55. package/lib/editor/input/AcEdCursorManager.js +32 -31
  56. package/lib/editor/input/AcEdCursorManager.js.map +1 -1
  57. package/lib/editor/input/AcEdPreviewJig.d.ts +103 -0
  58. package/lib/editor/input/AcEdPreviewJig.d.ts.map +1 -0
  59. package/lib/editor/input/AcEdPreviewJig.js +82 -0
  60. package/lib/editor/input/AcEdPreviewJig.js.map +1 -0
  61. package/lib/editor/input/AcEditor.d.ts +58 -11
  62. package/lib/editor/input/AcEditor.d.ts.map +1 -1
  63. package/lib/editor/input/AcEditor.js +86 -22
  64. package/lib/editor/input/AcEditor.js.map +1 -1
  65. package/lib/editor/input/handler/AcEdAngleHandler.d.ts +12 -0
  66. package/lib/editor/input/handler/AcEdAngleHandler.d.ts.map +1 -0
  67. package/lib/editor/input/handler/AcEdAngleHandler.js +25 -0
  68. package/lib/editor/input/handler/AcEdAngleHandler.js.map +1 -0
  69. package/lib/editor/input/handler/AcEdDistanceHandler.d.ts +8 -0
  70. package/lib/editor/input/handler/AcEdDistanceHandler.d.ts.map +1 -0
  71. package/lib/editor/input/handler/AcEdDistanceHandler.js +29 -0
  72. package/lib/editor/input/handler/AcEdDistanceHandler.js.map +1 -0
  73. package/lib/editor/input/handler/AcEdDoubleHandler.d.ts +7 -0
  74. package/lib/editor/input/handler/AcEdDoubleHandler.d.ts.map +1 -0
  75. package/lib/editor/input/handler/AcEdDoubleHandler.js +28 -0
  76. package/lib/editor/input/handler/AcEdDoubleHandler.js.map +1 -0
  77. package/lib/editor/input/handler/AcEdInputHandler.d.ts +14 -0
  78. package/lib/editor/input/handler/AcEdInputHandler.d.ts.map +1 -0
  79. package/lib/editor/input/handler/AcEdInputHandler.js +2 -0
  80. package/lib/editor/input/handler/AcEdInputHandler.js.map +1 -0
  81. package/lib/editor/input/handler/AcEdIntegerHandler.d.ts +11 -0
  82. package/lib/editor/input/handler/AcEdIntegerHandler.d.ts.map +1 -0
  83. package/lib/editor/input/handler/AcEdIntegerHandler.js +44 -0
  84. package/lib/editor/input/handler/AcEdIntegerHandler.js.map +1 -0
  85. package/lib/editor/input/handler/AcEdNumericalHandler.d.ts +11 -0
  86. package/lib/editor/input/handler/AcEdNumericalHandler.d.ts.map +1 -0
  87. package/lib/editor/input/handler/AcEdNumericalHandler.js +24 -0
  88. package/lib/editor/input/handler/AcEdNumericalHandler.js.map +1 -0
  89. package/lib/editor/input/handler/AcEdPointHandler.d.ts +16 -0
  90. package/lib/editor/input/handler/AcEdPointHandler.d.ts.map +1 -0
  91. package/lib/editor/input/handler/AcEdPointHandler.js +19 -0
  92. package/lib/editor/input/handler/AcEdPointHandler.js.map +1 -0
  93. package/lib/editor/input/handler/AcEdStringHandler.d.ts +12 -0
  94. package/lib/editor/input/handler/AcEdStringHandler.d.ts.map +1 -0
  95. package/lib/editor/input/handler/AcEdStringHandler.js +24 -0
  96. package/lib/editor/input/handler/AcEdStringHandler.js.map +1 -0
  97. package/lib/editor/input/handler/index.d.ts +9 -0
  98. package/lib/editor/input/handler/index.d.ts.map +1 -0
  99. package/lib/editor/input/handler/index.js +9 -0
  100. package/lib/editor/input/handler/index.js.map +1 -0
  101. package/lib/editor/input/index.d.ts +4 -1
  102. package/lib/editor/input/index.d.ts.map +1 -1
  103. package/lib/editor/input/index.js +4 -1
  104. package/lib/editor/input/index.js.map +1 -1
  105. package/lib/editor/input/marker/AcEdMarker.d.ts +72 -0
  106. package/lib/editor/input/marker/AcEdMarker.d.ts.map +1 -0
  107. package/lib/editor/input/marker/AcEdMarker.js +124 -0
  108. package/lib/editor/input/marker/AcEdMarker.js.map +1 -0
  109. package/lib/editor/input/marker/AcEdOSnapMarkerManager.d.ts +52 -0
  110. package/lib/editor/input/marker/AcEdOSnapMarkerManager.d.ts.map +1 -0
  111. package/lib/editor/input/marker/AcEdOSnapMarkerManager.js +91 -0
  112. package/lib/editor/input/marker/AcEdOSnapMarkerManager.js.map +1 -0
  113. package/lib/editor/input/marker/index.d.ts +3 -0
  114. package/lib/editor/input/marker/index.d.ts.map +1 -0
  115. package/lib/editor/input/marker/index.js +3 -0
  116. package/lib/editor/input/marker/index.js.map +1 -0
  117. package/lib/editor/input/prompt/AcEdKeyword.d.ts +63 -0
  118. package/lib/editor/input/prompt/AcEdKeyword.d.ts.map +1 -0
  119. package/lib/editor/input/prompt/AcEdKeyword.js +120 -0
  120. package/lib/editor/input/prompt/AcEdKeyword.js.map +1 -0
  121. package/lib/editor/input/prompt/AcEdKeywordCollection.d.ts +52 -0
  122. package/lib/editor/input/prompt/AcEdKeywordCollection.d.ts.map +1 -0
  123. package/lib/editor/input/prompt/AcEdKeywordCollection.js +103 -0
  124. package/lib/editor/input/prompt/AcEdKeywordCollection.js.map +1 -0
  125. package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts +75 -0
  126. package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts.map +1 -0
  127. package/lib/editor/input/prompt/AcEdPromptAngleOptions.js +182 -0
  128. package/lib/editor/input/prompt/AcEdPromptAngleOptions.js.map +1 -0
  129. package/lib/editor/input/prompt/AcEdPromptDistanceOptions.d.ts +46 -0
  130. package/lib/editor/input/prompt/AcEdPromptDistanceOptions.d.ts.map +1 -0
  131. package/lib/editor/input/prompt/AcEdPromptDistanceOptions.js +114 -0
  132. package/lib/editor/input/prompt/AcEdPromptDistanceOptions.js.map +1 -0
  133. package/lib/editor/input/prompt/AcEdPromptDoubleOptions.d.ts +10 -0
  134. package/lib/editor/input/prompt/AcEdPromptDoubleOptions.d.ts.map +1 -0
  135. package/lib/editor/input/prompt/AcEdPromptDoubleOptions.js +31 -0
  136. package/lib/editor/input/prompt/AcEdPromptDoubleOptions.js.map +1 -0
  137. package/lib/editor/input/prompt/AcEdPromptIntegerOptions.d.ts +39 -0
  138. package/lib/editor/input/prompt/AcEdPromptIntegerOptions.d.ts.map +1 -0
  139. package/lib/editor/input/prompt/AcEdPromptIntegerOptions.js +84 -0
  140. package/lib/editor/input/prompt/AcEdPromptIntegerOptions.js.map +1 -0
  141. package/lib/editor/input/prompt/AcEdPromptNumericalOptions.d.ts +59 -0
  142. package/lib/editor/input/prompt/AcEdPromptNumericalOptions.d.ts.map +1 -0
  143. package/lib/editor/input/prompt/AcEdPromptNumericalOptions.js +140 -0
  144. package/lib/editor/input/prompt/AcEdPromptNumericalOptions.js.map +1 -0
  145. package/lib/editor/input/prompt/AcEdPromptNumericalResult.d.ts +19 -0
  146. package/lib/editor/input/prompt/AcEdPromptNumericalResult.d.ts.map +1 -0
  147. package/lib/editor/input/prompt/AcEdPromptNumericalResult.js +36 -0
  148. package/lib/editor/input/prompt/AcEdPromptNumericalResult.js.map +1 -0
  149. package/lib/editor/input/prompt/AcEdPromptOptions.d.ts +61 -0
  150. package/lib/editor/input/prompt/AcEdPromptOptions.d.ts.map +1 -0
  151. package/lib/editor/input/prompt/AcEdPromptOptions.js +179 -0
  152. package/lib/editor/input/prompt/AcEdPromptOptions.js.map +1 -0
  153. package/lib/editor/input/prompt/AcEdPromptPointOptions.d.ts +46 -0
  154. package/lib/editor/input/prompt/AcEdPromptPointOptions.d.ts.map +1 -0
  155. package/lib/editor/input/prompt/AcEdPromptPointOptions.js +113 -0
  156. package/lib/editor/input/prompt/AcEdPromptPointOptions.js.map +1 -0
  157. package/lib/editor/input/prompt/AcEdPromptPointResult.d.ts +25 -0
  158. package/lib/editor/input/prompt/AcEdPromptPointResult.d.ts.map +1 -0
  159. package/lib/editor/input/prompt/AcEdPromptPointResult.js +38 -0
  160. package/lib/editor/input/prompt/AcEdPromptPointResult.js.map +1 -0
  161. package/lib/editor/input/prompt/AcEdPromptResult.d.ts +27 -0
  162. package/lib/editor/input/prompt/AcEdPromptResult.d.ts.map +1 -0
  163. package/lib/editor/input/prompt/AcEdPromptResult.js +19 -0
  164. package/lib/editor/input/prompt/AcEdPromptResult.js.map +1 -0
  165. package/lib/editor/input/prompt/AcEdPromptStatus.d.ts +22 -0
  166. package/lib/editor/input/prompt/AcEdPromptStatus.d.ts.map +1 -0
  167. package/lib/editor/input/prompt/AcEdPromptStatus.js +23 -0
  168. package/lib/editor/input/prompt/AcEdPromptStatus.js.map +1 -0
  169. package/lib/editor/input/prompt/AcEdPromptStringOptions.d.ts +54 -0
  170. package/lib/editor/input/prompt/AcEdPromptStringOptions.d.ts.map +1 -0
  171. package/lib/editor/input/prompt/AcEdPromptStringOptions.js +124 -0
  172. package/lib/editor/input/prompt/AcEdPromptStringOptions.js.map +1 -0
  173. package/lib/editor/input/prompt/index.d.ts +11 -0
  174. package/lib/editor/input/prompt/index.d.ts.map +1 -0
  175. package/lib/editor/input/prompt/index.js +11 -0
  176. package/lib/editor/input/prompt/index.js.map +1 -0
  177. package/lib/editor/input/ui/AcEdCommandLine.d.ts +116 -0
  178. package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -0
  179. package/lib/editor/input/ui/AcEdCommandLine.js +481 -0
  180. package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -0
  181. package/lib/editor/input/ui/AcEdFloatingInput.d.ts +151 -0
  182. package/lib/editor/input/ui/AcEdFloatingInput.d.ts.map +1 -0
  183. package/lib/editor/input/ui/AcEdFloatingInput.js +239 -0
  184. package/lib/editor/input/ui/AcEdFloatingInput.js.map +1 -0
  185. package/lib/editor/input/ui/AcEdFloatingInputBox.d.ts +60 -0
  186. package/lib/editor/input/ui/AcEdFloatingInputBox.d.ts.map +1 -0
  187. package/lib/editor/input/ui/AcEdFloatingInputBox.js +113 -0
  188. package/lib/editor/input/ui/AcEdFloatingInputBox.js.map +1 -0
  189. package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts +104 -0
  190. package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts.map +1 -0
  191. package/lib/editor/input/ui/AcEdFloatingInputBoxes.js +154 -0
  192. package/lib/editor/input/ui/AcEdFloatingInputBoxes.js.map +1 -0
  193. package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts +113 -0
  194. package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts.map +1 -0
  195. package/lib/editor/input/ui/AcEdFloatingInputTypes.js +2 -0
  196. package/lib/editor/input/ui/AcEdFloatingInputTypes.js.map +1 -0
  197. package/lib/editor/input/ui/AcEdInputManager.d.ts +132 -0
  198. package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -0
  199. package/lib/editor/input/ui/AcEdInputManager.js +477 -0
  200. package/lib/editor/input/ui/AcEdInputManager.js.map +1 -0
  201. package/lib/editor/input/ui/AcEdRubberBand.d.ts +66 -0
  202. package/lib/editor/input/ui/AcEdRubberBand.d.ts.map +1 -0
  203. package/lib/editor/input/ui/AcEdRubberBand.js +276 -0
  204. package/lib/editor/input/ui/AcEdRubberBand.js.map +1 -0
  205. package/lib/editor/input/ui/index.d.ts +3 -0
  206. package/lib/editor/input/ui/index.d.ts.map +1 -0
  207. package/lib/editor/input/ui/index.js +3 -0
  208. package/lib/editor/input/ui/index.js.map +1 -0
  209. package/lib/editor/view/AcEdBaseView.d.ts +54 -16
  210. package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
  211. package/lib/editor/view/AcEdBaseView.js +14 -11
  212. package/lib/editor/view/AcEdBaseView.js.map +1 -1
  213. package/lib/editor/view/AcEdLayerInfo.d.ts +5 -0
  214. package/lib/editor/view/AcEdLayerInfo.d.ts.map +1 -1
  215. package/lib/i18n/AcApI18n.d.ts +135 -0
  216. package/lib/i18n/AcApI18n.d.ts.map +1 -0
  217. package/lib/i18n/AcApI18n.js +208 -0
  218. package/lib/i18n/AcApI18n.js.map +1 -0
  219. package/lib/i18n/en/command.d.ts +18 -0
  220. package/lib/i18n/en/command.d.ts.map +1 -0
  221. package/lib/i18n/en/command.js +17 -0
  222. package/lib/i18n/en/command.js.map +1 -0
  223. package/lib/i18n/en/jig.d.ts +11 -0
  224. package/lib/i18n/en/jig.d.ts.map +1 -0
  225. package/lib/i18n/en/jig.js +10 -0
  226. package/lib/i18n/en/jig.js.map +1 -0
  227. package/lib/i18n/en/main.d.ts +37 -0
  228. package/lib/i18n/en/main.d.ts.map +1 -0
  229. package/lib/i18n/en/main.js +36 -0
  230. package/lib/i18n/en/main.js.map +1 -0
  231. package/lib/i18n/index.d.ts +6 -0
  232. package/lib/i18n/index.d.ts.map +1 -0
  233. package/lib/i18n/index.js +31 -0
  234. package/lib/i18n/index.js.map +1 -0
  235. package/lib/i18n/zh/command.d.ts +18 -0
  236. package/lib/i18n/zh/command.d.ts.map +1 -0
  237. package/lib/i18n/zh/command.js +17 -0
  238. package/lib/i18n/zh/command.js.map +1 -0
  239. package/lib/i18n/zh/jig.d.ts +11 -0
  240. package/lib/i18n/zh/jig.d.ts.map +1 -0
  241. package/lib/i18n/zh/jig.js +10 -0
  242. package/lib/i18n/zh/jig.js.map +1 -0
  243. package/lib/i18n/zh/main.d.ts +37 -0
  244. package/lib/i18n/zh/main.d.ts.map +1 -0
  245. package/lib/i18n/zh/main.js +36 -0
  246. package/lib/i18n/zh/main.js.map +1 -0
  247. package/lib/index.d.ts +1 -0
  248. package/lib/index.d.ts.map +1 -1
  249. package/lib/index.js +1 -0
  250. package/lib/index.js.map +1 -1
  251. package/lib/view/AcTrLayer.d.ts +29 -5
  252. package/lib/view/AcTrLayer.d.ts.map +1 -1
  253. package/lib/view/AcTrLayer.js +44 -6
  254. package/lib/view/AcTrLayer.js.map +1 -1
  255. package/lib/view/AcTrLayout.d.ts +13 -7
  256. package/lib/view/AcTrLayout.d.ts.map +1 -1
  257. package/lib/view/AcTrLayout.js +29 -21
  258. package/lib/view/AcTrLayout.js.map +1 -1
  259. package/lib/view/AcTrScene.d.ts +22 -8
  260. package/lib/view/AcTrScene.d.ts.map +1 -1
  261. package/lib/view/AcTrScene.js +36 -9
  262. package/lib/view/AcTrScene.js.map +1 -1
  263. package/lib/view/AcTrView2d.d.ts +19 -4
  264. package/lib/view/AcTrView2d.d.ts.map +1 -1
  265. package/lib/view/AcTrView2d.js +135 -43
  266. package/lib/view/AcTrView2d.js.map +1 -1
  267. package/package.json +7 -7
  268. package/lib/editor/input/AcEdBaseInput.d.ts +0 -89
  269. package/lib/editor/input/AcEdBaseInput.d.ts.map +0 -1
  270. package/lib/editor/input/AcEdBaseInput.js +0 -166
  271. package/lib/editor/input/AcEdBaseInput.js.map +0 -1
  272. package/lib/editor/input/AcEdBoxSelector.d.ts +0 -108
  273. package/lib/editor/input/AcEdBoxSelector.d.ts.map +0 -1
  274. package/lib/editor/input/AcEdBoxSelector.js +0 -220
  275. package/lib/editor/input/AcEdBoxSelector.js.map +0 -1
  276. package/lib/editor/input/AcEdInputPoint.d.ts +0 -51
  277. package/lib/editor/input/AcEdInputPoint.d.ts.map +0 -1
  278. package/lib/editor/input/AcEdInputPoint.js +0 -78
  279. package/lib/editor/input/AcEdInputPoint.js.map +0 -1
  280. package/lib/editor/input/AcEdJig.d.ts +0 -180
  281. package/lib/editor/input/AcEdJig.d.ts.map +0 -1
  282. package/lib/editor/input/AcEdJig.js +0 -256
  283. package/lib/editor/input/AcEdJig.js.map +0 -1
  284. package/lib/editor/input/AcEdJigLoop.d.ts +0 -63
  285. package/lib/editor/input/AcEdJigLoop.d.ts.map +0 -1
  286. package/lib/editor/input/AcEdJigLoop.js +0 -91
  287. package/lib/editor/input/AcEdJigLoop.js.map +0 -1
@@ -0,0 +1,151 @@
1
+ import { AcGePoint2dLike } from '@mlightcad/data-model';
2
+ import { AcEdFloatingInputOptions } from './AcEdFloatingInputTypes';
3
+ /**
4
+ * A UI component providing a small floating input box used inside CAD editing
5
+ * workflows. It supports both single-input (distance, angle, etc.) and
6
+ * double-input (coordinate entry) modes.
7
+ *
8
+ * The component is responsible for:
9
+ *
10
+ * - Creating, styling, and destroying its HTML structure
11
+ * - Handling keyboard events (Enter, Escape)
12
+ * - Managing live validation (via built-in or custom callback)
13
+ * - Emitting commit/change/cancel events
14
+ * - Ensuring no memory leaks via `dispose()`
15
+ *
16
+ * This abstraction allows higher-level objects such as AcEdInputManager to
17
+ * remain clean and free from DOM-handling logic.
18
+ */
19
+ export declare class AcEdFloatingInput<T> {
20
+ /**
21
+ * Mouse position in the parent element of the floating input.
22
+ */
23
+ mousePos?: AcGePoint2dLike;
24
+ /** Inject styles only once */
25
+ private static stylesInjected;
26
+ /**
27
+ * Parent element for positioning. Defaults to body if not provided.
28
+ */
29
+ private parent;
30
+ /**
31
+ * Root container DIV used to position and style the floating widget.
32
+ */
33
+ private container;
34
+ /**
35
+ * X and Y Input elements.
36
+ */
37
+ private inputs;
38
+ /**
39
+ * Callback functions
40
+ */
41
+ private onCommit?;
42
+ private onChange?;
43
+ private onCancel?;
44
+ private validateFn;
45
+ private getDynamicValue;
46
+ private drawPreview?;
47
+ /** Whether the widget is currently visible. */
48
+ private visible;
49
+ /** Whether this instance has been disposed. */
50
+ private disposed;
51
+ /**
52
+ * Cached bound handler for mouse enter event—ensures removal works.
53
+ */
54
+ private boundOnMouseEnter;
55
+ /**
56
+ * Cached bound handler for mouse leave event—ensures removal works.
57
+ */
58
+ private boundOnMouseLeave;
59
+ /**
60
+ * Cached bound handler for mouse move event—ensures removal works.
61
+ */
62
+ private boundOnMouseMove;
63
+ /**
64
+ * Cached bound handler for click event—ensures removal works.
65
+ */
66
+ private boundOnClick;
67
+ /**
68
+ * Constructs a new floating input widget with the given options.
69
+ *
70
+ * @param options Configuration object controlling behavior, callbacks,
71
+ * validation, and display mode.
72
+ */
73
+ constructor(options: AcEdFloatingInputOptions<T>);
74
+ /**
75
+ * Injects minimal CSS required for the floating input and preview rectangle.
76
+ * Useful when you do not have a separate CSS file.
77
+ */
78
+ private injectCSS;
79
+ /**
80
+ * Indicates whether the floating input widget is currently visible.
81
+ * Can be used by external code to check if the input is shown on the screen.
82
+ */
83
+ get isVisible(): boolean;
84
+ /**
85
+ * Shows the floating input box at the specified screen coordinates.
86
+ * @param pos - The mouse position in browser
87
+ */
88
+ showAt(pos: AcGePoint2dLike): void;
89
+ /**
90
+ * Hides the floating input widget.
91
+ *
92
+ * - Removes the widget from view.
93
+ * - Stops tracking mouse movement on the parent element.
94
+ *
95
+ * Safe to call multiple times; if the widget is already hidden, this method
96
+ * does nothing.
97
+ */
98
+ hide(): void;
99
+ /**
100
+ * Disposes the floating input widget permanently.
101
+ *
102
+ * - Removes all event listeners (keyboard, input, mouse move).
103
+ * - Removes the widget's DOM container from the parent.
104
+ * - Marks the widget as disposed; after this, it cannot be shown again.
105
+ *
106
+ * Safe to call multiple times; subsequent calls have no effect.
107
+ */
108
+ dispose(): void;
109
+ /**
110
+ * Sets position of this floating input
111
+ * @param pos - The mouse position in browser
112
+ * @returns The mouse position in the parent element of the floating input.
113
+ */
114
+ setPosition(pos: AcGePoint2dLike): {
115
+ x: number;
116
+ y: number;
117
+ };
118
+ /**
119
+ * Removes event listeners bound to the parent element
120
+ * @param isRemoveAll - If true, removes all of event listeners bound
121
+ * to the parent element
122
+ */
123
+ private removeListener;
124
+ /**
125
+ * Handles mouse move events to show floating input.
126
+ * @param e The mouse leave event.
127
+ */
128
+ private handleMouseEnter;
129
+ /**
130
+ * Handles mouse move events to hide floating input.
131
+ * @param e The mouse leave event.
132
+ */
133
+ private handleMouseLeave;
134
+ /**
135
+ * Handles mouse move events to reposition the floating input.
136
+ *
137
+ * Ensures that the input box follows the cursor while staying entirely
138
+ * within the bounds of the parent element. Applies a small offset
139
+ * to avoid overlapping the cursor.
140
+ *
141
+ * @param e The mouse move event containing the current cursor position.
142
+ */
143
+ private handleMouseMove;
144
+ /**
145
+ * Handles click events to commit inputs.
146
+ *
147
+ * @param e The click event containing the current cursor position.
148
+ */
149
+ private handleClick;
150
+ }
151
+ //# sourceMappingURL=AcEdFloatingInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdFloatingInput.d.ts","sourceRoot":"","sources":["../../../../src/editor/input/ui/AcEdFloatingInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGvD,OAAO,EAML,wBAAwB,EAEzB,MAAM,0BAA0B,CAAA;AAEjC;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,iBAAiB,CAAC,CAAC;IAC9B;;OAEG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAA;IAE1B,8BAA8B;IAC9B,OAAO,CAAC,MAAM,CAAC,cAAc,CAAQ;IAErC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAa;IAE3B;;OAEG;IACH,OAAO,CAAC,SAAS,CAAgB;IAEjC;;OAEG;IACH,OAAO,CAAC,MAAM,CAA2B;IAEzC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,CAAoC;IACrD,OAAO,CAAC,QAAQ,CAAC,CAAoC;IACrD,OAAO,CAAC,QAAQ,CAAC,CAAiC;IAClD,OAAO,CAAC,UAAU,CAAwC;IAC1D,OAAO,CAAC,eAAe,CAA0C;IACjE,OAAO,CAAC,WAAW,CAAC,CAAsC;IAE1D,+CAA+C;IAC/C,OAAO,CAAC,OAAO,CAAQ;IAEvB,+CAA+C;IAC/C,OAAO,CAAC,QAAQ,CAAQ;IAExB;;OAEG;IACH,OAAO,CAAC,iBAAiB,CAAyB;IAElD;;OAEG;IACH,OAAO,CAAC,iBAAiB,CAAyB;IAElD;;OAEG;IACH,OAAO,CAAC,gBAAgB,CAAyB;IAEjD;;OAEG;IACH,OAAO,CAAC,YAAY,CAAyB;IAM7C;;;;;OAKG;gBACS,OAAO,EAAE,wBAAwB,CAAC,CAAC,CAAC;IA8ChD;;;OAGG;IACH,OAAO,CAAC,SAAS;IAyCjB;;;OAGG;IACH,IAAI,SAAS,YAEZ;IAED;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;IAYlC;;;;;;;;OAQG;IACH,IAAI;IAOJ;;;;;;;;OAQG;IACH,OAAO;IASP;;;;OAIG;IACH,WAAW,CAAC,GAAG,EAAE,eAAe;;;;IA0BhC;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAUtB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;;;;;;OAQG;IACH,OAAO,CAAC,eAAe;IAiBvB;;;;OAIG;IACH,OAAO,CAAC,WAAW;CAOpB"}
@@ -0,0 +1,239 @@
1
+ import { AcEdFloatingInputBoxes } from './AcEdFloatingInputBoxes';
2
+ /**
3
+ * A UI component providing a small floating input box used inside CAD editing
4
+ * workflows. It supports both single-input (distance, angle, etc.) and
5
+ * double-input (coordinate entry) modes.
6
+ *
7
+ * The component is responsible for:
8
+ *
9
+ * - Creating, styling, and destroying its HTML structure
10
+ * - Handling keyboard events (Enter, Escape)
11
+ * - Managing live validation (via built-in or custom callback)
12
+ * - Emitting commit/change/cancel events
13
+ * - Ensuring no memory leaks via `dispose()`
14
+ *
15
+ * This abstraction allows higher-level objects such as AcEdInputManager to
16
+ * remain clean and free from DOM-handling logic.
17
+ */
18
+ var AcEdFloatingInput = /** @class */ (function () {
19
+ // ---------------------------------------------------------------------------
20
+ // CONSTRUCTOR
21
+ // ---------------------------------------------------------------------------
22
+ /**
23
+ * Constructs a new floating input widget with the given options.
24
+ *
25
+ * @param options Configuration object controlling behavior, callbacks,
26
+ * validation, and display mode.
27
+ */
28
+ function AcEdFloatingInput(options) {
29
+ var _this = this;
30
+ var _a, _b;
31
+ /** Whether the widget is currently visible. */
32
+ this.visible = false;
33
+ /** Whether this instance has been disposed. */
34
+ this.disposed = false;
35
+ this.parent = (_a = options.parent) !== null && _a !== void 0 ? _a : document.body;
36
+ this.validateFn = options.validate;
37
+ this.getDynamicValue = options.getDynamicValue;
38
+ this.drawPreview = options.drawPreview;
39
+ this.onCommit = options.onCommit;
40
+ this.onChange = options.onChange;
41
+ this.onCancel = options.onCancel;
42
+ // Create DOM
43
+ this.container = document.createElement('div');
44
+ this.container.className = 'ml-floating-input';
45
+ var label = document.createElement('span');
46
+ label.className = 'ml-floating-input-label';
47
+ label.textContent = (_b = options.message) !== null && _b !== void 0 ? _b : '';
48
+ this.container.appendChild(label);
49
+ this.inputs = new AcEdFloatingInputBoxes({
50
+ parent: this.container,
51
+ twoInputs: options.twoInputs,
52
+ validate: this.validateFn,
53
+ onCancel: this.onCancel,
54
+ onCommit: this.onCommit,
55
+ onChange: this.onChange
56
+ });
57
+ // Always add it as children of body element because the browser will ignore it completely if
58
+ // adding an <input> element as a child of a <canvas> element.
59
+ document.body.appendChild(this.container);
60
+ // Bind events
61
+ this.boundOnMouseEnter = function (e) { return _this.handleMouseEnter(e); };
62
+ this.boundOnMouseLeave = function () { return _this.handleMouseLeave(); };
63
+ this.boundOnMouseMove = function (e) { return _this.handleMouseMove(e); };
64
+ this.boundOnClick = function (e) { return _this.handleClick(e); };
65
+ // When the mouse enters the parent element, show floating input as AutoCAD
66
+ this.parent.addEventListener('mouseenter', this.boundOnMouseEnter);
67
+ // When the mouse leaves the parent element, hide floating input as AutoCAD
68
+ this.parent.addEventListener('mouseleave', this.boundOnMouseLeave);
69
+ this.injectCSS();
70
+ }
71
+ /**
72
+ * Injects minimal CSS required for the floating input and preview rectangle.
73
+ * Useful when you do not have a separate CSS file.
74
+ */
75
+ AcEdFloatingInput.prototype.injectCSS = function () {
76
+ if (AcEdFloatingInput.stylesInjected)
77
+ return;
78
+ AcEdFloatingInput.stylesInjected = true;
79
+ var style = document.createElement('style');
80
+ style.textContent = "\n .ml-floating-input {\n position: absolute;\n display: flex;\n align-items: center;\n padding: 2px 4px;\n background: #444; /* gray background for container */\n color: #fff; /* white text for message */\n border: none;\n border-radius: 4px;\n font-size: 12px;\n pointer-events: none;\n z-index: 10000;\n }\n .ml-floating-input input {\n font-size: 12px;\n padding: 2px 4px;\n margin-left: 6px;\n height: 22px;\n width: 90px; /* wider to show coordinates */\n background: #888; /* gray background for input */\n border: 1px solid #666; /* subtle border */\n border-radius: 2px;\n }\n .ml-floating-input input.invalid {\n border-color: red;\n color: red;\n }\n .ml-floating-input-label {\n white-space: nowrap;\n color: #fff; /* white label text */\n }\n ";
81
+ document.head.appendChild(style);
82
+ };
83
+ Object.defineProperty(AcEdFloatingInput.prototype, "isVisible", {
84
+ /**
85
+ * Indicates whether the floating input widget is currently visible.
86
+ * Can be used by external code to check if the input is shown on the screen.
87
+ */
88
+ get: function () {
89
+ return this.visible;
90
+ },
91
+ enumerable: false,
92
+ configurable: true
93
+ });
94
+ /**
95
+ * Shows the floating input box at the specified screen coordinates.
96
+ * @param pos - The mouse position in browser
97
+ */
98
+ AcEdFloatingInput.prototype.showAt = function (pos) {
99
+ if (this.disposed)
100
+ return;
101
+ this.container.style.display = 'flex';
102
+ this.visible = true;
103
+ this.inputs.focus();
104
+ this.setPosition(pos);
105
+ // Listen to mouse move and click on parent
106
+ this.parent.addEventListener('mousemove', this.boundOnMouseMove);
107
+ this.parent.addEventListener('click', this.boundOnClick);
108
+ };
109
+ /**
110
+ * Hides the floating input widget.
111
+ *
112
+ * - Removes the widget from view.
113
+ * - Stops tracking mouse movement on the parent element.
114
+ *
115
+ * Safe to call multiple times; if the widget is already hidden, this method
116
+ * does nothing.
117
+ */
118
+ AcEdFloatingInput.prototype.hide = function () {
119
+ if (!this.visible)
120
+ return;
121
+ this.container.style.display = 'none';
122
+ this.visible = false;
123
+ this.removeListener();
124
+ };
125
+ /**
126
+ * Disposes the floating input widget permanently.
127
+ *
128
+ * - Removes all event listeners (keyboard, input, mouse move).
129
+ * - Removes the widget's DOM container from the parent.
130
+ * - Marks the widget as disposed; after this, it cannot be shown again.
131
+ *
132
+ * Safe to call multiple times; subsequent calls have no effect.
133
+ */
134
+ AcEdFloatingInput.prototype.dispose = function () {
135
+ if (this.disposed)
136
+ return;
137
+ this.disposed = true;
138
+ this.inputs.dispose();
139
+ this.removeListener(true);
140
+ this.container.remove();
141
+ };
142
+ /**
143
+ * Sets position of this floating input
144
+ * @param pos - The mouse position in browser
145
+ * @returns The mouse position in the parent element of the floating input.
146
+ */
147
+ AcEdFloatingInput.prototype.setPosition = function (pos) {
148
+ var parentRect = this.parent.getBoundingClientRect();
149
+ var containerRect = this.container.getBoundingClientRect();
150
+ var mousePos = {
151
+ x: pos.x - parentRect.left,
152
+ y: pos.y - parentRect.top
153
+ };
154
+ this.mousePos = mousePos;
155
+ // Compute position within parent bounds
156
+ var left = mousePos.x + 10;
157
+ var top = mousePos.y + 10;
158
+ if (left + containerRect.width > parentRect.right)
159
+ left = parentRect.right - containerRect.width;
160
+ if (top + containerRect.height > parentRect.bottom)
161
+ top = parentRect.bottom - containerRect.height;
162
+ if (left < parentRect.left)
163
+ left = parentRect.left;
164
+ if (top < parentRect.top)
165
+ top = parentRect.top;
166
+ this.container.style.left = "".concat(left, "px");
167
+ this.container.style.top = "".concat(top, "px");
168
+ return mousePos;
169
+ };
170
+ /**
171
+ * Removes event listeners bound to the parent element
172
+ * @param isRemoveAll - If true, removes all of event listeners bound
173
+ * to the parent element
174
+ */
175
+ AcEdFloatingInput.prototype.removeListener = function (isRemoveAll) {
176
+ if (isRemoveAll === void 0) { isRemoveAll = false; }
177
+ this.parent.removeEventListener('mousemove', this.boundOnMouseMove);
178
+ this.parent.removeEventListener('click', this.boundOnClick);
179
+ if (isRemoveAll) {
180
+ this.parent.removeEventListener('mouseenter', this.boundOnMouseEnter);
181
+ this.parent.removeEventListener('mouseleave', this.boundOnMouseLeave);
182
+ }
183
+ };
184
+ /**
185
+ * Handles mouse move events to show floating input.
186
+ * @param e The mouse leave event.
187
+ */
188
+ AcEdFloatingInput.prototype.handleMouseEnter = function (e) {
189
+ this.showAt(e);
190
+ };
191
+ /**
192
+ * Handles mouse move events to hide floating input.
193
+ * @param e The mouse leave event.
194
+ */
195
+ AcEdFloatingInput.prototype.handleMouseLeave = function () {
196
+ this.hide();
197
+ };
198
+ /**
199
+ * Handles mouse move events to reposition the floating input.
200
+ *
201
+ * Ensures that the input box follows the cursor while staying entirely
202
+ * within the bounds of the parent element. Applies a small offset
203
+ * to avoid overlapping the cursor.
204
+ *
205
+ * @param e The mouse move event containing the current cursor position.
206
+ */
207
+ AcEdFloatingInput.prototype.handleMouseMove = function (e) {
208
+ var _a;
209
+ if (!this.visible)
210
+ return;
211
+ var mousePos = this.setPosition({ x: e.x, y: e.y });
212
+ // Update input values if empty using dynamic value callback
213
+ var defaults = this.getDynamicValue(mousePos.x, mousePos.y);
214
+ this.inputs.setValue(defaults.raw);
215
+ // If inputs lost focus due to some reason, let's try to focus them again.
216
+ if (!this.inputs.focused) {
217
+ this.inputs.focus();
218
+ }
219
+ (_a = this.drawPreview) === null || _a === void 0 ? void 0 : _a.call(this, mousePos.x, mousePos.y);
220
+ };
221
+ /**
222
+ * Handles click events to commit inputs.
223
+ *
224
+ * @param e The click event containing the current cursor position.
225
+ */
226
+ AcEdFloatingInput.prototype.handleClick = function (e) {
227
+ var _a;
228
+ if (!this.visible)
229
+ return;
230
+ var mousePos = this.setPosition({ x: e.x, y: e.y });
231
+ var defaults = this.getDynamicValue(mousePos.x, mousePos.y);
232
+ (_a = this.onCommit) === null || _a === void 0 ? void 0 : _a.call(this, defaults.value);
233
+ };
234
+ /** Inject styles only once */
235
+ AcEdFloatingInput.stylesInjected = false;
236
+ return AcEdFloatingInput;
237
+ }());
238
+ export { AcEdFloatingInput };
239
+ //# sourceMappingURL=AcEdFloatingInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdFloatingInput.js","sourceRoot":"","sources":["../../../../src/editor/input/ui/AcEdFloatingInput.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAWjE;;;;;;;;;;;;;;;GAeG;AACH;IA4DE,8EAA8E;IAC9E,cAAc;IACd,8EAA8E;IAE9E;;;;;OAKG;IACH,2BAAY,OAAoC;QAAhD,iBA4CC;;QAhFD,+CAA+C;QACvC,YAAO,GAAG,KAAK,CAAA;QAEvB,+CAA+C;QACvC,aAAQ,GAAG,KAAK,CAAA;QAiCtB,IAAI,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,QAAQ,CAAC,IAAI,CAAA;QAC7C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAA;QAClC,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAA;QAC9C,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAA;QAEtC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;QAChC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;QAChC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;QAEhC,aAAa;QACb,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QAC9C,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,mBAAmB,CAAA;QAE9C,IAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QAC5C,KAAK,CAAC,SAAS,GAAG,yBAAyB,CAAA;QAC3C,KAAK,CAAC,WAAW,GAA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CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;QACrB,CAAC;QAED,MAAA,IAAI,CAAC,WAAW,qDAAG,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC5C,CAAC;IAED;;;;OAIG;IACK,uCAAW,GAAnB,UAAoB,CAAa;;QAC/B,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAM;QAEzB,IAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;QACrD,IAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;QAC7D,MAAA,IAAI,CAAC,QAAQ,qDAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IACjC,CAAC;IAxTD,8BAA8B;IACf,gCAAc,GAAG,KAAK,AAAR,CAAQ;IAwTvC,wBAAC;CAAA,AA/TD,IA+TC;SA/TY,iBAAiB"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Represents ONE floating input box (<input> element).
3
+ * Tracks whether the user has typed anything manually.
4
+ */
5
+ export declare class AcEdFloatingInputBox {
6
+ /** The container element of this input */
7
+ private parent;
8
+ /** The actual text input element */
9
+ private input;
10
+ /** Whether the user typed something in this box */
11
+ userTyped: boolean;
12
+ /** Bound input handler for unbinding */
13
+ private boundOnInput;
14
+ /**
15
+ * Constructs one instance of this UI component.
16
+ * @param parent - The container element of this input
17
+ */
18
+ constructor(parent: HTMLElement);
19
+ /** Mark input as invalid */
20
+ markInvalid(): void;
21
+ /** Mark input as valid */
22
+ markValid(): void;
23
+ /** Clear validation state */
24
+ resetValidation(): void;
25
+ /** Get placeholder */
26
+ get placeholder(): string;
27
+ /** Set placeholder */
28
+ set placeholder(text: string);
29
+ /** Set value */
30
+ set value(v: string);
31
+ /** Read current text */
32
+ get value(): string;
33
+ /** Return one flag to indicate whether the input box is focused. */
34
+ get focused(): boolean;
35
+ /** Forwards focus() to the underlying element. */
36
+ focus(): void;
37
+ /** Forwards select() to the underlying element. */
38
+ select(): void;
39
+ /** Forwards remove() to the underlying element. */
40
+ remove(): void;
41
+ /** Return true if the specified event is originated from this input box. */
42
+ isEventTarget(e: KeyboardEvent): boolean;
43
+ /** Dispose the input box by unbinding events */
44
+ dispose(): void;
45
+ /**
46
+ * Add an event listener to the input element
47
+ * @param type Event type (e.g., 'input', 'keydown')
48
+ * @param listener Listener function
49
+ * @param options Optional event listener options
50
+ */
51
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLInputElement, ev: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
52
+ /**
53
+ * Remove an event listener from the input element
54
+ * @param type Event type (e.g., 'input', 'keydown')
55
+ * @param listener Listener function
56
+ * @param options Optional event listener options
57
+ */
58
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLInputElement, ev: HTMLElementEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
59
+ }
60
+ //# sourceMappingURL=AcEdFloatingInputBox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdFloatingInputBox.d.ts","sourceRoot":"","sources":["../../../../src/editor/input/ui/AcEdFloatingInputBox.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B,0CAA0C;IAC1C,OAAO,CAAC,MAAM,CAAa;IAE3B,oCAAoC;IACpC,OAAO,CAAC,KAAK,CAAkB;IAE/B,mDAAmD;IACnD,SAAS,UAAQ;IAEjB,wCAAwC;IACxC,OAAO,CAAC,YAAY,CAAY;IAEhC;;;OAGG;gBACS,MAAM,EAAE,WAAW;IAc/B,4BAA4B;IAC5B,WAAW;IAIX,0BAA0B;IAC1B,SAAS;IAIT,6BAA6B;IAC7B,eAAe;IAIf,sBAAsB;IACtB,IAAI,WAAW,IAKO,MAAM,CAH3B;IAED,sBAAsB;IACtB,IAAI,WAAW,CAAC,IAAI,EAAE,MAAM,EAE3B;IAED,gBAAgB;IAChB,IAAI,KAAK,CAAC,CAAC,EAAE,MAAM,EAElB;IAED,wBAAwB;IACxB,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,oEAAoE;IACpE,IAAI,OAAO,YAEV;IAED,kDAAkD;IAClD,KAAK;IAIL,mDAAmD;IACnD,MAAM;IAIN,mDAAmD;IACnD,MAAM;IAIN,4EAA4E;IAC5E,aAAa,CAAC,CAAC,EAAE,aAAa;IAI9B,gDAAgD;IAChD,OAAO;IAKP;;;;;OAKG;IACH,gBAAgB,CAAC,CAAC,SAAS,MAAM,mBAAmB,EAClD,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,EACtE,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB;IAK7C;;;;;OAKG;IACH,mBAAmB,CAAC,CAAC,SAAS,MAAM,mBAAmB,EACrD,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,EACtE,OAAO,CAAC,EAAE,OAAO,GAAG,oBAAoB;CAI3C"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Represents ONE floating input box (<input> element).
3
+ * Tracks whether the user has typed anything manually.
4
+ */
5
+ var AcEdFloatingInputBox = /** @class */ (function () {
6
+ /**
7
+ * Constructs one instance of this UI component.
8
+ * @param parent - The container element of this input
9
+ */
10
+ function AcEdFloatingInputBox(parent) {
11
+ var _this = this;
12
+ /** Whether the user typed something in this box */
13
+ this.userTyped = false;
14
+ this.parent = parent;
15
+ this.input = document.createElement('input');
16
+ this.input.type = 'text';
17
+ // Track user input
18
+ this.boundOnInput = function () {
19
+ _this.userTyped = true;
20
+ _this.resetValidation();
21
+ };
22
+ this.input.addEventListener('input', this.boundOnInput);
23
+ this.parent.appendChild(this.input);
24
+ }
25
+ /** Mark input as invalid */
26
+ AcEdFloatingInputBox.prototype.markInvalid = function () {
27
+ this.input.classList.add('invalid');
28
+ };
29
+ /** Mark input as valid */
30
+ AcEdFloatingInputBox.prototype.markValid = function () {
31
+ this.input.classList.remove('invalid');
32
+ };
33
+ /** Clear validation state */
34
+ AcEdFloatingInputBox.prototype.resetValidation = function () {
35
+ this.input.classList.remove('invalid');
36
+ };
37
+ Object.defineProperty(AcEdFloatingInputBox.prototype, "placeholder", {
38
+ /** Get placeholder */
39
+ get: function () {
40
+ return this.input.placeholder;
41
+ },
42
+ /** Set placeholder */
43
+ set: function (text) {
44
+ if (text)
45
+ this.input.placeholder = text;
46
+ },
47
+ enumerable: false,
48
+ configurable: true
49
+ });
50
+ Object.defineProperty(AcEdFloatingInputBox.prototype, "value", {
51
+ /** Read current text */
52
+ get: function () {
53
+ return this.input.value;
54
+ },
55
+ /** Set value */
56
+ set: function (v) {
57
+ if (v !== undefined)
58
+ this.input.value = v;
59
+ },
60
+ enumerable: false,
61
+ configurable: true
62
+ });
63
+ Object.defineProperty(AcEdFloatingInputBox.prototype, "focused", {
64
+ /** Return one flag to indicate whether the input box is focused. */
65
+ get: function () {
66
+ return document.activeElement === this.input;
67
+ },
68
+ enumerable: false,
69
+ configurable: true
70
+ });
71
+ /** Forwards focus() to the underlying element. */
72
+ AcEdFloatingInputBox.prototype.focus = function () {
73
+ this.input.focus();
74
+ };
75
+ /** Forwards select() to the underlying element. */
76
+ AcEdFloatingInputBox.prototype.select = function () {
77
+ this.input.select();
78
+ };
79
+ /** Forwards remove() to the underlying element. */
80
+ AcEdFloatingInputBox.prototype.remove = function () {
81
+ this.input.remove();
82
+ };
83
+ /** Return true if the specified event is originated from this input box. */
84
+ AcEdFloatingInputBox.prototype.isEventTarget = function (e) {
85
+ return e.target === this.input;
86
+ };
87
+ /** Dispose the input box by unbinding events */
88
+ AcEdFloatingInputBox.prototype.dispose = function () {
89
+ this.input.removeEventListener('input', this.boundOnInput);
90
+ this.remove();
91
+ };
92
+ /**
93
+ * Add an event listener to the input element
94
+ * @param type Event type (e.g., 'input', 'keydown')
95
+ * @param listener Listener function
96
+ * @param options Optional event listener options
97
+ */
98
+ AcEdFloatingInputBox.prototype.addEventListener = function (type, listener, options) {
99
+ this.input.addEventListener(type, listener, options);
100
+ };
101
+ /**
102
+ * Remove an event listener from the input element
103
+ * @param type Event type (e.g., 'input', 'keydown')
104
+ * @param listener Listener function
105
+ * @param options Optional event listener options
106
+ */
107
+ AcEdFloatingInputBox.prototype.removeEventListener = function (type, listener, options) {
108
+ this.input.removeEventListener(type, listener, options);
109
+ };
110
+ return AcEdFloatingInputBox;
111
+ }());
112
+ export { AcEdFloatingInputBox };
113
+ //# sourceMappingURL=AcEdFloatingInputBox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdFloatingInputBox.js","sourceRoot":"","sources":["../../../../src/editor/input/ui/AcEdFloatingInputBox.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;IAaE;;;OAGG;IACH,8BAAY,MAAmB;QAA/B,iBAYC;QAtBD,mDAAmD;QACnD,cAAS,GAAG,KAAK,CAAA;QAUf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;QAC5C,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,MAAM,CAAA;QAExB,mBAAmB;QACnB,IAAI,CAAC,YAAY,GAAG;YAClB,KAAI,CAAC,SAAS,GAAG,IAAI,CAAA;YACrB,KAAI,CAAC,eAAe,EAAE,CAAA;QACxB,CAAC,CAAA;QACD,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,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