fnloom 0.3.0 → 0.4.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 +27 -20
- package/package.json +14 -11
- package/packages/build/package.json +2 -2
- package/packages/build/src/tests.ts +2 -2
- package/packages/cli/package.json +1 -1
- package/packages/cli/src/cli.ts +2 -2
- package/packages/cli/src/command.ts +2 -2
- package/packages/cli/src/commands/install.ts +1 -1
- package/packages/cli/src/commands/mcp.ts +6 -6
- package/packages/cli/src/commands/store.ts +3 -3
- package/packages/cli/src/hub.ts +25 -25
- package/packages/cli/src/index.ts +1 -1
- package/packages/cli/src/io.ts +2 -2
- package/packages/cli/src/local.ts +7 -7
- package/packages/cli/src/premade.ts +1 -1
- package/packages/core/package.json +4 -4
- package/packages/core/src/auto-pair.ts +1 -1
- package/packages/core/src/connections.ts +1 -14
- package/packages/core/src/context-graph.ts +1 -1
- package/packages/core/src/data.ts +1 -1
- package/packages/core/src/gin-a.ts +13 -2
- package/packages/core/src/https.ts +2 -2
- package/packages/core/src/identity.ts +1 -1
- package/packages/core/src/image-embeddings.ts +1 -1
- package/packages/core/src/index.ts +5 -7
- package/packages/core/src/link.ts +1 -1
- package/packages/core/src/manifest.ts +2 -2
- package/packages/core/src/mention-search.ts +1 -1
- package/packages/core/src/model-calls.ts +1 -1
- package/packages/core/src/package.ts +1 -1
- package/packages/core/src/ports.ts +2 -2
- package/packages/core/src/query.ts +1 -1
- package/packages/core/src/records/chat.ts +1 -1
- package/packages/core/src/records/runs.ts +1 -1
- package/packages/core/src/records/spend.ts +4 -0
- package/packages/core/src/registries.ts +9 -3
- package/packages/core/src/sso.ts +2 -2
- package/packages/core/src/stores.ts +1 -1
- package/packages/core/src/suggestions.ts +2 -2
- package/packages/core/src/system-pages.ts +32 -6
- package/packages/core/src/tables.ts +233 -0
- package/packages/core/src/visuals.ts +47 -139
- package/packages/core/src/web.ts +2 -2
- package/packages/core/src/widgets-v1.ts +78 -1
- package/packages/hub/package.json +13 -11
- package/packages/hub/src/api/admin-ops.ts +5 -5
- package/packages/hub/src/api/auth.ts +2 -2
- package/packages/hub/src/api/https.ts +6 -6
- package/packages/hub/src/api/identities.ts +1 -1
- package/packages/hub/src/api/reads.ts +1 -1
- package/packages/hub/src/api/secrets.ts +1 -1
- package/packages/hub/src/api/serve.ts +2 -2
- package/packages/hub/src/api/sso-route.ts +2 -2
- package/packages/hub/src/api/sso.ts +6 -6
- package/packages/hub/src/api/store-ops.ts +9 -2
- package/packages/hub/src/api/testing/rig.ts +1 -1
- package/packages/hub/src/api/tls.ts +2 -2
- package/packages/hub/src/api/web/auth.ts +1 -1
- package/packages/hub/src/api/web/find.ts +1 -1
- package/packages/hub/src/api/web/pages.ts +4 -3
- package/packages/hub/src/api/web/pickers.ts +4 -4
- package/packages/hub/src/boot/env.ts +82 -78
- package/packages/hub/src/boot/hub-fns.ts +1 -1
- package/packages/hub/src/boot/identity.ts +2 -2
- package/packages/hub/src/boot/index.ts +1 -1
- package/packages/hub/src/boot/info.ts +1 -1
- package/packages/hub/src/boot/keys.ts +6 -6
- package/packages/hub/src/boot/log.ts +4 -4
- package/packages/hub/src/boot/modules.ts +4 -4
- package/packages/hub/src/boot/services.ts +9 -9
- package/packages/hub/src/boot/start.ts +23 -23
- package/packages/hub/src/catalog/catalog.ts +3 -2
- package/packages/hub/src/chat/cache.ts +1 -1
- package/packages/hub/src/chat/chat.ts +1 -1
- package/packages/hub/src/chat/compare.ts +2 -2
- package/packages/hub/src/chat/deliveries.ts +1 -1
- package/packages/hub/src/chat/deps.ts +3 -3
- package/packages/hub/src/chat/enrich.ts +7 -7
- package/packages/hub/src/chat/env.ts +20 -20
- package/packages/hub/src/chat/mention-requests.ts +1 -1
- package/packages/hub/src/chat/mention-search.ts +1 -1
- package/packages/hub/src/chat/mentions.ts +3 -3
- package/packages/hub/src/chat/notifications.ts +2 -2
- package/packages/hub/src/chat/presence.ts +2 -2
- package/packages/hub/src/chat/sessions.ts +2 -2
- package/packages/hub/src/chat/suggestions.ts +8 -8
- package/packages/hub/src/chat/testing.ts +1 -1
- package/packages/hub/src/chat/turns.ts +6 -6
- package/packages/hub/src/chat/undo.ts +1 -1
- package/packages/hub/src/connections/create.ts +1 -1
- package/packages/hub/src/connections/env.ts +2 -2
- package/packages/hub/src/connections/service.ts +5 -9
- package/packages/hub/src/contextor/contextors.ts +9 -9
- package/packages/hub/src/contextor/crawl.ts +1 -1
- package/packages/hub/src/contextor/create.ts +5 -5
- package/packages/hub/src/contextor/dynamic.ts +5 -5
- package/packages/hub/src/contextor/env.ts +46 -46
- package/packages/hub/src/contextor/injected.ts +1 -1
- package/packages/hub/src/contextor/limits.ts +9 -9
- package/packages/hub/src/contextor/planner.ts +11 -11
- package/packages/hub/src/contextor/testing.ts +1 -1
- package/packages/hub/src/data/env.ts +3 -3
- package/packages/hub/src/data/service.ts +5 -5
- package/packages/hub/src/execution/agent.ts +8 -8
- package/packages/hub/src/execution/ai.ts +7 -7
- package/packages/hub/src/execution/create.ts +11 -6
- package/packages/hub/src/execution/env.ts +16 -16
- package/packages/hub/src/execution/executors.ts +2 -2
- package/packages/hub/src/execution/gateway.ts +1 -1
- package/packages/hub/src/execution/index.ts +1 -1
- package/packages/hub/src/execution/ledger.ts +2 -2
- package/packages/hub/src/execution/limits.ts +2 -2
- package/packages/hub/src/execution/models.ts +2 -2
- package/packages/hub/src/execution/ports.ts +1 -1
- package/packages/hub/src/execution/providers.ts +55 -11
- package/packages/hub/src/execution/queues.ts +6 -6
- package/packages/hub/src/execution/runs.ts +10 -10
- package/packages/hub/src/execution/stream-guard.ts +2 -2
- package/packages/hub/src/execution/testing.ts +5 -5
- package/packages/hub/src/execution/wire.ts +3 -3
- package/packages/hub/src/fns/auto.ts +2 -2
- package/packages/hub/src/fns/client-logs.ts +2 -2
- package/packages/hub/src/fns/create.ts +2 -2
- package/packages/hub/src/fns/decided.ts +2 -2
- package/packages/hub/src/fns/env.ts +14 -14
- package/packages/hub/src/fns/examples.ts +3 -3
- package/packages/hub/src/fns/facts.ts +5 -5
- package/packages/hub/src/fns/search.ts +5 -5
- package/packages/hub/src/graph/graph.ts +1 -1
- package/packages/hub/src/index/context-sections.ts +1 -1
- package/packages/hub/src/index/embedders.ts +3 -3
- package/packages/hub/src/index/env.ts +12 -12
- package/packages/hub/src/index/index.ts +1 -1
- package/packages/hub/src/index/indexer.ts +4 -4
- package/packages/hub/src/index/search.ts +1 -1
- package/packages/hub/src/index/testing.ts +2 -2
- package/packages/hub/src/link/build.ts +32 -32
- package/packages/hub/src/link/env.ts +14 -14
- package/packages/hub/src/link/grants.ts +10 -10
- package/packages/hub/src/link/lifecycle.ts +4 -4
- package/packages/hub/src/link/migrate-api.ts +55 -15
- package/packages/hub/src/link/pairing.ts +1 -1
- package/packages/hub/src/link/process.ts +1 -1
- package/packages/hub/src/link/rig.ts +12 -12
- package/packages/hub/src/link/supervisor.ts +1 -1
- package/packages/hub/src/mcp/calls.ts +6 -6
- package/packages/hub/src/mcp/create.ts +5 -5
- package/packages/hub/src/mcp/env.ts +6 -6
- package/packages/hub/src/mcp/fns.ts +2 -2
- package/packages/hub/src/mcp/index.ts +2 -2
- package/packages/hub/src/mcp/sources.ts +3 -3
- package/packages/hub/src/mcp/tokens.ts +1 -1
- package/packages/hub/src/models/create.ts +1 -1
- package/packages/hub/src/models/decide.ts +2 -2
- package/packages/hub/src/models/index.ts +1 -1
- package/packages/hub/src/models/roles.ts +12 -12
- package/packages/hub/src/query/env.ts +5 -5
- package/packages/hub/src/query/sources.ts +3 -3
- package/packages/hub/src/questions/plans.ts +1 -1
- package/packages/hub/src/questions/worker.ts +2 -2
- package/packages/hub/src/resources/context.ts +3 -3
- package/packages/hub/src/resources/converters.ts +2 -2
- package/packages/hub/src/resources/create.ts +6 -6
- package/packages/hub/src/resources/env.ts +15 -15
- package/packages/hub/src/resources/fetch.ts +5 -5
- package/packages/hub/src/resources/forms.ts +5 -5
- package/packages/hub/src/resources/index.ts +1 -1
- package/packages/hub/src/resources/library.ts +2 -2
- package/packages/hub/src/resources/raw.ts +1 -1
- package/packages/hub/src/resources/reader.ts +2 -2
- package/packages/hub/src/resources/sqlite-files.ts +1 -1
- package/packages/hub/src/resources/storage.ts +5 -5
- package/packages/hub/src/resources/testing.ts +6 -6
- package/packages/hub/src/store/env.ts +4 -4
- package/packages/hub/src/store/hybrid.ts +4 -4
- package/packages/hub/src/store/sqlite.ts +3 -3
- package/packages/hub/src/stores/drivers.ts +2 -2
- package/packages/hub/src/stores/host.ts +3 -3
- package/packages/hub/src/stores/moves.ts +2 -2
- package/packages/hub/src/stores/service.ts +2 -2
- package/packages/hub/src/tables/env.ts +3 -3
- package/packages/hub/src/tables/index.ts +5 -5
- package/packages/hub/src/tables/service.ts +7 -7
- package/packages/sdk/AUTHORING.md +1206 -881
- package/packages/sdk/package.json +11 -8
- package/packages/sdk/src/agent.ts +1 -1
- package/packages/sdk/src/app-parts.ts +95 -0
- package/packages/sdk/src/authored.ts +26 -0
- package/packages/sdk/src/authoring.ts +13 -30
- package/packages/sdk/src/client-runtime.ts +24 -1
- package/packages/sdk/src/client-ui/AddServiceDialog.vue +43 -0
- package/packages/sdk/src/client-ui/InstanceNameField.vue +29 -0
- package/packages/sdk/src/client-ui/PairRowsEditor.vue +74 -0
- package/packages/sdk/src/client-ui/RemoteAuthFields.vue +95 -0
- package/packages/sdk/src/client-ui/ServiceRows.vue +57 -0
- package/packages/sdk/src/client-ui/draft.ts +10 -0
- package/packages/sdk/src/client-ui/host.ts +37 -0
- package/packages/sdk/src/client-ui/index.ts +19 -0
- package/packages/sdk/src/client-ui/loaded.ts +69 -0
- package/packages/sdk/src/client-ui/problems.ts +98 -0
- package/packages/sdk/src/client-ui/remote-config.ts +199 -0
- package/packages/sdk/src/client-ui/service-rows.ts +25 -0
- package/packages/sdk/src/client-ui/state.ts +14 -0
- package/packages/sdk/src/client-ui/testing.ts +147 -0
- package/packages/sdk/src/client-ui/vue-shim.d.ts +13 -0
- package/packages/sdk/src/client.ts +82 -11
- package/packages/sdk/src/hub.ts +4 -4
- package/packages/sdk/src/index.ts +13 -9
- package/packages/sdk/src/page-parts.ts +4 -0
- package/packages/sdk/src/program/env.ts +7 -7
- package/packages/sdk/src/program/runtime.ts +5 -5
- package/packages/sdk/src/program/tools.ts +3 -3
- package/packages/sdk/src/remote-auth.ts +128 -7
- package/packages/sdk/src/server/context-files.ts +1 -1
- package/packages/sdk/src/server/env.ts +36 -36
- package/packages/sdk/src/server/fake-hub-widgets.ts +7 -6
- package/packages/sdk/src/server/host.ts +28 -28
- package/packages/sdk/src/server/index.ts +2 -2
- package/packages/sdk/src/server/live.ts +4 -4
- package/packages/sdk/src/server/llm-wire.ts +54 -5
- package/packages/sdk/src/server/pairing.ts +1 -1
- package/packages/sdk/src/server/results.ts +4 -4
- package/packages/sdk/src/server/socket-guard.ts +1 -1
- package/packages/sdk/src/server/start-gate.ts +2 -2
- package/packages/sdk/src/server/store/engines.ts +2 -2
- package/packages/sdk/src/server/store/keeper.ts +2 -2
- package/packages/sdk/src/server/supervise.ts +4 -4
- package/packages/sdk/src/testing/env.ts +6 -6
- package/packages/sdk/src/testing/hub.ts +3 -1
- package/packages/sdk/src/testing/models.ts +3 -3
- package/packages/sdk/src/testing/openrouter.ts +3 -2
- package/packages/sdk/src/testing/preview.ts +7 -7
- package/packages/sdk/src/widgets.ts +21 -136
- package/packages/sdk/tsconfig.json +2 -2
- package/packages/web/dist/assets/{ActorSettingsView-v2k7v454.js → ActorSettingsView-CiWhrnP4.js} +2 -2
- package/packages/web/dist/assets/AdminLayout-CjVNzmYD.js +2 -0
- package/packages/web/dist/assets/{AdminLayout-1hbRPV3d.css → AdminLayout-ggcdQGlQ.css} +1 -1
- package/packages/web/dist/assets/{AppPage-CFmKZS8G.js → AppPage-D_kkUatv.js} +2 -2
- package/packages/web/dist/assets/{AutoPairPicker-C61gihmh.js → AutoPairPicker-BdCHi7dL.js} +2 -2
- package/packages/web/dist/assets/{BrowserFrame-Sq9EmQRT.js → BrowserFrame-CVQvfCB8.js} +2 -2
- package/packages/web/dist/assets/ChatPage-CPZJ8ya6.js +4 -0
- package/packages/web/dist/assets/{ChatPage-CbsRmktV.css → ChatPage-DjPv238m.css} +1 -1
- package/packages/web/dist/assets/{CodeViewer-tUNXZB77.js → CodeViewer-DzWZyAp4.js} +2 -2
- package/packages/web/dist/assets/ConfigWithCustom-C49loznj.js +3 -0
- package/packages/web/dist/assets/{ConfirmDialog-Dd3E4sJt.js → ConfirmDialog-BtugUGEY.js} +2 -2
- package/packages/web/dist/assets/{ConnectPage-CX9acyQH.js → ConnectPage-D8k2nSdX.js} +2 -2
- package/packages/web/dist/assets/ContextItemPage-DC4FGi8V.js +2 -0
- package/packages/web/dist/assets/ContextPage-MlEkKMq0.js +3 -0
- package/packages/web/dist/assets/{ContextRow-DrtPumZ5.js → ContextRow-BN26Di1B.js} +2 -2
- package/packages/web/dist/assets/{DataPage-DDSsxHro.js → DataPage-CvOYkEkS.js} +2 -2
- package/packages/web/dist/assets/DataTypePage-CDEL6BHp.js +2 -0
- package/packages/web/dist/assets/{DataTypePage-Cr238Hx_.css → DataTypePage-CWrWvUPs.css} +1 -1
- package/packages/web/dist/assets/{DesignPage-6e0XbOFC.js → DesignPage-D-MsKLuP.js} +3 -3
- package/packages/web/dist/assets/{ExplorePage-B7ND0W0l.js → ExplorePage-CNQpEe_8.js} +2 -2
- package/packages/web/dist/assets/{FnPill-Cp3KuLmP.js → FnPill-Dm5mmffj.js} +2 -2
- package/packages/web/dist/assets/{FnView-C0XZdnsS.js → FnView-oiIU5vka.js} +2 -2
- package/packages/web/dist/assets/{FnsView-GTH3p7a0.js → FnsView-DgIfza4W.js} +2 -2
- package/packages/web/dist/assets/{GinExprView-DGxns6lH.js → GinExprView-C19g0UgI.js} +2 -2
- package/packages/web/dist/assets/{GinForm-BDBUzuDP.js → GinForm-p7UsKQ3s.js} +2 -2
- package/packages/web/dist/assets/{GinTypeView-CUsymbVf.js → GinTypeView-DvdHc0V4.js} +2 -2
- package/packages/web/dist/assets/{GinValueView-jsKIfiEA.js → GinValueView-D6c7E4C_.js} +2 -2
- package/packages/web/dist/assets/{GraphPage-BCcPPsHu.js → GraphPage-BTamx4d-.js} +2 -2
- package/packages/web/dist/assets/GraphPanel-DKpbijQD.js +2 -0
- package/packages/web/dist/assets/{HubPicker-EoOErgmk.js → HubPicker-DfXIcUz1.js} +2 -2
- package/packages/web/dist/assets/{InboxApprovals-Dkq7DFp_.js → InboxApprovals-B9qwPCHR.js} +2 -2
- package/packages/web/dist/assets/{InboxPage-CHhslePq.js → InboxPage-j2lF00uW.js} +2 -2
- package/packages/web/dist/assets/InjectedList-BTGvy8GB.js +2 -0
- package/packages/web/dist/assets/{InstallDialog-D-VwfZYF.js → InstallDialog-BRJXLSMJ.js} +2 -2
- package/packages/web/dist/assets/InstanceTypes-DYdolFFW.js +2 -0
- package/packages/web/dist/assets/InstanceView-C5dJLBPe.js +2 -0
- package/packages/web/dist/assets/{ItemHistory-NQAP69ma.js → ItemHistory-vsyIMjIX.js} +2 -2
- package/packages/web/dist/assets/LimitsView-BtbQzkX1.js +2 -0
- package/packages/web/dist/assets/{ListSearch-BunVrDO0.js → ListSearch-BdVW9FHD.js} +2 -2
- package/packages/web/dist/assets/{LlmCallDetails-BoVNDTVs.js → LlmCallDetails-Cd7qtybU.js} +2 -2
- package/packages/web/dist/assets/{LlmCallsView-BGpV92RC.js → LlmCallsView-CrZB_I1H.js} +2 -2
- package/packages/web/dist/assets/{LoadState-h-K9bTYc.js → LoadState-8UknKQ6e.js} +2 -2
- package/packages/web/dist/assets/McpDialog-r-qJDHOO.js +2 -0
- package/packages/web/dist/assets/{McpView-GPXdCMne.js → McpView-FeDQWGxu.js} +2 -2
- package/packages/web/dist/assets/{McpsView-DJIR2JX5.js → McpsView-Czd2yUdE.js} +2 -2
- package/packages/web/dist/assets/{MemoryDialog-BTeIHQyA.js → MemoryDialog-DDiT6wO1.js} +2 -2
- package/packages/web/dist/assets/{ModelCallsView-DMcnwF2S.js → ModelCallsView-DsdztwCR.js} +2 -2
- package/packages/web/dist/assets/{ModelPicker-CgkMFxSO.js → ModelPicker-Df_3l8nS.js} +2 -2
- package/packages/web/dist/assets/ModelsView-YXwRDgWv.js +2 -0
- package/packages/web/dist/assets/{NotFoundPage-Tk92K7HN.js → NotFoundPage-DDEOlB6B.js} +2 -2
- package/packages/web/dist/assets/{PairPage-D0BK8CCw.js → PairPage-D3uHAkh1.js} +2 -2
- package/packages/web/dist/assets/{PanelHost-C-gKrxAk.js → PanelHost-BzWYqH39.js} +2 -2
- package/packages/web/dist/assets/PeopleView-Cg9RO5SF.js +2 -0
- package/packages/web/dist/assets/{PeopleView-CJ8yArTh.css → PeopleView-DBxdbT1C.css} +1 -1
- package/packages/web/dist/assets/{PoliciesView-BRi-QAuo.js → PoliciesView-BoshL7RQ.js} +2 -2
- package/packages/web/dist/assets/{RefusalList-DVO0bmeB.js → RefusalList-DnLIfmi-.js} +2 -2
- package/packages/web/dist/assets/RendererHost-CmkaVEX0.js +2 -0
- package/packages/web/dist/assets/RendererHost-Ym_SMkhp.css +1 -0
- package/packages/web/dist/assets/{ResourceViewer-Do0chYxU.js → ResourceViewer-CSAY6xIs.js} +2 -2
- package/packages/web/dist/assets/ResourcesPage-DAoa9mDs.js +2 -0
- package/packages/web/dist/assets/ResultGrid-CL2WSYQH.css +1 -0
- package/packages/web/dist/assets/ResultGrid-DSyc0btv.js +2 -0
- package/packages/web/dist/assets/{ReviewSummaryStrip-DO3p64Qj.js → ReviewSummaryStrip-Bzy-KGz_.js} +2 -2
- package/packages/web/dist/assets/ReviewView-Cwq8Az_B.js +3 -0
- package/packages/web/dist/assets/{RuleRow-DX9v4iGP.js → RuleRow-DAvl2m9p.js} +2 -2
- package/packages/web/dist/assets/RunCard-BMyRkKxJ.js +2 -0
- package/packages/web/dist/assets/RunCard-CSDiz-Nt.css +1 -0
- package/packages/web/dist/assets/{RunDetails-DjR206q6.js → RunDetails-Bvyr1HYK.js} +2 -2
- package/packages/web/dist/assets/{RunDot-lHRICdM5.js → RunDot-Lfrt5XR3.js} +2 -2
- package/packages/web/dist/assets/{RunPage-CbAQ_WPR.js → RunPage-C0-wY6Uz.js} +2 -2
- package/packages/web/dist/assets/{RunProgress-C3-B4tQf.js → RunProgress-BbzwzrTK.js} +2 -2
- package/packages/web/dist/assets/{RunsView-DMkPmkqX.js → RunsView-so-UV2Cq.js} +2 -2
- package/packages/web/dist/assets/SettingsPage-B4SQLk09.js +3 -0
- package/packages/web/dist/assets/{SettingsPage-t03BqXw8.css → SettingsPage-BTl3Ie4F.css} +1 -1
- package/packages/web/dist/assets/SignInPage-CXxLf7Rp.css +1 -0
- package/packages/web/dist/assets/{SignInPage-ByqGEZfj.js → SignInPage-Ck-v3eH0.js} +2 -2
- package/packages/web/dist/assets/{StatusBadge-CXne0sRZ.js → StatusBadge-C4NawPsO.js} +2 -2
- package/packages/web/dist/assets/{StorePlacementStep-B6SwTmdM.js → StorePlacementStep-DjLWeQF9.js} +2 -2
- package/packages/web/dist/assets/{SystemConfig-vQDL_eUl.js → SystemConfig-B5C5B3b0.js} +2 -2
- package/packages/web/dist/assets/SystemPageHost-DX7LrFoN.css +1 -0
- package/packages/web/dist/assets/SystemPageHost-DoyQlhKM.js +2 -0
- package/packages/web/dist/assets/SystemView-CTdpay8I.js +2 -0
- package/packages/web/dist/assets/SystemsView-Cnv2moRw.js +2 -0
- package/packages/web/dist/assets/TableView-BK_95qHT.js +3 -0
- package/packages/web/dist/assets/TableView-B_4MViVb.css +1 -0
- package/packages/web/dist/assets/{TableViewer-Boxx86f5.js → TableViewer-CRsIxdku.js} +3 -3
- package/packages/web/dist/assets/{ThemePicker-CIg_oRQX.js → ThemePicker-BlW7qvUd.js} +2 -2
- package/packages/web/dist/assets/{TurnTree-Ecm0yA5g.js → TurnTree-D6OYRutQ.js} +2 -2
- package/packages/web/dist/assets/{UserMessage-BtECa8ka.css → UserMessage-B63G9sxC.css} +1 -1
- package/packages/web/dist/assets/{UserMessage-BlnqZDVU.js → UserMessage-DJH2bXqv.js} +6 -6
- package/packages/web/dist/assets/{ValueVisual-C-MWpp7c.js → ValueVisual-BJUrdkHO.js} +2 -2
- package/packages/web/dist/assets/{fn-modal-B98MR7JN.js → fn-modal-DFtN7Kn-.js} +2 -2
- package/packages/web/dist/assets/{fn-notices-CfTa1E8y.js → fn-notices-C8HXeo7m.js} +2 -2
- package/packages/web/dist/assets/{formats-JwoKfXIq.js → formats-CHSYhY4X.js} +2 -2
- package/packages/web/dist/assets/index-BY7M8QUk.css +1 -0
- package/packages/web/dist/assets/index-Uz-h2M5K.js +4 -0
- package/packages/web/dist/assets/{labels-BFbk11BE.js → labels-DkV96Md_.js} +2 -2
- package/packages/web/dist/assets/{layout-D1gf481r.js → layout-CTAHAwIH.js} +2 -2
- package/packages/web/dist/assets/loaded-BrwmsuZY.js +2 -0
- package/packages/web/dist/assets/{metrics-CBPX3W5Y.js → metrics-BBvD6KSk.js} +2 -2
- package/packages/web/dist/assets/problems-CI9huk1n.js +2 -0
- package/packages/web/dist/assets/{push-payload-BeU1ADYt.js → push-payload-C1ppI5V2.js} +64 -64
- package/packages/web/dist/assets/record-edits-DFJBcNnL.js +2 -0
- package/packages/web/dist/assets/{review-fP-l9D6H.js → review-DlP8FQiO.js} +3 -3
- package/packages/web/dist/assets/routes-oIISbS5Z.js +4 -0
- package/packages/web/dist/assets/{runs-CveC2kKo.js → runs-BWVBevgu.js} +2 -2
- package/packages/web/dist/assets/{shared-LbaIHjbV.js → shared-Bc4GJbiE.js} +2 -2
- package/packages/web/dist/assets/{sources-VPrtgLIi.js → sources-gONU9kk2.js} +2 -2
- package/packages/web/dist/assets/src-ClMFVauH.js +43 -0
- package/packages/web/dist/assets/state-BQlvjJzT.js +2 -0
- package/packages/web/dist/assets/{systems-BqE3WTSF.js → systems-Dt01wDhP.js} +2 -2
- package/packages/web/dist/assets/table-host-BvEY0Zxn.js +2 -0
- package/packages/web/dist/assets/tables-CkqGZ0Yq.js +2 -0
- package/packages/web/dist/assets/{ui-BzgWquIU.js → ui-CjoSgSyZ.js} +5 -5
- package/packages/web/dist/assets/{url-DKGcECT1.js → url-Deh5u3O5.js} +2 -2
- package/packages/web/dist/index.html +49 -47
- package/packages/web/dist/sw.js +1 -1
- package/packages/web/package.json +2 -4
- package/premade/claude.zip +0 -0
- package/premade/database.zip +0 -0
- package/premade/web.zip +0 -0
- package/scripts/dev-env.ts +9 -9
- package/scripts/run-stack.ts +15 -15
- package/scripts/stack.ts +3 -3
- package/scripts/start.ts +18 -18
- package/systems/api/client/ApiServiceForm.vue +55 -0
- package/systems/api/client/ServiceList.vue +90 -0
- package/systems/api/client/ServicePage.vue +142 -0
- package/systems/api/client/ServicesPage.vue +32 -0
- package/systems/api/client/index.ts +15 -0
- package/systems/api/client/logic.ts +140 -0
- package/systems/api/client/state.ts +92 -0
- package/systems/api/package.json +9 -6
- package/systems/api/server/authoring.ts +2 -1
- package/systems/api/server/env.ts +1 -1
- package/systems/api/server/guard.ts +1 -1
- package/systems/api/server/http.ts +3 -2
- package/systems/api/server/impl.ts +3 -2
- package/systems/api/server/main.ts +11 -7
- package/systems/api/server/openapi.ts +1 -1
- package/systems/api/server/program.ts +2 -1
- package/systems/api/server/services.ts +2 -1
- package/systems/api/shared/http.ts +2 -1
- package/systems/api/shared/index.ts +15 -5
- package/{packages/core/src/programs.ts → systems/api/shared/services.ts} +7 -51
- package/systems/api/system.json +2 -1
- package/systems/api/tsconfig.json +2 -2
- package/systems/code/package.json +4 -3
- package/systems/code/server/authoring.ts +2 -1
- package/systems/code/server/impl.ts +2 -1
- package/systems/code/server/main.ts +5 -5
- package/systems/code/shared/index.ts +2 -3
- package/systems/code/shared/program.ts +23 -0
- package/systems/embedder/package.json +1 -1
- package/systems/embedder/server/env.ts +1 -1
- package/systems/embedder/server/main.ts +5 -5
- package/systems/embedder/shared/index.ts +1 -1
- package/systems/fs/client/machines/fakes.ts +1 -1
- package/systems/fs/client/machines/files/CommentComposer.vue +6 -3
- package/systems/fs/client/machines/files/FilePane.vue +2 -2
- package/systems/fs/client/machines/files/fakes.ts +1 -1
- package/systems/fs/client/machines/palette.ts +3 -2
- package/systems/fs/context/authoring/parts/client.md +23 -5
- package/systems/fs/context/authoring/parts/client.reference/client.md +7 -16
- package/systems/fs/context/authoring/parts/client.reference/pageinbox.md +524 -0
- package/systems/fs/context/authoring/parts/client.reference/{resultview.md → visuals.md} +85 -116
- package/systems/fs/context/authoring/parts/client.reference.md +8 -8
- package/systems/fs/context/authoring/parts/context.md +1 -1
- package/systems/fs/context/authoring/parts/contract.md +1 -1
- package/systems/fs/context/authoring/parts/core-types/admin-ts.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/connections-ts.md +12 -1
- package/systems/fs/context/authoring/parts/core-types/context-files-ts.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/context-graph-ts.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/contextdecl.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/lifecycle-ts.md +27 -2
- package/systems/fs/context/authoring/parts/core-types/manifest.md +27 -2
- package/systems/fs/context/authoring/parts/core-types/manifestpatch.md +26 -2
- package/systems/fs/context/authoring/parts/core-types/modes-ts.md +3 -3
- package/systems/fs/context/authoring/parts/core-types/records-systems-ts.md +145 -1
- package/systems/fs/context/authoring/parts/core-types/registries-ts.md +98 -2
- package/systems/fs/context/authoring/parts/core-types/run-ts.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/system-pages-ts.md +4 -2
- package/systems/fs/context/authoring/parts/core-types/system-providers-ts.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/tables-ts.md +91 -0
- package/systems/fs/context/authoring/parts/core-types/web-ts.md +1 -2
- package/systems/fs/context/authoring/parts/core-types.md +5 -8
- package/systems/fs/context/authoring/parts/examples/server-main-ts.md +4 -4
- package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-568-660.md +1 -1
- package/systems/fs/context/authoring/parts/fns.md +1 -1
- package/systems/fs/context/authoring/parts/folder.md +6 -6
- package/systems/fs/context/authoring/parts/hub/hub-ctx-from-resource.md +2 -2
- package/systems/fs/context/authoring/parts/hub/hub-install-package.md +2 -2
- package/systems/fs/context/authoring/parts/hub.reference.md +3 -3
- package/systems/fs/context/authoring/parts/internals/manifestof.md +2 -2
- package/systems/fs/context/authoring/parts/internals/permissionargs.md +4 -4
- package/systems/fs/context/authoring/parts/kinds-agents.md +1 -1
- package/systems/fs/context/authoring/parts/kinds-agents.reference/authoringsession.md +7 -5
- package/systems/fs/context/authoring/parts/kinds-agents.reference/kind.md +4 -4
- package/systems/fs/context/authoring/parts/outcomes.md +2 -2
- package/systems/fs/context/authoring/parts/outcomes.reference.md +2 -2
- package/systems/fs/context/authoring/parts/packaging.md +4 -4
- package/systems/fs/context/authoring/parts/remote.md +5 -5
- package/systems/fs/context/authoring/parts/remote.reference.md +201 -17
- package/systems/fs/context/authoring/parts/server.md +7 -7
- package/systems/fs/context/authoring/parts/server.reference.md +15 -15
- package/systems/fs/context/authoring/parts/testing.reference/equal.md +3 -3
- package/systems/fs/context/authoring/parts/testing.reference/fakehub.md +1 -1
- package/systems/fs/context/authoring/parts/testing.reference/kindprops.md +22 -10
- package/systems/fs/context/authoring/parts/testing.reference/{openmemorystore.md → storeconnection.md} +7 -19
- package/systems/fs/context/authoring/parts/testing.reference.md +5 -5
- package/systems/fs/context/authoring/parts/widgets.md +32 -22
- package/systems/fs/context/authoring/parts/widgets.reference.md +503 -9
- package/systems/fs/package.json +3 -3
- package/systems/fs/server/hosting.ts +10 -10
- package/systems/fs/server/main.ts +8 -8
- package/systems/fs/server/metrics/os.ts +50 -29
- package/systems/fs/server/shell.ts +1 -1
- package/systems/fs/shared/index.ts +1 -1
- package/systems/google-calendar/package.json +1 -1
- package/systems/google-calendar/server/main.ts +4 -4
- package/systems/input/package.json +3 -3
- package/systems/input/server/main.ts +6 -6
- package/systems/mcp/client/McpServerForm.vue +99 -0
- package/systems/mcp/client/ServerList.vue +78 -0
- package/systems/mcp/client/ServerPage.vue +194 -0
- package/systems/mcp/client/ServersPage.vue +32 -0
- package/systems/mcp/client/index.ts +15 -0
- package/systems/mcp/client/logic.ts +224 -0
- package/systems/mcp/client/state.ts +128 -0
- package/systems/mcp/package.json +9 -6
- package/systems/mcp/server/dial.ts +1 -1
- package/systems/mcp/server/impl.ts +2 -1
- package/systems/mcp/server/instance.ts +3 -5
- package/systems/mcp/server/main.ts +10 -6
- package/systems/mcp/server/mirror.ts +2 -3
- package/systems/mcp/server/oauth.ts +2 -1
- package/systems/mcp/server/server-link.ts +2 -1
- package/systems/mcp/shared/index.ts +15 -2
- package/{packages/core/src/mcp-servers.ts → systems/mcp/shared/servers.ts} +6 -5
- package/systems/mcp/system.json +2 -1
- package/systems/mcp/tsconfig.json +2 -2
- package/systems/ollama/package.json +3 -3
- package/systems/ollama/server/main.ts +5 -5
- package/systems/schedule/package.json +3 -3
- package/systems/schedule/server/main.ts +6 -6
- package/systems/template/README.md +2 -2
- package/systems/template/package.json +1 -1
- package/systems/template/server/main.ts +4 -4
- package/systems/widgets/client/ChipRow.vue +22 -0
- package/systems/widgets/client/ProposalCard.vue +6 -5
- package/systems/widgets/client/SavedWidget.vue +11 -8
- package/systems/widgets/client/WidgetChips.vue +137 -0
- package/systems/widgets/client/WidgetView.vue +32 -0
- package/systems/widgets/client/charts/ChartVisual.vue +157 -0
- package/systems/widgets/client/charts/chart-data.ts +230 -0
- package/systems/widgets/client/charts/echarts-setup.ts +69 -0
- package/systems/widgets/client/charts/export.ts +36 -0
- package/systems/widgets/client/charts/families/calendar.ts +105 -0
- package/systems/widgets/client/charts/families/category.ts +186 -0
- package/systems/widgets/client/charts/families/crosstab.ts +113 -0
- package/systems/widgets/client/charts/families/distribution.ts +160 -0
- package/systems/widgets/client/charts/families/finance.ts +96 -0
- package/systems/widgets/client/charts/families/gauge.ts +75 -0
- package/systems/widgets/client/charts/families/hierarchy.ts +166 -0
- package/systems/widgets/client/charts/families/index.ts +21 -0
- package/systems/widgets/client/charts/families/network.ts +140 -0
- package/systems/widgets/client/charts/families/part.ts +61 -0
- package/systems/widgets/client/charts/families/profile.ts +30 -0
- package/systems/widgets/client/charts/families/progress.ts +76 -0
- package/systems/widgets/client/charts/families/range.ts +107 -0
- package/systems/widgets/client/charts/families/time.ts +177 -0
- package/systems/widgets/client/charts/families/timeline.ts +114 -0
- package/systems/widgets/client/charts/families/wide.ts +41 -0
- package/systems/widgets/client/charts/index.ts +37 -0
- package/systems/widgets/client/charts/maths.ts +139 -0
- package/systems/widgets/client/charts/size.ts +39 -0
- package/systems/widgets/client/chips.ts +150 -0
- package/systems/widgets/client/index.ts +18 -5
- package/systems/widgets/client/proposal.ts +2 -1
- package/systems/widgets/package.json +7 -4
- package/systems/widgets/server/authoring.ts +13 -7
- package/systems/widgets/server/env.ts +1 -1
- package/systems/widgets/server/impl.ts +10 -6
- package/systems/widgets/server/main.ts +6 -6
- package/systems/widgets/server/run.ts +16 -9
- package/systems/widgets/server/upgrade.ts +34 -0
- package/systems/widgets/shared/args.ts +137 -0
- package/systems/widgets/shared/charts.ts +243 -0
- package/systems/widgets/shared/index.ts +12 -3
- package/{packages/sdk/src → systems/widgets/shared}/relative-dates.ts +2 -1
- package/systems/widgets/shared/spec.ts +208 -0
- package/{packages/sdk/src → systems/widgets/shared}/widget-check.ts +7 -9
- package/{packages/sdk/src → systems/widgets/shared}/widget-schema.ts +4 -4
- package/packages/core/src/remote-auth.ts +0 -111
- package/packages/core/src/widgets.ts +0 -427
- package/packages/web/dist/assets/AdminLayout-B6Jrc_4W.js +0 -2
- package/packages/web/dist/assets/ApiServiceForm-BxprSaAq.css +0 -1
- package/packages/web/dist/assets/ApiServiceForm-CuuQgOJc.js +0 -2
- package/packages/web/dist/assets/ApiServiceView-7bTHSO_Z.js +0 -2
- package/packages/web/dist/assets/ApiServiceView-BVmdRCjR.css +0 -1
- package/packages/web/dist/assets/ApiServicesView-BTLV6c8n.css +0 -1
- package/packages/web/dist/assets/ApiServicesView-BXi24n49.js +0 -2
- package/packages/web/dist/assets/ChartVisual-BnFG9aFi.css +0 -1
- package/packages/web/dist/assets/ChartVisual-C4mgw4wh.js +0 -11
- package/packages/web/dist/assets/ChatPage-CAhHE03Z.js +0 -4
- package/packages/web/dist/assets/ConfigWithCustom-D_-rY66L.js +0 -3
- package/packages/web/dist/assets/ContextItemPage-rUI3-T_L.js +0 -2
- package/packages/web/dist/assets/ContextPage-CtefzyKg.js +0 -3
- package/packages/web/dist/assets/DataTypePage-BW9fWaz8.js +0 -2
- package/packages/web/dist/assets/FnList-BCnb4kOB.css +0 -1
- package/packages/web/dist/assets/FnList-Bx6H-kux.js +0 -2
- package/packages/web/dist/assets/GraphPanel-9tztGHmu.js +0 -2
- package/packages/web/dist/assets/InjectedList-CSWqRiON.js +0 -2
- package/packages/web/dist/assets/InstanceTypes-D3rAEiE7.js +0 -2
- package/packages/web/dist/assets/InstanceView-DoH8C-1j.js +0 -2
- package/packages/web/dist/assets/LimitsView-DY2C9nYS.js +0 -2
- package/packages/web/dist/assets/McpDialog-DhOCk6_E.js +0 -2
- package/packages/web/dist/assets/McpServerForm-Cor3fI7s.js +0 -2
- package/packages/web/dist/assets/McpServerForm-DsHaf5Um.css +0 -1
- package/packages/web/dist/assets/McpServerView-7I76EznB.css +0 -1
- package/packages/web/dist/assets/McpServerView-ewXRPEmZ.js +0 -2
- package/packages/web/dist/assets/McpServersView-Dd0xmfws.js +0 -2
- package/packages/web/dist/assets/ModelsView-cMHygeiK.js +0 -2
- package/packages/web/dist/assets/PeopleView-DRfeNWK5.js +0 -2
- package/packages/web/dist/assets/RemoteAuthFields-CgiufuqQ.js +0 -2
- package/packages/web/dist/assets/RemoteAuthFields-Dm44vz2t.css +0 -1
- package/packages/web/dist/assets/ResourcesPage-BBx2u2mw.js +0 -2
- package/packages/web/dist/assets/ResultGrid-Bj-0I5HY.js +0 -2
- package/packages/web/dist/assets/ResultGrid-CuUQyTjW.css +0 -1
- package/packages/web/dist/assets/ReviewView-DZF9E1hb.js +0 -3
- package/packages/web/dist/assets/RunCard-BnrtK2Yp.js +0 -2
- package/packages/web/dist/assets/RunCard-CfyRaDLS.css +0 -1
- package/packages/web/dist/assets/ServiceRows-4WythFpF.js +0 -2
- package/packages/web/dist/assets/ServiceRows-HPQ0pN6b.css +0 -1
- package/packages/web/dist/assets/SettingsPage-BN4oSzoL.js +0 -3
- package/packages/web/dist/assets/SignInPage-Djx-M-0U.css +0 -1
- package/packages/web/dist/assets/SystemPageHost-BeZ-6N0-.css +0 -1
- package/packages/web/dist/assets/SystemPageHost-DrMrEPyh.js +0 -2
- package/packages/web/dist/assets/SystemView-Be6TBM4j.js +0 -2
- package/packages/web/dist/assets/SystemsView-DZtT3laz.js +0 -2
- package/packages/web/dist/assets/WidgetView-DQUDeFkB.css +0 -1
- package/packages/web/dist/assets/WidgetView-DX4ejNb6.js +0 -3
- package/packages/web/dist/assets/export-BwFkEtcm.js +0 -15
- package/packages/web/dist/assets/index-6ScWTFy2.js +0 -4
- package/packages/web/dist/assets/index-CEslGcrX.css +0 -1
- package/packages/web/dist/assets/problems-t1E_ovSz.js +0 -2
- package/packages/web/dist/assets/record-edits-Bfsi4lU3.js +0 -2
- package/packages/web/dist/assets/remote-config-BNQhSDzB.js +0 -2
- package/packages/web/dist/assets/routes-DV4IJpwe.js +0 -4
- package/packages/web/dist/assets/size-Bh__w5aI.js +0 -2
- package/packages/web/dist/assets/src-CT3TeFaM.js +0 -43
- package/packages/web/dist/assets/state-xfQqaQPX.js +0 -2
- package/packages/web/dist/assets/widget-host-B87MTaTn.js +0 -2
- package/packages/web/dist/assets/widgets-BBCuSS6E.js +0 -2
- package/systems/fs/context/authoring/parts/client.reference/textareaprops.md +0 -195
- package/systems/fs/context/authoring/parts/core-types/remote-auth-ts.md +0 -64
- package/systems/fs/context/authoring/parts/core-types/widgets-ts.md +0 -303
- package/systems/fs/context/authoring/parts/widgets.reference/hub-visuals.md +0 -627
- package/systems/fs/context/authoring/parts/widgets.reference/sourcecompatible.md +0 -154
|
@@ -11,19 +11,19 @@ import { createScheduleImpl } from './impl.ts';
|
|
|
11
11
|
import { scheduleMigrations } from './store.ts';
|
|
12
12
|
|
|
13
13
|
const settings = scheduleEnv.parse();
|
|
14
|
-
placeFolders(settings.
|
|
14
|
+
placeFolders(settings.FNLOOM_SYSTEM_STATE, settings);
|
|
15
15
|
const { host, log } = loggedHost(schedule.name);
|
|
16
16
|
|
|
17
17
|
// the calendar, schedule and admin pages and the result renderers: without the build the hub lists none of its pages
|
|
18
|
-
const clientFolder = await rendererFolder({ main: import.meta.url, outDir: join(settings.
|
|
18
|
+
const clientFolder = await rendererFolder({ main: import.meta.url, outDir: join(settings.FNLOOM_SYSTEM_STATE, 'client') });
|
|
19
19
|
|
|
20
|
-
log.info('schedule.serving', { hub: settings.
|
|
20
|
+
log.info('schedule.serving', { hub: settings.FNLOOM_HUB });
|
|
21
21
|
const running = await serve(schedule, createScheduleImpl({ settings }), {
|
|
22
|
-
hub: settings.
|
|
23
|
-
state: settings.
|
|
22
|
+
hub: settings.FNLOOM_HUB,
|
|
23
|
+
state: settings.FNLOOM_SYSTEM_STATE,
|
|
24
24
|
client: clientFolder,
|
|
25
25
|
store: { migrations: scheduleMigrations },
|
|
26
|
-
...(settings.
|
|
26
|
+
...(settings.FNLOOM_PAIRING_TOKEN === undefined ? {} : { pairingToken: settings.FNLOOM_PAIRING_TOKEN }),
|
|
27
27
|
}, host);
|
|
28
28
|
running.onStatus((status) => { log.info('schedule.status', { status }); });
|
|
29
29
|
await running.ready();
|
|
@@ -25,13 +25,13 @@ The guide to every part of a system is `packages/sdk/AUTHORING.md` (in the chat:
|
|
|
25
25
|
```sh
|
|
26
26
|
npm run typecheck # from the harness repository: every project, this one included
|
|
27
27
|
npx vitest run systems/template # its tests
|
|
28
|
-
|
|
28
|
+
FNLOOM_HUB=ws://127.0.0.1:4300/link npx tsx systems/template/server/main.ts
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
The first time it connects, the hub has never seen the name, so the system waits to be paired: it prints a pairing
|
|
32
32
|
code and link (and a QR code). An admin opens the link, checks the code, fills in the config and approves. To skip
|
|
33
33
|
that, an admin makes a one-time token (Admin, Systems, Pairing token) and the system starts with
|
|
34
|
-
`
|
|
34
|
+
`FNLOOM_PAIRING_TOKEN=<token>`. It keeps its key in `FNLOOM_SYSTEM_STATE` (default `.harness/systems/template`), so
|
|
35
35
|
later starts sign in on their own.
|
|
36
36
|
|
|
37
37
|
## Build, pack and install
|
|
@@ -14,11 +14,11 @@ const { host, log } = loggedHost(template.name);
|
|
|
14
14
|
// TODO: build each outside dependency here and pass it to createImpl.
|
|
15
15
|
const impl = createImpl({ settings });
|
|
16
16
|
|
|
17
|
-
log.info('template.serving', { hub: settings.
|
|
17
|
+
log.info('template.serving', { hub: settings.FNLOOM_HUB });
|
|
18
18
|
const running = await serve(template, impl, {
|
|
19
|
-
hub: settings.
|
|
20
|
-
state: settings.
|
|
21
|
-
...(settings.
|
|
19
|
+
hub: settings.FNLOOM_HUB,
|
|
20
|
+
state: settings.FNLOOM_SYSTEM_STATE,
|
|
21
|
+
...(settings.FNLOOM_PAIRING_TOKEN === undefined ? {} : { pairingToken: settings.FNLOOM_PAIRING_TOKEN }),
|
|
22
22
|
// client: the folder of the built renderers (`buildClient` from `@harness/sdk/build`), once `client/` has any.
|
|
23
23
|
}, host);
|
|
24
24
|
running.onStatus((status) => { log.info('template.status', { status }); });
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The widget's chip row as the result view's `controls` slot draws it: the chips and presets of the level shown (read
|
|
4
|
+
* from its output, so a drill level, a plain table, has none), staged and applied through the view (`ChipState`).
|
|
5
|
+
*/
|
|
6
|
+
import type { ResultControls } from '@harness/sdk';
|
|
7
|
+
import { computed } from 'vue';
|
|
8
|
+
import { WidgetResult } from '../shared/spec.ts';
|
|
9
|
+
import { ChipState } from './chips.ts';
|
|
10
|
+
import WidgetChips from './WidgetChips.vue';
|
|
11
|
+
|
|
12
|
+
const props = defineProps<{ view: ResultControls }>();
|
|
13
|
+
const chips = new ChipState(() => props.view);
|
|
14
|
+
const presets = computed(() => { const parsed = WidgetResult.safeParse(props.view.value); return parsed.success ? parsed.data.presets : []; });
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<WidgetChips
|
|
19
|
+
:controls="chips.controls.value" :presets="presets" :current-of="(arg) => chips.value(arg)" :dirty="chips.dirty.value" :busy="view.busy" :editable="view.editable"
|
|
20
|
+
@stage="(arg, value) => chips.stage(arg, value)" @apply="chips.apply()" @discard="chips.discard()" @preset="chips.preset($event)"
|
|
21
|
+
/>
|
|
22
|
+
</template>
|
|
@@ -8,18 +8,19 @@
|
|
|
8
8
|
* Nothing is saved until Save. Outside a chat (no `CHAT_HOST`) it shows the proposal and its preview only. It draws
|
|
9
9
|
* with the app's own buttons and badge (`APP_COMPONENTS`).
|
|
10
10
|
*/
|
|
11
|
-
import { APP_COMPONENTS, CHAT_HOST,
|
|
12
|
-
import {
|
|
11
|
+
import { APP_COMPONENTS, CHAT_HOST, type ResultViewOf } from '@harness/sdk';
|
|
12
|
+
import type { QualifiedName } from '@harness/core';
|
|
13
13
|
import { computed, inject, ref } from 'vue';
|
|
14
14
|
import type { widgets } from '../shared/index.ts';
|
|
15
15
|
import { changeRequest, saveArgs, savedName, widgetsPageHref } from './proposal.ts';
|
|
16
|
+
import WidgetView from './WidgetView.vue';
|
|
17
|
+
import { WidgetResult } from '../shared/spec.ts';
|
|
16
18
|
|
|
17
19
|
const props = defineProps<ResultViewOf<typeof widgets, 'make_widget'>>();
|
|
18
20
|
|
|
19
|
-
const ResultView = inject(RESULT_VIEW, undefined);
|
|
20
21
|
const chat = inject(CHAT_HOST, undefined);
|
|
21
22
|
const parts = inject(APP_COMPONENTS, undefined);
|
|
22
|
-
const preview = computed(() =>
|
|
23
|
+
const preview = computed(() => { const parsed = WidgetResult.safeParse(props.result.preview); return parsed.success ? parsed.data : undefined; });
|
|
23
24
|
const showing = ref(props.result.show);
|
|
24
25
|
const saving = ref(false);
|
|
25
26
|
const saved = ref<QualifiedName | undefined>(undefined);
|
|
@@ -66,7 +67,7 @@ function openSaved(): void { chat?.navigate(savedHref.value); }
|
|
|
66
67
|
</div>
|
|
67
68
|
</header>
|
|
68
69
|
<p v-if="problem !== ''" class="problem" role="alert">{{ problem }}</p>
|
|
69
|
-
<
|
|
70
|
+
<WidgetView v-if="showing && preview" :result="preview" :title="result.spec.title" :view-key="`${run}:preview`" />
|
|
70
71
|
</article>
|
|
71
72
|
</template>
|
|
72
73
|
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
/**
|
|
3
3
|
* A saved widget's result (a run of a `widgets/widget` fn), drawn as the kind's result renderer: the app's result view
|
|
4
|
-
* with the widget's chips, visuals, pager, drill and row actions, reading the widget fn again as the
|
|
5
|
-
* Settings can keep the look picked there as the widget's own: that runs `make_widget` over the same
|
|
6
|
-
* proposes the change in the chat for the person to save.
|
|
4
|
+
* with the widget's chips (`WidgetView`), visuals, pager, drill and row actions, reading the widget fn again as the
|
|
5
|
+
* chips change. Its Settings can keep the look picked there as the widget's own: that runs `make_widget` over the same
|
|
6
|
+
* source, which proposes the change in the chat for the person to save. The app's fn page draws a saved widget's
|
|
7
|
+
* latest run with this too.
|
|
7
8
|
*/
|
|
8
|
-
import {
|
|
9
|
+
import { Json } from '@harness/core';
|
|
9
10
|
import { RESULT_VIEW, type ResultLook, type ResultView, type UntypedFn, type WithSystem } from '@harness/sdk';
|
|
10
11
|
import { computed, inject } from 'vue';
|
|
12
|
+
import { WidgetResult } from '../shared/spec.ts';
|
|
11
13
|
import type { WidgetsContract } from '../shared/index.ts';
|
|
12
14
|
import { lookArgs } from './proposal.ts';
|
|
15
|
+
import WidgetView from './WidgetView.vue';
|
|
13
16
|
|
|
14
17
|
const props = defineProps<ResultView<UntypedFn> & WithSystem<WidgetsContract['defs']>>();
|
|
15
18
|
|
|
16
19
|
const ResultViewComponent = inject(RESULT_VIEW, undefined);
|
|
20
|
+
/** What a run that isn't a widget's result still shows (the app's result view draws what it can). */
|
|
21
|
+
const raw = computed(() => { const parsed = Json.safeParse(props.result); return parsed.success ? parsed.data : null; });
|
|
17
22
|
const widget = computed(() => {
|
|
18
23
|
const parsed = WidgetResult.safeParse(props.result);
|
|
19
24
|
return parsed.success ? parsed.data : undefined;
|
|
@@ -28,8 +33,6 @@ async function keepLook(look: ResultLook): Promise<boolean> {
|
|
|
28
33
|
</script>
|
|
29
34
|
|
|
30
35
|
<template>
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
:keep-look="widget ? keepLook : undefined" data-testid="saved-widget"
|
|
34
|
-
/>
|
|
36
|
+
<WidgetView v-if="widget" :result="widget" :fn="fn" :args="args" :title="title" :view-key="run" :keep-look="keepLook" data-testid="saved-widget" />
|
|
37
|
+
<component :is="ResultViewComponent" v-else-if="ResultViewComponent" :value="raw" :fn="fn" :args="args" :title="title" :view-key="run" data-testid="saved-widget" />
|
|
35
38
|
</template>
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A widget's chip row (controls-bar: always visible, never a dialog): its presets first (a tap sets their args and
|
|
4
|
+
* runs), then one chip per shown control with its label and value ("Any" when unset). A chip opens a popover with the
|
|
5
|
+
* editor for its argument: its choices (an optional one has an "Any" row), the relative dates for a date, and a typed
|
|
6
|
+
* value where one may be typed. Changes are staged: the chip marks itself and Apply beside the row runs them together.
|
|
7
|
+
* A chip's label is the plan's, else the arg's name humanized (`actionLabel`), with the raw arg name as its title. It
|
|
8
|
+
* wraps on a phone. Without `editable` (a preview, a page that can't run it) the chips only show their values. It draws
|
|
9
|
+
* with the app's own button, icon, popover and gin form (`APP_COMPONENTS`), above the app's result view.
|
|
10
|
+
*/
|
|
11
|
+
import type { Json } from '@harness/core';
|
|
12
|
+
import { APP_COMPONENTS } from '@harness/sdk';
|
|
13
|
+
import { computed, inject, ref } from 'vue';
|
|
14
|
+
import type { WidgetPreset, WidgetShownControl } from '../shared/spec.ts';
|
|
15
|
+
import { chipText, relativeChoices, sameValue, type ChipValue } from './chips.ts';
|
|
16
|
+
|
|
17
|
+
const props = defineProps<{
|
|
18
|
+
controls: readonly WidgetShownControl[];
|
|
19
|
+
presets: readonly WidgetPreset[];
|
|
20
|
+
/** A chip's value now (staged, else the one it ran with). */
|
|
21
|
+
currentOf: (arg: string) => ChipValue | undefined;
|
|
22
|
+
/** Whether there are staged changes to apply. */
|
|
23
|
+
dirty: boolean;
|
|
24
|
+
busy: boolean;
|
|
25
|
+
editable: boolean;
|
|
26
|
+
}>();
|
|
27
|
+
const emit = defineEmits<{ stage: [arg: string, value: ChipValue]; apply: []; discard: []; preset: [preset: WidgetPreset] }>();
|
|
28
|
+
|
|
29
|
+
const ui = inject(APP_COMPONENTS, undefined);
|
|
30
|
+
const anchors = ref<Record<string, HTMLElement | null>>({});
|
|
31
|
+
const openArg = ref<string | undefined>(undefined);
|
|
32
|
+
const open = computed({ get: () => openArg.value !== undefined, set: (on: boolean) => { if (!on) { openArg.value = undefined; } } });
|
|
33
|
+
const control = computed(() => props.controls.find((c) => c.arg === openArg.value));
|
|
34
|
+
const relatives = computed(() => (control.value === undefined ? [] : relativeChoices(control.value)));
|
|
35
|
+
/** Whether the open chip takes a typed value: no choices, or choices with `custom`. */
|
|
36
|
+
const typed = computed(() => control.value !== undefined && (control.value.choices === undefined || control.value.custom));
|
|
37
|
+
const literal = computed((): Json | undefined => {
|
|
38
|
+
const value = control.value === undefined ? undefined : props.currentOf(control.value.arg);
|
|
39
|
+
return value === undefined || value === null || 'relative' in value ? undefined : value.literal;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
function setAnchor(arg: string, el: unknown): void {
|
|
43
|
+
anchors.value[arg] = el instanceof HTMLElement ? el : null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function pick(value: ChipValue): void {
|
|
47
|
+
const arg = openArg.value;
|
|
48
|
+
if (arg === undefined) { return; }
|
|
49
|
+
emit('stage', arg, value);
|
|
50
|
+
openArg.value = undefined;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const changed = (c: WidgetShownControl): boolean => !sameValue(props.currentOf(c.arg), c.value);
|
|
54
|
+
const isPicked = (value: ChipValue): boolean => control.value !== undefined && sameValue(props.currentOf(control.value.arg), value);
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<template>
|
|
58
|
+
<div v-if="controls.length > 0 || presets.length > 0" class="chips" data-testid="widget-chips">
|
|
59
|
+
<button
|
|
60
|
+
v-for="preset in presets" :key="preset.label" type="button" class="preset" :disabled="!editable || busy" data-testid="widget-preset"
|
|
61
|
+
@click="emit('preset', preset)"
|
|
62
|
+
>
|
|
63
|
+
{{ preset.label }}
|
|
64
|
+
</button>
|
|
65
|
+
<button
|
|
66
|
+
v-for="c in controls" :key="c.arg" :ref="(el) => setAnchor(c.arg, el)" type="button" class="chip" :class="{ changed: changed(c) }" :disabled="!editable"
|
|
67
|
+
:aria-expanded="openArg === c.arg" aria-haspopup="dialog" :data-arg="c.arg" data-testid="widget-chip" @click="openArg = openArg === c.arg ? undefined : c.arg"
|
|
68
|
+
>
|
|
69
|
+
<span class="label" :title="c.arg">{{ c.label }}</span>
|
|
70
|
+
<span class="value">{{ chipText(c, currentOf(c.arg)) }}</span>
|
|
71
|
+
<component :is="ui.Icon" v-if="editable && ui" name="chevron-down" :size="12" />
|
|
72
|
+
</button>
|
|
73
|
+
<span v-if="dirty" class="apply">
|
|
74
|
+
<component :is="ui?.Button ?? 'button'" size="sm" variant="primary" :loading="busy" data-testid="widget-apply" @click="emit('apply')">Apply</component>
|
|
75
|
+
<component :is="ui?.Button ?? 'button'" size="sm" variant="ghost" :disabled="busy" data-testid="widget-discard" @click="emit('discard')">Reset</component>
|
|
76
|
+
</span>
|
|
77
|
+
<component :is="ui.Popover" v-if="ui" v-model:open="open" :anchor="openArg === undefined ? null : anchors[openArg]" :label="control?.label">
|
|
78
|
+
<div v-if="control" class="editor" data-testid="widget-chip-editor">
|
|
79
|
+
<ul v-if="control.choices || relatives.length > 0" class="options" role="listbox" :aria-label="control.label">
|
|
80
|
+
<li v-for="choice in control.choices ?? []" :key="choice.label">
|
|
81
|
+
<button
|
|
82
|
+
type="button" class="option" role="option" :aria-selected="isPicked(choice.value ?? null)" data-testid="widget-chip-choice"
|
|
83
|
+
@click="pick(choice.value ?? null)"
|
|
84
|
+
>
|
|
85
|
+
<span :class="{ any: choice.value === undefined }">{{ choice.label }}</span>
|
|
86
|
+
<component :is="ui.Icon" v-if="isPicked(choice.value ?? null)" name="check" :size="14" />
|
|
87
|
+
</button>
|
|
88
|
+
</li>
|
|
89
|
+
<li v-if="!control.choices && control.optional">
|
|
90
|
+
<button type="button" class="option" role="option" :aria-selected="isPicked(null)" data-testid="widget-chip-choice" @click="pick(null)">
|
|
91
|
+
<span class="any">Any</span>
|
|
92
|
+
<component :is="ui.Icon" v-if="isPicked(null)" name="check" :size="14" />
|
|
93
|
+
</button>
|
|
94
|
+
</li>
|
|
95
|
+
<li v-for="rel in relatives" :key="rel.label">
|
|
96
|
+
<button type="button" class="option" role="option" :aria-selected="isPicked(rel.value)" data-testid="widget-chip-relative" @click="pick(rel.value)">
|
|
97
|
+
<span>{{ rel.label }}</span>
|
|
98
|
+
<component :is="ui.Icon" v-if="isPicked(rel.value)" name="check" :size="14" />
|
|
99
|
+
</button>
|
|
100
|
+
</li>
|
|
101
|
+
</ul>
|
|
102
|
+
<component
|
|
103
|
+
:is="ui.Form" v-if="typed" :key="control.arg" class="typed" :type="control.argType" :initial="literal" :label="relatives.length > 0 ? 'Or a date' : control.label" submit-label="Set"
|
|
104
|
+
@submit="pick({ literal: $event })" @cancel="openArg = undefined"
|
|
105
|
+
/>
|
|
106
|
+
</div>
|
|
107
|
+
</component>
|
|
108
|
+
</div>
|
|
109
|
+
</template>
|
|
110
|
+
|
|
111
|
+
<style scoped>
|
|
112
|
+
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); min-width: 0; }
|
|
113
|
+
.chip, .preset {
|
|
114
|
+
display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: var(--control-sm); padding: 0 var(--space-3);
|
|
115
|
+
border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: var(--text-sm); cursor: pointer;
|
|
116
|
+
}
|
|
117
|
+
.preset { border-style: dashed; color: var(--text-dim); }
|
|
118
|
+
.chip:hover:not(:disabled), .preset:hover:not(:disabled) { border-color: var(--text-faint); }
|
|
119
|
+
.chip:focus-visible, .preset:focus-visible { outline: none; box-shadow: var(--ring); }
|
|
120
|
+
.chip:disabled, .preset:disabled { cursor: default; }
|
|
121
|
+
.chip.changed { border-color: var(--accent); background: var(--accent-soft); }
|
|
122
|
+
.label { color: var(--text-dim); white-space: nowrap; }
|
|
123
|
+
.value { min-width: 0; font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
124
|
+
.apply { display: inline-flex; gap: var(--space-1); }
|
|
125
|
+
.editor { display: grid; gap: var(--space-2); min-width: 14rem; max-width: min(24rem, 100vw - 32px); padding: var(--space-2); }
|
|
126
|
+
/* seven and a half rows, so a cut-off last row says the list scrolls */
|
|
127
|
+
.options { display: grid; gap: 2px; max-height: calc(7.5 * (36px + 2px)); margin: 0; padding: 0; overflow: auto; list-style: none; }
|
|
128
|
+
.option {
|
|
129
|
+
display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); width: 100%; min-height: 36px; padding: 0 var(--space-2);
|
|
130
|
+
border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer;
|
|
131
|
+
}
|
|
132
|
+
.option:hover, .option[aria-selected="true"] { background: var(--surface-2); }
|
|
133
|
+
.option:focus-visible { outline: none; box-shadow: inset var(--ring); }
|
|
134
|
+
.any { color: var(--text-dim); font-style: italic; }
|
|
135
|
+
.typed { padding: var(--space-1); border-top: 1px solid var(--border); }
|
|
136
|
+
.options + .typed { padding-top: var(--space-2); }
|
|
137
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A widget's result drawn: the app's result view (`RESULT_VIEW`: the rows and every chart, pager, drill, row actions,
|
|
4
|
+
* exports, full screen and Settings) with the widget's own chip row above the rows, in the view's `controls` slot. The
|
|
5
|
+
* chips read the latest run's output (`WidgetResult.controls`) and run the widget again through the slot (`run`), so a
|
|
6
|
+
* chip set, a preset, a pager page and a chart's range all read the widget fn again. A proposal's preview draws
|
|
7
|
+
* without `fn`: its chips show their values and run nothing.
|
|
8
|
+
*/
|
|
9
|
+
import { Json, type QualifiedName } from '@harness/core';
|
|
10
|
+
import { RESULT_VIEW, type ResultControls, type ResultLook } from '@harness/sdk';
|
|
11
|
+
import { computed, inject } from 'vue';
|
|
12
|
+
import type { WidgetResult } from '../shared/spec.ts';
|
|
13
|
+
import ChipRow from './ChipRow.vue';
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(defineProps<{
|
|
16
|
+
result: WidgetResult;
|
|
17
|
+
title: string;
|
|
18
|
+
fn?: QualifiedName | undefined;
|
|
19
|
+
args?: Json | undefined;
|
|
20
|
+
viewKey?: string;
|
|
21
|
+
keepLook?: ((look: ResultLook) => Promise<boolean>) | undefined;
|
|
22
|
+
}>(), { fn: undefined, args: undefined, viewKey: '', keepLook: undefined });
|
|
23
|
+
|
|
24
|
+
const ResultViewComponent = inject(RESULT_VIEW, undefined);
|
|
25
|
+
const value = computed(() => Json.parse(props.result));
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<component :is="ResultViewComponent" v-if="ResultViewComponent" :value="value" :fn="fn" :args="args" :title="title" :view-key="viewKey" :keep-look="keepLook">
|
|
30
|
+
<template #controls="controls: ResultControls"><ChipRow :view="controls" /></template>
|
|
31
|
+
</component>
|
|
32
|
+
</template>
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A chart family drawn with ECharts (vue-echarts, bundled with the widgets system): the family's option from the
|
|
4
|
+
* table, binding and style, the palette's theme (set again on a theme change, no remount), SVG under `SVG_MAX_POINTS`
|
|
5
|
+
* marks and canvas above, coarse-pointer hit testing, and a resize with its frame. A click on a mark that stands for
|
|
6
|
+
* one row emits `drill` (where nothing opens from a mark, no drill and no row menu, the marks don't point); a zoom of a
|
|
7
|
+
* range axis, or a calendar's period, emits `range` (debounced). While mounted it offers PNG and SVG export to the
|
|
8
|
+
* result view around it (the sdk's `VISUAL_IMAGE`). A family that can't lay this data out says why instead.
|
|
9
|
+
*/
|
|
10
|
+
import { APP_COMPONENTS, VISUAL_DRILLABLE, VISUAL_EMITS, VISUAL_IMAGE, type VisualRowOpener, type VisualView } from '@harness/sdk';
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import { computed, inject, onBeforeUnmount, ref, watch } from 'vue';
|
|
13
|
+
import VChart from 'vue-echarts';
|
|
14
|
+
import type { ChartFamily } from '../../shared/charts.ts';
|
|
15
|
+
import { isoOf, type ChartClick, type ChartDraw, type RangeAxis } from './chart-data.ts';
|
|
16
|
+
import { chartTheme } from './echarts-setup.ts';
|
|
17
|
+
import { chartImage } from './export.ts';
|
|
18
|
+
import { CHART_BUILDERS } from './families/index.ts';
|
|
19
|
+
import { PHONE_WIDTH, useMediaQuery, useWidth } from './size.ts';
|
|
20
|
+
|
|
21
|
+
/** Above this many marks a chart draws on canvas; below it in SVG (crisper text, prints cleanly). */
|
|
22
|
+
const SVG_MAX_POINTS = 2000;
|
|
23
|
+
/** The usual chart height, in pixels. */
|
|
24
|
+
const CHART_HEIGHT = 320;
|
|
25
|
+
/** How long a zoom rests before it sets the range. */
|
|
26
|
+
const RANGE_DEBOUNCE_MS = 400;
|
|
27
|
+
|
|
28
|
+
defineOptions({ inheritAttrs: false });
|
|
29
|
+
/**
|
|
30
|
+
* Its props, declared here rather than as `VisualView`'s type: a system bundle's build can't always read a type from
|
|
31
|
+
* another package, and an undeclared `style` would arrive as CSS. The style picked is `chartStyle` here (the registry
|
|
32
|
+
* component in `index.ts` hands the view's `style` on as it).
|
|
33
|
+
*/
|
|
34
|
+
interface ChartProps {
|
|
35
|
+
table: VisualView['table'];
|
|
36
|
+
facts: VisualView['facts'];
|
|
37
|
+
bind: VisualView['bind'];
|
|
38
|
+
chartStyle: string;
|
|
39
|
+
palette: VisualView['palette'];
|
|
40
|
+
title?: string | undefined;
|
|
41
|
+
opener?: VisualRowOpener | undefined;
|
|
42
|
+
family: ChartFamily;
|
|
43
|
+
}
|
|
44
|
+
const props = defineProps<ChartProps>();
|
|
45
|
+
const emit = defineEmits(VISUAL_EMITS);
|
|
46
|
+
|
|
47
|
+
const frame = ref<HTMLElement | null>(null);
|
|
48
|
+
const width = useWidth(frame);
|
|
49
|
+
const phone = computed(() => width.value > 0 && width.value < PHONE_WIDTH);
|
|
50
|
+
/** Periods back from the latest (the calendar). */
|
|
51
|
+
const shift = ref(0);
|
|
52
|
+
watch(() => [props.table, props.chartStyle] as const, () => { shift.value = 0; });
|
|
53
|
+
|
|
54
|
+
const built = computed(() => CHART_BUILDERS[props.family]({
|
|
55
|
+
table: props.table, facts: props.facts, bind: props.bind, style: props.chartStyle, palette: props.palette, phone: phone.value, shift: shift.value,
|
|
56
|
+
}));
|
|
57
|
+
const draw = computed((): ChartDraw | undefined => ('problem' in built.value ? undefined : built.value));
|
|
58
|
+
const problem = computed(() => ('problem' in built.value ? built.value.problem : undefined));
|
|
59
|
+
const theme = computed(() => chartTheme(props.palette));
|
|
60
|
+
/** Charts draw at once, without their entry animation, for a person who asks for reduced motion (and for screenshots). */
|
|
61
|
+
const still = useMediaQuery('(prefers-reduced-motion: reduce)');
|
|
62
|
+
/** The app's own buttons (the calendar's earlier and later), else plain ones (a test with no app around it). */
|
|
63
|
+
const app = inject(APP_COMPONENTS, undefined);
|
|
64
|
+
|
|
65
|
+
/** Whether a mark opens anything (a drill, or the row's menu): if not, the marks don't point. */
|
|
66
|
+
const drillable = inject(VISUAL_DRILLABLE, undefined);
|
|
67
|
+
const clickable = computed(() => drillable === undefined || drillable.value || props.opener !== undefined);
|
|
68
|
+
/** The option drawn: without the entry animation when asked, and with marks that don't point when they open nothing. */
|
|
69
|
+
const option = computed(() => {
|
|
70
|
+
const shown = draw.value?.option;
|
|
71
|
+
if (shown === undefined) { return undefined; }
|
|
72
|
+
const base = still.value ? { ...shown, animation: false } : shown;
|
|
73
|
+
if (clickable.value) { return base; }
|
|
74
|
+
const series = base.series;
|
|
75
|
+
return { ...base, series: (Array.isArray(series) ? series : series === undefined ? [] : [series]).map((one: object) => ({ ...one, cursor: 'default' })) };
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const renderer = computed((): 'canvas' | 'svg' => ((draw.value?.points ?? 0) > SVG_MAX_POINTS ? 'canvas' : 'svg'));
|
|
79
|
+
const initOptions = computed(() => ({ renderer: renderer.value, useCoarsePointer: true, pointerSize: 24 }));
|
|
80
|
+
const height = computed(() => `${String(draw.value?.height ?? CHART_HEIGHT)}px`);
|
|
81
|
+
|
|
82
|
+
function onClick(event: ChartClick): void {
|
|
83
|
+
const row = draw.value?.rowOf?.(event);
|
|
84
|
+
if (row !== undefined && row >= 0) { emit('drill', row); }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const chart = ref<InstanceType<typeof VChart> | null>(null);
|
|
88
|
+
const ZoomState = z.object({ dataZoom: z.array(z.object({ startValue: z.union([z.number(), z.string()]).optional(), endValue: z.union([z.number(), z.string()]).optional() })).optional() });
|
|
89
|
+
let resting: ReturnType<typeof setTimeout> | undefined;
|
|
90
|
+
|
|
91
|
+
/** A zoom end as the range's value: an ISO day or instant on a time axis, the category's value on a category axis. */
|
|
92
|
+
function rangeValue(axis: RangeAxis, value: number | string | undefined): string | undefined {
|
|
93
|
+
if (value === undefined) { return undefined; }
|
|
94
|
+
if (axis.kind === 'time') { return typeof value === 'number' ? isoOf(value, axis.day) : value; }
|
|
95
|
+
const at = typeof value === 'number' ? axis.values[value] : value;
|
|
96
|
+
return at === undefined || at === null ? undefined : String(at);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function onZoom(): void {
|
|
100
|
+
const axis = draw.value?.range;
|
|
101
|
+
if (axis === undefined) { return; }
|
|
102
|
+
clearTimeout(resting);
|
|
103
|
+
resting = setTimeout(() => {
|
|
104
|
+
const state = ZoomState.safeParse(chart.value?.getOption());
|
|
105
|
+
const [zoomed] = state.success ? state.data.dataZoom ?? [] : [];
|
|
106
|
+
const from = rangeValue(axis, zoomed?.startValue); const to = rangeValue(axis, zoomed?.endValue);
|
|
107
|
+
if (from !== undefined && to !== undefined) { emit('range', { from, to }); }
|
|
108
|
+
}, RANGE_DEBOUNCE_MS);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function moveBy(step: number): void {
|
|
112
|
+
shift.value = Math.max(0, shift.value + step);
|
|
113
|
+
const period = draw.value?.period;
|
|
114
|
+
if (period !== undefined) { emit('range', { from: period.from, to: period.to }); }
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const slot = inject(VISUAL_IMAGE, undefined);
|
|
118
|
+
watch(draw, (shown) => {
|
|
119
|
+
slot?.set(shown === undefined ? undefined : (kind) => chartImage({
|
|
120
|
+
option: shown.option, theme: theme.value, width: frame.value?.clientWidth ?? PHONE_WIDTH, height: draw.value?.height ?? CHART_HEIGHT, background: props.palette.surface,
|
|
121
|
+
}, kind));
|
|
122
|
+
}, { immediate: true });
|
|
123
|
+
onBeforeUnmount(() => { clearTimeout(resting); slot?.set(undefined); });
|
|
124
|
+
</script>
|
|
125
|
+
|
|
126
|
+
<template>
|
|
127
|
+
<div ref="frame" class="chart" data-testid="chart-visual" :data-family="family" :data-style="chartStyle" :data-renderer="renderer" :style="{ '--chart-h': height }">
|
|
128
|
+
<div v-if="draw?.period" class="period" data-testid="chart-period">
|
|
129
|
+
<component
|
|
130
|
+
:is="app?.Button ?? 'button'" variant="ghost" size="sm" icon="chevron-left" aria-label="Earlier" title="Earlier" :disabled="!draw.period.before"
|
|
131
|
+
data-testid="chart-period-earlier" @click="moveBy(1)"
|
|
132
|
+
>
|
|
133
|
+
<template v-if="!app">‹</template>
|
|
134
|
+
</component>
|
|
135
|
+
<span class="label">{{ draw.period.label }}</span>
|
|
136
|
+
<component
|
|
137
|
+
:is="app?.Button ?? 'button'" variant="ghost" size="sm" icon="chevron-right" aria-label="Later" title="Later" :disabled="shift === 0"
|
|
138
|
+
data-testid="chart-period-later" @click="moveBy(-1)"
|
|
139
|
+
>
|
|
140
|
+
<template v-if="!app">›</template>
|
|
141
|
+
</component>
|
|
142
|
+
</div>
|
|
143
|
+
<p v-if="problem" class="problem" data-testid="chart-problem">{{ problem }}</p>
|
|
144
|
+
<VChart
|
|
145
|
+
v-else-if="draw" :key="renderer" ref="chart" class="canvas" :option="option ?? draw.option" :theme="theme" :init-options="initOptions" autoresize
|
|
146
|
+
:aria-label="title" @click="onClick" @datazoom="onZoom"
|
|
147
|
+
/>
|
|
148
|
+
</div>
|
|
149
|
+
</template>
|
|
150
|
+
|
|
151
|
+
<style scoped>
|
|
152
|
+
.chart { display: grid; gap: var(--space-1); width: 100%; min-width: 0; }
|
|
153
|
+
.canvas { width: 100%; min-width: 0; height: var(--chart-full, var(--chart-h)); }
|
|
154
|
+
.period { display: flex; align-items: center; justify-content: center; gap: var(--space-2); }
|
|
155
|
+
.period .label { min-width: 10ch; color: var(--text); font-size: var(--text-sm); font-weight: var(--weight-medium); text-align: center; }
|
|
156
|
+
.problem { margin: 0; padding: var(--space-4); border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-dim); font-size: var(--text-sm); }
|
|
157
|
+
</style>
|