@qoretechnologies/reqraft 0.10.53 → 0.10.54-pr.115.gaf0d7a7

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 (291) hide show
  1. package/.claude/CLAUDE.md +25 -0
  2. package/.tasks/INDEX.md +1 -0
  3. package/.tasks/STORY_NETWORK_ISOLATION.md +98 -0
  4. package/README.md +1 -1
  5. package/design/FORM_ENGINE_EXPRESSIONS.md +110 -0
  6. package/design/FORM_ENGINE_FIELD_MIGRATION.md +155 -1
  7. package/design/RENDER_EXPRESSION_TRANSPORT.md +76 -10
  8. package/design/SMART_EDITOR_UX.md +21 -0
  9. package/dist/components/dpqlEditor/DpqlEditor.d.ts.map +1 -1
  10. package/dist/components/dpqlEditor/DpqlEditor.js +3 -3
  11. package/dist/components/dpqlEditor/DpqlEditor.js.map +1 -1
  12. package/dist/components/dpqlEditor/dpqlHelpers.d.ts +6 -0
  13. package/dist/components/dpqlEditor/dpqlHelpers.d.ts.map +1 -1
  14. package/dist/components/dpqlEditor/dpqlHelpers.js +21 -2
  15. package/dist/components/dpqlEditor/dpqlHelpers.js.map +1 -1
  16. package/dist/components/dpqlEditor/dpqlProbe.d.ts +37 -0
  17. package/dist/components/dpqlEditor/dpqlProbe.d.ts.map +1 -0
  18. package/dist/components/dpqlEditor/dpqlProbe.js +203 -0
  19. package/dist/components/dpqlEditor/dpqlProbe.js.map +1 -0
  20. package/dist/components/dpqlEditor/dpqlTags.d.ts +8 -0
  21. package/dist/components/dpqlEditor/dpqlTags.d.ts.map +1 -1
  22. package/dist/components/dpqlEditor/dpqlTags.js +5 -1
  23. package/dist/components/dpqlEditor/dpqlTags.js.map +1 -1
  24. package/dist/components/dpqlEditor/index.d.ts +4 -0
  25. package/dist/components/dpqlEditor/index.d.ts.map +1 -1
  26. package/dist/components/dpqlEditor/index.js +5 -1
  27. package/dist/components/dpqlEditor/index.js.map +1 -1
  28. package/dist/components/dpqlEditor/types.d.ts +42 -2
  29. package/dist/components/dpqlEditor/types.d.ts.map +1 -1
  30. package/dist/components/dpqlEditor/types.js +0 -4
  31. package/dist/components/dpqlEditor/types.js.map +1 -1
  32. package/dist/components/dpqlEditor/useDpqlProbe.d.ts +4 -0
  33. package/dist/components/dpqlEditor/useDpqlProbe.d.ts.map +1 -0
  34. package/dist/components/dpqlEditor/useDpqlProbe.js +29 -0
  35. package/dist/components/dpqlEditor/useDpqlProbe.js.map +1 -0
  36. package/dist/components/dpqlEditor/useDpqlSession.d.ts +5 -2
  37. package/dist/components/dpqlEditor/useDpqlSession.d.ts.map +1 -1
  38. package/dist/components/dpqlEditor/useDpqlSession.js +8 -2
  39. package/dist/components/dpqlEditor/useDpqlSession.js.map +1 -1
  40. package/dist/components/form/engine/CompactRow.d.ts.map +1 -1
  41. package/dist/components/form/engine/CompactRow.js +192 -45
  42. package/dist/components/form/engine/CompactRow.js.map +1 -1
  43. package/dist/components/form/engine/CompactToolbar.d.ts.map +1 -1
  44. package/dist/components/form/engine/CompactToolbar.js +5 -2
  45. package/dist/components/form/engine/CompactToolbar.js.map +1 -1
  46. package/dist/components/form/engine/FormEngine.d.ts +160 -12
  47. package/dist/components/form/engine/FormEngine.d.ts.map +1 -1
  48. package/dist/components/form/engine/FormEngine.js +380 -78
  49. package/dist/components/form/engine/FormEngine.js.map +1 -1
  50. package/dist/components/form/engine/FormFieldsSkeleton.d.ts +48 -0
  51. package/dist/components/form/engine/FormFieldsSkeleton.d.ts.map +1 -0
  52. package/dist/components/form/engine/FormFieldsSkeleton.js +38 -0
  53. package/dist/components/form/engine/FormFieldsSkeleton.js.map +1 -0
  54. package/dist/components/form/engine/OptionFieldMessages.d.ts +17 -2
  55. package/dist/components/form/engine/OptionFieldMessages.d.ts.map +1 -1
  56. package/dist/components/form/engine/OptionFieldMessages.js +73 -12
  57. package/dist/components/form/engine/OptionFieldMessages.js.map +1 -1
  58. package/dist/components/form/engine/_structuredData/SchemaDataView.d.ts.map +1 -1
  59. package/dist/components/form/engine/_structuredData/SchemaDataView.js +7 -1
  60. package/dist/components/form/engine/_structuredData/SchemaDataView.js.map +1 -1
  61. package/dist/components/form/engine/compactToolbarContext.d.ts +1 -0
  62. package/dist/components/form/engine/compactToolbarContext.d.ts.map +1 -1
  63. package/dist/components/form/engine/readFirst.d.ts +42 -1
  64. package/dist/components/form/engine/readFirst.d.ts.map +1 -1
  65. package/dist/components/form/engine/readFirst.js +74 -7
  66. package/dist/components/form/engine/readFirst.js.map +1 -1
  67. package/dist/components/form/engine/rendererTypes.d.ts +13 -0
  68. package/dist/components/form/engine/rendererTypes.d.ts.map +1 -1
  69. package/dist/components/form/engine/rendererTypes.js.map +1 -1
  70. package/dist/components/form/engine/rowMenuContext.d.ts +78 -0
  71. package/dist/components/form/engine/rowMenuContext.d.ts.map +1 -0
  72. package/dist/components/form/engine/rowMenuContext.js +103 -0
  73. package/dist/components/form/engine/rowMenuContext.js.map +1 -0
  74. package/dist/components/form/engine/typeChoices.d.ts +42 -0
  75. package/dist/components/form/engine/typeChoices.d.ts.map +1 -0
  76. package/dist/components/form/engine/typeChoices.js +31 -0
  77. package/dist/components/form/engine/typeChoices.js.map +1 -0
  78. package/dist/components/form/expressions/DpqlRendering.d.ts +26 -0
  79. package/dist/components/form/expressions/DpqlRendering.d.ts.map +1 -0
  80. package/dist/components/form/expressions/DpqlRendering.js +53 -0
  81. package/dist/components/form/expressions/DpqlRendering.js.map +1 -0
  82. package/dist/components/form/expressions/ExpressionField.d.ts +7 -1
  83. package/dist/components/form/expressions/ExpressionField.d.ts.map +1 -1
  84. package/dist/components/form/expressions/ExpressionField.js +203 -45
  85. package/dist/components/form/expressions/ExpressionField.js.map +1 -1
  86. package/dist/components/form/expressions/argumentPresence.d.ts +97 -0
  87. package/dist/components/form/expressions/argumentPresence.d.ts.map +1 -0
  88. package/dist/components/form/expressions/argumentPresence.js +203 -0
  89. package/dist/components/form/expressions/argumentPresence.js.map +1 -0
  90. package/dist/components/form/expressions/builder/argumentLabel.d.ts.map +1 -1
  91. package/dist/components/form/expressions/builder/argumentLabel.js +9 -4
  92. package/dist/components/form/expressions/builder/argumentLabel.js.map +1 -1
  93. package/dist/components/form/expressions/builder/index.d.ts +15 -2
  94. package/dist/components/form/expressions/builder/index.d.ts.map +1 -1
  95. package/dist/components/form/expressions/builder/index.js +20 -58
  96. package/dist/components/form/expressions/builder/index.js.map +1 -1
  97. package/dist/components/form/expressions/builder/renderTemplate.d.ts +4 -1
  98. package/dist/components/form/expressions/builder/renderTemplate.d.ts.map +1 -1
  99. package/dist/components/form/expressions/builder/renderTemplate.js +10 -67
  100. package/dist/components/form/expressions/builder/renderTemplate.js.map +1 -1
  101. package/dist/components/form/expressions/dpqlMockLanguage.d.ts +76 -0
  102. package/dist/components/form/expressions/dpqlMockLanguage.d.ts.map +1 -0
  103. package/dist/components/form/expressions/dpqlMockLanguage.js +525 -0
  104. package/dist/components/form/expressions/dpqlMockLanguage.js.map +1 -0
  105. package/dist/components/form/expressions/dpqlMockLsp.d.ts +31 -2
  106. package/dist/components/form/expressions/dpqlMockLsp.d.ts.map +1 -1
  107. package/dist/components/form/expressions/dpqlMockLsp.js +86 -80
  108. package/dist/components/form/expressions/dpqlMockLsp.js.map +1 -1
  109. package/dist/components/form/expressions/mockExpressions.d.ts.map +1 -1
  110. package/dist/components/form/expressions/mockExpressions.js +8 -4
  111. package/dist/components/form/expressions/mockExpressions.js.map +1 -1
  112. package/dist/components/form/expressions/renderExpressionToText.d.ts +1 -1
  113. package/dist/components/form/expressions/renderExpressionToText.d.ts.map +1 -1
  114. package/dist/components/form/expressions/renderExpressionToText.js +95 -19
  115. package/dist/components/form/expressions/renderExpressionToText.js.map +1 -1
  116. package/dist/components/form/expressions/types.d.ts +7 -0
  117. package/dist/components/form/expressions/types.d.ts.map +1 -1
  118. package/dist/components/form/expressions/useRenderExpression.d.ts +7 -16
  119. package/dist/components/form/expressions/useRenderExpression.d.ts.map +1 -1
  120. package/dist/components/form/expressions/useRenderExpression.js +50 -126
  121. package/dist/components/form/expressions/useRenderExpression.js.map +1 -1
  122. package/dist/components/form/fields/Field.d.ts.map +1 -1
  123. package/dist/components/form/fields/Field.js +3 -1
  124. package/dist/components/form/fields/Field.js.map +1 -1
  125. package/dist/components/form/fields/allowed-values/AllowedValues.d.ts +11 -1
  126. package/dist/components/form/fields/allowed-values/AllowedValues.d.ts.map +1 -1
  127. package/dist/components/form/fields/allowed-values/AllowedValues.js +14 -2
  128. package/dist/components/form/fields/allowed-values/AllowedValues.js.map +1 -1
  129. package/dist/components/form/fields/auto/AutoFormField.d.ts.map +1 -1
  130. package/dist/components/form/fields/auto/AutoFormField.js +91 -28
  131. package/dist/components/form/fields/auto/AutoFormField.js.map +1 -1
  132. package/dist/components/form/fields/date/Date.d.ts +1 -1
  133. package/dist/components/form/fields/date/Date.d.ts.map +1 -1
  134. package/dist/components/form/fields/date/Date.js +16 -2
  135. package/dist/components/form/fields/date/Date.js.map +1 -1
  136. package/dist/components/form/fields/long-string/LongString.d.ts.map +1 -1
  137. package/dist/components/form/fields/long-string/LongString.js +14 -2
  138. package/dist/components/form/fields/long-string/LongString.js.map +1 -1
  139. package/dist/components/form/fields/rich-text/RichText.d.ts +35 -2
  140. package/dist/components/form/fields/rich-text/RichText.d.ts.map +1 -1
  141. package/dist/components/form/fields/rich-text/RichText.js +153 -12
  142. package/dist/components/form/fields/rich-text/RichText.js.map +1 -1
  143. package/dist/components/form/fields/template/ReadOnlyTemplateTag.d.ts +2 -1
  144. package/dist/components/form/fields/template/ReadOnlyTemplateTag.d.ts.map +1 -1
  145. package/dist/components/form/fields/template/ReadOnlyTemplateTag.js +3 -2
  146. package/dist/components/form/fields/template/ReadOnlyTemplateTag.js.map +1 -1
  147. package/dist/components/form/fields/template/TemplateField.d.ts +34 -2
  148. package/dist/components/form/fields/template/TemplateField.d.ts.map +1 -1
  149. package/dist/components/form/fields/template/TemplateField.js +604 -58
  150. package/dist/components/form/fields/template/TemplateField.js.map +1 -1
  151. package/dist/components/form/index.d.ts +1 -0
  152. package/dist/components/form/index.d.ts.map +1 -1
  153. package/dist/components/form/index.js +1 -0
  154. package/dist/components/form/index.js.map +1 -1
  155. package/dist/components/smartEditor/SmartEditor.d.ts.map +1 -1
  156. package/dist/components/smartEditor/SmartEditor.js +29 -8
  157. package/dist/components/smartEditor/SmartEditor.js.map +1 -1
  158. package/dist/components/smartEditor/__fixtures__/mockLspServer.d.ts +8 -0
  159. package/dist/components/smartEditor/__fixtures__/mockLspServer.d.ts.map +1 -1
  160. package/dist/components/smartEditor/__fixtures__/mockLspServer.js +53 -10
  161. package/dist/components/smartEditor/__fixtures__/mockLspServer.js.map +1 -1
  162. package/dist/components/smartEditor/useLspSession.d.ts +5 -1
  163. package/dist/components/smartEditor/useLspSession.d.ts.map +1 -1
  164. package/dist/components/smartEditor/useLspSession.js +16 -2
  165. package/dist/components/smartEditor/useLspSession.js.map +1 -1
  166. package/dist/helpers/dpqlDetection.d.ts +58 -0
  167. package/dist/helpers/dpqlDetection.d.ts.map +1 -0
  168. package/dist/helpers/dpqlDetection.js +164 -0
  169. package/dist/helpers/dpqlDetection.js.map +1 -0
  170. package/dist/helpers/optionUiTypes.d.ts +19 -3
  171. package/dist/helpers/optionUiTypes.d.ts.map +1 -1
  172. package/dist/helpers/optionUiTypes.js +20 -1
  173. package/dist/helpers/optionUiTypes.js.map +1 -1
  174. package/dist/helpers/options.d.ts +37 -0
  175. package/dist/helpers/options.d.ts.map +1 -1
  176. package/dist/helpers/options.js +78 -1
  177. package/dist/helpers/options.js.map +1 -1
  178. package/dist/helpers/templateItems.d.ts +47 -0
  179. package/dist/helpers/templateItems.d.ts.map +1 -0
  180. package/dist/helpers/templateItems.js +88 -0
  181. package/dist/helpers/templateItems.js.map +1 -0
  182. package/dist/helpers/templateText.d.ts +37 -0
  183. package/dist/helpers/templateText.d.ts.map +1 -0
  184. package/dist/helpers/templateText.js +64 -0
  185. package/dist/helpers/templateText.js.map +1 -0
  186. package/dist/helpers/templates.d.ts +19 -11
  187. package/dist/helpers/templates.d.ts.map +1 -1
  188. package/dist/helpers/templates.js +46 -29
  189. package/dist/helpers/templates.js.map +1 -1
  190. package/dist/helpers/validations.d.ts.map +1 -1
  191. package/dist/helpers/validations.js +56 -9
  192. package/dist/helpers/validations.js.map +1 -1
  193. package/dist/hooks/useArgSchema.d.ts +2 -1
  194. package/dist/hooks/useArgSchema.d.ts.map +1 -1
  195. package/dist/hooks/useFetch/useFetch.d.ts +3 -1
  196. package/dist/hooks/useFetch/useFetch.d.ts.map +1 -1
  197. package/dist/hooks/useFetch/useFetch.js +47 -9
  198. package/dist/hooks/useFetch/useFetch.js.map +1 -1
  199. package/dist/hooks/useTemplates.d.ts +20 -0
  200. package/dist/hooks/useTemplates.d.ts.map +1 -1
  201. package/dist/hooks/useTemplates.js +34 -2
  202. package/dist/hooks/useTemplates.js.map +1 -1
  203. package/dist/index.d.ts +2 -1
  204. package/dist/index.d.ts.map +1 -1
  205. package/dist/index.js +5 -1
  206. package/dist/index.js.map +1 -1
  207. package/dist/stories/storyNetwork.d.ts +36 -0
  208. package/dist/stories/storyNetwork.d.ts.map +1 -0
  209. package/dist/stories/storyNetwork.js +82 -0
  210. package/dist/stories/storyNetwork.js.map +1 -0
  211. package/dist/utils/fetch.d.ts +151 -1
  212. package/dist/utils/fetch.d.ts.map +1 -1
  213. package/dist/utils/fetch.js +256 -44
  214. package/dist/utils/fetch.js.map +1 -1
  215. package/dist/utils/lspClient.d.ts +6 -0
  216. package/dist/utils/lspClient.d.ts.map +1 -1
  217. package/dist/utils/lspClient.js +62 -11
  218. package/dist/utils/lspClient.js.map +1 -1
  219. package/dist/utils/websocket.d.ts +6 -0
  220. package/dist/utils/websocket.d.ts.map +1 -1
  221. package/dist/utils/websocket.js +15 -7
  222. package/dist/utils/websocket.js.map +1 -1
  223. package/package.json +2 -2
  224. package/src/components/dpqlEditor/DpqlEditor.stories.tsx +3 -119
  225. package/src/components/dpqlEditor/DpqlEditor.tsx +5 -2
  226. package/src/components/dpqlEditor/dpqlHelpers.ts +20 -1
  227. package/src/components/dpqlEditor/dpqlProbe.ts +165 -0
  228. package/src/components/dpqlEditor/dpqlTags.ts +13 -0
  229. package/src/components/dpqlEditor/index.ts +4 -0
  230. package/src/components/dpqlEditor/types.ts +38 -2
  231. package/src/components/dpqlEditor/useDpqlProbe.ts +33 -0
  232. package/src/components/dpqlEditor/useDpqlSession.ts +20 -4
  233. package/src/components/form/engine/CompactRow.tsx +240 -51
  234. package/src/components/form/engine/CompactToolbar.tsx +10 -3
  235. package/src/components/form/engine/FormEngine.stories.tsx +431 -124
  236. package/src/components/form/engine/FormEngine.tsx +508 -90
  237. package/src/components/form/engine/FormFieldsSkeleton.tsx +76 -0
  238. package/src/components/form/engine/OptionFieldMessages.tsx +103 -12
  239. package/src/components/form/engine/_structuredData/SchemaDataView.tsx +11 -0
  240. package/src/components/form/engine/compactToolbarContext.ts +1 -1
  241. package/src/components/form/engine/readFirst.ts +86 -7
  242. package/src/components/form/engine/rendererTypes.ts +12 -0
  243. package/src/components/form/engine/rowMenuContext.ts +159 -0
  244. package/src/components/form/engine/typeChoices.ts +61 -0
  245. package/src/components/form/expressions/DpqlRendering.tsx +85 -0
  246. package/src/components/form/expressions/ExpressionField.stories.tsx +826 -48
  247. package/src/components/form/expressions/ExpressionField.tsx +266 -54
  248. package/src/components/form/expressions/argumentPresence.ts +200 -0
  249. package/src/components/form/expressions/builder/ExpressionBuilder.stories.tsx +31 -14
  250. package/src/components/form/expressions/builder/argumentLabel.tsx +10 -4
  251. package/src/components/form/expressions/builder/index.tsx +39 -77
  252. package/src/components/form/expressions/builder/renderTemplate.tsx +23 -56
  253. package/src/components/form/expressions/dpqlMockLanguage.ts +565 -0
  254. package/src/components/form/expressions/dpqlMockLsp.ts +109 -83
  255. package/src/components/form/expressions/mockExpressions.ts +8 -4
  256. package/src/components/form/expressions/renderExpressionToText.ts +112 -22
  257. package/src/components/form/expressions/types.ts +7 -0
  258. package/src/components/form/expressions/useRenderExpression.ts +43 -127
  259. package/src/components/form/fields/Field.tsx +3 -2
  260. package/src/components/form/fields/allowed-values/AllowedValues.tsx +13 -2
  261. package/src/components/form/fields/auto/AutoFormField.stories.tsx +85 -18
  262. package/src/components/form/fields/auto/AutoFormField.tsx +90 -20
  263. package/src/components/form/fields/date/Date.tsx +17 -1
  264. package/src/components/form/fields/long-string/LongString.tsx +15 -3
  265. package/src/components/form/fields/rich-text/RichText.tsx +235 -30
  266. package/src/components/form/fields/template/ReadOnlyTemplateTag.tsx +4 -2
  267. package/src/components/form/fields/template/TemplateField.stories.tsx +93 -14
  268. package/src/components/form/fields/template/TemplateField.tsx +823 -129
  269. package/src/components/form/index.tsx +1 -0
  270. package/src/components/log/Log.stories.tsx +2 -1
  271. package/src/components/smartEditor/SmartEditor.tsx +41 -9
  272. package/src/components/smartEditor/__fixtures__/mockLspServer.ts +52 -3
  273. package/src/components/smartEditor/useLspSession.ts +21 -3
  274. package/src/helpers/dpqlDetection.ts +209 -0
  275. package/src/helpers/optionUiTypes.ts +22 -0
  276. package/src/helpers/options.ts +70 -0
  277. package/src/helpers/templateItems.ts +81 -0
  278. package/src/helpers/templateText.ts +92 -0
  279. package/src/helpers/templates.ts +47 -37
  280. package/src/helpers/validations.ts +59 -9
  281. package/src/hooks/useFetch/useFetch.stories.tsx +6 -5
  282. package/src/hooks/useFetch/useFetch.tsx +53 -7
  283. package/src/hooks/useStorage/useStorage.stories.tsx +2 -1
  284. package/src/hooks/useTemplates.ts +41 -0
  285. package/src/hooks/useWebSocket/useWebsocket.stories.tsx +2 -1
  286. package/src/index.tsx +14 -1
  287. package/src/stores/currentUser/currentUser.stories.tsx +2 -1
  288. package/src/stories/storyNetwork.ts +92 -0
  289. package/src/utils/fetch.ts +311 -21
  290. package/src/utils/lspClient.ts +68 -11
  291. package/src/utils/websocket.ts +20 -9
