@medyll/idae-machine 0.129.0 → 0.136.1

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 (405) hide show
  1. package/README.md +462 -300
  2. package/cli.cjs +22 -0
  3. package/dist/__fixtures__/demoModel.d.ts +79 -0
  4. package/dist/__fixtures__/demoModel.js +146 -0
  5. package/dist/ai/frame/AiChatSession.svelte +152 -0
  6. package/dist/ai/frame/AiChatSession.svelte.d.ts +7 -0
  7. package/dist/ai/frame/index.d.ts +1 -0
  8. package/dist/ai/frame/index.js +2 -0
  9. package/dist/ai/index.d.ts +9 -0
  10. package/dist/ai/index.js +12 -0
  11. package/dist/ai/schema/ai-catalogs.d.ts +2 -0
  12. package/dist/ai/schema/ai-catalogs.js +86 -0
  13. package/dist/ai/schema/ai-chat-session.d.ts +2 -0
  14. package/dist/ai/schema/ai-chat-session.js +35 -0
  15. package/dist/ai/schema/ai-companion.d.ts +2 -0
  16. package/dist/ai/schema/ai-companion.js +25 -0
  17. package/dist/ai/schema/ai-message.d.ts +2 -0
  18. package/dist/ai/schema/ai-message.js +20 -0
  19. package/dist/ai/schema/ai-tool-call.d.ts +2 -0
  20. package/dist/ai/schema/ai-tool-call.js +18 -0
  21. package/dist/ai/schema/ai-user-prompt.d.ts +2 -0
  22. package/dist/ai/schema/ai-user-prompt.js +17 -0
  23. package/dist/ai/schema/tag.d.ts +2 -0
  24. package/dist/ai/schema/tag.js +14 -0
  25. package/dist/ai/streamIntoRecord.d.ts +31 -0
  26. package/dist/ai/streamIntoRecord.js +79 -0
  27. package/dist/config.d.ts +17 -0
  28. package/dist/config.js +19 -0
  29. package/dist/data-ui/controls/AlphabetFilter.svelte +114 -0
  30. package/dist/data-ui/controls/AlphabetFilter.svelte.d.ts +10 -0
  31. package/dist/data-ui/controls/ButtonAction.svelte +151 -0
  32. package/dist/data-ui/controls/ButtonAction.svelte.d.ts +18 -0
  33. package/dist/data-ui/controls/DataFind.svelte +174 -0
  34. package/dist/data-ui/controls/DataFind.svelte.d.ts +10 -0
  35. package/dist/data-ui/controls/DataGroup.svelte +150 -0
  36. package/dist/data-ui/controls/DataGroup.svelte.d.ts +7 -0
  37. package/dist/data-ui/controls/DataSort.svelte +78 -0
  38. package/dist/data-ui/controls/DataSort.svelte.d.ts +9 -0
  39. package/dist/data-ui/controls/DataToolbar.svelte +67 -0
  40. package/dist/data-ui/controls/DataToolbar.svelte.d.ts +11 -0
  41. package/dist/data-ui/controls/Find.svelte +38 -0
  42. package/dist/data-ui/controls/Find.svelte.d.ts +9 -0
  43. package/dist/data-ui/controls/FkFilter.svelte +94 -0
  44. package/dist/data-ui/controls/FkFilter.svelte.d.ts +11 -0
  45. package/dist/data-ui/controls/Group.svelte +36 -0
  46. package/dist/data-ui/controls/Group.svelte.d.ts +8 -0
  47. package/dist/data-ui/controls/ListMode.svelte +79 -0
  48. package/dist/data-ui/controls/ListMode.svelte.d.ts +10 -0
  49. package/dist/data-ui/controls/Sort.svelte +100 -0
  50. package/dist/data-ui/controls/Sort.svelte.d.ts +8 -0
  51. package/dist/data-ui/data/DataCount.svelte +67 -0
  52. package/dist/data-ui/data/DataCount.svelte.d.ts +36 -0
  53. package/dist/data-ui/data/DataFk.svelte +54 -0
  54. package/dist/data-ui/data/DataFk.svelte.d.ts +11 -0
  55. package/dist/data-ui/data/DataForm.svelte +191 -0
  56. package/dist/data-ui/data/DataForm.svelte.d.ts +15 -0
  57. package/dist/data-ui/data/DataList.svelte +645 -0
  58. package/dist/data-ui/data/DataList.svelte.d.ts +75 -0
  59. package/dist/data-ui/data/DataListFk.svelte +111 -0
  60. package/dist/data-ui/data/DataListFk.svelte.d.ts +13 -0
  61. package/dist/data-ui/data/DataListRfk.svelte +111 -0
  62. package/dist/data-ui/data/DataListRfk.svelte.d.ts +13 -0
  63. package/dist/data-ui/data/DataRecord.svelte +167 -0
  64. package/dist/data-ui/data/DataRecord.svelte.d.ts +22 -0
  65. package/dist/data-ui/data/DataRfk.svelte +73 -0
  66. package/dist/data-ui/data/DataRfk.svelte.d.ts +15 -0
  67. package/dist/data-ui/data/index.d.ts +7 -0
  68. package/dist/data-ui/data/index.js +8 -0
  69. package/dist/data-ui/field/DataField.svelte +343 -0
  70. package/dist/data-ui/field/DataField.svelte.d.ts +33 -0
  71. package/dist/data-ui/field/DataFieldEdit.svelte +103 -0
  72. package/dist/data-ui/field/DataFieldEdit.svelte.d.ts +14 -0
  73. package/dist/data-ui/field/index.d.ts +2 -0
  74. package/dist/data-ui/field/index.js +3 -0
  75. package/dist/data-ui/field/snippets/FieldAiPrompt.svelte +145 -0
  76. package/dist/data-ui/field/snippets/FieldAiPrompt.svelte.d.ts +14 -0
  77. package/dist/data-ui/field/snippets/FieldBoolean.svelte +43 -0
  78. package/dist/data-ui/field/snippets/FieldBoolean.svelte.d.ts +12 -0
  79. package/dist/data-ui/field/snippets/FieldColor.svelte +48 -0
  80. package/dist/data-ui/field/snippets/FieldColor.svelte.d.ts +10 -0
  81. package/dist/data-ui/field/snippets/FieldCurrency.svelte +105 -0
  82. package/dist/data-ui/field/snippets/FieldCurrency.svelte.d.ts +15 -0
  83. package/dist/data-ui/field/snippets/FieldEmail.svelte +77 -0
  84. package/dist/data-ui/field/snippets/FieldEmail.svelte.d.ts +14 -0
  85. package/dist/data-ui/field/snippets/FieldIcon.svelte +73 -0
  86. package/dist/data-ui/field/snippets/FieldIcon.svelte.d.ts +11 -0
  87. package/dist/data-ui/field/snippets/FieldSelect.svelte +71 -0
  88. package/dist/data-ui/field/snippets/FieldSelect.svelte.d.ts +15 -0
  89. package/dist/data-ui/field/snippets/FieldText.svelte +52 -0
  90. package/dist/data-ui/field/snippets/FieldText.svelte.d.ts +13 -0
  91. package/dist/data-ui/field/snippets/FieldTextarea.svelte +50 -0
  92. package/dist/data-ui/field/snippets/FieldTextarea.svelte.d.ts +13 -0
  93. package/dist/data-ui/field/snippets/index.d.ts +9 -0
  94. package/dist/data-ui/field/snippets/index.js +10 -0
  95. package/dist/data-ui/fragments/ContextMenu.svelte +109 -0
  96. package/dist/data-ui/fragments/ContextMenu.svelte.d.ts +4 -0
  97. package/dist/data-ui/fragments/ContextMenuContent.svelte +275 -0
  98. package/dist/data-ui/fragments/ContextMenuContent.svelte.d.ts +8 -0
  99. package/dist/data-ui/fragments/Frame.svelte +43 -0
  100. package/dist/data-ui/fragments/Frame.svelte.d.ts +10 -0
  101. package/dist/data-ui/fragments/InfoLine.svelte +123 -0
  102. package/dist/data-ui/fragments/InfoLine.svelte.d.ts +12 -0
  103. package/dist/data-ui/fragments/Selector.svelte +56 -0
  104. package/dist/data-ui/fragments/Selector.svelte.d.ts +10 -0
  105. package/dist/{fragments → data-ui/fragments}/Skeleton.svelte +3 -3
  106. package/dist/data-ui/fragments/Tile.svelte +126 -0
  107. package/dist/data-ui/fragments/Tile.svelte.d.ts +14 -0
  108. package/dist/data-ui/fragments/contextMenu.svelte.d.ts +22 -0
  109. package/dist/data-ui/fragments/contextMenu.svelte.js +31 -0
  110. package/dist/data-ui/fragments/dialog/Dialog.svelte +185 -0
  111. package/dist/data-ui/fragments/dialog/Dialog.svelte.d.ts +29 -0
  112. package/dist/data-ui/fragments/dialog/dialog.svelte.d.ts +27 -0
  113. package/dist/data-ui/fragments/dialog/dialog.svelte.js +41 -0
  114. package/dist/data-ui/fragments/index.d.ts +11 -0
  115. package/dist/data-ui/fragments/index.js +11 -0
  116. package/dist/data-ui/utils/__tests__/HostProbe.svelte +18 -0
  117. package/dist/data-ui/utils/__tests__/HostProbe.svelte.d.ts +8 -0
  118. package/dist/data-ui/utils/data-utils.d.ts +29 -0
  119. package/dist/data-ui/utils/data-utils.js +83 -0
  120. package/dist/data-ui/utils/dataRelationUtils.d.ts +37 -0
  121. package/dist/data-ui/utils/dataRelationUtils.js +125 -0
  122. package/dist/data-ui/utils/diagramUtils.d.ts +6 -0
  123. package/dist/data-ui/utils/diagramUtils.js +131 -0
  124. package/dist/data-ui/utils/draggable.d.ts +15 -0
  125. package/dist/data-ui/utils/draggable.js +61 -0
  126. package/dist/data-ui/utils/menuPrefs.d.ts +80 -0
  127. package/dist/data-ui/utils/menuPrefs.js +119 -0
  128. package/dist/data-ui/utils/useMachinePrefs.svelte.d.ts +38 -0
  129. package/dist/data-ui/utils/useMachinePrefs.svelte.js +117 -0
  130. package/dist/data-ui/utils/useMenuTree.svelte.d.ts +26 -0
  131. package/dist/data-ui/utils/useMenuTree.svelte.js +68 -0
  132. package/dist/data-ui/utils/useRecordData.svelte.d.ts +22 -0
  133. package/dist/data-ui/utils/useRecordData.svelte.js +50 -0
  134. package/dist/data-ui/utils/useViewFields.svelte.d.ts +22 -0
  135. package/dist/data-ui/utils/useViewFields.svelte.js +59 -0
  136. package/dist/demo/.gitkeep +0 -0
  137. package/dist/demo/demo-status.json +9 -0
  138. package/dist/idae/boot.d.ts +28 -0
  139. package/dist/idae/boot.js +43 -0
  140. package/dist/idae/bridge/register.d.ts +4 -0
  141. package/dist/idae/bridge/register.js +15 -0
  142. package/dist/idae/capabilities/Capabilities.d.ts +10 -0
  143. package/dist/idae/capabilities/Capabilities.js +34 -0
  144. package/dist/idae/codefield/CodeFieldConvention.d.ts +3 -0
  145. package/dist/idae/codefield/CodeFieldConvention.js +25 -0
  146. package/dist/idae/fieldcatalog/defaultFieldTypesDef.d.ts +2 -0
  147. package/dist/idae/fieldcatalog/defaultFieldTypesDef.js +104 -0
  148. package/dist/idae/frames/FrameCatalog.d.ts +31 -0
  149. package/dist/idae/frames/FrameCatalog.js +31 -0
  150. package/dist/idae/index.d.ts +14 -0
  151. package/dist/idae/index.js +13 -0
  152. package/dist/idae/menu/IdaeMenuManager.d.ts +79 -0
  153. package/dist/idae/menu/IdaeMenuManager.js +108 -0
  154. package/dist/idae/menu/IdaeMenuStore.d.ts +77 -0
  155. package/dist/idae/menu/IdaeMenuStore.js +68 -0
  156. package/dist/idae/menu/menuSnapshot.d.ts +30 -0
  157. package/dist/idae/menu/menuSnapshot.js +30 -0
  158. package/dist/idae/meta/MetaModelProvider.d.ts +11 -0
  159. package/dist/idae/meta/MetaModelProvider.js +43 -0
  160. package/dist/idae/relations/RelationPolicy.d.ts +19 -0
  161. package/dist/idae/relations/RelationPolicy.js +125 -0
  162. package/dist/idae/rights/RightsPolicy.d.ts +16 -0
  163. package/dist/idae/rights/RightsPolicy.js +80 -0
  164. package/dist/idae/userscope/UserScopePolicy.d.ts +9 -0
  165. package/dist/idae/userscope/UserScopePolicy.js +42 -0
  166. package/dist/idae/userscope/navTracking.d.ts +11 -0
  167. package/dist/idae/userscope/navTracking.js +15 -0
  168. package/dist/index.d.ts +68 -43
  169. package/dist/index.js +82 -44
  170. package/dist/main/__tests__/_relationTestUtils.d.ts +12 -0
  171. package/dist/main/__tests__/_relationTestUtils.js +53 -0
  172. package/dist/main/__tests__/helpers/mockCollection.d.ts +21 -0
  173. package/dist/main/__tests__/helpers/mockCollection.js +27 -0
  174. package/dist/main/api/types.d.ts +29 -0
  175. package/dist/main/ext/hooks.d.ts +32 -0
  176. package/dist/main/ext/hooks.js +31 -0
  177. package/dist/main/ext/interfaces.d.ts +69 -0
  178. package/dist/main/ext/interfaces.js +3 -0
  179. package/dist/main/ext/registry.d.ts +29 -0
  180. package/dist/main/ext/registry.js +30 -0
  181. package/dist/main/frame/MachineFrameManager.d.ts +187 -0
  182. package/dist/main/frame/MachineFrameManager.js +403 -0
  183. package/dist/main/frame/contextMenuSetup.d.ts +9 -0
  184. package/dist/main/frame/contextMenuSetup.js +42 -0
  185. package/dist/main/frame/frameUrl.d.ts +1 -0
  186. package/dist/main/frame/frameUrl.js +8 -0
  187. package/dist/main/frame/frameUtils.d.ts +16 -0
  188. package/dist/main/frame/frameUtils.js +26 -0
  189. package/dist/main/frame/linkParser.d.ts +9 -0
  190. package/dist/main/frame/linkParser.js +15 -0
  191. package/dist/main/index.d.ts +15 -0
  192. package/dist/main/index.js +19 -0
  193. package/dist/main/machine/MachineAction.d.ts +62 -0
  194. package/dist/main/machine/MachineAction.js +96 -0
  195. package/dist/main/machine/MachineError.d.ts +33 -0
  196. package/dist/main/machine/MachineError.js +49 -0
  197. package/dist/main/machine/MachineErrorValidation.d.ts +19 -0
  198. package/dist/main/machine/MachineErrorValidation.js +24 -0
  199. package/dist/main/machine/MachineFieldType.d.ts +140 -0
  200. package/dist/main/machine/MachineFieldType.js +341 -0
  201. package/dist/main/machine/MachineFkFold.d.ts +34 -0
  202. package/dist/main/machine/MachineFkFold.js +57 -0
  203. package/dist/main/machine/MachineRecordIdentity.d.ts +26 -0
  204. package/dist/main/machine/MachineRecordIdentity.js +44 -0
  205. package/dist/main/machine/MachineRights.d.ts +50 -0
  206. package/dist/main/machine/MachineRights.js +133 -0
  207. package/dist/main/machine/MachineRouter.d.ts +56 -0
  208. package/dist/main/machine/MachineRouter.js +250 -0
  209. package/dist/main/machine/MachineScheme.d.ts +54 -0
  210. package/dist/main/machine/MachineScheme.js +159 -0
  211. package/dist/main/machine/MachineSchemeField.js +67 -0
  212. package/dist/main/machine/MachineSchemeFieldForge.d.ts +84 -0
  213. package/dist/main/machine/MachineSchemeFieldForge.js +140 -0
  214. package/dist/main/machine/MachineSchemeFieldValues.d.ts +68 -0
  215. package/dist/main/machine/MachineSchemeFieldValues.js +97 -0
  216. package/dist/main/machine/MachineSchemeValidate.d.ts +107 -0
  217. package/dist/main/machine/MachineSchemeValidate.js +247 -0
  218. package/dist/main/machine/MachineSchemeValues.d.ts +120 -0
  219. package/dist/main/machine/MachineSchemeValues.js +306 -0
  220. package/dist/main/machine/SchemeFieldDefaultValues.d.ts +76 -0
  221. package/dist/main/machine/SchemeFieldDefaultValues.js +104 -0
  222. package/dist/main/machine/authState.svelte.d.ts +11 -0
  223. package/dist/main/machine/authState.svelte.js +17 -0
  224. package/dist/main/machine/fieldBuilder.d.ts +23 -0
  225. package/dist/main/machine/fieldBuilder.d.ts.map +1 -0
  226. package/dist/main/machine/fieldBuilder.js +10 -0
  227. package/dist/main/machine/fieldBuilder.js.map +1 -0
  228. package/dist/main/machine/machineLabel.d.ts +11 -0
  229. package/dist/main/machine/machineLabel.js +23 -0
  230. package/dist/main/machine/validateRules.d.ts +38 -0
  231. package/dist/main/machine/validateRules.js +109 -0
  232. package/dist/main/machine.d.ts +227 -61
  233. package/dist/main/machine.js +503 -86
  234. package/dist/main/machineDb.d.ts +25 -54
  235. package/dist/main/machineDb.js +40 -94
  236. package/dist/main/machineIdbAdapter.d.ts +83 -0
  237. package/dist/main/machineIdbAdapter.js +347 -0
  238. package/dist/main/machineModelBuilder.d.ts +31 -0
  239. package/dist/main/machineModelBuilder.js +58 -0
  240. package/dist/main/machineParserForge.d.ts +38 -0
  241. package/dist/main/machineParserForge.js +168 -0
  242. package/dist/main/machineSchemaCache.d.ts +8 -0
  243. package/dist/main/machineSchemaCache.js +58 -0
  244. package/dist/main/machineSchemaDoctor.d.ts +17 -0
  245. package/dist/main/machineSchemaDoctor.js +73 -0
  246. package/dist/main/machineSchemaLoader.d.ts +18 -0
  247. package/dist/main/machineSchemaLoader.js +43 -0
  248. package/dist/main/machineSeed.d.ts +21 -0
  249. package/dist/main/machineSeed.js +44 -0
  250. package/dist/main/router/componentRegistry.d.ts +35 -0
  251. package/dist/main/router/componentRegistry.js +35 -0
  252. package/dist/main/router/urlParser.d.ts +17 -0
  253. package/dist/main/router/urlParser.js +41 -0
  254. package/dist/main/warmupUtils.d.ts +40 -0
  255. package/dist/main/warmupUtils.js +73 -0
  256. package/dist/mcp/MachineMcpClient.d.ts +43 -0
  257. package/dist/mcp/MachineMcpClient.js +175 -0
  258. package/dist/shell/Frame.svelte +67 -0
  259. package/dist/shell/Frame.svelte.d.ts +11 -0
  260. package/dist/shell/auth/Login.svelte +244 -0
  261. package/dist/shell/auth/Login.svelte.d.ts +3 -0
  262. package/dist/shell/frame/dashboard/Dashboard.svelte +0 -0
  263. package/dist/shell/frame/dashboard/Dashboard.svelte.d.ts +26 -0
  264. package/dist/shell/frame/diagram/Diagram.svelte +244 -0
  265. package/dist/shell/frame/diagram/Diagram.svelte.d.ts +9 -0
  266. package/dist/shell/frame/explorer/Explorer.svelte +86 -0
  267. package/dist/shell/frame/explorer/Explorer.svelte.d.ts +29 -0
  268. package/dist/shell/frame/explorer/ExplorerContent.svelte +126 -0
  269. package/dist/shell/frame/explorer/ExplorerContent.svelte.d.ts +32 -0
  270. package/dist/shell/frame/index.d.ts +8 -0
  271. package/dist/shell/frame/index.js +9 -0
  272. package/dist/shell/frame/main-menu-content/MainMenuContent.svelte +100 -0
  273. package/dist/shell/frame/main-menu-content/MainMenuContent.svelte.d.ts +6 -0
  274. package/dist/shell/frame/planning/Planning.svelte +426 -0
  275. package/dist/shell/frame/planning/Planning.svelte.d.ts +12 -0
  276. package/dist/shell/frame/rbac/RbacMatrix.svelte +197 -0
  277. package/dist/shell/frame/rbac/RbacMatrix.svelte.d.ts +7 -0
  278. package/dist/shell/frame/space/Space.svelte +554 -0
  279. package/dist/shell/frame/space/Space.svelte.d.ts +8 -0
  280. package/dist/shell/frame/synthesis/Synthesis.svelte +383 -0
  281. package/dist/shell/frame/synthesis/Synthesis.svelte.d.ts +8 -0
  282. package/dist/shell/frame/today/Today.svelte +174 -0
  283. package/dist/shell/frame/today/Today.svelte.d.ts +3 -0
  284. package/dist/shell/layout/App.svelte +30 -0
  285. package/dist/shell/layout/App.svelte.d.ts +3 -0
  286. package/dist/shell/layout/Breadcrumb.svelte +67 -0
  287. package/dist/shell/layout/Breadcrumb.svelte.d.ts +12 -0
  288. package/dist/shell/layout/Columner.svelte +214 -0
  289. package/dist/shell/layout/Columner.svelte.d.ts +16 -0
  290. package/dist/shell/layout/DevResetPanel.svelte +194 -0
  291. package/dist/shell/layout/DevResetPanel.svelte.d.ts +7 -0
  292. package/dist/shell/layout/Fiche.svelte +111 -0
  293. package/dist/shell/layout/Fiche.svelte.d.ts +7 -0
  294. package/dist/shell/layout/FicheUpdate.svelte +53 -0
  295. package/dist/shell/layout/FicheUpdate.svelte.d.ts +7 -0
  296. package/dist/shell/layout/MainMenu.svelte +256 -0
  297. package/dist/shell/layout/MainMenu.svelte.d.ts +6 -0
  298. package/dist/shell/layout/MenuSettings.svelte +182 -0
  299. package/dist/shell/layout/MenuSettings.svelte.d.ts +6 -0
  300. package/dist/shell/layout/RecordTimeline.svelte +199 -0
  301. package/dist/shell/layout/RecordTimeline.svelte.d.ts +8 -0
  302. package/dist/shell/layout/RecordToolbar.svelte +39 -0
  303. package/dist/shell/layout/RecordToolbar.svelte.d.ts +7 -0
  304. package/dist/shell/layout/TaskBar.svelte +118 -0
  305. package/dist/shell/layout/TaskBar.svelte.d.ts +7 -0
  306. package/dist/shell/layout/TemplateShell.svelte +48 -0
  307. package/dist/shell/layout/TemplateShell.svelte.d.ts +15 -0
  308. package/dist/shell/layout/ThemeToggle.svelte +46 -0
  309. package/dist/shell/layout/ThemeToggle.svelte.d.ts +3 -0
  310. package/dist/shell/layout/index.d.ts +8 -0
  311. package/dist/shell/layout/index.js +9 -0
  312. package/dist/storage/ApiStorageAdapter.d.ts +41 -0
  313. package/dist/storage/ApiStorageAdapter.js +111 -0
  314. package/dist/storage/IdbStorageAdapter.d.ts +31 -0
  315. package/dist/storage/IdbStorageAdapter.js +72 -0
  316. package/dist/storage/MemoryStorageAdapter.d.ts +33 -0
  317. package/dist/storage/MemoryStorageAdapter.js +132 -0
  318. package/dist/storage/README.md +222 -0
  319. package/dist/storage/StorageAdapter.d.ts +75 -0
  320. package/dist/storage/StorageAdapter.js +7 -0
  321. package/dist/storage/demo/storage-demo.d.ts +22 -0
  322. package/dist/storage/demo/storage-demo.js +107 -0
  323. package/dist/storage/index.d.ts +9 -0
  324. package/dist/storage/index.js +9 -0
  325. package/dist/types/entity-types.d.ts +444 -0
  326. package/dist/types/entity-types.js +16 -0
  327. package/dist/types/index.d.ts +7 -0
  328. package/dist/types/index.js +6 -0
  329. package/dist/types/machine-model.d.ts +198 -0
  330. package/dist/types/machine-model.js +5 -0
  331. package/dist/types/qoolie-svelte.d.ts +11 -0
  332. package/dist/types/schema-utils.d.ts +32 -0
  333. package/dist/types/schema-utils.js +103 -0
  334. package/dist/utils/generateCode.d.ts +5 -0
  335. package/dist/utils/generateCode.js +9 -0
  336. package/dist/utils/logger.d.ts +10 -0
  337. package/dist/utils/logger.js +20 -0
  338. package/package.json +70 -31
  339. package/dist/db/CrudService.d.ts +0 -9
  340. package/dist/db/CrudService.js +0 -45
  341. package/dist/db/dbSchema.d.ts +0 -201
  342. package/dist/db/dbSchema.js +0 -205
  343. package/dist/db/fieldTypes.d.ts +0 -13
  344. package/dist/db/fieldTypes.js +0 -67
  345. package/dist/db/types.d.ts +0 -124
  346. package/dist/demo/form/CreateUpdate.svelte +0 -198
  347. package/dist/demo/form/CreateUpdate.svelte.d.ts +0 -29
  348. package/dist/demo/form/CrudZone.svelte +0 -22
  349. package/dist/demo/form/CrudZone.svelte.d.ts +0 -29
  350. package/dist/demo/form/DataProvider.svelte +0 -20
  351. package/dist/demo/form/DataProvider.svelte.d.ts +0 -9
  352. package/dist/demo/form/FieldInPlace.svelte +0 -49
  353. package/dist/demo/form/FieldInPlace.svelte.d.ts +0 -11
  354. package/dist/demo/form/FieldValue.svelte +0 -212
  355. package/dist/demo/form/FieldValue.svelte.d.ts +0 -35
  356. package/dist/demo/form/types.d.ts +0 -17
  357. package/dist/demo/form/types.js +0 -1
  358. package/dist/demo/testDbSchema.d.ts +0 -6
  359. package/dist/demo/testDbSchema.js +0 -58
  360. package/dist/demo/types.d.ts +0 -140
  361. package/dist/demo/types.js +0 -1
  362. package/dist/fragments/Confirm.svelte +0 -58
  363. package/dist/fragments/Confirm.svelte.d.ts +0 -11
  364. package/dist/fragments/Frame.svelte +0 -19
  365. package/dist/fragments/Frame.svelte.d.ts +0 -32
  366. package/dist/fragments/InfoLine.svelte +0 -21
  367. package/dist/fragments/InfoLine.svelte.d.ts +0 -35
  368. package/dist/fragments/List.svelte +0 -21
  369. package/dist/fragments/List.svelte.d.ts +0 -38
  370. package/dist/fragments/Selector.svelte +0 -26
  371. package/dist/fragments/Selector.svelte.d.ts +0 -38
  372. package/dist/main/machine/IDbCollection.d.ts +0 -69
  373. package/dist/main/machine/IDbCollection.js +0 -98
  374. package/dist/main/machine/IDbCollectionFieldForge.d.ts +0 -42
  375. package/dist/main/machine/IDbCollectionFieldForge.js +0 -74
  376. package/dist/main/machine/IDbCollectionFieldValues.d.ts +0 -46
  377. package/dist/main/machine/IDbCollectionFieldValues.js +0 -62
  378. package/dist/main/machine/IDbCollectionValues.d.ts +0 -78
  379. package/dist/main/machine/IDbCollectionValues.js +0 -203
  380. package/dist/main/machine/IDbError.d.ts +0 -6
  381. package/dist/main/machine/IDbError.js +0 -61
  382. package/dist/main/machine/IDbFormValidate.d.ts +0 -55
  383. package/dist/main/machine/IDbFormValidate.js +0 -183
  384. package/dist/main/machine/IDbValidationError.d.ts +0 -19
  385. package/dist/main/machine/IDbValidationError.js +0 -24
  386. package/dist/main/machine/types.d.ts +0 -1
  387. package/dist/main/machine/types.js +0 -1
  388. package/dist/main/machineForge.d.ts +0 -57
  389. package/dist/main/machineForge.js +0 -105
  390. package/dist/types/appschemeTypes.d.ts +0 -71
  391. package/dist/types/appschemeTypes.js +0 -83
  392. package/dist/ui/CollectionButton.svelte +0 -26
  393. package/dist/ui/CollectionButton.svelte.d.ts +0 -29
  394. package/dist/ui/CollectionFieldGuess.svelte +0 -29
  395. package/dist/ui/CollectionFieldGuess.svelte.d.ts +0 -11
  396. package/dist/ui/CollectionFks.svelte +0 -24
  397. package/dist/ui/CollectionFks.svelte.d.ts +0 -9
  398. package/dist/ui/CollectionList.svelte +0 -95
  399. package/dist/ui/CollectionList.svelte.d.ts +0 -37
  400. package/dist/ui/CollectionListMenu.svelte +0 -47
  401. package/dist/ui/CollectionListMenu.svelte.d.ts +0 -34
  402. package/dist/ui/CollectionReverseFks.svelte +0 -56
  403. package/dist/ui/CollectionReverseFks.svelte.d.ts +0 -18
  404. /package/dist/{fragments → data-ui/fragments}/Skeleton.svelte.d.ts +0 -0
  405. /package/dist/{db → main/api}/types.js +0 -0
