tnp-helpers 0.0.70 → 13.0.4

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 (304) hide show
  1. package/app.js +2 -1
  2. package/browser/README.md +24 -0
  3. package/browser/esm2020/lib/base-component.mjs +48 -0
  4. package/browser/esm2020/lib/base-formly-component.mjs +124 -0
  5. package/browser/esm2020/lib/condition-wait.mjs +54 -0
  6. package/browser/esm2020/lib/constants.mjs +2 -0
  7. package/browser/esm2020/lib/dual-component-ctrl.mjs +116 -0
  8. package/browser/esm2020/lib/helpers-array-obj.mjs +81 -0
  9. package/browser/esm2020/lib/helpers-environment.mjs +21 -0
  10. package/browser/esm2020/lib/helpers-strings-regexes.mjs +49 -0
  11. package/browser/esm2020/lib/helpers-strings.mjs +61 -0
  12. package/browser/esm2020/lib/helpers.mjs +106 -0
  13. package/browser/esm2020/lib/index.mjs +11 -0
  14. package/browser/esm2020/lib/long-press.directive.mjs +106 -0
  15. package/browser/esm2020/lib/project.mjs +90 -0
  16. package/browser/esm2020/lib/resize-service.mjs +20 -0
  17. package/browser/esm2020/public-api.mjs +2 -0
  18. package/browser/esm2020/tnp-helpers.mjs +5 -0
  19. package/browser/fesm2015/tnp-helpers.mjs +869 -0
  20. package/browser/fesm2015/tnp-helpers.mjs.map +1 -0
  21. package/browser/fesm2020/tnp-helpers.mjs +860 -0
  22. package/browser/fesm2020/tnp-helpers.mjs.map +1 -0
  23. package/browser/{base-component.d.ts → lib/base-component.d.ts} +3 -0
  24. package/browser/{base-formly-component.d.ts → lib/base-formly-component.d.ts} +4 -3
  25. package/browser/{condition-wait.d.ts → lib/condition-wait.d.ts} +0 -0
  26. package/browser/{constants.d.ts → lib/constants.d.ts} +0 -0
  27. package/browser/{dual-component-ctrl.d.ts → lib/dual-component-ctrl.d.ts} +0 -0
  28. package/{helpers-array-obj.d.ts → browser/lib/helpers-array-obj.d.ts} +1 -0
  29. package/browser/{helpers-environment.d.ts → lib/helpers-environment.d.ts} +0 -0
  30. package/browser/{helpers-strings-regexes.d.ts → lib/helpers-strings-regexes.d.ts} +0 -0
  31. package/browser/{helpers-strings.d.ts → lib/helpers-strings.d.ts} +0 -0
  32. package/browser/{helpers.d.ts → lib/helpers.d.ts} +2 -4
  33. package/{client → browser/lib}/index.d.ts +1 -1
  34. package/{client → browser/lib}/long-press.directive.d.ts +3 -0
  35. package/browser/{project.d.ts → lib/project.d.ts} +0 -0
  36. package/{client → browser/lib}/resize-service.d.ts +3 -0
  37. package/browser/package.json +31 -0
  38. package/browser/public-api.d.ts +1 -0
  39. package/browser/tnp-helpers.d.ts +5 -0
  40. package/client/README.md +24 -0
  41. package/client/esm2020/lib/base-component.mjs +48 -0
  42. package/client/esm2020/lib/base-formly-component.mjs +124 -0
  43. package/client/esm2020/lib/condition-wait.mjs +54 -0
  44. package/client/esm2020/lib/constants.mjs +2 -0
  45. package/client/esm2020/lib/dual-component-ctrl.mjs +116 -0
  46. package/client/esm2020/lib/helpers-array-obj.mjs +81 -0
  47. package/client/esm2020/lib/helpers-environment.mjs +21 -0
  48. package/client/esm2020/lib/helpers-strings-regexes.mjs +49 -0
  49. package/client/esm2020/lib/helpers-strings.mjs +61 -0
  50. package/client/esm2020/lib/helpers.mjs +106 -0
  51. package/client/esm2020/lib/index.mjs +11 -0
  52. package/client/esm2020/lib/long-press.directive.mjs +106 -0
  53. package/client/esm2020/lib/project.mjs +90 -0
  54. package/client/esm2020/lib/resize-service.mjs +20 -0
  55. package/client/esm2020/public-api.mjs +2 -0
  56. package/client/esm2020/tnp-helpers.mjs +5 -0
  57. package/client/fesm2015/tnp-helpers.mjs +869 -0
  58. package/client/fesm2015/tnp-helpers.mjs.map +1 -0
  59. package/client/fesm2020/tnp-helpers.mjs +860 -0
  60. package/client/fesm2020/tnp-helpers.mjs.map +1 -0
  61. package/client/{base-component.d.ts → lib/base-component.d.ts} +3 -0
  62. package/{base-formly-component.d.ts → client/lib/base-formly-component.d.ts} +4 -3
  63. package/client/{condition-wait.d.ts → lib/condition-wait.d.ts} +0 -0
  64. package/client/{constants.d.ts → lib/constants.d.ts} +0 -0
  65. package/client/{dual-component-ctrl.d.ts → lib/dual-component-ctrl.d.ts} +0 -0
  66. package/client/{helpers-array-obj.d.ts → lib/helpers-array-obj.d.ts} +1 -0
  67. package/client/{helpers-environment.d.ts → lib/helpers-environment.d.ts} +0 -0
  68. package/client/{helpers-strings-regexes.d.ts → lib/helpers-strings-regexes.d.ts} +0 -0
  69. package/client/{helpers-strings.d.ts → lib/helpers-strings.d.ts} +0 -0
  70. package/client/{helpers.d.ts → lib/helpers.d.ts} +2 -4
  71. package/{browser → client/lib}/index.d.ts +1 -1
  72. package/{browser → client/lib}/long-press.directive.d.ts +3 -0
  73. package/client/{project.d.ts → lib/project.d.ts} +0 -0
  74. package/{resize-service.d.ts → client/lib/resize-service.d.ts} +3 -0
  75. package/client/package.json +25 -19
  76. package/client/public-api.d.ts +1 -0
  77. package/client/tnp-helpers.d.ts +5 -0
  78. package/index.d.ts +1 -11
  79. package/index.js +3 -21
  80. package/index.js.map +1 -1
  81. package/{base-component.d.ts → lib/base-component.d.ts} +0 -0
  82. package/{base-component.js → lib/base-component.js} +8 -7
  83. package/lib/base-component.js.map +1 -0
  84. package/{client → lib}/base-formly-component.d.ts +1 -3
  85. package/{base-formly-component.js → lib/base-formly-component.js} +46 -47
  86. package/lib/base-formly-component.js.map +1 -0
  87. package/{condition-wait.d.ts → lib/condition-wait.d.ts} +0 -0
  88. package/{condition-wait.js → lib/condition-wait.js} +10 -9
  89. package/lib/condition-wait.js.map +1 -0
  90. package/{constants.d.ts → lib/constants.d.ts} +0 -0
  91. package/{constants.js → lib/constants.js} +2 -1
  92. package/lib/constants.js.map +1 -0
  93. package/{dual-component-ctrl.d.ts → lib/dual-component-ctrl.d.ts} +0 -0
  94. package/{dual-component-ctrl.js → lib/dual-component-ctrl.js} +2 -1
  95. package/lib/dual-component-ctrl.js.map +1 -0
  96. package/{git-project.d.ts → lib/git-project.d.ts} +4 -3
  97. package/{git-project.js → lib/git-project.js} +20 -11
  98. package/lib/git-project.js.map +1 -0
  99. package/{browser → lib}/helpers-array-obj.d.ts +1 -0
  100. package/{helpers-array-obj.js → lib/helpers-array-obj.js} +8 -1
  101. package/lib/helpers-array-obj.js.map +1 -0
  102. package/{helpers-cli-tool.backend.d.ts → lib/helpers-cli-tool.backend.d.ts} +0 -0
  103. package/{helpers-cli-tool.backend.js → lib/helpers-cli-tool.backend.js} +5 -4
  104. package/lib/helpers-cli-tool.backend.js.map +1 -0
  105. package/{helpers-dependencies.backend.d.ts → lib/helpers-dependencies.backend.d.ts} +0 -0
  106. package/{helpers-dependencies.backend.js → lib/helpers-dependencies.backend.js} +6 -5
  107. package/lib/helpers-dependencies.backend.js.map +1 -0
  108. package/{helpers-environment.d.ts → lib/helpers-environment.d.ts} +0 -0
  109. package/{helpers-environment.js → lib/helpers-environment.js} +2 -1
  110. package/lib/helpers-environment.js.map +1 -0
  111. package/{helpers-file-folders.backend.d.ts → lib/helpers-file-folders.backend.d.ts} +1 -0
  112. package/{helpers-file-folders.backend.js → lib/helpers-file-folders.backend.js} +66 -47
  113. package/lib/helpers-file-folders.backend.js.map +1 -0
  114. package/{helpers-git.backend.d.ts → lib/helpers-git.backend.d.ts} +3 -1
  115. package/{helpers-git.backend.js → lib/helpers-git.backend.js} +90 -56
  116. package/lib/helpers-git.backend.js.map +1 -0
  117. package/{helpers-json5.backend.d.ts → lib/helpers-json5.backend.d.ts} +0 -0
  118. package/{helpers-json5.backend.js → lib/helpers-json5.backend.js} +3 -2
  119. package/lib/helpers-json5.backend.js.map +1 -0
  120. package/{helpers-morphi-framework.backend.d.ts → lib/helpers-morphi-framework.backend.d.ts} +0 -0
  121. package/{helpers-morphi-framework.backend.js → lib/helpers-morphi-framework.backend.js} +4 -3
  122. package/lib/helpers-morphi-framework.backend.js.map +1 -0
  123. package/{helpers-network.backend.d.ts → lib/helpers-network.backend.d.ts} +0 -0
  124. package/{helpers-network.backend.js → lib/helpers-network.backend.js} +2 -1
  125. package/lib/helpers-network.backend.js.map +1 -0
  126. package/{helpers-npm.backend.d.ts → lib/helpers-npm.backend.d.ts} +0 -0
  127. package/{helpers-npm.backend.js → lib/helpers-npm.backend.js} +2 -1
  128. package/lib/helpers-npm.backend.js.map +1 -0
  129. package/{helpers-path.backend.d.ts → lib/helpers-path.backend.d.ts} +0 -0
  130. package/{helpers-path.backend.js → lib/helpers-path.backend.js} +4 -3
  131. package/lib/helpers-path.backend.js.map +1 -0
  132. package/{helpers-process.backend.d.ts → lib/helpers-process.backend.d.ts} +2 -2
  133. package/{helpers-process.backend.js → lib/helpers-process.backend.js} +54 -53
  134. package/lib/helpers-process.backend.js.map +1 -0
  135. package/{helpers-strings-regexes.d.ts → lib/helpers-strings-regexes.d.ts} +0 -0
  136. package/{helpers-strings-regexes.js → lib/helpers-strings-regexes.js} +2 -1
  137. package/lib/helpers-strings-regexes.js.map +1 -0
  138. package/{helpers-strings.d.ts → lib/helpers-strings.d.ts} +0 -0
  139. package/{helpers-strings.js → lib/helpers-strings.js} +2 -1
  140. package/lib/helpers-strings.js.map +1 -0
  141. package/{helpers-system-terminal.backend.d.ts → lib/helpers-system-terminal.backend.d.ts} +1 -1
  142. package/{helpers-system-terminal.backend.js → lib/helpers-system-terminal.backend.js} +9 -8
  143. package/lib/helpers-system-terminal.backend.js.map +1 -0
  144. package/{helpers.d.ts → lib/helpers.d.ts} +6 -6
  145. package/{helpers.js → lib/helpers.js} +34 -30
  146. package/lib/helpers.js.map +1 -0
  147. package/{client/index.js → lib/index.d.ts} +3 -3
  148. package/lib/index.js +25 -0
  149. package/lib/index.js.map +1 -0
  150. package/{long-press.directive.d.ts → lib/long-press.directive.d.ts} +0 -0
  151. package/{long-press.directive.js → lib/long-press.directive.js} +40 -39
  152. package/lib/long-press.directive.js.map +1 -0
  153. package/{merge-helpers.backend.d.ts → lib/merge-helpers.backend.d.ts} +0 -0
  154. package/{merge-helpers.backend.js → lib/merge-helpers.backend.js} +7 -6
  155. package/lib/merge-helpers.backend.js.map +1 -0
  156. package/{project.d.ts → lib/project.d.ts} +0 -0
  157. package/{project.js → lib/project.js} +23 -21
  158. package/lib/project.js.map +1 -0
  159. package/{browser → lib}/resize-service.d.ts +0 -0
  160. package/{resize-service.js → lib/resize-service.js} +5 -4
  161. package/lib/resize-service.js.map +1 -0
  162. package/{ts-code-modifier → lib/ts-code}/index.d.ts +0 -0
  163. package/{ts-code-modifier → lib/ts-code}/index.js +3 -2
  164. package/lib/ts-code/index.js.map +1 -0
  165. package/lib/ts-code/ts-code-extractor.d.ts +14 -0
  166. package/lib/ts-code/ts-code-extractor.js +47 -0
  167. package/lib/ts-code/ts-code-extractor.js.map +1 -0
  168. package/{ts-code-modifier → lib/ts-code}/ts-code-modifier.backend.d.ts +0 -0
  169. package/{ts-code-modifier → lib/ts-code}/ts-code-modifier.backend.js +3 -2
  170. package/lib/ts-code/ts-code-modifier.backend.js.map +1 -0
  171. package/package.json +10 -18
  172. package/package.json_devDependencies.json +50 -50
  173. package/{package.json_tnp.json → package.json_tnp.json5} +12 -8
  174. package/tmp-environment.json +86 -123
  175. package/base-component.js.map +0 -1
  176. package/base-formly-component.js.map +0 -1
  177. package/browser/base-component.js +0 -48
  178. package/browser/base-component.js.map +0 -1
  179. package/browser/base-formly-component.js +0 -149
  180. package/browser/base-formly-component.js.map +0 -1
  181. package/browser/condition-wait.js +0 -57
  182. package/browser/condition-wait.js.map +0 -1
  183. package/browser/constants.js +0 -2
  184. package/browser/constants.js.map +0 -1
  185. package/browser/dual-component-ctrl.js +0 -118
  186. package/browser/dual-component-ctrl.js.map +0 -1
  187. package/browser/es5/base-component.js +0 -89
  188. package/browser/es5/base-formly-component.js +0 -158
  189. package/browser/es5/condition-wait.js +0 -135
  190. package/browser/es5/constants.js +0 -7
  191. package/browser/es5/dual-component-ctrl.js +0 -164
  192. package/browser/es5/git-project.js +0 -18
  193. package/browser/es5/helpers-array-obj.js +0 -129
  194. package/browser/es5/helpers-environment.js +0 -46
  195. package/browser/es5/helpers-messages.js +0 -105
  196. package/browser/es5/helpers-strings-regexes.js +0 -74
  197. package/browser/es5/helpers-strings.js +0 -96
  198. package/browser/es5/helpers.js +0 -217
  199. package/browser/es5/index.js +0 -86
  200. package/browser/es5/long-press.directive.js +0 -133
  201. package/browser/es5/project.js +0 -146
  202. package/browser/es5/resize-service.js +0 -45
  203. package/browser/git-project.d.ts +0 -2
  204. package/browser/git-project.js +0 -6
  205. package/browser/git-project.js.map +0 -1
  206. package/browser/helpers-array-obj.js +0 -75
  207. package/browser/helpers-array-obj.js.map +0 -1
  208. package/browser/helpers-environment.js +0 -21
  209. package/browser/helpers-environment.js.map +0 -1
  210. package/browser/helpers-messages.d.ts +0 -7
  211. package/browser/helpers-messages.js +0 -68
  212. package/browser/helpers-messages.js.map +0 -1
  213. package/browser/helpers-strings-regexes.js +0 -49
  214. package/browser/helpers-strings-regexes.js.map +0 -1
  215. package/browser/helpers-strings.js +0 -61
  216. package/browser/helpers-strings.js.map +0 -1
  217. package/browser/helpers.js +0 -113
  218. package/browser/helpers.js.map +0 -1
  219. package/browser/index.js +0 -11
  220. package/browser/index.js.map +0 -1
  221. package/browser/long-press.directive.js +0 -125
  222. package/browser/long-press.directive.js.map +0 -1
  223. package/browser/project.js +0 -90
  224. package/browser/project.js.map +0 -1
  225. package/browser/resize-service.js +0 -20
  226. package/browser/resize-service.js.map +0 -1
  227. package/client/base-component.js +0 -48
  228. package/client/base-component.js.map +0 -1
  229. package/client/base-formly-component.js +0 -149
  230. package/client/base-formly-component.js.map +0 -1
  231. package/client/condition-wait.js +0 -57
  232. package/client/condition-wait.js.map +0 -1
  233. package/client/constants.js +0 -2
  234. package/client/constants.js.map +0 -1
  235. package/client/dual-component-ctrl.js +0 -118
  236. package/client/dual-component-ctrl.js.map +0 -1
  237. package/client/es5/base-component.js +0 -89
  238. package/client/es5/base-formly-component.js +0 -158
  239. package/client/es5/condition-wait.js +0 -135
  240. package/client/es5/constants.js +0 -7
  241. package/client/es5/dual-component-ctrl.js +0 -164
  242. package/client/es5/git-project.js +0 -18
  243. package/client/es5/helpers-array-obj.js +0 -129
  244. package/client/es5/helpers-environment.js +0 -46
  245. package/client/es5/helpers-messages.js +0 -105
  246. package/client/es5/helpers-strings-regexes.js +0 -74
  247. package/client/es5/helpers-strings.js +0 -96
  248. package/client/es5/helpers.js +0 -217
  249. package/client/es5/index.js +0 -86
  250. package/client/es5/long-press.directive.js +0 -133
  251. package/client/es5/project.js +0 -146
  252. package/client/es5/resize-service.js +0 -45
  253. package/client/git-project.d.ts +0 -2
  254. package/client/git-project.js +0 -6
  255. package/client/git-project.js.map +0 -1
  256. package/client/helpers-array-obj.js +0 -75
  257. package/client/helpers-array-obj.js.map +0 -1
  258. package/client/helpers-environment.js +0 -21
  259. package/client/helpers-environment.js.map +0 -1
  260. package/client/helpers-messages.d.ts +0 -7
  261. package/client/helpers-messages.js +0 -68
  262. package/client/helpers-messages.js.map +0 -1
  263. package/client/helpers-strings-regexes.js +0 -49
  264. package/client/helpers-strings-regexes.js.map +0 -1
  265. package/client/helpers-strings.js +0 -61
  266. package/client/helpers-strings.js.map +0 -1
  267. package/client/helpers.js +0 -113
  268. package/client/helpers.js.map +0 -1
  269. package/client/index.js.map +0 -1
  270. package/client/long-press.directive.js +0 -125
  271. package/client/long-press.directive.js.map +0 -1
  272. package/client/project.js +0 -90
  273. package/client/project.js.map +0 -1
  274. package/client/resize-service.js +0 -20
  275. package/client/resize-service.js.map +0 -1
  276. package/condition-wait.js.map +0 -1
  277. package/constants.js.map +0 -1
  278. package/dual-component-ctrl.js.map +0 -1
  279. package/git-project.js.map +0 -1
  280. package/helpers-array-obj.js.map +0 -1
  281. package/helpers-cli-tool.backend.js.map +0 -1
  282. package/helpers-dependencies.backend.js.map +0 -1
  283. package/helpers-environment.js.map +0 -1
  284. package/helpers-file-folders.backend.js.map +0 -1
  285. package/helpers-git.backend.js.map +0 -1
  286. package/helpers-json5.backend.js.map +0 -1
  287. package/helpers-messages.d.ts +0 -7
  288. package/helpers-messages.js +0 -237
  289. package/helpers-messages.js.map +0 -1
  290. package/helpers-morphi-framework.backend.js.map +0 -1
  291. package/helpers-network.backend.js.map +0 -1
  292. package/helpers-npm.backend.js.map +0 -1
  293. package/helpers-path.backend.js.map +0 -1
  294. package/helpers-process.backend.js.map +0 -1
  295. package/helpers-strings-regexes.js.map +0 -1
  296. package/helpers-strings.js.map +0 -1
  297. package/helpers-system-terminal.backend.js.map +0 -1
  298. package/helpers.js.map +0 -1
  299. package/long-press.directive.js.map +0 -1
  300. package/merge-helpers.backend.js.map +0 -1
  301. package/project.js.map +0 -1
  302. package/resize-service.js.map +0 -1
  303. package/ts-code-modifier/index.js.map +0 -1
  304. package/ts-code-modifier/ts-code-modifier.backend.js.map +0 -1