@@ -97,11 +97,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
97
97
  return (mod && mod.__esModule) ? mod : { "default": mod };
98
98
  };
99
99
  Object.defineProperty(exports, "__esModule", { value: true });
100
- exports.FormEngine = exports.getTypeAndCanBeNull = exports.flattenOptions = exports.fixOptions = exports.OptionsContext = exports.hasRequiredOptions = exports.fixOperatorValue = exports.getType = void 0;
100
+ exports.FormEngine = exports.getTypeAndCanBeNull = exports.flattenOptions = exports.shouldEmitLocalValue = exports.agreementFromRebuild = exports.isMirrorOfValue = exports.fixOptions = exports.OptionsContext = exports.hasRequiredOptions = exports.getOptionFieldStorageType = exports.fixOperatorValue = exports.getType = void 0;
101
101
  var react_1 = require("react");
102
102
  var jsx_runtime_1 = require("react/jsx-runtime");
103
103
  var reqore_1 = require("@qoretechnologies/reqore");
104
104
  var colors_1 = require("@qoretechnologies/reqore/dist/helpers/colors");
105
+ var argumentPresence_1 = require("../expressions/argumentPresence");
106
+ var typeChoices_1 = require("./typeChoices");
105
107
  var optionActions_1 = require("./optionActions");
106
108
  var rendererTypes_1 = require("./rendererTypes");
107
109
  var lodash_1 = require("lodash");
@@ -124,6 +126,7 @@ var FocusedEditing_1 = require("../../FocusedEditing");
124
126
  var Select_1 = require("../fields/select/Select");
125
127
  var TemplateField_1 = require("../fields/template/TemplateField");
126
128
  var CompactRow_1 = require("./CompactRow");
129
+ var FormFieldsSkeleton_1 = require("./FormFieldsSkeleton");
127
130
  var compactRowContext_1 = require("./compactRowContext");
128
131
  var compactRowStyles_1 = require("./compactRowStyles");
129
132
  var CompactToolbar_1 = require("./CompactToolbar");
@@ -131,6 +134,7 @@ var compactToolbarContext_1 = require("./compactToolbarContext");
131
134
  var OptionFieldMessages_1 = require("./OptionFieldMessages");
132
135
  var markdownRendererContext_1 = require("../../Description/markdownRendererContext");
133
136
  var OptionsHelpDialog_1 = require("./OptionsHelpDialog");
137
+ var optionUiTypes_1 = require("../../../helpers/optionUiTypes");
134
138
  var readFirst_1 = require("./readFirst");
