@ibgib/web-gib 0.0.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/.ibgibignore +30 -0
- package/.vscode/ibgib-snippets.code-snippets +309 -0
- package/.vscode/launch.json +25 -0
- package/.vscode/settings.json +68 -0
- package/.vscode/tasks.json +38 -0
- package/CHANGELOG.md +427 -0
- package/README.md +66 -0
- package/dist/agent-texts/common-agent-texts.d.mts +14 -0
- package/dist/agent-texts/common-agent-texts.d.mts.map +1 -0
- package/dist/agent-texts/common-agent-texts.mjs +51 -0
- package/dist/agent-texts/common-agent-texts.mjs.map +1 -0
- package/dist/agent-texts/primary-agent-texts.d.mts +16 -0
- package/dist/agent-texts/primary-agent-texts.d.mts.map +1 -0
- package/dist/agent-texts/primary-agent-texts.mjs +27 -0
- package/dist/agent-texts/primary-agent-texts.mjs.map +1 -0
- package/dist/agent-texts/project-agent-texts.d.mts +8 -0
- package/dist/agent-texts/project-agent-texts.d.mts.map +1 -0
- package/dist/agent-texts/project-agent-texts.mjs +29 -0
- package/dist/agent-texts/project-agent-texts.mjs.map +1 -0
- package/dist/agent-texts/project-child-text-agent-texts.d.mts +5 -0
- package/dist/agent-texts/project-child-text-agent-texts.d.mts.map +1 -0
- package/dist/agent-texts/project-child-text-agent-texts.mjs +26 -0
- package/dist/agent-texts/project-child-text-agent-texts.mjs.map +1 -0
- package/dist/agent-texts/projects-agent-texts.d.mts +4 -0
- package/dist/agent-texts/projects-agent-texts.d.mts.map +1 -0
- package/dist/agent-texts/projects-agent-texts.mjs +15 -0
- package/dist/agent-texts/projects-agent-texts.mjs.map +1 -0
- package/dist/agent-texts/raw-agent-texts.d.mts +4 -0
- package/dist/agent-texts/raw-agent-texts.d.mts.map +1 -0
- package/dist/agent-texts/raw-agent-texts.mjs +17 -0
- package/dist/agent-texts/raw-agent-texts.mjs.map +1 -0
- package/dist/agent-texts/text-editor-agent-texts.d.mts +6 -0
- package/dist/agent-texts/text-editor-agent-texts.d.mts.map +1 -0
- package/dist/agent-texts/text-editor-agent-texts.mjs +19 -0
- package/dist/agent-texts/text-editor-agent-texts.mjs.map +1 -0
- package/dist/api/api-constants.d.mts +9 -0
- package/dist/api/api-constants.d.mts.map +1 -0
- package/dist/api/api-constants.mjs +9 -0
- package/dist/api/api-constants.mjs.map +1 -0
- package/dist/api/api-index.d.mts +10 -0
- package/dist/api/api-index.d.mts.map +1 -0
- package/dist/api/api-index.mjs +121 -0
- package/dist/api/api-index.mjs.map +1 -0
- package/dist/api/api-types.d.mts +36 -0
- package/dist/api/api-types.d.mts.map +1 -0
- package/dist/api/api-types.mjs +2 -0
- package/dist/api/api-types.mjs.map +1 -0
- package/dist/api/commands/chat/chat-index.d.mts +3 -0
- package/dist/api/commands/chat/chat-index.d.mts.map +1 -0
- package/dist/api/commands/chat/chat-index.mjs +9 -0
- package/dist/api/commands/chat/chat-index.mjs.map +1 -0
- package/dist/api/commands/chat/get-context-info.d.mts +71 -0
- package/dist/api/commands/chat/get-context-info.d.mts.map +1 -0
- package/dist/api/commands/chat/get-context-info.mjs +130 -0
- package/dist/api/commands/chat/get-context-info.mjs.map +1 -0
- package/dist/api/commands/chat/hello-world.d.mts +63 -0
- package/dist/api/commands/chat/hello-world.d.mts.map +1 -0
- package/dist/api/commands/chat/hello-world.mjs +132 -0
- package/dist/api/commands/chat/hello-world.mjs.map +1 -0
- package/dist/api/commands/chat/tell-user.d.mts +57 -0
- package/dist/api/commands/chat/tell-user.d.mts.map +1 -0
- package/dist/api/commands/chat/tell-user.mjs +199 -0
- package/dist/api/commands/chat/tell-user.mjs.map +1 -0
- package/dist/api/commands/command-constants.d.mts +22 -0
- package/dist/api/commands/command-constants.d.mts.map +1 -0
- package/dist/api/commands/command-constants.mjs +17 -0
- package/dist/api/commands/command-constants.mjs.map +1 -0
- package/dist/api/commands/command-helpers.d.mts +47 -0
- package/dist/api/commands/command-helpers.d.mts.map +1 -0
- package/dist/api/commands/command-helpers.mjs +76 -0
- package/dist/api/commands/command-helpers.mjs.map +1 -0
- package/dist/api/commands/command-service-v1.d.mts +28 -0
- package/dist/api/commands/command-service-v1.d.mts.map +1 -0
- package/dist/api/commands/command-service-v1.mjs +122 -0
- package/dist/api/commands/command-service-v1.mjs.map +1 -0
- package/dist/api/commands/command-service.respec.d.mts +7 -0
- package/dist/api/commands/command-service.respec.d.mts.map +1 -0
- package/dist/api/commands/command-service.respec.mjs +66 -0
- package/dist/api/commands/command-service.respec.mjs.map +1 -0
- package/dist/api/commands/command-types.d.mts +48 -0
- package/dist/api/commands/command-types.d.mts.map +1 -0
- package/dist/api/commands/command-types.mjs +12 -0
- package/dist/api/commands/command-types.mjs.map +1 -0
- package/dist/api/commands/ibgib/get-ibgibs.d.mts +94 -0
- package/dist/api/commands/ibgib/get-ibgibs.d.mts.map +1 -0
- package/dist/api/commands/ibgib/get-ibgibs.mjs +219 -0
- package/dist/api/commands/ibgib/get-ibgibs.mjs.map +1 -0
- package/dist/api/commands/ibgib/ibgib-index.d.mts +3 -0
- package/dist/api/commands/ibgib/ibgib-index.d.mts.map +1 -0
- package/dist/api/commands/ibgib/ibgib-index.mjs +7 -0
- package/dist/api/commands/ibgib/ibgib-index.mjs.map +1 -0
- package/dist/api/commands/ibgib/mut8-ibgib.d.mts +135 -0
- package/dist/api/commands/ibgib/mut8-ibgib.d.mts.map +1 -0
- package/dist/api/commands/ibgib/mut8-ibgib.mjs +318 -0
- package/dist/api/commands/ibgib/mut8-ibgib.mjs.map +1 -0
- package/dist/api/commands/templates/api-function-info.template.d.mts +73 -0
- package/dist/api/commands/templates/api-function-info.template.d.mts.map +1 -0
- package/dist/api/commands/templates/api-function-info.template.mjs +161 -0
- package/dist/api/commands/templates/api-function-info.template.mjs.map +1 -0
- package/dist/api/commands/text/text-edit.d.mts +54 -0
- package/dist/api/commands/text/text-edit.d.mts.map +1 -0
- package/dist/api/commands/text/text-edit.mjs +170 -0
- package/dist/api/commands/text/text-edit.mjs.map +1 -0
- package/dist/api/commands/text/text-index.d.mts +3 -0
- package/dist/api/commands/text/text-index.d.mts.map +1 -0
- package/dist/api/commands/text/text-index.mjs +5 -0
- package/dist/api/commands/text/text-index.mjs.map +1 -0
- package/dist/api/commands/ui/ui-index.d.mts +3 -0
- package/dist/api/commands/ui/ui-index.d.mts.map +1 -0
- package/dist/api/commands/ui/ui-index.mjs +5 -0
- package/dist/api/commands/ui/ui-index.mjs.map +1 -0
- package/dist/api/commands/ui/update-css-variables.d.mts +48 -0
- package/dist/api/commands/ui/update-css-variables.d.mts.map +1 -0
- package/dist/api/commands/ui/update-css-variables.mjs +145 -0
- package/dist/api/commands/ui/update-css-variables.mjs.map +1 -0
- package/dist/api/function-infos.web.d.mts +15 -0
- package/dist/api/function-infos.web.d.mts.map +1 -0
- package/dist/api/function-infos.web.mjs +63 -0
- package/dist/api/function-infos.web.mjs.map +1 -0
- package/dist/assumptions.respec.d.mts +2 -0
- package/dist/assumptions.respec.d.mts.map +1 -0
- package/dist/assumptions.respec.mjs +41 -0
- package/dist/assumptions.respec.mjs.map +1 -0
- package/dist/common/project/project-constants.d.mts +38 -0
- package/dist/common/project/project-constants.d.mts.map +1 -0
- package/dist/common/project/project-constants.mjs +71 -0
- package/dist/common/project/project-constants.mjs.map +1 -0
- package/dist/common/project/project-helper.d.mts +127 -0
- package/dist/common/project/project-helper.d.mts.map +1 -0
- package/dist/common/project/project-helper.mjs +683 -0
- package/dist/common/project/project-helper.mjs.map +1 -0
- package/dist/common/project/project-types.d.mts +91 -0
- package/dist/common/project/project-types.d.mts.map +1 -0
- package/dist/common/project/project-types.mjs +31 -0
- package/dist/common/project/project-types.mjs.map +1 -0
- package/dist/common/prompt-functions.web.d.mts +90 -0
- package/dist/common/prompt-functions.web.d.mts.map +1 -0
- package/dist/common/prompt-functions.web.mjs +426 -0
- package/dist/common/prompt-functions.web.mjs.map +1 -0
- package/dist/common/settings/settings-constants.d.mts +33 -0
- package/dist/common/settings/settings-constants.d.mts.map +1 -0
- package/dist/common/settings/settings-constants.mjs +54 -0
- package/dist/common/settings/settings-constants.mjs.map +1 -0
- package/dist/common/settings/settings-helpers.d.mts +59 -0
- package/dist/common/settings/settings-helpers.d.mts.map +1 -0
- package/dist/common/settings/settings-helpers.mjs +253 -0
- package/dist/common/settings/settings-helpers.mjs.map +1 -0
- package/dist/common/settings/settings-types.d.mts +118 -0
- package/dist/common/settings/settings-types.d.mts.map +1 -0
- package/dist/common/settings/settings-types.mjs +13 -0
- package/dist/common/settings/settings-types.mjs.map +1 -0
- package/dist/constants.d.mts +34 -0
- package/dist/constants.d.mts.map +1 -0
- package/dist/constants.mjs +35 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/foo.d.mts +2 -0
- package/dist/foo.d.mts.map +1 -0
- package/dist/foo.mjs +19 -0
- package/dist/foo.mjs.map +1 -0
- package/dist/helpers.d.mts +137 -0
- package/dist/helpers.d.mts.map +1 -0
- package/dist/helpers.mjs +514 -0
- package/dist/helpers.mjs.map +1 -0
- package/dist/helpers.web.d.mts +324 -0
- package/dist/helpers.web.d.mts.map +1 -0
- package/dist/helpers.web.mjs +1133 -0
- package/dist/helpers.web.mjs.map +1 -0
- package/dist/helpers.web.respec.d.mts +2 -0
- package/dist/helpers.web.respec.d.mts.map +1 -0
- package/dist/helpers.web.respec.mjs +12 -0
- package/dist/helpers.web.respec.mjs.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/dist/respec-gib.node.d.mts +2 -0
- package/dist/respec-gib.node.d.mts.map +1 -0
- package/dist/respec-gib.node.mjs +211 -0
- package/dist/respec-gib.node.mjs.map +1 -0
- package/dist/spec-helper.node.respec.d.mts +13 -0
- package/dist/spec-helper.node.respec.d.mts.map +1 -0
- package/dist/spec-helper.node.respec.mjs +50 -0
- package/dist/spec-helper.node.respec.mjs.map +1 -0
- package/dist/storage/storage-helpers.web.d.mts +108 -0
- package/dist/storage/storage-helpers.web.d.mts.map +1 -0
- package/dist/storage/storage-helpers.web.mjs +757 -0
- package/dist/storage/storage-helpers.web.mjs.map +1 -0
- package/dist/storage/storage-types.web.d.mts +30 -0
- package/dist/storage/storage-types.web.d.mts.map +1 -0
- package/dist/storage/storage-types.web.mjs +2 -0
- package/dist/storage/storage-types.web.mjs.map +1 -0
- package/dist/types.web.d.mts +42 -0
- package/dist/types.web.d.mts.map +1 -0
- package/dist/types.web.mjs +2 -0
- package/dist/types.web.mjs.map +1 -0
- package/dist/ui/component/component-types.d.mts +225 -0
- package/dist/ui/component/component-types.d.mts.map +1 -0
- package/dist/ui/component/component-types.mjs +2 -0
- package/dist/ui/component/component-types.mjs.map +1 -0
- package/dist/ui/component/ibgib-component-service.d.mts +70 -0
- package/dist/ui/component/ibgib-component-service.d.mts.map +1 -0
- package/dist/ui/component/ibgib-component-service.mjs +201 -0
- package/dist/ui/component/ibgib-component-service.mjs.map +1 -0
- package/dist/ui/component/ibgib-dynamic-component-bases.d.mts +338 -0
- package/dist/ui/component/ibgib-dynamic-component-bases.d.mts.map +1 -0
- package/dist/ui/component/ibgib-dynamic-component-bases.mjs +1304 -0
- package/dist/ui/component/ibgib-dynamic-component-bases.mjs.map +1 -0
- package/dist/ui/ui-constants.d.mts +12 -0
- package/dist/ui/ui-constants.d.mts.map +1 -0
- package/dist/ui/ui-constants.mjs +93 -0
- package/dist/ui/ui-constants.mjs.map +1 -0
- package/dist/ui/ui-helpers.d.mts +42 -0
- package/dist/ui/ui-helpers.d.mts.map +1 -0
- package/dist/ui/ui-helpers.mjs +198 -0
- package/dist/ui/ui-helpers.mjs.map +1 -0
- package/dist/ui/ui-types.d.mts +13 -0
- package/dist/ui/ui-types.d.mts.map +1 -0
- package/dist/ui/ui-types.mjs +2 -0
- package/dist/ui/ui-types.mjs.map +1 -0
- package/dist/witness/agent/agent-constants.d.mts +97 -0
- package/dist/witness/agent/agent-constants.d.mts.map +1 -0
- package/dist/witness/agent/agent-constants.mjs +98 -0
- package/dist/witness/agent/agent-constants.mjs.map +1 -0
- package/dist/witness/agent/agent-helpers.d.mts +106 -0
- package/dist/witness/agent/agent-helpers.d.mts.map +1 -0
- package/dist/witness/agent/agent-helpers.mjs +601 -0
- package/dist/witness/agent/agent-helpers.mjs.map +1 -0
- package/dist/witness/agent/agent-one-file.app.d.mts +2 -0
- package/dist/witness/agent/agent-one-file.app.d.mts.map +1 -0
- package/dist/witness/agent/agent-one-file.app.mjs +8 -0
- package/dist/witness/agent/agent-one-file.app.mjs.map +1 -0
- package/dist/witness/agent/agent-one-file.d.mts +478 -0
- package/dist/witness/agent/agent-one-file.d.mts.map +1 -0
- package/dist/witness/agent/agent-one-file.mjs +1462 -0
- package/dist/witness/agent/agent-one-file.mjs.map +1 -0
- package/dist/witness/agent/agent-types.d.mts +83 -0
- package/dist/witness/agent/agent-types.d.mts.map +1 -0
- package/dist/witness/agent/agent-types.mjs +2 -0
- package/dist/witness/agent/agent-types.mjs.map +1 -0
- package/dist/witness/agent/agents-service-v1.d.mts +99 -0
- package/dist/witness/agent/agents-service-v1.d.mts.map +1 -0
- package/dist/witness/agent/agents-service-v1.mjs +453 -0
- package/dist/witness/agent/agents-service-v1.mjs.map +1 -0
- package/dist/witness/agent/function-info/function-info-one-file.d.mts +192 -0
- package/dist/witness/agent/function-info/function-info-one-file.d.mts.map +1 -0
- package/dist/witness/agent/function-info/function-info-one-file.mjs +192 -0
- package/dist/witness/agent/function-info/function-info-one-file.mjs.map +1 -0
- package/dist/witness/agent/gemini/agent-witness-gemini-v1.d.mts +51 -0
- package/dist/witness/agent/gemini/agent-witness-gemini-v1.d.mts.map +1 -0
- package/dist/witness/agent/gemini/agent-witness-gemini-v1.mjs +928 -0
- package/dist/witness/agent/gemini/agent-witness-gemini-v1.mjs.map +1 -0
- package/dist/witness/agent/gemini/gemini-agent-factory.d.mts +27 -0
- package/dist/witness/agent/gemini/gemini-agent-factory.d.mts.map +1 -0
- package/dist/witness/agent/gemini/gemini-agent-factory.mjs +144 -0
- package/dist/witness/agent/gemini/gemini-agent-factory.mjs.map +1 -0
- package/dist/witness/agent/gemini/gemini-constants.d.mts +36 -0
- package/dist/witness/agent/gemini/gemini-constants.d.mts.map +1 -0
- package/dist/witness/agent/gemini/gemini-constants.mjs +47 -0
- package/dist/witness/agent/gemini/gemini-constants.mjs.map +1 -0
- package/dist/witness/agent/gemini/gemini-helpers.d.mts +58 -0
- package/dist/witness/agent/gemini/gemini-helpers.d.mts.map +1 -0
- package/dist/witness/agent/gemini/gemini-helpers.mjs +210 -0
- package/dist/witness/agent/gemini/gemini-helpers.mjs.map +1 -0
- package/dist/witness/agent/gemini/gemini-types.d.mts +82 -0
- package/dist/witness/agent/gemini/gemini-types.d.mts.map +1 -0
- package/dist/witness/agent/gemini/gemini-types.mjs +3 -0
- package/dist/witness/agent/gemini/gemini-types.mjs.map +1 -0
- package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.d.mts +136 -0
- package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.d.mts.map +1 -0
- package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mjs +334 -0
- package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mjs.map +1 -0
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace-helper.d.mts +35 -0
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace-helper.d.mts.map +1 -0
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace-helper.mjs +267 -0
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace-helper.mjs.map +1 -0
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.d.mts +134 -0
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.d.mts.map +1 -0
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.mjs +389 -0
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.mjs.map +1 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-constants.d.mts +2 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-constants.d.mts.map +1 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-constants.mjs +2 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-constants.mjs.map +1 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-helper.d.mts +104 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-helper.d.mts.map +1 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-helper.mjs +457 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-helper.mjs.map +1 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-types.d.mts +93 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-types.d.mts.map +1 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-types.mjs +98 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-types.mjs.map +1 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-v1.d.mts +73 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-v1.d.mts.map +1 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-v1.mjs +650 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-v1.mjs.map +1 -0
- package/generate-version-file.js +29 -0
- package/package.json +60 -0
- package/src/agent-texts/common-agent-texts.mts +61 -0
- package/src/agent-texts/primary-agent-texts.mts +32 -0
- package/src/agent-texts/project-agent-texts.mts +29 -0
- package/src/agent-texts/project-child-text-agent-texts.mts +30 -0
- package/src/agent-texts/projects-agent-texts.mts +17 -0
- package/src/agent-texts/raw-agent-texts.mts +18 -0
- package/src/agent-texts/text-editor-agent-texts.mts +20 -0
- package/src/api/api-constants.mts +8 -0
- package/src/api/api-index.mts +110 -0
- package/src/api/api-types.mts +36 -0
- package/src/api/commands/chat/chat-index.mts +10 -0
- package/src/api/commands/chat/get-context-info.mts +196 -0
- package/src/api/commands/chat/hello-world.mts +183 -0
- package/src/api/commands/chat/tell-user.mts +241 -0
- package/src/api/commands/command-constants.mts +17 -0
- package/src/api/commands/command-helpers.mts +105 -0
- package/src/api/commands/command-service-v1.mts +136 -0
- package/src/api/commands/command-service.respec.mts +72 -0
- package/src/api/commands/command-types.mts +71 -0
- package/src/api/commands/ibgib/get-ibgibs.mts +269 -0
- package/src/api/commands/ibgib/ibgib-index.mts +8 -0
- package/src/api/commands/ibgib/mut8-ibgib.mts +418 -0
- package/src/api/commands/templates/api-function-info.template.mts +212 -0
- package/src/api/commands/text/text-edit.mts +217 -0
- package/src/api/commands/text/text-index.mts +6 -0
- package/src/api/commands/ui/ui-index.mts +6 -0
- package/src/api/commands/ui/update-css-variables.mts +187 -0
- package/src/api/function-infos.web.mts +66 -0
- package/src/assets/fullscreen-dialog.html +18 -0
- package/src/assumptions.respec.mts +51 -0
- package/src/common/project/project-constants.mts +83 -0
- package/src/common/project/project-helper.mts +730 -0
- package/src/common/project/project-types.mts +121 -0
- package/src/common/prompt-functions.web.mts +447 -0
- package/src/common/settings/settings-constants.mts +72 -0
- package/src/common/settings/settings-helpers.mts +280 -0
- package/src/common/settings/settings-types.mts +137 -0
- package/src/constants.mts +39 -0
- package/src/foo.mts +13 -0
- package/src/helpers.mts +574 -0
- package/src/helpers.web.mts +1277 -0
- package/src/helpers.web.respec.mts +16 -0
- package/src/index.mts +3 -0
- package/src/respec-gib.node.mts +199 -0
- package/src/spec-helper.node.respec.mts +50 -0
- package/src/storage/storage-helpers.web.mts +728 -0
- package/src/storage/storage-types.web.mts +29 -0
- package/src/types.web.mts +42 -0
- package/src/ui/component/component-types.mts +241 -0
- package/src/ui/component/ibgib-component-service.mts +201 -0
- package/src/ui/component/ibgib-dynamic-component-bases.mts +1369 -0
- package/src/ui/ui-constants.mts +101 -0
- package/src/ui/ui-helpers.mts +222 -0
- package/src/ui/ui-types.mts +11 -0
- package/src/witness/agent/agent-constants.mts +122 -0
- package/src/witness/agent/agent-helpers.mts +681 -0
- package/src/witness/agent/agent-one-file.app.mts +8 -0
- package/src/witness/agent/agent-one-file.mts +1665 -0
- package/src/witness/agent/agent-types.mts +92 -0
- package/src/witness/agent/agents-service-v1.mts +482 -0
- package/src/witness/agent/function-info/function-info-one-file.mts +362 -0
- package/src/witness/agent/gemini/agent-witness-gemini-v1.mts +910 -0
- package/src/witness/agent/gemini/gemini-agent-factory.mts +135 -0
- package/src/witness/agent/gemini/gemini-constants.mts +79 -0
- package/src/witness/agent/gemini/gemini-helpers.mts +216 -0
- package/src/witness/agent/gemini/gemini-types.mts +88 -0
- package/src/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mts +321 -0
- package/src/witness/space/metaspace/metaspace-webspace/metaspace-webspace-helper.mts +290 -0
- package/src/witness/space/metaspace/metaspace-webspace/metaspace-webspace.mts +407 -0
- package/src/witness/space/web-filesystem-space/web-filesystem-space-constants.mts +1 -0
- package/src/witness/space/web-filesystem-space/web-filesystem-space-helper.mts +491 -0
- package/src/witness/space/web-filesystem-space/web-filesystem-space-types.mts +172 -0
- package/src/witness/space/web-filesystem-space/web-filesystem-space-v1.mts +670 -0
- package/tsconfig.json +17 -0
- package/tsconfig.test.json +10 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* used to mimic the fs.Dirent interface.
|
|
3
|
+
* @see https://nodejs.org/api/fs.html#fs_class_fs_dirent
|
|
4
|
+
*/
|
|
5
|
+
export interface Dirent {
|
|
6
|
+
name: string;
|
|
7
|
+
isDirectory(): boolean;
|
|
8
|
+
isFile(): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Always false for IndexedDB
|
|
11
|
+
*/
|
|
12
|
+
isBlockDevice(): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Always false for IndexedDB
|
|
15
|
+
*/
|
|
16
|
+
isCharacterDevice(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Always false for IndexedDB
|
|
19
|
+
*/
|
|
20
|
+
isSymbolicLink(): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Always false for IndexedDB
|
|
23
|
+
*/
|
|
24
|
+
isFIFO(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Always false for IndexedDB
|
|
27
|
+
*/
|
|
28
|
+
isSocket(): boolean;
|
|
29
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Gib } from "@ibgib/ts-gib/dist/types.mjs";
|
|
2
|
+
import { GibInfo } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* deterministically driven colors based on a given {@link gib}
|
|
6
|
+
*/
|
|
7
|
+
export interface GibColorInfo {
|
|
8
|
+
/**
|
|
9
|
+
* Gib that was used to drive the color calculation
|
|
10
|
+
*/
|
|
11
|
+
gib: Gib;
|
|
12
|
+
gibInfo: GibInfo;
|
|
13
|
+
/**
|
|
14
|
+
* Color that corresponds to the punctiliar part of {@link gib}
|
|
15
|
+
*/
|
|
16
|
+
punctiliarColor: string;
|
|
17
|
+
/**
|
|
18
|
+
* Translucent version of {@link punctiliarColor}
|
|
19
|
+
*/
|
|
20
|
+
punctiliarColorTranslucent: string;
|
|
21
|
+
/**
|
|
22
|
+
* contrasting color against punctiliar color
|
|
23
|
+
*/
|
|
24
|
+
punctiliarColorContrast: string;
|
|
25
|
+
/**
|
|
26
|
+
* Color that corresponds to the tjp (timeline) part of {@link gib}
|
|
27
|
+
*/
|
|
28
|
+
tjpColor?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Translucent version of {@link tjpColor}
|
|
31
|
+
*/
|
|
32
|
+
tjpColorTranslucent?: string;
|
|
33
|
+
/**
|
|
34
|
+
* contrasting color against tjp color
|
|
35
|
+
*/
|
|
36
|
+
tjpColorContrast?: string;
|
|
37
|
+
/**
|
|
38
|
+
* If there was an error deriving the color info, this will show the error
|
|
39
|
+
* message.
|
|
40
|
+
*/
|
|
41
|
+
errorMsg?: string;
|
|
42
|
+
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { ROOT_ADDR } from "@ibgib/ts-gib/dist/V1/constants.mjs";
|
|
2
|
+
import { Gib, Ib, IbGibAddr } from "@ibgib/ts-gib/dist/types.mjs";
|
|
3
|
+
import { IbGib_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
4
|
+
import { MetaspaceService } from "@ibgib/core-gib/dist/witness/space/metaspace/metaspace-types.mjs";
|
|
5
|
+
|
|
6
|
+
import { AgentWitnessAny } from "../../witness/agent/agent-one-file.mjs";
|
|
7
|
+
import { LiveProxyIbGib } from "../../witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mjs";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @see {@link IbGibDynamicComponentMeta.fnHandleRoute}
|
|
11
|
+
*/
|
|
12
|
+
export type FnHandleRouteType =
|
|
13
|
+
(arg: { path: string; ibGibAddr?: IbGibAddr | undefined; }) => Promise<boolean>;
|
|
14
|
+
|
|
15
|
+
export interface IbGibDynamicComponentMetaCtorOpts {
|
|
16
|
+
/**
|
|
17
|
+
* @see {@link IbGibDynamicComponentMeta.fnGetMetaspace}
|
|
18
|
+
*/
|
|
19
|
+
fnGetMetaspace: () => Promise<MetaspaceService>;
|
|
20
|
+
/**
|
|
21
|
+
* @see {@link IbGibDynamicComponentMeta.bootstrapPromise}
|
|
22
|
+
*/
|
|
23
|
+
bootstrapPromise: Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* This meta object is what registers with the component service. It decides
|
|
28
|
+
* if a component matches a given route, and if so, this contains the factory
|
|
29
|
+
* function to create the ibgib component instance (which will be the actual web
|
|
30
|
+
* component).
|
|
31
|
+
*
|
|
32
|
+
* So this is like a factory class, but contains more so it's lumped in as
|
|
33
|
+
* "meta".
|
|
34
|
+
*
|
|
35
|
+
* @see {@link IbGibDynamicComponentInstance}
|
|
36
|
+
*/
|
|
37
|
+
export interface IbGibDynamicComponentMeta {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* will be used for web component tag, e.g. <my-custom-component>
|
|
41
|
+
*/
|
|
42
|
+
componentName: string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Optional regular expression meant to provide a quick, first pass when
|
|
46
|
+
* determining what component to inject given a certain route.
|
|
47
|
+
*
|
|
48
|
+
* NOTE: This is not the final decider of if the component handles the
|
|
49
|
+
* route. For that, @see {@link fnHandleRoute}
|
|
50
|
+
*/
|
|
51
|
+
routeRegExp?: RegExp;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Optional function that determines if this component should handle a given route.
|
|
55
|
+
*
|
|
56
|
+
* If provided **AND IF THE {@link routeRegExp} matches the route path**,
|
|
57
|
+
* the router will call this function with the route path and the parsed
|
|
58
|
+
* ibgib address.
|
|
59
|
+
*
|
|
60
|
+
* If the component should handle the route, this function will return true,
|
|
61
|
+
* else false.
|
|
62
|
+
*
|
|
63
|
+
* @param {object} arg - Arguments object.
|
|
64
|
+
* @param {string} arg.path - The route path (from window.location.hash or pathname).
|
|
65
|
+
* @param {IbGibAddr} [arg.ibGibAddr] - The parsed ibGib address from the route path, if applicable.
|
|
66
|
+
* @returns {Promise<boolean>} - Promise that resolves to `true` if this component should handle the route, `false` otherwise.
|
|
67
|
+
*
|
|
68
|
+
* ## implementation notes
|
|
69
|
+
*
|
|
70
|
+
* Since this is an optional property, I define this as a lambda not as a
|
|
71
|
+
* function proper on the class.
|
|
72
|
+
*/
|
|
73
|
+
fnHandleRoute?: FnHandleRouteType;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Factory function to create an instance of the dynamic component.
|
|
77
|
+
*
|
|
78
|
+
* @param {object} arg - Arguments object.
|
|
79
|
+
* @param {string} arg.path - The route path (from window.location.hash or pathname).
|
|
80
|
+
* @param {IbGibAddr} [arg.ibGibAddr] - The parsed ibGib address from the route path.
|
|
81
|
+
* @returns {Promise<IbGibDynamicComponentInstance>} - Promise that resolves to a new instance of the dynamic component.
|
|
82
|
+
*/
|
|
83
|
+
createInstance(arg: {
|
|
84
|
+
path: string,
|
|
85
|
+
ibGibAddr: IbGibAddr,
|
|
86
|
+
}): Promise<IbGibDynamicComponentInstance>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* factory function that returns a metaspace (most likely a global singleton
|
|
90
|
+
* service)
|
|
91
|
+
*/
|
|
92
|
+
fnGetMetaspace: () => Promise<MetaspaceService>;
|
|
93
|
+
/**
|
|
94
|
+
* Promise that resolves when the app has initialized ibgib-related code,
|
|
95
|
+
* e.g., the metaspace.
|
|
96
|
+
*
|
|
97
|
+
* ## intent
|
|
98
|
+
*
|
|
99
|
+
* I've found that deferring the ibgib-related code can speed up the initial
|
|
100
|
+
* rendering, but it requires this additional complexity. This is
|
|
101
|
+
* essentially the ibgib equivalent to waiting for the DOM ready event to
|
|
102
|
+
* fire.
|
|
103
|
+
*/
|
|
104
|
+
bootstrapPromise: Promise<void>;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* TElements is for the HTML elements of the instance.
|
|
109
|
+
*/
|
|
110
|
+
export interface IbGibDynamicComponentInstance<TIbGib extends IbGib_V1 = IbGib_V1, TElements = any> extends HTMLElement {
|
|
111
|
+
/**
|
|
112
|
+
* each instance should have an instance id created in ctor.
|
|
113
|
+
*/
|
|
114
|
+
get instanceId(): string;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Meant for HTMLElements that compose this component
|
|
118
|
+
*/
|
|
119
|
+
elements: TElements | undefined;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* ## driving use case
|
|
123
|
+
* need an empty ctor for document.createElement call. so createInstance
|
|
124
|
+
* will use this after creation.
|
|
125
|
+
*/
|
|
126
|
+
initialize(opts: IbGibDynamicComponentInstanceInitOpts): Promise<void>;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Reference to the component's meta object that created this component
|
|
130
|
+
* instance.
|
|
131
|
+
*/
|
|
132
|
+
meta?: IbGibDynamicComponentMeta;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Lifecycle method called after the component's HTML is dynamically loaded
|
|
136
|
+
* and inserted into the DOM.
|
|
137
|
+
*
|
|
138
|
+
* Use this to perform component-specific initialization,
|
|
139
|
+
* e.g., get element references, attach event listeners, set initial state, etc.
|
|
140
|
+
*
|
|
141
|
+
* @returns when component is fully created and initialized
|
|
142
|
+
*/
|
|
143
|
+
created(): Promise<void>;
|
|
144
|
+
destroyed(): Promise<void>;
|
|
145
|
+
destroy(): Promise<void>;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Lifecycle method called when the component is about to be dynamically removed
|
|
149
|
+
* from the DOM (e.g., when switching tabs or navigating away from the component).
|
|
150
|
+
*
|
|
151
|
+
* Use this to perform cleanup tasks,
|
|
152
|
+
* e.g., unregister event listeners, release resources, save state (if needed), etc.
|
|
153
|
+
*
|
|
154
|
+
* @returns when component is fully destroyed and cleaned up
|
|
155
|
+
*/
|
|
156
|
+
disconnected(): Promise<void>;
|
|
157
|
+
get ib(): Ib;
|
|
158
|
+
get gib(): Gib;
|
|
159
|
+
ibGibAddr: IbGibAddr;
|
|
160
|
+
/**
|
|
161
|
+
* The proxy witness used for updating the backing ibGib.
|
|
162
|
+
*/
|
|
163
|
+
ibGibProxy: LiveProxyIbGib<TIbGib> | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* Backing ibgib getter via {@link ibGibProxy.ibGib}
|
|
166
|
+
*/
|
|
167
|
+
get ibGib(): TIbGib | undefined;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* common ctor opts when newing up IbGibDynamicComponentInstanceBase
|
|
172
|
+
* descendants.
|
|
173
|
+
*
|
|
174
|
+
* Extend this interface when adding opts to concrete classes.
|
|
175
|
+
*/
|
|
176
|
+
export interface IbGibDynamicComponentInstanceInitOpts {
|
|
177
|
+
/**
|
|
178
|
+
* initial addr that the instance relates to. if you don't have an addr yet,
|
|
179
|
+
* just pass in {@link ROOT_ADDR} ("ib^gib") which acts like a null object
|
|
180
|
+
* pattern.
|
|
181
|
+
*/
|
|
182
|
+
ibGibAddr: IbGibAddr;
|
|
183
|
+
/**
|
|
184
|
+
* reference to the meta that creates the instance.
|
|
185
|
+
*/
|
|
186
|
+
meta: IbGibDynamicComponentMeta;
|
|
187
|
+
/**
|
|
188
|
+
* @required The HTML content of the component instance as a string.
|
|
189
|
+
*/
|
|
190
|
+
html: string;
|
|
191
|
+
/**
|
|
192
|
+
* @optional Array of CSS style strings to be loaded with the component.
|
|
193
|
+
*/
|
|
194
|
+
css?: string[];
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Every component is expected to have a content element and frequently a header
|
|
199
|
+
* and/or footer (but these are optional)
|
|
200
|
+
*/
|
|
201
|
+
export interface ElementsBase {
|
|
202
|
+
contentEl: HTMLElement;
|
|
203
|
+
headerEl?: HTMLElement;
|
|
204
|
+
footerEl?: HTMLElement;
|
|
205
|
+
/**
|
|
206
|
+
* often a spinner or something
|
|
207
|
+
*/
|
|
208
|
+
busyEl?: HTMLElement;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* for parent components, this is the base info class that backs a child
|
|
213
|
+
* component.
|
|
214
|
+
*/
|
|
215
|
+
export interface ChildInfoBase<TComponent extends IbGibDynamicComponentInstance<IbGib_V1>> {
|
|
216
|
+
/**
|
|
217
|
+
* for tabbed parents, this is the tab button.
|
|
218
|
+
* for explorer parents, this is the thing you click to expand/collapse.
|
|
219
|
+
*/
|
|
220
|
+
childBtnEl: HTMLElement;
|
|
221
|
+
/**
|
|
222
|
+
* addr of the child
|
|
223
|
+
*/
|
|
224
|
+
addr: IbGibAddr;
|
|
225
|
+
/**
|
|
226
|
+
* true if the child is active on the parent
|
|
227
|
+
*/
|
|
228
|
+
active: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* if set, this is the agent associated with the child component
|
|
231
|
+
*/
|
|
232
|
+
agent?: AgentWitnessAny;
|
|
233
|
+
/**
|
|
234
|
+
* access the ibGib via this component.
|
|
235
|
+
*
|
|
236
|
+
* This component wraps an ibgib proxy that automatically stays up-to-date
|
|
237
|
+
* when new ibgib frames are added to the ibgib's timeline and published to
|
|
238
|
+
* the metaspace. (via metaspace.registerNewIbGib)
|
|
239
|
+
*/
|
|
240
|
+
component?: TComponent;
|
|
241
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module component-one-file.mts contains all the types, helpers, constants and
|
|
3
|
+
* classes for the **shell** ui component system. the differentiating factor
|
|
4
|
+
* between this system and other front end ui frameworks is that this is
|
|
5
|
+
* ibgib-driven, with especially ibgib addresses driving components' backing
|
|
6
|
+
* model/data.
|
|
7
|
+
*
|
|
8
|
+
* this is not to be confused with "components" that may be dynamically
|
|
9
|
+
* generated within a blank-canvas environment that the canvas agents will
|
|
10
|
+
* build. this is for the old-school html shell.
|
|
11
|
+
*
|
|
12
|
+
* the ui component system is being built piecemeal as we go.
|
|
13
|
+
*
|
|
14
|
+
* ## approach
|
|
15
|
+
*
|
|
16
|
+
* there are two basic pieces to a component: the component metadata declaration
|
|
17
|
+
* and the concrete component instance that that declaration instantiates. these
|
|
18
|
+
* will be tightly coupled per use-case, with the intention that the meta object
|
|
19
|
+
* will not need to be a descendant class, whereas the component instance will
|
|
20
|
+
* most likely be the class that is extended from an abstract base class.
|
|
21
|
+
*
|
|
22
|
+
* @see {@link IbGibDynamicComponentMeta}
|
|
23
|
+
* @see {@link IbGibDynamicComponentInstance}
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { extractErrorMsg, } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
|
|
27
|
+
import { IbGibAddr } from "@ibgib/ts-gib/dist/types.mjs";
|
|
28
|
+
|
|
29
|
+
import { GLOBAL_LOG_A_LOT } from "../../constants.mjs";
|
|
30
|
+
import { IbGibDynamicComponentInstance, IbGibDynamicComponentMeta } from "./component-types.mjs";
|
|
31
|
+
|
|
32
|
+
const logalot = GLOBAL_LOG_A_LOT;
|
|
33
|
+
/**
|
|
34
|
+
* Service for managing dynamic ibgib-aware components via web components.
|
|
35
|
+
*/
|
|
36
|
+
export class IbGibComponentService {
|
|
37
|
+
protected lc: string = `[${IbGibComponentService.name}]`;
|
|
38
|
+
/**
|
|
39
|
+
* @internal references to component meta's registered with the service.
|
|
40
|
+
*/
|
|
41
|
+
private _registeredComponentsMeta: IbGibDynamicComponentMeta[] = [];
|
|
42
|
+
|
|
43
|
+
initialized: Promise<void>;
|
|
44
|
+
|
|
45
|
+
constructor() {
|
|
46
|
+
this.initialized = this.initialize();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
private async initialize(): Promise<void> {
|
|
50
|
+
const lc = `[${this.initialize.name}]`;
|
|
51
|
+
try {
|
|
52
|
+
if (logalot) { console.log(`${lc} starting... (I: 1cf04e8d768f4b5c55e7c3861e2d2225)`); }
|
|
53
|
+
console.log(`${lc} does nothing atow (I: 65bb46c88c82b637ad928b8bf1a07225)`)
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
56
|
+
throw error;
|
|
57
|
+
} finally {
|
|
58
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Registers a dynamic ibgib-aware component META object with the service.
|
|
64
|
+
* @param {IbGibDynamicComponentMeta} componentMeta - The component meta object to register.
|
|
65
|
+
*/
|
|
66
|
+
registerComponentMeta(componentMeta: IbGibDynamicComponentMeta): void {
|
|
67
|
+
this._registeredComponentsMeta.push(componentMeta);
|
|
68
|
+
if (logalot) { console.log(`${this.lc}[registerComponentMeta] component meta registered: ${componentMeta.constructor.name} (I: 88ddcbd0c8caa2342af0e7348f171225)`); }
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Unregisters a dynamic ibgib-aware component META object from the service.
|
|
73
|
+
* @param {IbGibDynamicComponentMeta} componentMeta - The component meta object to unregister.
|
|
74
|
+
*/
|
|
75
|
+
unregisterComponentMeta(componentMeta: IbGibDynamicComponentMeta): void {
|
|
76
|
+
this._registeredComponentsMeta = this._registeredComponentsMeta.filter(c => c !== componentMeta);
|
|
77
|
+
if (logalot) { console.log(`${this.lc}[unregisterComponentMeta] component meta unregistered: ${componentMeta.constructor.name} (I: 4e84b5274de688248984896a90f5cc25)`); }
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async getComponentInstance({
|
|
81
|
+
useRegExpPrefilter,
|
|
82
|
+
path,
|
|
83
|
+
ibGibAddr,
|
|
84
|
+
}: {
|
|
85
|
+
useRegExpPrefilter: boolean,
|
|
86
|
+
path: string,
|
|
87
|
+
ibGibAddr: IbGibAddr,
|
|
88
|
+
}): Promise<IbGibDynamicComponentInstance | undefined> {
|
|
89
|
+
const lc = `${this.lc}[${this.getComponentInstance.name}]`;
|
|
90
|
+
try {
|
|
91
|
+
if (logalot) { console.log(`${lc} starting... (I: 684ef316cbdb4a3b1fdc96096c273b25)`); }
|
|
92
|
+
|
|
93
|
+
let componentToInject: IbGibDynamicComponentInstance | undefined = undefined;
|
|
94
|
+
|
|
95
|
+
// 1. Get registered components from the component service (NEW)
|
|
96
|
+
const registeredComponents = componentSvc.getRegisteredComponentsMeta();
|
|
97
|
+
|
|
98
|
+
// 2. Filter by routeRegExp (quick filter)
|
|
99
|
+
const possibleComponentsMeta = useRegExpPrefilter ?
|
|
100
|
+
registeredComponents.filter(component => {
|
|
101
|
+
const componentMatchesPath = component.routeRegExp ? component.routeRegExp.test(path) : false;
|
|
102
|
+
if (logalot) { console.log(`${lc} ${component.componentName} ${component.routeRegExp} componentMatchesPath: ${componentMatchesPath} (I: 3758520e6a4a57f218396c8649283425)`); }
|
|
103
|
+
return componentMatchesPath;
|
|
104
|
+
}) :
|
|
105
|
+
registeredComponents.concat();
|
|
106
|
+
|
|
107
|
+
// 3. Iterate and call fnHandleRoute for finer-grained check
|
|
108
|
+
for (const componentMeta of possibleComponentsMeta) {
|
|
109
|
+
/**
|
|
110
|
+
* order of component registration wins right now
|
|
111
|
+
*/
|
|
112
|
+
const componentHandlesPath = componentMeta.fnHandleRoute ?
|
|
113
|
+
await componentMeta.fnHandleRoute({ path, ibGibAddr }) :
|
|
114
|
+
true;
|
|
115
|
+
if (componentHandlesPath) {
|
|
116
|
+
componentToInject = await componentMeta.createInstance({
|
|
117
|
+
path, ibGibAddr,
|
|
118
|
+
});
|
|
119
|
+
break; // Stop on first component that handles the route
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return componentToInject;
|
|
124
|
+
} catch (error) {
|
|
125
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
126
|
+
throw error;
|
|
127
|
+
} finally {
|
|
128
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Injects a dynamic ibgib-aware component into a parent HTML element based on the route path.
|
|
134
|
+
*
|
|
135
|
+
* @param {object} arg - Arguments object.
|
|
136
|
+
* @param {HTMLElement} arg.parentEl - The parent HTML element where the component should be injected.
|
|
137
|
+
* @param {string} arg.path - The route path to determine which component to load.
|
|
138
|
+
* @param {IbGibAddr} [arg.ibGibAddr] - Optional ibGib address parsed from the route path.
|
|
139
|
+
* @returns {Promise<void>} - Promise that resolves when the component is injected and created.
|
|
140
|
+
*/
|
|
141
|
+
async inject({
|
|
142
|
+
parentEl,
|
|
143
|
+
componentToInject,
|
|
144
|
+
}: {
|
|
145
|
+
parentEl: HTMLElement,
|
|
146
|
+
componentToInject: IbGibDynamicComponentInstance,
|
|
147
|
+
}): Promise<void> {
|
|
148
|
+
const lc = `${this.lc}[${this.inject.name}]`;
|
|
149
|
+
try {
|
|
150
|
+
if (logalot) { console.log(`${lc} starting... (I: 6844cf07eaf8a5b1b106784f7db17125)`); }
|
|
151
|
+
|
|
152
|
+
if (!parentEl) { throw new Error(`${lc} parentEl required. (E: 6f4eb2d682856ef47d173b970ec3c825)`); }
|
|
153
|
+
if (!componentToInject) { throw new Error(`${lc} componentToInject required. (E: decf0b51ad49257ce44fecbcf84c3a25)`); }
|
|
154
|
+
if (!componentToInject.meta) { throw new Error(`${lc} componentToInject.meta required. (E: f8827c0602ca7b0e030d0b3e2c4a4825)`); }
|
|
155
|
+
if (!componentToInject.meta.componentName) { throw new Error(`${lc} componentToInject.meta.componentName required. (E: 5dcae244ae32690f7b73ce27a32a3c25)`); }
|
|
156
|
+
|
|
157
|
+
// Clear parent content
|
|
158
|
+
parentEl.innerHTML = '';
|
|
159
|
+
|
|
160
|
+
// attach the component (web component) to the parent
|
|
161
|
+
parentEl.appendChild(componentToInject);
|
|
162
|
+
|
|
163
|
+
// right now we're manually fading in/out with this kluge.
|
|
164
|
+
parentEl.classList.remove('fade-out');
|
|
165
|
+
} catch (error) {
|
|
166
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
167
|
+
parentEl.innerHTML = `<p class="error">Error loading component for route. error:</p><br /><br /><p>${error.message}</p>`;
|
|
168
|
+
// console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
169
|
+
// throw error; // Re-throw error for upstream handling
|
|
170
|
+
} finally {
|
|
171
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
getRegisteredComponentsMeta(): readonly IbGibDynamicComponentMeta[] {
|
|
176
|
+
return [...this._registeredComponentsMeta];
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Singleton instance of the IbGibComponentService.
|
|
182
|
+
*/
|
|
183
|
+
let componentSvc: IbGibComponentService;
|
|
184
|
+
export async function getComponentSvc(): Promise<IbGibComponentService> {
|
|
185
|
+
const lc = `[${getComponentSvc.name}]`;
|
|
186
|
+
try {
|
|
187
|
+
if (logalot) { console.log(`${lc} starting... (I: 853694c88223381339103a3765129925)`); }
|
|
188
|
+
|
|
189
|
+
if (!componentSvc) {
|
|
190
|
+
componentSvc = new IbGibComponentService();
|
|
191
|
+
await componentSvc.initialized;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return componentSvc;
|
|
195
|
+
} catch (error) {
|
|
196
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
197
|
+
throw error;
|
|
198
|
+
} finally {
|
|
199
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
200
|
+
}
|
|
201
|
+
}
|