@ibgib/core-gib 0.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 (330) hide show
  1. package/.vscode/core-gib-snippets.code-snippets +189 -0
  2. package/.vscode/launch.json +24 -0
  3. package/.vscode/settings.json +56 -0
  4. package/.vscode/tasks.json +37 -0
  5. package/CHANGELOG.md +11 -0
  6. package/README.md +215 -0
  7. package/dist/common/aws-constants.d.mts +7 -0
  8. package/dist/common/aws-constants.d.mts.map +1 -0
  9. package/dist/common/aws-constants.mjs +7 -0
  10. package/dist/common/aws-constants.mjs.map +1 -0
  11. package/dist/common/bin/bin-types.d.mts +17 -0
  12. package/dist/common/bin/bin-types.d.mts.map +1 -0
  13. package/dist/common/bin/bin-types.mjs +3 -0
  14. package/dist/common/bin/bin-types.mjs.map +1 -0
  15. package/dist/common/cache/cache-types.d.mts +57 -0
  16. package/dist/common/cache/cache-types.d.mts.map +1 -0
  17. package/dist/common/cache/cache-types.mjs +2 -0
  18. package/dist/common/cache/cache-types.mjs.map +1 -0
  19. package/dist/common/comment/comment-constants.d.mts +11 -0
  20. package/dist/common/comment/comment-constants.d.mts.map +1 -0
  21. package/dist/common/comment/comment-constants.mjs +11 -0
  22. package/dist/common/comment/comment-constants.mjs.map +1 -0
  23. package/dist/common/comment/comment-helper.d.mts +59 -0
  24. package/dist/common/comment/comment-helper.d.mts.map +1 -0
  25. package/dist/common/comment/comment-helper.mjs +173 -0
  26. package/dist/common/comment/comment-helper.mjs.map +1 -0
  27. package/dist/common/comment/comment-types.d.mts +16 -0
  28. package/dist/common/comment/comment-types.d.mts.map +1 -0
  29. package/dist/common/comment/comment-types.mjs +2 -0
  30. package/dist/common/comment/comment-types.mjs.map +1 -0
  31. package/dist/common/display/display-helper.d.mts +19 -0
  32. package/dist/common/display/display-helper.d.mts.map +1 -0
  33. package/dist/common/display/display-helper.mjs +68 -0
  34. package/dist/common/display/display-helper.mjs.map +1 -0
  35. package/dist/common/display/display-types.d.mts +97 -0
  36. package/dist/common/display/display-types.d.mts.map +1 -0
  37. package/dist/common/display/display-types.mjs +37 -0
  38. package/dist/common/display/display-types.mjs.map +1 -0
  39. package/dist/common/encrypt/encrypt-constants.d.mts +27 -0
  40. package/dist/common/encrypt/encrypt-constants.d.mts.map +1 -0
  41. package/dist/common/encrypt/encrypt-constants.mjs +27 -0
  42. package/dist/common/encrypt/encrypt-constants.mjs.map +1 -0
  43. package/dist/common/encrypt/encrypt-types.d.mts +116 -0
  44. package/dist/common/encrypt/encrypt-types.d.mts.map +1 -0
  45. package/dist/common/encrypt/encrypt-types.mjs +9 -0
  46. package/dist/common/encrypt/encrypt-types.mjs.map +1 -0
  47. package/dist/common/error/error-constants.d.mts +9 -0
  48. package/dist/common/error/error-constants.d.mts.map +1 -0
  49. package/dist/common/error/error-constants.mjs +9 -0
  50. package/dist/common/error/error-constants.mjs.map +1 -0
  51. package/dist/common/error/error-helper.d.mts +43 -0
  52. package/dist/common/error/error-helper.d.mts.map +1 -0
  53. package/dist/common/error/error-helper.mjs +167 -0
  54. package/dist/common/error/error-helper.mjs.map +1 -0
  55. package/dist/common/error/error-types.d.mts +58 -0
  56. package/dist/common/error/error-types.d.mts.map +1 -0
  57. package/dist/common/error/error-types.mjs +2 -0
  58. package/dist/common/error/error-types.mjs.map +1 -0
  59. package/dist/common/form/form-helper.d.mts +97 -0
  60. package/dist/common/form/form-helper.d.mts.map +1 -0
  61. package/dist/common/form/form-helper.mjs +185 -0
  62. package/dist/common/form/form-helper.mjs.map +1 -0
  63. package/dist/common/form/form-items.d.mts +229 -0
  64. package/dist/common/form/form-items.d.mts.map +1 -0
  65. package/dist/common/form/form-items.mjs +63 -0
  66. package/dist/common/form/form-items.mjs.map +1 -0
  67. package/dist/common/import-export/import-export-types.d.mts +18 -0
  68. package/dist/common/import-export/import-export-types.d.mts.map +1 -0
  69. package/dist/common/import-export/import-export-types.mjs +2 -0
  70. package/dist/common/import-export/import-export-types.mjs.map +1 -0
  71. package/dist/common/legacy/legacy-types.d.mts +2 -0
  72. package/dist/common/legacy/legacy-types.d.mts.map +1 -0
  73. package/dist/common/legacy/legacy-types.mjs +2 -0
  74. package/dist/common/legacy/legacy-types.mjs.map +1 -0
  75. package/dist/common/link/link-constants.d.mts +2 -0
  76. package/dist/common/link/link-constants.d.mts.map +1 -0
  77. package/dist/common/link/link-constants.mjs +2 -0
  78. package/dist/common/link/link-constants.mjs.map +1 -0
  79. package/dist/common/link/link-helper.d.mts +37 -0
  80. package/dist/common/link/link-helper.d.mts.map +1 -0
  81. package/dist/common/link/link-helper.mjs +143 -0
  82. package/dist/common/link/link-helper.mjs.map +1 -0
  83. package/dist/common/link/link-types.d.mts +14 -0
  84. package/dist/common/link/link-types.d.mts.map +1 -0
  85. package/dist/common/link/link-types.mjs +2 -0
  86. package/dist/common/link/link-types.mjs.map +1 -0
  87. package/dist/common/other/graph-helper.d.mts +166 -0
  88. package/dist/common/other/graph-helper.d.mts.map +1 -0
  89. package/dist/common/other/graph-helper.mjs +710 -0
  90. package/dist/common/other/graph-helper.mjs.map +1 -0
  91. package/dist/common/other/ibgib-helper.d.mts +245 -0
  92. package/dist/common/other/ibgib-helper.d.mts.map +1 -0
  93. package/dist/common/other/ibgib-helper.mjs +641 -0
  94. package/dist/common/other/ibgib-helper.mjs.map +1 -0
  95. package/dist/common/other/other-constants.d.mts +53 -0
  96. package/dist/common/other/other-constants.d.mts.map +1 -0
  97. package/dist/common/other/other-constants.mjs +67 -0
  98. package/dist/common/other/other-constants.mjs.map +1 -0
  99. package/dist/common/other/other-types.d.mts +166 -0
  100. package/dist/common/other/other-types.d.mts.map +1 -0
  101. package/dist/common/other/other-types.mjs +30 -0
  102. package/dist/common/other/other-types.mjs.map +1 -0
  103. package/dist/common/other/svg-constants.d.mts +2 -0
  104. package/dist/common/other/svg-constants.d.mts.map +1 -0
  105. package/dist/common/other/svg-constants.mjs +2 -0
  106. package/dist/common/other/svg-constants.mjs.map +1 -0
  107. package/dist/common/other/svg-helper.d.mts +54 -0
  108. package/dist/common/other/svg-helper.d.mts.map +1 -0
  109. package/dist/common/other/svg-helper.mjs +170 -0
  110. package/dist/common/other/svg-helper.mjs.map +1 -0
  111. package/dist/common/pic/pic-constants.d.mts +13 -0
  112. package/dist/common/pic/pic-constants.d.mts.map +1 -0
  113. package/dist/common/pic/pic-constants.mjs +13 -0
  114. package/dist/common/pic/pic-constants.mjs.map +1 -0
  115. package/dist/common/pic/pic-helper.d.mts +70 -0
  116. package/dist/common/pic/pic-helper.d.mts.map +1 -0
  117. package/dist/common/pic/pic-helper.mjs +235 -0
  118. package/dist/common/pic/pic-helper.mjs.map +1 -0
  119. package/dist/common/pic/pic-types.d.mts +23 -0
  120. package/dist/common/pic/pic-types.d.mts.map +1 -0
  121. package/dist/common/pic/pic-types.mjs +2 -0
  122. package/dist/common/pic/pic-types.mjs.map +1 -0
  123. package/dist/common/root/root-constants.d.mts +40 -0
  124. package/dist/common/root/root-constants.d.mts.map +1 -0
  125. package/dist/common/root/root-constants.mjs +40 -0
  126. package/dist/common/root/root-constants.mjs.map +1 -0
  127. package/dist/common/root/root-types.d.mts +9 -0
  128. package/dist/common/root/root-types.d.mts.map +1 -0
  129. package/dist/common/root/root-types.mjs +2 -0
  130. package/dist/common/root/root-types.mjs.map +1 -0
  131. package/dist/common/tag/tag-constants.d.mts +21 -0
  132. package/dist/common/tag/tag-constants.d.mts.map +1 -0
  133. package/dist/common/tag/tag-constants.mjs +28 -0
  134. package/dist/common/tag/tag-constants.mjs.map +1 -0
  135. package/dist/common/tag/tag-types.d.mts +14 -0
  136. package/dist/common/tag/tag-types.d.mts.map +1 -0
  137. package/dist/common/tag/tag-types.mjs +2 -0
  138. package/dist/common/tag/tag-types.mjs.map +1 -0
  139. package/dist/core-constants.d.mts +89 -0
  140. package/dist/core-constants.d.mts.map +1 -0
  141. package/dist/core-constants.mjs +484 -0
  142. package/dist/core-constants.mjs.map +1 -0
  143. package/dist/core-helper.d.mts +6 -0
  144. package/dist/core-helper.d.mts.map +1 -0
  145. package/dist/core-helper.mjs +28 -0
  146. package/dist/core-helper.mjs.map +1 -0
  147. package/dist/core-types.d.mts +520 -0
  148. package/dist/core-types.d.mts.map +1 -0
  149. package/dist/core-types.mjs +2 -0
  150. package/dist/core-types.mjs.map +1 -0
  151. package/dist/index.d.mts +2 -0
  152. package/dist/index.d.mts.map +1 -0
  153. package/dist/index.mjs +3 -0
  154. package/dist/index.mjs.map +1 -0
  155. package/dist/witness/app/app-base-v1.d.mts +130 -0
  156. package/dist/witness/app/app-base-v1.d.mts.map +1 -0
  157. package/dist/witness/app/app-base-v1.mjs +462 -0
  158. package/dist/witness/app/app-base-v1.mjs.map +1 -0
  159. package/dist/witness/app/app-constants.d.mts +10 -0
  160. package/dist/witness/app/app-constants.d.mts.map +1 -0
  161. package/dist/witness/app/app-constants.mjs +13 -0
  162. package/dist/witness/app/app-constants.mjs.map +1 -0
  163. package/dist/witness/app/app-helper.d.mts +85 -0
  164. package/dist/witness/app/app-helper.d.mts.map +1 -0
  165. package/dist/witness/app/app-helper.mjs +258 -0
  166. package/dist/witness/app/app-helper.mjs.map +1 -0
  167. package/dist/witness/app/app-types.d.mts +211 -0
  168. package/dist/witness/app/app-types.d.mts.map +1 -0
  169. package/dist/witness/app/app-types.mjs +49 -0
  170. package/dist/witness/app/app-types.mjs.map +1 -0
  171. package/dist/witness/app/chat-app/chat-app-types.d.mts +18 -0
  172. package/dist/witness/app/chat-app/chat-app-types.d.mts.map +1 -0
  173. package/dist/witness/app/chat-app/chat-app-types.mjs +25 -0
  174. package/dist/witness/app/chat-app/chat-app-types.mjs.map +1 -0
  175. package/dist/witness/app/flash-app/flash-app-types.d.mts +16 -0
  176. package/dist/witness/app/flash-app/flash-app-types.d.mts.map +1 -0
  177. package/dist/witness/app/flash-app/flash-app-types.mjs +23 -0
  178. package/dist/witness/app/flash-app/flash-app-types.mjs.map +1 -0
  179. package/dist/witness/app/raw-app/raw-app-types.d.mts +18 -0
  180. package/dist/witness/app/raw-app/raw-app-types.d.mts.map +1 -0
  181. package/dist/witness/app/raw-app/raw-app-types.mjs +25 -0
  182. package/dist/witness/app/raw-app/raw-app-types.mjs.map +1 -0
  183. package/dist/witness/app/todo-app/todo-app-types.d.ts +33 -0
  184. package/dist/witness/app/todo-app/todo-app-types.d.ts.map +1 -0
  185. package/dist/witness/app/todo-app/todo-app-types.js +31 -0
  186. package/dist/witness/app/todo-app/todo-app-types.js.map +1 -0
  187. package/dist/witness/robbot/robbot-base-v1.d.ts +432 -0
  188. package/dist/witness/robbot/robbot-base-v1.d.ts.map +1 -0
  189. package/dist/witness/robbot/robbot-base-v1.js +1407 -0
  190. package/dist/witness/robbot/robbot-base-v1.js.map +1 -0
  191. package/dist/witness/robbot/robbot-constants.d.mts +24 -0
  192. package/dist/witness/robbot/robbot-constants.d.mts.map +1 -0
  193. package/dist/witness/robbot/robbot-constants.mjs +24 -0
  194. package/dist/witness/robbot/robbot-constants.mjs.map +1 -0
  195. package/dist/witness/robbot/robbot-helper.d.mts +152 -0
  196. package/dist/witness/robbot/robbot-helper.d.mts.map +1 -0
  197. package/dist/witness/robbot/robbot-helper.mjs +609 -0
  198. package/dist/witness/robbot/robbot-helper.mjs.map +1 -0
  199. package/dist/witness/robbot/robbot-types.d.mts +539 -0
  200. package/dist/witness/robbot/robbot-types.d.mts.map +1 -0
  201. package/dist/witness/robbot/robbot-types.mjs +294 -0
  202. package/dist/witness/robbot/robbot-types.mjs.map +1 -0
  203. package/dist/witness/space/bootstrap/bootstrap-constants.d.mts +14 -0
  204. package/dist/witness/space/bootstrap/bootstrap-constants.d.mts.map +1 -0
  205. package/dist/witness/space/bootstrap/bootstrap-constants.mjs +15 -0
  206. package/dist/witness/space/bootstrap/bootstrap-constants.mjs.map +1 -0
  207. package/dist/witness/space/inner-space-v1.d.ts +63 -0
  208. package/dist/witness/space/inner-space-v1.d.ts.map +1 -0
  209. package/dist/witness/space/inner-space-v1.js +356 -0
  210. package/dist/witness/space/inner-space-v1.js.map +1 -0
  211. package/dist/witness/space/outer-space/outer-space-constants.d.mts +2 -0
  212. package/dist/witness/space/outer-space/outer-space-constants.d.mts.map +1 -0
  213. package/dist/witness/space/outer-space/outer-space-constants.mjs +2 -0
  214. package/dist/witness/space/outer-space/outer-space-constants.mjs.map +1 -0
  215. package/dist/witness/space/outer-space/outer-space-helper.d.mts +28 -0
  216. package/dist/witness/space/outer-space/outer-space-helper.d.mts.map +1 -0
  217. package/dist/witness/space/outer-space/outer-space-helper.mjs +87 -0
  218. package/dist/witness/space/outer-space/outer-space-helper.mjs.map +1 -0
  219. package/dist/witness/space/outer-space/outer-space-types.d.mts +548 -0
  220. package/dist/witness/space/outer-space/outer-space-types.d.mts.map +1 -0
  221. package/dist/witness/space/outer-space/outer-space-types.mjs +118 -0
  222. package/dist/witness/space/outer-space/outer-space-types.mjs.map +1 -0
  223. package/dist/witness/space/space-base-v1.d.mts +147 -0
  224. package/dist/witness/space/space-base-v1.d.mts.map +1 -0
  225. package/dist/witness/space/space-base-v1.mjs +350 -0
  226. package/dist/witness/space/space-base-v1.mjs.map +1 -0
  227. package/dist/witness/space/space-constants.d.mts +181 -0
  228. package/dist/witness/space/space-constants.d.mts.map +1 -0
  229. package/dist/witness/space/space-constants.mjs +192 -0
  230. package/dist/witness/space/space-constants.mjs.map +1 -0
  231. package/dist/witness/space/space-helper.d.mts +666 -0
  232. package/dist/witness/space/space-helper.d.mts.map +1 -0
  233. package/dist/witness/space/space-helper.mjs +2830 -0
  234. package/dist/witness/space/space-helper.mjs.map +1 -0
  235. package/dist/witness/space/space-types.d.mts +422 -0
  236. package/dist/witness/space/space-types.d.mts.map +1 -0
  237. package/dist/witness/space/space-types.mjs +52 -0
  238. package/dist/witness/space/space-types.mjs.map +1 -0
  239. package/dist/witness/witness-base-v1.d.ts +144 -0
  240. package/dist/witness/witness-base-v1.d.ts.map +1 -0
  241. package/dist/witness/witness-base-v1.js +300 -0
  242. package/dist/witness/witness-base-v1.js.map +1 -0
  243. package/dist/witness/witness-constants.d.mts +3 -0
  244. package/dist/witness/witness-constants.d.mts.map +1 -0
  245. package/dist/witness/witness-constants.mjs +3 -0
  246. package/dist/witness/witness-constants.mjs.map +1 -0
  247. package/dist/witness/witness-form-builder.d.mts +45 -0
  248. package/dist/witness/witness-form-builder.d.mts.map +1 -0
  249. package/dist/witness/witness-form-builder.mjs +95 -0
  250. package/dist/witness/witness-form-builder.mjs.map +1 -0
  251. package/dist/witness/witness-helper.d.mts +89 -0
  252. package/dist/witness/witness-helper.d.mts.map +1 -0
  253. package/dist/witness/witness-helper.mjs +229 -0
  254. package/dist/witness/witness-helper.mjs.map +1 -0
  255. package/dist/witness/witness-types.d.mts +211 -0
  256. package/dist/witness/witness-types.d.mts.map +1 -0
  257. package/dist/witness/witness-types.mjs +2 -0
  258. package/dist/witness/witness-types.mjs.map +1 -0
  259. package/jasmine-browser.json +18 -0
  260. package/jasmine.json +6 -0
  261. package/package.json +67 -0
  262. package/src/assumptions.spec.mts +45 -0
  263. package/src/common/aws-constants.mts +5 -0
  264. package/src/common/bin/bin-types.mts +17 -0
  265. package/src/common/cache/cache-types.mts +53 -0
  266. package/src/common/comment/comment-constants.mts +10 -0
  267. package/src/common/comment/comment-helper.mts +211 -0
  268. package/src/common/comment/comment-types.mts +19 -0
  269. package/src/common/display/display-helper.mts +88 -0
  270. package/src/common/display/display-types.mts +108 -0
  271. package/src/common/encrypt/encrypt-constants.mts +28 -0
  272. package/src/common/encrypt/encrypt-types.mts +130 -0
  273. package/src/common/error/error-constants.mts +8 -0
  274. package/src/common/error/error-helper.mts +155 -0
  275. package/src/common/error/error-types.mts +62 -0
  276. package/src/common/form/form-helper.mts +253 -0
  277. package/src/common/form/form-items.mts +236 -0
  278. package/src/common/import-export/import-export-types.mts +18 -0
  279. package/src/common/legacy/about-legacy.md +0 -0
  280. package/src/common/legacy/legacy-types.mts +0 -0
  281. package/src/common/link/link-constants.mts +1 -0
  282. package/src/common/link/link-helper.mts +155 -0
  283. package/src/common/link/link-types.mts +16 -0
  284. package/src/common/other/graph-helper.mts +853 -0
  285. package/src/common/other/ibgib-helper.mts +671 -0
  286. package/src/common/other/other-constants.mts +76 -0
  287. package/src/common/other/other-types.mts +186 -0
  288. package/src/common/other/svg-constants.mts +1 -0
  289. package/src/common/other/svg-helper.mts +238 -0
  290. package/src/common/pic/pic-constants.mts +13 -0
  291. package/src/common/pic/pic-helper.mts +295 -0
  292. package/src/common/pic/pic-types.mts +29 -0
  293. package/src/common/root/root-constants.mts +41 -0
  294. package/src/common/root/root-types.mts +8 -0
  295. package/src/common/tag/tag-constants.mts +34 -0
  296. package/src/common/tag/tag-types.mts +19 -0
  297. package/src/core-constants.mts +506 -0
  298. package/src/core-helper.mts +33 -0
  299. package/src/core-types.mts +519 -0
  300. package/src/helper.spec.mts +64 -0
  301. package/src/index.mts +1 -0
  302. package/src/witness/app/app-base-v1.mts +584 -0
  303. package/src/witness/app/app-constants.mts +16 -0
  304. package/src/witness/app/app-helper.mts +322 -0
  305. package/src/witness/app/app-types.mts +252 -0
  306. package/src/witness/app/chat-app/chat-app-types.mts +40 -0
  307. package/src/witness/app/flash-app/flash-app-types.mts +38 -0
  308. package/src/witness/app/raw-app/raw-app-types.mts +40 -0
  309. package/src/witness/app/todo-app/todo-app-types.ts +59 -0
  310. package/src/witness/robbot/robbot-base-v1.ts +1531 -0
  311. package/src/witness/robbot/robbot-constants.mts +25 -0
  312. package/src/witness/robbot/robbot-helper.mts +676 -0
  313. package/src/witness/robbot/robbot-helper.spec.mts +135 -0
  314. package/src/witness/robbot/robbot-types.mts +797 -0
  315. package/src/witness/space/bootstrap/bootstrap-constants.mts +15 -0
  316. package/src/witness/space/inner-space-v1.ts +372 -0
  317. package/src/witness/space/outer-space/outer-space-constants.mts +1 -0
  318. package/src/witness/space/outer-space/outer-space-helper.mts +91 -0
  319. package/src/witness/space/outer-space/outer-space-types.mts +627 -0
  320. package/src/witness/space/space-base-v1.mts +414 -0
  321. package/src/witness/space/space-constants.mts +208 -0
  322. package/src/witness/space/space-helper.mts +3242 -0
  323. package/src/witness/space/space-types.mts +476 -0
  324. package/src/witness/witness-base-v1.ts +325 -0
  325. package/src/witness/witness-constants.mts +2 -0
  326. package/src/witness/witness-form-builder.mts +128 -0
  327. package/src/witness/witness-helper.mts +256 -0
  328. package/src/witness/witness-types.mts +249 -0
  329. package/tsconfig.json +15 -0
  330. package/tsconfig.test.json +10 -0