135
139
  /**
136
140
  * Resolve a field's `inherit_props` map against the current available
@@ -188,8 +192,7 @@ var PositiveColorEffect = {
188
192
  // group panels; colours come in as props so the layout follows the Reqore theme.
189
193
  var StyledCompactWrap = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n flex-flow: column;\n gap: 10px;\n width: 100%;\n /* Allow the wrap to shrink inside flex/grid parents so its rows' ellipsis can\n engage instead of overflowing the container horizontally. */\n min-width: 0;\n max-width: 100%;\n\n /* Scroll ownership \u2014 see `compactScroll`.\n\n 'host' (the default): the page or panel around us already scrolls, so we\n must not cap our height and scroll our own body, or the reader gets two\n scrollbars in two styles and cannot tell which moves what.\n\n `overflow-x: clip`, NOT `hidden`: CSS coerces an `overflow-y: visible`\n to `auto` whenever the other axis is neither visible nor clip, which would\n leave this box a scroll container \u2014 the element stops scrolling only\n because `max-height: none` means nothing overflows, while `position:\n sticky` inside it still resolves against US instead of the host, so the\n toolbar silently stops pinning. `clip` keeps the horizontal guard without\n that coercion. */\n ", "\n\n /* Option logos (e.g. language images) render as <img> inside ReqoreIcon's\n square box; constrain them so portrait PNGs don't overflow the row. */\n .reqore-icon img {\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n"], ["\n display: flex;\n flex-flow: column;\n gap: 10px;\n width: 100%;\n /* Allow the wrap to shrink inside flex/grid parents so its rows' ellipsis can\n engage instead of overflowing the container horizontally. */\n min-width: 0;\n max-width: 100%;\n\n /* Scroll ownership \u2014 see \\`compactScroll\\`.\n\n 'host' (the default): the page or panel around us already scrolls, so we\n must not cap our height and scroll our own body, or the reader gets two\n scrollbars in two styles and cannot tell which moves what.\n\n \\`overflow-x: clip\\`, NOT \\`hidden\\`: CSS coerces an \\`overflow-y: visible\\`\n to \\`auto\\` whenever the other axis is neither visible nor clip, which would\n leave this box a scroll container \u2014 the element stops scrolling only\n because \\`max-height: none\\` means nothing overflows, while \\`position:\n sticky\\` inside it still resolves against US instead of the host, so the\n toolbar silently stops pinning. \\`clip\\` keeps the horizontal guard without\n that coercion. */\n ", "\n\n /* Option logos (e.g. language images) render as <img> inside ReqoreIcon's\n square box; constrain them so portrait PNGs don't overflow the row. */\n .reqore-icon img {\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n"])), function (_a) {
190
194
  var $ownScroll = _a.$ownScroll;
191
- return $ownScroll
192
- ? (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n /* 'own': we are the scroller. The sticky toolbar pins to whatever\n scrolls, so a host whose scrollport carries top padding would\n resolve sticky `top: 0` against its padding box and leave an\n unblurred strip above the toolbar. Scrolling in this unpadded box\n pins it flush. Cap at the host's available height, but do not grow\n to fill it \u2014 short forms still hug their content.\n\n `min-height: 0` is what lets a flex item shrink below its content\n so there is something to scroll; it belongs to this branch only. */\n min-height: 0;\n max-height: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n "], ["\n /* 'own': we are the scroller. The sticky toolbar pins to whatever\n scrolls, so a host whose scrollport carries top padding would\n resolve sticky \\`top: 0\\` against its padding box and leave an\n unblurred strip above the toolbar. Scrolling in this unpadded box\n pins it flush. Cap at the host's available height, but do not grow\n to fill it \u2014 short forms still hug their content.\n\n \\`min-height: 0\\` is what lets a flex item shrink below its content\n so there is something to scroll; it belongs to this branch only. */\n min-height: 0;\n max-height: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n "]))) : (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n /* `min-height: auto` is load-bearing, not a default: inside a column\n flex parent the shrink allowance above collapses this box to zero\n height while its rows paint outside it, so the form looks right but\n contributes nothing to layout \u2014 the host cannot size or scroll to\n it and anything below it stacks against nothing. */\n min-height: auto;\n max-height: none;\n overflow-y: visible;\n overflow-x: clip;\n "], ["\n /* \\`min-height: auto\\` is load-bearing, not a default: inside a column\n flex parent the shrink allowance above collapses this box to zero\n height while its rows paint outside it, so the form looks right but\n contributes nothing to layout \u2014 the host cannot size or scroll to\n it and anything below it stacks against nothing. */\n min-height: auto;\n max-height: none;\n overflow-y: visible;\n overflow-x: clip;\n "])));
195
+ return $ownScroll ? (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n /* 'own': we are the scroller. The sticky toolbar pins to whatever\n scrolls, so a host whose scrollport carries top padding would\n resolve sticky `top: 0` against its padding box and leave an\n unblurred strip above the toolbar. Scrolling in this unpadded box\n pins it flush. Cap at the host's available height, but do not grow\n to fill it \u2014 short forms still hug their content.\n\n `min-height: 0` is what lets a flex item shrink below its content\n so there is something to scroll; it belongs to this branch only. */\n min-height: 0;\n max-height: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n "], ["\n /* 'own': we are the scroller. The sticky toolbar pins to whatever\n scrolls, so a host whose scrollport carries top padding would\n resolve sticky \\`top: 0\\` against its padding box and leave an\n unblurred strip above the toolbar. Scrolling in this unpadded box\n pins it flush. Cap at the host's available height, but do not grow\n to fill it \u2014 short forms still hug their content.\n\n \\`min-height: 0\\` is what lets a flex item shrink below its content\n so there is something to scroll; it belongs to this branch only. */\n min-height: 0;\n max-height: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n "]))) : (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n /* `min-height: auto` is load-bearing, not a default: inside a column\n flex parent the shrink allowance above collapses this box to zero\n height while its rows paint outside it, so the form looks right but\n contributes nothing to layout \u2014 the host cannot size or scroll to\n it and anything below it stacks against nothing. */\n min-height: auto;\n max-height: none;\n overflow-y: visible;\n overflow-x: clip;\n "], ["\n /* \\`min-height: auto\\` is load-bearing, not a default: inside a column\n flex parent the shrink allowance above collapses this box to zero\n height while its rows paint outside it, so the form looks right but\n contributes nothing to layout \u2014 the host cannot size or scroll to\n it and anything below it stacks against nothing. */\n min-height: auto;\n max-height: none;\n overflow-y: visible;\n overflow-x: clip;\n "])));
193
196
  });
194
197
  // Batched-commit dock: a floating Save/Discard card pinned bottom-right. Sticky
195
198
  // (not fixed) so it stays within the form's own scroll bounds when the engine
@@ -231,14 +234,55 @@ var getOptionSchemaStorageType = function (option, isRendererOnly) {
231
234
  : isRendererOnly(option === null || option === void 0 ? void 0 : option.ui_type) ? (option === null || option === void 0 ? void 0 : option.type) || (option === null || option === void 0 ? void 0 : option.ui_type)
232
235
  : (option === null || option === void 0 ? void 0 : option.ui_type) || (option === null || option === void 0 ? void 0 : option.type)) || 'any');
233
236
  };
234
- var getOptionFieldStorageType = function (optionName, fieldType, schema, operators, operatorData, isRendererOnly) {
237
+ /**
238
+ * Whether an option currently holds an expression, in EITHER shape it comes in.
239
+ *
240
+ * At runtime the editor writes the flag onto the option itself
241
+ * (`{ type, is_expression: true, value }`), but a value loaded from a saved
242
+ * draft carries the envelope NESTED (`{ type, value: { is_expression: true,
243
+ * value } }`). Same thing, two shapes, and only the flat one was ever checked —
244
+ * so a freshly typed expression behaved while a reloaded one did not, which is
245
+ * exactly how this survived several fixes: every test used the runtime shape.
246
+ */
247
+ var optionHoldsExpression = function (option) {
248
+ var _a;
249
+ var o = option;
250
+ return !!((o === null || o === void 0 ? void 0 : o.is_expression) || ((_a = o === null || o === void 0 ? void 0 : o.value) === null || _a === void 0 ? void 0 : _a.is_expression));
251
+ };
252
+ /**
253
+ * Which type an option resolves to — the schema's, or the one stored on the
254
+ * value.
255
+ *
256
+ * Exported because this single decision is what every option field is rendered
257
+ * with, and what an expression's return type is checked against. It deserves
258
+ * to be assertable without standing up a form.
259
+ */
260
+ var getOptionFieldStorageType = function (optionName, fieldType, schema, operators, operatorData, isRendererOnly,
261
+ /** Whether the stored value is an expression — see below. */
262
+ isExpression) {
235
263
  if (isRendererOnly === void 0) { isRendererOnly = rendererTypes_1.isRendererOnlyUiType; }
236
264
  var schemaOption = schema === null || schema === void 0 ? void 0 : schema[optionName];
237
- var storedType = fieldType && !(fieldType === (schemaOption === null || schemaOption === void 0 ? void 0 : schemaOption.ui_type) && isRendererOnly(fieldType)) ?
265
+ /* A STORED type does not describe an expression.
266
+
267
+ An expression value is `{ is_expression: true, value: {...} }`, so the type
268
+ recorded beside it describes that envelope — `hash` — and not what the
269
+ field holds. Letting it win means the SCHEMA's declared type is ignored and
270
+ the wrong answer is handed to the expression editor as the return type to
271
+ check against: `1 + 2` on a field declared `"type": "auto"` came back
272
+ "The expression returns int, and this field holds hash". A literal `1` was
273
+ fine, because a literal is stored as a plain value whose type matches.
274
+
275
+ `auto`/`any` accept anything, which is exactly why nothing should be
276
+ checked against them; a concrete declared type still is. The schema is the
277
+ only party that knows what the field accepts. */
278
+ var storedType = (!isExpression &&
279
+ fieldType &&
280
+ !(fieldType === (schemaOption === null || schemaOption === void 0 ? void 0 : schemaOption.ui_type) && isRendererOnly(fieldType))) ?
238
281
  fieldType
239
282
  : getOptionSchemaStorageType(schemaOption, isRendererOnly);
240
283
  return (0, exports.getType)(storedType, operators, operatorData);
241
284
  };
285
+ exports.getOptionFieldStorageType = getOptionFieldStorageType;
242
286
  var hasRequiredOptions = function (options) {
243
287
  if (options === void 0) { options = {}; }
244
288
  return !!(0, lodash_1.findKey)(options, function (option) { return option.required; });
@@ -370,6 +414,64 @@ var normalizeEmptyFieldValues = function (fields) {
370
414
  return acc;
371
415
  }, {});
372
416
  };
