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