@socketsecurity/cli-with-sentry 1.1.25 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (914) hide show
  1. package/CHANGELOG.md +51 -218
  2. package/README.md +41 -74
  3. package/dist/cli.js.bz +0 -0
  4. package/dist/cli.js.bz.sha256 +1 -0
  5. package/dist/index.js +2 -0
  6. package/package.json +31 -274
  7. package/bin/cli.js +0 -52
  8. package/bin/npm-cli.js +0 -29
  9. package/bin/npx-cli.js +0 -29
  10. package/bin/pnpm-cli.js +0 -29
  11. package/bin/yarn-cli.js +0 -29
  12. package/dist/cli.js +0 -14999
  13. package/dist/cli.js.map +0 -1
  14. package/dist/constants.js +0 -845
  15. package/dist/constants.js.map +0 -1
  16. package/dist/flags.js +0 -212
  17. package/dist/flags.js.map +0 -1
  18. package/dist/init.gradle +0 -250
  19. package/dist/instrument-with-sentry.js +0 -44
  20. package/dist/instrument-with-sentry.js.map +0 -1
  21. package/dist/npm-cli.js +0 -30
  22. package/dist/npm-cli.js.map +0 -1
  23. package/dist/npx-cli.js +0 -26
  24. package/dist/npx-cli.js.map +0 -1
  25. package/dist/pnpm-cli.js +0 -30
  26. package/dist/pnpm-cli.js.map +0 -1
  27. package/dist/shadow-npm-bin.js +0 -8
  28. package/dist/shadow-npm-bin.js.map +0 -1
  29. package/dist/shadow-npm-bin2.js +0 -102
  30. package/dist/shadow-npm-bin2.js.map +0 -1
  31. package/dist/shadow-npm-inject.js +0 -307
  32. package/dist/shadow-npm-inject.js.map +0 -1
  33. package/dist/shadow-npx-bin.js +0 -12
  34. package/dist/shadow-npx-bin.js.map +0 -1
  35. package/dist/shadow-pnpm-bin.js +0 -8
  36. package/dist/shadow-pnpm-bin.js.map +0 -1
  37. package/dist/shadow-pnpm-bin2.js +0 -300
  38. package/dist/shadow-pnpm-bin2.js.map +0 -1
  39. package/dist/shadow-yarn-bin.js +0 -96
  40. package/dist/shadow-yarn-bin.js.map +0 -1
  41. package/dist/tsconfig.dts.tsbuildinfo +0 -1
  42. package/dist/types/cli.d.mts +0 -3
  43. package/dist/types/cli.d.mts.map +0 -1
  44. package/dist/types/commands/analytics/cmd-analytics.d.mts +0 -10
  45. package/dist/types/commands/analytics/cmd-analytics.d.mts.map +0 -1
  46. package/dist/types/commands/analytics/fetch-org-analytics.d.mts +0 -8
  47. package/dist/types/commands/analytics/fetch-org-analytics.d.mts.map +0 -1
  48. package/dist/types/commands/analytics/fetch-repo-analytics.d.mts +0 -8
  49. package/dist/types/commands/analytics/fetch-repo-analytics.d.mts.map +0 -1
  50. package/dist/types/commands/analytics/handle-analytics.d.mts +0 -10
  51. package/dist/types/commands/analytics/handle-analytics.d.mts.map +0 -1
  52. package/dist/types/commands/analytics/output-analytics.d.mts +0 -29
  53. package/dist/types/commands/analytics/output-analytics.d.mts.map +0 -1
  54. package/dist/types/commands/audit-log/cmd-audit-log.d.mts +0 -10
  55. package/dist/types/commands/audit-log/cmd-audit-log.d.mts.map +0 -1
  56. package/dist/types/commands/audit-log/fetch-audit-log.d.mts +0 -15
  57. package/dist/types/commands/audit-log/fetch-audit-log.d.mts.map +0 -1
  58. package/dist/types/commands/audit-log/handle-audit-log.d.mts +0 -9
  59. package/dist/types/commands/audit-log/handle-audit-log.d.mts.map +0 -1
  60. package/dist/types/commands/audit-log/output-audit-log.d.mts +0 -22
  61. package/dist/types/commands/audit-log/output-audit-log.d.mts.map +0 -1
  62. package/dist/types/commands/ci/cmd-ci.d.mts +0 -9
  63. package/dist/types/commands/ci/cmd-ci.d.mts.map +0 -1
  64. package/dist/types/commands/ci/fetch-default-org-slug.d.mts +0 -4
  65. package/dist/types/commands/ci/fetch-default-org-slug.d.mts.map +0 -1
  66. package/dist/types/commands/ci/handle-ci.d.mts +0 -2
  67. package/dist/types/commands/ci/handle-ci.d.mts.map +0 -1
  68. package/dist/types/commands/config/cmd-config-auto.d.mts +0 -10
  69. package/dist/types/commands/config/cmd-config-auto.d.mts.map +0 -1
  70. package/dist/types/commands/config/cmd-config-get.d.mts +0 -9
  71. package/dist/types/commands/config/cmd-config-get.d.mts.map +0 -1
  72. package/dist/types/commands/config/cmd-config-list.d.mts +0 -9
  73. package/dist/types/commands/config/cmd-config-list.d.mts.map +0 -1
  74. package/dist/types/commands/config/cmd-config-set.d.mts +0 -10
  75. package/dist/types/commands/config/cmd-config-set.d.mts.map +0 -1
  76. package/dist/types/commands/config/cmd-config-unset.d.mts +0 -10
  77. package/dist/types/commands/config/cmd-config-unset.d.mts.map +0 -1
  78. package/dist/types/commands/config/cmd-config.d.mts +0 -3
  79. package/dist/types/commands/config/cmd-config.d.mts.map +0 -1
  80. package/dist/types/commands/config/discover-config-value.d.mts +0 -3
  81. package/dist/types/commands/config/discover-config-value.d.mts.map +0 -1
  82. package/dist/types/commands/config/handle-config-auto.d.mts +0 -7
  83. package/dist/types/commands/config/handle-config-auto.d.mts.map +0 -1
  84. package/dist/types/commands/config/handle-config-get.d.mts +0 -7
  85. package/dist/types/commands/config/handle-config-get.d.mts.map +0 -1
  86. package/dist/types/commands/config/handle-config-set.d.mts +0 -8
  87. package/dist/types/commands/config/handle-config-set.d.mts.map +0 -1
  88. package/dist/types/commands/config/handle-config-unset.d.mts +0 -7
  89. package/dist/types/commands/config/handle-config-unset.d.mts.map +0 -1
  90. package/dist/types/commands/config/output-config-auto.d.mts +0 -4
  91. package/dist/types/commands/config/output-config-auto.d.mts.map +0 -1
  92. package/dist/types/commands/config/output-config-get.d.mts +0 -4
  93. package/dist/types/commands/config/output-config-get.d.mts.map +0 -1
  94. package/dist/types/commands/config/output-config-list.d.mts +0 -6
  95. package/dist/types/commands/config/output-config-list.d.mts.map +0 -1
  96. package/dist/types/commands/config/output-config-set.d.mts +0 -3
  97. package/dist/types/commands/config/output-config-set.d.mts.map +0 -1
  98. package/dist/types/commands/config/output-config-unset.d.mts +0 -3
  99. package/dist/types/commands/config/output-config-unset.d.mts.map +0 -1
  100. package/dist/types/commands/fix/cmd-fix.d.mts +0 -10
  101. package/dist/types/commands/fix/cmd-fix.d.mts.map +0 -1
  102. package/dist/types/commands/fix/coana-fix.d.mts +0 -6
  103. package/dist/types/commands/fix/coana-fix.d.mts.map +0 -1
  104. package/dist/types/commands/fix/env-helpers.d.mts +0 -26
  105. package/dist/types/commands/fix/env-helpers.d.mts.map +0 -1
  106. package/dist/types/commands/fix/git.d.mts +0 -13
  107. package/dist/types/commands/fix/git.d.mts.map +0 -1
  108. package/dist/types/commands/fix/handle-fix.d.mts +0 -20
  109. package/dist/types/commands/fix/handle-fix.d.mts.map +0 -1
  110. package/dist/types/commands/fix/output-fix-result.d.mts +0 -3
  111. package/dist/types/commands/fix/output-fix-result.d.mts.map +0 -1
  112. package/dist/types/commands/fix/pull-request.d.mts +0 -31
  113. package/dist/types/commands/fix/pull-request.d.mts.map +0 -1
  114. package/dist/types/commands/fix/types.d.mts +0 -21
  115. package/dist/types/commands/fix/types.d.mts.map +0 -1
  116. package/dist/types/commands/install/cmd-install-completion.d.mts +0 -9
  117. package/dist/types/commands/install/cmd-install-completion.d.mts.map +0 -1
  118. package/dist/types/commands/install/cmd-install.d.mts +0 -3
  119. package/dist/types/commands/install/cmd-install.d.mts.map +0 -1
  120. package/dist/types/commands/install/handle-install-completion.d.mts +0 -2
  121. package/dist/types/commands/install/handle-install-completion.d.mts.map +0 -1
  122. package/dist/types/commands/install/output-install-completion.d.mts +0 -12
  123. package/dist/types/commands/install/output-install-completion.d.mts.map +0 -1
  124. package/dist/types/commands/install/setup-tab-completion.d.mts +0 -13
  125. package/dist/types/commands/install/setup-tab-completion.d.mts.map +0 -1
  126. package/dist/types/commands/json/cmd-json.d.mts +0 -9
  127. package/dist/types/commands/json/cmd-json.d.mts.map +0 -1
  128. package/dist/types/commands/json/handle-cmd-json.d.mts +0 -2
  129. package/dist/types/commands/json/handle-cmd-json.d.mts.map +0 -1
  130. package/dist/types/commands/json/output-cmd-json.d.mts +0 -2
  131. package/dist/types/commands/json/output-cmd-json.d.mts.map +0 -1
  132. package/dist/types/commands/login/apply-login.d.mts +0 -2
  133. package/dist/types/commands/login/apply-login.d.mts.map +0 -1
  134. package/dist/types/commands/login/attempt-login.d.mts +0 -6
  135. package/dist/types/commands/login/attempt-login.d.mts.map +0 -1
  136. package/dist/types/commands/login/cmd-login.d.mts +0 -10
  137. package/dist/types/commands/login/cmd-login.d.mts.map +0 -1
  138. package/dist/types/commands/logout/apply-logout.d.mts +0 -2
  139. package/dist/types/commands/logout/apply-logout.d.mts.map +0 -1
  140. package/dist/types/commands/logout/attempt-logout.d.mts +0 -2
  141. package/dist/types/commands/logout/attempt-logout.d.mts.map +0 -1
  142. package/dist/types/commands/logout/cmd-logout.d.mts +0 -9
  143. package/dist/types/commands/logout/cmd-logout.d.mts.map +0 -1
  144. package/dist/types/commands/manifest/cmd-manifest-auto.d.mts +0 -9
  145. package/dist/types/commands/manifest/cmd-manifest-auto.d.mts.map +0 -1
  146. package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts +0 -9
  147. package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts.map +0 -1
  148. package/dist/types/commands/manifest/cmd-manifest-conda.d.mts +0 -9
  149. package/dist/types/commands/manifest/cmd-manifest-conda.d.mts.map +0 -1
  150. package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts +0 -9
  151. package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts.map +0 -1
  152. package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts +0 -9
  153. package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts.map +0 -1
  154. package/dist/types/commands/manifest/cmd-manifest-scala.d.mts +0 -9
  155. package/dist/types/commands/manifest/cmd-manifest-scala.d.mts.map +0 -1
  156. package/dist/types/commands/manifest/cmd-manifest-setup.d.mts +0 -9
  157. package/dist/types/commands/manifest/cmd-manifest-setup.d.mts.map +0 -1
  158. package/dist/types/commands/manifest/cmd-manifest.d.mts +0 -9
  159. package/dist/types/commands/manifest/cmd-manifest.d.mts.map +0 -1
  160. package/dist/types/commands/manifest/convert-conda-to-requirements.d.mts +0 -8
  161. package/dist/types/commands/manifest/convert-conda-to-requirements.d.mts.map +0 -1
  162. package/dist/types/commands/manifest/convert_gradle_to_maven.d.mts +0 -7
  163. package/dist/types/commands/manifest/convert_gradle_to_maven.d.mts.map +0 -1
  164. package/dist/types/commands/manifest/convert_sbt_to_maven.d.mts +0 -8
  165. package/dist/types/commands/manifest/convert_sbt_to_maven.d.mts.map +0 -1
  166. package/dist/types/commands/manifest/detect-manifest-actions.d.mts +0 -13
  167. package/dist/types/commands/manifest/detect-manifest-actions.d.mts.map +0 -1
  168. package/dist/types/commands/manifest/generate_auto_manifest.d.mts +0 -9
  169. package/dist/types/commands/manifest/generate_auto_manifest.d.mts.map +0 -1
  170. package/dist/types/commands/manifest/handle-manifest-conda.d.mts +0 -9
  171. package/dist/types/commands/manifest/handle-manifest-conda.d.mts.map +0 -1
  172. package/dist/types/commands/manifest/handle-manifest-setup.d.mts +0 -2
  173. package/dist/types/commands/manifest/handle-manifest-setup.d.mts.map +0 -1
  174. package/dist/types/commands/manifest/output-manifest-setup.d.mts +0 -3
  175. package/dist/types/commands/manifest/output-manifest-setup.d.mts.map +0 -1
  176. package/dist/types/commands/manifest/output-requirements.d.mts +0 -6
  177. package/dist/types/commands/manifest/output-requirements.d.mts.map +0 -1
  178. package/dist/types/commands/manifest/run-cdxgen.d.mts +0 -6
  179. package/dist/types/commands/manifest/run-cdxgen.d.mts.map +0 -1
  180. package/dist/types/commands/manifest/setup-manifest-config.d.mts +0 -3
  181. package/dist/types/commands/manifest/setup-manifest-config.d.mts.map +0 -1
  182. package/dist/types/commands/npm/cmd-npm.d.mts +0 -10
  183. package/dist/types/commands/npm/cmd-npm.d.mts.map +0 -1
  184. package/dist/types/commands/npx/cmd-npx.d.mts +0 -9
  185. package/dist/types/commands/npx/cmd-npx.d.mts.map +0 -1
  186. package/dist/types/commands/oops/cmd-oops.d.mts +0 -9
  187. package/dist/types/commands/oops/cmd-oops.d.mts.map +0 -1
  188. package/dist/types/commands/optimize/add-overrides.d.mts +0 -20
  189. package/dist/types/commands/optimize/add-overrides.d.mts.map +0 -1
  190. package/dist/types/commands/optimize/apply-optimization.d.mts +0 -14
  191. package/dist/types/commands/optimize/apply-optimization.d.mts.map +0 -1
  192. package/dist/types/commands/optimize/cmd-optimize.d.mts +0 -10
  193. package/dist/types/commands/optimize/cmd-optimize.d.mts.map +0 -1
  194. package/dist/types/commands/optimize/deps-includes-by-agent.d.mts +0 -5
  195. package/dist/types/commands/optimize/deps-includes-by-agent.d.mts.map +0 -1
  196. package/dist/types/commands/optimize/get-dependency-entries.d.mts +0 -3
  197. package/dist/types/commands/optimize/get-dependency-entries.d.mts.map +0 -1
  198. package/dist/types/commands/optimize/get-overrides-by-agent.d.mts +0 -42
  199. package/dist/types/commands/optimize/get-overrides-by-agent.d.mts.map +0 -1
  200. package/dist/types/commands/optimize/handle-optimize.d.mts +0 -8
  201. package/dist/types/commands/optimize/handle-optimize.d.mts.map +0 -1
  202. package/dist/types/commands/optimize/lockfile-includes-by-agent.d.mts +0 -8
  203. package/dist/types/commands/optimize/lockfile-includes-by-agent.d.mts.map +0 -1
  204. package/dist/types/commands/optimize/ls-by-agent.d.mts +0 -13
  205. package/dist/types/commands/optimize/ls-by-agent.d.mts.map +0 -1
  206. package/dist/types/commands/optimize/output-optimize-result.d.mts +0 -9
  207. package/dist/types/commands/optimize/output-optimize-result.d.mts.map +0 -1
  208. package/dist/types/commands/optimize/shared.d.mts +0 -2
  209. package/dist/types/commands/optimize/shared.d.mts.map +0 -1
  210. package/dist/types/commands/optimize/types.d.mts +0 -9
  211. package/dist/types/commands/optimize/types.d.mts.map +0 -1
  212. package/dist/types/commands/optimize/update-lockfile.d.mts +0 -11
  213. package/dist/types/commands/optimize/update-lockfile.d.mts.map +0 -1
  214. package/dist/types/commands/optimize/update-manifest-by-agent.d.mts +0 -8
  215. package/dist/types/commands/optimize/update-manifest-by-agent.d.mts.map +0 -1
  216. package/dist/types/commands/organization/cmd-organization-dependencies.d.mts +0 -10
  217. package/dist/types/commands/organization/cmd-organization-dependencies.d.mts.map +0 -1
  218. package/dist/types/commands/organization/cmd-organization-list.d.mts +0 -10
  219. package/dist/types/commands/organization/cmd-organization-list.d.mts.map +0 -1
  220. package/dist/types/commands/organization/cmd-organization-policy-license.d.mts +0 -10
  221. package/dist/types/commands/organization/cmd-organization-policy-license.d.mts.map +0 -1
  222. package/dist/types/commands/organization/cmd-organization-policy-security.d.mts +0 -10
  223. package/dist/types/commands/organization/cmd-organization-policy-security.d.mts.map +0 -1
  224. package/dist/types/commands/organization/cmd-organization-policy.d.mts +0 -3
  225. package/dist/types/commands/organization/cmd-organization-policy.d.mts.map +0 -1
  226. package/dist/types/commands/organization/cmd-organization-quota.d.mts +0 -9
  227. package/dist/types/commands/organization/cmd-organization-quota.d.mts.map +0 -1
  228. package/dist/types/commands/organization/cmd-organization.d.mts +0 -3
  229. package/dist/types/commands/organization/cmd-organization.d.mts.map +0 -1
  230. package/dist/types/commands/organization/fetch-dependencies.d.mts +0 -12
  231. package/dist/types/commands/organization/fetch-dependencies.d.mts.map +0 -1
  232. package/dist/types/commands/organization/fetch-license-policy.d.mts +0 -8
  233. package/dist/types/commands/organization/fetch-license-policy.d.mts.map +0 -1
  234. package/dist/types/commands/organization/fetch-organization-list.d.mts +0 -20
  235. package/dist/types/commands/organization/fetch-organization-list.d.mts.map +0 -1
  236. package/dist/types/commands/organization/fetch-quota.d.mts +0 -8
  237. package/dist/types/commands/organization/fetch-quota.d.mts.map +0 -1
  238. package/dist/types/commands/organization/fetch-security-policy.d.mts +0 -8
  239. package/dist/types/commands/organization/fetch-security-policy.d.mts.map +0 -1
  240. package/dist/types/commands/organization/handle-dependencies.d.mts +0 -7
  241. package/dist/types/commands/organization/handle-dependencies.d.mts.map +0 -1
  242. package/dist/types/commands/organization/handle-license-policy.d.mts +0 -3
  243. package/dist/types/commands/organization/handle-license-policy.d.mts.map +0 -1
  244. package/dist/types/commands/organization/handle-organization-list.d.mts +0 -3
  245. package/dist/types/commands/organization/handle-organization-list.d.mts.map +0 -1
  246. package/dist/types/commands/organization/handle-quota.d.mts +0 -3
  247. package/dist/types/commands/organization/handle-quota.d.mts.map +0 -1
  248. package/dist/types/commands/organization/handle-security-policy.d.mts +0 -3
  249. package/dist/types/commands/organization/handle-security-policy.d.mts.map +0 -1
  250. package/dist/types/commands/organization/output-dependencies.d.mts +0 -8
  251. package/dist/types/commands/organization/output-dependencies.d.mts.map +0 -1
  252. package/dist/types/commands/organization/output-license-policy.d.mts +0 -4
  253. package/dist/types/commands/organization/output-license-policy.d.mts.map +0 -1
  254. package/dist/types/commands/organization/output-organization-list.d.mts +0 -4
  255. package/dist/types/commands/organization/output-organization-list.d.mts.map +0 -1
  256. package/dist/types/commands/organization/output-quota.d.mts +0 -4
  257. package/dist/types/commands/organization/output-quota.d.mts.map +0 -1
  258. package/dist/types/commands/organization/output-security-policy.d.mts +0 -4
  259. package/dist/types/commands/organization/output-security-policy.d.mts.map +0 -1
  260. package/dist/types/commands/package/cmd-package-score.d.mts +0 -10
  261. package/dist/types/commands/package/cmd-package-score.d.mts.map +0 -1
  262. package/dist/types/commands/package/cmd-package-shallow.d.mts +0 -17
  263. package/dist/types/commands/package/cmd-package-shallow.d.mts.map +0 -1
  264. package/dist/types/commands/package/cmd-package.d.mts +0 -3
  265. package/dist/types/commands/package/cmd-package.d.mts.map +0 -1
  266. package/dist/types/commands/package/fetch-purl-deep-score.d.mts +0 -51
  267. package/dist/types/commands/package/fetch-purl-deep-score.d.mts.map +0 -1
  268. package/dist/types/commands/package/fetch-purls-shallow-score.d.mts +0 -8
  269. package/dist/types/commands/package/fetch-purls-shallow-score.d.mts.map +0 -1
  270. package/dist/types/commands/package/handle-purl-deep-score.d.mts +0 -3
  271. package/dist/types/commands/package/handle-purl-deep-score.d.mts.map +0 -1
  272. package/dist/types/commands/package/handle-purls-shallow-score.d.mts +0 -6
  273. package/dist/types/commands/package/handle-purls-shallow-score.d.mts.map +0 -1
  274. package/dist/types/commands/package/output-purls-deep-score.d.mts +0 -5
  275. package/dist/types/commands/package/output-purls-deep-score.d.mts.map +0 -1
  276. package/dist/types/commands/package/output-purls-shallow-score.d.mts +0 -29
  277. package/dist/types/commands/package/output-purls-shallow-score.d.mts.map +0 -1
  278. package/dist/types/commands/package/parse-package-specifiers.d.mts +0 -9
  279. package/dist/types/commands/package/parse-package-specifiers.d.mts.map +0 -1
  280. package/dist/types/commands/patch/cmd-patch.d.mts +0 -10
  281. package/dist/types/commands/patch/cmd-patch.d.mts.map +0 -1
  282. package/dist/types/commands/patch/handle-patch.d.mts +0 -12
  283. package/dist/types/commands/patch/handle-patch.d.mts.map +0 -1
  284. package/dist/types/commands/patch/manifest-schema.d.mts +0 -34
  285. package/dist/types/commands/patch/manifest-schema.d.mts.map +0 -1
  286. package/dist/types/commands/patch/output-patch-result.d.mts +0 -5
  287. package/dist/types/commands/patch/output-patch-result.d.mts.map +0 -1
  288. package/dist/types/commands/pnpm/cmd-pnpm.d.mts +0 -10
  289. package/dist/types/commands/pnpm/cmd-pnpm.d.mts.map +0 -1
  290. package/dist/types/commands/raw-npm/cmd-raw-npm.d.mts +0 -9
  291. package/dist/types/commands/raw-npm/cmd-raw-npm.d.mts.map +0 -1
  292. package/dist/types/commands/raw-npm/run-raw-npm.d.mts +0 -2
  293. package/dist/types/commands/raw-npm/run-raw-npm.d.mts.map +0 -1
  294. package/dist/types/commands/raw-npx/cmd-raw-npx.d.mts +0 -9
  295. package/dist/types/commands/raw-npx/cmd-raw-npx.d.mts.map +0 -1
  296. package/dist/types/commands/raw-npx/run-raw-npx.d.mts +0 -2
  297. package/dist/types/commands/raw-npx/run-raw-npx.d.mts.map +0 -1
  298. package/dist/types/commands/repository/cmd-repository-create.d.mts +0 -10
  299. package/dist/types/commands/repository/cmd-repository-create.d.mts.map +0 -1
  300. package/dist/types/commands/repository/cmd-repository-del.d.mts +0 -10
  301. package/dist/types/commands/repository/cmd-repository-del.d.mts.map +0 -1
  302. package/dist/types/commands/repository/cmd-repository-list.d.mts +0 -10
  303. package/dist/types/commands/repository/cmd-repository-list.d.mts.map +0 -1
  304. package/dist/types/commands/repository/cmd-repository-update.d.mts +0 -10
  305. package/dist/types/commands/repository/cmd-repository-update.d.mts.map +0 -1
  306. package/dist/types/commands/repository/cmd-repository-view.d.mts +0 -10
  307. package/dist/types/commands/repository/cmd-repository-view.d.mts.map +0 -1
  308. package/dist/types/commands/repository/cmd-repository.d.mts +0 -3
  309. package/dist/types/commands/repository/cmd-repository.d.mts.map +0 -1
  310. package/dist/types/commands/repository/fetch-create-repo.d.mts +0 -16
  311. package/dist/types/commands/repository/fetch-create-repo.d.mts.map +0 -1
  312. package/dist/types/commands/repository/fetch-delete-repo.d.mts +0 -8
  313. package/dist/types/commands/repository/fetch-delete-repo.d.mts.map +0 -1
  314. package/dist/types/commands/repository/fetch-list-all-repos.d.mts +0 -10
  315. package/dist/types/commands/repository/fetch-list-all-repos.d.mts.map +0 -1
  316. package/dist/types/commands/repository/fetch-list-repos.d.mts +0 -15
  317. package/dist/types/commands/repository/fetch-list-repos.d.mts.map +0 -1
  318. package/dist/types/commands/repository/fetch-update-repo.d.mts +0 -16
  319. package/dist/types/commands/repository/fetch-update-repo.d.mts.map +0 -1
  320. package/dist/types/commands/repository/fetch-view-repo.d.mts +0 -8
  321. package/dist/types/commands/repository/fetch-view-repo.d.mts.map +0 -1
  322. package/dist/types/commands/repository/handle-create-repo.d.mts +0 -10
  323. package/dist/types/commands/repository/handle-create-repo.d.mts.map +0 -1
  324. package/dist/types/commands/repository/handle-delete-repo.d.mts +0 -3
  325. package/dist/types/commands/repository/handle-delete-repo.d.mts.map +0 -1
  326. package/dist/types/commands/repository/handle-list-repos.d.mts +0 -12
  327. package/dist/types/commands/repository/handle-list-repos.d.mts.map +0 -1
  328. package/dist/types/commands/repository/handle-update-repo.d.mts +0 -10
  329. package/dist/types/commands/repository/handle-update-repo.d.mts.map +0 -1
  330. package/dist/types/commands/repository/handle-view-repo.d.mts +0 -3
  331. package/dist/types/commands/repository/handle-view-repo.d.mts.map +0 -1
  332. package/dist/types/commands/repository/output-create-repo.d.mts +0 -4
  333. package/dist/types/commands/repository/output-create-repo.d.mts.map +0 -1
  334. package/dist/types/commands/repository/output-delete-repo.d.mts +0 -4
  335. package/dist/types/commands/repository/output-delete-repo.d.mts.map +0 -1
  336. package/dist/types/commands/repository/output-list-repos.d.mts +0 -5
  337. package/dist/types/commands/repository/output-list-repos.d.mts.map +0 -1
  338. package/dist/types/commands/repository/output-update-repo.d.mts +0 -4
  339. package/dist/types/commands/repository/output-update-repo.d.mts.map +0 -1
  340. package/dist/types/commands/repository/output-view-repo.d.mts +0 -4
  341. package/dist/types/commands/repository/output-view-repo.d.mts.map +0 -1
  342. package/dist/types/commands/repository/types.d.mts +0 -2
  343. package/dist/types/commands/repository/types.d.mts.map +0 -1
  344. package/dist/types/commands/scan/cmd-scan-create.d.mts +0 -10
  345. package/dist/types/commands/scan/cmd-scan-create.d.mts.map +0 -1
  346. package/dist/types/commands/scan/cmd-scan-del.d.mts +0 -10
  347. package/dist/types/commands/scan/cmd-scan-del.d.mts.map +0 -1
  348. package/dist/types/commands/scan/cmd-scan-diff.d.mts +0 -10
  349. package/dist/types/commands/scan/cmd-scan-diff.d.mts.map +0 -1
  350. package/dist/types/commands/scan/cmd-scan-github.d.mts +0 -10
  351. package/dist/types/commands/scan/cmd-scan-github.d.mts.map +0 -1
  352. package/dist/types/commands/scan/cmd-scan-list.d.mts +0 -4
  353. package/dist/types/commands/scan/cmd-scan-list.d.mts.map +0 -1
  354. package/dist/types/commands/scan/cmd-scan-metadata.d.mts +0 -4
  355. package/dist/types/commands/scan/cmd-scan-metadata.d.mts.map +0 -1
  356. package/dist/types/commands/scan/cmd-scan-reach.d.mts +0 -10
  357. package/dist/types/commands/scan/cmd-scan-reach.d.mts.map +0 -1
  358. package/dist/types/commands/scan/cmd-scan-report.d.mts +0 -4
  359. package/dist/types/commands/scan/cmd-scan-report.d.mts.map +0 -1
  360. package/dist/types/commands/scan/cmd-scan-setup.d.mts +0 -9
  361. package/dist/types/commands/scan/cmd-scan-setup.d.mts.map +0 -1
  362. package/dist/types/commands/scan/cmd-scan-view.d.mts +0 -4
  363. package/dist/types/commands/scan/cmd-scan-view.d.mts.map +0 -1
  364. package/dist/types/commands/scan/cmd-scan.d.mts +0 -3
  365. package/dist/types/commands/scan/cmd-scan.d.mts.map +0 -1
  366. package/dist/types/commands/scan/create-scan-from-github.d.mts +0 -12
  367. package/dist/types/commands/scan/create-scan-from-github.d.mts.map +0 -1
  368. package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts +0 -20
  369. package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts.map +0 -1
  370. package/dist/types/commands/scan/fetch-delete-org-full-scan.d.mts +0 -8
  371. package/dist/types/commands/scan/fetch-delete-org-full-scan.d.mts.map +0 -1
  372. package/dist/types/commands/scan/fetch-diff-scan.d.mts +0 -8
  373. package/dist/types/commands/scan/fetch-diff-scan.d.mts.map +0 -1
  374. package/dist/types/commands/scan/fetch-list-scans.d.mts +0 -18
  375. package/dist/types/commands/scan/fetch-list-scans.d.mts.map +0 -1
  376. package/dist/types/commands/scan/fetch-report-data.d.mts +0 -17
  377. package/dist/types/commands/scan/fetch-report-data.d.mts.map +0 -1
  378. package/dist/types/commands/scan/fetch-scan-metadata.d.mts +0 -8
  379. package/dist/types/commands/scan/fetch-scan-metadata.d.mts.map +0 -1
  380. package/dist/types/commands/scan/fetch-scan.d.mts +0 -4
  381. package/dist/types/commands/scan/fetch-scan.d.mts.map +0 -1
  382. package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts +0 -10
  383. package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts.map +0 -1
  384. package/dist/types/commands/scan/finalize-tier1-scan.d.mts +0 -12
  385. package/dist/types/commands/scan/finalize-tier1-scan.d.mts.map +0 -1
  386. package/dist/types/commands/scan/generate-report.d.mts +0 -44
  387. package/dist/types/commands/scan/generate-report.d.mts.map +0 -1
  388. package/dist/types/commands/scan/handle-create-github-scan.d.mts +0 -12
  389. package/dist/types/commands/scan/handle-create-github-scan.d.mts.map +0 -1
  390. package/dist/types/commands/scan/handle-create-new-scan.d.mts +0 -29
  391. package/dist/types/commands/scan/handle-create-new-scan.d.mts.map +0 -1
  392. package/dist/types/commands/scan/handle-delete-scan.d.mts +0 -3
  393. package/dist/types/commands/scan/handle-delete-scan.d.mts.map +0 -1
  394. package/dist/types/commands/scan/handle-diff-scan.d.mts +0 -10
  395. package/dist/types/commands/scan/handle-diff-scan.d.mts.map +0 -1
  396. package/dist/types/commands/scan/handle-list-scans.d.mts +0 -13
  397. package/dist/types/commands/scan/handle-list-scans.d.mts.map +0 -1
  398. package/dist/types/commands/scan/handle-scan-config.d.mts +0 -2
  399. package/dist/types/commands/scan/handle-scan-config.d.mts.map +0 -1
  400. package/dist/types/commands/scan/handle-scan-metadata.d.mts +0 -3
  401. package/dist/types/commands/scan/handle-scan-metadata.d.mts.map +0 -1
  402. package/dist/types/commands/scan/handle-scan-reach.d.mts +0 -12
  403. package/dist/types/commands/scan/handle-scan-reach.d.mts.map +0 -1
  404. package/dist/types/commands/scan/handle-scan-report.d.mts +0 -14
  405. package/dist/types/commands/scan/handle-scan-report.d.mts.map +0 -1
  406. package/dist/types/commands/scan/handle-scan-view.d.mts +0 -3
  407. package/dist/types/commands/scan/handle-scan-view.d.mts.map +0 -1
  408. package/dist/types/commands/scan/output-create-new-scan.d.mts +0 -10
  409. package/dist/types/commands/scan/output-create-new-scan.d.mts.map +0 -1
  410. package/dist/types/commands/scan/output-delete-scan.d.mts +0 -4
  411. package/dist/types/commands/scan/output-delete-scan.d.mts.map +0 -1
  412. package/dist/types/commands/scan/output-diff-scan.d.mts +0 -8
  413. package/dist/types/commands/scan/output-diff-scan.d.mts.map +0 -1
  414. package/dist/types/commands/scan/output-list-scans.d.mts +0 -4
  415. package/dist/types/commands/scan/output-list-scans.d.mts.map +0 -1
  416. package/dist/types/commands/scan/output-scan-config-result.d.mts +0 -3
  417. package/dist/types/commands/scan/output-scan-config-result.d.mts.map +0 -1
  418. package/dist/types/commands/scan/output-scan-github.d.mts +0 -3
  419. package/dist/types/commands/scan/output-scan-github.d.mts.map +0 -1
  420. package/dist/types/commands/scan/output-scan-metadata.d.mts +0 -4
  421. package/dist/types/commands/scan/output-scan-metadata.d.mts.map +0 -1
  422. package/dist/types/commands/scan/output-scan-reach.d.mts +0 -7
  423. package/dist/types/commands/scan/output-scan-reach.d.mts.map +0 -1
  424. package/dist/types/commands/scan/output-scan-report.d.mts +0 -22
  425. package/dist/types/commands/scan/output-scan-report.d.mts.map +0 -1
  426. package/dist/types/commands/scan/output-scan-view.d.mts +0 -4
  427. package/dist/types/commands/scan/output-scan-view.d.mts.map +0 -1
  428. package/dist/types/commands/scan/perform-reachability-analysis.d.mts +0 -27
  429. package/dist/types/commands/scan/perform-reachability-analysis.d.mts.map +0 -1
  430. package/dist/types/commands/scan/reachability-flags.d.mts +0 -3
  431. package/dist/types/commands/scan/reachability-flags.d.mts.map +0 -1
  432. package/dist/types/commands/scan/setup-scan-config.d.mts +0 -3
  433. package/dist/types/commands/scan/setup-scan-config.d.mts.map +0 -1
  434. package/dist/types/commands/scan/stream-scan.d.mts +0 -7
  435. package/dist/types/commands/scan/stream-scan.d.mts.map +0 -1
  436. package/dist/types/commands/scan/suggest-org-slug.d.mts +0 -2
  437. package/dist/types/commands/scan/suggest-org-slug.d.mts.map +0 -1
  438. package/dist/types/commands/scan/suggest-to-persist-orgslug.d.mts +0 -2
  439. package/dist/types/commands/scan/suggest-to-persist-orgslug.d.mts.map +0 -1
  440. package/dist/types/commands/scan/suggest_branch_slug.d.mts +0 -2
  441. package/dist/types/commands/scan/suggest_branch_slug.d.mts.map +0 -1
  442. package/dist/types/commands/scan/suggest_target.d.mts +0 -2
  443. package/dist/types/commands/scan/suggest_target.d.mts.map +0 -1
  444. package/dist/types/commands/scan/types.d.mts +0 -3
  445. package/dist/types/commands/scan/types.d.mts.map +0 -1
  446. package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts +0 -10
  447. package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts.map +0 -1
  448. package/dist/types/commands/threat-feed/fetch-threat-feed.d.mts +0 -13
  449. package/dist/types/commands/threat-feed/fetch-threat-feed.d.mts.map +0 -1
  450. package/dist/types/commands/threat-feed/handle-threat-feed.d.mts +0 -13
  451. package/dist/types/commands/threat-feed/handle-threat-feed.d.mts.map +0 -1
  452. package/dist/types/commands/threat-feed/output-threat-feed.d.mts +0 -4
  453. package/dist/types/commands/threat-feed/output-threat-feed.d.mts.map +0 -1
  454. package/dist/types/commands/threat-feed/types.d.mts +0 -15
  455. package/dist/types/commands/threat-feed/types.d.mts.map +0 -1
  456. package/dist/types/commands/uninstall/cmd-uninstall-completion.d.mts +0 -8
  457. package/dist/types/commands/uninstall/cmd-uninstall-completion.d.mts.map +0 -1
  458. package/dist/types/commands/uninstall/cmd-uninstall.d.mts +0 -3
  459. package/dist/types/commands/uninstall/cmd-uninstall.d.mts.map +0 -1
  460. package/dist/types/commands/uninstall/handle-uninstall-completion.d.mts +0 -2
  461. package/dist/types/commands/uninstall/handle-uninstall-completion.d.mts.map +0 -1
  462. package/dist/types/commands/uninstall/output-uninstall-completion.d.mts +0 -6
  463. package/dist/types/commands/uninstall/output-uninstall-completion.d.mts.map +0 -1
  464. package/dist/types/commands/uninstall/teardown-tab-completion.d.mts +0 -6
  465. package/dist/types/commands/uninstall/teardown-tab-completion.d.mts.map +0 -1
  466. package/dist/types/commands/wrapper/add-socket-wrapper.d.mts +0 -2
  467. package/dist/types/commands/wrapper/add-socket-wrapper.d.mts.map +0 -1
  468. package/dist/types/commands/wrapper/check-socket-wrapper-setup.d.mts +0 -2
  469. package/dist/types/commands/wrapper/check-socket-wrapper-setup.d.mts.map +0 -1
  470. package/dist/types/commands/wrapper/cmd-wrapper.d.mts +0 -9
  471. package/dist/types/commands/wrapper/cmd-wrapper.d.mts.map +0 -1
  472. package/dist/types/commands/wrapper/postinstall-wrapper.d.mts +0 -2
  473. package/dist/types/commands/wrapper/postinstall-wrapper.d.mts.map +0 -1
  474. package/dist/types/commands/wrapper/remove-socket-wrapper.d.mts +0 -2
  475. package/dist/types/commands/wrapper/remove-socket-wrapper.d.mts.map +0 -1
  476. package/dist/types/commands/yarn/cmd-yarn.d.mts +0 -10
  477. package/dist/types/commands/yarn/cmd-yarn.d.mts.map +0 -1
  478. package/dist/types/commands.d.mts +0 -203
  479. package/dist/types/commands.d.mts.map +0 -1
  480. package/dist/types/constants.d.mts +0 -299
  481. package/dist/types/constants.d.mts.map +0 -1
  482. package/dist/types/flags.d.mts +0 -18
  483. package/dist/types/flags.d.mts.map +0 -1
  484. package/dist/types/instrument-with-sentry.d.mts +0 -2
  485. package/dist/types/instrument-with-sentry.d.mts.map +0 -1
  486. package/dist/types/npm-cli.d.mts +0 -3
  487. package/dist/types/npm-cli.d.mts.map +0 -1
  488. package/dist/types/npx-cli.d.mts +0 -3
  489. package/dist/types/npx-cli.d.mts.map +0 -1
  490. package/dist/types/pnpm-cli.d.mts +0 -3
  491. package/dist/types/pnpm-cli.d.mts.map +0 -1
  492. package/dist/types/sea/bootstrap.d.mts +0 -2
  493. package/dist/types/sea/bootstrap.d.mts.map +0 -1
  494. package/dist/types/sea/build-sea.d.mts +0 -27
  495. package/dist/types/sea/build-sea.d.mts.map +0 -1
  496. package/dist/types/shadow/common.d.mts +0 -23
  497. package/dist/types/shadow/common.d.mts.map +0 -1
  498. package/dist/types/shadow/npm/arborist/index.d.mts +0 -8
  499. package/dist/types/shadow/npm/arborist/index.d.mts.map +0 -1
  500. package/dist/types/shadow/npm/arborist/lib/arborist/index.d.mts +0 -35
  501. package/dist/types/shadow/npm/arborist/lib/arborist/index.d.mts.map +0 -1
  502. package/dist/types/shadow/npm/arborist/types.d.mts +0 -123
  503. package/dist/types/shadow/npm/arborist/types.d.mts.map +0 -1
  504. package/dist/types/shadow/npm/arborist-helpers.d.mts +0 -24
  505. package/dist/types/shadow/npm/arborist-helpers.d.mts.map +0 -1
  506. package/dist/types/shadow/npm/bin.d.mts +0 -5
  507. package/dist/types/shadow/npm/bin.d.mts.map +0 -1
  508. package/dist/types/shadow/npm/inject.d.mts +0 -2
  509. package/dist/types/shadow/npm/inject.d.mts.map +0 -1
  510. package/dist/types/shadow/npm/install.d.mts +0 -13
  511. package/dist/types/shadow/npm/install.d.mts.map +0 -1
  512. package/dist/types/shadow/npm/paths.d.mts +0 -6
  513. package/dist/types/shadow/npm/paths.d.mts.map +0 -1
  514. package/dist/types/shadow/npm-base.d.mts +0 -11
  515. package/dist/types/shadow/npm-base.d.mts.map +0 -1
  516. package/dist/types/shadow/npx/bin.d.mts +0 -5
  517. package/dist/types/shadow/npx/bin.d.mts.map +0 -1
  518. package/dist/types/shadow/pnpm/bin.d.mts +0 -10
  519. package/dist/types/shadow/pnpm/bin.d.mts.map +0 -1
  520. package/dist/types/shadow/stdio-ipc.d.mts +0 -7
  521. package/dist/types/shadow/stdio-ipc.d.mts.map +0 -1
  522. package/dist/types/shadow/yarn/bin.d.mts +0 -10
  523. package/dist/types/shadow/yarn/bin.d.mts.map +0 -1
  524. package/dist/types/test/json-output-validation.d.mts +0 -37
  525. package/dist/types/test/json-output-validation.d.mts.map +0 -1
  526. package/dist/types/test/mocks/socket-auth.d.mts +0 -88
  527. package/dist/types/test/mocks/socket-auth.d.mts.map +0 -1
  528. package/dist/types/types.d.mts +0 -29
  529. package/dist/types/types.d.mts.map +0 -1
  530. package/dist/types/utils/agent.d.mts +0 -12
  531. package/dist/types/utils/agent.d.mts.map +0 -1
  532. package/dist/types/utils/alert/artifact.d.mts +0 -21
  533. package/dist/types/utils/alert/artifact.d.mts.map +0 -1
  534. package/dist/types/utils/alert/fix.d.mts +0 -6
  535. package/dist/types/utils/alert/fix.d.mts.map +0 -1
  536. package/dist/types/utils/alert/severity.d.mts +0 -14
  537. package/dist/types/utils/alert/severity.d.mts.map +0 -1
  538. package/dist/types/utils/alerts-map.d.mts +0 -27
  539. package/dist/types/utils/alerts-map.d.mts.map +0 -1
  540. package/dist/types/utils/api.d.mts +0 -44
  541. package/dist/types/utils/api.d.mts.map +0 -1
  542. package/dist/types/utils/check-input.d.mts +0 -9
  543. package/dist/types/utils/check-input.d.mts.map +0 -1
  544. package/dist/types/utils/cmd.d.mts +0 -50
  545. package/dist/types/utils/cmd.d.mts.map +0 -1
  546. package/dist/types/utils/coana.d.mts +0 -2
  547. package/dist/types/utils/coana.d.mts.map +0 -1
  548. package/dist/types/utils/color-or-markdown.d.mts +0 -16
  549. package/dist/types/utils/color-or-markdown.d.mts.map +0 -1
  550. package/dist/types/utils/completion.d.mts +0 -11
  551. package/dist/types/utils/completion.d.mts.map +0 -1
  552. package/dist/types/utils/config.d.mts +0 -34
  553. package/dist/types/utils/config.d.mts.map +0 -1
  554. package/dist/types/utils/cve-to-ghsa.d.mts +0 -6
  555. package/dist/types/utils/cve-to-ghsa.d.mts.map +0 -1
  556. package/dist/types/utils/debug.d.mts +0 -45
  557. package/dist/types/utils/debug.d.mts.map +0 -1
  558. package/dist/types/utils/determine-org-slug.d.mts +0 -2
  559. package/dist/types/utils/determine-org-slug.d.mts.map +0 -1
  560. package/dist/types/utils/dlx-binary.d.mts +0 -58
  561. package/dist/types/utils/dlx-binary.d.mts.map +0 -1
  562. package/dist/types/utils/dlx-detection.d.mts +0 -29
  563. package/dist/types/utils/dlx-detection.d.mts.map +0 -1
  564. package/dist/types/utils/dlx.d.mts +0 -36
  565. package/dist/types/utils/dlx.d.mts.map +0 -1
  566. package/dist/types/utils/ecosystem.d.mts +0 -20
  567. package/dist/types/utils/ecosystem.d.mts.map +0 -1
  568. package/dist/types/utils/errors.d.mts +0 -62
  569. package/dist/types/utils/errors.d.mts.map +0 -1
  570. package/dist/types/utils/extract-names.d.mts +0 -15
  571. package/dist/types/utils/extract-names.d.mts.map +0 -1
  572. package/dist/types/utils/fail-msg-with-badge.d.mts +0 -2
  573. package/dist/types/utils/fail-msg-with-badge.d.mts.map +0 -1
  574. package/dist/types/utils/filter-config.d.mts +0 -5
  575. package/dist/types/utils/filter-config.d.mts.map +0 -1
  576. package/dist/types/utils/fs.d.mts +0 -8
  577. package/dist/types/utils/fs.d.mts.map +0 -1
  578. package/dist/types/utils/get-output-kind.d.mts +0 -3
  579. package/dist/types/utils/get-output-kind.d.mts.map +0 -1
  580. package/dist/types/utils/git.d.mts +0 -35
  581. package/dist/types/utils/git.d.mts.map +0 -1
  582. package/dist/types/utils/github.d.mts +0 -38
  583. package/dist/types/utils/github.d.mts.map +0 -1
  584. package/dist/types/utils/glob.d.mts +0 -15
  585. package/dist/types/utils/glob.d.mts.map +0 -1
  586. package/dist/types/utils/lockfile.d.mts +0 -2
  587. package/dist/types/utils/lockfile.d.mts.map +0 -1
  588. package/dist/types/utils/map-to-object.d.mts +0 -10
  589. package/dist/types/utils/map-to-object.d.mts.map +0 -1
  590. package/dist/types/utils/markdown.d.mts +0 -27
  591. package/dist/types/utils/markdown.d.mts.map +0 -1
  592. package/dist/types/utils/meow-with-subcommands.d.mts +0 -83
  593. package/dist/types/utils/meow-with-subcommands.d.mts.map +0 -1
  594. package/dist/types/utils/ms-at-home.d.mts +0 -2
  595. package/dist/types/utils/ms-at-home.d.mts.map +0 -1
  596. package/dist/types/utils/npm-config.d.mts +0 -14
  597. package/dist/types/utils/npm-config.d.mts.map +0 -1
  598. package/dist/types/utils/npm-package-arg.d.mts +0 -8
  599. package/dist/types/utils/npm-package-arg.d.mts.map +0 -1
  600. package/dist/types/utils/npm-paths.d.mts +0 -7
  601. package/dist/types/utils/npm-paths.d.mts.map +0 -1
  602. package/dist/types/utils/npm-spec.d.mts +0 -57
  603. package/dist/types/utils/npm-spec.d.mts.map +0 -1
  604. package/dist/types/utils/objects.d.mts +0 -3
  605. package/dist/types/utils/objects.d.mts.map +0 -1
  606. package/dist/types/utils/organization.d.mts +0 -5
  607. package/dist/types/utils/organization.d.mts.map +0 -1
  608. package/dist/types/utils/output-formatting.d.mts +0 -20
  609. package/dist/types/utils/output-formatting.d.mts.map +0 -1
  610. package/dist/types/utils/package-environment.d.mts +0 -57
  611. package/dist/types/utils/package-environment.d.mts.map +0 -1
  612. package/dist/types/utils/path-resolve.d.mts +0 -14
  613. package/dist/types/utils/path-resolve.d.mts.map +0 -1
  614. package/dist/types/utils/pnpm-paths.d.mts +0 -5
  615. package/dist/types/utils/pnpm-paths.d.mts.map +0 -1
  616. package/dist/types/utils/pnpm.d.mts +0 -11
  617. package/dist/types/utils/pnpm.d.mts.map +0 -1
  618. package/dist/types/utils/purl-to-ghsa.d.mts +0 -6
  619. package/dist/types/utils/purl-to-ghsa.d.mts.map +0 -1
  620. package/dist/types/utils/purl.d.mts +0 -71
  621. package/dist/types/utils/purl.d.mts.map +0 -1
  622. package/dist/types/utils/requirements.d.mts +0 -125
  623. package/dist/types/utils/requirements.d.mts.map +0 -1
  624. package/dist/types/utils/sdk.d.mts +0 -17
  625. package/dist/types/utils/sdk.d.mts.map +0 -1
  626. package/dist/types/utils/semver.d.mts +0 -7
  627. package/dist/types/utils/semver.d.mts.map +0 -1
  628. package/dist/types/utils/serialize-result-json.d.mts +0 -5
  629. package/dist/types/utils/serialize-result-json.d.mts.map +0 -1
  630. package/dist/types/utils/shadow-links.d.mts +0 -5
  631. package/dist/types/utils/shadow-links.d.mts.map +0 -1
  632. package/dist/types/utils/socket-json.d.mts +0 -59
  633. package/dist/types/utils/socket-json.d.mts.map +0 -1
  634. package/dist/types/utils/socket-package-alert.d.mts +0 -80
  635. package/dist/types/utils/socket-package-alert.d.mts.map +0 -1
  636. package/dist/types/utils/socket-url.d.mts +0 -8
  637. package/dist/types/utils/socket-url.d.mts.map +0 -1
  638. package/dist/types/utils/spec.d.mts +0 -5
  639. package/dist/types/utils/spec.d.mts.map +0 -1
  640. package/dist/types/utils/strings.d.mts +0 -14
  641. package/dist/types/utils/strings.d.mts.map +0 -1
  642. package/dist/types/utils/terminal-link.d.mts +0 -52
  643. package/dist/types/utils/terminal-link.d.mts.map +0 -1
  644. package/dist/types/utils/tildify.d.mts +0 -2
  645. package/dist/types/utils/tildify.d.mts.map +0 -1
  646. package/dist/types/utils/translations.d.mts +0 -617
  647. package/dist/types/utils/translations.d.mts.map +0 -1
  648. package/dist/types/utils/walk-nested-map.d.mts +0 -7
  649. package/dist/types/utils/walk-nested-map.d.mts.map +0 -1
  650. package/dist/types/utils/yarn-paths.d.mts +0 -5
  651. package/dist/types/utils/yarn-paths.d.mts.map +0 -1
  652. package/dist/types/utils/yarn-version.d.mts +0 -2
  653. package/dist/types/utils/yarn-version.d.mts.map +0 -1
  654. package/dist/types/yarn-cli.d.mts +0 -3
  655. package/dist/types/yarn-cli.d.mts.map +0 -1
  656. package/dist/utils.js +0 -6146
  657. package/dist/utils.js.map +0 -1
  658. package/dist/vendor.js +0 -162074
  659. package/dist/yarn-cli.js +0 -30
  660. package/dist/yarn-cli.js.map +0 -1
  661. package/external/@socketsecurity/registry/LICENSE +0 -21
  662. package/external/@socketsecurity/registry/README.md +0 -9
  663. package/external/@socketsecurity/registry/extensions.json +0 -28
  664. package/external/@socketsecurity/registry/external/@inquirer/confirm.js +0 -3165
  665. package/external/@socketsecurity/registry/external/@inquirer/input.js +0 -3202
  666. package/external/@socketsecurity/registry/external/@inquirer/password.js +0 -3307
  667. package/external/@socketsecurity/registry/external/@inquirer/search.js +0 -3519
  668. package/external/@socketsecurity/registry/external/@inquirer/select.js +0 -3655
  669. package/external/@socketsecurity/registry/external/@npmcli/package-json/index.js +0 -21406
  670. package/external/@socketsecurity/registry/external/@npmcli/package-json/lib/read-package.js +0 -183
  671. package/external/@socketsecurity/registry/external/@npmcli/package-json/lib/sort.js +0 -274
  672. package/external/@socketsecurity/registry/external/@npmcli/promise-spawn.js +0 -704
  673. package/external/@socketsecurity/registry/external/@socketregistry/is-unicode-supported.js +0 -54
  674. package/external/@socketsecurity/registry/external/@socketregistry/packageurl-js.js +0 -4516
  675. package/external/@socketsecurity/registry/external/@socketregistry/yocto-spinner.js +0 -453
  676. package/external/@socketsecurity/registry/external/@yarnpkg/extensions.js +0 -1406
  677. package/external/@socketsecurity/registry/external/browserslist.js +0 -20496
  678. package/external/@socketsecurity/registry/external/cacache.js +0 -16208
  679. package/external/@socketsecurity/registry/external/debug.js +0 -1163
  680. package/external/@socketsecurity/registry/external/fast-glob.js +0 -7994
  681. package/external/@socketsecurity/registry/external/fast-sort.js +0 -181
  682. package/external/@socketsecurity/registry/external/libnpmpack.js +0 -106271
  683. package/external/@socketsecurity/registry/external/make-fetch-happen.js +0 -38997
  684. package/external/@socketsecurity/registry/external/normalize-package-data.js +0 -5343
  685. package/external/@socketsecurity/registry/external/npm-package-arg.js +0 -5773
  686. package/external/@socketsecurity/registry/external/pacote.js +0 -74109
  687. package/external/@socketsecurity/registry/external/picomatch.js +0 -2307
  688. package/external/@socketsecurity/registry/external/semver.js +0 -2618
  689. package/external/@socketsecurity/registry/external/signal-exit.js +0 -336
  690. package/external/@socketsecurity/registry/external/spdx-correct.js +0 -1457
  691. package/external/@socketsecurity/registry/external/spdx-expression-parse.js +0 -1043
  692. package/external/@socketsecurity/registry/external/streaming-iterables.js +0 -326
  693. package/external/@socketsecurity/registry/external/validate-npm-package-name.js +0 -108
  694. package/external/@socketsecurity/registry/external/which.js +0 -405
  695. package/external/@socketsecurity/registry/external/yoctocolors-cjs.js +0 -101
  696. package/external/@socketsecurity/registry/index.js +0 -31
  697. package/external/@socketsecurity/registry/lib/agent.js +0 -390
  698. package/external/@socketsecurity/registry/lib/arrays.js +0 -89
  699. package/external/@socketsecurity/registry/lib/bin.js +0 -650
  700. package/external/@socketsecurity/registry/lib/constants/abort-controller.js +0 -15
  701. package/external/@socketsecurity/registry/lib/constants/abort-signal.js +0 -27
  702. package/external/@socketsecurity/registry/lib/constants/at-latest.js +0 -3
  703. package/external/@socketsecurity/registry/lib/constants/biome-json.js +0 -3
  704. package/external/@socketsecurity/registry/lib/constants/bun-lock.js +0 -3
  705. package/external/@socketsecurity/registry/lib/constants/bun-lockb.js +0 -3
  706. package/external/@socketsecurity/registry/lib/constants/bun.js +0 -3
  707. package/external/@socketsecurity/registry/lib/constants/ci.js +0 -3
  708. package/external/@socketsecurity/registry/lib/constants/column-limit.js +0 -3
  709. package/external/@socketsecurity/registry/lib/constants/copy-left-licenses.js +0 -27
  710. package/external/@socketsecurity/registry/lib/constants/darwin.js +0 -3
  711. package/external/@socketsecurity/registry/lib/constants/dot-git-dir.js +0 -3
  712. package/external/@socketsecurity/registry/lib/constants/dot-package-lock-json.js +0 -3
  713. package/external/@socketsecurity/registry/lib/constants/dot-socket-dir.js +0 -3
  714. package/external/@socketsecurity/registry/lib/constants/empty-file.js +0 -3
  715. package/external/@socketsecurity/registry/lib/constants/empty-value.js +0 -3
  716. package/external/@socketsecurity/registry/lib/constants/env.js +0 -59
  717. package/external/@socketsecurity/registry/lib/constants/eslint-config-js.js +0 -3
  718. package/external/@socketsecurity/registry/lib/constants/esnext.js +0 -3
  719. package/external/@socketsecurity/registry/lib/constants/exec-path.js +0 -3
  720. package/external/@socketsecurity/registry/lib/constants/ext-cjs.js +0 -3
  721. package/external/@socketsecurity/registry/lib/constants/ext-cmd.js +0 -3
  722. package/external/@socketsecurity/registry/lib/constants/ext-cts.js +0 -3
  723. package/external/@socketsecurity/registry/lib/constants/ext-dts.js +0 -3
  724. package/external/@socketsecurity/registry/lib/constants/ext-js.js +0 -3
  725. package/external/@socketsecurity/registry/lib/constants/ext-json.js +0 -3
  726. package/external/@socketsecurity/registry/lib/constants/ext-lock.js +0 -3
  727. package/external/@socketsecurity/registry/lib/constants/ext-lockb.js +0 -3
  728. package/external/@socketsecurity/registry/lib/constants/ext-md.js +0 -3
  729. package/external/@socketsecurity/registry/lib/constants/ext-mjs.js +0 -3
  730. package/external/@socketsecurity/registry/lib/constants/ext-mts.js +0 -3
  731. package/external/@socketsecurity/registry/lib/constants/ext-ps1.js +0 -3
  732. package/external/@socketsecurity/registry/lib/constants/ext-yaml.js +0 -3
  733. package/external/@socketsecurity/registry/lib/constants/ext-yml.js +0 -3
  734. package/external/@socketsecurity/registry/lib/constants/extensions-json.js +0 -3
  735. package/external/@socketsecurity/registry/lib/constants/extensions.js +0 -3
  736. package/external/@socketsecurity/registry/lib/constants/get-ipc.js +0 -10
  737. package/external/@socketsecurity/registry/lib/constants/gitignore.js +0 -3
  738. package/external/@socketsecurity/registry/lib/constants/index.js +0 -139
  739. package/external/@socketsecurity/registry/lib/constants/ipc-handler.js +0 -19
  740. package/external/@socketsecurity/registry/lib/constants/ipc-object.js +0 -6
  741. package/external/@socketsecurity/registry/lib/constants/ipc-promise.js +0 -47
  742. package/external/@socketsecurity/registry/lib/constants/ipc-target.js +0 -3
  743. package/external/@socketsecurity/registry/lib/constants/k-internals-symbol.js +0 -3
  744. package/external/@socketsecurity/registry/lib/constants/latest.js +0 -3
  745. package/external/@socketsecurity/registry/lib/constants/license-glob-recursive.js +0 -3
  746. package/external/@socketsecurity/registry/lib/constants/license-glob.js +0 -3
  747. package/external/@socketsecurity/registry/lib/constants/license-original-glob-recursive.js +0 -3
  748. package/external/@socketsecurity/registry/lib/constants/license-original-glob.js +0 -3
  749. package/external/@socketsecurity/registry/lib/constants/license-original.js +0 -3
  750. package/external/@socketsecurity/registry/lib/constants/license.js +0 -3
  751. package/external/@socketsecurity/registry/lib/constants/lifecycle-script-names.js +0 -18
  752. package/external/@socketsecurity/registry/lib/constants/loop-sentinel.js +0 -3
  753. package/external/@socketsecurity/registry/lib/constants/maintained-node-versions.js +0 -47
  754. package/external/@socketsecurity/registry/lib/constants/manifest-json.js +0 -3
  755. package/external/@socketsecurity/registry/lib/constants/mit.js +0 -3
  756. package/external/@socketsecurity/registry/lib/constants/node-auth-token.js +0 -3
  757. package/external/@socketsecurity/registry/lib/constants/node-debug-flags.js +0 -9
  758. package/external/@socketsecurity/registry/lib/constants/node-env.js +0 -3
  759. package/external/@socketsecurity/registry/lib/constants/node-harden-flags.js +0 -29
  760. package/external/@socketsecurity/registry/lib/constants/node-modules-glob-recursive.js +0 -3
  761. package/external/@socketsecurity/registry/lib/constants/node-modules.js +0 -3
  762. package/external/@socketsecurity/registry/lib/constants/node-no-warnings-flags.js +0 -16
  763. package/external/@socketsecurity/registry/lib/constants/node-version.js +0 -3
  764. package/external/@socketsecurity/registry/lib/constants/npm-exec-path.js +0 -5
  765. package/external/@socketsecurity/registry/lib/constants/npm-real-exec-path.js +0 -6
  766. package/external/@socketsecurity/registry/lib/constants/npm-shrinkwrap-json.js +0 -3
  767. package/external/@socketsecurity/registry/lib/constants/npm.js +0 -3
  768. package/external/@socketsecurity/registry/lib/constants/npx.js +0 -3
  769. package/external/@socketsecurity/registry/lib/constants/overrides.js +0 -3
  770. package/external/@socketsecurity/registry/lib/constants/package-default-node-range.js +0 -6
  771. package/external/@socketsecurity/registry/lib/constants/package-default-socket-categories.js +0 -3
  772. package/external/@socketsecurity/registry/lib/constants/package-default-version.js +0 -3
  773. package/external/@socketsecurity/registry/lib/constants/package-extensions.js +0 -47
  774. package/external/@socketsecurity/registry/lib/constants/package-json.js +0 -3
  775. package/external/@socketsecurity/registry/lib/constants/package-lock-json.js +0 -3
  776. package/external/@socketsecurity/registry/lib/constants/packument-cache.js +0 -3
  777. package/external/@socketsecurity/registry/lib/constants/pacote-cache-path.js +0 -9
  778. package/external/@socketsecurity/registry/lib/constants/pnpm-exec-path.js +0 -5
  779. package/external/@socketsecurity/registry/lib/constants/pnpm-lock-yaml.js +0 -3
  780. package/external/@socketsecurity/registry/lib/constants/pnpm.js +0 -3
  781. package/external/@socketsecurity/registry/lib/constants/pre-commit.js +0 -3
  782. package/external/@socketsecurity/registry/lib/constants/readme-glob-recursive.js +0 -3
  783. package/external/@socketsecurity/registry/lib/constants/readme-glob.js +0 -3
  784. package/external/@socketsecurity/registry/lib/constants/readme-md.js +0 -3
  785. package/external/@socketsecurity/registry/lib/constants/registry-scope-delimiter.js +0 -3
  786. package/external/@socketsecurity/registry/lib/constants/registry.js +0 -3
  787. package/external/@socketsecurity/registry/lib/constants/resolutions.js +0 -3
  788. package/external/@socketsecurity/registry/lib/constants/socket-github-org.js +0 -3
  789. package/external/@socketsecurity/registry/lib/constants/socket-ipc-handshake.js +0 -3
  790. package/external/@socketsecurity/registry/lib/constants/socket-override-scope.js +0 -3
  791. package/external/@socketsecurity/registry/lib/constants/socket-public-api-token.js +0 -3
  792. package/external/@socketsecurity/registry/lib/constants/socket-registry-npm-org.js +0 -3
  793. package/external/@socketsecurity/registry/lib/constants/socket-registry-package-name.js +0 -3
  794. package/external/@socketsecurity/registry/lib/constants/socket-registry-repo-name.js +0 -3
  795. package/external/@socketsecurity/registry/lib/constants/socket-registry-scope.js +0 -3
  796. package/external/@socketsecurity/registry/lib/constants/socket-security-scope.js +0 -3
  797. package/external/@socketsecurity/registry/lib/constants/spinner.js +0 -4
  798. package/external/@socketsecurity/registry/lib/constants/supports-node-compile-cache-api.js +0 -8
  799. package/external/@socketsecurity/registry/lib/constants/supports-node-compile-cache-env-var.js +0 -8
  800. package/external/@socketsecurity/registry/lib/constants/supports-node-disable-warning-flag.js +0 -8
  801. package/external/@socketsecurity/registry/lib/constants/supports-node-permission-flag.js +0 -8
  802. package/external/@socketsecurity/registry/lib/constants/supports-node-require-module.js +0 -3
  803. package/external/@socketsecurity/registry/lib/constants/supports-node-run.js +0 -8
  804. package/external/@socketsecurity/registry/lib/constants/supports-process-send.js +0 -5
  805. package/external/@socketsecurity/registry/lib/constants/ts-libs-available.js +0 -22
  806. package/external/@socketsecurity/registry/lib/constants/ts-types-available.js +0 -3
  807. package/external/@socketsecurity/registry/lib/constants/tsconfig-json.js +0 -3
  808. package/external/@socketsecurity/registry/lib/constants/undefined-token.js +0 -3
  809. package/external/@socketsecurity/registry/lib/constants/unknown-error.js +0 -3
  810. package/external/@socketsecurity/registry/lib/constants/unknown-value.js +0 -3
  811. package/external/@socketsecurity/registry/lib/constants/unlicenced.js +0 -3
  812. package/external/@socketsecurity/registry/lib/constants/unlicensed.js +0 -3
  813. package/external/@socketsecurity/registry/lib/constants/utf8.js +0 -3
  814. package/external/@socketsecurity/registry/lib/constants/vitest.js +0 -3
  815. package/external/@socketsecurity/registry/lib/constants/vlt-lock-json.js +0 -3
  816. package/external/@socketsecurity/registry/lib/constants/vlt.js +0 -3
  817. package/external/@socketsecurity/registry/lib/constants/win32.js +0 -3
  818. package/external/@socketsecurity/registry/lib/constants/yarn-berry.js +0 -3
  819. package/external/@socketsecurity/registry/lib/constants/yarn-classic.js +0 -3
  820. package/external/@socketsecurity/registry/lib/constants/yarn-exec-path.js +0 -5
  821. package/external/@socketsecurity/registry/lib/constants/yarn-lock.js +0 -3
  822. package/external/@socketsecurity/registry/lib/constants/yarn.js +0 -3
  823. package/external/@socketsecurity/registry/lib/debug.js +0 -264
  824. package/external/@socketsecurity/registry/lib/env.js +0 -62
  825. package/external/@socketsecurity/registry/lib/fs.js +0 -556
  826. package/external/@socketsecurity/registry/lib/functions.js +0 -20
  827. package/external/@socketsecurity/registry/lib/globs.js +0 -145
  828. package/external/@socketsecurity/registry/lib/json.js +0 -69
  829. package/external/@socketsecurity/registry/lib/logger.js +0 -534
  830. package/external/@socketsecurity/registry/lib/objects.js +0 -422
  831. package/external/@socketsecurity/registry/lib/packages.js +0 -1376
  832. package/external/@socketsecurity/registry/lib/path.js +0 -231
  833. package/external/@socketsecurity/registry/lib/promises.js +0 -286
  834. package/external/@socketsecurity/registry/lib/prompts.js +0 -63
  835. package/external/@socketsecurity/registry/lib/regexps.js +0 -23
  836. package/external/@socketsecurity/registry/lib/sorts.js +0 -70
  837. package/external/@socketsecurity/registry/lib/spawn.js +0 -252
  838. package/external/@socketsecurity/registry/lib/spinner.js +0 -205
  839. package/external/@socketsecurity/registry/lib/streams.js +0 -84
  840. package/external/@socketsecurity/registry/lib/strings.js +0 -235
  841. package/external/@socketsecurity/registry/lib/url.js +0 -68
  842. package/external/@socketsecurity/registry/lib/words.js +0 -45
  843. package/external/@socketsecurity/registry/manifest.json +0 -1875
  844. package/external/blessed/LICENSE +0 -20
  845. package/external/blessed/README.md +0 -2421
  846. package/external/blessed/lib/alias.js +0 -528
  847. package/external/blessed/lib/blessed.js +0 -34
  848. package/external/blessed/lib/colors.js +0 -532
  849. package/external/blessed/lib/events.js +0 -191
  850. package/external/blessed/lib/gpmclient.js +0 -223
  851. package/external/blessed/lib/helpers.js +0 -167
  852. package/external/blessed/lib/keys.js +0 -341
  853. package/external/blessed/lib/program.js +0 -4297
  854. package/external/blessed/lib/tput.js +0 -3020
  855. package/external/blessed/lib/unicode.js +0 -792
  856. package/external/blessed/lib/widget.js +0 -62
  857. package/external/blessed/lib/widgets/ansiimage.js +0 -169
  858. package/external/blessed/lib/widgets/bigtext.js +0 -161
  859. package/external/blessed/lib/widgets/box.js +0 -36
  860. package/external/blessed/lib/widgets/button.js +0 -64
  861. package/external/blessed/lib/widgets/checkbox.js +0 -93
  862. package/external/blessed/lib/widgets/element.js +0 -2572
  863. package/external/blessed/lib/widgets/filemanager.js +0 -214
  864. package/external/blessed/lib/widgets/form.js +0 -269
  865. package/external/blessed/lib/widgets/image.js +0 -63
  866. package/external/blessed/lib/widgets/input.js +0 -36
  867. package/external/blessed/lib/widgets/layout.js +0 -235
  868. package/external/blessed/lib/widgets/line.js +0 -58
  869. package/external/blessed/lib/widgets/list.js +0 -601
  870. package/external/blessed/lib/widgets/listbar.js +0 -413
  871. package/external/blessed/lib/widgets/listtable.js +0 -254
  872. package/external/blessed/lib/widgets/loading.js +0 -90
  873. package/external/blessed/lib/widgets/log.js +0 -85
  874. package/external/blessed/lib/widgets/message.js +0 -125
  875. package/external/blessed/lib/widgets/node.js +0 -284
  876. package/external/blessed/lib/widgets/overlayimage.js +0 -719
  877. package/external/blessed/lib/widgets/progressbar.js +0 -159
  878. package/external/blessed/lib/widgets/prompt.js +0 -122
  879. package/external/blessed/lib/widgets/question.js +0 -118
  880. package/external/blessed/lib/widgets/radiobutton.js +0 -63
  881. package/external/blessed/lib/widgets/radioset.js +0 -38
  882. package/external/blessed/lib/widgets/screen.js +0 -2300
  883. package/external/blessed/lib/widgets/scrollablebox.js +0 -391
  884. package/external/blessed/lib/widgets/scrollabletext.js +0 -37
  885. package/external/blessed/lib/widgets/table.js +0 -356
  886. package/external/blessed/lib/widgets/terminal.js +0 -414
  887. package/external/blessed/lib/widgets/text.js +0 -37
  888. package/external/blessed/lib/widgets/textarea.js +0 -344
  889. package/external/blessed/lib/widgets/textbox.js +0 -79
  890. package/external/blessed/lib/widgets/video.js +0 -128
  891. package/external/blessed/usr/fonts/AUTHORS +0 -1
  892. package/external/blessed/usr/fonts/LICENSE +0 -94
  893. package/external/blessed/usr/fonts/README +0 -340
  894. package/external/blessed/usr/fonts/ter-u14b.json +0 -17826
  895. package/external/blessed/usr/fonts/ter-u14n.json +0 -17826
  896. package/external/blessed/usr/linux +0 -0
  897. package/external/blessed/usr/windows-ansi +0 -0
  898. package/external/blessed/usr/xterm +0 -0
  899. package/external/blessed/usr/xterm-256color +0 -0
  900. package/external/blessed/usr/xterm.termcap +0 -243
  901. package/external/blessed/usr/xterm.terminfo +0 -1977
  902. package/external/blessed/vendor/tng.js +0 -1757
  903. package/external/blessed-contrib/LICENSE.md +0 -21
  904. package/external/blessed-contrib/lib/layout/grid.js +0 -409
  905. package/external/blessed-contrib/lib/widget/charts/bar.js +0 -8370
  906. package/external/blessed-contrib/lib/widget/charts/line.js +0 -17924
  907. package/external/blessed-contrib/lib/widget/table.js +0 -187
  908. package/shadow-bin/npm +0 -27
  909. package/shadow-bin/npx +0 -27
  910. package/shadow-bin/pnpm +0 -27
  911. package/shadow-bin/yarn +0 -27
  912. /package/{translations.json → data/alert-translations.json} +0 -0
  913. /package/{requirements.json → data/command-api-requirements.json} +0 -0
  914. /package/{dist → data}/socket-completion.bash +0 -0
