@qoretechnologies/reqraft 0.10.62 → 0.10.63-pr.142.g0b675cd

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 (736) hide show
  1. package/README.md +21 -1
  2. package/dist/components/Description/describedControl.d.ts +48 -0
  3. package/dist/components/Description/describedControl.d.ts.map +1 -0
  4. package/dist/components/Description/describedControl.js +81 -0
  5. package/dist/components/Description/describedControl.js.map +1 -0
  6. package/dist/components/Description/index.d.ts.map +1 -1
  7. package/dist/components/Description/index.js +3 -2
  8. package/dist/components/Description/index.js.map +1 -1
  9. package/dist/components/colorValue/colorValue.d.ts +59 -0
  10. package/dist/components/colorValue/colorValue.d.ts.map +1 -0
  11. package/dist/components/colorValue/colorValue.js +245 -0
  12. package/dist/components/colorValue/colorValue.js.map +1 -0
  13. package/dist/components/colorValue/index.d.ts +34 -0
  14. package/dist/components/colorValue/index.d.ts.map +1 -0
  15. package/dist/components/colorValue/index.js +136 -0
  16. package/dist/components/colorValue/index.js.map +1 -0
  17. package/dist/components/colorValue/labels.d.ts +12 -0
  18. package/dist/components/colorValue/labels.d.ts.map +1 -0
  19. package/dist/components/colorValue/labels.js +11 -0
  20. package/dist/components/colorValue/labels.js.map +1 -0
  21. package/dist/components/composer/Composer.d.ts +1 -1
  22. package/dist/components/composer/Composer.d.ts.map +1 -1
  23. package/dist/components/composer/Composer.js +2 -2
  24. package/dist/components/composer/Composer.js.map +1 -1
  25. package/dist/components/dpqlEditor/DpqlEditor.d.ts.map +1 -1
  26. package/dist/components/dpqlEditor/DpqlEditor.js +25 -5
  27. package/dist/components/dpqlEditor/DpqlEditor.js.map +1 -1
  28. package/dist/components/dpqlEditor/dpqlHelpers.d.ts +10 -1
  29. package/dist/components/dpqlEditor/dpqlHelpers.d.ts.map +1 -1
  30. package/dist/components/dpqlEditor/dpqlHelpers.js +30 -13
  31. package/dist/components/dpqlEditor/dpqlHelpers.js.map +1 -1
  32. package/dist/components/dpqlEditor/dpqlTags.d.ts +11 -7
  33. package/dist/components/dpqlEditor/dpqlTags.d.ts.map +1 -1
  34. package/dist/components/dpqlEditor/dpqlTags.js +11 -6
  35. package/dist/components/dpqlEditor/dpqlTags.js.map +1 -1
  36. package/dist/components/dpqlEditor/types.d.ts +47 -8
  37. package/dist/components/dpqlEditor/types.d.ts.map +1 -1
  38. package/dist/components/dpqlEditor/useDpqlSession.d.ts +2 -2
  39. package/dist/components/dpqlEditor/useDpqlSession.d.ts.map +1 -1
  40. package/dist/components/dpqlEditor/useDpqlSession.js +16 -7
  41. package/dist/components/dpqlEditor/useDpqlSession.js.map +1 -1
  42. package/dist/components/form/engine/CompactRow.d.ts.map +1 -1
  43. package/dist/components/form/engine/CompactRow.js +151 -83
  44. package/dist/components/form/engine/CompactRow.js.map +1 -1
  45. package/dist/components/form/engine/CompactToolbar.d.ts.map +1 -1
  46. package/dist/components/form/engine/CompactToolbar.js +29 -3
  47. package/dist/components/form/engine/CompactToolbar.js.map +1 -1
  48. package/dist/components/form/engine/FormEngine.d.ts +34 -1
  49. package/dist/components/form/engine/FormEngine.d.ts.map +1 -1
  50. package/dist/components/form/engine/FormEngine.js +487 -87
  51. package/dist/components/form/engine/FormEngine.js.map +1 -1
  52. package/dist/components/form/engine/HiddenFieldsNote.d.ts +28 -0
  53. package/dist/components/form/engine/HiddenFieldsNote.d.ts.map +1 -0
  54. package/dist/components/form/engine/HiddenFieldsNote.js +32 -0
  55. package/dist/components/form/engine/HiddenFieldsNote.js.map +1 -0
  56. package/dist/components/form/engine/OptionFieldMessages.d.ts.map +1 -1
  57. package/dist/components/form/engine/OptionFieldMessages.js +24 -3
  58. package/dist/components/form/engine/OptionFieldMessages.js.map +1 -1
  59. package/dist/components/form/engine/_structuredData/SchemaDataView.d.ts +2 -2
  60. package/dist/components/form/engine/_structuredData/SchemaDataView.d.ts.map +1 -1
  61. package/dist/components/form/engine/_structuredData/SchemaDataView.js +12 -6
  62. package/dist/components/form/engine/_structuredData/SchemaDataView.js.map +1 -1
  63. package/dist/components/form/engine/compactRowContext.d.ts +19 -0
  64. package/dist/components/form/engine/compactRowContext.d.ts.map +1 -1
  65. package/dist/components/form/engine/compactRowContext.js.map +1 -1
  66. package/dist/components/form/engine/compactRowStyles.d.ts +0 -1
  67. package/dist/components/form/engine/compactRowStyles.d.ts.map +1 -1
  68. package/dist/components/form/engine/compactRowStyles.js +12 -20
  69. package/dist/components/form/engine/compactRowStyles.js.map +1 -1
  70. package/dist/components/form/engine/compactToolbarColors.d.ts +16 -0
  71. package/dist/components/form/engine/compactToolbarColors.d.ts.map +1 -0
  72. package/dist/components/form/engine/compactToolbarColors.js +21 -0
  73. package/dist/components/form/engine/compactToolbarColors.js.map +1 -0
  74. package/dist/components/form/engine/readFirst.d.ts +24 -8
  75. package/dist/components/form/engine/readFirst.d.ts.map +1 -1
  76. package/dist/components/form/engine/readFirst.js +77 -109
  77. package/dist/components/form/engine/readFirst.js.map +1 -1
  78. package/dist/components/form/engine/readFirstColors.d.ts +30 -0
  79. package/dist/components/form/engine/readFirstColors.d.ts.map +1 -0
  80. package/dist/components/form/engine/readFirstColors.js +51 -0
  81. package/dist/components/form/engine/readFirstColors.js.map +1 -0
  82. package/dist/components/form/engine/rowFocus.d.ts +2 -0
  83. package/dist/components/form/engine/rowFocus.d.ts.map +1 -1
  84. package/dist/components/form/engine/rowFocus.js +26 -3
  85. package/dist/components/form/engine/rowFocus.js.map +1 -1
  86. package/dist/components/form/engine/typeChoices.d.ts +1 -1
  87. package/dist/components/form/engine/variants/VariantCalmTable.d.ts.map +1 -1
  88. package/dist/components/form/engine/variants/VariantCalmTable.js +2 -1
  89. package/dist/components/form/engine/variants/VariantCalmTable.js.map +1 -1
  90. package/dist/components/form/engine/variants/VariantCards.d.ts.map +1 -1
  91. package/dist/components/form/engine/variants/VariantCards.js +2 -1
  92. package/dist/components/form/engine/variants/VariantCards.js.map +1 -1
  93. package/dist/components/form/engine/variants/VariantFocus.js +1 -1
  94. package/dist/components/form/engine/variants/VariantFocus.js.map +1 -1
  95. package/dist/components/form/engine/variants/VariantMinimal.d.ts.map +1 -1
  96. package/dist/components/form/engine/variants/VariantMinimal.js +2 -1
  97. package/dist/components/form/engine/variants/VariantMinimal.js.map +1 -1
  98. package/dist/components/form/engine/variants/variantParts.d.ts +1 -1
  99. package/dist/components/form/engine/variants/variantParts.d.ts.map +1 -1
  100. package/dist/components/form/engine/variants/variantParts.js +25 -17
  101. package/dist/components/form/engine/variants/variantParts.js.map +1 -1
  102. package/dist/components/form/expressions/DpqlRendering.d.ts +1 -1
  103. package/dist/components/form/expressions/DpqlRendering.d.ts.map +1 -1
  104. package/dist/components/form/expressions/DpqlRendering.js +3 -3
  105. package/dist/components/form/expressions/DpqlRendering.js.map +1 -1
  106. package/dist/components/form/expressions/ExpressionField.d.ts +41 -3
  107. package/dist/components/form/expressions/ExpressionField.d.ts.map +1 -1
  108. package/dist/components/form/expressions/ExpressionField.js +396 -99
  109. package/dist/components/form/expressions/ExpressionField.js.map +1 -1
  110. package/dist/components/form/expressions/builder/argumentDetail.d.ts.map +1 -1
  111. package/dist/components/form/expressions/builder/argumentDetail.js +4 -1
  112. package/dist/components/form/expressions/builder/argumentDetail.js.map +1 -1
  113. package/dist/components/form/expressions/builder/argumentLabel.d.ts.map +1 -1
  114. package/dist/components/form/expressions/builder/argumentLabel.js +27 -9
  115. package/dist/components/form/expressions/builder/argumentLabel.js.map +1 -1
  116. package/dist/components/form/expressions/builder/argumentWrapper.d.ts.map +1 -1
  117. package/dist/components/form/expressions/builder/argumentWrapper.js +4 -2
  118. package/dist/components/form/expressions/builder/argumentWrapper.js.map +1 -1
  119. package/dist/components/form/expressions/builder/confirmMismatchedTypesModal.d.ts.map +1 -1
  120. package/dist/components/form/expressions/builder/confirmMismatchedTypesModal.js +5 -4
  121. package/dist/components/form/expressions/builder/confirmMismatchedTypesModal.js.map +1 -1
  122. package/dist/components/form/expressions/builder/confirmUnsupportedTypeModal.d.ts +1 -1
  123. package/dist/components/form/expressions/builder/confirmUnsupportedTypeModal.d.ts.map +1 -1
  124. package/dist/components/form/expressions/builder/confirmUnsupportedTypeModal.js +6 -3
  125. package/dist/components/form/expressions/builder/confirmUnsupportedTypeModal.js.map +1 -1
  126. package/dist/components/form/expressions/builder/index.d.ts +24 -2
  127. package/dist/components/form/expressions/builder/index.d.ts.map +1 -1
  128. package/dist/components/form/expressions/builder/index.js +121 -77
  129. package/dist/components/form/expressions/builder/index.js.map +1 -1
  130. package/dist/components/form/expressions/builder/item.d.ts +6 -2
  131. package/dist/components/form/expressions/builder/item.d.ts.map +1 -1
  132. package/dist/components/form/expressions/builder/item.js +19 -5
  133. package/dist/components/form/expressions/builder/item.js.map +1 -1
  134. package/dist/components/form/expressions/builder/renderTemplate.js +1 -1
  135. package/dist/components/form/expressions/builder/renderTemplate.js.map +1 -1
  136. package/dist/components/form/expressions/expressionOperands.d.ts +16 -0
  137. package/dist/components/form/expressions/expressionOperands.d.ts.map +1 -0
  138. package/dist/components/form/expressions/expressionOperands.js +97 -0
  139. package/dist/components/form/expressions/expressionOperands.js.map +1 -0
  140. package/dist/components/form/expressions/mockExpressions.d.ts.map +1 -1
  141. package/dist/components/form/expressions/mockExpressions.js +22 -5
  142. package/dist/components/form/expressions/mockExpressions.js.map +1 -1
  143. package/dist/components/form/expressions/renderExpressionToText.d.ts +2 -0
  144. package/dist/components/form/expressions/renderExpressionToText.d.ts.map +1 -1
  145. package/dist/components/form/expressions/renderExpressionToText.js +35 -9
  146. package/dist/components/form/expressions/renderExpressionToText.js.map +1 -1
  147. package/dist/components/form/expressions/textOfExpression.d.ts +18 -0
  148. package/dist/components/form/expressions/textOfExpression.d.ts.map +1 -0
  149. package/dist/components/form/expressions/textOfExpression.js +37 -0
  150. package/dist/components/form/expressions/textOfExpression.js.map +1 -0
  151. package/dist/components/form/expressions/useExpressionType.d.ts +26 -0
  152. package/dist/components/form/expressions/useExpressionType.d.ts.map +1 -0
  153. package/dist/components/form/expressions/useExpressionType.js +181 -0
  154. package/dist/components/form/expressions/useExpressionType.js.map +1 -0
  155. package/dist/components/form/expressions/useRenderExpression.d.ts.map +1 -1
  156. package/dist/components/form/expressions/useRenderExpression.js +7 -7
  157. package/dist/components/form/expressions/useRenderExpression.js.map +1 -1
  158. package/dist/components/form/fields/Field.d.ts.map +1 -1
  159. package/dist/components/form/fields/Field.js +20 -7
  160. package/dist/components/form/fields/Field.js.map +1 -1
  161. package/dist/components/form/fields/allowed-values/AllowedValues.d.ts.map +1 -1
  162. package/dist/components/form/fields/allowed-values/AllowedValues.js +17 -4
  163. package/dist/components/form/fields/allowed-values/AllowedValues.js.map +1 -1
  164. package/dist/components/form/fields/array/ArrayAuto.d.ts.map +1 -1
  165. package/dist/components/form/fields/array/ArrayAuto.js +24 -0
  166. package/dist/components/form/fields/array/ArrayAuto.js.map +1 -1
  167. package/dist/components/form/fields/array/ArrayAutoField.d.ts.map +1 -1
  168. package/dist/components/form/fields/array/ArrayAutoField.js +36 -13
  169. package/dist/components/form/fields/array/ArrayAutoField.js.map +1 -1
  170. package/dist/components/form/fields/auto/AutoFormField.d.ts +20 -1
  171. package/dist/components/form/fields/auto/AutoFormField.d.ts.map +1 -1
  172. package/dist/components/form/fields/auto/AutoFormField.js +81 -36
  173. package/dist/components/form/fields/auto/AutoFormField.js.map +1 -1
  174. package/dist/components/form/fields/auto/hostEditorValue.d.ts +30 -0
  175. package/dist/components/form/fields/auto/hostEditorValue.d.ts.map +1 -0
  176. package/dist/components/form/fields/auto/hostEditorValue.js +53 -0
  177. package/dist/components/form/fields/auto/hostEditorValue.js.map +1 -0
  178. package/dist/components/form/fields/binary/Binary.d.ts.map +1 -1
  179. package/dist/components/form/fields/binary/Binary.js +23 -3
  180. package/dist/components/form/fields/binary/Binary.js.map +1 -1
  181. package/dist/components/form/fields/boolean/Boolean.d.ts +5 -0
  182. package/dist/components/form/fields/boolean/Boolean.d.ts.map +1 -1
  183. package/dist/components/form/fields/boolean/Boolean.js +9 -1
  184. package/dist/components/form/fields/boolean/Boolean.js.map +1 -1
  185. package/dist/components/form/fields/color/Color.d.ts +103 -16
  186. package/dist/components/form/fields/color/Color.d.ts.map +1 -1
  187. package/dist/components/form/fields/color/Color.js +611 -16
  188. package/dist/components/form/fields/color/Color.js.map +1 -1
  189. package/dist/components/form/fields/emittedValues.d.ts +34 -3
  190. package/dist/components/form/fields/emittedValues.d.ts.map +1 -1
  191. package/dist/components/form/fields/emittedValues.js +24 -1
  192. package/dist/components/form/fields/emittedValues.js.map +1 -1
  193. package/dist/components/form/fields/file/File.d.ts +1 -1
  194. package/dist/components/form/fields/file/File.d.ts.map +1 -1
  195. package/dist/components/form/fields/file/File.js +4 -2
  196. package/dist/components/form/fields/file/File.js.map +1 -1
  197. package/dist/components/form/fields/long-string/LongString.d.ts.map +1 -1
  198. package/dist/components/form/fields/long-string/LongString.js +17 -3
  199. package/dist/components/form/fields/long-string/LongString.js.map +1 -1
  200. package/dist/components/form/fields/markdown/MarkdownView.js +1 -1
  201. package/dist/components/form/fields/multi-select/MultiSelectFormField.d.ts.map +1 -1
  202. package/dist/components/form/fields/multi-select/MultiSelectFormField.js +4 -1
  203. package/dist/components/form/fields/multi-select/MultiSelectFormField.js.map +1 -1
  204. package/dist/components/form/fields/number/Number.d.ts +6 -0
  205. package/dist/components/form/fields/number/Number.d.ts.map +1 -1
  206. package/dist/components/form/fields/number/Number.js +41 -6
  207. package/dist/components/form/fields/number/Number.js.map +1 -1
  208. package/dist/components/form/fields/object/Object.d.ts +1 -1
  209. package/dist/components/form/fields/object/Object.d.ts.map +1 -1
  210. package/dist/components/form/fields/object/Object.js +4 -2
  211. package/dist/components/form/fields/object/Object.js.map +1 -1
  212. package/dist/components/form/fields/pendingEdit.d.ts +52 -0
  213. package/dist/components/form/fields/pendingEdit.d.ts.map +1 -0
  214. package/dist/components/form/fields/pendingEdit.js +79 -0
  215. package/dist/components/form/fields/pendingEdit.js.map +1 -0
  216. package/dist/components/form/fields/rich-text/RichText.d.ts +8 -1
  217. package/dist/components/form/fields/rich-text/RichText.d.ts.map +1 -1
  218. package/dist/components/form/fields/rich-text/RichText.js +190 -81
  219. package/dist/components/form/fields/rich-text/RichText.js.map +1 -1
  220. package/dist/components/form/fields/rich-text/useTemplateTags.d.ts +18 -0
  221. package/dist/components/form/fields/rich-text/useTemplateTags.d.ts.map +1 -0
  222. package/dist/components/form/fields/rich-text/useTemplateTags.js +49 -0
  223. package/dist/components/form/fields/rich-text/useTemplateTags.js.map +1 -0
  224. package/dist/components/form/fields/schema-definition/CatalogLeafForm.d.ts.map +1 -1
  225. package/dist/components/form/fields/schema-definition/CatalogLeafForm.js +4 -1
  226. package/dist/components/form/fields/schema-definition/CatalogLeafForm.js.map +1 -1
  227. package/dist/components/form/fields/schema-definition/CatalogNodeEditor.d.ts.map +1 -1
  228. package/dist/components/form/fields/schema-definition/CatalogNodeEditor.js +20 -5
  229. package/dist/components/form/fields/schema-definition/CatalogNodeEditor.js.map +1 -1
  230. package/dist/components/form/fields/schema-definition/TableEditor.d.ts.map +1 -1
  231. package/dist/components/form/fields/schema-definition/TableEditor.js +10 -2
  232. package/dist/components/form/fields/schema-definition/TableEditor.js.map +1 -1
  233. package/dist/components/form/fields/schema-definition/index.d.ts.map +1 -1
  234. package/dist/components/form/fields/schema-definition/index.js +8 -4
  235. package/dist/components/form/fields/schema-definition/index.js.map +1 -1
  236. package/dist/components/form/fields/select/Select.d.ts +2 -0
  237. package/dist/components/form/fields/select/Select.d.ts.map +1 -1
  238. package/dist/components/form/fields/select/Select.js +19 -10
  239. package/dist/components/form/fields/select/Select.js.map +1 -1
  240. package/dist/components/form/fields/select/SelectCollection.d.ts.map +1 -1
  241. package/dist/components/form/fields/select/SelectCollection.js +8 -2
  242. package/dist/components/form/fields/select/SelectCollection.js.map +1 -1
  243. package/dist/components/form/fields/select/unavailableRow.d.ts +23 -0
  244. package/dist/components/form/fields/select/unavailableRow.d.ts.map +1 -0
  245. package/dist/components/form/fields/select/unavailableRow.js +55 -0
  246. package/dist/components/form/fields/select/unavailableRow.js.map +1 -0
  247. package/dist/components/form/fields/template/ReadOnlyTemplateTag.d.ts +5 -5
  248. package/dist/components/form/fields/template/ReadOnlyTemplateTag.d.ts.map +1 -1
  249. package/dist/components/form/fields/template/ReadOnlyTemplateTag.js +11 -4
  250. package/dist/components/form/fields/template/ReadOnlyTemplateTag.js.map +1 -1
  251. package/dist/components/form/fields/template/TemplateBrowser.d.ts +22 -0
  252. package/dist/components/form/fields/template/TemplateBrowser.d.ts.map +1 -0
  253. package/dist/components/form/fields/template/TemplateBrowser.js +54 -0
  254. package/dist/components/form/fields/template/TemplateBrowser.js.map +1 -0
  255. package/dist/components/form/fields/template/TemplateField.d.ts +83 -1
  256. package/dist/components/form/fields/template/TemplateField.d.ts.map +1 -1
  257. package/dist/components/form/fields/template/TemplateField.js +535 -85
  258. package/dist/components/form/fields/template/TemplateField.js.map +1 -1
  259. package/dist/components/form/fields/template/TemplateText.d.ts +0 -17
  260. package/dist/components/form/fields/template/TemplateText.d.ts.map +1 -1
  261. package/dist/components/form/fields/template/TemplateText.js +8 -4
  262. package/dist/components/form/fields/template/TemplateText.js.map +1 -1
  263. package/dist/components/form/fields/template/writtenAsText.d.ts +55 -0
  264. package/dist/components/form/fields/template/writtenAsText.d.ts.map +1 -0
  265. package/dist/components/form/fields/template/writtenAsText.js +188 -0
  266. package/dist/components/form/fields/template/writtenAsText.js.map +1 -0
  267. package/dist/components/form/index.d.ts +10 -0
  268. package/dist/components/form/index.d.ts.map +1 -1
  269. package/dist/components/form/index.js +23 -1
  270. package/dist/components/form/index.js.map +1 -1
  271. package/dist/components/imageLightbox/ImageLightbox.d.ts.map +1 -1
  272. package/dist/components/imageLightbox/ImageLightbox.js +19 -7
  273. package/dist/components/imageLightbox/ImageLightbox.js.map +1 -1
  274. package/dist/components/log/Log.d.ts.map +1 -1
  275. package/dist/components/log/Log.js +15 -7
  276. package/dist/components/log/Log.js.map +1 -1
  277. package/dist/components/menu/Menu.d.ts.map +1 -1
  278. package/dist/components/menu/Menu.js +19 -10
  279. package/dist/components/menu/Menu.js.map +1 -1
  280. package/dist/components/smartEditor/CompletionMenu.d.ts +43 -0
  281. package/dist/components/smartEditor/CompletionMenu.d.ts.map +1 -0
  282. package/dist/components/smartEditor/CompletionMenu.js +196 -0
  283. package/dist/components/smartEditor/CompletionMenu.js.map +1 -0
  284. package/dist/components/smartEditor/MarkdownDoc.d.ts +1 -1
  285. package/dist/components/smartEditor/MarkdownDoc.js +1 -1
  286. package/dist/components/smartEditor/MarkdownDoc.js.map +1 -1
  287. package/dist/components/smartEditor/SmartEditor.d.ts.map +1 -1
  288. package/dist/components/smartEditor/SmartEditor.js +51 -136
  289. package/dist/components/smartEditor/SmartEditor.js.map +1 -1
  290. package/dist/components/smartEditor/completionStyle.d.ts +27 -0
  291. package/dist/components/smartEditor/completionStyle.d.ts.map +1 -0
  292. package/dist/components/smartEditor/completionStyle.js +66 -0
  293. package/dist/components/smartEditor/completionStyle.js.map +1 -0
  294. package/dist/components/smartEditor/index.d.ts +5 -1
  295. package/dist/components/smartEditor/index.d.ts.map +1 -1
  296. package/dist/components/smartEditor/index.js +19 -1
  297. package/dist/components/smartEditor/index.js.map +1 -1
  298. package/dist/components/smartEditor/templateCompletions.d.ts +18 -0
  299. package/dist/components/smartEditor/templateCompletions.d.ts.map +1 -0
  300. package/dist/components/smartEditor/templateCompletions.js +94 -0
  301. package/dist/components/smartEditor/templateCompletions.js.map +1 -0
  302. package/dist/components/smartEditor/types.d.ts +12 -1
  303. package/dist/components/smartEditor/types.d.ts.map +1 -1
  304. package/dist/components/smartEditor/useLspAutocomplete.d.ts +32 -0
  305. package/dist/components/smartEditor/useLspAutocomplete.d.ts.map +1 -1
  306. package/dist/components/smartEditor/useLspAutocomplete.js +228 -118
  307. package/dist/components/smartEditor/useLspAutocomplete.js.map +1 -1
  308. package/dist/components/smartEditor/useLspHover.d.ts +22 -7
  309. package/dist/components/smartEditor/useLspHover.d.ts.map +1 -1
  310. package/dist/components/smartEditor/useLspHover.js +86 -17
  311. package/dist/components/smartEditor/useLspHover.js.map +1 -1
  312. package/dist/components/smartEditor/useLspSemanticTokens.js +1 -1
  313. package/dist/components/smartEditor/useLspSemanticTokens.js.map +1 -1
  314. package/dist/components/smartEditor/useLspSession.d.ts +6 -0
  315. package/dist/components/smartEditor/useLspSession.d.ts.map +1 -1
  316. package/dist/components/smartEditor/useLspSession.js +7 -6
  317. package/dist/components/smartEditor/useLspSession.js.map +1 -1
  318. package/dist/components/supportTicket/AttachmentChips.d.ts.map +1 -1
  319. package/dist/components/supportTicket/AttachmentChips.js +15 -5
  320. package/dist/components/supportTicket/AttachmentChips.js.map +1 -1
  321. package/dist/components/supportTicket/ReferencePicker.d.ts +9 -2
  322. package/dist/components/supportTicket/ReferencePicker.d.ts.map +1 -1
  323. package/dist/components/supportTicket/ReferencePicker.js +27 -6
  324. package/dist/components/supportTicket/ReferencePicker.js.map +1 -1
  325. package/dist/components/supportTicket/TicketHeader.d.ts +3 -4
  326. package/dist/components/supportTicket/TicketHeader.d.ts.map +1 -1
  327. package/dist/components/supportTicket/TicketHeader.js +20 -2
  328. package/dist/components/supportTicket/TicketHeader.js.map +1 -1
  329. package/dist/components/supportTicket/TicketMetaTags.d.ts +1 -1
  330. package/dist/components/ticketReferences/TicketReferences.d.ts.map +1 -1
  331. package/dist/components/ticketReferences/TicketReferences.js +9 -4
  332. package/dist/components/ticketReferences/TicketReferences.js.map +1 -1
  333. package/dist/components/ticketThread/TicketThread.d.ts.map +1 -1
  334. package/dist/components/ticketThread/TicketThread.js +36 -11
  335. package/dist/components/ticketThread/TicketThread.js.map +1 -1
  336. package/dist/helpers/descriptionTooltip.d.ts +43 -0
  337. package/dist/helpers/descriptionTooltip.d.ts.map +1 -0
  338. package/dist/helpers/descriptionTooltip.js +70 -0
  339. package/dist/helpers/descriptionTooltip.js.map +1 -0
  340. package/dist/helpers/domProps.d.ts +5 -0
  341. package/dist/helpers/domProps.d.ts.map +1 -0
  342. package/dist/helpers/domProps.js +47 -0
  343. package/dist/helpers/domProps.js.map +1 -0
  344. package/dist/helpers/expressions.d.ts +107 -2
  345. package/dist/helpers/expressions.d.ts.map +1 -1
  346. package/dist/helpers/expressions.js +223 -8
  347. package/dist/helpers/expressions.js.map +1 -1
  348. package/dist/helpers/hoveringPointer.d.ts +26 -0
  349. package/dist/helpers/hoveringPointer.d.ts.map +1 -0
  350. package/dist/helpers/hoveringPointer.js +29 -0
  351. package/dist/helpers/hoveringPointer.js.map +1 -0
  352. package/dist/helpers/markdownText.d.ts +14 -0
  353. package/dist/helpers/markdownText.d.ts.map +1 -0
  354. package/dist/helpers/markdownText.js +160 -0
  355. package/dist/helpers/markdownText.js.map +1 -0
  356. package/dist/helpers/qorusTypeCatalogue.d.ts +53 -0
  357. package/dist/helpers/qorusTypeCatalogue.d.ts.map +1 -0
  358. package/dist/helpers/qorusTypeCatalogue.js +262 -0
  359. package/dist/helpers/qorusTypeCatalogue.js.map +1 -0
  360. package/dist/helpers/readableColors.d.ts +36 -0
  361. package/dist/helpers/readableColors.d.ts.map +1 -0
  362. package/dist/helpers/readableColors.js +116 -0
  363. package/dist/helpers/readableColors.js.map +1 -0
  364. package/dist/helpers/templateItems.d.ts +2 -2
  365. package/dist/helpers/templateItems.d.ts.map +1 -1
  366. package/dist/helpers/templateItems.js +6 -4
  367. package/dist/helpers/templateItems.js.map +1 -1
  368. package/dist/helpers/templates.d.ts +26 -1
  369. package/dist/helpers/templates.d.ts.map +1 -1
  370. package/dist/helpers/templates.js +41 -6
  371. package/dist/helpers/templates.js.map +1 -1
  372. package/dist/helpers/validations.d.ts +9 -0
  373. package/dist/helpers/validations.d.ts.map +1 -1
  374. package/dist/helpers/validations.js +139 -33
  375. package/dist/helpers/validations.js.map +1 -1
  376. package/dist/hooks/useQorusTypes.d.ts +7 -15
  377. package/dist/hooks/useQorusTypes.d.ts.map +1 -1
  378. package/dist/hooks/useQorusTypes.js +25 -166
  379. package/dist/hooks/useQorusTypes.js.map +1 -1
  380. package/dist/hooks/useReadableIntentShade.d.ts +9 -0
  381. package/dist/hooks/useReadableIntentShade.d.ts.map +1 -0
  382. package/dist/hooks/useReadableIntentShade.js +23 -0
  383. package/dist/hooks/useReadableIntentShade.js.map +1 -0
  384. package/dist/hooks/useReadableOpacity.d.ts +6 -0
  385. package/dist/hooks/useReadableOpacity.d.ts.map +1 -0
  386. package/dist/hooks/useReadableOpacity.js +17 -0
  387. package/dist/hooks/useReadableOpacity.js.map +1 -0
  388. package/dist/index.d.ts +1 -0
  389. package/dist/index.d.ts.map +1 -1
  390. package/dist/index.js +1 -0
  391. package/dist/index.js.map +1 -1
  392. package/dist/tracking/ui/ExperimentCard.d.ts +1 -1
  393. package/dist/tracking/ui/ExperimentCard.d.ts.map +1 -1
  394. package/dist/tracking/ui/ExperimentCard.js +26 -10
  395. package/dist/tracking/ui/ExperimentCard.js.map +1 -1
  396. package/dist/tracking/ui/card.d.ts +2 -2
  397. package/dist/tracking/ui/card.d.ts.map +1 -1
  398. package/dist/tracking/ui/card.js +2 -2
  399. package/dist/tracking/ui/card.js.map +1 -1
  400. package/dist/tracking/ui/readable.d.ts +14 -0
  401. package/dist/tracking/ui/readable.d.ts.map +1 -0
  402. package/dist/tracking/ui/readable.js +60 -0
  403. package/dist/tracking/ui/readable.js.map +1 -0
  404. package/package.json +14 -5
  405. package/.claude/CLAUDE.md +0 -317
  406. package/.tasks/EXPORT_EXPRESSION_BUILDER.md +0 -38
  407. package/.tasks/EXPRESSION_BUILDER_REPORT.md +0 -149
  408. package/.tasks/EXPRESSION_FIELD_SEAMS.md +0 -66
  409. package/.tasks/FIELD_STACK_REPORT.md +0 -234
  410. package/.tasks/FORM_ENGINE_COMPACT_READ_FIRST.md +0 -558
  411. package/.tasks/FORM_ENGINE_EXPRESSIONS.md +0 -197
  412. package/.tasks/FORM_ENGINE_OPTIONS_SYNC.md +0 -95
  413. package/.tasks/FORM_FIELD_EXTRAS.md +0 -72
  414. package/.tasks/INDEX.md +0 -111
  415. package/.tasks/LSP_SHARED_CONNECTION.md +0 -75
  416. package/.tasks/QONSOLE_ASSIST_FEATURES.md +0 -306
  417. package/.tasks/RENDER_EXPRESSION_LSP.md +0 -159
  418. package/.tasks/REQRAFT_AUTO_FIELD.md +0 -176
  419. package/.tasks/SCHEMA_DEFINITION_FIELD.md +0 -250
  420. package/.tasks/SMART_EDITOR_CONTEXT_AND_POLISH.md +0 -340
  421. package/.tasks/SMART_EDITOR_LSP_FEATURES.md +0 -299
  422. package/.tasks/SMART_EDITOR_REVIEW_FOLLOWUPS.md +0 -280
  423. package/.tasks/SMART_EDITOR_UX_POLISH.md +0 -383
  424. package/.tasks/SMART_EDITOR_VISUAL_POLISH.md +0 -246
  425. package/.tasks/STORY_NETWORK_ISOLATION.md +0 -98
  426. package/.tasks/TEMPLATE_TOKEN_GRAMMAR.md +0 -72
  427. package/CODE_OF_CONDUCT.md +0 -105
  428. package/CONTRIBUTING.MD +0 -78
  429. package/SECURITY.md +0 -3
  430. package/chromatic.config.json +0 -5
  431. package/design/COMPACT_ENGINE_REDESIGN.md +0 -156
  432. package/design/COMPACT_INFO_DISPLAY.md +0 -87
  433. package/design/COMPACT_PARITY.md +0 -85
  434. package/design/EXPRESSION_BUILDER_REPORT_STRATEGY.md +0 -92
  435. package/design/FORM_ENGINE_COMPACT.md +0 -300
  436. package/design/FORM_ENGINE_COMPACT_UX_PLAN.md +0 -353
  437. package/design/FORM_ENGINE_EXPRESSIONS.md +0 -257
  438. package/design/FORM_ENGINE_FIELD_MIGRATION.md +0 -419
  439. package/design/IDE_INTEGRATION.md +0 -64
  440. package/design/RENDER_EXPRESSION_TRANSPORT.md +0 -156
  441. package/design/SELECT_DIALOG_FLOOR.md +0 -86
  442. package/design/SMART_EDITOR_UX.md +0 -438
  443. package/design/TRACKING.md +0 -290
  444. package/design/UNAVAILABLE_ALLOWED_VALUES.md +0 -226
  445. package/src/components/Description/index.tsx +0 -254
  446. package/src/components/Description/markdownRendererContext.tsx +0 -29
  447. package/src/components/FocusedEditing/index.tsx +0 -50
  448. package/src/components/codeSize/index.tsx +0 -79
  449. package/src/components/composer/Composer.stories.tsx +0 -238
  450. package/src/components/composer/Composer.tsx +0 -554
  451. package/src/components/composer/helpers.ts +0 -74
  452. package/src/components/composer/index.ts +0 -2
  453. package/src/components/dpqlEditor/DpqlEditor.stories.tsx +0 -1183
  454. package/src/components/dpqlEditor/DpqlEditor.tsx +0 -219
  455. package/src/components/dpqlEditor/dpqlHelpers.ts +0 -287
  456. package/src/components/dpqlEditor/dpqlInserter.ts +0 -121
  457. package/src/components/dpqlEditor/dpqlProbe.ts +0 -165
  458. package/src/components/dpqlEditor/dpqlTags.ts +0 -114
  459. package/src/components/dpqlEditor/index.ts +0 -41
  460. package/src/components/dpqlEditor/types.ts +0 -203
  461. package/src/components/dpqlEditor/useDpqlProbe.ts +0 -33
  462. package/src/components/dpqlEditor/useDpqlSession.ts +0 -411
  463. package/src/components/form/engine/CompactRow.tsx +0 -2620
  464. package/src/components/form/engine/CompactToolbar.tsx +0 -330
  465. package/src/components/form/engine/FormEngine.stories.tsx +0 -9920
  466. package/src/components/form/engine/FormEngine.tsx +0 -4569
  467. package/src/components/form/engine/FormEngineRemote.stories.tsx +0 -679
  468. package/src/components/form/engine/FormEngineStickyHeaders.stories.tsx +0 -331
  469. package/src/components/form/engine/FormFieldsSkeleton.tsx +0 -82
  470. package/src/components/form/engine/OptionFieldMessages.tsx +0 -477
  471. package/src/components/form/engine/OptionsHelpDialog.tsx +0 -29
  472. package/src/components/form/engine/__fixtures__/basicFormOptions.ts +0 -309
  473. package/src/components/form/engine/__fixtures__/fieldChromeOptions.ts +0 -45
  474. package/src/components/form/engine/_structuredData/SchemaDataView.stories.tsx +0 -233
  475. package/src/components/form/engine/_structuredData/SchemaDataView.tsx +0 -742
  476. package/src/components/form/engine/_structuredData/StructuredDataView.stories.tsx +0 -85
  477. package/src/components/form/engine/_structuredData/StructuredDataView.tsx +0 -75
  478. package/src/components/form/engine/_structuredData/structuredData.ts +0 -145
  479. package/src/components/form/engine/compactRowContext.ts +0 -148
  480. package/src/components/form/engine/compactRowStyles.ts +0 -898
  481. package/src/components/form/engine/compactToolbarContext.ts +0 -69
  482. package/src/components/form/engine/optionActions.ts +0 -128
  483. package/src/components/form/engine/optionsContext.ts +0 -24
  484. package/src/components/form/engine/readFirst.ts +0 -1077
  485. package/src/components/form/engine/rendererTypes.ts +0 -107
  486. package/src/components/form/engine/revealRow.ts +0 -123
  487. package/src/components/form/engine/rowFocus.ts +0 -101
  488. package/src/components/form/engine/rowMenuContext.ts +0 -159
  489. package/src/components/form/engine/rowOpenPicker.ts +0 -27
  490. package/src/components/form/engine/typeChoices.ts +0 -63
  491. package/src/components/form/engine/variants/FormEngineVariants.stories.tsx +0 -159
  492. package/src/components/form/engine/variants/VariantCalmTable.tsx +0 -244
  493. package/src/components/form/engine/variants/VariantCards.tsx +0 -212
  494. package/src/components/form/engine/variants/VariantFocus.tsx +0 -382
  495. package/src/components/form/engine/variants/VariantMinimal.tsx +0 -170
  496. package/src/components/form/engine/variants/focusDemo.ts +0 -145
  497. package/src/components/form/engine/variants/variantModel.ts +0 -223
  498. package/src/components/form/engine/variants/variantParts.tsx +0 -313
  499. package/src/components/form/expressions/DpqlRendering.tsx +0 -85
  500. package/src/components/form/expressions/ExpressionField.stories.tsx +0 -1395
  501. package/src/components/form/expressions/ExpressionField.tsx +0 -503
  502. package/src/components/form/expressions/argumentPresence.ts +0 -213
  503. package/src/components/form/expressions/builder/ExpressionBuilder.stories.tsx +0 -1683
  504. package/src/components/form/expressions/builder/argumentDetail.tsx +0 -17
  505. package/src/components/form/expressions/builder/argumentLabel.tsx +0 -146
  506. package/src/components/form/expressions/builder/argumentSlot.tsx +0 -101
  507. package/src/components/form/expressions/builder/argumentWrapper.tsx +0 -243
  508. package/src/components/form/expressions/builder/confirmMismatchedTypesModal.tsx +0 -120
  509. package/src/components/form/expressions/builder/confirmUnsupportedTypeModal.tsx +0 -69
  510. package/src/components/form/expressions/builder/index.tsx +0 -1545
  511. package/src/components/form/expressions/builder/item.tsx +0 -89
  512. package/src/components/form/expressions/builder/moveToPositionStrip.tsx +0 -156
  513. package/src/components/form/expressions/builder/renderTemplate.tsx +0 -42
  514. package/src/components/form/expressions/dpqlMockLanguage.ts +0 -566
  515. package/src/components/form/expressions/dpqlMockLsp.ts +0 -126
  516. package/src/components/form/expressions/mockExpressions.ts +0 -317
  517. package/src/components/form/expressions/renderExpressionToText.ts +0 -137
  518. package/src/components/form/expressions/types.ts +0 -110
  519. package/src/components/form/expressions/useExpressions.ts +0 -101
  520. package/src/components/form/expressions/useRenderExpression.ts +0 -165
  521. package/src/components/form/fields/Field.stories.tsx +0 -143
  522. package/src/components/form/fields/Field.tsx +0 -732
  523. package/src/components/form/fields/allowed-values/AllowedValues.tsx +0 -297
  524. package/src/components/form/fields/array/ArrayAuto.tsx +0 -237
  525. package/src/components/form/fields/array/ArrayAutoField.stories.tsx +0 -475
  526. package/src/components/form/fields/array/ArrayAutoField.tsx +0 -367
  527. package/src/components/form/fields/auto/AutoFormField.stories.tsx +0 -825
  528. package/src/components/form/fields/auto/AutoFormField.tsx +0 -1164
  529. package/src/components/form/fields/binary/Binary.stories.tsx +0 -122
  530. package/src/components/form/fields/binary/Binary.tsx +0 -91
  531. package/src/components/form/fields/boolean/Boolean.stories.tsx +0 -125
  532. package/src/components/form/fields/boolean/Boolean.tsx +0 -34
  533. package/src/components/form/fields/byte-size/ByteSize.stories.tsx +0 -87
  534. package/src/components/form/fields/byte-size/ByteSize.tsx +0 -58
  535. package/src/components/form/fields/color/Color.stories.tsx +0 -99
  536. package/src/components/form/fields/color/Color.tsx +0 -46
  537. package/src/components/form/fields/cron/Cron.stories.tsx +0 -68
  538. package/src/components/form/fields/cron/Cron.tsx +0 -80
  539. package/src/components/form/fields/date/Date.stories.tsx +0 -77
  540. package/src/components/form/fields/date/Date.tsx +0 -55
  541. package/src/components/form/fields/emittedValues.ts +0 -70
  542. package/src/components/form/fields/file/File.stories.tsx +0 -161
  543. package/src/components/form/fields/file/File.tsx +0 -227
  544. package/src/components/form/fields/long-string/LongString.stories.tsx +0 -120
  545. package/src/components/form/fields/long-string/LongString.tsx +0 -130
  546. package/src/components/form/fields/markdown/Markdown.stories.tsx +0 -76
  547. package/src/components/form/fields/markdown/Markdown.tsx +0 -81
  548. package/src/components/form/fields/markdown/MarkdownView.tsx +0 -222
  549. package/src/components/form/fields/multi-select/MultiSelectFormField.tsx +0 -139
  550. package/src/components/form/fields/number/Number.stories.tsx +0 -159
  551. package/src/components/form/fields/number/Number.tsx +0 -160
  552. package/src/components/form/fields/object/Object.stories.tsx +0 -398
  553. package/src/components/form/fields/object/Object.tsx +0 -255
  554. package/src/components/form/fields/radio-group/RadioGroup.stories.tsx +0 -95
  555. package/src/components/form/fields/radio-group/RadioGroup.tsx +0 -46
  556. package/src/components/form/fields/radio-group/images/java-96x128.png +0 -0
  557. package/src/components/form/fields/radio-group/images/python-129x128.png +0 -0
  558. package/src/components/form/fields/radio-group/images/qore-106x128.png +0 -0
  559. package/src/components/form/fields/rich-text/RichText.stories.tsx +0 -260
  560. package/src/components/form/fields/rich-text/RichText.tsx +0 -537
  561. package/src/components/form/fields/schema-definition/CatalogLeafForm.tsx +0 -242
  562. package/src/components/form/fields/schema-definition/CatalogNodeEditor.tsx +0 -758
  563. package/src/components/form/fields/schema-definition/Hint.tsx +0 -22
  564. package/src/components/form/fields/schema-definition/InlineValidationBanner.tsx +0 -138
  565. package/src/components/form/fields/schema-definition/Loader.tsx +0 -20
  566. package/src/components/form/fields/schema-definition/MigrationsTab.tsx +0 -187
  567. package/src/components/form/fields/schema-definition/SchemaDefinitionField.stories.tsx +0 -286
  568. package/src/components/form/fields/schema-definition/TableEditor.tsx +0 -155
  569. package/src/components/form/fields/schema-definition/TablesTab.tsx +0 -138
  570. package/src/components/form/fields/schema-definition/catalog.ts +0 -237
  571. package/src/components/form/fields/schema-definition/helpers.ts +0 -90
  572. package/src/components/form/fields/schema-definition/index.tsx +0 -418
  573. package/src/components/form/fields/schema-definition/mockCatalog.ts +0 -325
  574. package/src/components/form/fields/schema-definition/mockDefinition.ts +0 -111
  575. package/src/components/form/fields/schema-definition/referenceSuggestions.tsx +0 -152
  576. package/src/components/form/fields/schema-definition/starterTemplate.ts +0 -68
  577. package/src/components/form/fields/schema-definition/types.ts +0 -185
  578. package/src/components/form/fields/schema-definition/useSchemaOptionCatalog.ts +0 -49
  579. package/src/components/form/fields/select/Select.stories.tsx +0 -872
  580. package/src/components/form/fields/select/Select.tsx +0 -624
  581. package/src/components/form/fields/select/SelectCollection.tsx +0 -594
  582. package/src/components/form/fields/string/String.stories.tsx +0 -86
  583. package/src/components/form/fields/string/String.tsx +0 -43
  584. package/src/components/form/fields/template/ExampleValueModal.stories.tsx +0 -114
  585. package/src/components/form/fields/template/ExampleValueModal.tsx +0 -99
  586. package/src/components/form/fields/template/ReadOnlyTemplateTag.tsx +0 -47
  587. package/src/components/form/fields/template/TemplateField.stories.tsx +0 -1121
  588. package/src/components/form/fields/template/TemplateField.tsx +0 -1717
  589. package/src/components/form/fields/template/TemplateText.tsx +0 -115
  590. package/src/components/form/fields/template/__fixtures__/longExampleValue.ts +0 -7
  591. package/src/components/form/fields/template/__fixtures__/multiLevelTemplates.json +0 -147
  592. package/src/components/form/fields/template/__fixtures__/templates.json +0 -83
  593. package/src/components/form/fields/timeout/Timeout.stories.tsx +0 -228
  594. package/src/components/form/fields/timeout/Timeout.tsx +0 -87
  595. package/src/components/form/fields/url/Url.stories.tsx +0 -94
  596. package/src/components/form/fields/url/Url.tsx +0 -85
  597. package/src/components/form/index.tsx +0 -47
  598. package/src/components/imageLightbox/ImageLightbox.stories.tsx +0 -238
  599. package/src/components/imageLightbox/ImageLightbox.tsx +0 -236
  600. package/src/components/imageLightbox/index.ts +0 -1
  601. package/src/components/log/Log.stories.tsx +0 -333
  602. package/src/components/log/Log.tsx +0 -285
  603. package/src/components/menu/Menu.stories.tsx +0 -155
  604. package/src/components/menu/Menu.tsx +0 -312
  605. package/src/components/qonsoleSmartInput/QonsoleSmartInput.stories.tsx +0 -797
  606. package/src/components/qonsoleSmartInput/QonsoleSmartInput.tsx +0 -105
  607. package/src/components/qonsoleSmartInput/index.ts +0 -16
  608. package/src/components/qonsoleSmartInput/qonsoleInserter.ts +0 -77
  609. package/src/components/qonsoleSmartInput/types.ts +0 -133
  610. package/src/components/qonsoleSmartInput/useQonsoleSession.ts +0 -124
  611. package/src/components/searchFilterBar/SearchFilterBar.stories.tsx +0 -62
  612. package/src/components/searchFilterBar/SearchFilterBar.tsx +0 -144
  613. package/src/components/searchFilterBar/index.ts +0 -1
  614. package/src/components/smartEditor/MarkdownDoc.tsx +0 -190
  615. package/src/components/smartEditor/SmartEditor.stories.tsx +0 -475
  616. package/src/components/smartEditor/SmartEditor.tsx +0 -808
  617. package/src/components/smartEditor/__fixtures__/mockLspServer.ts +0 -205
  618. package/src/components/smartEditor/helpers.ts +0 -217
  619. package/src/components/smartEditor/index.ts +0 -35
  620. package/src/components/smartEditor/styling.ts +0 -45
  621. package/src/components/smartEditor/types.ts +0 -211
  622. package/src/components/smartEditor/useLspAutocomplete.ts +0 -758
  623. package/src/components/smartEditor/useLspDiagnosticDecorations.ts +0 -125
  624. package/src/components/smartEditor/useLspHover.ts +0 -230
  625. package/src/components/smartEditor/useLspSemanticTokens.ts +0 -298
  626. package/src/components/smartEditor/useLspSession.ts +0 -231
  627. package/src/components/smartEditor/useLspSignatureHelp.ts +0 -198
  628. package/src/components/supportTicket/AttachmentChips.stories.tsx +0 -171
  629. package/src/components/supportTicket/AttachmentChips.tsx +0 -147
  630. package/src/components/supportTicket/InterfaceReferenceTags.stories.tsx +0 -257
  631. package/src/components/supportTicket/InterfaceReferenceTags.tsx +0 -129
  632. package/src/components/supportTicket/ReferencePicker.stories.tsx +0 -584
  633. package/src/components/supportTicket/ReferencePicker.tsx +0 -563
  634. package/src/components/supportTicket/TicketConversation.stories.tsx +0 -121
  635. package/src/components/supportTicket/TicketHeader.stories.tsx +0 -183
  636. package/src/components/supportTicket/TicketHeader.tsx +0 -247
  637. package/src/components/supportTicket/TicketMetaTags.stories.tsx +0 -103
  638. package/src/components/supportTicket/TicketMetaTags.tsx +0 -85
  639. package/src/components/supportTicket/TicketReplyBox.stories.tsx +0 -354
  640. package/src/components/supportTicket/TicketReplyBox.tsx +0 -150
  641. package/src/components/supportTicket/__fixtures__/kindMarks.ts +0 -28
  642. package/src/components/supportTicket/attachmentAccess.ts +0 -97
  643. package/src/components/supportTicket/fileToAttachment.ts +0 -24
  644. package/src/components/supportTicket/index.ts +0 -10
  645. package/src/components/supportTicket/meta.ts +0 -206
  646. package/src/components/supportTicket/ticketModel.ts +0 -131
  647. package/src/components/supportTicket/useLoadedImages.ts +0 -73
  648. package/src/components/ticketReferences/TicketReferences.stories.tsx +0 -315
  649. package/src/components/ticketReferences/TicketReferences.tsx +0 -906
  650. package/src/components/ticketReferences/index.ts +0 -2
  651. package/src/components/ticketThread/TicketThread.stories.tsx +0 -829
  652. package/src/components/ticketThread/TicketThread.tsx +0 -719
  653. package/src/components/ticketThread/index.ts +0 -6
  654. package/src/contexts/FetchContext.tsx +0 -25
  655. package/src/contexts/ReqraftContext.tsx +0 -9
  656. package/src/contexts/StorageContext.tsx +0 -33
  657. package/src/global.d.ts +0 -4
  658. package/src/helpers/allowedValues.ts +0 -249
  659. package/src/helpers/choiceChip.ts +0 -227
  660. package/src/helpers/common.ts +0 -326
  661. package/src/helpers/dpqlDetection.ts +0 -209
  662. package/src/helpers/expressions.ts +0 -140
  663. package/src/helpers/optionUiTypes.ts +0 -199
  664. package/src/helpers/options.ts +0 -150
  665. package/src/helpers/providerValue.ts +0 -125
  666. package/src/helpers/scrollbar.ts +0 -32
  667. package/src/helpers/singleLineString.ts +0 -61
  668. package/src/helpers/templateItems.ts +0 -81
  669. package/src/helpers/templateText.ts +0 -350
  670. package/src/helpers/templates.ts +0 -602
  671. package/src/helpers/validations.ts +0 -2085
  672. package/src/hooks/useArgSchema.ts +0 -37
  673. package/src/hooks/useCoarsePointer.ts +0 -30
  674. package/src/hooks/useFetch/useFetch.stories.tsx +0 -379
  675. package/src/hooks/useFetch/useFetch.tsx +0 -154
  676. package/src/hooks/usePhoneViewport.ts +0 -34
  677. package/src/hooks/useQorusTypes.ts +0 -233
  678. package/src/hooks/useReqraftProperty.ts +0 -16
  679. package/src/hooks/useStorage/useStorage.stories.tsx +0 -168
  680. package/src/hooks/useStorage/useStorage.ts +0 -35
  681. package/src/hooks/useTemplates.ts +0 -123
  682. package/src/hooks/useValidation.ts +0 -9
  683. package/src/hooks/useWebSocket/useWebSocket.ts +0 -224
  684. package/src/hooks/useWebSocket/useWebsocket.stories.tsx +0 -640
  685. package/src/hooks/useWhyDidYouUpdate.ts +0 -38
  686. package/src/index.tsx +0 -86
  687. package/src/providers/FetchProvider.tsx +0 -40
  688. package/src/providers/ReqraftProvider.tsx +0 -52
  689. package/src/providers/StorageProvider.tsx +0 -131
  690. package/src/stores/currentUser/currentUser.stories.tsx +0 -100
  691. package/src/stores/currentUser/currentUser.tsx +0 -94
  692. package/src/stories/Data/fileFieldArgSchema.json +0 -86
  693. package/src/stories/Tests/utils.ts +0 -320
  694. package/src/stories/storyNetwork.ts +0 -92
  695. package/src/stories/tracking.tsx +0 -206
  696. package/src/tracking/browser/attach.ts +0 -186
  697. package/src/tracking/browser/env.ts +0 -78
  698. package/src/tracking/core/consent.ts +0 -37
  699. package/src/tracking/core/engagement.ts +0 -47
  700. package/src/tracking/core/experiments.ts +0 -258
  701. package/src/tracking/core/hash.ts +0 -26
  702. package/src/tracking/core/ids.ts +0 -25
  703. package/src/tracking/core/observable.ts +0 -23
  704. package/src/tracking/core/queue.ts +0 -131
  705. package/src/tracking/core/sections.ts +0 -166
  706. package/src/tracking/core/storage.ts +0 -69
  707. package/src/tracking/core/tracker.ts +0 -417
  708. package/src/tracking/core/types.ts +0 -162
  709. package/src/tracking/core/utm.ts +0 -23
  710. package/src/tracking/index.ts +0 -72
  711. package/src/tracking/markup.ts +0 -17
  712. package/src/tracking/react/Experiment.tsx +0 -44
  713. package/src/tracking/react/TrackingProvider.tsx +0 -56
  714. package/src/tracking/react/hooks.ts +0 -106
  715. package/src/tracking/react/index.ts +0 -13
  716. package/src/tracking/testing.ts +0 -108
  717. package/src/tracking/ui/ExperimentCard.stories.tsx +0 -296
  718. package/src/tracking/ui/ExperimentCard.tsx +0 -667
  719. package/src/tracking/ui/ExperimentsOverlay.stories.tsx +0 -155
  720. package/src/tracking/ui/ExperimentsOverlay.tsx +0 -437
  721. package/src/tracking/ui/anchor.ts +0 -180
  722. package/src/tracking/ui/card.ts +0 -464
  723. package/src/tracking/ui/client.ts +0 -117
  724. package/src/tracking/ui/index.ts +0 -77
  725. package/src/tracking/ui/types.ts +0 -110
  726. package/src/tracking/ui/useExperimentsAdmin.ts +0 -103
  727. package/src/types/Form.ts +0 -29
  728. package/src/types.ts +0 -14
  729. package/src/utils/datetime.ts +0 -10
  730. package/src/utils/fetch.ts +0 -457
  731. package/src/utils/lspClient.ts +0 -711
  732. package/src/utils/lspClient.types.ts +0 -211
  733. package/src/utils/queryUnlessCancelled.ts +0 -28
  734. package/src/utils/websocket.ts +0 -293
  735. package/vite.config.ts +0 -58
  736. package/vitest.config.ts +0 -69