@@ -0,0 +1,236 @@
1
+ /**
2
+ * @module
3
+ *
4
+ * Types used in bindings for forms/dynamic forms.
5
+ *
6
+ * ## transitioning development
7
+ *
8
+ * I am transitioning from a ad hoc field behavior with angular templated forms
9
+ * to a slightly more powerful dynamic form fields that leverages angular's
10
+ * reactive forms. So many of the later properties of {@link FormItemInfo} are
11
+ * optional for backwards compatibility. These may become required in the
12
+ * future, once I have dynamic forms more fleshed out.
13
+ */
14
+
15
+ /**
16
+ * For when you want options with both a label and icons.
17
+ */
18
+ export interface SelectOptionWithIcon {
19
+ label: string;
20
+ icon: string;
21
+ value: string;
22
+ }
23
+
24
+ /**
25
+ * Used in modal forms.
26
+ */
27
+ export interface FormItemInfo {
28
+ /**
29
+ * Property name
30
+ */
31
+ name: string;
32
+ /**
33
+ *
34
+ */
35
+ value?: string | number | boolean;
36
+ /**
37
+ * If set, the value will default to this.
38
+ */
39
+ defaultValue?: string | number | boolean;
40
+ /**
41
+ * Label for the property on a form
42
+ */
43
+ label?: string;
44
+ /**
45
+ * Optional description for the property. Can bind title/hover/tooltip to this.
46
+ */
47
+ description?: string;
48
+ /**
49
+ * Placeholder when entering the field's data.
50
+ */
51
+ placeholder?: string;
52
+ /**
53
+ * Validation regular expression
54
+ *
55
+ * If you change this on a field, you should always change
56
+ * the {@link regexpErrorMsg} !
57
+
58
+ * @see {@link regexpErrorMsg}
59
+ */
60
+ regexp?: RegExp;
61
+ /**
62
+ * If provided, this tries to give guidance on regexp failures.
63
+ *
64
+ * NOTE this can always get out of sync with the regexp!
65
+ * @see {@link regexp}
66
+ */
67
+ regexpErrorMsg?: string;
68
+ /**
69
+ * regexp.source
70
+ */
71
+ // regexpSource?: string;
72
+ /**
73
+ * Only required if wanting to do validation beyond regexp/required.
74
+ */
75
+ fnValid?: (value: string | number) => boolean;
76
+ /**
77
+ * Default error message, often used with {@see fnValid}.
78
+ *
79
+ * @see {@link regexpErrorMsg}
80
+ *
81
+ * ## in the future, this may be changed to a
82
+ * `string | {[error: string]: string}` which would be a better
83
+ * solution probably.
84
+ */
85
+ defaultErrorMsg?: string;
86
+ /**
87
+ * If the field is required.
88
+ */
89
+ required?: boolean;
90
+ /**
91
+ * If true, will not log field and will use type='password', unless the field
92
+ * is {@link unmasked}.
93
+ */
94
+ private?: boolean;
95
+ /**
96
+ * If true, will reveal a private field.
97
+ */
98
+ unmasked?: boolean;
99
+ /**
100
+ * If true, then regardless of modal state (adding/editing/viewing), this
101
+ * field will always be readonly.
102
+ */
103
+ readonly?: boolean;
104
+ /**
105
+ * If truthy and non-zero, then this is a composite item which contains
106
+ * other items.
107
+ *
108
+ * Basically with angular, this translates to either a `FormGroup` or
109
+ * `FormArray`.
110
+ */
111
+ items?: FormItemInfo[];
112
+ /**
113
+ * @see {@link FormItemDataType}
114
+ *
115
+ * Only should be set if {@link items} is falsy.
116
+ */
117
+ dataType?: FormItemDataType;
118
+ /**
119
+ * Options to populate a select drop-down list (valid value list). I believe
120
+ * this can also be populated after the field info has been created but
121
+ * before/while the select list is shown to the user.
122
+ */
123
+ selectOptions?: string[];
124
+ /**
125
+ * If you want your select options to include icons, use this.
126
+ * @see {@link selectOptions}
127
+ */
128
+ selectOptionsWithIcons?: SelectOptionWithIcon[];
129
+ /**
130
+ * If set, this will trigger when the item is selected.
131
+ */
132
+ onSelect?: (event: any, info: FormItemInfo) => Promise<void>;
133
+ /**
134
+ * If given, should be the min of the field for validation.
135
+ *
136
+ * If the dataType is some kind of text, then this refers to the length of string.
137
+ * If the dataType is some kind of number, then this refers to the value of the number.
138
+ *
139
+ * ## notes
140
+ * * there can be the regex also that looks at this value
141
+ *
142
+ * @optional
143
+ */
144
+ min?: number;
145
+ /**
146
+ * If given, should be the max of the field for validation.
147
+ *
148
+ * If the dataType is some kind of text, then this refers to the length of string.
149
+ * If the dataType is some kind of number, then this refers to the value of the number.
150
+ *
151
+ * ## notes
152
+ * * there can be the regex also that looks at this value
153
+ *
154
+ * @optional
155
+ */
156
+ max?: number;
157
+ /**
158
+ * If true, select can select multiple items.
159
+ *
160
+ * If not a select, then not sure what's up.
161
+ */
162
+ multiple?: boolean;
163
+ /**
164
+ * If control is set, then this should be a randomly generated uuid
165
+ * that can be uniquely associated to the control.
166
+ */
167
+ uuid?: string;
168
+ /**
169
+ * If true, then the control is errored and contains error information.
170
+ */
171
+ errored?: boolean;
172
+ }
173
+
174
+ // /** @see {@link FormItemDataType} */
175
+ export type FormItemDataType =
176
+ 'text' | 'textarea' | 'select' | 'toggle' | 'number' | 'form';
177
+ /**
178
+ * Type of the data, to drive what kind of control will be used for data.
179
+ *
180
+ * See individual members for more info.
181
+ *
182
+ * For fields that have auto-generated UI.
183
+ *
184
+ * ATOW Pretty much mirroring html5 input types.
185
+ *
186
+ * @see {@link FormItemDataType.text}
187
+ * @see {@link textarea}
188
+ * @see {@link select}
189
+ * @see {@link toggle}
190
+ * @see {@link number}
191
+ */
192
+ export const FormItemDataType = {
193
+ /**
194
+ * @example name
195
+ */
196
+ text: 'text' as FormItemDataType,
197
+ /**
198
+ * @example description
199
+ */
200
+ textarea: 'textarea' as FormItemDataType,
201
+ /**
202
+ * select string(s) from a list.
203
+ *
204
+ * @example States e.g. TX, TN, NY, etc.
205
+ *
206
+ * @see {@link FormItemInfo.multiple}
207
+ */
208
+ select: 'select' as FormItemDataType,
209
+ /**
210
+ * Boolean true/false or on/off, etc.
211
+ */
212
+ toggle: 'toggle' as FormItemDataType,
213
+ /**
214
+ * Number value
215
+ */
216
+ number: 'number' as FormItemDataType,
217
+ /**
218
+ * The item is a collection of other items.
219
+ */
220
+ form: 'form' as FormItemDataType,
221
+ }
222
+
223
+ /**
224
+ * syntactic sugar for `Object.values(FormItemDataType)`
225
+ */
226
+ export const FORM_ITEM_DATA_TYPES = Object.values(FormItemDataType);
227
+
228
+ /**
229
+ * A form is basically an array of form items.
230
+ */
231
+ export interface DynamicForm extends FormItemInfo {
232
+ /**
233
+ * redeclared here to require children items.
234
+ */
235
+ items: FormItemInfo[];
236
+ }
@@ -0,0 +1,18 @@
1
+ import { IbGibAddr, IbGibRel8ns } from '@ibgib/ts-gib/dist/types.mjs';
2
+ import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs';
3
+
4
+ export interface RawExportData_V1 {
5
+ dependencyGraphAsString: string,
6
+ contextIbGibAddr: IbGibAddr;
7
+ tjpAddr?: IbGibAddr;
8
+ }
9
+
10
+ export interface RawExportRel8ns_V1 extends IbGibRel8ns { }
11
+
12
+ /**
13
+ * Ibgib that contains an entire export of a given ibgib.
14
+ *
15
+ * This could potentially be huge, so I'm naming it "Raw" in hopes
16
+ * that in the future some type of sharding & compression might happen.
17
+ */
18
+ export interface RawExportIbGib_V1 extends IbGib_V1<RawExportData_V1, RawExportRel8ns_V1> { }
File without changes
File without changes
@@ -0,0 +1 @@
1
+ export const DEFAULT_LINK_TEXT_IB_SUBSTRING_LENGTH = 20;
@@ -0,0 +1,155 @@
1
+ import * as h from '@ibgib/helper-gib';
2
+ import { Factory_V1 as factory, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs';
3
+ import { TransformResult } from '@ibgib/ts-gib';
4
+
5
+ import { IbGibSpaceAny } from '../../witness/space/space-base-v1.mjs';
6
+ // import { persistTransformResult, } from './space.mjs';
7
+ import { persistTransformResult } from '../../witness/space/space-helper.mjs';
8
+ import { DEFAULT_LINK_TEXT_IB_SUBSTRING_LENGTH } from './link-constants.mjs';
9
+ import { ONLY_HAS_NON_ALPHANUMERICS } from '@ibgib/helper-gib';
10
+ import { GLOBAL_LOG_A_LOT } from '../../core-constants.mjs';
11
+ import { LinkData_V1, LinkIbGib_V1 } from './link-types.mjs';
12
+
13
+ const logalot = GLOBAL_LOG_A_LOT || false;
14
+
15
+
16
+ /**
17
+ * generates an ib based on the link text.
18
+ *
19
+ * Basically this gets a short substring of the link text and replaces
20
+ * any non alphanumeric characters.
21
+ *
22
+ * @param linkText link text
23
+ * @returns link ib for the given link text
24
+ */
25
+ export function getLinkIb(linkText: string): string {
26
+ const lc = `[${getLinkIb.name}]`;
27
+ try {
28
+ if (!linkText) { throw new Error(`linkText required. (E: e131bda0f94e4af1807cda8710e6fb1f)`); }
29
+ let saferText = linkText.replace(/\W/g, '');
30
+ let ibLinkText: string;
31
+ if (saferText.length > DEFAULT_LINK_TEXT_IB_SUBSTRING_LENGTH) {
32
+ ibLinkText =
33
+ saferText.substring(0, DEFAULT_LINK_TEXT_IB_SUBSTRING_LENGTH);
34
+ } else if (saferText.length > 0) {
35
+ ibLinkText = saferText;
36
+ } else {
37
+ // link text only has characters/nonalphanumerics.
38
+ ibLinkText = ONLY_HAS_NON_ALPHANUMERICS;
39
+ }
40
+
41
+ return `link ${ibLinkText}`;
42
+ } catch (error) {
43
+ console.error(`${lc} ${error.message}`);
44
+ throw error;
45
+ }
46
+ }
47
+
48
+ /**
49
+ * creates a link ibgib, returning the transform result,
50
+ * optionally saving it in a given {@link space}.
51
+ */
52
+ export async function createLinkIbGib({
53
+ text,
54
+ saveInSpace,
55
+ space,
56
+ }: {
57
+ /**
58
+ * link text
59
+ */
60
+ text: string,
61
+ /**
62
+ * If true, will save the ibgibs created in the given {@link space}.
63
+ */
64
+ saveInSpace?: boolean,
65
+ /**
66
+ * If {@link saveInSpace}, all ibgibs created in this function will be stored in
67
+ * this space.
68
+ */
69
+ space?: IbGibSpaceAny,
70
+ }): Promise<TransformResult<LinkIbGib_V1>> {
71
+ const lc = `[${createLinkIbGib.name}]`;
72
+
73
+ if (logalot) { console.log(`${lc} starting...`); }
74
+ try {
75
+ if (!text) { throw new Error(`text required (E: bd9a29193ec7416da588fcd10de182ee)`); }
76
+
77
+ text = text.trim();
78
+
79
+ if (!text) { throw new Error(`text cannot be only whitespace (E: 5fbc0bf22388475da885993a261b01fa)`); }
80
+
81
+ const data: LinkData_V1 = { text, textTimestamp: h.getTimestamp() };
82
+
83
+ // create an ibgib with the filename and ext
84
+ const opts: any = {
85
+ parentIbGib: factory.primitive({ ib: 'link' }),
86
+ ib: getLinkIb(text),
87
+ data,
88
+ dna: true,
89
+ tjp: { uuid: true, timestamp: true },
90
+ nCounter: true,
91
+ };
92
+
93
+ // this makes it more difficult to share/sync ibgibs...
94
+ // if (this.addr) { opts.rel8ns = { 'link on': [this.addr] }; }
95
+
96
+ if (logalot) { console.log(`${lc} opts: ${h.pretty(opts)}`); }
97
+ const resLinkIbGib = await factory.firstGen(opts) as TransformResult<LinkIbGib_V1>;
98
+
99
+ if (saveInSpace) {
100
+ if (!space) { throw new Error(`space required if saveInSpace is truthy (E: 19af4790b5744a72bbdd995219d8f1d4)`); }
101
+ await persistTransformResult({ resTransform: resLinkIbGib, space });
102
+ }
103
+
104
+ return resLinkIbGib;
105
+ } catch (error) {
106
+ console.error(`${lc} ${error.message}`);
107
+ throw error;
108
+ }
109
+ }
110
+
111
+ export function isLink({
112
+ ibGib,
113
+ }: {
114
+ ibGib: IbGib_V1,
115
+ }): boolean {
116
+ const lc = `[${isLink.name}]`;
117
+ try {
118
+ if (logalot) { console.log(`${lc} starting...`); }
119
+
120
+ if (!ibGib) { throw new Error(`ibGib required (E: 62e4d60452824d9097702bcc9e8466f4)`); }
121
+
122
+ const { ib, data, rel8ns } = ibGib;
123
+
124
+ // try rel8ns first
125
+ if (!rel8ns) {
126
+ if (logalot) { console.log(`${lc} rel8ns falsy, NOT a link (I: 21c6bebf90a94c11aa0fb5d44501a7d9)`); }
127
+ return false;
128
+ }
129
+
130
+ // descends from link^gib
131
+ const ancestors = rel8ns.ancestor || [];
132
+ if (ancestors && ancestors.includes('link^gib')) {
133
+ if (logalot) { console.log(`${lc} descends from link^gib, YES is a link (I: be91be40214248c394065f8dc7a71e3b)`); }
134
+ return true;
135
+ }
136
+
137
+ // has binary qualities and ib contains 'link'
138
+ if (!data) {
139
+ if (logalot) { console.log(`${lc} data falsy, NOT a link (I: bee06c5c10ea4c04bc5d7e2244840020)`); }
140
+ return false;
141
+ }
142
+ if (data.text && ib?.includes('link')) {
143
+ if (logalot) { console.log(`${lc} has text, and ib has 'link', YES is a link (I: 306b6e1f54e94acc91622a93770d0c1e)`); }
144
+ return true;
145
+ }
146
+
147
+ if (logalot) { console.log(`${lc} reached end, doesn't have link qualities. NOT a link. (I: 43a983d5acf64970aa4310b41fd93e0f)`); }
148
+ return false;
149
+ } catch (error) {
150
+ console.error(`${lc} ${error.message}`);
151
+ throw error;
152
+ } finally {
153
+ if (logalot) { console.log(`${lc} complete.`); }
154
+ }
155
+ }
@@ -0,0 +1,16 @@
1
+ import { IbGibRel8ns_V1, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs';
2
+
3
+ /**
4
+ * Data for a link ibGib
5
+ */
6
+ export interface LinkData_V1 {
7
+ text: string;
8
+ textTimestamp?: string;
9
+ timestamp?: string;
10
+ }
11
+
12
+ export interface LinkRel8ns_V1 extends IbGibRel8ns_V1 {
13
+ }
14
+
15
+ export interface LinkIbGib_V1 extends IbGib_V1<LinkData_V1, LinkRel8ns_V1> {
16
+ }