@@ -1,2572 +0,0 @@
1
- 'use strict'
2
-
3
- /**
4
- * element.js - base element for blessed
5
- * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
6
- * https://github.com/chjj/blessed
7
- */
8
-
9
- /**
10
- * Modules
11
- */
12
-
13
- var assert = require('assert');
14
-
15
- var colors = require('../colors')
16
- , unicode = require('../unicode');
17
-
18
- var nextTick = global.setImmediate || process.nextTick.bind(process);
19
-
20
- var helpers = require('../helpers');
21
-
22
- var Node = require('./node');
23
-
24
- /**
25
- * Element
26
- */
27
-
28
- function Element(options) {
29
- var self = this;
30
-
31
- if (!(this instanceof Node)) {
32
- return new Element(options);
33
- }
34
-
35
- options = options || {};
36
-
37
- // Workaround to get a `scrollable` option.
38
- if (options.scrollable && !this._ignore && this.type !== 'scrollable-box') {
39
- var ScrollableBox = require('./scrollablebox');
40
- Object.getOwnPropertyNames(ScrollableBox.prototype).forEach(function(key) {
41
- if (key === 'type') return;
42
- Object.defineProperty(this, key,
43
- Object.getOwnPropertyDescriptor(ScrollableBox.prototype, key));
44
- }, this);
45
- this._ignore = true;
46
- ScrollableBox.call(this, options);
47
- delete this._ignore;
48
- return this;
49
- }
50
-
51
- Node.call(this, options);
52
-
53
- this.name = options.name;
54
-
55
- options.position = options.position || {
56
- left: options.left,
57
- right: options.right,
58
- top: options.top,
59
- bottom: options.bottom,
60
- width: options.width,
61
- height: options.height
62
- };
63
-
64
- if (options.position.width === 'shrink'
65
- || options.position.height === 'shrink') {
66
- if (options.position.width === 'shrink') {
67
- delete options.position.width;
68
- }
69
- if (options.position.height === 'shrink') {
70
- delete options.position.height;
71
- }
72
- options.shrink = true;
73
- }
74
-
75
- this.position = options.position;
76
-
77
- this.noOverflow = options.noOverflow;
78
- this.dockBorders = options.dockBorders;
79
- this.shadow = options.shadow;
80
-
81
- this.style = options.style;
82
-
83
- if (!this.style) {
84
- this.style = {};
85
- this.style.fg = options.fg;
86
- this.style.bg = options.bg;
87
- this.style.bold = options.bold;
88
- this.style.underline = options.underline;
89
- this.style.blink = options.blink;
90
- this.style.inverse = options.inverse;
91
- this.style.invisible = options.invisible;
92
- this.style.transparent = options.transparent;
93
- }
94
-
95
- this.hidden = options.hidden || false;
96
- this.fixed = options.fixed || false;
97
- this.align = options.align || 'left';
98
- this.valign = options.valign || 'top';
99
- this.wrap = options.wrap !== false;
100
- this.shrink = options.shrink;
101
- this.fixed = options.fixed;
102
- this.ch = options.ch || ' ';
103
-
104
- if (typeof options.padding === 'number' || !options.padding) {
105
- options.padding = {
106
- left: options.padding,
107
- top: options.padding,
108
- right: options.padding,
109
- bottom: options.padding
110
- };
111
- }
112
-
113
- this.padding = {
114
- left: options.padding.left || 0,
115
- top: options.padding.top || 0,
116
- right: options.padding.right || 0,
117
- bottom: options.padding.bottom || 0
118
- };
119
-
120
- this.border = options.border;
121
- if (this.border) {
122
- if (typeof this.border === 'string') {
123
- this.border = { type: this.border };
124
- }
125
- this.border.type = this.border.type || 'bg';
126
- if (this.border.type === 'ascii') this.border.type = 'line';
127
- this.border.ch = this.border.ch || ' ';
128
- this.style.border = this.style.border || this.border.style;
129
- if (!this.style.border) {
130
- this.style.border = {};
131
- this.style.border.fg = this.border.fg;
132
- this.style.border.bg = this.border.bg;
133
- }
134
- //this.border.style = this.style.border;
135
- if (this.border.left == null) this.border.left = true;
136
- if (this.border.top == null) this.border.top = true;
137
- if (this.border.right == null) this.border.right = true;
138
- if (this.border.bottom == null) this.border.bottom = true;
139
- }
140
-
141
- // if (options.mouse || options.clickable) {
142
- if (options.clickable) {
143
- this.screen._listenMouse(this);
144
- }
145
-
146
- if (options.input || options.keyable) {
147
- this.screen._listenKeys(this);
148
- }
149
-
150
- this.parseTags = options.parseTags || options.tags;
151
-
152
- this.setContent(options.content || '', true);
153
-
154
- if (options.label) {
155
- this.setLabel(options.label);
156
- }
157
-
158
- if (options.hoverText) {
159
- this.setHover(options.hoverText);
160
- }
161
-
162
- // TODO: Possibly move this to Node for onScreenEvent('mouse', ...).
163
- this.on('newListener', function fn(type) {
164
- // type = type.split(' ').slice(1).join(' ');
165
- if (type === 'mouse'
166
- || type === 'click'
167
- || type === 'mouseover'
168
- || type === 'mouseout'
169
- || type === 'mousedown'
170
- || type === 'mouseup'
171
- || type === 'mousewheel'
172
- || type === 'wheeldown'
173
- || type === 'wheelup'
174
- || type === 'mousemove') {
175
- self.screen._listenMouse(self);
176
- } else if (type === 'keypress' || type.indexOf('key ') === 0) {
177
- self.screen._listenKeys(self);
178
- }
179
- });
180
-
181
- this.on('resize', function() {
182
- self.parseContent();
183
- });
184
-
185
- this.on('attach', function() {
186
- self.parseContent();
187
- });
188
-
189
- this.on('detach', function() {
190
- delete self.lpos;
191
- });
192
-
193
- if (options.hoverBg != null) {
194
- options.hoverEffects = options.hoverEffects || {};
195
- options.hoverEffects.bg = options.hoverBg;
196
- }
197
-
198
- if (this.style.hover) {
199
- options.hoverEffects = this.style.hover;
200
- }
201
-
202
- if (this.style.focus) {
203
- options.focusEffects = this.style.focus;
204
- }
205
-
206
- if (options.effects) {
207
- if (options.effects.hover) options.hoverEffects = options.effects.hover;
208
- if (options.effects.focus) options.focusEffects = options.effects.focus;
209
- }
210
-
211
- [['hoverEffects', 'mouseover', 'mouseout', '_htemp'],
212
- ['focusEffects', 'focus', 'blur', '_ftemp']].forEach(function(props) {
213
- var pname = props[0], over = props[1], out = props[2], temp = props[3];
214
- self.screen.setEffects(self, self, over, out, self.options[pname], temp);
215
- });
216
-
217
- if (this.options.draggable) {
218
- this.draggable = true;
219
- }
220
-
221
- if (options.focused) {
222
- this.focus();
223
- }
224
- }
225
-
226
- Element.prototype.__proto__ = Node.prototype;
227
-
228
- Element.prototype.type = 'element';
229
-
230
- Element.prototype.__defineGetter__('focused', function() {
231
- return this.screen.focused === this;
232
- });
233
-
234
- Element.prototype.sattr = function(style, fg, bg) {
235
- var bold = style.bold
236
- , underline = style.underline
237
- , blink = style.blink
238
- , inverse = style.inverse
239
- , invisible = style.invisible;
240
-
241
- // if (arguments.length === 1) {
242
- if (fg == null && bg == null) {
243
- fg = style.fg;
244
- bg = style.bg;
245
- }
246
-
247
- // This used to be a loop, but I decided
248
- // to unroll it for performance's sake.
249
- if (typeof bold === 'function') bold = bold(this);
250
- if (typeof underline === 'function') underline = underline(this);
251
- if (typeof blink === 'function') blink = blink(this);
252
- if (typeof inverse === 'function') inverse = inverse(this);
253
- if (typeof invisible === 'function') invisible = invisible(this);
254
-
255
- if (typeof fg === 'function') fg = fg(this);
256
- if (typeof bg === 'function') bg = bg(this);
257
-
258
- // return (this.uid << 24)
259
- // | ((this.dockBorders ? 32 : 0) << 18)
260
- return ((invisible ? 16 : 0) << 18)
261
- | ((inverse ? 8 : 0) << 18)
262
- | ((blink ? 4 : 0) << 18)
263
- | ((underline ? 2 : 0) << 18)
264
- | ((bold ? 1 : 0) << 18)
265
- | (colors.convert(fg) << 9)
266
- | colors.convert(bg);
267
- };
268
-
269
- Element.prototype.onScreenEvent = function(type, handler) {
270
- var listeners = this._slisteners = this._slisteners || [];
271
- listeners.push({ type: type, handler: handler });
272
- this.screen.on(type, handler);
273
- };
274
-
275
- Element.prototype.onceScreenEvent = function(type, handler) {
276
- var listeners = this._slisteners = this._slisteners || [];
277
- var entry = { type: type, handler: handler };
278
- listeners.push(entry);
279
- this.screen.once(type, function() {
280
- var i = listeners.indexOf(entry);
281
- if (~i) listeners.splice(i, 1);
282
- return handler.apply(this, arguments);
283
- });
284
- };
285
-
286
- Element.prototype.removeScreenEvent = function(type, handler) {
287
- var listeners = this._slisteners = this._slisteners || [];
288
- for (var i = 0; i < listeners.length; i++) {
289
- var listener = listeners[i];
290
- if (listener.type === type && listener.handler === handler) {
291
- listeners.splice(i, 1);
292
- if (this._slisteners.length === 0) {
293
- delete this._slisteners;
294
- }
295
- break;
296
- }
297
- }
298
- this.screen.removeListener(type, handler);
299
- };
300
-
301
- Element.prototype.free = function() {
302
- var listeners = this._slisteners = this._slisteners || [];
303
- for (var i = 0; i < listeners.length; i++) {
304
- var listener = listeners[i];
305
- this.screen.removeListener(listener.type, listener.handler);
306
- }
307
- delete this._slisteners;
308
- };
309
-
310
- Element.prototype.hide = function() {
311
- if (this.hidden) return;
312
- this.clearPos();
313
- this.hidden = true;
314
- this.emit('hide');
315
- if (this.screen.focused === this) {
316
- this.screen.rewindFocus();
317
- }
318
- };
319
-
320
- Element.prototype.show = function() {
321
- if (!this.hidden) return;
322
- this.hidden = false;
323
- this.emit('show');
324
- };
325
-
326
- Element.prototype.toggle = function() {
327
- return this.hidden ? this.show() : this.hide();
328
- };
329
-
330
- Element.prototype.focus = function() {
331
- return this.screen.focused = this;
332
- };
333
-
334
- Element.prototype.setContent = function(content, noClear, noTags) {
335
- if (!noClear) this.clearPos();
336
- this.content = content || '';
337
- this.parseContent(noTags);
338
- this.emit('set content');
339
- };
340
-
341
- Element.prototype.getContent = function() {
342
- if (!this._clines) return '';
343
- return this._clines.fake.join('\n');
344
- };
345
-
346
- Element.prototype.setText = function(content, noClear) {
347
- content = content || '';
348
- content = content.replace(/\x1b\[[\d;]*m/g, '');
349
- return this.setContent(content, noClear, true);
350
- };
351
-
352
- Element.prototype.getText = function() {
353
- return this.getContent().replace(/\x1b\[[\d;]*m/g, '');
354
- };
355
-
356
- Element.prototype.parseContent = function(noTags) {
357
- if (this.detached) return false;
358
-
359
- var width = this.width - this.iwidth;
360
- if (this._clines == null
361
- || this._clines.width !== width
362
- || this._clines.content !== this.content) {
363
- var content = this.content;
364
-
365
- content = content
366
- .replace(/[\x00-\x08\x0b-\x0c\x0e-\x1a\x1c-\x1f\x7f]/g, '')
367
- .replace(/\x1b(?!\[[\d;]*m)/g, '')
368
- .replace(/\r\n|\r/g, '\n')
369
- .replace(/\t/g, this.screen.tabc);
370
-
371
- if (this.screen.fullUnicode) {
372
- // double-width chars will eat the next char after render. create a
373
- // blank character after it so it doesn't eat the real next char.
374
- content = content.replace(unicode.chars.all, '$1\x03');
375
- // iTerm2 cannot render combining characters properly.
376
- if (this.screen.program.isiTerm2) {
377
- content = content.replace(unicode.chars.combining, '');
378
- }
379
- } else {
380
- // no double-width: replace them with question-marks.
381
- content = content.replace(unicode.chars.all, '??');
382
- // delete combining characters since they're 0-width anyway.
383
- // NOTE: We could drop this, the non-surrogates would get changed to ? by
384
- // the unicode filter, and surrogates changed to ? by the surrogate
385
- // regex. however, the user might expect them to be 0-width.
386
- // NOTE: Might be better for performance to drop!
387
- content = content.replace(unicode.chars.combining, '');
388
- // no surrogate pairs: replace them with question-marks.
389
- content = content.replace(unicode.chars.surrogate, '?');
390
- // XXX Deduplicate code here:
391
- // content = helpers.dropUnicode(content);
392
- }
393
-
394
- if (!noTags) {
395
- content = this._parseTags(content);
396
- }
397
-
398
- this._clines = this._wrapContent(content, width);
399
- this._clines.width = width;
400
- this._clines.content = this.content;
401
- this._clines.attr = this._parseAttr(this._clines);
402
- this._clines.ci = [];
403
- this._clines.reduce(function(total, line) {
404
- this._clines.ci.push(total);
405
- return total + line.length + 1;
406
- }.bind(this), 0);
407
-
408
- this._pcontent = this._clines.join('\n');
409
- this.emit('parsed content');
410
-
411
- return true;
412
- }
413
-
414
- // Need to calculate this every time because the default fg/bg may change.
415
- this._clines.attr = this._parseAttr(this._clines) || this._clines.attr;
416
-
417
- return false;
418
- };
419
-
420
- // Convert `{red-fg}foo{/red-fg}` to `\x1b[31mfoo\x1b[39m`.
421
- Element.prototype._parseTags = function(text) {
422
- if (!this.parseTags) return text;
423
- if (!/{\/?[\w\-,;!#]*}/.test(text)) return text;
424
-
425
- var program = this.screen.program
426
- , out = ''
427
- , state
428
- , bg = []
429
- , fg = []
430
- , flag = []
431
- , cap
432
- , slash
433
- , param
434
- , attr
435
- , esc;
436
-
437
- for (;;) {
438
- if (!esc && (cap = /^{escape}/.exec(text))) {
439
- text = text.substring(cap[0].length);
440
- esc = true;
441
- continue;
442
- }
443
-
444
- if (esc && (cap = /^([\s\S]+?){\/escape}/.exec(text))) {
445
- text = text.substring(cap[0].length);
446
- out += cap[1];
447
- esc = false;
448
- continue;
449
- }
450
-
451
- if (esc) {
452
- // throw new Error('Unterminated escape tag.');
453
- out += text;
454
- break;
455
- }
456
-
457
- if (cap = /^{(\/?)([\w\-,;!#]*)}/.exec(text)) {
458
- text = text.substring(cap[0].length);
459
- slash = cap[1] === '/';
460
- param = cap[2].replace(/-/g, ' ');
461
-
462
- if (param === 'open') {
463
- out += '{';
464
- continue;
465
- } else if (param === 'close') {
466
- out += '}';
467
- continue;
468
- }
469
-
470
- if (param.slice(-3) === ' bg') state = bg;
471
- else if (param.slice(-3) === ' fg') state = fg;
472
- else state = flag;
473
-
474
- if (slash) {
475
- if (!param) {
476
- out += program._attr('normal');
477
- bg.length = 0;
478
- fg.length = 0;
479
- flag.length = 0;
480
- } else {
481
- attr = program._attr(param, false);
482
- if (attr == null) {
483
- out += cap[0];
484
- } else {
485
- // if (param !== state[state.length - 1]) {
486
- // throw new Error('Misnested tags.');
487
- // }
488
- state.pop();
489
- if (state.length) {
490
- out += program._attr(state[state.length - 1]);
491
- } else {
492
- out += attr;
493
- }
494
- }
495
- }
496
- } else {
497
- if (!param) {
498
- out += cap[0];
499
- } else {
500
- attr = program._attr(param);
501
- if (attr == null) {
502
- out += cap[0];
503
- } else {
504
- state.push(param);
505
- out += attr;
506
- }
507
- }
508
- }
509
-
510
- continue;
511
- }
512
-
513
- if (cap = /^[\s\S]+?(?={\/?[\w\-,;!#]*})/.exec(text)) {
514
- text = text.substring(cap[0].length);
515
- out += cap[0];
516
- continue;
517
- }
518
-
519
- out += text;
520
- break;
521
- }
522
-
523
- return out;
524
- };
525
-
526
- Element.prototype._parseAttr = function(lines) {
527
- var dattr = this.sattr(this.style)
528
- , attr = dattr
529
- , attrs = []
530
- , line
531
- , i
532
- , j
533
- , c;
534
-
535
- if (lines[0].attr === attr) {
536
- return;
537
- }
538
-
539
- for (j = 0; j < lines.length; j++) {
540
- line = lines[j];
541
- attrs[j] = attr;
542
- for (i = 0; i < line.length; i++) {
543
- if (line[i] === '\x1b') {
544
- if (c = /^\x1b\[[\d;]*m/.exec(line.substring(i))) {
545
- attr = this.screen.attrCode(c[0], attr, dattr);
546
- i += c[0].length - 1;
547
- }
548
- }
549
- }
550
- }
551
-
552
- return attrs;
553
- };
554
-
555
- Element.prototype._align = function(line, width, align) {
556
- if (!align) return line;
557
- //if (!align && !~line.indexOf('{|}')) return line;
558
-
559
- var cline = line.replace(/\x1b\[[\d;]*m/g, '')
560
- , len = cline.length
561
- , s = width - len;
562
-
563
- if (this.shrink) {
564
- s = 0;
565
- }
566
-
567
- if (len === 0) return line;
568
- if (s < 0) return line;
569
-
570
- if (align === 'center') {
571
- s = Array(((s / 2) | 0) + 1).join(' ');
572
- return s + line + s;
573
- } else if (align === 'right') {
574
- s = Array(s + 1).join(' ');
575
- return s + line;
576
- } else if (this.parseTags && ~line.indexOf('{|}')) {
577
- var parts = line.split('{|}');
578
- var cparts = cline.split('{|}');
579
- s = Math.max(width - cparts[0].length - cparts[1].length, 0);
580
- s = Array(s + 1).join(' ');
581
- return parts[0] + s + parts[1];
582
- }
583
-
584
- return line;
585
- };
586
-
587
- Element.prototype._wrapContent = function(content, width) {
588
- var tags = this.parseTags
589
- , state = this.align
590
- , wrap = this.wrap
591
- , margin = 0
592
- , rtof = []
593
- , ftor = []
594
- , out = []
595
- , no = 0
596
- , line
597
- , align
598
- , cap
599
- , total
600
- , i
601
- , part
602
- , j
603
- , lines
604
- , rest;
605
-
606
- lines = content.split('\n');
607
-
608
- if (!content) {
609
- out.push(content);
610
- out.rtof = [0];
611
- out.ftor = [[0]];
612
- out.fake = lines;
613
- out.real = out;
614
- out.mwidth = 0;
615
- return out;
616
- }
617
-
618
- if (this.scrollbar) margin++;
619
- if (this.type === 'textarea') margin++;
620
- if (width > margin) width -= margin;
621
-
622
- main:
623
- for (; no < lines.length; no++) {
624
- line = lines[no];
625
- align = state;
626
-
627
- ftor.push([]);
628
-
629
- // Handle alignment tags.
630
- if (tags) {
631
- if (cap = /^{(left|center|right)}/.exec(line)) {
632
- line = line.substring(cap[0].length);
633
- align = state = cap[1] !== 'left'
634
- ? cap[1]
635
- : null;
636
- }
637
- if (cap = /{\/(left|center|right)}$/.exec(line)) {
638
- line = line.slice(0, -cap[0].length);
639
- //state = null;
640
- state = this.align;
641
- }
642
- }
643
-
644
- // If the string is apparently too long, wrap it.
645
- while (line.length > width) {
646
- // Measure the real width of the string.
647
- for (i = 0, total = 0; i < line.length; i++) {
648
- while (line[i] === '\x1b') {
649
- while (line[i] && line[i++] !== 'm');
650
- }
651
- if (!line[i]) break;
652
- if (++total === width) {
653
- // If we're not wrapping the text, we have to finish up the rest of
654
- // the control sequences before cutting off the line.
655
- i++;
656
- if (!wrap) {
657
- rest = line.substring(i).match(/\x1b\[[^m]*m/g);
658
- rest = rest ? rest.join('') : '';
659
- out.push(this._align(line.substring(0, i) + rest, width, align));
660
- ftor[no].push(out.length - 1);
661
- rtof.push(no);
662
- continue main;
663
- }
664
- if (!this.screen.fullUnicode) {
665
- // Try to find a space to break on.
666
- if (i !== line.length) {
667
- j = i;
668
- while (j > i - 10 && j > 0 && line[--j] !== ' ');
669
- if (line[j] === ' ') i = j + 1;
670
- }
671
- } else {
672
- // Try to find a character to break on.
673
- if (i !== line.length) {
674
- // <XXX>
675
- // Compensate for surrogate length
676
- // counts on wrapping (experimental):
677
- // NOTE: Could optimize this by putting
678
- // it in the parent for loop.
679
- if (unicode.isSurrogate(line, i)) i--;
680
- for (var s = 0, n = 0; n < i; n++) {
681
- if (unicode.isSurrogate(line, n)) s++, n++;
682
- }
683
- i += s;
684
- // </XXX>
685
- j = i;
686
- // Break _past_ space.
687
- // Break _past_ double-width chars.
688
- // Break _past_ surrogate pairs.
689
- // Break _past_ combining chars.
690
- while (j > i - 10 && j > 0) {
691
- j--;
692
- if (line[j] === ' '
693
- || line[j] === '\x03'
694
- || (unicode.isSurrogate(line, j - 1) && line[j + 1] !== '\x03')
695
- || unicode.isCombining(line, j)) {
696
- break;
697
- }
698
- }
699
- if (line[j] === ' '
700
- || line[j] === '\x03'
701
- || (unicode.isSurrogate(line, j - 1) && line[j + 1] !== '\x03')
702
- || unicode.isCombining(line, j)) {
703
- i = j + 1;
704
- }
705
- }
706
- }
707
- break;
708
- }
709
- }
710
-
711
- part = line.substring(0, i);
712
- line = line.substring(i);
713
-
714
- out.push(this._align(part, width, align));
715
- ftor[no].push(out.length - 1);
716
- rtof.push(no);
717
-
718
- // Make sure we didn't wrap the line to the very end, otherwise
719
- // we get a pointless empty line after a newline.
720
- if (line === '') continue main;
721
-
722
- // If only an escape code got cut off, at it to `part`.
723
- if (/^(?:\x1b[\[\d;]*m)+$/.test(line)) {
724
- out[out.length - 1] += line;
725
- continue main;
726
- }
727
- }
728
-
729
- out.push(this._align(line, width, align));
730
- ftor[no].push(out.length - 1);
731
- rtof.push(no);
732
- }
733
-
734
- out.rtof = rtof;
735
- out.ftor = ftor;
736
- out.fake = lines;
737
- out.real = out;
738
-
739
- out.mwidth = out.reduce(function(current, line) {
740
- line = line.replace(/\x1b\[[\d;]*m/g, '');
741
- return line.length > current
742
- ? line.length
743
- : current;
744
- }, 0);
745
-
746
- return out;
747
- };
748
-
749
- Element.prototype.__defineGetter__('visible', function() {
750
- var el = this;
751
- do {
752
- if (el.detached) return false;
753
- if (el.hidden) return false;
754
- // if (!el.lpos) return false;
755
- // if (el.position.width === 0 || el.position.height === 0) return false;
756
- } while (el = el.parent);
757
- return true;
758
- });
759
-
760
- Element.prototype.__defineGetter__('_detached', function() {
761
- var el = this;
762
- do {
763
- if (el.type === 'screen') return false;
764
- if (!el.parent) return true;
765
- } while (el = el.parent);
766
- return false;
767
- });
768
-
769
- Element.prototype.enableMouse = function() {
770
- this.screen._listenMouse(this);
771
- };
772
-
773
- Element.prototype.enableKeys = function() {
774
- this.screen._listenKeys(this);
775
- };
776
-
777
- Element.prototype.enableInput = function() {
778
- this.screen._listenMouse(this);
779
- this.screen._listenKeys(this);
780
- };
781
-
782
- Element.prototype.__defineGetter__('draggable', function() {
783
- return this._draggable === true;
784
- });
785
-
786
- Element.prototype.__defineSetter__('draggable', function(draggable) {
787
- return draggable ? this.enableDrag(draggable) : this.disableDrag();
788
- });
789
-
790
- Element.prototype.enableDrag = function(verify) {
791
- var self = this;
792
-
793
- if (this._draggable) return true;
794
-
795
- if (typeof verify !== 'function') {
796
- verify = function() { return true; };
797
- }
798
-
799
- this.enableMouse();
800
-
801
- this.on('mousedown', this._dragMD = function(data) {
802
- if (self.screen._dragging) return;
803
- if (!verify(data)) return;
804
- self.screen._dragging = self;
805
- self._drag = {
806
- x: data.x - self.aleft,
807
- y: data.y - self.atop
808
- };
809
- self.setFront();
810
- });
811
-
812
- this.onScreenEvent('mouse', this._dragM = function(data) {
813
- if (self.screen._dragging !== self) return;
814
-
815
- if (data.action !== 'mousedown' && data.action !== 'mousemove') {
816
- delete self.screen._dragging;
817
- delete self._drag;
818
- return;
819
- }
820
-
821
- // This can happen in edge cases where the user is
822
- // already dragging and element when it is detached.
823
- if (!self.parent) return;
824
-
825
- var ox = self._drag.x
826
- , oy = self._drag.y
827
- , px = self.parent.aleft
828
- , py = self.parent.atop
829
- , x = data.x - px - ox
830
- , y = data.y - py - oy;
831
-
832
- if (self.position.right != null) {
833
- if (self.position.left != null) {
834
- self.width = '100%-' + (self.parent.width - self.width);
835
- }
836
- self.position.right = null;
837
- }
838
-
839
- if (self.position.bottom != null) {
840
- if (self.position.top != null) {
841
- self.height = '100%-' + (self.parent.height - self.height);
842
- }
843
- self.position.bottom = null;
844
- }
845
-
846
- self.rleft = x;
847
- self.rtop = y;
848
-
849
- self.screen.render();
850
- });
851
-
852
- return this._draggable = true;
853
- };
854
-
855
- Element.prototype.disableDrag = function() {
856
- if (!this._draggable) return false;
857
- delete this.screen._dragging;
858
- delete this._drag;
859
- this.removeListener('mousedown', this._dragMD);
860
- this.removeScreenEvent('mouse', this._dragM);
861
- return this._draggable = false;
862
- };
863
-
864
- Element.prototype.key = function() {
865
- return this.screen.program.key.apply(this, arguments);
866
- };
867
-
868
- Element.prototype.onceKey = function() {
869
- return this.screen.program.onceKey.apply(this, arguments);
870
- };
871
-
872
- Element.prototype.unkey =
873
- Element.prototype.removeKey = function() {
874
- return this.screen.program.unkey.apply(this, arguments);
875
- };
876
-
877
- Element.prototype.setIndex = function(index) {
878
- if (!this.parent) return;
879
-
880
- if (index < 0) {
881
- index = this.parent.children.length + index;
882
- }
883
-
884
- index = Math.max(index, 0);
885
- index = Math.min(index, this.parent.children.length - 1);
886
-
887
- var i = this.parent.children.indexOf(this);
888
- if (!~i) return;
889
-
890
- var item = this.parent.children.splice(i, 1)[0];
891
- this.parent.children.splice(index, 0, item);
892
- };
893
-
894
- Element.prototype.setFront = function() {
895
- return this.setIndex(-1);
896
- };
897
-
898
- Element.prototype.setBack = function() {
899
- return this.setIndex(0);
900
- };
901
-
902
- Element.prototype.clearPos = function(get, override) {
903
- if (this.detached) return;
904
- var lpos = this._getCoords(get);
905
- if (!lpos) return;
906
- this.screen.clearRegion(
907
- lpos.xi, lpos.xl,
908
- lpos.yi, lpos.yl,
909
- override);
910
- };
911
-
912
- Element.prototype.setLabel = function(options) {
913
- var self = this;
914
- var Box = require('./box');
915
-
916
- if (typeof options === 'string') {
917
- options = { text: options };
918
- }
919
-
920
- if (this._label) {
921
- this._label.setContent(options.text);
922
- if (options.side !== 'right') {
923
- this._label.rleft = 2 + (this.border ? -1 : 0);
924
- this._label.position.right = undefined;
925
- if (!this.screen.autoPadding) {
926
- this._label.rleft = 2;
927
- }
928
- } else {
929
- this._label.rright = 2 + (this.border ? -1 : 0);
930
- this._label.position.left = undefined;
931
- if (!this.screen.autoPadding) {
932
- this._label.rright = 2;
933
- }
934
- }
935
- return;
936
- }
937
-
938
- this._label = new Box({
939
- screen: this.screen,
940
- parent: this,
941
- content: options.text,
942
- top: -this.itop,
943
- tags: this.parseTags,
944
- shrink: true,
945
- style: this.style.label
946
- });
947
-
948
- if (options.side !== 'right') {
949
- this._label.rleft = 2 - this.ileft;
950
- } else {
951
- this._label.rright = 2 - this.iright;
952
- }
953
-
954
- this._label._isLabel = true;
955
-
956
- if (!this.screen.autoPadding) {
957
- if (options.side !== 'right') {
958
- this._label.rleft = 2;
959
- } else {
960
- this._label.rright = 2;
961
- }
962
- this._label.rtop = 0;
963
- }
964
-
965
- var reposition = function() {
966
- self._label.rtop = (self.childBase || 0) - self.itop;
967
- if (!self.screen.autoPadding) {
968
- self._label.rtop = (self.childBase || 0);
969
- }
970
- self.screen.render();
971
- };
972
-
973
- this.on('scroll', this._labelScroll = function() {
974
- reposition();
975
- });
976
-
977
- this.on('resize', this._labelResize = function() {
978
- nextTick(function() {
979
- reposition();
980
- });
981
- });
982
- };
983
-
984
- Element.prototype.removeLabel = function() {
985
- if (!this._label) return;
986
- this.removeListener('scroll', this._labelScroll);
987
- this.removeListener('resize', this._labelResize);
988
- this._label.detach();
989
- delete this._labelScroll;
990
- delete this._labelResize;
991
- delete this._label;
992
- };
993
-
994
- Element.prototype.setHover = function(options) {
995
- if (typeof options === 'string') {
996
- options = { text: options };
997
- }
998
-
999
- this._hoverOptions = options;
1000
- this.enableMouse();
1001
- this.screen._initHover();
1002
- };
1003
-
1004
- Element.prototype.removeHover = function() {
1005
- delete this._hoverOptions;
1006
- if (!this.screen._hoverText || this.screen._hoverText.detached) return;
1007
- this.screen._hoverText.detach();
1008
- this.screen.render();
1009
- };
1010
-
1011
- /**
1012
- * Positioning
1013
- */
1014
-
1015
- // The below methods are a bit confusing: basically
1016
- // whenever Box.render is called `lpos` gets set on
1017
- // the element, an object containing the rendered
1018
- // coordinates. Since these don't update if the
1019
- // element is moved somehow, they're unreliable in
1020
- // that situation. However, if we can guarantee that
1021
- // lpos is good and up to date, it can be more
1022
- // accurate than the calculated positions below.
1023
- // In this case, if the element is being rendered,
1024
- // it's guaranteed that the parent will have been
1025
- // rendered first, in which case we can use the
1026
- // parant's lpos instead of recalculating it's
1027
- // position (since that might be wrong because
1028
- // it doesn't handle content shrinkage).
1029
-
1030
- Element.prototype._getPos = function() {
1031
- var pos = this.lpos;
1032
-
1033
- assert.ok(pos);
1034
-
1035
- if (pos.aleft != null) return pos;
1036
-
1037
- pos.aleft = pos.xi;
1038
- pos.atop = pos.yi;
1039
- pos.aright = this.screen.cols - pos.xl;
1040
- pos.abottom = this.screen.rows - pos.yl;
1041
- pos.width = pos.xl - pos.xi;
1042
- pos.height = pos.yl - pos.yi;
1043
-
1044
- return pos;
1045
- };
1046
-
1047
- /**
1048
- * Position Getters
1049
- */
1050
-
1051
- Element.prototype._getWidth = function(get) {
1052
- var parent = get ? this.parent._getPos() : this.parent
1053
- , width = this.position.width
1054
- , left
1055
- , expr;
1056
-
1057
- if (typeof width === 'string') {
1058
- if (width === 'half') width = '50%';
1059
- expr = width.split(/(?=\+|-)/);
1060
- width = expr[0];
1061
- width = +width.slice(0, -1) / 100;
1062
- width = parent.width * width | 0;
1063
- width += +(expr[1] || 0);
1064
- return width;
1065
- }
1066
-
1067
- // This is for if the element is being streched or shrunken.
1068
- // Although the width for shrunken elements is calculated
1069
- // in the render function, it may be calculated based on
1070
- // the content width, and the content width is initially
1071
- // decided by the width the element, so it needs to be
1072
- // calculated here.
1073
- if (width == null) {
1074
- left = this.position.left || 0;
1075
- if (typeof left === 'string') {
1076
- if (left === 'center') left = '50%';
1077
- expr = left.split(/(?=\+|-)/);
1078
- left = expr[0];
1079
- left = +left.slice(0, -1) / 100;
1080
- left = parent.width * left | 0;
1081
- left += +(expr[1] || 0);
1082
- }
1083
- width = parent.width - (this.position.right || 0) - left;
1084
- if (this.screen.autoPadding) {
1085
- if ((this.position.left != null || this.position.right == null)
1086
- && this.position.left !== 'center') {
1087
- width -= this.parent.ileft;
1088
- }
1089
- width -= this.parent.iright;
1090
- }
1091
- }
1092
-
1093
- return width;
1094
- };
1095
-
1096
- Element.prototype.__defineGetter__('width', function() {
1097
- return this._getWidth(false);
1098
- });
1099
-
1100
- Element.prototype._getHeight = function(get) {
1101
- var parent = get ? this.parent._getPos() : this.parent
1102
- , height = this.position.height
1103
- , top
1104
- , expr;
1105
-
1106
- if (typeof height === 'string') {
1107
- if (height === 'half') height = '50%';
1108
- expr = height.split(/(?=\+|-)/);
1109
- height = expr[0];
1110
- height = +height.slice(0, -1) / 100;
1111
- height = parent.height * height | 0;
1112
- height += +(expr[1] || 0);
1113
- return height;
1114
- }
1115
-
1116
- // This is for if the element is being streched or shrunken.
1117
- // Although the width for shrunken elements is calculated
1118
- // in the render function, it may be calculated based on
1119
- // the content width, and the content width is initially
1120
- // decided by the width the element, so it needs to be
1121
- // calculated here.
1122
- if (height == null) {
1123
- top = this.position.top || 0;
1124
- if (typeof top === 'string') {
1125
- if (top === 'center') top = '50%';
1126
- expr = top.split(/(?=\+|-)/);
1127
- top = expr[0];
1128
- top = +top.slice(0, -1) / 100;
1129
- top = parent.height * top | 0;
1130
- top += +(expr[1] || 0);
1131
- }
1132
- height = parent.height - (this.position.bottom || 0) - top;
1133
- if (this.screen.autoPadding) {
1134
- if ((this.position.top != null
1135
- || this.position.bottom == null)
1136
- && this.position.top !== 'center') {
1137
- height -= this.parent.itop;
1138
- }
1139
- height -= this.parent.ibottom;
1140
- }
1141
- }
1142
-
1143
- return height;
1144
- };
1145
-
1146
- Element.prototype.__defineGetter__('height', function() {
1147
- return this._getHeight(false);
1148
- });
1149
-
1150
- Element.prototype._getLeft = function(get) {
1151
- var parent = get ? this.parent._getPos() : this.parent
1152
- , left = this.position.left || 0
1153
- , expr;
1154
-
1155
- if (typeof left === 'string') {
1156
- if (left === 'center') left = '50%';
1157
- expr = left.split(/(?=\+|-)/);
1158
- left = expr[0];
1159
- left = +left.slice(0, -1) / 100;
1160
- left = parent.width * left | 0;
1161
- left += +(expr[1] || 0);
1162
- if (this.position.left === 'center') {
1163
- left -= this._getWidth(get) / 2 | 0;
1164
- }
1165
- }
1166
-
1167
- if (this.position.left == null && this.position.right != null) {
1168
- return this.screen.cols - this._getWidth(get) - this._getRight(get);
1169
- }
1170
-
1171
- if (this.screen.autoPadding) {
1172
- if ((this.position.left != null
1173
- || this.position.right == null)
1174
- && this.position.left !== 'center') {
1175
- left += this.parent.ileft;
1176
- }
1177
- }
1178
-
1179
- return (parent.aleft || 0) + left;
1180
- };
1181
-
1182
- Element.prototype.__defineGetter__('aleft', function() {
1183
- return this._getLeft(false);
1184
- });
1185
-
1186
- Element.prototype._getRight = function(get) {
1187
- var parent = get ? this.parent._getPos() : this.parent
1188
- , right;
1189
-
1190
- if (this.position.right == null && this.position.left != null) {
1191
- right = this.screen.cols - (this._getLeft(get) + this._getWidth(get));
1192
- if (this.screen.autoPadding) {
1193
- right += this.parent.iright;
1194
- }
1195
- return right;
1196
- }
1197
-
1198
- right = (parent.aright || 0) + (this.position.right || 0);
1199
-
1200
- if (this.screen.autoPadding) {
1201
- right += this.parent.iright;
1202
- }
1203
-
1204
- return right;
1205
- };
1206
-
1207
- Element.prototype.__defineGetter__('aright', function() {
1208
- return this._getRight(false);
1209
- });
1210
-
1211
- Element.prototype._getTop = function(get) {
1212
- var parent = get ? this.parent._getPos() : this.parent
1213
- , top = this.position.top || 0
1214
- , expr;
1215
-
1216
- if (typeof top === 'string') {
1217
- if (top === 'center') top = '50%';
1218
- expr = top.split(/(?=\+|-)/);
1219
- top = expr[0];
1220
- top = +top.slice(0, -1) / 100;
1221
- top = parent.height * top | 0;
1222
- top += +(expr[1] || 0);
1223
- if (this.position.top === 'center') {
1224
- top -= this._getHeight(get) / 2 | 0;
1225
- }
1226
- }
1227
-
1228
- if (this.position.top == null && this.position.bottom != null) {
1229
- return this.screen.rows - this._getHeight(get) - this._getBottom(get);
1230
- }
1231
-
1232
- if (this.screen.autoPadding) {
1233
- if ((this.position.top != null
1234
- || this.position.bottom == null)
1235
- && this.position.top !== 'center') {
1236
- top += this.parent.itop;
1237
- }
1238
- }
1239
-
1240
- return (parent.atop || 0) + top;
1241
- };
1242
-
1243
- Element.prototype.__defineGetter__('atop', function() {
1244
- return this._getTop(false);
1245
- });
1246
-
1247
- Element.prototype._getBottom = function(get) {
1248
- var parent = get ? this.parent._getPos() : this.parent
1249
- , bottom;
1250
-
1251
- if (this.position.bottom == null && this.position.top != null) {
1252
- bottom = this.screen.rows - (this._getTop(get) + this._getHeight(get));
1253
- if (this.screen.autoPadding) {
1254
- bottom += this.parent.ibottom;
1255
- }
1256
- return bottom;
1257
- }
1258
-
1259
- bottom = (parent.abottom || 0) + (this.position.bottom || 0);
1260
-
1261
- if (this.screen.autoPadding) {
1262
- bottom += this.parent.ibottom;
1263
- }
1264
-
1265
- return bottom;
1266
- };
1267
-
1268
- Element.prototype.__defineGetter__('abottom', function() {
1269
- return this._getBottom(false);
1270
- });
1271
-
1272
- Element.prototype.__defineGetter__('rleft', function() {
1273
- return this.aleft - this.parent.aleft;
1274
- });
1275
-
1276
- Element.prototype.__defineGetter__('rright', function() {
1277
- return this.aright - this.parent.aright;
1278
- });
1279
-
1280
- Element.prototype.__defineGetter__('rtop', function() {
1281
- return this.atop - this.parent.atop;
1282
- });
1283
-
1284
- Element.prototype.__defineGetter__('rbottom', function() {
1285
- return this.abottom - this.parent.abottom;
1286
- });
1287
-
1288
- /**
1289
- * Position Setters
1290
- */
1291
-
1292
- // NOTE:
1293
- // For aright, abottom, right, and bottom:
1294
- // If position.bottom is null, we could simply set top instead.
1295
- // But it wouldn't replicate bottom behavior appropriately if
1296
- // the parent was resized, etc.
1297
- Element.prototype.__defineSetter__('width', function(val) {
1298
- if (this.position.width === val) return;
1299
- if (/^\d+$/.test(val)) val = +val;
1300
- this.emit('resize');
1301
- this.clearPos();
1302
- return this.position.width = val;
1303
- });
1304
-
1305
- Element.prototype.__defineSetter__('height', function(val) {
1306
- if (this.position.height === val) return;
1307
- if (/^\d+$/.test(val)) val = +val;
1308
- this.emit('resize');
1309
- this.clearPos();
1310
- return this.position.height = val;
1311
- });
1312
-
1313
- Element.prototype.__defineSetter__('aleft', function(val) {
1314
- var expr;
1315
- if (typeof val === 'string') {
1316
- if (val === 'center') {
1317
- val = this.screen.width / 2 | 0;
1318
- val -= this.width / 2 | 0;
1319
- } else {
1320
- expr = val.split(/(?=\+|-)/);
1321
- val = expr[0];
1322
- val = +val.slice(0, -1) / 100;
1323
- val = this.screen.width * val | 0;
1324
- val += +(expr[1] || 0);
1325
- }
1326
- }
1327
- val -= this.parent.aleft;
1328
- if (this.position.left === val) return;
1329
- this.emit('move');
1330
- this.clearPos();
1331
- return this.position.left = val;
1332
- });
1333
-
1334
- Element.prototype.__defineSetter__('aright', function(val) {
1335
- val -= this.parent.aright;
1336
- if (this.position.right === val) return;
1337
- this.emit('move');
1338
- this.clearPos();
1339
- return this.position.right = val;
1340
- });
1341
-
1342
- Element.prototype.__defineSetter__('atop', function(val) {
1343
- var expr;
1344
- if (typeof val === 'string') {
1345
- if (val === 'center') {
1346
- val = this.screen.height / 2 | 0;
1347
- val -= this.height / 2 | 0;
1348
- } else {
1349
- expr = val.split(/(?=\+|-)/);
1350
- val = expr[0];
1351
- val = +val.slice(0, -1) / 100;
1352
- val = this.screen.height * val | 0;
1353
- val += +(expr[1] || 0);
1354
- }
1355
- }
1356
- val -= this.parent.atop;
1357
- if (this.position.top === val) return;
1358
- this.emit('move');
1359
- this.clearPos();
1360
- return this.position.top = val;
1361
- });
1362
-
1363
- Element.prototype.__defineSetter__('abottom', function(val) {
1364
- val -= this.parent.abottom;
1365
- if (this.position.bottom === val) return;
1366
- this.emit('move');
1367
- this.clearPos();
1368
- return this.position.bottom = val;
1369
- });
1370
-
1371
- Element.prototype.__defineSetter__('rleft', function(val) {
1372
- if (this.position.left === val) return;
1373
- if (/^\d+$/.test(val)) val = +val;
1374
- this.emit('move');
1375
- this.clearPos();
1376
- return this.position.left = val;
1377
- });
1378
-
1379
- Element.prototype.__defineSetter__('rright', function(val) {
1380
- if (this.position.right === val) return;
1381
- this.emit('move');
1382
- this.clearPos();
1383
- return this.position.right = val;
1384
- });
1385
-
1386
- Element.prototype.__defineSetter__('rtop', function(val) {
1387
- if (this.position.top === val) return;
1388
- if (/^\d+$/.test(val)) val = +val;
1389
- this.emit('move');
1390
- this.clearPos();
1391
- return this.position.top = val;
1392
- });
1393
-
1394
- Element.prototype.__defineSetter__('rbottom', function(val) {
1395
- if (this.position.bottom === val) return;
1396
- this.emit('move');
1397
- this.clearPos();
1398
- return this.position.bottom = val;
1399
- });
1400
-
1401
- Element.prototype.__defineGetter__('ileft', function() {
1402
- return (this.border ? 1 : 0) + this.padding.left;
1403
- // return (this.border && this.border.left ? 1 : 0) + this.padding.left;
1404
- });
1405
-
1406
- Element.prototype.__defineGetter__('itop', function() {
1407
- return (this.border ? 1 : 0) + this.padding.top;
1408
- // return (this.border && this.border.top ? 1 : 0) + this.padding.top;
1409
- });
1410
-
1411
- Element.prototype.__defineGetter__('iright', function() {
1412
- return (this.border ? 1 : 0) + this.padding.right;
1413
- // return (this.border && this.border.right ? 1 : 0) + this.padding.right;
1414
- });
1415
-
1416
- Element.prototype.__defineGetter__('ibottom', function() {
1417
- return (this.border ? 1 : 0) + this.padding.bottom;
1418
- // return (this.border && this.border.bottom ? 1 : 0) + this.padding.bottom;
1419
- });
1420
-
1421
- Element.prototype.__defineGetter__('iwidth', function() {
1422
- // return (this.border
1423
- // ? ((this.border.left ? 1 : 0) + (this.border.right ? 1 : 0)) : 0)
1424
- // + this.padding.left + this.padding.right;
1425
- return (this.border ? 2 : 0) + this.padding.left + this.padding.right;
1426
- });
1427
-
1428
- Element.prototype.__defineGetter__('iheight', function() {
1429
- // return (this.border
1430
- // ? ((this.border.top ? 1 : 0) + (this.border.bottom ? 1 : 0)) : 0)
1431
- // + this.padding.top + this.padding.bottom;
1432
- return (this.border ? 2 : 0) + this.padding.top + this.padding.bottom;
1433
- });
1434
-
1435
- Element.prototype.__defineGetter__('tpadding', function() {
1436
- return this.padding.left + this.padding.top
1437
- + this.padding.right + this.padding.bottom;
1438
- });
1439
-
1440
- /**
1441
- * Relative coordinates as default properties
1442
- */
1443
-
1444
- Element.prototype.__defineGetter__('left', function() {
1445
- return this.rleft;
1446
- });
1447
-
1448
- Element.prototype.__defineGetter__('right', function() {
1449
- return this.rright;
1450
- });
1451
-
1452
- Element.prototype.__defineGetter__('top', function() {
1453
- return this.rtop;
1454
- });
1455
-
1456
- Element.prototype.__defineGetter__('bottom', function() {
1457
- return this.rbottom;
1458
- });
1459
-
1460
- Element.prototype.__defineSetter__('left', function(val) {
1461
- return this.rleft = val;
1462
- });
1463
-
1464
- Element.prototype.__defineSetter__('right', function(val) {
1465
- return this.rright = val;
1466
- });
1467
-
1468
- Element.prototype.__defineSetter__('top', function(val) {
1469
- return this.rtop = val;
1470
- });
1471
-
1472
- Element.prototype.__defineSetter__('bottom', function(val) {
1473
- return this.rbottom = val;
1474
- });
1475
-
1476
- /**
1477
- * Rendering - here be dragons
1478
- */
1479
-
1480
- Element.prototype._getShrinkBox = function(xi, xl, yi, yl, get) {
1481
- if (!this.children.length) {
1482
- return { xi: xi, xl: xi + 1, yi: yi, yl: yi + 1 };
1483
- }
1484
-
1485
- var i, el, ret, mxi = xi, mxl = xi + 1, myi = yi, myl = yi + 1;
1486
-
1487
- // This is a chicken and egg problem. We need to determine how the children
1488
- // will render in order to determine how this element renders, but it in
1489
- // order to figure out how the children will render, they need to know
1490
- // exactly how their parent renders, so, we can give them what we have so
1491
- // far.
1492
- var _lpos;
1493
- if (get) {
1494
- _lpos = this.lpos;
1495
- this.lpos = { xi: xi, xl: xl, yi: yi, yl: yl };
1496
- //this.shrink = false;
1497
- }
1498
-
1499
- for (i = 0; i < this.children.length; i++) {
1500
- el = this.children[i];
1501
-
1502
- ret = el._getCoords(get);
1503
-
1504
- // Or just (seemed to work, but probably not good):
1505
- // ret = el.lpos || this.lpos;
1506
-
1507
- if (!ret) continue;
1508
-
1509
- // Since the parent element is shrunk, and the child elements think it's
1510
- // going to take up as much space as possible, an element anchored to the
1511
- // right or bottom will inadvertantly make the parent's shrunken size as
1512
- // large as possible. So, we can just use the height and/or width the of
1513
- // element.
1514
- // if (get) {
1515
- if (el.position.left == null && el.position.right != null) {
1516
- ret.xl = xi + (ret.xl - ret.xi);
1517
- ret.xi = xi;
1518
- if (this.screen.autoPadding) {
1519
- // Maybe just do this no matter what.
1520
- ret.xl += this.ileft;
1521
- ret.xi += this.ileft;
1522
- }
1523
- }
1524
- if (el.position.top == null && el.position.bottom != null) {
1525
- ret.yl = yi + (ret.yl - ret.yi);
1526
- ret.yi = yi;
1527
- if (this.screen.autoPadding) {
1528
- // Maybe just do this no matter what.
1529
- ret.yl += this.itop;
1530
- ret.yi += this.itop;
1531
- }
1532
- }
1533
-
1534
- if (ret.xi < mxi) mxi = ret.xi;
1535
- if (ret.xl > mxl) mxl = ret.xl;
1536
- if (ret.yi < myi) myi = ret.yi;
1537
- if (ret.yl > myl) myl = ret.yl;
1538
- }
1539
-
1540
- if (get) {
1541
- this.lpos = _lpos;
1542
- //this.shrink = true;
1543
- }
1544
-
1545
- if (this.position.width == null
1546
- && (this.position.left == null
1547
- || this.position.right == null)) {
1548
- if (this.position.left == null && this.position.right != null) {
1549
- xi = xl - (mxl - mxi);
1550
- if (!this.screen.autoPadding) {
1551
- xi -= this.padding.left + this.padding.right;
1552
- } else {
1553
- xi -= this.ileft;
1554
- }
1555
- } else {
1556
- xl = mxl;
1557
- if (!this.screen.autoPadding) {
1558
- xl += this.padding.left + this.padding.right;
1559
- // XXX Temporary workaround until we decide to make autoPadding default.
1560
- // See widget-listtable.js for an example of why this is necessary.
1561
- // XXX Maybe just to this for all this being that this would affect
1562
- // width shrunken normal shrunken lists as well.
1563
- // if (this._isList) {
1564
- if (this.type === 'list-table') {
1565
- xl -= this.padding.left + this.padding.right;
1566
- xl += this.iright;
1567
- }
1568
- } else {
1569
- //xl += this.padding.right;
1570
- xl += this.iright;
1571
- }
1572
- }
1573
- }
1574
-
1575
- if (this.position.height == null
1576
- && (this.position.top == null
1577
- || this.position.bottom == null)
1578
- && (!this.scrollable || this._isList)) {
1579
- // NOTE: Lists get special treatment if they are shrunken - assume they
1580
- // want all list items showing. This is one case we can calculate the
1581
- // height based on items/boxes.
1582
- if (this._isList) {
1583
- myi = 0 - this.itop;
1584
- myl = this.items.length + this.ibottom;
1585
- }
1586
- if (this.position.top == null && this.position.bottom != null) {
1587
- yi = yl - (myl - myi);
1588
- if (!this.screen.autoPadding) {
1589
- yi -= this.padding.top + this.padding.bottom;
1590
- } else {
1591
- yi -= this.itop;
1592
- }
1593
- } else {
1594
- yl = myl;
1595
- if (!this.screen.autoPadding) {
1596
- yl += this.padding.top + this.padding.bottom;
1597
- } else {
1598
- yl += this.ibottom;
1599
- }
1600
- }
1601
- }
1602
-
1603
- return { xi: xi, xl: xl, yi: yi, yl: yl };
1604
- };
1605
-
1606
- Element.prototype._getShrinkContent = function(xi, xl, yi, yl) {
1607
- var h = this._clines.length
1608
- , w = this._clines.mwidth || 1;
1609
-
1610
- if (this.position.width == null
1611
- && (this.position.left == null
1612
- || this.position.right == null)) {
1613
- if (this.position.left == null && this.position.right != null) {
1614
- xi = xl - w - this.iwidth;
1615
- } else {
1616
- xl = xi + w + this.iwidth;
1617
- }
1618
- }
1619
-
1620
- if (this.position.height == null
1621
- && (this.position.top == null
1622
- || this.position.bottom == null)
1623
- && (!this.scrollable || this._isList)) {
1624
- if (this.position.top == null && this.position.bottom != null) {
1625
- yi = yl - h - this.iheight;
1626
- } else {
1627
- yl = yi + h + this.iheight;
1628
- }
1629
- }
1630
-
1631
- return { xi: xi, xl: xl, yi: yi, yl: yl };
1632
- };
1633
-
1634
- Element.prototype._getShrink = function(xi, xl, yi, yl, get) {
1635
- var shrinkBox = this._getShrinkBox(xi, xl, yi, yl, get)
1636
- , shrinkContent = this._getShrinkContent(xi, xl, yi, yl, get)
1637
- , xll = xl
1638
- , yll = yl;
1639
-
1640
- // Figure out which one is bigger and use it.
1641
- if (shrinkBox.xl - shrinkBox.xi > shrinkContent.xl - shrinkContent.xi) {
1642
- xi = shrinkBox.xi;
1643
- xl = shrinkBox.xl;
1644
- } else {
1645
- xi = shrinkContent.xi;
1646
- xl = shrinkContent.xl;
1647
- }
1648
-
1649
- if (shrinkBox.yl - shrinkBox.yi > shrinkContent.yl - shrinkContent.yi) {
1650
- yi = shrinkBox.yi;
1651
- yl = shrinkBox.yl;
1652
- } else {
1653
- yi = shrinkContent.yi;
1654
- yl = shrinkContent.yl;
1655
- }
1656
-
1657
- // Recenter shrunken elements.
1658
- if (xl < xll && this.position.left === 'center') {
1659
- xll = (xll - xl) / 2 | 0;
1660
- xi += xll;
1661
- xl += xll;
1662
- }
1663
-
1664
- if (yl < yll && this.position.top === 'center') {
1665
- yll = (yll - yl) / 2 | 0;
1666
- yi += yll;
1667
- yl += yll;
1668
- }
1669
-
1670
- return { xi: xi, xl: xl, yi: yi, yl: yl };
1671
- };
1672
-
1673
- Element.prototype._getCoords = function(get, noscroll) {
1674
- if (this.hidden) return;
1675
-
1676
- // if (this.parent._rendering) {
1677
- // get = true;
1678
- // }
1679
-
1680
- var xi = this._getLeft(get)
1681
- , xl = xi + this._getWidth(get)
1682
- , yi = this._getTop(get)
1683
- , yl = yi + this._getHeight(get)
1684
- , base = this.childBase || 0
1685
- , el = this
1686
- , fixed = this.fixed
1687
- , coords
1688
- , v
1689
- , noleft
1690
- , noright
1691
- , notop
1692
- , nobot
1693
- , ppos
1694
- , b;
1695
-
1696
- // Attempt to shrink the element base on the
1697
- // size of the content and child elements.
1698
- if (this.shrink) {
1699
- coords = this._getShrink(xi, xl, yi, yl, get);
1700
- xi = coords.xi, xl = coords.xl;
1701
- yi = coords.yi, yl = coords.yl;
1702
- }
1703
-
1704
- // Find a scrollable ancestor if we have one.
1705
- while (el = el.parent) {
1706
- if (el.scrollable) {
1707
- if (fixed) {
1708
- fixed = false;
1709
- continue;
1710
- }
1711
- break;
1712
- }
1713
- }
1714
-
1715
- // Check to make sure we're visible and
1716
- // inside of the visible scroll area.
1717
- // NOTE: Lists have a property where only
1718
- // the list items are obfuscated.
1719
-
1720
- // Old way of doing things, this would not render right if a shrunken element
1721
- // with lots of boxes in it was within a scrollable element.
1722
- // See: $ node test/widget-shrink-fail.js
1723
- // var thisparent = this.parent;
1724
-
1725
- var thisparent = el;
1726
- if (el && !noscroll) {
1727
- ppos = thisparent.lpos;
1728
-
1729
- // The shrink option can cause a stack overflow
1730
- // by calling _getCoords on the child again.
1731
- // if (!get && !thisparent.shrink) {
1732
- // ppos = thisparent._getCoords();
1733
- // }
1734
-
1735
- if (!ppos) return;
1736
-
1737
- // TODO: Figure out how to fix base (and cbase to only
1738
- // take into account the *parent's* padding.
1739
-
1740
- yi -= ppos.base;
1741
- yl -= ppos.base;
1742
-
1743
- b = thisparent.border ? 1 : 0;
1744
-
1745
- // XXX
1746
- // Fixes non-`fixed` labels to work with scrolling (they're ON the border):
1747
- // if (this.position.left < 0
1748
- // || this.position.right < 0
1749
- // || this.position.top < 0
1750
- // || this.position.bottom < 0) {
1751
- if (this._isLabel) {
1752
- b = 0;
1753
- }
1754
-
1755
- if (yi < ppos.yi + b) {
1756
- if (yl - 1 < ppos.yi + b) {
1757
- // Is above.
1758
- return;
1759
- } else {
1760
- // Is partially covered above.
1761
- notop = true;
1762
- v = ppos.yi - yi;
1763
- if (this.border) v--;
1764
- if (thisparent.border) v++;
1765
- base += v;
1766
- yi += v;
1767
- }
1768
- } else if (yl > ppos.yl - b) {
1769
- if (yi > ppos.yl - 1 - b) {
1770
- // Is below.
1771
- return;
1772
- } else {
1773
- // Is partially covered below.
1774
- nobot = true;
1775
- v = yl - ppos.yl;
1776
- if (this.border) v--;
1777
- if (thisparent.border) v++;
1778
- yl -= v;
1779
- }
1780
- }
1781
-
1782
- // Shouldn't be necessary.
1783
- // assert.ok(yi < yl);
1784
- if (yi >= yl) return;
1785
-
1786
- // Could allow overlapping stuff in scrolling elements
1787
- // if we cleared the pending buffer before every draw.
1788
- if (xi < el.lpos.xi) {
1789
- xi = el.lpos.xi;
1790
- noleft = true;
1791
- if (this.border) xi--;
1792
- if (thisparent.border) xi++;
1793
- }
1794
- if (xl > el.lpos.xl) {
1795
- xl = el.lpos.xl;
1796
- noright = true;
1797
- if (this.border) xl++;
1798
- if (thisparent.border) xl--;
1799
- }
1800
- //if (xi > xl) return;
1801
- if (xi >= xl) return;
1802
- }
1803
-
1804
- if (this.noOverflow && this.parent.lpos) {
1805
- if (xi < this.parent.lpos.xi + this.parent.ileft) {
1806
- xi = this.parent.lpos.xi + this.parent.ileft;
1807
- }
1808
- if (xl > this.parent.lpos.xl - this.parent.iright) {
1809
- xl = this.parent.lpos.xl - this.parent.iright;
1810
- }
1811
- if (yi < this.parent.lpos.yi + this.parent.itop) {
1812
- yi = this.parent.lpos.yi + this.parent.itop;
1813
- }
1814
- if (yl > this.parent.lpos.yl - this.parent.ibottom) {
1815
- yl = this.parent.lpos.yl - this.parent.ibottom;
1816
- }
1817
- }
1818
-
1819
- // if (this.parent.lpos) {
1820
- // this.parent.lpos._scrollBottom = Math.max(
1821
- // this.parent.lpos._scrollBottom, yl);
1822
- // }
1823
-
1824
- return {
1825
- xi: xi,
1826
- xl: xl,
1827
- yi: yi,
1828
- yl: yl,
1829
- base: base,
1830
- noleft: noleft,
1831
- noright: noright,
1832
- notop: notop,
1833
- nobot: nobot,
1834
- renders: this.screen.renders
1835
- };
1836
- };
1837
-
1838
- Element.prototype.render = function() {
1839
- this._emit('prerender');
1840
-
1841
- this.parseContent();
1842
-
1843
- var coords = this._getCoords(true);
1844
- if (!coords) {
1845
- delete this.lpos;
1846
- return;
1847
- }
1848
-
1849
- if (coords.xl - coords.xi <= 0) {
1850
- coords.xl = Math.max(coords.xl, coords.xi);
1851
- return;
1852
- }
1853
-
1854
- if (coords.yl - coords.yi <= 0) {
1855
- coords.yl = Math.max(coords.yl, coords.yi);
1856
- return;
1857
- }
1858
-
1859
- var lines = this.screen.lines
1860
- , xi = coords.xi
1861
- , xl = coords.xl
1862
- , yi = coords.yi
1863
- , yl = coords.yl
1864
- , x
1865
- , y
1866
- , cell
1867
- , attr
1868
- , ch
1869
- , content = this._pcontent
1870
- , ci = this._clines.ci[coords.base]
1871
- , battr
1872
- , dattr
1873
- , c
1874
- , visible
1875
- , i
1876
- , bch = this.ch;
1877
-
1878
- // Clip content if it's off the edge of the screen
1879
- // if (xi + this.ileft < 0 || yi + this.itop < 0) {
1880
- // var clines = this._clines.slice();
1881
- // if (xi + this.ileft < 0) {
1882
- // for (var i = 0; i < clines.length; i++) {
1883
- // var t = 0;
1884
- // var csi = '';
1885
- // var csis = '';
1886
- // for (var j = 0; j < clines[i].length; j++) {
1887
- // while (clines[i][j] === '\x1b') {
1888
- // csi = '\x1b';
1889
- // while (clines[i][j++] !== 'm') csi += clines[i][j];
1890
- // csis += csi;
1891
- // }
1892
- // if (++t === -(xi + this.ileft) + 1) break;
1893
- // }
1894
- // clines[i] = csis + clines[i].substring(j);
1895
- // }
1896
- // }
1897
- // if (yi + this.itop < 0) {
1898
- // clines = clines.slice(-(yi + this.itop));
1899
- // }
1900
- // content = clines.join('\n');
1901
- // }
1902
-
1903
- if (coords.base >= this._clines.ci.length) {
1904
- ci = this._pcontent.length;
1905
- }
1906
-
1907
- this.lpos = coords;
1908
-
1909
- if (this.border && this.border.type === 'line') {
1910
- this.screen._borderStops[coords.yi] = true;
1911
- this.screen._borderStops[coords.yl - 1] = true;
1912
- // if (!this.screen._borderStops[coords.yi]) {
1913
- // this.screen._borderStops[coords.yi] = { xi: coords.xi, xl: coords.xl };
1914
- // } else {
1915
- // if (this.screen._borderStops[coords.yi].xi > coords.xi) {
1916
- // this.screen._borderStops[coords.yi].xi = coords.xi;
1917
- // }
1918
- // if (this.screen._borderStops[coords.yi].xl < coords.xl) {
1919
- // this.screen._borderStops[coords.yi].xl = coords.xl;
1920
- // }
1921
- // }
1922
- // this.screen._borderStops[coords.yl - 1] = this.screen._borderStops[coords.yi];
1923
- }
1924
-
1925
- dattr = this.sattr(this.style);
1926
- attr = dattr;
1927
-
1928
- // If we're in a scrollable text box, check to
1929
- // see which attributes this line starts with.
1930
- if (ci > 0) {
1931
- attr = this._clines.attr[Math.min(coords.base, this._clines.length - 1)];
1932
- }
1933
-
1934
- if (this.border) xi++, xl--, yi++, yl--;
1935
-
1936
- // If we have padding/valign, that means the
1937
- // content-drawing loop will skip a few cells/lines.
1938
- // To deal with this, we can just fill the whole thing
1939
- // ahead of time. This could be optimized.
1940
- if (this.tpadding || (this.valign && this.valign !== 'top')) {
1941
- if (this.style.transparent) {
1942
- for (y = Math.max(yi, 0); y < yl; y++) {
1943
- if (!lines[y]) break;
1944
- for (x = Math.max(xi, 0); x < xl; x++) {
1945
- if (!lines[y][x]) break;
1946
- lines[y][x][0] = colors.blend(attr, lines[y][x][0]);
1947
- // lines[y][x][1] = bch;
1948
- lines[y].dirty = true;
1949
- }
1950
- }
1951
- } else {
1952
- this.screen.fillRegion(dattr, bch, xi, xl, yi, yl);
1953
- }
1954
- }
1955
-
1956
- if (this.tpadding) {
1957
- xi += this.padding.left, xl -= this.padding.right;
1958
- yi += this.padding.top, yl -= this.padding.bottom;
1959
- }
1960
-
1961
- // Determine where to place the text if it's vertically aligned.
1962
- if (this.valign === 'middle' || this.valign === 'bottom') {
1963
- visible = yl - yi;
1964
- if (this._clines.length < visible) {
1965
- if (this.valign === 'middle') {
1966
- visible = visible / 2 | 0;
1967
- visible -= this._clines.length / 2 | 0;
1968
- } else if (this.valign === 'bottom') {
1969
- visible -= this._clines.length;
1970
- }
1971
- ci -= visible * (xl - xi);
1972
- }
1973
- }
1974
-
1975
- // Draw the content and background.
1976
- for (y = yi; y < yl; y++) {
1977
- if (!lines[y]) {
1978
- if (y >= this.screen.height || yl < this.ibottom) {
1979
- break;
1980
- } else {
1981
- continue;
1982
- }
1983
- }
1984
- for (x = xi; x < xl; x++) {
1985
- cell = lines[y][x];
1986
- if (!cell) {
1987
- if (x >= this.screen.width || xl < this.iright) {
1988
- break;
1989
- } else {
1990
- continue;
1991
- }
1992
- }
1993
-
1994
- ch = content[ci++] || bch;
1995
-
1996
- // if (!content[ci] && !coords._contentEnd) {
1997
- // coords._contentEnd = { x: x - xi, y: y - yi };
1998
- // }
1999
-
2000
- // Handle escape codes.
2001
- while (ch === '\x1b') {
2002
- if (c = /^\x1b\[[\d;]*m/.exec(content.substring(ci - 1))) {
2003
- ci += c[0].length - 1;
2004
- attr = this.screen.attrCode(c[0], attr, dattr);
2005
- // Ignore foreground changes for selected items.
2006
- if (this.parent._isList && this.parent.interactive
2007
- && this.parent.items[this.parent.selected] === this
2008
- && this.parent.options.invertSelected !== false) {
2009
- attr = (attr & ~(0x1ff << 9)) | (dattr & (0x1ff << 9));
2010
- }
2011
- ch = content[ci] || bch;
2012
- ci++;
2013
- } else {
2014
- break;
2015
- }
2016
- }
2017
-
2018
- // Handle newlines.
2019
- if (ch === '\t') ch = bch;
2020
- if (ch === '\n') {
2021
- // If we're on the first cell and we find a newline and the last cell
2022
- // of the last line was not a newline, let's just treat this like the
2023
- // newline was already "counted".
2024
- if (x === xi && y !== yi && content[ci - 2] !== '\n') {
2025
- x--;
2026
- continue;
2027
- }
2028
- // We could use fillRegion here, name the
2029
- // outer loop, and continue to it instead.
2030
- ch = bch;
2031
- for (; x < xl; x++) {
2032
- cell = lines[y][x];
2033
- if (!cell) break;
2034
- if (this.style.transparent) {
2035
- lines[y][x][0] = colors.blend(attr, lines[y][x][0]);
2036
- if (content[ci]) lines[y][x][1] = ch;
2037
- lines[y].dirty = true;
2038
- } else {
2039
- if (attr !== cell[0] || ch !== cell[1]) {
2040
- lines[y][x][0] = attr;
2041
- lines[y][x][1] = ch;
2042
- lines[y].dirty = true;
2043
- }
2044
- }
2045
- }
2046
- continue;
2047
- }
2048
-
2049
- if (this.screen.fullUnicode && content[ci - 1]) {
2050
- var point = unicode.codePointAt(content, ci - 1);
2051
- // Handle combining chars:
2052
- // Make sure they get in the same cell and are counted as 0.
2053
- if (unicode.combining[point]) {
2054
- if (point > 0x00ffff) {
2055
- ch = content[ci - 1] + content[ci];
2056
- ci++;
2057
- }
2058
- if (x - 1 >= xi) {
2059
- lines[y][x - 1][1] += ch;
2060
- } else if (y - 1 >= yi) {
2061
- lines[y - 1][xl - 1][1] += ch;
2062
- }
2063
- x--;
2064
- continue;
2065
- }
2066
- // Handle surrogate pairs:
2067
- // Make sure we put surrogate pair chars in one cell.
2068
- if (point > 0x00ffff) {
2069
- ch = content[ci - 1] + content[ci];
2070
- ci++;
2071
- }
2072
- }
2073
-
2074
- if (this._noFill) continue;
2075
-
2076
- if (this.style.transparent) {
2077
- lines[y][x][0] = colors.blend(attr, lines[y][x][0]);
2078
- if (content[ci]) lines[y][x][1] = ch;
2079
- lines[y].dirty = true;
2080
- } else {
2081
- if (attr !== cell[0] || ch !== cell[1]) {
2082
- lines[y][x][0] = attr;
2083
- lines[y][x][1] = ch;
2084
- lines[y].dirty = true;
2085
- }
2086
- }
2087
- }
2088
- }
2089
-
2090
- // Draw the scrollbar.
2091
- // Could possibly draw this after all child elements.
2092
- if (this.scrollbar) {
2093
- // XXX
2094
- // i = this.getScrollHeight();
2095
- i = Math.max(this._clines.length, this._scrollBottom());
2096
- }
2097
- if (coords.notop || coords.nobot) i = -Infinity;
2098
- if (this.scrollbar && (yl - yi) < i) {
2099
- x = xl - 1;
2100
- if (this.scrollbar.ignoreBorder && this.border) x++;
2101
- if (this.alwaysScroll) {
2102
- y = this.childBase / (i - (yl - yi));
2103
- } else {
2104
- y = (this.childBase + this.childOffset) / (i - 1);
2105
- }
2106
- y = yi + ((yl - yi) * y | 0);
2107
- if (y >= yl) y = yl - 1;
2108
- cell = lines[y] && lines[y][x];
2109
- if (cell) {
2110
- if (this.track) {
2111
- ch = this.track.ch || ' ';
2112
- attr = this.sattr(this.style.track,
2113
- this.style.track.fg || this.style.fg,
2114
- this.style.track.bg || this.style.bg);
2115
- this.screen.fillRegion(attr, ch, x, x + 1, yi, yl);
2116
- }
2117
- ch = this.scrollbar.ch || ' ';
2118
- attr = this.sattr(this.style.scrollbar,
2119
- this.style.scrollbar.fg || this.style.fg,
2120
- this.style.scrollbar.bg || this.style.bg);
2121
- if (attr !== cell[0] || ch !== cell[1]) {
2122
- lines[y][x][0] = attr;
2123
- lines[y][x][1] = ch;
2124
- lines[y].dirty = true;
2125
- }
2126
- }
2127
- }
2128
-
2129
- if (this.border) xi--, xl++, yi--, yl++;
2130
-
2131
- if (this.tpadding) {
2132
- xi -= this.padding.left, xl += this.padding.right;
2133
- yi -= this.padding.top, yl += this.padding.bottom;
2134
- }
2135
-
2136
- // Draw the border.
2137
- if (this.border) {
2138
- battr = this.sattr(this.style.border);
2139
- y = yi;
2140
- if (coords.notop) y = -1;
2141
- for (x = xi; x < xl; x++) {
2142
- if (!lines[y]) break;
2143
- if (coords.noleft && x === xi) continue;
2144
- if (coords.noright && x === xl - 1) continue;
2145
- cell = lines[y][x];
2146
- if (!cell) continue;
2147
- if (this.border.type === 'line') {
2148
- if (x === xi) {
2149
- ch = '\u250c'; // '┌'
2150
- if (!this.border.left) {
2151
- if (this.border.top) {
2152
- ch = '\u2500'; // '─'
2153
- } else {
2154
- continue;
2155
- }
2156
- } else {
2157
- if (!this.border.top) {
2158
- ch = '\u2502'; // '│'
2159
- }
2160
- }
2161
- } else if (x === xl - 1) {
2162
- ch = '\u2510'; // '┐'
2163
- if (!this.border.right) {
2164
- if (this.border.top) {
2165
- ch = '\u2500'; // '─'
2166
- } else {
2167
- continue;
2168
- }
2169
- } else {
2170
- if (!this.border.top) {
2171
- ch = '\u2502'; // '│'
2172
- }
2173
- }
2174
- } else {
2175
- ch = '\u2500'; // '─'
2176
- }
2177
- } else if (this.border.type === 'bg') {
2178
- ch = this.border.ch;
2179
- }
2180
- if (!this.border.top && x !== xi && x !== xl - 1) {
2181
- ch = ' ';
2182
- if (dattr !== cell[0] || ch !== cell[1]) {
2183
- lines[y][x][0] = dattr;
2184
- lines[y][x][1] = ch;
2185
- lines[y].dirty = true;
2186
- continue;
2187
- }
2188
- }
2189
- if (battr !== cell[0] || ch !== cell[1]) {
2190
- lines[y][x][0] = battr;
2191
- lines[y][x][1] = ch;
2192
- lines[y].dirty = true;
2193
- }
2194
- }
2195
- y = yi + 1;
2196
- for (; y < yl - 1; y++) {
2197
- if (!lines[y]) continue;
2198
- cell = lines[y][xi];
2199
- if (cell) {
2200
- if (this.border.left) {
2201
- if (this.border.type === 'line') {
2202
- ch = '\u2502'; // '│'
2203
- } else if (this.border.type === 'bg') {
2204
- ch = this.border.ch;
2205
- }
2206
- if (!coords.noleft)
2207
- if (battr !== cell[0] || ch !== cell[1]) {
2208
- lines[y][xi][0] = battr;
2209
- lines[y][xi][1] = ch;
2210
- lines[y].dirty = true;
2211
- }
2212
- } else {
2213
- ch = ' ';
2214
- if (dattr !== cell[0] || ch !== cell[1]) {
2215
- lines[y][xi][0] = dattr;
2216
- lines[y][xi][1] = ch;
2217
- lines[y].dirty = true;
2218
- }
2219
- }
2220
- }
2221
- cell = lines[y][xl - 1];
2222
- if (cell) {
2223
- if (this.border.right) {
2224
- if (this.border.type === 'line') {
2225
- ch = '\u2502'; // '│'
2226
- } else if (this.border.type === 'bg') {
2227
- ch = this.border.ch;
2228
- }
2229
- if (!coords.noright)
2230
- if (battr !== cell[0] || ch !== cell[1]) {
2231
- lines[y][xl - 1][0] = battr;
2232
- lines[y][xl - 1][1] = ch;
2233
- lines[y].dirty = true;
2234
- }
2235
- } else {
2236
- ch = ' ';
2237
- if (dattr !== cell[0] || ch !== cell[1]) {
2238
- lines[y][xl - 1][0] = dattr;
2239
- lines[y][xl - 1][1] = ch;
2240
- lines[y].dirty = true;
2241
- }
2242
- }
2243
- }
2244
- }
2245
- y = yl - 1;
2246
- if (coords.nobot) y = -1;
2247
- for (x = xi; x < xl; x++) {
2248
- if (!lines[y]) break;
2249
- if (coords.noleft && x === xi) continue;
2250
- if (coords.noright && x === xl - 1) continue;
2251
- cell = lines[y][x];
2252
- if (!cell) continue;
2253
- if (this.border.type === 'line') {
2254
- if (x === xi) {
2255
- ch = '\u2514'; // '└'
2256
- if (!this.border.left) {
2257
- if (this.border.bottom) {
2258
- ch = '\u2500'; // '─'
2259
- } else {
2260
- continue;
2261
- }
2262
- } else {
2263
- if (!this.border.bottom) {
2264
- ch = '\u2502'; // '│'
2265
- }
2266
- }
2267
- } else if (x === xl - 1) {
2268
- ch = '\u2518'; // '┘'
2269
- if (!this.border.right) {
2270
- if (this.border.bottom) {
2271
- ch = '\u2500'; // '─'
2272
- } else {
2273
- continue;
2274
- }
2275
- } else {
2276
- if (!this.border.bottom) {
2277
- ch = '\u2502'; // '│'
2278
- }
2279
- }
2280
- } else {
2281
- ch = '\u2500'; // '─'
2282
- }
2283
- } else if (this.border.type === 'bg') {
2284
- ch = this.border.ch;
2285
- }
2286
- if (!this.border.bottom && x !== xi && x !== xl - 1) {
2287
- ch = ' ';
2288
- if (dattr !== cell[0] || ch !== cell[1]) {
2289
- lines[y][x][0] = dattr;
2290
- lines[y][x][1] = ch;
2291
- lines[y].dirty = true;
2292
- }
2293
- continue;
2294
- }
2295
- if (battr !== cell[0] || ch !== cell[1]) {
2296
- lines[y][x][0] = battr;
2297
- lines[y][x][1] = ch;
2298
- lines[y].dirty = true;
2299
- }
2300
- }
2301
- }
2302
-
2303
- if (this.shadow) {
2304
- // right
2305
- y = Math.max(yi + 1, 0);
2306
- for (; y < yl + 1; y++) {
2307
- if (!lines[y]) break;
2308
- x = xl;
2309
- for (; x < xl + 2; x++) {
2310
- if (!lines[y][x]) break;
2311
- // lines[y][x][0] = colors.blend(this.dattr, lines[y][x][0]);
2312
- lines[y][x][0] = colors.blend(lines[y][x][0]);
2313
- lines[y].dirty = true;
2314
- }
2315
- }
2316
- // bottom
2317
- y = yl;
2318
- for (; y < yl + 1; y++) {
2319
- if (!lines[y]) break;
2320
- for (x = Math.max(xi + 1, 0); x < xl; x++) {
2321
- if (!lines[y][x]) break;
2322
- // lines[y][x][0] = colors.blend(this.dattr, lines[y][x][0]);
2323
- lines[y][x][0] = colors.blend(lines[y][x][0]);
2324
- lines[y].dirty = true;
2325
- }
2326
- }
2327
- }
2328
-
2329
- this.children.forEach(function(el) {
2330
- if (el.screen._ci !== -1) {
2331
- el.index = el.screen._ci++;
2332
- }
2333
- // if (el.screen._rendering) {
2334
- // el._rendering = true;
2335
- // }
2336
- el.render();
2337
- // if (el.screen._rendering) {
2338
- // el._rendering = false;
2339
- // }
2340
- });
2341
-
2342
- this._emit('render', [coords]);
2343
-
2344
- return coords;
2345
- };
2346
-
2347
- Element.prototype._render = Element.prototype.render;
2348
-
2349
- /**
2350
- * Content Methods
2351
- */
2352
-
2353
- Element.prototype.insertLine = function(i, line) {
2354
- if (typeof line === 'string') line = line.split('\n');
2355
-
2356
- if (i !== i || i == null) {
2357
- i = this._clines.ftor.length;
2358
- }
2359
-
2360
- i = Math.max(i, 0);
2361
-
2362
- while (this._clines.fake.length < i) {
2363
- this._clines.fake.push('');
2364
- this._clines.ftor.push([this._clines.push('') - 1]);
2365
- this._clines.rtof(this._clines.fake.length - 1);
2366
- }
2367
-
2368
- // NOTE: Could possibly compare the first and last ftor line numbers to see
2369
- // if they're the same, or if they fit in the visible region entirely.
2370
- var start = this._clines.length
2371
- , diff
2372
- , real;
2373
-
2374
- if (i >= this._clines.ftor.length) {
2375
- real = this._clines.ftor[this._clines.ftor.length - 1];
2376
- real = real[real.length - 1] + 1;
2377
- } else {
2378
- real = this._clines.ftor[i][0];
2379
- }
2380
-
2381
- for (var j = 0; j < line.length; j++) {
2382
- this._clines.fake.splice(i + j, 0, line[j]);
2383
- }
2384
-
2385
- this.setContent(this._clines.fake.join('\n'), true);
2386
-
2387
- diff = this._clines.length - start;
2388
-
2389
- if (diff > 0) {
2390
- var pos = this._getCoords();
2391
- if (!pos) return;
2392
-
2393
- var height = pos.yl - pos.yi - this.iheight
2394
- , base = this.childBase || 0
2395
- , visible = real >= base && real - base < height;
2396
-
2397
- if (pos && visible && this.screen.cleanSides(this)) {
2398
- this.screen.insertLine(diff,
2399
- pos.yi + this.itop + real - base,
2400
- pos.yi,
2401
- pos.yl - this.ibottom - 1);
2402
- }
2403
- }
2404
- };
2405
-
2406
- Element.prototype.deleteLine = function(i, n) {
2407
- n = n || 1;
2408
-
2409
- if (i !== i || i == null) {
2410
- i = this._clines.ftor.length - 1;
2411
- }
2412
-
2413
- i = Math.max(i, 0);
2414
- i = Math.min(i, this._clines.ftor.length - 1);
2415
-
2416
- // NOTE: Could possibly compare the first and last ftor line numbers to see
2417
- // if they're the same, or if they fit in the visible region entirely.
2418
- var start = this._clines.length
2419
- , diff
2420
- , real = this._clines.ftor[i][0];
2421
-
2422
- while (n--) {
2423
- this._clines.fake.splice(i, 1);
2424
- }
2425
-
2426
- this.setContent(this._clines.fake.join('\n'), true);
2427
-
2428
- diff = start - this._clines.length;
2429
-
2430
- // XXX clearPos() without diff statement?
2431
- var height = 0;
2432
-
2433
- if (diff > 0) {
2434
- var pos = this._getCoords();
2435
- if (!pos) return;
2436
-
2437
- height = pos.yl - pos.yi - this.iheight;
2438
-
2439
- var base = this.childBase || 0
2440
- , visible = real >= base && real - base < height;
2441
-
2442
- if (pos && visible && this.screen.cleanSides(this)) {
2443
- this.screen.deleteLine(diff,
2444
- pos.yi + this.itop + real - base,
2445
- pos.yi,
2446
- pos.yl - this.ibottom - 1);
2447
- }
2448
- }
2449
-
2450
- if (this._clines.length < height) {
2451
- this.clearPos();
2452
- }
2453
- };
2454
-
2455
- Element.prototype.insertTop = function(line) {
2456
- var fake = this._clines.rtof[this.childBase || 0];
2457
- return this.insertLine(fake, line);
2458
- };
2459
-
2460
- Element.prototype.insertBottom = function(line) {
2461
- var h = (this.childBase || 0) + this.height - this.iheight
2462
- , i = Math.min(h, this._clines.length)
2463
- , fake = this._clines.rtof[i - 1] + 1;
2464
-
2465
- return this.insertLine(fake, line);
2466
- };
2467
-
2468
- Element.prototype.deleteTop = function(n) {
2469
- var fake = this._clines.rtof[this.childBase || 0];
2470
- return this.deleteLine(fake, n);
2471
- };
2472
-
2473
- Element.prototype.deleteBottom = function(n) {
2474
- var h = (this.childBase || 0) + this.height - 1 - this.iheight
2475
- , i = Math.min(h, this._clines.length - 1)
2476
- , fake = this._clines.rtof[i];
2477
-
2478
- n = n || 1;
2479
-
2480
- return this.deleteLine(fake - (n - 1), n);
2481
- };
2482
-
2483
- Element.prototype.setLine = function(i, line) {
2484
- i = Math.max(i, 0);
2485
- while (this._clines.fake.length < i) {
2486
- this._clines.fake.push('');
2487
- }
2488
- this._clines.fake[i] = line;
2489
- return this.setContent(this._clines.fake.join('\n'), true);
2490
- };
2491
-
2492
- Element.prototype.setBaseLine = function(i, line) {
2493
- var fake = this._clines.rtof[this.childBase || 0];
2494
- return this.setLine(fake + i, line);
2495
- };
2496
-
2497
- Element.prototype.getLine = function(i) {
2498
- i = Math.max(i, 0);
2499
- i = Math.min(i, this._clines.fake.length - 1);
2500
- return this._clines.fake[i];
2501
- };
2502
-
2503
- Element.prototype.getBaseLine = function(i) {
2504
- var fake = this._clines.rtof[this.childBase || 0];
2505
- return this.getLine(fake + i);
2506
- };
2507
-
2508
- Element.prototype.clearLine = function(i) {
2509
- i = Math.min(i, this._clines.fake.length - 1);
2510
- return this.setLine(i, '');
2511
- };
2512
-
2513
- Element.prototype.clearBaseLine = function(i) {
2514
- var fake = this._clines.rtof[this.childBase || 0];
2515
- return this.clearLine(fake + i);
2516
- };
2517
-
2518
- Element.prototype.unshiftLine = function(line) {
2519
- return this.insertLine(0, line);
2520
- };
2521
-
2522
- Element.prototype.shiftLine = function(n) {
2523
- return this.deleteLine(0, n);
2524
- };
2525
-
2526
- Element.prototype.pushLine = function(line) {
2527
- if (!this.content) return this.setLine(0, line);
2528
- return this.insertLine(this._clines.fake.length, line);
2529
- };
2530
-
2531
- Element.prototype.popLine = function(n) {
2532
- return this.deleteLine(this._clines.fake.length - 1, n);
2533
- };
2534
-
2535
- Element.prototype.getLines = function() {
2536
- return this._clines.fake.slice();
2537
- };
2538
-
2539
- Element.prototype.getScreenLines = function() {
2540
- return this._clines.slice();
2541
- };
2542
-
2543
- Element.prototype.strWidth = function(text) {
2544
- text = this.parseTags
2545
- ? helpers.stripTags(text)
2546
- : text;
2547
- return this.screen.fullUnicode
2548
- ? unicode.strWidth(text)
2549
- : helpers.dropUnicode(text).length;
2550
- };
2551
-
2552
- Element.prototype.screenshot = function(xi, xl, yi, yl) {
2553
- xi = this.lpos.xi + this.ileft + (xi || 0);
2554
- if (xl != null) {
2555
- xl = this.lpos.xi + this.ileft + (xl || 0);
2556
- } else {
2557
- xl = this.lpos.xl - this.iright;
2558
- }
2559
- yi = this.lpos.yi + this.itop + (yi || 0);
2560
- if (yl != null) {
2561
- yl = this.lpos.yi + this.itop + (yl || 0);
2562
- } else {
2563
- yl = this.lpos.yl - this.ibottom;
2564
- }
2565
- return this.screen.screenshot(xi, xl, yi, yl);
2566
- };
2567
-
2568
- /**
2569
- * Expose
2570
- */
2571
-
2572
- module.exports = Element;