@@ -0,0 +1,869 @@
1
+ import { __awaiter } from 'tslib';
2
+ import { _, CoreHelpers } from 'tnp-core/browser';
3
+ import * as fuzzy from 'fuzzy';
4
+ import { CLASS } from 'typescript-class-helpers/browser';
5
+ import { Morphi } from 'morphi/browser';
6
+ import { config } from 'tnp-config/browser';
7
+ import * as i0 from '@angular/core';
8
+ import { Component, Input, EventEmitter, Output, Injectable, Directive, HostBinding, HostListener } from '@angular/core';
9
+ import { NavigationEnd } from '@angular/router';
10
+ import { FieldType } from '@ngx-formly/core';
11
+ import { Log, Level } from 'ng2-logger/browser';
12
+ import * as elementResizeDetectorMaker from 'element-resize-detector';
13
+
14
+ class HelpersArrayObj {
15
+ from(s) {
16
+ if (_.isArray(s)) {
17
+ return s;
18
+ }
19
+ if (_.isString(s)) {
20
+ return s.split(' ');
21
+ }
22
+ }
23
+ second(arr) {
24
+ if (!Array.isArray(arr) || arr.length < 2) {
25
+ return void 0;
26
+ }
27
+ return arr[1];
28
+ }
29
+ arrayMoveElementBefore(arr, a, b, prop) {
30
+ let indexA = prop ? arr.findIndex(elem => elem[prop] === a[prop]) : arr.indexOf(a);
31
+ _.pullAt(arr, indexA);
32
+ let indexB = prop ? arr.findIndex(elem => elem[prop] === b[prop]) : arr.indexOf(b);
33
+ if (indexB === 0) {
34
+ arr.unshift(a);
35
+ }
36
+ else {
37
+ arr.splice(indexB - 1, 0, a);
38
+ }
39
+ return arr;
40
+ }
41
+ arrayMoveElementAfterB(arr, a, b, prop) {
42
+ let indexA = prop ? arr.findIndex(elem => elem[prop] === a[prop]) : arr.indexOf(a);
43
+ _.pullAt(arr, indexA);
44
+ let indexB = prop ? arr.findIndex(elem => elem[prop] === b[prop]) : arr.indexOf(b);
45
+ if (indexB === arr.length - 1) {
46
+ arr.push(a);
47
+ }
48
+ else {
49
+ arr.splice(indexB + 1, 0, a);
50
+ }
51
+ return arr;
52
+ }
53
+ uniqArray(array, uniqueProperty) {
54
+ var seen = {};
55
+ return array
56
+ .filter(f => !!f)
57
+ .filter(function (item) {
58
+ return seen.hasOwnProperty(uniqueProperty ? item[uniqueProperty] : item) ? false
59
+ : (seen[uniqueProperty ? item[uniqueProperty] : item] = true);
60
+ });
61
+ }
62
+ sortKeys(obj) {
63
+ if (_.isArray(obj)) {
64
+ return obj.map(Helpers.arrays.sortKeys);
65
+ }
66
+ if (_.isObject(obj)) {
67
+ return _.fromPairs(_.keys(obj).sort().map(key => [key, Helpers.arrays.sortKeys(obj[key])]));
68
+ }
69
+ return obj;
70
+ }
71
+ ;
72
+ /**
73
+ * Fuzzy search
74
+ */
75
+ fuzzy(query, list, valueFn) {
76
+ const resultsFuzzy = fuzzy.filter(query, list.map(k => valueFn ? valueFn(k) : k));
77
+ const resultsFuzzyKebab = fuzzy.filter(_.kebabCase(query), list.map(k => _.kebabCase((valueFn ? valueFn(k) : k))));
78
+ const matches = resultsFuzzy.map((el) => el.string);
79
+ const matchesKebab = resultsFuzzyKebab.map((el) => el.string);
80
+ const results = (resultsFuzzy.length === 0) ? [] : list.filter(k => {
81
+ return matches.includes((valueFn ? valueFn(k) : k));
82
+ });
83
+ if (matches.length === 0 && matchesKebab.length > 0) {
84
+ const m = list.find(k => _.kebabCase((valueFn ? valueFn(k) : k)) === _.first(matchesKebab));
85
+ results.push(m);
86
+ matches.push((valueFn ? valueFn(m) : m));
87
+ }
88
+ return { matches, results };
89
+ }
90
+ }
91
+
92
+ class HelpersStringsRegexes {
93
+ escapeStringForRegEx(s) {
94
+ return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
95
+ }
96
+ matchExactOnce(s, regex) {
97
+ if (!_.isString(s) || !_.isRegExp(regex)) {
98
+ return void 0;
99
+ }
100
+ const result = s.match(regex);
101
+ if (_.isNil(result)) {
102
+ return void 0;
103
+ }
104
+ return result.length >= 1 ? _.first(result) : void 0;
105
+ }
106
+ get regex() {
107
+ return {
108
+ /**
109
+ * mathes
110
+ * xxx.xxx.xxx.xxx
111
+ * xxx.xxx.xxx.xxx:port
112
+ * http://xxx.xxx.xxx.xxx:port
113
+ * http://xxx.xxx.xxx.xxx
114
+ * https://xxx.xxx.xxx.xxx:port
115
+ * https://xxx.xxx.xxx.xxx *
116
+ */
117
+ get forStringWithIpHost() {
118
+ const regex = /(http(s)?\:\/\/)?(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\:[0-9]+)?/;
119
+ return regex;
120
+ },
121
+ /**
122
+ * mathes
123
+ * http://domain.com:port
124
+ * http://domain.com
125
+ * http://domain:port
126
+ * http://domain
127
+ * https://domain.com:port
128
+ * https://domain.com
129
+ * https://domain:port
130
+ * https://domain
131
+ */
132
+ get forStringWithDomainHost() {
133
+ const regex = /(((http(s)?\:\/\/)?[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9](?:\.[a-zA-Z]{2,})+(\:[0-9]+)?)|((http(s)?\:\/\/)[a-zA-Z0-9-]{1,61}))/;
134
+ return regex;
135
+ }
136
+ };
137
+ }
138
+ }
139
+
140
+ class HelpersEnvironment {
141
+ environmentName(filename, local_env_name) {
142
+ }
143
+ isValidGitRepuUrl(url) {
144
+ const regex = /^([A-Za-z0-9]+@|http(|s)\:\/\/)([A-Za-z0-9.]+(:\d+)?)(?::|\/)([\d\/\w.-]+?)(\.git)?$/;
145
+ const res = regex.test(url);
146
+ return res;
147
+ }
148
+ isValidIp(ip) {
149
+ if (!_.isString(ip)) {
150
+ return false;
151
+ }
152
+ ip = ip.trim();
153
+ if (ip === 'localhost') {
154
+ return true;
155
+ }
156
+ return /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ip);
157
+ }
158
+ }
159
+
160
+ class HelpersStrings {
161
+ /**
162
+ * Example:
163
+ *
164
+ * const result = interpolateString("I'm {age} years old!")
165
+ * .withParameters({ age: 29 });
166
+ *
167
+ * const result = interpolateString("The {a} says {n}, {n}, {n}!")
168
+ * .withParameters({ a: 'cow', n: 'moo' });
169
+ *
170
+ *
171
+ * @param value string to interpolate
172
+ * @param parameters object with parametes
173
+ */
174
+ interpolateString(value) {
175
+ if (typeof value !== 'string') {
176
+ console.warn('[ss-logic][helper] Value for interpolation is not string: ', value);
177
+ return value;
178
+ }
179
+ return {
180
+ withParameters(parameters) {
181
+ if (typeof parameters !== 'object') {
182
+ console.warn('[ss-logic][helper] Parameters are not a object: ', parameters);
183
+ return value;
184
+ }
185
+ return value.replace(/{([^{}]*)}/g, function (a, b) {
186
+ var r = parameters[b];
187
+ return typeof r === 'string' || typeof r === 'number' ? r : a;
188
+ });
189
+ }
190
+ };
191
+ }
192
+ numValue(pixelsCss) {
193
+ // tslint:disable-next-line:radix
194
+ return parseInt(pixelsCss.replace('px', ''));
195
+ }
196
+ /**
197
+ * examples:
198
+ * 'aa bb bb' => ['aa','bb','cc'],
199
+ * 'aa' => ['aa']
200
+ * ['aa'] => ['aa']
201
+ */
202
+ splitIfNeed(stringOrArr) {
203
+ let res = [];
204
+ if (_.isArray(stringOrArr)) {
205
+ res = stringOrArr.map(s => {
206
+ return s.trim();
207
+ });
208
+ }
209
+ if (_.isString(stringOrArr)) {
210
+ res = stringOrArr.split(/\s*[\s,]\s*/);
211
+ }
212
+ return res.filter(f => !!f && (f.trim() !== ''));
213
+ }
214
+ removeDoubleOrMoreEmptyLines(s) {
215
+ s = s === null || s === void 0 ? void 0 : s.split('\n').map(f => f.trimRight()).join('\n');
216
+ return s === null || s === void 0 ? void 0 : s.replace(/(\r\n|\r|\n){2,}/g, '$1\n');
217
+ }
218
+ }
219
+
220
+ function conditionWait(conditionAndTimeout) {
221
+ return __awaiter(this, void 0, void 0, function* () {
222
+ yield waitFor(conditionAndTimeout);
223
+ });
224
+ }
225
+ function waitFor(arr, messageToShow = void 0) {
226
+ return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
227
+ if (arr.length === 0) {
228
+ resolve(void 0);
229
+ }
230
+ else {
231
+ // console.log(arr.length)
232
+ const check = arr.shift();
233
+ if (_.isUndefined(check.timeoutCheck)) {
234
+ check.timeoutCheck = 2000;
235
+ }
236
+ if (_.isUndefined(check.timeoutNext)) {
237
+ check.timeoutNext = 4000;
238
+ }
239
+ const { timeoutCheck, timeoutNext, name } = check;
240
+ // console.log(`timeoutCheck: ${timeoutCheck}`);
241
+ // console.log(`timeoutNext: ${timeoutNext}`);
242
+ // console.log(`Checking: ${name}`)
243
+ const resultTrue = yield Helpers.runSyncOrAsync(check.callback, check);
244
+ // console.log(`after: ${name}`)
245
+ if (resultTrue) {
246
+ // console.log(`timeout 1 is set to ${timeoutNext}`)
247
+ setTimeout(() => __awaiter(this, void 0, void 0, function* () {
248
+ // console.log(`timeout 1 is over`)
249
+ yield waitFor(arr).then(() => {
250
+ resolve(void 0);
251
+ });
252
+ }), timeoutNext);
253
+ }
254
+ else {
255
+ arr.unshift(check);
256
+ if (!messageToShow || check.errorMessage !== messageToShow) {
257
+ Helpers.info(check.errorMessage);
258
+ }
259
+ else {
260
+ // console.log(`dont show error message ${check.errorMessage}`)
261
+ }
262
+ // console.log(`timeout 2 is set to ${timeoutCheck}, arr.length is ${arr.length}`)
263
+ setTimeout(() => __awaiter(this, void 0, void 0, function* () {
264
+ // console.log(`timeout 2 ${timeoutCheck} ovef`)
265
+ yield waitFor(arr, check.errorMessage).then(() => {
266
+ resolve(void 0);
267
+ });
268
+ }), timeoutCheck);
269
+ }
270
+ }
271
+ }));
272
+ }
273
+
274
+ function applyMixins(derivedCtor, baseCtors) {
275
+ baseCtors.forEach(baseCtor => {
276
+ Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
277
+ Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name));
278
+ });
279
+ });
280
+ }
281
+ // @ts-ignore
282
+ class HelpersTnp extends CoreHelpers {
283
+ constructor(arrays = new HelpersArrayObj(), strings = new HelpersStrings()) {
284
+ super();
285
+ this.arrays = arrays;
286
+ this.strings = strings;
287
+ this.conditionWait = conditionWait;
288
+ this.applyMixins = applyMixins;
289
+ }
290
+ static get Instance() {
291
+ if (!HelpersTnp._instance) {
292
+ HelpersTnp._instance = new HelpersTnp();
293
+ }
294
+ return HelpersTnp._instance;
295
+ }
296
+ CLIWRAP(f, name) {
297
+ CLASS.setName(f, name);
298
+ return f;
299
+ }
300
+ isElevated() {
301
+ return __awaiter(this, void 0, void 0, function* () {
302
+ });
303
+ }
304
+ mesureExectionInMs(description, functionToExecute, ...functionArguments) {
305
+ return __awaiter(this, void 0, void 0, function* () {
306
+ var start = new Date();
307
+ yield Helpers.runSyncOrAsync(functionToExecute, ...functionArguments);
308
+ //@ts-ignore
309
+ var end = new Date() - start;
310
+ if (Morphi.IsBrowser) {
311
+ Helpers.info(`Execution time: ${end.toString()}ms for "${description}"`);
312
+ }
313
+ return end;
314
+ });
315
+ }
316
+ mesureExectionInMsSync(description, functionToExecute) {
317
+ var start = new Date();
318
+ functionToExecute();
319
+ //@ts-ignore
320
+ var end = new Date() - start;
321
+ if (Morphi.IsBrowser) {
322
+ Helpers.info(`Execution time: ${end.toString()}ms for "${description}"`);
323
+ }
324
+ return end;
325
+ }
326
+ waitForCondition(conditionFn, howOfftenCheckInMs = 1000) {
327
+ return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
328
+ const result = yield Helpers.runSyncOrAsync(conditionFn);
329
+ if (result) {
330
+ resolve(void 0);
331
+ }
332
+ else {
333
+ setTimeout(() => {
334
+ Helpers.waitForCondition(conditionFn, howOfftenCheckInMs).then(() => {
335
+ resolve(void 0);
336
+ });
337
+ }, howOfftenCheckInMs);
338
+ }
339
+ }));
340
+ }
341
+ getBrowserVerPath(moduleName) {
342
+ }
343
+ getMethodName(obj, method) {
344
+ var methodName = null;
345
+ Object.getOwnPropertyNames(obj).forEach(prop => {
346
+ if (obj[prop] === method) {
347
+ methodName = prop;
348
+ }
349
+ });
350
+ if (methodName !== null) {
351
+ return methodName;
352
+ }
353
+ var proto = Object.getPrototypeOf(obj);
354
+ if (proto) {
355
+ return Helpers.getMethodName(proto, method);
356
+ }
357
+ return null;
358
+ }
359
+ fixWebpackEnv(env) {
360
+ _.forIn(env, (v, k) => {
361
+ const value = v;
362
+ if (value === 'true')
363
+ env[k] = true;
364
+ if (value === 'false')
365
+ env[k] = false;
366
+ });
367
+ }
368
+ }
369
+ applyMixins(HelpersTnp, [
370
+ HelpersStringsRegexes,
371
+ HelpersEnvironment,
372
+ ]);
373
+
374
+ const BaselineSiteJoinprefix = '__';
375
+
376
+ const Helpers$1 = HelpersTnp.Instance;
377
+ class Project {
378
+ constructor() {
379
+ this.cache = {};
380
+ this.browser = {};
381
+ }
382
+ static typeFrom(location) {
383
+ return (void 0);
384
+ }
385
+ static unload(project) {
386
+ Project.projects = Project.projects.filter(f => f !== project);
387
+ }
388
+ static From(location) {
389
+ return (void 0);
390
+ }
391
+ static nearestTo(absoluteLocation, options) {
392
+ return (void 0);
393
+ }
394
+ static allProjectFrom(absoluteLocation, stopOnCwd = '/') {
395
+ return (void 0);
396
+ }
397
+ static DefaultPortByType(type) {
398
+ if (type === 'workspace') {
399
+ return 5000;
400
+ }
401
+ if (type === 'angular-client') {
402
+ return 4300;
403
+ }
404
+ if (type === 'angular-lib') {
405
+ return 4250;
406
+ }
407
+ if (type === 'electron-client') {
408
+ return 4350;
409
+ }
410
+ if (type === 'ionic-client') {
411
+ return 8080;
412
+ }
413
+ if (type === 'docker') {
414
+ return 5000;
415
+ }
416
+ if (type === 'isomorphic-lib') {
417
+ return 4000;
418
+ }
419
+ if (type === 'container' || type === 'unknow-npm-project') {
420
+ return;
421
+ }
422
+ }
423
+ static get isBundleMode() {
424
+ if (Helpers$1.isBrowser) {
425
+ return true;
426
+ }
427
+ }
428
+ static get Current() {
429
+ return (void 0);
430
+ }
431
+ static get Tnp() {
432
+ return (void 0);
433
+ }
434
+ static by(libraryType, version) {
435
+ return (void 0);
436
+ }
437
+ defineProperty(variableName, classFn) {
438
+ return (void 0);
439
+ }
440
+ setType(type) {
441
+ // @ts-ignore
442
+ this._type = type;
443
+ }
444
+ typeIs(...types) {
445
+ return this._type && types.includes(this._type);
446
+ }
447
+ typeIsNot(...types) {
448
+ return !this.typeIs(...types);
449
+ }
450
+ forEmptyStructure() {
451
+ return [
452
+ { relativePath: config.file.package_json, includeContent: true },
453
+ { relativePath: config.folder.src },
454
+ ];
455
+ }
456
+ }
457
+ Project.projects = [];
458
+ /**
459
+ * To speed up checking folder I am keeping pathes for alterdy checked folder
460
+ * This may break things that are creating new projects
461
+ */
462
+ Project.emptyLocations = [];
463
+
464
+ class BaseComponent {
465
+ constructor() {
466
+ // @ts-ignore
467
+ this.model = {};
468
+ this.handlers = [];
469
+ }
470
+ ngOnDestroy() {
471
+ this.handlers.forEach(h => h.unsubscribe());
472
+ this.handlers.length = 0;
473
+ }
474
+ }
475
+ BaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: BaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
476
+ BaseComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.4", type: BaseComponent, selector: "app-base-component-meta", inputs: { model: "model" }, ngImport: i0, template: '<div></div>', isInline: true });
477
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: BaseComponent, decorators: [{
478
+ type: Component,
479
+ args: [{
480
+ selector: 'app-base-component-meta',
481
+ template: '<div></div>'
482
+ }]
483
+ }], propDecorators: { model: [{
484
+ type: Input
485
+ }] } });
486
+ const isCalledNgInitAfterInternalRefresh = Symbol();
487
+ class BaseComponentForRouter extends BaseComponent {
488
+ constructor(__router) {
489
+ super();
490
+ this.__router = __router;
491
+ this[isCalledNgInitAfterInternalRefresh] = false;
492
+ }
493
+ isCalledNgInitAfterInternalRefresh() {
494
+ return !!this[isCalledNgInitAfterInternalRefresh];
495
+ }
496
+ reloadNgOninitOnUrlChange() {
497
+ this.handlers.push(this.__router.events.subscribe(event => {
498
+ if (event instanceof NavigationEnd && this['ngOnInit']) {
499
+ this[isCalledNgInitAfterInternalRefresh] = true;
500
+ this['ngOnInit']();
501
+ if (this[isCalledNgInitAfterInternalRefresh]) {
502
+ this[isCalledNgInitAfterInternalRefresh] = false;
503
+ }
504
+ }
505
+ }));
506
+ }
507
+ }
508
+
509
+ const log$2 = Log.create(`DualComponentController`);
510
+ class DualComponentController {
511
+ constructor(cmp, isFormlyMode = false) {
512
+ this.cmp = cmp;
513
+ this.isFormlyMode = isFormlyMode;
514
+ }
515
+ getValTemplateOptions(propertyName) {
516
+ var _a;
517
+ if (this.isFormlyMode) {
518
+ const res = (_a = this.cmp.field) === null || _a === void 0 ? void 0 : _a.templateOptions[propertyName];
519
+ if (res === void 0 && this.cmp[propertyName]) {
520
+ return this.cmp[propertyName];
521
+ }
522
+ return res;
523
+ }
524
+ return this.cmp[propertyName];
525
+ }
526
+ getValContext(propertyName) {
527
+ var _a;
528
+ if (this.isFormlyMode) {
529
+ const res = (_a = this.cmp) === null || _a === void 0 ? void 0 : _a.field[propertyName];
530
+ if (res === void 0 && this.cmp[propertyName]) {
531
+ return this.cmp[propertyName];
532
+ }
533
+ return res;
534
+ }
535
+ return this.cmp[propertyName];
536
+ }
537
+ get disabled() {
538
+ return this.getValTemplateOptions('disabled');
539
+ }
540
+ get required() {
541
+ return this.getValTemplateOptions('required');
542
+ }
543
+ get type() {
544
+ if (!this.isFormlyMode) {
545
+ return CLASS.getNameFromObject(this.cmp);
546
+ }
547
+ return this.getValContext('type');
548
+ }
549
+ get label() {
550
+ return this.getValTemplateOptions('label');
551
+ }
552
+ get placeholder() {
553
+ return this.getValTemplateOptions('placeholder');
554
+ }
555
+ get defaultValue() {
556
+ return this.getValContext('defaultValue');
557
+ }
558
+ get formControl() {
559
+ return this.getValContext('formControl');
560
+ }
561
+ get key() {
562
+ return this.getValContext('key');
563
+ }
564
+ get path() {
565
+ return this.getValContext('path');
566
+ }
567
+ get model() {
568
+ if (this.isFormlyMode) {
569
+ return this.getValContext('model');
570
+ }
571
+ else {
572
+ return this.__model;
573
+ }
574
+ }
575
+ set model(v) {
576
+ if (this.isFormlyMode) {
577
+ log$2.w(`[DualComponentController] You can't set model in formly component mode`);
578
+ }
579
+ else {
580
+ this.__model = v;
581
+ }
582
+ }
583
+ get mode() {
584
+ if (this.isFormlyMode) {
585
+ return this.getValContext('mode');
586
+ }
587
+ else {
588
+ return this.__mode;
589
+ }
590
+ }
591
+ set mode(v) {
592
+ if (this.isFormlyMode) {
593
+ // this.cmp.field.mode =
594
+ // log.w(`[DualComponentController] You can't set mode in formly component mode`);
595
+ }
596
+ else {
597
+ this.__mode = v;
598
+ }
599
+ }
600
+ get value() {
601
+ if (this.isFormlyMode) {
602
+ return this.cmp.field.formControl.value;
603
+ }
604
+ if (_.isString(this.path)) {
605
+ return _.get(this.cmp.model, this.path);
606
+ }
607
+ return this.cmp.model;
608
+ }
609
+ set value(v) {
610
+ if (this.isFormlyMode) {
611
+ this.cmp.field.formControl.setValue(v);
612
+ this.cmp.change.next(v);
613
+ return;
614
+ }
615
+ if (_.isString(this.path)) {
616
+ _.set(this.cmp.model, this.path, v);
617
+ }
618
+ else {
619
+ this.cmp.model = v;
620
+ }
621
+ }
622
+ }
623
+
624
+ const log$1 = Log.create('base formly component', Level.__NOTHING);
625
+ class BaseFormlyComponent extends FieldType {
626
+ constructor() {
627
+ super(...arguments);
628
+ this.DualComponentController = DualComponentController;
629
+ this.ctrl = {};
630
+ this.change = new EventEmitter();
631
+ // @ts-ignore
632
+ // @Input() formControl: FormControl; // TODO QUICK_FIX
633
+ this.handlers = [];
634
+ this.__field = {
635
+ templateOptions: {}
636
+ };
637
+ }
638
+ // @ts-ignore
639
+ get mode() {
640
+ return this.ctrl.mode;
641
+ }
642
+ // @ts-ignore
643
+ set mode(v) {
644
+ this.ctrl.mode = v;
645
+ }
646
+ // @ts-ignore
647
+ set model(v) {
648
+ this.ctrl.model = v;
649
+ }
650
+ get model() {
651
+ return this.ctrl.model;
652
+ }
653
+ // @ts-ignore
654
+ set key(value) {
655
+ if (this.ctrl && this.ctrl.isFormlyMode) {
656
+ return;
657
+ }
658
+ this.path = value;
659
+ }
660
+ get key() {
661
+ if (this.ctrl && this.ctrl.isFormlyMode) {
662
+ return this.field.key;
663
+ }
664
+ return this.path;
665
+ }
666
+ ngOnDestroy() {
667
+ this.handlers.forEach(h => h.unsubscribe());
668
+ this.handlers.length = 0;
669
+ }
670
+ ngAfterViewInit() {
671
+ }
672
+ // _model: any;
673
+ ngOnInit() {
674
+ // console.log('model', this.model)
675
+ // console.log('ket', this.key)
676
+ const isFormlyMode = !!this.field;
677
+ log$1.i(`isFormlyMode: ${isFormlyMode}`);
678
+ if (!isFormlyMode) {
679
+ const that = this;
680
+ Object.defineProperty(this, 'field', {
681
+ get: function () {
682
+ return that.__field;
683
+ },
684
+ set: function (v) {
685
+ that.__field = v;
686
+ }
687
+ });
688
+ }
689
+ const existed = this.ctrl;
690
+ this.ctrl = new this.DualComponentController(this, isFormlyMode);
691
+ // @ts-ignore
692
+ Object.keys(existed).forEach(key => {
693
+ this.ctrl[key] = existed[key];
694
+ });
695
+ // if (!this.formControl) {
696
+ // this.formControl = new FormControl({})
697
+ // Object.defineProperty(this, 'field', {
698
+ // get: () => {
699
+ // return {
700
+ // formControl: this.formControl
701
+ // } as FormlyFieldConfig
702
+ // }
703
+ // })
704
+ // // this.formControl = new FormControl({})
705
+ // }
706
+ // @ts-ignore
707
+ this.change.next(this.ctrl.value);
708
+ }
709
+ }
710
+ BaseFormlyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: BaseFormlyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
711
+ BaseFormlyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.4", type: BaseFormlyComponent, selector: "app-base-formly-component-meta", inputs: { pizda: "pizda", mode: "mode", disabled: "disabled", required: "required", label: "label", placeholder: "placeholder", defaultValue: "defaultValue", model: "model", path: "path", key: "key" }, outputs: { change: "change" }, usesInheritance: true, ngImport: i0, template: `<div></div>`, isInline: true });
712
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: BaseFormlyComponent, decorators: [{
713
+ type: Component,
714
+ args: [{
715
+ selector: 'app-base-formly-component-meta',
716
+ template: `<div></div>`
717
+ }]
718
+ }], propDecorators: { pizda: [{
719
+ type: Input
720
+ }], mode: [{
721
+ type: Input
722
+ }], disabled: [{
723
+ type: Input
724
+ }], required: [{
725
+ type: Input
726
+ }], label: [{
727
+ type: Input
728
+ }], placeholder: [{
729
+ type: Input
730
+ }], defaultValue: [{
731
+ type: Input
732
+ }], model: [{
733
+ type: Input
734
+ }], path: [{
735
+ type: Input
736
+ }], change: [{
737
+ type: Output
738
+ }], key: [{
739
+ type: Input
740
+ }] } });
741
+
742
+ class ResizeService {
743
+ constructor() {
744
+ this.resizeDetector = elementResizeDetectorMaker({ strategy: 'scroll' });
745
+ }
746
+ addResizeEventListener(element, handler) {
747
+ this.resizeDetector.listenTo(element, handler);
748
+ }
749
+ removeResizeEventListener(element) {
750
+ this.resizeDetector.uninstall(element);
751
+ }
752
+ }
753
+ ResizeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: ResizeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
754
+ ResizeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: ResizeService });
755
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: ResizeService, decorators: [{
756
+ type: Injectable
757
+ }], ctorParameters: function () { return []; } });
758
+
759
+ const log = Log.create(`[tnp-helpers] long-press`, Level.__NOTHING);
760
+ class LongPress {
761
+ constructor() {
762
+ this.pressDuration = 1000;
763
+ this.onLongPress = new EventEmitter();
764
+ this.onLongPressing = new EventEmitter();
765
+ this.onLongPressEnd = new EventEmitter();
766
+ this.mouseX = 0;
767
+ this.mouseY = 0;
768
+ this.allowTrigger = false;
769
+ this.triggerEnd = _.debounce(() => {
770
+ this.endPress();
771
+ }, 500);
772
+ }
773
+ get press() { return this.pressing; }
774
+ get longPress() { return this.longPressing; }
775
+ onMouseDown(event) {
776
+ // don't do right/middle clicks
777
+ log.d(`MOUSE DOWN `);
778
+ if (event.which !== 1)
779
+ return;
780
+ this.allowTrigger = true;
781
+ this.mouseX = event.clientX;
782
+ this.mouseY = event.clientY;
783
+ this.pressing = true;
784
+ this.longPressing = false;
785
+ this.timeout = setTimeout(() => {
786
+ if (this.allowTrigger) {
787
+ this.longPressing = true;
788
+ log.d(`long pressing start pressDuration:${this.pressDuration} `);
789
+ this.onLongPress.emit(event);
790
+ this.loop(event);
791
+ }
792
+ }, this.pressDuration);
793
+ this.loop(event);
794
+ }
795
+ onMouseMove(event) {
796
+ if (this.pressing && !this.longPressing) {
797
+ const xThres = (event.clientX - this.mouseX) > 10;
798
+ const yThres = (event.clientY - this.mouseY) > 10;
799
+ if (xThres || yThres) {
800
+ this.endPress();
801
+ }
802
+ }
803
+ }
804
+ loop(event) {
805
+ if (this.longPressing) {
806
+ this.timeout = setTimeout(() => {
807
+ log.d(`emil longpressing`);
808
+ this.triggerEnd();
809
+ this.onLongPressing.emit(event);
810
+ this.loop(event);
811
+ }, 50);
812
+ }
813
+ }
814
+ endPress(emit = true) {
815
+ this.allowTrigger = false;
816
+ clearTimeout(this.timeout);
817
+ this.longPressing = false;
818
+ this.pressing = false;
819
+ if (emit) {
820
+ log.d(`EMIT END`);
821
+ this.onLongPressEnd.emit(true);
822
+ }
823
+ else {
824
+ log.d(`NOT EMIT END`);
825
+ }
826
+ }
827
+ onMouseUp() {
828
+ this.endPress(false);
829
+ }
830
+ }
831
+ LongPress.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: LongPress, deps: [], target: i0.ɵɵFactoryTarget.Directive });
832
+ LongPress.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.4", type: LongPress, selector: "[long-press]", inputs: { pressDuration: "pressDuration" }, outputs: { onLongPress: "onLongPress", onLongPressing: "onLongPressing", onLongPressEnd: "onLongPressEnd" }, host: { listeners: { "mousedown": "onMouseDown($event)", "mousemove": "onMouseMove($event)", "mouseup": "onMouseUp()" }, properties: { "class.press": "this.press", "class.longpress": "this.longPress" } }, ngImport: i0 });
833
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: LongPress, decorators: [{
834
+ type: Directive,
835
+ args: [{ selector: '[long-press]' }]
836
+ }], propDecorators: { pressDuration: [{
837
+ type: Input
838
+ }], onLongPress: [{
839
+ type: Output
840
+ }], onLongPressing: [{
841
+ type: Output
842
+ }], onLongPressEnd: [{
843
+ type: Output
844
+ }], press: [{
845
+ type: HostBinding,
846
+ args: ['class.press']
847
+ }], longPress: [{
848
+ type: HostBinding,
849
+ args: ['class.longpress']
850
+ }], onMouseDown: [{
851
+ type: HostListener,
852
+ args: ['mousedown', ['$event']]
853
+ }], onMouseMove: [{
854
+ type: HostListener,
855
+ args: ['mousemove', ['$event']]
856
+ }], onMouseUp: [{
857
+ type: HostListener,
858
+ args: ['mouseup']
859
+ }] } });
860
+
861
+ // export * from './git-project';
862
+ const Helpers = HelpersTnp.Instance;
863
+
864
+ /**
865
+ * Generated bundle index. Do not edit.
866
+ */
867
+
868
+ export { BaseComponent, BaseComponentForRouter, BaseFormlyComponent, BaselineSiteJoinprefix, DualComponentController, Helpers, LongPress, Project, ResizeService };
869
+ //# sourceMappingURL=tnp-helpers.mjs.map