@@ -0,0 +1,126 @@
1
+ <!--
2
+ Tile.svelte
3
+ Generic card/section shell — title + icon header, body, optional footer, optional
4
+ whole-tile click. Shared by Space (classification/FK/period panels) and Today
5
+ (quick-create/my-lists/echeancier sections).
6
+
7
+ A clickable tile renders as a real <button> (native semantics, no role/tabindex
8
+ patching); a static one renders as <tile-fragment>. Both carry the .tile-fragment
9
+ class so a single CSS rule styles them — the --clickable modifier only adds button
10
+ normalisation and hover.
11
+
12
+ @prop {string} [title]
13
+ @prop {string} [icon] - Iconify icon name; bare names are prefixed with "ph:"
14
+ @prop {string} [accentColor] - CSS color value applied as --tile-accent
15
+ @prop {Snippet} [header] - overrides the default title/icon line
16
+ @prop {Snippet} [footer]
17
+ @prop {Snippet} children
18
+ @prop {() => void} [onclick] - whole-tile click (renders as a button)
19
+ @prop {string} [class]
20
+ -->
21
+ <script module lang="ts">
22
+ import type { Snippet } from 'svelte';
23
+
24
+ export interface TileProps {
25
+ title?: string;
26
+ icon?: string;
27
+ accentColor?: string;
28
+ header?: Snippet;
29
+ footer?: Snippet;
30
+ children: Snippet;
31
+ onclick?: () => void;
32
+ class?: string;
33
+ }
34
+ </script>
35
+
36
+ <script lang="ts">
37
+ import Icon from '@iconify/svelte';
38
+
39
+ let { title, icon, accentColor, header, footer, children, onclick, class: className }: TileProps =
40
+ $props();
41
+
42
+ function normalizeIcon(value: string): string {
43
+ const trimmed = value.trim();
44
+ return trimmed.includes(':') ? trimmed : `ph:${trimmed}`;
45
+ }
46
+
47
+ const style = $derived(accentColor ? `--tile-accent: ${accentColor};` : undefined);
48
+ </script>
49
+
50
+ {#snippet inner()}
51
+ {#if header}
52
+ <tile-header>{@render header()}</tile-header>
53
+ {:else if title || icon}
54
+ <tile-header>
55
+ {#if icon}<span class="tile-icon"><Icon icon={normalizeIcon(icon)} /></span>{/if}
56
+ {#if title}<span class="tile-title">{title}</span>{/if}
57
+ </tile-header>
58
+ {/if}
59
+ <tile-body>
60
+ {@render children()}
61
+ </tile-body>
62
+ {#if footer}
63
+ <tile-footer>{@render footer()}</tile-footer>
64
+ {/if}
65
+ {/snippet}
66
+
67
+ {#if onclick}
68
+ <button type="button" class="tile-fragment tile-fragment--clickable {className ?? ''}" {style} {onclick}>
69
+ {@render inner()}
70
+ </button>
71
+ {:else}
72
+ <tile-fragment class="tile-fragment {className ?? ''}" {style}>
73
+ {@render inner()}
74
+ </tile-fragment>
75
+ {/if}
76
+
77
+ <style>
78
+ @layer components {
79
+ .tile-fragment {
80
+ display: flex;
81
+ flex-direction: column;
82
+ gap: var(--gutter-xs);
83
+ padding: var(--pad-sm);
84
+ border: var(--border-width) solid var(--color-border);
85
+ border-radius: var(--radius-xs);
86
+ background: var(--color-surface-alt);
87
+ border-inline-start: calc(var(--border-width) * 3) solid var(--tile-accent, transparent);
88
+ color: var(--color-text);
89
+ font: inherit;
90
+ text-align: start;
91
+ }
92
+ /* Button normalisation only — surfaces/borders come from .tile-fragment above. */
93
+ .tile-fragment--clickable {
94
+ appearance: none;
95
+ inline-size: 100%;
96
+ cursor: pointer;
97
+ }
98
+ .tile-fragment--clickable:hover {
99
+ background: var(--color-surface-hover);
100
+ }
101
+ tile-header {
102
+ display: flex;
103
+ align-items: center;
104
+ gap: var(--gutter-xs);
105
+ font-weight: var(--font-semibold);
106
+ }
107
+ .tile-icon :global(svg) {
108
+ font-size: var(--icon-size-sm);
109
+ }
110
+ .tile-title {
111
+ text-transform: capitalize;
112
+ }
113
+ tile-body {
114
+ display: flex;
115
+ flex-direction: column;
116
+ gap: var(--gutter-xs);
117
+ }
118
+ tile-footer {
119
+ display: flex;
120
+ align-items: center;
121
+ gap: var(--gutter-xs);
122
+ padding-top: var(--pad-xs);
123
+ border-top: var(--border-width) solid var(--color-border);
124
+ }
125
+ }
126
+ </style>
@@ -0,0 +1,14 @@
1
+ import type { Snippet } from 'svelte';
2
+ export interface TileProps {
3
+ title?: string;
4
+ icon?: string;
5
+ accentColor?: string;
6
+ header?: Snippet;
7
+ footer?: Snippet;
8
+ children: Snippet;
9
+ onclick?: () => void;
10
+ class?: string;
11
+ }
12
+ declare const Tile: import("svelte").Component<TileProps, {}, "">;
13
+ type Tile = ReturnType<typeof Tile>;
14
+ export default Tile;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Reactive context-menu state. Svelte 5 runes module — consumers (ContextMenu.svelte)
3
+ * read `state` directly, no polling needed.
4
+ */
5
+ export interface ContextMenuState {
6
+ isOpen: boolean;
7
+ position: {
8
+ x: number;
9
+ y: number;
10
+ };
11
+ collection: string;
12
+ collectionId: string | number;
13
+ vars: Record<string, string>;
14
+ }
15
+ /** Open the context menu at the specified position. */
16
+ export declare function openContextMenu(targetCollection: string, targetId: string | number, targetVars: Record<string, string> | undefined, positionX: number, positionY: number): void;
17
+ /** Close the context menu. */
18
+ export declare function closeContextMenu(): void;
19
+ /** Reactive context-menu state (same object every call — read its fields in a reactive scope). */
20
+ export declare function getContextMenuState(): ContextMenuState;
21
+ /** Reset the context menu state (used by tests). */
22
+ export declare function resetContextMenu(): void;
@@ -0,0 +1,31 @@
1
+ const state = $state({
2
+ isOpen: false,
3
+ position: { x: 0, y: 0 },
4
+ collection: '',
5
+ collectionId: '',
6
+ vars: {}
7
+ });
8
+ /** Open the context menu at the specified position. */
9
+ export function openContextMenu(targetCollection, targetId, targetVars = {}, positionX, positionY) {
10
+ state.collection = targetCollection;
11
+ state.collectionId = targetId;
12
+ state.vars = targetVars;
13
+ state.position = { x: positionX, y: positionY };
14
+ state.isOpen = true;
15
+ }
16
+ /** Close the context menu. */
17
+ export function closeContextMenu() {
18
+ state.isOpen = false;
19
+ }
20
+ /** Reactive context-menu state (same object every call — read its fields in a reactive scope). */
21
+ export function getContextMenuState() {
22
+ return state;
23
+ }
24
+ /** Reset the context menu state (used by tests). */
25
+ export function resetContextMenu() {
26
+ state.isOpen = false;
27
+ state.position = { x: 0, y: 0 };
28
+ state.collection = '';
29
+ state.collectionId = '';
30
+ state.vars = {};
31
+ }
@@ -0,0 +1,185 @@
1
+ <!--
2
+ Dialog.svelte — floating/fullscreen frame with optional drag and modality (Svelte 5 runes).
3
+ A dialog IS a frame: it registers in machine.framer and mounts its content via the
4
+ shared host (componentRegistry). Rendered floating instead of filling a static zone.
5
+ When enabled, dragging uses the header bar. Stacking via css-base --z-modal.
6
+ -->
7
+ <script module lang="ts">
8
+ import type { Snippet } from 'svelte';
9
+
10
+ export interface DialogProps {
11
+ open?: boolean;
12
+ id: string;
13
+ modulePath?: string;
14
+ collection?: string;
15
+ collectionId?: string | number;
16
+ vars?: Record<string, string>;
17
+ iconClose?: string;
18
+ center?: boolean;
19
+ removeOnClose?: boolean;
20
+ /** Render a backdrop scrim behind the dialog (blocks interaction with the page). */
21
+ modal?: boolean;
22
+ /** Allow closing via the header button, Escape, or backdrop click. */
23
+ closable?: boolean;
24
+ /** Allow dragging by the header. Defaults to true. */
25
+ draggable?: boolean;
26
+ /** Fill the viewport. Defaults to false. */
27
+ fullscreen?: boolean;
28
+ onClose?: () => void;
29
+ header?: Snippet;
30
+ footer?: Snippet;
31
+ children?: Snippet;
32
+ }
33
+ </script>
34
+
35
+ <script lang="ts">
36
+ import Icon from '@iconify/svelte';
37
+ import { untrack } from 'svelte';
38
+ import { machine } from '../../../main/machine.js';
39
+ import type { FrameControls } from '../../../main/frame/MachineFrameManager.js';
40
+ import { draggable as draggableAction, centerInViewport } from '../../utils/draggable.js';
41
+
42
+ let {
43
+ open = $bindable(true),
44
+ id,
45
+ modulePath,
46
+ collection,
47
+ collectionId,
48
+ vars,
49
+ iconClose = 'mdi:close',
50
+ center = true,
51
+ removeOnClose = false,
52
+ modal = false,
53
+ closable = true,
54
+ draggable = true,
55
+ fullscreen = false,
56
+ onClose = () => {},
57
+ header,
58
+ footer,
59
+ children
60
+ }: DialogProps = $props();
61
+
62
+ let element = $state<HTMLDialogElement>();
63
+ let bodyEl = $state<HTMLDivElement>();
64
+ let visible = $state(true);
65
+ let title = $state('');
66
+
67
+ // Normal dialogs are content-driven; fullscreen dialogs provide a sized host.
68
+ const host = machine.framer.createHost(() => bodyEl, { fill: untrack(() => fullscreen) });
69
+
70
+ function setTitle(col?: string, colId?: string | number) {
71
+ if (!col) return;
72
+ machine.framer.resolveLabel(col, colId).then((label) => {
73
+ title = label ? `${col} — ${label}` : col;
74
+ });
75
+ }
76
+
77
+ /** Raise above sibling dialogs: same --z-modal layer, DOM order decides paint order. */
78
+ function raise() {
79
+ const parent = element?.parentElement;
80
+ if (parent && element && parent.lastElementChild !== element) {
81
+ parent.appendChild(element);
82
+ }
83
+ }
84
+
85
+ function focusDialog() {
86
+ visible = true;
87
+ raise();
88
+ element?.focus();
89
+ }
90
+
91
+ const controls: FrameControls = {
92
+ load: (mp, col, colId, v) => {
93
+ host.load(mp, col, colId, v);
94
+ setTitle(col, colId);
95
+ },
96
+ show: () => { visible = true; },
97
+ hide: () => { visible = false; },
98
+ toggle: () => { visible = !visible; },
99
+ close: () => close(),
100
+ focus: () => focusDialog(),
101
+ closable: untrack(() => closable)
102
+ };
103
+
104
+ $effect(() => {
105
+ untrack(() => machine.framer.register(id, controls, { replace: true }));
106
+ if (modulePath && collection) {
107
+ host.load(modulePath, collection, collectionId, vars);
108
+ setTitle(collection, collectionId);
109
+ }
110
+ return () => {
111
+ untrack(() => machine.framer.unregister(id));
112
+ host.destroy();
113
+ };
114
+ });
115
+
116
+ $effect(() => {
117
+ if (element && open && center && !fullscreen) centerInViewport(element);
118
+ });
119
+
120
+ export function close() {
121
+ host.destroy();
122
+ untrack(() => machine.framer.unregister(id));
123
+ open = false;
124
+ onClose();
125
+ }
126
+
127
+ function onKeydown(e: KeyboardEvent) {
128
+ if (closable && e.key === 'Escape') close();
129
+ }
130
+ </script>
131
+
132
+ {#if open}
133
+ {#if modal && visible}
134
+ <!-- Scrim: blocks the page; click-to-close only when closable. -->
135
+ <div
136
+ class="idae-dialog__backdrop"
137
+ role="presentation"
138
+ onpointerdown={() => closable && close()}
139
+ ></div>
140
+ {/if}
141
+ <dialog
142
+ bind:this={element}
143
+ open
144
+ class="idae-dialog"
145
+ class:idae-dialog--modal={modal}
146
+ class:idae-dialog--fullscreen={fullscreen}
147
+ tabindex="-1"
148
+ style:display={visible ? 'flex' : 'none'}
149
+ use:draggableAction={{ disabled: !draggable || fullscreen || modal }}
150
+ onpointerdown={raise}
151
+ onkeydown={onKeydown}
152
+ aria-label={title}
153
+ >
154
+ <header class="idae-dialog__bar" data-drag-handle>
155
+ {#if header}
156
+ {@render header()}
157
+ {:else}
158
+ <span class="idae-dialog__title">{title}</span>
159
+ {/if}
160
+ {#if closable}
161
+ <button
162
+ type="button"
163
+ class="btn-icon btn-sm idae-dialog__close"
164
+ aria-label="Close"
165
+ onclick={close}
166
+ >
167
+ <Icon icon={iconClose} />
168
+ </button>
169
+ {/if}
170
+ </header>
171
+
172
+ <div
173
+ class="idae-dialog__body"
174
+ class:idae-dialog__body--framed={!!modulePath}
175
+ bind:this={bodyEl}
176
+ >
177
+ {#if !modulePath && children}{@render children()}{/if}
178
+ </div>
179
+
180
+ {#if footer}
181
+ <footer class="idae-dialog__footer">{@render footer()}</footer>
182
+ {/if}
183
+ </dialog>
184
+ {/if}
185
+
@@ -0,0 +1,29 @@
1
+ import type { Snippet } from 'svelte';
2
+ export interface DialogProps {
3
+ open?: boolean;
4
+ id: string;
5
+ modulePath?: string;
6
+ collection?: string;
7
+ collectionId?: string | number;
8
+ vars?: Record<string, string>;
9
+ iconClose?: string;
10
+ center?: boolean;
11
+ removeOnClose?: boolean;
12
+ /** Render a backdrop scrim behind the dialog (blocks interaction with the page). */
13
+ modal?: boolean;
14
+ /** Allow closing via the header button, Escape, or backdrop click. */
15
+ closable?: boolean;
16
+ /** Allow dragging by the header. Defaults to true. */
17
+ draggable?: boolean;
18
+ /** Fill the viewport. Defaults to false. */
19
+ fullscreen?: boolean;
20
+ onClose?: () => void;
21
+ header?: Snippet;
22
+ footer?: Snippet;
23
+ children?: Snippet;
24
+ }
25
+ declare const Dialog: import("svelte").Component<DialogProps, {
26
+ close: () => void;
27
+ }, "open">;
28
+ type Dialog = ReturnType<typeof Dialog>;
29
+ export default Dialog;
@@ -0,0 +1,27 @@
1
+ export interface OpenDialogOptions {
2
+ /** Frame id — content-keyed by framer.loadInDialog. */
3
+ id: string;
4
+ iconClose?: string;
5
+ center?: boolean;
6
+ /** Render a backdrop scrim behind the dialog. */
7
+ modal?: boolean;
8
+ /** Allow closing via button / Escape / backdrop. Defaults to true. */
9
+ closable?: boolean;
10
+ /** Allow dragging by the header. Defaults to true. */
11
+ draggable?: boolean;
12
+ /** Fill the viewport. Defaults to false. */
13
+ fullscreen?: boolean;
14
+ /** Mount target. Defaults to document.body. */
15
+ target?: HTMLElement;
16
+ onClose?: () => void;
17
+ }
18
+ export interface DialogHandle {
19
+ close: () => void;
20
+ }
21
+ /**
22
+ * Mount a floating draggable Dialog frame on `target` (default body).
23
+ * Content is driven by framer: the Dialog auto-registers under `id`, then framer.load()
24
+ * calls controls.load() to mount the resolved component. Returns a handle with `.close()`.
25
+ * Prefer `machine.framer.loadInDialog(...)` over calling this directly.
26
+ */
27
+ export declare function openDialog(options: OpenDialogOptions): DialogHandle;
@@ -0,0 +1,41 @@
1
+ import { mount, unmount } from 'svelte';
2
+ import Dialog from './Dialog.svelte';
3
+ /**
4
+ * Mount a floating draggable Dialog frame on `target` (default body).
5
+ * Content is driven by framer: the Dialog auto-registers under `id`, then framer.load()
6
+ * calls controls.load() to mount the resolved component. Returns a handle with `.close()`.
7
+ * Prefer `machine.framer.loadInDialog(...)` over calling this directly.
8
+ */
9
+ export function openDialog(options) {
10
+ console.log('[Dialog] openDialog called with id:', options.id);
11
+ const { target = document.body, onClose, ...props } = options;
12
+ let instance;
13
+ const dispose = () => {
14
+ console.log('[Dialog] dispose called');
15
+ if (!instance)
16
+ return;
17
+ const ref = instance;
18
+ instance = undefined;
19
+ unmount(ref);
20
+ onClose?.();
21
+ };
22
+ try {
23
+ console.log('[Dialog] mounting Dialog component');
24
+ instance = mount(Dialog, {
25
+ target,
26
+ props: {
27
+ ...props,
28
+ open: true,
29
+ removeOnClose: true,
30
+ onClose: dispose
31
+ }
32
+ });
33
+ console.log('[Dialog] Dialog mounted successfully');
34
+ }
35
+ catch (err) {
36
+ console.error('[Dialog] Error mounting Dialog:', err);
37
+ throw err;
38
+ }
39
+ console.log('[Dialog] returning handle');
40
+ return { close: dispose };
41
+ }
@@ -0,0 +1,11 @@
1
+ export { default as Skeleton } from './Skeleton.svelte';
2
+ export { default as Selector } from './Selector.svelte';
3
+ export { default as Frame } from './Frame.svelte';
4
+ export { default as Tile } from './Tile.svelte';
5
+ export { default as InfoLine } from './InfoLine.svelte';
6
+ export { default as Dialog } from './dialog/Dialog.svelte';
7
+ export { default as ContextMenu } from './ContextMenu.svelte';
8
+ export { default as ContextMenuContent } from './ContextMenuContent.svelte';
9
+ export { openContextMenu, closeContextMenu } from './contextMenu.svelte.js';
10
+ export { openDialog } from './dialog/dialog.svelte.js';
11
+ export type { OpenDialogOptions, DialogHandle } from './dialog/dialog.svelte.js';
@@ -0,0 +1,11 @@
1
+ // Fragment components barrel export
2
+ export { default as Skeleton } from './Skeleton.svelte';
3
+ export { default as Selector } from './Selector.svelte';
4
+ export { default as Frame } from './Frame.svelte';
5
+ export { default as Tile } from './Tile.svelte';
6
+ export { default as InfoLine } from './InfoLine.svelte';
7
+ export { default as Dialog } from './dialog/Dialog.svelte';
8
+ export { default as ContextMenu } from './ContextMenu.svelte';
9
+ export { default as ContextMenuContent } from './ContextMenuContent.svelte';
10
+ export { openContextMenu, closeContextMenu } from './contextMenu.svelte.js';
11
+ export { openDialog } from './dialog/dialog.svelte.js';
@@ -0,0 +1,18 @@
1
+ <script lang="ts">
2
+ import { useRecordData } from '../useRecordData.svelte.js';
3
+
4
+ let {
5
+ collection,
6
+ collectionId,
7
+ data
8
+ }: {
9
+ collection: string;
10
+ collectionId?: string | number;
11
+ data?: Record<string, unknown>;
12
+ } = $props();
13
+
14
+ const recordData = useRecordData(() => collection, () => ({ collectionId, data }));
15
+ </script>
16
+
17
+ <span data-testid="code">{recordData.record?.code ?? ''}</span>
18
+ <span data-testid="collectionId">{recordData.collectionId ?? ''}</span>
@@ -0,0 +1,8 @@
1
+ type $$ComponentProps = {
2
+ collection: string;
3
+ collectionId?: string | number;
4
+ data?: Record<string, unknown>;
5
+ };
6
+ declare const HostProbe: import("svelte").Component<$$ComponentProps, {}, "">;
7
+ type HostProbe = ReturnType<typeof HostProbe>;
8
+ export default HostProbe;
@@ -0,0 +1,29 @@
1
+ export type { SortBy } from '../../types/index.js';
2
+ import type { SortBy } from '../../types/index.js';
3
+ export declare function sortItems<T extends Record<string, unknown>>(items: T[], sortBy: SortBy | SortBy[]): T[];
4
+ export declare function groupItems<T extends Record<string, unknown>>(items: T[], field: string): Map<string, T[]>;
5
+ export declare function groupItemsResolved<T extends Record<string, unknown>>(items: T[], field: string, resolveKey: (item: T, field: string) => string): Map<string, T[]>;
6
+ /**
7
+ * Resolve the FK relation key targeted by a `groupBy` expression.
8
+ * Accepts the `fks.<key>` convention (e.g. `fks.appscheme_type`) used in
9
+ * `template.presentation`, or a bare key when it matches a declared FK.
10
+ * Returns null when `groupBy` does not reference an FK relation.
11
+ */
12
+ export declare function parseFkGroupKey(groupBy: string, fks?: Record<string, unknown>): string | null;
13
+ /**
14
+ * Parse an FK field type string into its target collection and index field.
15
+ * `fk-category.id` → `{ collection: 'category', targetIndex: 'id' }`.
16
+ * Returns null for non-FK types. Pure, deterministic — no I/O.
17
+ */
18
+ export declare function parseFkType(fieldType?: string): {
19
+ collection: string;
20
+ targetIndex: string;
21
+ } | null;
22
+ /**
23
+ * Label for a FK relation stored as a nested object on the record under `fks`.
24
+ * A FK is always single (UNMULTIPLE.md) — the bag key is the bare field name.
25
+ *
26
+ * Returns undefined when the relation is not stored as a nested object
27
+ * (e.g. flat code values that need a store lookup).
28
+ */
29
+ export declare function fkObjectLabel(item: Record<string, unknown>, fkKey: string): string | undefined;
@@ -0,0 +1,83 @@
1
+ export function sortItems(items, sortBy) {
2
+ const chain = Array.isArray(sortBy) ? sortBy : [sortBy];
3
+ return [...items].sort((a, b) => {
4
+ for (const { field, direction } of chain) {
5
+ const av = a[field] ?? null;
6
+ const bv = b[field] ?? null;
7
+ if (av === null && bv === null)
8
+ continue;
9
+ if (av === null)
10
+ return 1;
11
+ if (bv === null)
12
+ return -1;
13
+ const cmp = av < bv ? -1 : av > bv ? 1 : 0;
14
+ if (cmp !== 0)
15
+ return direction === 'asc' ? cmp : -cmp;
16
+ }
17
+ return 0;
18
+ });
19
+ }
20
+ export function groupItems(items, field) {
21
+ const map = new Map();
22
+ for (const item of items) {
23
+ const key = String(item[field] ?? '—');
24
+ if (!map.has(key))
25
+ map.set(key, []);
26
+ map.get(key).push(item);
27
+ }
28
+ return map;
29
+ }
30
+ export function groupItemsResolved(items, field, resolveKey) {
31
+ const map = new Map();
32
+ for (const item of items) {
33
+ const key = resolveKey(item, field);
34
+ if (!map.has(key))
35
+ map.set(key, []);
36
+ map.get(key).push(item);
37
+ }
38
+ return map;
39
+ }
40
+ /**
41
+ * Resolve the FK relation key targeted by a `groupBy` expression.
42
+ * Accepts the `fks.<key>` convention (e.g. `fks.appscheme_type`) used in
43
+ * `template.presentation`, or a bare key when it matches a declared FK.
44
+ * Returns null when `groupBy` does not reference an FK relation.
45
+ */
46
+ export function parseFkGroupKey(groupBy, fks = {}) {
47
+ if (groupBy.startsWith('fks.'))
48
+ return groupBy.slice(4).split('.')[0] || null;
49
+ return fks[groupBy] ? groupBy : null;
50
+ }
51
+ /**
52
+ * Parse an FK field type string into its target collection and index field.
53
+ * `fk-category.id` → `{ collection: 'category', targetIndex: 'id' }`.
54
+ * Returns null for non-FK types. Pure, deterministic — no I/O.
55
+ */
56
+ export function parseFkType(fieldType) {
57
+ if (!fieldType?.startsWith('fk-'))
58
+ return null;
59
+ const [collection, targetIndex] = fieldType.slice(3).split('.');
60
+ if (!collection)
61
+ return null;
62
+ return { collection, targetIndex: targetIndex || 'id' };
63
+ }
64
+ /** Label a single nested FK entry object `{ id, code, name, … }`. */
65
+ function fkEntryLabel(o) {
66
+ return String(o.name ?? o.code ?? o.id ?? '—');
67
+ }
68
+ /**
69
+ * Label for a FK relation stored as a nested object on the record under `fks`.
70
+ * A FK is always single (UNMULTIPLE.md) — the bag key is the bare field name.
71
+ *
72
+ * Returns undefined when the relation is not stored as a nested object
73
+ * (e.g. flat code values that need a store lookup).
74
+ */
75
+ export function fkObjectLabel(item, fkKey) {
76
+ const bag = item.fks;
77
+ if (!bag || typeof bag !== 'object')
78
+ return undefined;
79
+ const entry = bag[fkKey];
80
+ if (entry && typeof entry === 'object')
81
+ return fkEntryLabel(entry);
82
+ return undefined;
83
+ }
@@ -0,0 +1,37 @@
1
+ import type { MachineScheme } from '../../main/machine/MachineScheme.js';
2
+ import type { MachineFkDef, Where, FkRelations } from '../../types/index.js';
3
+ export type RelationWhere = Where<Record<string, unknown>>;
4
+ export interface ResolvedRelation {
5
+ key: string;
6
+ title: string;
7
+ collection: string;
8
+ fieldName: string;
9
+ targetIndex: string;
10
+ where: RelationWhere;
11
+ fkDef: MachineFkDef;
12
+ }
13
+ export interface UnresolvedRelation {
14
+ key: string;
15
+ title: string;
16
+ collection: string;
17
+ error: string;
18
+ fkDef: MachineFkDef;
19
+ }
20
+ export declare function buildRelationWhere(targetIndex: string, value: unknown): RelationWhere;
21
+ export declare function resolveForwardRelations(scheme: MachineScheme, record: Record<string, unknown>, fk?: string): {
22
+ resolved: ResolvedRelation[];
23
+ unresolved: UnresolvedRelation[];
24
+ };
25
+ export declare function resolveReverseRelations(scheme: MachineScheme, record: Record<string, unknown>, fk?: string): {
26
+ resolved: ResolvedRelation[];
27
+ unresolved: UnresolvedRelation[];
28
+ };
29
+ /**
30
+ * FK relations for a collection, read via the domain bridge.
31
+ * The domain layer (IdaeRelationPolicy) reads from the `appscheme[collection]` record
32
+ * (source of truth — FKRELATIONS.md). Relations are static schema data, so this
33
+ * is an imperative read against the appscheme qoolie collection rather than the
34
+ * reactive `machine.store` (which requires a Svelte reactive frame). Both read
35
+ * the same appscheme store; consumers never read the in-memory model.
36
+ */
37
+ export declare function getCollectionRelations(collection: string): FkRelations | undefined;