417
+ /**
418
+ * Does this rebuild say anything the parent does not already hold?
419
+ *
420
+ * `false` means the rebuild is a MIRROR: `fixOptions` found no default to
421
+ * materialise, so the result repeats the `value` the parent handed down. The
422
+ * compare is empty-normalized because `fixOptions` round-trips a required-empty
423
+ * field between `{ value: '' }` and no `value` key, and that cosmetic
424
+ * difference would otherwise read as new information forever.
425
+ */
426
+ var isMirrorOfValue = function (fixedValue, value) { return (0, lodash_1.isEqual)(normalizeEmptyFieldValues(fixedValue), normalizeEmptyFieldValues(value)); };
427
+ exports.isMirrorOfValue = isMirrorOfValue;
428
+ /**
429
+ * What this rebuild lets the form agree with the parent on, if anything.
430
+ *
431
+ * Returns the rebuild when it mirrors `value`, and `undefined` when it
432
+ * contributed something the parent has yet to learn.
433
+ *
434
+ * Adopting the parent's value IS agreement, and saying so matters as much as
435
+ * staying quiet about it. The sync-down skips only when the parent echoed what
436
+ * this form last sent; if adopting a value never updates that record, it points
437
+ * at an older state forever, the skip can never fire again, and the form
438
+ * rebuilds on every single change. Holding the mirror back WITHOUT recording
439
+ * the agreement was measured making the starvation worse, not better — 8 s
440
+ * became a 45 s timeout — which is why the two belong together.
441
+ */
442
+ var agreementFromRebuild = function (fixedValue, value) {
443
+ return (0, exports.isMirrorOfValue)(fixedValue, value) ? fixedValue : undefined;
444
+ };
445
+ exports.agreementFromRebuild = agreementFromRebuild;
446
+ /**
447
+ * Should the form report `localValue` to its parent as an answer?
448
+ *
449
+ * Extracted and pure because the situation it exists for cannot be reproduced
450
+ * through a rendered form: it needs the emit to be decided against a `value`
451
+ * NEWER than the `localValue` built from it, which only happens when two
452
+ * components' effects land in one React commit — and a test renderer flushes
453
+ * effects between updates, so the two never fall out of step. The states below
454
+ * were recorded from a live instrumented run instead, and this is what makes
455
+ * them assertable.
456
+ *
457
+ * Two ways the answer is no:
458
+ *
459
+ * 1. `localValue` is a mirror — a rebuild of the parent's own value that added
460
+ * nothing. Repeating it back is not an answer. **Checked first**, because
461
+ * the comparison in (2) reads whatever `value` has become by now, which,
462
+ * when a nested engine shares the parent value, is already that engine's
463
+ * newer write; comparing against it would find a difference this form never
464
+ * made and emit the older mirror over the newer write. That is the loop.
465
+ * 2. `localValue` already equals `value` — there is nothing to report.
466
+ */
467
+ var shouldEmitLocalValue = function (_a) {
468
+ var localValue = _a.localValue, value = _a.value, mirroredValue = _a.mirroredValue;
469
+ if (mirroredValue !== undefined && (0, lodash_1.isEqual)(localValue, mirroredValue)) {
470
+ return false;
471
+ }
472
+ return !(0, lodash_1.isEqual)(localValue, value);
473
+ };
474
+ exports.shouldEmitLocalValue = shouldEmitLocalValue;
373
475
  var flattenOptions = function (options) {
374
476
  return (0, reduce_1.default)(options, function (newOptions, option, optionName) {
375
477
  var _a;
@@ -390,7 +492,7 @@ var getTypeAndCanBeNull = function (type, allowed_values, operatorData, operator
390
492
  return {
391
493
  type: realType,
392
494
  defaultType: realType,
393
- defaultInternalType: realType === 'auto' || realType === 'any' ? undefined : realType,
495
+ defaultInternalType: (0, optionUiTypes_1.isUntypedOptionType)(realType) ? undefined : realType,
394
496
  canBeNull: canBeNull,
395
497
  };
396
498
  };
@@ -415,12 +517,12 @@ var FormEngineImpl = function (_a) {
415
517
  // been a no-op. Removing it from the API is a separate, breaking change —
416
518
  // every consumer passing it today already gets the flush layout by default.
417
519
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
418
- compactFlush = _l === void 0 ? false : _l, _m = _a.compactNested, compactNested = _m === void 0 ? false : _m, _o = _a.compactScroll, compactScroll = _o === void 0 ? 'host' : _o, compactPanelProps = _a.compactPanelProps, _p = _a.compactCollapsedGroups, compactCollapsedGroups = _p === void 0 ? ['optional'] : _p, _q = _a.compactToolbar, compactToolbar = _q === void 0 ? true : _q, _r = _a.commitMode, commitMode = _r === void 0 ? 'immediate' : _r, _s = _a.expandMode, expandMode = _s === void 0 ? 'single' : _s, onCommit = _a.onCommit, operatorsProp = _a.operators, groups = _a.groups, optionsLoader = _a.optionsLoader, onValidityChange = _a.onValidityChange, optionActions = _a.optionActions, _t = _a.optionActionsCollapse, optionActionsCollapse = _t === void 0 ? 'auto' : _t, componentOverrides = _a.componentOverrides, codePreviewRenderer = _a.codePreviewRenderer,
520
+ compactFlush = _l === void 0 ? false : _l, _m = _a.compactNested, compactNested = _m === void 0 ? false : _m, _o = _a.compactScroll, compactScroll = _o === void 0 ? 'host' : _o, compactPanelProps = _a.compactPanelProps, compactCollapsedGroupsProp = _a.compactCollapsedGroups, compactBoxLabels = _a.compactBoxLabels, _p = _a.compactToolbar, compactToolbar = _p === void 0 ? true : _p, _q = _a.commitMode, commitMode = _q === void 0 ? 'immediate' : _q, _r = _a.expandMode, expandMode = _r === void 0 ? 'single' : _r, onCommit = _a.onCommit, operatorsProp = _a.operators, groups = _a.groups, optionsLoader = _a.optionsLoader, onValidityChange = _a.onValidityChange, optionActions = _a.optionActions, _s = _a.optionActionsCollapse, optionActionsCollapse = _s === void 0 ? 'auto' : _s, componentOverrides = _a.componentOverrides, codePreviewRenderer = _a.codePreviewRenderer,
419
521
  // consumed by the wrapper below, which publishes it to every description this
420
522
  // form draws; destructured here only so it cannot reach `rest` and be spread
421
523
  // onto a DOM node
422
524
  _markdownRenderer = _a.markdownRenderer, // eslint-disable-line @typescript-eslint/no-unused-vars
423
- rendererOnlyUiTypes = _a.rendererOnlyUiTypes, inheritedFromParent = _a.inheritedFromParent, autoFocusFirstRequired = _a.autoFocusFirstRequired, expandFirstRequired = _a.expandFirstRequired, initialExpandedOptions = _a.initialExpandedOptions, maxFieldsShown = _a.maxFieldsShown, rest = __rest(_a, ["name", "uniqueName", "value", "onChange", "onSingleOptionsChange", "onDependableOptionChange", "placeholder", "noValueString", "isValid", "url", "customUrl", "operatorsUrl", "onOptionsLoaded", "recordRequiresSearchOptions", "readOnly", "allowTemplates", "interfaceContext", "templateFieldProps", "forceDropdown", "showTypeToggle", "compact", "compactFlush", "compactNested", "compactScroll", "compactPanelProps", "compactCollapsedGroups", "compactToolbar", "commitMode", "expandMode", "onCommit", "operators", "groups", "optionsLoader", "onValidityChange", "optionActions", "optionActionsCollapse", "componentOverrides", "codePreviewRenderer", "markdownRenderer", "rendererOnlyUiTypes", "inheritedFromParent", "autoFocusFirstRequired", "expandFirstRequired", "initialExpandedOptions", "maxFieldsShown"]);
525
+ rendererOnlyUiTypes = _a.rendererOnlyUiTypes, templateAwareUiTypes = _a.templateAwareUiTypes, anyLikeUiTypes = _a.anyLikeUiTypes, inheritedFromParent = _a.inheritedFromParent, autoFocusFirstRequired = _a.autoFocusFirstRequired, expandFirstRequired = _a.expandFirstRequired, initialExpandedOptions = _a.initialExpandedOptions, maxFieldsShown = _a.maxFieldsShown, rest = __rest(_a, ["name", "uniqueName", "value", "onChange", "onSingleOptionsChange", "onDependableOptionChange", "placeholder", "noValueString", "isValid", "url", "customUrl", "operatorsUrl", "onOptionsLoaded", "recordRequiresSearchOptions", "readOnly", "allowTemplates", "interfaceContext", "templateFieldProps", "forceDropdown", "showTypeToggle", "compact", "compactFlush", "compactNested", "compactScroll", "compactPanelProps", "compactCollapsedGroups", "compactBoxLabels", "compactToolbar", "commitMode", "expandMode", "onCommit", "operators", "groups", "optionsLoader", "onValidityChange", "optionActions", "optionActionsCollapse", "componentOverrides", "codePreviewRenderer", "markdownRenderer", "rendererOnlyUiTypes", "templateAwareUiTypes", "anyLikeUiTypes", "inheritedFromParent", "autoFocusFirstRequired", "expandFirstRequired", "initialExpandedOptions", "maxFieldsShown"]);
424
526
  // Built-ins + whatever the consumer declared for its own injected editors.
425
527
  var isRendererOnly = (0, react_2.useMemo)(function () { return (0, rendererTypes_1.createRendererOnlyUiTypeCheck)(rendererOnlyUiTypes); }, [JSON.stringify(rendererOnlyUiTypes)]);
426
528
  // Pointer CAPABILITY and viewport WIDTH are different questions and both
@@ -438,33 +540,41 @@ var FormEngineImpl = function (_a) {
438
540
  var collapseOptionActions = optionActionsCollapse === 'always' ? true
439
541
  : optionActionsCollapse === 'never' ? false
440
542
  : !isHoverCapable || !!isMobile;
441
- var _u = (0, react_2.useState)((rest === null || rest === void 0 ? void 0 : rest.options) || undefined), options = _u[0], setOptions = _u[1];
543
+ /* The schema, as the form should ASK it — not always as it was served.
544
+ `resolveDegenerateRequiredGroups` turns a one-of group that has a single
545
+ member in this schema back into a plain required field, because a choice
546
+ with one option is not a choice. Applied here, at the one place the schema
547
+ enters the component, so the header, the chips, the messages, the meter and
548
+ the read-first summary cannot disagree about it: every one of them reads
549
+ `options`, and none of them has to know the rule. */
550
+ var _t = (0, react_2.useState)((rest === null || rest === void 0 ? void 0 : rest.options) || undefined), servedOptions = _t[0], setOptions = _t[1];
551
+ var options = (0, react_2.useMemo)(function () { return (0, options_1.resolveDegenerateRequiredGroups)(servedOptions); }, [servedOptions]);
442
552
  // optionsLoader lifecycle: loading feeds the skeleton gate, error the banner.
443
- var _v = (0, react_2.useState)(!!optionsLoader && !(rest === null || rest === void 0 ? void 0 : rest.options)), optionsLoading = _v[0], setOptionsLoading = _v[1];
444
- var _w = (0, react_2.useState)(), optionsError = _w[0], setOptionsError = _w[1];
553
+ var _u = (0, react_2.useState)(!!optionsLoader && !(rest === null || rest === void 0 ? void 0 : rest.options)), optionsLoading = _u[0], setOptionsLoading = _u[1];
554
+ var _v = (0, react_2.useState)(), optionsError = _v[0], setOptionsError = _v[1];
445
555
  // Operators: prop-provided (compact) or fetched via operatorsUrl (dpql,
446
556
  // ported from IDE Options) — the fetch overrides the seeded prop value.
447
- var _x = (0, react_2.useState)(operatorsProp), operators = _x[0], setOperators = _x[1];
557
+ var _w = (0, react_2.useState)(operatorsProp), operators = _w[0], setOperators = _w[1];
448
558
  // Remote-fetch loading (ported from IDE Options); only relevant when one of
449
559
  // the fetch urls is set — schema-as-props consumers never see the skeleton.
450
- var _y = (0, react_2.useState)(!!(url || customUrl || operatorsUrl)), loading = _y[0], setLoading = _y[1];
560
+ var _x = (0, react_2.useState)(!!(url || customUrl || operatorsUrl)), loading = _x[0], setLoading = _x[1];
451
561
  var confirmAction = (0, reqore_1.useReqoreProperty)('confirmAction');
452
562
  var theme = (0, reqore_1.useReqoreTheme)();
453
- var _z = (0, react_2.useState)(), focusedEditing = _z[0], setFocusedEditing = _z[1];
454
- var _0 = (0, react_2.useState)(false), showFieldTypes = _0[0], setShowFieldTypes = _0[1];
563
+ var _y = (0, react_2.useState)(), focusedEditing = _y[0], setFocusedEditing = _y[1];
564
+ var _z = (0, react_2.useState)(false), showFieldTypes = _z[0], setShowFieldTypes = _z[1];
455
565
  // Global toggle (toolbar ⓘ): reveal the short-description info panel on every
456
566
  // field that has a short_desc. Per-row ⓘ overrides still win over it.
457
567
  // Global field-info visibility, tri-state: `undefined` = default (critical
458
568
  // messages auto-open, the rest closed); `true` = show all; `false` = hide all
459
569
  // (even message fields). The toolbar ⓘ drives it.
460
- var _1 = (0, react_2.useState)(undefined), showAllDescriptions = _1[0], setShowAllDescriptions = _1[1];
461
- var _2 = (0, react_2.useState)(), showHelpForOption = _2[0], setShowHelpForOption = _2[1];
462
- var _3 = (0, react_2.useState)(false), showInvalidOptionsOnly = _3[0], setShowInvalidOptionsOnly = _3[1];
570
+ var _0 = (0, react_2.useState)(undefined), showAllDescriptions = _0[0], setShowAllDescriptions = _0[1];
571
+ var _1 = (0, react_2.useState)(), showHelpForOption = _1[0], setShowHelpForOption = _1[1];
572
+ var _2 = (0, react_2.useState)(false), showInvalidOptionsOnly = _2[0], setShowInvalidOptionsOnly = _2[1];
463
573
  // Which options are expanded into their editor (several can be open at once).
464
- var _4 = (0, react_2.useState)([]), expandedOptions = _4[0], setExpandedOptions = _4[1];
574
+ var _3 = (0, react_2.useState)([]), expandedOptions = _3[0], setExpandedOptions = _3[1];
465
575
  /** Status boxes whose "N more fields" control the reader has opened. Keyed by
466
576
  box so opening Optional does not also unfold Set. */
467
- var _5 = (0, react_2.useState)([]), expandedMoreBoxes = _5[0], setExpandedMoreBoxes = _5[1];
577
+ var _4 = (0, react_2.useState)([]), expandedMoreBoxes = _4[0], setExpandedMoreBoxes = _4[1];
468
578
  // --- Reveal a status box's content when it is opened ----------------------
469
579
  //
470
580
  // The status boxes stack, so the last one ("Optional", which holds every
@@ -480,7 +590,7 @@ var FormEngineImpl = function (_a) {
480
590
  // box has not grown and there is nothing to scroll to. A layout effect runs
481
591
  // after the DOM is updated and before paint, which makes the reveal
482
592
  // deterministic instead of a guessed delay.
483
- var _6 = (0, react_2.useState)(undefined), openedStatusBox = _6[0], setOpenedStatusBox = _6[1];
593
+ var _5 = (0, react_2.useState)(undefined), openedStatusBox = _5[0], setOpenedStatusBox = _5[1];
484
594
  var statusBoxRefs = (0, react_2.useRef)({});
485
595
  (0, react_2.useLayoutEffect)(function () {
486
596
  var _a, _b;
@@ -511,13 +621,13 @@ var FormEngineImpl = function (_a) {
511
621
  var settledBucket = (0, react_2.useRef)({});
512
622
  // Measured form width (not viewport — the form lives in drawers/panels of
513
623
  // arbitrary width) drives the stacked narrow layout.
514
- var _7 = (0, react_use_1.useMeasure)(), compactWrapRef = _7[0], compactWrapWidth = _7[1].width;
624
+ var _6 = (0, react_use_1.useMeasure)(), compactWrapRef = _6[0], compactWrapWidth = _6[1].width;
515
625
  // Own handle on the scroll wrap (useMeasure's ref is a callback, no `.current`)
516
626
  // so the label-column measurement can publish its CSS var on the element. It's
517
627
  // STATE, not a ref: the wrap mounts only after the loading-skeleton gate
518
628
  // resolves, so the measurement effect must re-run when the node appears — a
519
629
  // ref wouldn't retrigger it.
520
- var _8 = (0, react_2.useState)(null), compactWrapNode = _8[0], setCompactWrapNode = _8[1];
630
+ var _7 = (0, react_2.useState)(null), compactWrapNode = _7[0], setCompactWrapNode = _7[1];
521
631
  // Ref mirror of the wrap node for callbacks that must not re-create when it
522
632
  // mounts (flashOptions reads it inside a rAF).
523
633
  var compactWrapNodeRef = (0, react_2.useRef)(null);
@@ -571,8 +681,8 @@ var FormEngineImpl = function (_a) {
571
681
  var readRowHeights = (0, react_2.useRef)({});
572
682
  // Required-groups linkage: hovering a group chip highlights every member row;
573
683
  // clicking a sibling in the chip's popover scrolls to it and flashes it.
574
- var _9 = (0, react_2.useState)([]), highlightedOptions = _9[0], setHighlightedOptions = _9[1];
575
- var _10 = (0, react_2.useState)([]), flashedOptions = _10[0], setFlashedOptions = _10[1];
684
+ var _8 = (0, react_2.useState)([]), highlightedOptions = _8[0], setHighlightedOptions = _8[1];
685
+ var _9 = (0, react_2.useState)([]), flashedOptions = _9[0], setFlashedOptions = _9[1];
576
686
  var flashTimeout = (0, react_2.useRef)();
577
687
  var flashOptions = (0, react_2.useCallback)(function (optionNames, scrollToFirst) {
578
688
  if (scrollToFirst === void 0) { scrollToFirst = false; }
@@ -621,28 +731,58 @@ var FormEngineImpl = function (_a) {
621
731
  });
622
732
  var compactNarrow = !!compactWrapWidth && compactWrapWidth < 480;
623
733
  // Info panels auto-open on Tier-1 content; the per-row user override sticks.
624
- var _11 = (0, react_2.useState)({}), infoPanelOverrides = _11[0], setInfoPanelOverrides = _11[1];
734
+ var _10 = (0, react_2.useState)({}), infoPanelOverrides = _10[0], setInfoPanelOverrides = _10[1];
625
735
  // Toolbar filters affect the listed rows only — the meter reflects the full set.
626
- var _12 = (0, react_2.useState)(false), requiredOnly = _12[0], setRequiredOnly = _12[1];
627
- var _13 = (0, react_2.useState)(''), compactQuery = _13[0], setCompactQuery = _13[1];
736
+ var _11 = (0, react_2.useState)(false), requiredOnly = _11[0], setRequiredOnly = _11[1];
737
+ var _12 = (0, react_2.useState)(''), compactQuery = _12[0], setCompactQuery = _12[1];
628
738
  // Compact field sort (Fields menu → "Sort by"); 'schema' = declared order.
629
- var _14 = (0, react_2.useState)('schema'), compactSort = _14[0], setCompactSort = _14[1];
630
- var _15 = (0, react_2.useState)(function () { return ({
739
+ var _13 = (0, react_2.useState)('schema'), compactSort = _13[0], setCompactSort = _13[1];
740
+ var _14 = (0, react_2.useState)(function () { return ({
631
741
  fields: (0, exports.fixOptions)(value, options || {}, undefined, isRendererOnly),
632
742
  meta: undefined,
633
- }); }), localValue = _15[0], setLocalValue = _15[1];
743
+ }); }), localValue = _14[0], setLocalValue = _14[1];
634
744
  var originalValue = (0, react_2.useRef)();
635
745
  // Track the last value we emitted via onChange so we can skip re-applying fixOptions
636
746
  // when the parent echoes it back as the new value prop (controlled component loop prevention)
637
747
  var lastEmittedValue = (0, react_2.useRef)(value);
748
+ /**
749
+ * A `localValue` that is only a MIRROR of the incoming `value`, and so must
750
+ * never be emitted back as though this form had answered something.
751
+ *
752
+ * `localValue` is derived state: the sync-down effect below rebuilds it from
753
+ * the `value` prop. When that rebuild adds nothing (`fixOptions` had no
754
+ * default to materialise), the result says exactly what the parent already
755
+ * holds, and emitting it is not a change — it is this form repeating the
756
+ * parent's own words back at it.
757
+ *
758
+ * That repetition is harmless in a form that owns its state outright and
759
+ * fatal in one that shares a parent with a NESTED engine. The two write to
760
+ * the same parent value, so each sees the other's write arrive as an external
761
+ * change; `lastEmittedValue` is then always one step behind and its guard
762
+ * never fires. The engines alternate between two states forever, several
763
+ * times a second, and the newer write is repeatedly overwritten by the older
764
+ * one. Measured in the test editor: the row's summary flipped between two
765
+ * readings indefinitely and `setTimeout` was starved past a 45-second
766
+ * deadline.
767
+ *
768
+ * Only a mirror that CHANGES nothing is held back. A rebuild that restores a
769
+ * required or preselected field's default still emits, because that default
770
+ * is genuinely new information the parent has to be told about — which is the
771
+ * whole reason the sync-down runs `fixOptions` at all.
772
+ */
773
+ var mirroredValue = (0, react_2.useRef)(undefined);
638
774
  if (originalValue.current === undefined && (0, size_1.default)(value)) {
639
775
  originalValue.current = localValue.fields;
640
776
  }
641
777
  var unavailableOptionsCount = (0, react_2.useRef)(0);
642
- var _16 = (0, useQorusTypes_1.useQorusTypes)(), compactValue = _16.compactValue, typesLoading = _16.loading;
778
+ var _15 = (0, useQorusTypes_1.useQorusTypes)(), compactValue = _15.compactValue, typesLoading = _15.loading;
643
779
  var templates = (0, useTemplates_1.useTemplates)(allowTemplates, rest.stringTemplates, interfaceContext);
644
780
  (0, react_2.useEffect)(function () {
645
- if ((0, lodash_1.isEqual)(localValue.fields, value)) {
781
+ if (!(0, exports.shouldEmitLocalValue)({
782
+ localValue: localValue.fields,
783
+ value: value,
784
+ mirroredValue: mirroredValue.current,
785
+ })) {
646
786
  return;
647
787
  }
648
788
  var toEmit = (0, size_1.default)(localValue.fields) ? localValue.fields : undefined;
@@ -822,22 +962,51 @@ var FormEngineImpl = function (_a) {
822
962
  // Note: compare fixedValue against value, not localValue.fields — localValue may have been
823
963
  // updated by nested FormEngine emissions, so comparing against it would never skip.
824
964
  var normalizedValue = normalizeEmptyFieldValues(value);
965
+ /* What this rebuild lets us agree with the parent on — `undefined` when it
966
+ contributed something the parent has yet to learn. */
967
+ var agreed = (0, exports.agreementFromRebuild)(fixedValue, value);
825
968
  if ((0, lodash_1.isEqual)(normalizedValue, normalizeEmptyFieldValues(lastEmittedValue.current)) &&
826
- (0, lodash_1.isEqual)(normalizeEmptyFieldValues(fixedValue), normalizedValue)) {
969
+ agreed !== undefined) {
827
970
  return;
828
971
  }
829
972
  if (!originalValue.current && (0, size_1.default)(fixedValue)) {
830
973
  originalValue.current = fixedValue;
831
974
  }
975
+ /* Remember a mirror so the emit effect can tell one from an answer, and
976
+ record the agreement it represents. A rebuild that DID add something
977
+ leaves both alone — the parent has to learn about it. */
978
+ mirroredValue.current = agreed;
979
+ if (agreed !== undefined) {
980
+ lastEmittedValue.current = agreed;
981
+ }
832
982
  setLocalValue === null || setLocalValue === void 0 ? void 0 : setLocalValue({ fields: fixedValue, meta: undefined });
833
983
  }, [JSON.stringify(options), JSON.stringify(value), isRendererOnly]);
984
+ /**
985
+ * Fields the reader has actually edited in this instance.
986
+ *
987
+ * "This field is required" is an ERROR message, and an error is a report that
988
+ * something went wrong. Under a field nobody has been in yet it reports
989
+ * nothing — the form is empty because it is new — while the requirement is
990
+ * already stated by the asterisk, by the Needs-attention box the row sits in,
991
+ * and by the completion meter. A form whose first act is to accuse the reader
992
+ * of a mistake they have not made teaches them to discount its warnings.
993
+ *
994
+ * So the message waits for a touch. Being IN the field and leaving it empty
995
+ * is a real gap, and that one shows. A ref, not state: every edit re-renders
996
+ * anyway, so the following render reads the current set with no second pass.
997
+ */
998
+ var touchedOptionsRef = (0, react_2.useRef)(new Set());
834
999
  var handleValueChange = (0, react_2.useCallback)(function (optionName, val, _type, isFunction) {
1000
+ // Every route into this handler is a person acting: typing, picking from a
1001
+ // menu, clearing the value, adding an optional field. Marked here rather
1002
+ // than inside the updater below, which React may invoke twice.
1003
+ touchedOptionsRef.current.add(optionName);
835
1004
  setLocalValue(function (_a) {
836
1005
  var _b, _c;
837
- var _d, _f, _g, _h, _j, _k, _l, _m, _o, _p;
838
- var _q = _a.fields, fields = _q === void 0 ? {} : _q;
1006
+ var _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
1007
+ var _r = _a.fields, fields = _r === void 0 ? {} : _r;
839
1008
  var schemaType = getOptionSchemaStorageType(options === null || options === void 0 ? void 0 : options[optionName], isRendererOnly);
840
- var isAnyLike = schemaType === 'any' || schemaType === 'auto';
1009
+ var isAnyLike = (0, optionUiTypes_1.isUntypedOptionType)(schemaType);
841
1010
  // For any/auto schema types, preserve the user's chosen type stored in the field
842
1011
  var resolvedSchemaType = isAnyLike && ((_d = fields[optionName]) === null || _d === void 0 ? void 0 : _d.type) ?
843
1012
  fields[optionName].type
@@ -868,27 +1037,46 @@ var FormEngineImpl = function (_a) {
868
1037
  // by TemplateField/auto) drives the option's `is_expression` flag;
869
1038
  // the value itself is the raw AST `{ exp, args }`.
870
1039
  var updatedValue = __assign(__assign({}, fields), (_c = {}, _c[optionName] = __assign(__assign({}, fields[optionName]), { type: type, value: val }), _c));
871
- if (isFunction) {
1040
+ /* The flag belongs to the VALUE, so a change that said nothing about it
1041
+ does not throw it away — `undefined` is no opinion, not a denial.
1042
+ Deleting it unconditionally left the AST on the row with nothing
1043
+ marking it as one: an assertion's Expected Value came back from a
1044
+ saved draft drawn as a two-field hash of `exp` and `args`, because
1045
+ merely opening the row and reverting had stripped the flag. */
1046
+ if ((0, argumentPresence_1.shouldMarkAsExpression)(isFunction, val, (_l = fields[optionName]) === null || _l === void 0 ? void 0 : _l.is_expression)) {
872
1047
  updatedValue[optionName].is_expression = true;
873
1048
  }
874
1049
  else {
875
1050
  delete updatedValue[optionName].is_expression;
876
1051
  }
877
1052
  var meta = {};
878
- if (((_l = options === null || options === void 0 ? void 0 : options[optionName]) === null || _l === void 0 ? void 0 : _l.has_dependents) &&
1053
+ if (((_m = options === null || options === void 0 ? void 0 : options[optionName]) === null || _m === void 0 ? void 0 : _m.has_dependents) &&
879
1054
  val !== undefined &&
880
- val !== ((_m = fields[optionName]) === null || _m === void 0 ? void 0 : _m.value)) {
1055
+ val !== ((_o = fields[optionName]) === null || _o === void 0 ? void 0 : _o.value)) {
881
1056
  (0, lodash_1.forEach)(options, function (option, depName) {
1057
+ /* A dependency is `name`, `name=value` or `name!=value`, so the
1058
+ entry has to be PARSED to find which option it names. Compared as
1059
+ a whole string, only the bare spelling ever matched — so a field
1060
+ declared `depends_on: ['subject_iface_kind=workflow']` was never
1061
+ cleared when that option changed.
1062
+
1063
+ What that cost: a test whose subject was switched from a workflow
1064
+ to a service kept the workflow's `Subject Interface Version`.
1065
+ Services and jobs are versioned but only the latest is testable,
1066
+ so the field no longer applied, yet it stayed on the form as a
1067
+ locked control in front of a value the author could not clear —
1068
+ the value being there is exactly what stops the field being
1069
+ withheld outright. */
882
1070
  if (option.depends_on &&
883
- (0, lodash_1.flatten)(option.depends_on).includes(optionName) &&
1071
+ (0, lodash_1.flatten)(option.depends_on).some(function (dependency) { return (0, validations_1.parseDependency)(dependency).name === optionName; }) &&
884
1072
  updatedValue[depName]) {
885
1073
  updatedValue[depName].value = undefined;
886
1074
  }
887
1075
  });
888
1076
  onDependableOptionChange === null || onDependableOptionChange === void 0 ? void 0 : onDependableOptionChange(optionName, val, updatedValue, options);
889
1077
  }
890
- if ((0, size_1.default)((_o = options === null || options === void 0 ? void 0 : options[optionName]) === null || _o === void 0 ? void 0 : _o.on_change)) {
891
- meta.events = (_p = options === null || options === void 0 ? void 0 : options[optionName]) === null || _p === void 0 ? void 0 : _p.on_change;
1078
+ if ((0, size_1.default)((_p = options === null || options === void 0 ? void 0 : options[optionName]) === null || _p === void 0 ? void 0 : _p.on_change)) {
1079
+ meta.events = (_q = options === null || options === void 0 ? void 0 : options[optionName]) === null || _q === void 0 ? void 0 : _q.on_change;
892
1080
  }
893
1081
  onSingleOptionsChange === null || onSingleOptionsChange === void 0 ? void 0 : onSingleOptionsChange(optionName, updatedValue[optionName]);
894
1082
  if (compact && !readOnly && (0, readFirst_1.shouldAutoCollapseCompactOption)(options === null || options === void 0 ? void 0 : options[optionName], val)) {
@@ -1006,7 +1194,7 @@ var FormEngineImpl = function (_a) {
1006
1194
  return newValue;
1007
1195
  }
1008
1196
  var rendererType = (0, exports.getType)((options[optionName].ui_type || options[optionName].type), operators, option === null || option === void 0 ? void 0 : option.op);
1009
- var storageType = getOptionFieldStorageType(optionName, option === null || option === void 0 ? void 0 : option.type, options, operators, option === null || option === void 0 ? void 0 : option.op, isRendererOnly);
1197
+ var storageType = (0, exports.getOptionFieldStorageType)(optionName, option === null || option === void 0 ? void 0 : option.type, options, operators, option === null || option === void 0 ? void 0 : option.op, isRendererOnly, optionHoldsExpression(option));
1010
1198
  if (!(0, lodash_1.isPlainObject)(option)) {
1011
1199
  return __assign(__assign({}, newValue), (_a = {}, _a[optionName] = {
1012
1200
  type: storageType || rendererType,
@@ -1107,7 +1295,7 @@ var FormEngineImpl = function (_a) {
1107
1295
  var getValidityData = (0, react_2.useCallback)(function () {
1108
1296
  var fields = (0, reduce_1.default)(availableOptions, function (result, option, optionName) {
1109
1297
  var _a, _b;
1110
- var type = getOptionFieldStorageType(optionName, option.type, options, operators, option.op, isRendererOnly);
1298
+ var type = (0, exports.getOptionFieldStorageType)(optionName, option.type, options, operators, option.op, isRendererOnly, optionHoldsExpression(option));
1111
1299
  var optionValue = option.value;
1112
1300
  var isRequired = (_a = options === null || options === void 0 ? void 0 : options[optionName]) === null || _a === void 0 ? void 0 : _a.required;
1113
1301
  var hasRequiredGroups = !!((_b = options === null || options === void 0 ? void 0 : options[optionName]) === null || _b === void 0 ? void 0 : _b.required_groups);
@@ -1151,7 +1339,7 @@ var FormEngineImpl = function (_a) {
1151
1339
  return (0, reduce_1.default)(availableOptions, function (newValue, option, optionName) {
1152
1340
  var _a;
1153
1341
  if (showInvalidOptionsOnly &&
1154
- isOptionValid(optionName, getOptionFieldStorageType(optionName, option.type, options, operators, option.op, isRendererOnly), option.value)) {
1342
+ isOptionValid(optionName, (0, exports.getOptionFieldStorageType)(optionName, option.type, options, operators, option.op, isRendererOnly, optionHoldsExpression(option)), option.value)) {
1155
1343
  return newValue;
1156
1344
  }
1157
1345
  return __assign(__assign({}, newValue), (_a = {}, _a[optionName] = option, _a));
@@ -1185,7 +1373,7 @@ var FormEngineImpl = function (_a) {
1185
1373
  if (hidden)
1186
1374
  return 'optional';
1187
1375
  var schema = options === null || options === void 0 ? void 0 : options[name];
1188
- var type = getOptionFieldStorageType(name, (_a = availableOptions === null || availableOptions === void 0 ? void 0 : availableOptions[name]) === null || _a === void 0 ? void 0 : _a.type, options, operators, (_b = availableOptions === null || availableOptions === void 0 ? void 0 : availableOptions[name]) === null || _b === void 0 ? void 0 : _b.op, isRendererOnly);
1376
+ var type = (0, exports.getOptionFieldStorageType)(name, (_a = availableOptions === null || availableOptions === void 0 ? void 0 : availableOptions[name]) === null || _a === void 0 ? void 0 : _a.type, options, operators, (_b = availableOptions === null || availableOptions === void 0 ? void 0 : availableOptions[name]) === null || _b === void 0 ? void 0 : _b.op, isRendererOnly, optionHoldsExpression(availableOptions === null || availableOptions === void 0 ? void 0 : availableOptions[name]));
1189
1377
  var value = (_c = availableOptions === null || availableOptions === void 0 ? void 0 : availableOptions[name]) === null || _c === void 0 ? void 0 : _c.value;
1190
1378
  // A schema-declared hash whose every entry is a materialised-but-unset
1191
1379
  // field holds nothing, so it is not "set" — without this the row showed a
@@ -1307,11 +1495,16 @@ var FormEngineImpl = function (_a) {
1307
1495
  if (!names.length) {
1308
1496
  return;
1309
1497
  }
1310
- hasAppliedInitialExpansionRef.current = true;
1311
1498
  var toExpand = initialExpandedOptions.filter(function (name) { return names.includes(name); });
1312
1499
  if (!toExpand.length) {
1500
+ // Not "there is no such row" — "not YET". A server-driven schema arrives
1501
+ // in pieces, and the row the caller named can be in a later one (a test's
1502
+ // `cases` field materialises once its step-kind catalogue lands). Latching
1503
+ // here would spend the one shot on a form that did not yet contain the
1504
+ // field, and the address would never be applied at all.
1313
1505
  return;
1314
1506
  }
1507
+ hasAppliedInitialExpansionRef.current = true;
1315
1508
  setExpandedOptions(function (prev) { return __spreadArray(__spreadArray([], prev, true), toExpand.filter(function (name) { return !prev.includes(name); }), true); });
1316
1509
  }, [initialExpandedOptions, compact, availableOptions]);
1317
1510
  // --- First-attention-field autofocus (opt-in) -----------------------------
@@ -1394,7 +1587,14 @@ var FormEngineImpl = function (_a) {
1394
1587
  }
1395
1588
  setExpandedOptions(function (prev) {
1396
1589
  return prev.includes(target) ? prev
1397
- : expandMode === 'multi' ? __spreadArray(__spreadArray([], prev, true), [target], false) : [target];
1590
+ : expandMode === 'multi' ? __spreadArray(__spreadArray([], prev, true), [target], false)
1591
+ // `expandMode: 'single'` is a rule about what a CLICK does: opening a
1592
+ // row closes the one the reader last opened. It is not a licence to
1593
+ // close a row the HOST named through `initialExpandedOptions`. That
1594
+ // is an address — a statement about what the page is FOR, made before
1595
+ // the reader did anything — and this scan is a convenience layered on
1596
+ // top of it. Keep the named rows; replace only what a click could.
1597
+ : __spreadArray(__spreadArray([], prev.filter(function (name) { return initialExpandedOptions === null || initialExpandedOptions === void 0 ? void 0 : initialExpandedOptions.includes(name); }), true), [target], false);
1398
1598
  });
1399
1599
  }
1400
1600
  }, [
@@ -1407,10 +1607,13 @@ var FormEngineImpl = function (_a) {
1407
1607
  dependencyLockedNames,
1408
1608
  getOptionBucket,
1409
1609
  expandMode,
1610
+ initialExpandedOptions,
1410
1611
  ]);
1411
1612
  // Read-first completion summary (how many shown options have a value set),
1412
1613
  // surfaced as a progress meter at the top of the compact form.
1413
- var readFirstCompletion = (0, react_2.useMemo)(function () { return (0, readFirst_1.getReadFirstCompletion)(availableOptions); }, [JSON.stringify(availableOptions)]);
1614
+ var readFirstCompletion = (0, react_2.useMemo)(function () {
1615
+ return (0, readFirst_1.getReadFirstCompletion)(availableOptions, function (name) { return getOptionBucket(name) === 'attention'; });
1616
+ }, [JSON.stringify(availableOptions), getOptionBucket]);
1414
1617
  var optionalFields = (0, react_2.useMemo)(function () {
1415
1618
  return Object.keys(filteredOptions).map(function (option) {
1416
1619
  var _a, _b, _c, _d, _f, _g;
@@ -1477,7 +1680,7 @@ var FormEngineImpl = function (_a) {
1477
1680
  // The info panel below the row keeps showing schema messages while editing —
1478
1681
  // rendering them in the editor too would balloon a one-line edit.
1479
1682
  suppressSchemaMessages) {
1480
- var _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
1683
+ var _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
1481
1684
  var type = _a.type, other = __rest(_a, ["type"]);
1482
1685
  var operatorParts = (0, common_1.fixOperatorValue)(other.op);
1483
1686
  // The RENDERER type for this row — which editor mounts. Distinct from the
@@ -1493,12 +1696,55 @@ var FormEngineImpl = function (_a) {
1493
1696
  // schema has not arrived yet (`type` undefined) instead of crashing.
1494
1697
  var optionSchema = options === null || options === void 0 ? void 0 : options[optionName];
1495
1698
  var schemaUiType = optionSchema === null || optionSchema === void 0 ? void 0 : optionSchema.ui_type;
1496
- var uiTypeIsAnyLike = schemaUiType === 'any' || schemaUiType === 'auto';
1699
+ var uiTypeIsAnyLike = (0, optionUiTypes_1.isUntypedOptionType)(schemaUiType);
1700
+ /* An EXPRESSION's stored type is skipped in this chain.
1701
+
1702
+ The value is `{ is_expression: true, value: {...} }`, so the type saved
1703
+ beside it describes that envelope — `hash` — not what the field holds.
1704
+ With no `ui_type` to win first, that `hash` beat the schema's `auto`
1705
+ and was handed to the expression editor as the return type to check
1706
+ against: `1 + 2` on a field declared `auto` came back "This does not
1707
+ fit. The expression returns int, and this field holds hash". A literal
1708
+ `1` was fine, because a literal is stored as a plain value whose type
1709
+ matches.
1710
+
1711
+ Dropping the stored type here lets the schema decide, which is the
1712
+ only party that knows what the field accepts. This is the row
1713
+ renderer's OWN resolution and does not go through
1714
+ `getOptionFieldStorageType`, so guarding that one alone left this
1715
+ untouched. */
1716
+ var storedRowType = optionHoldsExpression(other) ? undefined : type;
1717
+ /* A RELOADED expression is handed to the editor in the shape the editor
1718
+ was written against.
1719
+
1720
+ An expression is written as `{ type, is_expression: true, value: ast }`
1721
+ and saved as `{ type, value: { is_expression: true, value: ast } }` —
1722
+ the flag moves ONTO the value. The editor was only ever given
1723
+ `other.is_expression`, which is absent in the saved shape, so a
1724
+ reloaded expression was not recognised as one: an `auto` field then
1725
+ resolved its type from the value it could see, decided the envelope was
1726
+ a `hash`, and rendered `1 + 2` as a raw tree of `is_expression` /
1727
+ `exp` / `args` for the author to edit by hand.
1728
+
1729
+ Both halves have to move together. Flipping the flag alone would put
1730
+ the editor into expression mode and then hand it the ENVELOPE where it
1731
+ expects the expression, so the value is unwrapped here too — after
1732
+ which a saved expression is indistinguishable from one just typed,
1733
+ which is what every component downstream already assumes.
1734
+
1735
+ Reported as "after Run assertion the value shows as raw data", but the
1736
+ run is incidental: the field beside it, which no run touched, was
1737
+ equally raw. The trigger is a RELOAD, which is the only thing that puts
1738
+ an expression into its saved shape. */
1739
+ var nestedExpression = !!((_b = other === null || other === void 0 ? void 0 : other.value) === null || _b === void 0 ? void 0 : _b.is_expression);
1740
+ var expressionAwareValue = nestedExpression ?
1741
+ other.value.value
1742
+ : other.value;
1497
1743
  var resolvedType = ((0, readFirst_1.isFixedCompactAllowedValueOption)(optionSchema) ?
1498
1744
  getOptionSchemaStorageType(optionSchema, isRendererOnly)
1499
1745
  : schemaUiType && !uiTypeIsAnyLike ? schemaUiType
1500
1746
  : undefined) ||
1501
- type ||
1747
+ storedRowType ||
1502
1748
  schemaUiType ||
1503
1749
  (optionSchema === null || optionSchema === void 0 ? void 0 : optionSchema.type) ||
1504
1750
  'any';
@@ -1537,7 +1783,7 @@ var FormEngineImpl = function (_a) {
1537
1783
  (0, jsx_runtime_1.jsx)(reqore_1.ReqoreButton, { disabled: readOnly, icon: 'DeleteBinLine', effect: NegativeColorEffect, fixed: true, onClick: function () { return handleRemoveOperator(optionName, fixedValue, index); } })
1538
1784
  : null] }, index));
1539
1785
  }) }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreVerticalSpacer, { height: 5 })] })
1540
- : null, (0, react_1.createElement)(TemplateField_1.TemplateField, __assign({ fluid: true }, options === null || options === void 0 ? void 0 : options[optionName], resolveInheritProps((_b = options === null || options === void 0 ? void 0 : options[optionName]) === null || _b === void 0 ? void 0 : _b.inherit_props, availableOptions, inheritedFromParent), {
1786
+ : null, (0, react_1.createElement)(TemplateField_1.TemplateField, __assign({ fluid: true }, options === null || options === void 0 ? void 0 : options[optionName], resolveInheritProps((_c = options === null || options === void 0 ? void 0 : options[optionName]) === null || _c === void 0 ? void 0 : _c.inherit_props, availableOptions, inheritedFromParent), {
1541
1787
  // qorus#347-followup (scope forwarding): merge accumulated
1542
1788
  // inheritance (`inheritedFromParent`) with THIS field's freshly
1543
1789
  // resolved inherit_props, and pass down as a single bag so any
@@ -1549,13 +1795,13 @@ var FormEngineImpl = function (_a) {
1549
1795
  // `inherit_props: { language: 'language' }`, the list renderer
1550
1796
  // forwards it into each row, and the row's body resolves against
1551
1797
  // the accumulated bag.
1552
- inheritedFromParent: __assign(__assign({}, inheritedFromParent), resolveInheritProps((_c = options === null || options === void 0 ? void 0 : options[optionName]) === null || _c === void 0 ? void 0 : _c.inherit_props, availableOptions, inheritedFromParent)),
1798
+ inheritedFromParent: __assign(__assign({}, inheritedFromParent), resolveInheritProps((_d = options === null || options === void 0 ? void 0 : options[optionName]) === null || _d === void 0 ? void 0 : _d.inherit_props, availableOptions, inheritedFromParent)),
1553
1799
  // Propagate compact so an arg_schema field renders a COMPACT sub-form
1554
1800
  // (consistent with the parent) rather than the classic FormEngine.
1555
1801
  compact: compact,
1556
1802
  // SEAM: forwarded through TemplateField's rest-spread to AutoFormField,
1557
1803
  // which renders consumer-injected editors by field type/ui_type.
1558
- componentOverrides: componentOverrides, allowTemplates: !!(allowTemplates && ((_d = options === null || options === void 0 ? void 0 : options[optionName]) === null || _d === void 0 ? void 0 : _d.supports_templates)), allowFunctions: !!((_f = options === null || options === void 0 ? void 0 : options[optionName]) === null || _f === void 0 ? void 0 : _f.supports_expressions),
1804
+ componentOverrides: componentOverrides, templateAwareUiTypes: templateAwareUiTypes, allowTemplates: !!(allowTemplates && ((_f = options === null || options === void 0 ? void 0 : options[optionName]) === null || _f === void 0 ? void 0 : _f.supports_templates)), allowFunctions: !!((_g = options === null || options === void 0 ? void 0 : options[optionName]) === null || _g === void 0 ? void 0 : _g.supports_expressions),
1559
1805
  // reqraft: form-level expression fields get the Visual/Text shell
1560
1806
  // (DPQL text mode); opt out per-form via `templateFieldProps`.
1561
1807
  allowTextExpressions: true,
@@ -1567,25 +1813,42 @@ var FormEngineImpl = function (_a) {
1567
1813
  // control groups. The allowed-values renderer itself enforces the
1568
1814
  // fixed catalogue and never exposes free-form entry.
1569
1815
  allowCustomValues: (0, readFirst_1.isFixedCompactAllowedValueOption)(optionSchema) ||
1570
- (((_g = options === null || options === void 0 ? void 0 : options[optionName]) === null || _g === void 0 ? void 0 : _g.supports_custom_values) !== false && resolvedType !== 'any'), templates: templates.value }, (0, exports.getTypeAndCanBeNull)(
1816
+ (((_h = options === null || options === void 0 ? void 0 : options[optionName]) === null || _h === void 0 ? void 0 : _h.supports_custom_values) !== false && resolvedType !== 'any'),
1817
+ // A field may declare a template list OF ITS OWN, and when it does
1818
+ // that list is the one to offer. The engine-wide `stringTemplates`
1819
+ // are the form's shared vocabulary - config items, system properties
1820
+ // - and every field draws on the same set. A per-field list answers a
1821
+ // question only that field asks: a test assertion's `$.` references
1822
+ // are the values ITS case captured, and no other field in the form
1823
+ // should be offering them.
1824
+ //
1825
+ // Passing the engine's list unconditionally overwrote the schema's,
1826
+ // so a field that declared templates had none by the time it
1827
+ // rendered. On a typed field that only cost the picker; on an
1828
+ // ANY-LIKE one it changed the question, because `TemplateField`
1829
+ // opens on the template selector only when there is something to
1830
+ // pick and otherwise falls back to the type picker. An untyped field
1831
+ // therefore asked the author to choose `string`/`int`/`hash` before
1832
+ // it would let them name a value they had already captured.
1833
+ templates: (_j = optionSchema === null || optionSchema === void 0 ? void 0 : optionSchema.templates) !== null && _j !== void 0 ? _j : templates.value }, (0, exports.getTypeAndCanBeNull)(
1571
1834
  // The RENDERER type picks the editor — the storage type lives on
1572
1835
  // the value envelope. Passing storage here rendered a `richtext`
1573
1836
  // field as a plain string input.
1574
- resolvedType, (_h = options === null || options === void 0 ? void 0 : options[optionName]) === null || _h === void 0 ? void 0 : _h.allowed_values, other.op), { ui_type: resolvedType, name: optionName, uniqueName: "".concat(uniqueName ? "".concat(uniqueName, ".") : "".concat(name ? "".concat(name, ".") : '')).concat(optionName), onChange:
1837
+ resolvedType, (_k = options === null || options === void 0 ? void 0 : options[optionName]) === null || _k === void 0 ? void 0 : _k.allowed_values, other.op), { ui_type: resolvedType, name: optionName, uniqueName: "".concat(uniqueName ? "".concat(uniqueName, ".") : "".concat(name ? "".concat(name, ".") : '')).concat(optionName), onChange:
1575
1838
  // Identity-stable on purpose: the typed fields debounce on
1576
1839
  // `[localValue, onChange]` — an inline lambda resets the pending emit
1577
1840
  // every render and the typed value can starve.
1578
- handleValueChange, key: optionName, arg_schema: (_j = options === null || options === void 0 ? void 0 : options[optionName]) === null || _j === void 0 ? void 0 : _j.arg_schema, noSoft: !!(rest === null || rest === void 0 ? void 0 : rest.options), value: other.value, isFunction: other.is_expression, isDefaultFunction: ((_k = options === null || options === void 0 ? void 0 : options[optionName]) === null || _k === void 0 ? void 0 : _k.default_view) === 'expression', sensitive: (_l = options === null || options === void 0 ? void 0 : options[optionName]) === null || _l === void 0 ? void 0 : _l.sensitive, default_value: (0, common_1.getDefaultValue)(options === null || options === void 0 ? void 0 : options[optionName]), isDefaultTemplate: ((_m = options === null || options === void 0 ? void 0 : options[optionName]) === null || _m === void 0 ? void 0 : _m.default_view) === 'template', allowed_values: (_o = options === null || options === void 0 ? void 0 : options[optionName]) === null || _o === void 0 ? void 0 : _o.allowed_values, allowed_values_creatable: (_p = options === null || options === void 0 ? void 0 : options[optionName]) === null || _p === void 0 ? void 0 : _p.allowed_values_creatable, disabled: ((_q = options === null || options === void 0 ? void 0 : options[optionName]) === null || _q === void 0 ? void 0 : _q.disabled) ||
1841
+ handleValueChange, key: optionName, arg_schema: (_l = options === null || options === void 0 ? void 0 : options[optionName]) === null || _l === void 0 ? void 0 : _l.arg_schema, noSoft: !!(rest === null || rest === void 0 ? void 0 : rest.options), value: expressionAwareValue, isFunction: optionHoldsExpression(other), isDefaultFunction: ((_m = options === null || options === void 0 ? void 0 : options[optionName]) === null || _m === void 0 ? void 0 : _m.default_view) === 'expression', sensitive: (_o = options === null || options === void 0 ? void 0 : options[optionName]) === null || _o === void 0 ? void 0 : _o.sensitive, default_value: (0, common_1.getDefaultValue)(options === null || options === void 0 ? void 0 : options[optionName]), isDefaultTemplate: ((_p = options === null || options === void 0 ? void 0 : options[optionName]) === null || _p === void 0 ? void 0 : _p.default_view) === 'template', allowed_values: (_q = options === null || options === void 0 ? void 0 : options[optionName]) === null || _q === void 0 ? void 0 : _q.allowed_values, allowed_values_creatable: (_r = options === null || options === void 0 ? void 0 : options[optionName]) === null || _r === void 0 ? void 0 : _r.allowed_values_creatable, disabled: ((_s = options === null || options === void 0 ? void 0 : options[optionName]) === null || _s === void 0 ? void 0 : _s.disabled) ||
1579
1842
  (
1580
1843
  // a system-owned field states that as `readonly`; only the older
1581
1844
  // compat projection also sent `disabled`, so honouring only
1582
1845
  // `disabled` rendered an editable control for a value the user
1583
1846
  // cannot change (see CompactRow's `fieldReadonly`)
1584
- (_r = options === null || options === void 0 ? void 0 : options[optionName]) === null || _r === void 0 ? void 0 : _r.readonly) ||
1847
+ (_t = options === null || options === void 0 ? void 0 : options[optionName]) === null || _t === void 0 ? void 0 : _t.readonly) ||
1585
1848
  readOnly ||
1586
- !(0, validations_1.hasAllDependenciesFullfilled)((_s = options === null || options === void 0 ? void 0 : options[optionName]) === null || _s === void 0 ? void 0 : _s.depends_on, availableOptions, options || {}), readOnly: readOnly, size: editorSize || rest.size, menuItems: ((_t = options === null || options === void 0 ? void 0 : options[optionName]) === null || _t === void 0 ? void 0 : _t.ui_type) === 'any' ?
1849
+ !(0, validations_1.hasAllDependenciesFullfilled)((_u = options === null || options === void 0 ? void 0 : options[optionName]) === null || _u === void 0 ? void 0 : _u.depends_on, availableOptions, options || {}), readOnly: readOnly, size: editorSize || rest.size, menuItems: (0, typeChoices_1.offersTypeChoices)(options === null || options === void 0 ? void 0 : options[optionName], anyLikeUiTypes) ?
1587
1850
  getCustomMenuTemplateItems(optionName)
1588
- : undefined }, templateFieldProps, { forceDropdown: effectiveForceDropdown })), (0, jsx_runtime_1.jsx)(OptionFieldMessages_1.OptionFieldMessages, { schema: options || {}, allOptions: availableOptions, name: optionName, option: __assign({ type: resolvedType }, other), getType: getTypeForOption }), operators && (0, size_1.default)(operators) && (0, size_1.default)(other.op) ?
1851
+ : undefined }, templateFieldProps, { forceDropdown: effectiveForceDropdown })), (0, jsx_runtime_1.jsx)(OptionFieldMessages_1.OptionFieldMessages, { schema: options || {}, allOptions: availableOptions, name: optionName, option: __assign({ type: resolvedType }, other), getType: getTypeForOption, untouched: !touchedOptionsRef.current.has(optionName) }), operators && (0, size_1.default)(operators) && (0, size_1.default)(other.op) ?
1589
1852
  (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreVerticalSpacer, { height: 5 }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreMessage, { size: 'small', children: (0, jsx_runtime_1.jsxs)(reqore_1.ReqoreTagGroup, { children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { size: 'small', labelKey: 'WHERE', label: optionName }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { size: 'small', labelKey: 'IS', label: operatorParts.join(' ') }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { size: 'small', intent: 'info', label: other.value ?
1590
1853
  resolvedType === 'richtext' ?
1591
1854
  (0, common_1.richtextToString)(other.value)
@@ -1756,7 +2019,21 @@ var FormEngineImpl = function (_a) {
1756
2019
  fields: false,
1757
2020
  help: false,
1758
2021
  },
1759
- hasMultipleOptions: (0, size_1.default)(availableOptions) > 1,
2022
+ /* From the SCHEMA, not from the value.
2023
+ *
2024
+ * `availableOptions` is keyed off the form's VALUE, so it grows as data
2025
+ * arrives — and the search row is rendered only when this is true
2026
+ * (`CompactToolbar`). A form whose value lands after its first render
2027
+ * therefore ADDED a 38px row to its header a beat later, and everything
2028
+ * below it moved. Measured on the Qorus IDE's test editor, on the nested
2029
+ * sub-form of a case: 33 elements jumped down 51px in one frame, on every
2030
+ * cold load.
2031
+ *
2032
+ * How many fields a form has is a property of its schema. The two agree
2033
+ * once the value has arrived — `fixOptions` materialises an entry per
2034
+ * declared field — so this only changes the answer during the load, which
2035
+ * is the whole point. */
2036
+ hasMultipleOptions: (0, size_1.default)(options) > 1,
1760
2037
  compactQuery: compactQuery,
1761
2038
  setCompactQuery: setCompactQuery,
1762
2039
  requiredOnly: requiredOnly,
@@ -1807,6 +2084,7 @@ var FormEngineImpl = function (_a) {
1807
2084
  // removes it, and then the header carries just the consumer's own actions.
1808
2085
  var compactHeaderActions = (0, react_2.useMemo)(function () { return __spreadArray(__spreadArray([], (compactToolbarParts ? [{ as: CompactToolbar_1.CompactToolbar, responsive: false }] : []), true), ((compactPanelProps === null || compactPanelProps === void 0 ? void 0 : compactPanelProps.actions) || []), true); }, [compactPanelProps === null || compactPanelProps === void 0 ? void 0 : compactPanelProps.actions, compactToolbarParts]);
1809
2086
  var renderCompact = function () {
2087
+ var _a, _b, _c;
1810
2088
  var headerBg = "".concat((0, colors_1.changeDarkness)((0, colors_1.getMainBackgroundColor)(theme), 0.02)).concat((0, colors_1.percentToHexAlpha)(88));
1811
2089
  // Toolbar filters narrow the listed rows; the meter reflects the full set.
1812
2090
  var query = compactQuery.trim().toLowerCase();
@@ -1899,7 +2177,7 @@ var FormEngineImpl = function (_a) {
1899
2177
  var isUnset_1 = function (name) { var _a; return (0, readFirst_1.isOptionValueEmpty)((_a = shownOptions[name]) === null || _a === void 0 ? void 0 : _a.value); };
1900
2178
  var isFieldInvalid_1 = function (name) {
1901
2179
  var _a, _b, _c;
1902
- return !isOptionValid(name, getOptionFieldStorageType(name, (_a = shownOptions[name]) === null || _a === void 0 ? void 0 : _a.type, options, operators, (_b = shownOptions[name]) === null || _b === void 0 ? void 0 : _b.op, isRendererOnly), (_c = shownOptions[name]) === null || _c === void 0 ? void 0 : _c.value);
2180
+ return !isOptionValid(name, (0, exports.getOptionFieldStorageType)(name, (_a = shownOptions[name]) === null || _a === void 0 ? void 0 : _a.type, options, operators, (_b = shownOptions[name]) === null || _b === void 0 ? void 0 : _b.op, isRendererOnly), (_c = shownOptions[name]) === null || _c === void 0 ? void 0 : _c.value);
1903
2181
  };
1904
2182
  var comparator_1 = function (a, b) {
1905
2183
  switch (compactSort) {
@@ -1985,6 +2263,13 @@ var FormEngineImpl = function (_a) {
1985
2263
  var bucketCount = function (b) {
1986
2264
  return bucketGroups[b].reduce(function (n, g) { return n + buckets[b][g].length; }, 0);
1987
2265
  };
2266
+ /* The default is to collapse the Optional box, and an explicit pass is
2267
+ what waives the "never collapse the sole box" escape below. Resolving it
2268
+ here rather than in the parameter list is what makes the two
2269
+ distinguishable — `['optional']` as a default and `['optional']` from a
2270
+ caller mean different things. */
2271
+ var compactCollapsedGroups = compactCollapsedGroupsProp !== null && compactCollapsedGroupsProp !== void 0 ? compactCollapsedGroupsProp : ['optional'];
2272
+ var collapsedGroupsRequested = compactCollapsedGroupsProp !== undefined;
1988
2273
  // "Is the Optional box the whole form?" — when nothing needs attention and
1989
2274
  // nothing is set, collapsing it leaves a card with no visible content at all.
1990
2275
  var onlyOptionalRows = bucketCount('optional') > 0 && bucketCount('attention') === 0 && bucketCount('set') === 0;
@@ -2025,9 +2310,18 @@ var FormEngineImpl = function (_a) {
2025
2310
  bucketGroups[boxKey].some(function (groupName) { return groupHasPreselectedRow(boxKey, groupName); });
2026
2311
  };
2027
2312
  var STATUS_BOXES = [
2028
- { key: 'attention', label: 'Needs attention', intent: 'warning', icon: 'ErrorWarningLine' },
2029
- { key: 'set', label: 'Set', intent: 'success', icon: 'CheckLine' },
2030
- { key: 'optional', label: 'Optional', icon: 'CheckboxBlankCircleLine' },
2313
+ {
2314
+ key: 'attention',
2315
+ label: (_a = compactBoxLabels === null || compactBoxLabels === void 0 ? void 0 : compactBoxLabels.attention) !== null && _a !== void 0 ? _a : 'Needs attention',
2316
+ intent: 'warning',
2317
+ icon: 'ErrorWarningLine',
2318
+ },
2319
+ { key: 'set', label: (_b = compactBoxLabels === null || compactBoxLabels === void 0 ? void 0 : compactBoxLabels.set) !== null && _b !== void 0 ? _b : 'Set', intent: 'success', icon: 'CheckLine' },
2320
+ {
2321
+ key: 'optional',
2322
+ label: (_c = compactBoxLabels === null || compactBoxLabels === void 0 ? void 0 : compactBoxLabels.optional) !== null && _c !== void 0 ? _c : 'Optional',
2323
+ icon: 'CheckboxBlankCircleLine',
2324
+ },
2031
2325
  ];
2032
2326
  // Build the rows for one group: contiguous required-group members are pulled
2033
2327
  // together at the first member's slot and rendered as a connected rail (flat
@@ -2108,7 +2402,7 @@ var FormEngineImpl = function (_a) {
2108
2402
  // Mirrors the toolbar's own search-row gate: when no search
2109
2403
  // row renders, the header is a thin strip and sits tight to
2110
2404
  // the first status box (see StyledCompactPanel).
2111
- , __assign({ "$tightHeader": !((compactToolbarParts === null || compactToolbarParts === void 0 ? void 0 : compactToolbarParts.search) && (0, size_1.default)(availableOptions) > 1), "$headerBg": compactNested ? 'transparent' : headerBg, "$nested": compactNested, flat: true, raised: true, minimal: true,
2405
+ , __assign({ "$tightHeader": !((compactToolbarParts === null || compactToolbarParts === void 0 ? void 0 : compactToolbarParts.search) && (0, size_1.default)(options) > 1), "$headerBg": compactNested ? 'transparent' : headerBg, "$nested": compactNested, flat: true, raised: true, minimal: true,
2112
2406
  // No panel background: the form sits transparently on whatever
2113
2407
  // hosts it (page, drawer, or — for an arg_schema field — the
2114
2408
  // parent's edit card) instead of stacking its own dark surface.
@@ -2130,7 +2424,7 @@ var FormEngineImpl = function (_a) {
2130
2424
  var hasPreselectedRows = boxHasPreselectedRows(box.key);
2131
2425
  var wouldCollapse = compactCollapsedGroups.includes(box.key) &&
2132
2426
  !query &&
2133
- !(box.key === 'optional' && onlyOptionalRows);
2427
+ !(box.key === 'optional' && onlyOptionalRows && !collapsedGroupsRequested);
2134
2428
  // Only a box that was opened SOLELY to reveal a preselected
2135
2429
  // row splits its body; a box that renders open anyway shows
2136
2430
  // all of its groups as before.
@@ -2231,15 +2525,23 @@ var FormEngineImpl = function (_a) {
2231
2525
  : 'Resolve the invalid fields before saving', onClick: handleCommitClick, children: "Save" }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreButton, { size: 'small', minimal: true, flat: true, fixed: true, icon: 'HistoryLine', className: 'options-readfirst-discard', onClick: handleRevertChangesClick, children: "Discard" })] }) })
2232
2526
  : null] }) })] }) }) }));
2233
2527
  };
2234
- if (rest.skeleton ||
2235
- templates.loading ||
2236
- typesLoading ||
2237
- optionsLoading ||
2238
- // Remote-fetch gates, mirroring IDE Options (systemOptions.tsx:1097-1102).
2239
- loading ||
2240
- (operatorsUrl && !operators) ||
2241
- ((url || customUrl) && !options)) {
2242
- return ((0, jsx_runtime_1.jsxs)(reqore_1.ReqoreControlGroup, { className: 'options-loading-skeleton', vertical: true, fill: true, fluid: true, style: { flexGrow: 1 }, gapSize: 'big', children: [(0, jsx_runtime_1.jsxs)(reqore_1.ReqoreControlGroup, { fixed: true, fill: false, children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreSkeleton, {}), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreSkeleton, {}), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreSkeleton, { width: '100%' })] }), (0, jsx_runtime_1.jsxs)(reqore_1.ReqoreControlGroup, { vertical: true, fill: false, children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreSkeleton, { width: '100%', height: '150px' }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreSkeleton, { width: '100%', height: '150px' }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreSkeleton, { width: '100%', height: '150px' })] })] }));
2528
+ /* Which of the seven waits is holding the form, in the order they are
2529
+ tested. Rendered as `data-wait` on the placeholder so a page can be asked
2530
+ what it is waiting FOR instead of only that it is waiting. */
2531
+ var waitReason = rest.skeleton ? (rest.skeletonReason ? "host:".concat(rest.skeletonReason) : 'host')
2532
+ : templates.loading ? 'templates'
2533
+ : typesLoading ? 'types'
2534
+ : optionsLoading ? 'options'
2535
+ : loading ? 'fetch'
2536
+ : operatorsUrl && !operators ? 'operators'
2537
+ : (url || customUrl) && !options ? 'schema'
2538
+ : undefined;
2539
+ if (waitReason) {
2540
+ /* The shape of the FORM, not a generic block arrangement. This used to be
2541
+ three bars over three big panels, which resembles nothing this gate is
2542
+ waiting for and shared no vocabulary with the other waits on the same
2543
+ page — see `FormFieldsSkeleton`. */
2544
+ return (0, jsx_runtime_1.jsx)(FormFieldsSkeleton_1.FormFieldsSkeleton, { fill: true, className: 'options-loading-skeleton', reason: waitReason });
2243
2545
  }
2244
2546
  // A loader that rejected (and produced no usable schema) surfaces its error
2245
2547
  // instead of the generic "No options available" empty state.