@@ -1,1077 +0,0 @@
1
- import {
2
- IQorusFormField,
3
- IQorusFormSchema,
4
- TQorusFormFieldSchema,
5
- TQorusType,
6
- } from '@qoretechnologies/ts-toolkit';
7
- import { isRendererOnlyUiType } from './rendererTypes';
8
- import { isEmptyUiEnvelope, isUiEncodedValue } from './_structuredData/structuredData';
9
- import { renderExpressionToText } from '../expressions/renderExpressionToText';
10
- import { IExpressionValue } from '../expressions/types';
11
- import yaml from 'js-yaml';
12
- import { formatTimeoutValue, richtextToString } from '../../../helpers/common';
13
- import { firstDeclaredType } from '../../../helpers/optionUiTypes';
14
- import { findAllowedValueOption } from '../../../helpers/allowedValues';
15
-
16
- /** "N noun" with naive pluralisation ("1 item", "2 items"). */
17
- const pluralize = (count: number, noun: string): string =>
18
- `${count} ${noun}${count === 1 ? '' : 's'}`;
19
-
20
- // The server's typed-value serialization wraps each value in an envelope —
21
- // `{ type, value }` plus optional descriptive keys. Only this exact shape is
22
- // unwrapped; any foreign key means it's a real user hash, not an envelope.
23
- // One envelope definition for the whole engine: the structured tree and the
24
- // hash summaries must agree on what unwraps (`isUiEncodedValue` carries the
25
- // full server allow-list, incl. keys like `sensitive`/`required`).
26
- const isTypedEnvelope = (raw: unknown): raw is IQorusFormField => isUiEncodedValue(raw);
27
-
28
- /** Reduce ONE list item to a short, human label — never an object. Unwraps a
29
- * typed `{type, value}` envelope, prefers a `name`/`display_name`, and returns
30
- * undefined for a bare object (no name) so the caller falls back to a count
31
- * instead of printing "[object Object]". */
32
- const summarizeListItem = (item: unknown): string | number | undefined => {
33
- if (item === null || item === undefined) return undefined;
34
- if (typeof item !== 'object') return item as string | number;
35
- const obj = item as Record<string, unknown>;
36
- // A named object (or allowed-value) → its label.
37
- if (typeof obj.name === 'string' || typeof obj.name === 'number') return obj.name;
38
- if (typeof obj.display_name === 'string') return obj.display_name;
39
- // A typed envelope ({type, value}) or a {value} wrapper → look inside once.
40
- if ('value' in obj) {
41
- const inner = obj.value;
42
- if (inner === null || inner === undefined) return undefined;
43
- if (typeof inner !== 'object') return inner as string | number;
44
- const innerName = (inner as Record<string, unknown>).name;
45
- return typeof innerName === 'string' || typeof innerName === 'number' ? innerName : undefined;
46
- }
47
- return undefined;
48
- };
49
-
50
- /**
51
- * Label ONE list item from the sub-schema that describes it.
52
- *
53
- * `summarizeListItem` can only read an item that names ITSELF — one carrying a
54
- * `name` or `display_name` key. A hash whose fields are all domain fields names
55
- * itself nowhere: an auth profile's scheme has `type`, `cookie_name`,
56
- * `redirect_url`, and the row fell back to "2 items" — true, and silent about
57
- * which two.
58
- *
59
- * The `arg_schema` is the same description the sub-form was built from, so the
60
- * row can read an item the way the form asked for it: the FIRST declared field
61
- * the item actually has, resolved through that field's allowed values. The
62
- * scheme list then reads "Default RBAC, Cookie" — the words the author picked —
63
- * instead of a count.
64
- *
65
- * Schema order, not value order: the first declared field is the one the form
66
- * puts at the top of the item, which is the one that identifies it to its author.
67
- * Value order is insertion order and would vary between two equal items.
68
- */
69
- const summarizeHashItemFromSchema = (
70
- item: unknown,
71
- argSchema: Record<string, TQorusFormFieldSchema> | undefined
72
- ): string | number | undefined => {
73
- if (!argSchema) {
74
- return undefined;
75
- }
76
- const record = isTypedEnvelope(item) ? item.value : item;
77
- if (!record || typeof record !== 'object' || Array.isArray(record)) {
78
- return undefined;
79
- }
80
- const fields = record as Record<string, unknown>;
81
- const key = Object.keys(argSchema).find((name) => {
82
- const raw = fields[name];
83
- const value = isTypedEnvelope(raw) ? raw.value : raw;
84
- return value !== undefined && value !== null && value !== '';
85
- });
86
- if (!key) {
87
- return undefined;
88
- }
89
- const raw = fields[key];
90
- const value = isTypedEnvelope(raw) ? raw.value : raw;
91
- const label = getAllowedValueLabel(value, argSchema[key]);
92
- if (label) {
93
- return label;
94
- }
95
- // No allowed values (a free-text field): the stored value IS what was typed,
96
- // so it reads correctly as-is. An object at this position has no short form,
97
- // and a count beats printing its shape.
98
- return typeof value === 'string' || typeof value === 'number' ? value : undefined;
99
- };
100
-
101
- /** Summarise a list value: join item labels, or fall back to an "N items" count
102
- * (e.g. a list of anonymous hashes). Never prints raw objects. */
103
- /**
104
- * Join a list into one line, labelling each item from the field's allowed values
105
- * where it has them.
106
- *
107
- * A multi-select stores what the server stores -- a parse option is
108
- * `PO_REQUIRE_TYPES`, a permission is a code -- and the picker is what turns
109
- * that into something readable. The row has the same allowed values the picker
110
- * does, so it can read the same way instead of printing the wire form back.
111
- */
112
- const formatList = (items: unknown[], schema?: TQorusFormFieldSchema): string => {
113
- const argSchema = (schema as { arg_schema?: Record<string, TQorusFormFieldSchema> } | undefined)
114
- ?.arg_schema;
115
- const parts = items
116
- .map(
117
- (item) =>
118
- getAllowedValueLabel(item, schema) ??
119
- summarizeListItem(item) ??
120
- summarizeHashItemFromSchema(item, argSchema)
121
- )
122
- .filter((part) => part !== '' && part !== undefined && part !== null);
123
-
124
- return parts.length ? parts.join(', ') : pluralize(items.length, 'item');
125
- };
126
-
127
- /** "datasource · omquser · /bb_local": the provider's kind, its name and its
128
- * path, as the picker shows them. A read row must say WHICH provider a value
129
- * is, and "11 fields" said only how many keys describe it. Undefined when the
130
- * value is not shaped like a provider, so the caller falls through. */
131
- export const formatDataProviderValue = (value: unknown): string | undefined => {
132
- if (!value || typeof value !== 'object' || Array.isArray(value)) {
133
- return undefined;
134
- }
135
- const { type, name, path } = value as { type?: unknown; name?: unknown; path?: unknown };
136
- const parts = [type, name, path].filter(
137
- (part): part is string => typeof part === 'string' && part.trim() !== ''
138
- );
139
- return parts.length ? parts.join(' · ') : undefined;
140
- };
141
-
142
- /** Summarise a hash/object by its field count ("2 fields"), or "Set" when empty. */
143
- const fieldCountLabel = (obj: object): string => {
144
- const keys = Object.keys(obj);
145
- return keys.length ? pluralize(keys.length, 'field') : 'Set';
146
- };
147
-
148
- /** The object/list editor stores complex values as a serialized YAML string
149
- * (`%YAML 1.2 --- […]`) — parse it back for the summary; undefined when the
150
- * string isn't a serialized structure. */
151
- const parseSerialized = (value: string, type?: string): unknown => {
152
- const looksLikeYamlDoc = /^\s*(%YAML|---)\s/.test(value);
153
- if (type !== 'list' && type !== 'hash' && !looksLikeYamlDoc) {
154
- return undefined;
155
- }
156
- try {
157
- return yaml.load(value);
158
- } catch {
159
- return undefined;
160
- }
161
- };
162
-
163
- /**
164
- * Pure helpers for FormEngine compact (read-first) mode: format an option's
165
- * stored value into a short summary and resolve its group. Unit-testable.
166
- */
167
-
168
- /** A value is "empty" (nothing set) when it is nullish, an empty string, or an empty array. */
169
- export const isOptionValueEmpty = (value: unknown): boolean =>
170
- value === undefined ||
171
- value === null ||
172
- value === '' ||
173
- (Array.isArray(value) && value.length === 0);
174
-
175
- /**
176
- * A schema-declared hash whose every entry is a materialised-but-unset field.
177
- *
178
- * `preselected` on a sub-field means "show this in the form so the author sees
179
- * it exists" — a FORM instruction. Opening the sub-form materialises each one,
180
- * `fixOptions` writes `{type: 'int'}` with no value, and the draft autosaves
181
- * that, so the stored hash permanently carries keys that stand for nothing.
182
- *
183
- * The row then read those keys as content: `Runtime Defaults` listed three
184
- * sub-fields with no values, counted toward "7/12 set", and showed a green
185
- * set-dot — while the sub-form it summarises correctly said 0/3 set. Nothing
186
- * was ever entered.
187
- *
188
- * Requires the sub-schema, and requires each key to be declared by it: without
189
- * that, `{type: 'x'}` could be somebody's data rather than an empty envelope.
190
- */
191
- export const isUnsetSchemaHash = (value: unknown, schema?: TQorusFormFieldSchema): boolean => {
192
- const argSchema = (schema as { arg_schema?: Record<string, unknown> } | undefined)?.arg_schema;
193
- if (!argSchema || typeof argSchema !== 'object') {
194
- return false;
195
- }
196
- const inner =
197
- value && typeof value === 'object' && !Array.isArray(value) && 'value' in (value as object) ?
198
- (value as { value: unknown }).value
199
- : value;
200
- if (!inner || typeof inner !== 'object' || Array.isArray(inner)) {
201
- return false;
202
- }
203
- const keys = Object.keys(inner as object);
204
- return (
205
- keys.length > 0 &&
206
- keys.every(
207
- (key) =>
208
- !!(argSchema as Record<string, unknown>)[key] &&
209
- isEmptyUiEnvelope((inner as Record<string, unknown>)[key])
210
- )
211
- );
212
- };
213
-
214
- export const isFixedCompactAllowedValueOption = (
215
- schema: TQorusFormFieldSchema | undefined
216
- ): boolean => {
217
- if (!schema) {
218
- return false;
219
- }
220
-
221
- const selectableSchema = schema as TQorusFormFieldSchema & { items?: unknown[] };
222
- const options =
223
- selectableSchema.allowed_values?.length ?
224
- selectableSchema.allowed_values
225
- : selectableSchema.items;
226
-
227
- return !!(
228
- options?.length &&
229
- !schema.allowed_values_creatable &&
230
- !schema.multiselect &&
231
- !schema.arg_schema
232
- );
233
- };
234
-
235
- export const shouldAutoCollapseCompactAllowedValueOption = (
236
- schema: TQorusFormFieldSchema | undefined,
237
- value: unknown
238
- ): boolean => !isOptionValueEmpty(value) && isFixedCompactAllowedValueOption(schema);
239
-
240
- /** Boolean fields have three meaningful states: unset, Yes, and No. Once the
241
- * user chooses either boolean value in compact mode, the choice is complete
242
- * and the inline editor can close without a separate confirmation. */
243
- export const isCompactBooleanOption = (schema: TQorusFormFieldSchema | undefined): boolean => {
244
- const type = firstDeclaredType(schema?.ui_type || schema?.type)?.toLowerCase();
245
- return type === 'bool' || type === 'boolean';
246
- };
247
-
248
- /**
249
- * Whether a change completes a compact row, so its editor can close.
250
- *
251
- * Only a VALUE does: Yes or No, or one of a fixed list. An expression is
252
- * built one step at a time - an operation, then each of its arguments - and
253
- * every step is a change; closing the editor on the first one left a bool
254
- * field's condition at `null > null`, with no way to fill in its arguments
255
- * short of opening the row again for each of them.
256
- *
257
- * @param isExpression the row now holds an expression (`is_expression`)
258
- */
259
- export const shouldAutoCollapseCompactOption = (
260
- schema: TQorusFormFieldSchema | undefined,
261
- value: unknown,
262
- isExpression?: boolean
263
- ): boolean =>
264
- !isExpression &&
265
- !isOptionValueEmpty(value) &&
266
- (isCompactBooleanOption(schema) || isFixedCompactAllowedValueOption(schema));
267
-
268
- /**
269
- * Prefer the matching allowed_values entry's display_name (fallback `name`)
270
- * over the raw stored value. The predicate lives in `helpers/allowedValues`,
271
- * where the validator uses it too, so a value the row can name is exactly a
272
- * value the form accepts.
273
- */
274
- export { findAllowedValueOption };
275
-
276
- const getAllowedValueLabel = (
277
- value: unknown,
278
- schema?: TQorusFormFieldSchema
279
- ): string | undefined => {
280
- const match = findAllowedOption(value, schema);
281
- return match ? match.display_name || match.title || match.name || undefined : undefined;
282
- };
283
-
284
- /** Local alias for the module's own callers. */
285
- const findAllowedOption = findAllowedValueOption;
286
-
287
- /** True when the field's selectable options carry images (logos). Such a choice
288
- * renders too tall/rich for an inline row, so compact opens it in the card. */
289
- export const optionHasImages = (schema?: TQorusFormFieldSchema): boolean => {
290
- const s = schema as { allowed_values?: any[]; items?: any[] } | undefined;
291
- const options = s?.allowed_values?.length ? s.allowed_values : s?.items;
292
- return !!options?.some((option) => !!option?.image);
293
- };
294
-
295
- /** The selected option's image (logo), when it carries one — for the value cell. */
296
- export const getAllowedValueImage = (
297
- value: unknown,
298
- schema?: TQorusFormFieldSchema
299
- ): string | undefined => {
300
- const match = findAllowedOption(value, schema);
301
- return (match?.image as string) || undefined;
302
- };
303
-
304
- /**
305
- * The selected option's ICON, when it carries one and no logo — for the value
306
- * cell.
307
- *
308
- * The same idea as {@link getAllowedValueImage} and read for the same reason:
309
- * an option's mark belongs beside the value it names. Only images were rendered,
310
- * so a picker whose entries are distinguished by ICON — an interface-kind list
311
- * where every entry is a bare word, `Service`, `Job`, `Qog` — showed each mark
312
- * while choosing and then dropped it the moment the row went read-only, which is
313
- * the surface a reader spends the most time on.
314
- *
315
- * The image wins where an option has both: a logo is the more specific mark, and
316
- * an icon standing behind it is a fallback rather than a second thing to draw.
317
- */
318
- export const getAllowedValueIcon = (
319
- value: unknown,
320
- schema?: TQorusFormFieldSchema
321
- ): string | undefined => {
322
- const match = findAllowedOption(value, schema);
323
- if (!match || match.image) {
324
- return undefined;
325
- }
326
- return (match.icon as string) || undefined;
327
- };
328
-
329
- /** Clamp an RGB channel to a 0–255 integer. */
330
- const clampChannel = (n: number): number => Math.max(0, Math.min(255, Math.round(n)));
331
- const toHexPart = (n: number): string => clampChannel(n).toString(16).padStart(2, '0');
332
-
333
- /** The shape the rgbcolor field stores (react-color's RGBA result). */
334
- type TColorValue = { r?: number; g?: number; b?: number; a?: number; hex?: string };
335
-
336
- /** Normalised colour parts parsed from any shape the rgbcolor field can store. */
337
- interface IParsedColor {
338
- hex?: string;
339
- r?: number;
340
- g?: number;
341
- b?: number;
342
- a: number;
343
- }
344
-
345
- /** Whether parsed colour parts carry usable RGB channels. */
346
- const hasRgb = (c: IParsedColor): c is IParsedColor & { r: number; g: number; b: number } =>
347
- c.r !== undefined && c.g !== undefined && c.b !== undefined;
348
-
349
- /** Parse an `rgbcolor` into normalised parts: accepts `{ r, g, b, a }` (may
350
- * carry `hex`), `{ hex }`, or a raw hex string; undefined when unrecognisable. */
351
- const parseColor = (value: unknown): IParsedColor | undefined => {
352
- if (typeof value === 'string') {
353
- const trimmed = value.trim();
354
- return trimmed.startsWith('#') ? { hex: trimmed, a: 1 } : undefined;
355
- }
356
- if (value && typeof value === 'object') {
357
- const c = value as TColorValue;
358
- const a = typeof c.a === 'number' ? c.a : 1;
359
- const hex = typeof c.hex === 'string' && c.hex.trim() ? c.hex.trim() : undefined;
360
- if (typeof c.r === 'number' && typeof c.g === 'number' && typeof c.b === 'number') {
361
- return { r: c.r, g: c.g, b: c.b, a, hex };
362
- }
363
- if (hex) {
364
- return { hex, a };
365
- }
366
- }
367
- return undefined;
368
- };
369
-
370
- /** Uppercase hex (`#0000FF`), or `rgba(…)` when non-opaque; undefined when
371
- * unrecognisable (the caller falls back to the generic marker). */
372
- export const formatColorValue = (value: unknown): string | undefined => {
373
- const c = parseColor(value);
374
- if (!c) {
375
- return undefined;
376
- }
377
- // Prefer rgba(…) for non-opaque colours; the hex shortcut would drop alpha.
378
- if (c.a < 1 && hasRgb(c)) {
379
- const alpha = Math.round(c.a * 100) / 100;
380
- return `rgba(${clampChannel(c.r)}, ${clampChannel(c.g)}, ${clampChannel(c.b)}, ${alpha})`;
381
- }
382
- if (c.hex) {
383
- return c.hex.toUpperCase();
384
- }
385
- return hasRgb(c) ?
386
- `#${toHexPart(c.r)}${toHexPart(c.g)}${toHexPart(c.b)}`.toUpperCase()
387
- : undefined;
388
- };
389
-
390
- /** CSS colour for the swatch preview (keeps alpha); undefined when
391
- * unrecognisable. */
392
- export const colorToCss = (value: unknown): string | undefined => {
393
- const c = parseColor(value);
394
- if (!c) {
395
- return undefined;
396
- }
397
- return hasRgb(c) ?
398
- `rgba(${clampChannel(c.r)}, ${clampChannel(c.g)}, ${clampChannel(c.b)}, ${c.a})`
399
- : c.hex;
400
- };
401
-
402
- /** Filename for a `file` value: accepts `{ name, content, size }`, the
403
- * build-tab `{ name: { value } }` shape, or a raw path; undefined when no
404
- * filename resolves. */
405
- export const formatFileValue = (value: unknown): string | undefined => {
406
- if (typeof value === 'string') {
407
- const name = value.trim().split(/[\\/]/).pop();
408
- return name || undefined;
409
- }
410
- if (value && typeof value === 'object') {
411
- const name = (value as { name?: unknown }).name;
412
- if (typeof name === 'string' && name.trim()) {
413
- return name.trim();
414
- }
415
- const nested = (name as { value?: unknown } | undefined)?.value;
416
- if (typeof nested === 'string' && nested.trim()) {
417
- return nested.trim();
418
- }
419
- }
420
- return undefined;
421
- };
422
-
423
- /** The byte size of a `file` value, when present (for the muted size suffix). */
424
- export const getFileSize = (value: unknown): number | undefined => {
425
- const size = (value as { size?: unknown } | undefined)?.size;
426
- return typeof size === 'number' && Number.isFinite(size) && size >= 0 ? size : undefined;
427
- };
428
-
429
- /**
430
- * Effective UI type for DISPLAY — which preview/summary a value renders as.
431
- *
432
- * A renderer-only `ui_type` wins outright: the field's stored `type` holds the
433
- * STORAGE type for those (a `code-editor` stores a string), so consulting the
434
- * stored type here would render the bespoke editor's value as a plain string and
435
- * silently drop its preview. Every other case keeps the stored type first, so an
436
- * `any`/`auto` field still displays as whatever concrete type the user picked.
437
- */
438
- export const getValueType = (
439
- option?: IQorusFormField,
440
- schema?: TQorusFormFieldSchema
441
- ): string | undefined => {
442
- const uiType = (schema as { ui_type?: string } | undefined)?.ui_type;
443
-
444
- if (isRendererOnlyUiType(uiType as TQorusType)) {
445
- return uiType;
446
- }
447
-
448
- return (option?.type || uiType || (schema as { type?: string } | undefined)?.type) as
449
- string | undefined;
450
- };
451
-
452
- /** Human-readable byte count (e.g. `1.2 KB`). */
453
- export const formatBytes = (bytes: number): string => {
454
- if (bytes < 1024) {
455
- return `${bytes} B`;
456
- }
457
- const units = ['KB', 'MB', 'GB', 'TB'];
458
- let size = bytes / 1024;
459
- let unit = 0;
460
- while (size >= 1024 && unit < units.length - 1) {
461
- size /= 1024;
462
- unit += 1;
463
- }
464
- return `${size >= 10 || Number.isInteger(size) ? Math.round(size) : size.toFixed(1)} ${units[unit]}`;
465
- };
466
-
467
- /**
468
- * Short read-first summary of a value; '' when unset (the caller renders the
469
- * placeholder). Bools → Yes/No, allowed_values → display label, colour →
470
- * hex/rgba, file → filename, richtext → plain text, timeout → scaled duration
471
- * ("45 seconds"), list → joined names, hash → "N fields" (generic "Set"
472
- * fallback).
473
- */
474
- /** Read-first summary of a `schema-definition` value: the schema name plus a
475
- * table count (e.g. `orders · 2 tables`). */
476
- const formatSchemaDefinition = (value: unknown): string => {
477
- if (!value || typeof value !== 'object') return 'Schema';
478
- const def = value as { schema?: { name?: string }; tables?: object };
479
- const name = def.schema?.name;
480
- const count = def.tables ? Object.keys(def.tables).length : 0;
481
- const tables = count ? ` · ${count} table${count === 1 ? '' : 's'}` : '';
482
- return name ? `${name}${tables}` : 'Schema';
483
- };
484
-
485
- /**
486
- /**
487
- * How much prose a one-line summary may carry.
488
- *
489
- * The row's value cell is a single CSS-clipped line (`text-overflow: ellipsis`),
490
- * so the CELL needs no cap — the browser does that. The `title` hover does: it
491
- * is handed this same string whole, and a description is a document. Without a
492
- * bound, hovering a 4,000-word description produces a 4,000-word native
493
- * tooltip, which no browser renders usefully and no reader can scroll.
494
- *
495
- * 240 comfortably overfills the widest realistic cell (~80-120 characters), so
496
- * nothing visible is lost, and leaves the hover as what it is useful as — the
497
- * next sentence or two. The whole document is never far away: it renders in the
498
- * row's inset below.
499
- */
500
- export const SUMMARY_MAX_LENGTH = 240;
501
-
502
- /** Clip to {@link SUMMARY_MAX_LENGTH}, on a word boundary where there is one
503
- * close enough to the end, so a hover never stops mid-identifier. */
504
- const capSummary = (text: string): string => {
505
- if (text.length <= SUMMARY_MAX_LENGTH) {
506
- return text;
507
- }
508
-
509
- const cut = text.slice(0, SUMMARY_MAX_LENGTH);
510
- const lastSpace = cut.lastIndexOf(' ');
511
- const body = lastSpace > SUMMARY_MAX_LENGTH * 0.6 ? cut.slice(0, lastSpace) : cut;
512
-
513
- return `${body.trimEnd()}…`;
514
- };
515
-
516
- /**
517
- * Summarise a markdown value as the prose it renders to.
518
- *
519
- * A read-first row has one line to work with, and for markdown that line was
520
- * the SOURCE: a description opening with a heading read as `## Partner portal`,
521
- * which is punctuation where the reader wanted the sentence. The markers are
522
- * stripped rather than the value truncated, because what the row is standing in
523
- * for is the rendered document, not the file behind it.
524
- *
525
- * Deliberately not a markdown parser: this feeds a one-line summary and the
526
- * row's hover title, and the real document renders in the inset below the row.
527
- *
528
- * The inline rules below are CommonMark-shaped on purpose, because the naive
529
- * versions corrupt exactly the text these descriptions are full of. `(\*|_)(.*?)\1`
530
- * turns "2 * 3 * 4 items" into "2 3 4 items" and `retry_count_max` into
531
- * `retrycountmax`: emphasis delimiters have to hug the text they wrap, and an
532
- * underscore must not be intraword, or an option key loses its underscores.
533
- */
534
- export const summariseMarkdown = (value: unknown): string => {
535
- if (typeof value !== 'string') {
536
- return '';
537
- }
538
-
539
- const prose = value
540
- // a fenced block is never the summary of the thing it sits in
541
- .replace(/```[\s\S]*?```/g, ' ')
542
- // images before links — an image's `!` prefix would otherwise survive
543
- .replace(/!\[([^\]]*)\]\([^)]*\)/g, '$1')
544
- .replace(/\[([^\]]*)\]\([^)]*\)/g, '$1')
545
- // autolinks: <https://example.com> → https://example.com
546
- .replace(/<((?:https?|mailto):[^>\s]+)>/g, '$1')
547
- // leading block markers: heading hashes, blockquote carets, list bullets
548
- .replace(/^\s{0,3}(?:#{1,6}\s+|>\s?|[-*+]\s+|\d+[.)]\s+)/gm, '')
549
- // setext underlines and thematic breaks carry no prose
550
- .replace(/^\s{0,3}(?:={2,}|-{2,}|\*{3,}|_{3,})\s*$/gm, '')
551
- // Emphasis / strong / strikethrough markers around their own text. The
552
- // delimiters must hug the text they wrap, as CommonMark requires, and
553
- // underscores additionally must not be intraword.
554
- .replace(/(\*\*\*)(?=\S)([\s\S]+?)(?<=\S)\1/g, '$2')
555
- .replace(/(?<![A-Za-z0-9])(___)(?=\S)([\s\S]+?)(?<=\S)\1(?![A-Za-z0-9])/g, '$2')
556
- .replace(/(\*\*)(?=\S)([\s\S]+?)(?<=\S)\1/g, '$2')
557
- .replace(/(?<![A-Za-z0-9])(__)(?=\S)([\s\S]+?)(?<=\S)\1(?![A-Za-z0-9])/g, '$2')
558
- .replace(/(\*)(?=\S)([\s\S]+?)(?<=\S)\1/g, '$2')
559
- .replace(/(?<![A-Za-z0-9])(_)(?=\S)([\s\S]+?)(?<=\S)\1(?![A-Za-z0-9])/g, '$2')
560
- .replace(/~~(?=\S)([\s\S]+?)(?<=\S)~~/g, '$1')
561
- // inline code spans
562
- .replace(/`+([^`]+)`+/g, '$1')
563
- .replace(/\s+/g, ' ')
564
- .trim();
565
-
566
- return capSummary(prose);
567
- };
568
-
569
- /**
570
- * The expression AST a field holds, whichever shape it arrived in.
571
- *
572
- * An expression arrives in TWO shapes, and only the flat one used to be
573
- * checked. At runtime the editor writes the flag onto the option
574
- * (`{ is_expression: true, value: ast }`); a value read back from a saved draft
575
- * carries the envelope NESTED (`{ value: { is_expression: true, value: ast } }`)
576
- * with no flag on the option at all. Missing the nested shape sent a reloaded
577
- * expression to the generic formatter, which printed the AST — the row showed
578
- * `is_expression true / value / exp + / args 1 2` where the expression should
579
- * be.
580
- *
581
- * Exported because the SUMMARY is not the only place that has to know. The AST
582
- * is how an expression is stored, not what it is, so nothing may draw it as
583
- * data: `CompactRow` asks this before deciding a hash-shaped value has earned a
584
- * structured inset. Answering it in one place is what keeps the row's two
585
- * halves — the line and the inset under it — talking about the same value.
586
- */
587
- export const getExpressionAst = (option?: {
588
- is_expression?: boolean;
589
- value?: unknown;
590
- }): IExpressionValue | undefined =>
591
- option?.is_expression ? (option?.value as IExpressionValue | undefined)
592
- : (
593
- (option?.value as { is_expression?: boolean; value?: IExpressionValue } | undefined)
594
- ?.is_expression
595
- ) ?
596
- (option?.value as { value?: IExpressionValue }).value
597
- : undefined;
598
-
599
- export const formatOptionValue = (
600
- option?: IQorusFormField,
601
- schema?: TQorusFormFieldSchema
602
- ): string => {
603
- const value = option?.value;
604
-
605
- if (isOptionValueEmpty(value) || isUnsetSchemaHash(value, schema)) {
606
- return '';
607
- }
608
-
609
- // A sensitive option (passwords, tokens) must never print its value in the
610
- // read-first row — the formatted string also feeds the row's hover title.
611
- if ((schema as { sensitive?: boolean } | undefined)?.sensitive) {
612
- return '••••••';
613
- }
614
-
615
- const expressionAst = getExpressionAst(option);
616
-
617
- if (expressionAst !== undefined) {
618
- // Offline summary of the {exp,args} AST already in the form value — the
619
- // same client-side renderer the editor's "Explain" seam falls back to when
620
- // the LSP is unreachable. The drill-in editor shows the canonical DPQL.
621
- return renderExpressionToText(expressionAst) || 'Expression';
622
- }
623
-
624
- // schema-definition is stored as a hash envelope; summarise it as the schema
625
- // name + table count rather than a meaningless top-level key count.
626
- if ((schema as { ui_type?: string } | undefined)?.ui_type === 'schema-definition') {
627
- return formatSchemaDefinition(value);
628
- }
629
-
630
- // Same reasoning, different notation: show what the markdown says, not how it
631
- // is written.
632
- if ((schema as { ui_type?: string } | undefined)?.ui_type === 'markdown') {
633
- // `|| 'Set'` is not defensive padding. A description that is ONLY a fenced
634
- // code block summarises to the empty string — the block is dropped, and
635
- // there is no prose behind it — and CompactRow reads `formatted === ''` as
636
- // "no value" and renders a faint em-dash. A field holding a whole code
637
- // block would show as empty. `'Set'` is this file's established answer for
638
- // "there is a value here that does not reduce to a line" (colours, files,
639
- // richtext all use it), and the block itself still renders in the inset.
640
- return summariseMarkdown(value) || 'Set';
641
- }
642
-
643
- const type = getValueType(option, schema);
644
-
645
- if (type === 'bool' || type === 'boolean') {
646
- return value ? 'Yes' : 'No';
647
- }
648
-
649
- const allowedLabel = getAllowedValueLabel(value, schema);
650
- if (allowedLabel) {
651
- return allowedLabel;
652
- }
653
-
654
- if (type === 'rgbcolor') {
655
- return formatColorValue(value) ?? 'Set';
656
- }
657
-
658
- // Raw milliseconds read poorly at a glance — scale to the largest exact
659
- // unit, matching what the expanded TimeoutFormField shows.
660
- if (type === 'timeout' && typeof value === 'number') {
661
- return formatTimeoutValue(value);
662
- }
663
-
664
- if (type === 'file') {
665
- return formatFileValue(value) ?? 'Set';
666
- }
667
-
668
- if (type === 'richtext') {
669
- const text = richtextToString(value as any);
670
- return text && text.trim() ? text : 'Set';
671
- }
672
-
673
- // A markdown value reads as prose, not as source: the row's one line — and
674
- // the hover title built from it — would otherwise open with `# ` or spend its
675
- // width on `[label](https://…)`. The rendered document itself is drawn in the
676
- // row's inset below.
677
- if (type === 'markdown' && typeof value === 'string') {
678
- const text = summariseMarkdown(value);
679
- return text || 'Set';
680
- }
681
-
682
- if (Array.isArray(value)) {
683
- return formatList(value, schema);
684
- }
685
-
686
- // A serialized list/hash (the object editor stores them as a YAML string):
687
- // parse it back and summarise rather than showing the raw `%YAML 1.2 --- …`.
688
- if (typeof value === 'string') {
689
- const parsed = parseSerialized(value, type);
690
- if (Array.isArray(parsed)) {
691
- return formatList(parsed, schema);
692
- }
693
- if (parsed && typeof parsed === 'object') {
694
- return fieldCountLabel(parsed as object);
695
- }
696
- if (parsed !== undefined && parsed !== null && typeof parsed !== 'object') {
697
- return String(parsed);
698
- }
699
- }
700
-
701
- // A provider is an object, but the count of its keys is not what the reader
702
- // asked: name it. (The structured preview under the row shows the keys.)
703
- if (type === 'data-provider') {
704
- const provider = formatDataProviderValue(value);
705
- if (provider) {
706
- return provider;
707
- }
708
- }
709
-
710
- if (typeof value === 'object') {
711
- return fieldCountLabel(value as object);
712
- }
713
-
714
- return String(value);
715
- };
716
-
717
- /** One sub-field of a hash value, summarised for a read-first sub-row. */
718
- export interface IReadFirstHashEntry {
719
- /** The raw key in the hash. */
720
- name: string;
721
- /** Display label — the sub-field's `display_name` (from `arg_schema`) or the key. */
722
- label: string;
723
- /** The sub-field's value formatted via `formatOptionValue` ('' when unset). */
724
- value: string;
725
- }
726
-
727
- /**
728
- * Expand a hash into sub-fields for the "view more" sub-rows. Handles the three
729
- * hash shapes: arg_schema descriptors, serialized-YAML string, plain object.
730
- * [] when not expandable; entry values format via `formatOptionValue`.
731
- */
732
- export const getHashEntries = (
733
- option?: IQorusFormField,
734
- schema?: TQorusFormFieldSchema
735
- ): IReadFirstHashEntry[] => {
736
- const value = option?.value;
737
- if (isOptionValueEmpty(value)) {
738
- return [];
739
- }
740
-
741
- let hashObject: Record<string, unknown> | undefined;
742
- if (typeof value === 'string') {
743
- const parsed = parseSerialized(value, 'hash');
744
- if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
745
- hashObject = parsed as Record<string, unknown>;
746
- }
747
- } else if (value && typeof value === 'object' && !Array.isArray(value)) {
748
- hashObject = value as Record<string, unknown>;
749
- }
750
-
751
- if (!hashObject) {
752
- return [];
753
- }
754
-
755
- const argSchema = (schema as { arg_schema?: Record<string, TQorusFormFieldSchema> } | undefined)
756
- ?.arg_schema;
757
-
758
- return Object.keys(hashObject)
759
- .filter((key) => {
760
- // Only sub-fields with a value belong in a read view. `preselected`
761
- // materialises a field so the FORM shows it; that is not a statement
762
- // that the object has one, and listing it here says the opposite of
763
- // what the sub-form says.
764
- const subSchema = argSchema?.[key];
765
- return !(subSchema && isEmptyUiEnvelope(hashObject![key]));
766
- })
767
- .map((key) => {
768
- const raw = hashObject![key];
769
- const subSchema = argSchema?.[key];
770
- // A schema-declared (`arg_schema`) hash stores each entry as a
771
- // `{ type, value }` field descriptor — gate on the sub-schema's presence.
772
- // A schema-less hash *usually* stores raw values, but the server's typed
773
- // serialization can nest envelopes there too (e.g. a hash default_value
774
- // whose entries are `{ type: 'string', value: 'x' }`) — recognise those by
775
- // their strict shape (a string `type`, a `value`, and no foreign keys) so
776
- // the sub-row shows 'x' rather than counting the envelope's own keys.
777
- // `'value' in raw` is FALSE for a materialised-but-unset field: `fixOptions`
778
- // omits the key entirely when the value is undefined, leaving `{type: 'x'}`.
779
- // Requiring `value` therefore classed that envelope as a raw hash VALUE and
780
- // counted its own `type` key, so an untouched Runtime Defaults collapsed to
781
- // "Timeout (Seconds) 1 field" three times over while the sub-form correctly
782
- // said 0/3 set. With a sub-schema present, a `type`-only object is an empty
783
- // envelope, never content.
784
- // Shared with SchemaDataView, which previews this same value one level
785
- // down: two renderers disagreeing about what an unset field looks like is
786
- // how the row said "1 field" long after this one stopped.
787
- const isEmptyEnvelope = !!subSchema && isEmptyUiEnvelope(raw);
788
- const isFieldShape =
789
- (!!subSchema &&
790
- !!raw &&
791
- typeof raw === 'object' &&
792
- !Array.isArray(raw) &&
793
- 'value' in (raw as object)) ||
794
- isEmptyEnvelope ||
795
- isTypedEnvelope(raw);
796
- const subOption: IQorusFormField =
797
- isFieldShape ?
798
- (raw as IQorusFormField)
799
- : ({ type: subSchema?.type as IQorusFormField['type'], value: raw } as IQorusFormField);
800
-
801
- return {
802
- name: key,
803
- label: subSchema?.display_name || key,
804
- value: formatOptionValue(subOption, subSchema),
805
- };
806
- });
807
- };
808
-
809
- const titleCase = (value: string): string =>
810
- value
811
- .replace(/[_-]+/g, ' ')
812
- .trim()
813
- .replace(/\b\w/g, (char) => char.toUpperCase());
814
-
815
- /**
816
- * Raw group key for an option: the server's `group`, else "general" for
817
- * required/preselected (never buried — `group` is still rolling out
818
- * server-side, qorus #259) and "optional" for the rest.
819
- */
820
- export const getOptionGroup = (schema?: TQorusFormFieldSchema): string => {
821
- const group = (schema as { group?: string } | undefined)?.group;
822
-
823
- if (typeof group === 'string' && group.trim()) {
824
- return group.trim();
825
- }
826
-
827
- return (
828
- schema?.required ||
829
- (schema as { required_groups?: string[] } | undefined)?.required_groups ||
830
- (schema as { preselected?: boolean } | undefined)?.preselected
831
- ) ?
832
- 'general'
833
- : 'optional';
834
- };
835
-
836
- /** Display label for a group key: the consumer-supplied label (FormEngine
837
- * `groups` prop) or the title-cased key. */
838
- export const getOptionGroupLabel = (
839
- key: string,
840
- groups?: Record<string, { label?: string } | undefined>
841
- ): string => groups?.[key]?.label ?? titleCase(key);
842
-
843
- /** Completion summary for the read-first progress meter. */
844
- export interface IReadFirstCompletion {
845
- total: number;
846
- /** Fields holding a value, whether or not anything is wrong with it. */
847
- set: number;
848
- /** Fields holding a value that nothing is flagging — what the meter fills. */
849
- done: number;
850
- pct: number;
851
- }
852
-
853
- /** Read-first row status, shared by the status DOT (CompactRow) and the
854
- * status BOX bucketing (FormEngine) so the two can never disagree:
855
- * invalid — a value fails validation, or a danger message is present (red)
856
- * todo — empty & required (or has a warning message), needs a value (amber)
857
- * set — has a valid value (green)
858
- * optional — empty & not required, or covered by a one-of sibling (calm) */
859
- export type TReadFirstStatus = 'invalid' | 'todo' | 'set' | 'optional';
860
-
861
- export const getReadFirstStatus = (s: {
862
- empty: boolean;
863
- required: boolean;
864
- /** Empty member of a one-of required group already satisfied by a sibling. */
865
- covered: boolean;
866
- /** Non-empty value fails validation, or a danger message is attached. */
867
- invalid: boolean;
868
- /** A warning message is attached (surfaces an empty field for attention). */
869
- warned: boolean;
870
- }): TReadFirstStatus => {
871
- if (s.invalid) return 'invalid';
872
- if (!s.empty) return 'set';
873
- // A one-of member covered by a satisfied sibling reads as "set" (green) — the
874
- // requirement is met; the row just shows a "Covered by …" note.
875
- if (s.covered) return 'set';
876
- if (s.required || s.warned) return 'todo';
877
- return 'optional';
878
- };
879
-
880
- /** Coarse bucket for the three status boxes (Needs attention / Set / Optional). */
881
- export const getReadFirstBucket = (status: TReadFirstStatus): 'attention' | 'set' | 'optional' =>
882
- status === 'set' ? 'set'
883
- : status === 'optional' ? 'optional'
884
- : 'attention';
885
-
886
- /** Count how many of the shown options have a value set, for the progress meter. */
887
- export const getReadFirstCompletion = (
888
- shownOptions: Record<string, IQorusFormField | undefined> = {},
889
- /**
890
- * Whether the form flags this field as needing attention. Optional: without
891
- * it the meter falls back to counting values alone, which is what a caller
892
- * with no bucketing of its own can honestly say.
893
- */
894
- needsAttention?: (name: string) => boolean
895
- ): IReadFirstCompletion => {
896
- const names = Object.keys(shownOptions);
897
- const total = names.length;
898
- const hasValue = (name: string) => !isOptionValueEmpty(shownOptions[name]?.value);
899
- const set = names.filter(hasValue).length;
900
- /* "Set" and "needs attention" are not opposites. A field can hold a value and
901
- still be wrong — one that fails validation, or one the host has flagged
902
- because something INSIDE it is unfinished — and counting those as progress
903
- is how a form comes to report 100% while the box beneath it says a field
904
- needs attention.
905
-
906
- It also cost the meter its amber run: the bar draws attention from `set%`
907
- onward, so a field counted in both pushed that run past the right edge,
908
- where `overflow: hidden` swallowed it. The one visual signal that something
909
- was outstanding was the one thing the double-count hid. */
910
- const done =
911
- needsAttention ? names.filter((name) => hasValue(name) && !needsAttention(name)).length : set;
912
- const pct = total ? Math.round((done / total) * 100) : 0;
913
-
914
- return { total, set, done, pct };
915
- };
916
-
917
- /** What the "first field to fix" selector needs to know about one field.
918
- * Kept deliberately minimal — both verdicts are supplied by the caller — so the
919
- * selector is decoupled from the engine's value/schema shapes and unit-testable
920
- * in isolation. */
921
- export interface IFirstAttentionFieldMeta {
922
- /** Whether the field can actually receive focus — the caller folds in
923
- * disabled / readonly / read-only-form / unmet-dependency gating here. */
924
- focusable: boolean;
925
- /** Whether the form considers this field to "need attention". The caller
926
- * supplies this from the SAME `getOptionBucket` the read-first status boxes
927
- * use, so it covers every attention case — empty-required, an unsatisfied
928
- * one-of group, AND a filled-but-invalid value — and the autofocus target can
929
- * never drift from the visible needs-attention set. */
930
- needsAttention: boolean;
931
- }
932
-
933
- /**
934
- * Pick the first field the user must fix: the first focusable field — in the
935
- * supplied (already ordered) name list — that the form buckets as "needs
936
- * attention".
937
- *
938
- * Pure and side-effect free. It deliberately does NOT re-derive emptiness /
939
- * required / validity itself; the caller passes `needsAttention` straight from
940
- * the engine's own `getOptionBucket`, so there is a single source of truth and
941
- * the "focus the first field to fix" affordance can never disagree with the
942
- * per-row status the user sees (including filled-but-invalid rows). Returns
943
- * `undefined` when nothing needs attention.
944
- */
945
- export const getFirstAttentionOptionName = (
946
- orderedNames: string[],
947
- getFieldMeta: (name: string) => IFirstAttentionFieldMeta | undefined
948
- ): string | undefined => {
949
- for (const name of orderedNames) {
950
- const meta = getFieldMeta(name);
951
- if (meta?.focusable && meta.needsAttention) {
952
- return name;
953
- }
954
- }
955
-
956
- return undefined;
957
- };
958
-
959
- /* ------------------------------------------------------------------------- */
960
- /* Record identity — which field says WHICH item this is */
961
- /* */
962
- /* Lives here, beside the formatters it uses, rather than in the view that */
963
- /* first needed it: it is data logic, not rendering, and BOTH list renderers */
964
- /* plus their tests import it. Keeping it in `SchemaDataView` dragged React, */
965
- /* styled-components and every Reqore component it renders into any module */
966
- /* that only wanted to know an item's name — which broke `arrayAutoField`'s */
967
- /* mocked-Reqore test the moment the editable list started using it. */
968
- /* ------------------------------------------------------------------------- */
969
-
970
- /** A UI-encoded value carries its type alongside it; the record's own value is inside. */
971
- const unwrap = (value: unknown): unknown =>
972
- isUiEncodedValue(value) ? (value as { value: unknown }).value : value;
973
-
974
- /** Whether a value is worth a row of its own. `false` and `0` are values. */
975
- export const isSet = (value: unknown): boolean =>
976
- value !== undefined && value !== null && value !== '' && !(Array.isArray(value) && !value.length);
977
-
978
- /**
979
- * The keys to render, in the order to render them: the schema's own order first
980
- * (that is the order the form puts the fields in), then anything stored that the
981
- * schema does not mention, so undescribed data is shown rather than dropped.
982
- */
983
- export const orderedKeys = (
984
- record: Record<string, unknown>,
985
- schema: IQorusFormSchema
986
- ): string[] => {
987
- const described = Object.keys(schema).filter((key) => isSet(unwrap(record[key])));
988
- const extra = Object.keys(record).filter((key) => !(key in schema) && isSet(unwrap(record[key])));
989
- return [...described, ...extra];
990
- };
991
-
992
- /** A field whose content is source code. `ui_type` is what the form renders by,
993
- * so it is what the preview reads by too — the storage type is just `string`. */
994
- export const isCodeField = (fieldSchema: TQorusFormFieldSchema | undefined): boolean => {
995
- const uiType = (fieldSchema as { ui_type?: string } | undefined)?.ui_type;
996
- return uiType === 'code-editor';
997
- };
998
-
999
- /**
1000
- * The field whose value heads the item — the first DECLARED one holding a plain
1001
- * scalar.
1002
- *
1003
- * Schema order, not value order: the first declared field is the one the form
1004
- * puts at the top of an item, which is the one that says which item it is. A
1005
- * code body or a nested level is skipped, not because it is unimportant but
1006
- * because it has no one-line form — it belongs in the rows below where it can
1007
- * actually be read.
1008
- *
1009
- * One definition, used both to RENDER the heading and to omit that field from
1010
- * the rows. Computing it twice is how the heading and the rows start disagreeing
1011
- * about which field was promoted, and the item shows its name twice or not at
1012
- * all.
1013
- */
1014
- export const titleKeyFor = (
1015
- record: Record<string, unknown>,
1016
- schema: IQorusFormSchema
1017
- ): string | undefined =>
1018
- orderedKeys(record, schema).find((key) => {
1019
- const fieldSchema = schema[key] as TQorusFormFieldSchema | undefined;
1020
- if (isCodeField(fieldSchema)) {
1021
- return false;
1022
- }
1023
- const raw = unwrap(record[key]);
1024
- return typeof raw === 'string' || typeof raw === 'number';
1025
- });
1026
-
1027
- /** What identifies one record: which field was promoted, and how to draw it. */
1028
- export interface IRecordIdentity {
1029
- /** The promoted field's key, so a caller can omit it from the rows below. */
1030
- key: string;
1031
- /** The value, formatted the way its own row would format it. */
1032
- text: string;
1033
- /** The promoted field's label — a caption for the heading, not a second line. */
1034
- label: string;
1035
- /** A literal keeps its mono face; a chosen label is prose. */
1036
- mono: boolean;
1037
- }
1038
-
1039
- /**
1040
- * The identity of one record, for any surface that heads a list item with it.
1041
- *
1042
- * Exported because the preview is not the only place a list of records is shown:
1043
- * the editable list (`ArrayAuto`) heads the same records, and it must promote the
1044
- * same field and format it the same way. Two implementations would drift the
1045
- * moment one of them learned about a new field type, and the reader would meet
1046
- * an item called `init` in the preview and `#1` in the editor.
1047
- */
1048
- export const recordIdentity = (
1049
- record: Record<string, unknown>,
1050
- schema: IQorusFormSchema | undefined
1051
- ): IRecordIdentity | undefined => {
1052
- if (!schema) {
1053
- return undefined;
1054
- }
1055
-
1056
- const key = titleKeyFor(record, schema);
1057
-
1058
- if (!key) {
1059
- return undefined;
1060
- }
1061
-
1062
- const fieldSchema = schema[key] as TQorusFormFieldSchema | undefined;
1063
- const raw = unwrap(record[key]);
1064
-
1065
- return {
1066
- key,
1067
- text: formatOptionValue(
1068
- { type: fieldSchema?.type, value: raw } as IQorusFormField,
1069
- fieldSchema
1070
- ),
1071
- label: fieldLabel(key, fieldSchema),
1072
- mono: !findAllowedValueOption(raw, fieldSchema),
1073
- };
1074
- };
1075
-
1076
- export const fieldLabel = (key: string, fieldSchema: TQorusFormFieldSchema | undefined): string =>
1077
- (fieldSchema as { display_name?: string } | undefined)?.display_name || key;