@dxos/plugin-automation 0.7.5-labs.ff2ff30 → 0.7.5-main.5ae2ba8
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/dist/lib/browser/AutomationPanel-ITYXSN5Z.mjs +132 -0
- package/dist/lib/browser/AutomationPanel-ITYXSN5Z.mjs.map +7 -0
- package/dist/lib/browser/{chunk-R4JH4TLE.mjs → chunk-OFDNNRLE.mjs} +3 -8
- package/dist/lib/browser/chunk-OFDNNRLE.mjs.map +7 -0
- package/dist/lib/browser/chunk-U7QLNY2S.mjs +8 -0
- package/dist/lib/browser/chunk-U7QLNY2S.mjs.map +7 -0
- package/dist/lib/browser/chunk-WY2C7JY4.mjs +119 -0
- package/dist/lib/browser/chunk-WY2C7JY4.mjs.map +7 -0
- package/dist/lib/browser/complementary-panel-4CPOJL4Y.mjs +56 -0
- package/dist/lib/browser/complementary-panel-4CPOJL4Y.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +21 -377
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-SAPMN4PF.mjs +27 -0
- package/dist/lib/browser/react-surface-SAPMN4PF.mjs.map +7 -0
- package/dist/lib/node/{chunk-QXIHYOMF.cjs → AutomationPanel-X33HHDMQ.cjs} +19 -132
- package/dist/lib/node/AutomationPanel-X33HHDMQ.cjs.map +7 -0
- package/dist/lib/node/chunk-7Q5SNGCL.cjs +148 -0
- package/dist/lib/node/chunk-7Q5SNGCL.cjs.map +7 -0
- package/dist/lib/node/chunk-CB5OB6JH.cjs +40 -0
- package/dist/lib/node/chunk-CB5OB6JH.cjs.map +7 -0
- package/dist/lib/node/{chunk-EQYHOTGG.cjs → chunk-ORMEYEBE.cjs} +6 -12
- package/dist/lib/node/chunk-ORMEYEBE.cjs.map +7 -0
- package/dist/lib/node/complementary-panel-ZYJJ42ZU.cjs +72 -0
- package/dist/lib/node/complementary-panel-ZYJJ42ZU.cjs.map +7 -0
- package/dist/lib/node/index.cjs +36 -378
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-LWDY7SQG.cjs → react-surface-2WRVAPGR.cjs} +9 -34
- package/dist/lib/node/react-surface-2WRVAPGR.cjs.map +7 -0
- package/dist/lib/node-esm/AutomationPanel-HY3GB4BT.mjs +133 -0
- package/dist/lib/node-esm/AutomationPanel-HY3GB4BT.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-EMVA6QUT.mjs → chunk-6MUUH67V.mjs} +3 -8
- package/dist/lib/node-esm/chunk-6MUUH67V.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-R3P2WPBQ.mjs +10 -0
- package/dist/lib/node-esm/chunk-R3P2WPBQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UDD2VA6G.mjs +120 -0
- package/dist/lib/node-esm/chunk-UDD2VA6G.mjs.map +7 -0
- package/dist/lib/node-esm/complementary-panel-S42RIIAY.mjs +57 -0
- package/dist/lib/node-esm/complementary-panel-S42RIIAY.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +21 -377
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-QWLPOYXO.mjs +28 -0
- package/dist/lib/node-esm/react-surface-QWLPOYXO.mjs.map +7 -0
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/{ai-client.d.ts → complementary-panel.d.ts} +2 -3
- package/dist/types/src/capabilities/complementary-panel.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +1 -180
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +1 -2
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +1 -2
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -12
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +0 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -2
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -94
- package/dist/types/src/translations.d.ts.map +1 -1
- package/package.json +23 -73
- package/src/AutomationPlugin.tsx +9 -64
- package/src/capabilities/complementary-panel.ts +56 -0
- package/src/capabilities/index.ts +1 -5
- package/src/capabilities/react-surface.tsx +3 -23
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +1 -2
- package/src/components/AutomationPanel/AutomationPanel.tsx +56 -49
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +1 -2
- package/src/components/index.ts +0 -8
- package/src/index.ts +2 -3
- package/src/meta.ts +1 -4
- package/src/testing/index.ts +0 -1
- package/src/testing/test-functions.ts +0 -7
- package/src/translations.ts +1 -29
- package/dist/lib/browser/AutomationPanel-VW2XIUPU.mjs +0 -8
- package/dist/lib/browser/AutomationPanel-VW2XIUPU.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-5TAVTN3T.mjs +0 -12
- package/dist/lib/browser/ChatContainer-5TAVTN3T.mjs.map +0 -7
- package/dist/lib/browser/ai-client-5CNY6JBF.mjs +0 -22
- package/dist/lib/browser/ai-client-5CNY6JBF.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-FZGK55G7.mjs +0 -197
- package/dist/lib/browser/app-graph-builder-FZGK55G7.mjs.map +0 -7
- package/dist/lib/browser/chunk-2H2EUYXL.mjs +0 -15
- package/dist/lib/browser/chunk-2H2EUYXL.mjs.map +0 -7
- package/dist/lib/browser/chunk-DVE33EZL.mjs +0 -1602
- package/dist/lib/browser/chunk-DVE33EZL.mjs.map +0 -7
- package/dist/lib/browser/chunk-MJK7GL5P.mjs +0 -307
- package/dist/lib/browser/chunk-MJK7GL5P.mjs.map +0 -7
- package/dist/lib/browser/chunk-NQFZ6XRX.mjs +0 -243
- package/dist/lib/browser/chunk-NQFZ6XRX.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q4IMHYGH.mjs +0 -150
- package/dist/lib/browser/chunk-Q4IMHYGH.mjs.map +0 -7
- package/dist/lib/browser/chunk-R4JH4TLE.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-BWAXKT27.mjs +0 -29
- package/dist/lib/browser/intent-resolver-BWAXKT27.mjs.map +0 -7
- package/dist/lib/browser/react-surface-ILBDBZCN.mjs +0 -58
- package/dist/lib/browser/react-surface-ILBDBZCN.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -24
- package/dist/lib/browser/types/index.mjs.map +0 -7
- package/dist/lib/node/AutomationPanel-G6EDDYWW.cjs +0 -26
- package/dist/lib/node/AutomationPanel-G6EDDYWW.cjs.map +0 -7
- package/dist/lib/node/ChatContainer-EN24W3K4.cjs +0 -33
- package/dist/lib/node/ChatContainer-EN24W3K4.cjs.map +0 -7
- package/dist/lib/node/ai-client-FKLPDELV.cjs +0 -38
- package/dist/lib/node/ai-client-FKLPDELV.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-T76NYV42.cjs +0 -212
- package/dist/lib/node/app-graph-builder-T76NYV42.cjs.map +0 -7
- package/dist/lib/node/chunk-CJGJXNY3.cjs +0 -1586
- package/dist/lib/node/chunk-CJGJXNY3.cjs.map +0 -7
- package/dist/lib/node/chunk-EQYHOTGG.cjs.map +0 -7
- package/dist/lib/node/chunk-GB7245FH.cjs +0 -173
- package/dist/lib/node/chunk-GB7245FH.cjs.map +0 -7
- package/dist/lib/node/chunk-HMBKP6VG.cjs +0 -324
- package/dist/lib/node/chunk-HMBKP6VG.cjs.map +0 -7
- package/dist/lib/node/chunk-QXIHYOMF.cjs.map +0 -7
- package/dist/lib/node/chunk-U5Z7LFWB.cjs +0 -34
- package/dist/lib/node/chunk-U5Z7LFWB.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-C6OKFVEW.cjs +0 -44
- package/dist/lib/node/intent-resolver-C6OKFVEW.cjs.map +0 -7
- package/dist/lib/node/react-surface-LWDY7SQG.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs +0 -46
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/AutomationPanel-V3IWQAMO.mjs +0 -9
- package/dist/lib/node-esm/AutomationPanel-V3IWQAMO.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-CNTY3C2D.mjs +0 -13
- package/dist/lib/node-esm/ChatContainer-CNTY3C2D.mjs.map +0 -7
- package/dist/lib/node-esm/ai-client-XGNA6SJ5.mjs +0 -23
- package/dist/lib/node-esm/ai-client-XGNA6SJ5.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-IJQEN7WT.mjs +0 -198
- package/dist/lib/node-esm/app-graph-builder-IJQEN7WT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6HLBYDUI.mjs +0 -244
- package/dist/lib/node-esm/chunk-6HLBYDUI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DNCXRGAF.mjs +0 -151
- package/dist/lib/node-esm/chunk-DNCXRGAF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EMVA6QUT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IJRTDSKN.mjs +0 -16
- package/dist/lib/node-esm/chunk-IJRTDSKN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QP47VJT6.mjs +0 -1603
- package/dist/lib/node-esm/chunk-QP47VJT6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZLIAMW45.mjs +0 -308
- package/dist/lib/node-esm/chunk-ZLIAMW45.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-DCP4ZDBA.mjs +0 -30
- package/dist/lib/node-esm/intent-resolver-DCP4ZDBA.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-SBDXFVIN.mjs +0 -59
- package/dist/lib/node-esm/react-surface-SBDXFVIN.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -25
- package/dist/lib/node-esm/types/index.mjs.map +0 -7
- package/dist/types/src/artifacts.stories.d.ts +0 -16
- package/dist/types/src/artifacts.stories.d.ts.map +0 -1
- package/dist/types/src/capabilities/ai-client.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -181
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -5
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/AmbientChatDialog/AmbientChatDialog.d.ts +0 -3
- package/dist/types/src/components/AmbientChatDialog/AmbientChatDialog.d.ts.map +0 -1
- package/dist/types/src/components/AmbientChatDialog/index.d.ts +0 -2
- package/dist/types/src/components/AmbientChatDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/Box/StatusLine.d.ts +0 -11
- package/dist/types/src/components/Box/StatusLine.d.ts.map +0 -1
- package/dist/types/src/components/Box/StatusLine.stories.d.ts +0 -9
- package/dist/types/src/components/Box/StatusLine.stories.d.ts.map +0 -1
- package/dist/types/src/components/Box/Tabbed.d.ts +0 -15
- package/dist/types/src/components/Box/Tabbed.d.ts.map +0 -1
- package/dist/types/src/components/Box/Tabbed.stories.d.ts +0 -8
- package/dist/types/src/components/Box/Tabbed.stories.d.ts.map +0 -1
- package/dist/types/src/components/Box/ToggleContainer.d.ts +0 -13
- package/dist/types/src/components/Box/ToggleContainer.d.ts.map +0 -1
- package/dist/types/src/components/Box/ToggleContainer.stories.d.ts +0 -9
- package/dist/types/src/components/Box/ToggleContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/Box/index.d.ts +0 -4
- package/dist/types/src/components/Box/index.d.ts.map +0 -1
- package/dist/types/src/components/ChatContainer/ChatContainer.d.ts +0 -7
- package/dist/types/src/components/ChatContainer/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChatContainer/index.d.ts +0 -4
- package/dist/types/src/components/ChatContainer/index.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownViewer/MarkdownViewer.d.ts +0 -14
- package/dist/types/src/components/MarkdownViewer/MarkdownViewer.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownViewer/MarkdownViewer.stories.d.ts +0 -8
- package/dist/types/src/components/MarkdownViewer/MarkdownViewer.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownViewer/index.d.ts +0 -2
- package/dist/types/src/components/MarkdownViewer/index.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/Prompt.d.ts +0 -7
- package/dist/types/src/components/Prompt/Prompt.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts +0 -8
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/index.d.ts +0 -2
- package/dist/types/src/components/Prompt/index.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/prompt-autocomplete.d.ts +0 -20
- package/dist/types/src/components/Prompt/prompt-autocomplete.d.ts.map +0 -1
- package/dist/types/src/components/PromptEditor/PromptEditor.d.ts +0 -10
- package/dist/types/src/components/PromptEditor/PromptEditor.d.ts.map +0 -1
- package/dist/types/src/components/PromptEditor/PromptEditor.stories.d.ts +0 -6
- package/dist/types/src/components/PromptEditor/PromptEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/PromptEditor/index.d.ts +0 -2
- package/dist/types/src/components/PromptEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/PromptEditor/prompt-extension.d.ts +0 -4
- package/dist/types/src/components/PromptEditor/prompt-extension.d.ts.map +0 -1
- package/dist/types/src/components/PromptEditor/types.d.ts +0 -18
- package/dist/types/src/components/PromptEditor/types.d.ts.map +0 -1
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts +0 -6
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts.map +0 -1
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts +0 -8
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts.map +0 -1
- package/dist/types/src/components/ServiceRegistry/index.d.ts +0 -2
- package/dist/types/src/components/ServiceRegistry/index.d.ts.map +0 -1
- package/dist/types/src/components/Thread/Thread.d.ts +0 -11
- package/dist/types/src/components/Thread/Thread.d.ts.map +0 -1
- package/dist/types/src/components/Thread/Thread.stories.d.ts +0 -11
- package/dist/types/src/components/Thread/Thread.stories.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ThreadMessage.d.ts +0 -12
- package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +0 -1
- package/dist/types/src/components/Thread/index.d.ts +0 -2
- package/dist/types/src/components/Thread/index.d.ts.map +0 -1
- package/dist/types/src/hooks/email.d.ts +0 -4
- package/dist/types/src/hooks/email.d.ts.map +0 -1
- package/dist/types/src/hooks/index.d.ts +0 -6
- package/dist/types/src/hooks/index.d.ts.map +0 -1
- package/dist/types/src/hooks/invocation-handler.d.ts +0 -5
- package/dist/types/src/hooks/invocation-handler.d.ts.map +0 -1
- package/dist/types/src/hooks/processor.d.ts +0 -70
- package/dist/types/src/hooks/processor.d.ts.map +0 -1
- package/dist/types/src/hooks/processor.test.d.ts +0 -2
- package/dist/types/src/hooks/processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +0 -7
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +0 -1
- package/dist/types/src/hooks/useLocalTriggerManager.d.ts +0 -3
- package/dist/types/src/hooks/useLocalTriggerManager.d.ts.map +0 -1
- package/dist/types/src/hooks/useMessageQueue.d.ts +0 -41
- package/dist/types/src/hooks/useMessageQueue.d.ts.map +0 -1
- package/dist/types/src/hooks/useServices.d.ts +0 -7
- package/dist/types/src/hooks/useServices.d.ts.map +0 -1
- package/dist/types/src/presets.d.ts +0 -9
- package/dist/types/src/presets.d.ts.map +0 -1
- package/dist/types/src/testing/test-services.d.ts +0 -5
- package/dist/types/src/testing/test-services.d.ts.map +0 -1
- package/dist/types/src/tools/function.d.ts +0 -5
- package/dist/types/src/tools/function.d.ts.map +0 -1
- package/dist/types/src/tools/index.d.ts +0 -3
- package/dist/types/src/tools/index.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.d.ts +0 -10
- package/dist/types/src/tools/openapi.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.test.d.ts +0 -2
- package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
- package/dist/types/src/types/index.d.ts +0 -4
- package/dist/types/src/types/index.d.ts.map +0 -1
- package/dist/types/src/types/registry.d.ts +0 -10
- package/dist/types/src/types/registry.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -221
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -18
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/artifacts.stories.tsx +0 -241
- package/src/capabilities/ai-client.ts +0 -19
- package/src/capabilities/app-graph-builder.ts +0 -187
- package/src/capabilities/capabilities.ts +0 -12
- package/src/capabilities/intent-resolver.ts +0 -27
- package/src/components/AmbientChatDialog/AmbientChatDialog.tsx +0 -26
- package/src/components/AmbientChatDialog/index.ts +0 -5
- package/src/components/Box/StatusLine.stories.tsx +0 -52
- package/src/components/Box/StatusLine.tsx +0 -76
- package/src/components/Box/Tabbed.stories.tsx +0 -51
- package/src/components/Box/Tabbed.tsx +0 -89
- package/src/components/Box/ToggleContainer.stories.tsx +0 -110
- package/src/components/Box/ToggleContainer.tsx +0 -108
- package/src/components/Box/index.ts +0 -7
- package/src/components/ChatContainer/ChatContainer.tsx +0 -52
- package/src/components/ChatContainer/index.ts +0 -8
- package/src/components/MarkdownViewer/MarkdownViewer.stories.tsx +0 -56
- package/src/components/MarkdownViewer/MarkdownViewer.tsx +0 -79
- package/src/components/MarkdownViewer/index.ts +0 -5
- package/src/components/Prompt/Prompt.stories.tsx +0 -50
- package/src/components/Prompt/Prompt.tsx +0 -36
- package/src/components/Prompt/index.ts +0 -5
- package/src/components/Prompt/prompt-autocomplete.ts +0 -200
- package/src/components/PromptEditor/PromptEditor.stories.tsx +0 -64
- package/src/components/PromptEditor/PromptEditor.tsx +0 -222
- package/src/components/PromptEditor/index.ts +0 -5
- package/src/components/PromptEditor/prompt-extension.ts +0 -43
- package/src/components/PromptEditor/types.tsx +0 -28
- package/src/components/ServiceRegistry/ServiceRegistry.stories.tsx +0 -49
- package/src/components/ServiceRegistry/ServiceRegistry.tsx +0 -75
- package/src/components/ServiceRegistry/index.ts +0 -5
- package/src/components/Thread/Thread.stories.tsx +0 -197
- package/src/components/Thread/Thread.tsx +0 -156
- package/src/components/Thread/ThreadMessage.tsx +0 -225
- package/src/components/Thread/index.ts +0 -5
- package/src/hooks/email.ts +0 -49
- package/src/hooks/index.ts +0 -10
- package/src/hooks/invocation-handler.ts +0 -109
- package/src/hooks/processor.test.ts +0 -15
- package/src/hooks/processor.ts +0 -210
- package/src/hooks/useChatProcessor.tsx +0 -86
- package/src/hooks/useLocalTriggerManager.ts +0 -82
- package/src/hooks/useMessageQueue.ts +0 -23
- package/src/hooks/useServices.ts +0 -28
- package/src/presets.ts +0 -248
- package/src/testing/test-services.ts +0 -131
- package/src/tools/function.ts +0 -47
- package/src/tools/index.ts +0 -6
- package/src/tools/openapi.test.ts +0 -227
- package/src/tools/openapi.ts +0 -331
- package/src/types/index.ts +0 -7
- package/src/types/registry.ts +0 -26
- package/src/types/schema.ts +0 -132
- package/src/types/types.ts +0 -21
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities, contributes, createIntent, LayoutAction, type PluginsContext } from '@dxos/app-framework';
|
|
6
|
-
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
7
|
-
import { createExtension, type Node, ROOT_ID, toSignal } from '@dxos/plugin-graph';
|
|
8
|
-
import { memoizeQuery } from '@dxos/plugin-space';
|
|
9
|
-
import { getTypename, parseId, SpaceState } from '@dxos/react-client/echo';
|
|
10
|
-
|
|
11
|
-
import { AMBIENT_CHAT_DIALOG, AUTOMATION_PLUGIN } from '../meta';
|
|
12
|
-
|
|
13
|
-
export default (context: PluginsContext) => {
|
|
14
|
-
const resolve = (typename: string) =>
|
|
15
|
-
context.requestCapabilities(Capabilities.Metadata).find(({ id }) => id === typename)?.metadata ?? {};
|
|
16
|
-
|
|
17
|
-
return contributes(Capabilities.AppGraphBuilder, [
|
|
18
|
-
createExtension({
|
|
19
|
-
id: `${AUTOMATION_PLUGIN}/service-registry`,
|
|
20
|
-
resolver: ({ id }) => {
|
|
21
|
-
if (!id.endsWith('~service-registry')) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const type = 'orphan-settings-for-subject';
|
|
26
|
-
const icon = 'ph--plugs--regular';
|
|
27
|
-
|
|
28
|
-
const client = context.requestCapability(ClientCapabilities.Client);
|
|
29
|
-
const [subjectId] = id.split('~');
|
|
30
|
-
const { spaceId } = parseId(subjectId);
|
|
31
|
-
const spaces = toSignal(
|
|
32
|
-
(onChange) => client.spaces.subscribe(() => onChange()).unsubscribe,
|
|
33
|
-
() => client.spaces.get(),
|
|
34
|
-
);
|
|
35
|
-
const space = spaces?.find((space) => space.id === spaceId && space.state.get() === SpaceState.SPACE_READY);
|
|
36
|
-
return {
|
|
37
|
-
id,
|
|
38
|
-
type,
|
|
39
|
-
data: null,
|
|
40
|
-
properties: {
|
|
41
|
-
icon,
|
|
42
|
-
label: ['service registry label', { ns: AUTOMATION_PLUGIN }],
|
|
43
|
-
object: null,
|
|
44
|
-
space,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
}),
|
|
49
|
-
createExtension({
|
|
50
|
-
id: `${AUTOMATION_PLUGIN}/ambient-chat`,
|
|
51
|
-
filter: (node): node is Node<null> => node.id === ROOT_ID,
|
|
52
|
-
actions: () => [
|
|
53
|
-
{
|
|
54
|
-
id: `${LayoutAction.UpdateDialog._tag}/ambient-chat/open`,
|
|
55
|
-
data: async () => {
|
|
56
|
-
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
57
|
-
await dispatch(
|
|
58
|
-
createIntent(LayoutAction.UpdateDialog, {
|
|
59
|
-
part: 'dialog',
|
|
60
|
-
subject: AMBIENT_CHAT_DIALOG,
|
|
61
|
-
options: {
|
|
62
|
-
state: true,
|
|
63
|
-
blockAlign: 'end',
|
|
64
|
-
},
|
|
65
|
-
}),
|
|
66
|
-
);
|
|
67
|
-
},
|
|
68
|
-
properties: {
|
|
69
|
-
label: ['open ambient chat label', { ns: AUTOMATION_PLUGIN }],
|
|
70
|
-
icon: 'ph--chat-centered-text--regular',
|
|
71
|
-
disposition: 'pin-end',
|
|
72
|
-
keyBinding: {
|
|
73
|
-
macos: 'shift+meta+k',
|
|
74
|
-
windows: 'shift+ctrl+k',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
}),
|
|
80
|
-
createExtension({
|
|
81
|
-
id: `${AUTOMATION_PLUGIN}/automation-for-subject`,
|
|
82
|
-
resolver: ({ id }) => {
|
|
83
|
-
if (!id.endsWith('~automation')) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const type = 'orphan-settings-for-subject';
|
|
88
|
-
const icon = 'ph--magic-wand--regular';
|
|
89
|
-
|
|
90
|
-
const client = context.requestCapability(ClientCapabilities.Client);
|
|
91
|
-
const [subjectId] = id.split('~');
|
|
92
|
-
const { spaceId, objectId } = parseId(subjectId);
|
|
93
|
-
const spaces = toSignal(
|
|
94
|
-
(onChange) => client.spaces.subscribe(() => onChange()).unsubscribe,
|
|
95
|
-
() => client.spaces.get(),
|
|
96
|
-
);
|
|
97
|
-
const space = spaces?.find((space) => space.id === spaceId && space.state.get() === SpaceState.SPACE_READY);
|
|
98
|
-
if (!objectId) {
|
|
99
|
-
// TODO(burdon): Ref SPACE_PLUGIN ns.
|
|
100
|
-
const label = space
|
|
101
|
-
? space.properties.name || ['unnamed space label', { ns: AUTOMATION_PLUGIN }]
|
|
102
|
-
: ['unnamed object settings label', { ns: AUTOMATION_PLUGIN }];
|
|
103
|
-
|
|
104
|
-
// TODO(wittjosiah): Support comments for arbitrary subjects.
|
|
105
|
-
// This is to ensure that the comments panel is not stuck on an old object.
|
|
106
|
-
return {
|
|
107
|
-
id,
|
|
108
|
-
type,
|
|
109
|
-
data: null,
|
|
110
|
-
properties: {
|
|
111
|
-
icon,
|
|
112
|
-
label,
|
|
113
|
-
showResolvedThreads: false,
|
|
114
|
-
object: null,
|
|
115
|
-
space,
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const [object] = memoizeQuery(space, { id: objectId });
|
|
121
|
-
if (!object || !subjectId) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const meta = resolve(getTypename(object) ?? '');
|
|
126
|
-
const label = meta.label?.(object) ||
|
|
127
|
-
object.name ||
|
|
128
|
-
meta.placeholder || ['unnamed object settings label', { ns: AUTOMATION_PLUGIN }];
|
|
129
|
-
|
|
130
|
-
return {
|
|
131
|
-
id,
|
|
132
|
-
type,
|
|
133
|
-
data: null,
|
|
134
|
-
properties: {
|
|
135
|
-
icon,
|
|
136
|
-
label,
|
|
137
|
-
object,
|
|
138
|
-
},
|
|
139
|
-
};
|
|
140
|
-
},
|
|
141
|
-
}),
|
|
142
|
-
createExtension({
|
|
143
|
-
id: `${AUTOMATION_PLUGIN}/assistant-for-subject`,
|
|
144
|
-
resolver: ({ id }) => {
|
|
145
|
-
if (!id.endsWith('~assistant')) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const client = context.requestCapability(ClientCapabilities.Client);
|
|
150
|
-
const [subjectId] = id.split('~');
|
|
151
|
-
const { spaceId, objectId } = parseId(subjectId);
|
|
152
|
-
const spaces = toSignal(
|
|
153
|
-
(onChange) => client.spaces.subscribe(() => onChange()).unsubscribe,
|
|
154
|
-
() => client.spaces.get(),
|
|
155
|
-
);
|
|
156
|
-
const space = spaces?.find((space) => space.id === spaceId && space.state.get() === SpaceState.SPACE_READY);
|
|
157
|
-
if (!objectId) {
|
|
158
|
-
// TODO(wittjosiah): Support assistant for arbitrary subjects.
|
|
159
|
-
// This is to ensure that the assistant panel is not stuck on an old object.
|
|
160
|
-
return {
|
|
161
|
-
id,
|
|
162
|
-
type: 'orphan-automation-for-subject',
|
|
163
|
-
data: null,
|
|
164
|
-
properties: {
|
|
165
|
-
icon: 'ph--atom--regular',
|
|
166
|
-
label: ['assistant panel label', { ns: AUTOMATION_PLUGIN }],
|
|
167
|
-
object: null,
|
|
168
|
-
space,
|
|
169
|
-
},
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
const [object] = memoizeQuery(space, { id: objectId });
|
|
174
|
-
return {
|
|
175
|
-
id,
|
|
176
|
-
type: 'orphan-automation-for-subject',
|
|
177
|
-
data: null,
|
|
178
|
-
properties: {
|
|
179
|
-
icon: 'ph--atom--regular',
|
|
180
|
-
label: ['assistant panel label', { ns: AUTOMATION_PLUGIN }],
|
|
181
|
-
object,
|
|
182
|
-
},
|
|
183
|
-
};
|
|
184
|
-
},
|
|
185
|
-
}),
|
|
186
|
-
]);
|
|
187
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { defineCapability } from '@dxos/app-framework';
|
|
6
|
-
import { type AIServiceClientImpl } from '@dxos/assistant';
|
|
7
|
-
|
|
8
|
-
import { AUTOMATION_PLUGIN } from '../meta';
|
|
9
|
-
|
|
10
|
-
export namespace AutomationCapabilities {
|
|
11
|
-
export const AiClient = defineCapability<AIServiceClientImpl>(`${AUTOMATION_PLUGIN}/capability/ai-client`);
|
|
12
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities, contributes, createResolver } from '@dxos/app-framework';
|
|
6
|
-
import { ObjectId } from '@dxos/echo-schema';
|
|
7
|
-
import { create, makeRef } from '@dxos/live-object';
|
|
8
|
-
|
|
9
|
-
import { AutomationAction, AIChatType } from '../types';
|
|
10
|
-
|
|
11
|
-
export default () =>
|
|
12
|
-
contributes(
|
|
13
|
-
Capabilities.IntentResolver,
|
|
14
|
-
createResolver({
|
|
15
|
-
intent: AutomationAction.Create,
|
|
16
|
-
resolve: ({ name }) => ({
|
|
17
|
-
data: {
|
|
18
|
-
object: create(AIChatType, {
|
|
19
|
-
name,
|
|
20
|
-
// TODO(burdon): ???
|
|
21
|
-
// new DXN(DXN.kind.QUEUE, [QueueSubspaceTags.DATA, SpaceId.random(), ObjectId.random()]).toString(),
|
|
22
|
-
queue: makeRef({ id: ObjectId.random() }),
|
|
23
|
-
}),
|
|
24
|
-
},
|
|
25
|
-
}),
|
|
26
|
-
}),
|
|
27
|
-
);
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { Dialog, Icon, useTranslation } from '@dxos/react-ui';
|
|
8
|
-
|
|
9
|
-
import { AUTOMATION_PLUGIN } from '../../meta';
|
|
10
|
-
|
|
11
|
-
const preventDefault = (event: Event) => event.preventDefault();
|
|
12
|
-
|
|
13
|
-
export const AmbientChatDialog = () => {
|
|
14
|
-
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
15
|
-
return (
|
|
16
|
-
<div role='none' className='dx-dialog__overlay bg-transparent pointer-events-none' data-block-align='end'>
|
|
17
|
-
<Dialog.Content onInteractOutside={preventDefault} classNames='pointer-events-auto' inOverlayLayout>
|
|
18
|
-
<Dialog.Title classNames='sr-only'>{t('ambient chat dialog title')}</Dialog.Title>
|
|
19
|
-
<Dialog.Close>
|
|
20
|
-
<Icon icon='ph--x--regular' size={4} />
|
|
21
|
-
</Dialog.Close>
|
|
22
|
-
<h1>Hello</h1>
|
|
23
|
-
</Dialog.Content>
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
|
-
import React, { useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { faker } from '@dxos/random';
|
|
11
|
-
import { Button } from '@dxos/react-ui';
|
|
12
|
-
import { withLayout, withTheme, withSignals } from '@dxos/storybook-utils';
|
|
13
|
-
|
|
14
|
-
import { StatusLine } from './StatusLine';
|
|
15
|
-
|
|
16
|
-
const meta: Meta<typeof StatusLine> = {
|
|
17
|
-
title: 'plugins/plugin-automation/StatusLine',
|
|
18
|
-
component: StatusLine,
|
|
19
|
-
decorators: [withSignals, withTheme, withLayout()],
|
|
20
|
-
parameters: {
|
|
21
|
-
layout: 'centered',
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default meta;
|
|
26
|
-
|
|
27
|
-
type Story = StoryObj<typeof StatusLine>;
|
|
28
|
-
|
|
29
|
-
export const Default: Story = {
|
|
30
|
-
args: {
|
|
31
|
-
classNames: 'w-96 px-2',
|
|
32
|
-
lines: Array.from({ length: 5 }, (_, i) => `${i}. ${faker.lorem.paragraph()}`),
|
|
33
|
-
autoAdvance: true,
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const Demo: Story = {
|
|
38
|
-
render: () => {
|
|
39
|
-
const [lines, setLines] = useState<string[]>([]);
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<div className='flex flex-col w-96 gap-4'>
|
|
43
|
-
<StatusLine lines={lines} autoAdvance advance={500} />
|
|
44
|
-
<div>
|
|
45
|
-
<Button onClick={() => setLines((lines) => [...lines, `${lines.length + 1}. ${faker.lorem.paragraph()}`])}>
|
|
46
|
-
Add
|
|
47
|
-
</Button>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
);
|
|
51
|
-
},
|
|
52
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
8
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
9
|
-
|
|
10
|
-
const emptyLines: string[] = [];
|
|
11
|
-
|
|
12
|
-
export type StatusLineProps = ThemedClassName<{
|
|
13
|
-
line?: number;
|
|
14
|
-
lines?: string[];
|
|
15
|
-
transition?: number;
|
|
16
|
-
advance?: number;
|
|
17
|
-
autoAdvance?: boolean;
|
|
18
|
-
}>;
|
|
19
|
-
|
|
20
|
-
export const StatusLine = ({
|
|
21
|
-
classNames,
|
|
22
|
-
line = -1,
|
|
23
|
-
lines = emptyLines,
|
|
24
|
-
transition = 300,
|
|
25
|
-
advance = 1_000,
|
|
26
|
-
autoAdvance,
|
|
27
|
-
}: StatusLineProps) => {
|
|
28
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
29
|
-
const [currentLine, setCurrentLine] = useState(line);
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
setCurrentLine(line);
|
|
32
|
-
}, [line]);
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (!autoAdvance) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const next = () => {
|
|
40
|
-
setCurrentLine((prev) => {
|
|
41
|
-
if (prev >= lines.length - 1) {
|
|
42
|
-
clearInterval(interval);
|
|
43
|
-
return prev;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return prev + 1;
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
next();
|
|
51
|
-
const interval = setInterval(next, advance);
|
|
52
|
-
|
|
53
|
-
return () => clearInterval(interval);
|
|
54
|
-
}, [lines.length, autoAdvance, advance]);
|
|
55
|
-
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
if (containerRef.current) {
|
|
58
|
-
containerRef.current.style.transition = `transform ${transition}ms ease-in-out`;
|
|
59
|
-
containerRef.current.style.transform = `translateY(-${currentLine * 24}px)`;
|
|
60
|
-
}
|
|
61
|
-
}, [currentLine]);
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<div className={mx('relative h-[24px] overflow-hidden', classNames)}>
|
|
65
|
-
<div ref={containerRef} className='h-[24px]'>
|
|
66
|
-
<div className='flex flex-col'>
|
|
67
|
-
{lines.map((line, i) => (
|
|
68
|
-
<div key={i} className={mx('flex h-[24px] items-center')}>
|
|
69
|
-
<span className='truncate'>{line}</span>
|
|
70
|
-
</div>
|
|
71
|
-
))}
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
);
|
|
76
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
|
-
import React, { useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { faker } from '@dxos/random';
|
|
11
|
-
import { withLayout, withTheme, withSignals } from '@dxos/storybook-utils';
|
|
12
|
-
|
|
13
|
-
import { Tabs } from './Tabbed';
|
|
14
|
-
import { ToggleContainer } from './ToggleContainer';
|
|
15
|
-
|
|
16
|
-
const content = Array.from({ length: 4 }, (_, i) => ({
|
|
17
|
-
title: faker.lorem.paragraph(),
|
|
18
|
-
content: faker.lorem.paragraphs(3),
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
const meta: Meta<typeof Tabs> = {
|
|
22
|
-
title: 'plugins/plugin-automation/Tabbed',
|
|
23
|
-
component: Tabs,
|
|
24
|
-
decorators: [withSignals, withTheme, withLayout({ fullscreen: true, classNames: 'justify-center' })],
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default meta;
|
|
28
|
-
|
|
29
|
-
type Story = StoryObj<typeof Tabs>;
|
|
30
|
-
|
|
31
|
-
export const Default: Story = {
|
|
32
|
-
render: () => {
|
|
33
|
-
const [selected, setSelected] = useState(0);
|
|
34
|
-
return (
|
|
35
|
-
<div className='flex flex-col w-[500px] p-4 bg-attention'>
|
|
36
|
-
<ToggleContainer
|
|
37
|
-
open
|
|
38
|
-
title={content[selected].title}
|
|
39
|
-
classNames='p-1 rounded-lg bg-baseSurface border border-neutral-500'
|
|
40
|
-
>
|
|
41
|
-
<div className='flex w-full overflow-hidden'>
|
|
42
|
-
<Tabs length={content.length} selected={selected} onSelect={setSelected} />
|
|
43
|
-
<div className='flex-1 pis-2 pie-2 overflow-y-auto'>
|
|
44
|
-
<div>{content[selected].content}</div>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</ToggleContainer>
|
|
48
|
-
</div>
|
|
49
|
-
);
|
|
50
|
-
},
|
|
51
|
-
};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { forwardRef } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Icon, type ThemedClassName } from '@dxos/react-ui';
|
|
8
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
9
|
-
|
|
10
|
-
const numbers = [
|
|
11
|
-
{ regular: 'ph--number-circle-zero--thin', active: 'ph--number-circle-zero--duotone' },
|
|
12
|
-
{ regular: 'ph--number-circle-one--thin', active: 'ph--number-circle-one--duotone' },
|
|
13
|
-
{ regular: 'ph--number-circle-two--thin', active: 'ph--number-circle-two--duotone' },
|
|
14
|
-
{ regular: 'ph--number-circle-three--thin', active: 'ph--number-circle-three--duotone' },
|
|
15
|
-
{ regular: 'ph--number-circle-four--thin', active: 'ph--number-circle-four--duotone' },
|
|
16
|
-
{ regular: 'ph--number-circle-five--thin', active: 'ph--number-circle-five--duotone' },
|
|
17
|
-
{ regular: 'ph--number-circle-six--thin', active: 'ph--number-circle-six--duotone' },
|
|
18
|
-
{ regular: 'ph--number-circle-seven--thin', active: 'ph--number-circle-seven--duotone' },
|
|
19
|
-
{ regular: 'ph--number-circle-eight--thin', active: 'ph--number-circle-eight--duotone' },
|
|
20
|
-
{ regular: 'ph--number-circle-nine--thin', active: 'ph--number-circle-nine--duotone' },
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
export type TabsProps = ThemedClassName<{
|
|
24
|
-
length: number;
|
|
25
|
-
selected?: number;
|
|
26
|
-
onSelect?: (index: number) => void;
|
|
27
|
-
}>;
|
|
28
|
-
|
|
29
|
-
export const Tabs = forwardRef<HTMLDivElement, TabsProps>(
|
|
30
|
-
({ classNames, length, selected = 0, onSelect }, forwardedRef) => {
|
|
31
|
-
return (
|
|
32
|
-
<div
|
|
33
|
-
ref={forwardedRef}
|
|
34
|
-
className={mx('flex flex-col overflow-hidden outline-none', classNames)}
|
|
35
|
-
tabIndex={-1}
|
|
36
|
-
onKeyDown={(ev) => {
|
|
37
|
-
// TODO(burdon): Focus when open Toggle.
|
|
38
|
-
switch (ev.key) {
|
|
39
|
-
case 'ArrowDown':
|
|
40
|
-
case 'ArrowRight': {
|
|
41
|
-
ev.preventDefault();
|
|
42
|
-
ev.stopPropagation();
|
|
43
|
-
if (selected < length - 1) {
|
|
44
|
-
onSelect?.(selected + 1);
|
|
45
|
-
}
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
case 'ArrowUp':
|
|
49
|
-
case 'ArrowLeft': {
|
|
50
|
-
ev.preventDefault();
|
|
51
|
-
ev.stopPropagation();
|
|
52
|
-
if (selected > 0) {
|
|
53
|
-
onSelect?.(selected - 1);
|
|
54
|
-
}
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
case 'Enter': {
|
|
59
|
-
ev.preventDefault();
|
|
60
|
-
ev.stopPropagation();
|
|
61
|
-
onSelect?.(selected);
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}}
|
|
66
|
-
>
|
|
67
|
-
{Array.from({ length }).map((_, i) => {
|
|
68
|
-
const icon = numbers[i + 1];
|
|
69
|
-
return (
|
|
70
|
-
<div
|
|
71
|
-
key={i}
|
|
72
|
-
className={mx(
|
|
73
|
-
'relative flex w-[24px] h-[28px] justify-center cursor-pointer text-subdued',
|
|
74
|
-
selected === i && '!text-cyan-550 !dark:text-cyan-300',
|
|
75
|
-
)}
|
|
76
|
-
>
|
|
77
|
-
{i < length - 1 && <div className='absolute left-[11.5px] top-[21px] w-[1px] h-[10px] bg-neutral-400' />}
|
|
78
|
-
<Icon
|
|
79
|
-
icon={selected === i ? icon.regular : icon.regular}
|
|
80
|
-
classNames='z-10 !p-0 !w-[24px] !h-[24px] outline-none'
|
|
81
|
-
onClick={() => onSelect?.(i)}
|
|
82
|
-
/>
|
|
83
|
-
</div>
|
|
84
|
-
);
|
|
85
|
-
})}
|
|
86
|
-
</div>
|
|
87
|
-
);
|
|
88
|
-
},
|
|
89
|
-
);
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { computed, type ReadonlySignal, signal } from '@preact/signals-core';
|
|
8
|
-
import { type StoryObj, type Meta } from '@storybook/react';
|
|
9
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
10
|
-
|
|
11
|
-
import { faker } from '@dxos/random';
|
|
12
|
-
import { Icon, Input, Toolbar } from '@dxos/react-ui';
|
|
13
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
14
|
-
import { withLayout, withTheme, withSignals } from '@dxos/storybook-utils';
|
|
15
|
-
|
|
16
|
-
import { ToggleContainer, type ToggleContainerProps } from './ToggleContainer';
|
|
17
|
-
import { MarkdownViewer } from '../MarkdownViewer';
|
|
18
|
-
|
|
19
|
-
class Generator {
|
|
20
|
-
private readonly _current = signal<string>(faker.lorem.sentence(5));
|
|
21
|
-
private readonly _lines = signal<string[]>([]);
|
|
22
|
-
private _running: NodeJS.Timeout | undefined;
|
|
23
|
-
|
|
24
|
-
readonly count = computed(() => this._lines.value.length);
|
|
25
|
-
readonly text: ReadonlySignal<string[]> = computed(() => [...this._lines.value, this._current.value]);
|
|
26
|
-
|
|
27
|
-
start() {
|
|
28
|
-
this.stop();
|
|
29
|
-
this._running = setInterval(() => {
|
|
30
|
-
if (this._current.value.length > 0) {
|
|
31
|
-
this._current.value += ' ';
|
|
32
|
-
}
|
|
33
|
-
this._current.value += faker.lorem.words(Math.ceil(Math.random() * 2));
|
|
34
|
-
if (Math.random() > 0.95) {
|
|
35
|
-
this._lines.value = [...this._lines.value, this._current.value + '.'];
|
|
36
|
-
this._current.value = '';
|
|
37
|
-
}
|
|
38
|
-
}, 100);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
stop() {
|
|
42
|
-
if (this._running) {
|
|
43
|
-
clearInterval(this._running);
|
|
44
|
-
this._running = undefined;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const Render = ({ shrinkX, ...props }: ToggleContainerProps) => {
|
|
50
|
-
const generator = useMemo(() => new Generator(), []);
|
|
51
|
-
const [running, setRunning] = useState(false);
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
if (running) {
|
|
54
|
-
generator.start();
|
|
55
|
-
} else {
|
|
56
|
-
generator.stop();
|
|
57
|
-
}
|
|
58
|
-
}, [running]);
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<div className='flex flex-col w-[500px]'>
|
|
62
|
-
<Toolbar.Root classNames='p-4'>
|
|
63
|
-
<Input.Root>
|
|
64
|
-
<Input.Switch checked={running} onCheckedChange={(checked) => setRunning(checked)} />
|
|
65
|
-
</Input.Root>
|
|
66
|
-
<div className='grow' />
|
|
67
|
-
<div>{generator.count.value}</div>
|
|
68
|
-
</Toolbar.Root>
|
|
69
|
-
<div className='flex p-4'>
|
|
70
|
-
<div className={mx('border border-border rounded-md p-2', !shrinkX && 'w-full')}>
|
|
71
|
-
<ToggleContainer
|
|
72
|
-
{...props}
|
|
73
|
-
shrinkX={shrinkX}
|
|
74
|
-
icon={
|
|
75
|
-
running ? (
|
|
76
|
-
<Icon icon={'ph--circle-notch--regular'} classNames='text-subdued ml-2 animate-spin' size={4} />
|
|
77
|
-
) : undefined
|
|
78
|
-
}
|
|
79
|
-
>
|
|
80
|
-
<MarkdownViewer classNames='text-sm' content={generator.text.value.join('\n\n')} />
|
|
81
|
-
</ToggleContainer>
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
</div>
|
|
85
|
-
);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const meta: Meta<typeof ToggleContainer> = {
|
|
89
|
-
title: 'plugins/plugin-automation/ToggleContainer',
|
|
90
|
-
component: ToggleContainer,
|
|
91
|
-
render: Render,
|
|
92
|
-
decorators: [withSignals, withTheme, withLayout({ fullscreen: true, classNames: 'justify-center bg-baseSurface' })],
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
export default meta;
|
|
96
|
-
|
|
97
|
-
type Story = StoryObj<typeof ToggleContainer>;
|
|
98
|
-
|
|
99
|
-
export const Default: Story = {
|
|
100
|
-
args: {
|
|
101
|
-
title: 'Markdown',
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export const Shrink: Story = {
|
|
106
|
-
args: {
|
|
107
|
-
title: 'Markdown',
|
|
108
|
-
shrinkX: true,
|
|
109
|
-
},
|
|
110
|
-
};
|