@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.
- package/README.md +462 -300
- package/cli.cjs +22 -0
- package/dist/__fixtures__/demoModel.d.ts +79 -0
- package/dist/__fixtures__/demoModel.js +146 -0
- package/dist/ai/frame/AiChatSession.svelte +152 -0
- package/dist/ai/frame/AiChatSession.svelte.d.ts +7 -0
- package/dist/ai/frame/index.d.ts +1 -0
- package/dist/ai/frame/index.js +2 -0
- package/dist/ai/index.d.ts +9 -0
- package/dist/ai/index.js +12 -0
- package/dist/ai/schema/ai-catalogs.d.ts +2 -0
- package/dist/ai/schema/ai-catalogs.js +86 -0
- package/dist/ai/schema/ai-chat-session.d.ts +2 -0
- package/dist/ai/schema/ai-chat-session.js +35 -0
- package/dist/ai/schema/ai-companion.d.ts +2 -0
- package/dist/ai/schema/ai-companion.js +25 -0
- package/dist/ai/schema/ai-message.d.ts +2 -0
- package/dist/ai/schema/ai-message.js +20 -0
- package/dist/ai/schema/ai-tool-call.d.ts +2 -0
- package/dist/ai/schema/ai-tool-call.js +18 -0
- package/dist/ai/schema/ai-user-prompt.d.ts +2 -0
- package/dist/ai/schema/ai-user-prompt.js +17 -0
- package/dist/ai/schema/tag.d.ts +2 -0
- package/dist/ai/schema/tag.js +14 -0
- package/dist/ai/streamIntoRecord.d.ts +31 -0
- package/dist/ai/streamIntoRecord.js +79 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.js +19 -0
- package/dist/data-ui/controls/AlphabetFilter.svelte +114 -0
- package/dist/data-ui/controls/AlphabetFilter.svelte.d.ts +10 -0
- package/dist/data-ui/controls/ButtonAction.svelte +151 -0
- package/dist/data-ui/controls/ButtonAction.svelte.d.ts +18 -0
- package/dist/data-ui/controls/DataFind.svelte +174 -0
- package/dist/data-ui/controls/DataFind.svelte.d.ts +10 -0
- package/dist/data-ui/controls/DataGroup.svelte +150 -0
- package/dist/data-ui/controls/DataGroup.svelte.d.ts +7 -0
- package/dist/data-ui/controls/DataSort.svelte +78 -0
- package/dist/data-ui/controls/DataSort.svelte.d.ts +9 -0
- package/dist/data-ui/controls/DataToolbar.svelte +67 -0
- package/dist/data-ui/controls/DataToolbar.svelte.d.ts +11 -0
- package/dist/data-ui/controls/Find.svelte +38 -0
- package/dist/data-ui/controls/Find.svelte.d.ts +9 -0
- package/dist/data-ui/controls/FkFilter.svelte +94 -0
- package/dist/data-ui/controls/FkFilter.svelte.d.ts +11 -0
- package/dist/data-ui/controls/Group.svelte +36 -0
- package/dist/data-ui/controls/Group.svelte.d.ts +8 -0
- package/dist/data-ui/controls/ListMode.svelte +79 -0
- package/dist/data-ui/controls/ListMode.svelte.d.ts +10 -0
- package/dist/data-ui/controls/Sort.svelte +100 -0
- package/dist/data-ui/controls/Sort.svelte.d.ts +8 -0
- package/dist/data-ui/data/DataCount.svelte +67 -0
- package/dist/data-ui/data/DataCount.svelte.d.ts +36 -0
- package/dist/data-ui/data/DataFk.svelte +54 -0
- package/dist/data-ui/data/DataFk.svelte.d.ts +11 -0
- package/dist/data-ui/data/DataForm.svelte +191 -0
- package/dist/data-ui/data/DataForm.svelte.d.ts +15 -0
- package/dist/data-ui/data/DataList.svelte +645 -0
- package/dist/data-ui/data/DataList.svelte.d.ts +75 -0
- package/dist/data-ui/data/DataListFk.svelte +111 -0
- package/dist/data-ui/data/DataListFk.svelte.d.ts +13 -0
- package/dist/data-ui/data/DataListRfk.svelte +111 -0
- package/dist/data-ui/data/DataListRfk.svelte.d.ts +13 -0
- package/dist/data-ui/data/DataRecord.svelte +167 -0
- package/dist/data-ui/data/DataRecord.svelte.d.ts +22 -0
- package/dist/data-ui/data/DataRfk.svelte +73 -0
- package/dist/data-ui/data/DataRfk.svelte.d.ts +15 -0
- package/dist/data-ui/data/index.d.ts +7 -0
- package/dist/data-ui/data/index.js +8 -0
- package/dist/data-ui/field/DataField.svelte +343 -0
- package/dist/data-ui/field/DataField.svelte.d.ts +33 -0
- package/dist/data-ui/field/DataFieldEdit.svelte +103 -0
- package/dist/data-ui/field/DataFieldEdit.svelte.d.ts +14 -0
- package/dist/data-ui/field/index.d.ts +2 -0
- package/dist/data-ui/field/index.js +3 -0
- package/dist/data-ui/field/snippets/FieldAiPrompt.svelte +145 -0
- package/dist/data-ui/field/snippets/FieldAiPrompt.svelte.d.ts +14 -0
- package/dist/data-ui/field/snippets/FieldBoolean.svelte +43 -0
- package/dist/data-ui/field/snippets/FieldBoolean.svelte.d.ts +12 -0
- package/dist/data-ui/field/snippets/FieldColor.svelte +48 -0
- package/dist/data-ui/field/snippets/FieldColor.svelte.d.ts +10 -0
- package/dist/data-ui/field/snippets/FieldCurrency.svelte +105 -0
- package/dist/data-ui/field/snippets/FieldCurrency.svelte.d.ts +15 -0
- package/dist/data-ui/field/snippets/FieldEmail.svelte +77 -0
- package/dist/data-ui/field/snippets/FieldEmail.svelte.d.ts +14 -0
- package/dist/data-ui/field/snippets/FieldIcon.svelte +73 -0
- package/dist/data-ui/field/snippets/FieldIcon.svelte.d.ts +11 -0
- package/dist/data-ui/field/snippets/FieldSelect.svelte +71 -0
- package/dist/data-ui/field/snippets/FieldSelect.svelte.d.ts +15 -0
- package/dist/data-ui/field/snippets/FieldText.svelte +52 -0
- package/dist/data-ui/field/snippets/FieldText.svelte.d.ts +13 -0
- package/dist/data-ui/field/snippets/FieldTextarea.svelte +50 -0
- package/dist/data-ui/field/snippets/FieldTextarea.svelte.d.ts +13 -0
- package/dist/data-ui/field/snippets/index.d.ts +9 -0
- package/dist/data-ui/field/snippets/index.js +10 -0
- package/dist/data-ui/fragments/ContextMenu.svelte +109 -0
- package/dist/data-ui/fragments/ContextMenu.svelte.d.ts +4 -0
- package/dist/data-ui/fragments/ContextMenuContent.svelte +275 -0
- package/dist/data-ui/fragments/ContextMenuContent.svelte.d.ts +8 -0
- package/dist/data-ui/fragments/Frame.svelte +43 -0
- package/dist/data-ui/fragments/Frame.svelte.d.ts +10 -0
- package/dist/data-ui/fragments/InfoLine.svelte +123 -0
- package/dist/data-ui/fragments/InfoLine.svelte.d.ts +12 -0
- package/dist/data-ui/fragments/Selector.svelte +56 -0
- package/dist/data-ui/fragments/Selector.svelte.d.ts +10 -0
- package/dist/{fragments → data-ui/fragments}/Skeleton.svelte +3 -3
- package/dist/data-ui/fragments/Tile.svelte +126 -0
- package/dist/data-ui/fragments/Tile.svelte.d.ts +14 -0
- package/dist/data-ui/fragments/contextMenu.svelte.d.ts +22 -0
- package/dist/data-ui/fragments/contextMenu.svelte.js +31 -0
- package/dist/data-ui/fragments/dialog/Dialog.svelte +185 -0
- package/dist/data-ui/fragments/dialog/Dialog.svelte.d.ts +29 -0
- package/dist/data-ui/fragments/dialog/dialog.svelte.d.ts +27 -0
- package/dist/data-ui/fragments/dialog/dialog.svelte.js +41 -0
- package/dist/data-ui/fragments/index.d.ts +11 -0
- package/dist/data-ui/fragments/index.js +11 -0
- package/dist/data-ui/utils/__tests__/HostProbe.svelte +18 -0
- package/dist/data-ui/utils/__tests__/HostProbe.svelte.d.ts +8 -0
- package/dist/data-ui/utils/data-utils.d.ts +29 -0
- package/dist/data-ui/utils/data-utils.js +83 -0
- package/dist/data-ui/utils/dataRelationUtils.d.ts +37 -0
- package/dist/data-ui/utils/dataRelationUtils.js +125 -0
- package/dist/data-ui/utils/diagramUtils.d.ts +6 -0
- package/dist/data-ui/utils/diagramUtils.js +131 -0
- package/dist/data-ui/utils/draggable.d.ts +15 -0
- package/dist/data-ui/utils/draggable.js +61 -0
- package/dist/data-ui/utils/menuPrefs.d.ts +80 -0
- package/dist/data-ui/utils/menuPrefs.js +119 -0
- package/dist/data-ui/utils/useMachinePrefs.svelte.d.ts +38 -0
- package/dist/data-ui/utils/useMachinePrefs.svelte.js +117 -0
- package/dist/data-ui/utils/useMenuTree.svelte.d.ts +26 -0
- package/dist/data-ui/utils/useMenuTree.svelte.js +68 -0
- package/dist/data-ui/utils/useRecordData.svelte.d.ts +22 -0
- package/dist/data-ui/utils/useRecordData.svelte.js +50 -0
- package/dist/data-ui/utils/useViewFields.svelte.d.ts +22 -0
- package/dist/data-ui/utils/useViewFields.svelte.js +59 -0
- package/dist/demo/.gitkeep +0 -0
- package/dist/demo/demo-status.json +9 -0
- package/dist/idae/boot.d.ts +28 -0
- package/dist/idae/boot.js +43 -0
- package/dist/idae/bridge/register.d.ts +4 -0
- package/dist/idae/bridge/register.js +15 -0
- package/dist/idae/capabilities/Capabilities.d.ts +10 -0
- package/dist/idae/capabilities/Capabilities.js +34 -0
- package/dist/idae/codefield/CodeFieldConvention.d.ts +3 -0
- package/dist/idae/codefield/CodeFieldConvention.js +25 -0
- package/dist/idae/fieldcatalog/defaultFieldTypesDef.d.ts +2 -0
- package/dist/idae/fieldcatalog/defaultFieldTypesDef.js +104 -0
- package/dist/idae/frames/FrameCatalog.d.ts +31 -0
- package/dist/idae/frames/FrameCatalog.js +31 -0
- package/dist/idae/index.d.ts +14 -0
- package/dist/idae/index.js +13 -0
- package/dist/idae/menu/IdaeMenuManager.d.ts +79 -0
- package/dist/idae/menu/IdaeMenuManager.js +108 -0
- package/dist/idae/menu/IdaeMenuStore.d.ts +77 -0
- package/dist/idae/menu/IdaeMenuStore.js +68 -0
- package/dist/idae/menu/menuSnapshot.d.ts +30 -0
- package/dist/idae/menu/menuSnapshot.js +30 -0
- package/dist/idae/meta/MetaModelProvider.d.ts +11 -0
- package/dist/idae/meta/MetaModelProvider.js +43 -0
- package/dist/idae/relations/RelationPolicy.d.ts +19 -0
- package/dist/idae/relations/RelationPolicy.js +125 -0
- package/dist/idae/rights/RightsPolicy.d.ts +16 -0
- package/dist/idae/rights/RightsPolicy.js +80 -0
- package/dist/idae/userscope/UserScopePolicy.d.ts +9 -0
- package/dist/idae/userscope/UserScopePolicy.js +42 -0
- package/dist/idae/userscope/navTracking.d.ts +11 -0
- package/dist/idae/userscope/navTracking.js +15 -0
- package/dist/index.d.ts +68 -43
- package/dist/index.js +82 -44
- package/dist/main/__tests__/_relationTestUtils.d.ts +12 -0
- package/dist/main/__tests__/_relationTestUtils.js +53 -0
- package/dist/main/__tests__/helpers/mockCollection.d.ts +21 -0
- package/dist/main/__tests__/helpers/mockCollection.js +27 -0
- package/dist/main/api/types.d.ts +29 -0
- package/dist/main/ext/hooks.d.ts +32 -0
- package/dist/main/ext/hooks.js +31 -0
- package/dist/main/ext/interfaces.d.ts +69 -0
- package/dist/main/ext/interfaces.js +3 -0
- package/dist/main/ext/registry.d.ts +29 -0
- package/dist/main/ext/registry.js +30 -0
- package/dist/main/frame/MachineFrameManager.d.ts +187 -0
- package/dist/main/frame/MachineFrameManager.js +403 -0
- package/dist/main/frame/contextMenuSetup.d.ts +9 -0
- package/dist/main/frame/contextMenuSetup.js +42 -0
- package/dist/main/frame/frameUrl.d.ts +1 -0
- package/dist/main/frame/frameUrl.js +8 -0
- package/dist/main/frame/frameUtils.d.ts +16 -0
- package/dist/main/frame/frameUtils.js +26 -0
- package/dist/main/frame/linkParser.d.ts +9 -0
- package/dist/main/frame/linkParser.js +15 -0
- package/dist/main/index.d.ts +15 -0
- package/dist/main/index.js +19 -0
- package/dist/main/machine/MachineAction.d.ts +62 -0
- package/dist/main/machine/MachineAction.js +96 -0
- package/dist/main/machine/MachineError.d.ts +33 -0
- package/dist/main/machine/MachineError.js +49 -0
- package/dist/main/machine/MachineErrorValidation.d.ts +19 -0
- package/dist/main/machine/MachineErrorValidation.js +24 -0
- package/dist/main/machine/MachineFieldType.d.ts +140 -0
- package/dist/main/machine/MachineFieldType.js +341 -0
- package/dist/main/machine/MachineFkFold.d.ts +34 -0
- package/dist/main/machine/MachineFkFold.js +57 -0
- package/dist/main/machine/MachineRecordIdentity.d.ts +26 -0
- package/dist/main/machine/MachineRecordIdentity.js +44 -0
- package/dist/main/machine/MachineRights.d.ts +50 -0
- package/dist/main/machine/MachineRights.js +133 -0
- package/dist/main/machine/MachineRouter.d.ts +56 -0
- package/dist/main/machine/MachineRouter.js +250 -0
- package/dist/main/machine/MachineScheme.d.ts +54 -0
- package/dist/main/machine/MachineScheme.js +159 -0
- package/dist/main/machine/MachineSchemeField.js +67 -0
- package/dist/main/machine/MachineSchemeFieldForge.d.ts +84 -0
- package/dist/main/machine/MachineSchemeFieldForge.js +140 -0
- package/dist/main/machine/MachineSchemeFieldValues.d.ts +68 -0
- package/dist/main/machine/MachineSchemeFieldValues.js +97 -0
- package/dist/main/machine/MachineSchemeValidate.d.ts +107 -0
- package/dist/main/machine/MachineSchemeValidate.js +247 -0
- package/dist/main/machine/MachineSchemeValues.d.ts +120 -0
- package/dist/main/machine/MachineSchemeValues.js +306 -0
- package/dist/main/machine/SchemeFieldDefaultValues.d.ts +76 -0
- package/dist/main/machine/SchemeFieldDefaultValues.js +104 -0
- package/dist/main/machine/authState.svelte.d.ts +11 -0
- package/dist/main/machine/authState.svelte.js +17 -0
- package/dist/main/machine/fieldBuilder.d.ts +23 -0
- package/dist/main/machine/fieldBuilder.d.ts.map +1 -0
- package/dist/main/machine/fieldBuilder.js +10 -0
- package/dist/main/machine/fieldBuilder.js.map +1 -0
- package/dist/main/machine/machineLabel.d.ts +11 -0
- package/dist/main/machine/machineLabel.js +23 -0
- package/dist/main/machine/validateRules.d.ts +38 -0
- package/dist/main/machine/validateRules.js +109 -0
- package/dist/main/machine.d.ts +227 -61
- package/dist/main/machine.js +503 -86
- package/dist/main/machineDb.d.ts +25 -54
- package/dist/main/machineDb.js +40 -94
- package/dist/main/machineIdbAdapter.d.ts +83 -0
- package/dist/main/machineIdbAdapter.js +347 -0
- package/dist/main/machineModelBuilder.d.ts +31 -0
- package/dist/main/machineModelBuilder.js +58 -0
- package/dist/main/machineParserForge.d.ts +38 -0
- package/dist/main/machineParserForge.js +168 -0
- package/dist/main/machineSchemaCache.d.ts +8 -0
- package/dist/main/machineSchemaCache.js +58 -0
- package/dist/main/machineSchemaDoctor.d.ts +17 -0
- package/dist/main/machineSchemaDoctor.js +73 -0
- package/dist/main/machineSchemaLoader.d.ts +18 -0
- package/dist/main/machineSchemaLoader.js +43 -0
- package/dist/main/machineSeed.d.ts +21 -0
- package/dist/main/machineSeed.js +44 -0
- package/dist/main/router/componentRegistry.d.ts +35 -0
- package/dist/main/router/componentRegistry.js +35 -0
- package/dist/main/router/urlParser.d.ts +17 -0
- package/dist/main/router/urlParser.js +41 -0
- package/dist/main/warmupUtils.d.ts +40 -0
- package/dist/main/warmupUtils.js +73 -0
- package/dist/mcp/MachineMcpClient.d.ts +43 -0
- package/dist/mcp/MachineMcpClient.js +175 -0
- package/dist/shell/Frame.svelte +67 -0
- package/dist/shell/Frame.svelte.d.ts +11 -0
- package/dist/shell/auth/Login.svelte +244 -0
- package/dist/shell/auth/Login.svelte.d.ts +3 -0
- package/dist/shell/frame/dashboard/Dashboard.svelte +0 -0
- package/dist/shell/frame/dashboard/Dashboard.svelte.d.ts +26 -0
- package/dist/shell/frame/diagram/Diagram.svelte +244 -0
- package/dist/shell/frame/diagram/Diagram.svelte.d.ts +9 -0
- package/dist/shell/frame/explorer/Explorer.svelte +86 -0
- package/dist/shell/frame/explorer/Explorer.svelte.d.ts +29 -0
- package/dist/shell/frame/explorer/ExplorerContent.svelte +126 -0
- package/dist/shell/frame/explorer/ExplorerContent.svelte.d.ts +32 -0
- package/dist/shell/frame/index.d.ts +8 -0
- package/dist/shell/frame/index.js +9 -0
- package/dist/shell/frame/main-menu-content/MainMenuContent.svelte +100 -0
- package/dist/shell/frame/main-menu-content/MainMenuContent.svelte.d.ts +6 -0
- package/dist/shell/frame/planning/Planning.svelte +426 -0
- package/dist/shell/frame/planning/Planning.svelte.d.ts +12 -0
- package/dist/shell/frame/rbac/RbacMatrix.svelte +197 -0
- package/dist/shell/frame/rbac/RbacMatrix.svelte.d.ts +7 -0
- package/dist/shell/frame/space/Space.svelte +554 -0
- package/dist/shell/frame/space/Space.svelte.d.ts +8 -0
- package/dist/shell/frame/synthesis/Synthesis.svelte +383 -0
- package/dist/shell/frame/synthesis/Synthesis.svelte.d.ts +8 -0
- package/dist/shell/frame/today/Today.svelte +174 -0
- package/dist/shell/frame/today/Today.svelte.d.ts +3 -0
- package/dist/shell/layout/App.svelte +30 -0
- package/dist/shell/layout/App.svelte.d.ts +3 -0
- package/dist/shell/layout/Breadcrumb.svelte +67 -0
- package/dist/shell/layout/Breadcrumb.svelte.d.ts +12 -0
- package/dist/shell/layout/Columner.svelte +214 -0
- package/dist/shell/layout/Columner.svelte.d.ts +16 -0
- package/dist/shell/layout/DevResetPanel.svelte +194 -0
- package/dist/shell/layout/DevResetPanel.svelte.d.ts +7 -0
- package/dist/shell/layout/Fiche.svelte +111 -0
- package/dist/shell/layout/Fiche.svelte.d.ts +7 -0
- package/dist/shell/layout/FicheUpdate.svelte +53 -0
- package/dist/shell/layout/FicheUpdate.svelte.d.ts +7 -0
- package/dist/shell/layout/MainMenu.svelte +256 -0
- package/dist/shell/layout/MainMenu.svelte.d.ts +6 -0
- package/dist/shell/layout/MenuSettings.svelte +182 -0
- package/dist/shell/layout/MenuSettings.svelte.d.ts +6 -0
- package/dist/shell/layout/RecordTimeline.svelte +199 -0
- package/dist/shell/layout/RecordTimeline.svelte.d.ts +8 -0
- package/dist/shell/layout/RecordToolbar.svelte +39 -0
- package/dist/shell/layout/RecordToolbar.svelte.d.ts +7 -0
- package/dist/shell/layout/TaskBar.svelte +118 -0
- package/dist/shell/layout/TaskBar.svelte.d.ts +7 -0
- package/dist/shell/layout/TemplateShell.svelte +48 -0
- package/dist/shell/layout/TemplateShell.svelte.d.ts +15 -0
- package/dist/shell/layout/ThemeToggle.svelte +46 -0
- package/dist/shell/layout/ThemeToggle.svelte.d.ts +3 -0
- package/dist/shell/layout/index.d.ts +8 -0
- package/dist/shell/layout/index.js +9 -0
- package/dist/storage/ApiStorageAdapter.d.ts +41 -0
- package/dist/storage/ApiStorageAdapter.js +111 -0
- package/dist/storage/IdbStorageAdapter.d.ts +31 -0
- package/dist/storage/IdbStorageAdapter.js +72 -0
- package/dist/storage/MemoryStorageAdapter.d.ts +33 -0
- package/dist/storage/MemoryStorageAdapter.js +132 -0
- package/dist/storage/README.md +222 -0
- package/dist/storage/StorageAdapter.d.ts +75 -0
- package/dist/storage/StorageAdapter.js +7 -0
- package/dist/storage/demo/storage-demo.d.ts +22 -0
- package/dist/storage/demo/storage-demo.js +107 -0
- package/dist/storage/index.d.ts +9 -0
- package/dist/storage/index.js +9 -0
- package/dist/types/entity-types.d.ts +444 -0
- package/dist/types/entity-types.js +16 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.js +6 -0
- package/dist/types/machine-model.d.ts +198 -0
- package/dist/types/machine-model.js +5 -0
- package/dist/types/qoolie-svelte.d.ts +11 -0
- package/dist/types/schema-utils.d.ts +32 -0
- package/dist/types/schema-utils.js +103 -0
- package/dist/utils/generateCode.d.ts +5 -0
- package/dist/utils/generateCode.js +9 -0
- package/dist/utils/logger.d.ts +10 -0
- package/dist/utils/logger.js +20 -0
- package/package.json +70 -31
- package/dist/db/CrudService.d.ts +0 -9
- package/dist/db/CrudService.js +0 -45
- package/dist/db/dbSchema.d.ts +0 -201
- package/dist/db/dbSchema.js +0 -205
- package/dist/db/fieldTypes.d.ts +0 -13
- package/dist/db/fieldTypes.js +0 -67
- package/dist/db/types.d.ts +0 -124
- package/dist/demo/form/CreateUpdate.svelte +0 -198
- package/dist/demo/form/CreateUpdate.svelte.d.ts +0 -29
- package/dist/demo/form/CrudZone.svelte +0 -22
- package/dist/demo/form/CrudZone.svelte.d.ts +0 -29
- package/dist/demo/form/DataProvider.svelte +0 -20
- package/dist/demo/form/DataProvider.svelte.d.ts +0 -9
- package/dist/demo/form/FieldInPlace.svelte +0 -49
- package/dist/demo/form/FieldInPlace.svelte.d.ts +0 -11
- package/dist/demo/form/FieldValue.svelte +0 -212
- package/dist/demo/form/FieldValue.svelte.d.ts +0 -35
- package/dist/demo/form/types.d.ts +0 -17
- package/dist/demo/form/types.js +0 -1
- package/dist/demo/testDbSchema.d.ts +0 -6
- package/dist/demo/testDbSchema.js +0 -58
- package/dist/demo/types.d.ts +0 -140
- package/dist/demo/types.js +0 -1
- package/dist/fragments/Confirm.svelte +0 -58
- package/dist/fragments/Confirm.svelte.d.ts +0 -11
- package/dist/fragments/Frame.svelte +0 -19
- package/dist/fragments/Frame.svelte.d.ts +0 -32
- package/dist/fragments/InfoLine.svelte +0 -21
- package/dist/fragments/InfoLine.svelte.d.ts +0 -35
- package/dist/fragments/List.svelte +0 -21
- package/dist/fragments/List.svelte.d.ts +0 -38
- package/dist/fragments/Selector.svelte +0 -26
- package/dist/fragments/Selector.svelte.d.ts +0 -38
- package/dist/main/machine/IDbCollection.d.ts +0 -69
- package/dist/main/machine/IDbCollection.js +0 -98
- package/dist/main/machine/IDbCollectionFieldForge.d.ts +0 -42
- package/dist/main/machine/IDbCollectionFieldForge.js +0 -74
- package/dist/main/machine/IDbCollectionFieldValues.d.ts +0 -46
- package/dist/main/machine/IDbCollectionFieldValues.js +0 -62
- package/dist/main/machine/IDbCollectionValues.d.ts +0 -78
- package/dist/main/machine/IDbCollectionValues.js +0 -203
- package/dist/main/machine/IDbError.d.ts +0 -6
- package/dist/main/machine/IDbError.js +0 -61
- package/dist/main/machine/IDbFormValidate.d.ts +0 -55
- package/dist/main/machine/IDbFormValidate.js +0 -183
- package/dist/main/machine/IDbValidationError.d.ts +0 -19
- package/dist/main/machine/IDbValidationError.js +0 -24
- package/dist/main/machine/types.d.ts +0 -1
- package/dist/main/machine/types.js +0 -1
- package/dist/main/machineForge.d.ts +0 -57
- package/dist/main/machineForge.js +0 -105
- package/dist/types/appschemeTypes.d.ts +0 -71
- package/dist/types/appschemeTypes.js +0 -83
- package/dist/ui/CollectionButton.svelte +0 -26
- package/dist/ui/CollectionButton.svelte.d.ts +0 -29
- package/dist/ui/CollectionFieldGuess.svelte +0 -29
- package/dist/ui/CollectionFieldGuess.svelte.d.ts +0 -11
- package/dist/ui/CollectionFks.svelte +0 -24
- package/dist/ui/CollectionFks.svelte.d.ts +0 -9
- package/dist/ui/CollectionList.svelte +0 -95
- package/dist/ui/CollectionList.svelte.d.ts +0 -37
- package/dist/ui/CollectionListMenu.svelte +0 -47
- package/dist/ui/CollectionListMenu.svelte.d.ts +0 -34
- package/dist/ui/CollectionReverseFks.svelte +0 -56
- package/dist/ui/CollectionReverseFks.svelte.d.ts +0 -18
- /package/dist/{fragments → data-ui/fragments}/Skeleton.svelte.d.ts +0 -0
- /package/dist/{db → main/api}/types.js +0 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MachineFrameManager — singleton registry for dynamic frame controls.
|
|
3
|
+
* DOM-first: frames auto-register on mount, unregister on unmount.
|
|
4
|
+
*/
|
|
5
|
+
import { mount, unmount } from 'svelte';
|
|
6
|
+
import { SvelteMap } from 'svelte/reactivity';
|
|
7
|
+
import { buildLoadInUrl } from './frameUrl.js';
|
|
8
|
+
import { computeFrameId } from './frameUtils.js';
|
|
9
|
+
import { componentRegistry } from '../router/componentRegistry.js';
|
|
10
|
+
export class MachineFrameManager {
|
|
11
|
+
registry = new SvelteMap();
|
|
12
|
+
/** Zones with a Frame mount in flight — closes the race where the same URL fires twice
|
|
13
|
+
* before the first Frame's $effect registers, causing a duplicate Frame mount. */
|
|
14
|
+
mountingZones = new Set();
|
|
15
|
+
/** zone name → set of registered frameIds in that zone (for sibling hide/show). */
|
|
16
|
+
zoneFrames = new Map();
|
|
17
|
+
frameClosable = new Map();
|
|
18
|
+
_router;
|
|
19
|
+
silentCloseFrames = new Set();
|
|
20
|
+
_onNavigate;
|
|
21
|
+
_labelResolver;
|
|
22
|
+
_contextMenuMounted = false;
|
|
23
|
+
/** Injected by machine at init — enables URL-based navigation from framer. */
|
|
24
|
+
setRouter(options) {
|
|
25
|
+
this._router = options;
|
|
26
|
+
}
|
|
27
|
+
/** Injected by machine at init — fires after each loadFrame navigation. */
|
|
28
|
+
setNavigationHook(fn) {
|
|
29
|
+
this._onNavigate = fn;
|
|
30
|
+
}
|
|
31
|
+
/** Injected by machine — resolves a record label (presentation) for dialog titles. */
|
|
32
|
+
setLabelResolver(fn) {
|
|
33
|
+
this._labelResolver = fn;
|
|
34
|
+
}
|
|
35
|
+
/** Resolve a human label for (collection, id). Falls back to undefined if no resolver set. */
|
|
36
|
+
async resolveLabel(collection, collectionId) {
|
|
37
|
+
if (!this._labelResolver)
|
|
38
|
+
return undefined;
|
|
39
|
+
try {
|
|
40
|
+
return await this._labelResolver(collection, collectionId);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Create a mount host bound to a target element (resolved lazily via getTarget).
|
|
48
|
+
* Shared engine for Frame.svelte and Dialog.svelte — see FrameHost.
|
|
49
|
+
*
|
|
50
|
+
* Toggle semantics (not swap): each distinct (modulePath, collection, collectionId, vars)
|
|
51
|
+
* mounts once into its own wrapper div and is kept alive. Re-loading the same content
|
|
52
|
+
* hides every sibling and shows the existing instance — no unmount, no re-render.
|
|
53
|
+
* Loading new content hides siblings and mounts the new instance. State is preserved
|
|
54
|
+
* across toggles. `destroy()` unmounts everything (frame teardown).
|
|
55
|
+
*
|
|
56
|
+
* `fill` (default true): the mounted content fills its zone via absolute
|
|
57
|
+
* inset:0 — correct for sized zones (main, panel). Set false for hosts whose
|
|
58
|
+
* own size is content-driven (floating dialog): content then sits in normal
|
|
59
|
+
* flow so the host can grow to fit it.
|
|
60
|
+
*/
|
|
61
|
+
createHost(getTarget, opts = {}) {
|
|
62
|
+
const fill = opts.fill ?? true;
|
|
63
|
+
const instances = new Map();
|
|
64
|
+
let seq = 0;
|
|
65
|
+
const contentKey = (modulePath, collection, collectionId, vars) => `${modulePath}::${computeFrameId(collection, collectionId, vars)}`;
|
|
66
|
+
const hideAll = () => {
|
|
67
|
+
for (const { el } of instances.values())
|
|
68
|
+
el.style.display = 'none';
|
|
69
|
+
};
|
|
70
|
+
const destroy = () => {
|
|
71
|
+
for (const { app } of instances.values())
|
|
72
|
+
unmount(app);
|
|
73
|
+
instances.clear();
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
load: (modulePath, collection, collectionId, vars) => {
|
|
77
|
+
const key = contentKey(modulePath, collection, collectionId, vars);
|
|
78
|
+
// Already mounted → toggle to it without re-rendering.
|
|
79
|
+
const existing = instances.get(key);
|
|
80
|
+
if (existing) {
|
|
81
|
+
hideAll();
|
|
82
|
+
existing.el.style.display = 'block';
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const s = ++seq;
|
|
86
|
+
componentRegistry.resolve(modulePath).then((Comp) => {
|
|
87
|
+
const target = getTarget();
|
|
88
|
+
if (!target)
|
|
89
|
+
return;
|
|
90
|
+
// Guard re-entrancy: another instance for this key may have mounted while resolving.
|
|
91
|
+
if (instances.has(key)) {
|
|
92
|
+
if (s === seq) {
|
|
93
|
+
hideAll();
|
|
94
|
+
instances.get(key).el.style.display = 'block';
|
|
95
|
+
}
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
hideAll();
|
|
99
|
+
const el = document.createElement('div');
|
|
100
|
+
el.className = 'frame-content';
|
|
101
|
+
el.dataset.contentKey = key;
|
|
102
|
+
el.style.cssText = fill
|
|
103
|
+
? 'position:absolute;inset:0;overflow:hidden;'
|
|
104
|
+
: 'position:relative;width:100%;';
|
|
105
|
+
target.appendChild(el);
|
|
106
|
+
const app = mount(Comp, {
|
|
107
|
+
target: el,
|
|
108
|
+
props: {
|
|
109
|
+
collection,
|
|
110
|
+
collectionId,
|
|
111
|
+
dataId: collectionId,
|
|
112
|
+
vars
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
instances.set(key, { app, el });
|
|
116
|
+
}).catch((err) => {
|
|
117
|
+
console.error(`[FrameManager] Error loading component for modulePath "${modulePath}":`, err);
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
destroy
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Open the global context menu for (collection, collectionId) at the given page position.
|
|
125
|
+
* Mounts the singleton <ContextMenu> host into document.body on first use.
|
|
126
|
+
*/
|
|
127
|
+
openContextMenu(collection, collectionId, vars = {}, x = 0, y = 0) {
|
|
128
|
+
this.#ensureContextMenuMounted().then(() => {
|
|
129
|
+
import('../../data-ui/fragments/contextMenu.svelte.js').then(({ openContextMenu }) => {
|
|
130
|
+
openContextMenu(collection, collectionId, vars, x, y);
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/** Close the global context menu, if open. */
|
|
135
|
+
closeContextMenu() {
|
|
136
|
+
import('../../data-ui/fragments/contextMenu.svelte.js').then(({ closeContextMenu }) => {
|
|
137
|
+
closeContextMenu();
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
async #ensureContextMenuMounted() {
|
|
141
|
+
if (this._contextMenuMounted || typeof document === 'undefined')
|
|
142
|
+
return;
|
|
143
|
+
this._contextMenuMounted = true;
|
|
144
|
+
const ContextMenu = (await import('../../data-ui/fragments/ContextMenu.svelte')).default;
|
|
145
|
+
mount(ContextMenu, { target: document.body });
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Frame navigation. By default it pushes a hash URL through the router;
|
|
149
|
+
* history:false mounts directly and leaves the URL untouched.
|
|
150
|
+
*/
|
|
151
|
+
loadFrame(pathKey, collection, collectionId, options = {}) {
|
|
152
|
+
if (!this._router)
|
|
153
|
+
throw new Error('[FrameManager] router not set — call machine.init() first');
|
|
154
|
+
const { vars, zone = 'main', closable = true, history = true } = options;
|
|
155
|
+
const frameId = `${pathKey}:${zone}`;
|
|
156
|
+
this.frameClosable.set(frameId, closable);
|
|
157
|
+
const registered = this.registry.get(frameId);
|
|
158
|
+
if (registered)
|
|
159
|
+
registered.closable = closable;
|
|
160
|
+
const event = { modulePath: pathKey, collection, collectionId, vars, zone };
|
|
161
|
+
if (history) {
|
|
162
|
+
const varsStr = vars && Object.keys(vars).length > 0 ? new URLSearchParams(vars).toString() : undefined;
|
|
163
|
+
this._router.push(buildLoadInUrl(pathKey, zone, collection, collectionId, varsStr));
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
this._router.openFrame(event);
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
this._onNavigate?.(event);
|
|
170
|
+
console.log(`[FrameManager] navigate: ${pathKey} in zone "${zone}" for ${collection}:${collectionId ?? ''}`);
|
|
171
|
+
}
|
|
172
|
+
catch (err) {
|
|
173
|
+
console.warn('[FrameManager] navigation hook failed:', err);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
loadIn(pathKey, collection, collectionIdOrOptions, maybeOptions) {
|
|
177
|
+
const collectionId = typeof collectionIdOrOptions === 'object'
|
|
178
|
+
? undefined
|
|
179
|
+
: collectionIdOrOptions;
|
|
180
|
+
const options = typeof collectionIdOrOptions === 'object'
|
|
181
|
+
? collectionIdOrOptions
|
|
182
|
+
: maybeOptions;
|
|
183
|
+
if (!options)
|
|
184
|
+
throw new Error('[FrameManager] loadIn requires options.zone');
|
|
185
|
+
this.loadFrame(pathKey, collection, collectionId, options);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Open content in a dialog, routed by default and direct when history:false.
|
|
189
|
+
* frameId is content-keyed: reopening the same (modulePath, collection, id) focuses the
|
|
190
|
+
* existing dialog instead of duplicating; different content stacks new dialogs.
|
|
191
|
+
*/
|
|
192
|
+
async loadInDialog(pathKey, collection, collectionId, options = {}) {
|
|
193
|
+
const { vars, history = true, modal, closable = true, draggable = true, fullscreen = false } = options;
|
|
194
|
+
const frameId = `dialog:${pathKey}:${collection}:${collectionId ?? ''}`;
|
|
195
|
+
this.frameClosable.set(frameId, closable);
|
|
196
|
+
console.log(`[FrameManager] loadInDialog: ${frameId}`);
|
|
197
|
+
// Already open → focus the existing dialog, don't reload/duplicate.
|
|
198
|
+
const existing = this.registry.get(frameId);
|
|
199
|
+
if (existing) {
|
|
200
|
+
existing.closable = closable;
|
|
201
|
+
console.log(`[FrameManager] loadInDialog: focusing existing dialog`);
|
|
202
|
+
existing.show();
|
|
203
|
+
existing.focus?.();
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (history) {
|
|
207
|
+
if (!this._router)
|
|
208
|
+
throw new Error('[FrameManager] router not set — call machine.init() first');
|
|
209
|
+
this._router.openDialog({
|
|
210
|
+
modulePath: pathKey,
|
|
211
|
+
collection,
|
|
212
|
+
collectionId,
|
|
213
|
+
vars,
|
|
214
|
+
modal,
|
|
215
|
+
closable,
|
|
216
|
+
draggable,
|
|
217
|
+
fullscreen
|
|
218
|
+
});
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
console.log(`[FrameManager] loadInDialog: loading new dialog`);
|
|
222
|
+
await this.load(frameId, pathKey, collection, collectionId, vars, async (id) => {
|
|
223
|
+
console.log(`[FrameManager] loadInDialog: opening dialog ${id}`);
|
|
224
|
+
const { openDialog } = await import('../../data-ui/fragments/dialog/dialog.svelte.js');
|
|
225
|
+
openDialog({ id, modal, closable, draggable, fullscreen });
|
|
226
|
+
console.log(`[FrameManager] loadInDialog: dialog opened`);
|
|
227
|
+
});
|
|
228
|
+
console.log(`[FrameManager] loadInDialog: completed`);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Register a frame's controls under a unique frameId.
|
|
232
|
+
* By default throws if the frameId is already registered.
|
|
233
|
+
* `replace` is intended for DOM/HMR-driven remounts where the frame id is stable
|
|
234
|
+
* but the mounted component instance has been recreated.
|
|
235
|
+
*
|
|
236
|
+
* Zone frames (format "modulePath:zone", not starting with "dialog:") are tracked
|
|
237
|
+
* per-zone so siblings can be hidden when a new frame activates.
|
|
238
|
+
*/
|
|
239
|
+
register(frameId, controls, options = {}) {
|
|
240
|
+
const existing = this.registry.get(frameId);
|
|
241
|
+
if (existing === controls)
|
|
242
|
+
return;
|
|
243
|
+
if (existing && !options.replace) {
|
|
244
|
+
throw new Error(`[FrameManager] frame "${frameId}" already registered`);
|
|
245
|
+
}
|
|
246
|
+
const registeredControls = !this._router
|
|
247
|
+
? controls
|
|
248
|
+
: {
|
|
249
|
+
...controls,
|
|
250
|
+
closable: this.frameClosable.get(frameId) ?? controls.closable ?? true,
|
|
251
|
+
close: () => {
|
|
252
|
+
controls.close();
|
|
253
|
+
if (!this.silentCloseFrames.has(frameId))
|
|
254
|
+
this._router?.closeFrame(frameId);
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
this.registry.set(frameId, registeredControls);
|
|
258
|
+
if (!frameId.startsWith('dialog:')) {
|
|
259
|
+
const colonIdx = frameId.indexOf(':');
|
|
260
|
+
if (colonIdx !== -1) {
|
|
261
|
+
const zone = frameId.slice(colonIdx + 1);
|
|
262
|
+
if (!this.zoneFrames.has(zone))
|
|
263
|
+
this.zoneFrames.set(zone, new Set());
|
|
264
|
+
this.zoneFrames.get(zone).add(frameId);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Unregister a frame by its frameId. No-op if not found.
|
|
270
|
+
*/
|
|
271
|
+
unregister(frameId) {
|
|
272
|
+
this.registry.delete(frameId);
|
|
273
|
+
if (!frameId.startsWith('dialog:')) {
|
|
274
|
+
const colonIdx = frameId.indexOf(':');
|
|
275
|
+
if (colonIdx !== -1) {
|
|
276
|
+
const zone = frameId.slice(colonIdx + 1);
|
|
277
|
+
this.zoneFrames.get(zone)?.delete(frameId);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* For zone frames (format "modulePath:zone"): hide all sibling frames in the same
|
|
283
|
+
* zone and show the target frame. No-op for dialog frames.
|
|
284
|
+
*/
|
|
285
|
+
activateZoneFrame(frameId) {
|
|
286
|
+
if (frameId.startsWith('dialog:'))
|
|
287
|
+
return;
|
|
288
|
+
const colonIdx = frameId.indexOf(':');
|
|
289
|
+
if (colonIdx === -1)
|
|
290
|
+
return;
|
|
291
|
+
const zone = frameId.slice(colonIdx + 1);
|
|
292
|
+
const siblings = this.zoneFrames.get(zone);
|
|
293
|
+
if (!siblings)
|
|
294
|
+
return;
|
|
295
|
+
for (const sibId of siblings) {
|
|
296
|
+
if (sibId !== frameId)
|
|
297
|
+
this.registry.get(sibId)?.hide();
|
|
298
|
+
}
|
|
299
|
+
this.registry.get(frameId)?.show();
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Load content into a frame.
|
|
303
|
+
* - Frame known (in registry) → delegates to controls.load()
|
|
304
|
+
* - Frame unknown → looks for DOM zone [data-target-zone="${frameId}"]
|
|
305
|
+
* If zone found, caller should mount <Frame> there (auto-register happens on mount),
|
|
306
|
+
* then this method retries with the now-registered frame.
|
|
307
|
+
* If no zone found, throws.
|
|
308
|
+
*
|
|
309
|
+
* @param mountFn — optional callback to mount a <Frame> in the DOM zone.
|
|
310
|
+
* Signature: (frameId: string) => Promise<void>
|
|
311
|
+
*/
|
|
312
|
+
async load(frameId, modulePath, collection, collectionId, vars, mountFn) {
|
|
313
|
+
const controls = this.registry.get(frameId);
|
|
314
|
+
if (controls) {
|
|
315
|
+
this.activateZoneFrame(frameId);
|
|
316
|
+
controls.load(modulePath, collection, collectionId, vars);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
// A concurrent load is already mounting a Frame for this zone (same URL fired twice).
|
|
320
|
+
// Skip the duplicate mount — the in-flight one will mount + load the same content.
|
|
321
|
+
if (this.mountingZones.has(frameId))
|
|
322
|
+
return;
|
|
323
|
+
const zone = typeof document !== 'undefined'
|
|
324
|
+
? document.querySelector(`[data-target-zone="${frameId}"]`)
|
|
325
|
+
: null;
|
|
326
|
+
if (mountFn) {
|
|
327
|
+
this.mountingZones.add(frameId);
|
|
328
|
+
try {
|
|
329
|
+
await mountFn(frameId);
|
|
330
|
+
}
|
|
331
|
+
finally {
|
|
332
|
+
this.mountingZones.delete(frameId);
|
|
333
|
+
}
|
|
334
|
+
const fresh = this.registry.get(frameId);
|
|
335
|
+
if (fresh) {
|
|
336
|
+
this.activateZoneFrame(frameId);
|
|
337
|
+
fresh.load(modulePath, collection, collectionId, vars);
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (zone) {
|
|
341
|
+
throw new Error(`[FrameManager] frame "${frameId}" failed to register after mount`);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (!zone) {
|
|
345
|
+
throw new Error(`[FrameManager] frame "${frameId}" not found and no DOM zone [data-target-zone="${frameId}"] exists`);
|
|
346
|
+
}
|
|
347
|
+
throw new Error(`[FrameManager] frame "${frameId}" not registered — mountFn required to mount <Frame> in zone`);
|
|
348
|
+
}
|
|
349
|
+
/** Show a frame by calling controls.show(). Throws if not found. */
|
|
350
|
+
show(frameId) {
|
|
351
|
+
const controls = this.registry.get(frameId);
|
|
352
|
+
if (!controls)
|
|
353
|
+
throw new Error(`[FrameManager] frame "${frameId}" not found`);
|
|
354
|
+
controls.show();
|
|
355
|
+
}
|
|
356
|
+
/** Hide a frame by calling controls.hide(). Throws if not found. */
|
|
357
|
+
hide(frameId) {
|
|
358
|
+
const controls = this.registry.get(frameId);
|
|
359
|
+
if (!controls)
|
|
360
|
+
throw new Error(`[FrameManager] frame "${frameId}" not found`);
|
|
361
|
+
controls.hide();
|
|
362
|
+
}
|
|
363
|
+
/** Toggle a frame visibility. Throws if not found. */
|
|
364
|
+
toggle(frameId) {
|
|
365
|
+
const controls = this.registry.get(frameId);
|
|
366
|
+
if (!controls)
|
|
367
|
+
throw new Error(`[FrameManager] frame "${frameId}" not found`);
|
|
368
|
+
controls.toggle();
|
|
369
|
+
}
|
|
370
|
+
/** Close a frame (unmount + unregister). Throws if not found. */
|
|
371
|
+
close(frameId, options = {}) {
|
|
372
|
+
const controls = this.registry.get(frameId);
|
|
373
|
+
if (!controls)
|
|
374
|
+
throw new Error(`[FrameManager] frame "${frameId}" not found`);
|
|
375
|
+
if (options.history === false)
|
|
376
|
+
this.silentCloseFrames.add(frameId);
|
|
377
|
+
try {
|
|
378
|
+
controls.close();
|
|
379
|
+
}
|
|
380
|
+
finally {
|
|
381
|
+
this.silentCloseFrames.delete(frameId);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
/** Read-only view of currently open frames. */
|
|
385
|
+
get openFrames() {
|
|
386
|
+
return this.registry;
|
|
387
|
+
}
|
|
388
|
+
/** Check if a frame is registered. */
|
|
389
|
+
has(frameId) {
|
|
390
|
+
return this.registry.has(frameId);
|
|
391
|
+
}
|
|
392
|
+
/** Get controls for a frame (or undefined). */
|
|
393
|
+
getControls(frameId) {
|
|
394
|
+
return this.registry.get(frameId);
|
|
395
|
+
}
|
|
396
|
+
/** Clear all registered frames. */
|
|
397
|
+
clear() {
|
|
398
|
+
this.registry.clear();
|
|
399
|
+
this.zoneFrames.clear();
|
|
400
|
+
this.frameClosable.clear();
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
export const machineFrameManager = new MachineFrameManager();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type ContextMenuHost = {
|
|
2
|
+
openContextMenu(collection: string, collectionId: string | number, vars: Record<string, string>, x: number, y: number): void;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Attach a contextmenu listener that delegates data-contextual elements to the frame manager.
|
|
6
|
+
* Returns a cleanup function — call it in destroy().
|
|
7
|
+
*/
|
|
8
|
+
export declare function setupContextMenuListener(framer: ContextMenuHost): () => void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const RESERVED_KEYS = new Set(['collection', 'table', 'collectionId', 'table_value']);
|
|
2
|
+
function parseContextualAttr(raw) {
|
|
3
|
+
const params = {};
|
|
4
|
+
for (const part of raw.split('&')) {
|
|
5
|
+
const [key, value] = part.split('=');
|
|
6
|
+
if (key && value)
|
|
7
|
+
params[key] = decodeURIComponent(value);
|
|
8
|
+
}
|
|
9
|
+
const vars = {};
|
|
10
|
+
for (const [k, v] of Object.entries(params)) {
|
|
11
|
+
if (!RESERVED_KEYS.has(k))
|
|
12
|
+
vars[k] = v;
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
collection: params.collection ?? params.table,
|
|
16
|
+
collectionId: params.collectionId ?? params.table_value,
|
|
17
|
+
vars,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Attach a contextmenu listener that delegates data-contextual elements to the frame manager.
|
|
22
|
+
* Returns a cleanup function — call it in destroy().
|
|
23
|
+
*/
|
|
24
|
+
export function setupContextMenuListener(framer) {
|
|
25
|
+
if (typeof document === 'undefined')
|
|
26
|
+
return () => { };
|
|
27
|
+
const handler = (e) => {
|
|
28
|
+
const target = e.target.closest('[data-contextual]');
|
|
29
|
+
if (!target)
|
|
30
|
+
return;
|
|
31
|
+
const raw = target.dataset.contextual;
|
|
32
|
+
if (!raw)
|
|
33
|
+
return;
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
const { collection, collectionId, vars } = parseContextualAttr(raw);
|
|
36
|
+
if (collection && collectionId !== undefined) {
|
|
37
|
+
framer.openContextMenu(collection, collectionId, vars, e.pageX, e.pageY);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
document.addEventListener('contextmenu', handler);
|
|
41
|
+
return () => document.removeEventListener('contextmenu', handler);
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function buildLoadInUrl(modulePath: string, targetId: string, collection: string, collectionId?: string | number, vars?: string): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* generateFrameId — unique human-readable frame instance ID.
|
|
3
|
+
* Format: "{prefix}_{8-char hex}" e.g. "vehicle_a1b2c3d4"
|
|
4
|
+
*/
|
|
5
|
+
export declare function generateFrameId(prefix: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* computeFrameId — deterministic frame ID from (collection, collectionId?, vars?).
|
|
8
|
+
*
|
|
9
|
+
* Examples:
|
|
10
|
+
* computeFrameId('vehicle') → "vehicle"
|
|
11
|
+
* computeFrameId('vehicle', '42') → "vehicle:42"
|
|
12
|
+
* computeFrameId('vehicle', '42', {tab}) → "vehicle:42:tab=info"
|
|
13
|
+
*
|
|
14
|
+
* Vars are sorted by key to ensure identical output regardless of insertion order.
|
|
15
|
+
*/
|
|
16
|
+
export declare function computeFrameId(collection: string, collectionId?: string | number, vars?: Record<string, string>): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* generateFrameId — unique human-readable frame instance ID.
|
|
3
|
+
* Format: "{prefix}_{8-char hex}" e.g. "vehicle_a1b2c3d4"
|
|
4
|
+
*/
|
|
5
|
+
export function generateFrameId(prefix) {
|
|
6
|
+
const hex = crypto.randomUUID?.().replace(/-/g, '').slice(0, 8)
|
|
7
|
+
?? Math.floor(Math.random() * 0xffffffff).toString(16).padStart(8, '0');
|
|
8
|
+
return `${prefix}_${hex}`;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* computeFrameId — deterministic frame ID from (collection, collectionId?, vars?).
|
|
12
|
+
*
|
|
13
|
+
* Examples:
|
|
14
|
+
* computeFrameId('vehicle') → "vehicle"
|
|
15
|
+
* computeFrameId('vehicle', '42') → "vehicle:42"
|
|
16
|
+
* computeFrameId('vehicle', '42', {tab}) → "vehicle:42:tab=info"
|
|
17
|
+
*
|
|
18
|
+
* Vars are sorted by key to ensure identical output regardless of insertion order.
|
|
19
|
+
*/
|
|
20
|
+
export function computeFrameId(collection, collectionId, vars) {
|
|
21
|
+
const base = collectionId ? `${collection}:${collectionId}` : collection;
|
|
22
|
+
if (!vars || Object.keys(vars).length === 0)
|
|
23
|
+
return base;
|
|
24
|
+
const varStr = Object.keys(vars).sort().map(k => `${k}=${vars[k]}`).join('&');
|
|
25
|
+
return `${base}:${varStr}`;
|
|
26
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type LinkAction = 'loadFrame' | 'loadIn' | 'loadInDialog';
|
|
2
|
+
/** Typed link string — format: `"action:module"` or `"action:module@zone"`. */
|
|
3
|
+
export type LinkString = `${LinkAction}:${string}` | `${LinkAction}:${string}@${string}`;
|
|
4
|
+
export interface ParsedLink {
|
|
5
|
+
action: LinkAction;
|
|
6
|
+
module: string;
|
|
7
|
+
zone: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function parseLink(link: string): ParsedLink | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function parseLink(link) {
|
|
2
|
+
const atIdx = link.indexOf('@');
|
|
3
|
+
const zone = atIdx !== -1 ? link.slice(atIdx + 1) : 'main';
|
|
4
|
+
const base = atIdx !== -1 ? link.slice(0, atIdx) : link;
|
|
5
|
+
const colonIdx = base.indexOf(':');
|
|
6
|
+
if (colonIdx === -1)
|
|
7
|
+
return null;
|
|
8
|
+
const action = base.slice(0, colonIdx);
|
|
9
|
+
if (action !== 'loadFrame' && action !== 'loadIn' && action !== 'loadInDialog')
|
|
10
|
+
return null;
|
|
11
|
+
const module = base.slice(colonIdx + 1);
|
|
12
|
+
if (!module)
|
|
13
|
+
return null;
|
|
14
|
+
return { action, module, zone };
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { Machine } from './machine.js';
|
|
2
|
+
export { machine } from './machine.js';
|
|
3
|
+
export type { MachineBootPhase, MachineBootStatus, MachineBootTraceEntry, MachineComponentRegistry, MachineStoreDiagnostic } from './machine.js';
|
|
4
|
+
export { MachineDb } from './machineDb.js';
|
|
5
|
+
export { MachineParserForge } from './machineParserForge.js';
|
|
6
|
+
export { diagnoseMachineModel } from './machineSchemaDoctor.js';
|
|
7
|
+
export type { SchemaDiagnostic, SchemaDiagnosticReport, SchemaDiagnosticSeverity } from './machineSchemaDoctor.js';
|
|
8
|
+
export { field } from './machine/fieldBuilder.js';
|
|
9
|
+
export { machineRights } from './machine/MachineRights.js';
|
|
10
|
+
export { MachineRecordIdentity } from './machine/MachineRecordIdentity.js';
|
|
11
|
+
export * from '../types/index.js';
|
|
12
|
+
export type { AppScheme, ViewFieldDef, ViewFields } from './api/types.js';
|
|
13
|
+
export { seed } from './machineSeed.js';
|
|
14
|
+
export { MachineRouter } from './machine/MachineRouter.js';
|
|
15
|
+
export type { MachineRouterConfig } from './machine/MachineRouter.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Main barrel export for idae-machine v2
|
|
2
|
+
// Core
|
|
3
|
+
export { Machine } from './machine.js';
|
|
4
|
+
export { machine } from './machine.js';
|
|
5
|
+
export { MachineDb } from './machineDb.js';
|
|
6
|
+
export { MachineParserForge } from './machineParserForge.js';
|
|
7
|
+
export { diagnoseMachineModel } from './machineSchemaDoctor.js';
|
|
8
|
+
// Schema builder helpers
|
|
9
|
+
export { field } from './machine/fieldBuilder.js';
|
|
10
|
+
// Rights / RBAC
|
|
11
|
+
export { machineRights } from './machine/MachineRights.js';
|
|
12
|
+
// Record identity normalization
|
|
13
|
+
export { MachineRecordIdentity } from './machine/MachineRecordIdentity.js';
|
|
14
|
+
// Types
|
|
15
|
+
export * from '../types/index.js';
|
|
16
|
+
// Seed
|
|
17
|
+
export { seed } from './machineSeed.js';
|
|
18
|
+
// Router (v2 features)
|
|
19
|
+
export { MachineRouter } from './machine/MachineRouter.js';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MachineAction — generic write dispatcher.
|
|
3
|
+
*
|
|
4
|
+
* Single entry point for any user-scoped write on any collection. Replaces
|
|
5
|
+
* the per-collection wrappers (prefs/history/activity) with one imperative
|
|
6
|
+
* action call: caller passes the target collection, the variables, and
|
|
7
|
+
* optional behavior hints (upsertOn / bump / touch / code template).
|
|
8
|
+
*
|
|
9
|
+
* Auto-injected on every call:
|
|
10
|
+
* - `id` : crypto.randomUUID() when not provided (with non-crypto fallback)
|
|
11
|
+
* - `userId` : host.rights.currentUser.id (no-op if no current user)
|
|
12
|
+
*
|
|
13
|
+
* The dispatcher is the only abstraction. It does not know — and must not
|
|
14
|
+
* know — what `appuser_prefs` / `appuser_history` / `appuser_activity` mean.
|
|
15
|
+
*
|
|
16
|
+
* Dependency is injected (no import of the `machine` singleton) to keep the
|
|
17
|
+
* module free of circular references with `machine.ts`.
|
|
18
|
+
*/
|
|
19
|
+
export interface ActionOptions {
|
|
20
|
+
/** Field names that form a natural key. When all match an existing doc, update instead of insert. */
|
|
21
|
+
upsertOn?: string[];
|
|
22
|
+
/** Numeric field to increment by 1 on upsert hit (e.g. `count`). */
|
|
23
|
+
bump?: string;
|
|
24
|
+
/** Field set to `new Date().toISOString()` on every write (e.g. `lastSeen`, `timestamp`). */
|
|
25
|
+
touch?: string;
|
|
26
|
+
/** Template applied to compute `code`. Tokens: `{userId}` + any field name in `vars`.
|
|
27
|
+
* Result is written to `vars.code` (and used as the natural key when `upsertOn` is undefined). */
|
|
28
|
+
code?: string;
|
|
29
|
+
/** Override the userId injected. Defaults to host.rights.currentUser.id. */
|
|
30
|
+
userId?: string;
|
|
31
|
+
}
|
|
32
|
+
type AnyDoc = Record<string, unknown>;
|
|
33
|
+
export interface ActionCollection {
|
|
34
|
+
getAll: () => AnyDoc[] | Promise<AnyDoc[]>;
|
|
35
|
+
where: (q: Record<string, unknown>) => AnyDoc[] | Promise<AnyDoc[]>;
|
|
36
|
+
create: (doc: AnyDoc) => Promise<unknown>;
|
|
37
|
+
update: (id: string, data: AnyDoc) => Promise<unknown>;
|
|
38
|
+
}
|
|
39
|
+
export interface ActionHost {
|
|
40
|
+
currentUserId(): string | null;
|
|
41
|
+
collection(name: string): ActionCollection | null;
|
|
42
|
+
}
|
|
43
|
+
export declare class MachineAction {
|
|
44
|
+
#private;
|
|
45
|
+
/** Inject the host providing `currentUserId()` and `collection(name)`. Called once at machine boot. */
|
|
46
|
+
setHost(host: ActionHost): void;
|
|
47
|
+
/**
|
|
48
|
+
* Write `vars` to `collection`, applying optional upsert / bump / touch / code rules.
|
|
49
|
+
* Returns the persisted document (or null when no user is authenticated, no host wired, or the collection is missing).
|
|
50
|
+
*/
|
|
51
|
+
act(collection: string, vars: AnyDoc, opts?: ActionOptions): Promise<AnyDoc | null>;
|
|
52
|
+
}
|
|
53
|
+
export declare const machineAction: MachineAction;
|
|
54
|
+
/**
|
|
55
|
+
* Callable form — `machine.action(collection, vars, opts?)`.
|
|
56
|
+
* Carries the underlying instance on `.instance` for callers that want it explicitly.
|
|
57
|
+
*/
|
|
58
|
+
export type MachineActionCallable = ((collection: string, vars: AnyDoc, opts?: ActionOptions) => Promise<AnyDoc | null>) & {
|
|
59
|
+
readonly instance: MachineAction;
|
|
60
|
+
};
|
|
61
|
+
export declare const machineActionCallable: MachineActionCallable;
|
|
62
|
+
export {};
|