yks-element 1.5.1 → 1.5.2

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 (475) hide show
  1. package/README.md +10 -20
  2. package/lib/yks.js +1 -1
  3. package/package.json +1 -1
  4. package/lib/00155bd406dacc6f2d79b8de025719ac.js +0 -48
  5. package/lib/01fd21b5525a03456f881515f1002134.js +0 -18
  6. package/lib/0242eebc51caa2b134602e86ed3be3cf.js +0 -18
  7. package/lib/027e36a1f41877209eca741a54467a40.js +0 -16
  8. package/lib/028a3e5cd150f029676e21c0ba88f7e6.js +0 -18
  9. package/lib/036680d9c1d332cf478c5823cd2a47db.js +0 -9
  10. package/lib/039a0e6e22fee41c6f074e9745f20ff4.js +0 -9
  11. package/lib/0410ca02b96655ac3c08452105cdad32.js +0 -168
  12. package/lib/057c0c1a0dff072cbb9819e95cb739cf.js +0 -170
  13. package/lib/06b29b48315cd443a04a6b3fac315dcf.js +0 -2518
  14. package/lib/07312a5fd7bf0e4c902ae8a92d42a69a.js +0 -18
  15. package/lib/086d94781c70156042f95d5fa61d995a.js +0 -427
  16. package/lib/0871aac6c551218cdd4a5690ace7b38c.js +0 -45
  17. package/lib/08ead5ce2617fb6ce642b5ba343bd62c.js +0 -9
  18. package/lib/08f2ebda31cf24e86831115fde674fad.js +0 -16
  19. package/lib/0955faac884af83a837117d815a9cc04.js +0 -2522
  20. package/lib/0ab8bd2c1e69b03bc24b70523a70e30a.js +0 -293
  21. package/lib/0c2b3b3b66a73e289e2ca47cf22ef150.js +0 -9
  22. package/lib/0cdc14741de08dc4af237c4e1124d661.js +0 -642
  23. package/lib/0dd0f45c3dde9af3fcf9706e6a2a1edd.js +0 -9
  24. package/lib/0e13b643b6e88e8fd6328d50acabfda8.js +0 -56
  25. package/lib/0e6175d2306c7bd33ad73acb96313103.js +0 -330
  26. package/lib/0ebb7559af3a19776ac2272fbbc77a11.js +0 -82
  27. package/lib/0ee3d8835fa32648b51c9a73bff3324e.js +0 -18
  28. package/lib/0f1ed761f7bd80b36c267d65764b87ca.js +0 -344
  29. package/lib/0faaa4d3cf56de624fb5dd12e7fa18c9.js +0 -18
  30. package/lib/11115bde71f6d8245d7cb05b89dbfbc1.js +0 -18
  31. package/lib/1136d59010460a6c7277688011fc86dc.js +0 -145
  32. package/lib/119d8ff08e82b0f391f59f1fe657130f.js +0 -9
  33. package/lib/12738aa8461e4775d7f380a5d1953893.js +0 -279
  34. package/lib/13b157cfddcb9a76ae0800b47a8f0122.js +0 -9
  35. package/lib/142d258626093a8c3187029538e32bbc.js +0 -9
  36. package/lib/155500be4d3113e94dca99f997defb7a.js +0 -9
  37. package/lib/15bd2f4de9aefea698aea59ecd36327f.js +0 -16
  38. package/lib/173ea2d9126a53f1d6cb61ef26219598.js +0 -16
  39. package/lib/17c85759d562794da4d2ff11f1b9b3bd.js +0 -9
  40. package/lib/182aa449781ff6997bc12b8eb3611ccb.js +0 -3122
  41. package/lib/182fa653555b8340835b3bf4f7192ae2.js +0 -9
  42. package/lib/1865ebc428856723187c96ea096a68e7.js +0 -3294
  43. package/lib/188744ad64e26326b70337714cc840c8.js +0 -151
  44. package/lib/18a893070398343ab529fdb7b62f1b6d.js +0 -9
  45. package/lib/18b69bf761ab7d8645f68794096dcb46.js +0 -16
  46. package/lib/1ac4b99c62f756d61d25417728b2e5f8.js +0 -104
  47. package/lib/1afe87852eca4b28294075c659ff8c45.js +0 -9
  48. package/lib/1b6f35b7d53ed37d0823a2081ab95fac.js +0 -402
  49. package/lib/1b8199f34db41b72375a9947d4ef84a4.js +0 -348
  50. package/lib/1c71dfe2ae40884baae78d14e2568eb1.js +0 -9
  51. package/lib/1c9874850164cfdaa7e1d212d09124a7.js +0 -9
  52. package/lib/1cac3566cdfb6be0f51c3f2ade7c1603.js +0 -16
  53. package/lib/1cb8df3a3416707163473b1ee9268faf.js +0 -9
  54. package/lib/1cbff31b1abe2c3f9eb1113b4cfa5cb6.js +0 -18
  55. package/lib/1d051fbb1bd28c0b89641f417930f078.js +0 -192
  56. package/lib/1dda5460bcee9fb6faa67d22b6448454.js +0 -9
  57. package/lib/1e16076242211185847c3208ffb79bad.js +0 -2750
  58. package/lib/1e46a85215aeb52a8ed19cf62d1b3362.js +0 -9
  59. package/lib/1ea9cb4eff3a4f4c27ff63263151eba2.js +0 -16
  60. package/lib/1f1abd5e247cf6b2e9a3db6303277572.js +0 -9
  61. package/lib/1fd353d022bf5027ba193d0b0b9995ed.js +0 -9
  62. package/lib/2031467f3d02be43b638c5e3ccba3996.js +0 -9
  63. package/lib/207fa26d9d4b4c2d5af507fa6db04339.js +0 -185
  64. package/lib/20b085f014791c3916e38d818e76ef3c.js +0 -318
  65. package/lib/20f8061729d26f9786679bbf7af0b87a.js +0 -9
  66. package/lib/214a729dcea91ee8a56f8ef43e17243a.js +0 -9
  67. package/lib/21888fda037b96f7d9c9261cbef5bbbc.js +0 -338
  68. package/lib/21dca974f7343f200597e43a55766c6e.js +0 -9
  69. package/lib/2251070349dc9ecad4cb9f2be8a15c13.js +0 -3834
  70. package/lib/22ddca0f2cac653ae8eebd716e965aa7.js +0 -9
  71. package/lib/22e2ec10d48dca8a66c53f9a41271023.js +0 -459
  72. package/lib/238b48c537406ead43a4005567d5a013.js +0 -268
  73. package/lib/23ad6224fd6059c31c199b6d6d420628.js +0 -16
  74. package/lib/23da774e43bdbc0fee7d11009ee014b2.js +0 -18
  75. package/lib/242fb5a92733d151e9ca303fcd3ae7ff.js +0 -9
  76. package/lib/251c1b0aa30bc78444e22999d6a2e6f1.js +0 -19
  77. package/lib/2681042a598b029b51d51f7669b81c4d.js +0 -9
  78. package/lib/26916d87ee46ad72f432b9a59e6fd198.js +0 -16
  79. package/lib/269bb81eeebec9d70536fede3f17dac5.js +0 -9
  80. package/lib/272c72bab8da763aef48ecb7934c9586.js +0 -18
  81. package/lib/279a2126957722bd396f011c41d616f2.js +0 -2017
  82. package/lib/2818bca0cd2a7e31aa1a7d0698a1312b.js +0 -342
  83. package/lib/2836e58974a8e2730a9b6bec1921dd3d.js +0 -199
  84. package/lib/2863331c75e78da46cd0d6c9a0399846.js +0 -567
  85. package/lib/28b3223a7121c1e1392918647cfd3ea4.js +0 -2785
  86. package/lib/28f7c5b28bbad7b0bac0cc3cc5b89bad.js +0 -9
  87. package/lib/2984fab606909e16083d98c4581fd484.js +0 -1626
  88. package/lib/2a4c96bd91c25806d68325751fb0c958.js +0 -16
  89. package/lib/2ac58492ad5a1b5244deb0fef1e5a773.js +0 -9
  90. package/lib/2bba99eb717e1aa22e45284a964ca73f.js +0 -9
  91. package/lib/2bf178d3af8ceb86a2c5588fa5b0434a.js +0 -18
  92. package/lib/2c41df6060672e75b4ab09e4a5d43049.js +0 -74
  93. package/lib/2c48ebc44a87762b127d573fd4ed4d49.js +0 -18
  94. package/lib/2c6ae8805adc9206e70eb29818e71a4f.js +0 -9
  95. package/lib/2d0362619c6807297b4b207bad2940cd.js +0 -18
  96. package/lib/2d53cfacb6a695f378ca997fcee7efb3.js +0 -16
  97. package/lib/2dcf359bda4d96fcd06e8b0b7bc039bf.js +0 -305
  98. package/lib/2df83568e34903d7d3e0051e3a95c459.js +0 -450
  99. package/lib/2ecf7f87e692b92a347ff145a2e6212e.js +0 -768
  100. package/lib/2f6dcc38e5ad378438bea99c47e20e28.js +0 -16
  101. package/lib/2fd1880f79d0f2ffb10daaf928266181.js +0 -317
  102. package/lib/30335c579bfc2de8dcf574523ef13020.js +0 -325
  103. package/lib/309668174423f4bc9dbe529041f8e48c.js +0 -1276
  104. package/lib/30e3bb6a531e1c812558474a78d50e51.js +0 -18
  105. package/lib/313a120714418a06223767f908e52a06.js +0 -393
  106. package/lib/31459a657ac30dcaa54765c6d76d8c81.js +0 -9
  107. package/lib/318f90759f2ff0d2a437350e87578172.js +0 -9
  108. package/lib/31bcb02e59d84ce2e38b85616a0b44db.js +0 -9
  109. package/lib/31f3f1c32b27587832d28b634351325c.js +0 -9
  110. package/lib/32cea5ceeb0f16ead13364fac0c3214d.js +0 -197
  111. package/lib/330543be2120b9dcc9bec41ba5e05805.js +0 -9
  112. package/lib/33443ec129774bb1add5795cc8895137.js +0 -9
  113. package/lib/33b2bdaf684e9e4ad47970682aa5b00d.js +0 -154
  114. package/lib/33df99ab21a0e281c0626e261c1638bc.js +0 -9
  115. package/lib/34166ea54cd1328fee335538a4fb7d5c.js +0 -2580
  116. package/lib/34f05dc84111ffe37a1d5b5aacff7488.js +0 -9
  117. package/lib/34f52a56877a14fbb7e9d37469ebbf15.js +0 -254
  118. package/lib/35858a47038a7be957df49854e8e5eea.js +0 -9
  119. package/lib/35b519c2ce83bbe55e6ba35bd379db4e.js +0 -445
  120. package/lib/35dc4119f9e28cb9baba1475537460bb.js +0 -9
  121. package/lib/3734f5f0d471b4551566c56c7149b602.js +0 -9
  122. package/lib/3792c6a2af140883f2b4a70d783d442f.js +0 -16
  123. package/lib/38528de2a5c097da375fd0a076667441.js +0 -9
  124. package/lib/38b9892d0c5fa60cb6c0496fcbae4c05.js +0 -477
  125. package/lib/3a820eb0c0fb52f9b75e34214b5f8c9c.js +0 -226
  126. package/lib/3baeab62d681338ba3287f0a50e5dad1.js +0 -9
  127. package/lib/3bbeadbf33a4c2c131ec271b9b103a59.js +0 -1255
  128. package/lib/3c126add795585b0bcdab07451b9c398.js +0 -57579
  129. package/lib/3c2688e4b9137acb04affdd5e0c154fa.js +0 -391
  130. package/lib/3c58f68d787710c79906a2cd6d248295.js +0 -9
  131. package/lib/3cab7110c6a090f72c540dcc1cfbe3b5.js +0 -9
  132. package/lib/3cce0c7e1a8e1148f97de59a4b1ee73f.js +0 -9
  133. package/lib/3cf64ec91a700bfa1dece0957c49c7dc.js +0 -9
  134. package/lib/3cfffbb4555d5856b82186750e7b2b65.js +0 -253
  135. package/lib/3ddb5ebdc00b5a39bd4aedae80e1e1fb.js +0 -1757
  136. package/lib/3dfe9a3e745ca1e3755291ac5c5a4a24.js +0 -16
  137. package/lib/3e6808cd6eefd1be1040403985581374.js +0 -9
  138. package/lib/3e6a7169aea2691d9a23761b355fddc1.js +0 -580
  139. package/lib/3f043d654fe1e1895f0f2d65861e21aa.js +0 -18
  140. package/lib/3fb7fc8a302c8083706f70dff565dcbe.js +0 -1254
  141. package/lib/3fba2de8f5fff55907837780285f7481.js +0 -3066
  142. package/lib/40505d6c2f34fc08502d3e596573c7f8.js +0 -9
  143. package/lib/41251dac588b04bea51a664d331ff40a.js +0 -412
  144. package/lib/41c9592c46bdb2ee5d35a45a28cdd46c.js +0 -18
  145. package/lib/41f85ea0c545f0539b6ae2753eb1f79c.js +0 -9
  146. package/lib/43a9bcfc200d80676bc68fe9a3c8ab6d.js +0 -9
  147. package/lib/443b217c1337c10d168828ffd8f93528.js +0 -250
  148. package/lib/45de113a9f4cd75a8a71a2e6f4f91c95.js +0 -129
  149. package/lib/48ef2bea2256bfb13400738d7be7025f.js +0 -18
  150. package/lib/49152f07a653743e724f599386af2d7c.js +0 -16
  151. package/lib/49456231db02d9338914cee404f1b864.js +0 -2577
  152. package/lib/494f806d0f1ce92dfbbc4f80f34086a8.js +0 -2741
  153. package/lib/4a02cfb7dd2f107d184dc23fce76eebb.js +0 -387
  154. package/lib/4ab40446885d7f476b5c21fd390b0e23.js +0 -18
  155. package/lib/4cbd6f8a4f52821c1d3476139078797d.js +0 -9
  156. package/lib/4d694d41a0c1b3eaad752a8352c5661c.js +0 -9
  157. package/lib/4e347d330ecc5e8dcff367c024911892.js +0 -67
  158. package/lib/4e79f5ab805c7bfe58091ad27689b35e.js +0 -350
  159. package/lib/4ec4239f7011262fb987ab393a945110.js +0 -2416
  160. package/lib/4ee8da21e528c64675b310845a654de5.js +0 -18
  161. package/lib/5094b30d2471cc7312746173d8a4bb25.js +0 -9
  162. package/lib/50990da99a99a307711c6890db7397bd.js +0 -18
  163. package/lib/51e6ccd3ea9d7443949b155b113eebd5.js +0 -9
  164. package/lib/530deeb11db43fceba9bdf6054d0205e.js +0 -18
  165. package/lib/5343fc74a2893a130daa6ff1bff15621.js +0 -388
  166. package/lib/53ba4b759877a16fe3dbf842b4804538.js +0 -1393
  167. package/lib/540bba54b49ea7a6ec513270449132db.js +0 -9
  168. package/lib/540ec89580e27e662f5b0b323d70fd95.js +0 -18
  169. package/lib/544cdec50f7d5ee773f1023634bc8c59.js +0 -311
  170. package/lib/553aa6bb3b625428f4df57f5885d50f3.js +0 -9
  171. package/lib/557dc611a621064762e5796567cbec28.js +0 -18
  172. package/lib/5589658498306bc6e9b1eaead4b2c222.js +0 -231
  173. package/lib/573b79a51fa9a0e40000dd478d13f4d7.js +0 -184
  174. package/lib/57c2d2eb6a844a8c9ecd932c6d4067b0.js +0 -9
  175. package/lib/59120b5217fb17fd60c30c7f393921f6.js +0 -49
  176. package/lib/59543cab15a42dfc13060f00cf904cb2.js +0 -1860
  177. package/lib/59621f6df1f47f3cdbe959a670025c7b.js +0 -349
  178. package/lib/5b672566d0c18327a0da6515bd9035ab.js +0 -135
  179. package/lib/5bd58f2ebad7e63ff72a891fb43e2b38.js +0 -9
  180. package/lib/5d1543d89f404122d87ebbfb99b51a7a.js +0 -125
  181. package/lib/5df037f2a5d3b5c66d894dcbd21d0816.js +0 -1209
  182. package/lib/5eeee1acc01b04328cf42db0715bb7f5.js +0 -9
  183. package/lib/5f6f5026d13b2a9b884a8144a119cf9e.js +0 -9
  184. package/lib/5fbd38e4ab27403be200a3eb30384030.js +0 -286
  185. package/lib/60da7742294eac1092684664b706b11e.js +0 -632
  186. package/lib/60fc15a66fa7ba74ccd248f85b50fbe5.js +0 -9
  187. package/lib/61c62ea9a6f8f097fef7bbf63bad8923.js +0 -2339
  188. package/lib/6220ec418ec41a0ea2d8800c24bca639.js +0 -213
  189. package/lib/626617463b05d66ef839305eb1ace8e3.js +0 -78
  190. package/lib/62f1660714df9d262535c413ec4535ef.js +0 -16
  191. package/lib/63b236091dce5c38c8150dcf792457ba.js +0 -16
  192. package/lib/64f5157a095478101beea396e6f539c2.js +0 -335
  193. package/lib/64f93b6b093bba4147485023263cf65f.js +0 -9
  194. package/lib/65e9e719bfb286e3d617eccd6604bb5f.js +0 -16
  195. package/lib/66de9caaffb9ac6b2762a83eec7b9587.js +0 -9
  196. package/lib/671016bacf5ec687a2b9fe8e1d9e4218.js +0 -18
  197. package/lib/682658f2844cd4eee41af0221bcf8dd6.js +0 -120
  198. package/lib/68cf9a0e1eaff7cc991e970a855108f8.js +0 -9
  199. package/lib/697c2df91bf7c729d317c620a3cd77bd.js +0 -9
  200. package/lib/6ac188cc35ae0d38d3647a2eef17b2fc.js +0 -409
  201. package/lib/6bd258d83c216261a3311d59ba8ee34d.js +0 -18
  202. package/lib/6e88d3943f4c3a068493aad131cd4898.js +0 -9
  203. package/lib/6e9ca56e0fa3e784eab3da45f8d0d8ac.js +0 -9
  204. package/lib/6f0543453c605ea6d673a3bd31dd1090.js +0 -9
  205. package/lib/6ff41783e24317d71bac349acf29459f.js +0 -18
  206. package/lib/70f9578a3a4e83be56a998aacc7fac80.js +0 -449
  207. package/lib/716afffe05a2fc1a2a8f5c34221fba3f.js +0 -278
  208. package/lib/71bbf2d4b6293b54d672c2812fa8323e.js +0 -138
  209. package/lib/727184c92f9da8d8b0c013fd79cf32fe.js +0 -9
  210. package/lib/729151a662f8055d864efe142b48ba27.js +0 -120
  211. package/lib/72ea341d3b973200daae3cdf95fc40f9.js +0 -2691
  212. package/lib/730a06424debf3bfdaf03370df2177bd.js +0 -9
  213. package/lib/731a5afa4ad31a0a038e5742b5e98dd7.js +0 -59
  214. package/lib/73ca62c494dfdfee1f16213f88d5b3bc.js +0 -16
  215. package/lib/73e4df62b3639bb0465a1b59163d2eac.js +0 -361
  216. package/lib/7580bcf90c3e2026e05b37255bf61c1f.js +0 -1293
  217. package/lib/769ae488953faab19b33deee8331b789.js +0 -409
  218. package/lib/7745f3e776488705a38e62f85adad54d.js +0 -16
  219. package/lib/777bbf0a7ab200cd0c25bb83731450a5.js +0 -234
  220. package/lib/77cec85a8ab17451a509ed9d3b30df18.js +0 -308
  221. package/lib/781fca4f412ab92c4ebd788467ae2e97.js +0 -378
  222. package/lib/783bd9a28d2a45d4c721a6a89b11699f.js +0 -1067
  223. package/lib/78a7313929094809f734ad2e59e197e3.js +0 -618
  224. package/lib/79e0b3ad503310cab7a365134b0c9cf3.js +0 -2923
  225. package/lib/7a6833382e61e00bee32f0bfa809d003.js +0 -768
  226. package/lib/7b28e997ea39fe6dc3e83c44eca5c587.js +0 -18
  227. package/lib/7cef38946c33fa981d6d2c86c62428e0.js +0 -9
  228. package/lib/7d007aac1c748641b522339e2ac0fbaf.js +0 -2845
  229. package/lib/7d46cd8e5efaac33d5bf823ed4268841.js +0 -9
  230. package/lib/7e98c4d98664d6f7bcc52a07f21a1f9f.js +0 -9
  231. package/lib/7f10fe526aec57bd522af77ea6ac2b62.js +0 -9
  232. package/lib/80eb1b0b5703e92094de41a810d24007.js +0 -443
  233. package/lib/8105009e77ebb88abf8665ac5ae28c91.js +0 -227
  234. package/lib/814057700de193461611e3e87fe31b9c.js +0 -1610
  235. package/lib/81508a4a9fff65810b6f8e17ce3996a7.js +0 -456
  236. package/lib/817d52a47a4657b8a4dab79e057f5fb0.js +0 -9
  237. package/lib/822a4447c3ed956ee2e4620cb476d60e.js +0 -392
  238. package/lib/833b242747fd7b098d46011e4289bc3f.js +0 -9
  239. package/lib/83ea78d42f1a8e5f7346f3a30140ebfb.js +0 -9
  240. package/lib/8556209505fb59065be2b2447cfdb25d.js +0 -750
  241. package/lib/857bad1d4069806ce36bacbedb429722.js +0 -14259
  242. package/lib/86080d8c5fe43520ce7a6e70a2eb4732.js +0 -516
  243. package/lib/867fb2b26eef123915aff8634c0bbf4a.js +0 -9
  244. package/lib/87b758062566250308e676d10074337b.js +0 -136
  245. package/lib/8833a126ef9d8892bfb372d227f7f088.js +0 -9
  246. package/lib/8870430db332faf22d90e12f1620ee84.js +0 -9
  247. package/lib/892f2033266a9827d3bf6bd4315677bc.js +0 -18
  248. package/lib/89859a411a50c90f1e669deaf8a6775f.js +0 -9
  249. package/lib/89a47a0051ac0b3885ef8af2476526f0.js +0 -9
  250. package/lib/89b4957483c0fda92fa78a9fa2af1645.js +0 -92
  251. package/lib/8a8a1644af027b4abdb3d6083c9955d8.js +0 -288
  252. package/lib/8abeef6a68ee08e5bf12281dec186e2c.js +0 -108
  253. package/lib/8b06720820b9c72663405e0b3a3d2001.js +0 -1395
  254. package/lib/8b403118d591f67d12f9885715ee4ad5.js +0 -502
  255. package/lib/8b6c6eddf77150952b8fbf4e5efe2700.js +0 -16
  256. package/lib/8bdee0874b771c1eb1f31ff621294dc4.js +0 -212
  257. package/lib/8c530519258e4b3b00a0692332d85bbf.js +0 -4770
  258. package/lib/8c5f030ed5d170844b1b3583cecf54c4.js +0 -321
  259. package/lib/8c66a2b37b2c38fa00a15c2a7450947e.js +0 -1906
  260. package/lib/8ed43cdfdd838056af84f9840f79af2d.js +0 -129
  261. package/lib/8f2a42fe0e894777b68908b3a78b82f5.js +0 -346
  262. package/lib/90643b9da87302fef490f3f48af806e2.js +0 -9
  263. package/lib/909037dfc8091283e4134bc6e5448e2b.js +0 -9
  264. package/lib/9142b3f5bf59ae79b69c505c6964f395.js +0 -16
  265. package/lib/91c7448bc6eb27a1d06db8e292e1a8cf.js +0 -555
  266. package/lib/92c379ded8761c0541b8e1d165ba781d.js +0 -232
  267. package/lib/92cf63e9a949f08d97a74d9ed17392ed.js +0 -9
  268. package/lib/9405408bc4c1c18469c1eefd766f06b9.js +0 -274
  269. package/lib/94a0179602c94d55621a35e41c97ed5c.js +0 -9
  270. package/lib/96801bb73ed08f0f25218527e5bdaaa7.js +0 -18
  271. package/lib/96e3c47a608b9a6e9362ff9d05bbc860.js +0 -18
  272. package/lib/9737a936e499f40b0c36f497031321b1.js +0 -208
  273. package/lib/97d15c029119bb1a0a1640736097aa31.js +0 -16
  274. package/lib/97fdcd4009ecde2477e3c1a605932517.js +0 -272
  275. package/lib/985b400088bf5e23fb83e70d9948eccb.js +0 -9
  276. package/lib/9874181c924bc65b0e3b8f51b3ae93df.js +0 -16
  277. package/lib/9955feb95d88844fc661cfa178ea4694.js +0 -3277
  278. package/lib/998c5f13555e18b42e9bf826578b2e16.js +0 -9
  279. package/lib/99fc1d5bce3320a8fbf9ce9a8d6b9e2f.js +0 -16
  280. package/lib/9aafe4a55ece5a23a8c7658cc25325fc.js +0 -16
  281. package/lib/9accd7b58ca45adc71ff333cb4c52eee.js +0 -18
  282. package/lib/9b24c141c4ab1fb899b2b0f1b8ee33ac.js +0 -16
  283. package/lib/9c202aefac35a5ff49d3d3795e9932bc.js +0 -9
  284. package/lib/9d0f4f65be2f50ad54488089f126feda.js +0 -9
  285. package/lib/9d8bbe9529a9f66ee4d6c4f6f376fa2c.js +0 -1381
  286. package/lib/9e357a97da26127713394684a51946b8.js +0 -9
  287. package/lib/9e4e95d996934ef66be6d1a85e3664c2.js +0 -18
  288. package/lib/9e69cb39701c3578226b39536edd4dd7.js +0 -9
  289. package/lib/9e83fd7a5db2121eb7faae412c537d5c.js +0 -477
  290. package/lib/9eea27d77b60c76da9cc3893debdeda7.js +0 -74
  291. package/lib/a07b6e4197eca283e090784508b6d540.js +0 -2381
  292. package/lib/a0e8234e951b18226479ae8e42b1c93d.js +0 -357
  293. package/lib/a19137421c9f3cc98071541e5e963bde.js +0 -98
  294. package/lib/a19af7abc527c42ce54ba987a9415f60.js +0 -279
  295. package/lib/a26463d029a2515171748a1ebcca53c3.js +0 -9
  296. package/lib/a311e02008e0f00a37305a12d479159a.js +0 -9
  297. package/lib/a3c1e3c29abb7292332b270897165234.js +0 -586
  298. package/lib/a4e757143b7d39ef56b848ed1d29c6da.js +0 -2409
  299. package/lib/a53f122656a01ecdca71c42673652f34.js +0 -4072
  300. package/lib/a57084011e3d6966b4b6efca1f38ae67.js +0 -18
  301. package/lib/a622989f636724d14d53e8d14109fde1.js +0 -346
  302. package/lib/a62714eeb3aaae12f4a27774e869ee6f.js +0 -255
  303. package/lib/a81cd084ae545af4318d919f40a91fa2.js +0 -318
  304. package/lib/a861e5537ad18a87bd993445c930764c.js +0 -309
  305. package/lib/a8f124f2e0e0523eb45659ef81ec2a8b.js +0 -186
  306. package/lib/aaf660b90ac538fc99a895fa3834507c.js +0 -322
  307. package/lib/ab16c1237e6e04bbf0024ee2bae42130.js +0 -9
  308. package/lib/ab629526f508af92330c5df96676044d.js +0 -18
  309. package/lib/ab97e619322ba5f39d521ef73502cf48.js +0 -204
  310. package/lib/acc30207efba7ab5b7b509b599f37e6f.js +0 -9
  311. package/lib/ad806674b28b94be3406af2d34899870.js +0 -16
  312. package/lib/adbb57fa182dce548204311d3be6dffa.js +0 -9
  313. package/lib/add52c11fde0c2170a733fb50e8115db.js +0 -2454
  314. package/lib/ae3310b649786304c4aac9ab5d423e94.js +0 -475
  315. package/lib/aecb26a2eb6c7e44cf7b73ef096dc6a5.js +0 -164
  316. package/lib/afb72b77b4edf3430441b8280c9fb6a9.js +0 -9
  317. package/lib/b02513e1d0cc664936e1ba9cb5a923af.js +0 -9
  318. package/lib/b131314d1ea62fa7bba91a4da8360298.js +0 -9
  319. package/lib/b26ac1601176c0fde051d667e573863f.js +0 -2436
  320. package/lib/b2ea05f3f240a06db30a5de0fa5012b2.js +0 -1459
  321. package/lib/b435aebcb57d65080cfd510e0a9d5d9d.js +0 -9
  322. package/lib/b830d88aa22a866a208be27af90526a7.js +0 -9
  323. package/lib/b8c600a9527c786c1cc59d21f60193ed.js +0 -742
  324. package/lib/bae95bdb1bbcc0969e0e40fb72539df3.js +0 -9
  325. package/lib/bb7afd142656785e03deb43ec5d49526.js +0 -323
  326. package/lib/bbd62124f6d03e01eb4332f55ead999d.js +0 -9
  327. package/lib/bbfbf8a18d2c6b577f613f7684e13d4b.js +0 -380
  328. package/lib/bc26ab0797e975ba01e701683935864b.js +0 -9
  329. package/lib/beebd365e9d52fb45e4e2e0e8f3f25f3.js +0 -78
  330. package/lib/c051c769f84d00d933e12224dfaebd7b.js +0 -7090
  331. package/lib/c088ea7c1fc0c66a644a908ecad590e6.js +0 -1401
  332. package/lib/c23b1f80ab9746b425f3848bdaacc144.js +0 -9
  333. package/lib/c2b4975093d5885f2e8ff09c4fabe8f7.js +0 -27
  334. package/lib/c2ded7fafb683b89f9fb51f37400cfb5.js +0 -602
  335. package/lib/c38a3226f3858a47ba9fb788dc7b44fc.js +0 -9
  336. package/lib/c3b0cd15adcc12a549e7ac5d165ac1f4.js +0 -9
  337. package/lib/c3ee66447735372b0459983d11153db5.js +0 -16
  338. package/lib/c448dbcc87b3a8382bc29284f8ccd11f.js +0 -318
  339. package/lib/c57721ccc0d5a41063560477b0bc7d02.js +0 -457
  340. package/lib/c6c186b45f36f18d9ce1fb2bc07fa5e3.js +0 -272
  341. package/lib/c6f608398c43e25821557ee65cda5e58.js +0 -9
  342. package/lib/c7ce5b5383c7658be6582f9712b20241.js +0 -790
  343. package/lib/c7d3b0afe7600a632fbf44ee8d84996e.js +0 -9
  344. package/lib/c839f8e61d644bd6930589eff240ff48.js +0 -5841
  345. package/lib/c8fa7b978e3d1a3d8871518e9cb83968.js +0 -293
  346. package/lib/c99de01dd8fcf7af2080074f8a3e8ef6.js +0 -18
  347. package/lib/ca1483809659f6c87cc6f588891d2bd4.js +0 -9
  348. package/lib/ca66e3089e6c4a01fceaa4c4675d4da1.js +0 -245
  349. package/lib/cad6fbe6e921174297d7734303ba247a.js +0 -387
  350. package/lib/cbc9092524363d014f77a62f36ff1540.js +0 -174
  351. package/lib/cbd92a6b4e6e2fc9ea2464d82df1305d.js +0 -374
  352. package/lib/cf0a04afa21ac9ba23a1de0416a03105.js +0 -9
  353. package/lib/cf6b4e5dec4a192e62b1dcb7878bc5bb.js +0 -19
  354. package/lib/cf90a0e6a2989274c84edd1dc44db5e1.js +0 -318
  355. package/lib/cfbb8ac8b034c4ecdb1d74d5a0aa997e.js +0 -210
  356. package/lib/d005c2353bc934b0d4fc4238808f1259.js +0 -19
  357. package/lib/d112fccc383541781adddd56d2d29a7d.js +0 -1329
  358. package/lib/d2bee538ff0c2eb104ee3a32dc6545de.js +0 -16
  359. package/lib/d359506111994701cea5613b7666f1c0.js +0 -18
  360. package/lib/d37f0f78c06e883be0e04a3be861fb68.js +0 -277
  361. package/lib/d424588d01445a9c14ec1f5681eca0e6.js +0 -69
  362. package/lib/d465c0a35c6ef244bf587b0e6bdb4019.js +0 -9
  363. package/lib/d4b6ff63e9caf8e009194725fdb28294.js +0 -2589
  364. package/lib/d58a44852ccf290e290f798d594ceaf1.js +0 -116
  365. package/lib/d59d13db0f151770597f301a137ee206.js +0 -554
  366. package/lib/d66813bade53d7a1eeb0fb22223c9120.js +0 -9
  367. package/lib/d6ea3dc0dc78e3b4768d60556ec71aae.js +0 -921
  368. package/lib/d750a8dbf9dd09c0a33b9986e79e3c8c.js +0 -9
  369. package/lib/d754905fe54aac6f3c350df34f51a0b6.js +0 -9
  370. package/lib/d7889907dbb51f58ceadb3e1eec03a5d.js +0 -9
  371. package/lib/d8d4867d7fff5b67bbbdd47e637b3a6c.js +0 -17
  372. package/lib/da0827f4d8af0fc29eb75e28166177d3.js +0 -16
  373. package/lib/dab7702d658b1b41983f79f5bcac4fd7.js +0 -2502
  374. package/lib/dabc32896dd99d88e7b0f27f99d9f3d1.js +0 -199
  375. package/lib/db6c0056cef31f6654438a92a8aca336.js +0 -16
  376. package/lib/dbfe76a5b35e105c53ee5e24e7aecea9.js +0 -16
  377. package/lib/dd0c5a4ed6f5fb11d7cf1f1eff6d60e0.js +0 -243
  378. package/lib/dd40dfc7840568927fdef65087a233ed.js +0 -9
  379. package/lib/dda326057180e4a9865574a97d14bcc5.js +0 -498
  380. package/lib/de020738b0103e8faeb314d46d9c2c01.js +0 -239
  381. package/lib/de055fa0609f610ae1992b080f00c59e.js +0 -19
  382. package/lib/df45474c1375a8a5476097ade35f708c.js +0 -130
  383. package/lib/dfcf55f148a1c3a275c32ba307579b9b.js +0 -262
  384. package/lib/e03035341d2106650617dd1fcc8f9449.js +0 -16
  385. package/lib/e0a28b17e30569d83ad05f7d1a29fc11.js +0 -18
  386. package/lib/e0e2b1267a5d4acb4dda3a4a598cd8a5.js +0 -9
  387. package/lib/e100a40535c8ae342c0ad33bcd5d64a9.js +0 -585
  388. package/lib/e110e3db3be6ddf70601eb2702f22acf.js +0 -313
  389. package/lib/e12b5d4b9067b678942c6e49b6e982ac.js +0 -480
  390. package/lib/e19330270e6bc1ee8999d324a435aadf.js +0 -200
  391. package/lib/e2792218bae78a6aef6764de4e61fd82.js +0 -9
  392. package/lib/e28135172e9bc8cda916c86776d44203.js +0 -9
  393. package/lib/e2d132960212ec2beddd241dd7593d2b.js +0 -1332
  394. package/lib/e354197c37ec292280f982aba242ae46.js +0 -110
  395. package/lib/e365a7884e56d015bf238dff35e12cd0.js +0 -10843
  396. package/lib/e3d11b16ffc27b99f8fa8dc16d1474a5.js +0 -16
  397. package/lib/e479a0392cfe75cd566a510cf0a9cbf1.js +0 -316
  398. package/lib/e4d51c8b4202d444cb39db4e7642d7d9.js +0 -9
  399. package/lib/e6555a04d885d35af1b77d1ea7f71374.js +0 -265
  400. package/lib/e6a1d1f679385aaa06472b3ba6a31104.js +0 -16
  401. package/lib/e6b156303e195d37bbaf6bc12cecbbb5.js +0 -2935
  402. package/lib/e6debe4d13e93851fa0535e27f258266.js +0 -2474
  403. package/lib/e728712368c13c8aab76ad59e143b345.js +0 -9
  404. package/lib/e745f8fb4f054a3f5b66ccad100a1217.js +0 -9
  405. package/lib/e85c03bb74a03136c066c6e2093c5014.js +0 -18
  406. package/lib/e85d326b81c95df9bb7325c6468b61ba.js +0 -201
  407. package/lib/e86b459e406840ac8eaf63fcfcf817e5.js +0 -264
  408. package/lib/e8b30aff1e922139ce1feffb337fdf58.js +0 -150
  409. package/lib/e96618f2248a28f9239a2c652eff0b1e.js +0 -287
  410. package/lib/e970a8b8e51d2b1fe9d44e1b2c741ff1.js +0 -16
  411. package/lib/ea89161d379a9e55da8a3ecf89b2431b.js +0 -183
  412. package/lib/ec0bbb0ae01a2eac8dd4f36da4eb1e73.js +0 -74
  413. package/lib/ed4e3116f7d95675f9f2ccd0ede27490.js +0 -252
  414. package/lib/ed72112dc346ee7976809d4693f0dcba.js +0 -16
  415. package/lib/edd8457765d7fc38c3fc00b71e3dcce0.js +0 -18
  416. package/lib/efc508c36f4e417ec6bd5ec72989443b.js +0 -9
  417. package/lib/f017fb07fd7b0b8db9c5341bec72eb34.js +0 -395
  418. package/lib/f13fe511a9069c65f44deab412b47724.js +0 -836
  419. package/lib/f1e5afe8cfefc6ab380dd2510f4e331d.js +0 -2611
  420. package/lib/f2195d2eae3dbef7e3798e115209dcd7.js +0 -9
  421. package/lib/f233af729cc30f9b3af99d3e9a0a2409.js +0 -256
  422. package/lib/f2494721164a79754987fc480a293ddc.js +0 -557
  423. package/lib/f2cd6e7579511c57435b54b760147916.js +0 -443
  424. package/lib/f2cfc0e604350e23bfcd7c78165b1411.js +0 -9
  425. package/lib/f2e306454ac91234ddb8a5c6a838635b.js +0 -94
  426. package/lib/f34c660c7a713eb0664cc9e6a48e85ce.js +0 -18
  427. package/lib/f36f4038005be804fc28f2cf96e89ca4.js +0 -3519
  428. package/lib/f3a0f6e7e442de2ae51eddbf4eb98d97.js +0 -9
  429. package/lib/f3de8b166131cd8116c58b72e74de979.js +0 -56
  430. package/lib/f50d7c4ce743ce495230d19bd33fefab.js +0 -9
  431. package/lib/f5292be525fc36a337ce7bfb792070de.js +0 -9
  432. package/lib/f56d1624f84c7ea412383f5dc2535fe5.js +0 -3380
  433. package/lib/f61f1aaed3f32a7dabd977a6f47ecd5f.js +0 -9
  434. package/lib/f6d0fea0854403a43f86a04e3db40850.js +0 -16
  435. package/lib/f6e49568b937ae1f55e5fd35391456e6.js +0 -9
  436. package/lib/f7443e8232a7e4289b9f2ed4a512750c.js +0 -9
  437. package/lib/f80c6eb0f52a68464b21211240e3d6e6.js +0 -9
  438. package/lib/f81ee1c4aaf66bb5c9c3b56816fcf9ec.js +0 -18
  439. package/lib/f88127ad8950e3c94c3af6c65a7120fa.js +0 -9
  440. package/lib/f9395802478bac162b30e96f9124ab98.js +0 -275
  441. package/lib/f98a70bc7ea9c1711963a8879739b6ec.js +0 -210
  442. package/lib/fa100e0900a8c3255a4388d06ee51ed0.js +0 -513
  443. package/lib/fa1618cda4da7d5362c381ea2d5f7321.js +0 -9
  444. package/lib/faf460076b3383fdc3ecc224068964cf.js +0 -9
  445. package/lib/fafa44ae58fa8a874e008aa32408cb02.js +0 -2438
  446. package/lib/fb9eb8450ed17fce1ab64c6f239c0ed5.js +0 -270
  447. package/lib/fc2291e5687166730bc9040250deb4dc.js +0 -192
  448. package/lib/fc6ba43496896432983dff35a140ed34.js +0 -324
  449. package/lib/fe4607153f9dc163f7fcfd9e5112d082.js +0 -18
  450. package/lib/fea21d07929a3bfd1791e338b3643845.js +0 -8913
  451. package/lib/ffa203dcaae3e64846fe72a12c66f52a.js +0 -16
  452. package/lib/ffa6632dc8b1f24b217b89a5976d340c.js +0 -1487
  453. package/lib/fffbc895129cdb3efeafa5b234743aa0.js +0 -9
  454. /package/lib/{ca5623b927b1e84f612a0d33b758dc07.js → 03a5f5b2b97a8fc289399d92fba810d0.js} +0 -0
  455. /package/lib/{0b3587e0f3fd518d1ec22d14ba147660.js → 0d5aa4cf4cd6ced22d689adc35468925.js} +0 -0
  456. /package/lib/{615baa5f68e26f620f7e032683bd4b50.js → 237d897892d45083fa60f6b81d5254ee.js} +0 -0
  457. /package/lib/{503f9ce3546623bbbbb78ee6363d7a79.js → 283970c76db99e2d0d90f0e7c45494f9.js} +0 -0
  458. /package/lib/{acc7448b80728a73c9a4046b3ec4407f.js → 28785bea435918d49b290d27bf660baa.js} +0 -0
  459. /package/lib/{1840080076c4078d157a5b05d0d95551.js → 2fc0239242a898632ca8aa451cb930c2.js} +0 -0
  460. /package/lib/{80c81bb26b21258a1b765122345ec38b.js → 367def81f25c0a08527f9a4e86e70c56.js} +0 -0
  461. /package/lib/{643ef4de6914010141d57fcfbb21823f.js → 41ae585cdbb9c2e8eefff5d30193029f.js} +0 -0
  462. /package/lib/{c6d4a590e14107a8a5ad505d66241032.js → 5e55b301888460bd06c8e26d1011e01a.js} +0 -0
  463. /package/lib/{c9b9a1dd6c2e609511c3361642370120.js → 62a96977e725e8bc809dc80afe0fedf1.js} +0 -0
  464. /package/lib/{1a68c4ad5a712aab108814672bf0e7b7.js → 6c6d192b6860b4508a14c2d04769a35e.js} +0 -0
  465. /package/lib/{039af9192b9bb277966ceb4e4ce29c41.js → 8a31266178067a316bb2503147cdb5cb.js} +0 -0
  466. /package/lib/{0510e05d595927fa703cb56d8f13065d.js → 8c6220f01c8d5232db7dd6f8410fae08.js} +0 -0
  467. /package/lib/{014f8e91bc4baf39175490216b0e3ae3.js → 947d538f92dd1e146e4a3c41e4eacb92.js} +0 -0
  468. /package/lib/{6813d64f169561dbff03e9a9c462ba83.js → a2746fc96d535b19c120d4b87dc86ef1.js} +0 -0
  469. /package/lib/{a1126819c6d0a10f20464c174f78fcfb.js → a709bba98acec5da3ea6258e245514cb.js} +0 -0
  470. /package/lib/{fd5c5250dc8b0ef84eec8e5e54d6588f.js → add6c4cce3d9d8f1de24094ebb4bfa5b.js} +0 -0
  471. /package/lib/{8d5f887ab72833490ccc03f5855f4d4f.js → b13d991d1e4a016abea3fe5837261690.js} +0 -0
  472. /package/lib/{49852db8b337fb8e781a58d82c81ead5.js → c3832579be376308fa819b04e7b0c66f.js} +0 -0
  473. /package/lib/{a1561f47e5391d4d132a0ec704474d90.js → cc65d108f0e7cfb200de1d0bcf115005.js} +0 -0
  474. /package/lib/{f58ee8ca364e28090c10b602eef235b1.js → d83cda12aee0c87c8b381a1234bf7798.js} +0 -0
  475. /package/lib/{69e9e34a4d2799561f7d50987beb9387.js → fd39a83fd8083f7924f23beb597cb741.js} +0 -0
@@ -1,3380 +0,0 @@
1
- ace.define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"], function(require, exports, module){"use strict";
2
- var dom = require("./lib/dom");
3
- var oop = require("./lib/oop");
4
- var EventEmitter = require("./lib/event_emitter").EventEmitter;
5
- var lang = require("./lib/lang");
6
- var Range = require("./range").Range;
7
- var RangeList = require("./range_list").RangeList;
8
- var HashHandler = require("./keyboard/hash_handler").HashHandler;
9
- var Tokenizer = require("./tokenizer").Tokenizer;
10
- var clipboard = require("./clipboard");
11
- var VARIABLES = {
12
- CURRENT_WORD: function (editor) {
13
- return editor.session.getTextRange(editor.session.getWordRange());
14
- },
15
- SELECTION: function (editor, name, indentation) {
16
- var text = editor.session.getTextRange();
17
- if (indentation)
18
- return text.replace(/\n\r?([ \t]*\S)/g, "\n" + indentation + "$1");
19
- return text;
20
- },
21
- CURRENT_LINE: function (editor) {
22
- return editor.session.getLine(editor.getCursorPosition().row);
23
- },
24
- PREV_LINE: function (editor) {
25
- return editor.session.getLine(editor.getCursorPosition().row - 1);
26
- },
27
- LINE_INDEX: function (editor) {
28
- return editor.getCursorPosition().row;
29
- },
30
- LINE_NUMBER: function (editor) {
31
- return editor.getCursorPosition().row + 1;
32
- },
33
- SOFT_TABS: function (editor) {
34
- return editor.session.getUseSoftTabs() ? "YES" : "NO";
35
- },
36
- TAB_SIZE: function (editor) {
37
- return editor.session.getTabSize();
38
- },
39
- CLIPBOARD: function (editor) {
40
- return clipboard.getText && clipboard.getText();
41
- },
42
- FILENAME: function (editor) {
43
- return /[^/\\]*$/.exec(this.FILEPATH(editor))[0];
44
- },
45
- FILENAME_BASE: function (editor) {
46
- return /[^/\\]*$/.exec(this.FILEPATH(editor))[0].replace(/\.[^.]*$/, "");
47
- },
48
- DIRECTORY: function (editor) {
49
- return this.FILEPATH(editor).replace(/[^/\\]*$/, "");
50
- },
51
- FILEPATH: function (editor) { return "/not implemented.txt"; },
52
- WORKSPACE_NAME: function () { return "Unknown"; },
53
- FULLNAME: function () { return "Unknown"; },
54
- BLOCK_COMMENT_START: function (editor) {
55
- var mode = editor.session.$mode || {};
56
- return mode.blockComment && mode.blockComment.start || "";
57
- },
58
- BLOCK_COMMENT_END: function (editor) {
59
- var mode = editor.session.$mode || {};
60
- return mode.blockComment && mode.blockComment.end || "";
61
- },
62
- LINE_COMMENT: function (editor) {
63
- var mode = editor.session.$mode || {};
64
- return mode.lineCommentStart || "";
65
- },
66
- CURRENT_YEAR: date.bind(null, { year: "numeric" }),
67
- CURRENT_YEAR_SHORT: date.bind(null, { year: "2-digit" }),
68
- CURRENT_MONTH: date.bind(null, { month: "numeric" }),
69
- CURRENT_MONTH_NAME: date.bind(null, { month: "long" }),
70
- CURRENT_MONTH_NAME_SHORT: date.bind(null, { month: "short" }),
71
- CURRENT_DATE: date.bind(null, { day: "2-digit" }),
72
- CURRENT_DAY_NAME: date.bind(null, { weekday: "long" }),
73
- CURRENT_DAY_NAME_SHORT: date.bind(null, { weekday: "short" }),
74
- CURRENT_HOUR: date.bind(null, { hour: "2-digit", hour12: false }),
75
- CURRENT_MINUTE: date.bind(null, { minute: "2-digit" }),
76
- CURRENT_SECOND: date.bind(null, { second: "2-digit" })
77
- };
78
- VARIABLES.SELECTED_TEXT = VARIABLES.SELECTION;
79
- function date(dateFormat) {
80
- var str = new Date().toLocaleString("en-us", dateFormat);
81
- return str.length == 1 ? "0" + str : str;
82
- }
83
- var SnippetManager = /** @class */ (function () {
84
- function SnippetManager() {
85
- this.snippetMap = {};
86
- this.snippetNameMap = {};
87
- this.variables = VARIABLES;
88
- }
89
- SnippetManager.prototype.getTokenizer = function () {
90
- return SnippetManager["$tokenizer"] || this.createTokenizer();
91
- };
92
- SnippetManager.prototype.createTokenizer = function () {
93
- function TabstopToken(str) {
94
- str = str.substr(1);
95
- if (/^\d+$/.test(str))
96
- return [{ tabstopId: parseInt(str, 10) }];
97
- return [{ text: str }];
98
- }
99
- function escape(ch) {
100
- return "(?:[^\\\\" + ch + "]|\\\\.)";
101
- }
102
- var formatMatcher = {
103
- regex: "/(" + escape("/") + "+)/",
104
- onMatch: function (val, state, stack) {
105
- var ts = stack[0];
106
- ts.fmtString = true;
107
- ts.guard = val.slice(1, -1);
108
- ts.flag = "";
109
- return "";
110
- },
111
- next: "formatString"
112
- };
113
- SnippetManager["$tokenizer"] = new Tokenizer({
114
- start: [
115
- { regex: /\\./, onMatch: function (val, state, stack) {
116
- var ch = val[1];
117
- if (ch == "}" && stack.length) {
118
- val = ch;
119
- }
120
- else if ("`$\\".indexOf(ch) != -1) {
121
- val = ch;
122
- }
123
- return [val];
124
- } },
125
- { regex: /}/, onMatch: function (val, state, stack) {
126
- return [stack.length ? stack.shift() : val];
127
- } },
128
- { regex: /\$(?:\d+|\w+)/, onMatch: TabstopToken },
129
- { regex: /\$\{[\dA-Z_a-z]+/, onMatch: function (str, state, stack) {
130
- var t = TabstopToken(str.substr(1));
131
- stack.unshift(t[0]);
132
- return t;
133
- }, next: "snippetVar" },
134
- { regex: /\n/, token: "newline", merge: false }
135
- ],
136
- snippetVar: [
137
- { regex: "\\|" + escape("\\|") + "*\\|", onMatch: function (val, state, stack) {
138
- var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function (operator) {
139
- return operator.length == 2 ? operator[1] : "\x00";
140
- }).split("\x00").map(function (value) {
141
- return { value: value };
142
- });
143
- stack[0].choices = choices;
144
- return [choices[0]];
145
- }, next: "start" },
146
- formatMatcher,
147
- { regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start" }
148
- ],
149
- formatString: [
150
- { regex: /:/, onMatch: function (val, state, stack) {
151
- if (stack.length && stack[0].expectElse) {
152
- stack[0].expectElse = false;
153
- stack[0].ifEnd = { elseEnd: stack[0] };
154
- return [stack[0].ifEnd];
155
- }
156
- return ":";
157
- } },
158
- { regex: /\\./, onMatch: function (val, state, stack) {
159
- var ch = val[1];
160
- if (ch == "}" && stack.length)
161
- val = ch;
162
- else if ("`$\\".indexOf(ch) != -1)
163
- val = ch;
164
- else if (ch == "n")
165
- val = "\n";
166
- else if (ch == "t")
167
- val = "\t";
168
- else if ("ulULE".indexOf(ch) != -1)
169
- val = { changeCase: ch, local: ch > "a" };
170
- return [val];
171
- } },
172
- { regex: "/\\w*}", onMatch: function (val, state, stack) {
173
- var next = stack.shift();
174
- if (next)
175
- next.flag = val.slice(1, -1);
176
- this.next = next && next.tabstopId ? "start" : "";
177
- return [next || val];
178
- }, next: "start" },
179
- { regex: /\$(?:\d+|\w+)/, onMatch: function (val, state, stack) {
180
- return [{ text: val.slice(1) }];
181
- } },
182
- { regex: /\${\w+/, onMatch: function (val, state, stack) {
183
- var token = { text: val.slice(2) };
184
- stack.unshift(token);
185
- return [token];
186
- }, next: "formatStringVar" },
187
- { regex: /\n/, token: "newline", merge: false },
188
- { regex: /}/, onMatch: function (val, state, stack) {
189
- var next = stack.shift();
190
- this.next = next && next.tabstopId ? "start" : "";
191
- return [next || val];
192
- }, next: "start" }
193
- ],
194
- formatStringVar: [
195
- { regex: /:\/\w+}/, onMatch: function (val, state, stack) {
196
- var ts = stack[0];
197
- ts.formatFunction = val.slice(2, -1);
198
- return [stack.shift()];
199
- }, next: "formatString" },
200
- formatMatcher,
201
- { regex: /:[\?\-+]?/, onMatch: function (val, state, stack) {
202
- if (val[1] == "+")
203
- stack[0].ifEnd = stack[0];
204
- if (val[1] == "?")
205
- stack[0].expectElse = true;
206
- }, next: "formatString" },
207
- { regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "formatString" }
208
- ]
209
- });
210
- return SnippetManager["$tokenizer"];
211
- };
212
- SnippetManager.prototype.tokenizeTmSnippet = function (str, startState) {
213
- return this.getTokenizer().getLineTokens(str, startState).tokens.map(function (x) {
214
- return x.value || x;
215
- });
216
- };
217
- SnippetManager.prototype.getVariableValue = function (editor, name, indentation) {
218
- if (/^\d+$/.test(name))
219
- return (this.variables.__ || {})[name] || "";
220
- if (/^[A-Z]\d+$/.test(name))
221
- return (this.variables[name[0] + "__"] || {})[name.substr(1)] || "";
222
- name = name.replace(/^TM_/, "");
223
- if (!this.variables.hasOwnProperty(name))
224
- return "";
225
- var value = this.variables[name];
226
- if (typeof value == "function")
227
- value = this.variables[name](editor, name, indentation);
228
- return value == null ? "" : value;
229
- };
230
- SnippetManager.prototype.tmStrFormat = function (str, ch, editor) {
231
- if (!ch.fmt)
232
- return str;
233
- var flag = ch.flag || "";
234
- var re = ch.guard;
235
- re = new RegExp(re, flag.replace(/[^gim]/g, ""));
236
- var fmtTokens = typeof ch.fmt == "string" ? this.tokenizeTmSnippet(ch.fmt, "formatString") : ch.fmt;
237
- var _self = this;
238
- var formatted = str.replace(re, function () {
239
- var oldArgs = _self.variables.__;
240
- _self.variables.__ = [].slice.call(arguments);
241
- var fmtParts = _self.resolveVariables(fmtTokens, editor);
242
- var gChangeCase = "E";
243
- for (var i = 0; i < fmtParts.length; i++) {
244
- var ch = fmtParts[i];
245
- if (typeof ch == "object") {
246
- fmtParts[i] = "";
247
- if (ch.changeCase && ch.local) {
248
- var next = fmtParts[i + 1];
249
- if (next && typeof next == "string") {
250
- if (ch.changeCase == "u")
251
- fmtParts[i] = next[0].toUpperCase();
252
- else
253
- fmtParts[i] = next[0].toLowerCase();
254
- fmtParts[i + 1] = next.substr(1);
255
- }
256
- }
257
- else if (ch.changeCase) {
258
- gChangeCase = ch.changeCase;
259
- }
260
- }
261
- else if (gChangeCase == "U") {
262
- fmtParts[i] = ch.toUpperCase();
263
- }
264
- else if (gChangeCase == "L") {
265
- fmtParts[i] = ch.toLowerCase();
266
- }
267
- }
268
- _self.variables.__ = oldArgs;
269
- return fmtParts.join("");
270
- });
271
- return formatted;
272
- };
273
- SnippetManager.prototype.tmFormatFunction = function (str, ch, editor) {
274
- if (ch.formatFunction == "upcase")
275
- return str.toUpperCase();
276
- if (ch.formatFunction == "downcase")
277
- return str.toLowerCase();
278
- return str;
279
- };
280
- SnippetManager.prototype.resolveVariables = function (snippet, editor) {
281
- var result = [];
282
- var indentation = "";
283
- var afterNewLine = true;
284
- for (var i = 0; i < snippet.length; i++) {
285
- var ch = snippet[i];
286
- if (typeof ch == "string") {
287
- result.push(ch);
288
- if (ch == "\n") {
289
- afterNewLine = true;
290
- indentation = "";
291
- }
292
- else if (afterNewLine) {
293
- indentation = /^\t*/.exec(ch)[0];
294
- afterNewLine = /\S/.test(ch);
295
- }
296
- continue;
297
- }
298
- if (!ch)
299
- continue;
300
- afterNewLine = false;
301
- if (ch.fmtString) {
302
- var j = snippet.indexOf(ch, i + 1);
303
- if (j == -1)
304
- j = snippet.length;
305
- ch.fmt = snippet.slice(i + 1, j);
306
- i = j;
307
- }
308
- if (ch.text) {
309
- var value = this.getVariableValue(editor, ch.text, indentation) + "";
310
- if (ch.fmtString)
311
- value = this.tmStrFormat(value, ch, editor);
312
- if (ch.formatFunction)
313
- value = this.tmFormatFunction(value, ch, editor);
314
- if (value && !ch.ifEnd) {
315
- result.push(value);
316
- gotoNext(ch);
317
- }
318
- else if (!value && ch.ifEnd) {
319
- gotoNext(ch.ifEnd);
320
- }
321
- }
322
- else if (ch.elseEnd) {
323
- gotoNext(ch.elseEnd);
324
- }
325
- else if (ch.tabstopId != null) {
326
- result.push(ch);
327
- }
328
- else if (ch.changeCase != null) {
329
- result.push(ch);
330
- }
331
- }
332
- function gotoNext(ch) {
333
- var i1 = snippet.indexOf(ch, i + 1);
334
- if (i1 != -1)
335
- i = i1;
336
- }
337
- return result;
338
- };
339
- SnippetManager.prototype.getDisplayTextForSnippet = function (editor, snippetText) {
340
- var processedSnippet = processSnippetText.call(this, editor, snippetText);
341
- return processedSnippet.text;
342
- };
343
- SnippetManager.prototype.insertSnippetForSelection = function (editor, snippetText, options) {
344
- if (options === void 0) { options = {}; }
345
- var processedSnippet = processSnippetText.call(this, editor, snippetText, options);
346
- var range = editor.getSelectionRange();
347
- var end = editor.session.replace(range, processedSnippet.text);
348
- var tabstopManager = new TabstopManager(editor);
349
- var selectionId = editor.inVirtualSelectionMode && editor.selection.index;
350
- tabstopManager.addTabstops(processedSnippet.tabstops, range.start, end, selectionId);
351
- };
352
- SnippetManager.prototype.insertSnippet = function (editor, snippetText, options) {
353
- if (options === void 0) { options = {}; }
354
- var self = this;
355
- if (editor.inVirtualSelectionMode)
356
- return self.insertSnippetForSelection(editor, snippetText, options);
357
- editor.forEachSelection(function () {
358
- self.insertSnippetForSelection(editor, snippetText, options);
359
- }, null, { keepOrder: true });
360
- if (editor.tabstopManager)
361
- editor.tabstopManager.tabNext();
362
- };
363
- SnippetManager.prototype.$getScope = function (editor) {
364
- var scope = editor.session.$mode.$id || "";
365
- scope = scope.split("/").pop();
366
- if (scope === "html" || scope === "php") {
367
- if (scope === "php" && !editor.session.$mode.inlinePhp)
368
- scope = "html";
369
- var c = editor.getCursorPosition();
370
- var state = editor.session.getState(c.row);
371
- if (typeof state === "object") {
372
- state = state[0];
373
- }
374
- if (state.substring) {
375
- if (state.substring(0, 3) == "js-")
376
- scope = "javascript";
377
- else if (state.substring(0, 4) == "css-")
378
- scope = "css";
379
- else if (state.substring(0, 4) == "php-")
380
- scope = "php";
381
- }
382
- }
383
- return scope;
384
- };
385
- SnippetManager.prototype.getActiveScopes = function (editor) {
386
- var scope = this.$getScope(editor);
387
- var scopes = [scope];
388
- var snippetMap = this.snippetMap;
389
- if (snippetMap[scope] && snippetMap[scope].includeScopes) {
390
- scopes.push.apply(scopes, snippetMap[scope].includeScopes);
391
- }
392
- scopes.push("_");
393
- return scopes;
394
- };
395
- SnippetManager.prototype.expandWithTab = function (editor, options) {
396
- var self = this;
397
- var result = editor.forEachSelection(function () {
398
- return self.expandSnippetForSelection(editor, options);
399
- }, null, { keepOrder: true });
400
- if (result && editor.tabstopManager)
401
- editor.tabstopManager.tabNext();
402
- return result;
403
- };
404
- SnippetManager.prototype.expandSnippetForSelection = function (editor, options) {
405
- var cursor = editor.getCursorPosition();
406
- var line = editor.session.getLine(cursor.row);
407
- var before = line.substring(0, cursor.column);
408
- var after = line.substr(cursor.column);
409
- var snippetMap = this.snippetMap;
410
- var snippet;
411
- this.getActiveScopes(editor).some(function (scope) {
412
- var snippets = snippetMap[scope];
413
- if (snippets)
414
- snippet = this.findMatchingSnippet(snippets, before, after);
415
- return !!snippet;
416
- }, this);
417
- if (!snippet)
418
- return false;
419
- if (options && options.dryRun)
420
- return true;
421
- editor.session.doc.removeInLine(cursor.row, cursor.column - snippet.replaceBefore.length, cursor.column + snippet.replaceAfter.length);
422
- this.variables.M__ = snippet.matchBefore;
423
- this.variables.T__ = snippet.matchAfter;
424
- this.insertSnippetForSelection(editor, snippet.content);
425
- this.variables.M__ = this.variables.T__ = null;
426
- return true;
427
- };
428
- SnippetManager.prototype.findMatchingSnippet = function (snippetList, before, after) {
429
- for (var i = snippetList.length; i--;) {
430
- var s = snippetList[i];
431
- if (s.startRe && !s.startRe.test(before))
432
- continue;
433
- if (s.endRe && !s.endRe.test(after))
434
- continue;
435
- if (!s.startRe && !s.endRe)
436
- continue;
437
- s.matchBefore = s.startRe ? s.startRe.exec(before) : [""];
438
- s.matchAfter = s.endRe ? s.endRe.exec(after) : [""];
439
- s.replaceBefore = s.triggerRe ? s.triggerRe.exec(before)[0] : "";
440
- s.replaceAfter = s.endTriggerRe ? s.endTriggerRe.exec(after)[0] : "";
441
- return s;
442
- }
443
- };
444
- SnippetManager.prototype.register = function (snippets, scope) {
445
- var snippetMap = this.snippetMap;
446
- var snippetNameMap = this.snippetNameMap;
447
- var self = this;
448
- if (!snippets)
449
- snippets = [];
450
- function wrapRegexp(src) {
451
- if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src))
452
- src = "(?:" + src + ")";
453
- return src || "";
454
- }
455
- function guardedRegexp(re, guard, opening) {
456
- re = wrapRegexp(re);
457
- guard = wrapRegexp(guard);
458
- if (opening) {
459
- re = guard + re;
460
- if (re && re[re.length - 1] != "$")
461
- re = re + "$";
462
- }
463
- else {
464
- re = re + guard;
465
- if (re && re[0] != "^")
466
- re = "^" + re;
467
- }
468
- return new RegExp(re);
469
- }
470
- function addSnippet(s) {
471
- if (!s.scope)
472
- s.scope = scope || "_";
473
- scope = s.scope;
474
- if (!snippetMap[scope]) {
475
- snippetMap[scope] = [];
476
- snippetNameMap[scope] = {};
477
- }
478
- var map = snippetNameMap[scope];
479
- if (s.name) {
480
- var old = map[s.name];
481
- if (old)
482
- self.unregister(old);
483
- map[s.name] = s;
484
- }
485
- snippetMap[scope].push(s);
486
- if (s.prefix)
487
- s.tabTrigger = s.prefix;
488
- if (!s.content && s.body)
489
- s.content = Array.isArray(s.body) ? s.body.join("\n") : s.body;
490
- if (s.tabTrigger && !s.trigger) {
491
- if (!s.guard && /^\w/.test(s.tabTrigger))
492
- s.guard = "\\b";
493
- s.trigger = lang.escapeRegExp(s.tabTrigger);
494
- }
495
- if (!s.trigger && !s.guard && !s.endTrigger && !s.endGuard)
496
- return;
497
- s.startRe = guardedRegexp(s.trigger, s.guard, true);
498
- s.triggerRe = new RegExp(s.trigger);
499
- s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true);
500
- s.endTriggerRe = new RegExp(s.endTrigger);
501
- }
502
- if (Array.isArray(snippets)) {
503
- snippets.forEach(addSnippet);
504
- }
505
- else {
506
- Object.keys(snippets).forEach(function (key) {
507
- addSnippet(snippets[key]);
508
- });
509
- }
510
- this._signal("registerSnippets", { scope: scope });
511
- };
512
- SnippetManager.prototype.unregister = function (snippets, scope) {
513
- var snippetMap = this.snippetMap;
514
- var snippetNameMap = this.snippetNameMap;
515
- function removeSnippet(s) {
516
- var nameMap = snippetNameMap[s.scope || scope];
517
- if (nameMap && nameMap[s.name]) {
518
- delete nameMap[s.name];
519
- var map = snippetMap[s.scope || scope];
520
- var i = map && map.indexOf(s);
521
- if (i >= 0)
522
- map.splice(i, 1);
523
- }
524
- }
525
- if (snippets.content)
526
- removeSnippet(snippets);
527
- else if (Array.isArray(snippets))
528
- snippets.forEach(removeSnippet);
529
- };
530
- SnippetManager.prototype.parseSnippetFile = function (str) {
531
- str = str.replace(/\r/g, "");
532
- var list = [], /**@type{Snippet}*/ snippet = {};
533
- var re = /^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;
534
- var m;
535
- while (m = re.exec(str)) {
536
- if (m[1]) {
537
- try {
538
- snippet = JSON.parse(m[1]);
539
- list.push(snippet);
540
- }
541
- catch (e) { }
542
- }
543
- if (m[4]) {
544
- snippet.content = m[4].replace(/^\t/gm, "");
545
- list.push(snippet);
546
- snippet = {};
547
- }
548
- else {
549
- var key = m[2], val = m[3];
550
- if (key == "regex") {
551
- var guardRe = /\/((?:[^\/\\]|\\.)*)|$/g;
552
- snippet.guard = guardRe.exec(val)[1];
553
- snippet.trigger = guardRe.exec(val)[1];
554
- snippet.endTrigger = guardRe.exec(val)[1];
555
- snippet.endGuard = guardRe.exec(val)[1];
556
- }
557
- else if (key == "snippet") {
558
- snippet.tabTrigger = val.match(/^\S*/)[0];
559
- if (!snippet.name)
560
- snippet.name = val;
561
- }
562
- else if (key) {
563
- snippet[key] = val;
564
- }
565
- }
566
- }
567
- return list;
568
- };
569
- SnippetManager.prototype.getSnippetByName = function (name, editor) {
570
- var snippetMap = this.snippetNameMap;
571
- var snippet;
572
- this.getActiveScopes(editor).some(function (scope) {
573
- var snippets = snippetMap[scope];
574
- if (snippets)
575
- snippet = snippets[name];
576
- return !!snippet;
577
- }, this);
578
- return snippet;
579
- };
580
- return SnippetManager;
581
- }());
582
- oop.implement(SnippetManager.prototype, EventEmitter);
583
- var processSnippetText = function (editor, snippetText, options) {
584
- if (options === void 0) { options = {}; }
585
- var cursor = editor.getCursorPosition();
586
- var line = editor.session.getLine(cursor.row);
587
- var tabString = editor.session.getTabString();
588
- var indentString = line.match(/^\s*/)[0];
589
- if (cursor.column < indentString.length)
590
- indentString = indentString.slice(0, cursor.column);
591
- snippetText = snippetText.replace(/\r/g, "");
592
- var tokens = this.tokenizeTmSnippet(snippetText);
593
- tokens = this.resolveVariables(tokens, editor);
594
- tokens = tokens.map(function (x) {
595
- if (x == "\n" && !options.excludeExtraIndent)
596
- return x + indentString;
597
- if (typeof x == "string")
598
- return x.replace(/\t/g, tabString);
599
- return x;
600
- });
601
- var tabstops = [];
602
- tokens.forEach(function (p, i) {
603
- if (typeof p != "object")
604
- return;
605
- var id = p.tabstopId;
606
- var ts = tabstops[id];
607
- if (!ts) {
608
- ts = tabstops[id] = [];
609
- ts.index = id;
610
- ts.value = "";
611
- ts.parents = {};
612
- }
613
- if (ts.indexOf(p) !== -1)
614
- return;
615
- if (p.choices && !ts.choices)
616
- ts.choices = p.choices;
617
- ts.push(p);
618
- var i1 = tokens.indexOf(p, i + 1);
619
- if (i1 === -1)
620
- return;
621
- var value = tokens.slice(i + 1, i1);
622
- var isNested = value.some(function (t) { return typeof t === "object"; });
623
- if (isNested && !ts.value) {
624
- ts.value = value;
625
- }
626
- else if (value.length && (!ts.value || typeof ts.value !== "string")) {
627
- ts.value = value.join("");
628
- }
629
- });
630
- tabstops.forEach(function (ts) { ts.length = 0; });
631
- var expanding = {};
632
- function copyValue(val) {
633
- var copy = [];
634
- for (var i = 0; i < val.length; i++) {
635
- var p = val[i];
636
- if (typeof p == "object") {
637
- if (expanding[p.tabstopId])
638
- continue;
639
- var j = val.lastIndexOf(p, i - 1);
640
- p = copy[j] || { tabstopId: p.tabstopId };
641
- }
642
- copy[i] = p;
643
- }
644
- return copy;
645
- }
646
- for (var i = 0; i < tokens.length; i++) {
647
- var p = tokens[i];
648
- if (typeof p != "object")
649
- continue;
650
- var id = p.tabstopId;
651
- var ts = tabstops[id];
652
- var i1 = tokens.indexOf(p, i + 1);
653
- if (expanding[id]) {
654
- if (expanding[id] === p) {
655
- delete expanding[id];
656
- Object.keys(expanding).forEach(function (parentId) {
657
- ts.parents[parentId] = true;
658
- });
659
- }
660
- continue;
661
- }
662
- expanding[id] = p;
663
- var value = ts.value;
664
- if (typeof value !== "string")
665
- value = copyValue(value);
666
- else if (p.fmt)
667
- value = this.tmStrFormat(value, p, editor);
668
- tokens.splice.apply(tokens, [i + 1, Math.max(0, i1 - i)].concat(value, p));
669
- if (ts.indexOf(p) === -1)
670
- ts.push(p);
671
- }
672
- var row = 0, column = 0;
673
- var text = "";
674
- tokens.forEach(function (t) {
675
- if (typeof t === "string") {
676
- var lines = t.split("\n");
677
- if (lines.length > 1) {
678
- column = lines[lines.length - 1].length;
679
- row += lines.length - 1;
680
- }
681
- else
682
- column += t.length;
683
- text += t;
684
- }
685
- else if (t) {
686
- if (!t.start)
687
- t.start = { row: row, column: column };
688
- else
689
- t.end = { row: row, column: column };
690
- }
691
- });
692
- return {
693
- text: text,
694
- tabstops: tabstops,
695
- tokens: tokens
696
- };
697
- };
698
- var TabstopManager = /** @class */ (function () {
699
- function TabstopManager(editor) {
700
- this.index = 0;
701
- this.ranges = [];
702
- this.tabstops = [];
703
- if (editor.tabstopManager)
704
- return editor.tabstopManager;
705
- editor.tabstopManager = this;
706
- this.$onChange = this.onChange.bind(this);
707
- this.$onChangeSelection = lang.delayedCall(this.onChangeSelection.bind(this)).schedule;
708
- this.$onChangeSession = this.onChangeSession.bind(this);
709
- this.$onAfterExec = this.onAfterExec.bind(this);
710
- this.attach(editor);
711
- }
712
- TabstopManager.prototype.attach = function (editor) {
713
- this.$openTabstops = null;
714
- this.selectedTabstop = null;
715
- this.editor = editor;
716
- this.session = editor.session;
717
- this.editor.on("change", this.$onChange);
718
- this.editor.on("changeSelection", this.$onChangeSelection);
719
- this.editor.on("changeSession", this.$onChangeSession);
720
- this.editor.commands.on("afterExec", this.$onAfterExec);
721
- this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
722
- };
723
- TabstopManager.prototype.detach = function () {
724
- this.tabstops.forEach(this.removeTabstopMarkers, this);
725
- this.ranges.length = 0;
726
- this.tabstops.length = 0;
727
- this.selectedTabstop = null;
728
- this.editor.off("change", this.$onChange);
729
- this.editor.off("changeSelection", this.$onChangeSelection);
730
- this.editor.off("changeSession", this.$onChangeSession);
731
- this.editor.commands.off("afterExec", this.$onAfterExec);
732
- this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
733
- this.editor.tabstopManager = null;
734
- this.session = null;
735
- this.editor = null;
736
- };
737
- TabstopManager.prototype.onChange = function (delta) {
738
- var isRemove = delta.action[0] == "r";
739
- var selectedTabstop = this.selectedTabstop || {};
740
- var parents = selectedTabstop.parents || {};
741
- var tabstops = this.tabstops.slice();
742
- for (var i = 0; i < tabstops.length; i++) {
743
- var ts = tabstops[i];
744
- var active = ts == selectedTabstop || parents[ts.index];
745
- ts.rangeList.$bias = active ? 0 : 1;
746
- if (delta.action == "remove" && ts !== selectedTabstop) {
747
- var parentActive = ts.parents && ts.parents[selectedTabstop.index];
748
- var startIndex = ts.rangeList.pointIndex(delta.start, parentActive);
749
- startIndex = startIndex < 0 ? -startIndex - 1 : startIndex + 1;
750
- var endIndex = ts.rangeList.pointIndex(delta.end, parentActive);
751
- endIndex = endIndex < 0 ? -endIndex - 1 : endIndex - 1;
752
- var toRemove = ts.rangeList.ranges.slice(startIndex, endIndex);
753
- for (var j = 0; j < toRemove.length; j++)
754
- this.removeRange(toRemove[j]);
755
- }
756
- ts.rangeList.$onChange(delta);
757
- }
758
- var session = this.session;
759
- if (!this.$inChange && isRemove && session.getLength() == 1 && !session.getValue())
760
- this.detach();
761
- };
762
- TabstopManager.prototype.updateLinkedFields = function () {
763
- var ts = this.selectedTabstop;
764
- if (!ts || !ts.hasLinkedRanges || !ts.firstNonLinked)
765
- return;
766
- this.$inChange = true;
767
- var session = this.session;
768
- var text = session.getTextRange(ts.firstNonLinked);
769
- for (var i = 0; i < ts.length; i++) {
770
- var range = ts[i];
771
- if (!range.linked)
772
- continue;
773
- var original = range.original;
774
- var fmt = exports.snippetManager.tmStrFormat(text, original, this.editor);
775
- session.replace(range, fmt);
776
- }
777
- this.$inChange = false;
778
- };
779
- TabstopManager.prototype.onAfterExec = function (e) {
780
- if (e.command && !e.command.readOnly)
781
- this.updateLinkedFields();
782
- };
783
- TabstopManager.prototype.onChangeSelection = function () {
784
- if (!this.editor)
785
- return;
786
- var lead = this.editor.selection.lead;
787
- var anchor = this.editor.selection.anchor;
788
- var isEmpty = this.editor.selection.isEmpty();
789
- for (var i = 0; i < this.ranges.length; i++) {
790
- if (this.ranges[i].linked)
791
- continue;
792
- var containsLead = this.ranges[i].contains(lead.row, lead.column);
793
- var containsAnchor = isEmpty || this.ranges[i].contains(anchor.row, anchor.column);
794
- if (containsLead && containsAnchor)
795
- return;
796
- }
797
- this.detach();
798
- };
799
- TabstopManager.prototype.onChangeSession = function () {
800
- this.detach();
801
- };
802
- TabstopManager.prototype.tabNext = function (dir) {
803
- var max = this.tabstops.length;
804
- var index = this.index + (dir || 1);
805
- index = Math.min(Math.max(index, 1), max);
806
- if (index == max)
807
- index = 0;
808
- this.selectTabstop(index);
809
- this.updateTabstopMarkers();
810
- if (index === 0) {
811
- this.detach();
812
- }
813
- };
814
- TabstopManager.prototype.selectTabstop = function (index) {
815
- this.$openTabstops = null;
816
- var ts = this.tabstops[this.index];
817
- if (ts)
818
- this.addTabstopMarkers(ts);
819
- this.index = index;
820
- ts = this.tabstops[this.index];
821
- if (!ts || !ts.length)
822
- return;
823
- this.selectedTabstop = ts;
824
- var range = ts.firstNonLinked || ts;
825
- if (ts.choices)
826
- range.cursor = range.start;
827
- if (!this.editor.inVirtualSelectionMode) {
828
- var sel = this.editor.multiSelect;
829
- sel.toSingleRange(range);
830
- for (var i = 0; i < ts.length; i++) {
831
- if (ts.hasLinkedRanges && ts[i].linked)
832
- continue;
833
- sel.addRange(ts[i].clone(), true);
834
- }
835
- }
836
- else {
837
- this.editor.selection.fromOrientedRange(range);
838
- }
839
- this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
840
- if (this.selectedTabstop && this.selectedTabstop.choices)
841
- this.editor.execCommand("startAutocomplete", { matches: this.selectedTabstop.choices });
842
- };
843
- TabstopManager.prototype.addTabstops = function (tabstops, start, end) {
844
- var useLink = this.useLink || !this.editor.getOption("enableMultiselect");
845
- if (!this.$openTabstops)
846
- this.$openTabstops = [];
847
- if (!tabstops[0]) {
848
- var p = Range.fromPoints(end, end);
849
- moveRelative(p.start, start);
850
- moveRelative(p.end, start);
851
- tabstops[0] = [p];
852
- tabstops[0].index = 0;
853
- }
854
- var i = this.index;
855
- var arg = [i + 1, 0];
856
- var ranges = this.ranges;
857
- var snippetId = this.snippetId = (this.snippetId || 0) + 1;
858
- tabstops.forEach(function (ts, index) {
859
- var dest = this.$openTabstops[index] || ts;
860
- dest.snippetId = snippetId;
861
- for (var i = 0; i < ts.length; i++) {
862
- var p = ts[i];
863
- var range = Range.fromPoints(p.start, p.end || p.start);
864
- movePoint(range.start, start);
865
- movePoint(range.end, start);
866
- range.original = p;
867
- range.tabstop = dest;
868
- ranges.push(range);
869
- if (dest != ts)
870
- dest.unshift(range);
871
- else
872
- dest[i] = range;
873
- if (p.fmtString || (dest.firstNonLinked && useLink)) {
874
- range.linked = true;
875
- dest.hasLinkedRanges = true;
876
- }
877
- else if (!dest.firstNonLinked)
878
- dest.firstNonLinked = range;
879
- }
880
- if (!dest.firstNonLinked)
881
- dest.hasLinkedRanges = false;
882
- if (dest === ts) {
883
- arg.push(dest);
884
- this.$openTabstops[index] = dest;
885
- }
886
- this.addTabstopMarkers(dest);
887
- dest.rangeList = dest.rangeList || new RangeList();
888
- dest.rangeList.$bias = 0;
889
- dest.rangeList.addList(dest);
890
- }, this);
891
- if (arg.length > 2) {
892
- if (this.tabstops.length)
893
- arg.push(arg.splice(2, 1)[0]);
894
- this.tabstops.splice.apply(this.tabstops, arg);
895
- }
896
- };
897
- TabstopManager.prototype.addTabstopMarkers = function (ts) {
898
- var session = this.session;
899
- ts.forEach(function (range) {
900
- if (!range.markerId)
901
- range.markerId = session.addMarker(range, "ace_snippet-marker", "text");
902
- });
903
- };
904
- TabstopManager.prototype.removeTabstopMarkers = function (ts) {
905
- var session = this.session;
906
- ts.forEach(function (range) {
907
- session.removeMarker(range.markerId);
908
- range.markerId = null;
909
- });
910
- };
911
- TabstopManager.prototype.updateTabstopMarkers = function () {
912
- if (!this.selectedTabstop)
913
- return;
914
- var currentSnippetId = this.selectedTabstop.snippetId;
915
- if (this.selectedTabstop.index === 0) {
916
- currentSnippetId--;
917
- }
918
- this.tabstops.forEach(function (ts) {
919
- if (ts.snippetId === currentSnippetId)
920
- this.addTabstopMarkers(ts);
921
- else
922
- this.removeTabstopMarkers(ts);
923
- }, this);
924
- };
925
- TabstopManager.prototype.removeRange = function (range) {
926
- var i = range.tabstop.indexOf(range);
927
- if (i != -1)
928
- range.tabstop.splice(i, 1);
929
- i = this.ranges.indexOf(range);
930
- if (i != -1)
931
- this.ranges.splice(i, 1);
932
- i = range.tabstop.rangeList.ranges.indexOf(range);
933
- if (i != -1)
934
- range.tabstop.splice(i, 1);
935
- this.session.removeMarker(range.markerId);
936
- if (!range.tabstop.length) {
937
- i = this.tabstops.indexOf(range.tabstop);
938
- if (i != -1)
939
- this.tabstops.splice(i, 1);
940
- if (!this.tabstops.length)
941
- this.detach();
942
- }
943
- };
944
- return TabstopManager;
945
- }());
946
- TabstopManager.prototype.keyboardHandler = new HashHandler();
947
- TabstopManager.prototype.keyboardHandler.bindKeys({
948
- "Tab": function (editor) {
949
- if (exports.snippetManager && exports.snippetManager.expandWithTab(editor))
950
- return;
951
- editor.tabstopManager.tabNext(1);
952
- editor.renderer.scrollCursorIntoView();
953
- },
954
- "Shift-Tab": function (editor) {
955
- editor.tabstopManager.tabNext(-1);
956
- editor.renderer.scrollCursorIntoView();
957
- },
958
- "Esc": function (editor) {
959
- editor.tabstopManager.detach();
960
- }
961
- });
962
- var movePoint = function (point, diff) {
963
- if (point.row == 0)
964
- point.column += diff.column;
965
- point.row += diff.row;
966
- };
967
- var moveRelative = function (point, start) {
968
- if (point.row == start.row)
969
- point.column -= start.column;
970
- point.row -= start.row;
971
- };
972
- dom.importCssString("\n.ace_snippet-marker {\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n background: rgba(194, 193, 208, 0.09);\n border: 1px dotted rgba(211, 208, 235, 0.62);\n position: absolute;\n}", "snippets.css", false);
973
- exports.snippetManager = new SnippetManager();
974
- var Editor = require("./editor").Editor;
975
- (function () {
976
- this.insertSnippet = function (content, options) {
977
- return exports.snippetManager.insertSnippet(this, content, options);
978
- };
979
- this.expandSnippet = function (options) {
980
- return exports.snippetManager.expandWithTab(this, options);
981
- };
982
- }).call(Editor.prototype);
983
-
984
- });
985
-
986
- ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"], function(require, exports, module){"use strict";
987
- var AceInlineScreenReader = /** @class */ (function () {
988
- function AceInlineScreenReader(editor) {
989
- this.editor = editor;
990
- this.screenReaderDiv = document.createElement("div");
991
- this.screenReaderDiv.classList.add("ace_screenreader-only");
992
- this.editor.container.appendChild(this.screenReaderDiv);
993
- }
994
- AceInlineScreenReader.prototype.setScreenReaderContent = function (content) {
995
- if (!this.popup && this.editor.completer && /**@type{import("../autocomplete").Autocomplete}*/ (this.editor.completer).popup) {
996
- this.popup = /**@type{import("../autocomplete").Autocomplete}*/ (this.editor.completer).popup;
997
- this.popup.renderer.on("afterRender", function () {
998
- var row = this.popup.getRow();
999
- var t = this.popup.renderer.$textLayer;
1000
- var selected = t.element.childNodes[row - t.config.firstRow];
1001
- if (selected) {
1002
- var idString = "doc-tooltip ";
1003
- for (var lineIndex = 0; lineIndex < this._lines.length; lineIndex++) {
1004
- idString += "ace-inline-screenreader-line-".concat(lineIndex, " ");
1005
- }
1006
- selected.setAttribute("aria-describedby", idString);
1007
- }
1008
- }.bind(this));
1009
- }
1010
- while (this.screenReaderDiv.firstChild) {
1011
- this.screenReaderDiv.removeChild(this.screenReaderDiv.firstChild);
1012
- }
1013
- this._lines = content.split(/\r\n|\r|\n/);
1014
- var codeElement = this.createCodeBlock();
1015
- this.screenReaderDiv.appendChild(codeElement);
1016
- };
1017
- AceInlineScreenReader.prototype.destroy = function () {
1018
- this.screenReaderDiv.remove();
1019
- };
1020
- AceInlineScreenReader.prototype.createCodeBlock = function () {
1021
- var container = document.createElement("pre");
1022
- container.setAttribute("id", "ace-inline-screenreader");
1023
- for (var lineIndex = 0; lineIndex < this._lines.length; lineIndex++) {
1024
- var codeElement = document.createElement("code");
1025
- codeElement.setAttribute("id", "ace-inline-screenreader-line-".concat(lineIndex));
1026
- var line = document.createTextNode(this._lines[lineIndex]);
1027
- codeElement.appendChild(line);
1028
- container.appendChild(codeElement);
1029
- }
1030
- return container;
1031
- };
1032
- return AceInlineScreenReader;
1033
- }());
1034
- exports.AceInlineScreenReader = AceInlineScreenReader;
1035
-
1036
- });
1037
-
1038
- ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"], function(require, exports, module){"use strict";
1039
- var snippetManager = require("../snippets").snippetManager;
1040
- var AceInlineScreenReader = require("./inline_screenreader").AceInlineScreenReader;
1041
- var AceInline = /** @class */ (function () {
1042
- function AceInline() {
1043
- this.editor = null;
1044
- }
1045
- AceInline.prototype.show = function (editor, completion, prefix) {
1046
- prefix = prefix || "";
1047
- if (editor && this.editor && this.editor !== editor) {
1048
- this.hide();
1049
- this.editor = null;
1050
- this.inlineScreenReader = null;
1051
- }
1052
- if (!editor || !completion) {
1053
- return false;
1054
- }
1055
- if (!this.inlineScreenReader) {
1056
- this.inlineScreenReader = new AceInlineScreenReader(editor);
1057
- }
1058
- var displayText = completion.snippet ? snippetManager.getDisplayTextForSnippet(editor, completion.snippet) : completion.value;
1059
- if (completion.hideInlinePreview || !displayText || !displayText.startsWith(prefix)) {
1060
- return false;
1061
- }
1062
- this.editor = editor;
1063
- this.inlineScreenReader.setScreenReaderContent(displayText);
1064
- displayText = displayText.slice(prefix.length);
1065
- if (displayText === "") {
1066
- editor.removeGhostText();
1067
- }
1068
- else {
1069
- editor.setGhostText(displayText);
1070
- }
1071
- return true;
1072
- };
1073
- AceInline.prototype.isOpen = function () {
1074
- if (!this.editor) {
1075
- return false;
1076
- }
1077
- return !!this.editor.renderer.$ghostText;
1078
- };
1079
- AceInline.prototype.hide = function () {
1080
- if (!this.editor) {
1081
- return false;
1082
- }
1083
- this.editor.removeGhostText();
1084
- return true;
1085
- };
1086
- AceInline.prototype.destroy = function () {
1087
- this.hide();
1088
- this.editor = null;
1089
- if (this.inlineScreenReader) {
1090
- this.inlineScreenReader.destroy();
1091
- this.inlineScreenReader = null;
1092
- }
1093
- };
1094
- return AceInline;
1095
- }());
1096
- exports.AceInline = AceInline;
1097
-
1098
- });
1099
-
1100
- ace.define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/config","ace/lib/useragent"], function(require, exports, module){"use strict";
1101
- var Renderer = require("../virtual_renderer").VirtualRenderer;
1102
- var Editor = require("../editor").Editor;
1103
- var Range = require("../range").Range;
1104
- var event = require("../lib/event");
1105
- var lang = require("../lib/lang");
1106
- var dom = require("../lib/dom");
1107
- var nls = require("../config").nls;
1108
- var userAgent = require("./../lib/useragent");
1109
- var getAriaId = function (index) {
1110
- return "suggest-aria-id:".concat(index);
1111
- };
1112
- var popupAriaRole = userAgent.isSafari ? "menu" : "listbox";
1113
- var optionAriaRole = userAgent.isSafari ? "menuitem" : "option";
1114
- var ariaActiveState = userAgent.isSafari ? "aria-current" : "aria-selected";
1115
- var $singleLineEditor = function (el) {
1116
- var renderer = new Renderer(el);
1117
- renderer.$maxLines = 4;
1118
- var editor = new Editor(renderer);
1119
- editor.setHighlightActiveLine(false);
1120
- editor.setShowPrintMargin(false);
1121
- editor.renderer.setShowGutter(false);
1122
- editor.renderer.setHighlightGutterLine(false);
1123
- editor.$mouseHandler.$focusTimeout = 0;
1124
- editor.$highlightTagPending = true;
1125
- return editor;
1126
- };
1127
- var AcePopup = /** @class */ (function () {
1128
- function AcePopup(parentNode) {
1129
- var el = dom.createElement("div");
1130
- var popup = $singleLineEditor(el);
1131
- if (parentNode) {
1132
- parentNode.appendChild(el);
1133
- }
1134
- el.style.display = "none";
1135
- popup.renderer.content.style.cursor = "default";
1136
- popup.renderer.setStyle("ace_autocomplete");
1137
- popup.renderer.$textLayer.element.setAttribute("role", popupAriaRole);
1138
- popup.renderer.$textLayer.element.setAttribute("aria-roledescription", nls("autocomplete.popup.aria-roledescription", "Autocomplete suggestions"));
1139
- popup.renderer.$textLayer.element.setAttribute("aria-label", nls("autocomplete.popup.aria-label", "Autocomplete suggestions"));
1140
- popup.renderer.textarea.setAttribute("aria-hidden", "true");
1141
- popup.setOption("displayIndentGuides", false);
1142
- popup.setOption("dragDelay", 150);
1143
- var noop = function () { };
1144
- popup.focus = noop;
1145
- popup.$isFocused = true;
1146
- popup.renderer.$cursorLayer.restartTimer = noop;
1147
- popup.renderer.$cursorLayer.element.style.opacity = "0";
1148
- popup.renderer.$maxLines = 8;
1149
- popup.renderer.$keepTextAreaAtCursor = false;
1150
- popup.setHighlightActiveLine(false);
1151
- popup.session.highlight("");
1152
- popup.session.$searchHighlight.clazz = "ace_highlight-marker";
1153
- popup.on("mousedown", function (e) {
1154
- var pos = e.getDocumentPosition();
1155
- popup.selection.moveToPosition(pos);
1156
- selectionMarker.start.row = selectionMarker.end.row = pos.row;
1157
- e.stop();
1158
- });
1159
- var lastMouseEvent;
1160
- var hoverMarker = new Range(-1, 0, -1, Infinity);
1161
- var selectionMarker = new Range(-1, 0, -1, Infinity);
1162
- selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine");
1163
- popup.setSelectOnHover = function (val) {
1164
- if (!val) {
1165
- hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine");
1166
- }
1167
- else if (hoverMarker.id) {
1168
- popup.session.removeMarker(hoverMarker.id);
1169
- hoverMarker.id = null;
1170
- }
1171
- };
1172
- popup.setSelectOnHover(false);
1173
- popup.on("mousemove", function (e) {
1174
- if (!lastMouseEvent) {
1175
- lastMouseEvent = e;
1176
- return;
1177
- }
1178
- if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) {
1179
- return;
1180
- }
1181
- lastMouseEvent = e;
1182
- lastMouseEvent.scrollTop = popup.renderer.scrollTop;
1183
- popup.isMouseOver = true;
1184
- var row = lastMouseEvent.getDocumentPosition().row;
1185
- if (hoverMarker.start.row != row) {
1186
- if (!hoverMarker.id)
1187
- popup.setRow(row);
1188
- setHoverMarker(row);
1189
- }
1190
- });
1191
- popup.renderer.on("beforeRender", function () {
1192
- if (lastMouseEvent && hoverMarker.start.row != -1) {
1193
- lastMouseEvent.$pos = null;
1194
- var row = lastMouseEvent.getDocumentPosition().row;
1195
- if (!hoverMarker.id)
1196
- popup.setRow(row);
1197
- setHoverMarker(row, true);
1198
- }
1199
- });
1200
- popup.renderer.on("afterRender", function () {
1201
- var row = popup.getRow();
1202
- var t = popup.renderer.$textLayer;
1203
- var selected = /** @type {HTMLElement|null} */ (t.element.childNodes[row - t.config.firstRow]);
1204
- var el = document.activeElement; // Active element is textarea of main editor
1205
- if (selected !== popup.selectedNode && popup.selectedNode) {
1206
- dom.removeCssClass(popup.selectedNode, "ace_selected");
1207
- el.removeAttribute("aria-activedescendant");
1208
- popup.selectedNode.removeAttribute(ariaActiveState);
1209
- popup.selectedNode.removeAttribute("id");
1210
- }
1211
- popup.selectedNode = selected;
1212
- if (selected) {
1213
- dom.addCssClass(selected, "ace_selected");
1214
- var ariaId = getAriaId(row);
1215
- selected.id = ariaId;
1216
- t.element.setAttribute("aria-activedescendant", ariaId);
1217
- el.setAttribute("aria-activedescendant", ariaId);
1218
- selected.setAttribute("role", optionAriaRole);
1219
- selected.setAttribute("aria-roledescription", nls("autocomplete.popup.item.aria-roledescription", "item"));
1220
- selected.setAttribute("aria-label", popup.getData(row).caption || popup.getData(row).value);
1221
- selected.setAttribute("aria-setsize", popup.data.length);
1222
- selected.setAttribute("aria-posinset", row + 1);
1223
- selected.setAttribute("aria-describedby", "doc-tooltip");
1224
- selected.setAttribute(ariaActiveState, "true");
1225
- }
1226
- });
1227
- var hideHoverMarker = function () { setHoverMarker(-1); };
1228
- var setHoverMarker = function (row, suppressRedraw) {
1229
- if (row !== hoverMarker.start.row) {
1230
- hoverMarker.start.row = hoverMarker.end.row = row;
1231
- if (!suppressRedraw)
1232
- popup.session._emit("changeBackMarker");
1233
- popup._emit("changeHoverMarker");
1234
- }
1235
- };
1236
- popup.getHoveredRow = function () {
1237
- return hoverMarker.start.row;
1238
- };
1239
- event.addListener(popup.container, "mouseout", function () {
1240
- popup.isMouseOver = false;
1241
- hideHoverMarker();
1242
- });
1243
- popup.on("hide", hideHoverMarker);
1244
- popup.on("changeSelection", hideHoverMarker);
1245
- popup.session.doc.getLength = function () {
1246
- return popup.data.length;
1247
- };
1248
- popup.session.doc.getLine = function (i) {
1249
- var data = popup.data[i];
1250
- if (typeof data == "string")
1251
- return data;
1252
- return (data && data.value) || "";
1253
- };
1254
- var bgTokenizer = popup.session.bgTokenizer;
1255
- bgTokenizer.$tokenizeRow = function (row) {
1256
- var data = popup.data[row];
1257
- var tokens = [];
1258
- if (!data)
1259
- return tokens;
1260
- if (typeof data == "string")
1261
- data = { value: data };
1262
- var caption = data.caption || data.value || data.name;
1263
- function addToken(value, className) {
1264
- value && tokens.push({
1265
- type: (data.className || "") + (className || ""),
1266
- value: value
1267
- });
1268
- }
1269
- var lower = caption.toLowerCase();
1270
- var filterText = (popup.filterText || "").toLowerCase();
1271
- var lastIndex = 0;
1272
- var lastI = 0;
1273
- for (var i = 0; i <= filterText.length; i++) {
1274
- if (i != lastI && (data.matchMask & (1 << i) || i == filterText.length)) {
1275
- var sub = filterText.slice(lastI, i);
1276
- lastI = i;
1277
- var index = lower.indexOf(sub, lastIndex);
1278
- if (index == -1)
1279
- continue;
1280
- addToken(caption.slice(lastIndex, index), "");
1281
- lastIndex = index + sub.length;
1282
- addToken(caption.slice(index, lastIndex), "completion-highlight");
1283
- }
1284
- }
1285
- addToken(caption.slice(lastIndex, caption.length), "");
1286
- tokens.push({ type: "completion-spacer", value: " " });
1287
- if (data.meta)
1288
- tokens.push({ type: "completion-meta", value: data.meta });
1289
- if (data.message)
1290
- tokens.push({ type: "completion-message", value: data.message });
1291
- return tokens;
1292
- };
1293
- bgTokenizer.$updateOnChange = noop;
1294
- bgTokenizer.start = noop;
1295
- popup.session.$computeWidth = function () {
1296
- return this.screenWidth = 0;
1297
- };
1298
- popup.isOpen = false;
1299
- popup.isTopdown = false;
1300
- popup.autoSelect = true;
1301
- popup.filterText = "";
1302
- popup.isMouseOver = false;
1303
- popup.data = [];
1304
- popup.setData = function (list, filterText) {
1305
- popup.filterText = filterText || "";
1306
- popup.setValue(lang.stringRepeat("\n", list.length), -1);
1307
- popup.data = list || [];
1308
- popup.setRow(0);
1309
- };
1310
- popup.getData = function (row) {
1311
- return popup.data[row];
1312
- };
1313
- popup.getRow = function () {
1314
- return selectionMarker.start.row;
1315
- };
1316
- popup.setRow = function (line) {
1317
- line = Math.max(this.autoSelect ? 0 : -1, Math.min(this.data.length - 1, line));
1318
- if (selectionMarker.start.row != line) {
1319
- popup.selection.clearSelection();
1320
- selectionMarker.start.row = selectionMarker.end.row = line || 0;
1321
- popup.session._emit("changeBackMarker");
1322
- popup.moveCursorTo(line || 0, 0);
1323
- if (popup.isOpen)
1324
- popup._signal("select");
1325
- }
1326
- };
1327
- popup.on("changeSelection", function () {
1328
- if (popup.isOpen)
1329
- popup.setRow(popup.selection.lead.row);
1330
- popup.renderer.scrollCursorIntoView();
1331
- });
1332
- popup.hide = function () {
1333
- this.container.style.display = "none";
1334
- popup.anchorPos = null;
1335
- popup.anchor = null;
1336
- if (popup.isOpen) {
1337
- popup.isOpen = false;
1338
- this._signal("hide");
1339
- }
1340
- };
1341
- popup.tryShow = function (pos, lineHeight, anchor, forceShow) {
1342
- if (!forceShow && popup.isOpen && popup.anchorPos && popup.anchor &&
1343
- popup.anchorPos.top === pos.top && popup.anchorPos.left === pos.left &&
1344
- popup.anchor === anchor) {
1345
- return true;
1346
- }
1347
- var el = this.container;
1348
- var screenHeight = window.innerHeight;
1349
- var screenWidth = window.innerWidth;
1350
- var renderer = this.renderer;
1351
- var maxH = renderer.$maxLines * lineHeight * 1.4;
1352
- var dims = { top: 0, bottom: 0, left: 0 };
1353
- var spaceBelow = screenHeight - pos.top - 3 * this.$borderSize - lineHeight;
1354
- var spaceAbove = pos.top - 3 * this.$borderSize;
1355
- if (!anchor) {
1356
- if (spaceAbove <= spaceBelow || spaceBelow >= maxH) {
1357
- anchor = "bottom";
1358
- }
1359
- else {
1360
- anchor = "top";
1361
- }
1362
- }
1363
- if (anchor === "top") {
1364
- dims.bottom = pos.top - this.$borderSize;
1365
- dims.top = dims.bottom - maxH;
1366
- }
1367
- else if (anchor === "bottom") {
1368
- dims.top = pos.top + lineHeight + this.$borderSize;
1369
- dims.bottom = dims.top + maxH;
1370
- }
1371
- var fitsX = dims.top >= 0 && dims.bottom <= screenHeight;
1372
- if (!forceShow && !fitsX) {
1373
- return false;
1374
- }
1375
- if (!fitsX) {
1376
- if (anchor === "top") {
1377
- renderer.$maxPixelHeight = spaceAbove;
1378
- }
1379
- else {
1380
- renderer.$maxPixelHeight = spaceBelow;
1381
- }
1382
- }
1383
- else {
1384
- renderer.$maxPixelHeight = null;
1385
- }
1386
- if (anchor === "top") {
1387
- el.style.top = "";
1388
- el.style.bottom = (screenHeight - dims.bottom) + "px";
1389
- popup.isTopdown = false;
1390
- }
1391
- else {
1392
- el.style.top = dims.top + "px";
1393
- el.style.bottom = "";
1394
- popup.isTopdown = true;
1395
- }
1396
- el.style.display = "";
1397
- var left = pos.left;
1398
- if (left + el.offsetWidth > screenWidth)
1399
- left = screenWidth - el.offsetWidth;
1400
- el.style.left = left + "px";
1401
- el.style.right = "";
1402
- if (!popup.isOpen) {
1403
- popup.isOpen = true;
1404
- this._signal("show");
1405
- lastMouseEvent = null;
1406
- }
1407
- popup.anchorPos = pos;
1408
- popup.anchor = anchor;
1409
- return true;
1410
- };
1411
- popup.show = function (pos, lineHeight, topdownOnly) {
1412
- this.tryShow(pos, lineHeight, topdownOnly ? "bottom" : undefined, true);
1413
- };
1414
- popup.goTo = function (where) {
1415
- var row = this.getRow();
1416
- var max = this.session.getLength() - 1;
1417
- switch (where) {
1418
- case "up":
1419
- row = row <= 0 ? max : row - 1;
1420
- break;
1421
- case "down":
1422
- row = row >= max ? -1 : row + 1;
1423
- break;
1424
- case "start":
1425
- row = 0;
1426
- break;
1427
- case "end":
1428
- row = max;
1429
- break;
1430
- }
1431
- this.setRow(row);
1432
- };
1433
- popup.getTextLeftOffset = function () {
1434
- return this.$borderSize + this.renderer.$padding + this.$imageSize;
1435
- };
1436
- popup.$imageSize = 0;
1437
- popup.$borderSize = 1;
1438
- return popup;
1439
- }
1440
- return AcePopup;
1441
- }());
1442
- dom.importCssString("\n.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #CAD6FA;\n z-index: 1;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #3a674e;\n}\n.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid #abbffe;\n margin-top: -1px;\n background: rgba(233,233,253,0.4);\n position: absolute;\n z-index: 2;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid rgba(109, 150, 13, 0.8);\n background: rgba(58, 103, 78, 0.62);\n}\n.ace_completion-meta {\n opacity: 0.5;\n margin-left: 0.9em;\n}\n.ace_completion-message {\n margin-left: 0.9em;\n color: blue;\n}\n.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #2d69c7;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #93ca12;\n}\n.ace_editor.ace_autocomplete {\n width: 300px;\n z-index: 200000;\n border: 1px lightgray solid;\n position: fixed;\n box-shadow: 2px 3px 5px rgba(0,0,0,.2);\n line-height: 1.4;\n background: #fefefe;\n color: #111;\n}\n.ace_dark.ace_editor.ace_autocomplete {\n border: 1px #484747 solid;\n box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);\n line-height: 1.4;\n background: #25282c;\n color: #c1c1c1;\n}\n.ace_autocomplete .ace_text-layer {\n width: calc(100% - 8px);\n}\n.ace_autocomplete .ace_line {\n display: flex;\n align-items: center;\n}\n.ace_autocomplete .ace_line > * {\n min-width: 0;\n flex: 0 0 auto;\n}\n.ace_autocomplete .ace_line .ace_ {\n flex: 0 1 auto;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.ace_autocomplete .ace_completion-spacer {\n flex: 1;\n}\n.ace_autocomplete.ace_loading:after {\n content: \"\";\n position: absolute;\n top: 0px;\n height: 2px;\n width: 8%;\n background: blue;\n z-index: 100;\n animation: ace_progress 3s infinite linear;\n animation-delay: 300ms;\n transform: translateX(-100%) scaleX(1);\n}\n@keyframes ace_progress {\n 0% { transform: translateX(-100%) scaleX(1) }\n 50% { transform: translateX(625%) scaleX(2) } \n 100% { transform: translateX(1500%) scaleX(3) } \n}\n@media (prefers-reduced-motion) {\n .ace_autocomplete.ace_loading:after {\n transform: translateX(625%) scaleX(2);\n animation: none;\n }\n}\n", "autocompletion.css", false);
1443
- exports.AcePopup = AcePopup;
1444
- exports.$singleLineEditor = $singleLineEditor;
1445
- exports.getAriaId = getAriaId;
1446
-
1447
- });
1448
-
1449
- ace.define("ace/autocomplete/util",["require","exports","module"], function(require, exports, module){"use strict";
1450
- exports.parForEach = function (array, fn, callback) {
1451
- var completed = 0;
1452
- var arLength = array.length;
1453
- if (arLength === 0)
1454
- callback();
1455
- for (var i = 0; i < arLength; i++) {
1456
- fn(array[i], function (result, err) {
1457
- completed++;
1458
- if (completed === arLength)
1459
- callback(result, err);
1460
- });
1461
- }
1462
- };
1463
- var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;
1464
- exports.retrievePrecedingIdentifier = function (text, pos, regex) {
1465
- regex = regex || ID_REGEX;
1466
- var buf = [];
1467
- for (var i = pos - 1; i >= 0; i--) {
1468
- if (regex.test(text[i]))
1469
- buf.push(text[i]);
1470
- else
1471
- break;
1472
- }
1473
- return buf.reverse().join("");
1474
- };
1475
- exports.retrieveFollowingIdentifier = function (text, pos, regex) {
1476
- regex = regex || ID_REGEX;
1477
- var buf = [];
1478
- for (var i = pos; i < text.length; i++) {
1479
- if (regex.test(text[i]))
1480
- buf.push(text[i]);
1481
- else
1482
- break;
1483
- }
1484
- return buf;
1485
- };
1486
- exports.getCompletionPrefix = function (editor) {
1487
- var pos = editor.getCursorPosition();
1488
- var line = editor.session.getLine(pos.row);
1489
- var prefix;
1490
- editor.completers.forEach(function (completer) {
1491
- if (completer.identifierRegexps) {
1492
- completer.identifierRegexps.forEach(function (identifierRegex) {
1493
- if (!prefix && identifierRegex)
1494
- prefix = this.retrievePrecedingIdentifier(line, pos.column, identifierRegex);
1495
- }.bind(this));
1496
- }
1497
- }.bind(this));
1498
- return prefix || this.retrievePrecedingIdentifier(line, pos.column);
1499
- };
1500
- exports.triggerAutocomplete = function (editor, previousChar) {
1501
- var previousChar = previousChar == null
1502
- ? editor.session.getPrecedingCharacter()
1503
- : previousChar;
1504
- return editor.completers.some(function (completer) {
1505
- if (completer.triggerCharacters && Array.isArray(completer.triggerCharacters)) {
1506
- return completer.triggerCharacters.includes(previousChar);
1507
- }
1508
- });
1509
- };
1510
-
1511
- });
1512
-
1513
- ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/inline","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config","ace/lib/event","ace/lib/scroll"], function(require, exports, module){"use strict";
1514
- var HashHandler = require("./keyboard/hash_handler").HashHandler;
1515
- var AcePopup = require("./autocomplete/popup").AcePopup;
1516
- var AceInline = require("./autocomplete/inline").AceInline;
1517
- var getAriaId = require("./autocomplete/popup").getAriaId;
1518
- var util = require("./autocomplete/util");
1519
- var lang = require("./lib/lang");
1520
- var dom = require("./lib/dom");
1521
- var snippetManager = require("./snippets").snippetManager;
1522
- var config = require("./config");
1523
- var event = require("./lib/event");
1524
- var preventParentScroll = require("./lib/scroll").preventParentScroll;
1525
- var destroyCompleter = function (e, editor) {
1526
- editor.completer && editor.completer.destroy();
1527
- };
1528
- var Autocomplete = /** @class */ (function () {
1529
- function Autocomplete() {
1530
- this.autoInsert = false;
1531
- this.autoSelect = true;
1532
- this.autoShown = false;
1533
- this.exactMatch = false;
1534
- this.inlineEnabled = false;
1535
- this.keyboardHandler = new HashHandler();
1536
- this.keyboardHandler.bindKeys(this.commands);
1537
- this.parentNode = null;
1538
- this.setSelectOnHover = false;
1539
- this.hasSeen = new Set();
1540
- this.showLoadingState = false;
1541
- this.stickySelectionDelay = 500;
1542
- this.blurListener = this.blurListener.bind(this);
1543
- this.changeListener = this.changeListener.bind(this);
1544
- this.mousedownListener = this.mousedownListener.bind(this);
1545
- this.mousewheelListener = this.mousewheelListener.bind(this);
1546
- this.onLayoutChange = this.onLayoutChange.bind(this);
1547
- this.changeTimer = lang.delayedCall(function () {
1548
- this.updateCompletions(true);
1549
- }.bind(this));
1550
- this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);
1551
- this.popupTimer = lang.delayedCall(this.$updatePopupPosition.bind(this), 50);
1552
- this.stickySelectionTimer = lang.delayedCall(function () {
1553
- this.stickySelection = true;
1554
- }.bind(this), this.stickySelectionDelay);
1555
- this.$firstOpenTimer = lang.delayedCall(/**@this{Autocomplete}*/ function () {
1556
- var initialPosition = this.completionProvider && this.completionProvider.initialPosition;
1557
- if (this.autoShown || (this.popup && this.popup.isOpen) || !initialPosition || this.editor.completers.length === 0)
1558
- return;
1559
- this.completions = new FilteredList(Autocomplete.completionsForLoading);
1560
- this.openPopup(this.editor, initialPosition.prefix, false);
1561
- this.popup.renderer.setStyle("ace_loading", true);
1562
- }.bind(this), this.stickySelectionDelay);
1563
- }
1564
- Object.defineProperty(Autocomplete, "completionsForLoading", {
1565
- get: function () {
1566
- return [{
1567
- caption: config.nls("autocomplete.loading", "Loading..."),
1568
- value: ""
1569
- }];
1570
- },
1571
- enumerable: false,
1572
- configurable: true
1573
- });
1574
- Autocomplete.prototype.$init = function () {
1575
- this.popup = new AcePopup(this.parentNode || document.body || document.documentElement);
1576
- this.popup.on("click", function (e) {
1577
- this.insertMatch();
1578
- e.stop();
1579
- }.bind(this));
1580
- this.popup.focus = this.editor.focus.bind(this.editor);
1581
- this.popup.on("show", this.$onPopupShow.bind(this));
1582
- this.popup.on("hide", this.$onHidePopup.bind(this));
1583
- this.popup.on("select", this.$onPopupChange.bind(this));
1584
- event.addListener(this.popup.container, "mouseout", this.mouseOutListener.bind(this));
1585
- this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null));
1586
- this.popup.renderer.on("afterRender", this.$onPopupRender.bind(this));
1587
- return this.popup;
1588
- };
1589
- Autocomplete.prototype.$initInline = function () {
1590
- if (!this.inlineEnabled || this.inlineRenderer)
1591
- return;
1592
- this.inlineRenderer = new AceInline();
1593
- return this.inlineRenderer;
1594
- };
1595
- Autocomplete.prototype.getPopup = function () {
1596
- return this.popup || this.$init();
1597
- };
1598
- Autocomplete.prototype.$onHidePopup = function () {
1599
- if (this.inlineRenderer) {
1600
- this.inlineRenderer.hide();
1601
- }
1602
- this.hideDocTooltip();
1603
- this.stickySelectionTimer.cancel();
1604
- this.popupTimer.cancel();
1605
- this.stickySelection = false;
1606
- };
1607
- Autocomplete.prototype.$seen = function (completion) {
1608
- if (!this.hasSeen.has(completion) && completion && completion.completer && completion.completer.onSeen && typeof completion.completer.onSeen === "function") {
1609
- completion.completer.onSeen(this.editor, completion);
1610
- this.hasSeen.add(completion);
1611
- }
1612
- };
1613
- Autocomplete.prototype.$onPopupChange = function (hide) {
1614
- if (this.inlineRenderer && this.inlineEnabled) {
1615
- var completion = hide ? null : this.popup.getData(this.popup.getRow());
1616
- this.$updateGhostText(completion);
1617
- if (this.popup.isMouseOver && this.setSelectOnHover) {
1618
- this.tooltipTimer.call(null, null);
1619
- return;
1620
- }
1621
- this.popupTimer.schedule();
1622
- this.tooltipTimer.schedule();
1623
- }
1624
- else {
1625
- this.popupTimer.call(null, null);
1626
- this.tooltipTimer.call(null, null);
1627
- }
1628
- };
1629
- Autocomplete.prototype.$updateGhostText = function (completion) {
1630
- var row = this.base.row;
1631
- var column = this.base.column;
1632
- var cursorColumn = this.editor.getCursorPosition().column;
1633
- var prefix = this.editor.session.getLine(row).slice(column, cursorColumn);
1634
- if (!this.inlineRenderer.show(this.editor, completion, prefix)) {
1635
- this.inlineRenderer.hide();
1636
- }
1637
- else {
1638
- this.$seen(completion);
1639
- }
1640
- };
1641
- Autocomplete.prototype.$onPopupRender = function () {
1642
- var inlineEnabled = this.inlineRenderer && this.inlineEnabled;
1643
- if (this.completions && this.completions.filtered && this.completions.filtered.length > 0) {
1644
- for (var i = this.popup.getFirstVisibleRow(); i <= this.popup.getLastVisibleRow(); i++) {
1645
- var completion = this.popup.getData(i);
1646
- if (completion && (!inlineEnabled || completion.hideInlinePreview)) {
1647
- this.$seen(completion);
1648
- }
1649
- }
1650
- }
1651
- };
1652
- Autocomplete.prototype.$onPopupShow = function (hide) {
1653
- this.$onPopupChange(hide);
1654
- this.stickySelection = false;
1655
- if (this.stickySelectionDelay >= 0)
1656
- this.stickySelectionTimer.schedule(this.stickySelectionDelay);
1657
- };
1658
- Autocomplete.prototype.observeLayoutChanges = function () {
1659
- if (this.$elements || !this.editor)
1660
- return;
1661
- window.addEventListener("resize", this.onLayoutChange, { passive: true });
1662
- window.addEventListener("wheel", this.mousewheelListener);
1663
- var el = this.editor.container.parentNode;
1664
- var elements = [];
1665
- while (el) {
1666
- elements.push(el);
1667
- el.addEventListener("scroll", this.onLayoutChange, { passive: true });
1668
- el = el.parentNode;
1669
- }
1670
- this.$elements = elements;
1671
- };
1672
- Autocomplete.prototype.unObserveLayoutChanges = function () {
1673
- var _this = this;
1674
- window.removeEventListener("resize", this.onLayoutChange, { passive: true });
1675
- window.removeEventListener("wheel", this.mousewheelListener);
1676
- this.$elements && this.$elements.forEach(function (el) {
1677
- el.removeEventListener("scroll", _this.onLayoutChange, { passive: true });
1678
- });
1679
- this.$elements = null;
1680
- };
1681
- Autocomplete.prototype.onLayoutChange = function () {
1682
- if (!this.popup.isOpen)
1683
- return this.unObserveLayoutChanges();
1684
- this.$updatePopupPosition();
1685
- this.updateDocTooltip();
1686
- };
1687
- Autocomplete.prototype.$updatePopupPosition = function () {
1688
- var editor = this.editor;
1689
- var renderer = editor.renderer;
1690
- var lineHeight = renderer.layerConfig.lineHeight;
1691
- var pos = renderer.$cursorLayer.getPixelPosition(this.base, true);
1692
- pos.left -= this.popup.getTextLeftOffset();
1693
- var rect = editor.container.getBoundingClientRect();
1694
- pos.top += rect.top - renderer.layerConfig.offset;
1695
- pos.left += rect.left - editor.renderer.scrollLeft;
1696
- pos.left += renderer.gutterWidth;
1697
- var posGhostText = {
1698
- top: pos.top,
1699
- left: pos.left
1700
- };
1701
- if (renderer.$ghostText && renderer.$ghostTextWidget) {
1702
- if (this.base.row === renderer.$ghostText.position.row) {
1703
- posGhostText.top += renderer.$ghostTextWidget.el.offsetHeight;
1704
- }
1705
- }
1706
- var editorContainerBottom = editor.container.getBoundingClientRect().bottom - lineHeight;
1707
- var lowestPosition = editorContainerBottom < posGhostText.top ?
1708
- { top: editorContainerBottom, left: posGhostText.left } :
1709
- posGhostText;
1710
- if (this.popup.tryShow(lowestPosition, lineHeight, "bottom")) {
1711
- return;
1712
- }
1713
- if (this.popup.tryShow(pos, lineHeight, "top")) {
1714
- return;
1715
- }
1716
- this.popup.show(pos, lineHeight);
1717
- };
1718
- Autocomplete.prototype.openPopup = function (editor, prefix, keepPopupPosition) {
1719
- this.$firstOpenTimer.cancel();
1720
- if (!this.popup)
1721
- this.$init();
1722
- if (this.inlineEnabled && !this.inlineRenderer)
1723
- this.$initInline();
1724
- this.popup.autoSelect = this.autoSelect;
1725
- this.popup.setSelectOnHover(this.setSelectOnHover);
1726
- var oldRow = this.popup.getRow();
1727
- var previousSelectedItem = this.popup.data[oldRow];
1728
- this.popup.setData(this.completions.filtered, this.completions.filterText);
1729
- if (this.editor.textInput.setAriaOptions) {
1730
- this.editor.textInput.setAriaOptions({
1731
- activeDescendant: getAriaId(this.popup.getRow()),
1732
- inline: this.inlineEnabled
1733
- });
1734
- }
1735
- editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
1736
- var newRow;
1737
- if (this.stickySelection)
1738
- newRow = this.popup.data.indexOf(previousSelectedItem);
1739
- if (!newRow || newRow === -1)
1740
- newRow = 0;
1741
- this.popup.setRow(this.autoSelect ? newRow : -1);
1742
- if (newRow === oldRow && previousSelectedItem !== this.completions.filtered[newRow])
1743
- this.$onPopupChange();
1744
- var inlineEnabled = this.inlineRenderer && this.inlineEnabled;
1745
- if (newRow === oldRow && inlineEnabled) {
1746
- var completion = this.popup.getData(this.popup.getRow());
1747
- this.$updateGhostText(completion);
1748
- }
1749
- if (!keepPopupPosition) {
1750
- this.popup.setTheme(editor.getTheme());
1751
- this.popup.setFontSize(editor.getFontSize());
1752
- this.$updatePopupPosition();
1753
- if (this.tooltipNode) {
1754
- this.updateDocTooltip();
1755
- }
1756
- }
1757
- this.changeTimer.cancel();
1758
- this.observeLayoutChanges();
1759
- };
1760
- Autocomplete.prototype.detach = function () {
1761
- if (this.editor) {
1762
- this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
1763
- this.editor.off("changeSelection", this.changeListener);
1764
- this.editor.off("blur", this.blurListener);
1765
- this.editor.off("mousedown", this.mousedownListener);
1766
- this.editor.off("mousewheel", this.mousewheelListener);
1767
- }
1768
- this.$firstOpenTimer.cancel();
1769
- this.changeTimer.cancel();
1770
- this.hideDocTooltip();
1771
- if (this.completionProvider) {
1772
- this.completionProvider.detach();
1773
- }
1774
- if (this.popup && this.popup.isOpen)
1775
- this.popup.hide();
1776
- if (this.popup && this.popup.renderer) {
1777
- this.popup.renderer.off("afterRender", this.$onPopupRender);
1778
- }
1779
- if (this.base)
1780
- this.base.detach();
1781
- this.activated = false;
1782
- this.completionProvider = this.completions = this.base = null;
1783
- this.unObserveLayoutChanges();
1784
- };
1785
- Autocomplete.prototype.changeListener = function (e) {
1786
- var cursor = this.editor.selection.lead;
1787
- if (cursor.row != this.base.row || cursor.column < this.base.column) {
1788
- this.detach();
1789
- }
1790
- if (this.activated)
1791
- this.changeTimer.schedule();
1792
- else
1793
- this.detach();
1794
- };
1795
- Autocomplete.prototype.blurListener = function (e) {
1796
- var el = document.activeElement;
1797
- var text = this.editor.textInput.getElement();
1798
- var fromTooltip = e.relatedTarget && this.tooltipNode && this.tooltipNode.contains(e.relatedTarget);
1799
- var container = this.popup && this.popup.container;
1800
- if (el != text && el.parentNode != container && !fromTooltip
1801
- && el != this.tooltipNode && e.relatedTarget != text) {
1802
- this.detach();
1803
- }
1804
- };
1805
- Autocomplete.prototype.mousedownListener = function (e) {
1806
- this.detach();
1807
- };
1808
- Autocomplete.prototype.mousewheelListener = function (e) {
1809
- if (this.popup && !this.popup.isMouseOver)
1810
- this.detach();
1811
- };
1812
- Autocomplete.prototype.mouseOutListener = function (e) {
1813
- if (this.popup.isOpen)
1814
- this.$updatePopupPosition();
1815
- };
1816
- Autocomplete.prototype.goTo = function (where) {
1817
- this.popup.goTo(where);
1818
- };
1819
- Autocomplete.prototype.insertMatch = function (data, options) {
1820
- if (!data)
1821
- data = this.popup.getData(this.popup.getRow());
1822
- if (!data)
1823
- return false;
1824
- if (data.value === "") // Explicitly given nothing to insert, e.g. "No suggestion state"
1825
- return this.detach();
1826
- var completions = this.completions;
1827
- var result = this.getCompletionProvider().insertMatch(this.editor, data, completions.filterText, options);
1828
- if (this.completions == completions)
1829
- this.detach();
1830
- return result;
1831
- };
1832
- Autocomplete.prototype.showPopup = function (editor, options) {
1833
- if (this.editor)
1834
- this.detach();
1835
- this.activated = true;
1836
- this.editor = editor;
1837
- if (editor.completer != this) {
1838
- if (editor.completer)
1839
- editor.completer.detach();
1840
- editor.completer = this;
1841
- }
1842
- editor.on("changeSelection", this.changeListener);
1843
- editor.on("blur", this.blurListener);
1844
- editor.on("mousedown", this.mousedownListener);
1845
- editor.on("mousewheel", this.mousewheelListener);
1846
- this.updateCompletions(false, options);
1847
- };
1848
- Autocomplete.prototype.getCompletionProvider = function (initialPosition) {
1849
- if (!this.completionProvider)
1850
- this.completionProvider = new CompletionProvider(initialPosition);
1851
- return this.completionProvider;
1852
- };
1853
- Autocomplete.prototype.gatherCompletions = function (editor, callback) {
1854
- return this.getCompletionProvider().gatherCompletions(editor, callback);
1855
- };
1856
- Autocomplete.prototype.updateCompletions = function (keepPopupPosition, options) {
1857
- if (keepPopupPosition && this.base && this.completions) {
1858
- var pos = this.editor.getCursorPosition();
1859
- var prefix = this.editor.session.getTextRange({ start: this.base, end: pos });
1860
- if (prefix == this.completions.filterText)
1861
- return;
1862
- this.completions.setFilter(prefix);
1863
- if (!this.completions.filtered.length)
1864
- return this.detach();
1865
- if (this.completions.filtered.length == 1
1866
- && this.completions.filtered[0].value == prefix
1867
- && !this.completions.filtered[0].snippet)
1868
- return this.detach();
1869
- this.openPopup(this.editor, prefix, keepPopupPosition);
1870
- return;
1871
- }
1872
- if (options && options.matches) {
1873
- var pos = this.editor.getSelectionRange().start;
1874
- this.base = this.editor.session.doc.createAnchor(pos.row, pos.column);
1875
- this.base.$insertRight = true;
1876
- this.completions = new FilteredList(options.matches);
1877
- this.getCompletionProvider().completions = this.completions;
1878
- return this.openPopup(this.editor, "", keepPopupPosition);
1879
- }
1880
- var session = this.editor.getSession();
1881
- var pos = this.editor.getCursorPosition();
1882
- var prefix = util.getCompletionPrefix(this.editor);
1883
- this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
1884
- this.base.$insertRight = true;
1885
- var completionOptions = {
1886
- exactMatch: this.exactMatch,
1887
- ignoreCaption: this.ignoreCaption
1888
- };
1889
- this.getCompletionProvider({
1890
- prefix: prefix,
1891
- pos: pos
1892
- }).provideCompletions(this.editor, completionOptions,
1893
- function (err, completions, finished) {
1894
- var filtered = completions.filtered;
1895
- var prefix = util.getCompletionPrefix(this.editor);
1896
- this.$firstOpenTimer.cancel();
1897
- if (finished) {
1898
- if (!filtered.length) {
1899
- var emptyMessage = !this.autoShown && this.emptyMessage;
1900
- if (typeof emptyMessage == "function")
1901
- emptyMessage = this.emptyMessage(prefix);
1902
- if (emptyMessage) {
1903
- var completionsForEmpty = [{
1904
- caption: emptyMessage,
1905
- value: ""
1906
- }
1907
- ];
1908
- this.completions = new FilteredList(completionsForEmpty);
1909
- this.openPopup(this.editor, prefix, keepPopupPosition);
1910
- this.popup.renderer.setStyle("ace_loading", false);
1911
- this.popup.renderer.setStyle("ace_empty-message", true);
1912
- return;
1913
- }
1914
- return this.detach();
1915
- }
1916
- if (filtered.length == 1 && filtered[0].value == prefix
1917
- && !filtered[0].snippet)
1918
- return this.detach();
1919
- if (this.autoInsert && !this.autoShown && filtered.length == 1)
1920
- return this.insertMatch(filtered[0]);
1921
- }
1922
- this.completions = !finished && this.showLoadingState ?
1923
- new FilteredList(Autocomplete.completionsForLoading.concat(filtered), completions.filterText) :
1924
- completions;
1925
- this.openPopup(this.editor, prefix, keepPopupPosition);
1926
- this.popup.renderer.setStyle("ace_empty-message", false);
1927
- this.popup.renderer.setStyle("ace_loading", !finished);
1928
- }.bind(this));
1929
- if (this.showLoadingState && !this.autoShown && !(this.popup && this.popup.isOpen)) {
1930
- this.$firstOpenTimer.delay(this.stickySelectionDelay / 2);
1931
- }
1932
- };
1933
- Autocomplete.prototype.cancelContextMenu = function () {
1934
- this.editor.$mouseHandler.cancelContextMenu();
1935
- };
1936
- Autocomplete.prototype.updateDocTooltip = function () {
1937
- var popup = this.popup;
1938
- var all = this.completions.filtered;
1939
- var selected = all && (all[popup.getHoveredRow()] || all[popup.getRow()]);
1940
- var doc = null;
1941
- if (!selected || !this.editor || !this.popup.isOpen)
1942
- return this.hideDocTooltip();
1943
- var completersLength = this.editor.completers.length;
1944
- for (var i = 0; i < completersLength; i++) {
1945
- var completer = this.editor.completers[i];
1946
- if (completer.getDocTooltip && selected.completerId === completer.id) {
1947
- doc = completer.getDocTooltip(selected);
1948
- break;
1949
- }
1950
- }
1951
- if (!doc && typeof selected != "string")
1952
- doc = selected;
1953
- if (typeof doc == "string")
1954
- doc = { docText: doc };
1955
- if (!doc || !(doc.docHTML || doc.docText))
1956
- return this.hideDocTooltip();
1957
- this.showDocTooltip(doc);
1958
- };
1959
- Autocomplete.prototype.showDocTooltip = function (item) {
1960
- if (!this.tooltipNode) {
1961
- this.tooltipNode = dom.createElement("div");
1962
- this.tooltipNode.style.margin = "0";
1963
- this.tooltipNode.style.pointerEvents = "auto";
1964
- this.tooltipNode.style.overscrollBehavior = "contain";
1965
- this.tooltipNode.tabIndex = -1;
1966
- this.tooltipNode.onblur = this.blurListener.bind(this);
1967
- this.tooltipNode.onclick = this.onTooltipClick.bind(this);
1968
- this.tooltipNode.id = "doc-tooltip";
1969
- this.tooltipNode.setAttribute("role", "tooltip");
1970
- this.tooltipNode.addEventListener("wheel", preventParentScroll);
1971
- }
1972
- var theme = this.editor.renderer.theme;
1973
- this.tooltipNode.className = "ace_tooltip ace_doc-tooltip " +
1974
- (theme.isDark ? "ace_dark " : "") + (theme.cssClass || "");
1975
- var tooltipNode = this.tooltipNode;
1976
- if (item.docHTML) {
1977
- tooltipNode.innerHTML = item.docHTML;
1978
- }
1979
- else if (item.docText) {
1980
- tooltipNode.textContent = item.docText;
1981
- }
1982
- if (!tooltipNode.parentNode)
1983
- this.popup.container.appendChild(this.tooltipNode);
1984
- var popup = this.popup;
1985
- var rect = popup.container.getBoundingClientRect();
1986
- tooltipNode.style.top = popup.container.style.top;
1987
- tooltipNode.style.bottom = popup.container.style.bottom;
1988
- tooltipNode.style.display = "block";
1989
- if (window.innerWidth - rect.right < 320) {
1990
- if (rect.left < 320) {
1991
- if (popup.isTopdown) {
1992
- tooltipNode.style.top = rect.bottom + "px";
1993
- tooltipNode.style.left = rect.left + "px";
1994
- tooltipNode.style.right = "";
1995
- tooltipNode.style.bottom = "";
1996
- }
1997
- else {
1998
- tooltipNode.style.top = popup.container.offsetTop - tooltipNode.offsetHeight + "px";
1999
- tooltipNode.style.left = rect.left + "px";
2000
- tooltipNode.style.right = "";
2001
- tooltipNode.style.bottom = "";
2002
- }
2003
- }
2004
- else {
2005
- tooltipNode.style.right = window.innerWidth - rect.left + "px";
2006
- tooltipNode.style.left = "";
2007
- }
2008
- }
2009
- else {
2010
- tooltipNode.style.left = (rect.right + 1) + "px";
2011
- tooltipNode.style.right = "";
2012
- }
2013
- };
2014
- Autocomplete.prototype.hideDocTooltip = function () {
2015
- this.tooltipTimer.cancel();
2016
- if (!this.tooltipNode)
2017
- return;
2018
- var el = this.tooltipNode;
2019
- if (!this.editor.isFocused() && document.activeElement == el)
2020
- this.editor.focus();
2021
- this.tooltipNode = null;
2022
- if (el.parentNode)
2023
- el.parentNode.removeChild(el);
2024
- };
2025
- Autocomplete.prototype.onTooltipClick = function (e) {
2026
- var a = e.target;
2027
- while (a && a != this.tooltipNode) {
2028
- if (a.nodeName == "A" && a.href) {
2029
- a.rel = "noreferrer";
2030
- a.target = "_blank";
2031
- break;
2032
- }
2033
- a = a.parentNode;
2034
- }
2035
- };
2036
- Autocomplete.prototype.destroy = function () {
2037
- this.detach();
2038
- if (this.popup) {
2039
- this.popup.destroy();
2040
- var el = this.popup.container;
2041
- if (el && el.parentNode)
2042
- el.parentNode.removeChild(el);
2043
- }
2044
- if (this.editor && this.editor.completer == this) {
2045
- this.editor.off("destroy", destroyCompleter);
2046
- this.editor.completer = null;
2047
- }
2048
- this.inlineRenderer = this.popup = this.editor = null;
2049
- };
2050
- Autocomplete.for = function (editor) {
2051
- if (editor.completer instanceof Autocomplete) {
2052
- return editor.completer;
2053
- }
2054
- if (editor.completer) {
2055
- editor.completer.destroy();
2056
- editor.completer = null;
2057
- }
2058
- if (config.get("sharedPopups")) {
2059
- if (!Autocomplete["$sharedInstance"])
2060
- Autocomplete["$sharedInstance"] = new Autocomplete();
2061
- editor.completer = Autocomplete["$sharedInstance"];
2062
- }
2063
- else {
2064
- editor.completer = new Autocomplete();
2065
- editor.once("destroy", destroyCompleter);
2066
- }
2067
- return editor.completer;
2068
- };
2069
- return Autocomplete;
2070
- }());
2071
- Autocomplete.prototype.commands = {
2072
- "Up": function (editor) { editor.completer.goTo("up"); },
2073
- "Down": function (editor) { editor.completer.goTo("down"); },
2074
- "Ctrl-Up|Ctrl-Home": function (editor) { editor.completer.goTo("start"); },
2075
- "Ctrl-Down|Ctrl-End": function (editor) { editor.completer.goTo("end"); },
2076
- "Esc": function (editor) { editor.completer.detach(); },
2077
- "Return": function (editor) { return editor.completer.insertMatch(); },
2078
- "Shift-Return": function (editor) { editor.completer.insertMatch(null, { deleteSuffix: true }); },
2079
- "Tab": function (editor) {
2080
- var result = editor.completer.insertMatch();
2081
- if (!result && !editor.tabstopManager)
2082
- editor.completer.goTo("down");
2083
- else
2084
- return result;
2085
- },
2086
- "Backspace": function (editor) {
2087
- editor.execCommand("backspace");
2088
- var prefix = util.getCompletionPrefix(editor);
2089
- if (!prefix && editor.completer)
2090
- editor.completer.detach();
2091
- },
2092
- "PageUp": function (editor) { editor.completer.popup.gotoPageUp(); },
2093
- "PageDown": function (editor) { editor.completer.popup.gotoPageDown(); }
2094
- };
2095
- Autocomplete.startCommand = {
2096
- name: "startAutocomplete",
2097
- exec: function (editor, options) {
2098
- var completer = Autocomplete.for(editor);
2099
- completer.autoInsert = false;
2100
- completer.autoSelect = true;
2101
- completer.autoShown = false;
2102
- completer.showPopup(editor, options);
2103
- completer.cancelContextMenu();
2104
- },
2105
- bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
2106
- };
2107
- var CompletionProvider = /** @class */ (function () {
2108
- function CompletionProvider(initialPosition) {
2109
- this.initialPosition = initialPosition;
2110
- this.active = true;
2111
- }
2112
- CompletionProvider.prototype.insertByIndex = function (editor, index, options) {
2113
- if (!this.completions || !this.completions.filtered) {
2114
- return false;
2115
- }
2116
- return this.insertMatch(editor, this.completions.filtered[index], options);
2117
- };
2118
- CompletionProvider.prototype.insertMatch = function (editor, data, options) {
2119
- if (!data)
2120
- return false;
2121
- editor.startOperation({ command: { name: "insertMatch" } });
2122
- if (data.completer && data.completer.insertMatch) {
2123
- data.completer.insertMatch(editor, data);
2124
- }
2125
- else {
2126
- if (!this.completions)
2127
- return false;
2128
- var replaceBefore = this.completions.filterText.length;
2129
- var replaceAfter = 0;
2130
- if (data.range && data.range.start.row === data.range.end.row) {
2131
- replaceBefore -= this.initialPosition.prefix.length;
2132
- replaceBefore += this.initialPosition.pos.column - data.range.start.column;
2133
- replaceAfter += data.range.end.column - this.initialPosition.pos.column;
2134
- }
2135
- if (replaceBefore || replaceAfter) {
2136
- var ranges;
2137
- if (editor.selection.getAllRanges) {
2138
- ranges = editor.selection.getAllRanges();
2139
- }
2140
- else {
2141
- ranges = [editor.getSelectionRange()];
2142
- }
2143
- for (var i = 0, range; range = ranges[i]; i++) {
2144
- range.start.column -= replaceBefore;
2145
- range.end.column += replaceAfter;
2146
- editor.session.remove(range);
2147
- }
2148
- }
2149
- if (data.snippet) {
2150
- snippetManager.insertSnippet(editor, data.snippet);
2151
- }
2152
- else {
2153
- this.$insertString(editor, data);
2154
- }
2155
- if (data.completer && data.completer.onInsert && typeof data.completer.onInsert == "function") {
2156
- data.completer.onInsert(editor, data);
2157
- }
2158
- if (data.command && data.command === "startAutocomplete") {
2159
- editor.execCommand(data.command);
2160
- }
2161
- }
2162
- editor.endOperation();
2163
- return true;
2164
- };
2165
- CompletionProvider.prototype.$insertString = function (editor, data) {
2166
- var text = data.value || data;
2167
- editor.execCommand("insertstring", text);
2168
- };
2169
- CompletionProvider.prototype.gatherCompletions = function (editor, callback) {
2170
- var session = editor.getSession();
2171
- var pos = editor.getCursorPosition();
2172
- var prefix = util.getCompletionPrefix(editor);
2173
- var matches = [];
2174
- this.completers = editor.completers;
2175
- var total = editor.completers.length;
2176
- editor.completers.forEach(function (completer, i) {
2177
- completer.getCompletions(editor, session, pos, prefix, function (err, results) {
2178
- if (completer.hideInlinePreview)
2179
- results = results.map(function (result) {
2180
- return Object.assign(result, { hideInlinePreview: completer.hideInlinePreview });
2181
- });
2182
- if (!err && results)
2183
- matches = matches.concat(results);
2184
- callback(null, {
2185
- prefix: util.getCompletionPrefix(editor),
2186
- matches: matches,
2187
- finished: (--total === 0)
2188
- });
2189
- });
2190
- });
2191
- return true;
2192
- };
2193
- CompletionProvider.prototype.provideCompletions = function (editor, options, callback) {
2194
- var processResults = function (results) {
2195
- var prefix = results.prefix;
2196
- var matches = results.matches;
2197
- this.completions = new FilteredList(matches);
2198
- if (options.exactMatch)
2199
- this.completions.exactMatch = true;
2200
- if (options.ignoreCaption)
2201
- this.completions.ignoreCaption = true;
2202
- this.completions.setFilter(prefix);
2203
- if (results.finished || this.completions.filtered.length)
2204
- callback(null, this.completions, results.finished);
2205
- }.bind(this);
2206
- var isImmediate = true;
2207
- var immediateResults = null;
2208
- this.gatherCompletions(editor, function (err, results) {
2209
- if (!this.active) {
2210
- return;
2211
- }
2212
- if (err) {
2213
- callback(err, [], true);
2214
- this.detach();
2215
- }
2216
- var prefix = results.prefix;
2217
- if (prefix.indexOf(results.prefix) !== 0)
2218
- return;
2219
- if (isImmediate) {
2220
- immediateResults = results;
2221
- return;
2222
- }
2223
- processResults(results);
2224
- }.bind(this));
2225
- isImmediate = false;
2226
- if (immediateResults) {
2227
- var results = immediateResults;
2228
- immediateResults = null;
2229
- processResults(results);
2230
- }
2231
- };
2232
- CompletionProvider.prototype.detach = function () {
2233
- this.active = false;
2234
- this.completers && this.completers.forEach(function (completer) {
2235
- if (typeof completer.cancel === "function") {
2236
- completer.cancel();
2237
- }
2238
- });
2239
- };
2240
- return CompletionProvider;
2241
- }());
2242
- var FilteredList = /** @class */ (function () {
2243
- function FilteredList(array, filterText) {
2244
- this.all = array;
2245
- this.filtered = array;
2246
- this.filterText = filterText || "";
2247
- this.exactMatch = false;
2248
- this.ignoreCaption = false;
2249
- }
2250
- FilteredList.prototype.setFilter = function (str) {
2251
- if (str.length > this.filterText && str.lastIndexOf(this.filterText, 0) === 0)
2252
- var matches = this.filtered;
2253
- else
2254
- var matches = this.all;
2255
- this.filterText = str;
2256
- matches = this.filterCompletions(matches, this.filterText);
2257
- matches = matches.sort(function (a, b) {
2258
- return b.exactMatch - a.exactMatch || b.$score - a.$score
2259
- || (a.caption || a.value).localeCompare(b.caption || b.value);
2260
- });
2261
- var prev = null;
2262
- matches = matches.filter(function (item) {
2263
- var caption = item.snippet || item.caption || item.value;
2264
- if (caption === prev)
2265
- return false;
2266
- prev = caption;
2267
- return true;
2268
- });
2269
- this.filtered = matches;
2270
- };
2271
- FilteredList.prototype.filterCompletions = function (items, needle) {
2272
- var results = [];
2273
- var upper = needle.toUpperCase();
2274
- var lower = needle.toLowerCase();
2275
- loop: for (var i = 0, item; item = items[i]; i++) {
2276
- var caption = (!this.ignoreCaption && item.caption) || item.value || item.snippet;
2277
- if (!caption)
2278
- continue;
2279
- var lastIndex = -1;
2280
- var matchMask = 0;
2281
- var penalty = 0;
2282
- var index, distance;
2283
- if (this.exactMatch) {
2284
- if (needle !== caption.substr(0, needle.length))
2285
- continue loop;
2286
- }
2287
- else {
2288
- var fullMatchIndex = caption.toLowerCase().indexOf(lower);
2289
- if (fullMatchIndex > -1) {
2290
- penalty = fullMatchIndex;
2291
- }
2292
- else {
2293
- for (var j = 0; j < needle.length; j++) {
2294
- var i1 = caption.indexOf(lower[j], lastIndex + 1);
2295
- var i2 = caption.indexOf(upper[j], lastIndex + 1);
2296
- index = (i1 >= 0) ? ((i2 < 0 || i1 < i2) ? i1 : i2) : i2;
2297
- if (index < 0)
2298
- continue loop;
2299
- distance = index - lastIndex - 1;
2300
- if (distance > 0) {
2301
- if (lastIndex === -1)
2302
- penalty += 10;
2303
- penalty += distance;
2304
- matchMask = matchMask | (1 << j);
2305
- }
2306
- lastIndex = index;
2307
- }
2308
- }
2309
- }
2310
- item.matchMask = matchMask;
2311
- item.exactMatch = penalty ? 0 : 1;
2312
- item.$score = (item.score || 0) - penalty;
2313
- results.push(item);
2314
- }
2315
- return results;
2316
- };
2317
- return FilteredList;
2318
- }());
2319
- exports.Autocomplete = Autocomplete;
2320
- exports.CompletionProvider = CompletionProvider;
2321
- exports.FilteredList = FilteredList;
2322
-
2323
- });
2324
-
2325
- ace.define("ace/ext/command_bar",["require","exports","module","ace/tooltip","ace/lib/event_emitter","ace/lib/lang","ace/lib/dom","ace/lib/oop","ace/lib/useragent"], function(require, exports, module){var __values = (this && this.__values) || function(o) {
2326
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
2327
- if (m) return m.call(o);
2328
- if (o && typeof o.length === "number") return {
2329
- next: function () {
2330
- if (o && i >= o.length) o = void 0;
2331
- return { value: o && o[i++], done: !o };
2332
- }
2333
- };
2334
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
2335
- };
2336
- var Tooltip = require("../tooltip").Tooltip;
2337
- var EventEmitter = require("../lib/event_emitter").EventEmitter;
2338
- var lang = require("../lib/lang");
2339
- var dom = require("../lib/dom");
2340
- var oop = require("../lib/oop");
2341
- var useragent = require("../lib/useragent");
2342
- var BUTTON_CLASS_NAME = 'command_bar_tooltip_button';
2343
- var VALUE_CLASS_NAME = 'command_bar_button_value';
2344
- var CAPTION_CLASS_NAME = 'command_bar_button_caption';
2345
- var KEYBINDING_CLASS_NAME = 'command_bar_keybinding';
2346
- var TOOLTIP_CLASS_NAME = 'command_bar_tooltip';
2347
- var MORE_OPTIONS_BUTTON_ID = 'MoreOptionsButton';
2348
- var defaultDelay = 100;
2349
- var defaultMaxElements = 4;
2350
- var minPosition = function (posA, posB) {
2351
- if (posB.row > posA.row) {
2352
- return posA;
2353
- }
2354
- else if (posB.row === posA.row && posB.column > posA.column) {
2355
- return posA;
2356
- }
2357
- return posB;
2358
- };
2359
- var keyDisplayMap = {
2360
- "Ctrl": { mac: "^" },
2361
- "Option": { mac: "⌥" },
2362
- "Command": { mac: "⌘" },
2363
- "Cmd": { mac: "⌘" },
2364
- "Shift": "⇧",
2365
- "Left": "←",
2366
- "Right": "→",
2367
- "Up": "↑",
2368
- "Down": "↓"
2369
- };
2370
- var CommandBarTooltip = /** @class */ (function () {
2371
- function CommandBarTooltip(parentNode, options) {
2372
- var e_1, _a;
2373
- options = options || {};
2374
- this.parentNode = parentNode;
2375
- this.tooltip = new Tooltip(this.parentNode);
2376
- this.moreOptions = new Tooltip(this.parentNode);
2377
- this.maxElementsOnTooltip = options.maxElementsOnTooltip || defaultMaxElements;
2378
- this.$alwaysShow = options.alwaysShow || false;
2379
- this.eventListeners = {};
2380
- this.elements = {};
2381
- this.commands = {};
2382
- this.tooltipEl = dom.buildDom(['div', { class: TOOLTIP_CLASS_NAME }], this.tooltip.getElement());
2383
- this.moreOptionsEl = dom.buildDom(['div', { class: TOOLTIP_CLASS_NAME + " tooltip_more_options" }], this.moreOptions.getElement());
2384
- this.$showTooltipTimer = lang.delayedCall(this.$showTooltip.bind(this), options.showDelay || defaultDelay);
2385
- this.$hideTooltipTimer = lang.delayedCall(this.$hideTooltip.bind(this), options.hideDelay || defaultDelay);
2386
- this.$tooltipEnter = this.$tooltipEnter.bind(this);
2387
- this.$onMouseMove = this.$onMouseMove.bind(this);
2388
- this.$onChangeScroll = this.$onChangeScroll.bind(this);
2389
- this.$onEditorChangeSession = this.$onEditorChangeSession.bind(this);
2390
- this.$scheduleTooltipForHide = this.$scheduleTooltipForHide.bind(this);
2391
- this.$preventMouseEvent = this.$preventMouseEvent.bind(this);
2392
- try {
2393
- for (var _b = __values(["mousedown", "mouseup", "click"]), _c = _b.next(); !_c.done; _c = _b.next()) {
2394
- var event = _c.value;
2395
- this.tooltip.getElement().addEventListener(event, this.$preventMouseEvent);
2396
- this.moreOptions.getElement().addEventListener(event, this.$preventMouseEvent);
2397
- }
2398
- }
2399
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2400
- finally {
2401
- try {
2402
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2403
- }
2404
- finally { if (e_1) throw e_1.error; }
2405
- }
2406
- }
2407
- CommandBarTooltip.prototype.registerCommand = function (id, command) {
2408
- var registerForMainTooltip = Object.keys(this.commands).length < this.maxElementsOnTooltip;
2409
- if (!registerForMainTooltip && !this.elements[MORE_OPTIONS_BUTTON_ID]) {
2410
- this.$createCommand(MORE_OPTIONS_BUTTON_ID, {
2411
- name: "···",
2412
- exec:
2413
- function () {
2414
- this.$shouldHideMoreOptions = false;
2415
- this.$setMoreOptionsVisibility(!this.isMoreOptionsShown());
2416
- }.bind(this),
2417
- type: "checkbox",
2418
- getValue: function () {
2419
- return this.isMoreOptionsShown();
2420
- }.bind(this),
2421
- enabled: true
2422
- }, true);
2423
- }
2424
- this.$createCommand(id, command, registerForMainTooltip);
2425
- if (this.isShown()) {
2426
- this.updatePosition();
2427
- }
2428
- };
2429
- CommandBarTooltip.prototype.isShown = function () {
2430
- return !!this.tooltip && this.tooltip.isOpen;
2431
- };
2432
- CommandBarTooltip.prototype.isMoreOptionsShown = function () {
2433
- return !!this.moreOptions && this.moreOptions.isOpen;
2434
- };
2435
- CommandBarTooltip.prototype.getAlwaysShow = function () {
2436
- return this.$alwaysShow;
2437
- };
2438
- CommandBarTooltip.prototype.setAlwaysShow = function (alwaysShow) {
2439
- this.$alwaysShow = alwaysShow;
2440
- this.$updateOnHoverHandlers(!this.$alwaysShow);
2441
- this._signal("alwaysShow", this.$alwaysShow);
2442
- };
2443
- CommandBarTooltip.prototype.attach = function (editor) {
2444
- if (!editor || (this.isShown() && this.editor === editor)) {
2445
- return;
2446
- }
2447
- this.detach();
2448
- this.editor = editor;
2449
- this.editor.on("changeSession", this.$onEditorChangeSession);
2450
- if (this.editor.session) {
2451
- this.editor.session.on("changeScrollLeft", this.$onChangeScroll);
2452
- this.editor.session.on("changeScrollTop", this.$onChangeScroll);
2453
- }
2454
- if (this.getAlwaysShow()) {
2455
- this.$showTooltip();
2456
- }
2457
- else {
2458
- this.$updateOnHoverHandlers(true);
2459
- }
2460
- };
2461
- CommandBarTooltip.prototype.updatePosition = function () {
2462
- if (!this.editor) {
2463
- return;
2464
- }
2465
- var renderer = this.editor.renderer;
2466
- var ranges;
2467
- if (this.editor.selection.getAllRanges) {
2468
- ranges = this.editor.selection.getAllRanges();
2469
- }
2470
- else {
2471
- ranges = [this.editor.getSelectionRange()];
2472
- }
2473
- if (!ranges.length) {
2474
- return;
2475
- }
2476
- var minPos = minPosition(ranges[0].start, ranges[0].end);
2477
- for (var i = 0, range; range = ranges[i]; i++) {
2478
- minPos = minPosition(minPos, minPosition(range.start, range.end));
2479
- }
2480
- var pos = renderer.$cursorLayer.getPixelPosition(minPos, true);
2481
- var tooltipEl = this.tooltip.getElement();
2482
- var screenWidth = window.innerWidth;
2483
- var screenHeight = window.innerHeight;
2484
- var rect = this.editor.container.getBoundingClientRect();
2485
- pos.top += rect.top - renderer.layerConfig.offset;
2486
- pos.left += rect.left + renderer.gutterWidth - renderer.scrollLeft;
2487
- var cursorVisible = pos.top >= rect.top && pos.top <= rect.bottom &&
2488
- pos.left >= rect.left + renderer.gutterWidth && pos.left <= rect.right;
2489
- if (!cursorVisible && this.isShown()) {
2490
- this.$hideTooltip();
2491
- return;
2492
- }
2493
- else if (cursorVisible && !this.isShown() && this.getAlwaysShow()) {
2494
- this.$showTooltip();
2495
- return;
2496
- }
2497
- var top = pos.top - tooltipEl.offsetHeight;
2498
- var left = Math.min(screenWidth - tooltipEl.offsetWidth, pos.left);
2499
- var tooltipFits = top >= 0 && top + tooltipEl.offsetHeight <= screenHeight &&
2500
- left >= 0 && left + tooltipEl.offsetWidth <= screenWidth;
2501
- if (!tooltipFits) {
2502
- this.$hideTooltip();
2503
- return;
2504
- }
2505
- this.tooltip.setPosition(left, top);
2506
- if (this.isMoreOptionsShown()) {
2507
- top = top + tooltipEl.offsetHeight;
2508
- left = this.elements[MORE_OPTIONS_BUTTON_ID].getBoundingClientRect().left;
2509
- var moreOptionsEl = this.moreOptions.getElement();
2510
- var screenHeight = window.innerHeight;
2511
- if (top + moreOptionsEl.offsetHeight > screenHeight) {
2512
- top -= tooltipEl.offsetHeight + moreOptionsEl.offsetHeight;
2513
- }
2514
- if (left + moreOptionsEl.offsetWidth > screenWidth) {
2515
- left = screenWidth - moreOptionsEl.offsetWidth;
2516
- }
2517
- this.moreOptions.setPosition(left, top);
2518
- }
2519
- };
2520
- CommandBarTooltip.prototype.update = function () {
2521
- Object.keys(this.elements).forEach(this.$updateElement.bind(this));
2522
- };
2523
- CommandBarTooltip.prototype.detach = function () {
2524
- this.tooltip.hide();
2525
- this.moreOptions.hide();
2526
- this.$updateOnHoverHandlers(false);
2527
- if (this.editor) {
2528
- this.editor.off("changeSession", this.$onEditorChangeSession);
2529
- if (this.editor.session) {
2530
- this.editor.session.off("changeScrollLeft", this.$onChangeScroll);
2531
- this.editor.session.off("changeScrollTop", this.$onChangeScroll);
2532
- }
2533
- }
2534
- this.$mouseInTooltip = false;
2535
- this.editor = null;
2536
- };
2537
- CommandBarTooltip.prototype.destroy = function () {
2538
- if (this.tooltip && this.moreOptions) {
2539
- this.detach();
2540
- this.tooltip.destroy();
2541
- this.moreOptions.destroy();
2542
- }
2543
- this.eventListeners = {};
2544
- this.commands = {};
2545
- this.elements = {};
2546
- this.tooltip = this.moreOptions = this.parentNode = null;
2547
- };
2548
- CommandBarTooltip.prototype.$createCommand = function (id, command, forMainTooltip) {
2549
- var parentEl = forMainTooltip ? this.tooltipEl : this.moreOptionsEl;
2550
- var keyParts = [];
2551
- var bindKey = command.bindKey;
2552
- if (bindKey) {
2553
- if (typeof bindKey === 'object') {
2554
- bindKey = useragent.isMac ? bindKey.mac : bindKey.win;
2555
- }
2556
- bindKey = bindKey.split("|")[0];
2557
- keyParts = bindKey.split("-");
2558
- keyParts = keyParts.map(function (key) {
2559
- if (keyDisplayMap[key]) {
2560
- if (typeof keyDisplayMap[key] === 'string') {
2561
- return keyDisplayMap[key];
2562
- }
2563
- else if (useragent.isMac && keyDisplayMap[key].mac) {
2564
- return keyDisplayMap[key].mac;
2565
- }
2566
- }
2567
- return key;
2568
- });
2569
- }
2570
- var buttonNode;
2571
- if (forMainTooltip && command.iconCssClass) {
2572
- buttonNode = [
2573
- 'div',
2574
- {
2575
- class: ["ace_icon_svg", command.iconCssClass].join(" "),
2576
- "aria-label": command.name + " (" + command.bindKey + ")"
2577
- }
2578
- ];
2579
- }
2580
- else {
2581
- buttonNode = [
2582
- ['div', { class: VALUE_CLASS_NAME }],
2583
- ['div', { class: CAPTION_CLASS_NAME }, command.name]
2584
- ];
2585
- if (keyParts.length) {
2586
- buttonNode.push([
2587
- 'div',
2588
- { class: KEYBINDING_CLASS_NAME },
2589
- keyParts.map(function (keyPart) {
2590
- return ['div', keyPart];
2591
- })
2592
- ]);
2593
- }
2594
- }
2595
- dom.buildDom(['div', { class: [BUTTON_CLASS_NAME, command.cssClass || ""].join(" "), ref: id }, buttonNode], parentEl, this.elements);
2596
- this.commands[id] = command;
2597
- var eventListener =
2598
- function (e) {
2599
- if (this.editor) {
2600
- this.editor.focus();
2601
- }
2602
- this.$shouldHideMoreOptions = this.isMoreOptionsShown();
2603
- if (!this.elements[id].disabled && command.exec) {
2604
- command.exec(this.editor);
2605
- }
2606
- if (this.$shouldHideMoreOptions) {
2607
- this.$setMoreOptionsVisibility(false);
2608
- }
2609
- this.update();
2610
- e.preventDefault();
2611
- }.bind(this);
2612
- this.eventListeners[id] = eventListener;
2613
- this.elements[id].addEventListener('click', eventListener.bind(this));
2614
- this.$updateElement(id);
2615
- };
2616
- CommandBarTooltip.prototype.$setMoreOptionsVisibility = function (visible) {
2617
- if (visible) {
2618
- this.moreOptions.setTheme(this.editor.renderer.theme);
2619
- this.moreOptions.setClassName(TOOLTIP_CLASS_NAME + "_wrapper");
2620
- this.moreOptions.show();
2621
- this.update();
2622
- this.updatePosition();
2623
- }
2624
- else {
2625
- this.moreOptions.hide();
2626
- }
2627
- };
2628
- CommandBarTooltip.prototype.$onEditorChangeSession = function (e) {
2629
- if (e.oldSession) {
2630
- e.oldSession.off("changeScrollTop", this.$onChangeScroll);
2631
- e.oldSession.off("changeScrollLeft", this.$onChangeScroll);
2632
- }
2633
- this.detach();
2634
- };
2635
- CommandBarTooltip.prototype.$onChangeScroll = function () {
2636
- if (this.editor.renderer && (this.isShown() || this.getAlwaysShow())) {
2637
- this.editor.renderer.once("afterRender", this.updatePosition.bind(this));
2638
- }
2639
- };
2640
- CommandBarTooltip.prototype.$onMouseMove = function (e) {
2641
- if (this.$mouseInTooltip) {
2642
- return;
2643
- }
2644
- var cursorPosition = this.editor.getCursorPosition();
2645
- var cursorScreenPosition = this.editor.renderer.textToScreenCoordinates(cursorPosition.row, cursorPosition.column);
2646
- var lineHeight = this.editor.renderer.lineHeight;
2647
- var isInCurrentLine = e.clientY >= cursorScreenPosition.pageY && e.clientY < cursorScreenPosition.pageY + lineHeight;
2648
- if (isInCurrentLine) {
2649
- if (!this.isShown() && !this.$showTooltipTimer.isPending()) {
2650
- this.$showTooltipTimer.delay();
2651
- }
2652
- if (this.$hideTooltipTimer.isPending()) {
2653
- this.$hideTooltipTimer.cancel();
2654
- }
2655
- }
2656
- else {
2657
- if (this.isShown() && !this.$hideTooltipTimer.isPending()) {
2658
- this.$hideTooltipTimer.delay();
2659
- }
2660
- if (this.$showTooltipTimer.isPending()) {
2661
- this.$showTooltipTimer.cancel();
2662
- }
2663
- }
2664
- };
2665
- CommandBarTooltip.prototype.$preventMouseEvent = function (e) {
2666
- if (this.editor) {
2667
- this.editor.focus();
2668
- }
2669
- e.preventDefault();
2670
- };
2671
- CommandBarTooltip.prototype.$scheduleTooltipForHide = function () {
2672
- this.$mouseInTooltip = false;
2673
- this.$showTooltipTimer.cancel();
2674
- this.$hideTooltipTimer.delay();
2675
- };
2676
- CommandBarTooltip.prototype.$tooltipEnter = function () {
2677
- this.$mouseInTooltip = true;
2678
- if (this.$showTooltipTimer.isPending()) {
2679
- this.$showTooltipTimer.cancel();
2680
- }
2681
- if (this.$hideTooltipTimer.isPending()) {
2682
- this.$hideTooltipTimer.cancel();
2683
- }
2684
- };
2685
- CommandBarTooltip.prototype.$updateOnHoverHandlers = function (enableHover) {
2686
- var tooltipEl = this.tooltip.getElement();
2687
- var moreOptionsEl = this.moreOptions.getElement();
2688
- if (enableHover) {
2689
- if (this.editor) {
2690
- this.editor.on("mousemove", this.$onMouseMove);
2691
- this.editor.renderer.getMouseEventTarget().addEventListener("mouseout", this.$scheduleTooltipForHide, true);
2692
- }
2693
- tooltipEl.addEventListener('mouseenter', this.$tooltipEnter);
2694
- tooltipEl.addEventListener('mouseleave', this.$scheduleTooltipForHide);
2695
- moreOptionsEl.addEventListener('mouseenter', this.$tooltipEnter);
2696
- moreOptionsEl.addEventListener('mouseleave', this.$scheduleTooltipForHide);
2697
- }
2698
- else {
2699
- if (this.editor) {
2700
- this.editor.off("mousemove", this.$onMouseMove);
2701
- this.editor.renderer.getMouseEventTarget().removeEventListener("mouseout", this.$scheduleTooltipForHide, true);
2702
- }
2703
- tooltipEl.removeEventListener('mouseenter', this.$tooltipEnter);
2704
- tooltipEl.removeEventListener('mouseleave', this.$scheduleTooltipForHide);
2705
- moreOptionsEl.removeEventListener('mouseenter', this.$tooltipEnter);
2706
- moreOptionsEl.removeEventListener('mouseleave', this.$scheduleTooltipForHide);
2707
- }
2708
- };
2709
- CommandBarTooltip.prototype.$showTooltip = function () {
2710
- if (this.isShown()) {
2711
- return;
2712
- }
2713
- this.tooltip.setTheme(this.editor.renderer.theme);
2714
- this.tooltip.setClassName(TOOLTIP_CLASS_NAME + "_wrapper");
2715
- this.tooltip.show();
2716
- this.update();
2717
- this.updatePosition();
2718
- this._signal("show");
2719
- };
2720
- CommandBarTooltip.prototype.$hideTooltip = function () {
2721
- this.$mouseInTooltip = false;
2722
- if (!this.isShown()) {
2723
- return;
2724
- }
2725
- this.moreOptions.hide();
2726
- this.tooltip.hide();
2727
- this._signal("hide");
2728
- };
2729
- CommandBarTooltip.prototype.$updateElement = function (id) {
2730
- var command = this.commands[id];
2731
- if (!command) {
2732
- return;
2733
- }
2734
- var el = this.elements[id];
2735
- var commandEnabled = command.enabled;
2736
- if (typeof commandEnabled === 'function') {
2737
- commandEnabled = commandEnabled(this.editor);
2738
- }
2739
- if (typeof command.getValue === 'function') {
2740
- var value = command.getValue(this.editor);
2741
- if (command.type === 'text') {
2742
- el.textContent = value;
2743
- }
2744
- else if (command.type === 'checkbox') {
2745
- var domCssFn = value ? dom.addCssClass : dom.removeCssClass;
2746
- var isOnTooltip = el.parentElement === this.tooltipEl;
2747
- el.ariaChecked = value;
2748
- if (isOnTooltip) {
2749
- domCssFn(el, "ace_selected");
2750
- }
2751
- else {
2752
- el = el.querySelector("." + VALUE_CLASS_NAME);
2753
- domCssFn(el, "ace_checkmark");
2754
- }
2755
- }
2756
- }
2757
- if (commandEnabled && el.disabled) {
2758
- dom.removeCssClass(el, "ace_disabled");
2759
- el.ariaDisabled = el.disabled = false;
2760
- el.removeAttribute("disabled");
2761
- }
2762
- else if (!commandEnabled && !el.disabled) {
2763
- dom.addCssClass(el, "ace_disabled");
2764
- el.ariaDisabled = el.disabled = true;
2765
- el.setAttribute("disabled", "");
2766
- }
2767
- };
2768
- return CommandBarTooltip;
2769
- }());
2770
- oop.implement(CommandBarTooltip.prototype, EventEmitter);
2771
- dom.importCssString("\n.ace_tooltip.".concat(TOOLTIP_CLASS_NAME, "_wrapper {\n padding: 0;\n}\n\n.ace_tooltip .").concat(TOOLTIP_CLASS_NAME, " {\n padding: 1px 5px;\n display: flex;\n pointer-events: auto;\n}\n\n.ace_tooltip .").concat(TOOLTIP_CLASS_NAME, ".tooltip_more_options {\n padding: 1px;\n flex-direction: column;\n}\n\ndiv.").concat(BUTTON_CLASS_NAME, " {\n display: inline-flex;\n cursor: pointer;\n margin: 1px;\n border-radius: 2px;\n padding: 2px 5px;\n align-items: center;\n}\n\ndiv.").concat(BUTTON_CLASS_NAME, ".ace_selected,\ndiv.").concat(BUTTON_CLASS_NAME, ":hover:not(.ace_disabled) {\n background-color: rgba(0, 0, 0, 0.1);\n}\n\ndiv.").concat(BUTTON_CLASS_NAME, ".ace_disabled {\n color: #777;\n pointer-events: none;\n}\n\ndiv.").concat(BUTTON_CLASS_NAME, " .ace_icon_svg {\n height: 12px;\n background-color: #000;\n}\n\ndiv.").concat(BUTTON_CLASS_NAME, ".ace_disabled .ace_icon_svg {\n background-color: #777;\n}\n\n.").concat(TOOLTIP_CLASS_NAME, ".tooltip_more_options .").concat(BUTTON_CLASS_NAME, " {\n display: flex;\n}\n\n.").concat(TOOLTIP_CLASS_NAME, ".").concat(VALUE_CLASS_NAME, " {\n display: none;\n}\n\n.").concat(TOOLTIP_CLASS_NAME, ".tooltip_more_options .").concat(VALUE_CLASS_NAME, " {\n display: inline-block;\n width: 12px;\n}\n\n.").concat(CAPTION_CLASS_NAME, " {\n display: inline-block;\n}\n\n.").concat(KEYBINDING_CLASS_NAME, " {\n margin: 0 2px;\n display: inline-block;\n font-size: 8px;\n}\n\n.").concat(TOOLTIP_CLASS_NAME, ".tooltip_more_options .").concat(KEYBINDING_CLASS_NAME, " {\n margin-left: auto;\n}\n\n.").concat(KEYBINDING_CLASS_NAME, " div {\n display: inline-block;\n min-width: 8px;\n padding: 2px;\n margin: 0 1px;\n border-radius: 2px;\n background-color: #ccc;\n text-align: center;\n}\n\n.ace_dark.ace_tooltip .").concat(TOOLTIP_CLASS_NAME, " {\n background-color: #373737;\n color: #eee;\n}\n\n.ace_dark div.").concat(BUTTON_CLASS_NAME, ".ace_disabled {\n color: #979797;\n}\n\n.ace_dark div.").concat(BUTTON_CLASS_NAME, ".ace_selected,\n.ace_dark div.").concat(BUTTON_CLASS_NAME, ":hover:not(.ace_disabled) {\n background-color: rgba(255, 255, 255, 0.1);\n}\n\n.ace_dark div.").concat(BUTTON_CLASS_NAME, " .ace_icon_svg {\n background-color: #eee;\n}\n\n.ace_dark div.").concat(BUTTON_CLASS_NAME, ".ace_disabled .ace_icon_svg {\n background-color: #979797;\n}\n\n.ace_dark .").concat(BUTTON_CLASS_NAME, ".ace_disabled {\n color: #979797;\n}\n\n.ace_dark .").concat(KEYBINDING_CLASS_NAME, " div {\n background-color: #575757;\n}\n\n.ace_checkmark::before {\n content: '\u2713';\n}\n"), "commandbar.css", false);
2772
- exports.CommandBarTooltip = CommandBarTooltip;
2773
- exports.TOOLTIP_CLASS_NAME = TOOLTIP_CLASS_NAME;
2774
- exports.BUTTON_CLASS_NAME = BUTTON_CLASS_NAME;
2775
-
2776
- });
2777
-
2778
- ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"], function(require, exports, module){var Range = require("../range").Range;
2779
- var splitRegex = /[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;
2780
- function getWordIndex(doc, pos) {
2781
- var textBefore = doc.getTextRange(Range.fromPoints({
2782
- row: 0,
2783
- column: 0
2784
- }, pos));
2785
- return textBefore.split(splitRegex).length - 1;
2786
- }
2787
- function wordDistance(doc, pos) {
2788
- var prefixPos = getWordIndex(doc, pos);
2789
- var words = doc.getValue().split(splitRegex);
2790
- var wordScores = Object.create(null);
2791
- var currentWord = words[prefixPos];
2792
- words.forEach(function (word, idx) {
2793
- if (!word || word === currentWord)
2794
- return;
2795
- var distance = Math.abs(prefixPos - idx);
2796
- var score = words.length - distance;
2797
- if (wordScores[word]) {
2798
- wordScores[word] = Math.max(score, wordScores[word]);
2799
- }
2800
- else {
2801
- wordScores[word] = score;
2802
- }
2803
- });
2804
- return wordScores;
2805
- }
2806
- exports.getCompletions = function (editor, session, pos, prefix, callback) {
2807
- var wordScore = wordDistance(session, pos);
2808
- var wordList = Object.keys(wordScore);
2809
- callback(null, wordList.map(function (word) {
2810
- return {
2811
- caption: word,
2812
- value: word,
2813
- score: wordScore[word],
2814
- meta: "local"
2815
- };
2816
- }));
2817
- };
2818
-
2819
- });
2820
-
2821
- ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/autocomplete/text_completer","ace/editor","ace/config"], function(require, exports, module){"use strict";
2822
- var snippetManager = require("../snippets").snippetManager;
2823
- var Autocomplete = require("../autocomplete").Autocomplete;
2824
- var config = require("../config");
2825
- var lang = require("../lib/lang");
2826
- var util = require("../autocomplete/util");
2827
- var textCompleter = require("../autocomplete/text_completer");
2828
- var keyWordCompleter = {
2829
- getCompletions: function (editor, session, pos, prefix, callback) {
2830
- if (session.$mode.completer) {
2831
- return session.$mode.completer.getCompletions(editor, session, pos, prefix, callback);
2832
- }
2833
- var state = editor.session.getState(pos.row);
2834
- var completions = session.$mode.getCompletions(state, session, pos, prefix);
2835
- completions = completions.map(function (el) {
2836
- el.completerId = keyWordCompleter.id;
2837
- return el;
2838
- });
2839
- callback(null, completions);
2840
- },
2841
- id: "keywordCompleter"
2842
- };
2843
- var transformSnippetTooltip = function (str) {
2844
- var record = {};
2845
- return str.replace(/\${(\d+)(:(.*?))?}/g, function (_, p1, p2, p3) {
2846
- return (record[p1] = p3 || '');
2847
- }).replace(/\$(\d+?)/g, function (_, p1) {
2848
- return record[p1];
2849
- });
2850
- };
2851
- var snippetCompleter = {
2852
- getCompletions: function (editor, session, pos, prefix, callback) {
2853
- var scopes = [];
2854
- var token = session.getTokenAt(pos.row, pos.column);
2855
- if (token && token.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/))
2856
- scopes.push('html-tag');
2857
- else
2858
- scopes = snippetManager.getActiveScopes(editor);
2859
- var snippetMap = snippetManager.snippetMap;
2860
- var completions = [];
2861
- scopes.forEach(function (scope) {
2862
- var snippets = snippetMap[scope] || [];
2863
- for (var i = snippets.length; i--;) {
2864
- var s = snippets[i];
2865
- var caption = s.name || s.tabTrigger;
2866
- if (!caption)
2867
- continue;
2868
- completions.push({
2869
- caption: caption,
2870
- snippet: s.content,
2871
- meta: s.tabTrigger && !s.name ? s.tabTrigger + "\u21E5 " : "snippet",
2872
- completerId: snippetCompleter.id
2873
- });
2874
- }
2875
- }, this);
2876
- callback(null, completions);
2877
- },
2878
- getDocTooltip: function (item) {
2879
- if (item.snippet && !item.docHTML) {
2880
- item.docHTML = [
2881
- "<b>", lang.escapeHTML(item.caption), "</b>", "<hr></hr>",
2882
- lang.escapeHTML(transformSnippetTooltip(item.snippet))
2883
- ].join("");
2884
- }
2885
- },
2886
- id: "snippetCompleter"
2887
- };
2888
- var completers = [snippetCompleter, textCompleter, keyWordCompleter];
2889
- exports.setCompleters = function (val) {
2890
- completers.length = 0;
2891
- if (val)
2892
- completers.push.apply(completers, val);
2893
- };
2894
- exports.addCompleter = function (completer) {
2895
- completers.push(completer);
2896
- };
2897
- exports.textCompleter = textCompleter;
2898
- exports.keyWordCompleter = keyWordCompleter;
2899
- exports.snippetCompleter = snippetCompleter;
2900
- var expandSnippet = {
2901
- name: "expandSnippet",
2902
- exec: function (editor) {
2903
- return snippetManager.expandWithTab(editor);
2904
- },
2905
- bindKey: "Tab"
2906
- };
2907
- var onChangeMode = function (e, editor) {
2908
- loadSnippetsForMode(editor.session.$mode);
2909
- };
2910
- var loadSnippetsForMode = function (mode) {
2911
- if (typeof mode == "string")
2912
- mode = config.$modes[mode];
2913
- if (!mode)
2914
- return;
2915
- if (!snippetManager.files)
2916
- snippetManager.files = {};
2917
- loadSnippetFile(mode.$id, mode.snippetFileId);
2918
- if (mode.modes)
2919
- mode.modes.forEach(loadSnippetsForMode);
2920
- };
2921
- var loadSnippetFile = function (id, snippetFilePath) {
2922
- if (!snippetFilePath || !id || snippetManager.files[id])
2923
- return;
2924
- snippetManager.files[id] = {};
2925
- config.loadModule(snippetFilePath, function (m) {
2926
- if (!m)
2927
- return;
2928
- snippetManager.files[id] = m;
2929
- if (!m.snippets && m.snippetText)
2930
- m.snippets = snippetManager.parseSnippetFile(m.snippetText);
2931
- snippetManager.register(m.snippets || [], m.scope);
2932
- if (m.includeScopes) {
2933
- snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes;
2934
- m.includeScopes.forEach(function (x) {
2935
- loadSnippetsForMode("ace/mode/" + x);
2936
- });
2937
- }
2938
- });
2939
- };
2940
- var doLiveAutocomplete = function (e) {
2941
- var editor = e.editor;
2942
- var hasCompleter = editor.completer && editor.completer.activated;
2943
- if (e.command.name === "backspace") {
2944
- if (hasCompleter && !util.getCompletionPrefix(editor))
2945
- editor.completer.detach();
2946
- }
2947
- else if (e.command.name === "insertstring" && !hasCompleter) {
2948
- lastExecEvent = e;
2949
- var delay = e.editor.$liveAutocompletionDelay;
2950
- if (delay) {
2951
- liveAutocompleteTimer.delay(delay);
2952
- }
2953
- else {
2954
- showLiveAutocomplete(e);
2955
- }
2956
- }
2957
- };
2958
- var lastExecEvent;
2959
- var liveAutocompleteTimer = lang.delayedCall(function () {
2960
- showLiveAutocomplete(lastExecEvent);
2961
- }, 0);
2962
- var showLiveAutocomplete = function (e) {
2963
- var editor = e.editor;
2964
- var prefix = util.getCompletionPrefix(editor);
2965
- var previousChar = e.args;
2966
- var triggerAutocomplete = util.triggerAutocomplete(editor, previousChar);
2967
- if (prefix && prefix.length >= editor.$liveAutocompletionThreshold || triggerAutocomplete) {
2968
- var completer = Autocomplete.for(editor);
2969
- completer.autoShown = true;
2970
- completer.showPopup(editor);
2971
- }
2972
- };
2973
- var Editor = require("../editor").Editor;
2974
- require("../config").defineOptions(Editor.prototype, "editor", {
2975
- enableBasicAutocompletion: {
2976
- set: function (val) {
2977
- if (val) {
2978
- if (!this.completers)
2979
- this.completers = Array.isArray(val) ? val : completers;
2980
- this.commands.addCommand(Autocomplete.startCommand);
2981
- }
2982
- else {
2983
- this.commands.removeCommand(Autocomplete.startCommand);
2984
- }
2985
- },
2986
- value: false
2987
- },
2988
- enableLiveAutocompletion: {
2989
- set: function (val) {
2990
- if (val) {
2991
- if (!this.completers)
2992
- this.completers = Array.isArray(val) ? val : completers;
2993
- this.commands.on('afterExec', doLiveAutocomplete);
2994
- }
2995
- else {
2996
- this.commands.off('afterExec', doLiveAutocomplete);
2997
- }
2998
- },
2999
- value: false
3000
- },
3001
- liveAutocompletionDelay: {
3002
- initialValue: 0
3003
- },
3004
- liveAutocompletionThreshold: {
3005
- initialValue: 0
3006
- },
3007
- enableSnippets: {
3008
- set: function (val) {
3009
- if (val) {
3010
- this.commands.addCommand(expandSnippet);
3011
- this.on("changeMode", onChangeMode);
3012
- onChangeMode(null, this);
3013
- }
3014
- else {
3015
- this.commands.removeCommand(expandSnippet);
3016
- this.off("changeMode", onChangeMode);
3017
- }
3018
- },
3019
- value: false
3020
- }
3021
- });
3022
-
3023
- });
3024
-
3025
- ace.define("ace/ext/inline_autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/inline","ace/autocomplete","ace/autocomplete","ace/editor","ace/autocomplete/util","ace/lib/dom","ace/lib/lang","ace/ext/command_bar","ace/ext/command_bar","ace/ext/language_tools","ace/ext/language_tools","ace/ext/language_tools","ace/config"], function(require, exports, module){"use strict";
3026
- var HashHandler = require("../keyboard/hash_handler").HashHandler;
3027
- var AceInline = require("../autocomplete/inline").AceInline;
3028
- var FilteredList = require("../autocomplete").FilteredList;
3029
- var CompletionProvider = require("../autocomplete").CompletionProvider;
3030
- var Editor = require("../editor").Editor;
3031
- var util = require("../autocomplete/util");
3032
- var dom = require("../lib/dom");
3033
- var lang = require("../lib/lang");
3034
- var CommandBarTooltip = require("./command_bar").CommandBarTooltip;
3035
- var BUTTON_CLASS_NAME = require("./command_bar").BUTTON_CLASS_NAME;
3036
- var snippetCompleter = require("./language_tools").snippetCompleter;
3037
- var textCompleter = require("./language_tools").textCompleter;
3038
- var keyWordCompleter = require("./language_tools").keyWordCompleter;
3039
- var destroyCompleter = function (e, editor) {
3040
- editor.completer && editor.completer.destroy();
3041
- };
3042
- var InlineAutocomplete = /** @class */ (function () {
3043
- function InlineAutocomplete(editor) {
3044
- this.editor = editor;
3045
- this.keyboardHandler = new HashHandler(this.commands);
3046
- this.$index = -1;
3047
- this.blurListener = this.blurListener.bind(this);
3048
- this.changeListener = this.changeListener.bind(this);
3049
- this.changeTimer = lang.delayedCall(function () {
3050
- this.updateCompletions();
3051
- }.bind(this));
3052
- }
3053
- InlineAutocomplete.prototype.getInlineRenderer = function () {
3054
- if (!this.inlineRenderer)
3055
- this.inlineRenderer = new AceInline();
3056
- return this.inlineRenderer;
3057
- };
3058
- InlineAutocomplete.prototype.getInlineTooltip = function () {
3059
- if (!this.inlineTooltip) {
3060
- this.inlineTooltip = InlineAutocomplete.createInlineTooltip(document.body || document.documentElement);
3061
- }
3062
- return this.inlineTooltip;
3063
- };
3064
- InlineAutocomplete.prototype.show = function (options) {
3065
- this.activated = true;
3066
- if (this.editor.completer !== this) {
3067
- if (this.editor.completer)
3068
- this.editor.completer.detach();
3069
- this.editor.completer = this;
3070
- }
3071
- this.editor.on("changeSelection", this.changeListener);
3072
- this.editor.on("blur", this.blurListener);
3073
- this.updateCompletions(options);
3074
- };
3075
- InlineAutocomplete.prototype.$open = function () {
3076
- if (this.editor.textInput.setAriaOptions) {
3077
- this.editor.textInput.setAriaOptions({});
3078
- }
3079
- this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
3080
- this.getInlineTooltip().attach(this.editor);
3081
- if (this.$index === -1) {
3082
- this.setIndex(0);
3083
- }
3084
- else {
3085
- this.$showCompletion();
3086
- }
3087
- this.changeTimer.cancel();
3088
- };
3089
- InlineAutocomplete.prototype.insertMatch = function () {
3090
- var result = this.getCompletionProvider().insertByIndex(this.editor, this.$index);
3091
- this.detach();
3092
- return result;
3093
- };
3094
- InlineAutocomplete.prototype.changeListener = function (e) {
3095
- var cursor = this.editor.selection.lead;
3096
- if (cursor.row != this.base.row || cursor.column < this.base.column) {
3097
- this.detach();
3098
- }
3099
- if (this.activated)
3100
- this.changeTimer.schedule();
3101
- else
3102
- this.detach();
3103
- };
3104
- InlineAutocomplete.prototype.blurListener = function (e) {
3105
- this.detach();
3106
- };
3107
- InlineAutocomplete.prototype.goTo = function (where) {
3108
- if (!this.completions || !this.completions.filtered) {
3109
- return;
3110
- }
3111
- var completionLength = this.completions.filtered.length;
3112
- switch (where.toLowerCase()) {
3113
- case "prev":
3114
- this.setIndex((this.$index - 1 + completionLength) % completionLength);
3115
- break;
3116
- case "next":
3117
- this.setIndex((this.$index + 1 + completionLength) % completionLength);
3118
- break;
3119
- case "first":
3120
- this.setIndex(0);
3121
- break;
3122
- case "last":
3123
- this.setIndex(this.completions.filtered.length - 1);
3124
- break;
3125
- }
3126
- };
3127
- InlineAutocomplete.prototype.getLength = function () {
3128
- if (!this.completions || !this.completions.filtered) {
3129
- return 0;
3130
- }
3131
- return this.completions.filtered.length;
3132
- };
3133
- InlineAutocomplete.prototype.getData = function (index) {
3134
- if (index == undefined || index === null) {
3135
- return this.completions.filtered[this.$index];
3136
- }
3137
- else {
3138
- return this.completions.filtered[index];
3139
- }
3140
- };
3141
- InlineAutocomplete.prototype.getIndex = function () {
3142
- return this.$index;
3143
- };
3144
- InlineAutocomplete.prototype.isOpen = function () {
3145
- return this.$index >= 0;
3146
- };
3147
- InlineAutocomplete.prototype.setIndex = function (value) {
3148
- if (!this.completions || !this.completions.filtered) {
3149
- return;
3150
- }
3151
- var newIndex = Math.max(-1, Math.min(this.completions.filtered.length - 1, value));
3152
- if (newIndex !== this.$index) {
3153
- this.$index = newIndex;
3154
- this.$showCompletion();
3155
- }
3156
- };
3157
- InlineAutocomplete.prototype.getCompletionProvider = function (initialPosition) {
3158
- if (!this.completionProvider)
3159
- this.completionProvider = new CompletionProvider(initialPosition);
3160
- return this.completionProvider;
3161
- };
3162
- InlineAutocomplete.prototype.$showCompletion = function () {
3163
- if (!this.getInlineRenderer().show(this.editor, this.completions.filtered[this.$index], this.completions.filterText)) {
3164
- this.getInlineRenderer().hide();
3165
- }
3166
- if (this.inlineTooltip && this.inlineTooltip.isShown()) {
3167
- this.inlineTooltip.update();
3168
- }
3169
- };
3170
- InlineAutocomplete.prototype.$updatePrefix = function () {
3171
- var pos = this.editor.getCursorPosition();
3172
- var prefix = this.editor.session.getTextRange({ start: this.base, end: pos });
3173
- this.completions.setFilter(prefix);
3174
- if (!this.completions.filtered.length)
3175
- return this.detach();
3176
- if (this.completions.filtered.length == 1
3177
- && this.completions.filtered[0].value == prefix
3178
- && !this.completions.filtered[0].snippet)
3179
- return this.detach();
3180
- this.$open(this.editor, prefix);
3181
- return prefix;
3182
- };
3183
- InlineAutocomplete.prototype.updateCompletions = function (options) {
3184
- var prefix = "";
3185
- if (options && options.matches) {
3186
- var pos = this.editor.getSelectionRange().start;
3187
- this.base = this.editor.session.doc.createAnchor(pos.row, pos.column);
3188
- this.base.$insertRight = true;
3189
- this.completions = new FilteredList(options.matches);
3190
- return this.$open(this.editor, "");
3191
- }
3192
- if (this.base && this.completions) {
3193
- prefix = this.$updatePrefix();
3194
- }
3195
- var session = this.editor.getSession();
3196
- var pos = this.editor.getCursorPosition();
3197
- var prefix = util.getCompletionPrefix(this.editor);
3198
- this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
3199
- this.base.$insertRight = true;
3200
- var options = {
3201
- exactMatch: true,
3202
- ignoreCaption: true
3203
- };
3204
- this.getCompletionProvider({
3205
- prefix: prefix,
3206
- base: this.base,
3207
- pos: pos
3208
- }).provideCompletions(this.editor, options,
3209
- function (err, completions, finished) {
3210
- var filtered = completions.filtered;
3211
- var prefix = util.getCompletionPrefix(this.editor);
3212
- if (finished) {
3213
- if (!filtered.length)
3214
- return this.detach();
3215
- if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet)
3216
- return this.detach();
3217
- }
3218
- this.completions = completions;
3219
- this.$open(this.editor, prefix);
3220
- }.bind(this));
3221
- };
3222
- InlineAutocomplete.prototype.detach = function () {
3223
- if (this.editor) {
3224
- this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
3225
- this.editor.off("changeSelection", this.changeListener);
3226
- this.editor.off("blur", this.blurListener);
3227
- }
3228
- this.changeTimer.cancel();
3229
- if (this.inlineTooltip) {
3230
- this.inlineTooltip.detach();
3231
- }
3232
- this.setIndex(-1);
3233
- if (this.completionProvider) {
3234
- this.completionProvider.detach();
3235
- }
3236
- if (this.inlineRenderer && this.inlineRenderer.isOpen()) {
3237
- this.inlineRenderer.hide();
3238
- }
3239
- if (this.base)
3240
- this.base.detach();
3241
- this.activated = false;
3242
- this.completionProvider = this.completions = this.base = null;
3243
- };
3244
- InlineAutocomplete.prototype.destroy = function () {
3245
- this.detach();
3246
- if (this.inlineRenderer)
3247
- this.inlineRenderer.destroy();
3248
- if (this.inlineTooltip)
3249
- this.inlineTooltip.destroy();
3250
- if (this.editor && this.editor.completer == this) {
3251
- this.editor.off("destroy", destroyCompleter);
3252
- this.editor.completer = null;
3253
- }
3254
- this.inlineTooltip = this.editor = this.inlineRenderer = null;
3255
- };
3256
- InlineAutocomplete.prototype.updateDocTooltip = function () {
3257
- };
3258
- return InlineAutocomplete;
3259
- }());
3260
- InlineAutocomplete.prototype.commands = {
3261
- "Previous": {
3262
- bindKey: "Alt-[",
3263
- name: "Previous",
3264
- exec: function (editor) {
3265
- editor.completer.goTo("prev");
3266
- }
3267
- },
3268
- "Next": {
3269
- bindKey: "Alt-]",
3270
- name: "Next",
3271
- exec: function (editor) {
3272
- editor.completer.goTo("next");
3273
- }
3274
- },
3275
- "Accept": {
3276
- bindKey: { win: "Tab|Ctrl-Right", mac: "Tab|Cmd-Right" },
3277
- name: "Accept",
3278
- exec: function (editor) {
3279
- return /**@type{InlineAutocomplete}*/ (editor.completer).insertMatch();
3280
- }
3281
- },
3282
- "Close": {
3283
- bindKey: "Esc",
3284
- name: "Close",
3285
- exec: function (editor) {
3286
- editor.completer.detach();
3287
- }
3288
- }
3289
- };
3290
- InlineAutocomplete.for = function (editor) {
3291
- if (editor.completer instanceof InlineAutocomplete) {
3292
- return editor.completer;
3293
- }
3294
- if (editor.completer) {
3295
- editor.completer.destroy();
3296
- editor.completer = null;
3297
- }
3298
- editor.completer = new InlineAutocomplete(editor);
3299
- editor.once("destroy", destroyCompleter);
3300
- return editor.completer;
3301
- };
3302
- InlineAutocomplete.startCommand = {
3303
- name: "startInlineAutocomplete",
3304
- exec: function (editor, options) {
3305
- var completer = InlineAutocomplete.for(editor);
3306
- completer.show(options);
3307
- },
3308
- bindKey: { win: "Alt-C", mac: "Option-C" }
3309
- };
3310
- var completers = [snippetCompleter, textCompleter, keyWordCompleter];
3311
- require("../config").defineOptions(Editor.prototype, "editor", {
3312
- enableInlineAutocompletion: {
3313
- set: function (val) {
3314
- if (val) {
3315
- if (!this.completers)
3316
- this.completers = Array.isArray(val) ? val : completers;
3317
- this.commands.addCommand(InlineAutocomplete.startCommand);
3318
- }
3319
- else {
3320
- this.commands.removeCommand(InlineAutocomplete.startCommand);
3321
- }
3322
- },
3323
- value: false
3324
- }
3325
- });
3326
- InlineAutocomplete.createInlineTooltip = function (parentEl) {
3327
- var inlineTooltip = new CommandBarTooltip(parentEl);
3328
- inlineTooltip.registerCommand("Previous",
3329
- Object.assign({}, InlineAutocomplete.prototype.commands["Previous"], {
3330
- enabled: true,
3331
- type: "button",
3332
- iconCssClass: "ace_arrow_rotated"
3333
- }));
3334
- inlineTooltip.registerCommand("Position", {
3335
- enabled: false,
3336
- getValue: function (editor) {
3337
- return editor ? [
3338
- (editor.completer).getIndex() + 1, /**@type{InlineAutocomplete}*/ (editor.completer).getLength()
3339
- ].join("/") : "";
3340
- },
3341
- type: "text",
3342
- cssClass: "completion_position"
3343
- });
3344
- inlineTooltip.registerCommand("Next",
3345
- Object.assign({}, InlineAutocomplete.prototype.commands["Next"], {
3346
- enabled: true,
3347
- type: "button",
3348
- iconCssClass: "ace_arrow"
3349
- }));
3350
- inlineTooltip.registerCommand("Accept",
3351
- Object.assign({}, InlineAutocomplete.prototype.commands["Accept"], {
3352
- enabled: function (editor) {
3353
- return !!editor && editor.completer.getIndex() >= 0;
3354
- },
3355
- type: "button"
3356
- }));
3357
- inlineTooltip.registerCommand("ShowTooltip", {
3358
- name: "Always Show Tooltip",
3359
- exec: function () {
3360
- inlineTooltip.setAlwaysShow(!inlineTooltip.getAlwaysShow());
3361
- },
3362
- enabled: true,
3363
- getValue: function () {
3364
- return inlineTooltip.getAlwaysShow();
3365
- },
3366
- type: "checkbox"
3367
- });
3368
- return inlineTooltip;
3369
- };
3370
- dom.importCssString("\n\n.ace_icon_svg.ace_arrow,\n.ace_icon_svg.ace_arrow_rotated {\n -webkit-mask-image: url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTUuODM3MDEgMTVMNC41ODc1MSAxMy43MTU1TDEwLjE0NjggOEw0LjU4NzUxIDIuMjg0NDZMNS44MzcwMSAxTDEyLjY0NjUgOEw1LjgzNzAxIDE1WiIgZmlsbD0iYmxhY2siLz48L3N2Zz4=\");\n}\n\n.ace_icon_svg.ace_arrow_rotated {\n transform: rotate(180deg);\n}\n\ndiv.".concat(BUTTON_CLASS_NAME, ".completion_position {\n padding: 0;\n}\n"), "inlineautocomplete.css", false);
3371
- exports.InlineAutocomplete = InlineAutocomplete;
3372
-
3373
- }); (function() {
3374
- ace.require(["ace/ext/inline_autocomplete"], function(m) {
3375
- if (typeof module == "object" && typeof exports == "object" && module) {
3376
- module.exports = m;
3377
- }
3378
- });
3379
- })();
3380
-